path
stringlengths 5
304
| repo_name
stringlengths 6
79
| content
stringlengths 27
1.05M
|
---|---|---|
ajax/libs/knockout/3.3.0/knockout-debug.js | billybonz1/cdnjs | /*!
* Knockout JavaScript library v3.3.0
* (c) Steven Sanderson - http://knockoutjs.com/
* License: MIT (http://www.opensource.org/licenses/mit-license.php)
*/
(function(){
var DEBUG=true;
(function(undefined){
// (0, eval)('this') is a robust way of getting a reference to the global object
// For details, see http://stackoverflow.com/questions/14119988/return-this-0-evalthis/14120023#14120023
var window = this || (0, eval)('this'),
document = window['document'],
navigator = window['navigator'],
jQueryInstance = window["jQuery"],
JSON = window["JSON"];
(function(factory) {
// Support three module loading scenarios
if (typeof define === 'function' && define['amd']) {
// [1] AMD anonymous module
define(['exports', 'require'], factory);
} else if (typeof require === 'function' && typeof exports === 'object' && typeof module === 'object') {
// [2] CommonJS/Node.js
factory(module['exports'] || exports); // module.exports is for Node.js
} else {
// [3] No module loader (plain <script> tag) - put directly in global namespace
factory(window['ko'] = {});
}
}(function(koExports, amdRequire){
// Internally, all KO objects are attached to koExports (even the non-exported ones whose names will be minified by the closure compiler).
// In the future, the following "ko" variable may be made distinct from "koExports" so that private objects are not externally reachable.
var ko = typeof koExports !== 'undefined' ? koExports : {};
// Google Closure Compiler helpers (used only to make the minified file smaller)
ko.exportSymbol = function(koPath, object) {
var tokens = koPath.split(".");
// In the future, "ko" may become distinct from "koExports" (so that non-exported objects are not reachable)
// At that point, "target" would be set to: (typeof koExports !== "undefined" ? koExports : ko)
var target = ko;
for (var i = 0; i < tokens.length - 1; i++)
target = target[tokens[i]];
target[tokens[tokens.length - 1]] = object;
};
ko.exportProperty = function(owner, publicName, object) {
owner[publicName] = object;
};
ko.version = "3.3.0";
ko.exportSymbol('version', ko.version);
ko.utils = (function () {
function objectForEach(obj, action) {
for (var prop in obj) {
if (obj.hasOwnProperty(prop)) {
action(prop, obj[prop]);
}
}
}
function extend(target, source) {
if (source) {
for(var prop in source) {
if(source.hasOwnProperty(prop)) {
target[prop] = source[prop];
}
}
}
return target;
}
function setPrototypeOf(obj, proto) {
obj.__proto__ = proto;
return obj;
}
var canSetPrototype = ({ __proto__: [] } instanceof Array);
// Represent the known event types in a compact way, then at runtime transform it into a hash with event name as key (for fast lookup)
var knownEvents = {}, knownEventTypesByEventName = {};
var keyEventTypeName = (navigator && /Firefox\/2/i.test(navigator.userAgent)) ? 'KeyboardEvent' : 'UIEvents';
knownEvents[keyEventTypeName] = ['keyup', 'keydown', 'keypress'];
knownEvents['MouseEvents'] = ['click', 'dblclick', 'mousedown', 'mouseup', 'mousemove', 'mouseover', 'mouseout', 'mouseenter', 'mouseleave'];
objectForEach(knownEvents, function(eventType, knownEventsForType) {
if (knownEventsForType.length) {
for (var i = 0, j = knownEventsForType.length; i < j; i++)
knownEventTypesByEventName[knownEventsForType[i]] = eventType;
}
});
var eventsThatMustBeRegisteredUsingAttachEvent = { 'propertychange': true }; // Workaround for an IE9 issue - https://github.com/SteveSanderson/knockout/issues/406
// Detect IE versions for bug workarounds (uses IE conditionals, not UA string, for robustness)
// Note that, since IE 10 does not support conditional comments, the following logic only detects IE < 10.
// Currently this is by design, since IE 10+ behaves correctly when treated as a standard browser.
// If there is a future need to detect specific versions of IE10+, we will amend this.
var ieVersion = document && (function() {
var version = 3, div = document.createElement('div'), iElems = div.getElementsByTagName('i');
// Keep constructing conditional HTML blocks until we hit one that resolves to an empty fragment
while (
div.innerHTML = '<!--[if gt IE ' + (++version) + ']><i></i><![endif]-->',
iElems[0]
) {}
return version > 4 ? version : undefined;
}());
var isIe6 = ieVersion === 6,
isIe7 = ieVersion === 7;
function isClickOnCheckableElement(element, eventType) {
if ((ko.utils.tagNameLower(element) !== "input") || !element.type) return false;
if (eventType.toLowerCase() != "click") return false;
var inputType = element.type;
return (inputType == "checkbox") || (inputType == "radio");
}
// For details on the pattern for changing node classes
// see: https://github.com/knockout/knockout/issues/1597
var cssClassNameRegex = /\S+/g;
function toggleDomNodeCssClass(node, classNames, shouldHaveClass) {
var addOrRemoveFn;
if (classNames) {
if (typeof node.classList === 'object') {
addOrRemoveFn = node.classList[shouldHaveClass ? 'add' : 'remove'];
ko.utils.arrayForEach(classNames.match(cssClassNameRegex), function(className) {
addOrRemoveFn.call(node.classList, className);
});
} else if (typeof node.className['baseVal'] === 'string') {
// SVG tag .classNames is an SVGAnimatedString instance
toggleObjectClassPropertyString(node.className, 'baseVal', classNames, shouldHaveClass);
} else {
// node.className ought to be a string.
toggleObjectClassPropertyString(node, 'className', classNames, shouldHaveClass);
}
}
}
function toggleObjectClassPropertyString(obj, prop, classNames, shouldHaveClass) {
// obj/prop is either a node/'className' or a SVGAnimatedString/'baseVal'.
var currentClassNames = obj[prop].match(cssClassNameRegex) || [];
ko.utils.arrayForEach(classNames.match(cssClassNameRegex), function(className) {
ko.utils.addOrRemoveItem(currentClassNames, className, shouldHaveClass);
});
obj[prop] = currentClassNames.join(" ");
}
return {
fieldsIncludedWithJsonPost: ['authenticity_token', /^__RequestVerificationToken(_.*)?$/],
arrayForEach: function (array, action) {
for (var i = 0, j = array.length; i < j; i++)
action(array[i], i);
},
arrayIndexOf: function (array, item) {
if (typeof Array.prototype.indexOf == "function")
return Array.prototype.indexOf.call(array, item);
for (var i = 0, j = array.length; i < j; i++)
if (array[i] === item)
return i;
return -1;
},
arrayFirst: function (array, predicate, predicateOwner) {
for (var i = 0, j = array.length; i < j; i++)
if (predicate.call(predicateOwner, array[i], i))
return array[i];
return null;
},
arrayRemoveItem: function (array, itemToRemove) {
var index = ko.utils.arrayIndexOf(array, itemToRemove);
if (index > 0) {
array.splice(index, 1);
}
else if (index === 0) {
array.shift();
}
},
arrayGetDistinctValues: function (array) {
array = array || [];
var result = [];
for (var i = 0, j = array.length; i < j; i++) {
if (ko.utils.arrayIndexOf(result, array[i]) < 0)
result.push(array[i]);
}
return result;
},
arrayMap: function (array, mapping) {
array = array || [];
var result = [];
for (var i = 0, j = array.length; i < j; i++)
result.push(mapping(array[i], i));
return result;
},
arrayFilter: function (array, predicate) {
array = array || [];
var result = [];
for (var i = 0, j = array.length; i < j; i++)
if (predicate(array[i], i))
result.push(array[i]);
return result;
},
arrayPushAll: function (array, valuesToPush) {
if (valuesToPush instanceof Array)
array.push.apply(array, valuesToPush);
else
for (var i = 0, j = valuesToPush.length; i < j; i++)
array.push(valuesToPush[i]);
return array;
},
addOrRemoveItem: function(array, value, included) {
var existingEntryIndex = ko.utils.arrayIndexOf(ko.utils.peekObservable(array), value);
if (existingEntryIndex < 0) {
if (included)
array.push(value);
} else {
if (!included)
array.splice(existingEntryIndex, 1);
}
},
canSetPrototype: canSetPrototype,
extend: extend,
setPrototypeOf: setPrototypeOf,
setPrototypeOfOrExtend: canSetPrototype ? setPrototypeOf : extend,
objectForEach: objectForEach,
objectMap: function(source, mapping) {
if (!source)
return source;
var target = {};
for (var prop in source) {
if (source.hasOwnProperty(prop)) {
target[prop] = mapping(source[prop], prop, source);
}
}
return target;
},
emptyDomNode: function (domNode) {
while (domNode.firstChild) {
ko.removeNode(domNode.firstChild);
}
},
moveCleanedNodesToContainerElement: function(nodes) {
// Ensure it's a real array, as we're about to reparent the nodes and
// we don't want the underlying collection to change while we're doing that.
var nodesArray = ko.utils.makeArray(nodes);
var templateDocument = (nodesArray[0] && nodesArray[0].ownerDocument) || document;
var container = templateDocument.createElement('div');
for (var i = 0, j = nodesArray.length; i < j; i++) {
container.appendChild(ko.cleanNode(nodesArray[i]));
}
return container;
},
cloneNodes: function (nodesArray, shouldCleanNodes) {
for (var i = 0, j = nodesArray.length, newNodesArray = []; i < j; i++) {
var clonedNode = nodesArray[i].cloneNode(true);
newNodesArray.push(shouldCleanNodes ? ko.cleanNode(clonedNode) : clonedNode);
}
return newNodesArray;
},
setDomNodeChildren: function (domNode, childNodes) {
ko.utils.emptyDomNode(domNode);
if (childNodes) {
for (var i = 0, j = childNodes.length; i < j; i++)
domNode.appendChild(childNodes[i]);
}
},
replaceDomNodes: function (nodeToReplaceOrNodeArray, newNodesArray) {
var nodesToReplaceArray = nodeToReplaceOrNodeArray.nodeType ? [nodeToReplaceOrNodeArray] : nodeToReplaceOrNodeArray;
if (nodesToReplaceArray.length > 0) {
var insertionPoint = nodesToReplaceArray[0];
var parent = insertionPoint.parentNode;
for (var i = 0, j = newNodesArray.length; i < j; i++)
parent.insertBefore(newNodesArray[i], insertionPoint);
for (var i = 0, j = nodesToReplaceArray.length; i < j; i++) {
ko.removeNode(nodesToReplaceArray[i]);
}
}
},
fixUpContinuousNodeArray: function(continuousNodeArray, parentNode) {
// Before acting on a set of nodes that were previously outputted by a template function, we have to reconcile
// them against what is in the DOM right now. It may be that some of the nodes have already been removed, or that
// new nodes might have been inserted in the middle, for example by a binding. Also, there may previously have been
// leading comment nodes (created by rewritten string-based templates) that have since been removed during binding.
// So, this function translates the old "map" output array into its best guess of the set of current DOM nodes.
//
// Rules:
// [A] Any leading nodes that have been removed should be ignored
// These most likely correspond to memoization nodes that were already removed during binding
// See https://github.com/SteveSanderson/knockout/pull/440
// [B] We want to output a continuous series of nodes. So, ignore any nodes that have already been removed,
// and include any nodes that have been inserted among the previous collection
if (continuousNodeArray.length) {
// The parent node can be a virtual element; so get the real parent node
parentNode = (parentNode.nodeType === 8 && parentNode.parentNode) || parentNode;
// Rule [A]
while (continuousNodeArray.length && continuousNodeArray[0].parentNode !== parentNode)
continuousNodeArray.splice(0, 1);
// Rule [B]
if (continuousNodeArray.length > 1) {
var current = continuousNodeArray[0], last = continuousNodeArray[continuousNodeArray.length - 1];
// Replace with the actual new continuous node set
continuousNodeArray.length = 0;
while (current !== last) {
continuousNodeArray.push(current);
current = current.nextSibling;
if (!current) // Won't happen, except if the developer has manually removed some DOM elements (then we're in an undefined scenario)
return;
}
continuousNodeArray.push(last);
}
}
return continuousNodeArray;
},
setOptionNodeSelectionState: function (optionNode, isSelected) {
// IE6 sometimes throws "unknown error" if you try to write to .selected directly, whereas Firefox struggles with setAttribute. Pick one based on browser.
if (ieVersion < 7)
optionNode.setAttribute("selected", isSelected);
else
optionNode.selected = isSelected;
},
stringTrim: function (string) {
return string === null || string === undefined ? '' :
string.trim ?
string.trim() :
string.toString().replace(/^[\s\xa0]+|[\s\xa0]+$/g, '');
},
stringStartsWith: function (string, startsWith) {
string = string || "";
if (startsWith.length > string.length)
return false;
return string.substring(0, startsWith.length) === startsWith;
},
domNodeIsContainedBy: function (node, containedByNode) {
if (node === containedByNode)
return true;
if (node.nodeType === 11)
return false; // Fixes issue #1162 - can't use node.contains for document fragments on IE8
if (containedByNode.contains)
return containedByNode.contains(node.nodeType === 3 ? node.parentNode : node);
if (containedByNode.compareDocumentPosition)
return (containedByNode.compareDocumentPosition(node) & 16) == 16;
while (node && node != containedByNode) {
node = node.parentNode;
}
return !!node;
},
domNodeIsAttachedToDocument: function (node) {
return ko.utils.domNodeIsContainedBy(node, node.ownerDocument.documentElement);
},
anyDomNodeIsAttachedToDocument: function(nodes) {
return !!ko.utils.arrayFirst(nodes, ko.utils.domNodeIsAttachedToDocument);
},
tagNameLower: function(element) {
// For HTML elements, tagName will always be upper case; for XHTML elements, it'll be lower case.
// Possible future optimization: If we know it's an element from an XHTML document (not HTML),
// we don't need to do the .toLowerCase() as it will always be lower case anyway.
return element && element.tagName && element.tagName.toLowerCase();
},
registerEventHandler: function (element, eventType, handler) {
var mustUseAttachEvent = ieVersion && eventsThatMustBeRegisteredUsingAttachEvent[eventType];
if (!mustUseAttachEvent && jQueryInstance) {
jQueryInstance(element)['bind'](eventType, handler);
} else if (!mustUseAttachEvent && typeof element.addEventListener == "function")
element.addEventListener(eventType, handler, false);
else if (typeof element.attachEvent != "undefined") {
var attachEventHandler = function (event) { handler.call(element, event); },
attachEventName = "on" + eventType;
element.attachEvent(attachEventName, attachEventHandler);
// IE does not dispose attachEvent handlers automatically (unlike with addEventListener)
// so to avoid leaks, we have to remove them manually. See bug #856
ko.utils.domNodeDisposal.addDisposeCallback(element, function() {
element.detachEvent(attachEventName, attachEventHandler);
});
} else
throw new Error("Browser doesn't support addEventListener or attachEvent");
},
triggerEvent: function (element, eventType) {
if (!(element && element.nodeType))
throw new Error("element must be a DOM node when calling triggerEvent");
// For click events on checkboxes and radio buttons, jQuery toggles the element checked state *after* the
// event handler runs instead of *before*. (This was fixed in 1.9 for checkboxes but not for radio buttons.)
// IE doesn't change the checked state when you trigger the click event using "fireEvent".
// In both cases, we'll use the click method instead.
var useClickWorkaround = isClickOnCheckableElement(element, eventType);
if (jQueryInstance && !useClickWorkaround) {
jQueryInstance(element)['trigger'](eventType);
} else if (typeof document.createEvent == "function") {
if (typeof element.dispatchEvent == "function") {
var eventCategory = knownEventTypesByEventName[eventType] || "HTMLEvents";
var event = document.createEvent(eventCategory);
event.initEvent(eventType, true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, element);
element.dispatchEvent(event);
}
else
throw new Error("The supplied element doesn't support dispatchEvent");
} else if (useClickWorkaround && element.click) {
element.click();
} else if (typeof element.fireEvent != "undefined") {
element.fireEvent("on" + eventType);
} else {
throw new Error("Browser doesn't support triggering events");
}
},
unwrapObservable: function (value) {
return ko.isObservable(value) ? value() : value;
},
peekObservable: function (value) {
return ko.isObservable(value) ? value.peek() : value;
},
toggleDomNodeCssClass: toggleDomNodeCssClass,
setTextContent: function(element, textContent) {
var value = ko.utils.unwrapObservable(textContent);
if ((value === null) || (value === undefined))
value = "";
// We need there to be exactly one child: a text node.
// If there are no children, more than one, or if it's not a text node,
// we'll clear everything and create a single text node.
var innerTextNode = ko.virtualElements.firstChild(element);
if (!innerTextNode || innerTextNode.nodeType != 3 || ko.virtualElements.nextSibling(innerTextNode)) {
ko.virtualElements.setDomNodeChildren(element, [element.ownerDocument.createTextNode(value)]);
} else {
innerTextNode.data = value;
}
ko.utils.forceRefresh(element);
},
setElementName: function(element, name) {
element.name = name;
// Workaround IE 6/7 issue
// - https://github.com/SteveSanderson/knockout/issues/197
// - http://www.matts411.com/post/setting_the_name_attribute_in_ie_dom/
if (ieVersion <= 7) {
try {
element.mergeAttributes(document.createElement("<input name='" + element.name + "'/>"), false);
}
catch(e) {} // For IE9 with doc mode "IE9 Standards" and browser mode "IE9 Compatibility View"
}
},
forceRefresh: function(node) {
// Workaround for an IE9 rendering bug - https://github.com/SteveSanderson/knockout/issues/209
if (ieVersion >= 9) {
// For text nodes and comment nodes (most likely virtual elements), we will have to refresh the container
var elem = node.nodeType == 1 ? node : node.parentNode;
if (elem.style)
elem.style.zoom = elem.style.zoom;
}
},
ensureSelectElementIsRenderedCorrectly: function(selectElement) {
// Workaround for IE9 rendering bug - it doesn't reliably display all the text in dynamically-added select boxes unless you force it to re-render by updating the width.
// (See https://github.com/SteveSanderson/knockout/issues/312, http://stackoverflow.com/questions/5908494/select-only-shows-first-char-of-selected-option)
// Also fixes IE7 and IE8 bug that causes selects to be zero width if enclosed by 'if' or 'with'. (See issue #839)
if (ieVersion) {
var originalWidth = selectElement.style.width;
selectElement.style.width = 0;
selectElement.style.width = originalWidth;
}
},
range: function (min, max) {
min = ko.utils.unwrapObservable(min);
max = ko.utils.unwrapObservable(max);
var result = [];
for (var i = min; i <= max; i++)
result.push(i);
return result;
},
makeArray: function(arrayLikeObject) {
var result = [];
for (var i = 0, j = arrayLikeObject.length; i < j; i++) {
result.push(arrayLikeObject[i]);
};
return result;
},
isIe6 : isIe6,
isIe7 : isIe7,
ieVersion : ieVersion,
getFormFields: function(form, fieldName) {
var fields = ko.utils.makeArray(form.getElementsByTagName("input")).concat(ko.utils.makeArray(form.getElementsByTagName("textarea")));
var isMatchingField = (typeof fieldName == 'string')
? function(field) { return field.name === fieldName }
: function(field) { return fieldName.test(field.name) }; // Treat fieldName as regex or object containing predicate
var matches = [];
for (var i = fields.length - 1; i >= 0; i--) {
if (isMatchingField(fields[i]))
matches.push(fields[i]);
};
return matches;
},
parseJson: function (jsonString) {
if (typeof jsonString == "string") {
jsonString = ko.utils.stringTrim(jsonString);
if (jsonString) {
if (JSON && JSON.parse) // Use native parsing where available
return JSON.parse(jsonString);
return (new Function("return " + jsonString))(); // Fallback on less safe parsing for older browsers
}
}
return null;
},
stringifyJson: function (data, replacer, space) { // replacer and space are optional
if (!JSON || !JSON.stringify)
throw new Error("Cannot find JSON.stringify(). Some browsers (e.g., IE < 8) don't support it natively, but you can overcome this by adding a script reference to json2.js, downloadable from http://www.json.org/json2.js");
return JSON.stringify(ko.utils.unwrapObservable(data), replacer, space);
},
postJson: function (urlOrForm, data, options) {
options = options || {};
var params = options['params'] || {};
var includeFields = options['includeFields'] || this.fieldsIncludedWithJsonPost;
var url = urlOrForm;
// If we were given a form, use its 'action' URL and pick out any requested field values
if((typeof urlOrForm == 'object') && (ko.utils.tagNameLower(urlOrForm) === "form")) {
var originalForm = urlOrForm;
url = originalForm.action;
for (var i = includeFields.length - 1; i >= 0; i--) {
var fields = ko.utils.getFormFields(originalForm, includeFields[i]);
for (var j = fields.length - 1; j >= 0; j--)
params[fields[j].name] = fields[j].value;
}
}
data = ko.utils.unwrapObservable(data);
var form = document.createElement("form");
form.style.display = "none";
form.action = url;
form.method = "post";
for (var key in data) {
// Since 'data' this is a model object, we include all properties including those inherited from its prototype
var input = document.createElement("input");
input.type = "hidden";
input.name = key;
input.value = ko.utils.stringifyJson(ko.utils.unwrapObservable(data[key]));
form.appendChild(input);
}
objectForEach(params, function(key, value) {
var input = document.createElement("input");
input.type = "hidden";
input.name = key;
input.value = value;
form.appendChild(input);
});
document.body.appendChild(form);
options['submitter'] ? options['submitter'](form) : form.submit();
setTimeout(function () { form.parentNode.removeChild(form); }, 0);
}
}
}());
ko.exportSymbol('utils', ko.utils);
ko.exportSymbol('utils.arrayForEach', ko.utils.arrayForEach);
ko.exportSymbol('utils.arrayFirst', ko.utils.arrayFirst);
ko.exportSymbol('utils.arrayFilter', ko.utils.arrayFilter);
ko.exportSymbol('utils.arrayGetDistinctValues', ko.utils.arrayGetDistinctValues);
ko.exportSymbol('utils.arrayIndexOf', ko.utils.arrayIndexOf);
ko.exportSymbol('utils.arrayMap', ko.utils.arrayMap);
ko.exportSymbol('utils.arrayPushAll', ko.utils.arrayPushAll);
ko.exportSymbol('utils.arrayRemoveItem', ko.utils.arrayRemoveItem);
ko.exportSymbol('utils.extend', ko.utils.extend);
ko.exportSymbol('utils.fieldsIncludedWithJsonPost', ko.utils.fieldsIncludedWithJsonPost);
ko.exportSymbol('utils.getFormFields', ko.utils.getFormFields);
ko.exportSymbol('utils.peekObservable', ko.utils.peekObservable);
ko.exportSymbol('utils.postJson', ko.utils.postJson);
ko.exportSymbol('utils.parseJson', ko.utils.parseJson);
ko.exportSymbol('utils.registerEventHandler', ko.utils.registerEventHandler);
ko.exportSymbol('utils.stringifyJson', ko.utils.stringifyJson);
ko.exportSymbol('utils.range', ko.utils.range);
ko.exportSymbol('utils.toggleDomNodeCssClass', ko.utils.toggleDomNodeCssClass);
ko.exportSymbol('utils.triggerEvent', ko.utils.triggerEvent);
ko.exportSymbol('utils.unwrapObservable', ko.utils.unwrapObservable);
ko.exportSymbol('utils.objectForEach', ko.utils.objectForEach);
ko.exportSymbol('utils.addOrRemoveItem', ko.utils.addOrRemoveItem);
ko.exportSymbol('utils.setTextContent', ko.utils.setTextContent);
ko.exportSymbol('unwrap', ko.utils.unwrapObservable); // Convenient shorthand, because this is used so commonly
if (!Function.prototype['bind']) {
// Function.prototype.bind is a standard part of ECMAScript 5th Edition (December 2009, http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-262.pdf)
// In case the browser doesn't implement it natively, provide a JavaScript implementation. This implementation is based on the one in prototype.js
Function.prototype['bind'] = function (object) {
var originalFunction = this;
if (arguments.length === 1) {
return function () {
return originalFunction.apply(object, arguments);
};
} else {
var partialArgs = Array.prototype.slice.call(arguments, 1);
return function () {
var args = partialArgs.slice(0);
args.push.apply(args, arguments);
return originalFunction.apply(object, args);
};
}
};
}
ko.utils.domData = new (function () {
var uniqueId = 0;
var dataStoreKeyExpandoPropertyName = "__ko__" + (new Date).getTime();
var dataStore = {};
function getAll(node, createIfNotFound) {
var dataStoreKey = node[dataStoreKeyExpandoPropertyName];
var hasExistingDataStore = dataStoreKey && (dataStoreKey !== "null") && dataStore[dataStoreKey];
if (!hasExistingDataStore) {
if (!createIfNotFound)
return undefined;
dataStoreKey = node[dataStoreKeyExpandoPropertyName] = "ko" + uniqueId++;
dataStore[dataStoreKey] = {};
}
return dataStore[dataStoreKey];
}
return {
get: function (node, key) {
var allDataForNode = getAll(node, false);
return allDataForNode === undefined ? undefined : allDataForNode[key];
},
set: function (node, key, value) {
if (value === undefined) {
// Make sure we don't actually create a new domData key if we are actually deleting a value
if (getAll(node, false) === undefined)
return;
}
var allDataForNode = getAll(node, true);
allDataForNode[key] = value;
},
clear: function (node) {
var dataStoreKey = node[dataStoreKeyExpandoPropertyName];
if (dataStoreKey) {
delete dataStore[dataStoreKey];
node[dataStoreKeyExpandoPropertyName] = null;
return true; // Exposing "did clean" flag purely so specs can infer whether things have been cleaned up as intended
}
return false;
},
nextKey: function () {
return (uniqueId++) + dataStoreKeyExpandoPropertyName;
}
};
})();
ko.exportSymbol('utils.domData', ko.utils.domData);
ko.exportSymbol('utils.domData.clear', ko.utils.domData.clear); // Exporting only so specs can clear up after themselves fully
ko.utils.domNodeDisposal = new (function () {
var domDataKey = ko.utils.domData.nextKey();
var cleanableNodeTypes = { 1: true, 8: true, 9: true }; // Element, Comment, Document
var cleanableNodeTypesWithDescendants = { 1: true, 9: true }; // Element, Document
function getDisposeCallbacksCollection(node, createIfNotFound) {
var allDisposeCallbacks = ko.utils.domData.get(node, domDataKey);
if ((allDisposeCallbacks === undefined) && createIfNotFound) {
allDisposeCallbacks = [];
ko.utils.domData.set(node, domDataKey, allDisposeCallbacks);
}
return allDisposeCallbacks;
}
function destroyCallbacksCollection(node) {
ko.utils.domData.set(node, domDataKey, undefined);
}
function cleanSingleNode(node) {
// Run all the dispose callbacks
var callbacks = getDisposeCallbacksCollection(node, false);
if (callbacks) {
callbacks = callbacks.slice(0); // Clone, as the array may be modified during iteration (typically, callbacks will remove themselves)
for (var i = 0; i < callbacks.length; i++)
callbacks[i](node);
}
// Erase the DOM data
ko.utils.domData.clear(node);
// Perform cleanup needed by external libraries (currently only jQuery, but can be extended)
ko.utils.domNodeDisposal["cleanExternalData"](node);
// Clear any immediate-child comment nodes, as these wouldn't have been found by
// node.getElementsByTagName("*") in cleanNode() (comment nodes aren't elements)
if (cleanableNodeTypesWithDescendants[node.nodeType])
cleanImmediateCommentTypeChildren(node);
}
function cleanImmediateCommentTypeChildren(nodeWithChildren) {
var child, nextChild = nodeWithChildren.firstChild;
while (child = nextChild) {
nextChild = child.nextSibling;
if (child.nodeType === 8)
cleanSingleNode(child);
}
}
return {
addDisposeCallback : function(node, callback) {
if (typeof callback != "function")
throw new Error("Callback must be a function");
getDisposeCallbacksCollection(node, true).push(callback);
},
removeDisposeCallback : function(node, callback) {
var callbacksCollection = getDisposeCallbacksCollection(node, false);
if (callbacksCollection) {
ko.utils.arrayRemoveItem(callbacksCollection, callback);
if (callbacksCollection.length == 0)
destroyCallbacksCollection(node);
}
},
cleanNode : function(node) {
// First clean this node, where applicable
if (cleanableNodeTypes[node.nodeType]) {
cleanSingleNode(node);
// ... then its descendants, where applicable
if (cleanableNodeTypesWithDescendants[node.nodeType]) {
// Clone the descendants list in case it changes during iteration
var descendants = [];
ko.utils.arrayPushAll(descendants, node.getElementsByTagName("*"));
for (var i = 0, j = descendants.length; i < j; i++)
cleanSingleNode(descendants[i]);
}
}
return node;
},
removeNode : function(node) {
ko.cleanNode(node);
if (node.parentNode)
node.parentNode.removeChild(node);
},
"cleanExternalData" : function (node) {
// Special support for jQuery here because it's so commonly used.
// Many jQuery plugins (including jquery.tmpl) store data using jQuery's equivalent of domData
// so notify it to tear down any resources associated with the node & descendants here.
if (jQueryInstance && (typeof jQueryInstance['cleanData'] == "function"))
jQueryInstance['cleanData']([node]);
}
};
})();
ko.cleanNode = ko.utils.domNodeDisposal.cleanNode; // Shorthand name for convenience
ko.removeNode = ko.utils.domNodeDisposal.removeNode; // Shorthand name for convenience
ko.exportSymbol('cleanNode', ko.cleanNode);
ko.exportSymbol('removeNode', ko.removeNode);
ko.exportSymbol('utils.domNodeDisposal', ko.utils.domNodeDisposal);
ko.exportSymbol('utils.domNodeDisposal.addDisposeCallback', ko.utils.domNodeDisposal.addDisposeCallback);
ko.exportSymbol('utils.domNodeDisposal.removeDisposeCallback', ko.utils.domNodeDisposal.removeDisposeCallback);
(function () {
var leadingCommentRegex = /^(\s*)<!--(.*?)-->/;
function simpleHtmlParse(html, documentContext) {
documentContext || (documentContext = document);
var windowContext = documentContext['parentWindow'] || documentContext['defaultView'] || window;
// Based on jQuery's "clean" function, but only accounting for table-related elements.
// If you have referenced jQuery, this won't be used anyway - KO will use jQuery's "clean" function directly
// Note that there's still an issue in IE < 9 whereby it will discard comment nodes that are the first child of
// a descendant node. For example: "<div><!-- mycomment -->abc</div>" will get parsed as "<div>abc</div>"
// This won't affect anyone who has referenced jQuery, and there's always the workaround of inserting a dummy node
// (possibly a text node) in front of the comment. So, KO does not attempt to workaround this IE issue automatically at present.
// Trim whitespace, otherwise indexOf won't work as expected
var tags = ko.utils.stringTrim(html).toLowerCase(), div = documentContext.createElement("div");
// Finds the first match from the left column, and returns the corresponding "wrap" data from the right column
var wrap = tags.match(/^<(thead|tbody|tfoot)/) && [1, "<table>", "</table>"] ||
!tags.indexOf("<tr") && [2, "<table><tbody>", "</tbody></table>"] ||
(!tags.indexOf("<td") || !tags.indexOf("<th")) && [3, "<table><tbody><tr>", "</tr></tbody></table>"] ||
/* anything else */ [0, "", ""];
// Go to html and back, then peel off extra wrappers
// Note that we always prefix with some dummy text, because otherwise, IE<9 will strip out leading comment nodes in descendants. Total madness.
var markup = "ignored<div>" + wrap[1] + html + wrap[2] + "</div>";
if (typeof windowContext['innerShiv'] == "function") {
div.appendChild(windowContext['innerShiv'](markup));
} else {
div.innerHTML = markup;
}
// Move to the right depth
while (wrap[0]--)
div = div.lastChild;
return ko.utils.makeArray(div.lastChild.childNodes);
}
function jQueryHtmlParse(html, documentContext) {
// jQuery's "parseHTML" function was introduced in jQuery 1.8.0 and is a documented public API.
if (jQueryInstance['parseHTML']) {
return jQueryInstance['parseHTML'](html, documentContext) || []; // Ensure we always return an array and never null
} else {
// For jQuery < 1.8.0, we fall back on the undocumented internal "clean" function.
var elems = jQueryInstance['clean']([html], documentContext);
// As of jQuery 1.7.1, jQuery parses the HTML by appending it to some dummy parent nodes held in an in-memory document fragment.
// Unfortunately, it never clears the dummy parent nodes from the document fragment, so it leaks memory over time.
// Fix this by finding the top-most dummy parent element, and detaching it from its owner fragment.
if (elems && elems[0]) {
// Find the top-most parent element that's a direct child of a document fragment
var elem = elems[0];
while (elem.parentNode && elem.parentNode.nodeType !== 11 /* i.e., DocumentFragment */)
elem = elem.parentNode;
// ... then detach it
if (elem.parentNode)
elem.parentNode.removeChild(elem);
}
return elems;
}
}
ko.utils.parseHtmlFragment = function(html, documentContext) {
return jQueryInstance ? jQueryHtmlParse(html, documentContext) // As below, benefit from jQuery's optimisations where possible
: simpleHtmlParse(html, documentContext); // ... otherwise, this simple logic will do in most common cases.
};
ko.utils.setHtml = function(node, html) {
ko.utils.emptyDomNode(node);
// There's no legitimate reason to display a stringified observable without unwrapping it, so we'll unwrap it
html = ko.utils.unwrapObservable(html);
if ((html !== null) && (html !== undefined)) {
if (typeof html != 'string')
html = html.toString();
// jQuery contains a lot of sophisticated code to parse arbitrary HTML fragments,
// for example <tr> elements which are not normally allowed to exist on their own.
// If you've referenced jQuery we'll use that rather than duplicating its code.
if (jQueryInstance) {
jQueryInstance(node)['html'](html);
} else {
// ... otherwise, use KO's own parsing logic.
var parsedNodes = ko.utils.parseHtmlFragment(html, node.ownerDocument);
for (var i = 0; i < parsedNodes.length; i++)
node.appendChild(parsedNodes[i]);
}
}
};
})();
ko.exportSymbol('utils.parseHtmlFragment', ko.utils.parseHtmlFragment);
ko.exportSymbol('utils.setHtml', ko.utils.setHtml);
ko.memoization = (function () {
var memos = {};
function randomMax8HexChars() {
return (((1 + Math.random()) * 0x100000000) | 0).toString(16).substring(1);
}
function generateRandomId() {
return randomMax8HexChars() + randomMax8HexChars();
}
function findMemoNodes(rootNode, appendToArray) {
if (!rootNode)
return;
if (rootNode.nodeType == 8) {
var memoId = ko.memoization.parseMemoText(rootNode.nodeValue);
if (memoId != null)
appendToArray.push({ domNode: rootNode, memoId: memoId });
} else if (rootNode.nodeType == 1) {
for (var i = 0, childNodes = rootNode.childNodes, j = childNodes.length; i < j; i++)
findMemoNodes(childNodes[i], appendToArray);
}
}
return {
memoize: function (callback) {
if (typeof callback != "function")
throw new Error("You can only pass a function to ko.memoization.memoize()");
var memoId = generateRandomId();
memos[memoId] = callback;
return "<!--[ko_memo:" + memoId + "]-->";
},
unmemoize: function (memoId, callbackParams) {
var callback = memos[memoId];
if (callback === undefined)
throw new Error("Couldn't find any memo with ID " + memoId + ". Perhaps it's already been unmemoized.");
try {
callback.apply(null, callbackParams || []);
return true;
}
finally { delete memos[memoId]; }
},
unmemoizeDomNodeAndDescendants: function (domNode, extraCallbackParamsArray) {
var memos = [];
findMemoNodes(domNode, memos);
for (var i = 0, j = memos.length; i < j; i++) {
var node = memos[i].domNode;
var combinedParams = [node];
if (extraCallbackParamsArray)
ko.utils.arrayPushAll(combinedParams, extraCallbackParamsArray);
ko.memoization.unmemoize(memos[i].memoId, combinedParams);
node.nodeValue = ""; // Neuter this node so we don't try to unmemoize it again
if (node.parentNode)
node.parentNode.removeChild(node); // If possible, erase it totally (not always possible - someone else might just hold a reference to it then call unmemoizeDomNodeAndDescendants again)
}
},
parseMemoText: function (memoText) {
var match = memoText.match(/^\[ko_memo\:(.*?)\]$/);
return match ? match[1] : null;
}
};
})();
ko.exportSymbol('memoization', ko.memoization);
ko.exportSymbol('memoization.memoize', ko.memoization.memoize);
ko.exportSymbol('memoization.unmemoize', ko.memoization.unmemoize);
ko.exportSymbol('memoization.parseMemoText', ko.memoization.parseMemoText);
ko.exportSymbol('memoization.unmemoizeDomNodeAndDescendants', ko.memoization.unmemoizeDomNodeAndDescendants);
ko.extenders = {
'throttle': function(target, timeout) {
// Throttling means two things:
// (1) For dependent observables, we throttle *evaluations* so that, no matter how fast its dependencies
// notify updates, the target doesn't re-evaluate (and hence doesn't notify) faster than a certain rate
target['throttleEvaluation'] = timeout;
// (2) For writable targets (observables, or writable dependent observables), we throttle *writes*
// so the target cannot change value synchronously or faster than a certain rate
var writeTimeoutInstance = null;
return ko.dependentObservable({
'read': target,
'write': function(value) {
clearTimeout(writeTimeoutInstance);
writeTimeoutInstance = setTimeout(function() {
target(value);
}, timeout);
}
});
},
'rateLimit': function(target, options) {
var timeout, method, limitFunction;
if (typeof options == 'number') {
timeout = options;
} else {
timeout = options['timeout'];
method = options['method'];
}
limitFunction = method == 'notifyWhenChangesStop' ? debounce : throttle;
target.limit(function(callback) {
return limitFunction(callback, timeout);
});
},
'notify': function(target, notifyWhen) {
target["equalityComparer"] = notifyWhen == "always" ?
null : // null equalityComparer means to always notify
valuesArePrimitiveAndEqual;
}
};
var primitiveTypes = { 'undefined':1, 'boolean':1, 'number':1, 'string':1 };
function valuesArePrimitiveAndEqual(a, b) {
var oldValueIsPrimitive = (a === null) || (typeof(a) in primitiveTypes);
return oldValueIsPrimitive ? (a === b) : false;
}
function throttle(callback, timeout) {
var timeoutInstance;
return function () {
if (!timeoutInstance) {
timeoutInstance = setTimeout(function() {
timeoutInstance = undefined;
callback();
}, timeout);
}
};
}
function debounce(callback, timeout) {
var timeoutInstance;
return function () {
clearTimeout(timeoutInstance);
timeoutInstance = setTimeout(callback, timeout);
};
}
function applyExtenders(requestedExtenders) {
var target = this;
if (requestedExtenders) {
ko.utils.objectForEach(requestedExtenders, function(key, value) {
var extenderHandler = ko.extenders[key];
if (typeof extenderHandler == 'function') {
target = extenderHandler(target, value) || target;
}
});
}
return target;
}
ko.exportSymbol('extenders', ko.extenders);
ko.subscription = function (target, callback, disposeCallback) {
this._target = target;
this.callback = callback;
this.disposeCallback = disposeCallback;
this.isDisposed = false;
ko.exportProperty(this, 'dispose', this.dispose);
};
ko.subscription.prototype.dispose = function () {
this.isDisposed = true;
this.disposeCallback();
};
ko.subscribable = function () {
ko.utils.setPrototypeOfOrExtend(this, ko.subscribable['fn']);
this._subscriptions = {};
this._versionNumber = 1;
}
var defaultEvent = "change";
var ko_subscribable_fn = {
subscribe: function (callback, callbackTarget, event) {
var self = this;
event = event || defaultEvent;
var boundCallback = callbackTarget ? callback.bind(callbackTarget) : callback;
var subscription = new ko.subscription(self, boundCallback, function () {
ko.utils.arrayRemoveItem(self._subscriptions[event], subscription);
if (self.afterSubscriptionRemove)
self.afterSubscriptionRemove(event);
});
if (self.beforeSubscriptionAdd)
self.beforeSubscriptionAdd(event);
if (!self._subscriptions[event])
self._subscriptions[event] = [];
self._subscriptions[event].push(subscription);
return subscription;
},
"notifySubscribers": function (valueToNotify, event) {
event = event || defaultEvent;
if (event === defaultEvent) {
this.updateVersion();
}
if (this.hasSubscriptionsForEvent(event)) {
try {
ko.dependencyDetection.begin(); // Begin suppressing dependency detection (by setting the top frame to undefined)
for (var a = this._subscriptions[event].slice(0), i = 0, subscription; subscription = a[i]; ++i) {
// In case a subscription was disposed during the arrayForEach cycle, check
// for isDisposed on each subscription before invoking its callback
if (!subscription.isDisposed)
subscription.callback(valueToNotify);
}
} finally {
ko.dependencyDetection.end(); // End suppressing dependency detection
}
}
},
getVersion: function () {
return this._versionNumber;
},
hasChanged: function (versionToCheck) {
return this.getVersion() !== versionToCheck;
},
updateVersion: function () {
++this._versionNumber;
},
limit: function(limitFunction) {
var self = this, selfIsObservable = ko.isObservable(self),
isPending, previousValue, pendingValue, beforeChange = 'beforeChange';
if (!self._origNotifySubscribers) {
self._origNotifySubscribers = self["notifySubscribers"];
self["notifySubscribers"] = function(value, event) {
if (!event || event === defaultEvent) {
self._rateLimitedChange(value);
} else if (event === beforeChange) {
self._rateLimitedBeforeChange(value);
} else {
self._origNotifySubscribers(value, event);
}
};
}
var finish = limitFunction(function() {
// If an observable provided a reference to itself, access it to get the latest value.
// This allows computed observables to delay calculating their value until needed.
if (selfIsObservable && pendingValue === self) {
pendingValue = self();
}
isPending = false;
if (self.isDifferent(previousValue, pendingValue)) {
self._origNotifySubscribers(previousValue = pendingValue);
}
});
self._rateLimitedChange = function(value) {
isPending = true;
pendingValue = value;
finish();
};
self._rateLimitedBeforeChange = function(value) {
if (!isPending) {
previousValue = value;
self._origNotifySubscribers(value, beforeChange);
}
};
},
hasSubscriptionsForEvent: function(event) {
return this._subscriptions[event] && this._subscriptions[event].length;
},
getSubscriptionsCount: function (event) {
if (event) {
return this._subscriptions[event] && this._subscriptions[event].length || 0;
} else {
var total = 0;
ko.utils.objectForEach(this._subscriptions, function(eventName, subscriptions) {
total += subscriptions.length;
});
return total;
}
},
isDifferent: function(oldValue, newValue) {
return !this['equalityComparer'] || !this['equalityComparer'](oldValue, newValue);
},
extend: applyExtenders
};
ko.exportProperty(ko_subscribable_fn, 'subscribe', ko_subscribable_fn.subscribe);
ko.exportProperty(ko_subscribable_fn, 'extend', ko_subscribable_fn.extend);
ko.exportProperty(ko_subscribable_fn, 'getSubscriptionsCount', ko_subscribable_fn.getSubscriptionsCount);
// For browsers that support proto assignment, we overwrite the prototype of each
// observable instance. Since observables are functions, we need Function.prototype
// to still be in the prototype chain.
if (ko.utils.canSetPrototype) {
ko.utils.setPrototypeOf(ko_subscribable_fn, Function.prototype);
}
ko.subscribable['fn'] = ko_subscribable_fn;
ko.isSubscribable = function (instance) {
return instance != null && typeof instance.subscribe == "function" && typeof instance["notifySubscribers"] == "function";
};
ko.exportSymbol('subscribable', ko.subscribable);
ko.exportSymbol('isSubscribable', ko.isSubscribable);
ko.computedContext = ko.dependencyDetection = (function () {
var outerFrames = [],
currentFrame,
lastId = 0;
// Return a unique ID that can be assigned to an observable for dependency tracking.
// Theoretically, you could eventually overflow the number storage size, resulting
// in duplicate IDs. But in JavaScript, the largest exact integral value is 2^53
// or 9,007,199,254,740,992. If you created 1,000,000 IDs per second, it would
// take over 285 years to reach that number.
// Reference http://blog.vjeux.com/2010/javascript/javascript-max_int-number-limits.html
function getId() {
return ++lastId;
}
function begin(options) {
outerFrames.push(currentFrame);
currentFrame = options;
}
function end() {
currentFrame = outerFrames.pop();
}
return {
begin: begin,
end: end,
registerDependency: function (subscribable) {
if (currentFrame) {
if (!ko.isSubscribable(subscribable))
throw new Error("Only subscribable things can act as dependencies");
currentFrame.callback(subscribable, subscribable._id || (subscribable._id = getId()));
}
},
ignore: function (callback, callbackTarget, callbackArgs) {
try {
begin();
return callback.apply(callbackTarget, callbackArgs || []);
} finally {
end();
}
},
getDependenciesCount: function () {
if (currentFrame)
return currentFrame.computed.getDependenciesCount();
},
isInitial: function() {
if (currentFrame)
return currentFrame.isInitial;
}
};
})();
ko.exportSymbol('computedContext', ko.computedContext);
ko.exportSymbol('computedContext.getDependenciesCount', ko.computedContext.getDependenciesCount);
ko.exportSymbol('computedContext.isInitial', ko.computedContext.isInitial);
ko.exportSymbol('computedContext.isSleeping', ko.computedContext.isSleeping);
ko.exportSymbol('ignoreDependencies', ko.ignoreDependencies = ko.dependencyDetection.ignore);
ko.observable = function (initialValue) {
var _latestValue = initialValue;
function observable() {
if (arguments.length > 0) {
// Write
// Ignore writes if the value hasn't changed
if (observable.isDifferent(_latestValue, arguments[0])) {
observable.valueWillMutate();
_latestValue = arguments[0];
if (DEBUG) observable._latestValue = _latestValue;
observable.valueHasMutated();
}
return this; // Permits chained assignments
}
else {
// Read
ko.dependencyDetection.registerDependency(observable); // The caller only needs to be notified of changes if they did a "read" operation
return _latestValue;
}
}
ko.subscribable.call(observable);
ko.utils.setPrototypeOfOrExtend(observable, ko.observable['fn']);
if (DEBUG) observable._latestValue = _latestValue;
observable.peek = function() { return _latestValue };
observable.valueHasMutated = function () { observable["notifySubscribers"](_latestValue); }
observable.valueWillMutate = function () { observable["notifySubscribers"](_latestValue, "beforeChange"); }
ko.exportProperty(observable, 'peek', observable.peek);
ko.exportProperty(observable, "valueHasMutated", observable.valueHasMutated);
ko.exportProperty(observable, "valueWillMutate", observable.valueWillMutate);
return observable;
}
ko.observable['fn'] = {
"equalityComparer": valuesArePrimitiveAndEqual
};
var protoProperty = ko.observable.protoProperty = "__ko_proto__";
ko.observable['fn'][protoProperty] = ko.observable;
// Note that for browsers that don't support proto assignment, the
// inheritance chain is created manually in the ko.observable constructor
if (ko.utils.canSetPrototype) {
ko.utils.setPrototypeOf(ko.observable['fn'], ko.subscribable['fn']);
}
ko.hasPrototype = function(instance, prototype) {
if ((instance === null) || (instance === undefined) || (instance[protoProperty] === undefined)) return false;
if (instance[protoProperty] === prototype) return true;
return ko.hasPrototype(instance[protoProperty], prototype); // Walk the prototype chain
};
ko.isObservable = function (instance) {
return ko.hasPrototype(instance, ko.observable);
}
ko.isWriteableObservable = function (instance) {
// Observable
if ((typeof instance == "function") && instance[protoProperty] === ko.observable)
return true;
// Writeable dependent observable
if ((typeof instance == "function") && (instance[protoProperty] === ko.dependentObservable) && (instance.hasWriteFunction))
return true;
// Anything else
return false;
}
ko.exportSymbol('observable', ko.observable);
ko.exportSymbol('isObservable', ko.isObservable);
ko.exportSymbol('isWriteableObservable', ko.isWriteableObservable);
ko.exportSymbol('isWritableObservable', ko.isWriteableObservable);
ko.observableArray = function (initialValues) {
initialValues = initialValues || [];
if (typeof initialValues != 'object' || !('length' in initialValues))
throw new Error("The argument passed when initializing an observable array must be an array, or null, or undefined.");
var result = ko.observable(initialValues);
ko.utils.setPrototypeOfOrExtend(result, ko.observableArray['fn']);
return result.extend({'trackArrayChanges':true});
};
ko.observableArray['fn'] = {
'remove': function (valueOrPredicate) {
var underlyingArray = this.peek();
var removedValues = [];
var predicate = typeof valueOrPredicate == "function" && !ko.isObservable(valueOrPredicate) ? valueOrPredicate : function (value) { return value === valueOrPredicate; };
for (var i = 0; i < underlyingArray.length; i++) {
var value = underlyingArray[i];
if (predicate(value)) {
if (removedValues.length === 0) {
this.valueWillMutate();
}
removedValues.push(value);
underlyingArray.splice(i, 1);
i--;
}
}
if (removedValues.length) {
this.valueHasMutated();
}
return removedValues;
},
'removeAll': function (arrayOfValues) {
// If you passed zero args, we remove everything
if (arrayOfValues === undefined) {
var underlyingArray = this.peek();
var allValues = underlyingArray.slice(0);
this.valueWillMutate();
underlyingArray.splice(0, underlyingArray.length);
this.valueHasMutated();
return allValues;
}
// If you passed an arg, we interpret it as an array of entries to remove
if (!arrayOfValues)
return [];
return this['remove'](function (value) {
return ko.utils.arrayIndexOf(arrayOfValues, value) >= 0;
});
},
'destroy': function (valueOrPredicate) {
var underlyingArray = this.peek();
var predicate = typeof valueOrPredicate == "function" && !ko.isObservable(valueOrPredicate) ? valueOrPredicate : function (value) { return value === valueOrPredicate; };
this.valueWillMutate();
for (var i = underlyingArray.length - 1; i >= 0; i--) {
var value = underlyingArray[i];
if (predicate(value))
underlyingArray[i]["_destroy"] = true;
}
this.valueHasMutated();
},
'destroyAll': function (arrayOfValues) {
// If you passed zero args, we destroy everything
if (arrayOfValues === undefined)
return this['destroy'](function() { return true });
// If you passed an arg, we interpret it as an array of entries to destroy
if (!arrayOfValues)
return [];
return this['destroy'](function (value) {
return ko.utils.arrayIndexOf(arrayOfValues, value) >= 0;
});
},
'indexOf': function (item) {
var underlyingArray = this();
return ko.utils.arrayIndexOf(underlyingArray, item);
},
'replace': function(oldItem, newItem) {
var index = this['indexOf'](oldItem);
if (index >= 0) {
this.valueWillMutate();
this.peek()[index] = newItem;
this.valueHasMutated();
}
}
};
// Populate ko.observableArray.fn with read/write functions from native arrays
// Important: Do not add any additional functions here that may reasonably be used to *read* data from the array
// because we'll eval them without causing subscriptions, so ko.computed output could end up getting stale
ko.utils.arrayForEach(["pop", "push", "reverse", "shift", "sort", "splice", "unshift"], function (methodName) {
ko.observableArray['fn'][methodName] = function () {
// Use "peek" to avoid creating a subscription in any computed that we're executing in the context of
// (for consistency with mutating regular observables)
var underlyingArray = this.peek();
this.valueWillMutate();
this.cacheDiffForKnownOperation(underlyingArray, methodName, arguments);
var methodCallResult = underlyingArray[methodName].apply(underlyingArray, arguments);
this.valueHasMutated();
return methodCallResult;
};
});
// Populate ko.observableArray.fn with read-only functions from native arrays
ko.utils.arrayForEach(["slice"], function (methodName) {
ko.observableArray['fn'][methodName] = function () {
var underlyingArray = this();
return underlyingArray[methodName].apply(underlyingArray, arguments);
};
});
// Note that for browsers that don't support proto assignment, the
// inheritance chain is created manually in the ko.observableArray constructor
if (ko.utils.canSetPrototype) {
ko.utils.setPrototypeOf(ko.observableArray['fn'], ko.observable['fn']);
}
ko.exportSymbol('observableArray', ko.observableArray);
var arrayChangeEventName = 'arrayChange';
ko.extenders['trackArrayChanges'] = function(target) {
// Only modify the target observable once
if (target.cacheDiffForKnownOperation) {
return;
}
var trackingChanges = false,
cachedDiff = null,
arrayChangeSubscription,
pendingNotifications = 0,
underlyingBeforeSubscriptionAddFunction = target.beforeSubscriptionAdd,
underlyingAfterSubscriptionRemoveFunction = target.afterSubscriptionRemove;
// Watch "subscribe" calls, and for array change events, ensure change tracking is enabled
target.beforeSubscriptionAdd = function (event) {
if (underlyingBeforeSubscriptionAddFunction)
underlyingBeforeSubscriptionAddFunction.call(target, event);
if (event === arrayChangeEventName) {
trackChanges();
}
};
// Watch "dispose" calls, and for array change events, ensure change tracking is disabled when all are disposed
target.afterSubscriptionRemove = function (event) {
if (underlyingAfterSubscriptionRemoveFunction)
underlyingAfterSubscriptionRemoveFunction.call(target, event);
if (event === arrayChangeEventName && !target.hasSubscriptionsForEvent(arrayChangeEventName)) {
arrayChangeSubscription.dispose();
trackingChanges = false;
}
};
function trackChanges() {
// Calling 'trackChanges' multiple times is the same as calling it once
if (trackingChanges) {
return;
}
trackingChanges = true;
// Intercept "notifySubscribers" to track how many times it was called.
var underlyingNotifySubscribersFunction = target['notifySubscribers'];
target['notifySubscribers'] = function(valueToNotify, event) {
if (!event || event === defaultEvent) {
++pendingNotifications;
}
return underlyingNotifySubscribersFunction.apply(this, arguments);
};
// Each time the array changes value, capture a clone so that on the next
// change it's possible to produce a diff
var previousContents = [].concat(target.peek() || []);
cachedDiff = null;
arrayChangeSubscription = target.subscribe(function(currentContents) {
// Make a copy of the current contents and ensure it's an array
currentContents = [].concat(currentContents || []);
// Compute the diff and issue notifications, but only if someone is listening
if (target.hasSubscriptionsForEvent(arrayChangeEventName)) {
var changes = getChanges(previousContents, currentContents);
}
// Eliminate references to the old, removed items, so they can be GCed
previousContents = currentContents;
cachedDiff = null;
pendingNotifications = 0;
if (changes && changes.length) {
target['notifySubscribers'](changes, arrayChangeEventName);
}
});
}
function getChanges(previousContents, currentContents) {
// We try to re-use cached diffs.
// The scenarios where pendingNotifications > 1 are when using rate-limiting or the Deferred Updates
// plugin, which without this check would not be compatible with arrayChange notifications. Normally,
// notifications are issued immediately so we wouldn't be queueing up more than one.
if (!cachedDiff || pendingNotifications > 1) {
cachedDiff = ko.utils.compareArrays(previousContents, currentContents, { 'sparse': true });
}
return cachedDiff;
}
target.cacheDiffForKnownOperation = function(rawArray, operationName, args) {
// Only run if we're currently tracking changes for this observable array
// and there aren't any pending deferred notifications.
if (!trackingChanges || pendingNotifications) {
return;
}
var diff = [],
arrayLength = rawArray.length,
argsLength = args.length,
offset = 0;
function pushDiff(status, value, index) {
return diff[diff.length] = { 'status': status, 'value': value, 'index': index };
}
switch (operationName) {
case 'push':
offset = arrayLength;
case 'unshift':
for (var index = 0; index < argsLength; index++) {
pushDiff('added', args[index], offset + index);
}
break;
case 'pop':
offset = arrayLength - 1;
case 'shift':
if (arrayLength) {
pushDiff('deleted', rawArray[offset], offset);
}
break;
case 'splice':
// Negative start index means 'from end of array'. After that we clamp to [0...arrayLength].
// See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice
var startIndex = Math.min(Math.max(0, args[0] < 0 ? arrayLength + args[0] : args[0]), arrayLength),
endDeleteIndex = argsLength === 1 ? arrayLength : Math.min(startIndex + (args[1] || 0), arrayLength),
endAddIndex = startIndex + argsLength - 2,
endIndex = Math.max(endDeleteIndex, endAddIndex),
additions = [], deletions = [];
for (var index = startIndex, argsIndex = 2; index < endIndex; ++index, ++argsIndex) {
if (index < endDeleteIndex)
deletions.push(pushDiff('deleted', rawArray[index], index));
if (index < endAddIndex)
additions.push(pushDiff('added', args[argsIndex], index));
}
ko.utils.findMovesInArrayComparison(deletions, additions);
break;
default:
return;
}
cachedDiff = diff;
};
};
ko.computed = ko.dependentObservable = function (evaluatorFunctionOrOptions, evaluatorFunctionTarget, options) {
var _latestValue,
_needsEvaluation = true,
_isBeingEvaluated = false,
_suppressDisposalUntilDisposeWhenReturnsFalse = false,
_isDisposed = false,
readFunction = evaluatorFunctionOrOptions,
pure = false,
isSleeping = false;
if (readFunction && typeof readFunction == "object") {
// Single-parameter syntax - everything is on this "options" param
options = readFunction;
readFunction = options["read"];
} else {
// Multi-parameter syntax - construct the options according to the params passed
options = options || {};
if (!readFunction)
readFunction = options["read"];
}
if (typeof readFunction != "function")
throw new Error("Pass a function that returns the value of the ko.computed");
function addDependencyTracking(id, target, trackingObj) {
if (pure && target === dependentObservable) {
throw Error("A 'pure' computed must not be called recursively");
}
dependencyTracking[id] = trackingObj;
trackingObj._order = _dependenciesCount++;
trackingObj._version = target.getVersion();
}
function haveDependenciesChanged() {
var id, dependency;
for (id in dependencyTracking) {
if (dependencyTracking.hasOwnProperty(id)) {
dependency = dependencyTracking[id];
if (dependency._target.hasChanged(dependency._version)) {
return true;
}
}
}
}
function disposeComputed() {
if (!isSleeping && dependencyTracking) {
ko.utils.objectForEach(dependencyTracking, function (id, dependency) {
if (dependency.dispose)
dependency.dispose();
});
}
dependencyTracking = null;
_dependenciesCount = 0;
_isDisposed = true;
_needsEvaluation = false;
isSleeping = false;
}
function evaluatePossiblyAsync() {
var throttleEvaluationTimeout = dependentObservable['throttleEvaluation'];
if (throttleEvaluationTimeout && throttleEvaluationTimeout >= 0) {
clearTimeout(evaluationTimeoutInstance);
evaluationTimeoutInstance = setTimeout(function () {
evaluateImmediate(true /*notifyChange*/);
}, throttleEvaluationTimeout);
} else if (dependentObservable._evalRateLimited) {
dependentObservable._evalRateLimited();
} else {
evaluateImmediate(true /*notifyChange*/);
}
}
function evaluateImmediate(notifyChange) {
if (_isBeingEvaluated) {
// If the evaluation of a ko.computed causes side effects, it's possible that it will trigger its own re-evaluation.
// This is not desirable (it's hard for a developer to realise a chain of dependencies might cause this, and they almost
// certainly didn't intend infinite re-evaluations). So, for predictability, we simply prevent ko.computeds from causing
// their own re-evaluation. Further discussion at https://github.com/SteveSanderson/knockout/pull/387
return;
}
// Do not evaluate (and possibly capture new dependencies) if disposed
if (_isDisposed) {
return;
}
if (disposeWhen && disposeWhen()) {
// See comment below about _suppressDisposalUntilDisposeWhenReturnsFalse
if (!_suppressDisposalUntilDisposeWhenReturnsFalse) {
dispose();
return;
}
} else {
// It just did return false, so we can stop suppressing now
_suppressDisposalUntilDisposeWhenReturnsFalse = false;
}
_isBeingEvaluated = true;
try {
// Initially, we assume that none of the subscriptions are still being used (i.e., all are candidates for disposal).
// Then, during evaluation, we cross off any that are in fact still being used.
var disposalCandidates = dependencyTracking,
disposalCount = _dependenciesCount,
isInitial = pure ? undefined : !_dependenciesCount; // If we're evaluating when there are no previous dependencies, it must be the first time
ko.dependencyDetection.begin({
callback: function(subscribable, id) {
if (!_isDisposed) {
if (disposalCount && disposalCandidates[id]) {
// Don't want to dispose this subscription, as it's still being used
addDependencyTracking(id, subscribable, disposalCandidates[id]);
delete disposalCandidates[id];
--disposalCount;
} else if (!dependencyTracking[id]) {
// Brand new subscription - add it
addDependencyTracking(id, subscribable, isSleeping ? { _target: subscribable } : subscribable.subscribe(evaluatePossiblyAsync));
}
}
},
computed: dependentObservable,
isInitial: isInitial
});
dependencyTracking = {};
_dependenciesCount = 0;
try {
var newValue = evaluatorFunctionTarget ? readFunction.call(evaluatorFunctionTarget) : readFunction();
} finally {
ko.dependencyDetection.end();
// For each subscription no longer being used, remove it from the active subscriptions list and dispose it
if (disposalCount && !isSleeping) {
ko.utils.objectForEach(disposalCandidates, function(id, toDispose) {
if (toDispose.dispose)
toDispose.dispose();
});
}
_needsEvaluation = false;
}
if (dependentObservable.isDifferent(_latestValue, newValue)) {
if (!isSleeping) {
notify(_latestValue, "beforeChange");
}
_latestValue = newValue;
if (DEBUG) dependentObservable._latestValue = _latestValue;
if (isSleeping) {
dependentObservable.updateVersion();
} else if (notifyChange) {
notify(_latestValue);
}
}
if (isInitial) {
notify(_latestValue, "awake");
}
} finally {
_isBeingEvaluated = false;
}
if (!_dependenciesCount)
dispose();
}
function dependentObservable() {
if (arguments.length > 0) {
if (typeof writeFunction === "function") {
// Writing a value
writeFunction.apply(evaluatorFunctionTarget, arguments);
} else {
throw new Error("Cannot write a value to a ko.computed unless you specify a 'write' option. If you wish to read the current value, don't pass any parameters.");
}
return this; // Permits chained assignments
} else {
// Reading the value
ko.dependencyDetection.registerDependency(dependentObservable);
if (_needsEvaluation || (isSleeping && haveDependenciesChanged())) {
evaluateImmediate();
}
return _latestValue;
}
}
function peek() {
// Peek won't re-evaluate, except while the computed is sleeping or to get the initial value when "deferEvaluation" is set.
if ((_needsEvaluation && !_dependenciesCount) || (isSleeping && haveDependenciesChanged())) {
evaluateImmediate();
}
return _latestValue;
}
function isActive() {
return _needsEvaluation || _dependenciesCount > 0;
}
function notify(value, event) {
dependentObservable["notifySubscribers"](value, event);
}
// By here, "options" is always non-null
var writeFunction = options["write"],
disposeWhenNodeIsRemoved = options["disposeWhenNodeIsRemoved"] || options.disposeWhenNodeIsRemoved || null,
disposeWhenOption = options["disposeWhen"] || options.disposeWhen,
disposeWhen = disposeWhenOption,
dispose = disposeComputed,
dependencyTracking = {},
_dependenciesCount = 0,
evaluationTimeoutInstance = null;
if (!evaluatorFunctionTarget)
evaluatorFunctionTarget = options["owner"];
ko.subscribable.call(dependentObservable);
ko.utils.setPrototypeOfOrExtend(dependentObservable, ko.dependentObservable['fn']);
dependentObservable.peek = peek;
dependentObservable.getDependenciesCount = function () { return _dependenciesCount; };
dependentObservable.hasWriteFunction = typeof writeFunction === "function";
dependentObservable.dispose = function () { dispose(); };
dependentObservable.isActive = isActive;
// Replace the limit function with one that delays evaluation as well.
var originalLimit = dependentObservable.limit;
dependentObservable.limit = function(limitFunction) {
originalLimit.call(dependentObservable, limitFunction);
dependentObservable._evalRateLimited = function() {
dependentObservable._rateLimitedBeforeChange(_latestValue);
_needsEvaluation = true; // Mark as dirty
// Pass the observable to the rate-limit code, which will access it when
// it's time to do the notification.
dependentObservable._rateLimitedChange(dependentObservable);
}
};
if (options['pure']) {
pure = true;
isSleeping = true; // Starts off sleeping; will awake on the first subscription
dependentObservable.beforeSubscriptionAdd = function (event) {
// If asleep, wake up the computed by subscribing to any dependencies.
if (!_isDisposed && isSleeping && event == 'change') {
isSleeping = false;
if (_needsEvaluation || haveDependenciesChanged()) {
dependencyTracking = null;
_dependenciesCount = 0;
_needsEvaluation = true;
evaluateImmediate();
} else {
// First put the dependencies in order
var dependeciesOrder = [];
ko.utils.objectForEach(dependencyTracking, function (id, dependency) {
dependeciesOrder[dependency._order] = id;
});
// Next, subscribe to each one
ko.utils.arrayForEach(dependeciesOrder, function(id, order) {
var dependency = dependencyTracking[id],
subscription = dependency._target.subscribe(evaluatePossiblyAsync);
subscription._order = order;
subscription._version = dependency._version;
dependencyTracking[id] = subscription;
});
}
if (!_isDisposed) { // test since evaluating could trigger disposal
notify(_latestValue, "awake");
}
}
};
dependentObservable.afterSubscriptionRemove = function (event) {
if (!_isDisposed && event == 'change' && !dependentObservable.hasSubscriptionsForEvent('change')) {
ko.utils.objectForEach(dependencyTracking, function (id, dependency) {
if (dependency.dispose) {
dependencyTracking[id] = {
_target: dependency._target,
_order: dependency._order,
_version: dependency._version
};
dependency.dispose();
}
});
isSleeping = true;
notify(undefined, "asleep");
}
};
// Because a pure computed is not automatically updated while it is sleeping, we can't
// simply return the version number. Instead, we check if any of the dependencies have
// changed and conditionally re-evaluate the computed observable.
dependentObservable._originalGetVersion = dependentObservable.getVersion;
dependentObservable.getVersion = function () {
if (isSleeping && (_needsEvaluation || haveDependenciesChanged())) {
evaluateImmediate();
}
return dependentObservable._originalGetVersion();
};
} else if (options['deferEvaluation']) {
// This will force a computed with deferEvaluation to evaluate when the first subscriptions is registered.
dependentObservable.beforeSubscriptionAdd = function (event) {
if (event == 'change' || event == 'beforeChange') {
peek();
}
}
}
ko.exportProperty(dependentObservable, 'peek', dependentObservable.peek);
ko.exportProperty(dependentObservable, 'dispose', dependentObservable.dispose);
ko.exportProperty(dependentObservable, 'isActive', dependentObservable.isActive);
ko.exportProperty(dependentObservable, 'getDependenciesCount', dependentObservable.getDependenciesCount);
// Add a "disposeWhen" callback that, on each evaluation, disposes if the node was removed without using ko.removeNode.
if (disposeWhenNodeIsRemoved) {
// Since this computed is associated with a DOM node, and we don't want to dispose the computed
// until the DOM node is *removed* from the document (as opposed to never having been in the document),
// we'll prevent disposal until "disposeWhen" first returns false.
_suppressDisposalUntilDisposeWhenReturnsFalse = true;
// Only watch for the node's disposal if the value really is a node. It might not be,
// e.g., { disposeWhenNodeIsRemoved: true } can be used to opt into the "only dispose
// after first false result" behaviour even if there's no specific node to watch. This
// technique is intended for KO's internal use only and shouldn't be documented or used
// by application code, as it's likely to change in a future version of KO.
if (disposeWhenNodeIsRemoved.nodeType) {
disposeWhen = function () {
return !ko.utils.domNodeIsAttachedToDocument(disposeWhenNodeIsRemoved) || (disposeWhenOption && disposeWhenOption());
};
}
}
// Evaluate, unless sleeping or deferEvaluation is true
if (!isSleeping && !options['deferEvaluation'])
evaluateImmediate();
// Attach a DOM node disposal callback so that the computed will be proactively disposed as soon as the node is
// removed using ko.removeNode. But skip if isActive is false (there will never be any dependencies to dispose).
if (disposeWhenNodeIsRemoved && isActive() && disposeWhenNodeIsRemoved.nodeType) {
dispose = function() {
ko.utils.domNodeDisposal.removeDisposeCallback(disposeWhenNodeIsRemoved, dispose);
disposeComputed();
};
ko.utils.domNodeDisposal.addDisposeCallback(disposeWhenNodeIsRemoved, dispose);
}
return dependentObservable;
};
ko.isComputed = function(instance) {
return ko.hasPrototype(instance, ko.dependentObservable);
};
var protoProp = ko.observable.protoProperty; // == "__ko_proto__"
ko.dependentObservable[protoProp] = ko.observable;
ko.dependentObservable['fn'] = {
"equalityComparer": valuesArePrimitiveAndEqual
};
ko.dependentObservable['fn'][protoProp] = ko.dependentObservable;
// Note that for browsers that don't support proto assignment, the
// inheritance chain is created manually in the ko.dependentObservable constructor
if (ko.utils.canSetPrototype) {
ko.utils.setPrototypeOf(ko.dependentObservable['fn'], ko.subscribable['fn']);
}
ko.exportSymbol('dependentObservable', ko.dependentObservable);
ko.exportSymbol('computed', ko.dependentObservable); // Make "ko.computed" an alias for "ko.dependentObservable"
ko.exportSymbol('isComputed', ko.isComputed);
ko.pureComputed = function (evaluatorFunctionOrOptions, evaluatorFunctionTarget) {
if (typeof evaluatorFunctionOrOptions === 'function') {
return ko.computed(evaluatorFunctionOrOptions, evaluatorFunctionTarget, {'pure':true});
} else {
evaluatorFunctionOrOptions = ko.utils.extend({}, evaluatorFunctionOrOptions); // make a copy of the parameter object
evaluatorFunctionOrOptions['pure'] = true;
return ko.computed(evaluatorFunctionOrOptions, evaluatorFunctionTarget);
}
}
ko.exportSymbol('pureComputed', ko.pureComputed);
(function() {
var maxNestedObservableDepth = 10; // Escape the (unlikely) pathalogical case where an observable's current value is itself (or similar reference cycle)
ko.toJS = function(rootObject) {
if (arguments.length == 0)
throw new Error("When calling ko.toJS, pass the object you want to convert.");
// We just unwrap everything at every level in the object graph
return mapJsObjectGraph(rootObject, function(valueToMap) {
// Loop because an observable's value might in turn be another observable wrapper
for (var i = 0; ko.isObservable(valueToMap) && (i < maxNestedObservableDepth); i++)
valueToMap = valueToMap();
return valueToMap;
});
};
ko.toJSON = function(rootObject, replacer, space) { // replacer and space are optional
var plainJavaScriptObject = ko.toJS(rootObject);
return ko.utils.stringifyJson(plainJavaScriptObject, replacer, space);
};
function mapJsObjectGraph(rootObject, mapInputCallback, visitedObjects) {
visitedObjects = visitedObjects || new objectLookup();
rootObject = mapInputCallback(rootObject);
var canHaveProperties = (typeof rootObject == "object") && (rootObject !== null) && (rootObject !== undefined) && (!(rootObject instanceof Date)) && (!(rootObject instanceof String)) && (!(rootObject instanceof Number)) && (!(rootObject instanceof Boolean));
if (!canHaveProperties)
return rootObject;
var outputProperties = rootObject instanceof Array ? [] : {};
visitedObjects.save(rootObject, outputProperties);
visitPropertiesOrArrayEntries(rootObject, function(indexer) {
var propertyValue = mapInputCallback(rootObject[indexer]);
switch (typeof propertyValue) {
case "boolean":
case "number":
case "string":
case "function":
outputProperties[indexer] = propertyValue;
break;
case "object":
case "undefined":
var previouslyMappedValue = visitedObjects.get(propertyValue);
outputProperties[indexer] = (previouslyMappedValue !== undefined)
? previouslyMappedValue
: mapJsObjectGraph(propertyValue, mapInputCallback, visitedObjects);
break;
}
});
return outputProperties;
}
function visitPropertiesOrArrayEntries(rootObject, visitorCallback) {
if (rootObject instanceof Array) {
for (var i = 0; i < rootObject.length; i++)
visitorCallback(i);
// For arrays, also respect toJSON property for custom mappings (fixes #278)
if (typeof rootObject['toJSON'] == 'function')
visitorCallback('toJSON');
} else {
for (var propertyName in rootObject) {
visitorCallback(propertyName);
}
}
};
function objectLookup() {
this.keys = [];
this.values = [];
};
objectLookup.prototype = {
constructor: objectLookup,
save: function(key, value) {
var existingIndex = ko.utils.arrayIndexOf(this.keys, key);
if (existingIndex >= 0)
this.values[existingIndex] = value;
else {
this.keys.push(key);
this.values.push(value);
}
},
get: function(key) {
var existingIndex = ko.utils.arrayIndexOf(this.keys, key);
return (existingIndex >= 0) ? this.values[existingIndex] : undefined;
}
};
})();
ko.exportSymbol('toJS', ko.toJS);
ko.exportSymbol('toJSON', ko.toJSON);
(function () {
var hasDomDataExpandoProperty = '__ko__hasDomDataOptionValue__';
// Normally, SELECT elements and their OPTIONs can only take value of type 'string' (because the values
// are stored on DOM attributes). ko.selectExtensions provides a way for SELECTs/OPTIONs to have values
// that are arbitrary objects. This is very convenient when implementing things like cascading dropdowns.
ko.selectExtensions = {
readValue : function(element) {
switch (ko.utils.tagNameLower(element)) {
case 'option':
if (element[hasDomDataExpandoProperty] === true)
return ko.utils.domData.get(element, ko.bindingHandlers.options.optionValueDomDataKey);
return ko.utils.ieVersion <= 7
? (element.getAttributeNode('value') && element.getAttributeNode('value').specified ? element.value : element.text)
: element.value;
case 'select':
return element.selectedIndex >= 0 ? ko.selectExtensions.readValue(element.options[element.selectedIndex]) : undefined;
default:
return element.value;
}
},
writeValue: function(element, value, allowUnset) {
switch (ko.utils.tagNameLower(element)) {
case 'option':
switch(typeof value) {
case "string":
ko.utils.domData.set(element, ko.bindingHandlers.options.optionValueDomDataKey, undefined);
if (hasDomDataExpandoProperty in element) { // IE <= 8 throws errors if you delete non-existent properties from a DOM node
delete element[hasDomDataExpandoProperty];
}
element.value = value;
break;
default:
// Store arbitrary object using DomData
ko.utils.domData.set(element, ko.bindingHandlers.options.optionValueDomDataKey, value);
element[hasDomDataExpandoProperty] = true;
// Special treatment of numbers is just for backward compatibility. KO 1.2.1 wrote numerical values to element.value.
element.value = typeof value === "number" ? value : "";
break;
}
break;
case 'select':
if (value === "" || value === null) // A blank string or null value will select the caption
value = undefined;
var selection = -1;
for (var i = 0, n = element.options.length, optionValue; i < n; ++i) {
optionValue = ko.selectExtensions.readValue(element.options[i]);
// Include special check to handle selecting a caption with a blank string value
if (optionValue == value || (optionValue == "" && value === undefined)) {
selection = i;
break;
}
}
if (allowUnset || selection >= 0 || (value === undefined && element.size > 1)) {
element.selectedIndex = selection;
}
break;
default:
if ((value === null) || (value === undefined))
value = "";
element.value = value;
break;
}
}
};
})();
ko.exportSymbol('selectExtensions', ko.selectExtensions);
ko.exportSymbol('selectExtensions.readValue', ko.selectExtensions.readValue);
ko.exportSymbol('selectExtensions.writeValue', ko.selectExtensions.writeValue);
ko.expressionRewriting = (function () {
var javaScriptReservedWords = ["true", "false", "null", "undefined"];
// Matches something that can be assigned to--either an isolated identifier or something ending with a property accessor
// This is designed to be simple and avoid false negatives, but could produce false positives (e.g., a+b.c).
// This also will not properly handle nested brackets (e.g., obj1[obj2['prop']]; see #911).
var javaScriptAssignmentTarget = /^(?:[$_a-z][$\w]*|(.+)(\.\s*[$_a-z][$\w]*|\[.+\]))$/i;
function getWriteableValue(expression) {
if (ko.utils.arrayIndexOf(javaScriptReservedWords, expression) >= 0)
return false;
var match = expression.match(javaScriptAssignmentTarget);
return match === null ? false : match[1] ? ('Object(' + match[1] + ')' + match[2]) : expression;
}
// The following regular expressions will be used to split an object-literal string into tokens
// These two match strings, either with double quotes or single quotes
var stringDouble = '"(?:[^"\\\\]|\\\\.)*"',
stringSingle = "'(?:[^'\\\\]|\\\\.)*'",
// Matches a regular expression (text enclosed by slashes), but will also match sets of divisions
// as a regular expression (this is handled by the parsing loop below).
stringRegexp = '/(?:[^/\\\\]|\\\\.)*/\w*',
// These characters have special meaning to the parser and must not appear in the middle of a
// token, except as part of a string.
specials = ',"\'{}()/:[\\]',
// Match text (at least two characters) that does not contain any of the above special characters,
// although some of the special characters are allowed to start it (all but the colon and comma).
// The text can contain spaces, but leading or trailing spaces are skipped.
everyThingElse = '[^\\s:,/][^' + specials + ']*[^\\s' + specials + ']',
// Match any non-space character not matched already. This will match colons and commas, since they're
// not matched by "everyThingElse", but will also match any other single character that wasn't already
// matched (for example: in "a: 1, b: 2", each of the non-space characters will be matched by oneNotSpace).
oneNotSpace = '[^\\s]',
// Create the actual regular expression by or-ing the above strings. The order is important.
bindingToken = RegExp(stringDouble + '|' + stringSingle + '|' + stringRegexp + '|' + everyThingElse + '|' + oneNotSpace, 'g'),
// Match end of previous token to determine whether a slash is a division or regex.
divisionLookBehind = /[\])"'A-Za-z0-9_$]+$/,
keywordRegexLookBehind = {'in':1,'return':1,'typeof':1};
function parseObjectLiteral(objectLiteralString) {
// Trim leading and trailing spaces from the string
var str = ko.utils.stringTrim(objectLiteralString);
// Trim braces '{' surrounding the whole object literal
if (str.charCodeAt(0) === 123) str = str.slice(1, -1);
// Split into tokens
var result = [], toks = str.match(bindingToken), key, values = [], depth = 0;
if (toks) {
// Append a comma so that we don't need a separate code block to deal with the last item
toks.push(',');
for (var i = 0, tok; tok = toks[i]; ++i) {
var c = tok.charCodeAt(0);
// A comma signals the end of a key/value pair if depth is zero
if (c === 44) { // ","
if (depth <= 0) {
result.push((key && values.length) ? {key: key, value: values.join('')} : {'unknown': key || values.join('')});
key = depth = 0;
values = [];
continue;
}
// Simply skip the colon that separates the name and value
} else if (c === 58) { // ":"
if (!depth && !key && values.length === 1) {
key = values.pop();
continue;
}
// A set of slashes is initially matched as a regular expression, but could be division
} else if (c === 47 && i && tok.length > 1) { // "/"
// Look at the end of the previous token to determine if the slash is actually division
var match = toks[i-1].match(divisionLookBehind);
if (match && !keywordRegexLookBehind[match[0]]) {
// The slash is actually a division punctuator; re-parse the remainder of the string (not including the slash)
str = str.substr(str.indexOf(tok) + 1);
toks = str.match(bindingToken);
toks.push(',');
i = -1;
// Continue with just the slash
tok = '/';
}
// Increment depth for parentheses, braces, and brackets so that interior commas are ignored
} else if (c === 40 || c === 123 || c === 91) { // '(', '{', '['
++depth;
} else if (c === 41 || c === 125 || c === 93) { // ')', '}', ']'
--depth;
// The key will be the first token; if it's a string, trim the quotes
} else if (!key && !values.length && (c === 34 || c === 39)) { // '"', "'"
tok = tok.slice(1, -1);
}
values.push(tok);
}
}
return result;
}
// Two-way bindings include a write function that allow the handler to update the value even if it's not an observable.
var twoWayBindings = {};
function preProcessBindings(bindingsStringOrKeyValueArray, bindingOptions) {
bindingOptions = bindingOptions || {};
function processKeyValue(key, val) {
var writableVal;
function callPreprocessHook(obj) {
return (obj && obj['preprocess']) ? (val = obj['preprocess'](val, key, processKeyValue)) : true;
}
if (!bindingParams) {
if (!callPreprocessHook(ko['getBindingHandler'](key)))
return;
if (twoWayBindings[key] && (writableVal = getWriteableValue(val))) {
// For two-way bindings, provide a write method in case the value
// isn't a writable observable.
propertyAccessorResultStrings.push("'" + key + "':function(_z){" + writableVal + "=_z}");
}
}
// Values are wrapped in a function so that each value can be accessed independently
if (makeValueAccessors) {
val = 'function(){return ' + val + ' }';
}
resultStrings.push("'" + key + "':" + val);
}
var resultStrings = [],
propertyAccessorResultStrings = [],
makeValueAccessors = bindingOptions['valueAccessors'],
bindingParams = bindingOptions['bindingParams'],
keyValueArray = typeof bindingsStringOrKeyValueArray === "string" ?
parseObjectLiteral(bindingsStringOrKeyValueArray) : bindingsStringOrKeyValueArray;
ko.utils.arrayForEach(keyValueArray, function(keyValue) {
processKeyValue(keyValue.key || keyValue['unknown'], keyValue.value);
});
if (propertyAccessorResultStrings.length)
processKeyValue('_ko_property_writers', "{" + propertyAccessorResultStrings.join(",") + " }");
return resultStrings.join(",");
}
return {
bindingRewriteValidators: [],
twoWayBindings: twoWayBindings,
parseObjectLiteral: parseObjectLiteral,
preProcessBindings: preProcessBindings,
keyValueArrayContainsKey: function(keyValueArray, key) {
for (var i = 0; i < keyValueArray.length; i++)
if (keyValueArray[i]['key'] == key)
return true;
return false;
},
// Internal, private KO utility for updating model properties from within bindings
// property: If the property being updated is (or might be) an observable, pass it here
// If it turns out to be a writable observable, it will be written to directly
// allBindings: An object with a get method to retrieve bindings in the current execution context.
// This will be searched for a '_ko_property_writers' property in case you're writing to a non-observable
// key: The key identifying the property to be written. Example: for { hasFocus: myValue }, write to 'myValue' by specifying the key 'hasFocus'
// value: The value to be written
// checkIfDifferent: If true, and if the property being written is a writable observable, the value will only be written if
// it is !== existing value on that writable observable
writeValueToProperty: function(property, allBindings, key, value, checkIfDifferent) {
if (!property || !ko.isObservable(property)) {
var propWriters = allBindings.get('_ko_property_writers');
if (propWriters && propWriters[key])
propWriters[key](value);
} else if (ko.isWriteableObservable(property) && (!checkIfDifferent || property.peek() !== value)) {
property(value);
}
}
};
})();
ko.exportSymbol('expressionRewriting', ko.expressionRewriting);
ko.exportSymbol('expressionRewriting.bindingRewriteValidators', ko.expressionRewriting.bindingRewriteValidators);
ko.exportSymbol('expressionRewriting.parseObjectLiteral', ko.expressionRewriting.parseObjectLiteral);
ko.exportSymbol('expressionRewriting.preProcessBindings', ko.expressionRewriting.preProcessBindings);
// Making bindings explicitly declare themselves as "two way" isn't ideal in the long term (it would be better if
// all bindings could use an official 'property writer' API without needing to declare that they might). However,
// since this is not, and has never been, a public API (_ko_property_writers was never documented), it's acceptable
// as an internal implementation detail in the short term.
// For those developers who rely on _ko_property_writers in their custom bindings, we expose _twoWayBindings as an
// undocumented feature that makes it relatively easy to upgrade to KO 3.0. However, this is still not an official
// public API, and we reserve the right to remove it at any time if we create a real public property writers API.
ko.exportSymbol('expressionRewriting._twoWayBindings', ko.expressionRewriting.twoWayBindings);
// For backward compatibility, define the following aliases. (Previously, these function names were misleading because
// they referred to JSON specifically, even though they actually work with arbitrary JavaScript object literal expressions.)
ko.exportSymbol('jsonExpressionRewriting', ko.expressionRewriting);
ko.exportSymbol('jsonExpressionRewriting.insertPropertyAccessorsIntoJson', ko.expressionRewriting.preProcessBindings);
(function() {
// "Virtual elements" is an abstraction on top of the usual DOM API which understands the notion that comment nodes
// may be used to represent hierarchy (in addition to the DOM's natural hierarchy).
// If you call the DOM-manipulating functions on ko.virtualElements, you will be able to read and write the state
// of that virtual hierarchy
//
// The point of all this is to support containerless templates (e.g., <!-- ko foreach:someCollection -->blah<!-- /ko -->)
// without having to scatter special cases all over the binding and templating code.
// IE 9 cannot reliably read the "nodeValue" property of a comment node (see https://github.com/SteveSanderson/knockout/issues/186)
// but it does give them a nonstandard alternative property called "text" that it can read reliably. Other browsers don't have that property.
// So, use node.text where available, and node.nodeValue elsewhere
var commentNodesHaveTextProperty = document && document.createComment("test").text === "<!--test-->";
var startCommentRegex = commentNodesHaveTextProperty ? /^<!--\s*ko(?:\s+([\s\S]+))?\s*-->$/ : /^\s*ko(?:\s+([\s\S]+))?\s*$/;
var endCommentRegex = commentNodesHaveTextProperty ? /^<!--\s*\/ko\s*-->$/ : /^\s*\/ko\s*$/;
var htmlTagsWithOptionallyClosingChildren = { 'ul': true, 'ol': true };
function isStartComment(node) {
return (node.nodeType == 8) && startCommentRegex.test(commentNodesHaveTextProperty ? node.text : node.nodeValue);
}
function isEndComment(node) {
return (node.nodeType == 8) && endCommentRegex.test(commentNodesHaveTextProperty ? node.text : node.nodeValue);
}
function getVirtualChildren(startComment, allowUnbalanced) {
var currentNode = startComment;
var depth = 1;
var children = [];
while (currentNode = currentNode.nextSibling) {
if (isEndComment(currentNode)) {
depth--;
if (depth === 0)
return children;
}
children.push(currentNode);
if (isStartComment(currentNode))
depth++;
}
if (!allowUnbalanced)
throw new Error("Cannot find closing comment tag to match: " + startComment.nodeValue);
return null;
}
function getMatchingEndComment(startComment, allowUnbalanced) {
var allVirtualChildren = getVirtualChildren(startComment, allowUnbalanced);
if (allVirtualChildren) {
if (allVirtualChildren.length > 0)
return allVirtualChildren[allVirtualChildren.length - 1].nextSibling;
return startComment.nextSibling;
} else
return null; // Must have no matching end comment, and allowUnbalanced is true
}
function getUnbalancedChildTags(node) {
// e.g., from <div>OK</div><!-- ko blah --><span>Another</span>, returns: <!-- ko blah --><span>Another</span>
// from <div>OK</div><!-- /ko --><!-- /ko -->, returns: <!-- /ko --><!-- /ko -->
var childNode = node.firstChild, captureRemaining = null;
if (childNode) {
do {
if (captureRemaining) // We already hit an unbalanced node and are now just scooping up all subsequent nodes
captureRemaining.push(childNode);
else if (isStartComment(childNode)) {
var matchingEndComment = getMatchingEndComment(childNode, /* allowUnbalanced: */ true);
if (matchingEndComment) // It's a balanced tag, so skip immediately to the end of this virtual set
childNode = matchingEndComment;
else
captureRemaining = [childNode]; // It's unbalanced, so start capturing from this point
} else if (isEndComment(childNode)) {
captureRemaining = [childNode]; // It's unbalanced (if it wasn't, we'd have skipped over it already), so start capturing
}
} while (childNode = childNode.nextSibling);
}
return captureRemaining;
}
ko.virtualElements = {
allowedBindings: {},
childNodes: function(node) {
return isStartComment(node) ? getVirtualChildren(node) : node.childNodes;
},
emptyNode: function(node) {
if (!isStartComment(node))
ko.utils.emptyDomNode(node);
else {
var virtualChildren = ko.virtualElements.childNodes(node);
for (var i = 0, j = virtualChildren.length; i < j; i++)
ko.removeNode(virtualChildren[i]);
}
},
setDomNodeChildren: function(node, childNodes) {
if (!isStartComment(node))
ko.utils.setDomNodeChildren(node, childNodes);
else {
ko.virtualElements.emptyNode(node);
var endCommentNode = node.nextSibling; // Must be the next sibling, as we just emptied the children
for (var i = 0, j = childNodes.length; i < j; i++)
endCommentNode.parentNode.insertBefore(childNodes[i], endCommentNode);
}
},
prepend: function(containerNode, nodeToPrepend) {
if (!isStartComment(containerNode)) {
if (containerNode.firstChild)
containerNode.insertBefore(nodeToPrepend, containerNode.firstChild);
else
containerNode.appendChild(nodeToPrepend);
} else {
// Start comments must always have a parent and at least one following sibling (the end comment)
containerNode.parentNode.insertBefore(nodeToPrepend, containerNode.nextSibling);
}
},
insertAfter: function(containerNode, nodeToInsert, insertAfterNode) {
if (!insertAfterNode) {
ko.virtualElements.prepend(containerNode, nodeToInsert);
} else if (!isStartComment(containerNode)) {
// Insert after insertion point
if (insertAfterNode.nextSibling)
containerNode.insertBefore(nodeToInsert, insertAfterNode.nextSibling);
else
containerNode.appendChild(nodeToInsert);
} else {
// Children of start comments must always have a parent and at least one following sibling (the end comment)
containerNode.parentNode.insertBefore(nodeToInsert, insertAfterNode.nextSibling);
}
},
firstChild: function(node) {
if (!isStartComment(node))
return node.firstChild;
if (!node.nextSibling || isEndComment(node.nextSibling))
return null;
return node.nextSibling;
},
nextSibling: function(node) {
if (isStartComment(node))
node = getMatchingEndComment(node);
if (node.nextSibling && isEndComment(node.nextSibling))
return null;
return node.nextSibling;
},
hasBindingValue: isStartComment,
virtualNodeBindingValue: function(node) {
var regexMatch = (commentNodesHaveTextProperty ? node.text : node.nodeValue).match(startCommentRegex);
return regexMatch ? regexMatch[1] : null;
},
normaliseVirtualElementDomStructure: function(elementVerified) {
// Workaround for https://github.com/SteveSanderson/knockout/issues/155
// (IE <= 8 or IE 9 quirks mode parses your HTML weirdly, treating closing </li> tags as if they don't exist, thereby moving comment nodes
// that are direct descendants of <ul> into the preceding <li>)
if (!htmlTagsWithOptionallyClosingChildren[ko.utils.tagNameLower(elementVerified)])
return;
// Scan immediate children to see if they contain unbalanced comment tags. If they do, those comment tags
// must be intended to appear *after* that child, so move them there.
var childNode = elementVerified.firstChild;
if (childNode) {
do {
if (childNode.nodeType === 1) {
var unbalancedTags = getUnbalancedChildTags(childNode);
if (unbalancedTags) {
// Fix up the DOM by moving the unbalanced tags to where they most likely were intended to be placed - *after* the child
var nodeToInsertBefore = childNode.nextSibling;
for (var i = 0; i < unbalancedTags.length; i++) {
if (nodeToInsertBefore)
elementVerified.insertBefore(unbalancedTags[i], nodeToInsertBefore);
else
elementVerified.appendChild(unbalancedTags[i]);
}
}
}
} while (childNode = childNode.nextSibling);
}
}
};
})();
ko.exportSymbol('virtualElements', ko.virtualElements);
ko.exportSymbol('virtualElements.allowedBindings', ko.virtualElements.allowedBindings);
ko.exportSymbol('virtualElements.emptyNode', ko.virtualElements.emptyNode);
//ko.exportSymbol('virtualElements.firstChild', ko.virtualElements.firstChild); // firstChild is not minified
ko.exportSymbol('virtualElements.insertAfter', ko.virtualElements.insertAfter);
//ko.exportSymbol('virtualElements.nextSibling', ko.virtualElements.nextSibling); // nextSibling is not minified
ko.exportSymbol('virtualElements.prepend', ko.virtualElements.prepend);
ko.exportSymbol('virtualElements.setDomNodeChildren', ko.virtualElements.setDomNodeChildren);
(function() {
var defaultBindingAttributeName = "data-bind";
ko.bindingProvider = function() {
this.bindingCache = {};
};
ko.utils.extend(ko.bindingProvider.prototype, {
'nodeHasBindings': function(node) {
switch (node.nodeType) {
case 1: // Element
return node.getAttribute(defaultBindingAttributeName) != null
|| ko.components['getComponentNameForNode'](node);
case 8: // Comment node
return ko.virtualElements.hasBindingValue(node);
default: return false;
}
},
'getBindings': function(node, bindingContext) {
var bindingsString = this['getBindingsString'](node, bindingContext),
parsedBindings = bindingsString ? this['parseBindingsString'](bindingsString, bindingContext, node) : null;
return ko.components.addBindingsForCustomElement(parsedBindings, node, bindingContext, /* valueAccessors */ false);
},
'getBindingAccessors': function(node, bindingContext) {
var bindingsString = this['getBindingsString'](node, bindingContext),
parsedBindings = bindingsString ? this['parseBindingsString'](bindingsString, bindingContext, node, { 'valueAccessors': true }) : null;
return ko.components.addBindingsForCustomElement(parsedBindings, node, bindingContext, /* valueAccessors */ true);
},
// The following function is only used internally by this default provider.
// It's not part of the interface definition for a general binding provider.
'getBindingsString': function(node, bindingContext) {
switch (node.nodeType) {
case 1: return node.getAttribute(defaultBindingAttributeName); // Element
case 8: return ko.virtualElements.virtualNodeBindingValue(node); // Comment node
default: return null;
}
},
// The following function is only used internally by this default provider.
// It's not part of the interface definition for a general binding provider.
'parseBindingsString': function(bindingsString, bindingContext, node, options) {
try {
var bindingFunction = createBindingsStringEvaluatorViaCache(bindingsString, this.bindingCache, options);
return bindingFunction(bindingContext, node);
} catch (ex) {
ex.message = "Unable to parse bindings.\nBindings value: " + bindingsString + "\nMessage: " + ex.message;
throw ex;
}
}
});
ko.bindingProvider['instance'] = new ko.bindingProvider();
function createBindingsStringEvaluatorViaCache(bindingsString, cache, options) {
var cacheKey = bindingsString + (options && options['valueAccessors'] || '');
return cache[cacheKey]
|| (cache[cacheKey] = createBindingsStringEvaluator(bindingsString, options));
}
function createBindingsStringEvaluator(bindingsString, options) {
// Build the source for a function that evaluates "expression"
// For each scope variable, add an extra level of "with" nesting
// Example result: with(sc1) { with(sc0) { return (expression) } }
var rewrittenBindings = ko.expressionRewriting.preProcessBindings(bindingsString, options),
functionBody = "with($context){with($data||{}){return{" + rewrittenBindings + "}}}";
return new Function("$context", "$element", functionBody);
}
})();
ko.exportSymbol('bindingProvider', ko.bindingProvider);
(function () {
ko.bindingHandlers = {};
// The following element types will not be recursed into during binding. In the future, we
// may consider adding <template> to this list, because such elements' contents are always
// intended to be bound in a different context from where they appear in the document.
var bindingDoesNotRecurseIntoElementTypes = {
// Don't want bindings that operate on text nodes to mutate <script> and <textarea> contents,
// because it's unexpected and a potential XSS issue
'script': true,
'textarea': true
};
// Use an overridable method for retrieving binding handlers so that a plugins may support dynamically created handlers
ko['getBindingHandler'] = function(bindingKey) {
return ko.bindingHandlers[bindingKey];
};
// The ko.bindingContext constructor is only called directly to create the root context. For child
// contexts, use bindingContext.createChildContext or bindingContext.extend.
ko.bindingContext = function(dataItemOrAccessor, parentContext, dataItemAlias, extendCallback) {
// The binding context object includes static properties for the current, parent, and root view models.
// If a view model is actually stored in an observable, the corresponding binding context object, and
// any child contexts, must be updated when the view model is changed.
function updateContext() {
// Most of the time, the context will directly get a view model object, but if a function is given,
// we call the function to retrieve the view model. If the function accesses any obsevables or returns
// an observable, the dependency is tracked, and those observables can later cause the binding
// context to be updated.
var dataItemOrObservable = isFunc ? dataItemOrAccessor() : dataItemOrAccessor,
dataItem = ko.utils.unwrapObservable(dataItemOrObservable);
if (parentContext) {
// When a "parent" context is given, register a dependency on the parent context. Thus whenever the
// parent context is updated, this context will also be updated.
if (parentContext._subscribable)
parentContext._subscribable();
// Copy $root and any custom properties from the parent context
ko.utils.extend(self, parentContext);
// Because the above copy overwrites our own properties, we need to reset them.
// During the first execution, "subscribable" isn't set, so don't bother doing the update then.
if (subscribable) {
self._subscribable = subscribable;
}
} else {
self['$parents'] = [];
self['$root'] = dataItem;
// Export 'ko' in the binding context so it will be available in bindings and templates
// even if 'ko' isn't exported as a global, such as when using an AMD loader.
// See https://github.com/SteveSanderson/knockout/issues/490
self['ko'] = ko;
}
self['$rawData'] = dataItemOrObservable;
self['$data'] = dataItem;
if (dataItemAlias)
self[dataItemAlias] = dataItem;
// The extendCallback function is provided when creating a child context or extending a context.
// It handles the specific actions needed to finish setting up the binding context. Actions in this
// function could also add dependencies to this binding context.
if (extendCallback)
extendCallback(self, parentContext, dataItem);
return self['$data'];
}
function disposeWhen() {
return nodes && !ko.utils.anyDomNodeIsAttachedToDocument(nodes);
}
var self = this,
isFunc = typeof(dataItemOrAccessor) == "function" && !ko.isObservable(dataItemOrAccessor),
nodes,
subscribable = ko.dependentObservable(updateContext, null, { disposeWhen: disposeWhen, disposeWhenNodeIsRemoved: true });
// At this point, the binding context has been initialized, and the "subscribable" computed observable is
// subscribed to any observables that were accessed in the process. If there is nothing to track, the
// computed will be inactive, and we can safely throw it away. If it's active, the computed is stored in
// the context object.
if (subscribable.isActive()) {
self._subscribable = subscribable;
// Always notify because even if the model ($data) hasn't changed, other context properties might have changed
subscribable['equalityComparer'] = null;
// We need to be able to dispose of this computed observable when it's no longer needed. This would be
// easy if we had a single node to watch, but binding contexts can be used by many different nodes, and
// we cannot assume that those nodes have any relation to each other. So instead we track any node that
// the context is attached to, and dispose the computed when all of those nodes have been cleaned.
// Add properties to *subscribable* instead of *self* because any properties added to *self* may be overwritten on updates
nodes = [];
subscribable._addNode = function(node) {
nodes.push(node);
ko.utils.domNodeDisposal.addDisposeCallback(node, function(node) {
ko.utils.arrayRemoveItem(nodes, node);
if (!nodes.length) {
subscribable.dispose();
self._subscribable = subscribable = undefined;
}
});
};
}
}
// Extend the binding context hierarchy with a new view model object. If the parent context is watching
// any obsevables, the new child context will automatically get a dependency on the parent context.
// But this does not mean that the $data value of the child context will also get updated. If the child
// view model also depends on the parent view model, you must provide a function that returns the correct
// view model on each update.
ko.bindingContext.prototype['createChildContext'] = function (dataItemOrAccessor, dataItemAlias, extendCallback) {
return new ko.bindingContext(dataItemOrAccessor, this, dataItemAlias, function(self, parentContext) {
// Extend the context hierarchy by setting the appropriate pointers
self['$parentContext'] = parentContext;
self['$parent'] = parentContext['$data'];
self['$parents'] = (parentContext['$parents'] || []).slice(0);
self['$parents'].unshift(self['$parent']);
if (extendCallback)
extendCallback(self);
});
};
// Extend the binding context with new custom properties. This doesn't change the context hierarchy.
// Similarly to "child" contexts, provide a function here to make sure that the correct values are set
// when an observable view model is updated.
ko.bindingContext.prototype['extend'] = function(properties) {
// If the parent context references an observable view model, "_subscribable" will always be the
// latest view model object. If not, "_subscribable" isn't set, and we can use the static "$data" value.
return new ko.bindingContext(this._subscribable || this['$data'], this, null, function(self, parentContext) {
// This "child" context doesn't directly track a parent observable view model,
// so we need to manually set the $rawData value to match the parent.
self['$rawData'] = parentContext['$rawData'];
ko.utils.extend(self, typeof(properties) == "function" ? properties() : properties);
});
};
// Returns the valueAccesor function for a binding value
function makeValueAccessor(value) {
return function() {
return value;
};
}
// Returns the value of a valueAccessor function
function evaluateValueAccessor(valueAccessor) {
return valueAccessor();
}
// Given a function that returns bindings, create and return a new object that contains
// binding value-accessors functions. Each accessor function calls the original function
// so that it always gets the latest value and all dependencies are captured. This is used
// by ko.applyBindingsToNode and getBindingsAndMakeAccessors.
function makeAccessorsFromFunction(callback) {
return ko.utils.objectMap(ko.dependencyDetection.ignore(callback), function(value, key) {
return function() {
return callback()[key];
};
});
}
// Given a bindings function or object, create and return a new object that contains
// binding value-accessors functions. This is used by ko.applyBindingsToNode.
function makeBindingAccessors(bindings, context, node) {
if (typeof bindings === 'function') {
return makeAccessorsFromFunction(bindings.bind(null, context, node));
} else {
return ko.utils.objectMap(bindings, makeValueAccessor);
}
}
// This function is used if the binding provider doesn't include a getBindingAccessors function.
// It must be called with 'this' set to the provider instance.
function getBindingsAndMakeAccessors(node, context) {
return makeAccessorsFromFunction(this['getBindings'].bind(this, node, context));
}
function validateThatBindingIsAllowedForVirtualElements(bindingName) {
var validator = ko.virtualElements.allowedBindings[bindingName];
if (!validator)
throw new Error("The binding '" + bindingName + "' cannot be used with virtual elements")
}
function applyBindingsToDescendantsInternal (bindingContext, elementOrVirtualElement, bindingContextsMayDifferFromDomParentElement) {
var currentChild,
nextInQueue = ko.virtualElements.firstChild(elementOrVirtualElement),
provider = ko.bindingProvider['instance'],
preprocessNode = provider['preprocessNode'];
// Preprocessing allows a binding provider to mutate a node before bindings are applied to it. For example it's
// possible to insert new siblings after it, and/or replace the node with a different one. This can be used to
// implement custom binding syntaxes, such as {{ value }} for string interpolation, or custom element types that
// trigger insertion of <template> contents at that point in the document.
if (preprocessNode) {
while (currentChild = nextInQueue) {
nextInQueue = ko.virtualElements.nextSibling(currentChild);
preprocessNode.call(provider, currentChild);
}
// Reset nextInQueue for the next loop
nextInQueue = ko.virtualElements.firstChild(elementOrVirtualElement);
}
while (currentChild = nextInQueue) {
// Keep a record of the next child *before* applying bindings, in case the binding removes the current child from its position
nextInQueue = ko.virtualElements.nextSibling(currentChild);
applyBindingsToNodeAndDescendantsInternal(bindingContext, currentChild, bindingContextsMayDifferFromDomParentElement);
}
}
function applyBindingsToNodeAndDescendantsInternal (bindingContext, nodeVerified, bindingContextMayDifferFromDomParentElement) {
var shouldBindDescendants = true;
// Perf optimisation: Apply bindings only if...
// (1) We need to store the binding context on this node (because it may differ from the DOM parent node's binding context)
// Note that we can't store binding contexts on non-elements (e.g., text nodes), as IE doesn't allow expando properties for those
// (2) It might have bindings (e.g., it has a data-bind attribute, or it's a marker for a containerless template)
var isElement = (nodeVerified.nodeType === 1);
if (isElement) // Workaround IE <= 8 HTML parsing weirdness
ko.virtualElements.normaliseVirtualElementDomStructure(nodeVerified);
var shouldApplyBindings = (isElement && bindingContextMayDifferFromDomParentElement) // Case (1)
|| ko.bindingProvider['instance']['nodeHasBindings'](nodeVerified); // Case (2)
if (shouldApplyBindings)
shouldBindDescendants = applyBindingsToNodeInternal(nodeVerified, null, bindingContext, bindingContextMayDifferFromDomParentElement)['shouldBindDescendants'];
if (shouldBindDescendants && !bindingDoesNotRecurseIntoElementTypes[ko.utils.tagNameLower(nodeVerified)]) {
// We're recursing automatically into (real or virtual) child nodes without changing binding contexts. So,
// * For children of a *real* element, the binding context is certainly the same as on their DOM .parentNode,
// hence bindingContextsMayDifferFromDomParentElement is false
// * For children of a *virtual* element, we can't be sure. Evaluating .parentNode on those children may
// skip over any number of intermediate virtual elements, any of which might define a custom binding context,
// hence bindingContextsMayDifferFromDomParentElement is true
applyBindingsToDescendantsInternal(bindingContext, nodeVerified, /* bindingContextsMayDifferFromDomParentElement: */ !isElement);
}
}
var boundElementDomDataKey = ko.utils.domData.nextKey();
function topologicalSortBindings(bindings) {
// Depth-first sort
var result = [], // The list of key/handler pairs that we will return
bindingsConsidered = {}, // A temporary record of which bindings are already in 'result'
cyclicDependencyStack = []; // Keeps track of a depth-search so that, if there's a cycle, we know which bindings caused it
ko.utils.objectForEach(bindings, function pushBinding(bindingKey) {
if (!bindingsConsidered[bindingKey]) {
var binding = ko['getBindingHandler'](bindingKey);
if (binding) {
// First add dependencies (if any) of the current binding
if (binding['after']) {
cyclicDependencyStack.push(bindingKey);
ko.utils.arrayForEach(binding['after'], function(bindingDependencyKey) {
if (bindings[bindingDependencyKey]) {
if (ko.utils.arrayIndexOf(cyclicDependencyStack, bindingDependencyKey) !== -1) {
throw Error("Cannot combine the following bindings, because they have a cyclic dependency: " + cyclicDependencyStack.join(", "));
} else {
pushBinding(bindingDependencyKey);
}
}
});
cyclicDependencyStack.length--;
}
// Next add the current binding
result.push({ key: bindingKey, handler: binding });
}
bindingsConsidered[bindingKey] = true;
}
});
return result;
}
function applyBindingsToNodeInternal(node, sourceBindings, bindingContext, bindingContextMayDifferFromDomParentElement) {
// Prevent multiple applyBindings calls for the same node, except when a binding value is specified
var alreadyBound = ko.utils.domData.get(node, boundElementDomDataKey);
if (!sourceBindings) {
if (alreadyBound) {
throw Error("You cannot apply bindings multiple times to the same element.");
}
ko.utils.domData.set(node, boundElementDomDataKey, true);
}
// Optimization: Don't store the binding context on this node if it's definitely the same as on node.parentNode, because
// we can easily recover it just by scanning up the node's ancestors in the DOM
// (note: here, parent node means "real DOM parent" not "virtual parent", as there's no O(1) way to find the virtual parent)
if (!alreadyBound && bindingContextMayDifferFromDomParentElement)
ko.storedBindingContextForNode(node, bindingContext);
// Use bindings if given, otherwise fall back on asking the bindings provider to give us some bindings
var bindings;
if (sourceBindings && typeof sourceBindings !== 'function') {
bindings = sourceBindings;
} else {
var provider = ko.bindingProvider['instance'],
getBindings = provider['getBindingAccessors'] || getBindingsAndMakeAccessors;
// Get the binding from the provider within a computed observable so that we can update the bindings whenever
// the binding context is updated or if the binding provider accesses observables.
var bindingsUpdater = ko.dependentObservable(
function() {
bindings = sourceBindings ? sourceBindings(bindingContext, node) : getBindings.call(provider, node, bindingContext);
// Register a dependency on the binding context to support obsevable view models.
if (bindings && bindingContext._subscribable)
bindingContext._subscribable();
return bindings;
},
null, { disposeWhenNodeIsRemoved: node }
);
if (!bindings || !bindingsUpdater.isActive())
bindingsUpdater = null;
}
var bindingHandlerThatControlsDescendantBindings;
if (bindings) {
// Return the value accessor for a given binding. When bindings are static (won't be updated because of a binding
// context update), just return the value accessor from the binding. Otherwise, return a function that always gets
// the latest binding value and registers a dependency on the binding updater.
var getValueAccessor = bindingsUpdater
? function(bindingKey) {
return function() {
return evaluateValueAccessor(bindingsUpdater()[bindingKey]);
};
} : function(bindingKey) {
return bindings[bindingKey];
};
// Use of allBindings as a function is maintained for backwards compatibility, but its use is deprecated
function allBindings() {
return ko.utils.objectMap(bindingsUpdater ? bindingsUpdater() : bindings, evaluateValueAccessor);
}
// The following is the 3.x allBindings API
allBindings['get'] = function(key) {
return bindings[key] && evaluateValueAccessor(getValueAccessor(key));
};
allBindings['has'] = function(key) {
return key in bindings;
};
// First put the bindings into the right order
var orderedBindings = topologicalSortBindings(bindings);
// Go through the sorted bindings, calling init and update for each
ko.utils.arrayForEach(orderedBindings, function(bindingKeyAndHandler) {
// Note that topologicalSortBindings has already filtered out any nonexistent binding handlers,
// so bindingKeyAndHandler.handler will always be nonnull.
var handlerInitFn = bindingKeyAndHandler.handler["init"],
handlerUpdateFn = bindingKeyAndHandler.handler["update"],
bindingKey = bindingKeyAndHandler.key;
if (node.nodeType === 8) {
validateThatBindingIsAllowedForVirtualElements(bindingKey);
}
try {
// Run init, ignoring any dependencies
if (typeof handlerInitFn == "function") {
ko.dependencyDetection.ignore(function() {
var initResult = handlerInitFn(node, getValueAccessor(bindingKey), allBindings, bindingContext['$data'], bindingContext);
// If this binding handler claims to control descendant bindings, make a note of this
if (initResult && initResult['controlsDescendantBindings']) {
if (bindingHandlerThatControlsDescendantBindings !== undefined)
throw new Error("Multiple bindings (" + bindingHandlerThatControlsDescendantBindings + " and " + bindingKey + ") are trying to control descendant bindings of the same element. You cannot use these bindings together on the same element.");
bindingHandlerThatControlsDescendantBindings = bindingKey;
}
});
}
// Run update in its own computed wrapper
if (typeof handlerUpdateFn == "function") {
ko.dependentObservable(
function() {
handlerUpdateFn(node, getValueAccessor(bindingKey), allBindings, bindingContext['$data'], bindingContext);
},
null,
{ disposeWhenNodeIsRemoved: node }
);
}
} catch (ex) {
ex.message = "Unable to process binding \"" + bindingKey + ": " + bindings[bindingKey] + "\"\nMessage: " + ex.message;
throw ex;
}
});
}
return {
'shouldBindDescendants': bindingHandlerThatControlsDescendantBindings === undefined
};
};
var storedBindingContextDomDataKey = ko.utils.domData.nextKey();
ko.storedBindingContextForNode = function (node, bindingContext) {
if (arguments.length == 2) {
ko.utils.domData.set(node, storedBindingContextDomDataKey, bindingContext);
if (bindingContext._subscribable)
bindingContext._subscribable._addNode(node);
} else {
return ko.utils.domData.get(node, storedBindingContextDomDataKey);
}
}
function getBindingContext(viewModelOrBindingContext) {
return viewModelOrBindingContext && (viewModelOrBindingContext instanceof ko.bindingContext)
? viewModelOrBindingContext
: new ko.bindingContext(viewModelOrBindingContext);
}
ko.applyBindingAccessorsToNode = function (node, bindings, viewModelOrBindingContext) {
if (node.nodeType === 1) // If it's an element, workaround IE <= 8 HTML parsing weirdness
ko.virtualElements.normaliseVirtualElementDomStructure(node);
return applyBindingsToNodeInternal(node, bindings, getBindingContext(viewModelOrBindingContext), true);
};
ko.applyBindingsToNode = function (node, bindings, viewModelOrBindingContext) {
var context = getBindingContext(viewModelOrBindingContext);
return ko.applyBindingAccessorsToNode(node, makeBindingAccessors(bindings, context, node), context);
};
ko.applyBindingsToDescendants = function(viewModelOrBindingContext, rootNode) {
if (rootNode.nodeType === 1 || rootNode.nodeType === 8)
applyBindingsToDescendantsInternal(getBindingContext(viewModelOrBindingContext), rootNode, true);
};
ko.applyBindings = function (viewModelOrBindingContext, rootNode) {
// If jQuery is loaded after Knockout, we won't initially have access to it. So save it here.
if (!jQueryInstance && window['jQuery']) {
jQueryInstance = window['jQuery'];
}
if (rootNode && (rootNode.nodeType !== 1) && (rootNode.nodeType !== 8))
throw new Error("ko.applyBindings: first parameter should be your view model; second parameter should be a DOM node");
rootNode = rootNode || window.document.body; // Make "rootNode" parameter optional
applyBindingsToNodeAndDescendantsInternal(getBindingContext(viewModelOrBindingContext), rootNode, true);
};
// Retrieving binding context from arbitrary nodes
ko.contextFor = function(node) {
// We can only do something meaningful for elements and comment nodes (in particular, not text nodes, as IE can't store domdata for them)
switch (node.nodeType) {
case 1:
case 8:
var context = ko.storedBindingContextForNode(node);
if (context) return context;
if (node.parentNode) return ko.contextFor(node.parentNode);
break;
}
return undefined;
};
ko.dataFor = function(node) {
var context = ko.contextFor(node);
return context ? context['$data'] : undefined;
};
ko.exportSymbol('bindingHandlers', ko.bindingHandlers);
ko.exportSymbol('applyBindings', ko.applyBindings);
ko.exportSymbol('applyBindingsToDescendants', ko.applyBindingsToDescendants);
ko.exportSymbol('applyBindingAccessorsToNode', ko.applyBindingAccessorsToNode);
ko.exportSymbol('applyBindingsToNode', ko.applyBindingsToNode);
ko.exportSymbol('contextFor', ko.contextFor);
ko.exportSymbol('dataFor', ko.dataFor);
})();
(function(undefined) {
var loadingSubscribablesCache = {}, // Tracks component loads that are currently in flight
loadedDefinitionsCache = {}; // Tracks component loads that have already completed
ko.components = {
get: function(componentName, callback) {
var cachedDefinition = getObjectOwnProperty(loadedDefinitionsCache, componentName);
if (cachedDefinition) {
// It's already loaded and cached. Reuse the same definition object.
// Note that for API consistency, even cache hits complete asynchronously by default.
// You can bypass this by putting synchronous:true on your component config.
if (cachedDefinition.isSynchronousComponent) {
ko.dependencyDetection.ignore(function() { // See comment in loaderRegistryBehaviors.js for reasoning
callback(cachedDefinition.definition);
});
} else {
setTimeout(function() { callback(cachedDefinition.definition); }, 0);
}
} else {
// Join the loading process that is already underway, or start a new one.
loadComponentAndNotify(componentName, callback);
}
},
clearCachedDefinition: function(componentName) {
delete loadedDefinitionsCache[componentName];
},
_getFirstResultFromLoaders: getFirstResultFromLoaders
};
function getObjectOwnProperty(obj, propName) {
return obj.hasOwnProperty(propName) ? obj[propName] : undefined;
}
function loadComponentAndNotify(componentName, callback) {
var subscribable = getObjectOwnProperty(loadingSubscribablesCache, componentName),
completedAsync;
if (!subscribable) {
// It's not started loading yet. Start loading, and when it's done, move it to loadedDefinitionsCache.
subscribable = loadingSubscribablesCache[componentName] = new ko.subscribable();
subscribable.subscribe(callback);
beginLoadingComponent(componentName, function(definition, config) {
var isSynchronousComponent = !!(config && config['synchronous']);
loadedDefinitionsCache[componentName] = { definition: definition, isSynchronousComponent: isSynchronousComponent };
delete loadingSubscribablesCache[componentName];
// For API consistency, all loads complete asynchronously. However we want to avoid
// adding an extra setTimeout if it's unnecessary (i.e., the completion is already
// async) since setTimeout(..., 0) still takes about 16ms or more on most browsers.
//
// You can bypass the 'always synchronous' feature by putting the synchronous:true
// flag on your component configuration when you register it.
if (completedAsync || isSynchronousComponent) {
// Note that notifySubscribers ignores any dependencies read within the callback.
// See comment in loaderRegistryBehaviors.js for reasoning
subscribable['notifySubscribers'](definition);
} else {
setTimeout(function() {
subscribable['notifySubscribers'](definition);
}, 0);
}
});
completedAsync = true;
} else {
subscribable.subscribe(callback);
}
}
function beginLoadingComponent(componentName, callback) {
getFirstResultFromLoaders('getConfig', [componentName], function(config) {
if (config) {
// We have a config, so now load its definition
getFirstResultFromLoaders('loadComponent', [componentName, config], function(definition) {
callback(definition, config);
});
} else {
// The component has no config - it's unknown to all the loaders.
// Note that this is not an error (e.g., a module loading error) - that would abort the
// process and this callback would not run. For this callback to run, all loaders must
// have confirmed they don't know about this component.
callback(null, null);
}
});
}
function getFirstResultFromLoaders(methodName, argsExceptCallback, callback, candidateLoaders) {
// On the first call in the stack, start with the full set of loaders
if (!candidateLoaders) {
candidateLoaders = ko.components['loaders'].slice(0); // Use a copy, because we'll be mutating this array
}
// Try the next candidate
var currentCandidateLoader = candidateLoaders.shift();
if (currentCandidateLoader) {
var methodInstance = currentCandidateLoader[methodName];
if (methodInstance) {
var wasAborted = false,
synchronousReturnValue = methodInstance.apply(currentCandidateLoader, argsExceptCallback.concat(function(result) {
if (wasAborted) {
callback(null);
} else if (result !== null) {
// This candidate returned a value. Use it.
callback(result);
} else {
// Try the next candidate
getFirstResultFromLoaders(methodName, argsExceptCallback, callback, candidateLoaders);
}
}));
// Currently, loaders may not return anything synchronously. This leaves open the possibility
// that we'll extend the API to support synchronous return values in the future. It won't be
// a breaking change, because currently no loader is allowed to return anything except undefined.
if (synchronousReturnValue !== undefined) {
wasAborted = true;
// Method to suppress exceptions will remain undocumented. This is only to keep
// KO's specs running tidily, since we can observe the loading got aborted without
// having exceptions cluttering up the console too.
if (!currentCandidateLoader['suppressLoaderExceptions']) {
throw new Error('Component loaders must supply values by invoking the callback, not by returning values synchronously.');
}
}
} else {
// This candidate doesn't have the relevant handler. Synchronously move on to the next one.
getFirstResultFromLoaders(methodName, argsExceptCallback, callback, candidateLoaders);
}
} else {
// No candidates returned a value
callback(null);
}
}
// Reference the loaders via string name so it's possible for developers
// to replace the whole array by assigning to ko.components.loaders
ko.components['loaders'] = [];
ko.exportSymbol('components', ko.components);
ko.exportSymbol('components.get', ko.components.get);
ko.exportSymbol('components.clearCachedDefinition', ko.components.clearCachedDefinition);
})();
(function(undefined) {
// The default loader is responsible for two things:
// 1. Maintaining the default in-memory registry of component configuration objects
// (i.e., the thing you're writing to when you call ko.components.register(someName, ...))
// 2. Answering requests for components by fetching configuration objects
// from that default in-memory registry and resolving them into standard
// component definition objects (of the form { createViewModel: ..., template: ... })
// Custom loaders may override either of these facilities, i.e.,
// 1. To supply configuration objects from some other source (e.g., conventions)
// 2. Or, to resolve configuration objects by loading viewmodels/templates via arbitrary logic.
var defaultConfigRegistry = {};
ko.components.register = function(componentName, config) {
if (!config) {
throw new Error('Invalid configuration for ' + componentName);
}
if (ko.components.isRegistered(componentName)) {
throw new Error('Component ' + componentName + ' is already registered');
}
defaultConfigRegistry[componentName] = config;
}
ko.components.isRegistered = function(componentName) {
return componentName in defaultConfigRegistry;
}
ko.components.unregister = function(componentName) {
delete defaultConfigRegistry[componentName];
ko.components.clearCachedDefinition(componentName);
}
ko.components.defaultLoader = {
'getConfig': function(componentName, callback) {
var result = defaultConfigRegistry.hasOwnProperty(componentName)
? defaultConfigRegistry[componentName]
: null;
callback(result);
},
'loadComponent': function(componentName, config, callback) {
var errorCallback = makeErrorCallback(componentName);
possiblyGetConfigFromAmd(errorCallback, config, function(loadedConfig) {
resolveConfig(componentName, errorCallback, loadedConfig, callback);
});
},
'loadTemplate': function(componentName, templateConfig, callback) {
resolveTemplate(makeErrorCallback(componentName), templateConfig, callback);
},
'loadViewModel': function(componentName, viewModelConfig, callback) {
resolveViewModel(makeErrorCallback(componentName), viewModelConfig, callback);
}
};
var createViewModelKey = 'createViewModel';
// Takes a config object of the form { template: ..., viewModel: ... }, and asynchronously convert it
// into the standard component definition format:
// { template: <ArrayOfDomNodes>, createViewModel: function(params, componentInfo) { ... } }.
// Since both template and viewModel may need to be resolved asynchronously, both tasks are performed
// in parallel, and the results joined when both are ready. We don't depend on any promises infrastructure,
// so this is implemented manually below.
function resolveConfig(componentName, errorCallback, config, callback) {
var result = {},
makeCallBackWhenZero = 2,
tryIssueCallback = function() {
if (--makeCallBackWhenZero === 0) {
callback(result);
}
},
templateConfig = config['template'],
viewModelConfig = config['viewModel'];
if (templateConfig) {
possiblyGetConfigFromAmd(errorCallback, templateConfig, function(loadedConfig) {
ko.components._getFirstResultFromLoaders('loadTemplate', [componentName, loadedConfig], function(resolvedTemplate) {
result['template'] = resolvedTemplate;
tryIssueCallback();
});
});
} else {
tryIssueCallback();
}
if (viewModelConfig) {
possiblyGetConfigFromAmd(errorCallback, viewModelConfig, function(loadedConfig) {
ko.components._getFirstResultFromLoaders('loadViewModel', [componentName, loadedConfig], function(resolvedViewModel) {
result[createViewModelKey] = resolvedViewModel;
tryIssueCallback();
});
});
} else {
tryIssueCallback();
}
}
function resolveTemplate(errorCallback, templateConfig, callback) {
if (typeof templateConfig === 'string') {
// Markup - parse it
callback(ko.utils.parseHtmlFragment(templateConfig));
} else if (templateConfig instanceof Array) {
// Assume already an array of DOM nodes - pass through unchanged
callback(templateConfig);
} else if (isDocumentFragment(templateConfig)) {
// Document fragment - use its child nodes
callback(ko.utils.makeArray(templateConfig.childNodes));
} else if (templateConfig['element']) {
var element = templateConfig['element'];
if (isDomElement(element)) {
// Element instance - copy its child nodes
callback(cloneNodesFromTemplateSourceElement(element));
} else if (typeof element === 'string') {
// Element ID - find it, then copy its child nodes
var elemInstance = document.getElementById(element);
if (elemInstance) {
callback(cloneNodesFromTemplateSourceElement(elemInstance));
} else {
errorCallback('Cannot find element with ID ' + element);
}
} else {
errorCallback('Unknown element type: ' + element);
}
} else {
errorCallback('Unknown template value: ' + templateConfig);
}
}
function resolveViewModel(errorCallback, viewModelConfig, callback) {
if (typeof viewModelConfig === 'function') {
// Constructor - convert to standard factory function format
// By design, this does *not* supply componentInfo to the constructor, as the intent is that
// componentInfo contains non-viewmodel data (e.g., the component's element) that should only
// be used in factory functions, not viewmodel constructors.
callback(function (params /*, componentInfo */) {
return new viewModelConfig(params);
});
} else if (typeof viewModelConfig[createViewModelKey] === 'function') {
// Already a factory function - use it as-is
callback(viewModelConfig[createViewModelKey]);
} else if ('instance' in viewModelConfig) {
// Fixed object instance - promote to createViewModel format for API consistency
var fixedInstance = viewModelConfig['instance'];
callback(function (params, componentInfo) {
return fixedInstance;
});
} else if ('viewModel' in viewModelConfig) {
// Resolved AMD module whose value is of the form { viewModel: ... }
resolveViewModel(errorCallback, viewModelConfig['viewModel'], callback);
} else {
errorCallback('Unknown viewModel value: ' + viewModelConfig);
}
}
function cloneNodesFromTemplateSourceElement(elemInstance) {
switch (ko.utils.tagNameLower(elemInstance)) {
case 'script':
return ko.utils.parseHtmlFragment(elemInstance.text);
case 'textarea':
return ko.utils.parseHtmlFragment(elemInstance.value);
case 'template':
// For browsers with proper <template> element support (i.e., where the .content property
// gives a document fragment), use that document fragment.
if (isDocumentFragment(elemInstance.content)) {
return ko.utils.cloneNodes(elemInstance.content.childNodes);
}
}
// Regular elements such as <div>, and <template> elements on old browsers that don't really
// understand <template> and just treat it as a regular container
return ko.utils.cloneNodes(elemInstance.childNodes);
}
function isDomElement(obj) {
if (window['HTMLElement']) {
return obj instanceof HTMLElement;
} else {
return obj && obj.tagName && obj.nodeType === 1;
}
}
function isDocumentFragment(obj) {
if (window['DocumentFragment']) {
return obj instanceof DocumentFragment;
} else {
return obj && obj.nodeType === 11;
}
}
function possiblyGetConfigFromAmd(errorCallback, config, callback) {
if (typeof config['require'] === 'string') {
// The config is the value of an AMD module
if (amdRequire || window['require']) {
(amdRequire || window['require'])([config['require']], callback);
} else {
errorCallback('Uses require, but no AMD loader is present');
}
} else {
callback(config);
}
}
function makeErrorCallback(componentName) {
return function (message) {
throw new Error('Component \'' + componentName + '\': ' + message);
};
}
ko.exportSymbol('components.register', ko.components.register);
ko.exportSymbol('components.isRegistered', ko.components.isRegistered);
ko.exportSymbol('components.unregister', ko.components.unregister);
// Expose the default loader so that developers can directly ask it for configuration
// or to resolve configuration
ko.exportSymbol('components.defaultLoader', ko.components.defaultLoader);
// By default, the default loader is the only registered component loader
ko.components['loaders'].push(ko.components.defaultLoader);
// Privately expose the underlying config registry for use in old-IE shim
ko.components._allRegisteredComponents = defaultConfigRegistry;
})();
(function (undefined) {
// Overridable API for determining which component name applies to a given node. By overriding this,
// you can for example map specific tagNames to components that are not preregistered.
ko.components['getComponentNameForNode'] = function(node) {
var tagNameLower = ko.utils.tagNameLower(node);
return ko.components.isRegistered(tagNameLower) && tagNameLower;
};
ko.components.addBindingsForCustomElement = function(allBindings, node, bindingContext, valueAccessors) {
// Determine if it's really a custom element matching a component
if (node.nodeType === 1) {
var componentName = ko.components['getComponentNameForNode'](node);
if (componentName) {
// It does represent a component, so add a component binding for it
allBindings = allBindings || {};
if (allBindings['component']) {
// Avoid silently overwriting some other 'component' binding that may already be on the element
throw new Error('Cannot use the "component" binding on a custom element matching a component');
}
var componentBindingValue = { 'name': componentName, 'params': getComponentParamsFromCustomElement(node, bindingContext) };
allBindings['component'] = valueAccessors
? function() { return componentBindingValue; }
: componentBindingValue;
}
}
return allBindings;
}
var nativeBindingProviderInstance = new ko.bindingProvider();
function getComponentParamsFromCustomElement(elem, bindingContext) {
var paramsAttribute = elem.getAttribute('params');
if (paramsAttribute) {
var params = nativeBindingProviderInstance['parseBindingsString'](paramsAttribute, bindingContext, elem, { 'valueAccessors': true, 'bindingParams': true }),
rawParamComputedValues = ko.utils.objectMap(params, function(paramValue, paramName) {
return ko.computed(paramValue, null, { disposeWhenNodeIsRemoved: elem });
}),
result = ko.utils.objectMap(rawParamComputedValues, function(paramValueComputed, paramName) {
var paramValue = paramValueComputed.peek();
// Does the evaluation of the parameter value unwrap any observables?
if (!paramValueComputed.isActive()) {
// No it doesn't, so there's no need for any computed wrapper. Just pass through the supplied value directly.
// Example: "someVal: firstName, age: 123" (whether or not firstName is an observable/computed)
return paramValue;
} else {
// Yes it does. Supply a computed property that unwraps both the outer (binding expression)
// level of observability, and any inner (resulting model value) level of observability.
// This means the component doesn't have to worry about multiple unwrapping. If the value is a
// writable observable, the computed will also be writable and pass the value on to the observable.
return ko.computed({
'read': function() {
return ko.utils.unwrapObservable(paramValueComputed());
},
'write': ko.isWriteableObservable(paramValue) && function(value) {
paramValueComputed()(value);
},
disposeWhenNodeIsRemoved: elem
});
}
});
// Give access to the raw computeds, as long as that wouldn't overwrite any custom param also called '$raw'
// This is in case the developer wants to react to outer (binding) observability separately from inner
// (model value) observability, or in case the model value observable has subobservables.
if (!result.hasOwnProperty('$raw')) {
result['$raw'] = rawParamComputedValues;
}
return result;
} else {
// For consistency, absence of a "params" attribute is treated the same as the presence of
// any empty one. Otherwise component viewmodels need special code to check whether or not
// 'params' or 'params.$raw' is null/undefined before reading subproperties, which is annoying.
return { '$raw': {} };
}
}
// --------------------------------------------------------------------------------
// Compatibility code for older (pre-HTML5) IE browsers
if (ko.utils.ieVersion < 9) {
// Whenever you preregister a component, enable it as a custom element in the current document
ko.components['register'] = (function(originalFunction) {
return function(componentName) {
document.createElement(componentName); // Allows IE<9 to parse markup containing the custom element
return originalFunction.apply(this, arguments);
}
})(ko.components['register']);
// Whenever you create a document fragment, enable all preregistered component names as custom elements
// This is needed to make innerShiv/jQuery HTML parsing correctly handle the custom elements
document.createDocumentFragment = (function(originalFunction) {
return function() {
var newDocFrag = originalFunction(),
allComponents = ko.components._allRegisteredComponents;
for (var componentName in allComponents) {
if (allComponents.hasOwnProperty(componentName)) {
newDocFrag.createElement(componentName);
}
}
return newDocFrag;
};
})(document.createDocumentFragment);
}
})();(function(undefined) {
var componentLoadingOperationUniqueId = 0;
ko.bindingHandlers['component'] = {
'init': function(element, valueAccessor, ignored1, ignored2, bindingContext) {
var currentViewModel,
currentLoadingOperationId,
disposeAssociatedComponentViewModel = function () {
var currentViewModelDispose = currentViewModel && currentViewModel['dispose'];
if (typeof currentViewModelDispose === 'function') {
currentViewModelDispose.call(currentViewModel);
}
// Any in-flight loading operation is no longer relevant, so make sure we ignore its completion
currentLoadingOperationId = null;
},
originalChildNodes = ko.utils.makeArray(ko.virtualElements.childNodes(element));
ko.utils.domNodeDisposal.addDisposeCallback(element, disposeAssociatedComponentViewModel);
ko.computed(function () {
var value = ko.utils.unwrapObservable(valueAccessor()),
componentName, componentParams;
if (typeof value === 'string') {
componentName = value;
} else {
componentName = ko.utils.unwrapObservable(value['name']);
componentParams = ko.utils.unwrapObservable(value['params']);
}
if (!componentName) {
throw new Error('No component name specified');
}
var loadingOperationId = currentLoadingOperationId = ++componentLoadingOperationUniqueId;
ko.components.get(componentName, function(componentDefinition) {
// If this is not the current load operation for this element, ignore it.
if (currentLoadingOperationId !== loadingOperationId) {
return;
}
// Clean up previous state
disposeAssociatedComponentViewModel();
// Instantiate and bind new component. Implicitly this cleans any old DOM nodes.
if (!componentDefinition) {
throw new Error('Unknown component \'' + componentName + '\'');
}
cloneTemplateIntoElement(componentName, componentDefinition, element);
var componentViewModel = createViewModel(componentDefinition, element, originalChildNodes, componentParams),
childBindingContext = bindingContext['createChildContext'](componentViewModel, /* dataItemAlias */ undefined, function(ctx) {
ctx['$component'] = componentViewModel;
ctx['$componentTemplateNodes'] = originalChildNodes;
});
currentViewModel = componentViewModel;
ko.applyBindingsToDescendants(childBindingContext, element);
});
}, null, { disposeWhenNodeIsRemoved: element });
return { 'controlsDescendantBindings': true };
}
};
ko.virtualElements.allowedBindings['component'] = true;
function cloneTemplateIntoElement(componentName, componentDefinition, element) {
var template = componentDefinition['template'];
if (!template) {
throw new Error('Component \'' + componentName + '\' has no template');
}
var clonedNodesArray = ko.utils.cloneNodes(template);
ko.virtualElements.setDomNodeChildren(element, clonedNodesArray);
}
function createViewModel(componentDefinition, element, originalChildNodes, componentParams) {
var componentViewModelFactory = componentDefinition['createViewModel'];
return componentViewModelFactory
? componentViewModelFactory.call(componentDefinition, componentParams, { 'element': element, 'templateNodes': originalChildNodes })
: componentParams; // Template-only component
}
})();
var attrHtmlToJavascriptMap = { 'class': 'className', 'for': 'htmlFor' };
ko.bindingHandlers['attr'] = {
'update': function(element, valueAccessor, allBindings) {
var value = ko.utils.unwrapObservable(valueAccessor()) || {};
ko.utils.objectForEach(value, function(attrName, attrValue) {
attrValue = ko.utils.unwrapObservable(attrValue);
// To cover cases like "attr: { checked:someProp }", we want to remove the attribute entirely
// when someProp is a "no value"-like value (strictly null, false, or undefined)
// (because the absence of the "checked" attr is how to mark an element as not checked, etc.)
var toRemove = (attrValue === false) || (attrValue === null) || (attrValue === undefined);
if (toRemove)
element.removeAttribute(attrName);
// In IE <= 7 and IE8 Quirks Mode, you have to use the Javascript property name instead of the
// HTML attribute name for certain attributes. IE8 Standards Mode supports the correct behavior,
// but instead of figuring out the mode, we'll just set the attribute through the Javascript
// property for IE <= 8.
if (ko.utils.ieVersion <= 8 && attrName in attrHtmlToJavascriptMap) {
attrName = attrHtmlToJavascriptMap[attrName];
if (toRemove)
element.removeAttribute(attrName);
else
element[attrName] = attrValue;
} else if (!toRemove) {
element.setAttribute(attrName, attrValue.toString());
}
// Treat "name" specially - although you can think of it as an attribute, it also needs
// special handling on older versions of IE (https://github.com/SteveSanderson/knockout/pull/333)
// Deliberately being case-sensitive here because XHTML would regard "Name" as a different thing
// entirely, and there's no strong reason to allow for such casing in HTML.
if (attrName === "name") {
ko.utils.setElementName(element, toRemove ? "" : attrValue.toString());
}
});
}
};
(function() {
ko.bindingHandlers['checked'] = {
'after': ['value', 'attr'],
'init': function (element, valueAccessor, allBindings) {
var checkedValue = ko.pureComputed(function() {
// Treat "value" like "checkedValue" when it is included with "checked" binding
if (allBindings['has']('checkedValue')) {
return ko.utils.unwrapObservable(allBindings.get('checkedValue'));
} else if (allBindings['has']('value')) {
return ko.utils.unwrapObservable(allBindings.get('value'));
}
return element.value;
});
function updateModel() {
// This updates the model value from the view value.
// It runs in response to DOM events (click) and changes in checkedValue.
var isChecked = element.checked,
elemValue = useCheckedValue ? checkedValue() : isChecked;
// When we're first setting up this computed, don't change any model state.
if (ko.computedContext.isInitial()) {
return;
}
// We can ignore unchecked radio buttons, because some other radio
// button will be getting checked, and that one can take care of updating state.
if (isRadio && !isChecked) {
return;
}
var modelValue = ko.dependencyDetection.ignore(valueAccessor);
if (isValueArray) {
if (oldElemValue !== elemValue) {
// When we're responding to the checkedValue changing, and the element is
// currently checked, replace the old elem value with the new elem value
// in the model array.
if (isChecked) {
ko.utils.addOrRemoveItem(modelValue, elemValue, true);
ko.utils.addOrRemoveItem(modelValue, oldElemValue, false);
}
oldElemValue = elemValue;
} else {
// When we're responding to the user having checked/unchecked a checkbox,
// add/remove the element value to the model array.
ko.utils.addOrRemoveItem(modelValue, elemValue, isChecked);
}
} else {
ko.expressionRewriting.writeValueToProperty(modelValue, allBindings, 'checked', elemValue, true);
}
};
function updateView() {
// This updates the view value from the model value.
// It runs in response to changes in the bound (checked) value.
var modelValue = ko.utils.unwrapObservable(valueAccessor());
if (isValueArray) {
// When a checkbox is bound to an array, being checked represents its value being present in that array
element.checked = ko.utils.arrayIndexOf(modelValue, checkedValue()) >= 0;
} else if (isCheckbox) {
// When a checkbox is bound to any other value (not an array), being checked represents the value being trueish
element.checked = modelValue;
} else {
// For radio buttons, being checked means that the radio button's value corresponds to the model value
element.checked = (checkedValue() === modelValue);
}
};
var isCheckbox = element.type == "checkbox",
isRadio = element.type == "radio";
// Only bind to check boxes and radio buttons
if (!isCheckbox && !isRadio) {
return;
}
var isValueArray = isCheckbox && (ko.utils.unwrapObservable(valueAccessor()) instanceof Array),
oldElemValue = isValueArray ? checkedValue() : undefined,
useCheckedValue = isRadio || isValueArray;
// IE 6 won't allow radio buttons to be selected unless they have a name
if (isRadio && !element.name)
ko.bindingHandlers['uniqueName']['init'](element, function() { return true });
// Set up two computeds to update the binding:
// The first responds to changes in the checkedValue value and to element clicks
ko.computed(updateModel, null, { disposeWhenNodeIsRemoved: element });
ko.utils.registerEventHandler(element, "click", updateModel);
// The second responds to changes in the model value (the one associated with the checked binding)
ko.computed(updateView, null, { disposeWhenNodeIsRemoved: element });
}
};
ko.expressionRewriting.twoWayBindings['checked'] = true;
ko.bindingHandlers['checkedValue'] = {
'update': function (element, valueAccessor) {
element.value = ko.utils.unwrapObservable(valueAccessor());
}
};
})();var classesWrittenByBindingKey = '__ko__cssValue';
ko.bindingHandlers['css'] = {
'update': function (element, valueAccessor) {
var value = ko.utils.unwrapObservable(valueAccessor());
if (value !== null && typeof value == "object") {
ko.utils.objectForEach(value, function(className, shouldHaveClass) {
shouldHaveClass = ko.utils.unwrapObservable(shouldHaveClass);
ko.utils.toggleDomNodeCssClass(element, className, shouldHaveClass);
});
} else {
value = String(value || ''); // Make sure we don't try to store or set a non-string value
ko.utils.toggleDomNodeCssClass(element, element[classesWrittenByBindingKey], false);
element[classesWrittenByBindingKey] = value;
ko.utils.toggleDomNodeCssClass(element, value, true);
}
}
};
ko.bindingHandlers['enable'] = {
'update': function (element, valueAccessor) {
var value = ko.utils.unwrapObservable(valueAccessor());
if (value && element.disabled)
element.removeAttribute("disabled");
else if ((!value) && (!element.disabled))
element.disabled = true;
}
};
ko.bindingHandlers['disable'] = {
'update': function (element, valueAccessor) {
ko.bindingHandlers['enable']['update'](element, function() { return !ko.utils.unwrapObservable(valueAccessor()) });
}
};
// For certain common events (currently just 'click'), allow a simplified data-binding syntax
// e.g. click:handler instead of the usual full-length event:{click:handler}
function makeEventHandlerShortcut(eventName) {
ko.bindingHandlers[eventName] = {
'init': function(element, valueAccessor, allBindings, viewModel, bindingContext) {
var newValueAccessor = function () {
var result = {};
result[eventName] = valueAccessor();
return result;
};
return ko.bindingHandlers['event']['init'].call(this, element, newValueAccessor, allBindings, viewModel, bindingContext);
}
}
}
ko.bindingHandlers['event'] = {
'init' : function (element, valueAccessor, allBindings, viewModel, bindingContext) {
var eventsToHandle = valueAccessor() || {};
ko.utils.objectForEach(eventsToHandle, function(eventName) {
if (typeof eventName == "string") {
ko.utils.registerEventHandler(element, eventName, function (event) {
var handlerReturnValue;
var handlerFunction = valueAccessor()[eventName];
if (!handlerFunction)
return;
try {
// Take all the event args, and prefix with the viewmodel
var argsForHandler = ko.utils.makeArray(arguments);
viewModel = bindingContext['$data'];
argsForHandler.unshift(viewModel);
handlerReturnValue = handlerFunction.apply(viewModel, argsForHandler);
} finally {
if (handlerReturnValue !== true) { // Normally we want to prevent default action. Developer can override this be explicitly returning true.
if (event.preventDefault)
event.preventDefault();
else
event.returnValue = false;
}
}
var bubble = allBindings.get(eventName + 'Bubble') !== false;
if (!bubble) {
event.cancelBubble = true;
if (event.stopPropagation)
event.stopPropagation();
}
});
}
});
}
};
// "foreach: someExpression" is equivalent to "template: { foreach: someExpression }"
// "foreach: { data: someExpression, afterAdd: myfn }" is equivalent to "template: { foreach: someExpression, afterAdd: myfn }"
ko.bindingHandlers['foreach'] = {
makeTemplateValueAccessor: function(valueAccessor) {
return function() {
var modelValue = valueAccessor(),
unwrappedValue = ko.utils.peekObservable(modelValue); // Unwrap without setting a dependency here
// If unwrappedValue is the array, pass in the wrapped value on its own
// The value will be unwrapped and tracked within the template binding
// (See https://github.com/SteveSanderson/knockout/issues/523)
if ((!unwrappedValue) || typeof unwrappedValue.length == "number")
return { 'foreach': modelValue, 'templateEngine': ko.nativeTemplateEngine.instance };
// If unwrappedValue.data is the array, preserve all relevant options and unwrap again value so we get updates
ko.utils.unwrapObservable(modelValue);
return {
'foreach': unwrappedValue['data'],
'as': unwrappedValue['as'],
'includeDestroyed': unwrappedValue['includeDestroyed'],
'afterAdd': unwrappedValue['afterAdd'],
'beforeRemove': unwrappedValue['beforeRemove'],
'afterRender': unwrappedValue['afterRender'],
'beforeMove': unwrappedValue['beforeMove'],
'afterMove': unwrappedValue['afterMove'],
'templateEngine': ko.nativeTemplateEngine.instance
};
};
},
'init': function(element, valueAccessor, allBindings, viewModel, bindingContext) {
return ko.bindingHandlers['template']['init'](element, ko.bindingHandlers['foreach'].makeTemplateValueAccessor(valueAccessor));
},
'update': function(element, valueAccessor, allBindings, viewModel, bindingContext) {
return ko.bindingHandlers['template']['update'](element, ko.bindingHandlers['foreach'].makeTemplateValueAccessor(valueAccessor), allBindings, viewModel, bindingContext);
}
};
ko.expressionRewriting.bindingRewriteValidators['foreach'] = false; // Can't rewrite control flow bindings
ko.virtualElements.allowedBindings['foreach'] = true;
var hasfocusUpdatingProperty = '__ko_hasfocusUpdating';
var hasfocusLastValue = '__ko_hasfocusLastValue';
ko.bindingHandlers['hasfocus'] = {
'init': function(element, valueAccessor, allBindings) {
var handleElementFocusChange = function(isFocused) {
// Where possible, ignore which event was raised and determine focus state using activeElement,
// as this avoids phantom focus/blur events raised when changing tabs in modern browsers.
// However, not all KO-targeted browsers (Firefox 2) support activeElement. For those browsers,
// prevent a loss of focus when changing tabs/windows by setting a flag that prevents hasfocus
// from calling 'blur()' on the element when it loses focus.
// Discussion at https://github.com/SteveSanderson/knockout/pull/352
element[hasfocusUpdatingProperty] = true;
var ownerDoc = element.ownerDocument;
if ("activeElement" in ownerDoc) {
var active;
try {
active = ownerDoc.activeElement;
} catch(e) {
// IE9 throws if you access activeElement during page load (see issue #703)
active = ownerDoc.body;
}
isFocused = (active === element);
}
var modelValue = valueAccessor();
ko.expressionRewriting.writeValueToProperty(modelValue, allBindings, 'hasfocus', isFocused, true);
//cache the latest value, so we can avoid unnecessarily calling focus/blur in the update function
element[hasfocusLastValue] = isFocused;
element[hasfocusUpdatingProperty] = false;
};
var handleElementFocusIn = handleElementFocusChange.bind(null, true);
var handleElementFocusOut = handleElementFocusChange.bind(null, false);
ko.utils.registerEventHandler(element, "focus", handleElementFocusIn);
ko.utils.registerEventHandler(element, "focusin", handleElementFocusIn); // For IE
ko.utils.registerEventHandler(element, "blur", handleElementFocusOut);
ko.utils.registerEventHandler(element, "focusout", handleElementFocusOut); // For IE
},
'update': function(element, valueAccessor) {
var value = !!ko.utils.unwrapObservable(valueAccessor()); //force boolean to compare with last value
if (!element[hasfocusUpdatingProperty] && element[hasfocusLastValue] !== value) {
value ? element.focus() : element.blur();
ko.dependencyDetection.ignore(ko.utils.triggerEvent, null, [element, value ? "focusin" : "focusout"]); // For IE, which doesn't reliably fire "focus" or "blur" events synchronously
}
}
};
ko.expressionRewriting.twoWayBindings['hasfocus'] = true;
ko.bindingHandlers['hasFocus'] = ko.bindingHandlers['hasfocus']; // Make "hasFocus" an alias
ko.expressionRewriting.twoWayBindings['hasFocus'] = true;
ko.bindingHandlers['html'] = {
'init': function() {
// Prevent binding on the dynamically-injected HTML (as developers are unlikely to expect that, and it has security implications)
return { 'controlsDescendantBindings': true };
},
'update': function (element, valueAccessor) {
// setHtml will unwrap the value if needed
ko.utils.setHtml(element, valueAccessor());
}
};
// Makes a binding like with or if
function makeWithIfBinding(bindingKey, isWith, isNot, makeContextCallback) {
ko.bindingHandlers[bindingKey] = {
'init': function(element, valueAccessor, allBindings, viewModel, bindingContext) {
var didDisplayOnLastUpdate,
savedNodes;
ko.computed(function() {
var dataValue = ko.utils.unwrapObservable(valueAccessor()),
shouldDisplay = !isNot !== !dataValue, // equivalent to isNot ? !dataValue : !!dataValue
isFirstRender = !savedNodes,
needsRefresh = isFirstRender || isWith || (shouldDisplay !== didDisplayOnLastUpdate);
if (needsRefresh) {
// Save a copy of the inner nodes on the initial update, but only if we have dependencies.
if (isFirstRender && ko.computedContext.getDependenciesCount()) {
savedNodes = ko.utils.cloneNodes(ko.virtualElements.childNodes(element), true /* shouldCleanNodes */);
}
if (shouldDisplay) {
if (!isFirstRender) {
ko.virtualElements.setDomNodeChildren(element, ko.utils.cloneNodes(savedNodes));
}
ko.applyBindingsToDescendants(makeContextCallback ? makeContextCallback(bindingContext, dataValue) : bindingContext, element);
} else {
ko.virtualElements.emptyNode(element);
}
didDisplayOnLastUpdate = shouldDisplay;
}
}, null, { disposeWhenNodeIsRemoved: element });
return { 'controlsDescendantBindings': true };
}
};
ko.expressionRewriting.bindingRewriteValidators[bindingKey] = false; // Can't rewrite control flow bindings
ko.virtualElements.allowedBindings[bindingKey] = true;
}
// Construct the actual binding handlers
makeWithIfBinding('if');
makeWithIfBinding('ifnot', false /* isWith */, true /* isNot */);
makeWithIfBinding('with', true /* isWith */, false /* isNot */,
function(bindingContext, dataValue) {
return bindingContext['createChildContext'](dataValue);
}
);
var captionPlaceholder = {};
ko.bindingHandlers['options'] = {
'init': function(element) {
if (ko.utils.tagNameLower(element) !== "select")
throw new Error("options binding applies only to SELECT elements");
// Remove all existing <option>s.
while (element.length > 0) {
element.remove(0);
}
// Ensures that the binding processor doesn't try to bind the options
return { 'controlsDescendantBindings': true };
},
'update': function (element, valueAccessor, allBindings) {
function selectedOptions() {
return ko.utils.arrayFilter(element.options, function (node) { return node.selected; });
}
var selectWasPreviouslyEmpty = element.length == 0,
multiple = element.multiple,
previousScrollTop = (!selectWasPreviouslyEmpty && multiple) ? element.scrollTop : null,
unwrappedArray = ko.utils.unwrapObservable(valueAccessor()),
valueAllowUnset = allBindings.get('valueAllowUnset') && allBindings['has']('value'),
includeDestroyed = allBindings.get('optionsIncludeDestroyed'),
arrayToDomNodeChildrenOptions = {},
captionValue,
filteredArray,
previousSelectedValues = [];
if (!valueAllowUnset) {
if (multiple) {
previousSelectedValues = ko.utils.arrayMap(selectedOptions(), ko.selectExtensions.readValue);
} else if (element.selectedIndex >= 0) {
previousSelectedValues.push(ko.selectExtensions.readValue(element.options[element.selectedIndex]));
}
}
if (unwrappedArray) {
if (typeof unwrappedArray.length == "undefined") // Coerce single value into array
unwrappedArray = [unwrappedArray];
// Filter out any entries marked as destroyed
filteredArray = ko.utils.arrayFilter(unwrappedArray, function(item) {
return includeDestroyed || item === undefined || item === null || !ko.utils.unwrapObservable(item['_destroy']);
});
// If caption is included, add it to the array
if (allBindings['has']('optionsCaption')) {
captionValue = ko.utils.unwrapObservable(allBindings.get('optionsCaption'));
// If caption value is null or undefined, don't show a caption
if (captionValue !== null && captionValue !== undefined) {
filteredArray.unshift(captionPlaceholder);
}
}
} else {
// If a falsy value is provided (e.g. null), we'll simply empty the select element
}
function applyToObject(object, predicate, defaultValue) {
var predicateType = typeof predicate;
if (predicateType == "function") // Given a function; run it against the data value
return predicate(object);
else if (predicateType == "string") // Given a string; treat it as a property name on the data value
return object[predicate];
else // Given no optionsText arg; use the data value itself
return defaultValue;
}
// The following functions can run at two different times:
// The first is when the whole array is being updated directly from this binding handler.
// The second is when an observable value for a specific array entry is updated.
// oldOptions will be empty in the first case, but will be filled with the previously generated option in the second.
var itemUpdate = false;
function optionForArrayItem(arrayEntry, index, oldOptions) {
if (oldOptions.length) {
previousSelectedValues = !valueAllowUnset && oldOptions[0].selected ? [ ko.selectExtensions.readValue(oldOptions[0]) ] : [];
itemUpdate = true;
}
var option = element.ownerDocument.createElement("option");
if (arrayEntry === captionPlaceholder) {
ko.utils.setTextContent(option, allBindings.get('optionsCaption'));
ko.selectExtensions.writeValue(option, undefined);
} else {
// Apply a value to the option element
var optionValue = applyToObject(arrayEntry, allBindings.get('optionsValue'), arrayEntry);
ko.selectExtensions.writeValue(option, ko.utils.unwrapObservable(optionValue));
// Apply some text to the option element
var optionText = applyToObject(arrayEntry, allBindings.get('optionsText'), optionValue);
ko.utils.setTextContent(option, optionText);
}
return [option];
}
// By using a beforeRemove callback, we delay the removal until after new items are added. This fixes a selection
// problem in IE<=8 and Firefox. See https://github.com/knockout/knockout/issues/1208
arrayToDomNodeChildrenOptions['beforeRemove'] =
function (option) {
element.removeChild(option);
};
function setSelectionCallback(arrayEntry, newOptions) {
if (itemUpdate && valueAllowUnset) {
// The model value is authoritative, so make sure its value is the one selected
// There is no need to use dependencyDetection.ignore since setDomNodeChildrenFromArrayMapping does so already.
ko.selectExtensions.writeValue(element, ko.utils.unwrapObservable(allBindings.get('value')), true /* allowUnset */);
} else if (previousSelectedValues.length) {
// IE6 doesn't like us to assign selection to OPTION nodes before they're added to the document.
// That's why we first added them without selection. Now it's time to set the selection.
var isSelected = ko.utils.arrayIndexOf(previousSelectedValues, ko.selectExtensions.readValue(newOptions[0])) >= 0;
ko.utils.setOptionNodeSelectionState(newOptions[0], isSelected);
// If this option was changed from being selected during a single-item update, notify the change
if (itemUpdate && !isSelected) {
ko.dependencyDetection.ignore(ko.utils.triggerEvent, null, [element, "change"]);
}
}
}
var callback = setSelectionCallback;
if (allBindings['has']('optionsAfterRender') && typeof allBindings.get('optionsAfterRender') == "function") {
callback = function(arrayEntry, newOptions) {
setSelectionCallback(arrayEntry, newOptions);
ko.dependencyDetection.ignore(allBindings.get('optionsAfterRender'), null, [newOptions[0], arrayEntry !== captionPlaceholder ? arrayEntry : undefined]);
}
}
ko.utils.setDomNodeChildrenFromArrayMapping(element, filteredArray, optionForArrayItem, arrayToDomNodeChildrenOptions, callback);
ko.dependencyDetection.ignore(function () {
if (valueAllowUnset) {
// The model value is authoritative, so make sure its value is the one selected
ko.selectExtensions.writeValue(element, ko.utils.unwrapObservable(allBindings.get('value')), true /* allowUnset */);
} else {
// Determine if the selection has changed as a result of updating the options list
var selectionChanged;
if (multiple) {
// For a multiple-select box, compare the new selection count to the previous one
// But if nothing was selected before, the selection can't have changed
selectionChanged = previousSelectedValues.length && selectedOptions().length < previousSelectedValues.length;
} else {
// For a single-select box, compare the current value to the previous value
// But if nothing was selected before or nothing is selected now, just look for a change in selection
selectionChanged = (previousSelectedValues.length && element.selectedIndex >= 0)
? (ko.selectExtensions.readValue(element.options[element.selectedIndex]) !== previousSelectedValues[0])
: (previousSelectedValues.length || element.selectedIndex >= 0);
}
// Ensure consistency between model value and selected option.
// If the dropdown was changed so that selection is no longer the same,
// notify the value or selectedOptions binding.
if (selectionChanged) {
ko.utils.triggerEvent(element, "change");
}
}
});
// Workaround for IE bug
ko.utils.ensureSelectElementIsRenderedCorrectly(element);
if (previousScrollTop && Math.abs(previousScrollTop - element.scrollTop) > 20)
element.scrollTop = previousScrollTop;
}
};
ko.bindingHandlers['options'].optionValueDomDataKey = ko.utils.domData.nextKey();
ko.bindingHandlers['selectedOptions'] = {
'after': ['options', 'foreach'],
'init': function (element, valueAccessor, allBindings) {
ko.utils.registerEventHandler(element, "change", function () {
var value = valueAccessor(), valueToWrite = [];
ko.utils.arrayForEach(element.getElementsByTagName("option"), function(node) {
if (node.selected)
valueToWrite.push(ko.selectExtensions.readValue(node));
});
ko.expressionRewriting.writeValueToProperty(value, allBindings, 'selectedOptions', valueToWrite);
});
},
'update': function (element, valueAccessor) {
if (ko.utils.tagNameLower(element) != "select")
throw new Error("values binding applies only to SELECT elements");
var newValue = ko.utils.unwrapObservable(valueAccessor());
if (newValue && typeof newValue.length == "number") {
ko.utils.arrayForEach(element.getElementsByTagName("option"), function(node) {
var isSelected = ko.utils.arrayIndexOf(newValue, ko.selectExtensions.readValue(node)) >= 0;
ko.utils.setOptionNodeSelectionState(node, isSelected);
});
}
}
};
ko.expressionRewriting.twoWayBindings['selectedOptions'] = true;
ko.bindingHandlers['style'] = {
'update': function (element, valueAccessor) {
var value = ko.utils.unwrapObservable(valueAccessor() || {});
ko.utils.objectForEach(value, function(styleName, styleValue) {
styleValue = ko.utils.unwrapObservable(styleValue);
if (styleValue === null || styleValue === undefined || styleValue === false) {
// Empty string removes the value, whereas null/undefined have no effect
styleValue = "";
}
element.style[styleName] = styleValue;
});
}
};
ko.bindingHandlers['submit'] = {
'init': function (element, valueAccessor, allBindings, viewModel, bindingContext) {
if (typeof valueAccessor() != "function")
throw new Error("The value for a submit binding must be a function");
ko.utils.registerEventHandler(element, "submit", function (event) {
var handlerReturnValue;
var value = valueAccessor();
try { handlerReturnValue = value.call(bindingContext['$data'], element); }
finally {
if (handlerReturnValue !== true) { // Normally we want to prevent default action. Developer can override this be explicitly returning true.
if (event.preventDefault)
event.preventDefault();
else
event.returnValue = false;
}
}
});
}
};
ko.bindingHandlers['text'] = {
'init': function() {
// Prevent binding on the dynamically-injected text node (as developers are unlikely to expect that, and it has security implications).
// It should also make things faster, as we no longer have to consider whether the text node might be bindable.
return { 'controlsDescendantBindings': true };
},
'update': function (element, valueAccessor) {
ko.utils.setTextContent(element, valueAccessor());
}
};
ko.virtualElements.allowedBindings['text'] = true;
(function () {
if (window && window.navigator) {
var parseVersion = function (matches) {
if (matches) {
return parseFloat(matches[1]);
}
};
// Detect various browser versions because some old versions don't fully support the 'input' event
var operaVersion = window.opera && window.opera.version && parseInt(window.opera.version()),
userAgent = window.navigator.userAgent,
safariVersion = parseVersion(userAgent.match(/^(?:(?!chrome).)*version\/([^ ]*) safari/i)),
firefoxVersion = parseVersion(userAgent.match(/Firefox\/([^ ]*)/));
}
// IE 8 and 9 have bugs that prevent the normal events from firing when the value changes.
// But it does fire the 'selectionchange' event on many of those, presumably because the
// cursor is moving and that counts as the selection changing. The 'selectionchange' event is
// fired at the document level only and doesn't directly indicate which element changed. We
// set up just one event handler for the document and use 'activeElement' to determine which
// element was changed.
if (ko.utils.ieVersion < 10) {
var selectionChangeRegisteredName = ko.utils.domData.nextKey(),
selectionChangeHandlerName = ko.utils.domData.nextKey();
var selectionChangeHandler = function(event) {
var target = this.activeElement,
handler = target && ko.utils.domData.get(target, selectionChangeHandlerName);
if (handler) {
handler(event);
}
};
var registerForSelectionChangeEvent = function (element, handler) {
var ownerDoc = element.ownerDocument;
if (!ko.utils.domData.get(ownerDoc, selectionChangeRegisteredName)) {
ko.utils.domData.set(ownerDoc, selectionChangeRegisteredName, true);
ko.utils.registerEventHandler(ownerDoc, 'selectionchange', selectionChangeHandler);
}
ko.utils.domData.set(element, selectionChangeHandlerName, handler);
};
}
ko.bindingHandlers['textInput'] = {
'init': function (element, valueAccessor, allBindings) {
var previousElementValue = element.value,
timeoutHandle,
elementValueBeforeEvent;
var updateModel = function (event) {
clearTimeout(timeoutHandle);
elementValueBeforeEvent = timeoutHandle = undefined;
var elementValue = element.value;
if (previousElementValue !== elementValue) {
// Provide a way for tests to know exactly which event was processed
if (DEBUG && event) element['_ko_textInputProcessedEvent'] = event.type;
previousElementValue = elementValue;
ko.expressionRewriting.writeValueToProperty(valueAccessor(), allBindings, 'textInput', elementValue);
}
};
var deferUpdateModel = function (event) {
if (!timeoutHandle) {
// The elementValueBeforeEvent variable is set *only* during the brief gap between an
// event firing and the updateModel function running. This allows us to ignore model
// updates that are from the previous state of the element, usually due to techniques
// such as rateLimit. Such updates, if not ignored, can cause keystrokes to be lost.
elementValueBeforeEvent = element.value;
var handler = DEBUG ? updateModel.bind(element, {type: event.type}) : updateModel;
timeoutHandle = setTimeout(handler, 4);
}
};
var updateView = function () {
var modelValue = ko.utils.unwrapObservable(valueAccessor());
if (modelValue === null || modelValue === undefined) {
modelValue = '';
}
if (elementValueBeforeEvent !== undefined && modelValue === elementValueBeforeEvent) {
setTimeout(updateView, 4);
return;
}
// Update the element only if the element and model are different. On some browsers, updating the value
// will move the cursor to the end of the input, which would be bad while the user is typing.
if (element.value !== modelValue) {
previousElementValue = modelValue; // Make sure we ignore events (propertychange) that result from updating the value
element.value = modelValue;
}
};
var onEvent = function (event, handler) {
ko.utils.registerEventHandler(element, event, handler);
};
if (DEBUG && ko.bindingHandlers['textInput']['_forceUpdateOn']) {
// Provide a way for tests to specify exactly which events are bound
ko.utils.arrayForEach(ko.bindingHandlers['textInput']['_forceUpdateOn'], function(eventName) {
if (eventName.slice(0,5) == 'after') {
onEvent(eventName.slice(5), deferUpdateModel);
} else {
onEvent(eventName, updateModel);
}
});
} else {
if (ko.utils.ieVersion < 10) {
// Internet Explorer <= 8 doesn't support the 'input' event, but does include 'propertychange' that fires whenever
// any property of an element changes. Unlike 'input', it also fires if a property is changed from JavaScript code,
// but that's an acceptable compromise for this binding. IE 9 does support 'input', but since it doesn't fire it
// when using autocomplete, we'll use 'propertychange' for it also.
onEvent('propertychange', function(event) {
if (event.propertyName === 'value') {
updateModel(event);
}
});
if (ko.utils.ieVersion == 8) {
// IE 8 has a bug where it fails to fire 'propertychange' on the first update following a value change from
// JavaScript code. It also doesn't fire if you clear the entire value. To fix this, we bind to the following
// events too.
onEvent('keyup', updateModel); // A single keystoke
onEvent('keydown', updateModel); // The first character when a key is held down
}
if (ko.utils.ieVersion >= 8) {
// Internet Explorer 9 doesn't fire the 'input' event when deleting text, including using
// the backspace, delete, or ctrl-x keys, clicking the 'x' to clear the input, dragging text
// out of the field, and cutting or deleting text using the context menu. 'selectionchange'
// can detect all of those except dragging text out of the field, for which we use 'dragend'.
// These are also needed in IE8 because of the bug described above.
registerForSelectionChangeEvent(element, updateModel); // 'selectionchange' covers cut, paste, drop, delete, etc.
onEvent('dragend', deferUpdateModel);
}
} else {
// All other supported browsers support the 'input' event, which fires whenever the content of the element is changed
// through the user interface.
onEvent('input', updateModel);
if (safariVersion < 5 && ko.utils.tagNameLower(element) === "textarea") {
// Safari <5 doesn't fire the 'input' event for <textarea> elements (it does fire 'textInput'
// but only when typing). So we'll just catch as much as we can with keydown, cut, and paste.
onEvent('keydown', deferUpdateModel);
onEvent('paste', deferUpdateModel);
onEvent('cut', deferUpdateModel);
} else if (operaVersion < 11) {
// Opera 10 doesn't always fire the 'input' event for cut, paste, undo & drop operations.
// We can try to catch some of those using 'keydown'.
onEvent('keydown', deferUpdateModel);
} else if (firefoxVersion < 4.0) {
// Firefox <= 3.6 doesn't fire the 'input' event when text is filled in through autocomplete
onEvent('DOMAutoComplete', updateModel);
// Firefox <=3.5 doesn't fire the 'input' event when text is dropped into the input.
onEvent('dragdrop', updateModel); // <3.5
onEvent('drop', updateModel); // 3.5
}
}
}
// Bind to the change event so that we can catch programmatic updates of the value that fire this event.
onEvent('change', updateModel);
ko.computed(updateView, null, { disposeWhenNodeIsRemoved: element });
}
};
ko.expressionRewriting.twoWayBindings['textInput'] = true;
// textinput is an alias for textInput
ko.bindingHandlers['textinput'] = {
// preprocess is the only way to set up a full alias
'preprocess': function (value, name, addBinding) {
addBinding('textInput', value);
}
};
})();ko.bindingHandlers['uniqueName'] = {
'init': function (element, valueAccessor) {
if (valueAccessor()) {
var name = "ko_unique_" + (++ko.bindingHandlers['uniqueName'].currentIndex);
ko.utils.setElementName(element, name);
}
}
};
ko.bindingHandlers['uniqueName'].currentIndex = 0;
ko.bindingHandlers['value'] = {
'after': ['options', 'foreach'],
'init': function (element, valueAccessor, allBindings) {
// If the value binding is placed on a radio/checkbox, then just pass through to checkedValue and quit
if (element.tagName.toLowerCase() == "input" && (element.type == "checkbox" || element.type == "radio")) {
ko.applyBindingAccessorsToNode(element, { 'checkedValue': valueAccessor });
return;
}
// Always catch "change" event; possibly other events too if asked
var eventsToCatch = ["change"];
var requestedEventsToCatch = allBindings.get("valueUpdate");
var propertyChangedFired = false;
var elementValueBeforeEvent = null;
if (requestedEventsToCatch) {
if (typeof requestedEventsToCatch == "string") // Allow both individual event names, and arrays of event names
requestedEventsToCatch = [requestedEventsToCatch];
ko.utils.arrayPushAll(eventsToCatch, requestedEventsToCatch);
eventsToCatch = ko.utils.arrayGetDistinctValues(eventsToCatch);
}
var valueUpdateHandler = function() {
elementValueBeforeEvent = null;
propertyChangedFired = false;
var modelValue = valueAccessor();
var elementValue = ko.selectExtensions.readValue(element);
ko.expressionRewriting.writeValueToProperty(modelValue, allBindings, 'value', elementValue);
}
// Workaround for https://github.com/SteveSanderson/knockout/issues/122
// IE doesn't fire "change" events on textboxes if the user selects a value from its autocomplete list
var ieAutoCompleteHackNeeded = ko.utils.ieVersion && element.tagName.toLowerCase() == "input" && element.type == "text"
&& element.autocomplete != "off" && (!element.form || element.form.autocomplete != "off");
if (ieAutoCompleteHackNeeded && ko.utils.arrayIndexOf(eventsToCatch, "propertychange") == -1) {
ko.utils.registerEventHandler(element, "propertychange", function () { propertyChangedFired = true });
ko.utils.registerEventHandler(element, "focus", function () { propertyChangedFired = false });
ko.utils.registerEventHandler(element, "blur", function() {
if (propertyChangedFired) {
valueUpdateHandler();
}
});
}
ko.utils.arrayForEach(eventsToCatch, function(eventName) {
// The syntax "after<eventname>" means "run the handler asynchronously after the event"
// This is useful, for example, to catch "keydown" events after the browser has updated the control
// (otherwise, ko.selectExtensions.readValue(this) will receive the control's value *before* the key event)
var handler = valueUpdateHandler;
if (ko.utils.stringStartsWith(eventName, "after")) {
handler = function() {
// The elementValueBeforeEvent variable is non-null *only* during the brief gap between
// a keyX event firing and the valueUpdateHandler running, which is scheduled to happen
// at the earliest asynchronous opportunity. We store this temporary information so that
// if, between keyX and valueUpdateHandler, the underlying model value changes separately,
// we can overwrite that model value change with the value the user just typed. Otherwise,
// techniques like rateLimit can trigger model changes at critical moments that will
// override the user's inputs, causing keystrokes to be lost.
elementValueBeforeEvent = ko.selectExtensions.readValue(element);
setTimeout(valueUpdateHandler, 0);
};
eventName = eventName.substring("after".length);
}
ko.utils.registerEventHandler(element, eventName, handler);
});
var updateFromModel = function () {
var newValue = ko.utils.unwrapObservable(valueAccessor());
var elementValue = ko.selectExtensions.readValue(element);
if (elementValueBeforeEvent !== null && newValue === elementValueBeforeEvent) {
setTimeout(updateFromModel, 0);
return;
}
var valueHasChanged = (newValue !== elementValue);
if (valueHasChanged) {
if (ko.utils.tagNameLower(element) === "select") {
var allowUnset = allBindings.get('valueAllowUnset');
var applyValueAction = function () {
ko.selectExtensions.writeValue(element, newValue, allowUnset);
};
applyValueAction();
if (!allowUnset && newValue !== ko.selectExtensions.readValue(element)) {
// If you try to set a model value that can't be represented in an already-populated dropdown, reject that change,
// because you're not allowed to have a model value that disagrees with a visible UI selection.
ko.dependencyDetection.ignore(ko.utils.triggerEvent, null, [element, "change"]);
} else {
// Workaround for IE6 bug: It won't reliably apply values to SELECT nodes during the same execution thread
// right after you've changed the set of OPTION nodes on it. So for that node type, we'll schedule a second thread
// to apply the value as well.
setTimeout(applyValueAction, 0);
}
} else {
ko.selectExtensions.writeValue(element, newValue);
}
}
};
ko.computed(updateFromModel, null, { disposeWhenNodeIsRemoved: element });
},
'update': function() {} // Keep for backwards compatibility with code that may have wrapped value binding
};
ko.expressionRewriting.twoWayBindings['value'] = true;
ko.bindingHandlers['visible'] = {
'update': function (element, valueAccessor) {
var value = ko.utils.unwrapObservable(valueAccessor());
var isCurrentlyVisible = !(element.style.display == "none");
if (value && !isCurrentlyVisible)
element.style.display = "";
else if ((!value) && isCurrentlyVisible)
element.style.display = "none";
}
};
// 'click' is just a shorthand for the usual full-length event:{click:handler}
makeEventHandlerShortcut('click');
// If you want to make a custom template engine,
//
// [1] Inherit from this class (like ko.nativeTemplateEngine does)
// [2] Override 'renderTemplateSource', supplying a function with this signature:
//
// function (templateSource, bindingContext, options) {
// // - templateSource.text() is the text of the template you should render
// // - bindingContext.$data is the data you should pass into the template
// // - you might also want to make bindingContext.$parent, bindingContext.$parents,
// // and bindingContext.$root available in the template too
// // - options gives you access to any other properties set on "data-bind: { template: options }"
// // - templateDocument is the document object of the template
// //
// // Return value: an array of DOM nodes
// }
//
// [3] Override 'createJavaScriptEvaluatorBlock', supplying a function with this signature:
//
// function (script) {
// // Return value: Whatever syntax means "Evaluate the JavaScript statement 'script' and output the result"
// // For example, the jquery.tmpl template engine converts 'someScript' to '${ someScript }'
// }
//
// This is only necessary if you want to allow data-bind attributes to reference arbitrary template variables.
// If you don't want to allow that, you can set the property 'allowTemplateRewriting' to false (like ko.nativeTemplateEngine does)
// and then you don't need to override 'createJavaScriptEvaluatorBlock'.
ko.templateEngine = function () { };
ko.templateEngine.prototype['renderTemplateSource'] = function (templateSource, bindingContext, options, templateDocument) {
throw new Error("Override renderTemplateSource");
};
ko.templateEngine.prototype['createJavaScriptEvaluatorBlock'] = function (script) {
throw new Error("Override createJavaScriptEvaluatorBlock");
};
ko.templateEngine.prototype['makeTemplateSource'] = function(template, templateDocument) {
// Named template
if (typeof template == "string") {
templateDocument = templateDocument || document;
var elem = templateDocument.getElementById(template);
if (!elem)
throw new Error("Cannot find template with ID " + template);
return new ko.templateSources.domElement(elem);
} else if ((template.nodeType == 1) || (template.nodeType == 8)) {
// Anonymous template
return new ko.templateSources.anonymousTemplate(template);
} else
throw new Error("Unknown template type: " + template);
};
ko.templateEngine.prototype['renderTemplate'] = function (template, bindingContext, options, templateDocument) {
var templateSource = this['makeTemplateSource'](template, templateDocument);
return this['renderTemplateSource'](templateSource, bindingContext, options, templateDocument);
};
ko.templateEngine.prototype['isTemplateRewritten'] = function (template, templateDocument) {
// Skip rewriting if requested
if (this['allowTemplateRewriting'] === false)
return true;
return this['makeTemplateSource'](template, templateDocument)['data']("isRewritten");
};
ko.templateEngine.prototype['rewriteTemplate'] = function (template, rewriterCallback, templateDocument) {
var templateSource = this['makeTemplateSource'](template, templateDocument);
var rewritten = rewriterCallback(templateSource['text']());
templateSource['text'](rewritten);
templateSource['data']("isRewritten", true);
};
ko.exportSymbol('templateEngine', ko.templateEngine);
ko.templateRewriting = (function () {
var memoizeDataBindingAttributeSyntaxRegex = /(<([a-z]+\d*)(?:\s+(?!data-bind\s*=\s*)[a-z0-9\-]+(?:=(?:\"[^\"]*\"|\'[^\']*\'|[^>]*))?)*\s+)data-bind\s*=\s*(["'])([\s\S]*?)\3/gi;
var memoizeVirtualContainerBindingSyntaxRegex = /<!--\s*ko\b\s*([\s\S]*?)\s*-->/g;
function validateDataBindValuesForRewriting(keyValueArray) {
var allValidators = ko.expressionRewriting.bindingRewriteValidators;
for (var i = 0; i < keyValueArray.length; i++) {
var key = keyValueArray[i]['key'];
if (allValidators.hasOwnProperty(key)) {
var validator = allValidators[key];
if (typeof validator === "function") {
var possibleErrorMessage = validator(keyValueArray[i]['value']);
if (possibleErrorMessage)
throw new Error(possibleErrorMessage);
} else if (!validator) {
throw new Error("This template engine does not support the '" + key + "' binding within its templates");
}
}
}
}
function constructMemoizedTagReplacement(dataBindAttributeValue, tagToRetain, nodeName, templateEngine) {
var dataBindKeyValueArray = ko.expressionRewriting.parseObjectLiteral(dataBindAttributeValue);
validateDataBindValuesForRewriting(dataBindKeyValueArray);
var rewrittenDataBindAttributeValue = ko.expressionRewriting.preProcessBindings(dataBindKeyValueArray, {'valueAccessors':true});
// For no obvious reason, Opera fails to evaluate rewrittenDataBindAttributeValue unless it's wrapped in an additional
// anonymous function, even though Opera's built-in debugger can evaluate it anyway. No other browser requires this
// extra indirection.
var applyBindingsToNextSiblingScript =
"ko.__tr_ambtns(function($context,$element){return(function(){return{ " + rewrittenDataBindAttributeValue + " } })()},'" + nodeName.toLowerCase() + "')";
return templateEngine['createJavaScriptEvaluatorBlock'](applyBindingsToNextSiblingScript) + tagToRetain;
}
return {
ensureTemplateIsRewritten: function (template, templateEngine, templateDocument) {
if (!templateEngine['isTemplateRewritten'](template, templateDocument))
templateEngine['rewriteTemplate'](template, function (htmlString) {
return ko.templateRewriting.memoizeBindingAttributeSyntax(htmlString, templateEngine);
}, templateDocument);
},
memoizeBindingAttributeSyntax: function (htmlString, templateEngine) {
return htmlString.replace(memoizeDataBindingAttributeSyntaxRegex, function () {
return constructMemoizedTagReplacement(/* dataBindAttributeValue: */ arguments[4], /* tagToRetain: */ arguments[1], /* nodeName: */ arguments[2], templateEngine);
}).replace(memoizeVirtualContainerBindingSyntaxRegex, function() {
return constructMemoizedTagReplacement(/* dataBindAttributeValue: */ arguments[1], /* tagToRetain: */ "<!-- ko -->", /* nodeName: */ "#comment", templateEngine);
});
},
applyMemoizedBindingsToNextSibling: function (bindings, nodeName) {
return ko.memoization.memoize(function (domNode, bindingContext) {
var nodeToBind = domNode.nextSibling;
if (nodeToBind && nodeToBind.nodeName.toLowerCase() === nodeName) {
ko.applyBindingAccessorsToNode(nodeToBind, bindings, bindingContext);
}
});
}
}
})();
// Exported only because it has to be referenced by string lookup from within rewritten template
ko.exportSymbol('__tr_ambtns', ko.templateRewriting.applyMemoizedBindingsToNextSibling);
(function() {
// A template source represents a read/write way of accessing a template. This is to eliminate the need for template loading/saving
// logic to be duplicated in every template engine (and means they can all work with anonymous templates, etc.)
//
// Two are provided by default:
// 1. ko.templateSources.domElement - reads/writes the text content of an arbitrary DOM element
// 2. ko.templateSources.anonymousElement - uses ko.utils.domData to read/write text *associated* with the DOM element, but
// without reading/writing the actual element text content, since it will be overwritten
// with the rendered template output.
// You can implement your own template source if you want to fetch/store templates somewhere other than in DOM elements.
// Template sources need to have the following functions:
// text() - returns the template text from your storage location
// text(value) - writes the supplied template text to your storage location
// data(key) - reads values stored using data(key, value) - see below
// data(key, value) - associates "value" with this template and the key "key". Is used to store information like "isRewritten".
//
// Optionally, template sources can also have the following functions:
// nodes() - returns a DOM element containing the nodes of this template, where available
// nodes(value) - writes the given DOM element to your storage location
// If a DOM element is available for a given template source, template engines are encouraged to use it in preference over text()
// for improved speed. However, all templateSources must supply text() even if they don't supply nodes().
//
// Once you've implemented a templateSource, make your template engine use it by subclassing whatever template engine you were
// using and overriding "makeTemplateSource" to return an instance of your custom template source.
ko.templateSources = {};
// ---- ko.templateSources.domElement -----
ko.templateSources.domElement = function(element) {
this.domElement = element;
}
ko.templateSources.domElement.prototype['text'] = function(/* valueToWrite */) {
var tagNameLower = ko.utils.tagNameLower(this.domElement),
elemContentsProperty = tagNameLower === "script" ? "text"
: tagNameLower === "textarea" ? "value"
: "innerHTML";
if (arguments.length == 0) {
return this.domElement[elemContentsProperty];
} else {
var valueToWrite = arguments[0];
if (elemContentsProperty === "innerHTML")
ko.utils.setHtml(this.domElement, valueToWrite);
else
this.domElement[elemContentsProperty] = valueToWrite;
}
};
var dataDomDataPrefix = ko.utils.domData.nextKey() + "_";
ko.templateSources.domElement.prototype['data'] = function(key /*, valueToWrite */) {
if (arguments.length === 1) {
return ko.utils.domData.get(this.domElement, dataDomDataPrefix + key);
} else {
ko.utils.domData.set(this.domElement, dataDomDataPrefix + key, arguments[1]);
}
};
// ---- ko.templateSources.anonymousTemplate -----
// Anonymous templates are normally saved/retrieved as DOM nodes through "nodes".
// For compatibility, you can also read "text"; it will be serialized from the nodes on demand.
// Writing to "text" is still supported, but then the template data will not be available as DOM nodes.
var anonymousTemplatesDomDataKey = ko.utils.domData.nextKey();
ko.templateSources.anonymousTemplate = function(element) {
this.domElement = element;
}
ko.templateSources.anonymousTemplate.prototype = new ko.templateSources.domElement();
ko.templateSources.anonymousTemplate.prototype.constructor = ko.templateSources.anonymousTemplate;
ko.templateSources.anonymousTemplate.prototype['text'] = function(/* valueToWrite */) {
if (arguments.length == 0) {
var templateData = ko.utils.domData.get(this.domElement, anonymousTemplatesDomDataKey) || {};
if (templateData.textData === undefined && templateData.containerData)
templateData.textData = templateData.containerData.innerHTML;
return templateData.textData;
} else {
var valueToWrite = arguments[0];
ko.utils.domData.set(this.domElement, anonymousTemplatesDomDataKey, {textData: valueToWrite});
}
};
ko.templateSources.domElement.prototype['nodes'] = function(/* valueToWrite */) {
if (arguments.length == 0) {
var templateData = ko.utils.domData.get(this.domElement, anonymousTemplatesDomDataKey) || {};
return templateData.containerData;
} else {
var valueToWrite = arguments[0];
ko.utils.domData.set(this.domElement, anonymousTemplatesDomDataKey, {containerData: valueToWrite});
}
};
ko.exportSymbol('templateSources', ko.templateSources);
ko.exportSymbol('templateSources.domElement', ko.templateSources.domElement);
ko.exportSymbol('templateSources.anonymousTemplate', ko.templateSources.anonymousTemplate);
})();
(function () {
var _templateEngine;
ko.setTemplateEngine = function (templateEngine) {
if ((templateEngine != undefined) && !(templateEngine instanceof ko.templateEngine))
throw new Error("templateEngine must inherit from ko.templateEngine");
_templateEngine = templateEngine;
}
function invokeForEachNodeInContinuousRange(firstNode, lastNode, action) {
var node, nextInQueue = firstNode, firstOutOfRangeNode = ko.virtualElements.nextSibling(lastNode);
while (nextInQueue && ((node = nextInQueue) !== firstOutOfRangeNode)) {
nextInQueue = ko.virtualElements.nextSibling(node);
action(node, nextInQueue);
}
}
function activateBindingsOnContinuousNodeArray(continuousNodeArray, bindingContext) {
// To be used on any nodes that have been rendered by a template and have been inserted into some parent element
// Walks through continuousNodeArray (which *must* be continuous, i.e., an uninterrupted sequence of sibling nodes, because
// the algorithm for walking them relies on this), and for each top-level item in the virtual-element sense,
// (1) Does a regular "applyBindings" to associate bindingContext with this node and to activate any non-memoized bindings
// (2) Unmemoizes any memos in the DOM subtree (e.g., to activate bindings that had been memoized during template rewriting)
if (continuousNodeArray.length) {
var firstNode = continuousNodeArray[0],
lastNode = continuousNodeArray[continuousNodeArray.length - 1],
parentNode = firstNode.parentNode,
provider = ko.bindingProvider['instance'],
preprocessNode = provider['preprocessNode'];
if (preprocessNode) {
invokeForEachNodeInContinuousRange(firstNode, lastNode, function(node, nextNodeInRange) {
var nodePreviousSibling = node.previousSibling;
var newNodes = preprocessNode.call(provider, node);
if (newNodes) {
if (node === firstNode)
firstNode = newNodes[0] || nextNodeInRange;
if (node === lastNode)
lastNode = newNodes[newNodes.length - 1] || nodePreviousSibling;
}
});
// Because preprocessNode can change the nodes, including the first and last nodes, update continuousNodeArray to match.
// We need the full set, including inner nodes, because the unmemoize step might remove the first node (and so the real
// first node needs to be in the array).
continuousNodeArray.length = 0;
if (!firstNode) { // preprocessNode might have removed all the nodes, in which case there's nothing left to do
return;
}
if (firstNode === lastNode) {
continuousNodeArray.push(firstNode);
} else {
continuousNodeArray.push(firstNode, lastNode);
ko.utils.fixUpContinuousNodeArray(continuousNodeArray, parentNode);
}
}
// Need to applyBindings *before* unmemoziation, because unmemoization might introduce extra nodes (that we don't want to re-bind)
// whereas a regular applyBindings won't introduce new memoized nodes
invokeForEachNodeInContinuousRange(firstNode, lastNode, function(node) {
if (node.nodeType === 1 || node.nodeType === 8)
ko.applyBindings(bindingContext, node);
});
invokeForEachNodeInContinuousRange(firstNode, lastNode, function(node) {
if (node.nodeType === 1 || node.nodeType === 8)
ko.memoization.unmemoizeDomNodeAndDescendants(node, [bindingContext]);
});
// Make sure any changes done by applyBindings or unmemoize are reflected in the array
ko.utils.fixUpContinuousNodeArray(continuousNodeArray, parentNode);
}
}
function getFirstNodeFromPossibleArray(nodeOrNodeArray) {
return nodeOrNodeArray.nodeType ? nodeOrNodeArray
: nodeOrNodeArray.length > 0 ? nodeOrNodeArray[0]
: null;
}
function executeTemplate(targetNodeOrNodeArray, renderMode, template, bindingContext, options) {
options = options || {};
var firstTargetNode = targetNodeOrNodeArray && getFirstNodeFromPossibleArray(targetNodeOrNodeArray);
var templateDocument = (firstTargetNode || template || {}).ownerDocument;
var templateEngineToUse = (options['templateEngine'] || _templateEngine);
ko.templateRewriting.ensureTemplateIsRewritten(template, templateEngineToUse, templateDocument);
var renderedNodesArray = templateEngineToUse['renderTemplate'](template, bindingContext, options, templateDocument);
// Loosely check result is an array of DOM nodes
if ((typeof renderedNodesArray.length != "number") || (renderedNodesArray.length > 0 && typeof renderedNodesArray[0].nodeType != "number"))
throw new Error("Template engine must return an array of DOM nodes");
var haveAddedNodesToParent = false;
switch (renderMode) {
case "replaceChildren":
ko.virtualElements.setDomNodeChildren(targetNodeOrNodeArray, renderedNodesArray);
haveAddedNodesToParent = true;
break;
case "replaceNode":
ko.utils.replaceDomNodes(targetNodeOrNodeArray, renderedNodesArray);
haveAddedNodesToParent = true;
break;
case "ignoreTargetNode": break;
default:
throw new Error("Unknown renderMode: " + renderMode);
}
if (haveAddedNodesToParent) {
activateBindingsOnContinuousNodeArray(renderedNodesArray, bindingContext);
if (options['afterRender'])
ko.dependencyDetection.ignore(options['afterRender'], null, [renderedNodesArray, bindingContext['$data']]);
}
return renderedNodesArray;
}
function resolveTemplateName(template, data, context) {
// The template can be specified as:
if (ko.isObservable(template)) {
// 1. An observable, with string value
return template();
} else if (typeof template === 'function') {
// 2. A function of (data, context) returning a string
return template(data, context);
} else {
// 3. A string
return template;
}
}
ko.renderTemplate = function (template, dataOrBindingContext, options, targetNodeOrNodeArray, renderMode) {
options = options || {};
if ((options['templateEngine'] || _templateEngine) == undefined)
throw new Error("Set a template engine before calling renderTemplate");
renderMode = renderMode || "replaceChildren";
if (targetNodeOrNodeArray) {
var firstTargetNode = getFirstNodeFromPossibleArray(targetNodeOrNodeArray);
var whenToDispose = function () { return (!firstTargetNode) || !ko.utils.domNodeIsAttachedToDocument(firstTargetNode); }; // Passive disposal (on next evaluation)
var activelyDisposeWhenNodeIsRemoved = (firstTargetNode && renderMode == "replaceNode") ? firstTargetNode.parentNode : firstTargetNode;
return ko.dependentObservable( // So the DOM is automatically updated when any dependency changes
function () {
// Ensure we've got a proper binding context to work with
var bindingContext = (dataOrBindingContext && (dataOrBindingContext instanceof ko.bindingContext))
? dataOrBindingContext
: new ko.bindingContext(ko.utils.unwrapObservable(dataOrBindingContext));
var templateName = resolveTemplateName(template, bindingContext['$data'], bindingContext),
renderedNodesArray = executeTemplate(targetNodeOrNodeArray, renderMode, templateName, bindingContext, options);
if (renderMode == "replaceNode") {
targetNodeOrNodeArray = renderedNodesArray;
firstTargetNode = getFirstNodeFromPossibleArray(targetNodeOrNodeArray);
}
},
null,
{ disposeWhen: whenToDispose, disposeWhenNodeIsRemoved: activelyDisposeWhenNodeIsRemoved }
);
} else {
// We don't yet have a DOM node to evaluate, so use a memo and render the template later when there is a DOM node
return ko.memoization.memoize(function (domNode) {
ko.renderTemplate(template, dataOrBindingContext, options, domNode, "replaceNode");
});
}
};
ko.renderTemplateForEach = function (template, arrayOrObservableArray, options, targetNode, parentBindingContext) {
// Since setDomNodeChildrenFromArrayMapping always calls executeTemplateForArrayItem and then
// activateBindingsCallback for added items, we can store the binding context in the former to use in the latter.
var arrayItemContext;
// This will be called by setDomNodeChildrenFromArrayMapping to get the nodes to add to targetNode
var executeTemplateForArrayItem = function (arrayValue, index) {
// Support selecting template as a function of the data being rendered
arrayItemContext = parentBindingContext['createChildContext'](arrayValue, options['as'], function(context) {
context['$index'] = index;
});
var templateName = resolveTemplateName(template, arrayValue, arrayItemContext);
return executeTemplate(null, "ignoreTargetNode", templateName, arrayItemContext, options);
}
// This will be called whenever setDomNodeChildrenFromArrayMapping has added nodes to targetNode
var activateBindingsCallback = function(arrayValue, addedNodesArray, index) {
activateBindingsOnContinuousNodeArray(addedNodesArray, arrayItemContext);
if (options['afterRender'])
options['afterRender'](addedNodesArray, arrayValue);
// release the "cache" variable, so that it can be collected by
// the GC when its value isn't used from within the bindings anymore.
arrayItemContext = null;
};
return ko.dependentObservable(function () {
var unwrappedArray = ko.utils.unwrapObservable(arrayOrObservableArray) || [];
if (typeof unwrappedArray.length == "undefined") // Coerce single value into array
unwrappedArray = [unwrappedArray];
// Filter out any entries marked as destroyed
var filteredArray = ko.utils.arrayFilter(unwrappedArray, function(item) {
return options['includeDestroyed'] || item === undefined || item === null || !ko.utils.unwrapObservable(item['_destroy']);
});
// Call setDomNodeChildrenFromArrayMapping, ignoring any observables unwrapped within (most likely from a callback function).
// If the array items are observables, though, they will be unwrapped in executeTemplateForArrayItem and managed within setDomNodeChildrenFromArrayMapping.
ko.dependencyDetection.ignore(ko.utils.setDomNodeChildrenFromArrayMapping, null, [targetNode, filteredArray, executeTemplateForArrayItem, options, activateBindingsCallback]);
}, null, { disposeWhenNodeIsRemoved: targetNode });
};
var templateComputedDomDataKey = ko.utils.domData.nextKey();
function disposeOldComputedAndStoreNewOne(element, newComputed) {
var oldComputed = ko.utils.domData.get(element, templateComputedDomDataKey);
if (oldComputed && (typeof(oldComputed.dispose) == 'function'))
oldComputed.dispose();
ko.utils.domData.set(element, templateComputedDomDataKey, (newComputed && newComputed.isActive()) ? newComputed : undefined);
}
ko.bindingHandlers['template'] = {
'init': function(element, valueAccessor) {
// Support anonymous templates
var bindingValue = ko.utils.unwrapObservable(valueAccessor());
if (typeof bindingValue == "string" || bindingValue['name']) {
// It's a named template - clear the element
ko.virtualElements.emptyNode(element);
} else if ('nodes' in bindingValue) {
// We've been given an array of DOM nodes. Save them as the template source.
// There is no known use case for the node array being an observable array (if the output
// varies, put that behavior *into* your template - that's what templates are for), and
// the implementation would be a mess, so assert that it's not observable.
var nodes = bindingValue['nodes'] || [];
if (ko.isObservable(nodes)) {
throw new Error('The "nodes" option must be a plain, non-observable array.');
}
var container = ko.utils.moveCleanedNodesToContainerElement(nodes); // This also removes the nodes from their current parent
new ko.templateSources.anonymousTemplate(element)['nodes'](container);
} else {
// It's an anonymous template - store the element contents, then clear the element
var templateNodes = ko.virtualElements.childNodes(element),
container = ko.utils.moveCleanedNodesToContainerElement(templateNodes); // This also removes the nodes from their current parent
new ko.templateSources.anonymousTemplate(element)['nodes'](container);
}
return { 'controlsDescendantBindings': true };
},
'update': function (element, valueAccessor, allBindings, viewModel, bindingContext) {
var value = valueAccessor(),
dataValue,
options = ko.utils.unwrapObservable(value),
shouldDisplay = true,
templateComputed = null,
templateName;
if (typeof options == "string") {
templateName = value;
options = {};
} else {
templateName = options['name'];
// Support "if"/"ifnot" conditions
if ('if' in options)
shouldDisplay = ko.utils.unwrapObservable(options['if']);
if (shouldDisplay && 'ifnot' in options)
shouldDisplay = !ko.utils.unwrapObservable(options['ifnot']);
dataValue = ko.utils.unwrapObservable(options['data']);
}
if ('foreach' in options) {
// Render once for each data point (treating data set as empty if shouldDisplay==false)
var dataArray = (shouldDisplay && options['foreach']) || [];
templateComputed = ko.renderTemplateForEach(templateName || element, dataArray, options, element, bindingContext);
} else if (!shouldDisplay) {
ko.virtualElements.emptyNode(element);
} else {
// Render once for this single data point (or use the viewModel if no data was provided)
var innerBindingContext = ('data' in options) ?
bindingContext['createChildContext'](dataValue, options['as']) : // Given an explitit 'data' value, we create a child binding context for it
bindingContext; // Given no explicit 'data' value, we retain the same binding context
templateComputed = ko.renderTemplate(templateName || element, innerBindingContext, options, element);
}
// It only makes sense to have a single template computed per element (otherwise which one should have its output displayed?)
disposeOldComputedAndStoreNewOne(element, templateComputed);
}
};
// Anonymous templates can't be rewritten. Give a nice error message if you try to do it.
ko.expressionRewriting.bindingRewriteValidators['template'] = function(bindingValue) {
var parsedBindingValue = ko.expressionRewriting.parseObjectLiteral(bindingValue);
if ((parsedBindingValue.length == 1) && parsedBindingValue[0]['unknown'])
return null; // It looks like a string literal, not an object literal, so treat it as a named template (which is allowed for rewriting)
if (ko.expressionRewriting.keyValueArrayContainsKey(parsedBindingValue, "name"))
return null; // Named templates can be rewritten, so return "no error"
return "This template engine does not support anonymous templates nested within its templates";
};
ko.virtualElements.allowedBindings['template'] = true;
})();
ko.exportSymbol('setTemplateEngine', ko.setTemplateEngine);
ko.exportSymbol('renderTemplate', ko.renderTemplate);
// Go through the items that have been added and deleted and try to find matches between them.
ko.utils.findMovesInArrayComparison = function (left, right, limitFailedCompares) {
if (left.length && right.length) {
var failedCompares, l, r, leftItem, rightItem;
for (failedCompares = l = 0; (!limitFailedCompares || failedCompares < limitFailedCompares) && (leftItem = left[l]); ++l) {
for (r = 0; rightItem = right[r]; ++r) {
if (leftItem['value'] === rightItem['value']) {
leftItem['moved'] = rightItem['index'];
rightItem['moved'] = leftItem['index'];
right.splice(r, 1); // This item is marked as moved; so remove it from right list
failedCompares = r = 0; // Reset failed compares count because we're checking for consecutive failures
break;
}
}
failedCompares += r;
}
}
};
ko.utils.compareArrays = (function () {
var statusNotInOld = 'added', statusNotInNew = 'deleted';
// Simple calculation based on Levenshtein distance.
function compareArrays(oldArray, newArray, options) {
// For backward compatibility, if the third arg is actually a bool, interpret
// it as the old parameter 'dontLimitMoves'. Newer code should use { dontLimitMoves: true }.
options = (typeof options === 'boolean') ? { 'dontLimitMoves': options } : (options || {});
oldArray = oldArray || [];
newArray = newArray || [];
if (oldArray.length <= newArray.length)
return compareSmallArrayToBigArray(oldArray, newArray, statusNotInOld, statusNotInNew, options);
else
return compareSmallArrayToBigArray(newArray, oldArray, statusNotInNew, statusNotInOld, options);
}
function compareSmallArrayToBigArray(smlArray, bigArray, statusNotInSml, statusNotInBig, options) {
var myMin = Math.min,
myMax = Math.max,
editDistanceMatrix = [],
smlIndex, smlIndexMax = smlArray.length,
bigIndex, bigIndexMax = bigArray.length,
compareRange = (bigIndexMax - smlIndexMax) || 1,
maxDistance = smlIndexMax + bigIndexMax + 1,
thisRow, lastRow,
bigIndexMaxForRow, bigIndexMinForRow;
for (smlIndex = 0; smlIndex <= smlIndexMax; smlIndex++) {
lastRow = thisRow;
editDistanceMatrix.push(thisRow = []);
bigIndexMaxForRow = myMin(bigIndexMax, smlIndex + compareRange);
bigIndexMinForRow = myMax(0, smlIndex - 1);
for (bigIndex = bigIndexMinForRow; bigIndex <= bigIndexMaxForRow; bigIndex++) {
if (!bigIndex)
thisRow[bigIndex] = smlIndex + 1;
else if (!smlIndex) // Top row - transform empty array into new array via additions
thisRow[bigIndex] = bigIndex + 1;
else if (smlArray[smlIndex - 1] === bigArray[bigIndex - 1])
thisRow[bigIndex] = lastRow[bigIndex - 1]; // copy value (no edit)
else {
var northDistance = lastRow[bigIndex] || maxDistance; // not in big (deletion)
var westDistance = thisRow[bigIndex - 1] || maxDistance; // not in small (addition)
thisRow[bigIndex] = myMin(northDistance, westDistance) + 1;
}
}
}
var editScript = [], meMinusOne, notInSml = [], notInBig = [];
for (smlIndex = smlIndexMax, bigIndex = bigIndexMax; smlIndex || bigIndex;) {
meMinusOne = editDistanceMatrix[smlIndex][bigIndex] - 1;
if (bigIndex && meMinusOne === editDistanceMatrix[smlIndex][bigIndex-1]) {
notInSml.push(editScript[editScript.length] = { // added
'status': statusNotInSml,
'value': bigArray[--bigIndex],
'index': bigIndex });
} else if (smlIndex && meMinusOne === editDistanceMatrix[smlIndex - 1][bigIndex]) {
notInBig.push(editScript[editScript.length] = { // deleted
'status': statusNotInBig,
'value': smlArray[--smlIndex],
'index': smlIndex });
} else {
--bigIndex;
--smlIndex;
if (!options['sparse']) {
editScript.push({
'status': "retained",
'value': bigArray[bigIndex] });
}
}
}
// Set a limit on the number of consecutive non-matching comparisons; having it a multiple of
// smlIndexMax keeps the time complexity of this algorithm linear.
ko.utils.findMovesInArrayComparison(notInSml, notInBig, smlIndexMax * 10);
return editScript.reverse();
}
return compareArrays;
})();
ko.exportSymbol('utils.compareArrays', ko.utils.compareArrays);
(function () {
// Objective:
// * Given an input array, a container DOM node, and a function from array elements to arrays of DOM nodes,
// map the array elements to arrays of DOM nodes, concatenate together all these arrays, and use them to populate the container DOM node
// * Next time we're given the same combination of things (with the array possibly having mutated), update the container DOM node
// so that its children is again the concatenation of the mappings of the array elements, but don't re-map any array elements that we
// previously mapped - retain those nodes, and just insert/delete other ones
// "callbackAfterAddingNodes" will be invoked after any "mapping"-generated nodes are inserted into the container node
// You can use this, for example, to activate bindings on those nodes.
function mapNodeAndRefreshWhenChanged(containerNode, mapping, valueToMap, callbackAfterAddingNodes, index) {
// Map this array value inside a dependentObservable so we re-map when any dependency changes
var mappedNodes = [];
var dependentObservable = ko.dependentObservable(function() {
var newMappedNodes = mapping(valueToMap, index, ko.utils.fixUpContinuousNodeArray(mappedNodes, containerNode)) || [];
// On subsequent evaluations, just replace the previously-inserted DOM nodes
if (mappedNodes.length > 0) {
ko.utils.replaceDomNodes(mappedNodes, newMappedNodes);
if (callbackAfterAddingNodes)
ko.dependencyDetection.ignore(callbackAfterAddingNodes, null, [valueToMap, newMappedNodes, index]);
}
// Replace the contents of the mappedNodes array, thereby updating the record
// of which nodes would be deleted if valueToMap was itself later removed
mappedNodes.length = 0;
ko.utils.arrayPushAll(mappedNodes, newMappedNodes);
}, null, { disposeWhenNodeIsRemoved: containerNode, disposeWhen: function() { return !ko.utils.anyDomNodeIsAttachedToDocument(mappedNodes); } });
return { mappedNodes : mappedNodes, dependentObservable : (dependentObservable.isActive() ? dependentObservable : undefined) };
}
var lastMappingResultDomDataKey = ko.utils.domData.nextKey();
ko.utils.setDomNodeChildrenFromArrayMapping = function (domNode, array, mapping, options, callbackAfterAddingNodes) {
// Compare the provided array against the previous one
array = array || [];
options = options || {};
var isFirstExecution = ko.utils.domData.get(domNode, lastMappingResultDomDataKey) === undefined;
var lastMappingResult = ko.utils.domData.get(domNode, lastMappingResultDomDataKey) || [];
var lastArray = ko.utils.arrayMap(lastMappingResult, function (x) { return x.arrayEntry; });
var editScript = ko.utils.compareArrays(lastArray, array, options['dontLimitMoves']);
// Build the new mapping result
var newMappingResult = [];
var lastMappingResultIndex = 0;
var newMappingResultIndex = 0;
var nodesToDelete = [];
var itemsToProcess = [];
var itemsForBeforeRemoveCallbacks = [];
var itemsForMoveCallbacks = [];
var itemsForAfterAddCallbacks = [];
var mapData;
function itemMovedOrRetained(editScriptIndex, oldPosition) {
mapData = lastMappingResult[oldPosition];
if (newMappingResultIndex !== oldPosition)
itemsForMoveCallbacks[editScriptIndex] = mapData;
// Since updating the index might change the nodes, do so before calling fixUpContinuousNodeArray
mapData.indexObservable(newMappingResultIndex++);
ko.utils.fixUpContinuousNodeArray(mapData.mappedNodes, domNode);
newMappingResult.push(mapData);
itemsToProcess.push(mapData);
}
function callCallback(callback, items) {
if (callback) {
for (var i = 0, n = items.length; i < n; i++) {
if (items[i]) {
ko.utils.arrayForEach(items[i].mappedNodes, function(node) {
callback(node, i, items[i].arrayEntry);
});
}
}
}
}
for (var i = 0, editScriptItem, movedIndex; editScriptItem = editScript[i]; i++) {
movedIndex = editScriptItem['moved'];
switch (editScriptItem['status']) {
case "deleted":
if (movedIndex === undefined) {
mapData = lastMappingResult[lastMappingResultIndex];
// Stop tracking changes to the mapping for these nodes
if (mapData.dependentObservable)
mapData.dependentObservable.dispose();
// Queue these nodes for later removal
nodesToDelete.push.apply(nodesToDelete, ko.utils.fixUpContinuousNodeArray(mapData.mappedNodes, domNode));
if (options['beforeRemove']) {
itemsForBeforeRemoveCallbacks[i] = mapData;
itemsToProcess.push(mapData);
}
}
lastMappingResultIndex++;
break;
case "retained":
itemMovedOrRetained(i, lastMappingResultIndex++);
break;
case "added":
if (movedIndex !== undefined) {
itemMovedOrRetained(i, movedIndex);
} else {
mapData = { arrayEntry: editScriptItem['value'], indexObservable: ko.observable(newMappingResultIndex++) };
newMappingResult.push(mapData);
itemsToProcess.push(mapData);
if (!isFirstExecution)
itemsForAfterAddCallbacks[i] = mapData;
}
break;
}
}
// Call beforeMove first before any changes have been made to the DOM
callCallback(options['beforeMove'], itemsForMoveCallbacks);
// Next remove nodes for deleted items (or just clean if there's a beforeRemove callback)
ko.utils.arrayForEach(nodesToDelete, options['beforeRemove'] ? ko.cleanNode : ko.removeNode);
// Next add/reorder the remaining items (will include deleted items if there's a beforeRemove callback)
for (var i = 0, nextNode = ko.virtualElements.firstChild(domNode), lastNode, node; mapData = itemsToProcess[i]; i++) {
// Get nodes for newly added items
if (!mapData.mappedNodes)
ko.utils.extend(mapData, mapNodeAndRefreshWhenChanged(domNode, mapping, mapData.arrayEntry, callbackAfterAddingNodes, mapData.indexObservable));
// Put nodes in the right place if they aren't there already
for (var j = 0; node = mapData.mappedNodes[j]; nextNode = node.nextSibling, lastNode = node, j++) {
if (node !== nextNode)
ko.virtualElements.insertAfter(domNode, node, lastNode);
}
// Run the callbacks for newly added nodes (for example, to apply bindings, etc.)
if (!mapData.initialized && callbackAfterAddingNodes) {
callbackAfterAddingNodes(mapData.arrayEntry, mapData.mappedNodes, mapData.indexObservable);
mapData.initialized = true;
}
}
// If there's a beforeRemove callback, call it after reordering.
// Note that we assume that the beforeRemove callback will usually be used to remove the nodes using
// some sort of animation, which is why we first reorder the nodes that will be removed. If the
// callback instead removes the nodes right away, it would be more efficient to skip reordering them.
// Perhaps we'll make that change in the future if this scenario becomes more common.
callCallback(options['beforeRemove'], itemsForBeforeRemoveCallbacks);
// Finally call afterMove and afterAdd callbacks
callCallback(options['afterMove'], itemsForMoveCallbacks);
callCallback(options['afterAdd'], itemsForAfterAddCallbacks);
// Store a copy of the array items we just considered so we can difference it next time
ko.utils.domData.set(domNode, lastMappingResultDomDataKey, newMappingResult);
}
})();
ko.exportSymbol('utils.setDomNodeChildrenFromArrayMapping', ko.utils.setDomNodeChildrenFromArrayMapping);
ko.nativeTemplateEngine = function () {
this['allowTemplateRewriting'] = false;
}
ko.nativeTemplateEngine.prototype = new ko.templateEngine();
ko.nativeTemplateEngine.prototype.constructor = ko.nativeTemplateEngine;
ko.nativeTemplateEngine.prototype['renderTemplateSource'] = function (templateSource, bindingContext, options, templateDocument) {
var useNodesIfAvailable = !(ko.utils.ieVersion < 9), // IE<9 cloneNode doesn't work properly
templateNodesFunc = useNodesIfAvailable ? templateSource['nodes'] : null,
templateNodes = templateNodesFunc ? templateSource['nodes']() : null;
if (templateNodes) {
return ko.utils.makeArray(templateNodes.cloneNode(true).childNodes);
} else {
var templateText = templateSource['text']();
return ko.utils.parseHtmlFragment(templateText, templateDocument);
}
};
ko.nativeTemplateEngine.instance = new ko.nativeTemplateEngine();
ko.setTemplateEngine(ko.nativeTemplateEngine.instance);
ko.exportSymbol('nativeTemplateEngine', ko.nativeTemplateEngine);
(function() {
ko.jqueryTmplTemplateEngine = function () {
// Detect which version of jquery-tmpl you're using. Unfortunately jquery-tmpl
// doesn't expose a version number, so we have to infer it.
// Note that as of Knockout 1.3, we only support jQuery.tmpl 1.0.0pre and later,
// which KO internally refers to as version "2", so older versions are no longer detected.
var jQueryTmplVersion = this.jQueryTmplVersion = (function() {
if (!jQueryInstance || !(jQueryInstance['tmpl']))
return 0;
// Since it exposes no official version number, we use our own numbering system. To be updated as jquery-tmpl evolves.
try {
if (jQueryInstance['tmpl']['tag']['tmpl']['open'].toString().indexOf('__') >= 0) {
// Since 1.0.0pre, custom tags should append markup to an array called "__"
return 2; // Final version of jquery.tmpl
}
} catch(ex) { /* Apparently not the version we were looking for */ }
return 1; // Any older version that we don't support
})();
function ensureHasReferencedJQueryTemplates() {
if (jQueryTmplVersion < 2)
throw new Error("Your version of jQuery.tmpl is too old. Please upgrade to jQuery.tmpl 1.0.0pre or later.");
}
function executeTemplate(compiledTemplate, data, jQueryTemplateOptions) {
return jQueryInstance['tmpl'](compiledTemplate, data, jQueryTemplateOptions);
}
this['renderTemplateSource'] = function(templateSource, bindingContext, options, templateDocument) {
templateDocument = templateDocument || document;
options = options || {};
ensureHasReferencedJQueryTemplates();
// Ensure we have stored a precompiled version of this template (don't want to reparse on every render)
var precompiled = templateSource['data']('precompiled');
if (!precompiled) {
var templateText = templateSource['text']() || "";
// Wrap in "with($whatever.koBindingContext) { ... }"
templateText = "{{ko_with $item.koBindingContext}}" + templateText + "{{/ko_with}}";
precompiled = jQueryInstance['template'](null, templateText);
templateSource['data']('precompiled', precompiled);
}
var data = [bindingContext['$data']]; // Prewrap the data in an array to stop jquery.tmpl from trying to unwrap any arrays
var jQueryTemplateOptions = jQueryInstance['extend']({ 'koBindingContext': bindingContext }, options['templateOptions']);
var resultNodes = executeTemplate(precompiled, data, jQueryTemplateOptions);
resultNodes['appendTo'](templateDocument.createElement("div")); // Using "appendTo" forces jQuery/jQuery.tmpl to perform necessary cleanup work
jQueryInstance['fragments'] = {}; // Clear jQuery's fragment cache to avoid a memory leak after a large number of template renders
return resultNodes;
};
this['createJavaScriptEvaluatorBlock'] = function(script) {
return "{{ko_code ((function() { return " + script + " })()) }}";
};
this['addTemplate'] = function(templateName, templateMarkup) {
document.write("<script type='text/html' id='" + templateName + "'>" + templateMarkup + "<" + "/script>");
};
if (jQueryTmplVersion > 0) {
jQueryInstance['tmpl']['tag']['ko_code'] = {
open: "__.push($1 || '');"
};
jQueryInstance['tmpl']['tag']['ko_with'] = {
open: "with($1) {",
close: "} "
};
}
};
ko.jqueryTmplTemplateEngine.prototype = new ko.templateEngine();
ko.jqueryTmplTemplateEngine.prototype.constructor = ko.jqueryTmplTemplateEngine;
// Use this one by default *only if jquery.tmpl is referenced*
var jqueryTmplTemplateEngineInstance = new ko.jqueryTmplTemplateEngine();
if (jqueryTmplTemplateEngineInstance.jQueryTmplVersion > 0)
ko.setTemplateEngine(jqueryTmplTemplateEngineInstance);
ko.exportSymbol('jqueryTmplTemplateEngine', ko.jqueryTmplTemplateEngine);
})();
}));
}());
})();
|
core/com.b2international.snowowl.core.rest/snow-owl-api-docs/src/App.js | b2ihealthcare/snow-owl | import 'antd/dist/antd.css';
import 'rapidoc';
import React from 'react';
import { BackTop } from 'antd';
import { parse } from 'qs';
class App extends React.Component {
state = {
selectedKey: 'core',
apis: [],
serverUrl: process.env.REACT_APP_SO_BASE_URL || process.env.PUBLIC_URL
}
componentDidMount() {
fetch(`${this.state.serverUrl}/apis`)
.then(response => response.json())
.then(data => {
const queryParams = parse(window.location.search, { ignoreQueryPrefix: true, parameterLimit: 1 })
this.setState({
apis: data.items,
selectedKey: queryParams?.api || 'core'
})
})
}
onMenuSelect = (e) => {
this.setState({
selectedKey: e.target.value
})
}
render() {
const { apis, serverUrl, selectedKey } = this.state
return (
<>
<BackTop />
<rapi-doc
key = "api-docs"
theme = "light"
spec-url = {`${serverUrl}/api-docs/${this.state.selectedKey}`}
server-url = {`${serverUrl}`}
route-prefix = {`?api=${this.state.selectedKey}#`}
render-style = "focused"
use-path-in-nav-bar = "true"
default-schema-tab = "example"
layout = "row"
schema-expand-level = "3"
style = {{ height: "100vh", width: "100%" }}
show-header="false"
allow-spec-url-load="false"
allow-spec-file-load="false"
allow-server-selection="false"
>
<div slot="nav-logo">
<div style={{ display: "flex", alignItems: "center", justifyContent: "center", fontSize: "24px" }}>
<img src = {`${process.env.PUBLIC_URL}/assets/favicon.svg`} style={{ width: "40px", marginRight: "8px" }} alt="logo" />
<span style={{ color: "#fff" }}> Snow Owl API Docs </span>
</div>
<div style={{
display: "flex",
flexDirection: "row",
alignItems: "center",
justifyContent: "center",
paddingLeft: "8px"
}}>
<select style={{
width: "100%",
marginTop: "16px",
color: "var(--nav-hover-text-color)",
borderColor: "var(--nav-accent-color)",
backgroundColor: "var(--nav-hover-bg-color)"
}} name="apis" onChange={(e) => this.onMenuSelect(e)} value={selectedKey}>
{apis.map(api =>
<option key={api.id} value={`${api.id}`}>{api.title}</option>
)}
</select>
</div>
</div>
</rapi-doc>
</>
)
}
}
export default App;
|
features/apimgt/org.wso2.carbon.apimgt.admin.feature/src/main/resources/admin/source/src/app/components/Base/Header/Header.js | thusithak/carbon-apimgt | /*
* Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import React from 'react'
import {Link, withRouter} from "react-router-dom";
import AuthManager from '../../../data/AuthManager.js';
import qs from 'qs'
const Header = (props) => {
let params = qs.stringify({referrer: props.location.pathname});
return (
<header className="header header-default">
<div className="container-fluid">
<div id="nav-icon1" className="menu-trigger navbar-left " data-toggle="sidebar"
data-target="#left-sidebar" data-container=".page-content-wrapper" data-container-divide="true"
aria-expanded="false" rel="sub-nav">
</div>
<div className="pull-left brand">
<Link to="/">
<span>APIM Admin Portal</span>
</Link>
</div>
<ul className="nav navbar-right">
<li className="visible-inline-block">
<a className="dropdown" data-toggle="dropdown" aria-expanded="false">
<span className="icon fw-stack">
<i className="fw fw-circle fw-stack-2x"/>
<i className="fw fw-user fw-stack-1x fw-inverse"/>
</span>
<span className="hidden-xs add-margin-left-1x" id="logged-in-username">
{ AuthManager.getUser() ? AuthManager.getUser().name : ""}
<span className="caret"/></span>
</a>
<ul className="dropdown-menu dropdown-menu-right slideInDown" role="menu">
<li><a href="#">Profile Settings</a></li>
<li>
<Link to={{pathname: '/logout', search: params}}>Logout</Link>
</li>
</ul>
</li>
</ul>
</div>
</header >
);
};
// Using `withRouter` helper from React-Router-Dom to get the current user location to be used with logout action,
// We pass the current path in referrer parameter to redirect back the user to where he/she was after login.
// DOC: https://github.com/ReactTraining/react-router/blob/master/packages/react-router/docs/api/withRouter.md
export default withRouter(Header) |
ActivityCounter/src/index.js | vmalvaro/react-projects | import React from 'react'
import { render } from 'react-dom'
import { App } from './components/App'
import { Whoops404 } from './components/Whoops404'
import { HashRouter as Router, Route, Switch, Link } from 'react-router-dom'
import { AddDayForm } from './components/AddDayFormStateless'
window.React = React;
// render(
// <BeachDayCount />,
// document.getElementById('react-container')
// );
render(
<Router>
<div>
<ul>
<li><Link to="/">Home</Link></li>
<li><Link to="/list-days">List Days</Link></li>
<li><Link to="/add-day">Add Day</Link></li>
<li><Link to="/also/will/not/match">Also Will Not Match</Link></li>
</ul>
<Switch>
<Route path="/" exact component={App}/>
<Route path="/add-day" component={App}/>
<Route path="/list-days" component={App}/>
<Route component={Whoops404}/>
</Switch>
</div>
</Router>,
document.getElementById('react-container')
);
// render(
// <Router>
// <Switch>
// <Route exact path="/" component={App} />
// <Route path="/list-days" component={App} />
// <Route path="/add-day" component={App} />
// <Route component={Whoops404} />
// </Switch>
// </Router>,
// document.getElementById('react-container')
// );
// render(
// <App />,
// document.getElementById('react-container')
// ); |
server/public/js/libs/jquery.mobile.js | tcase360/email-client | /*!
* jQuery Mobile 1.4.0
* Git HEAD hash: f09aae0e035d6805e461a7be246d04a0dbc98f69 <> Date: Thu Dec 19 2013 17:34:22 UTC
* http://jquerymobile.com
*
* Copyright 2010, 2013 jQuery Foundation, Inc. and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
*/
(function ( root, doc, factory ) {
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define( [ "jquery" ], function ( $ ) {
factory( $, root, doc );
return $.mobile;
});
} else {
// Browser globals
factory( root.jQuery, root, doc );
}
}( this, document, function ( jQuery, window, document, undefined ) {
(function( $ ) {
$.mobile = {};
}( jQuery ));
(function( $, window, undefined ) {
$.extend( $.mobile, {
// Version of the jQuery Mobile Framework
version: "1.4.0",
// Deprecated and no longer used in 1.4 remove in 1.5
// Define the url parameter used for referencing widget-generated sub-pages.
// Translates to example.html&ui-page=subpageIdentifier
// hash segment before &ui-page= is used to make Ajax request
subPageUrlKey: "ui-page",
hideUrlBar: true,
// Keepnative Selector
keepNative: ":jqmData(role='none'), :jqmData(role='nojs')",
// Deprecated in 1.4 remove in 1.5
// Class assigned to page currently in view, and during transitions
activePageClass: "ui-page-active",
// Deprecated in 1.4 remove in 1.5
// Class used for "active" button state, from CSS framework
activeBtnClass: "ui-btn-active",
// Deprecated in 1.4 remove in 1.5
// Class used for "focus" form element state, from CSS framework
focusClass: "ui-focus",
// Automatically handle clicks and form submissions through Ajax, when same-domain
ajaxEnabled: true,
// Automatically load and show pages based on location.hash
hashListeningEnabled: true,
// disable to prevent jquery from bothering with links
linkBindingEnabled: true,
// Set default page transition - 'none' for no transitions
defaultPageTransition: "fade",
// Set maximum window width for transitions to apply - 'false' for no limit
maxTransitionWidth: false,
// Minimum scroll distance that will be remembered when returning to a page
// Deprecated remove in 1.5
minScrollBack: 0,
// Set default dialog transition - 'none' for no transitions
defaultDialogTransition: "pop",
// Error response message - appears when an Ajax page request fails
pageLoadErrorMessage: "Error Loading Page",
// For error messages, which theme does the box uses?
pageLoadErrorMessageTheme: "a",
// replace calls to window.history.back with phonegaps navigation helper
// where it is provided on the window object
phonegapNavigationEnabled: false,
//automatically initialize the DOM when it's ready
autoInitializePage: true,
pushStateEnabled: true,
// allows users to opt in to ignoring content by marking a parent element as
// data-ignored
ignoreContentEnabled: false,
buttonMarkup: {
hoverDelay: 200
},
// disable the alteration of the dynamic base tag or links in the case
// that a dynamic base tag isn't supported
dynamicBaseEnabled: true,
// default the property to remove dependency on assignment in init module
pageContainer: $(),
//enable cross-domain page support
allowCrossDomainPages: false,
dialogHashKey: "&ui-state=dialog"
});
})( jQuery, this );
(function( $, window, undefined ) {
var nsNormalizeDict = {},
oldFind = $.find,
rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/,
jqmDataRE = /:jqmData\(([^)]*)\)/g;
$.extend( $.mobile, {
// Namespace used framework-wide for data-attrs. Default is no namespace
ns: "",
// Retrieve an attribute from an element and perform some massaging of the value
getAttribute: function( element, key ) {
var data;
element = element.jquery ? element[0] : element;
if ( element && element.getAttribute ) {
data = element.getAttribute( "data-" + $.mobile.ns + key );
}
// Copied from core's src/data.js:dataAttr()
// Convert from a string to a proper data type
try {
data = data === "true" ? true :
data === "false" ? false :
data === "null" ? null :
// Only convert to a number if it doesn't change the string
+data + "" === data ? +data :
rbrace.test( data ) ? JSON.parse( data ) :
data;
} catch( err ) {}
return data;
},
// Expose our cache for testing purposes.
nsNormalizeDict: nsNormalizeDict,
// Take a data attribute property, prepend the namespace
// and then camel case the attribute string. Add the result
// to our nsNormalizeDict so we don't have to do this again.
nsNormalize: function( prop ) {
return nsNormalizeDict[ prop ] ||
( nsNormalizeDict[ prop ] = $.camelCase( $.mobile.ns + prop ) );
},
// Find the closest javascript page element to gather settings data jsperf test
// http://jsperf.com/single-complex-selector-vs-many-complex-selectors/edit
// possibly naive, but it shows that the parsing overhead for *just* the page selector vs
// the page and dialog selector is negligable. This could probably be speed up by
// doing a similar parent node traversal to the one found in the inherited theme code above
closestPageData: function( $target ) {
return $target
.closest( ":jqmData(role='page'), :jqmData(role='dialog')" )
.data( "mobile-page" );
}
});
// Mobile version of data and removeData and hasData methods
// ensures all data is set and retrieved using jQuery Mobile's data namespace
$.fn.jqmData = function( prop, value ) {
var result;
if ( typeof prop !== "undefined" ) {
if ( prop ) {
prop = $.mobile.nsNormalize( prop );
}
// undefined is permitted as an explicit input for the second param
// in this case it returns the value and does not set it to undefined
if ( arguments.length < 2 || value === undefined ) {
result = this.data( prop );
} else {
result = this.data( prop, value );
}
}
return result;
};
$.jqmData = function( elem, prop, value ) {
var result;
if ( typeof prop !== "undefined" ) {
result = $.data( elem, prop ? $.mobile.nsNormalize( prop ) : prop, value );
}
return result;
};
$.fn.jqmRemoveData = function( prop ) {
return this.removeData( $.mobile.nsNormalize( prop ) );
};
$.jqmRemoveData = function( elem, prop ) {
return $.removeData( elem, $.mobile.nsNormalize( prop ) );
};
$.find = function( selector, context, ret, extra ) {
if ( selector.indexOf( ":jqmData" ) > -1 ) {
selector = selector.replace( jqmDataRE, "[data-" + ( $.mobile.ns || "" ) + "$1]" );
}
return oldFind.call( this, selector, context, ret, extra );
};
$.extend( $.find, oldFind );
})( jQuery, this );
/*!
* jQuery UI Core c0ab71056b936627e8a7821f03c044aec6280a40
* http://jqueryui.com
*
* Copyright 2013 jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/category/ui-core/
*/
(function( $, undefined ) {
var uuid = 0,
runiqueId = /^ui-id-\d+$/;
// $.ui might exist from components with no dependencies, e.g., $.ui.position
$.ui = $.ui || {};
$.extend( $.ui, {
version: "c0ab71056b936627e8a7821f03c044aec6280a40",
keyCode: {
BACKSPACE: 8,
COMMA: 188,
DELETE: 46,
DOWN: 40,
END: 35,
ENTER: 13,
ESCAPE: 27,
HOME: 36,
LEFT: 37,
PAGE_DOWN: 34,
PAGE_UP: 33,
PERIOD: 190,
RIGHT: 39,
SPACE: 32,
TAB: 9,
UP: 38
}
});
// plugins
$.fn.extend({
focus: (function( orig ) {
return function( delay, fn ) {
return typeof delay === "number" ?
this.each(function() {
var elem = this;
setTimeout(function() {
$( elem ).focus();
if ( fn ) {
fn.call( elem );
}
}, delay );
}) :
orig.apply( this, arguments );
};
})( $.fn.focus ),
scrollParent: function() {
var scrollParent;
if (($.ui.ie && (/(static|relative)/).test(this.css("position"))) || (/absolute/).test(this.css("position"))) {
scrollParent = this.parents().filter(function() {
return (/(relative|absolute|fixed)/).test($.css(this,"position")) && (/(auto|scroll)/).test($.css(this,"overflow")+$.css(this,"overflow-y")+$.css(this,"overflow-x"));
}).eq(0);
} else {
scrollParent = this.parents().filter(function() {
return (/(auto|scroll)/).test($.css(this,"overflow")+$.css(this,"overflow-y")+$.css(this,"overflow-x"));
}).eq(0);
}
return ( /fixed/ ).test( this.css( "position") ) || !scrollParent.length ? $( this[ 0 ].ownerDocument || document ) : scrollParent;
},
uniqueId: function() {
return this.each(function() {
if ( !this.id ) {
this.id = "ui-id-" + (++uuid);
}
});
},
removeUniqueId: function() {
return this.each(function() {
if ( runiqueId.test( this.id ) ) {
$( this ).removeAttr( "id" );
}
});
}
});
// selectors
function focusable( element, isTabIndexNotNaN ) {
var map, mapName, img,
nodeName = element.nodeName.toLowerCase();
if ( "area" === nodeName ) {
map = element.parentNode;
mapName = map.name;
if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) {
return false;
}
img = $( "img[usemap=#" + mapName + "]" )[0];
return !!img && visible( img );
}
return ( /input|select|textarea|button|object/.test( nodeName ) ?
!element.disabled :
"a" === nodeName ?
element.href || isTabIndexNotNaN :
isTabIndexNotNaN) &&
// the element and all of its ancestors must be visible
visible( element );
}
function visible( element ) {
return $.expr.filters.visible( element ) &&
!$( element ).parents().addBack().filter(function() {
return $.css( this, "visibility" ) === "hidden";
}).length;
}
$.extend( $.expr[ ":" ], {
data: $.expr.createPseudo ?
$.expr.createPseudo(function( dataName ) {
return function( elem ) {
return !!$.data( elem, dataName );
};
}) :
// support: jQuery <1.8
function( elem, i, match ) {
return !!$.data( elem, match[ 3 ] );
},
focusable: function( element ) {
return focusable( element, !isNaN( $.attr( element, "tabindex" ) ) );
},
tabbable: function( element ) {
var tabIndex = $.attr( element, "tabindex" ),
isTabIndexNaN = isNaN( tabIndex );
return ( isTabIndexNaN || tabIndex >= 0 ) && focusable( element, !isTabIndexNaN );
}
});
// support: jQuery <1.8
if ( !$( "<a>" ).outerWidth( 1 ).jquery ) {
$.each( [ "Width", "Height" ], function( i, name ) {
var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ],
type = name.toLowerCase(),
orig = {
innerWidth: $.fn.innerWidth,
innerHeight: $.fn.innerHeight,
outerWidth: $.fn.outerWidth,
outerHeight: $.fn.outerHeight
};
function reduce( elem, size, border, margin ) {
$.each( side, function() {
size -= parseFloat( $.css( elem, "padding" + this ) ) || 0;
if ( border ) {
size -= parseFloat( $.css( elem, "border" + this + "Width" ) ) || 0;
}
if ( margin ) {
size -= parseFloat( $.css( elem, "margin" + this ) ) || 0;
}
});
return size;
}
$.fn[ "inner" + name ] = function( size ) {
if ( size === undefined ) {
return orig[ "inner" + name ].call( this );
}
return this.each(function() {
$( this ).css( type, reduce( this, size ) + "px" );
});
};
$.fn[ "outer" + name] = function( size, margin ) {
if ( typeof size !== "number" ) {
return orig[ "outer" + name ].call( this, size );
}
return this.each(function() {
$( this).css( type, reduce( this, size, true, margin ) + "px" );
});
};
});
}
// support: jQuery <1.8
if ( !$.fn.addBack ) {
$.fn.addBack = function( selector ) {
return this.add( selector == null ?
this.prevObject : this.prevObject.filter( selector )
);
};
}
// support: jQuery 1.6.1, 1.6.2 (http://bugs.jquery.com/ticket/9413)
if ( $( "<a>" ).data( "a-b", "a" ).removeData( "a-b" ).data( "a-b" ) ) {
$.fn.removeData = (function( removeData ) {
return function( key ) {
if ( arguments.length ) {
return removeData.call( this, $.camelCase( key ) );
} else {
return removeData.call( this );
}
};
})( $.fn.removeData );
}
// deprecated
$.ui.ie = !!/msie [\w.]+/.exec( navigator.userAgent.toLowerCase() );
$.support.selectstart = "onselectstart" in document.createElement( "div" );
$.fn.extend({
disableSelection: function() {
return this.bind( ( $.support.selectstart ? "selectstart" : "mousedown" ) +
".ui-disableSelection", function( event ) {
event.preventDefault();
});
},
enableSelection: function() {
return this.unbind( ".ui-disableSelection" );
},
zIndex: function( zIndex ) {
if ( zIndex !== undefined ) {
return this.css( "zIndex", zIndex );
}
if ( this.length ) {
var elem = $( this[ 0 ] ), position, value;
while ( elem.length && elem[ 0 ] !== document ) {
// Ignore z-index if position is set to a value where z-index is ignored by the browser
// This makes behavior of this function consistent across browsers
// WebKit always returns auto if the element is positioned
position = elem.css( "position" );
if ( position === "absolute" || position === "relative" || position === "fixed" ) {
// IE returns 0 when zIndex is not specified
// other browsers return a string
// we ignore the case of nested elements with an explicit value of 0
// <div style="z-index: -10;"><div style="z-index: 0;"></div></div>
value = parseInt( elem.css( "zIndex" ), 10 );
if ( !isNaN( value ) && value !== 0 ) {
return value;
}
}
elem = elem.parent();
}
}
return 0;
}
});
// $.ui.plugin is deprecated. Use $.widget() extensions instead.
$.ui.plugin = {
add: function( module, option, set ) {
var i,
proto = $.ui[ module ].prototype;
for ( i in set ) {
proto.plugins[ i ] = proto.plugins[ i ] || [];
proto.plugins[ i ].push( [ option, set[ i ] ] );
}
},
call: function( instance, name, args, allowDisconnected ) {
var i,
set = instance.plugins[ name ];
if ( !set ) {
return;
}
if ( !allowDisconnected && ( !instance.element[ 0 ].parentNode || instance.element[ 0 ].parentNode.nodeType === 11 ) ) {
return;
}
for ( i = 0; i < set.length; i++ ) {
if ( instance.options[ set[ i ][ 0 ] ] ) {
set[ i ][ 1 ].apply( instance.element, args );
}
}
}
};
})( jQuery );
(function( $, window, undefined ) {
$.extend( $.mobile, {
// define the window and the document objects
window: $( window ),
document: $( document ),
// TODO: Remove and use $.ui.keyCode directly
keyCode: $.ui.keyCode,
// Place to store various widget extensions
behaviors: {},
// Scroll page vertically: scroll to 0 to hide iOS address bar, or pass a Y value
silentScroll: function( ypos ) {
if ( $.type( ypos ) !== "number" ) {
ypos = $.mobile.defaultHomeScroll;
}
// prevent scrollstart and scrollstop events
$.event.special.scrollstart.enabled = false;
setTimeout(function() {
window.scrollTo( 0, ypos );
$.mobile.document.trigger( "silentscroll", { x: 0, y: ypos });
}, 20 );
setTimeout(function() {
$.event.special.scrollstart.enabled = true;
}, 150 );
},
getClosestBaseUrl: function( ele ) {
// Find the closest page and extract out its url.
var url = $( ele ).closest( ".ui-page" ).jqmData( "url" ),
base = $.mobile.path.documentBase.hrefNoHash;
if ( !$.mobile.dynamicBaseEnabled || !url || !$.mobile.path.isPath( url ) ) {
url = base;
}
return $.mobile.path.makeUrlAbsolute( url, base );
},
removeActiveLinkClass: function( forceRemoval ) {
if ( !!$.mobile.activeClickedLink &&
( !$.mobile.activeClickedLink.closest( "." + $.mobile.activePageClass ).length ||
forceRemoval ) ) {
$.mobile.activeClickedLink.removeClass( $.mobile.activeBtnClass );
}
$.mobile.activeClickedLink = null;
},
// DEPRECATED in 1.4
// Find the closest parent with a theme class on it. Note that
// we are not using $.fn.closest() on purpose here because this
// method gets called quite a bit and we need it to be as fast
// as possible.
getInheritedTheme: function( el, defaultTheme ) {
var e = el[ 0 ],
ltr = "",
re = /ui-(bar|body|overlay)-([a-z])\b/,
c, m;
while ( e ) {
c = e.className || "";
if ( c && ( m = re.exec( c ) ) && ( ltr = m[ 2 ] ) ) {
// We found a parent with a theme class
// on it so bail from this loop.
break;
}
e = e.parentNode;
}
// Return the theme letter we found, if none, return the
// specified default.
return ltr || defaultTheme || "a";
},
enhanceable: function( elements ) {
return this.haveParents( elements, "enhance" );
},
hijackable: function( elements ) {
return this.haveParents( elements, "ajax" );
},
haveParents: function( elements, attr ) {
if ( !$.mobile.ignoreContentEnabled ) {
return elements;
}
var count = elements.length,
$newSet = $(),
e, $element, excluded,
i, c;
for ( i = 0; i < count; i++ ) {
$element = elements.eq( i );
excluded = false;
e = elements[ i ];
while ( e ) {
c = e.getAttribute ? e.getAttribute( "data-" + $.mobile.ns + attr ) : "";
if ( c === "false" ) {
excluded = true;
break;
}
e = e.parentNode;
}
if ( !excluded ) {
$newSet = $newSet.add( $element );
}
}
return $newSet;
},
getScreenHeight: function() {
// Native innerHeight returns more accurate value for this across platforms,
// jQuery version is here as a normalized fallback for platforms like Symbian
return window.innerHeight || $.mobile.window.height();
},
//simply set the active page's minimum height to screen height, depending on orientation
resetActivePageHeight: function( height ) {
var page = $( "." + $.mobile.activePageClass ),
pageHeight = page.height(),
pageOuterHeight = page.outerHeight( true );
height = ( typeof height === "number" ) ? height : $.mobile.getScreenHeight();
page.css( "min-height", height - ( pageOuterHeight - pageHeight ) );
},
loading: function() {
// If this is the first call to this function, instantiate a loader widget
var loader = this.loading._widget || $( $.mobile.loader.prototype.defaultHtml ).loader(),
// Call the appropriate method on the loader
returnValue = loader.loader.apply( loader, arguments );
// Make sure the loader is retained for future calls to this function.
this.loading._widget = loader;
return returnValue;
}
});
$.addDependents = function( elem, newDependents ) {
var $elem = $( elem ),
dependents = $elem.jqmData( "dependents" ) || $();
$elem.jqmData( "dependents", $( dependents ).add( newDependents ) );
};
// plugins
$.fn.extend({
removeWithDependents: function() {
$.removeWithDependents( this );
},
// Enhance child elements
enhanceWithin: function() {
var index,
widgetElements = {},
keepNative = $.mobile.page.prototype.keepNativeSelector(),
that = this;
// Add no js class to elements
if ( $.mobile.nojs ) {
$.mobile.nojs( this );
}
// Bind links for ajax nav
if ( $.mobile.links ) {
$.mobile.links( this );
}
// Degrade inputs for styleing
if ( $.mobile.degradeInputsWithin ) {
$.mobile.degradeInputsWithin( this );
}
// Run buttonmarkup
if ( $.fn.buttonMarkup ) {
this.find( $.fn.buttonMarkup.initSelector ).not( keepNative )
.jqmEnhanceable().buttonMarkup();
}
// Add classes for fieldContain
if ( $.fn.fieldcontain ) {
this.find( ":jqmData(role='fieldcontain')" ).not( keepNative )
.jqmEnhanceable().fieldcontain();
}
// Enhance widgets
$.each( $.mobile.widgets, function( name, constructor ) {
// If initSelector not false find elements
if ( constructor.initSelector ) {
// Filter elements that should not be enhanced based on parents
var elements = $.mobile.enhanceable( that.find( constructor.initSelector ) );
// If any matching elements remain filter ones with keepNativeSelector
if ( elements.length > 0 ) {
// $.mobile.page.prototype.keepNativeSelector is deprecated this is just for backcompat
// Switch to $.mobile.keepNative in 1.5 which is just a value not a function
elements = elements.not( keepNative );
}
// Enhance whatever is left
if ( elements.length > 0 ) {
widgetElements[ constructor.prototype.widgetName ] = elements;
}
}
});
for ( index in widgetElements ) {
widgetElements[ index ][ index ]();
}
return this;
},
addDependents: function( newDependents ) {
$.addDependents( this, newDependents );
},
// note that this helper doesn't attempt to handle the callback
// or setting of an html element's text, its only purpose is
// to return the html encoded version of the text in all cases. (thus the name)
getEncodedText: function() {
return $( "<a>" ).text( this.text() ).html();
},
// fluent helper function for the mobile namespaced equivalent
jqmEnhanceable: function() {
return $.mobile.enhanceable( this );
},
jqmHijackable: function() {
return $.mobile.hijackable( this );
}
});
$.removeWithDependents = function( nativeElement ) {
var element = $( nativeElement );
( element.jqmData( "dependents" ) || $() ).remove();
element.remove();
};
$.addDependents = function( nativeElement, newDependents ) {
var element = $( nativeElement ),
dependents = element.jqmData( "dependents" ) || $();
element.jqmData( "dependents", $( dependents ).add( newDependents ) );
};
$.find.matches = function( expr, set ) {
return $.find( expr, null, null, set );
};
$.find.matchesSelector = function( node, expr ) {
return $.find( expr, null, null, [ node ] ).length > 0;
};
})( jQuery, this );
/*!
* jQuery UI Widget c0ab71056b936627e8a7821f03c044aec6280a40N
* http://jqueryui.com
*
* Copyright 2013 jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/jQuery.widget/
*/
(function( $, undefined ) {
var uuid = 0,
slice = Array.prototype.slice,
_cleanData = $.cleanData;
$.cleanData = function( elems ) {
for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
try {
$( elem ).triggerHandler( "remove" );
// http://bugs.jquery.com/ticket/8235
} catch( e ) {}
}
_cleanData( elems );
};
$.widget = function( name, base, prototype ) {
var fullName, existingConstructor, constructor, basePrototype,
// proxiedPrototype allows the provided prototype to remain unmodified
// so that it can be used as a mixin for multiple widgets (#8876)
proxiedPrototype = {},
namespace = name.split( "." )[ 0 ];
name = name.split( "." )[ 1 ];
fullName = namespace + "-" + name;
if ( !prototype ) {
prototype = base;
base = $.Widget;
}
// create selector for plugin
$.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) {
return !!$.data( elem, fullName );
};
$[ namespace ] = $[ namespace ] || {};
existingConstructor = $[ namespace ][ name ];
constructor = $[ namespace ][ name ] = function( options, element ) {
// allow instantiation without "new" keyword
if ( !this._createWidget ) {
return new constructor( options, element );
}
// allow instantiation without initializing for simple inheritance
// must use "new" keyword (the code above always passes args)
if ( arguments.length ) {
this._createWidget( options, element );
}
};
// extend with the existing constructor to carry over any static properties
$.extend( constructor, existingConstructor, {
version: prototype.version,
// copy the object used to create the prototype in case we need to
// redefine the widget later
_proto: $.extend( {}, prototype ),
// track widgets that inherit from this widget in case this widget is
// redefined after a widget inherits from it
_childConstructors: []
});
basePrototype = new base();
// we need to make the options hash a property directly on the new instance
// otherwise we'll modify the options hash on the prototype that we're
// inheriting from
basePrototype.options = $.widget.extend( {}, basePrototype.options );
$.each( prototype, function( prop, value ) {
if ( !$.isFunction( value ) ) {
proxiedPrototype[ prop ] = value;
return;
}
proxiedPrototype[ prop ] = (function() {
var _super = function() {
return base.prototype[ prop ].apply( this, arguments );
},
_superApply = function( args ) {
return base.prototype[ prop ].apply( this, args );
};
return function() {
var __super = this._super,
__superApply = this._superApply,
returnValue;
this._super = _super;
this._superApply = _superApply;
returnValue = value.apply( this, arguments );
this._super = __super;
this._superApply = __superApply;
return returnValue;
};
})();
});
constructor.prototype = $.widget.extend( basePrototype, {
// TODO: remove support for widgetEventPrefix
// always use the name + a colon as the prefix, e.g., draggable:start
// don't prefix for widgets that aren't DOM-based
widgetEventPrefix: existingConstructor ? (basePrototype.widgetEventPrefix || name) : name
}, proxiedPrototype, {
constructor: constructor,
namespace: namespace,
widgetName: name,
widgetFullName: fullName
});
// If this widget is being redefined then we need to find all widgets that
// are inheriting from it and redefine all of them so that they inherit from
// the new version of this widget. We're essentially trying to replace one
// level in the prototype chain.
if ( existingConstructor ) {
$.each( existingConstructor._childConstructors, function( i, child ) {
var childPrototype = child.prototype;
// redefine the child widget using the same prototype that was
// originally used, but inherit from the new version of the base
$.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto );
});
// remove the list of existing child constructors from the old constructor
// so the old child constructors can be garbage collected
delete existingConstructor._childConstructors;
} else {
base._childConstructors.push( constructor );
}
$.widget.bridge( name, constructor );
return constructor;
};
$.widget.extend = function( target ) {
var input = slice.call( arguments, 1 ),
inputIndex = 0,
inputLength = input.length,
key,
value;
for ( ; inputIndex < inputLength; inputIndex++ ) {
for ( key in input[ inputIndex ] ) {
value = input[ inputIndex ][ key ];
if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) {
// Clone objects
if ( $.isPlainObject( value ) ) {
target[ key ] = $.isPlainObject( target[ key ] ) ?
$.widget.extend( {}, target[ key ], value ) :
// Don't extend strings, arrays, etc. with objects
$.widget.extend( {}, value );
// Copy everything else by reference
} else {
target[ key ] = value;
}
}
}
}
return target;
};
$.widget.bridge = function( name, object ) {
var fullName = object.prototype.widgetFullName || name;
$.fn[ name ] = function( options ) {
var isMethodCall = typeof options === "string",
args = slice.call( arguments, 1 ),
returnValue = this;
// allow multiple hashes to be passed on init
options = !isMethodCall && args.length ?
$.widget.extend.apply( null, [ options ].concat(args) ) :
options;
if ( isMethodCall ) {
this.each(function() {
var methodValue,
instance = $.data( this, fullName );
if ( options === "instance" ) {
returnValue = instance;
return false;
}
if ( !instance ) {
return $.error( "cannot call methods on " + name + " prior to initialization; " +
"attempted to call method '" + options + "'" );
}
if ( !$.isFunction( instance[options] ) || options.charAt( 0 ) === "_" ) {
return $.error( "no such method '" + options + "' for " + name + " widget instance" );
}
methodValue = instance[ options ].apply( instance, args );
if ( methodValue !== instance && methodValue !== undefined ) {
returnValue = methodValue && methodValue.jquery ?
returnValue.pushStack( methodValue.get() ) :
methodValue;
return false;
}
});
} else {
this.each(function() {
var instance = $.data( this, fullName );
if ( instance ) {
instance.option( options || {} )._init();
} else {
$.data( this, fullName, new object( options, this ) );
}
});
}
return returnValue;
};
};
$.Widget = function( /* options, element */ ) {};
$.Widget._childConstructors = [];
$.Widget.prototype = {
widgetName: "widget",
widgetEventPrefix: "",
defaultElement: "<div>",
options: {
disabled: false,
// callbacks
create: null
},
_createWidget: function( options, element ) {
element = $( element || this.defaultElement || this )[ 0 ];
this.element = $( element );
this.uuid = uuid++;
this.eventNamespace = "." + this.widgetName + this.uuid;
this.options = $.widget.extend( {},
this.options,
this._getCreateOptions(),
options );
this.bindings = $();
this.hoverable = $();
this.focusable = $();
if ( element !== this ) {
$.data( element, this.widgetFullName, this );
this._on( true, this.element, {
remove: function( event ) {
if ( event.target === element ) {
this.destroy();
}
}
});
this.document = $( element.style ?
// element within the document
element.ownerDocument :
// element is window or document
element.document || element );
this.window = $( this.document[0].defaultView || this.document[0].parentWindow );
}
this._create();
this._trigger( "create", null, this._getCreateEventData() );
this._init();
},
_getCreateOptions: $.noop,
_getCreateEventData: $.noop,
_create: $.noop,
_init: $.noop,
destroy: function() {
this._destroy();
// we can probably remove the unbind calls in 2.0
// all event bindings should go through this._on()
this.element
.unbind( this.eventNamespace )
.removeData( this.widgetFullName )
// support: jquery <1.6.3
// http://bugs.jquery.com/ticket/9413
.removeData( $.camelCase( this.widgetFullName ) );
this.widget()
.unbind( this.eventNamespace )
.removeAttr( "aria-disabled" )
.removeClass(
this.widgetFullName + "-disabled " +
"ui-state-disabled" );
// clean up events and states
this.bindings.unbind( this.eventNamespace );
this.hoverable.removeClass( "ui-state-hover" );
this.focusable.removeClass( "ui-state-focus" );
},
_destroy: $.noop,
widget: function() {
return this.element;
},
option: function( key, value ) {
var options = key,
parts,
curOption,
i;
if ( arguments.length === 0 ) {
// don't return a reference to the internal hash
return $.widget.extend( {}, this.options );
}
if ( typeof key === "string" ) {
// handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
options = {};
parts = key.split( "." );
key = parts.shift();
if ( parts.length ) {
curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] );
for ( i = 0; i < parts.length - 1; i++ ) {
curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {};
curOption = curOption[ parts[ i ] ];
}
key = parts.pop();
if ( value === undefined ) {
return curOption[ key ] === undefined ? null : curOption[ key ];
}
curOption[ key ] = value;
} else {
if ( value === undefined ) {
return this.options[ key ] === undefined ? null : this.options[ key ];
}
options[ key ] = value;
}
}
this._setOptions( options );
return this;
},
_setOptions: function( options ) {
var key;
for ( key in options ) {
this._setOption( key, options[ key ] );
}
return this;
},
_setOption: function( key, value ) {
this.options[ key ] = value;
if ( key === "disabled" ) {
this.widget()
.toggleClass( this.widgetFullName + "-disabled", !!value );
this.hoverable.removeClass( "ui-state-hover" );
this.focusable.removeClass( "ui-state-focus" );
}
return this;
},
enable: function() {
return this._setOptions({ disabled: false });
},
disable: function() {
return this._setOptions({ disabled: true });
},
_on: function( suppressDisabledCheck, element, handlers ) {
var delegateElement,
instance = this;
// no suppressDisabledCheck flag, shuffle arguments
if ( typeof suppressDisabledCheck !== "boolean" ) {
handlers = element;
element = suppressDisabledCheck;
suppressDisabledCheck = false;
}
// no element argument, shuffle and use this.element
if ( !handlers ) {
handlers = element;
element = this.element;
delegateElement = this.widget();
} else {
// accept selectors, DOM elements
element = delegateElement = $( element );
this.bindings = this.bindings.add( element );
}
$.each( handlers, function( event, handler ) {
function handlerProxy() {
// allow widgets to customize the disabled handling
// - disabled as an array instead of boolean
// - disabled class as method for disabling individual parts
if ( !suppressDisabledCheck &&
( instance.options.disabled === true ||
$( this ).hasClass( "ui-state-disabled" ) ) ) {
return;
}
return ( typeof handler === "string" ? instance[ handler ] : handler )
.apply( instance, arguments );
}
// copy the guid so direct unbinding works
if ( typeof handler !== "string" ) {
handlerProxy.guid = handler.guid =
handler.guid || handlerProxy.guid || $.guid++;
}
var match = event.match( /^(\w+)\s*(.*)$/ ),
eventName = match[1] + instance.eventNamespace,
selector = match[2];
if ( selector ) {
delegateElement.delegate( selector, eventName, handlerProxy );
} else {
element.bind( eventName, handlerProxy );
}
});
},
_off: function( element, eventName ) {
eventName = (eventName || "").split( " " ).join( this.eventNamespace + " " ) + this.eventNamespace;
element.unbind( eventName ).undelegate( eventName );
},
_delay: function( handler, delay ) {
function handlerProxy() {
return ( typeof handler === "string" ? instance[ handler ] : handler )
.apply( instance, arguments );
}
var instance = this;
return setTimeout( handlerProxy, delay || 0 );
},
_hoverable: function( element ) {
this.hoverable = this.hoverable.add( element );
this._on( element, {
mouseenter: function( event ) {
$( event.currentTarget ).addClass( "ui-state-hover" );
},
mouseleave: function( event ) {
$( event.currentTarget ).removeClass( "ui-state-hover" );
}
});
},
_focusable: function( element ) {
this.focusable = this.focusable.add( element );
this._on( element, {
focusin: function( event ) {
$( event.currentTarget ).addClass( "ui-state-focus" );
},
focusout: function( event ) {
$( event.currentTarget ).removeClass( "ui-state-focus" );
}
});
},
_trigger: function( type, event, data ) {
var prop, orig,
callback = this.options[ type ];
data = data || {};
event = $.Event( event );
event.type = ( type === this.widgetEventPrefix ?
type :
this.widgetEventPrefix + type ).toLowerCase();
// the original event may come from any element
// so we need to reset the target on the new event
event.target = this.element[ 0 ];
// copy original event properties over to the new event
orig = event.originalEvent;
if ( orig ) {
for ( prop in orig ) {
if ( !( prop in event ) ) {
event[ prop ] = orig[ prop ];
}
}
}
this.element.trigger( event, data );
return !( $.isFunction( callback ) &&
callback.apply( this.element[0], [ event ].concat( data ) ) === false ||
event.isDefaultPrevented() );
}
};
$.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
$.Widget.prototype[ "_" + method ] = function( element, options, callback ) {
if ( typeof options === "string" ) {
options = { effect: options };
}
var hasOptions,
effectName = !options ?
method :
options === true || typeof options === "number" ?
defaultEffect :
options.effect || defaultEffect;
options = options || {};
if ( typeof options === "number" ) {
options = { duration: options };
}
hasOptions = !$.isEmptyObject( options );
options.complete = callback;
if ( options.delay ) {
element.delay( options.delay );
}
if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) {
element[ method ]( options );
} else if ( effectName !== method && element[ effectName ] ) {
element[ effectName ]( options.duration, options.easing, callback );
} else {
element.queue(function( next ) {
$( this )[ method ]();
if ( callback ) {
callback.call( element[ 0 ] );
}
next();
});
}
};
});
})( jQuery );
(function( $, undefined ) {
var rcapitals = /[A-Z]/g,
replaceFunction = function( c ) {
return "-" + c.toLowerCase();
};
$.extend( $.Widget.prototype, {
_getCreateOptions: function() {
var option, value,
elem = this.element[ 0 ],
options = {};
//
if ( !$.mobile.getAttribute( elem, "defaults" ) ) {
for ( option in this.options ) {
value = $.mobile.getAttribute( elem, option.replace( rcapitals, replaceFunction ) );
if ( value != null ) {
options[ option ] = value;
}
}
}
return options;
}
});
//TODO: Remove in 1.5 for backcompat only
$.mobile.widget = $.Widget;
})( jQuery );
(function( $ ) {
// TODO move loader class down into the widget settings
var loaderClass = "ui-loader", $html = $( "html" );
$.widget( "mobile.loader", {
// NOTE if the global config settings are defined they will override these
// options
options: {
// the theme for the loading message
theme: "a",
// whether the text in the loading message is shown
textVisible: false,
// custom html for the inner content of the loading message
html: "",
// the text to be displayed when the popup is shown
text: "loading"
},
defaultHtml: "<div class='" + loaderClass + "'>" +
"<span class='ui-icon-loading'></span>" +
"<h1></h1>" +
"</div>",
// For non-fixed supportin browsers. Position at y center (if scrollTop supported), above the activeBtn (if defined), or just 100px from top
fakeFixLoader: function() {
var activeBtn = $( "." + $.mobile.activeBtnClass ).first();
this.element
.css({
top: $.support.scrollTop && this.window.scrollTop() + this.window.height() / 2 ||
activeBtn.length && activeBtn.offset().top || 100
});
},
// check position of loader to see if it appears to be "fixed" to center
// if not, use abs positioning
checkLoaderPosition: function() {
var offset = this.element.offset(),
scrollTop = this.window.scrollTop(),
screenHeight = $.mobile.getScreenHeight();
if ( offset.top < scrollTop || ( offset.top - scrollTop ) > screenHeight ) {
this.element.addClass( "ui-loader-fakefix" );
this.fakeFixLoader();
this.window
.unbind( "scroll", this.checkLoaderPosition )
.bind( "scroll", $.proxy( this.fakeFixLoader, this ) );
}
},
resetHtml: function() {
this.element.html( $( this.defaultHtml ).html() );
},
// Turn on/off page loading message. Theme doubles as an object argument
// with the following shape: { theme: '', text: '', html: '', textVisible: '' }
// NOTE that the $.mobile.loading* settings and params past the first are deprecated
// TODO sweet jesus we need to break some of this out
show: function( theme, msgText, textonly ) {
var textVisible, message, loadSettings;
this.resetHtml();
// use the prototype options so that people can set them globally at
// mobile init. Consistency, it's what's for dinner
if ( $.type( theme ) === "object" ) {
loadSettings = $.extend( {}, this.options, theme );
theme = loadSettings.theme;
} else {
loadSettings = this.options;
// here we prefer the theme value passed as a string argument, then
// we prefer the global option because we can't use undefined default
// prototype options, then the prototype option
theme = theme || loadSettings.theme;
}
// set the message text, prefer the param, then the settings object
// then loading message
message = msgText || ( loadSettings.text === false ? "" : loadSettings.text );
// prepare the dom
$html.addClass( "ui-loading" );
textVisible = loadSettings.textVisible;
// add the proper css given the options (theme, text, etc)
// Force text visibility if the second argument was supplied, or
// if the text was explicitly set in the object args
this.element.attr("class", loaderClass +
" ui-corner-all ui-body-" + theme +
" ui-loader-" + ( textVisible || msgText || theme.text ? "verbose" : "default" ) +
( loadSettings.textonly || textonly ? " ui-loader-textonly" : "" ) );
// TODO verify that jquery.fn.html is ok to use in both cases here
// this might be overly defensive in preventing unknowing xss
// if the html attribute is defined on the loading settings, use that
// otherwise use the fallbacks from above
if ( loadSettings.html ) {
this.element.html( loadSettings.html );
} else {
this.element.find( "h1" ).text( message );
}
// attach the loader to the DOM
this.element.appendTo( $.mobile.pageContainer );
// check that the loader is visible
this.checkLoaderPosition();
// on scroll check the loader position
this.window.bind( "scroll", $.proxy( this.checkLoaderPosition, this ) );
},
hide: function() {
$html.removeClass( "ui-loading" );
if ( this.options.text ) {
this.element.removeClass( "ui-loader-fakefix" );
}
$.mobile.window.unbind( "scroll", this.fakeFixLoader );
$.mobile.window.unbind( "scroll", this.checkLoaderPosition );
}
});
})(jQuery, this);
// Script: jQuery hashchange event
//
// *Version: 1.3, Last updated: 7/21/2010*
//
// Project Home - http://benalman.com/projects/jquery-hashchange-plugin/
// GitHub - http://github.com/cowboy/jquery-hashchange/
// Source - http://github.com/cowboy/jquery-hashchange/raw/master/jquery.ba-hashchange.js
// (Minified) - http://github.com/cowboy/jquery-hashchange/raw/master/jquery.ba-hashchange.min.js (0.8kb gzipped)
//
// About: License
//
// Copyright (c) 2010 "Cowboy" Ben Alman,
// Dual licensed under the MIT and GPL licenses.
// http://benalman.com/about/license/
//
// About: Examples
//
// These working examples, complete with fully commented code, illustrate a few
// ways in which this plugin can be used.
//
// hashchange event - http://benalman.com/code/projects/jquery-hashchange/examples/hashchange/
// document.domain - http://benalman.com/code/projects/jquery-hashchange/examples/document_domain/
//
// About: Support and Testing
//
// Information about what version or versions of jQuery this plugin has been
// tested with, what browsers it has been tested in, and where the unit tests
// reside (so you can test it yourself).
//
// jQuery Versions - 1.2.6, 1.3.2, 1.4.1, 1.4.2
// Browsers Tested - Internet Explorer 6-8, Firefox 2-4, Chrome 5-6, Safari 3.2-5,
// Opera 9.6-10.60, iPhone 3.1, Android 1.6-2.2, BlackBerry 4.6-5.
// Unit Tests - http://benalman.com/code/projects/jquery-hashchange/unit/
//
// About: Known issues
//
// While this jQuery hashchange event implementation is quite stable and
// robust, there are a few unfortunate browser bugs surrounding expected
// hashchange event-based behaviors, independent of any JavaScript
// window.onhashchange abstraction. See the following examples for more
// information:
//
// Chrome: Back Button - http://benalman.com/code/projects/jquery-hashchange/examples/bug-chrome-back-button/
// Firefox: Remote XMLHttpRequest - http://benalman.com/code/projects/jquery-hashchange/examples/bug-firefox-remote-xhr/
// WebKit: Back Button in an Iframe - http://benalman.com/code/projects/jquery-hashchange/examples/bug-webkit-hash-iframe/
// Safari: Back Button from a different domain - http://benalman.com/code/projects/jquery-hashchange/examples/bug-safari-back-from-diff-domain/
//
// Also note that should a browser natively support the window.onhashchange
// event, but not report that it does, the fallback polling loop will be used.
//
// About: Release History
//
// 1.3 - (7/21/2010) Reorganized IE6/7 Iframe code to make it more
// "removable" for mobile-only development. Added IE6/7 document.title
// support. Attempted to make Iframe as hidden as possible by using
// techniques from http://www.paciellogroup.com/blog/?p=604. Added
// support for the "shortcut" format $(window).hashchange( fn ) and
// $(window).hashchange() like jQuery provides for built-in events.
// Renamed jQuery.hashchangeDelay to <jQuery.fn.hashchange.delay> and
// lowered its default value to 50. Added <jQuery.fn.hashchange.domain>
// and <jQuery.fn.hashchange.src> properties plus document-domain.html
// file to address access denied issues when setting document.domain in
// IE6/7.
// 1.2 - (2/11/2010) Fixed a bug where coming back to a page using this plugin
// from a page on another domain would cause an error in Safari 4. Also,
// IE6/7 Iframe is now inserted after the body (this actually works),
// which prevents the page from scrolling when the event is first bound.
// Event can also now be bound before DOM ready, but it won't be usable
// before then in IE6/7.
// 1.1 - (1/21/2010) Incorporated document.documentMode test to fix IE8 bug
// where browser version is incorrectly reported as 8.0, despite
// inclusion of the X-UA-Compatible IE=EmulateIE7 meta tag.
// 1.0 - (1/9/2010) Initial Release. Broke out the jQuery BBQ event.special
// window.onhashchange functionality into a separate plugin for users
// who want just the basic event & back button support, without all the
// extra awesomeness that BBQ provides. This plugin will be included as
// part of jQuery BBQ, but also be available separately.
(function( $, window, undefined ) {
// Reused string.
var str_hashchange = 'hashchange',
// Method / object references.
doc = document,
fake_onhashchange,
special = $.event.special,
// Does the browser support window.onhashchange? Note that IE8 running in
// IE7 compatibility mode reports true for 'onhashchange' in window, even
// though the event isn't supported, so also test document.documentMode.
doc_mode = doc.documentMode,
supports_onhashchange = 'on' + str_hashchange in window && ( doc_mode === undefined || doc_mode > 7 );
// Get location.hash (or what you'd expect location.hash to be) sans any
// leading #. Thanks for making this necessary, Firefox!
function get_fragment( url ) {
url = url || location.href;
return '#' + url.replace( /^[^#]*#?(.*)$/, '$1' );
};
// Method: jQuery.fn.hashchange
//
// Bind a handler to the window.onhashchange event or trigger all bound
// window.onhashchange event handlers. This behavior is consistent with
// jQuery's built-in event handlers.
//
// Usage:
//
// > jQuery(window).hashchange( [ handler ] );
//
// Arguments:
//
// handler - (Function) Optional handler to be bound to the hashchange
// event. This is a "shortcut" for the more verbose form:
// jQuery(window).bind( 'hashchange', handler ). If handler is omitted,
// all bound window.onhashchange event handlers will be triggered. This
// is a shortcut for the more verbose
// jQuery(window).trigger( 'hashchange' ). These forms are described in
// the <hashchange event> section.
//
// Returns:
//
// (jQuery) The initial jQuery collection of elements.
// Allow the "shortcut" format $(elem).hashchange( fn ) for binding and
// $(elem).hashchange() for triggering, like jQuery does for built-in events.
$.fn[ str_hashchange ] = function( fn ) {
return fn ? this.bind( str_hashchange, fn ) : this.trigger( str_hashchange );
};
// Property: jQuery.fn.hashchange.delay
//
// The numeric interval (in milliseconds) at which the <hashchange event>
// polling loop executes. Defaults to 50.
// Property: jQuery.fn.hashchange.domain
//
// If you're setting document.domain in your JavaScript, and you want hash
// history to work in IE6/7, not only must this property be set, but you must
// also set document.domain BEFORE jQuery is loaded into the page. This
// property is only applicable if you are supporting IE6/7 (or IE8 operating
// in "IE7 compatibility" mode).
//
// In addition, the <jQuery.fn.hashchange.src> property must be set to the
// path of the included "document-domain.html" file, which can be renamed or
// modified if necessary (note that the document.domain specified must be the
// same in both your main JavaScript as well as in this file).
//
// Usage:
//
// jQuery.fn.hashchange.domain = document.domain;
// Property: jQuery.fn.hashchange.src
//
// If, for some reason, you need to specify an Iframe src file (for example,
// when setting document.domain as in <jQuery.fn.hashchange.domain>), you can
// do so using this property. Note that when using this property, history
// won't be recorded in IE6/7 until the Iframe src file loads. This property
// is only applicable if you are supporting IE6/7 (or IE8 operating in "IE7
// compatibility" mode).
//
// Usage:
//
// jQuery.fn.hashchange.src = 'path/to/file.html';
$.fn[ str_hashchange ].delay = 50;
/*
$.fn[ str_hashchange ].domain = null;
$.fn[ str_hashchange ].src = null;
*/
// Event: hashchange event
//
// Fired when location.hash changes. In browsers that support it, the native
// HTML5 window.onhashchange event is used, otherwise a polling loop is
// initialized, running every <jQuery.fn.hashchange.delay> milliseconds to
// see if the hash has changed. In IE6/7 (and IE8 operating in "IE7
// compatibility" mode), a hidden Iframe is created to allow the back button
// and hash-based history to work.
//
// Usage as described in <jQuery.fn.hashchange>:
//
// > // Bind an event handler.
// > jQuery(window).hashchange( function(e) {
// > var hash = location.hash;
// > ...
// > });
// >
// > // Manually trigger the event handler.
// > jQuery(window).hashchange();
//
// A more verbose usage that allows for event namespacing:
//
// > // Bind an event handler.
// > jQuery(window).bind( 'hashchange', function(e) {
// > var hash = location.hash;
// > ...
// > });
// >
// > // Manually trigger the event handler.
// > jQuery(window).trigger( 'hashchange' );
//
// Additional Notes:
//
// * The polling loop and Iframe are not created until at least one handler
// is actually bound to the 'hashchange' event.
// * If you need the bound handler(s) to execute immediately, in cases where
// a location.hash exists on page load, via bookmark or page refresh for
// example, use jQuery(window).hashchange() or the more verbose
// jQuery(window).trigger( 'hashchange' ).
// * The event can be bound before DOM ready, but since it won't be usable
// before then in IE6/7 (due to the necessary Iframe), recommended usage is
// to bind it inside a DOM ready handler.
// Override existing $.event.special.hashchange methods (allowing this plugin
// to be defined after jQuery BBQ in BBQ's source code).
special[ str_hashchange ] = $.extend( special[ str_hashchange ], {
// Called only when the first 'hashchange' event is bound to window.
setup: function() {
// If window.onhashchange is supported natively, there's nothing to do..
if ( supports_onhashchange ) { return false; }
// Otherwise, we need to create our own. And we don't want to call this
// until the user binds to the event, just in case they never do, since it
// will create a polling loop and possibly even a hidden Iframe.
$( fake_onhashchange.start );
},
// Called only when the last 'hashchange' event is unbound from window.
teardown: function() {
// If window.onhashchange is supported natively, there's nothing to do..
if ( supports_onhashchange ) { return false; }
// Otherwise, we need to stop ours (if possible).
$( fake_onhashchange.stop );
}
});
// fake_onhashchange does all the work of triggering the window.onhashchange
// event for browsers that don't natively support it, including creating a
// polling loop to watch for hash changes and in IE 6/7 creating a hidden
// Iframe to enable back and forward.
fake_onhashchange = (function() {
var self = {},
timeout_id,
// Remember the initial hash so it doesn't get triggered immediately.
last_hash = get_fragment(),
fn_retval = function( val ) { return val; },
history_set = fn_retval,
history_get = fn_retval;
// Start the polling loop.
self.start = function() {
timeout_id || poll();
};
// Stop the polling loop.
self.stop = function() {
timeout_id && clearTimeout( timeout_id );
timeout_id = undefined;
};
// This polling loop checks every $.fn.hashchange.delay milliseconds to see
// if location.hash has changed, and triggers the 'hashchange' event on
// window when necessary.
function poll() {
var hash = get_fragment(),
history_hash = history_get( last_hash );
if ( hash !== last_hash ) {
history_set( last_hash = hash, history_hash );
$(window).trigger( str_hashchange );
} else if ( history_hash !== last_hash ) {
location.href = location.href.replace( /#.*/, '' ) + history_hash;
}
timeout_id = setTimeout( poll, $.fn[ str_hashchange ].delay );
};
// vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
// vvvvvvvvvvvvvvvvvvv REMOVE IF NOT SUPPORTING IE6/7/8 vvvvvvvvvvvvvvvvvvv
// vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
window.attachEvent && !window.addEventListener && !supports_onhashchange && (function() {
// Not only do IE6/7 need the "magical" Iframe treatment, but so does IE8
// when running in "IE7 compatibility" mode.
var iframe,
iframe_src;
// When the event is bound and polling starts in IE 6/7, create a hidden
// Iframe for history handling.
self.start = function() {
if ( !iframe ) {
iframe_src = $.fn[ str_hashchange ].src;
iframe_src = iframe_src && iframe_src + get_fragment();
// Create hidden Iframe. Attempt to make Iframe as hidden as possible
// by using techniques from http://www.paciellogroup.com/blog/?p=604.
iframe = $('<iframe tabindex="-1" title="empty"/>').hide()
// When Iframe has completely loaded, initialize the history and
// start polling.
.one( 'load', function() {
iframe_src || history_set( get_fragment() );
poll();
})
// Load Iframe src if specified, otherwise nothing.
.attr( 'src', iframe_src || 'javascript:0' )
// Append Iframe after the end of the body to prevent unnecessary
// initial page scrolling (yes, this works).
.insertAfter( 'body' )[0].contentWindow;
// Whenever `document.title` changes, update the Iframe's title to
// prettify the back/next history menu entries. Since IE sometimes
// errors with "Unspecified error" the very first time this is set
// (yes, very useful) wrap this with a try/catch block.
doc.onpropertychange = function() {
try {
if ( event.propertyName === 'title' ) {
iframe.document.title = doc.title;
}
} catch(e) {}
};
}
};
// Override the "stop" method since an IE6/7 Iframe was created. Even
// if there are no longer any bound event handlers, the polling loop
// is still necessary for back/next to work at all!
self.stop = fn_retval;
// Get history by looking at the hidden Iframe's location.hash.
history_get = function() {
return get_fragment( iframe.location.href );
};
// Set a new history item by opening and then closing the Iframe
// document, *then* setting its location.hash. If document.domain has
// been set, update that as well.
history_set = function( hash, history_hash ) {
var iframe_doc = iframe.document,
domain = $.fn[ str_hashchange ].domain;
if ( hash !== history_hash ) {
// Update Iframe with any initial `document.title` that might be set.
iframe_doc.title = doc.title;
// Opening the Iframe's document after it has been closed is what
// actually adds a history entry.
iframe_doc.open();
// Set document.domain for the Iframe document as well, if necessary.
domain && iframe_doc.write( '<script>document.domain="' + domain + '"<\/script>' );
iframe_doc.close();
// Update the Iframe's hash, for great justice.
iframe.location.hash = hash;
}
};
})();
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// ^^^^^^^^^^^^^^^^^^^ REMOVE IF NOT SUPPORTING IE6/7/8 ^^^^^^^^^^^^^^^^^^^
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
return self;
})();
})(jQuery,this);
(function( $, undefined ) {
/*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas. Dual MIT/BSD license */
window.matchMedia = window.matchMedia || (function( doc, undefined ) {
var bool,
docElem = doc.documentElement,
refNode = docElem.firstElementChild || docElem.firstChild,
// fakeBody required for <FF4 when executed in <head>
fakeBody = doc.createElement( "body" ),
div = doc.createElement( "div" );
div.id = "mq-test-1";
div.style.cssText = "position:absolute;top:-100em";
fakeBody.style.background = "none";
fakeBody.appendChild(div);
return function(q){
div.innerHTML = "­<style media=\"" + q + "\"> #mq-test-1 { width: 42px; }</style>";
docElem.insertBefore( fakeBody, refNode );
bool = div.offsetWidth === 42;
docElem.removeChild( fakeBody );
return {
matches: bool,
media: q
};
};
}( document ));
// $.mobile.media uses matchMedia to return a boolean.
$.mobile.media = function( q ) {
return window.matchMedia( q ).matches;
};
})(jQuery);
(function( $, undefined ) {
var support = {
touch: "ontouchend" in document
};
$.mobile.support = $.mobile.support || {};
$.extend( $.support, support );
$.extend( $.mobile.support, support );
}( jQuery ));
(function( $, undefined ) {
$.extend( $.support, {
orientation: "orientation" in window && "onorientationchange" in window
});
}( jQuery ));
(function( $, undefined ) {
// thx Modernizr
function propExists( prop ) {
var uc_prop = prop.charAt( 0 ).toUpperCase() + prop.substr( 1 ),
props = ( prop + " " + vendors.join( uc_prop + " " ) + uc_prop ).split( " " ),
v;
for ( v in props ) {
if ( fbCSS[ props[ v ] ] !== undefined ) {
return true;
}
}
}
var fakeBody = $( "<body>" ).prependTo( "html" ),
fbCSS = fakeBody[ 0 ].style,
vendors = [ "Webkit", "Moz", "O" ],
webos = "palmGetResource" in window, //only used to rule out scrollTop
opera = window.opera,
operamini = window.operamini && ({}).toString.call( window.operamini ) === "[object OperaMini]",
bb = window.blackberry && !propExists( "-webkit-transform" ), //only used to rule out box shadow, as it's filled opaque on BB 5 and lower
nokiaLTE7_3;
function validStyle( prop, value, check_vend ) {
var div = document.createElement( "div" ),
uc = function( txt ) {
return txt.charAt( 0 ).toUpperCase() + txt.substr( 1 );
},
vend_pref = function( vend ) {
if ( vend === "" ) {
return "";
} else {
return "-" + vend.charAt( 0 ).toLowerCase() + vend.substr( 1 ) + "-";
}
},
check_style = function( vend ) {
var vend_prop = vend_pref( vend ) + prop + ": " + value + ";",
uc_vend = uc( vend ),
propStyle = uc_vend + ( uc_vend === "" ? prop : uc( prop ) );
div.setAttribute( "style", vend_prop );
if ( !!div.style[ propStyle ] ) {
ret = true;
}
},
check_vends = check_vend ? check_vend : vendors,
i, ret;
for( i = 0; i < check_vends.length; i++ ) {
check_style( check_vends[i] );
}
return !!ret;
}
// inline SVG support test
function inlineSVG() {
// Thanks Modernizr & Erik Dahlstrom
var w = window,
svg = !!w.document.createElementNS && !!w.document.createElementNS( "http://www.w3.org/2000/svg", "svg" ).createSVGRect && !( w.opera && navigator.userAgent.indexOf( "Chrome" ) === -1 ),
support = function( data ) {
if ( !( data && svg ) ) {
$( "html" ).addClass( "ui-nosvg" );
}
},
img = new w.Image();
img.onerror = function() {
support( false );
};
img.onload = function() {
support( img.width === 1 && img.height === 1 );
};
img.src = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==";
}
function transform3dTest() {
var mqProp = "transform-3d",
// Because the `translate3d` test below throws false positives in Android:
ret = $.mobile.media( "(-" + vendors.join( "-" + mqProp + "),(-" ) + "-" + mqProp + "),(" + mqProp + ")" ),
el, transforms, t;
if ( ret ) {
return !!ret;
}
el = document.createElement( "div" );
transforms = {
// We’re omitting Opera for the time being; MS uses unprefixed.
"MozTransform": "-moz-transform",
"transform": "transform"
};
fakeBody.append( el );
for ( t in transforms ) {
if ( el.style[ t ] !== undefined ) {
el.style[ t ] = "translate3d( 100px, 1px, 1px )";
ret = window.getComputedStyle( el ).getPropertyValue( transforms[ t ] );
}
}
return ( !!ret && ret !== "none" );
}
// Test for dynamic-updating base tag support ( allows us to avoid href,src attr rewriting )
function baseTagTest() {
var fauxBase = location.protocol + "//" + location.host + location.pathname + "ui-dir/",
base = $( "head base" ),
fauxEle = null,
href = "",
link, rebase;
if ( !base.length ) {
base = fauxEle = $( "<base>", { "href": fauxBase }).appendTo( "head" );
} else {
href = base.attr( "href" );
}
link = $( "<a href='testurl' />" ).prependTo( fakeBody );
rebase = link[ 0 ].href;
base[ 0 ].href = href || location.pathname;
if ( fauxEle ) {
fauxEle.remove();
}
return rebase.indexOf( fauxBase ) === 0;
}
// Thanks Modernizr
function cssPointerEventsTest() {
var element = document.createElement( "x" ),
documentElement = document.documentElement,
getComputedStyle = window.getComputedStyle,
supports;
if ( !( "pointerEvents" in element.style ) ) {
return false;
}
element.style.pointerEvents = "auto";
element.style.pointerEvents = "x";
documentElement.appendChild( element );
supports = getComputedStyle &&
getComputedStyle( element, "" ).pointerEvents === "auto";
documentElement.removeChild( element );
return !!supports;
}
function boundingRect() {
var div = document.createElement( "div" );
return typeof div.getBoundingClientRect !== "undefined";
}
// non-UA-based IE version check by James Padolsey, modified by jdalton - from http://gist.github.com/527683
// allows for inclusion of IE 6+, including Windows Mobile 7
$.extend( $.mobile, { browser: {} } );
$.mobile.browser.oldIE = (function() {
var v = 3,
div = document.createElement( "div" ),
a = div.all || [];
do {
div.innerHTML = "<!--[if gt IE " + ( ++v ) + "]><br><![endif]-->";
} while( a[0] );
return v > 4 ? v : !v;
})();
function fixedPosition() {
var w = window,
ua = navigator.userAgent,
platform = navigator.platform,
// Rendering engine is Webkit, and capture major version
wkmatch = ua.match( /AppleWebKit\/([0-9]+)/ ),
wkversion = !!wkmatch && wkmatch[ 1 ],
ffmatch = ua.match( /Fennec\/([0-9]+)/ ),
ffversion = !!ffmatch && ffmatch[ 1 ],
operammobilematch = ua.match( /Opera Mobi\/([0-9]+)/ ),
omversion = !!operammobilematch && operammobilematch[ 1 ];
if (
// iOS 4.3 and older : Platform is iPhone/Pad/Touch and Webkit version is less than 534 (ios5)
( ( platform.indexOf( "iPhone" ) > -1 || platform.indexOf( "iPad" ) > -1 || platform.indexOf( "iPod" ) > -1 ) && wkversion && wkversion < 534 ) ||
// Opera Mini
( w.operamini && ({}).toString.call( w.operamini ) === "[object OperaMini]" ) ||
( operammobilematch && omversion < 7458 ) ||
//Android lte 2.1: Platform is Android and Webkit version is less than 533 (Android 2.2)
( ua.indexOf( "Android" ) > -1 && wkversion && wkversion < 533 ) ||
// Firefox Mobile before 6.0 -
( ffversion && ffversion < 6 ) ||
// WebOS less than 3
( "palmGetResource" in window && wkversion && wkversion < 534 ) ||
// MeeGo
( ua.indexOf( "MeeGo" ) > -1 && ua.indexOf( "NokiaBrowser/8.5.0" ) > -1 ) ) {
return false;
}
return true;
}
$.extend( $.support, {
cssTransitions: "WebKitTransitionEvent" in window ||
validStyle( "transition", "height 100ms linear", [ "Webkit", "Moz", "" ] ) &&
!$.mobile.browser.oldIE && !opera,
// Note, Chrome for iOS has an extremely quirky implementation of popstate.
// We've chosen to take the shortest path to a bug fix here for issue #5426
// See the following link for information about the regex chosen
// https://developers.google.com/chrome/mobile/docs/user-agent#chrome_for_ios_user-agent
pushState: "pushState" in history &&
"replaceState" in history &&
// When running inside a FF iframe, calling replaceState causes an error
!( window.navigator.userAgent.indexOf( "Firefox" ) >= 0 && window.top !== window ) &&
( window.navigator.userAgent.search(/CriOS/) === -1 ),
mediaquery: $.mobile.media( "only all" ),
cssPseudoElement: !!propExists( "content" ),
touchOverflow: !!propExists( "overflowScrolling" ),
cssTransform3d: transform3dTest(),
cssAnimations: !!propExists( "animationName" ),
boxShadow: !!propExists( "boxShadow" ) && !bb,
fixedPosition: fixedPosition(),
scrollTop: ("pageXOffset" in window ||
"scrollTop" in document.documentElement ||
"scrollTop" in fakeBody[ 0 ]) && !webos && !operamini,
dynamicBaseTag: baseTagTest(),
cssPointerEvents: cssPointerEventsTest(),
boundingRect: boundingRect(),
inlineSVG: inlineSVG
});
fakeBody.remove();
// $.mobile.ajaxBlacklist is used to override ajaxEnabled on platforms that have known conflicts with hash history updates (BB5, Symbian)
// or that generally work better browsing in regular http for full page refreshes (Opera Mini)
// Note: This detection below is used as a last resort.
// We recommend only using these detection methods when all other more reliable/forward-looking approaches are not possible
nokiaLTE7_3 = (function() {
var ua = window.navigator.userAgent;
//The following is an attempt to match Nokia browsers that are running Symbian/s60, with webkit, version 7.3 or older
return ua.indexOf( "Nokia" ) > -1 &&
( ua.indexOf( "Symbian/3" ) > -1 || ua.indexOf( "Series60/5" ) > -1 ) &&
ua.indexOf( "AppleWebKit" ) > -1 &&
ua.match( /(BrowserNG|NokiaBrowser)\/7\.[0-3]/ );
})();
// Support conditions that must be met in order to proceed
// default enhanced qualifications are media query support OR IE 7+
$.mobile.gradeA = function() {
return ( ( $.support.mediaquery && $.support.cssPseudoElement ) || $.mobile.browser.oldIE && $.mobile.browser.oldIE >= 8 ) && ( $.support.boundingRect || $.fn.jquery.match(/1\.[0-7+]\.[0-9+]?/) !== null );
};
$.mobile.ajaxBlacklist =
// BlackBerry browsers, pre-webkit
window.blackberry && !window.WebKitPoint ||
// Opera Mini
operamini ||
// Symbian webkits pre 7.3
nokiaLTE7_3;
// Lastly, this workaround is the only way we've found so far to get pre 7.3 Symbian webkit devices
// to render the stylesheets when they're referenced before this script, as we'd recommend doing.
// This simply reappends the CSS in place, which for some reason makes it apply
if ( nokiaLTE7_3 ) {
$(function() {
$( "head link[rel='stylesheet']" ).attr( "rel", "alternate stylesheet" ).attr( "rel", "stylesheet" );
});
}
// For ruling out shadows via css
if ( !$.support.boxShadow ) {
$( "html" ).addClass( "ui-noboxshadow" );
}
})( jQuery );
(function( $, undefined ) {
var $win = $.mobile.window, self,
dummyFnToInitNavigate = function() {
};
$.event.special.beforenavigate = {
setup: function() {
$win.on( "navigate", dummyFnToInitNavigate );
},
teardown: function() {
$win.off( "navigate", dummyFnToInitNavigate );
}
};
$.event.special.navigate = self = {
bound: false,
pushStateEnabled: true,
originalEventName: undefined,
// If pushstate support is present and push state support is defined to
// be true on the mobile namespace.
isPushStateEnabled: function() {
return $.support.pushState &&
$.mobile.pushStateEnabled === true &&
this.isHashChangeEnabled();
},
// !! assumes mobile namespace is present
isHashChangeEnabled: function() {
return $.mobile.hashListeningEnabled === true;
},
// TODO a lot of duplication between popstate and hashchange
popstate: function( event ) {
var newEvent = new $.Event( "navigate" ),
beforeNavigate = new $.Event( "beforenavigate" ),
state = event.originalEvent.state || {};
beforeNavigate.originalEvent = event;
$win.trigger( beforeNavigate );
if ( beforeNavigate.isDefaultPrevented() ) {
return;
}
if ( event.historyState ) {
$.extend(state, event.historyState);
}
// Make sure the original event is tracked for the end
// user to inspect incase they want to do something special
newEvent.originalEvent = event;
// NOTE we let the current stack unwind because any assignment to
// location.hash will stop the world and run this event handler. By
// doing this we create a similar behavior to hashchange on hash
// assignment
setTimeout(function() {
$win.trigger( newEvent, {
state: state
});
}, 0);
},
hashchange: function( event /*, data */ ) {
var newEvent = new $.Event( "navigate" ),
beforeNavigate = new $.Event( "beforenavigate" );
beforeNavigate.originalEvent = event;
$win.trigger( beforeNavigate );
if ( beforeNavigate.isDefaultPrevented() ) {
return;
}
// Make sure the original event is tracked for the end
// user to inspect incase they want to do something special
newEvent.originalEvent = event;
// Trigger the hashchange with state provided by the user
// that altered the hash
$win.trigger( newEvent, {
// Users that want to fully normalize the two events
// will need to do history management down the stack and
// add the state to the event before this binding is fired
// TODO consider allowing for the explicit addition of callbacks
// to be fired before this value is set to avoid event timing issues
state: event.hashchangeState || {}
});
},
// TODO We really only want to set this up once
// but I'm not clear if there's a beter way to achieve
// this with the jQuery special event structure
setup: function( /* data, namespaces */ ) {
if ( self.bound ) {
return;
}
self.bound = true;
if ( self.isPushStateEnabled() ) {
self.originalEventName = "popstate";
$win.bind( "popstate.navigate", self.popstate );
} else if ( self.isHashChangeEnabled() ) {
self.originalEventName = "hashchange";
$win.bind( "hashchange.navigate", self.hashchange );
}
}
};
})( jQuery );
(function( $, undefined ) {
var path, $base, dialogHashKey = "&ui-state=dialog";
$.mobile.path = path = {
uiStateKey: "&ui-state",
// This scary looking regular expression parses an absolute URL or its relative
// variants (protocol, site, document, query, and hash), into the various
// components (protocol, host, path, query, fragment, etc that make up the
// URL as well as some other commonly used sub-parts. When used with RegExp.exec()
// or String.match, it parses the URL into a results array that looks like this:
//
// [0]: http://jblas:password@mycompany.com:8080/mail/inbox?msg=1234&type=unread#msg-content
// [1]: http://jblas:password@mycompany.com:8080/mail/inbox?msg=1234&type=unread
// [2]: http://jblas:password@mycompany.com:8080/mail/inbox
// [3]: http://jblas:password@mycompany.com:8080
// [4]: http:
// [5]: //
// [6]: jblas:password@mycompany.com:8080
// [7]: jblas:password
// [8]: jblas
// [9]: password
// [10]: mycompany.com:8080
// [11]: mycompany.com
// [12]: 8080
// [13]: /mail/inbox
// [14]: /mail/
// [15]: inbox
// [16]: ?msg=1234&type=unread
// [17]: #msg-content
//
urlParseRE: /^\s*(((([^:\/#\?]+:)?(?:(\/\/)((?:(([^:@\/#\?]+)(?:\:([^:@\/#\?]+))?)@)?(([^:\/#\?\]\[]+|\[[^\/\]@#?]+\])(?:\:([0-9]+))?))?)?)?((\/?(?:[^\/\?#]+\/+)*)([^\?#]*)))?(\?[^#]+)?)(#.*)?/,
// Abstraction to address xss (Issue #4787) by removing the authority in
// browsers that auto decode it. All references to location.href should be
// replaced with a call to this method so that it can be dealt with properly here
getLocation: function( url ) {
var uri = url ? this.parseUrl( url ) : location,
hash = this.parseUrl( url || location.href ).hash;
// mimic the browser with an empty string when the hash is empty
hash = hash === "#" ? "" : hash;
// Make sure to parse the url or the location object for the hash because using location.hash
// is autodecoded in firefox, the rest of the url should be from the object (location unless
// we're testing) to avoid the inclusion of the authority
return uri.protocol + "//" + uri.host + uri.pathname + uri.search + hash;
},
//return the original document url
getDocumentUrl: function( asParsedObject ) {
return asParsedObject ? $.extend( {}, path.documentUrl ) : path.documentUrl.href;
},
parseLocation: function() {
return this.parseUrl( this.getLocation() );
},
//Parse a URL into a structure that allows easy access to
//all of the URL components by name.
parseUrl: function( url ) {
// If we're passed an object, we'll assume that it is
// a parsed url object and just return it back to the caller.
if ( $.type( url ) === "object" ) {
return url;
}
var matches = path.urlParseRE.exec( url || "" ) || [];
// Create an object that allows the caller to access the sub-matches
// by name. Note that IE returns an empty string instead of undefined,
// like all other browsers do, so we normalize everything so its consistent
// no matter what browser we're running on.
return {
href: matches[ 0 ] || "",
hrefNoHash: matches[ 1 ] || "",
hrefNoSearch: matches[ 2 ] || "",
domain: matches[ 3 ] || "",
protocol: matches[ 4 ] || "",
doubleSlash: matches[ 5 ] || "",
authority: matches[ 6 ] || "",
username: matches[ 8 ] || "",
password: matches[ 9 ] || "",
host: matches[ 10 ] || "",
hostname: matches[ 11 ] || "",
port: matches[ 12 ] || "",
pathname: matches[ 13 ] || "",
directory: matches[ 14 ] || "",
filename: matches[ 15 ] || "",
search: matches[ 16 ] || "",
hash: matches[ 17 ] || ""
};
},
//Turn relPath into an asbolute path. absPath is
//an optional absolute path which describes what
//relPath is relative to.
makePathAbsolute: function( relPath, absPath ) {
var absStack,
relStack,
i, d;
if ( relPath && relPath.charAt( 0 ) === "/" ) {
return relPath;
}
relPath = relPath || "";
absPath = absPath ? absPath.replace( /^\/|(\/[^\/]*|[^\/]+)$/g, "" ) : "";
absStack = absPath ? absPath.split( "/" ) : [];
relStack = relPath.split( "/" );
for ( i = 0; i < relStack.length; i++ ) {
d = relStack[ i ];
switch ( d ) {
case ".":
break;
case "..":
if ( absStack.length ) {
absStack.pop();
}
break;
default:
absStack.push( d );
break;
}
}
return "/" + absStack.join( "/" );
},
//Returns true if both urls have the same domain.
isSameDomain: function( absUrl1, absUrl2 ) {
return path.parseUrl( absUrl1 ).domain === path.parseUrl( absUrl2 ).domain;
},
//Returns true for any relative variant.
isRelativeUrl: function( url ) {
// All relative Url variants have one thing in common, no protocol.
return path.parseUrl( url ).protocol === "";
},
//Returns true for an absolute url.
isAbsoluteUrl: function( url ) {
return path.parseUrl( url ).protocol !== "";
},
//Turn the specified realtive URL into an absolute one. This function
//can handle all relative variants (protocol, site, document, query, fragment).
makeUrlAbsolute: function( relUrl, absUrl ) {
if ( !path.isRelativeUrl( relUrl ) ) {
return relUrl;
}
if ( absUrl === undefined ) {
absUrl = this.documentBase;
}
var relObj = path.parseUrl( relUrl ),
absObj = path.parseUrl( absUrl ),
protocol = relObj.protocol || absObj.protocol,
doubleSlash = relObj.protocol ? relObj.doubleSlash : ( relObj.doubleSlash || absObj.doubleSlash ),
authority = relObj.authority || absObj.authority,
hasPath = relObj.pathname !== "",
pathname = path.makePathAbsolute( relObj.pathname || absObj.filename, absObj.pathname ),
search = relObj.search || ( !hasPath && absObj.search ) || "",
hash = relObj.hash;
return protocol + doubleSlash + authority + pathname + search + hash;
},
//Add search (aka query) params to the specified url.
addSearchParams: function( url, params ) {
var u = path.parseUrl( url ),
p = ( typeof params === "object" ) ? $.param( params ) : params,
s = u.search || "?";
return u.hrefNoSearch + s + ( s.charAt( s.length - 1 ) !== "?" ? "&" : "" ) + p + ( u.hash || "" );
},
convertUrlToDataUrl: function( absUrl ) {
var u = path.parseUrl( absUrl );
if ( path.isEmbeddedPage( u ) ) {
// For embedded pages, remove the dialog hash key as in getFilePath(),
// and remove otherwise the Data Url won't match the id of the embedded Page.
return u.hash
.split( dialogHashKey )[0]
.replace( /^#/, "" )
.replace( /\?.*$/, "" );
} else if ( path.isSameDomain( u, this.documentBase ) ) {
return u.hrefNoHash.replace( this.documentBase.domain, "" ).split( dialogHashKey )[0];
}
return window.decodeURIComponent(absUrl);
},
//get path from current hash, or from a file path
get: function( newPath ) {
if ( newPath === undefined ) {
newPath = path.parseLocation().hash;
}
return path.stripHash( newPath ).replace( /[^\/]*\.[^\/*]+$/, "" );
},
//set location hash to path
set: function( path ) {
location.hash = path;
},
//test if a given url (string) is a path
//NOTE might be exceptionally naive
isPath: function( url ) {
return ( /\// ).test( url );
},
//return a url path with the window's location protocol/hostname/pathname removed
clean: function( url ) {
return url.replace( this.documentBase.domain, "" );
},
//just return the url without an initial #
stripHash: function( url ) {
return url.replace( /^#/, "" );
},
stripQueryParams: function( url ) {
return url.replace( /\?.*$/, "" );
},
//remove the preceding hash, any query params, and dialog notations
cleanHash: function( hash ) {
return path.stripHash( hash.replace( /\?.*$/, "" ).replace( dialogHashKey, "" ) );
},
isHashValid: function( hash ) {
return ( /^#[^#]+$/ ).test( hash );
},
//check whether a url is referencing the same domain, or an external domain or different protocol
//could be mailto, etc
isExternal: function( url ) {
var u = path.parseUrl( url );
return u.protocol && u.domain !== this.documentUrl.domain ? true : false;
},
hasProtocol: function( url ) {
return ( /^(:?\w+:)/ ).test( url );
},
isEmbeddedPage: function( url ) {
var u = path.parseUrl( url );
//if the path is absolute, then we need to compare the url against
//both the this.documentUrl and the documentBase. The main reason for this
//is that links embedded within external documents will refer to the
//application document, whereas links embedded within the application
//document will be resolved against the document base.
if ( u.protocol !== "" ) {
return ( !this.isPath(u.hash) && u.hash && ( u.hrefNoHash === this.documentUrl.hrefNoHash || ( this.documentBaseDiffers && u.hrefNoHash === this.documentBase.hrefNoHash ) ) );
}
return ( /^#/ ).test( u.href );
},
squash: function( url, resolutionUrl ) {
var href, cleanedUrl, search, stateIndex,
isPath = this.isPath( url ),
uri = this.parseUrl( url ),
preservedHash = uri.hash,
uiState = "";
// produce a url against which we can resole the provided path
resolutionUrl = resolutionUrl || (path.isPath(url) ? path.getLocation() : path.getDocumentUrl());
// If the url is anything but a simple string, remove any preceding hash
// eg #foo/bar -> foo/bar
// #foo -> #foo
cleanedUrl = isPath ? path.stripHash( url ) : url;
// If the url is a full url with a hash check if the parsed hash is a path
// if it is, strip the #, and use it otherwise continue without change
cleanedUrl = path.isPath( uri.hash ) ? path.stripHash( uri.hash ) : cleanedUrl;
// Split the UI State keys off the href
stateIndex = cleanedUrl.indexOf( this.uiStateKey );
// store the ui state keys for use
if ( stateIndex > -1 ) {
uiState = cleanedUrl.slice( stateIndex );
cleanedUrl = cleanedUrl.slice( 0, stateIndex );
}
// make the cleanedUrl absolute relative to the resolution url
href = path.makeUrlAbsolute( cleanedUrl, resolutionUrl );
// grab the search from the resolved url since parsing from
// the passed url may not yield the correct result
search = this.parseUrl( href ).search;
// TODO all this crap is terrible, clean it up
if ( isPath ) {
// reject the hash if it's a path or it's just a dialog key
if ( path.isPath( preservedHash ) || preservedHash.replace("#", "").indexOf( this.uiStateKey ) === 0) {
preservedHash = "";
}
// Append the UI State keys where it exists and it's been removed
// from the url
if ( uiState && preservedHash.indexOf( this.uiStateKey ) === -1) {
preservedHash += uiState;
}
// make sure that pound is on the front of the hash
if ( preservedHash.indexOf( "#" ) === -1 && preservedHash !== "" ) {
preservedHash = "#" + preservedHash;
}
// reconstruct each of the pieces with the new search string and hash
href = path.parseUrl( href );
href = href.protocol + "//" + href.host + href.pathname + search + preservedHash;
} else {
href += href.indexOf( "#" ) > -1 ? uiState : "#" + uiState;
}
return href;
},
isPreservableHash: function( hash ) {
return hash.replace( "#", "" ).indexOf( this.uiStateKey ) === 0;
},
// Escape weird characters in the hash if it is to be used as a selector
hashToSelector: function( hash ) {
var hasHash = ( hash.substring( 0, 1 ) === "#" );
if ( hasHash ) {
hash = hash.substring( 1 );
}
return ( hasHash ? "#" : "" ) + hash.replace( /([!"#$%&'()*+,./:;<=>?@[\]^`{|}~])/g, "\\$1" );
},
// return the substring of a filepath before the sub-page key, for making
// a server request
getFilePath: function( path ) {
var splitkey = "&" + $.mobile.subPageUrlKey;
return path && path.split( splitkey )[0].split( dialogHashKey )[0];
},
// check if the specified url refers to the first page in the main
// application document.
isFirstPageUrl: function( url ) {
// We only deal with absolute paths.
var u = path.parseUrl( path.makeUrlAbsolute( url, this.documentBase ) ),
// Does the url have the same path as the document?
samePath = u.hrefNoHash === this.documentUrl.hrefNoHash ||
( this.documentBaseDiffers &&
u.hrefNoHash === this.documentBase.hrefNoHash ),
// Get the first page element.
fp = $.mobile.firstPage,
// Get the id of the first page element if it has one.
fpId = fp && fp[0] ? fp[0].id : undefined;
// The url refers to the first page if the path matches the document and
// it either has no hash value, or the hash is exactly equal to the id
// of the first page element.
return samePath &&
( !u.hash ||
u.hash === "#" ||
( fpId && u.hash.replace( /^#/, "" ) === fpId ) );
},
// Some embedded browsers, like the web view in Phone Gap, allow
// cross-domain XHR requests if the document doing the request was loaded
// via the file:// protocol. This is usually to allow the application to
// "phone home" and fetch app specific data. We normally let the browser
// handle external/cross-domain urls, but if the allowCrossDomainPages
// option is true, we will allow cross-domain http/https requests to go
// through our page loading logic.
isPermittedCrossDomainRequest: function( docUrl, reqUrl ) {
return $.mobile.allowCrossDomainPages &&
(docUrl.protocol === "file:" || docUrl.protocol === "content:") &&
reqUrl.search( /^https?:/ ) !== -1;
}
};
path.documentUrl = path.parseLocation();
$base = $( "head" ).find( "base" );
path.documentBase = $base.length ?
path.parseUrl( path.makeUrlAbsolute( $base.attr( "href" ), path.documentUrl.href ) ) :
path.documentUrl;
path.documentBaseDiffers = (path.documentUrl.hrefNoHash !== path.documentBase.hrefNoHash);
//return the original document base url
path.getDocumentBase = function( asParsedObject ) {
return asParsedObject ? $.extend( {}, path.documentBase ) : path.documentBase.href;
};
// DEPRECATED as of 1.4.0 - remove in 1.5.0
$.extend( $.mobile, {
//return the original document url
getDocumentUrl: path.getDocumentUrl,
//return the original document base url
getDocumentBase: path.getDocumentBase
});
})( jQuery );
(function( $, undefined ) {
$.mobile.History = function( stack, index ) {
this.stack = stack || [];
this.activeIndex = index || 0;
};
$.extend($.mobile.History.prototype, {
getActive: function() {
return this.stack[ this.activeIndex ];
},
getLast: function() {
return this.stack[ this.previousIndex ];
},
getNext: function() {
return this.stack[ this.activeIndex + 1 ];
},
getPrev: function() {
return this.stack[ this.activeIndex - 1 ];
},
// addNew is used whenever a new page is added
add: function( url, data ) {
data = data || {};
//if there's forward history, wipe it
if ( this.getNext() ) {
this.clearForward();
}
// if the hash is included in the data make sure the shape
// is consistent for comparison
if ( data.hash && data.hash.indexOf( "#" ) === -1) {
data.hash = "#" + data.hash;
}
data.url = url;
this.stack.push( data );
this.activeIndex = this.stack.length - 1;
},
//wipe urls ahead of active index
clearForward: function() {
this.stack = this.stack.slice( 0, this.activeIndex + 1 );
},
find: function( url, stack, earlyReturn ) {
stack = stack || this.stack;
var entry, i, length = stack.length, index;
for ( i = 0; i < length; i++ ) {
entry = stack[i];
if ( decodeURIComponent(url) === decodeURIComponent(entry.url) ||
decodeURIComponent(url) === decodeURIComponent(entry.hash) ) {
index = i;
if ( earlyReturn ) {
return index;
}
}
}
return index;
},
closest: function( url ) {
var closest, a = this.activeIndex;
// First, take the slice of the history stack before the current index and search
// for a url match. If one is found, we'll avoid avoid looking through forward history
// NOTE the preference for backward history movement is driven by the fact that
// most mobile browsers only have a dedicated back button, and users rarely use
// the forward button in desktop browser anyhow
closest = this.find( url, this.stack.slice(0, a) );
// If nothing was found in backward history check forward. The `true`
// value passed as the third parameter causes the find method to break
// on the first match in the forward history slice. The starting index
// of the slice must then be added to the result to get the element index
// in the original history stack :( :(
//
// TODO this is hyper confusing and should be cleaned up (ugh so bad)
if ( closest === undefined ) {
closest = this.find( url, this.stack.slice(a), true );
closest = closest === undefined ? closest : closest + a;
}
return closest;
},
direct: function( opts ) {
var newActiveIndex = this.closest( opts.url ), a = this.activeIndex;
// save new page index, null check to prevent falsey 0 result
// record the previous index for reference
if ( newActiveIndex !== undefined ) {
this.activeIndex = newActiveIndex;
this.previousIndex = a;
}
// invoke callbacks where appropriate
//
// TODO this is also convoluted and confusing
if ( newActiveIndex < a ) {
( opts.present || opts.back || $.noop )( this.getActive(), "back" );
} else if ( newActiveIndex > a ) {
( opts.present || opts.forward || $.noop )( this.getActive(), "forward" );
} else if ( newActiveIndex === undefined && opts.missing ) {
opts.missing( this.getActive() );
}
}
});
})( jQuery );
(function( $, undefined ) {
var path = $.mobile.path,
initialHref = location.href;
$.mobile.Navigator = function( history ) {
this.history = history;
this.ignoreInitialHashChange = true;
$.mobile.window.bind({
"popstate.history": $.proxy( this.popstate, this ),
"hashchange.history": $.proxy( this.hashchange, this )
});
};
$.extend($.mobile.Navigator.prototype, {
squash: function( url, data ) {
var state, href, hash = path.isPath(url) ? path.stripHash(url) : url;
href = path.squash( url );
// make sure to provide this information when it isn't explicitly set in the
// data object that was passed to the squash method
state = $.extend({
hash: hash,
url: href
}, data);
// replace the current url with the new href and store the state
// Note that in some cases we might be replacing an url with the
// same url. We do this anyways because we need to make sure that
// all of our history entries have a state object associated with
// them. This allows us to work around the case where $.mobile.back()
// is called to transition from an external page to an embedded page.
// In that particular case, a hashchange event is *NOT* generated by the browser.
// Ensuring each history entry has a state object means that onPopState()
// will always trigger our hashchange callback even when a hashchange event
// is not fired.
window.history.replaceState( state, state.title || document.title, href );
return state;
},
hash: function( url, href ) {
var parsed, loc, hash, resolved;
// Grab the hash for recording. If the passed url is a path
// we used the parsed version of the squashed url to reconstruct,
// otherwise we assume it's a hash and store it directly
parsed = path.parseUrl( url );
loc = path.parseLocation();
if ( loc.pathname + loc.search === parsed.pathname + parsed.search ) {
// If the pathname and search of the passed url is identical to the current loc
// then we must use the hash. Otherwise there will be no event
// eg, url = "/foo/bar?baz#bang", location.href = "http://example.com/foo/bar?baz"
hash = parsed.hash ? parsed.hash : parsed.pathname + parsed.search;
} else if ( path.isPath(url) ) {
resolved = path.parseUrl( href );
// If the passed url is a path, make it domain relative and remove any trailing hash
hash = resolved.pathname + resolved.search + (path.isPreservableHash( resolved.hash )? resolved.hash.replace( "#", "" ) : "");
} else {
hash = url;
}
return hash;
},
// TODO reconsider name
go: function( url, data, noEvents ) {
var state, href, hash, popstateEvent,
isPopStateEvent = $.event.special.navigate.isPushStateEnabled();
// Get the url as it would look squashed on to the current resolution url
href = path.squash( url );
// sort out what the hash sould be from the url
hash = this.hash( url, href );
// Here we prevent the next hash change or popstate event from doing any
// history management. In the case of hashchange we don't swallow it
// if there will be no hashchange fired (since that won't reset the value)
// and will swallow the following hashchange
if ( noEvents && hash !== path.stripHash(path.parseLocation().hash) ) {
this.preventNextHashChange = noEvents;
}
// IMPORTANT in the case where popstate is supported the event will be triggered
// directly, stopping further execution - ie, interupting the flow of this
// method call to fire bindings at this expression. Below the navigate method
// there is a binding to catch this event and stop its propagation.
//
// We then trigger a new popstate event on the window with a null state
// so that the navigate events can conclude their work properly
//
// if the url is a path we want to preserve the query params that are available on
// the current url.
this.preventHashAssignPopState = true;
window.location.hash = hash;
// If popstate is enabled and the browser triggers `popstate` events when the hash
// is set (this often happens immediately in browsers like Chrome), then the
// this flag will be set to false already. If it's a browser that does not trigger
// a `popstate` on hash assignement or `replaceState` then we need avoid the branch
// that swallows the event created by the popstate generated by the hash assignment
// At the time of this writing this happens with Opera 12 and some version of IE
this.preventHashAssignPopState = false;
state = $.extend({
url: href,
hash: hash,
title: document.title
}, data);
if ( isPopStateEvent ) {
popstateEvent = new $.Event( "popstate" );
popstateEvent.originalEvent = {
type: "popstate",
state: null
};
this.squash( url, state );
// Trigger a new faux popstate event to replace the one that we
// caught that was triggered by the hash setting above.
if ( !noEvents ) {
this.ignorePopState = true;
$.mobile.window.trigger( popstateEvent );
}
}
// record the history entry so that the information can be included
// in hashchange event driven navigate events in a similar fashion to
// the state that's provided by popstate
this.history.add( state.url, state );
},
// This binding is intended to catch the popstate events that are fired
// when execution of the `$.navigate` method stops at window.location.hash = url;
// and completely prevent them from propagating. The popstate event will then be
// retriggered after execution resumes
//
// TODO grab the original event here and use it for the synthetic event in the
// second half of the navigate execution that will follow this binding
popstate: function( event ) {
var hash, state;
// Partly to support our test suite which manually alters the support
// value to test hashchange. Partly to prevent all around weirdness
if ( !$.event.special.navigate.isPushStateEnabled() ) {
return;
}
// If this is the popstate triggered by the actual alteration of the hash
// prevent it completely. History is tracked manually
if ( this.preventHashAssignPopState ) {
this.preventHashAssignPopState = false;
event.stopImmediatePropagation();
return;
}
// if this is the popstate triggered after the `replaceState` call in the go
// method, then simply ignore it. The history entry has already been captured
if ( this.ignorePopState ) {
this.ignorePopState = false;
return;
}
// If there is no state, and the history stack length is one were
// probably getting the page load popstate fired by browsers like chrome
// avoid it and set the one time flag to false.
// TODO: Do we really need all these conditions? Comparing location hrefs
// should be sufficient.
if ( !event.originalEvent.state &&
this.history.stack.length === 1 &&
this.ignoreInitialHashChange ) {
this.ignoreInitialHashChange = false;
if ( location.href === initialHref ) {
event.preventDefault();
return;
}
}
// account for direct manipulation of the hash. That is, we will receive a popstate
// when the hash is changed by assignment, and it won't have a state associated. We
// then need to squash the hash. See below for handling of hash assignment that
// matches an existing history entry
// TODO it might be better to only add to the history stack
// when the hash is adjacent to the active history entry
hash = path.parseLocation().hash;
if ( !event.originalEvent.state && hash ) {
// squash the hash that's been assigned on the URL with replaceState
// also grab the resulting state object for storage
state = this.squash( hash );
// record the new hash as an additional history entry
// to match the browser's treatment of hash assignment
this.history.add( state.url, state );
// pass the newly created state information
// along with the event
event.historyState = state;
// do not alter history, we've added a new history entry
// so we know where we are
return;
}
// If all else fails this is a popstate that comes from the back or forward buttons
// make sure to set the state of our history stack properly, and record the directionality
this.history.direct({
url: (event.originalEvent.state || {}).url || hash,
// When the url is either forward or backward in history include the entry
// as data on the event object for merging as data in the navigate event
present: function( historyEntry, direction ) {
// make sure to create a new object to pass down as the navigate event data
event.historyState = $.extend({}, historyEntry);
event.historyState.direction = direction;
}
});
},
// NOTE must bind before `navigate` special event hashchange binding otherwise the
// navigation data won't be attached to the hashchange event in time for those
// bindings to attach it to the `navigate` special event
// TODO add a check here that `hashchange.navigate` is bound already otherwise it's
// broken (exception?)
hashchange: function( event ) {
var history, hash;
// If hashchange listening is explicitly disabled or pushstate is supported
// avoid making use of the hashchange handler.
if (!$.event.special.navigate.isHashChangeEnabled() ||
$.event.special.navigate.isPushStateEnabled() ) {
return;
}
// On occasion explicitly want to prevent the next hash from propogating because we only
// with to alter the url to represent the new state do so here
if ( this.preventNextHashChange ) {
this.preventNextHashChange = false;
event.stopImmediatePropagation();
return;
}
history = this.history;
hash = path.parseLocation().hash;
// If this is a hashchange caused by the back or forward button
// make sure to set the state of our history stack properly
this.history.direct({
url: hash,
// When the url is either forward or backward in history include the entry
// as data on the event object for merging as data in the navigate event
present: function( historyEntry, direction ) {
// make sure to create a new object to pass down as the navigate event data
event.hashchangeState = $.extend({}, historyEntry);
event.hashchangeState.direction = direction;
},
// When we don't find a hash in our history clearly we're aiming to go there
// record the entry as new for future traversal
//
// NOTE it's not entirely clear that this is the right thing to do given that we
// can't know the users intention. It might be better to explicitly _not_
// support location.hash assignment in preference to $.navigate calls
// TODO first arg to add should be the href, but it causes issues in identifying
// embeded pages
missing: function() {
history.add( hash, {
hash: hash,
title: document.title
});
}
});
}
});
})( jQuery );
(function( $, undefined ) {
// TODO consider queueing navigation activity until previous activities have completed
// so that end users don't have to think about it. Punting for now
// TODO !! move the event bindings into callbacks on the navigate event
$.mobile.navigate = function( url, data, noEvents ) {
$.mobile.navigate.navigator.go( url, data, noEvents );
};
// expose the history on the navigate method in anticipation of full integration with
// existing navigation functionalty that is tightly coupled to the history information
$.mobile.navigate.history = new $.mobile.History();
// instantiate an instance of the navigator for use within the $.navigate method
$.mobile.navigate.navigator = new $.mobile.Navigator( $.mobile.navigate.history );
var loc = $.mobile.path.parseLocation();
$.mobile.navigate.history.add( loc.href, {hash: loc.hash} );
})( jQuery );
// This plugin is an experiment for abstracting away the touch and mouse
// events so that developers don't have to worry about which method of input
// the device their document is loaded on supports.
//
// The idea here is to allow the developer to register listeners for the
// basic mouse events, such as mousedown, mousemove, mouseup, and click,
// and the plugin will take care of registering the correct listeners
// behind the scenes to invoke the listener at the fastest possible time
// for that device, while still retaining the order of event firing in
// the traditional mouse environment, should multiple handlers be registered
// on the same element for different events.
//
// The current version exposes the following virtual events to jQuery bind methods:
// "vmouseover vmousedown vmousemove vmouseup vclick vmouseout vmousecancel"
(function( $, window, document, undefined ) {
var dataPropertyName = "virtualMouseBindings",
touchTargetPropertyName = "virtualTouchID",
virtualEventNames = "vmouseover vmousedown vmousemove vmouseup vclick vmouseout vmousecancel".split( " " ),
touchEventProps = "clientX clientY pageX pageY screenX screenY".split( " " ),
mouseHookProps = $.event.mouseHooks ? $.event.mouseHooks.props : [],
mouseEventProps = $.event.props.concat( mouseHookProps ),
activeDocHandlers = {},
resetTimerID = 0,
startX = 0,
startY = 0,
didScroll = false,
clickBlockList = [],
blockMouseTriggers = false,
blockTouchTriggers = false,
eventCaptureSupported = "addEventListener" in document,
$document = $( document ),
nextTouchID = 1,
lastTouchID = 0, threshold,
i;
$.vmouse = {
moveDistanceThreshold: 10,
clickDistanceThreshold: 10,
resetTimerDuration: 1500
};
function getNativeEvent( event ) {
while ( event && typeof event.originalEvent !== "undefined" ) {
event = event.originalEvent;
}
return event;
}
function createVirtualEvent( event, eventType ) {
var t = event.type,
oe, props, ne, prop, ct, touch, i, j, len;
event = $.Event( event );
event.type = eventType;
oe = event.originalEvent;
props = $.event.props;
// addresses separation of $.event.props in to $.event.mouseHook.props and Issue 3280
// https://github.com/jquery/jquery-mobile/issues/3280
if ( t.search( /^(mouse|click)/ ) > -1 ) {
props = mouseEventProps;
}
// copy original event properties over to the new event
// this would happen if we could call $.event.fix instead of $.Event
// but we don't have a way to force an event to be fixed multiple times
if ( oe ) {
for ( i = props.length, prop; i; ) {
prop = props[ --i ];
event[ prop ] = oe[ prop ];
}
}
// make sure that if the mouse and click virtual events are generated
// without a .which one is defined
if ( t.search(/mouse(down|up)|click/) > -1 && !event.which ) {
event.which = 1;
}
if ( t.search(/^touch/) !== -1 ) {
ne = getNativeEvent( oe );
t = ne.touches;
ct = ne.changedTouches;
touch = ( t && t.length ) ? t[0] : ( ( ct && ct.length ) ? ct[ 0 ] : undefined );
if ( touch ) {
for ( j = 0, len = touchEventProps.length; j < len; j++) {
prop = touchEventProps[ j ];
event[ prop ] = touch[ prop ];
}
}
}
return event;
}
function getVirtualBindingFlags( element ) {
var flags = {},
b, k;
while ( element ) {
b = $.data( element, dataPropertyName );
for ( k in b ) {
if ( b[ k ] ) {
flags[ k ] = flags.hasVirtualBinding = true;
}
}
element = element.parentNode;
}
return flags;
}
function getClosestElementWithVirtualBinding( element, eventType ) {
var b;
while ( element ) {
b = $.data( element, dataPropertyName );
if ( b && ( !eventType || b[ eventType ] ) ) {
return element;
}
element = element.parentNode;
}
return null;
}
function enableTouchBindings() {
blockTouchTriggers = false;
}
function disableTouchBindings() {
blockTouchTriggers = true;
}
function enableMouseBindings() {
lastTouchID = 0;
clickBlockList.length = 0;
blockMouseTriggers = false;
// When mouse bindings are enabled, our
// touch bindings are disabled.
disableTouchBindings();
}
function disableMouseBindings() {
// When mouse bindings are disabled, our
// touch bindings are enabled.
enableTouchBindings();
}
function startResetTimer() {
clearResetTimer();
resetTimerID = setTimeout( function() {
resetTimerID = 0;
enableMouseBindings();
}, $.vmouse.resetTimerDuration );
}
function clearResetTimer() {
if ( resetTimerID ) {
clearTimeout( resetTimerID );
resetTimerID = 0;
}
}
function triggerVirtualEvent( eventType, event, flags ) {
var ve;
if ( ( flags && flags[ eventType ] ) ||
( !flags && getClosestElementWithVirtualBinding( event.target, eventType ) ) ) {
ve = createVirtualEvent( event, eventType );
$( event.target).trigger( ve );
}
return ve;
}
function mouseEventCallback( event ) {
var touchID = $.data( event.target, touchTargetPropertyName ),
ve;
if ( !blockMouseTriggers && ( !lastTouchID || lastTouchID !== touchID ) ) {
ve = triggerVirtualEvent( "v" + event.type, event );
if ( ve ) {
if ( ve.isDefaultPrevented() ) {
event.preventDefault();
}
if ( ve.isPropagationStopped() ) {
event.stopPropagation();
}
if ( ve.isImmediatePropagationStopped() ) {
event.stopImmediatePropagation();
}
}
}
}
function handleTouchStart( event ) {
var touches = getNativeEvent( event ).touches,
target, flags, t;
if ( touches && touches.length === 1 ) {
target = event.target;
flags = getVirtualBindingFlags( target );
if ( flags.hasVirtualBinding ) {
lastTouchID = nextTouchID++;
$.data( target, touchTargetPropertyName, lastTouchID );
clearResetTimer();
disableMouseBindings();
didScroll = false;
t = getNativeEvent( event ).touches[ 0 ];
startX = t.pageX;
startY = t.pageY;
triggerVirtualEvent( "vmouseover", event, flags );
triggerVirtualEvent( "vmousedown", event, flags );
}
}
}
function handleScroll( event ) {
if ( blockTouchTriggers ) {
return;
}
if ( !didScroll ) {
triggerVirtualEvent( "vmousecancel", event, getVirtualBindingFlags( event.target ) );
}
didScroll = true;
startResetTimer();
}
function handleTouchMove( event ) {
if ( blockTouchTriggers ) {
return;
}
var t = getNativeEvent( event ).touches[ 0 ],
didCancel = didScroll,
moveThreshold = $.vmouse.moveDistanceThreshold,
flags = getVirtualBindingFlags( event.target );
didScroll = didScroll ||
( Math.abs( t.pageX - startX ) > moveThreshold ||
Math.abs( t.pageY - startY ) > moveThreshold );
if ( didScroll && !didCancel ) {
triggerVirtualEvent( "vmousecancel", event, flags );
}
triggerVirtualEvent( "vmousemove", event, flags );
startResetTimer();
}
function handleTouchEnd( event ) {
if ( blockTouchTriggers ) {
return;
}
disableTouchBindings();
var flags = getVirtualBindingFlags( event.target ),
ve, t;
triggerVirtualEvent( "vmouseup", event, flags );
if ( !didScroll ) {
ve = triggerVirtualEvent( "vclick", event, flags );
if ( ve && ve.isDefaultPrevented() ) {
// The target of the mouse events that follow the touchend
// event don't necessarily match the target used during the
// touch. This means we need to rely on coordinates for blocking
// any click that is generated.
t = getNativeEvent( event ).changedTouches[ 0 ];
clickBlockList.push({
touchID: lastTouchID,
x: t.clientX,
y: t.clientY
});
// Prevent any mouse events that follow from triggering
// virtual event notifications.
blockMouseTriggers = true;
}
}
triggerVirtualEvent( "vmouseout", event, flags);
didScroll = false;
startResetTimer();
}
function hasVirtualBindings( ele ) {
var bindings = $.data( ele, dataPropertyName ),
k;
if ( bindings ) {
for ( k in bindings ) {
if ( bindings[ k ] ) {
return true;
}
}
}
return false;
}
function dummyMouseHandler() {}
function getSpecialEventObject( eventType ) {
var realType = eventType.substr( 1 );
return {
setup: function(/* data, namespace */) {
// If this is the first virtual mouse binding for this element,
// add a bindings object to its data.
if ( !hasVirtualBindings( this ) ) {
$.data( this, dataPropertyName, {} );
}
// If setup is called, we know it is the first binding for this
// eventType, so initialize the count for the eventType to zero.
var bindings = $.data( this, dataPropertyName );
bindings[ eventType ] = true;
// If this is the first virtual mouse event for this type,
// register a global handler on the document.
activeDocHandlers[ eventType ] = ( activeDocHandlers[ eventType ] || 0 ) + 1;
if ( activeDocHandlers[ eventType ] === 1 ) {
$document.bind( realType, mouseEventCallback );
}
// Some browsers, like Opera Mini, won't dispatch mouse/click events
// for elements unless they actually have handlers registered on them.
// To get around this, we register dummy handlers on the elements.
$( this ).bind( realType, dummyMouseHandler );
// For now, if event capture is not supported, we rely on mouse handlers.
if ( eventCaptureSupported ) {
// If this is the first virtual mouse binding for the document,
// register our touchstart handler on the document.
activeDocHandlers[ "touchstart" ] = ( activeDocHandlers[ "touchstart" ] || 0) + 1;
if ( activeDocHandlers[ "touchstart" ] === 1 ) {
$document.bind( "touchstart", handleTouchStart )
.bind( "touchend", handleTouchEnd )
// On touch platforms, touching the screen and then dragging your finger
// causes the window content to scroll after some distance threshold is
// exceeded. On these platforms, a scroll prevents a click event from being
// dispatched, and on some platforms, even the touchend is suppressed. To
// mimic the suppression of the click event, we need to watch for a scroll
// event. Unfortunately, some platforms like iOS don't dispatch scroll
// events until *AFTER* the user lifts their finger (touchend). This means
// we need to watch both scroll and touchmove events to figure out whether
// or not a scroll happenens before the touchend event is fired.
.bind( "touchmove", handleTouchMove )
.bind( "scroll", handleScroll );
}
}
},
teardown: function(/* data, namespace */) {
// If this is the last virtual binding for this eventType,
// remove its global handler from the document.
--activeDocHandlers[ eventType ];
if ( !activeDocHandlers[ eventType ] ) {
$document.unbind( realType, mouseEventCallback );
}
if ( eventCaptureSupported ) {
// If this is the last virtual mouse binding in existence,
// remove our document touchstart listener.
--activeDocHandlers[ "touchstart" ];
if ( !activeDocHandlers[ "touchstart" ] ) {
$document.unbind( "touchstart", handleTouchStart )
.unbind( "touchmove", handleTouchMove )
.unbind( "touchend", handleTouchEnd )
.unbind( "scroll", handleScroll );
}
}
var $this = $( this ),
bindings = $.data( this, dataPropertyName );
// teardown may be called when an element was
// removed from the DOM. If this is the case,
// jQuery core may have already stripped the element
// of any data bindings so we need to check it before
// using it.
if ( bindings ) {
bindings[ eventType ] = false;
}
// Unregister the dummy event handler.
$this.unbind( realType, dummyMouseHandler );
// If this is the last virtual mouse binding on the
// element, remove the binding data from the element.
if ( !hasVirtualBindings( this ) ) {
$this.removeData( dataPropertyName );
}
}
};
}
// Expose our custom events to the jQuery bind/unbind mechanism.
for ( i = 0; i < virtualEventNames.length; i++ ) {
$.event.special[ virtualEventNames[ i ] ] = getSpecialEventObject( virtualEventNames[ i ] );
}
// Add a capture click handler to block clicks.
// Note that we require event capture support for this so if the device
// doesn't support it, we punt for now and rely solely on mouse events.
if ( eventCaptureSupported ) {
document.addEventListener( "click", function( e ) {
var cnt = clickBlockList.length,
target = e.target,
x, y, ele, i, o, touchID;
if ( cnt ) {
x = e.clientX;
y = e.clientY;
threshold = $.vmouse.clickDistanceThreshold;
// The idea here is to run through the clickBlockList to see if
// the current click event is in the proximity of one of our
// vclick events that had preventDefault() called on it. If we find
// one, then we block the click.
//
// Why do we have to rely on proximity?
//
// Because the target of the touch event that triggered the vclick
// can be different from the target of the click event synthesized
// by the browser. The target of a mouse/click event that is synthesized
// from a touch event seems to be implementation specific. For example,
// some browsers will fire mouse/click events for a link that is near
// a touch event, even though the target of the touchstart/touchend event
// says the user touched outside the link. Also, it seems that with most
// browsers, the target of the mouse/click event is not calculated until the
// time it is dispatched, so if you replace an element that you touched
// with another element, the target of the mouse/click will be the new
// element underneath that point.
//
// Aside from proximity, we also check to see if the target and any
// of its ancestors were the ones that blocked a click. This is necessary
// because of the strange mouse/click target calculation done in the
// Android 2.1 browser, where if you click on an element, and there is a
// mouse/click handler on one of its ancestors, the target will be the
// innermost child of the touched element, even if that child is no where
// near the point of touch.
ele = target;
while ( ele ) {
for ( i = 0; i < cnt; i++ ) {
o = clickBlockList[ i ];
touchID = 0;
if ( ( ele === target && Math.abs( o.x - x ) < threshold && Math.abs( o.y - y ) < threshold ) ||
$.data( ele, touchTargetPropertyName ) === o.touchID ) {
// XXX: We may want to consider removing matches from the block list
// instead of waiting for the reset timer to fire.
e.preventDefault();
e.stopPropagation();
return;
}
}
ele = ele.parentNode;
}
}
}, true);
}
})( jQuery, window, document );
(function( $, window, undefined ) {
var $document = $( document ),
supportTouch = $.mobile.support.touch,
scrollEvent = "touchmove scroll",
touchStartEvent = supportTouch ? "touchstart" : "mousedown",
touchStopEvent = supportTouch ? "touchend" : "mouseup",
touchMoveEvent = supportTouch ? "touchmove" : "mousemove";
// setup new event shortcuts
$.each( ( "touchstart touchmove touchend " +
"tap taphold " +
"swipe swipeleft swiperight " +
"scrollstart scrollstop" ).split( " " ), function( i, name ) {
$.fn[ name ] = function( fn ) {
return fn ? this.bind( name, fn ) : this.trigger( name );
};
// jQuery < 1.8
if ( $.attrFn ) {
$.attrFn[ name ] = true;
}
});
function triggerCustomEvent( obj, eventType, event ) {
var originalType = event.type;
event.type = eventType;
$.event.dispatch.call( obj, event );
event.type = originalType;
}
// also handles scrollstop
$.event.special.scrollstart = {
enabled: true,
setup: function() {
var thisObject = this,
$this = $( thisObject ),
scrolling,
timer;
function trigger( event, state ) {
scrolling = state;
triggerCustomEvent( thisObject, scrolling ? "scrollstart" : "scrollstop", event );
}
// iPhone triggers scroll after a small delay; use touchmove instead
$this.bind( scrollEvent, function( event ) {
if ( !$.event.special.scrollstart.enabled ) {
return;
}
if ( !scrolling ) {
trigger( event, true );
}
clearTimeout( timer );
timer = setTimeout( function() {
trigger( event, false );
}, 50 );
});
},
teardown: function() {
$( this ).unbind( scrollEvent );
}
};
// also handles taphold
$.event.special.tap = {
tapholdThreshold: 750,
emitTapOnTaphold: true,
setup: function() {
var thisObject = this,
$this = $( thisObject ),
isTaphold = false;
$this.bind( "vmousedown", function( event ) {
isTaphold = false;
if ( event.which && event.which !== 1 ) {
return false;
}
var origTarget = event.target,
timer;
function clearTapTimer() {
clearTimeout( timer );
}
function clearTapHandlers() {
clearTapTimer();
$this.unbind( "vclick", clickHandler )
.unbind( "vmouseup", clearTapTimer );
$document.unbind( "vmousecancel", clearTapHandlers );
}
function clickHandler( event ) {
clearTapHandlers();
// ONLY trigger a 'tap' event if the start target is
// the same as the stop target.
if ( !isTaphold && origTarget === event.target ) {
triggerCustomEvent( thisObject, "tap", event );
} else if ( isTaphold ) {
event.stopPropagation();
}
}
$this.bind( "vmouseup", clearTapTimer )
.bind( "vclick", clickHandler );
$document.bind( "vmousecancel", clearTapHandlers );
timer = setTimeout( function() {
if ( !$.event.special.tap.emitTapOnTaphold ) {
isTaphold = true;
}
triggerCustomEvent( thisObject, "taphold", $.Event( "taphold", { target: origTarget } ) );
}, $.event.special.tap.tapholdThreshold );
});
},
teardown: function() {
$( this ).unbind( "vmousedown" ).unbind( "vclick" ).unbind( "vmouseup" );
$document.unbind( "vmousecancel" );
}
};
// also handles swipeleft, swiperight
$.event.special.swipe = {
scrollSupressionThreshold: 30, // More than this horizontal displacement, and we will suppress scrolling.
durationThreshold: 1000, // More time than this, and it isn't a swipe.
horizontalDistanceThreshold: 30, // Swipe horizontal displacement must be more than this.
verticalDistanceThreshold: 75, // Swipe vertical displacement must be less than this.
start: function( event ) {
var data = event.originalEvent.touches ?
event.originalEvent.touches[ 0 ] : event;
return {
time: ( new Date() ).getTime(),
coords: [ data.pageX, data.pageY ],
origin: $( event.target )
};
},
stop: function( event ) {
var data = event.originalEvent.touches ?
event.originalEvent.touches[ 0 ] : event;
return {
time: ( new Date() ).getTime(),
coords: [ data.pageX, data.pageY ]
};
},
handleSwipe: function( start, stop, thisObject, origTarget ) {
if ( stop.time - start.time < $.event.special.swipe.durationThreshold &&
Math.abs( start.coords[ 0 ] - stop.coords[ 0 ] ) > $.event.special.swipe.horizontalDistanceThreshold &&
Math.abs( start.coords[ 1 ] - stop.coords[ 1 ] ) < $.event.special.swipe.verticalDistanceThreshold ) {
var direction = start.coords[0] > stop.coords[ 0 ] ? "swipeleft" : "swiperight";
triggerCustomEvent( thisObject, "swipe", $.Event( "swipe", { target: origTarget, swipestart: start, swipestop: stop }) );
triggerCustomEvent( thisObject, direction,$.Event( direction, { target: origTarget, swipestart: start, swipestop: stop } ) );
return true;
}
return false;
},
setup: function() {
var thisObject = this,
$this = $( thisObject );
$this.bind( touchStartEvent, function( event ) {
var stop,
start = $.event.special.swipe.start( event ),
origTarget = event.target,
emitted = false;
function moveHandler( event ) {
if ( !start ) {
return;
}
stop = $.event.special.swipe.stop( event );
if ( !emitted ) {
emitted = $.event.special.swipe.handleSwipe( start, stop, thisObject, origTarget );
}
// prevent scrolling
if ( Math.abs( start.coords[ 0 ] - stop.coords[ 0 ] ) > $.event.special.swipe.scrollSupressionThreshold ) {
event.preventDefault();
}
}
$this.bind( touchMoveEvent, moveHandler )
.one( touchStopEvent, function() {
emitted = true;
$this.unbind( touchMoveEvent, moveHandler );
});
});
},
teardown: function() {
$( this ).unbind( touchStartEvent ).unbind( touchMoveEvent ).unbind( touchStopEvent );
}
};
$.each({
scrollstop: "scrollstart",
taphold: "tap",
swipeleft: "swipe",
swiperight: "swipe"
}, function( event, sourceEvent ) {
$.event.special[ event ] = {
setup: function() {
$( this ).bind( sourceEvent, $.noop );
},
teardown: function() {
$( this ).unbind( sourceEvent );
}
};
});
})( jQuery, this );
// throttled resize event
(function( $ ) {
$.event.special.throttledresize = {
setup: function() {
$( this ).bind( "resize", handler );
},
teardown: function() {
$( this ).unbind( "resize", handler );
}
};
var throttle = 250,
handler = function() {
curr = ( new Date() ).getTime();
diff = curr - lastCall;
if ( diff >= throttle ) {
lastCall = curr;
$( this ).trigger( "throttledresize" );
} else {
if ( heldCall ) {
clearTimeout( heldCall );
}
// Promise a held call will still execute
heldCall = setTimeout( handler, throttle - diff );
}
},
lastCall = 0,
heldCall,
curr,
diff;
})( jQuery );
(function( $, window ) {
var win = $( window ),
event_name = "orientationchange",
get_orientation,
last_orientation,
initial_orientation_is_landscape,
initial_orientation_is_default,
portrait_map = { "0": true, "180": true },
ww, wh, landscape_threshold;
// It seems that some device/browser vendors use window.orientation values 0 and 180 to
// denote the "default" orientation. For iOS devices, and most other smart-phones tested,
// the default orientation is always "portrait", but in some Android and RIM based tablets,
// the default orientation is "landscape". The following code attempts to use the window
// dimensions to figure out what the current orientation is, and then makes adjustments
// to the to the portrait_map if necessary, so that we can properly decode the
// window.orientation value whenever get_orientation() is called.
//
// Note that we used to use a media query to figure out what the orientation the browser
// thinks it is in:
//
// initial_orientation_is_landscape = $.mobile.media("all and (orientation: landscape)");
//
// but there was an iPhone/iPod Touch bug beginning with iOS 4.2, up through iOS 5.1,
// where the browser *ALWAYS* applied the landscape media query. This bug does not
// happen on iPad.
if ( $.support.orientation ) {
// Check the window width and height to figure out what the current orientation
// of the device is at this moment. Note that we've initialized the portrait map
// values to 0 and 180, *AND* we purposely check for landscape so that if we guess
// wrong, , we default to the assumption that portrait is the default orientation.
// We use a threshold check below because on some platforms like iOS, the iPhone
// form-factor can report a larger width than height if the user turns on the
// developer console. The actual threshold value is somewhat arbitrary, we just
// need to make sure it is large enough to exclude the developer console case.
ww = window.innerWidth || win.width();
wh = window.innerHeight || win.height();
landscape_threshold = 50;
initial_orientation_is_landscape = ww > wh && ( ww - wh ) > landscape_threshold;
// Now check to see if the current window.orientation is 0 or 180.
initial_orientation_is_default = portrait_map[ window.orientation ];
// If the initial orientation is landscape, but window.orientation reports 0 or 180, *OR*
// if the initial orientation is portrait, but window.orientation reports 90 or -90, we
// need to flip our portrait_map values because landscape is the default orientation for
// this device/browser.
if ( ( initial_orientation_is_landscape && initial_orientation_is_default ) || ( !initial_orientation_is_landscape && !initial_orientation_is_default ) ) {
portrait_map = { "-90": true, "90": true };
}
}
$.event.special.orientationchange = $.extend( {}, $.event.special.orientationchange, {
setup: function() {
// If the event is supported natively, return false so that jQuery
// will bind to the event using DOM methods.
if ( $.support.orientation && !$.event.special.orientationchange.disabled ) {
return false;
}
// Get the current orientation to avoid initial double-triggering.
last_orientation = get_orientation();
// Because the orientationchange event doesn't exist, simulate the
// event by testing window dimensions on resize.
win.bind( "throttledresize", handler );
},
teardown: function() {
// If the event is not supported natively, return false so that
// jQuery will unbind the event using DOM methods.
if ( $.support.orientation && !$.event.special.orientationchange.disabled ) {
return false;
}
// Because the orientationchange event doesn't exist, unbind the
// resize event handler.
win.unbind( "throttledresize", handler );
},
add: function( handleObj ) {
// Save a reference to the bound event handler.
var old_handler = handleObj.handler;
handleObj.handler = function( event ) {
// Modify event object, adding the .orientation property.
event.orientation = get_orientation();
// Call the originally-bound event handler and return its result.
return old_handler.apply( this, arguments );
};
}
});
// If the event is not supported natively, this handler will be bound to
// the window resize event to simulate the orientationchange event.
function handler() {
// Get the current orientation.
var orientation = get_orientation();
if ( orientation !== last_orientation ) {
// The orientation has changed, so trigger the orientationchange event.
last_orientation = orientation;
win.trigger( event_name );
}
}
// Get the current page orientation. This method is exposed publicly, should it
// be needed, as jQuery.event.special.orientationchange.orientation()
$.event.special.orientationchange.orientation = get_orientation = function() {
var isPortrait = true, elem = document.documentElement;
// prefer window orientation to the calculation based on screensize as
// the actual screen resize takes place before or after the orientation change event
// has been fired depending on implementation (eg android 2.3 is before, iphone after).
// More testing is required to determine if a more reliable method of determining the new screensize
// is possible when orientationchange is fired. (eg, use media queries + element + opacity)
if ( $.support.orientation ) {
// if the window orientation registers as 0 or 180 degrees report
// portrait, otherwise landscape
isPortrait = portrait_map[ window.orientation ];
} else {
isPortrait = elem && elem.clientWidth / elem.clientHeight < 1.1;
}
return isPortrait ? "portrait" : "landscape";
};
$.fn[ event_name ] = function( fn ) {
return fn ? this.bind( event_name, fn ) : this.trigger( event_name );
};
// jQuery < 1.8
if ( $.attrFn ) {
$.attrFn[ event_name ] = true;
}
}( jQuery, this ));
(function( $, undefined ) {
// existing base tag?
var baseElement = $( "head" ).children( "base" ),
// base element management, defined depending on dynamic base tag support
// TODO move to external widget
base = {
// define base element, for use in routing asset urls that are referenced
// in Ajax-requested markup
element: ( baseElement.length ? baseElement :
$( "<base>", { href: $.mobile.path.documentBase.hrefNoHash } ).prependTo( $( "head" ) ) ),
linkSelector: "[src], link[href], a[rel='external'], :jqmData(ajax='false'), a[target]",
// set the generated BASE element's href to a new page's base path
set: function( href ) {
// we should do nothing if the user wants to manage their url base
// manually
if ( !$.mobile.dynamicBaseEnabled ) {
return;
}
// we should use the base tag if we can manipulate it dynamically
if ( $.support.dynamicBaseTag ) {
base.element.attr( "href",
$.mobile.path.makeUrlAbsolute( href, $.mobile.path.documentBase ) );
}
},
rewrite: function( href, page ) {
var newPath = $.mobile.path.get( href );
page.find( base.linkSelector ).each(function( i, link ) {
var thisAttr = $( link ).is( "[href]" ) ? "href" :
$( link ).is( "[src]" ) ? "src" : "action",
thisUrl = $( link ).attr( thisAttr );
// XXX_jblas: We need to fix this so that it removes the document
// base URL, and then prepends with the new page URL.
// if full path exists and is same, chop it - helps IE out
thisUrl = thisUrl.replace( location.protocol + "//" +
location.host + location.pathname, "" );
if ( !/^(\w+:|#|\/)/.test( thisUrl ) ) {
$( link ).attr( thisAttr, newPath + thisUrl );
}
});
},
// set the generated BASE element's href to a new page's base path
reset: function(/* href */) {
base.element.attr( "href", $.mobile.path.documentBase.hrefNoSearch );
}
};
$.mobile.base = base;
})( jQuery );
(function( $, undefined ) {
$.mobile.widgets = {};
var originalWidget = $.widget,
// Record the original, non-mobileinit-modified version of $.mobile.keepNative
// so we can later determine whether someone has modified $.mobile.keepNative
keepNativeFactoryDefault = $.mobile.keepNative;
$.widget = (function( orig ) {
return function() {
var constructor = orig.apply( this, arguments ),
name = constructor.prototype.widgetName;
constructor.initSelector = ( ( constructor.prototype.initSelector !== undefined ) ?
constructor.prototype.initSelector : ":jqmData(role='" + name + "')" );
$.mobile.widgets[ name ] = constructor;
return constructor;
};
})( $.widget );
// Make sure $.widget still has bridge and extend methods
$.extend( $.widget, originalWidget );
// For backcompat remove in 1.5
$.mobile.document.on( "create", function( event ) {
$( event.target ).enhanceWithin();
});
$.widget( "mobile.page", {
options: {
theme: "a",
domCache: false,
// Deprecated in 1.4 remove in 1.5
keepNativeDefault: $.mobile.keepNative,
// Deprecated in 1.4 remove in 1.5
contentTheme: null,
enhanced: false
},
// DEPRECATED for > 1.4
// TODO remove at 1.5
_createWidget: function() {
$.Widget.prototype._createWidget.apply( this, arguments );
this._trigger( "init" );
},
_create: function() {
// If false is returned by the callbacks do not create the page
if ( this._trigger( "beforecreate" ) === false ) {
return false;
}
if ( !this.options.enhanced ) {
this._enhance();
}
this._on( this.element, {
pagebeforehide: "removeContainerBackground",
pagebeforeshow: "_handlePageBeforeShow"
});
this.element.enhanceWithin();
// Dialog widget is deprecated in 1.4 remove this in 1.5
if ( $.mobile.getAttribute( this.element[0], "role" ) === "dialog" && $.mobile.dialog ) {
this.element.dialog();
}
},
_enhance: function () {
var attrPrefix = "data-" + $.mobile.ns,
self = this;
if ( this.options.role ) {
this.element.attr( "data-" + $.mobile.ns + "role", this.options.role );
}
this.element
.attr( "tabindex", "0" )
.addClass( "ui-page ui-page-theme-" + this.options.theme );
// Manipulation of content os Deprecated as of 1.4 remove in 1.5
this.element.find( "[" + attrPrefix + "role='content']" ).each( function() {
var $this = $( this ),
theme = this.getAttribute( attrPrefix + "theme" ) || undefined;
self.options.contentTheme = theme || self.options.contentTheme || ( self.options.dialog && self.options.theme ) || ( self.element.jqmData("role") === "dialog" && self.options.theme );
$this.addClass( "ui-content" );
if ( self.options.contentTheme ) {
$this.addClass( "ui-body-" + ( self.options.contentTheme ) );
}
// Add ARIA role
$this.attr( "role", "main" ).addClass( "ui-content" );
});
},
bindRemove: function( callback ) {
var page = this.element;
// when dom caching is not enabled or the page is embedded bind to remove the page on hide
if ( !page.data( "mobile-page" ).options.domCache &&
page.is( ":jqmData(external-page='true')" ) ) {
// TODO use _on - that is, sort out why it doesn't work in this case
page.bind( "pagehide.remove", callback || function( e, data ) {
//check if this is a same page transition and if so don't remove the page
if( !data.samePage ){
var $this = $( this ),
prEvent = new $.Event( "pageremove" );
$this.trigger( prEvent );
if ( !prEvent.isDefaultPrevented() ) {
$this.removeWithDependents();
}
}
});
}
},
_setOptions: function( o ) {
if ( o.theme !== undefined ) {
this.element.removeClass( "ui-body-" + this.options.theme ).addClass( "ui-body-" + o.theme );
}
if ( o.contentTheme !== undefined ) {
this.element.find( "[data-" + $.mobile.ns + "='content']" ).removeClass( "ui-body-" + this.options.contentTheme )
.addClass( "ui-body-" + o.contentTheme );
}
},
_handlePageBeforeShow: function(/* e */) {
this.setContainerBackground();
},
// Deprecated in 1.4 remove in 1.5
removeContainerBackground: function() {
this.element.closest( ":mobile-pagecontainer" ).pagecontainer({ "theme": "none" });
},
// Deprecated in 1.4 remove in 1.5
// set the page container background to the page theme
setContainerBackground: function( theme ) {
this.element.parent().pagecontainer( { "theme": theme || this.options.theme } );
},
// Deprecated in 1.4 remove in 1.5
keepNativeSelector: function() {
var options = this.options,
keepNative = $.trim( options.keepNative || "" ),
globalValue = $.trim( $.mobile.keepNative ),
optionValue = $.trim( options.keepNativeDefault ),
// Check if $.mobile.keepNative has changed from the factory default
newDefault = ( keepNativeFactoryDefault === globalValue ?
"" : globalValue ),
// If $.mobile.keepNative has not changed, use options.keepNativeDefault
oldDefault = ( newDefault === "" ? optionValue : "" );
// Concatenate keepNative selectors from all sources where the value has
// changed or, if nothing has changed, return the default
return ( ( keepNative ? [ keepNative ] : [] )
.concat( newDefault ? [ newDefault ] : [] )
.concat( oldDefault ? [ oldDefault ] : [] )
.join( ", " ) );
}
});
})( jQuery );
(function( $, undefined ) {
$.widget( "mobile.pagecontainer", {
options: {
theme: "a"
},
initSelector: false,
_create: function() {
this.setLastScrollEnabled = true;
// TODO consider moving the navigation handler OUT of widget into
// some other object as glue between the navigate event and the
// content widget load and change methods
this._on( this.window, { navigate: "_filterNavigateEvents" });
this._on( this.window, {
// disable an scroll setting when a hashchange has been fired,
// this only works because the recording of the scroll position
// is delayed for 100ms after the browser might have changed the
// position because of the hashchange
navigate: "_disableRecordScroll",
// bind to scrollstop for the first page, "pagechange" won't be
// fired in that case
scrollstop: "_delayedRecordScroll"
});
// TODO move from page* events to content* events
this._on({ pagechange: "_afterContentChange" });
// handle initial hashchange from chrome :(
this.window.one( "navigate", $.proxy(function() {
this.setLastScrollEnabled = true;
}, this));
},
_setOptions: function( options ) {
if ( options.theme !== undefined && options.theme !== "none" ) {
this.element.removeClass( "ui-overlay-" + this.options.theme )
.addClass( "ui-overlay-" + options.theme );
} else if ( options.theme !== undefined ) {
this.element.removeClass( "ui-overlay-" + this.options.theme );
}
this._super( options );
},
_disableRecordScroll: function() {
this.setLastScrollEnabled = false;
},
_enableRecordScroll: function() {
this.setLastScrollEnabled = true;
},
// TODO consider the name here, since it's purpose specific
_afterContentChange: function() {
// once the page has changed, re-enable the scroll recording
this.setLastScrollEnabled = true;
// remove any binding that previously existed on the get scroll
// which may or may not be different than the scroll element
// determined for this page previously
this._off( this.window, "scrollstop" );
// determine and bind to the current scoll element which may be the
// window or in the case of touch overflow the element touch overflow
this._on( this.window, { scrollstop: "_delayedRecordScroll" });
},
_recordScroll: function() {
// this barrier prevents setting the scroll value based on
// the browser scrolling the window based on a hashchange
if ( !this.setLastScrollEnabled ) {
return;
}
var active = this._getActiveHistory(),
currentScroll, minScroll, defaultScroll;
if ( active ) {
currentScroll = this._getScroll();
minScroll = this._getMinScroll();
defaultScroll = this._getDefaultScroll();
// Set active page's lastScroll prop. If the location we're
// scrolling to is less than minScrollBack, let it go.
active.lastScroll = currentScroll < minScroll ? defaultScroll : currentScroll;
}
},
_delayedRecordScroll: function() {
setTimeout( $.proxy(this, "_recordScroll"), 100 );
},
_getScroll: function() {
return this.window.scrollTop();
},
_getMinScroll: function() {
return $.mobile.minScrollBack;
},
_getDefaultScroll: function() {
return $.mobile.defaultHomeScroll;
},
_filterNavigateEvents: function( e, data ) {
var url;
if ( e.originalEvent && e.originalEvent.isDefaultPrevented() ) {
return;
}
url = e.originalEvent.type.indexOf( "hashchange" ) > -1 ? data.state.hash : data.state.url;
if ( !url ) {
url = this._getHash();
}
if ( !url || url === "#" || url.indexOf( "#" + $.mobile.path.uiStateKey ) === 0 ) {
url = location.href;
}
this._handleNavigate( url, data.state );
},
_getHash: function() {
return $.mobile.path.parseLocation().hash;
},
// TODO active page should be managed by the container (ie, it should be a property)
getActivePage: function() {
return this.activePage;
},
// TODO the first page should be a property set during _create using the logic
// that currently resides in init
_getInitialContent: function() {
return $.mobile.firstPage;
},
// TODO each content container should have a history object
_getHistory: function() {
return $.mobile.navigate.history;
},
// TODO use _getHistory
_getActiveHistory: function() {
return $.mobile.navigate.history.getActive();
},
// TODO the document base should be determined at creation
_getDocumentBase: function() {
return $.mobile.path.documentBase;
},
back: function() {
this.go( -1 );
},
forward: function() {
this.go( 1 );
},
go: function( steps ) {
//if hashlistening is enabled use native history method
if ( $.mobile.hashListeningEnabled ) {
window.history.go( steps );
} else {
//we are not listening to the hash so handle history internally
var activeIndex = $.mobile.navigate.history.activeIndex,
index = activeIndex + parseInt( steps, 10 ),
url = $.mobile.navigate.history.stack[ index ].url,
direction = ( steps >= 1 )? "forward" : "back";
//update the history object
$.mobile.navigate.history.activeIndex = index;
$.mobile.navigate.history.previousIndex = activeIndex;
//change to the new page
this.change( url, { direction: direction, changeHash: false, fromHashChange: true } );
}
},
// TODO rename _handleDestination
_handleDestination: function( to ) {
var history;
// clean the hash for comparison if it's a url
if ( $.type(to) === "string" ) {
to = $.mobile.path.stripHash( to );
}
if ( to ) {
history = this._getHistory();
// At this point, 'to' can be one of 3 things, a cached page
// element from a history stack entry, an id, or site-relative /
// absolute URL. If 'to' is an id, we need to resolve it against
// the documentBase, not the location.href, since the hashchange
// could've been the result of a forward/backward navigation
// that crosses from an external page/dialog to an internal
// page/dialog.
//
// TODO move check to history object or path object?
to = !$.mobile.path.isPath( to ) ? ( $.mobile.path.makeUrlAbsolute( "#" + to, this._getDocumentBase() ) ) : to;
// If we're about to go to an initial URL that contains a
// reference to a non-existent internal page, go to the first
// page instead. We know that the initial hash refers to a
// non-existent page, because the initial hash did not end
// up in the initial history entry
// TODO move check to history object?
if ( to === $.mobile.path.makeUrlAbsolute( "#" + history.initialDst, this._getDocumentBase() ) &&
history.stack.length &&
history.stack[0].url !== history.initialDst.replace( $.mobile.dialogHashKey, "" ) ) {
to = this._getInitialContent();
}
}
return to || this._getInitialContent();
},
_handleDialog: function( changePageOptions, data ) {
var to, active, activeContent = this.getActivePage();
// If current active page is not a dialog skip the dialog and continue
// in the same direction
if ( activeContent && !activeContent.hasClass( "ui-dialog" ) ) {
// determine if we're heading forward or backward and continue
// accordingly past the current dialog
if ( data.direction === "back" ) {
this.back();
} else {
this.forward();
}
// prevent changePage call
return false;
} else {
// if the current active page is a dialog and we're navigating
// to a dialog use the dialog objected saved in the stack
to = data.pageUrl;
active = this._getActiveHistory();
// make sure to set the role, transition and reversal
// as most of this is lost by the domCache cleaning
$.extend( changePageOptions, {
role: active.role,
transition: active.transition,
reverse: data.direction === "back"
});
}
return to;
},
_handleNavigate: function( url, data ) {
//find first page via hash
// TODO stripping the hash twice with handleUrl
var to = $.mobile.path.stripHash( url ), history = this._getHistory(),
// transition is false if it's the first page, undefined
// otherwise (and may be overridden by default)
transition = history.stack.length === 0 ? "none" : undefined,
// default options for the changPage calls made after examining
// the current state of the page and the hash, NOTE that the
// transition is derived from the previous history entry
changePageOptions = {
changeHash: false,
fromHashChange: true,
reverse: data.direction === "back"
};
$.extend( changePageOptions, data, {
transition: ( history.getLast() || {} ).transition || transition
});
// TODO move to _handleDestination ?
// If this isn't the first page, if the current url is a dialog hash
// key, and the initial destination isn't equal to the current target
// page, use the special dialog handling
if ( history.activeIndex > 0 &&
to.indexOf( $.mobile.dialogHashKey ) > -1 &&
history.initialDst !== to ) {
to = this._handleDialog( changePageOptions, data );
if ( to === false ) {
return;
}
}
this._changeContent( this._handleDestination( to ), changePageOptions );
},
_changeContent: function( to, opts ) {
$.mobile.changePage( to, opts );
},
_getBase: function() {
return $.mobile.base;
},
_getNs: function() {
return $.mobile.ns;
},
_enhance: function( content, role ) {
// TODO consider supporting a custom callback, and passing in
// the settings which includes the role
return content.page({ role: role });
},
_include: function( page, settings ) {
// append to page and enhance
page.appendTo( this.element );
// use the page widget to enhance
this._enhance( page, settings.role );
// remove page on hide
page.page( "bindRemove" );
},
_find: function( absUrl ) {
// TODO consider supporting a custom callback
var fileUrl = this._createFileUrl( absUrl ),
dataUrl = this._createDataUrl( absUrl ),
page, initialContent = this._getInitialContent();
// Check to see if the page already exists in the DOM.
// NOTE do _not_ use the :jqmData pseudo selector because parenthesis
// are a valid url char and it breaks on the first occurence
page = this.element
.children( "[data-" + this._getNs() +"url='" + dataUrl + "']" );
// If we failed to find the page, check to see if the url is a
// reference to an embedded page. If so, it may have been dynamically
// injected by a developer, in which case it would be lacking a
// data-url attribute and in need of enhancement.
if ( page.length === 0 && dataUrl && !$.mobile.path.isPath( dataUrl ) ) {
page = this.element.children( $.mobile.path.hashToSelector("#" + dataUrl) )
.attr( "data-" + this._getNs() + "url", dataUrl )
.jqmData( "url", dataUrl );
}
// If we failed to find a page in the DOM, check the URL to see if it
// refers to the first page in the application. Also check to make sure
// our cached-first-page is actually in the DOM. Some user deployed
// apps are pruning the first page from the DOM for various reasons.
// We check for this case here because we don't want a first-page with
// an id falling through to the non-existent embedded page error case.
if ( page.length === 0 &&
$.mobile.path.isFirstPageUrl( fileUrl ) &&
initialContent &&
initialContent.parent().length ) {
page = $( initialContent );
}
return page;
},
_getLoader: function() {
return $.mobile.loading();
},
_showLoading: function( delay, theme, msg, textonly ) {
// This configurable timeout allows cached pages a brief
// delay to load without showing a message
if ( this._loadMsg ) {
return;
}
this._loadMsg = setTimeout($.proxy(function() {
this._getLoader().loader( "show", theme, msg, textonly );
this._loadMsg = 0;
}, this), delay );
},
_hideLoading: function() {
// Stop message show timer
clearTimeout( this._loadMsg );
this._loadMsg = 0;
// Hide loading message
this._getLoader().loader( "hide" );
},
_showError: function() {
// make sure to remove the current loading message
this._hideLoading();
// show the error message
this._showLoading( 0, $.mobile.pageLoadErrorMessageTheme, $.mobile.pageLoadErrorMessage, true );
// hide the error message after a delay
// TODO configuration
setTimeout( $.proxy(this, "_hideLoading"), 1500 );
},
_parse: function( html, fileUrl ) {
// TODO consider allowing customization of this method. It's very JQM specific
var page, all = $( "<div></div>" );
//workaround to allow scripts to execute when included in page divs
all.get( 0 ).innerHTML = html;
page = all.find( ":jqmData(role='page'), :jqmData(role='dialog')" ).first();
//if page elem couldn't be found, create one and insert the body element's contents
if ( !page.length ) {
page = $( "<div data-" + this._getNs() + "role='page'>" +
( html.split( /<\/?body[^>]*>/gmi )[1] || "" ) +
"</div>" );
}
// TODO tagging a page with external to make sure that embedded pages aren't
// removed by the various page handling code is bad. Having page handling code
// in many places is bad. Solutions post 1.0
page.attr( "data-" + this._getNs() + "url", $.mobile.path.convertUrlToDataUrl(fileUrl) )
.attr( "data-" + this._getNs() + "external-page", true );
return page;
},
_setLoadedTitle: function( page, html ) {
//page title regexp
var newPageTitle = html.match( /<title[^>]*>([^<]*)/ ) && RegExp.$1;
if ( newPageTitle && !page.jqmData("title") ) {
newPageTitle = $( "<div>" + newPageTitle + "</div>" ).text();
page.jqmData( "title", newPageTitle );
}
},
_isRewritableBaseTag: function() {
return $.mobile.dynamicBaseEnabled && !$.support.dynamicBaseTag;
},
_createDataUrl: function( absoluteUrl ) {
return $.mobile.path.convertUrlToDataUrl( absoluteUrl );
},
_createFileUrl: function( absoluteUrl ) {
return $.mobile.path.getFilePath( absoluteUrl );
},
_triggerWithDeprecated: function( name, data, page ) {
var deprecatedEvent = $.Event( "page" + name ),
newEvent = $.Event( this.widgetName + name );
// DEPRECATED
// trigger the old deprecated event on the page if it's provided
( page || this.element ).trigger( deprecatedEvent, data );
// use the widget trigger method for the new content* event
this.element.trigger( newEvent, data );
return {
deprecatedEvent: deprecatedEvent,
event: newEvent
};
},
// TODO it would be nice to split this up more but everything appears to be "one off"
// or require ordering such that other bits are sprinkled in between parts that
// could be abstracted out as a group
_loadSuccess: function( absUrl, triggerData, settings, deferred ) {
var fileUrl = this._createFileUrl( absUrl ),
dataUrl = this._createDataUrl( absUrl );
return $.proxy(function( html, textStatus, xhr ) {
//pre-parse html to check for a data-url,
//use it as the new fileUrl, base path, etc
var content,
// TODO handle dialogs again
pageElemRegex = new RegExp( "(<[^>]+\\bdata-" + this._getNs() + "role=[\"']?page[\"']?[^>]*>)" ),
dataUrlRegex = new RegExp( "\\bdata-" + this._getNs() + "url=[\"']?([^\"'>]*)[\"']?" );
// data-url must be provided for the base tag so resource requests
// can be directed to the correct url. loading into a temprorary
// element makes these requests immediately
if ( pageElemRegex.test( html ) &&
RegExp.$1 &&
dataUrlRegex.test( RegExp.$1 ) &&
RegExp.$1 ) {
fileUrl = $.mobile.path.getFilePath( $("<div>" + RegExp.$1 + "</div>").text() );
}
//dont update the base tag if we are prefetching
if ( settings.prefetch === undefined ) {
this._getBase().set( fileUrl );
}
content = this._parse( html, fileUrl );
this._setLoadedTitle( content, html );
// Add the content reference and xhr to our triggerData.
triggerData.xhr = xhr;
triggerData.textStatus = textStatus;
// DEPRECATED
triggerData.page = content;
triggerData.content = content;
// If the default behavior is prevented, stop here!
// Note that it is the responsibility of the listener/handler
// that called preventDefault(), to resolve/reject the
// deferred object within the triggerData.
if ( !this._trigger( "load", undefined, triggerData ) ) {
return;
}
// rewrite src and href attrs to use a base url if the base tag won't work
if ( this._isRewritableBaseTag() && content ) {
this._getBase().rewrite( fileUrl, content );
}
this._include( content, settings );
// Enhancing the content may result in new dialogs/sub content being inserted
// into the DOM. If the original absUrl refers to a sub-content, that is the
// real content we are interested in.
if ( absUrl.indexOf( "&" + $.mobile.subPageUrlKey ) > -1 ) {
content = this.element.children( "[data-" + this._getNs() +"url='" + dataUrl + "']" );
}
// Remove loading message.
if ( settings.showLoadMsg ) {
this._hideLoading();
}
// BEGIN DEPRECATED ---------------------------------------------------
// Let listeners know the content loaded successfully.
this.element.trigger( "pageload" );
// END DEPRECATED -----------------------------------------------------
deferred.resolve( absUrl, settings, content );
}, this);
},
_loadDefaults: {
type: "get",
data: undefined,
// DEPRECATED
reloadPage: false,
reload: false,
// By default we rely on the role defined by the @data-role attribute.
role: undefined,
showLoadMsg: false,
// This delay allows loads that pull from browser cache to
// occur without showing the loading message.
loadMsgDelay: 50
},
load: function( url, options ) {
// This function uses deferred notifications to let callers
// know when the content is done loading, or if an error has occurred.
var deferred = ( options && options.deferred ) || $.Deferred(),
// The default load options with overrides specified by the caller.
settings = $.extend( {}, this._loadDefaults, options ),
// The DOM element for the content after it has been loaded.
content = null,
// The absolute version of the URL passed into the function. This
// version of the URL may contain dialog/subcontent params in it.
absUrl = $.mobile.path.makeUrlAbsolute( url, this._findBaseWithDefault() ),
fileUrl, dataUrl, pblEvent, triggerData;
// DEPRECATED reloadPage
settings.reload = settings.reloadPage;
// If the caller provided data, and we're using "get" request,
// append the data to the URL.
if ( settings.data && settings.type === "get" ) {
absUrl = $.mobile.path.addSearchParams( absUrl, settings.data );
settings.data = undefined;
}
// If the caller is using a "post" request, reload must be true
if ( settings.data && settings.type === "post" ) {
settings.reload = true;
}
// The absolute version of the URL minus any dialog/subcontent params.
// In otherwords the real URL of the content to be loaded.
fileUrl = this._createFileUrl( absUrl );
// The version of the Url actually stored in the data-url attribute of
// the content. For embedded content, it is just the id of the page. For
// content within the same domain as the document base, it is the site
// relative path. For cross-domain content (Phone Gap only) the entire
// absolute Url is used to load the content.
dataUrl = this._createDataUrl( absUrl );
content = this._find( absUrl );
// If it isn't a reference to the first content and refers to missing
// embedded content reject the deferred and return
if ( content.length === 0 &&
$.mobile.path.isEmbeddedPage(fileUrl) &&
!$.mobile.path.isFirstPageUrl(fileUrl) ) {
deferred.reject( absUrl, settings );
return;
}
// Reset base to the default document base
// TODO figure out why we doe this
this._getBase().reset();
// If the content we are interested in is already in the DOM,
// and the caller did not indicate that we should force a
// reload of the file, we are done. Resolve the deferrred so that
// users can bind to .done on the promise
if ( content.length && !settings.reload ) {
this._enhance( content, settings.role );
deferred.resolve( absUrl, settings, content );
//if we are reloading the content make sure we update
// the base if its not a prefetch
if ( !settings.prefetch ) {
this._getBase().set(url);
}
return;
}
triggerData = {
url: url,
absUrl: absUrl,
dataUrl: dataUrl,
deferred: deferred,
options: settings
};
// Let listeners know we're about to load content.
pblEvent = this._triggerWithDeprecated( "beforeload", triggerData );
// If the default behavior is prevented, stop here!
if ( pblEvent.deprecatedEvent.isDefaultPrevented() ||
pblEvent.event.isDefaultPrevented() ) {
return;
}
if ( settings.showLoadMsg ) {
this._showLoading( settings.loadMsgDelay );
}
// Reset base to the default document base.
// only reset if we are not prefetching
if ( settings.prefetch === undefined ) {
this._getBase().reset();
}
if ( !( $.mobile.allowCrossDomainPages ||
$.mobile.path.isSameDomain($.mobile.path.documentUrl, absUrl ) ) ) {
deferred.reject( absUrl, settings );
return;
}
// Load the new content.
$.ajax({
url: fileUrl,
type: settings.type,
data: settings.data,
contentType: settings.contentType,
dataType: "html",
success: this._loadSuccess( absUrl, triggerData, settings, deferred ),
error: this._loadError( absUrl, triggerData, settings, deferred )
});
},
_loadError: function( absUrl, triggerData, settings, deferred ) {
return $.proxy(function( xhr, textStatus, errorThrown ) {
//set base back to current path
this._getBase().set( $.mobile.path.get() );
// Add error info to our triggerData.
triggerData.xhr = xhr;
triggerData.textStatus = textStatus;
triggerData.errorThrown = errorThrown;
// Let listeners know the page load failed.
var plfEvent = this._triggerWithDeprecated( "loadfailed", triggerData );
// If the default behavior is prevented, stop here!
// Note that it is the responsibility of the listener/handler
// that called preventDefault(), to resolve/reject the
// deferred object within the triggerData.
if ( plfEvent.deprecatedEvent.isDefaultPrevented() ||
plfEvent.event.isDefaultPrevented() ) {
return;
}
// Remove loading message.
if ( settings.showLoadMsg ) {
this._showError();
}
deferred.reject( absUrl, settings );
}, this);
},
_getTransitionHandler: function( transition ) {
transition = $.mobile._maybeDegradeTransition( transition );
//find the transition handler for the specified transition. If there
//isn't one in our transitionHandlers dictionary, use the default one.
//call the handler immediately to kick-off the transition.
return $.mobile.transitionHandlers[ transition ] || $.mobile.defaultTransitionHandler;
},
// TODO move into transition handlers?
_triggerCssTransitionEvents: function( to, from, prefix ) {
var samePage = false;
prefix = prefix || "";
// TODO decide if these events should in fact be triggered on the container
if ( from ) {
//Check if this is a same page transition and tell the handler in page
if( to[0] === from[0] ){
samePage = true;
}
//trigger before show/hide events
// TODO deprecate nextPage in favor of next
this._triggerWithDeprecated( prefix + "hide", { nextPage: to, samePage: samePage }, from );
}
// TODO deprecate prevPage in favor of previous
this._triggerWithDeprecated( prefix + "show", { prevPage: from || $( "" ) }, to );
},
// TODO make private once change has been defined in the widget
_cssTransition: function( to, from, options ) {
var transition = options.transition,
reverse = options.reverse,
deferred = options.deferred,
TransitionHandler,
promise;
this._triggerCssTransitionEvents( to, from, "before" );
// TODO put this in a binding to events *outside* the widget
this._hideLoading();
TransitionHandler = this._getTransitionHandler( transition );
promise = ( new TransitionHandler( transition, reverse, to, from ) ).transition();
// TODO temporary accomodation of argument deferred
promise.done(function() {
deferred.resolve.apply( deferred, arguments );
});
promise.done($.proxy(function() {
this._triggerCssTransitionEvents( to, from );
}, this));
},
_releaseTransitionLock: function() {
//release transition lock so navigation is free again
isPageTransitioning = false;
if ( pageTransitionQueue.length > 0 ) {
$.mobile.changePage.apply( null, pageTransitionQueue.pop() );
}
},
_removeActiveLinkClass: function( force ) {
//clear out the active button state
$.mobile.removeActiveLinkClass( force );
},
_loadUrl: function( to, triggerData, settings ) {
// preserve the original target as the dataUrl value will be
// simplified eg, removing ui-state, and removing query params
// from the hash this is so that users who want to use query
// params have access to them in the event bindings for the page
// life cycle See issue #5085
settings.target = to;
settings.deferred = $.Deferred();
this.load( to, settings );
settings.deferred.done($.proxy(function( url, options, content ) {
isPageTransitioning = false;
// store the original absolute url so that it can be provided
// to events in the triggerData of the subsequent changePage call
options.absUrl = triggerData.absUrl;
this.transition( content, triggerData, options );
}, this));
settings.deferred.fail($.proxy(function(/* url, options */) {
this._removeActiveLinkClass( true );
this._releaseTransitionLock();
this._triggerWithDeprecated( "changefailed", triggerData );
}, this));
},
_triggerPageBeforeChange: function( to, triggerData, settings ) {
var pbcEvent = new $.Event( "pagebeforechange" );
$.extend(triggerData, { toPage: to, options: settings });
// NOTE: preserve the original target as the dataUrl value will be
// simplified eg, removing ui-state, and removing query params from
// the hash this is so that users who want to use query params have
// access to them in the event bindings for the page life cycle
// See issue #5085
if ( $.type(to) === "string" ) {
// if the toPage is a string simply convert it
triggerData.absUrl = $.mobile.path.makeUrlAbsolute( to, this._findBaseWithDefault() );
} else {
// if the toPage is a jQuery object grab the absolute url stored
// in the loadPage callback where it exists
triggerData.absUrl = settings.absUrl;
}
// Let listeners know we're about to change the current page.
this.element.trigger( pbcEvent, triggerData );
// If the default behavior is prevented, stop here!
if ( pbcEvent.isDefaultPrevented() ) {
return false;
}
return true;
},
change: function( to, options ) {
// If we are in the midst of a transition, queue the current request.
// We'll call changePage() once we're done with the current transition
// to service the request.
if ( isPageTransitioning ) {
pageTransitionQueue.unshift( arguments );
return;
}
var settings = $.extend( {}, $.mobile.changePage.defaults, options ),
triggerData = {};
// Make sure we have a fromPage.
settings.fromPage = settings.fromPage || this.activePage;
// if the page beforechange default is prevented return early
if ( !this._triggerPageBeforeChange(to, triggerData, settings) ) {
return;
}
// We allow "pagebeforechange" observers to modify the to in
// the trigger data to allow for redirects. Make sure our to is
// updated. We also need to re-evaluate whether it is a string,
// because an object can also be replaced by a string
to = triggerData.toPage;
// If the caller passed us a url, call loadPage()
// to make sure it is loaded into the DOM. We'll listen
// to the promise object it returns so we know when
// it is done loading or if an error ocurred.
if ( $.type(to) === "string" ) {
// Set the isPageTransitioning flag to prevent any requests from
// entering this method while we are in the midst of loading a page
// or transitioning.
isPageTransitioning = true;
this._loadUrl( to, triggerData, settings );
} else {
this.transition( to, triggerData, settings );
}
},
transition: function( toPage, triggerData, settings ) {
var fromPage, url, pageUrl, fileUrl,
active, activeIsInitialPage,
historyDir, pageTitle, isDialog,
alreadyThere, newPageTitle,
params, cssTransitionDeferred,
beforeTransition;
// If we are in the midst of a transition, queue the current request.
// We'll call changePage() once we're done with the current transition
// to service the request.
if ( isPageTransitioning ) {
// make sure to only queue the to and settings values so the arguments
// work with a call to the change method
pageTransitionQueue.unshift( [toPage, settings] );
return;
}
// DEPRECATED - this call only, in favor of the before transition
// if the page beforechange default is prevented return early
if ( !this._triggerPageBeforeChange(toPage, triggerData, settings) ) {
return;
}
// if the (content|page)beforetransition default is prevented return early
// Note, we have to check for both the deprecated and new events
beforeTransition = this._triggerWithDeprecated( "beforetransition", triggerData );
if (beforeTransition.deprecatedEvent.isDefaultPrevented() ||
beforeTransition.event.isDefaultPrevented() ) {
return;
}
// Set the isPageTransitioning flag to prevent any requests from
// entering this method while we are in the midst of loading a page
// or transitioning.
isPageTransitioning = true;
// If we are going to the first-page of the application, we need to make
// sure settings.dataUrl is set to the application document url. This allows
// us to avoid generating a document url with an id hash in the case where the
// first-page of the document has an id attribute specified.
if ( toPage[ 0 ] === $.mobile.firstPage[ 0 ] && !settings.dataUrl ) {
settings.dataUrl = $.mobile.path.documentUrl.hrefNoHash;
}
// The caller passed us a real page DOM element. Update our
// internal state and then trigger a transition to the page.
fromPage = settings.fromPage;
url = ( settings.dataUrl && $.mobile.path.convertUrlToDataUrl(settings.dataUrl) ) ||
toPage.jqmData( "url" );
// The pageUrl var is usually the same as url, except when url is obscured
// as a dialog url. pageUrl always contains the file path
pageUrl = url;
fileUrl = $.mobile.path.getFilePath( url );
active = $.mobile.navigate.history.getActive();
activeIsInitialPage = $.mobile.navigate.history.activeIndex === 0;
historyDir = 0;
pageTitle = document.title;
isDialog = ( settings.role === "dialog" ||
toPage.jqmData( "role" ) === "dialog" ) &&
toPage.jqmData( "dialog" ) !== true;
// By default, we prevent changePage requests when the fromPage and toPage
// are the same element, but folks that generate content
// manually/dynamically and reuse pages want to be able to transition to
// the same page. To allow this, they will need to change the default
// value of allowSamePageTransition to true, *OR*, pass it in as an
// option when they manually call changePage(). It should be noted that
// our default transition animations assume that the formPage and toPage
// are different elements, so they may behave unexpectedly. It is up to
// the developer that turns on the allowSamePageTransitiona option to
// either turn off transition animations, or make sure that an appropriate
// animation transition is used.
if ( fromPage && fromPage[0] === toPage[0] &&
!settings.allowSamePageTransition ) {
isPageTransitioning = false;
this._triggerWithDeprecated( "transition", triggerData );
this.element.trigger( "pagechange", triggerData );
// Even if there is no page change to be done, we should keep the
// urlHistory in sync with the hash changes
if ( settings.fromHashChange ) {
$.mobile.navigate.history.direct({ url: url });
}
return;
}
// We need to make sure the page we are given has already been enhanced.
toPage.page({ role: settings.role });
// If the changePage request was sent from a hashChange event, check to
// see if the page is already within the urlHistory stack. If so, we'll
// assume the user hit the forward/back button and will try to match the
// transition accordingly.
if ( settings.fromHashChange ) {
historyDir = settings.direction === "back" ? -1 : 1;
}
// Kill the keyboard.
// XXX_jblas: We need to stop crawling the entire document to kill focus.
// Instead, we should be tracking focus with a delegate()
// handler so we already have the element in hand at this
// point.
// Wrap this in a try/catch block since IE9 throw "Unspecified error" if
// document.activeElement is undefined when we are in an IFrame.
try {
if ( document.activeElement &&
document.activeElement.nodeName.toLowerCase() !== "body" ) {
$( document.activeElement ).blur();
} else {
$( "input:focus, textarea:focus, select:focus" ).blur();
}
} catch( e ) {}
// Record whether we are at a place in history where a dialog used to be -
// if so, do not add a new history entry and do not change the hash either
alreadyThere = false;
// If we're displaying the page as a dialog, we don't want the url
// for the dialog content to be used in the hash. Instead, we want
// to append the dialogHashKey to the url of the current page.
if ( isDialog && active ) {
// on the initial page load active.url is undefined and in that case
// should be an empty string. Moving the undefined -> empty string back
// into urlHistory.addNew seemed imprudent given undefined better
// represents the url state
// If we are at a place in history that once belonged to a dialog, reuse
// this state without adding to urlHistory and without modifying the
// hash. However, if a dialog is already displayed at this point, and
// we're about to display another dialog, then we must add another hash
// and history entry on top so that one may navigate back to the
// original dialog
if ( active.url &&
active.url.indexOf( $.mobile.dialogHashKey ) > -1 &&
this.activePage &&
!this.activePage.hasClass( "ui-dialog" ) &&
$.mobile.navigate.history.activeIndex > 0 ) {
settings.changeHash = false;
alreadyThere = true;
}
// Normally, we tack on a dialog hash key, but if this is the location
// of a stale dialog, we reuse the URL from the entry
url = ( active.url || "" );
// account for absolute urls instead of just relative urls use as hashes
if ( !alreadyThere && url.indexOf("#") > -1 ) {
url += $.mobile.dialogHashKey;
} else {
url += "#" + $.mobile.dialogHashKey;
}
// tack on another dialogHashKey if this is the same as the initial hash
// this makes sure that a history entry is created for this dialog
if ( $.mobile.navigate.history.activeIndex === 0 && url === $.mobile.navigate.history.initialDst ) {
url += $.mobile.dialogHashKey;
}
}
// if title element wasn't found, try the page div data attr too
// If this is a deep-link or a reload ( active === undefined ) then just
// use pageTitle
newPageTitle = ( !active ) ? pageTitle : toPage.jqmData( "title" ) ||
toPage.children( ":jqmData(role='header')" ).find( ".ui-title" ).text();
if ( !!newPageTitle && pageTitle === document.title ) {
pageTitle = newPageTitle;
}
if ( !toPage.jqmData( "title" ) ) {
toPage.jqmData( "title", pageTitle );
}
// Make sure we have a transition defined.
settings.transition = settings.transition ||
( ( historyDir && !activeIsInitialPage ) ? active.transition : undefined ) ||
( isDialog ? $.mobile.defaultDialogTransition : $.mobile.defaultPageTransition );
//add page to history stack if it's not back or forward
if ( !historyDir && alreadyThere ) {
$.mobile.navigate.history.getActive().pageUrl = pageUrl;
}
// Set the location hash.
if ( url && !settings.fromHashChange ) {
// rebuilding the hash here since we loose it earlier on
// TODO preserve the originally passed in path
if ( !$.mobile.path.isPath( url ) && url.indexOf( "#" ) < 0 ) {
url = "#" + url;
}
// TODO the property names here are just silly
params = {
transition: settings.transition,
title: pageTitle,
pageUrl: pageUrl,
role: settings.role
};
if ( settings.changeHash !== false && $.mobile.hashListeningEnabled ) {
$.mobile.navigate( url, params, true);
} else if ( toPage[ 0 ] !== $.mobile.firstPage[ 0 ] ) {
$.mobile.navigate.history.add( url, params );
}
}
//set page title
document.title = pageTitle;
//set "toPage" as activePage deprecated in 1.4 remove in 1.5
$.mobile.activePage = toPage;
//new way to handle activePage
this.activePage = toPage;
// If we're navigating back in the URL history, set reverse accordingly.
settings.reverse = settings.reverse || historyDir < 0;
cssTransitionDeferred = $.Deferred();
this._cssTransition(toPage, fromPage, {
transition: settings.transition,
reverse: settings.reverse,
deferred: cssTransitionDeferred
});
cssTransitionDeferred.done($.proxy(function( name, reverse, $to, $from, alreadyFocused ) {
$.mobile.removeActiveLinkClass();
//if there's a duplicateCachedPage, remove it from the DOM now that it's hidden
if ( settings.duplicateCachedPage ) {
settings.duplicateCachedPage.remove();
}
// despite visibility: hidden addresses issue #2965
// https://github.com/jquery/jquery-mobile/issues/2965
if ( !alreadyFocused ) {
$.mobile.focusPage( toPage );
}
this._releaseTransitionLock();
this.element.trigger( "pagechange", triggerData );
this._triggerWithDeprecated( "transition", triggerData );
}, this));
},
// determine the current base url
_findBaseWithDefault: function() {
var closestBase = ( this.activePage &&
$.mobile.getClosestBaseUrl( this.activePage ) );
return closestBase || $.mobile.path.documentBase.hrefNoHash;
}
});
// The following handlers should be bound after mobileinit has been triggered
// the following deferred is resolved in the init file
$.mobile.navreadyDeferred = $.Deferred();
//these variables make all page containers use the same queue and only navigate one at a time
// queue to hold simultanious page transitions
var pageTransitionQueue = [],
// indicates whether or not page is in process of transitioning
isPageTransitioning = false;
})( jQuery );
(function( $, undefined ) {
// resolved on domready
var domreadyDeferred = $.Deferred(),
documentUrl = $.mobile.path.documentUrl,
// used to track last vclicked element to make sure its value is added to form data
$lastVClicked = null;
/* Event Bindings - hashchange, submit, and click */
function findClosestLink( ele ) {
while ( ele ) {
// Look for the closest element with a nodeName of "a".
// Note that we are checking if we have a valid nodeName
// before attempting to access it. This is because the
// node we get called with could have originated from within
// an embedded SVG document where some symbol instance elements
// don't have nodeName defined on them, or strings are of type
// SVGAnimatedString.
if ( ( typeof ele.nodeName === "string" ) && ele.nodeName.toLowerCase() === "a" ) {
break;
}
ele = ele.parentNode;
}
return ele;
}
$.mobile.loadPage = function( url, opts ) {
var container;
opts = opts || {};
container = ( opts.pageContainer || $.mobile.pageContainer );
// create the deferred that will be supplied to loadPage callers
// and resolved by the content widget's load method
opts.deferred = $.Deferred();
// Preferring to allow exceptions for uninitialized opts.pageContainer
// widgets so we know if we need to force init here for users
container.pagecontainer( "load", url, opts );
// provide the deferred
return opts.deferred.promise();
};
//define vars for interal use
/* internal utility functions */
// NOTE Issue #4950 Android phonegap doesn't navigate back properly
// when a full page refresh has taken place. It appears that hashchange
// and replacestate history alterations work fine but we need to support
// both forms of history traversal in our code that uses backward history
// movement
$.mobile.back = function() {
var nav = window.navigator;
// if the setting is on and the navigator object is
// available use the phonegap navigation capability
if ( this.phonegapNavigationEnabled &&
nav &&
nav.app &&
nav.app.backHistory ) {
nav.app.backHistory();
} else {
$.mobile.pageContainer.pagecontainer( "back" );
}
};
//direct focus to the page title, or otherwise first focusable element
$.mobile.focusPage = function ( page ) {
var autofocus = page.find( "[autofocus]" ),
pageTitle = page.find( ".ui-title:eq(0)" );
if ( autofocus.length ) {
autofocus.focus();
return;
}
if ( pageTitle.length ) {
pageTitle.focus();
} else{
page.focus();
}
};
// No-op implementation of transition degradation
$.mobile._maybeDegradeTransition = $.mobile._maybeDegradeTransition || function( transition ) {
return transition;
};
/* exposed $.mobile methods */
//animation complete callback
$.fn.animationComplete = function( callback ) {
if ( $.support.cssTransitions ) {
return $( this ).one( "webkitAnimationEnd animationend", callback );
}
else{
// defer execution for consistency between webkit/non webkit
setTimeout( callback, 0 );
return $( this );
}
};
$.mobile.changePage = function( to, options ) {
$.mobile.pageContainer.pagecontainer( "change", to, options );
};
$.mobile.changePage.defaults = {
transition: undefined,
reverse: false,
changeHash: true,
fromHashChange: false,
role: undefined, // By default we rely on the role defined by the @data-role attribute.
duplicateCachedPage: undefined,
pageContainer: undefined,
showLoadMsg: true, //loading message shows by default when pages are being fetched during changePage
dataUrl: undefined,
fromPage: undefined,
allowSamePageTransition: false
};
$.mobile._registerInternalEvents = function() {
var getAjaxFormData = function( $form, calculateOnly ) {
var url, ret = true, formData, vclickedName, method;
if ( !$.mobile.ajaxEnabled ||
// test that the form is, itself, ajax false
$form.is( ":jqmData(ajax='false')" ) ||
// test that $.mobile.ignoreContentEnabled is set and
// the form or one of it's parents is ajax=false
!$form.jqmHijackable().length ||
$form.attr( "target" ) ) {
return false;
}
url = ( $lastVClicked && $lastVClicked.attr( "formaction" ) ) ||
$form.attr( "action" );
method = ( $form.attr( "method" ) || "get" ).toLowerCase();
// If no action is specified, browsers default to using the
// URL of the document containing the form. Since we dynamically
// pull in pages from external documents, the form should submit
// to the URL for the source document of the page containing
// the form.
if ( !url ) {
// Get the @data-url for the page containing the form.
url = $.mobile.getClosestBaseUrl( $form );
// NOTE: If the method is "get", we need to strip off the query string
// because it will get replaced with the new form data. See issue #5710.
if ( method === "get" ) {
url = $.mobile.path.parseUrl( url ).hrefNoSearch;
}
if ( url === $.mobile.path.documentBase.hrefNoHash ) {
// The url we got back matches the document base,
// which means the page must be an internal/embedded page,
// so default to using the actual document url as a browser
// would.
url = documentUrl.hrefNoSearch;
}
}
url = $.mobile.path.makeUrlAbsolute( url, $.mobile.getClosestBaseUrl( $form ) );
if ( ( $.mobile.path.isExternal( url ) && !$.mobile.path.isPermittedCrossDomainRequest( documentUrl, url ) ) ) {
return false;
}
if ( !calculateOnly ) {
formData = $form.serializeArray();
if ( $lastVClicked && $lastVClicked[ 0 ].form === $form[ 0 ] ) {
vclickedName = $lastVClicked.attr( "name" );
if ( vclickedName ) {
// Make sure the last clicked element is included in the form
$.each( formData, function( key, value ) {
if ( value.name === vclickedName ) {
// Unset vclickedName - we've found it in the serialized data already
vclickedName = "";
return false;
}
});
if ( vclickedName ) {
formData.push( { name: vclickedName, value: $lastVClicked.attr( "value" ) } );
}
}
}
ret = {
url: url,
options: {
type: method,
data: $.param( formData ),
transition: $form.jqmData( "transition" ),
reverse: $form.jqmData( "direction" ) === "reverse",
reloadPage: true
}
};
}
return ret;
};
//bind to form submit events, handle with Ajax
$.mobile.document.delegate( "form", "submit", function( event ) {
var formData;
if ( !event.isDefaultPrevented() ) {
formData = getAjaxFormData( $( this ) );
if ( formData ) {
$.mobile.changePage( formData.url, formData.options );
event.preventDefault();
}
}
});
//add active state on vclick
$.mobile.document.bind( "vclick", function( event ) {
var $btn, btnEls, target = event.target, needClosest = false;
// if this isn't a left click we don't care. Its important to note
// that when the virtual event is generated it will create the which attr
if ( event.which > 1 || !$.mobile.linkBindingEnabled ) {
return;
}
// Record that this element was clicked, in case we need it for correct
// form submission during the "submit" handler above
$lastVClicked = $( target );
// Try to find a target element to which the active class will be applied
if ( $.data( target, "mobile-button" ) ) {
// If the form will not be submitted via AJAX, do not add active class
if ( !getAjaxFormData( $( target ).closest( "form" ), true ) ) {
return;
}
// We will apply the active state to this button widget - the parent
// of the input that was clicked will have the associated data
if ( target.parentNode ) {
target = target.parentNode;
}
} else {
target = findClosestLink( target );
if ( !( target && $.mobile.path.parseUrl( target.getAttribute( "href" ) || "#" ).hash !== "#" ) ) {
return;
}
// TODO teach $.mobile.hijackable to operate on raw dom elements so the
// link wrapping can be avoided
if ( !$( target ).jqmHijackable().length ) {
return;
}
}
// Avoid calling .closest by using the data set during .buttonMarkup()
// List items have the button data in the parent of the element clicked
if ( !!~target.className.indexOf( "ui-link-inherit" ) ) {
if ( target.parentNode ) {
btnEls = $.data( target.parentNode, "buttonElements" );
}
// Otherwise, look for the data on the target itself
} else {
btnEls = $.data( target, "buttonElements" );
}
// If found, grab the button's outer element
if ( btnEls ) {
target = btnEls.outer;
} else {
needClosest = true;
}
$btn = $( target );
// If the outer element wasn't found by the our heuristics, use .closest()
if ( needClosest ) {
$btn = $btn.closest( ".ui-btn" );
}
if ( $btn.length > 0 &&
!( $btn.hasClass( "ui-state-disabled" ||
// DEPRECATED as of 1.4.0 - remove after 1.4.0 release
// only ui-state-disabled should be present thereafter
$btn.hasClass( "ui-disabled" ) ) ) ) {
$.mobile.removeActiveLinkClass( true );
$.mobile.activeClickedLink = $btn;
$.mobile.activeClickedLink.addClass( $.mobile.activeBtnClass );
}
});
// click routing - direct to HTTP or Ajax, accordingly
$.mobile.document.bind( "click", function( event ) {
if ( !$.mobile.linkBindingEnabled || event.isDefaultPrevented() ) {
return;
}
var link = findClosestLink( event.target ),
$link = $( link ),
//remove active link class if external (then it won't be there if you come back)
httpCleanup = function() {
window.setTimeout(function() { $.mobile.removeActiveLinkClass( true ); }, 200 );
},
baseUrl, href,
useDefaultUrlHandling, isExternal,
transition, reverse, role;
// If a button was clicked, clean up the active class added by vclick above
if ( $.mobile.activeClickedLink &&
$.mobile.activeClickedLink[ 0 ] === event.target.parentNode ) {
httpCleanup();
}
// If there is no link associated with the click or its not a left
// click we want to ignore the click
// TODO teach $.mobile.hijackable to operate on raw dom elements so the link wrapping
// can be avoided
if ( !link || event.which > 1 || !$link.jqmHijackable().length ) {
return;
}
//if there's a data-rel=back attr, go back in history
if ( $link.is( ":jqmData(rel='back')" ) ) {
$.mobile.back();
return false;
}
baseUrl = $.mobile.getClosestBaseUrl( $link );
//get href, if defined, otherwise default to empty hash
href = $.mobile.path.makeUrlAbsolute( $link.attr( "href" ) || "#", baseUrl );
//if ajax is disabled, exit early
if ( !$.mobile.ajaxEnabled && !$.mobile.path.isEmbeddedPage( href ) ) {
httpCleanup();
//use default click handling
return;
}
// XXX_jblas: Ideally links to application pages should be specified as
// an url to the application document with a hash that is either
// the site relative path or id to the page. But some of the
// internal code that dynamically generates sub-pages for nested
// lists and select dialogs, just write a hash in the link they
// create. This means the actual URL path is based on whatever
// the current value of the base tag is at the time this code
// is called. For now we are just assuming that any url with a
// hash in it is an application page reference.
if ( href.search( "#" ) !== -1 ) {
href = href.replace( /[^#]*#/, "" );
if ( !href ) {
//link was an empty hash meant purely
//for interaction, so we ignore it.
event.preventDefault();
return;
} else if ( $.mobile.path.isPath( href ) ) {
//we have apath so make it the href we want to load.
href = $.mobile.path.makeUrlAbsolute( href, baseUrl );
} else {
//we have a simple id so use the documentUrl as its base.
href = $.mobile.path.makeUrlAbsolute( "#" + href, documentUrl.hrefNoHash );
}
}
// Should we handle this link, or let the browser deal with it?
useDefaultUrlHandling = $link.is( "[rel='external']" ) || $link.is( ":jqmData(ajax='false')" ) || $link.is( "[target]" );
// Some embedded browsers, like the web view in Phone Gap, allow cross-domain XHR
// requests if the document doing the request was loaded via the file:// protocol.
// This is usually to allow the application to "phone home" and fetch app specific
// data. We normally let the browser handle external/cross-domain urls, but if the
// allowCrossDomainPages option is true, we will allow cross-domain http/https
// requests to go through our page loading logic.
//check for protocol or rel and its not an embedded page
//TODO overlap in logic from isExternal, rel=external check should be
// moved into more comprehensive isExternalLink
isExternal = useDefaultUrlHandling || ( $.mobile.path.isExternal( href ) && !$.mobile.path.isPermittedCrossDomainRequest( documentUrl, href ) );
if ( isExternal ) {
httpCleanup();
//use default click handling
return;
}
//use ajax
transition = $link.jqmData( "transition" );
reverse = $link.jqmData( "direction" ) === "reverse" ||
// deprecated - remove by 1.0
$link.jqmData( "back" );
//this may need to be more specific as we use data-rel more
role = $link.attr( "data-" + $.mobile.ns + "rel" ) || undefined;
$.mobile.changePage( href, { transition: transition, reverse: reverse, role: role, link: $link } );
event.preventDefault();
});
//prefetch pages when anchors with data-prefetch are encountered
$.mobile.document.delegate( ".ui-page", "pageshow.prefetch", function() {
var urls = [];
$( this ).find( "a:jqmData(prefetch)" ).each(function() {
var $link = $( this ),
url = $link.attr( "href" );
if ( url && $.inArray( url, urls ) === -1 ) {
urls.push( url );
$.mobile.loadPage( url, { role: $link.attr( "data-" + $.mobile.ns + "rel" ),prefetch: true } );
}
});
});
// TODO ensure that the navigate binding in the content widget happens at the right time
$.mobile.pageContainer.pagecontainer();
//set page min-heights to be device specific
$.mobile.document.bind( "pageshow", $.mobile.resetActivePageHeight );
$.mobile.window.bind( "throttledresize", $.mobile.resetActivePageHeight );
};//navreadyDeferred done callback
$( function() { domreadyDeferred.resolve(); } );
$.when( domreadyDeferred, $.mobile.navreadyDeferred ).done( function() { $.mobile._registerInternalEvents(); } );
})( jQuery );
(function( $, window, undefined ) {
// TODO remove direct references to $.mobile and properties, we should
// favor injection with params to the constructor
$.mobile.Transition = function() {
this.init.apply( this, arguments );
};
$.extend($.mobile.Transition.prototype, {
toPreClass: " ui-page-pre-in",
init: function( name, reverse, $to, $from ) {
$.extend(this, {
name: name,
reverse: reverse,
$to: $to,
$from: $from,
deferred: new $.Deferred()
});
},
cleanFrom: function() {
this.$from
.removeClass( $.mobile.activePageClass + " out in reverse " + this.name )
.height( "" );
},
// NOTE overridden by child object prototypes, noop'd here as defaults
beforeDoneIn: function() {},
beforeDoneOut: function() {},
beforeStartOut: function() {},
doneIn: function() {
this.beforeDoneIn();
this.$to.removeClass( "out in reverse " + this.name ).height( "" );
this.toggleViewportClass();
// In some browsers (iOS5), 3D transitions block the ability to scroll to the desired location during transition
// This ensures we jump to that spot after the fact, if we aren't there already.
if ( $.mobile.window.scrollTop() !== this.toScroll ) {
this.scrollPage();
}
if ( !this.sequential ) {
this.$to.addClass( $.mobile.activePageClass );
}
this.deferred.resolve( this.name, this.reverse, this.$to, this.$from, true );
},
doneOut: function( screenHeight, reverseClass, none, preventFocus ) {
this.beforeDoneOut();
this.startIn( screenHeight, reverseClass, none, preventFocus );
},
hideIn: function( callback ) {
// Prevent flickering in phonegap container: see comments at #4024 regarding iOS
this.$to.css( "z-index", -10 );
callback.call( this );
this.$to.css( "z-index", "" );
},
scrollPage: function() {
// By using scrollTo instead of silentScroll, we can keep things better in order
// Just to be precautios, disable scrollstart listening like silentScroll would
$.event.special.scrollstart.enabled = false;
//if we are hiding the url bar or the page was previously scrolled scroll to hide or return to position
if ( $.mobile.hideUrlBar || this.toScroll !== $.mobile.defaultHomeScroll ) {
window.scrollTo( 0, this.toScroll );
}
// reenable scrollstart listening like silentScroll would
setTimeout( function() {
$.event.special.scrollstart.enabled = true;
}, 150 );
},
startIn: function( screenHeight, reverseClass, none, preventFocus ) {
this.hideIn(function() {
this.$to.addClass( $.mobile.activePageClass + this.toPreClass );
// Send focus to page as it is now display: block
if ( !preventFocus ) {
$.mobile.focusPage( this.$to );
}
// Set to page height
this.$to.height( screenHeight + this.toScroll );
if ( !none ) {
this.scrollPage();
}
});
if ( !none ) {
this.$to.animationComplete( $.proxy(function() {
this.doneIn();
}, this ));
}
this.$to
.removeClass( this.toPreClass )
.addClass( this.name + " in " + reverseClass );
if ( none ) {
this.doneIn();
}
},
startOut: function( screenHeight, reverseClass, none ) {
this.beforeStartOut( screenHeight, reverseClass, none );
// Set the from page's height and start it transitioning out
// Note: setting an explicit height helps eliminate tiling in the transitions
this.$from
.height( screenHeight + $.mobile.window.scrollTop() )
.addClass( this.name + " out" + reverseClass );
},
toggleViewportClass: function() {
$.mobile.pageContainer.toggleClass( "ui-mobile-viewport-transitioning viewport-" + this.name );
},
transition: function() {
// NOTE many of these could be calculated/recorded in the constructor, it's my
// opinion that binding them as late as possible has value with regards to
// better transitions with fewer bugs. Ie, it's not guaranteed that the
// object will be created and transition will be run immediately after as
// it is today. So we wait until transition is invoked to gather the following
var reverseClass = this.reverse ? " reverse" : "",
screenHeight = $.mobile.getScreenHeight(),
maxTransitionOverride = $.mobile.maxTransitionWidth !== false && $.mobile.window.width() > $.mobile.maxTransitionWidth,
none = !$.support.cssTransitions || !$.support.cssAnimations || maxTransitionOverride || !this.name || this.name === "none" || Math.max( $.mobile.window.scrollTop(), this.toScroll ) > $.mobile.getMaxScrollForTransition();
this.toScroll = $.mobile.navigate.history.getActive().lastScroll || $.mobile.defaultHomeScroll;
this.toggleViewportClass();
if ( this.$from && !none ) {
this.startOut( screenHeight, reverseClass, none );
} else {
this.doneOut( screenHeight, reverseClass, none, true );
}
return this.deferred.promise();
}
});
})( jQuery, this );
(function( $ ) {
$.mobile.SerialTransition = function() {
this.init.apply(this, arguments);
};
$.extend($.mobile.SerialTransition.prototype, $.mobile.Transition.prototype, {
sequential: true,
beforeDoneOut: function() {
if ( this.$from ) {
this.cleanFrom();
}
},
beforeStartOut: function( screenHeight, reverseClass, none ) {
this.$from.animationComplete($.proxy(function() {
this.doneOut( screenHeight, reverseClass, none );
}, this ));
}
});
})( jQuery );
(function( $ ) {
$.mobile.ConcurrentTransition = function() {
this.init.apply(this, arguments);
};
$.extend($.mobile.ConcurrentTransition.prototype, $.mobile.Transition.prototype, {
sequential: false,
beforeDoneIn: function() {
if ( this.$from ) {
this.cleanFrom();
}
},
beforeStartOut: function( screenHeight, reverseClass, none ) {
this.doneOut( screenHeight, reverseClass, none );
}
});
})( jQuery );
(function( $ ) {
// generate the handlers from the above
var defaultGetMaxScrollForTransition = function() {
return $.mobile.getScreenHeight() * 3;
};
//transition handler dictionary for 3rd party transitions
$.mobile.transitionHandlers = {
"sequential": $.mobile.SerialTransition,
"simultaneous": $.mobile.ConcurrentTransition
};
// Make our transition handler the public default.
$.mobile.defaultTransitionHandler = $.mobile.transitionHandlers.sequential;
$.mobile.transitionFallbacks = {};
// If transition is defined, check if css 3D transforms are supported, and if not, if a fallback is specified
$.mobile._maybeDegradeTransition = function( transition ) {
if ( transition && !$.support.cssTransform3d && $.mobile.transitionFallbacks[ transition ] ) {
transition = $.mobile.transitionFallbacks[ transition ];
}
return transition;
};
// Set the getMaxScrollForTransition to default if no implementation was set by user
$.mobile.getMaxScrollForTransition = $.mobile.getMaxScrollForTransition || defaultGetMaxScrollForTransition;
})( jQuery );
/*
* fallback transition for flip in non-3D supporting browsers (which tend to handle complex transitions poorly in general
*/
(function( $, window, undefined ) {
$.mobile.transitionFallbacks.flip = "fade";
})( jQuery, this );
/*
* fallback transition for flow in non-3D supporting browsers (which tend to handle complex transitions poorly in general
*/
(function( $, window, undefined ) {
$.mobile.transitionFallbacks.flow = "fade";
})( jQuery, this );
/*
* fallback transition for pop in non-3D supporting browsers (which tend to handle complex transitions poorly in general
*/
(function( $, window, undefined ) {
$.mobile.transitionFallbacks.pop = "fade";
})( jQuery, this );
/*
* fallback transition for slide in non-3D supporting browsers (which tend to handle complex transitions poorly in general
*/
(function( $, window, undefined ) {
// Use the simultaneous transitions handler for slide transitions
$.mobile.transitionHandlers.slide = $.mobile.transitionHandlers.simultaneous;
// Set the slide transitions's fallback to "fade"
$.mobile.transitionFallbacks.slide = "fade";
})( jQuery, this );
/*
* fallback transition for slidedown in non-3D supporting browsers (which tend to handle complex transitions poorly in general
*/
(function( $, window, undefined ) {
$.mobile.transitionFallbacks.slidedown = "fade";
})( jQuery, this );
/*
* fallback transition for slidefade in non-3D supporting browsers (which tend to handle complex transitions poorly in general
*/
(function( $, window, undefined ) {
// Set the slide transitions's fallback to "fade"
$.mobile.transitionFallbacks.slidefade = "fade";
})( jQuery, this );
/*
* fallback transition for slideup in non-3D supporting browsers (which tend to handle complex transitions poorly in general
*/
(function( $, window, undefined ) {
$.mobile.transitionFallbacks.slideup = "fade";
})( jQuery, this );
/*
* fallback transition for turn in non-3D supporting browsers (which tend to handle complex transitions poorly in general
*/
(function( $, window, undefined ) {
$.mobile.transitionFallbacks.turn = "fade";
})( jQuery, this );
(function( $, undefined ) {
$.mobile.degradeInputs = {
color: false,
date: false,
datetime: false,
"datetime-local": false,
email: false,
month: false,
number: false,
range: "number",
search: "text",
tel: false,
time: false,
url: false,
week: false
};
// Backcompat remove in 1.5
$.mobile.page.prototype.options.degradeInputs = $.mobile.degradeInputs;
// Auto self-init widgets
$.mobile.degradeInputsWithin = function( target ) {
target = $( target );
// Degrade inputs to avoid poorly implemented native functionality
target.find( "input" ).not( $.mobile.page.prototype.keepNativeSelector() ).each(function() {
var element = $( this ),
type = this.getAttribute( "type" ),
optType = $.mobile.degradeInputs[ type ] || "text",
html, hasType, findstr, repstr;
if ( $.mobile.degradeInputs[ type ] ) {
html = $( "<div>" ).html( element.clone() ).html();
// In IE browsers, the type sometimes doesn't exist in the cloned markup, so we replace the closing tag instead
hasType = html.indexOf( " type=" ) > -1;
findstr = hasType ? /\s+type=["']?\w+['"]?/ : /\/?>/;
repstr = " type=\"" + optType + "\" data-" + $.mobile.ns + "type=\"" + type + "\"" + ( hasType ? "" : ">" );
element.replaceWith( html.replace( findstr, repstr ) );
}
});
};
})( jQuery );
(function( $, window, undefined ) {
$.widget( "mobile.page", $.mobile.page, {
options: {
// Accepts left, right and none
closeBtn: "left",
closeBtnText: "Close",
overlayTheme: "a",
corners: true,
dialog: false
},
_create: function() {
this._super();
if ( this.options.dialog ) {
$.extend( this, {
_inner: this.element.children(),
_headerCloseButton: null
});
if ( !this.options.enhanced ) {
this._setCloseBtn( this.options.closeBtn );
}
}
},
_enhance: function() {
this._super();
// Class the markup for dialog styling and wrap interior
if ( this.options.dialog ) {
this.element.addClass( "ui-dialog" )
.wrapInner( $( "<div/>", {
// ARIA role
"role" : "dialog",
"class" : "ui-dialog-contain ui-overlay-shadow" +
( this.options.corners ? " ui-corner-all" : "" )
}));
}
},
_setOptions: function( options ) {
var closeButtonLocation, closeButtonText,
currentOpts = this.options;
if ( options.corners !== undefined ) {
this._inner.toggleClass( "ui-corner-all", !!options.corners );
}
if ( options.overlayTheme !== undefined ) {
if ( $.mobile.activePage[ 0 ] === this.element[ 0 ] ) {
currentOpts.overlayTheme = options.overlayTheme;
this._handlePageBeforeShow();
}
}
if ( options.closeBtnText !== undefined ) {
closeButtonLocation = currentOpts.closeBtn;
closeButtonText = options.closeBtnText;
}
if ( options.closeBtn !== undefined ) {
closeButtonLocation = options.closeBtn;
}
if ( closeButtonLocation ) {
this._setCloseBtn( closeButtonLocation, closeButtonText );
}
this._super( options );
},
_handlePageBeforeShow: function () {
if ( this.options.overlayTheme && this.options.dialog ) {
this.removeContainerBackground();
this.setContainerBackground( this.options.overlayTheme );
} else {
this._super();
}
},
_setCloseBtn: function( location, text ) {
var dst,
btn = this._headerCloseButton;
// Sanitize value
location = "left" === location ? "left" : "right" === location ? "right" : "none";
if ( "none" === location ) {
if ( btn ) {
btn.remove();
btn = null;
}
} else if ( btn ) {
btn.removeClass( "ui-btn-left ui-btn-right" ).addClass( "ui-btn-" + location );
if ( text ) {
btn.text( text );
}
} else {
dst = this._inner.find( ":jqmData(role='header')" ).first();
btn = $( "<a></a>", {
"href": "#",
"class": "ui-btn ui-corner-all ui-icon-delete ui-btn-icon-notext ui-btn-" + location
})
.attr( "data-" + $.mobile.ns + "rel", "back" )
.text( text || this.options.closeBtnText || "" )
.prependTo( dst );
this._on( btn, { click: "close" } );
}
this._headerCloseButton = btn;
}
});
})( jQuery, this );
(function( $, window, undefined ) {
$.widget( "mobile.dialog", {
options: {
// Accepts left, right and none
closeBtn: "left",
closeBtnText: "Close",
overlayTheme: "a",
corners: true
},
// Override the theme set by the page plugin on pageshow
_handlePageBeforeShow: function() {
this._isCloseable = true;
if ( this.options.overlayTheme ) {
this.element
.page( "removeContainerBackground" )
.page( "setContainerBackground", this.options.overlayTheme );
}
},
_handlePageBeforeHide: function() {
this._isCloseable = false;
},
// click and submit events:
// - clicks and submits should use the closing transition that the dialog
// opened with unless a data-transition is specified on the link/form
// - if the click was on the close button, or the link has a data-rel="back"
// it'll go back in history naturally
_handleVClickSubmit: function( event ) {
var attrs,
$target = $( event.target ).closest( event.type === "vclick" ? "a" : "form" );
if ( $target.length && !$target.jqmData( "transition" ) ) {
attrs = {};
attrs[ "data-" + $.mobile.ns + "transition" ] =
( $.mobile.navigate.history.getActive() || {} )[ "transition" ] ||
$.mobile.defaultDialogTransition;
attrs[ "data-" + $.mobile.ns + "direction" ] = "reverse";
$target.attr( attrs );
}
},
_create: function() {
var elem = this.element,
opts = this.options;
// Class the markup for dialog styling and wrap interior
elem.addClass( "ui-dialog" )
.wrapInner( $( "<div/>", {
// ARIA role
"role" : "dialog",
"class" : "ui-dialog-contain ui-overlay-shadow" +
( !!opts.corners ? " ui-corner-all" : "" )
}));
$.extend( this, {
_isCloseable: false,
_inner: elem.children(),
_headerCloseButton: null
});
this._on( elem, {
vclick: "_handleVClickSubmit",
submit: "_handleVClickSubmit",
pagebeforeshow: "_handlePageBeforeShow",
pagebeforehide: "_handlePageBeforeHide"
});
this._setCloseBtn( opts.closeBtn );
},
_setOptions: function( options ) {
var closeButtonLocation, closeButtonText,
currentOpts = this.options;
if ( options.corners !== undefined ) {
this._inner.toggleClass( "ui-corner-all", !!options.corners );
}
if ( options.overlayTheme !== undefined ) {
if ( $.mobile.activePage[ 0 ] === this.element[ 0 ] ) {
currentOpts.overlayTheme = options.overlayTheme;
this._handlePageBeforeShow();
}
}
if ( options.closeBtnText !== undefined ) {
closeButtonLocation = currentOpts.closeBtn;
closeButtonText = options.closeBtnText;
}
if ( options.closeBtn !== undefined ) {
closeButtonLocation = options.closeBtn;
}
if ( closeButtonLocation ) {
this._setCloseBtn( closeButtonLocation, closeButtonText );
}
this._super( options );
},
_setCloseBtn: function( location, text ) {
var dst,
btn = this._headerCloseButton;
// Sanitize value
location = "left" === location ? "left" : "right" === location ? "right" : "none";
if ( "none" === location ) {
if ( btn ) {
btn.remove();
btn = null;
}
} else if ( btn ) {
btn.removeClass( "ui-btn-left ui-btn-right" ).addClass( "ui-btn-" + location );
if ( text ) {
btn.text( text );
}
} else {
dst = this._inner.find( ":jqmData(role='header')" ).first();
btn = $( "<a></a>", {
"role": "button",
"href": "#",
"class": "ui-btn ui-corner-all ui-icon-delete ui-btn-icon-notext ui-btn-" + location
})
.text( text || this.options.closeBtnText || "" )
.prependTo( dst );
this._on( btn, { click: "close" } );
}
this._headerCloseButton = btn;
},
// Close method goes back in history
close: function() {
var hist = $.mobile.navigate.history;
if ( this._isCloseable ) {
this._isCloseable = false;
// If the hash listening is enabled and there is at least one preceding history
// entry it's ok to go back. Initial pages with the dialog hash state are an example
// where the stack check is necessary
if ( $.mobile.hashListeningEnabled && hist.activeIndex > 0 ) {
$.mobile.back();
} else {
$.mobile.pageContainer.pagecontainer( "back" );
}
}
}
});
})( jQuery, this );
(function( $, undefined ) {
var rInitialLetter = /([A-Z])/g;
$.widget( "mobile.collapsible", {
options: {
enhanced: false,
expandCueText: null,
collapseCueText: null,
collapsed: true,
heading: "h1,h2,h3,h4,h5,h6,legend",
collapsedIcon: null,
expandedIcon: null,
iconpos: null,
theme: null,
contentTheme: null,
inset: null,
corners: null,
mini: null
},
_create: function() {
var elem = this.element,
ui = {
accordion: elem
.closest( ":jqmData(role='collapsible-set')" +
( $.mobile.collapsibleset ? ", :mobile-collapsibleset" : "" ) )
.addClass( "ui-collapsible-set" )
};
$.extend( this, {
_ui: ui
});
if ( this.options.enhanced ) {
ui.heading = $( ".ui-collapsible-heading", this.element[ 0 ] );
ui.content = ui.heading.next();
ui.anchor = $( "a", ui.heading[ 0 ] ).first();
ui.status = ui.anchor.children( ".ui-collapsible-heading-status" );
} else {
this._enhance( elem, ui );
}
this._on( ui.heading, {
"tap": function() {
ui.heading.find( "a" ).first().addClass( $.mobile.activeBtnClass );
},
"click": function( event ) {
this._handleExpandCollapse( !ui.heading.hasClass( "ui-collapsible-heading-collapsed" ) );
event.preventDefault();
event.stopPropagation();
}
});
},
// Adjust the keys inside options for inherited values
_getOptions: function( options ) {
var key,
accordion = this._ui.accordion,
accordionWidget = this._ui.accordionWidget;
// Copy options
options = $.extend( {}, options );
if ( accordion.length && !accordionWidget ) {
this._ui.accordionWidget =
accordionWidget = accordion.data( "mobile-collapsibleset" );
}
for ( key in options ) {
// Retrieve the option value first from the options object passed in and, if
// null, from the parent accordion or, if that's null too, or if there's no
// parent accordion, then from the defaults.
options[ key ] =
( options[ key ] != null ) ? options[ key ] :
( accordionWidget ) ? accordionWidget.options[ key ] :
accordion.length ? $.mobile.getAttribute( accordion[ 0 ],
key.replace( rInitialLetter, "-$1" ).toLowerCase() ):
null;
if ( null == options[ key ] ) {
options[ key ] = $.mobile.collapsible.defaults[ key ];
}
}
return options;
},
_themeClassFromOption: function( prefix, value ) {
return ( value ? ( value === "none" ? "" : prefix + value ) : "" );
},
_enhance: function( elem, ui ) {
var iconclass,
opts = this._getOptions( this.options ),
contentThemeClass = this._themeClassFromOption( "ui-body-", opts.contentTheme );
elem.addClass( "ui-collapsible " +
( opts.inset ? "ui-collapsible-inset " : "" ) +
( opts.inset && opts.corners ? "ui-corner-all " : "" ) +
( contentThemeClass ? "ui-collapsible-themed-content " : "" ) );
ui.originalHeading = elem.children( this.options.heading ).first(),
ui.content = elem
.wrapInner( "<div " +
"class='ui-collapsible-content " +
contentThemeClass + "'></div>" )
.children( ".ui-collapsible-content" ),
ui.heading = ui.originalHeading;
// Replace collapsibleHeading if it's a legend
if ( ui.heading.is( "legend" ) ) {
ui.heading = $( "<div role='heading'>"+ ui.heading.html() +"</div>" );
ui.placeholder = $( "<div><!-- placeholder for legend --></div>" ).insertBefore( ui.originalHeading );
ui.originalHeading.remove();
}
iconclass = ( opts.collapsed ? ( opts.collapsedIcon ? "ui-icon-" + opts.collapsedIcon : "" ):
( opts.expandedIcon ? "ui-icon-" + opts.expandedIcon : "" ) );
ui.status = $( "<span class='ui-collapsible-heading-status'></span>" );
ui.anchor = ui.heading
.detach()
//modify markup & attributes
.addClass( "ui-collapsible-heading" )
.append( ui.status )
.wrapInner( "<a href='#' class='ui-collapsible-heading-toggle'></a>" )
.find( "a" )
.first()
.addClass( "ui-btn " +
( iconclass ? iconclass + " " : "" ) +
( iconclass ? ( "ui-btn-icon-" +
( opts.iconpos === "right" ? "right" : "left" ) ) +
" " : "" ) +
this._themeClassFromOption( "ui-btn-", opts.theme ) + " " +
( opts.mini ? "ui-mini " : "" ) );
//drop heading in before content
ui.heading.insertBefore( ui.content );
this._handleExpandCollapse( this.options.collapsed );
return ui;
},
refresh: function() {
var key, options = {};
for ( key in $.mobile.collapsible.defaults ) {
options[ key ] = this.options[ key ];
}
this._setOptions( options );
},
_setOptions: function( options ) {
var isCollapsed, newTheme, oldTheme, hasCorners,
elem = this.element,
currentOpts = this._getOptions( this.options ),
ui = this._ui,
anchor = ui.anchor,
status = ui.status,
opts = this._getOptions( options );
// First and foremost we need to make sure the collapsible is in the proper
// state, in case somebody decided to change the collapsed option at the
// same time as another option
if ( options.collapsed !== undefined ) {
this._handleExpandCollapse( options.collapsed );
}
isCollapsed = elem.hasClass( "ui-collapsible-collapsed" );
// Only options referring to the current state need to be applied right away
// It is enough to store options covering the alternate in this.options.
if ( isCollapsed ) {
if ( opts.expandCueText !== undefined ) {
status.text( opts.expandCueText );
}
if ( opts.collapsedIcon !== undefined ) {
if ( currentOpts.collapsedIcon ) {
anchor.removeClass( "ui-icon-" + currentOpts.collapsedIcon );
}
if ( opts.collapsedIcon ) {
anchor.addClass( "ui-icon-" + opts.collapsedIcon );
}
}
} else {
if ( opts.collapseCueText !== undefined ) {
status.text( opts.collapseCueText );
}
if ( opts.expandedIcon !== undefined ) {
if ( currentOpts.expandedIcon ) {
anchor.removeClass( "ui-icon-" + currentOpts.expandedIcon );
}
if ( opts.expandedIcon ) {
anchor.addClass( "ui-icon-" + opts.expandedIcon );
}
}
}
if ( opts.iconpos !== undefined ) {
anchor.removeClass( "ui-btn-icon-" + ( currentOpts.iconPos === "right" ? "right" : "left" ) );
anchor.addClass( "ui-btn-icon-" + ( opts.iconPos === "right" ? "right" : "left" ) );
}
if ( opts.theme !== undefined ) {
oldTheme = this._themeClassFromOption( "ui-btn-", currentOpts.theme );
newTheme = this._themeClassFromOption( "ui-btn-", opts.theme );
anchor.removeClass( oldTheme ).addClass( newTheme );
}
if ( opts.contentTheme !== undefined ) {
oldTheme = this._themeClassFromOption( "ui-body-", currentOpts.theme );
newTheme = this._themeClassFromOption( "ui-body-", opts.theme );
ui.content.removeClass( oldTheme ).addClass( newTheme );
}
if ( opts.inset !== undefined ) {
elem.toggleClass( "ui-collapsible-inset", opts.inset );
hasCorners = !!( opts.inset && ( opts.corners || currentOpts.corners ) );
}
if ( opts.corners !== undefined ) {
hasCorners = !!( opts.corners && ( opts.inset || currentOpts.inset ) );
}
if ( hasCorners !== undefined ) {
elem.toggleClass( "ui-corner-all", hasCorners );
}
if ( opts.mini !== undefined ) {
anchor.toggleClass( "ui-mini", opts.mini );
}
this._super( options );
},
_handleExpandCollapse: function( isCollapse ) {
var opts = this._getOptions( this.options ),
ui = this._ui;
ui.status.text( isCollapse ? opts.expandCueText : opts.collapseCueText );
ui.heading
.toggleClass( "ui-collapsible-heading-collapsed", isCollapse )
.find( "a" ).first()
.toggleClass( "ui-icon-" + opts.expandedIcon, !isCollapse )
// logic or cause same icon for expanded/collapsed state would remove the ui-icon-class
.toggleClass( "ui-icon-" + opts.collapsedIcon, ( isCollapse || opts.expandedIcon === opts.collapsedIcon ) )
.removeClass( $.mobile.activeBtnClass );
this.element.toggleClass( "ui-collapsible-collapsed", isCollapse );
ui.content
.toggleClass( "ui-collapsible-content-collapsed", isCollapse )
.attr( "aria-hidden", isCollapse )
.trigger( "updatelayout" );
this.options.collapsed = isCollapse;
this._trigger( isCollapse ? "collapse" : "expand" );
},
expand: function() {
this._handleExpandCollapse( false );
},
collapse: function() {
this._handleExpandCollapse( true );
},
_destroy: function() {
var ui = this._ui,
opts = this.options;
if ( opts.enhanced ) {
return;
}
if ( ui.placeholder ) {
ui.originalHeading.insertBefore( ui.placeholder );
ui.placeholder.remove();
ui.heading.remove();
} else {
ui.status.remove();
ui.heading
.removeClass( "ui-collapsible-heading ui-collapsible-heading-collapsed" )
.children()
.contents()
.unwrap();
}
ui.anchor.contents().unwrap();
ui.content.contents().unwrap();
this.element
.removeClass( "ui-collapsible ui-collapsible-collapsed " +
"ui-collapsible-themed-content ui-collapsible-inset ui-corner-all" );
}
});
// Defaults to be used by all instances of collapsible if per-instance values
// are unset or if nothing is specified by way of inheritance from an accordion.
// Note that this hash does not contain options "collapsed" or "heading",
// because those are not inheritable.
$.mobile.collapsible.defaults = {
expandCueText: " click to expand contents",
collapseCueText: " click to collapse contents",
collapsedIcon: "plus",
contentTheme: "inherit",
expandedIcon: "minus",
iconpos: "left",
inset: true,
corners: true,
theme: "inherit",
mini: false
};
})( jQuery );
(function( $, undefined ) {
$.mobile.behaviors.addFirstLastClasses = {
_getVisibles: function( $els, create ) {
var visibles;
if ( create ) {
visibles = $els.not( ".ui-screen-hidden" );
} else {
visibles = $els.filter( ":visible" );
if ( visibles.length === 0 ) {
visibles = $els.not( ".ui-screen-hidden" );
}
}
return visibles;
},
_addFirstLastClasses: function( $els, $visibles, create ) {
$els.removeClass( "ui-first-child ui-last-child" );
$visibles.eq( 0 ).addClass( "ui-first-child" ).end().last().addClass( "ui-last-child" );
if ( !create ) {
this.element.trigger( "updatelayout" );
}
},
_removeFirstLastClasses: function( $els ) {
$els.removeClass( "ui-first-child ui-last-child" );
}
};
})( jQuery );
(function( $, undefined ) {
var childCollapsiblesSelector = ":mobile-collapsible, " + $.mobile.collapsible.initSelector;
$.widget( "mobile.collapsibleset", $.extend( {
// The initSelector is deprecated as of 1.4.0. In 1.5.0 we will use
// :jqmData(role='collapsibleset') which will allow us to get rid of the line
// below altogether, because the autoinit will generate such an initSelector
initSelector: ":jqmData(role='collapsible-set'),:jqmData(role='collapsibleset')",
options: $.extend( {
enhanced: false
}, $.mobile.collapsible.defaults ),
_handleCollapsibleExpand: function( event ) {
var closestCollapsible = $( event.target ).closest( ".ui-collapsible" );
if ( closestCollapsible.parent().is( ":mobile-collapsibleset, :jqmData(role='collapsible-set')" ) ) {
closestCollapsible
.siblings( ".ui-collapsible:not(.ui-collapsible-collapsed)" )
.collapsible( "collapse" );
}
},
_create: function() {
var elem = this.element,
opts = this.options;
$.extend( this, {
_classes: ""
});
if ( !opts.enhanced ) {
elem.addClass( "ui-collapsible-set " +
this._themeClassFromOption( "ui-group-theme-", opts.theme ) + " " +
( opts.corners && opts.inset ? "ui-corner-all " : "" ) );
this.element.find( $.mobile.collapsible.initSelector ).collapsible();
}
this._on( elem, { collapsibleexpand: "_handleCollapsibleExpand" } );
},
_themeClassFromOption: function( prefix, value ) {
return ( value ? ( value === "none" ? "" : prefix + value ) : "" );
},
_init: function() {
this._refresh( true );
// Because the corners are handled by the collapsible itself and the default state is collapsed
// That was causing https://github.com/jquery/jquery-mobile/issues/4116
this.element
.children( childCollapsiblesSelector )
.filter( ":jqmData(collapsed='false')" )
.collapsible( "expand" );
},
_setOptions: function( options ) {
var ret, hasCorners,
elem = this.element,
themeClass = this._themeClassFromOption( "ui-group-theme-", options.theme );
if ( themeClass ) {
elem
.removeClass( this._themeClassFromOption( "ui-group-theme-", this.options.theme ) )
.addClass( themeClass );
}
if ( options.inset !== undefined ) {
hasCorners = !!( options.inset && ( options.corners || this.options.corners ) );
}
if ( options.corners !== undefined ) {
hasCorners = !!( options.corners && ( options.inset || this.options.inset ) );
}
if ( hasCorners !== undefined ) {
elem.toggleClass( "ui-corner-all", hasCorners );
}
ret = this._super( options );
this.element.children( ":mobile-collapsible" ).collapsible( "refresh" );
return ret;
},
_destroy: function() {
var el = this.element;
this._removeFirstLastClasses( el.children( childCollapsiblesSelector ) );
el
.removeClass( "ui-collapsible-set ui-corner-all " +
this._themeClassFromOption( "ui-group-theme-", this.options.theme ) )
.children( ":mobile-collapsible" )
.collapsible( "destroy" );
},
_refresh: function( create ) {
var collapsiblesInSet = this.element.children( childCollapsiblesSelector );
this.element.find( $.mobile.collapsible.initSelector ).not( ".ui-collapsible" ).collapsible();
this._addFirstLastClasses( collapsiblesInSet, this._getVisibles( collapsiblesInSet, create ), create );
},
refresh: function() {
this._refresh( false );
}
}, $.mobile.behaviors.addFirstLastClasses ) );
})( jQuery );
(function( $, undefined ) {
// Deprecated in 1.4
$.fn.fieldcontain = function(/* options */) {
return this.addClass( "ui-field-contain" );
};
})( jQuery );
(function( $, undefined ) {
$.fn.grid = function( options ) {
return this.each(function() {
var $this = $( this ),
o = $.extend({
grid: null
}, options ),
$kids = $this.children(),
gridCols = { solo:1, a:2, b:3, c:4, d:5 },
grid = o.grid,
iterator,
letter;
if ( !grid ) {
if ( $kids.length <= 5 ) {
for ( letter in gridCols ) {
if ( gridCols[ letter ] === $kids.length ) {
grid = letter;
}
}
} else {
grid = "a";
$this.addClass( "ui-grid-duo" );
}
}
iterator = gridCols[grid];
$this.addClass( "ui-grid-" + grid );
$kids.filter( ":nth-child(" + iterator + "n+1)" ).addClass( "ui-block-a" );
if ( iterator > 1 ) {
$kids.filter( ":nth-child(" + iterator + "n+2)" ).addClass( "ui-block-b" );
}
if ( iterator > 2 ) {
$kids.filter( ":nth-child(" + iterator + "n+3)" ).addClass( "ui-block-c" );
}
if ( iterator > 3 ) {
$kids.filter( ":nth-child(" + iterator + "n+4)" ).addClass( "ui-block-d" );
}
if ( iterator > 4 ) {
$kids.filter( ":nth-child(" + iterator + "n+5)" ).addClass( "ui-block-e" );
}
});
};
})( jQuery );
(function( $, undefined ) {
$.widget( "mobile.navbar", {
options: {
iconpos: "top",
grid: null
},
_create: function() {
var $navbar = this.element,
$navbtns = $navbar.find( "a" ),
iconpos = $navbtns.filter( ":jqmData(icon)" ).length ? this.options.iconpos : undefined;
$navbar.addClass( "ui-navbar" )
.attr( "role", "navigation" )
.find( "ul" )
.jqmEnhanceable()
.grid({ grid: this.options.grid });
$navbtns
.each( function() {
var icon = $.mobile.getAttribute( this, "icon" ),
theme = $.mobile.getAttribute( this, "theme" ),
classes = "ui-btn";
if ( theme ) {
classes += " ui-btn-" + theme;
}
if ( icon ) {
classes += " ui-icon-" + icon + " ui-btn-icon-" + iconpos;
}
$( this ).addClass( classes );
});
$navbar.delegate( "a", "vclick", function( /* event */ ) {
var activeBtn = $( this );
if ( !( activeBtn.hasClass( "ui-state-disabled" ) ||
// DEPRECATED as of 1.4.0 - remove after 1.4.0 release
// only ui-state-disabled should be present thereafter
activeBtn.hasClass( "ui-disabled" ) ||
activeBtn.hasClass( $.mobile.activeBtnClass ) ) ) {
$navbtns.removeClass( $.mobile.activeBtnClass );
activeBtn.addClass( $.mobile.activeBtnClass );
// The code below is a workaround to fix #1181
$( document ).one( "pagehide", function() {
activeBtn.removeClass( $.mobile.activeBtnClass );
});
}
});
// Buttons in the navbar with ui-state-persist class should regain their active state before page show
$navbar.closest( ".ui-page" ).bind( "pagebeforeshow", function() {
$navbtns.filter( ".ui-state-persist" ).addClass( $.mobile.activeBtnClass );
});
}
});
})( jQuery );
(function( $, undefined ) {
var getAttr = $.mobile.getAttribute;
$.widget( "mobile.listview", $.extend( {
options: {
theme: null,
countTheme: null, /* Deprecated in 1.4 */
dividerTheme: null,
icon: "carat-r",
splitIcon: "carat-r",
splitTheme: null,
corners: true,
shadow: true,
inset: false
},
_create: function() {
var t = this,
listviewClasses = "";
listviewClasses += t.options.inset ? " ui-listview-inset" : "";
if ( !!t.options.inset ) {
listviewClasses += t.options.corners ? " ui-corner-all" : "";
listviewClasses += t.options.shadow ? " ui-shadow" : "";
}
// create listview markup
t.element.addClass( " ui-listview" + listviewClasses );
t.refresh( true );
},
// TODO: Remove in 1.5
_findFirstElementByTagName: function( ele, nextProp, lcName, ucName ) {
var dict = {};
dict[ lcName ] = dict[ ucName ] = true;
while ( ele ) {
if ( dict[ ele.nodeName ] ) {
return ele;
}
ele = ele[ nextProp ];
}
return null;
},
// TODO: Remove in 1.5
_addThumbClasses: function( containers ) {
var i, img, len = containers.length;
for ( i = 0; i < len; i++ ) {
img = $( this._findFirstElementByTagName( containers[ i ].firstChild, "nextSibling", "img", "IMG" ) );
if ( img.length ) {
$( this._findFirstElementByTagName( img[ 0 ].parentNode, "parentNode", "li", "LI" ) ).addClass( img.hasClass( "ui-li-icon" ) ? "ui-li-has-icon" : "ui-li-has-thumb" );
}
}
},
_getChildrenByTagName: function( ele, lcName, ucName ) {
var results = [],
dict = {};
dict[ lcName ] = dict[ ucName ] = true;
ele = ele.firstChild;
while ( ele ) {
if ( dict[ ele.nodeName ] ) {
results.push( ele );
}
ele = ele.nextSibling;
}
return $( results );
},
_beforeListviewRefresh: $.noop,
_afterListviewRefresh: $.noop,
refresh: function( create ) {
var buttonClass, pos, numli, item, itemClass, itemTheme, itemIcon, icon, a,
isDivider, startCount, newStartCount, value, last, splittheme, splitThemeClass, spliticon,
altButtonClass, dividerTheme, li,
o = this.options,
$list = this.element,
ol = !!$.nodeName( $list[ 0 ], "ol" ),
start = $list.attr( "start" ),
itemClassDict = {},
countBubbles = $list.find( ".ui-li-count" ),
countTheme = getAttr( $list[ 0 ], "counttheme" ) || this.options.countTheme,
countThemeClass = countTheme ? "ui-body-" + countTheme : "ui-body-inherit";
if ( o.theme ) {
$list.addClass( "ui-group-theme-" + o.theme );
}
// Check if a start attribute has been set while taking a value of 0 into account
if ( ol && ( start || start === 0 ) ) {
startCount = parseInt( start, 10 ) - 1;
$list.css( "counter-reset", "listnumbering " + startCount );
}
this._beforeListviewRefresh();
li = this._getChildrenByTagName( $list[ 0 ], "li", "LI" );
for ( pos = 0, numli = li.length; pos < numli; pos++ ) {
item = li.eq( pos );
itemClass = "";
if ( create || item[ 0 ].className.search( /\bui-li-static\b|\bui-li-divider\b/ ) < 0 ) {
a = this._getChildrenByTagName( item[ 0 ], "a", "A" );
isDivider = ( getAttr( item[ 0 ], "role" ) === "list-divider" );
value = item.attr( "value" );
itemTheme = getAttr( item[ 0 ], "theme" );
if ( a.length && a[ 0 ].className.search( /\bui-btn\b/ ) < 0 && !isDivider ) {
itemIcon = getAttr( item[ 0 ], "icon" );
icon = ( itemIcon === false ) ? false : ( itemIcon || o.icon );
// TODO: Remove in 1.5 together with links.js (links.js / .ui-link deprecated in 1.4)
a.removeClass( "ui-link" );
buttonClass = "ui-btn";
if ( itemTheme ) {
buttonClass += " ui-btn-" + itemTheme;
}
if ( a.length > 1 ) {
itemClass = "ui-li-has-alt";
last = a.last();
splittheme = getAttr( last[ 0 ], "theme" ) || o.splitTheme || getAttr( item[ 0 ], "theme", true );
splitThemeClass = splittheme ? " ui-btn-" + splittheme : "";
spliticon = getAttr( last[ 0 ], "icon" ) || getAttr( item[ 0 ], "icon" ) || o.splitIcon;
altButtonClass = "ui-btn ui-btn-icon-notext ui-icon-" + spliticon + splitThemeClass;
last
.attr( "title", $.trim( last.getEncodedText() ) )
.addClass( altButtonClass )
.empty();
} else if ( icon ) {
buttonClass += " ui-btn-icon-right ui-icon-" + icon;
}
a.first().addClass( buttonClass );
} else if ( isDivider ) {
dividerTheme = ( getAttr( item[ 0 ], "theme" ) || o.dividerTheme || o.theme );
itemClass = "ui-li-divider ui-bar-" + ( dividerTheme ? dividerTheme : "inherit" );
item.attr( "role", "heading" );
} else if ( a.length <= 0 ) {
itemClass = "ui-li-static ui-body-" + ( itemTheme ? itemTheme : "inherit" );
}
if ( ol && value ) {
newStartCount = parseInt( value , 10 ) - 1;
item.css( "counter-reset", "listnumbering " + newStartCount );
}
}
// Instead of setting item class directly on the list item
// at this point in time, push the item into a dictionary
// that tells us what class to set on it so we can do this after this
// processing loop is finished.
if ( !itemClassDict[ itemClass ] ) {
itemClassDict[ itemClass ] = [];
}
itemClassDict[ itemClass ].push( item[ 0 ] );
}
// Set the appropriate listview item classes on each list item.
// The main reason we didn't do this
// in the for-loop above is because we can eliminate per-item function overhead
// by calling addClass() and children() once or twice afterwards. This
// can give us a significant boost on platforms like WP7.5.
for ( itemClass in itemClassDict ) {
$( itemClassDict[ itemClass ] ).addClass( itemClass );
}
countBubbles.each( function() {
$( this ).closest( "li" ).addClass( "ui-li-has-count" );
});
if ( countThemeClass ) {
countBubbles.addClass( countThemeClass );
}
// Deprecated in 1.4. From 1.5 you have to add class ui-li-has-thumb or ui-li-has-icon to the LI.
this._addThumbClasses( li );
this._addThumbClasses( li.find( ".ui-btn" ) );
this._afterListviewRefresh();
this._addFirstLastClasses( li, this._getVisibles( li, create ), create );
}
}, $.mobile.behaviors.addFirstLastClasses ) );
})( jQuery );
(function( $, undefined ) {
function defaultAutodividersSelector( elt ) {
// look for the text in the given element
var text = $.trim( elt.text() ) || null;
if ( !text ) {
return null;
}
// create the text for the divider (first uppercased letter)
text = text.slice( 0, 1 ).toUpperCase();
return text;
}
$.widget( "mobile.listview", $.mobile.listview, {
options: {
autodividers: false,
autodividersSelector: defaultAutodividersSelector
},
_beforeListviewRefresh: function() {
if ( this.options.autodividers ) {
this._replaceDividers();
this._superApply( arguments );
}
},
_replaceDividers: function() {
var i, lis, li, dividerText,
lastDividerText = null,
list = this.element,
divider;
list.children( "li:jqmData(role='list-divider')" ).remove();
lis = list.children( "li" );
for ( i = 0; i < lis.length ; i++ ) {
li = lis[ i ];
dividerText = this.options.autodividersSelector( $( li ) );
if ( dividerText && lastDividerText !== dividerText ) {
divider = document.createElement( "li" );
divider.appendChild( document.createTextNode( dividerText ) );
divider.setAttribute( "data-" + $.mobile.ns + "role", "list-divider" );
li.parentNode.insertBefore( divider, li );
}
lastDividerText = dividerText;
}
}
});
})( jQuery );
(function( $, undefined ) {
var rdivider = /(^|\s)ui-li-divider($|\s)/,
rhidden = /(^|\s)ui-screen-hidden($|\s)/;
$.widget( "mobile.listview", $.mobile.listview, {
options: {
hideDividers: false
},
_afterListviewRefresh: function() {
var items, idx, item, hideDivider = true;
this._superApply( arguments );
if ( this.options.hideDividers ) {
items = this._getChildrenByTagName( this.element[ 0 ], "li", "LI" );
for ( idx = items.length - 1 ; idx > -1 ; idx-- ) {
item = items[ idx ];
if ( item.className.match( rdivider ) ) {
if ( hideDivider ) {
item.className = item.className + " ui-screen-hidden";
}
hideDivider = true;
} else {
if ( !item.className.match( rhidden ) ) {
hideDivider = false;
}
}
}
}
}
});
})( jQuery );
(function( $, undefined ) {
$.mobile.nojs = function( target ) {
$( ":jqmData(role='nojs')", target ).addClass( "ui-nojs" );
};
})( jQuery );
(function( $, undefined ) {
$.mobile.behaviors.formReset = {
_handleFormReset: function() {
this._on( this.element.closest( "form" ), {
reset: function() {
this._delay( "_reset" );
}
});
}
};
})( jQuery );
/*
* "checkboxradio" plugin
*/
(function( $, undefined ) {
$.widget( "mobile.checkboxradio", $.extend( {
initSelector: "input:not( :jqmData(role='flipswitch' ) )[type='checkbox'],input[type='radio']:not( :jqmData(role='flipswitch' ))",
options: {
theme: "inherit",
mini: false,
wrapperClass: null,
enhanced: false,
iconpos: "left"
},
_create: function() {
var input = this.element,
o = this.options,
inheritAttr = function( input, dataAttr ) {
return input.jqmData( dataAttr ) ||
input.closest( "form, fieldset" ).jqmData( dataAttr );
},
// NOTE: Windows Phone could not find the label through a selector
// filter works though.
parentLabel = input.closest( "label" ),
label = parentLabel.length ? parentLabel :
input
.closest( "form, fieldset, :jqmData(role='page'), :jqmData(role='dialog')" )
.find( "label" )
.filter( "[for='" + $.mobile.path.hashToSelector( input[0].id ) + "']" )
.first(),
inputtype = input[0].type,
checkedClass = "ui-" + inputtype + "-on",
uncheckedClass = "ui-" + inputtype + "-off";
if ( inputtype !== "checkbox" && inputtype !== "radio" ) {
return;
}
if ( this.element[0].disabled ) {
this.options.disabled = true;
}
o.iconpos = inheritAttr( input, "iconpos" ) || label.attr( "data-" + $.mobile.ns + "iconpos" ) || o.iconpos,
// Establish options
o.mini = inheritAttr( input, "mini" ) || o.mini;
// Expose for other methods
$.extend( this, {
input: input,
label: label,
parentLabel: parentLabel,
inputtype: inputtype,
checkedClass: checkedClass,
uncheckedClass: uncheckedClass
});
if ( !this.options.enhanced ) {
this._enhance();
}
this._on( label, {
vmouseover: "_handleLabelVMouseOver",
vclick: "_handleLabelVClick"
});
this._on( input, {
vmousedown: "_cacheVals",
vclick: "_handleInputVClick",
focus: "_handleInputFocus",
blur: "_handleInputBlur"
});
this._handleFormReset();
this.refresh();
},
_enhance: function() {
this.label.addClass( "ui-btn ui-corner-all");
if ( this.parentLabel.length > 0 ) {
this.input.add( this.label ).wrapAll( this._wrapper() );
} else {
//this.element.replaceWith( this.input.add( this.label ).wrapAll( this._wrapper() ) );
this.element.wrap( this._wrapper() );
this.element.parent().prepend( this.label );
}
// Wrap the input + label in a div
this._setOptions({
"theme": this.options.theme,
"iconpos": this.options.iconpos,
"mini": this.options.mini
});
},
_wrapper: function() {
return $( "<div class='" +
( this.options.wrapperClass ? this.options.wrapperClass : "" ) +
" ui-" + this.inputtype +
( this.options.disabled ? " ui-state-disabled" : "" ) + "' >" );
},
_handleInputFocus: function() {
this.label.addClass( $.mobile.focusClass );
},
_handleInputBlur: function() {
this.label.removeClass( $.mobile.focusClass );
},
_handleInputVClick: function() {
var $this = this.element;
// Adds checked attribute to checked input when keyboard is used
if ( $this.is( ":checked" ) ) {
$this.prop( "checked", true);
this._getInputSet().not( $this ).prop( "checked", false );
} else {
$this.prop( "checked", false );
}
this._updateAll();
},
_handleLabelVMouseOver: function( event ) {
if ( this.label.parent().hasClass( "ui-state-disabled" ) ) {
event.stopPropagation();
}
},
_handleLabelVClick: function( event ) {
var input = this.element;
if ( input.is( ":disabled" ) ) {
event.preventDefault();
return;
}
this._cacheVals();
input.prop( "checked", this.inputtype === "radio" && true || !input.prop( "checked" ) );
// trigger click handler's bound directly to the input as a substitute for
// how label clicks behave normally in the browsers
// TODO: it would be nice to let the browser's handle the clicks and pass them
// through to the associate input. we can swallow that click at the parent
// wrapper element level
input.triggerHandler( "click" );
// Input set for common radio buttons will contain all the radio
// buttons, but will not for checkboxes. clearing the checked status
// of other radios ensures the active button state is applied properly
this._getInputSet().not( input ).prop( "checked", false );
this._updateAll();
return false;
},
_cacheVals: function() {
this._getInputSet().each( function() {
$( this ).attr("data-" + $.mobile.ns + "cacheVal", this.checked );
});
},
//returns either a set of radios with the same name attribute, or a single checkbox
_getInputSet: function() {
if ( this.inputtype === "checkbox" ) {
return this.element;
}
return this.element.closest( "form, :jqmData(role='page'), :jqmData(role='dialog')" )
.find( "input[name='" + this.element[ 0 ].name + "'][type='" + this.inputtype + "']" );
},
_updateAll: function() {
var self = this;
this._getInputSet().each( function() {
var $this = $( this );
if ( this.checked || self.inputtype === "checkbox" ) {
$this.trigger( "change" );
}
})
.checkboxradio( "refresh" );
},
_reset: function() {
this.refresh();
},
// Is the widget supposed to display an icon?
_hasIcon: function() {
var controlgroup, controlgroupWidget,
controlgroupConstructor = $.mobile.controlgroup;
// If the controlgroup widget is defined ...
if ( controlgroupConstructor ) {
controlgroup = this.element.closest(
":mobile-controlgroup," +
controlgroupConstructor.prototype.initSelector );
// ... and the checkbox is in a controlgroup ...
if ( controlgroup.length > 0 ) {
// ... look for a controlgroup widget instance, and ...
controlgroupWidget = $.data( controlgroup[ 0 ], "mobile-controlgroup" );
// ... if found, decide based on the option value, ...
return ( ( controlgroupWidget ? controlgroupWidget.options.type :
// ... otherwise decide based on the "type" data attribute.
controlgroup.attr( "data-" + $.mobile.ns + "type" ) ) !== "horizontal" );
}
}
// Normally, the widget displays an icon.
return true;
},
refresh: function() {
var hasIcon = this._hasIcon(),
isChecked = this.element[ 0 ].checked,
active = $.mobile.activeBtnClass,
iconposClass = "ui-btn-icon-" + this.options.iconpos,
addClasses = [],
removeClasses = [];
if ( hasIcon ) {
removeClasses.push( active );
addClasses.push( iconposClass );
} else {
removeClasses.push( iconposClass );
( isChecked ? addClasses : removeClasses ).push( active );
}
if ( isChecked ) {
addClasses.push( this.checkedClass );
removeClasses.push( this.uncheckedClass );
} else {
addClasses.push( this.uncheckedClass );
removeClasses.push( this.checkedClass );
}
this.label
.addClass( addClasses.join( " " ) )
.removeClass( removeClasses.join( " " ) );
},
widget: function() {
return this.label.parent();
},
_setOptions: function( options ) {
var label = this.label,
currentOptions = this.options,
outer = this.widget(),
hasIcon = this._hasIcon();
if ( options.disabled !== undefined ) {
this.input.prop( "disabled", !!options.disabled );
outer.toggleClass( "ui-state-disabled", !!options.disabled );
}
if ( options.mini !== undefined ) {
outer.toggleClass( "ui-mini", !!options.mini );
}
if ( options.theme !== undefined ) {
label
.removeClass( "ui-btn-" + currentOptions.theme )
.addClass( "ui-btn-" + options.theme );
}
if ( options.wrapperClass !== undefined ) {
outer
.removeClass( currentOptions.wrapperClass )
.addClass( options.wrapperClass );
}
if ( options.iconpos !== undefined && hasIcon ) {
label.removeClass( "ui-btn-icon-" + currentOptions.iconpos ).addClass( "ui-btn-icon-" + options.iconpos );
} else if ( !hasIcon ) {
label.removeClass( "ui-btn-icon-" + currentOptions.iconpos );
}
this._super( options );
}
}, $.mobile.behaviors.formReset ) );
})( jQuery );
(function( $, undefined ) {
$.widget( "mobile.button", {
initSelector: "input[type='button'], input[type='submit'], input[type='reset']",
options: {
theme: null,
icon: null,
iconpos: "left",
iconshadow: false, /* TODO: Deprecated in 1.4, remove in 1.5. */
corners: true,
shadow: true,
inline: null,
mini: null,
wrapperClass: null,
enhanced: false
},
_create: function() {
if ( this.element.is( ":disabled" ) ) {
this.options.disabled = true;
}
if ( !this.options.enhanced ) {
this._enhance();
}
$.extend( this, {
wrapper: this.element.parent()
});
this._on( {
focus: function() {
this.widget().addClass( $.mobile.focusClass );
},
blur: function() {
this.widget().removeClass( $.mobile.focusClass );
}
});
this.refresh( true );
},
_enhance: function() {
this.element.wrap( this._button() );
},
_button: function() {
var options = this.options,
iconClasses = this._getIconClasses( this.options );
return $("<div class='ui-btn ui-input-btn" +
( options.wrapperClass ? " " + options.wrapperClass : "" ) +
( options.theme ? " ui-btn-" + options.theme : "" ) +
( options.corners ? " ui-corner-all" : "" ) +
( options.shadow ? " ui-shadow" : "" ) +
( options.inline ? " ui-btn-inline" : "" ) +
( options.mini ? " ui-mini" : "" ) +
( options.disabled ? " ui-state-disabled" : "" ) +
( iconClasses ? ( " " + iconClasses ) : "" ) +
"' >" + this.element.val() + "</div>" );
},
widget: function() {
return this.wrapper;
},
_destroy: function() {
this.element.insertBefore( this.button );
this.button.remove();
},
_getIconClasses: function( options ) {
return ( options.icon ? ( "ui-icon-" + options.icon +
( options.iconshadow ? " ui-shadow-icon" : "" ) + /* TODO: Deprecated in 1.4, remove in 1.5. */
" ui-btn-icon-" + options.iconpos ) : "" );
},
_setOptions: function( options ) {
var outer = this.widget();
if ( options.theme !== undefined ) {
outer
.removeClass( this.options.theme )
.addClass( "ui-btn-" + options.theme );
}
if ( options.corners !== undefined ) {
outer.toggleClass( "ui-corner-all", options.corners );
}
if ( options.shadow !== undefined ) {
outer.toggleClass( "ui-shadow", options.shadow );
}
if ( options.inline !== undefined ) {
outer.toggleClass( "ui-btn-inline", options.inline );
}
if ( options.mini !== undefined ) {
outer.toggleClass( "ui-mini", options.mini );
}
if ( options.disabled !== undefined ) {
this.element.prop( "disabled", options.disabled );
outer.toggleClass( "ui-state-disabled", options.disabled );
}
if ( options.icon !== undefined ||
options.iconshadow !== undefined || /* TODO: Deprecated in 1.4, remove in 1.5. */
options.iconpos !== undefined ) {
outer
.removeClass( this._getIconClasses( this.options ) )
.addClass( this._getIconClasses(
$.extend( {}, this.options, options ) ) );
}
this._super( options );
},
refresh: function( create ) {
if ( this.options.icon && this.options.iconpos === "notext" && this.element.attr( "title" ) ) {
this.element.attr( "title", this.element.val() );
}
if ( !create ) {
var originalElement = this.element.detach();
$( this.wrapper ).text( this.element.val() ).append( originalElement );
}
}
});
})( jQuery );
(function( $ ) {
var meta = $( "meta[name=viewport]" ),
initialContent = meta.attr( "content" ),
disabledZoom = initialContent + ",maximum-scale=1, user-scalable=no",
enabledZoom = initialContent + ",maximum-scale=10, user-scalable=yes",
disabledInitially = /(user-scalable[\s]*=[\s]*no)|(maximum-scale[\s]*=[\s]*1)[$,\s]/.test( initialContent );
$.mobile.zoom = $.extend( {}, {
enabled: !disabledInitially,
locked: false,
disable: function( lock ) {
if ( !disabledInitially && !$.mobile.zoom.locked ) {
meta.attr( "content", disabledZoom );
$.mobile.zoom.enabled = false;
$.mobile.zoom.locked = lock || false;
}
},
enable: function( unlock ) {
if ( !disabledInitially && ( !$.mobile.zoom.locked || unlock === true ) ) {
meta.attr( "content", enabledZoom );
$.mobile.zoom.enabled = true;
$.mobile.zoom.locked = false;
}
},
restore: function() {
if ( !disabledInitially ) {
meta.attr( "content", initialContent );
$.mobile.zoom.enabled = true;
}
}
});
}( jQuery ));
(function( $, undefined ) {
$.widget( "mobile.textinput", {
initSelector: "input[type='text']," +
"input[type='search']," +
":jqmData(type='search')," +
"input[type='number']," +
":jqmData(type='number')," +
"input[type='password']," +
"input[type='email']," +
"input[type='url']," +
"input[type='tel']," +
"textarea," +
"input[type='time']," +
"input[type='date']," +
"input[type='month']," +
"input[type='week']," +
"input[type='datetime']," +
"input[type='datetime-local']," +
"input[type='color']," +
"input:not([type])," +
"input[type='file']",
options: {
theme: null,
corners: true,
mini: false,
// This option defaults to true on iOS devices.
preventFocusZoom: /iPhone|iPad|iPod/.test( navigator.platform ) && navigator.userAgent.indexOf( "AppleWebKit" ) > -1,
wrapperClass: "",
enhanced: false
},
_create: function() {
var options = this.options,
isSearch = this.element.is( "[type='search'], :jqmData(type='search')" ),
isTextarea = this.element[ 0 ].tagName === "TEXTAREA",
isRange = this.element.is( "[data-" + ( $.mobile.ns || "" ) + "type='range']" ),
inputNeedsWrap = ( (this.element.is( "input" ) ||
this.element.is( "[data-" + ( $.mobile.ns || "" ) + "type='search']" ) ) &&
!isRange );
if ( this.element.prop( "disabled" ) ) {
options.disabled = true;
}
$.extend( this, {
classes: this._classesFromOptions(),
isSearch: isSearch,
isTextarea: isTextarea,
isRange: isRange,
inputNeedsWrap: inputNeedsWrap
});
this._autoCorrect();
if ( !options.enhanced ) {
this._enhance();
}
this._on( {
"focus": "_handleFocus",
"blur": "_handleBlur"
});
},
refresh: function() {
this.setOptions({
"disabled" : this.element.is( ":disabled" )
});
},
_enhance: function() {
var elementClasses = [];
if ( this.isTextarea ) {
elementClasses.push( "ui-input-text" );
}
if ( this.isTextarea || this.isRange ) {
elementClasses.push( "ui-shadow-inset" );
}
//"search" and "text" input widgets
if ( this.inputNeedsWrap ) {
this.element.wrap( this._wrap() );
} else {
elementClasses = elementClasses.concat( this.classes );
}
this.element.addClass( elementClasses.join( " " ) );
},
widget: function() {
return ( this.inputNeedsWrap ) ? this.element.parent() : this.element;
},
_classesFromOptions: function() {
var options = this.options,
classes = [];
classes.push( "ui-body-" + ( ( options.theme === null ) ? "inherit" : options.theme ) );
if ( options.corners ) {
classes.push( "ui-corner-all" );
}
if ( options.mini ) {
classes.push( "ui-mini" );
}
if ( options.disabled ) {
classes.push( "ui-state-disabled" );
}
if ( options.wrapperClass ) {
classes.push( options.wrapperClass );
}
return classes;
},
_wrap: function() {
return $( "<div class='" +
( this.isSearch ? "ui-input-search " : "ui-input-text " ) +
this.classes.join( " " ) + " " +
"ui-shadow-inset'></div>" );
},
_autoCorrect: function() {
// XXX: Temporary workaround for issue 785 (Apple bug 8910589).
// Turn off autocorrect and autocomplete on non-iOS 5 devices
// since the popup they use can't be dismissed by the user. Note
// that we test for the presence of the feature by looking for
// the autocorrect property on the input element. We currently
// have no test for iOS 5 or newer so we're temporarily using
// the touchOverflow support flag for jQM 1.0. Yes, I feel dirty.
// - jblas
if ( typeof this.element[0].autocorrect !== "undefined" &&
!$.support.touchOverflow ) {
// Set the attribute instead of the property just in case there
// is code that attempts to make modifications via HTML.
this.element[0].setAttribute( "autocorrect", "off" );
this.element[0].setAttribute( "autocomplete", "off" );
}
},
_handleBlur: function() {
this.widget().removeClass( $.mobile.focusClass );
if ( this.options.preventFocusZoom ) {
$.mobile.zoom.enable( true );
}
},
_handleFocus: function() {
// In many situations, iOS will zoom into the input upon tap, this
// prevents that from happening
if ( this.options.preventFocusZoom ) {
$.mobile.zoom.disable( true );
}
this.widget().addClass( $.mobile.focusClass );
},
_setOptions: function ( options ) {
var outer = this.widget();
this._super( options );
if ( !( options.disabled === undefined &&
options.mini === undefined &&
options.corners === undefined &&
options.theme === undefined &&
options.wrapperClass === undefined ) ) {
outer.removeClass( this.classes.join( " " ) );
this.classes = this._classesFromOptions();
outer.addClass( this.classes.join( " " ) );
}
if ( options.disabled !== undefined ) {
this.element.prop( "disabled", !!options.disabled );
}
},
_destroy: function() {
if ( this.options.enhanced ) {
return;
}
if ( this.inputNeedsWrap ) {
this.element.unwrap();
}
this.element.removeClass( "ui-input-text " + this.classes.join( " " ) );
}
});
})( jQuery );
(function( $, undefined ) {
$.widget( "mobile.slider", $.extend( {
initSelector: "input[type='range'], :jqmData(type='range'), :jqmData(role='slider')",
widgetEventPrefix: "slide",
options: {
theme: null,
trackTheme: null,
corners: true,
mini: false,
highlight: false
},
_create: function() {
// TODO: Each of these should have comments explain what they're for
var self = this,
control = this.element,
trackTheme = this.options.trackTheme || $.mobile.getAttribute( control[ 0 ], "theme" ),
trackThemeClass = trackTheme ? " ui-bar-" + trackTheme : " ui-bar-inherit",
cornerClass = ( this.options.corners || control.jqmData( "corners" ) ) ? " ui-corner-all" : "",
miniClass = ( this.options.mini || control.jqmData( "mini" ) ) ? " ui-mini" : "",
cType = control[ 0 ].nodeName.toLowerCase(),
isToggleSwitch = ( cType === "select" ),
isRangeslider = control.parent().is( ":jqmData(role='rangeslider')" ),
selectClass = ( isToggleSwitch ) ? "ui-slider-switch" : "",
controlID = control.attr( "id" ),
$label = $( "[for='" + controlID + "']" ),
labelID = $label.attr( "id" ) || controlID + "-label",
min = !isToggleSwitch ? parseFloat( control.attr( "min" ) ) : 0,
max = !isToggleSwitch ? parseFloat( control.attr( "max" ) ) : control.find( "option" ).length-1,
step = window.parseFloat( control.attr( "step" ) || 1 ),
domHandle = document.createElement( "a" ),
handle = $( domHandle ),
domSlider = document.createElement( "div" ),
slider = $( domSlider ),
valuebg = this.options.highlight && !isToggleSwitch ? (function() {
var bg = document.createElement( "div" );
bg.className = "ui-slider-bg " + $.mobile.activeBtnClass;
return $( bg ).prependTo( slider );
})() : false,
options,
wrapper,
j, length,
i, optionsCount, origTabIndex,
side, activeClass, sliderImg;
$label.attr( "id", labelID );
this.isToggleSwitch = isToggleSwitch;
domHandle.setAttribute( "href", "#" );
domSlider.setAttribute( "role", "application" );
domSlider.className = [ this.isToggleSwitch ? "ui-slider ui-slider-track ui-shadow-inset " : "ui-slider-track ui-shadow-inset ", selectClass, trackThemeClass, cornerClass, miniClass ].join( "" );
domHandle.className = "ui-slider-handle";
domSlider.appendChild( domHandle );
handle.attr({
"role": "slider",
"aria-valuemin": min,
"aria-valuemax": max,
"aria-valuenow": this._value(),
"aria-valuetext": this._value(),
"title": this._value(),
"aria-labelledby": labelID
});
$.extend( this, {
slider: slider,
handle: handle,
control: control,
type: cType,
step: step,
max: max,
min: min,
valuebg: valuebg,
isRangeslider: isRangeslider,
dragging: false,
beforeStart: null,
userModified: false,
mouseMoved: false
});
if ( isToggleSwitch ) {
// TODO: restore original tabindex (if any) in a destroy method
origTabIndex = control.attr( "tabindex" );
if ( origTabIndex ) {
handle.attr( "tabindex", origTabIndex );
}
control.attr( "tabindex", "-1" ).focus(function() {
$( this ).blur();
handle.focus();
});
wrapper = document.createElement( "div" );
wrapper.className = "ui-slider-inneroffset";
for ( j = 0, length = domSlider.childNodes.length; j < length; j++ ) {
wrapper.appendChild( domSlider.childNodes[j] );
}
domSlider.appendChild( wrapper );
// slider.wrapInner( "<div class='ui-slider-inneroffset'></div>" );
// make the handle move with a smooth transition
handle.addClass( "ui-slider-handle-snapping" );
options = control.find( "option" );
for ( i = 0, optionsCount = options.length; i < optionsCount; i++ ) {
side = !i ? "b" : "a";
activeClass = !i ? "" : " " + $.mobile.activeBtnClass;
sliderImg = document.createElement( "span" );
sliderImg.className = [ "ui-slider-label ui-slider-label-", side, activeClass ].join( "" );
sliderImg.setAttribute( "role", "img" );
sliderImg.appendChild( document.createTextNode( options[i].innerHTML ) );
$( sliderImg ).prependTo( slider );
}
self._labels = $( ".ui-slider-label", slider );
}
// monitor the input for updated values
control.addClass( isToggleSwitch ? "ui-slider-switch" : "ui-slider-input" );
this._on( control, {
"change": "_controlChange",
"keyup": "_controlKeyup",
"blur": "_controlBlur",
"vmouseup": "_controlVMouseUp"
});
slider.bind( "vmousedown", $.proxy( this._sliderVMouseDown, this ) )
.bind( "vclick", false );
// We have to instantiate a new function object for the unbind to work properly
// since the method itself is defined in the prototype (causing it to unbind everything)
this._on( document, { "vmousemove": "_preventDocumentDrag" });
this._on( slider.add( document ), { "vmouseup": "_sliderVMouseUp" });
slider.insertAfter( control );
// wrap in a div for styling purposes
if ( !isToggleSwitch && !isRangeslider ) {
wrapper = this.options.mini ? "<div class='ui-slider ui-mini'>" : "<div class='ui-slider'>";
control.add( slider ).wrapAll( wrapper );
}
// bind the handle event callbacks and set the context to the widget instance
this._on( this.handle, {
"vmousedown": "_handleVMouseDown",
"keydown": "_handleKeydown",
"keyup": "_handleKeyup"
});
this.handle.bind( "vclick", false );
this._handleFormReset();
this.refresh( undefined, undefined, true );
},
_setOptions: function( options ) {
if ( options.theme !== undefined ) {
this._setTheme( options.theme );
}
if ( options.trackTheme !== undefined ) {
this._setTrackTheme( options.trackTheme );
}
if ( options.corners !== undefined ) {
this._setCorners( options.corners );
}
if ( options.mini !== undefined ) {
this._setMini( options.mini );
}
if ( options.highlight !== undefined ) {
this._setHighlight( options.highlight );
}
if ( options.disabled !== undefined ) {
this._setDisabled( options.disabled );
}
this._super( options );
},
_controlChange: function( event ) {
// if the user dragged the handle, the "change" event was triggered from inside refresh(); don't call refresh() again
if ( this._trigger( "controlchange", event ) === false ) {
return false;
}
if ( !this.mouseMoved ) {
this.refresh( this._value(), true );
}
},
_controlKeyup: function(/* event */) { // necessary?
this.refresh( this._value(), true, true );
},
_controlBlur: function(/* event */) {
this.refresh( this._value(), true );
},
// it appears the clicking the up and down buttons in chrome on
// range/number inputs doesn't trigger a change until the field is
// blurred. Here we check thif the value has changed and refresh
_controlVMouseUp: function(/* event */) {
this._checkedRefresh();
},
// NOTE force focus on handle
_handleVMouseDown: function(/* event */) {
this.handle.focus();
},
_handleKeydown: function( event ) {
var index = this._value();
if ( this.options.disabled ) {
return;
}
// In all cases prevent the default and mark the handle as active
switch ( event.keyCode ) {
case $.mobile.keyCode.HOME:
case $.mobile.keyCode.END:
case $.mobile.keyCode.PAGE_UP:
case $.mobile.keyCode.PAGE_DOWN:
case $.mobile.keyCode.UP:
case $.mobile.keyCode.RIGHT:
case $.mobile.keyCode.DOWN:
case $.mobile.keyCode.LEFT:
event.preventDefault();
if ( !this._keySliding ) {
this._keySliding = true;
this.handle.addClass( "ui-state-active" ); /* TODO: We don't use this class for styling. Do we need to add it? */
}
break;
}
// move the slider according to the keypress
switch ( event.keyCode ) {
case $.mobile.keyCode.HOME:
this.refresh( this.min );
break;
case $.mobile.keyCode.END:
this.refresh( this.max );
break;
case $.mobile.keyCode.PAGE_UP:
case $.mobile.keyCode.UP:
case $.mobile.keyCode.RIGHT:
this.refresh( index + this.step );
break;
case $.mobile.keyCode.PAGE_DOWN:
case $.mobile.keyCode.DOWN:
case $.mobile.keyCode.LEFT:
this.refresh( index - this.step );
break;
}
}, // remove active mark
_handleKeyup: function(/* event */) {
if ( this._keySliding ) {
this._keySliding = false;
this.handle.removeClass( "ui-state-active" ); /* See comment above. */
}
},
_sliderVMouseDown: function( event ) {
// NOTE: we don't do this in refresh because we still want to
// support programmatic alteration of disabled inputs
if ( this.options.disabled || !( event.which === 1 || event.which === 0 || event.which === undefined ) ) {
return false;
}
if ( this._trigger( "beforestart", event ) === false ) {
return false;
}
this.dragging = true;
this.userModified = false;
this.mouseMoved = false;
if ( this.isToggleSwitch ) {
this.beforeStart = this.element[0].selectedIndex;
}
this.refresh( event );
this._trigger( "start" );
return false;
},
_sliderVMouseUp: function() {
if ( this.dragging ) {
this.dragging = false;
if ( this.isToggleSwitch ) {
// make the handle move with a smooth transition
this.handle.addClass( "ui-slider-handle-snapping" );
if ( this.mouseMoved ) {
// this is a drag, change the value only if user dragged enough
if ( this.userModified ) {
this.refresh( this.beforeStart === 0 ? 1 : 0 );
} else {
this.refresh( this.beforeStart );
}
} else {
// this is just a click, change the value
this.refresh( this.beforeStart === 0 ? 1 : 0 );
}
}
this.mouseMoved = false;
this._trigger( "stop" );
return false;
}
},
_preventDocumentDrag: function( event ) {
// NOTE: we don't do this in refresh because we still want to
// support programmatic alteration of disabled inputs
if ( this._trigger( "drag", event ) === false) {
return false;
}
if ( this.dragging && !this.options.disabled ) {
// this.mouseMoved must be updated before refresh() because it will be used in the control "change" event
this.mouseMoved = true;
if ( this.isToggleSwitch ) {
// make the handle move in sync with the mouse
this.handle.removeClass( "ui-slider-handle-snapping" );
}
this.refresh( event );
// only after refresh() you can calculate this.userModified
this.userModified = this.beforeStart !== this.element[0].selectedIndex;
return false;
}
},
_checkedRefresh: function() {
if ( this.value !== this._value() ) {
this.refresh( this._value() );
}
},
_value: function() {
return this.isToggleSwitch ? this.element[0].selectedIndex : parseFloat( this.element.val() ) ;
},
_reset: function() {
this.refresh( undefined, false, true );
},
refresh: function( val, isfromControl, preventInputUpdate ) {
// NOTE: we don't return here because we want to support programmatic
// alteration of the input value, which should still update the slider
var self = this,
parentTheme = $.mobile.getAttribute( this.element[ 0 ], "theme" ),
theme = this.options.theme || parentTheme,
themeClass = theme ? " ui-btn-" + theme : "",
trackTheme = this.options.trackTheme || parentTheme,
trackThemeClass = trackTheme ? " ui-bar-" + trackTheme : " ui-bar-inherit",
cornerClass = this.options.corners ? " ui-corner-all" : "",
miniClass = this.options.mini ? " ui-mini" : "",
left, width, data, tol,
pxStep, percent,
control, isInput, optionElements, min, max, step,
newval, valModStep, alignValue, percentPerStep,
handlePercent, aPercent, bPercent,
valueChanged;
self.slider[0].className = [ this.isToggleSwitch ? "ui-slider ui-slider-switch ui-slider-track ui-shadow-inset" : "ui-slider-track ui-shadow-inset", trackThemeClass, cornerClass, miniClass ].join( "" );
if ( this.options.disabled || this.element.prop( "disabled" ) ) {
this.disable();
}
// set the stored value for comparison later
this.value = this._value();
if ( this.options.highlight && !this.isToggleSwitch && this.slider.find( ".ui-slider-bg" ).length === 0 ) {
this.valuebg = (function() {
var bg = document.createElement( "div" );
bg.className = "ui-slider-bg " + $.mobile.activeBtnClass;
return $( bg ).prependTo( self.slider );
})();
}
this.handle.addClass( "ui-btn" + themeClass + " ui-shadow" );
control = this.element;
isInput = !this.isToggleSwitch;
optionElements = isInput ? [] : control.find( "option" );
min = isInput ? parseFloat( control.attr( "min" ) ) : 0;
max = isInput ? parseFloat( control.attr( "max" ) ) : optionElements.length - 1;
step = ( isInput && parseFloat( control.attr( "step" ) ) > 0 ) ? parseFloat( control.attr( "step" ) ) : 1;
if ( typeof val === "object" ) {
data = val;
// a slight tolerance helped get to the ends of the slider
tol = 8;
left = this.slider.offset().left;
width = this.slider.width();
pxStep = width/((max-min)/step);
if ( !this.dragging ||
data.pageX < left - tol ||
data.pageX > left + width + tol ) {
return;
}
if ( pxStep > 1 ) {
percent = ( ( data.pageX - left ) / width ) * 100;
} else {
percent = Math.round( ( ( data.pageX - left ) / width ) * 100 );
}
} else {
if ( val == null ) {
val = isInput ? parseFloat( control.val() || 0 ) : control[0].selectedIndex;
}
percent = ( parseFloat( val ) - min ) / ( max - min ) * 100;
}
if ( isNaN( percent ) ) {
return;
}
newval = ( percent / 100 ) * ( max - min ) + min;
//from jQuery UI slider, the following source will round to the nearest step
valModStep = ( newval - min ) % step;
alignValue = newval - valModStep;
if ( Math.abs( valModStep ) * 2 >= step ) {
alignValue += ( valModStep > 0 ) ? step : ( -step );
}
percentPerStep = 100/((max-min)/step);
// Since JavaScript has problems with large floats, round
// the final value to 5 digits after the decimal point (see jQueryUI: #4124)
newval = parseFloat( alignValue.toFixed(5) );
if ( typeof pxStep === "undefined" ) {
pxStep = width / ( (max-min) / step );
}
if ( pxStep > 1 && isInput ) {
percent = ( newval - min ) * percentPerStep * ( 1 / step );
}
if ( percent < 0 ) {
percent = 0;
}
if ( percent > 100 ) {
percent = 100;
}
if ( newval < min ) {
newval = min;
}
if ( newval > max ) {
newval = max;
}
this.handle.css( "left", percent + "%" );
this.handle[0].setAttribute( "aria-valuenow", isInput ? newval : optionElements.eq( newval ).attr( "value" ) );
this.handle[0].setAttribute( "aria-valuetext", isInput ? newval : optionElements.eq( newval ).getEncodedText() );
this.handle[0].setAttribute( "title", isInput ? newval : optionElements.eq( newval ).getEncodedText() );
if ( this.valuebg ) {
this.valuebg.css( "width", percent + "%" );
}
// drag the label widths
if ( this._labels ) {
handlePercent = this.handle.width() / this.slider.width() * 100;
aPercent = percent && handlePercent + ( 100 - handlePercent ) * percent / 100;
bPercent = percent === 100 ? 0 : Math.min( handlePercent + 100 - aPercent, 100 );
this._labels.each(function() {
var ab = $( this ).hasClass( "ui-slider-label-a" );
$( this ).width( ( ab ? aPercent : bPercent ) + "%" );
});
}
if ( !preventInputUpdate ) {
valueChanged = false;
// update control"s value
if ( isInput ) {
valueChanged = control.val() !== newval;
control.val( newval );
} else {
valueChanged = control[ 0 ].selectedIndex !== newval;
control[ 0 ].selectedIndex = newval;
}
if ( this._trigger( "beforechange", val ) === false) {
return false;
}
if ( !isfromControl && valueChanged ) {
control.trigger( "change" );
}
}
},
_setHighlight: function( value ) {
value = !!value;
if ( value ) {
this.options.highlight = !!value;
this.refresh();
} else if ( this.valuebg ) {
this.valuebg.remove();
this.valuebg = false;
}
},
_setTheme: function( value ) {
this.handle
.removeClass( "ui-btn-" + this.options.theme )
.addClass( "ui-btn-" + value );
var currentTheme = this.options.theme ? this.options.theme : "inherit",
newTheme = value ? value : "inherit";
this.control
.removeClass( "ui-body-" + currentTheme )
.addClass( "ui-body-" + newTheme );
},
_setTrackTheme: function( value ) {
var currentTrackTheme = this.options.trackTheme ? this.options.trackTheme : "inherit",
newTrackTheme = value ? value : "inherit";
this.slider
.removeClass( "ui-body-" + currentTrackTheme )
.addClass( "ui-body-" + newTrackTheme );
},
_setMini: function( value ) {
value = !!value;
if ( !this.isToggleSwitch && !this.isRangeslider ) {
this.slider.parent().toggleClass( "ui-mini", value );
this.element.toggleClass( "ui-mini", value );
}
this.slider.toggleClass( "ui-mini", value );
},
_setCorners: function( value ) {
this.slider.toggleClass( "ui-corner-all", value );
if ( !this.isToggleSwitch ) {
this.control.toggleClass( "ui-corner-all", value );
}
},
_setDisabled: function( value ) {
value = !!value;
this.element.prop( "disabled", value );
this.slider.toggleClass( "ui-state-disabled" ).attr( "aria-disabled", value );
}
}, $.mobile.behaviors.formReset ) );
})( jQuery );
(function( $, undefined ) {
var popup;
function getPopup() {
if ( !popup ) {
popup = $( "<div></div>", {
"class": "ui-slider-popup ui-shadow ui-corner-all"
});
}
return popup.clone();
}
$.widget( "mobile.slider", $.mobile.slider, {
options: {
popupEnabled: false,
showValue: false
},
_create: function() {
this._super();
$.extend( this, {
_currentValue: null,
_popup: null,
_popupVisible: false
});
this._setOption( "popupEnabled", this.options.popupEnabled );
this._on( this.handle, { "vmousedown" : "_showPopup" } );
this._on( this.slider.add( this.document ), { "vmouseup" : "_hidePopup" } );
this._refresh();
},
// position the popup centered 5px above the handle
_positionPopup: function() {
var dstOffset = this.handle.offset();
this._popup.offset( {
left: dstOffset.left + ( this.handle.width() - this._popup.width() ) / 2,
top: dstOffset.top - this._popup.outerHeight() - 5
});
},
_setOption: function( key, value ) {
this._super( key, value );
if ( key === "showValue" ) {
this.handle.html( value && !this.options.mini ? this._value() : "" );
} else if ( key === "popupEnabled" ) {
if ( value && !this._popup ) {
this._popup = getPopup()
.addClass( "ui-body-" + ( this.options.theme || "a" ) )
.insertBefore( this.element );
}
}
},
// show value on the handle and in popup
refresh: function() {
this._super.apply( this, arguments );
this._refresh();
},
_refresh: function() {
var o = this.options, newValue;
if ( o.popupEnabled ) {
// remove the title attribute from the handle (which is
// responsible for the annoying tooltip); NB we have
// to do it here as the jqm slider sets it every time
// the slider's value changes :(
this.handle.removeAttr( "title" );
}
newValue = this._value();
if ( newValue === this._currentValue ) {
return;
}
this._currentValue = newValue;
if ( o.popupEnabled && this._popup ) {
this._positionPopup();
this._popup.html( newValue );
} else if ( o.showValue && !this.options.mini ) {
this.handle.html( newValue );
}
},
_showPopup: function() {
if ( this.options.popupEnabled && !this._popupVisible ) {
this.handle.html( "" );
this._popup.show();
this._positionPopup();
this._popupVisible = true;
}
},
_hidePopup: function() {
var o = this.options;
if ( o.popupEnabled && this._popupVisible ) {
if ( o.showValue && !o.mini ) {
this.handle.html( this._value() );
}
this._popup.hide();
this._popupVisible = false;
}
}
});
})( jQuery );
(function( $, undefined ) {
$.widget( "mobile.flipswitch", $.extend({
options: {
onText: "On",
offText: "Off",
theme: null,
enhanced: false,
wrapperClass: null,
corners: true,
mini: false
},
_create: function() {
if ( !this.options.enhanced ) {
this._enhance();
} else {
$.extend( this, {
flipswitch: this.element.parent(),
on: this.element.find( ".ui-flipswitch-on" ).eq( 0 ),
off: this.element.find( ".ui-flipswitch-off" ).eq(0),
type: this.element.get( 0 ).tagName
});
}
this._handleFormReset();
if ( this.element.is( ":disabled" ) ) {
this._setOptions({
"disabled": true
});
}
this._on( this.flipswitch, {
"click": "_toggle",
"swipeleft": "_left",
"swiperight": "_right"
});
this._on( this.on, {
"keydown": "_keydown"
});
this._on( {
"change": "refresh"
});
},
widget: function() {
return this.flipswitch;
},
_left: function() {
this.flipswitch.removeClass( "ui-flipswitch-active" );
if ( this.type === "SELECT" ) {
this.element.get( 0 ).selectedIndex = 0;
} else {
this.element.prop( "checked", false );
}
this.element.trigger( "change" );
},
_right: function() {
this.flipswitch.addClass( "ui-flipswitch-active" );
if ( this.type === "SELECT" ) {
this.element.get( 0 ).selectedIndex = 1;
} else {
this.element.prop( "checked", true );
}
this.element.trigger( "change" );
},
_enhance: function() {
var flipswitch = $( "<div>" ),
options = this.options,
element = this.element,
theme = options.theme ? options.theme : "inherit",
on = $( "<span></span>", { tabindex: 1 } ),
off = $( "<span></span>" ),
type = element.get( 0 ).tagName,
onText = ( type === "INPUT" ) ?
options.onText : element.find( "option" ).eq( 1 ).text(),
offText = ( type === "INPUT" ) ?
options.offText : element.find( "option" ).eq( 0 ).text();
on
.addClass( "ui-flipswitch-on ui-btn ui-shadow ui-btn-inherit" )
.text( onText );
off
.addClass( "ui-flipswitch-off" )
.text( offText );
flipswitch
.addClass( "ui-flipswitch ui-shadow-inset " +
"ui-bar-" + theme + " " +
( options.wrapperClass ? options.wrapperClass : "" ) + " " +
( ( element.is( ":checked" ) ||
element
.find( "option" )
.eq( 1 )
.is( ":selected" ) ) ? "ui-flipswitch-active" : "" ) +
( element.is(":disabled") ? " ui-state-disabled": "") +
( options.corners ? " ui-corner-all": "" ) +
( options.mini ? " ui-mini": "" ) )
.append( on, off );
element
.addClass( "ui-flipswitch-input" )
.after( flipswitch )
.appendTo( flipswitch );
$.extend( this, {
flipswitch: flipswitch,
on: on,
off: off,
type: type
});
},
_reset: function() {
this.refresh();
},
refresh: function() {
var direction,
existingDirection = this.flipswitch.hasClass( "ui-flipswitch-active" ) ? "_right" : "_left";
if ( this.type === "SELECT" ) {
direction = ( this.element.get( 0 ).selectedIndex > 0 ) ? "_right": "_left";
} else {
direction = this.element.prop( "checked" ) ? "_right": "_left";
}
if ( direction !== existingDirection ) {
this[ direction ]();
}
},
_toggle: function() {
var direction = this.flipswitch.hasClass( "ui-flipswitch-active" ) ? "_left" : "_right";
this[ direction ]();
},
_keydown: function( e ) {
if ( e.which === $.mobile.keyCode.LEFT ) {
this._left();
} else if ( e.which === $.mobile.keyCode.RIGHT ) {
this._right();
} else if ( e.which === $.mobile.keyCode.SPACE ) {
this._toggle();
e.preventDefault();
}
},
_setOptions: function( options ) {
if ( options.theme !== undefined ) {
var currentTheme = options.theme ? options.theme : "inherit",
newTheme = options.theme ? options.theme : "inherit";
this.widget()
.removeClass( "ui-bar-" + currentTheme )
.addClass( "ui-bar-" + newTheme );
}
if ( options.onText !== undefined ) {
this.on.text( options.onText );
}
if ( options.offText !== undefined ) {
this.off.text( options.offText );
}
if ( options.disabled !== undefined ) {
this.widget().toggleClass( "ui-state-disabled", options.disabled );
}
if ( options.mini !== undefined ) {
this.widget().toggleClass( "ui-mini", options.mini );
}
if ( options.corners !== undefined ) {
this.widget().toggleClass( "ui-corner-all", options.corners );
}
this._super( options );
},
_destroy: function() {
if ( this.options.enhanced ) {
return;
}
this.on.remove();
this.off.remove();
this.element.unwrap();
this.flipswitch.remove();
this.removeClass( "ui-flipswitch-input" );
}
}, $.mobile.behaviors.formReset ) );
})( jQuery );
(function( $, undefined ) {
$.widget( "mobile.rangeslider", $.extend( {
options: {
theme: null,
trackTheme: null,
corners: true,
mini: false,
highlight: true
},
_create: function() {
var $el = this.element,
elClass = this.options.mini ? "ui-rangeslider ui-mini" : "ui-rangeslider",
_inputFirst = $el.find( "input" ).first(),
_inputLast = $el.find( "input" ).last(),
_label = $el.find( "label" ).first(),
_sliderWidgetFirst = $.data( _inputFirst.get( 0 ), "mobile-slider" ) ||
$.data( _inputFirst.slider().get( 0 ), "mobile-slider" ),
_sliderWidgetLast = $.data( _inputLast.get(0), "mobile-slider" ) ||
$.data( _inputLast.slider().get( 0 ), "mobile-slider" ),
_sliderFirst = _sliderWidgetFirst.slider,
_sliderLast = _sliderWidgetLast.slider,
firstHandle = _sliderWidgetFirst.handle,
_sliders = $( "<div class='ui-rangeslider-sliders' />" ).appendTo( $el );
_inputFirst.addClass( "ui-rangeslider-first" );
_inputLast.addClass( "ui-rangeslider-last" );
$el.addClass( elClass );
_sliderFirst.appendTo( _sliders );
_sliderLast.appendTo( _sliders );
_label.insertBefore( $el );
firstHandle.prependTo( _sliderLast );
$.extend( this, {
_inputFirst: _inputFirst,
_inputLast: _inputLast,
_sliderFirst: _sliderFirst,
_sliderLast: _sliderLast,
_label: _label,
_targetVal: null,
_sliderTarget: false,
_sliders: _sliders,
_proxy: false
});
this.refresh();
this._on( this.element.find( "input.ui-slider-input" ), {
"slidebeforestart": "_slidebeforestart",
"slidestop": "_slidestop",
"slidedrag": "_slidedrag",
"slidebeforechange": "_change",
"blur": "_change",
"keyup": "_change"
});
this._on({
"mousedown":"_change"
});
this._on( this.element.closest( "form" ), {
"reset":"_handleReset"
});
this._on( firstHandle, {
"vmousedown": "_dragFirstHandle"
});
},
_handleReset: function() {
var self = this;
//we must wait for the stack to unwind before updateing other wise sliders will not have updated yet
setTimeout( function() {
self._updateHighlight();
},0);
},
_dragFirstHandle: function( event ) {
//if the first handle is dragged send the event to the first slider
$.data( this._inputFirst.get(0), "mobile-slider" ).dragging = true;
$.data( this._inputFirst.get(0), "mobile-slider" ).refresh( event );
return false;
},
_slidedrag: function( event ) {
var first = $( event.target ).is( this._inputFirst ),
otherSlider = ( first ) ? this._inputLast : this._inputFirst;
this._sliderTarget = false;
//if the drag was initiated on an extreme and the other handle is focused send the events to
//the closest handle
if ( ( this._proxy === "first" && first ) || ( this._proxy === "last" && !first ) ) {
$.data( otherSlider.get(0), "mobile-slider" ).dragging = true;
$.data( otherSlider.get(0), "mobile-slider" ).refresh( event );
return false;
}
},
_slidestop: function( event ) {
var first = $( event.target ).is( this._inputFirst );
this._proxy = false;
//this stops dragging of the handle and brings the active track to the front
//this makes clicks on the track go the the last handle used
this.element.find( "input" ).trigger( "vmouseup" );
this._sliderFirst.css( "z-index", first ? 1 : "" );
},
_slidebeforestart: function( event ) {
this._sliderTarget = false;
//if the track is the target remember this and the original value
if ( $( event.originalEvent.target ).hasClass( "ui-slider-track" ) ) {
this._sliderTarget = true;
this._targetVal = $( event.target ).val();
}
},
_setOptions: function( options ) {
if ( options.theme !== undefined ) {
this._setTheme( options.theme );
}
if ( options.trackTheme !== undefined ) {
this._setTrackTheme( options.trackTheme );
}
if ( options.mini !== undefined ) {
this._setMini( options.mini );
}
if ( options.highlight !== undefined ) {
this._setHighlight( options.highlight );
}
this._super( options );
this.refresh();
},
refresh: function() {
var $el = this.element,
o = this.options;
if ( this._inputFirst.is( ":disabled" ) || this._inputLast.is( ":disabled" ) ) {
this.options.disabled = true;
}
$el.find( "input" ).slider({
theme: o.theme,
trackTheme: o.trackTheme,
disabled: o.disabled,
corners: o.corners,
mini: o.mini,
highlight: o.highlight
}).slider( "refresh" );
this._updateHighlight();
},
_change: function( event ) {
if ( event.type === "keyup" ) {
this._updateHighlight();
return false;
}
var self = this,
min = parseFloat( this._inputFirst.val(), 10 ),
max = parseFloat( this._inputLast.val(), 10 ),
first = $( event.target ).hasClass( "ui-rangeslider-first" ),
thisSlider = first ? this._inputFirst : this._inputLast,
otherSlider = first ? this._inputLast : this._inputFirst;
if ( ( this._inputFirst.val() > this._inputLast.val() && event.type === "mousedown" && !$(event.target).hasClass("ui-slider-handle")) ) {
thisSlider.blur();
} else if ( event.type === "mousedown" ) {
return;
}
if ( min > max && !this._sliderTarget ) {
//this prevents min from being greater then max
thisSlider.val( first ? max: min ).slider( "refresh" );
this._trigger( "normalize" );
} else if ( min > max ) {
//this makes it so clicks on the target on either extreme go to the closest handle
thisSlider.val( this._targetVal ).slider( "refresh" );
//You must wait for the stack to unwind so first slider is updated before updating second
setTimeout( function() {
otherSlider.val( first ? min: max ).slider( "refresh" );
$.data( otherSlider.get(0), "mobile-slider" ).handle.focus();
self._sliderFirst.css( "z-index", first ? "" : 1 );
self._trigger( "normalize" );
}, 0 );
this._proxy = ( first ) ? "first" : "last";
}
//fixes issue where when both _sliders are at min they cannot be adjusted
if ( min === max ) {
$.data( thisSlider.get(0), "mobile-slider" ).handle.css( "z-index", 1 );
$.data( otherSlider.get(0), "mobile-slider" ).handle.css( "z-index", 0 );
} else {
$.data( otherSlider.get(0), "mobile-slider" ).handle.css( "z-index", "" );
$.data( thisSlider.get(0), "mobile-slider" ).handle.css( "z-index", "" );
}
this._updateHighlight();
if ( min >= max ) {
return false;
}
},
_updateHighlight: function() {
var min = parseInt( $.data( this._inputFirst.get(0), "mobile-slider" ).handle.get(0).style.left, 10 ),
max = parseInt( $.data( this._inputLast.get(0), "mobile-slider" ).handle.get(0).style.left, 10 ),
width = (max - min);
this.element.find( ".ui-slider-bg" ).css({
"margin-left": min + "%",
"width": width + "%"
});
},
_setTheme: function( value ) {
this._inputFirst.slider( "option", "theme", value );
this._inputLast.slider( "option", "theme", value );
},
_setTrackTheme: function( value ) {
this._inputFirst.slider( "option", "trackTheme", value );
this._inputLast.slider( "option", "trackTheme", value );
},
_setMini: function( value ) {
this._inputFirst.slider( "option", "mini", value );
this._inputLast.slider( "option", "mini", value );
this.element.toggleClass( "ui-mini", !!value );
},
_setHighlight: function( value ) {
this._inputFirst.slider( "option", "highlight", value );
this._inputLast.slider( "option", "highlight", value );
},
_destroy: function() {
this._label.prependTo( this.element );
this.element.removeClass( "ui-rangeslider ui-mini" );
this._inputFirst.after( this._sliderFirst );
this._inputLast.after( this._sliderLast );
this._sliders.remove();
this.element.find( "input" ).removeClass( "ui-rangeslider-first ui-rangeslider-last" ).slider( "destroy" );
}
}, $.mobile.behaviors.formReset ) );
})( jQuery );
(function( $, undefined ) {
$.widget( "mobile.textinput", $.mobile.textinput, {
options: {
clearBtn: false,
clearBtnText: "Clear text"
},
_create: function() {
this._super();
if ( !!this.options.clearBtn || this.isSearch ) {
this._addClearBtn();
}
},
clearButton: function() {
return $( "<a href='#' class='ui-input-clear ui-btn ui-icon-delete ui-btn-icon-notext ui-corner-all" +
"' title='" + this.options.clearBtnText + "'>" + this.options.clearBtnText + "</a>" );
},
_clearBtnClick: function( event ) {
this.element.val( "" )
.focus()
.trigger( "change" );
this._clearBtn.addClass( "ui-input-clear-hidden" );
event.preventDefault();
},
_addClearBtn: function() {
if ( !this.options.enhanced ) {
this._enhanceClear();
}
$.extend( this, {
_clearBtn: this.widget().find("a.ui-input-clear")
});
this._bindClearEvents();
this._toggleClear();
},
_enhanceClear: function() {
this.clearButton().appendTo( this.widget() );
this.widget().addClass( "ui-input-has-clear" );
},
_bindClearEvents: function() {
this._on( this._clearBtn, {
"click": "_clearBtnClick"
});
this._on({
"keyup": "_toggleClear",
"change": "_toggleClear",
"input": "_toggleClear",
"focus": "_toggleClear",
"blur": "_toggleClear",
"cut": "_toggleClear",
"paste": "_toggleClear"
});
},
_unbindClear: function() {
this._off( this._clearBtn, "click");
this._off( this.element, "keyup change input focus blur cut paste" );
},
_setOptions: function( options ) {
this._super( options );
if ( options.clearbtn !== undefined && !this.element.is( "textarea, :jqmData(type='range')" ) ) {
if ( options.clearBtn ) {
this._addClearBtn();
} else {
this._destroyClear();
}
}
if ( options.clearBtnText !== undefined && this._clearBtn !== undefined ) {
this._clearBtn.text( options.clearBtnText );
}
},
_toggleClear: function() {
this._delay( "_toggleClearClass", 0 );
},
_toggleClearClass: function() {
this._clearBtn.toggleClass( "ui-input-clear-hidden", !this.element.val() );
},
_destroyClear: function() {
this.element.removeClass( "ui-input-has-clear" );
this._unbindClear()._clearBtn.remove();
},
_destroy: function() {
this._super();
this._destroyClear();
}
});
})( jQuery );
(function( $, undefined ) {
$.widget( "mobile.textinput", $.mobile.textinput, {
options: {
autogrow:true,
keyupTimeoutBuffer: 100
},
_create: function() {
this._super();
if ( this.options.autogrow && this.isTextarea ) {
this._autogrow();
}
},
_autogrow: function() {
this._on({
"keyup": "_timeout",
"change": "_timeout",
"input": "_timeout",
"paste": "_timeout",
});
// Attach to the various you-have-become-visible notifications that the
// various framework elements emit.
// TODO: Remove all but the updatelayout handler once #6426 is fixed.
this._on( true, this.document, {
// TODO: Move to non-deprecated event
"pageshow": "_handleShow",
"popupbeforeposition": "_handleShow",
"updatelayout": "_handleShow",
"panelopen": "_handleShow"
});
},
// Synchronously fix the widget height if this widget's parents are such
// that they show/hide content at runtime. We still need to check whether
// the widget is actually visible in case it is contained inside multiple
// such containers. For example: panel contains collapsible contains
// autogrow textinput. The panel may emit "panelopen" indicating that its
// content has become visible, but the collapsible is still collapsed, so
// the autogrow textarea is still not visible.
_handleShow: function( event ) {
if ( $.contains( event.target, this.element[ 0 ] ) &&
this.element.is( ":visible" ) ) {
if ( event.type !== "popupbeforeposition" ) {
this.element
.addClass( "ui-textinput-autogrow-resize" )
.one( "transitionend webkitTransitionEnd oTransitionEnd",
$.proxy( function() {
this.element.removeClass( "ui-textinput-autogrow-resize" );
}, this ) );
}
this._prepareHeightUpdate();
}
},
_unbindAutogrow: function() {
this._off( this.element, "keyup change input paste" );
this._off( this.document,
"pageshow popupbeforeposition updatelayout panelopen" );
},
keyupTimeout: null,
_prepareHeightUpdate: function( delay ) {
if ( this.keyupTimeout ) {
clearTimeout( this.keyupTimeout );
}
if ( delay === undefined ) {
this._updateHeight();
} else {
this.keyupTimeout = this._delay( "_updateHeight", delay );
}
},
_timeout: function() {
this._prepareHeightUpdate( this.options.keyupTimeoutBuffer );
},
_updateHeight: function() {
this.keyupTimeout = 0;
this.element.css({
"height": 0,
"min-height": 0,
"max-height": 0
});
var paddingTop, paddingBottom, paddingHeight,
scrollHeight = this.element[ 0 ].scrollHeight,
clientHeight = this.element[ 0 ].clientHeight,
borderTop = parseFloat( this.element.css( "border-top-width" ) ),
borderBottom = parseFloat( this.element.css( "border-bottom-width" ) ),
borderHeight = borderTop + borderBottom,
height = scrollHeight + borderHeight + 15;
// Issue 6179: Padding is not included in scrollHeight and
// clientHeight by Firefox if no scrollbar is visible. Because
// textareas use the border-box box-sizing model, padding should be
// included in the new (assigned) height. Because the height is set
// to 0, clientHeight == 0 in Firefox. Therefore, we can use this to
// check if padding must be added.
if ( clientHeight === 0 ) {
paddingTop = parseFloat( this.element.css( "padding-top" ) );
paddingBottom = parseFloat( this.element.css( "padding-bottom" ) );
paddingHeight = paddingTop + paddingBottom;
height += paddingHeight;
}
this.element.css({
"height": height,
"min-height": "",
"max-height": ""
});
},
refresh: function() {
if ( this.options.autogrow && this.isTextarea ) {
this._updateHeight();
}
},
_setOptions: function( options ) {
this._super( options );
if ( options.autogrow !== undefined && this.isTextarea ) {
if ( options.autogrow ) {
this._autogrow();
} else {
this._unbindAutogrow();
}
}
}
});
})( jQuery );
(function( $, undefined ) {
$.widget( "mobile.selectmenu", $.extend( {
initSelector: "select:not( :jqmData(role='slider')):not( :jqmData(role='flipswitch') )",
options: {
theme: null,
icon: "carat-d",
iconpos: "right",
inline: false,
corners: true,
shadow: true,
iconshadow: false, /* TODO: Deprecated in 1.4, remove in 1.5. */
overlayTheme: null,
dividerTheme: null,
hidePlaceholderMenuItems: true,
closeText: "Close",
nativeMenu: true,
// This option defaults to true on iOS devices.
preventFocusZoom: /iPhone|iPad|iPod/.test( navigator.platform ) && navigator.userAgent.indexOf( "AppleWebKit" ) > -1,
mini: false
},
_button: function() {
return $( "<div/>" );
},
_setDisabled: function( value ) {
this.element.attr( "disabled", value );
this.button.attr( "aria-disabled", value );
return this._setOption( "disabled", value );
},
_focusButton : function() {
var self = this;
setTimeout( function() {
self.button.focus();
}, 40);
},
_selectOptions: function() {
return this.select.find( "option" );
},
// setup items that are generally necessary for select menu extension
_preExtension: function() {
var inline = this.options.inline || this.element.jqmData( "inline" ),
mini = this.options.mini || this.element.jqmData( "mini" ),
classes = "";
// TODO: Post 1.1--once we have time to test thoroughly--any classes manually applied to the original element should be carried over to the enhanced element, with an `-enhanced` suffix. See https://github.com/jquery/jquery-mobile/issues/3577
/* if ( $el[0].className.length ) {
classes = $el[0].className;
} */
if ( !!~this.element[0].className.indexOf( "ui-btn-left" ) ) {
classes = " ui-btn-left";
}
if ( !!~this.element[0].className.indexOf( "ui-btn-right" ) ) {
classes = " ui-btn-right";
}
if ( inline ) {
classes += " ui-btn-inline";
}
if ( mini ) {
classes += " ui-mini";
}
this.select = this.element.removeClass( "ui-btn-left ui-btn-right" ).wrap( "<div class='ui-select" + classes + "'>" );
this.selectId = this.select.attr( "id" ) || ( "select-" + this.uuid );
this.buttonId = this.selectId + "-button";
this.label = $( "label[for='"+ this.selectId +"']" );
this.isMultiple = this.select[ 0 ].multiple;
},
_destroy: function() {
var wrapper = this.element.parents( ".ui-select" );
if ( wrapper.length > 0 ) {
if ( wrapper.is( ".ui-btn-left, .ui-btn-right" ) ) {
this.element.addClass( wrapper.hasClass( "ui-btn-left" ) ? "ui-btn-left" : "ui-btn-right" );
}
this.element.insertAfter( wrapper );
wrapper.remove();
}
},
_create: function() {
this._preExtension();
this.button = this._button();
var self = this,
options = this.options,
iconpos = options.icon ? ( options.iconpos || this.select.jqmData( "iconpos" ) ) : false,
button = this.button
.insertBefore( this.select )
.attr( "id", this.buttonId )
.addClass( "ui-btn" +
( options.icon ? ( " ui-icon-" + options.icon + " ui-btn-icon-" + iconpos +
( options.iconshadow ? " ui-shadow-icon" : "" ) ) : "" ) + /* TODO: Remove in 1.5. */
( options.theme ? " ui-btn-" + options.theme : "" ) +
( options.corners ? " ui-corner-all" : "" ) +
( options.shadow ? " ui-shadow" : "" ) );
this.setButtonText();
// Opera does not properly support opacity on select elements
// In Mini, it hides the element, but not its text
// On the desktop,it seems to do the opposite
// for these reasons, using the nativeMenu option results in a full native select in Opera
if ( options.nativeMenu && window.opera && window.opera.version ) {
button.addClass( "ui-select-nativeonly" );
}
// Add counter for multi selects
if ( this.isMultiple ) {
this.buttonCount = $( "<span>" )
.addClass( "ui-li-count ui-body-inherit" )
.hide()
.appendTo( button.addClass( "ui-li-has-count" ) );
}
// Disable if specified
if ( options.disabled || this.element.attr( "disabled" )) {
this.disable();
}
// Events on native select
this.select.change(function() {
self.refresh();
if ( !!options.nativeMenu ) {
this.blur();
}
});
this._handleFormReset();
this._on( this.button, {
keydown: "_handleKeydown"
});
this.build();
},
build: function() {
var self = this;
this.select
.appendTo( self.button )
.bind( "vmousedown", function() {
// Add active class to button
self.button.addClass( $.mobile.activeBtnClass );
})
.bind( "focus", function() {
self.button.addClass( $.mobile.focusClass );
})
.bind( "blur", function() {
self.button.removeClass( $.mobile.focusClass );
})
.bind( "focus vmouseover", function() {
self.button.trigger( "vmouseover" );
})
.bind( "vmousemove", function() {
// Remove active class on scroll/touchmove
self.button.removeClass( $.mobile.activeBtnClass );
})
.bind( "change blur vmouseout", function() {
self.button.trigger( "vmouseout" )
.removeClass( $.mobile.activeBtnClass );
});
// In many situations, iOS will zoom into the select upon tap, this prevents that from happening
self.button.bind( "vmousedown", function() {
if ( self.options.preventFocusZoom ) {
$.mobile.zoom.disable( true );
}
});
self.label.bind( "click focus", function() {
if ( self.options.preventFocusZoom ) {
$.mobile.zoom.disable( true );
}
});
self.select.bind( "focus", function() {
if ( self.options.preventFocusZoom ) {
$.mobile.zoom.disable( true );
}
});
self.button.bind( "mouseup", function() {
if ( self.options.preventFocusZoom ) {
setTimeout(function() {
$.mobile.zoom.enable( true );
}, 0 );
}
});
self.select.bind( "blur", function() {
if ( self.options.preventFocusZoom ) {
$.mobile.zoom.enable( true );
}
});
},
selected: function() {
return this._selectOptions().filter( ":selected" );
},
selectedIndices: function() {
var self = this;
return this.selected().map(function() {
return self._selectOptions().index( this );
}).get();
},
setButtonText: function() {
var self = this,
selected = this.selected(),
text = this.placeholder,
span = $( document.createElement( "span" ) );
this.button.children( "span" ).not( ".ui-li-count" ).remove().end().end().prepend( (function() {
if ( selected.length ) {
text = selected.map(function() {
return $( this ).text();
}).get().join( ", " );
} else {
text = self.placeholder;
}
if ( text ) {
span.text( text );
} else {
span.html( " " );
}
// TODO possibly aggregate multiple select option classes
return span
.addClass( self.select.attr( "class" ) )
.addClass( selected.attr( "class" ) )
.removeClass( "ui-screen-hidden" );
})());
},
setButtonCount: function() {
var selected = this.selected();
// multiple count inside button
if ( this.isMultiple ) {
this.buttonCount[ selected.length > 1 ? "show" : "hide" ]().text( selected.length );
}
},
_handleKeydown: function( /* event */ ) {
this._delay( "_refreshButton" );
},
_reset: function() {
this.refresh();
},
_refreshButton: function() {
this.setButtonText();
this.setButtonCount();
},
refresh: function() {
this._refreshButton();
},
// open and close preserved in native selects
// to simplify users code when looping over selects
open: $.noop,
close: $.noop,
disable: function() {
this._setDisabled( true );
this.button.addClass( "ui-state-disabled" );
},
enable: function() {
this._setDisabled( false );
this.button.removeClass( "ui-state-disabled" );
}
}, $.mobile.behaviors.formReset ) );
})( jQuery );
(function( $, undefined ) {
$.mobile.links = function( target ) {
//links within content areas, tests included with page
$( target )
.find( "a" )
.jqmEnhanceable()
.filter( ":jqmData(rel='popup')[href][href!='']" )
.each( function() {
// Accessibility info for popups
var element = this,
idref = element.getAttribute( "href" ).substring( 1 );
if ( idref ) {
element.setAttribute( "aria-haspopup", true );
element.setAttribute( "aria-owns", idref );
element.setAttribute( "aria-expanded", false );
}
})
.end()
.not( ".ui-btn, :jqmData(role='none'), :jqmData(role='nojs')" )
.addClass( "ui-link" );
};
})( jQuery );
(function( $, undefined ) {
function fitSegmentInsideSegment( windowSize, segmentSize, offset, desired ) {
var returnValue = desired;
if ( windowSize < segmentSize ) {
// Center segment if it's bigger than the window
returnValue = offset + ( windowSize - segmentSize ) / 2;
} else {
// Otherwise center it at the desired coordinate while keeping it completely inside the window
returnValue = Math.min( Math.max( offset, desired - segmentSize / 2 ), offset + windowSize - segmentSize );
}
return returnValue;
}
function getWindowCoordinates( theWindow ) {
return {
x: theWindow.scrollLeft(),
y: theWindow.scrollTop(),
cx: ( theWindow[ 0 ].innerWidth || theWindow.width() ),
cy: ( theWindow[ 0 ].innerHeight || theWindow.height() )
};
}
$.widget( "mobile.popup", {
options: {
wrapperClass: null,
theme: null,
overlayTheme: null,
shadow: true,
corners: true,
transition: "none",
positionTo: "origin",
tolerance: null,
closeLinkSelector: "a:jqmData(rel='back')",
closeLinkEvents: "click.popup",
navigateEvents: "navigate.popup",
closeEvents: "navigate.popup pagebeforechange.popup",
dismissible: true,
enhanced: false,
// NOTE Windows Phone 7 has a scroll position caching issue that
// requires us to disable popup history management by default
// https://github.com/jquery/jquery-mobile/issues/4784
//
// NOTE this option is modified in _create!
history: !$.mobile.browser.oldIE
},
_create: function() {
var theElement = this.element,
myId = theElement.attr( "id" ),
currentOptions = this.options;
// We need to adjust the history option to be false if there's no AJAX nav.
// We can't do it in the option declarations because those are run before
// it is determined whether there shall be AJAX nav.
currentOptions.history = currentOptions.history && $.mobile.ajaxEnabled && $.mobile.hashListeningEnabled;
// Define instance variables
$.extend( this, {
_scrollTop: 0,
_page: theElement.closest( ".ui-page" ),
_ui: null,
_fallbackTransition: "",
_currentTransition: false,
_prerequisites: null,
_isOpen: false,
_tolerance: null,
_resizeData: null,
_ignoreResizeTo: 0,
_orientationchangeInProgress: false
});
if ( this._page.length === 0 ) {
this._page = $( "body" );
}
if ( currentOptions.enhanced ) {
this._ui = {
container: theElement.parent(),
screen: theElement.parent().prev(),
placeholder: $( this.document[ 0 ].getElementById( myId + "-placeholder" ) )
};
} else {
this._ui = this._enhance( theElement, myId );
this._applyTransition( currentOptions.transition );
}
this
._setTolerance( currentOptions.tolerance )
._ui.focusElement = this._ui.container;
// Event handlers
this._on( this._ui.screen, { "vclick": "_eatEventAndClose" } );
this._on( this.window, {
orientationchange: $.proxy( this, "_handleWindowOrientationchange" ),
resize: $.proxy( this, "_handleWindowResize" ),
keyup: $.proxy( this, "_handleWindowKeyUp" )
});
this._on( this.document, { "focusin": "_handleDocumentFocusIn" } );
},
_enhance: function( theElement, myId ) {
var currentOptions = this.options,
wrapperClass = currentOptions.wrapperClass,
ui = {
screen: $( "<div class='ui-screen-hidden ui-popup-screen " +
this._themeClassFromOption( "ui-overlay-", currentOptions.overlayTheme ) + "'></div>" ),
placeholder: $( "<div style='display: none;'><!-- placeholder --></div>" ),
container: $( "<div class='ui-popup-container ui-popup-hidden ui-popup-truncate" +
( wrapperClass ? ( " " + wrapperClass ) : "" ) + "'></div>" )
},
fragment = this.document[ 0 ].createDocumentFragment();
fragment.appendChild( ui.screen[ 0 ] );
fragment.appendChild( ui.container[ 0 ] );
if ( myId ) {
ui.screen.attr( "id", myId + "-screen" );
ui.container.attr( "id", myId + "-popup" );
ui.placeholder
.attr( "id", myId + "-placeholder" )
.html( "<!-- placeholder for " + myId + " -->" );
}
// Apply the proto
this._page[ 0 ].appendChild( fragment );
// Leave a placeholder where the element used to be
ui.placeholder.insertAfter( theElement );
theElement
.detach()
.addClass( "ui-popup " +
this._themeClassFromOption( "ui-body-", currentOptions.theme ) + " " +
( currentOptions.shadow ? "ui-overlay-shadow " : "" ) +
( currentOptions.corners ? "ui-corner-all " : "" ) )
.appendTo( ui.container );
return ui;
},
_eatEventAndClose: function( theEvent ) {
theEvent.preventDefault();
theEvent.stopImmediatePropagation();
if ( this.options.dismissible ) {
this.close();
}
return false;
},
// Make sure the screen covers the entire document - CSS is sometimes not
// enough to accomplish this.
_resizeScreen: function() {
var screen = this._ui.screen,
popupHeight = this._ui.container.outerHeight( true ),
screenHeight = screen.removeAttr( "style" ).height(),
// Subtracting 1 here is necessary for an obscure Andrdoid 4.0 bug where
// the browser hangs if the screen covers the entire document :/
documentHeight = this.document.height() - 1;
if ( screenHeight < documentHeight ) {
screen.height( documentHeight );
} else if ( popupHeight > screenHeight ) {
screen.height( popupHeight );
}
},
_handleWindowKeyUp: function( theEvent ) {
if ( this._isOpen && theEvent.keyCode === $.mobile.keyCode.ESCAPE ) {
return this._eatEventAndClose( theEvent );
}
},
_expectResizeEvent: function() {
var windowCoordinates = getWindowCoordinates( this.window );
if ( this._resizeData ) {
if ( windowCoordinates.x === this._resizeData.windowCoordinates.x &&
windowCoordinates.y === this._resizeData.windowCoordinates.y &&
windowCoordinates.cx === this._resizeData.windowCoordinates.cx &&
windowCoordinates.cy === this._resizeData.windowCoordinates.cy ) {
// timeout not refreshed
return false;
} else {
// clear existing timeout - it will be refreshed below
clearTimeout( this._resizeData.timeoutId );
}
}
this._resizeData = {
timeoutId: this._delay( "_resizeTimeout", 200 ),
windowCoordinates: windowCoordinates
};
return true;
},
_resizeTimeout: function() {
if ( this._isOpen ) {
if ( !this._expectResizeEvent() ) {
if ( this._ui.container.hasClass( "ui-popup-hidden" ) ) {
// effectively rapid-open the popup while leaving the screen intact
this._ui.container.removeClass( "ui-popup-hidden ui-popup-truncate" );
this.reposition( { positionTo: "window" } );
this._ignoreResizeEvents();
}
this._resizeScreen();
this._resizeData = null;
this._orientationchangeInProgress = false;
}
} else {
this._resizeData = null;
this._orientationchangeInProgress = false;
}
},
_stopIgnoringResizeEvents: function() {
this._ignoreResizeTo = 0;
},
_ignoreResizeEvents: function() {
if ( this._ignoreResizeTo ) {
clearTimeout( this._ignoreResizeTo );
}
this._ignoreResizeTo = this._delay( "_stopIgnoringResizeEvents", 1000 );
},
_handleWindowResize: function(/* theEvent */) {
if ( this._isOpen && this._ignoreResizeTo === 0 ) {
if ( ( this._expectResizeEvent() || this._orientationchangeInProgress ) &&
!this._ui.container.hasClass( "ui-popup-hidden" ) ) {
// effectively rapid-close the popup while leaving the screen intact
this._ui.container
.addClass( "ui-popup-hidden ui-popup-truncate" )
.removeAttr( "style" );
}
}
},
_handleWindowOrientationchange: function(/* theEvent */) {
if ( !this._orientationchangeInProgress && this._isOpen && this._ignoreResizeTo === 0 ) {
this._expectResizeEvent();
this._orientationchangeInProgress = true;
}
},
// When the popup is open, attempting to focus on an element that is not a
// child of the popup will redirect focus to the popup
_handleDocumentFocusIn: function( theEvent ) {
var target,
targetElement = theEvent.target,
ui = this._ui;
if ( !this._isOpen ) {
return;
}
if ( targetElement !== ui.container[ 0 ] ) {
target = $( targetElement );
if ( 0 === target.parents().filter( ui.container[ 0 ] ).length ) {
$( this.document[ 0 ].activeElement ).one( "focus", function(/* theEvent */) {
target.blur();
});
ui.focusElement.focus();
theEvent.preventDefault();
theEvent.stopImmediatePropagation();
return false;
} else if ( ui.focusElement[ 0 ] === ui.container[ 0 ] ) {
ui.focusElement = target;
}
}
this._ignoreResizeEvents();
},
_themeClassFromOption: function( prefix, value ) {
return ( value ? ( value === "none" ? "" : ( prefix + value ) ) : ( prefix + "inherit" ) );
},
_applyTransition: function( value ) {
if ( value ) {
this._ui.container.removeClass( this._fallbackTransition );
if ( value !== "none" ) {
this._fallbackTransition = $.mobile._maybeDegradeTransition( value );
if ( this._fallbackTransition === "none" ) {
this._fallbackTransition = "";
}
this._ui.container.addClass( this._fallbackTransition );
}
}
return this;
},
_setOptions: function( newOptions ) {
var currentOptions = this.options,
theElement = this.element,
screen = this._ui.screen;
if ( newOptions.wrapperClass !== undefined ) {
this._ui.container
.removeClass( currentOptions.wrapperClass )
.addClass( newOptions.wrapperClass );
}
if ( newOptions.theme !== undefined ) {
theElement
.removeClass( this._themeClassFromOption( "ui-body-", currentOptions.theme ) )
.addClass( this._themeClassFromOption( "ui-body-", newOptions.theme ) );
}
if ( newOptions.overlayTheme !== undefined ) {
screen
.removeClass( this._themeClassFromOption( "ui-overlay-", currentOptions.overlayTheme ) )
.addClass( this._themeClassFromOption( "ui-overlay-", newOptions.overlayTheme ) );
if ( this._isOpen ) {
screen.addClass( "in" );
}
}
if ( newOptions.shadow !== undefined ) {
theElement.toggleClass( "ui-overlay-shadow", newOptions.shadow );
}
if ( newOptions.corners !== undefined ) {
theElement.toggleClass( "ui-corner-all", newOptions.corners );
}
if ( newOptions.transition !== undefined ) {
if ( !this._currentTransition ) {
this._applyTransition( newOptions.transition );
}
}
if ( newOptions.tolerance !== undefined ) {
this._setTolerance( newOptions.tolerance );
}
if ( newOptions.disabled !== undefined ) {
if ( newOptions.disabled ) {
this.close();
}
}
return this._super( newOptions );
},
_setTolerance: function( value ) {
var tol = { t: 30, r: 15, b: 30, l: 15 },
ar;
if ( value !== undefined ) {
ar = String( value ).split( "," );
$.each( ar, function( idx, val ) { ar[ idx ] = parseInt( val, 10 ); } );
switch( ar.length ) {
// All values are to be the same
case 1:
if ( !isNaN( ar[ 0 ] ) ) {
tol.t = tol.r = tol.b = tol.l = ar[ 0 ];
}
break;
// The first value denotes top/bottom tolerance, and the second value denotes left/right tolerance
case 2:
if ( !isNaN( ar[ 0 ] ) ) {
tol.t = tol.b = ar[ 0 ];
}
if ( !isNaN( ar[ 1 ] ) ) {
tol.l = tol.r = ar[ 1 ];
}
break;
// The array contains values in the order top, right, bottom, left
case 4:
if ( !isNaN( ar[ 0 ] ) ) {
tol.t = ar[ 0 ];
}
if ( !isNaN( ar[ 1 ] ) ) {
tol.r = ar[ 1 ];
}
if ( !isNaN( ar[ 2 ] ) ) {
tol.b = ar[ 2 ];
}
if ( !isNaN( ar[ 3 ] ) ) {
tol.l = ar[ 3 ];
}
break;
default:
break;
}
}
this._tolerance = tol;
return this;
},
_clampPopupWidth: function( infoOnly ) {
var menuSize,
windowCoordinates = getWindowCoordinates( this.window ),
// rectangle within which the popup must fit
rectangle = {
x: this._tolerance.l,
y: windowCoordinates.y + this._tolerance.t,
cx: windowCoordinates.cx - this._tolerance.l - this._tolerance.r,
cy: windowCoordinates.cy - this._tolerance.t - this._tolerance.b
};
if ( !infoOnly ) {
// Clamp the width of the menu before grabbing its size
this._ui.container.css( "max-width", rectangle.cx );
}
menuSize = {
cx: this._ui.container.outerWidth( true ),
cy: this._ui.container.outerHeight( true )
};
return { rc: rectangle, menuSize: menuSize };
},
_calculateFinalLocation: function( desired, clampInfo ) {
var returnValue,
rectangle = clampInfo.rc,
menuSize = clampInfo.menuSize;
// Center the menu over the desired coordinates, while not going outside
// the window tolerances. This will center wrt. the window if the popup is
// too large.
returnValue = {
left: fitSegmentInsideSegment( rectangle.cx, menuSize.cx, rectangle.x, desired.x ),
top: fitSegmentInsideSegment( rectangle.cy, menuSize.cy, rectangle.y, desired.y )
};
// Make sure the top of the menu is visible
returnValue.top = Math.max( 0, returnValue.top );
// If the height of the menu is smaller than the height of the document
// align the bottom with the bottom of the document
returnValue.top -= Math.min( returnValue.top,
Math.max( 0, returnValue.top + menuSize.cy - this.document.height() ) );
return returnValue;
},
// Try and center the overlay over the given coordinates
_placementCoords: function( desired ) {
return this._calculateFinalLocation( desired, this._clampPopupWidth() );
},
_createPrerequisites: function( screenPrerequisite, containerPrerequisite, whenDone ) {
var prerequisites,
self = this;
// It is important to maintain both the local variable prerequisites and
// self._prerequisites. The local variable remains in the closure of the
// functions which call the callbacks passed in. The comparison between the
// local variable and self._prerequisites is necessary, because once a
// function has been passed to .animationComplete() it will be called next
// time an animation completes, even if that's not the animation whose end
// the function was supposed to catch (for example, if an abort happens
// during the opening animation, the .animationComplete handler is not
// called for that animation anymore, but the handler remains attached, so
// it is called the next time the popup is opened - making it stale.
// Comparing the local variable prerequisites to the widget-level variable
// self._prerequisites ensures that callbacks triggered by a stale
// .animationComplete will be ignored.
prerequisites = {
screen: $.Deferred(),
container: $.Deferred()
};
prerequisites.screen.then( function() {
if ( prerequisites === self._prerequisites ) {
screenPrerequisite();
}
});
prerequisites.container.then( function() {
if ( prerequisites === self._prerequisites ) {
containerPrerequisite();
}
});
$.when( prerequisites.screen, prerequisites.container ).done( function() {
if ( prerequisites === self._prerequisites ) {
self._prerequisites = null;
whenDone();
}
});
self._prerequisites = prerequisites;
},
_animate: function( args ) {
// NOTE before removing the default animation of the screen
// this had an animate callback that would resolve the deferred
// now the deferred is resolved immediately
// TODO remove the dependency on the screen deferred
this._ui.screen
.removeClass( args.classToRemove )
.addClass( args.screenClassToAdd );
args.prerequisites.screen.resolve();
if ( args.transition && args.transition !== "none" ) {
if ( args.applyTransition ) {
this._applyTransition( args.transition );
}
if ( this._fallbackTransition ) {
this._ui.container
.animationComplete( $.proxy( args.prerequisites.container, "resolve" ) )
.addClass( args.containerClassToAdd )
.removeClass( args.classToRemove );
return;
}
}
this._ui.container.removeClass( args.classToRemove );
args.prerequisites.container.resolve();
},
// The desired coordinates passed in will be returned untouched if no reference element can be identified via
// desiredPosition.positionTo. Nevertheless, this function ensures that its return value always contains valid
// x and y coordinates by specifying the center middle of the window if the coordinates are absent.
// options: { x: coordinate, y: coordinate, positionTo: string: "origin", "window", or jQuery selector
_desiredCoords: function( openOptions ) {
var offset,
dst = null,
windowCoordinates = getWindowCoordinates( this.window ),
x = openOptions.x,
y = openOptions.y,
pTo = openOptions.positionTo;
// Establish which element will serve as the reference
if ( pTo && pTo !== "origin" ) {
if ( pTo === "window" ) {
x = windowCoordinates.cx / 2 + windowCoordinates.x;
y = windowCoordinates.cy / 2 + windowCoordinates.y;
} else {
try {
dst = $( pTo );
} catch( err ) {
dst = null;
}
if ( dst ) {
dst.filter( ":visible" );
if ( dst.length === 0 ) {
dst = null;
}
}
}
}
// If an element was found, center over it
if ( dst ) {
offset = dst.offset();
x = offset.left + dst.outerWidth() / 2;
y = offset.top + dst.outerHeight() / 2;
}
// Make sure x and y are valid numbers - center over the window
if ( $.type( x ) !== "number" || isNaN( x ) ) {
x = windowCoordinates.cx / 2 + windowCoordinates.x;
}
if ( $.type( y ) !== "number" || isNaN( y ) ) {
y = windowCoordinates.cy / 2 + windowCoordinates.y;
}
return { x: x, y: y };
},
_reposition: function( openOptions ) {
// We only care about position-related parameters for repositioning
openOptions = {
x: openOptions.x,
y: openOptions.y,
positionTo: openOptions.positionTo
};
this._trigger( "beforeposition", undefined, openOptions );
this._ui.container.offset( this._placementCoords( this._desiredCoords( openOptions ) ) );
},
reposition: function( openOptions ) {
if ( this._isOpen ) {
this._reposition( openOptions );
}
},
_openPrerequisitesComplete: function() {
var id = this.element.attr( "id" );
this._ui.container.addClass( "ui-popup-active" );
this._isOpen = true;
this._resizeScreen();
this._ui.container.attr( "tabindex", "0" ).focus();
this._ignoreResizeEvents();
if ( id ) {
this.document.find( "[aria-haspopup='true'][aria-owns='" + id + "']" ).attr( "aria-expanded", true );
}
this._trigger( "afteropen" );
},
_open: function( options ) {
var openOptions = $.extend( {}, this.options, options ),
// TODO move blacklist to private method
androidBlacklist = ( function() {
var ua = navigator.userAgent,
// Rendering engine is Webkit, and capture major version
wkmatch = ua.match( /AppleWebKit\/([0-9\.]+)/ ),
wkversion = !!wkmatch && wkmatch[ 1 ],
androidmatch = ua.match( /Android (\d+(?:\.\d+))/ ),
andversion = !!androidmatch && androidmatch[ 1 ],
chromematch = ua.indexOf( "Chrome" ) > -1;
// Platform is Android, WebKit version is greater than 534.13 ( Android 3.2.1 ) and not Chrome.
if ( androidmatch !== null && andversion === "4.0" && wkversion && wkversion > 534.13 && !chromematch ) {
return true;
}
return false;
}());
// Count down to triggering "popupafteropen" - we have two prerequisites:
// 1. The popup window animation completes (container())
// 2. The screen opacity animation completes (screen())
this._createPrerequisites(
$.noop,
$.noop,
$.proxy( this, "_openPrerequisitesComplete" ) );
this._currentTransition = openOptions.transition;
this._applyTransition( openOptions.transition );
this._ui.screen.removeClass( "ui-screen-hidden" );
this._ui.container.removeClass( "ui-popup-truncate" );
// Give applications a chance to modify the contents of the container before it appears
this._reposition( openOptions );
this._ui.container.removeClass( "ui-popup-hidden" );
if ( this.options.overlayTheme && androidBlacklist ) {
/* TODO: The native browser on Android 4.0.X ("Ice Cream Sandwich") suffers from an issue where the popup overlay appears to be z-indexed above the popup itself when certain other styles exist on the same page -- namely, any element set to `position: fixed` and certain types of input. These issues are reminiscent of previously uncovered bugs in older versions of Android's native browser: https://github.com/scottjehl/Device-Bugs/issues/3
This fix closes the following bugs ( I use "closes" with reluctance, and stress that this issue should be revisited as soon as possible ):
https://github.com/jquery/jquery-mobile/issues/4816
https://github.com/jquery/jquery-mobile/issues/4844
https://github.com/jquery/jquery-mobile/issues/4874
*/
// TODO sort out why this._page isn't working
this.element.closest( ".ui-page" ).addClass( "ui-popup-open" );
}
this._animate({
additionalCondition: true,
transition: openOptions.transition,
classToRemove: "",
screenClassToAdd: "in",
containerClassToAdd: "in",
applyTransition: false,
prerequisites: this._prerequisites
});
},
_closePrerequisiteScreen: function() {
this._ui.screen
.removeClass( "out" )
.addClass( "ui-screen-hidden" );
},
_closePrerequisiteContainer: function() {
this._ui.container
.removeClass( "reverse out" )
.addClass( "ui-popup-hidden ui-popup-truncate" )
.removeAttr( "style" );
},
_closePrerequisitesDone: function() {
var container = this._ui.container,
id = this.element.attr( "id" );
container.removeAttr( "tabindex" );
// remove the global mutex for popups
$.mobile.popup.active = undefined;
// Blur elements inside the container, including the container
$( ":focus", container[ 0 ] ).add( container[ 0 ] ).blur();
if ( id ) {
this.document.find( "[aria-haspopup='true'][aria-owns='" + id + "']" ).attr( "aria-expanded", false );
}
// alert users that the popup is closed
this._trigger( "afterclose" );
},
_close: function( immediate ) {
this._ui.container.removeClass( "ui-popup-active" );
this._page.removeClass( "ui-popup-open" );
this._isOpen = false;
// Count down to triggering "popupafterclose" - we have two prerequisites:
// 1. The popup window reverse animation completes (container())
// 2. The screen opacity animation completes (screen())
this._createPrerequisites(
$.proxy( this, "_closePrerequisiteScreen" ),
$.proxy( this, "_closePrerequisiteContainer" ),
$.proxy( this, "_closePrerequisitesDone" ) );
this._animate( {
additionalCondition: this._ui.screen.hasClass( "in" ),
transition: ( immediate ? "none" : ( this._currentTransition ) ),
classToRemove: "in",
screenClassToAdd: "out",
containerClassToAdd: "reverse out",
applyTransition: true,
prerequisites: this._prerequisites
});
},
_unenhance: function() {
if ( this.options.enhanced ) {
return;
}
// Put the element back to where the placeholder was and remove the "ui-popup" class
this._setOptions( { theme: $.mobile.popup.prototype.options.theme } );
this.element
// Cannot directly insertAfter() - we need to detach() first, because
// insertAfter() will do nothing if the payload div was not attached
// to the DOM at the time the widget was created, and so the payload
// will remain inside the container even after we call insertAfter().
// If that happens and we remove the container a few lines below, we
// will cause an infinite recursion - #5244
.detach()
.insertAfter( this._ui.placeholder )
.removeClass( "ui-popup ui-overlay-shadow ui-corner-all ui-body-inherit" );
this._ui.screen.remove();
this._ui.container.remove();
this._ui.placeholder.remove();
},
_destroy: function() {
if ( $.mobile.popup.active === this ) {
this.element.one( "popupafterclose", $.proxy( this, "_unenhance" ) );
this.close();
} else {
this._unenhance();
}
return this;
},
_closePopup: function( theEvent, data ) {
var parsedDst, toUrl,
currentOptions = this.options,
immediate = false;
if ( ( theEvent && theEvent.isDefaultPrevented() ) || $.mobile.popup.active !== this ) {
return;
}
// restore location on screen
window.scrollTo( 0, this._scrollTop );
if ( theEvent && theEvent.type === "pagebeforechange" && data ) {
// Determine whether we need to rapid-close the popup, or whether we can
// take the time to run the closing transition
if ( typeof data.toPage === "string" ) {
parsedDst = data.toPage;
} else {
parsedDst = data.toPage.jqmData( "url" );
}
parsedDst = $.mobile.path.parseUrl( parsedDst );
toUrl = parsedDst.pathname + parsedDst.search + parsedDst.hash;
if ( this._myUrl !== $.mobile.path.makeUrlAbsolute( toUrl ) ) {
// Going to a different page - close immediately
immediate = true;
} else {
theEvent.preventDefault();
}
}
// remove nav bindings
this.window.off( currentOptions.closeEvents );
// unbind click handlers added when history is disabled
this.element.undelegate( currentOptions.closeLinkSelector, currentOptions.closeLinkEvents );
this._close( immediate );
},
// any navigation event after a popup is opened should close the popup
// NOTE the pagebeforechange is bound to catch navigation events that don't
// alter the url (eg, dialogs from popups)
_bindContainerClose: function() {
this.window
.on( this.options.closeEvents, $.proxy( this, "_closePopup" ) );
},
widget: function() {
return this._ui.container;
},
// TODO no clear deliniation of what should be here and
// what should be in _open. Seems to be "visual" vs "history" for now
open: function( options ) {
var url, hashkey, activePage, currentIsDialog, hasHash, urlHistory,
self = this,
currentOptions = this.options;
// make sure open is idempotent
if ( $.mobile.popup.active || currentOptions.disabled ) {
return this;
}
// set the global popup mutex
$.mobile.popup.active = this;
this._scrollTop = this.window.scrollTop();
// if history alteration is disabled close on navigate events
// and leave the url as is
if ( !( currentOptions.history ) ) {
self._open( options );
self._bindContainerClose();
// When histoy is disabled we have to grab the data-rel
// back link clicks so we can close the popup instead of
// relying on history to do it for us
self.element
.delegate( currentOptions.closeLinkSelector, currentOptions.closeLinkEvents, function( theEvent ) {
self.close();
theEvent.preventDefault();
});
return this;
}
// cache some values for min/readability
urlHistory = $.mobile.navigate.history;
hashkey = $.mobile.dialogHashKey;
activePage = $.mobile.activePage;
currentIsDialog = ( activePage ? activePage.hasClass( "ui-dialog" ) : false );
this._myUrl = url = urlHistory.getActive().url;
hasHash = ( url.indexOf( hashkey ) > -1 ) && !currentIsDialog && ( urlHistory.activeIndex > 0 );
if ( hasHash ) {
self._open( options );
self._bindContainerClose();
return this;
}
// if the current url has no dialog hash key proceed as normal
// otherwise, if the page is a dialog simply tack on the hash key
if ( url.indexOf( hashkey ) === -1 && !currentIsDialog ) {
url = url + (url.indexOf( "#" ) > -1 ? hashkey : "#" + hashkey);
} else {
url = $.mobile.path.parseLocation().hash + hashkey;
}
// Tack on an extra hashkey if this is the first page and we've just reconstructed the initial hash
if ( urlHistory.activeIndex === 0 && url === urlHistory.initialDst ) {
url += hashkey;
}
// swallow the the initial navigation event, and bind for the next
this.window.one( "beforenavigate", function( theEvent ) {
theEvent.preventDefault();
self._open( options );
self._bindContainerClose();
});
this.urlAltered = true;
$.mobile.navigate( url, { role: "dialog" } );
return this;
},
close: function() {
// make sure close is idempotent
if ( $.mobile.popup.active !== this ) {
return this;
}
this._scrollTop = this.window.scrollTop();
if ( this.options.history && this.urlAltered ) {
$.mobile.back();
this.urlAltered = false;
} else {
// simulate the nav bindings having fired
this._closePopup();
}
return this;
}
});
// TODO this can be moved inside the widget
$.mobile.popup.handleLink = function( $link ) {
var offset,
path = $.mobile.path,
// NOTE make sure to get only the hash from the href because ie7 (wp7)
// returns the absolute href in this case ruining the element selection
popup = $( path.hashToSelector( path.parseUrl( $link.attr( "href" ) ).hash ) ).first();
if ( popup.length > 0 && popup.data( "mobile-popup" ) ) {
offset = $link.offset();
popup.popup( "open", {
x: offset.left + $link.outerWidth() / 2,
y: offset.top + $link.outerHeight() / 2,
transition: $link.jqmData( "transition" ),
positionTo: $link.jqmData( "position-to" )
});
}
//remove after delay
setTimeout( function() {
$link.removeClass( $.mobile.activeBtnClass );
}, 300 );
};
// TODO move inside _create
$.mobile.document.on( "pagebeforechange", function( theEvent, data ) {
if ( data.options.role === "popup" ) {
$.mobile.popup.handleLink( data.options.link );
theEvent.preventDefault();
}
});
})( jQuery );
/*
* custom "selectmenu" plugin
*/
(function( $, undefined ) {
var unfocusableItemSelector = ".ui-disabled,.ui-state-disabled,.ui-li-divider,.ui-screen-hidden,:jqmData(role='placeholder')",
goToAdjacentItem = function( item, target, direction ) {
var adjacent = item[ direction + "All" ]()
.not( unfocusableItemSelector )
.first();
// if there's a previous option, focus it
if ( adjacent.length ) {
target
.blur()
.attr( "tabindex", "-1" );
adjacent.find( "a" ).first().focus();
}
};
$.widget( "mobile.selectmenu", $.mobile.selectmenu, {
_create: function() {
var o = this.options;
// Custom selects cannot exist inside popups, so revert the "nativeMenu"
// option to true if a parent is a popup
o.nativeMenu = o.nativeMenu || ( this.element.parents( ":jqmData(role='popup'),:mobile-popup" ).length > 0 );
return this._super();
},
_handleSelectFocus: function() {
this.element.blur();
this.button.focus();
},
_handleKeydown: function( event ) {
this._super( event );
this._handleButtonVclickKeydown( event );
},
_handleButtonVclickKeydown: function( event ) {
if ( this.options.disabled || this.isOpen ) {
return;
}
if (event.type === "vclick" ||
event.keyCode && (event.keyCode === $.mobile.keyCode.ENTER || event.keyCode === $.mobile.keyCode.SPACE)) {
this._decideFormat();
if ( this.menuType === "overlay" ) {
this.button.attr( "href", "#" + this.popupId ).attr( "data-" + ( $.mobile.ns || "" ) + "rel", "popup" );
} else {
this.button.attr( "href", "#" + this.dialogId ).attr( "data-" + ( $.mobile.ns || "" ) + "rel", "dialog" );
}
this.isOpen = true;
// Do not prevent default, so the navigation may have a chance to actually open the chosen format
}
},
_handleListFocus: function( e ) {
var params = ( e.type === "focusin" ) ?
{ tabindex: "0", event: "vmouseover" }:
{ tabindex: "-1", event: "vmouseout" };
$( e.target )
.attr( "tabindex", params.tabindex )
.trigger( params.event );
},
_handleListKeydown: function( event ) {
var target = $( event.target ),
li = target.closest( "li" );
// switch logic based on which key was pressed
switch ( event.keyCode ) {
// up or left arrow keys
case 38:
goToAdjacentItem( li, target, "prev" );
return false;
// down or right arrow keys
case 40:
goToAdjacentItem( li, target, "next" );
return false;
// If enter or space is pressed, trigger click
case 13:
case 32:
target.trigger( "click" );
return false;
}
},
_handleMenuPageHide: function() {
// TODO centralize page removal binding / handling in the page plugin.
// Suggestion from @jblas to do refcounting
//
// TODO extremely confusing dependency on the open method where the pagehide.remove
// bindings are stripped to prevent the parent page from disappearing. The way
// we're keeping pages in the DOM right now sucks
//
// rebind the page remove that was unbound in the open function
// to allow for the parent page removal from actions other than the use
// of a dialog sized custom select
//
// doing this here provides for the back button on the custom select dialog
this.thisPage.page( "bindRemove" );
},
_handleHeaderCloseClick: function() {
if ( this.menuType === "overlay" ) {
this.close();
return false;
}
},
build: function() {
var selectId, popupId, dialogId, label, thisPage, isMultiple, menuId, themeAttr, overlayThemeAttr,
dividerThemeAttr, menuPage, listbox, list, header, headerTitle, menuPageContent, menuPageClose, headerClose, self,
o = this.options;
if ( o.nativeMenu ) {
return this._super();
}
self = this;
selectId = this.selectId;
popupId = selectId + "-listbox";
dialogId = selectId + "-dialog";
label = this.label;
thisPage = this.element.closest( ".ui-page" );
isMultiple = this.element[ 0 ].multiple;
menuId = selectId + "-menu";
themeAttr = o.theme ? ( " data-" + $.mobile.ns + "theme='" + o.theme + "'" ) : "";
overlayThemeAttr = o.overlayTheme ? ( " data-" + $.mobile.ns + "theme='" + o.overlayTheme + "'" ) : "";
dividerThemeAttr = ( o.dividerTheme && isMultiple ) ? ( " data-" + $.mobile.ns + "divider-theme='" + o.dividerTheme + "'" ) : "";
menuPage = $( "<div data-" + $.mobile.ns + "role='dialog' class='ui-selectmenu' id='" + dialogId + "'" + themeAttr + overlayThemeAttr + ">" +
"<div data-" + $.mobile.ns + "role='header'>" +
"<div class='ui-title'>" + label.getEncodedText() + "</div>"+
"</div>"+
"<div data-" + $.mobile.ns + "role='content'></div>"+
"</div>" );
listbox = $( "<div id='" + popupId + "' class='ui-selectmenu'>" ).insertAfter( this.select ).popup({ theme: o.overlayTheme });
list = $( "<ul class='ui-selectmenu-list' id='" + menuId + "' role='listbox' aria-labelledby='" + this.buttonId + "'" + themeAttr + dividerThemeAttr + ">" ).appendTo( listbox );
header = $( "<div class='ui-header ui-bar-" + ( o.theme ? o.theme : "inherit" ) + "'>" ).prependTo( listbox );
headerTitle = $( "<h1 class='ui-title'>" ).appendTo( header );
if ( this.isMultiple ) {
headerClose = $( "<a>", {
"role": "button",
"text": o.closeText,
"href": "#",
"class": "ui-btn ui-corner-all ui-btn-left ui-btn-icon-notext ui-icon-delete"
}).appendTo( header );
}
$.extend( this, {
selectId: selectId,
menuId: menuId,
popupId: popupId,
dialogId: dialogId,
thisPage: thisPage,
menuPage: menuPage,
label: label,
isMultiple: isMultiple,
theme: o.theme,
listbox: listbox,
list: list,
header: header,
headerTitle: headerTitle,
headerClose: headerClose,
menuPageContent: menuPageContent,
menuPageClose: menuPageClose,
placeholder: ""
});
// Create list from select, update state
this.refresh();
if ( this._origTabIndex === undefined ) {
// Map undefined to false, because this._origTabIndex === undefined
// indicates that we have not yet checked whether the select has
// originally had a tabindex attribute, whereas false indicates that
// we have checked the select for such an attribute, and have found
// none present.
this._origTabIndex = ( this.select[ 0 ].getAttribute( "tabindex" ) === null ) ? false : this.select.attr( "tabindex" );
}
this.select.attr( "tabindex", "-1" );
this._on( this.select, { focus : "_handleSelectFocus" } );
// Button events
this._on( this.button, {
vclick: "_handleButtonVclickKeydown"
});
// Events for list items
this.list.attr( "role", "listbox" );
this._on( this.list, {
focusin : "_handleListFocus",
focusout : "_handleListFocus",
keydown: "_handleListKeydown"
});
this.list
.delegate( "li:not(.ui-disabled,.ui-state-disabled,.ui-li-divider)", "click", function( event ) {
// index of option tag to be selected
var oldIndex = self.select[ 0 ].selectedIndex,
newIndex = $.mobile.getAttribute( this, "option-index" ),
option = self._selectOptions().eq( newIndex )[ 0 ];
// toggle selected status on the tag for multi selects
option.selected = self.isMultiple ? !option.selected : true;
// toggle checkbox class for multiple selects
if ( self.isMultiple ) {
$( this ).find( "a" )
.toggleClass( "ui-checkbox-on", option.selected )
.toggleClass( "ui-checkbox-off", !option.selected );
}
// trigger change if value changed
if ( self.isMultiple || oldIndex !== newIndex ) {
self.select.trigger( "change" );
}
// hide custom select for single selects only - otherwise focus clicked item
// We need to grab the clicked item the hard way, because the list may have been rebuilt
if ( self.isMultiple ) {
self.list.find( "li:not(.ui-li-divider)" ).eq( newIndex )
.find( "a" ).first().focus();
}
else {
self.close();
}
event.preventDefault();
});
// button refocus ensures proper height calculation
// by removing the inline style and ensuring page inclusion
this._on( this.menuPage, { pagehide: "_handleMenuPageHide" } );
// Events on the popup
this._on( this.listbox, { popupafterclose: "close" } );
// Close button on small overlays
if ( this.isMultiple ) {
this._on( this.headerClose, { click: "_handleHeaderCloseClick" } );
}
return this;
},
_isRebuildRequired: function() {
var list = this.list.find( "li" ),
options = this._selectOptions().not( ".ui-screen-hidden" );
// TODO exceedingly naive method to determine difference
// ignores value changes etc in favor of a forcedRebuild
// from the user in the refresh method
return options.text() !== list.text();
},
selected: function() {
return this._selectOptions().filter( ":selected:not( :jqmData(placeholder='true') )" );
},
refresh: function( force ) {
var self, indices;
if ( this.options.nativeMenu ) {
return this._super( force );
}
self = this;
if ( force || this._isRebuildRequired() ) {
self._buildList();
}
indices = this.selectedIndices();
self.setButtonText();
self.setButtonCount();
self.list.find( "li:not(.ui-li-divider)" )
.find( "a" ).removeClass( $.mobile.activeBtnClass ).end()
.attr( "aria-selected", false )
.each(function( i ) {
if ( $.inArray( i, indices ) > -1 ) {
var item = $( this );
// Aria selected attr
item.attr( "aria-selected", true );
// Multiple selects: add the "on" checkbox state to the icon
if ( self.isMultiple ) {
item.find( "a" ).removeClass( "ui-checkbox-off" ).addClass( "ui-checkbox-on" );
} else {
if ( item.hasClass( "ui-screen-hidden" ) ) {
item.next().find( "a" ).addClass( $.mobile.activeBtnClass );
} else {
item.find( "a" ).addClass( $.mobile.activeBtnClass );
}
}
}
});
},
close: function() {
if ( this.options.disabled || !this.isOpen ) {
return;
}
var self = this;
if ( self.menuType === "page" ) {
self.menuPage.dialog( "close" );
self.list.appendTo( self.listbox );
} else {
self.listbox.popup( "close" );
}
self._focusButton();
// allow the dialog to be closed again
self.isOpen = false;
},
open: function() {
this.button.click();
},
_focusMenuItem: function() {
var selector = this.list.find( "a." + $.mobile.activeBtnClass );
if ( selector.length === 0 ) {
selector = this.list.find( "li:not(" + unfocusableItemSelector + ") a.ui-btn" );
}
selector.first().focus();
},
_decideFormat: function() {
var self = this,
$window = this.window,
selfListParent = self.list.parent(),
menuHeight = selfListParent.outerHeight(),
scrollTop = $window.scrollTop(),
btnOffset = self.button.offset().top,
screenHeight = $window.height();
if ( menuHeight > screenHeight - 80 || !$.support.scrollTop ) {
self.menuPage.appendTo( $.mobile.pageContainer ).page();
self.menuPageContent = self.menuPage.find( ".ui-content" );
self.menuPageClose = self.menuPage.find( ".ui-header a" );
// prevent the parent page from being removed from the DOM,
// otherwise the results of selecting a list item in the dialog
// fall into a black hole
self.thisPage.unbind( "pagehide.remove" );
//for WebOS/Opera Mini (set lastscroll using button offset)
if ( scrollTop === 0 && btnOffset > screenHeight ) {
self.thisPage.one( "pagehide", function() {
$( this ).jqmData( "lastScroll", btnOffset );
});
}
self.menuPage.one( {
pageshow: $.proxy( this, "_focusMenuItem" ),
pagehide: $.proxy( this, "close" )
});
self.menuType = "page";
self.menuPageContent.append( self.list );
self.menuPage.find( "div .ui-title" ).text( self.label.text() );
} else {
self.menuType = "overlay";
self.listbox.one( { popupafteropen: $.proxy( this, "_focusMenuItem" ) } );
}
},
_buildList: function() {
var self = this,
o = this.options,
placeholder = this.placeholder,
needPlaceholder = true,
dataIcon = "false",
$options, numOptions, select,
dataPrefix = "data-" + $.mobile.ns,
dataIndexAttr = dataPrefix + "option-index",
dataIconAttr = dataPrefix + "icon",
dataRoleAttr = dataPrefix + "role",
dataPlaceholderAttr = dataPrefix + "placeholder",
fragment = document.createDocumentFragment(),
isPlaceholderItem = false,
optGroup,
i,
option, $option, parent, text, anchor, classes,
optLabel, divider, item;
self.list.empty().filter( ".ui-listview" ).listview( "destroy" );
$options = this._selectOptions();
numOptions = $options.length;
select = this.select[ 0 ];
for ( i = 0; i < numOptions;i++, isPlaceholderItem = false) {
option = $options[i];
$option = $( option );
// Do not create options based on ui-screen-hidden select options
if ( $option.hasClass( "ui-screen-hidden" ) ) {
continue;
}
parent = option.parentNode;
text = $option.text();
anchor = document.createElement( "a" );
classes = [];
anchor.setAttribute( "href", "#" );
anchor.appendChild( document.createTextNode( text ) );
// Are we inside an optgroup?
if ( parent !== select && parent.nodeName.toLowerCase() === "optgroup" ) {
optLabel = parent.getAttribute( "label" );
if ( optLabel !== optGroup ) {
divider = document.createElement( "li" );
divider.setAttribute( dataRoleAttr, "list-divider" );
divider.setAttribute( "role", "option" );
divider.setAttribute( "tabindex", "-1" );
divider.appendChild( document.createTextNode( optLabel ) );
fragment.appendChild( divider );
optGroup = optLabel;
}
}
if ( needPlaceholder && ( !option.getAttribute( "value" ) || text.length === 0 || $option.jqmData( "placeholder" ) ) ) {
needPlaceholder = false;
isPlaceholderItem = true;
// If we have identified a placeholder, record the fact that it was
// us who have added the placeholder to the option and mark it
// retroactively in the select as well
if ( null === option.getAttribute( dataPlaceholderAttr ) ) {
this._removePlaceholderAttr = true;
}
option.setAttribute( dataPlaceholderAttr, true );
if ( o.hidePlaceholderMenuItems ) {
classes.push( "ui-screen-hidden" );
}
if ( placeholder !== text ) {
placeholder = self.placeholder = text;
}
}
item = document.createElement( "li" );
if ( option.disabled ) {
classes.push( "ui-state-disabled" );
item.setAttribute( "aria-disabled", true );
}
item.setAttribute( dataIndexAttr, i );
item.setAttribute( dataIconAttr, dataIcon );
if ( isPlaceholderItem ) {
item.setAttribute( dataPlaceholderAttr, true );
}
item.className = classes.join( " " );
item.setAttribute( "role", "option" );
anchor.setAttribute( "tabindex", "-1" );
if ( this.isMultiple ) {
$( anchor ).addClass( "ui-btn ui-checkbox-off ui-btn-icon-right" );
}
item.appendChild( anchor );
fragment.appendChild( item );
}
self.list[0].appendChild( fragment );
// Hide header if it's not a multiselect and there's no placeholder
if ( !this.isMultiple && !placeholder.length ) {
this.header.addClass( "ui-screen-hidden" );
} else {
this.headerTitle.text( this.placeholder );
}
// Now populated, create listview
self.list.listview();
},
_button: function() {
return this.options.nativeMenu ?
this._super() :
$( "<a>", {
"href": "#",
"role": "button",
// TODO value is undefined at creation
"id": this.buttonId,
"aria-haspopup": "true",
// TODO value is undefined at creation
"aria-owns": this.menuId
});
},
_destroy: function() {
if ( !this.options.nativeMenu ) {
this.close();
// Restore the tabindex attribute to its original value
if ( this._origTabIndex !== undefined ) {
if ( this._origTabIndex !== false ) {
this.select.attr( "tabindex", this._origTabIndex );
} else {
this.select.removeAttr( "tabindex" );
}
}
// Remove the placeholder attribute if we were the ones to add it
if ( this._removePlaceholderAttr ) {
this._selectOptions().removeAttr( "data-" + $.mobile.ns + "placeholder" );
}
// Remove the popup
this.listbox.remove();
// Remove the dialog
this.menuPage.remove();
}
// Chain up
this._super();
}
});
})( jQuery );
// buttonMarkup is deprecated as of 1.4.0 and will be removed in 1.5.0.
(function( $, undefined ) {
// General policy: Do not access data-* attributes except during enhancement.
// In all other cases we determine the state of the button exclusively from its
// className. That's why optionsToClasses expects a full complement of options,
// and the jQuery plugin completes the set of options from the default values.
// Map classes to buttonMarkup boolean options - used in classNameToOptions()
var reverseBoolOptionMap = {
"ui-shadow" : "shadow",
"ui-corner-all" : "corners",
"ui-btn-inline" : "inline",
"ui-shadow-icon" : "iconshadow", /* TODO: Remove in 1.5 */
"ui-mini" : "mini"
},
getAttrFixed = function() {
var ret = $.mobile.getAttribute.apply( this, arguments );
return ( ret == null ? undefined : ret );
},
capitalLettersRE = /[A-Z]/g;
// optionsToClasses:
// @options: A complete set of options to convert to class names.
// @existingClasses: extra classes to add to the result
//
// Converts @options to buttonMarkup classes and returns the result as an array
// that can be converted to an element's className with .join( " " ). All
// possible options must be set inside @options. Use $.fn.buttonMarkup.defaults
// to get a complete set and use $.extend to override your choice of options
// from that set.
function optionsToClasses( options, existingClasses ) {
var classes = existingClasses ? existingClasses : [];
// Add classes to the array - first ui-btn
classes.push( "ui-btn" );
// If there is a theme
if ( options.theme ) {
classes.push( "ui-btn-" + options.theme );
}
// If there's an icon, add the icon-related classes
if ( options.icon ) {
classes = classes.concat([
"ui-icon-" + options.icon,
"ui-btn-icon-" + options.iconpos
]);
if ( options.iconshadow ) {
classes.push( "ui-shadow-icon" ); /* TODO: Remove in 1.5 */
}
}
// Add the appropriate class for each boolean option
if ( options.inline ) {
classes.push( "ui-btn-inline" );
}
if ( options.shadow ) {
classes.push( "ui-shadow" );
}
if ( options.corners ) {
classes.push( "ui-corner-all" );
}
if ( options.mini ) {
classes.push( "ui-mini" );
}
// Create a string from the array and return it
return classes;
}
// classNameToOptions:
// @classes: A string containing a .className-style space-separated class list
//
// Loops over @classes and calculates an options object based on the
// buttonMarkup-related classes it finds. It records unrecognized classes in an
// array.
//
// Returns: An object containing the following items:
//
// "options": buttonMarkup options found to be present because of the
// presence/absence of corresponding classes
//
// "unknownClasses": a string containing all the non-buttonMarkup-related
// classes found in @classes
//
// "alreadyEnhanced": A boolean indicating whether the ui-btn class was among
// those found to be present
function classNameToOptions( classes ) {
var idx, map, unknownClass,
alreadyEnhanced = false,
noIcon = true,
o = {
icon: "",
inline: false,
shadow: false,
corners: false,
iconshadow: false,
mini: false
},
unknownClasses = [];
classes = classes.split( " " );
// Loop over the classes
for ( idx = 0 ; idx < classes.length ; idx++ ) {
// Assume it's an unrecognized class
unknownClass = true;
// Recognize boolean options from the presence of classes
map = reverseBoolOptionMap[ classes[ idx ] ];
if ( map !== undefined ) {
unknownClass = false;
o[ map ] = true;
// Recognize the presence of an icon and establish the icon position
} else if ( classes[ idx ].indexOf( "ui-btn-icon-" ) === 0 ) {
unknownClass = false;
noIcon = false;
o.iconpos = classes[ idx ].substring( 12 );
// Establish which icon is present
} else if ( classes[ idx ].indexOf( "ui-icon-" ) === 0 ) {
unknownClass = false;
o.icon = classes[ idx ].substring( 8 );
// Establish the theme - this recognizes one-letter theme swatch names
} else if ( classes[ idx ].indexOf( "ui-btn-" ) === 0 && classes[ idx ].length === 8 ) {
unknownClass = false;
o.theme = classes[ idx ].substring( 7 );
// Recognize that this element has already been buttonMarkup-enhanced
} else if ( classes[ idx ] === "ui-btn" ) {
unknownClass = false;
alreadyEnhanced = true;
}
// If this class has not been recognized, add it to the list
if ( unknownClass ) {
unknownClasses.push( classes[ idx ] );
}
}
// If a "ui-btn-icon-*" icon position class is absent there cannot be an icon
if ( noIcon ) {
o.icon = "";
}
return {
options: o,
unknownClasses: unknownClasses,
alreadyEnhanced: alreadyEnhanced
};
}
function camelCase2Hyphenated( c ) {
return "-" + c.toLowerCase();
}
// $.fn.buttonMarkup:
// DOM: gets/sets .className
//
// @options: options to apply to the elements in the jQuery object
// @overwriteClasses: boolean indicating whether to honour existing classes
//
// Calculates the classes to apply to the elements in the jQuery object based on
// the options passed in. If @overwriteClasses is true, it sets the className
// property of each element in the jQuery object to the buttonMarkup classes
// it calculates based on the options passed in.
//
// If you wish to preserve any classes that are already present on the elements
// inside the jQuery object, including buttonMarkup-related classes that were
// added by a previous call to $.fn.buttonMarkup() or during page enhancement
// then you should omit @overwriteClasses or set it to false.
$.fn.buttonMarkup = function( options, overwriteClasses ) {
var idx, data, el, retrievedOptions, optionKey,
defaults = $.fn.buttonMarkup.defaults;
for ( idx = 0 ; idx < this.length ; idx++ ) {
el = this[ idx ];
data = overwriteClasses ?
// Assume this element is not enhanced and ignore its classes
{ alreadyEnhanced: false, unknownClasses: [] } :
// Otherwise analyze existing classes to establish existing options and
// classes
classNameToOptions( el.className );
retrievedOptions = $.extend( {},
// If the element already has the class ui-btn, then we assume that
// it has passed through buttonMarkup before - otherwise, the options
// returned by classNameToOptions do not correctly reflect the state of
// the element
( data.alreadyEnhanced ? data.options : {} ),
// Finally, apply the options passed in
options );
// If this is the first call on this element, retrieve remaining options
// from the data-attributes
if ( !data.alreadyEnhanced ) {
for ( optionKey in defaults ) {
if ( retrievedOptions[ optionKey ] === undefined ) {
retrievedOptions[ optionKey ] = getAttrFixed( el,
optionKey.replace( capitalLettersRE, camelCase2Hyphenated )
);
}
}
}
el.className = optionsToClasses(
// Merge all the options and apply them as classes
$.extend( {},
// The defaults form the basis
defaults,
// Add the computed options
retrievedOptions
),
// ... and re-apply any unrecognized classes that were found
data.unknownClasses ).join( " " );
if ( el.tagName.toLowerCase() !== "button" ) {
el.setAttribute( "role", "button" );
}
}
return this;
};
// buttonMarkup defaults. This must be a complete set, i.e., a value must be
// given here for all recognized options
$.fn.buttonMarkup.defaults = {
icon: "",
iconpos: "left",
theme: null,
inline: false,
shadow: true,
corners: true,
iconshadow: false, /* TODO: Remove in 1.5. Option deprecated in 1.4. */
mini: false
};
$.extend( $.fn.buttonMarkup, {
initSelector: "a:jqmData(role='button'), .ui-bar > a, .ui-bar > :jqmData(role='controlgroup') > a, button"
});
})( jQuery );
(function( $, undefined ) {
$.widget( "mobile.controlgroup", $.extend( {
options: {
enhanced: false,
theme: null,
shadow: false,
corners: true,
excludeInvisible: true,
type: "vertical",
mini: false
},
_create: function() {
var elem = this.element,
opts = this.options;
// Run buttonmarkup
if ( $.fn.buttonMarkup ) {
this.element.find( $.fn.buttonMarkup.initSelector ).buttonMarkup();
}
// Enhance child widgets
$.each( this._childWidgets, $.proxy( function( number, widgetName ) {
if ( $.mobile[ widgetName ] ) {
this.element.find( $.mobile[ widgetName ].initSelector ).not( $.mobile.page.prototype.keepNativeSelector() )[ widgetName ]();
}
}, this ));
$.extend( this, {
_ui: null,
_initialRefresh: true
});
if ( opts.enhanced ) {
this._ui = {
groupLegend: elem.children( ".ui-controlgroup-label" ).children(),
childWrapper: elem.children( ".ui-controlgroup-controls" )
};
} else {
this._ui = this._enhance();
}
},
_childWidgets: [ "checkboxradio", "selectmenu", "button" ],
_themeClassFromOption: function( value ) {
return ( value ? ( value === "none" ? "" : "ui-group-theme-" + value ) : "" );
},
_enhance: function() {
var elem = this.element,
opts = this.options,
ui = {
groupLegend: elem.children( "legend" ),
childWrapper: elem
.addClass( "ui-controlgroup " +
"ui-controlgroup-" +
( opts.type === "horizontal" ? "horizontal" : "vertical" ) + " " +
this._themeClassFromOption( opts.theme ) + " " +
( opts.corners ? "ui-corner-all " : "" ) +
( opts.mini ? "ui-mini " : "" ) )
.wrapInner( "<div " +
"class='ui-controlgroup-controls " +
( opts.shadow === true ? "ui-shadow" : "" ) + "'></div>" )
.children()
};
if ( ui.groupLegend.length > 0 ) {
$( "<div role='heading' class='ui-controlgroup-label'></div>" )
.append( ui.groupLegend )
.prependTo( elem );
}
return ui;
},
_init: function() {
this.refresh();
},
_setOptions: function( options ) {
var callRefresh, returnValue,
elem = this.element;
// Must have one of horizontal or vertical
if ( options.type !== undefined ) {
elem
.removeClass( "ui-controlgroup-horizontal ui-controlgroup-vertical" )
.addClass( "ui-controlgroup-" + ( options.type === "horizontal" ? "horizontal" : "vertical" ) );
callRefresh = true;
}
if ( options.theme !== undefined ) {
elem
.removeClass( this._themeClassFromOption( this.options.theme ) )
.addClass( this._themeClassFromOption( options.theme ) );
}
if ( options.corners !== undefined ) {
elem.toggleClass( "ui-corner-all", options.corners );
}
if ( options.mini !== undefined ) {
elem.toggleClass( "ui-mini", options.mini );
}
if ( options.shadow !== undefined ) {
this._ui.childWrapper.toggleClass( "ui-shadow", options.shadow );
}
if ( options.excludeInvisible !== undefined ) {
this.options.excludeInvisible = options.excludeInvisible;
callRefresh = true;
}
returnValue = this._super( options );
if ( callRefresh ) {
this.refresh();
}
return returnValue;
},
container: function() {
return this._ui.childWrapper;
},
refresh: function() {
var $el = this.container(),
els = $el.find( ".ui-btn" ).not( ".ui-slider-handle" ),
create = this._initialRefresh;
if ( $.mobile.checkboxradio ) {
$el.find( ":mobile-checkboxradio" ).checkboxradio( "refresh" );
}
this._addFirstLastClasses( els,
this.options.excludeInvisible ? this._getVisibles( els, create ) : els,
create );
this._initialRefresh = false;
},
// Caveat: If the legend is not the first child of the controlgroup at enhance
// time, it will be after _destroy().
_destroy: function() {
var ui, buttons,
opts = this.options;
if ( opts.enhanced ) {
return this;
}
ui = this._ui;
buttons = this.element
.removeClass( "ui-controlgroup " +
"ui-controlgroup-horizontal ui-controlgroup-vertical ui-corner-all ui-mini " +
this._themeClassFromOption( opts.theme ) )
.find( ".ui-btn" )
.not( ".ui-slider-handle" );
this._removeFirstLastClasses( buttons );
ui.groupLegend.unwrap();
ui.childWrapper.children().unwrap();
}
}, $.mobile.behaviors.addFirstLastClasses ) );
})(jQuery);
(function( $, undefined ) {
$.widget( "mobile.toolbar", {
initSelector: ":jqmData(role='footer'), :jqmData(role='header')",
options: {
theme: null,
addBackBtn: false,
backBtnTheme: null,
backBtnText: "Back"
},
_create: function() {
var leftbtn, rightbtn,
role = this.element.is( ":jqmData(role='header')" ) ? "header" : "footer",
page = this.element.closest( ".ui-page" );
if ( page.length === 0 ) {
page = false;
this._on( this.document, {
"pageshow": "refresh"
});
}
$.extend( this, {
role: role,
page: page,
leftbtn: leftbtn,
rightbtn: rightbtn,
backBtn: null
});
this.element.attr( "role", role === "header" ? "banner" : "contentinfo" ).addClass( "ui-" + role );
this.refresh();
this._setOptions( this.options );
},
_setOptions: function( o ) {
if ( o.addBackBtn !== undefined ) {
if ( this.options.addBackBtn &&
this.role === "header" &&
$( ".ui-page" ).length > 1 &&
this.page[ 0 ].getAttribute( "data-" + $.mobile.ns + "url" ) !== $.mobile.path.stripHash( location.hash ) &&
!this.leftbtn ) {
this._addBackButton();
} else {
this.element.find( ".ui-toolbar-back-btn" ).remove();
}
}
if ( o.backBtnTheme != null ) {
this.element
.find( ".ui-toolbar-back-btn" )
.addClass( "ui-btn ui-btn-" + o.backBtnTheme );
}
if ( o.backBtnText !== undefined ) {
this.element.find( ".ui-toolbar-back-btn .ui-btn-text" ).text( o.backBtnText );
}
if ( o.theme !== undefined ) {
var currentTheme = this.options.theme ? this.options.theme : "inherit",
newTheme = o.theme ? o.theme : "inherit";
this.element.removeClass( "ui-bar-" + currentTheme ).addClass( "ui-bar-" + newTheme );
}
this._super( o );
},
refresh: function() {
if ( this.role === "header" ) {
this._addHeaderButtonClasses();
}
if ( !this.page ) {
this._setRelative();
if ( this.role === "footer" ) {
this.element.appendTo( "body" );
}
}
this._addHeadingClasses();
this._btnMarkup();
},
//we only want this to run on non fixed toolbars so make it easy to override
_setRelative: function() {
$( "[data-"+ $.mobile.ns + "role='page']" ).css({ "position": "relative" });
},
// Deprecated in 1.4. As from 1.5 button classes have to be present in the markup.
_btnMarkup: function() {
this.element.children( "a" ).attr( "data-" + $.mobile.ns + "role", "button" );
this.element.trigger( "create" );
},
// Deprecated in 1.4. As from 1.5 ui-btn-left/right classes have to be present in the markup.
_addHeaderButtonClasses: function() {
var $headeranchors = this.element.children( "a, button" );
this.leftbtn = $headeranchors.hasClass( "ui-btn-left" );
this.rightbtn = $headeranchors.hasClass( "ui-btn-right" );
this.leftbtn = this.leftbtn || $headeranchors.eq( 0 ).not( ".ui-btn-right" ).addClass( "ui-btn-left" ).length;
this.rightbtn = this.rightbtn || $headeranchors.eq( 1 ).addClass( "ui-btn-right" ).length;
},
_addBackButton: function() {
var theme,
options = this.options;
if ( !this.backBtn ) {
theme = options.backBtnTheme || options.theme;
this.backBtn = $( "<a role='button' href='javascript:void(0);' " +
"class='ui-btn ui-corner-all ui-shadow ui-btn-left " +
( theme ? "ui-btn-" + theme + " " : "" ) +
"ui-toolbar-back-btn ui-icon-carat-l ui-btn-icon-left' " +
"data-" + $.mobile.ns + "rel='back'>" + options.backBtnText + "</a>" )
.prependTo( this.element );
}
},
_addHeadingClasses: function() {
this.element.children( "h1, h2, h3, h4, h5, h6" )
.addClass( "ui-title" )
// Regardless of h element number in src, it becomes h1 for the enhanced page
.attr({
"role": "heading",
"aria-level": "1"
});
}
});
})( jQuery );
(function( $, undefined ) {
$.widget( "mobile.toolbar", $.mobile.toolbar, {
options: {
position:null,
visibleOnPageShow: true,
disablePageZoom: true,
transition: "slide", //can be none, fade, slide (slide maps to slideup or slidedown)
fullscreen: false,
tapToggle: true,
tapToggleBlacklist: "a, button, input, select, textarea, .ui-header-fixed, .ui-footer-fixed, .ui-flipswitch, .ui-popup, .ui-panel, .ui-panel-dismiss-open",
hideDuringFocus: "input, textarea, select",
updatePagePadding: true,
trackPersistentToolbars: true,
// Browser detection! Weeee, here we go...
// Unfortunately, position:fixed is costly, not to mention probably impossible, to feature-detect accurately.
// Some tests exist, but they currently return false results in critical devices and browsers, which could lead to a broken experience.
// Testing fixed positioning is also pretty obtrusive to page load, requiring injected elements and scrolling the window
// The following function serves to rule out some popular browsers with known fixed-positioning issues
// This is a plugin option like any other, so feel free to improve or overwrite it
supportBlacklist: function() {
return !$.support.fixedPosition;
}
},
_create: function() {
this._super();
if ( this.options.position === "fixed" && !this.options.supportBlacklist() ) {
this._makeFixed();
}
},
_makeFixed: function() {
this.element.addClass( "ui-"+ this.role +"-fixed" );
this.updatePagePadding();
this._addTransitionClass();
this._bindPageEvents();
this._bindToggleHandlers();
this._setOptions( this.options );
},
_setOptions: function( o ) {
if ( o.position === "fixed" && this.options.position !== "fixed" ) {
this._makeFixed();
}
if ( this.options.position === "fixed" && !this.options.supportBlacklist() ) {
var $page = ( !!this.page )? this.page: ( $(".ui-page-active").length > 0 )? $(".ui-page-active"): $(".ui-page").eq(0);
if ( o.fullscreen !== undefined) {
if ( o.fullscreen ) {
this.element.addClass( "ui-"+ this.role +"-fullscreen" );
$page.addClass( "ui-page-" + this.role + "-fullscreen" );
}
// If not fullscreen, add class to page to set top or bottom padding
else {
this.element.removeClass( "ui-"+ this.role +"-fullscreen" );
$page.removeClass( "ui-page-" + this.role + "-fullscreen" ).addClass( "ui-page-" + this.role+ "-fixed" );
}
}
}
this._super(o);
},
_addTransitionClass: function() {
var tclass = this.options.transition;
if ( tclass && tclass !== "none" ) {
// use appropriate slide for header or footer
if ( tclass === "slide" ) {
tclass = this.element.hasClass( "ui-header" ) ? "slidedown" : "slideup";
}
this.element.addClass( tclass );
}
},
_bindPageEvents: function() {
var page = ( !!this.page )? this.element.closest( ".ui-page" ): this.document;
//page event bindings
// Fixed toolbars require page zoom to be disabled, otherwise usability issues crop up
// This method is meant to disable zoom while a fixed-positioned toolbar page is visible
this._on( page , {
"pagebeforeshow": "_handlePageBeforeShow",
"webkitAnimationStart":"_handleAnimationStart",
"animationstart":"_handleAnimationStart",
"updatelayout": "_handleAnimationStart",
"pageshow": "_handlePageShow",
"pagebeforehide": "_handlePageBeforeHide"
});
},
_handlePageBeforeShow: function( ) {
var o = this.options;
if ( o.disablePageZoom ) {
$.mobile.zoom.disable( true );
}
if ( !o.visibleOnPageShow ) {
this.hide( true );
}
},
_handleAnimationStart: function() {
if ( this.options.updatePagePadding ) {
this.updatePagePadding( ( !!this.page )? this.page: ".ui-page-active" );
}
},
_handlePageShow: function() {
this.updatePagePadding( ( !!this.page )? this.page: ".ui-page-active" );
if ( this.options.updatePagePadding ) {
this._on( this.window, { "throttledresize": "updatePagePadding" } );
}
},
_handlePageBeforeHide: function( e, ui ) {
var o = this.options,
thisFooter, thisHeader, nextFooter, nextHeader;
if ( o.disablePageZoom ) {
$.mobile.zoom.enable( true );
}
if ( o.updatePagePadding ) {
this._off( this.window, "throttledresize" );
}
if ( o.trackPersistentToolbars ) {
thisFooter = $( ".ui-footer-fixed:jqmData(id)", this.page );
thisHeader = $( ".ui-header-fixed:jqmData(id)", this.page );
nextFooter = thisFooter.length && ui.nextPage && $( ".ui-footer-fixed:jqmData(id='" + thisFooter.jqmData( "id" ) + "')", ui.nextPage ) || $();
nextHeader = thisHeader.length && ui.nextPage && $( ".ui-header-fixed:jqmData(id='" + thisHeader.jqmData( "id" ) + "')", ui.nextPage ) || $();
if ( nextFooter.length || nextHeader.length ) {
nextFooter.add( nextHeader ).appendTo( $.mobile.pageContainer );
ui.nextPage.one( "pageshow", function() {
nextHeader.prependTo( this );
nextFooter.appendTo( this );
});
}
}
},
_visible: true,
// This will set the content element's top or bottom padding equal to the toolbar's height
updatePagePadding: function( tbPage ) {
var $el = this.element,
header = ( this.role ==="header" ),
pos = parseFloat( $el.css( header ? "top" : "bottom" ) );
// This behavior only applies to "fixed", not "fullscreen"
if ( this.options.fullscreen ) { return; }
// tbPage argument can be a Page object or an event, if coming from throttled resize.
tbPage = ( tbPage && tbPage.type === undefined && tbPage ) || this.page || $el.closest( ".ui-page" );
tbPage = ( !!this.page )? this.page: ".ui-page-active";
$( tbPage ).css( "padding-" + ( header ? "top" : "bottom" ), $el.outerHeight() + pos );
},
_useTransition: function( notransition ) {
var $win = this.window,
$el = this.element,
scroll = $win.scrollTop(),
elHeight = $el.height(),
pHeight = ( !!this.page )? $el.closest( ".ui-page" ).height():$(".ui-page-active").height(),
viewportHeight = $.mobile.getScreenHeight();
return !notransition &&
( this.options.transition && this.options.transition !== "none" &&
(
( this.role === "header" && !this.options.fullscreen && scroll > elHeight ) ||
( this.role === "footer" && !this.options.fullscreen && scroll + viewportHeight < pHeight - elHeight )
) || this.options.fullscreen
);
},
show: function( notransition ) {
var hideClass = "ui-fixed-hidden",
$el = this.element;
if ( this._useTransition( notransition ) ) {
$el
.removeClass( "out " + hideClass )
.addClass( "in" )
.animationComplete(function () {
$el.removeClass( "in" );
});
}
else {
$el.removeClass( hideClass );
}
this._visible = true;
},
hide: function( notransition ) {
var hideClass = "ui-fixed-hidden",
$el = this.element,
// if it's a slide transition, our new transitions need the reverse class as well to slide outward
outclass = "out" + ( this.options.transition === "slide" ? " reverse" : "" );
if ( this._useTransition( notransition ) ) {
$el
.addClass( outclass )
.removeClass( "in" )
.animationComplete(function() {
$el.addClass( hideClass ).removeClass( outclass );
});
}
else {
$el.addClass( hideClass ).removeClass( outclass );
}
this._visible = false;
},
toggle: function() {
this[ this._visible ? "hide" : "show" ]();
},
_bindToggleHandlers: function() {
var self = this,
o = self.options,
delayShow, delayHide,
isVisible = true,
page = ( !!this.page )? this.page: $(".ui-page");
// tap toggle
page
.bind( "vclick", function( e ) {
if ( o.tapToggle && !$( e.target ).closest( o.tapToggleBlacklist ).length ) {
self.toggle();
}
})
.bind( "focusin focusout", function( e ) {
//this hides the toolbars on a keyboard pop to give more screen room and prevent ios bug which
//positions fixed toolbars in the middle of the screen on pop if the input is near the top or
//bottom of the screen addresses issues #4410 Footer navbar moves up when clicking on a textbox in an Android environment
//and issue #4113 Header and footer change their position after keyboard popup - iOS
//and issue #4410 Footer navbar moves up when clicking on a textbox in an Android environment
if ( screen.width < 1025 && $( e.target ).is( o.hideDuringFocus ) && !$( e.target ).closest( ".ui-header-fixed, .ui-footer-fixed" ).length ) {
//Fix for issue #4724 Moving through form in Mobile Safari with "Next" and "Previous" system
//controls causes fixed position, tap-toggle false Header to reveal itself
// isVisible instead of self._visible because the focusin and focusout events fire twice at the same time
// Also use a delay for hiding the toolbars because on Android native browser focusin is direclty followed
// by a focusout when a native selects opens and the other way around when it closes.
if ( e.type === "focusout" && !isVisible ) {
isVisible = true;
//wait for the stack to unwind and see if we have jumped to another input
clearTimeout( delayHide );
delayShow = setTimeout( function() {
self.show();
}, 0 );
} else if ( e.type === "focusin" && !!isVisible ) {
//if we have jumped to another input clear the time out to cancel the show.
clearTimeout( delayShow );
isVisible = false;
delayHide = setTimeout( function() {
self.hide();
}, 0 );
}
}
});
},
_setRelative: function() {
if( this.options.position !== "fixed" ){
$( "[data-"+ $.mobile.ns + "role='page']" ).css({ "position": "relative" });
}
},
_destroy: function() {
var $el = this.element,
header = $el.hasClass( "ui-header" );
$el.closest( ".ui-page" ).css( "padding-" + ( header ? "top" : "bottom" ), "" );
$el.removeClass( "ui-header-fixed ui-footer-fixed ui-header-fullscreen ui-footer-fullscreen in out fade slidedown slideup ui-fixed-hidden" );
$el.closest( ".ui-page" ).removeClass( "ui-page-header-fixed ui-page-footer-fixed ui-page-header-fullscreen ui-page-footer-fullscreen" );
}
});
})( jQuery );
(function( $, undefined ) {
$.widget( "mobile.toolbar", $.mobile.toolbar, {
_makeFixed: function() {
this._super();
this._workarounds();
},
//check the browser and version and run needed workarounds
_workarounds: function() {
var ua = navigator.userAgent,
platform = navigator.platform,
// Rendering engine is Webkit, and capture major version
wkmatch = ua.match( /AppleWebKit\/([0-9]+)/ ),
wkversion = !!wkmatch && wkmatch[ 1 ],
os = null,
self = this;
//set the os we are working in if it dosent match one with workarounds return
if ( platform.indexOf( "iPhone" ) > -1 || platform.indexOf( "iPad" ) > -1 || platform.indexOf( "iPod" ) > -1 ) {
os = "ios";
} else if ( ua.indexOf( "Android" ) > -1 ) {
os = "android";
} else {
return;
}
//check os version if it dosent match one with workarounds return
if ( os === "ios" ) {
//iOS workarounds
self._bindScrollWorkaround();
} else if ( os === "android" && wkversion && wkversion < 534 ) {
//Android 2.3 run all Android 2.3 workaround
self._bindScrollWorkaround();
self._bindListThumbWorkaround();
} else {
return;
}
},
//Utility class for checking header and footer positions relative to viewport
_viewportOffset: function() {
var $el = this.element,
header = $el.hasClass( "ui-header" ),
offset = Math.abs( $el.offset().top - this.window.scrollTop() );
if ( !header ) {
offset = Math.round( offset - this.window.height() + $el.outerHeight() ) - 60;
}
return offset;
},
//bind events for _triggerRedraw() function
_bindScrollWorkaround: function() {
var self = this;
//bind to scrollstop and check if the toolbars are correctly positioned
this._on( this.window, { scrollstop: function() {
var viewportOffset = self._viewportOffset();
//check if the header is visible and if its in the right place
if ( viewportOffset > 2 && self._visible ) {
self._triggerRedraw();
}
}});
},
//this addresses issue #4250 Persistent footer instability in v1.1 with long select lists in Android 2.3.3
//and issue #3748 Android 2.x: Page transitions broken when fixed toolbars used
//the absolutely positioned thumbnail in a list view causes problems with fixed position buttons above in a nav bar
//setting the li's to -webkit-transform:translate3d(0,0,0); solves this problem to avoide potential issues in other
//platforms we scope this with the class ui-android-2x-fix
_bindListThumbWorkaround: function() {
this.element.closest( ".ui-page" ).addClass( "ui-android-2x-fixed" );
},
//this addresses issues #4337 Fixed header problem after scrolling content on iOS and Android
//and device bugs project issue #1 Form elements can lose click hit area in position: fixed containers.
//this also addresses not on fixed toolbars page in docs
//adding 1px of padding to the bottom then removing it causes a "redraw"
//which positions the toolbars correctly (they will always be visually correct)
_triggerRedraw: function() {
var paddingBottom = parseFloat( $( ".ui-page-active" ).css( "padding-bottom" ) );
//trigger page redraw to fix incorrectly positioned fixed elements
$( ".ui-page-active" ).css( "padding-bottom", ( paddingBottom + 1 ) + "px" );
//if the padding is reset with out a timeout the reposition will not occure.
//this is independant of JQM the browser seems to need the time to react.
setTimeout( function() {
$( ".ui-page-active" ).css( "padding-bottom", paddingBottom + "px" );
}, 0 );
},
destroy: function() {
this._super();
//Remove the class we added to the page previously in android 2.x
this.element.closest( ".ui-page-active" ).removeClass( "ui-android-2x-fix" );
}
});
})( jQuery );
( function( $, undefined ) {
var ieHack = ( $.mobile.browser.oldIE && $.mobile.browser.oldIE <= 8 ),
uiTemplate = $(
"<div class='ui-popup-arrow-guide'></div>" +
"<div class='ui-popup-arrow-container" + ( ieHack ? " ie" : "" ) + "'>" +
"<div class='ui-popup-arrow'>" +
"<div class='ui-popup-arrow-background'></div>" +
"</div>" +
"</div>"
),
// Needed for transforming coordinates from screen to arrow background
txFactor = Math.sqrt( 2 ) / 2;
function getArrow() {
var clone = uiTemplate.clone(),
gd = clone.eq( 0 ),
ct = clone.eq( 1 ),
ar = ct.children(),
bg = ar.children();
return { arEls: ct.add( gd ), gd: gd, ct: ct, ar: ar, bg: bg };
}
$.widget( "mobile.popup", $.mobile.popup, {
options: {
arrow: ""
},
_create: function() {
var ar,
ret = this._super();
if ( this.options.arrow ) {
this._ui.arrow = ar = this._addArrow();
}
return ret;
},
_addArrow: function() {
var theme,
opts = this.options,
ar = getArrow();
theme = this._themeClassFromOption( "ui-body-", opts.theme );
ar.ar.addClass( theme + ( opts.shadow ? " ui-overlay-shadow" : "" ) );
ar.bg.addClass( theme );
ar.arEls.hide().appendTo( this.element );
return ar;
},
_unenhance: function() {
var ar = this._ui.arrow;
if ( ar ) {
ar.arEls.remove();
}
return this._super();
},
// Pretend to show an arrow described by @p and @dir and calculate the
// distance from the desired point. If a best-distance is passed in, return
// the minimum of the one passed in and the one calculated.
_tryAnArrow: function( p, dir, desired, s, best ) {
var result, r, diff, desiredForArrow = {}, tip = {};
// If the arrow has no wiggle room along the edge of the popup, it cannot
// be displayed along the requested edge without it sticking out.
if ( s.arFull[ p.dimKey ] > s.guideDims[ p.dimKey ] ) {
return best;
}
desiredForArrow[ p.fst ] = desired[ p.fst ] +
( s.arHalf[ p.oDimKey ] + s.menuHalf[ p.oDimKey ] ) * p.offsetFactor -
s.contentBox[ p.fst ] + ( s.clampInfo.menuSize[ p.oDimKey ] - s.contentBox[ p.oDimKey ] ) * p.arrowOffsetFactor;
desiredForArrow[ p.snd ] = desired[ p.snd ];
result = s.result || this._calculateFinalLocation( desiredForArrow, s.clampInfo );
r = { x: result.left, y: result.top };
tip[ p.fst ] = r[ p.fst ] + s.contentBox[ p.fst ] + p.tipOffset;
tip[ p.snd ] = Math.max( result[ p.prop ] + s.guideOffset[ p.prop ] + s.arHalf[ p.dimKey ],
Math.min( result[ p.prop ] + s.guideOffset[ p.prop ] + s.guideDims[ p.dimKey ] - s.arHalf[ p.dimKey ],
desired[ p.snd ] ) );
diff = Math.abs( desired.x - tip.x ) + Math.abs( desired.y - tip.y );
if ( !best || diff < best.diff ) {
// Convert tip offset to coordinates inside the popup
tip[ p.snd ] -= s.arHalf[ p.dimKey ] + result[ p.prop ] + s.contentBox[ p.snd ];
best = { dir: dir, diff: diff, result: result, posProp: p.prop, posVal: tip[ p.snd ] };
}
return best;
},
_getPlacementState: function( clamp ) {
var offset, gdOffset,
ar = this._ui.arrow,
state = {
clampInfo: this._clampPopupWidth( !clamp ),
arFull: { cx: ar.ct.width(), cy: ar.ct.height() },
guideDims: { cx: ar.gd.width(), cy: ar.gd.height() },
guideOffset: ar.gd.offset()
};
offset = this.element.offset();
ar.gd.css( { left: 0, top: 0, right: 0, bottom: 0 } );
gdOffset = ar.gd.offset();
state.contentBox = {
x: gdOffset.left - offset.left,
y: gdOffset.top - offset.top,
cx: ar.gd.width(),
cy: ar.gd.height()
};
ar.gd.removeAttr( "style" );
// The arrow box moves between guideOffset and guideOffset + guideDims - arFull
state.guideOffset = { left: state.guideOffset.left - offset.left, top: state.guideOffset.top - offset.top };
state.arHalf = { cx: state.arFull.cx / 2, cy: state.arFull.cy / 2 };
state.menuHalf = { cx: state.clampInfo.menuSize.cx / 2, cy: state.clampInfo.menuSize.cy / 2 };
return state;
},
_placementCoords: function( desired ) {
var state, best, params, bgOffset, elOffset, diff, bgRef,
optionValue = this.options.arrow,
ar = this._ui.arrow;
if ( !ar ) {
return this._super( desired );
}
ar.arEls.show();
bgRef = {};
state = this._getPlacementState( true );
params = {
"l": { fst: "x", snd: "y", prop: "top", dimKey: "cy", oDimKey: "cx", offsetFactor: 1, tipOffset: -state.arHalf.cx, arrowOffsetFactor: 0 },
"r": { fst: "x", snd: "y", prop: "top", dimKey: "cy", oDimKey: "cx", offsetFactor: -1, tipOffset: state.arHalf.cx + state.contentBox.cx, arrowOffsetFactor: 1 },
"b": { fst: "y", snd: "x", prop: "left", dimKey: "cx", oDimKey: "cy", offsetFactor: -1, tipOffset: state.arHalf.cy + state.contentBox.cy, arrowOffsetFactor: 1 },
"t": { fst: "y", snd: "x", prop: "left", dimKey: "cx", oDimKey: "cy", offsetFactor: 1, tipOffset: -state.arHalf.cy, arrowOffsetFactor: 0 }
};
// Try each side specified in the options to see on which one the arrow
// should be placed such that the distance between the tip of the arrow and
// the desired coordinates is the shortest.
$.each( ( optionValue === true ? "l,t,r,b" : optionValue ).split( "," ),
$.proxy( function( key, value ) {
best = this._tryAnArrow( params[ value ], value, desired, state, best );
}, this ) );
// Could not place the arrow along any of the edges - behave as if showing
// the arrow was turned off.
if ( !best ) {
ar.arEls.hide();
return this._super( desired );
}
// Move the arrow into place
ar.ct
.removeClass( "ui-popup-arrow-l ui-popup-arrow-t ui-popup-arrow-r ui-popup-arrow-b" )
.addClass( "ui-popup-arrow-" + best.dir )
.removeAttr( "style" ).css( best.posProp, best.posVal )
.show();
// Do not move/size the background div on IE, because we use the arrow div for background as well.
if ( !ieHack ) {
elOffset = this.element.offset();
bgRef[ params[ best.dir ].fst ] = ar.ct.offset();
bgRef[ params[ best.dir ].snd ] = {
left: elOffset.left + state.contentBox.x,
top: elOffset.top + state.contentBox.y
};
bgOffset = ar.bg
.removeAttr( "style" )
.css( ( "cx" === params[ best.dir ].dimKey ? "width" : "height" ), state.contentBox[ params[ best.dir ].dimKey ] )
.offset();
diff = { dx: bgRef.x.left - bgOffset.left, dy: bgRef.y.top - bgOffset.top };
ar.bg.css( { left: txFactor * diff.dy + txFactor * diff.dx, top: txFactor * diff.dy - txFactor * diff.dx } );
}
return best.result;
},
_setOptions: function( opts ) {
var newTheme,
oldTheme = this.options.theme,
ar = this._ui.arrow,
ret = this._super( opts );
if ( opts.arrow !== undefined ) {
if ( !ar && opts.arrow ) {
this._ui.arrow = this._addArrow();
// Important to return here so we don't set the same options all over
// again below.
return;
} else if ( ar && !opts.arrow ) {
ar.arEls.remove();
this._ui.arrow = null;
}
}
// Reassign with potentially new arrow
ar = this._ui.arrow;
if ( ar ) {
if ( opts.theme !== undefined ) {
oldTheme = this._themeClassFromOption( "ui-body-", oldTheme );
newTheme = this._themeClassFromOption( "ui-body-", opts.theme );
ar.ar.removeClass( oldTheme ).addClass( newTheme );
ar.bg.removeClass( oldTheme ).addClass( newTheme );
}
if ( opts.shadow !== undefined ) {
ar.ar.toggleClass( "ui-overlay-shadow", opts.shadow );
}
}
return ret;
},
_destroy: function() {
var ar = this._ui.arrow;
if ( ar ) {
ar.arEls.remove();
}
return this._super();
}
});
})( jQuery );
(function( $, undefined ) {
$.widget( "mobile.panel", {
options: {
classes: {
panel: "ui-panel",
panelOpen: "ui-panel-open",
panelClosed: "ui-panel-closed",
panelFixed: "ui-panel-fixed",
panelInner: "ui-panel-inner",
modal: "ui-panel-dismiss",
modalOpen: "ui-panel-dismiss-open",
pageContainer: "ui-panel-page-container",
pageWrapper: "ui-panel-wrapper",
pageFixedToolbar: "ui-panel-fixed-toolbar",
pageContentPrefix: "ui-panel-page-content", /* Used for wrapper and fixed toolbars position, display and open classes. */
animate: "ui-panel-animate"
},
animate: true,
theme: null,
position: "left",
dismissible: true,
display: "reveal", //accepts reveal, push, overlay
swipeClose: true,
positionFixed: false
},
_panelID: null,
_closeLink: null,
_parentPage: null,
_page: null,
_modal: null,
_panelInner: null,
_wrapper: null,
_fixedToolbars: null,
_create: function() {
var el = this.element,
parentPage = el.closest( ":jqmData(role='page')" );
// expose some private props to other methods
$.extend( this, {
_panelID: el.attr( "id" ),
_closeLink: el.find( ":jqmData(rel='close')" ),
_parentPage: ( parentPage.length > 0 ) ? parentPage : false,
_page: this._getPage,
_panelInner: this._getPanelInner(),
_wrapper: this._getWrapper,
_fixedToolbars: this._getFixedToolbars
});
this._addPanelClasses();
// if animating, add the class to do so
if ( $.support.cssTransform3d && !!this.options.animate ) {
this.element.addClass( this.options.classes.animate );
}
this._bindUpdateLayout();
this._bindCloseEvents();
this._bindLinkListeners();
this._bindPageEvents();
if ( !!this.options.dismissible ) {
this._createModal();
}
this._bindSwipeEvents();
},
_getPanelInner: function() {
var panelInner = this.element.find( "." + this.options.classes.panelInner );
if ( panelInner.length === 0 ) {
panelInner = this.element.children().wrapAll( "<div class='" + this.options.classes.panelInner + "' />" ).parent();
}
return panelInner;
},
_createModal: function() {
var self = this,
target = self._parentPage ? self._parentPage.parent() : self.element.parent();
self._modal = $( "<div class='" + self.options.classes.modal + "' data-panelid='" + self._panelID + "'></div>" )
.on( "mousedown", function() {
self.close();
})
.appendTo( target );
},
_getPage: function() {
var page = this._parentPage ? this._parentPage : $( "." + $.mobile.activePageClass );
return page;
},
_getWrapper: function() {
var wrapper = this._page().find( "." + this.options.classes.pageWrapper );
if ( wrapper.length === 0 ) {
wrapper = this._page().children( ".ui-header:not(.ui-header-fixed), .ui-content:not(.ui-popup), .ui-footer:not(.ui-footer-fixed)" )
.wrapAll( "<div class='" + this.options.classes.pageWrapper + "'></div>" )
.parent();
}
return wrapper;
},
_getFixedToolbars: function() {
var extFixedToolbars = $( "body" ).children( ".ui-header-fixed, .ui-footer-fixed" ),
intFixedToolbars = this._page().find( ".ui-header-fixed, .ui-footer-fixed" ),
fixedToolbars = extFixedToolbars.add( intFixedToolbars ).addClass( this.options.classes.pageFixedToolbar );
return fixedToolbars;
},
_getPosDisplayClasses: function( prefix ) {
return prefix + "-position-" + this.options.position + " " + prefix + "-display-" + this.options.display;
},
_getPanelClasses: function() {
var panelClasses = this.options.classes.panel +
" " + this._getPosDisplayClasses( this.options.classes.panel ) +
" " + this.options.classes.panelClosed +
" " + "ui-body-" + ( this.options.theme ? this.options.theme : "inherit" );
if ( !!this.options.positionFixed ) {
panelClasses += " " + this.options.classes.panelFixed;
}
return panelClasses;
},
_addPanelClasses: function() {
this.element.addClass( this._getPanelClasses() );
},
_bindCloseEvents: function() {
var self = this;
self._closeLink.on( "click.panel" , function( e ) {
e.preventDefault();
self.close();
return false;
});
self.element.on( "click.panel" , "a:jqmData(ajax='false')", function(/* e */) {
self.close();
});
},
_positionPanel: function() {
var self = this,
panelInnerHeight = self._panelInner.outerHeight(),
expand = panelInnerHeight > $.mobile.getScreenHeight();
if ( expand || !self.options.positionFixed ) {
if ( expand ) {
self._unfixPanel();
$.mobile.resetActivePageHeight( panelInnerHeight );
}
window.scrollTo( 0, $.mobile.defaultHomeScroll );
} else {
self._fixPanel();
}
},
_bindFixListener: function() {
this._on( $( window ), { "throttledresize": "_positionPanel" });
},
_unbindFixListener: function() {
this._off( $( window ), "throttledresize" );
},
_unfixPanel: function() {
if ( !!this.options.positionFixed && $.support.fixedPosition ) {
this.element.removeClass( this.options.classes.panelFixed );
}
},
_fixPanel: function() {
if ( !!this.options.positionFixed && $.support.fixedPosition ) {
this.element.addClass( this.options.classes.panelFixed );
}
},
_bindUpdateLayout: function() {
var self = this;
self.element.on( "updatelayout", function(/* e */) {
if ( self._open ) {
self._positionPanel();
}
});
},
_bindLinkListeners: function() {
this._on( "body", {
"click a": "_handleClick"
});
},
_handleClick: function( e ) {
if ( e.currentTarget.href.split( "#" )[ 1 ] === this._panelID && this._panelID !== undefined ) {
e.preventDefault();
var link = $( e.target );
if ( link.hasClass( "ui-btn" ) ) {
link.addClass( $.mobile.activeBtnClass );
this.element.one( "panelopen panelclose", function() {
link.removeClass( $.mobile.activeBtnClass );
});
}
this.toggle();
return false;
}
},
_bindSwipeEvents: function() {
var self = this,
area = self._modal ? self.element.add( self._modal ) : self.element;
// on swipe, close the panel
if ( !!self.options.swipeClose ) {
if ( self.options.position === "left" ) {
area.on( "swipeleft.panel", function(/* e */) {
self.close();
});
} else {
area.on( "swiperight.panel", function(/* e */) {
self.close();
});
}
}
},
_bindPageEvents: function() {
var self = this;
this.document
// Close the panel if another panel on the page opens
.on( "panelbeforeopen", function( e ) {
if ( self._open && e.target !== self.element[ 0 ] ) {
self.close();
}
})
// On escape, close? might need to have a target check too...
.on( "keyup.panel", function( e ) {
if ( e.keyCode === 27 && self._open ) {
self.close();
}
});
// Clean up open panels after page hide
if ( self._parentPage ) {
this.document.on( "pagehide", ":jqmData(role='page')", function() {
if ( self._open ) {
self.close( true );
}
});
} else {
this.document.on( "pagebeforehide", function() {
if ( self._open ) {
self.close( true );
}
});
}
},
// state storage of open or closed
_open: false,
_pageContentOpenClasses: null,
_modalOpenClasses: null,
open: function( immediate ) {
if ( !this._open ) {
var self = this,
o = self.options,
_openPanel = function() {
self.document.off( "panelclose" );
self._page().jqmData( "panel", "open" );
if ( $.support.cssTransform3d && !!o.animate && o.display !== "overlay" ) {
self._wrapper().addClass( o.classes.animate );
self._fixedToolbars().addClass( o.classes.animate );
}
if ( !immediate && $.support.cssTransform3d && !!o.animate ) {
self.document.on( self._transitionEndEvents, complete );
} else {
setTimeout( complete, 0 );
}
if ( o.theme && o.display !== "overlay" ) {
self._page().parent()
.addClass( o.classes.pageContainer + "-themed " + o.classes.pageContainer + "-" + o.theme );
}
self.element
.removeClass( o.classes.panelClosed )
.addClass( o.classes.panelOpen );
self._positionPanel();
self._pageContentOpenClasses = self._getPosDisplayClasses( o.classes.pageContentPrefix );
if ( o.display !== "overlay" ) {
self._page().parent().addClass( o.classes.pageContainer );
self._wrapper().addClass( self._pageContentOpenClasses );
self._fixedToolbars().addClass( self._pageContentOpenClasses );
}
self._modalOpenClasses = self._getPosDisplayClasses( o.classes.modal ) + " " + o.classes.modalOpen;
if ( self._modal ) {
self._modal
.addClass( self._modalOpenClasses )
.height( Math.max( self._modal.height(), self.document.height() ) );
}
},
complete = function() {
self.document.off( self._transitionEndEvents, complete );
if ( o.display !== "overlay" ) {
self._wrapper().addClass( o.classes.pageContentPrefix + "-open" );
self._fixedToolbars().addClass( o.classes.pageContentPrefix + "-open" );
}
self._bindFixListener();
self._trigger( "open" );
};
self._trigger( "beforeopen" );
if ( self._page().jqmData( "panel" ) === "open" ) {
self.document.on( "panelclose", function() {
_openPanel();
});
} else {
_openPanel();
}
self._open = true;
}
},
close: function( immediate ) {
if ( this._open ) {
var self = this,
o = this.options,
_closePanel = function() {
if ( !immediate && $.support.cssTransform3d && !!o.animate ) {
self.document.on( self._transitionEndEvents, complete );
} else {
setTimeout( complete, 0 );
}
self.element.removeClass( o.classes.panelOpen );
if ( o.display !== "overlay" ) {
self._wrapper().removeClass( self._pageContentOpenClasses );
self._fixedToolbars().removeClass( self._pageContentOpenClasses );
}
if ( self._modal ) {
self._modal.removeClass( self._modalOpenClasses );
}
},
complete = function() {
self.document.off( self._transitionEndEvents, complete );
if ( o.theme && o.display !== "overlay" ) {
self._page().parent().removeClass( o.classes.pageContainer + "-themed " + o.classes.pageContainer + "-" + o.theme );
}
self.element.addClass( o.classes.panelClosed );
if ( o.display !== "overlay" ) {
self._page().parent().removeClass( o.classes.pageContainer );
self._wrapper().removeClass( o.classes.pageContentPrefix + "-open" );
self._fixedToolbars().removeClass( o.classes.pageContentPrefix + "-open" );
}
if ( $.support.cssTransform3d && !!o.animate && o.display !== "overlay" ) {
self._wrapper().removeClass( o.classes.animate );
self._fixedToolbars().removeClass( o.classes.animate );
}
self._fixPanel();
self._unbindFixListener();
$.mobile.resetActivePageHeight();
self._page().jqmRemoveData( "panel" );
self._trigger( "close" );
};
self._trigger( "beforeclose" );
_closePanel();
self._open = false;
}
},
toggle: function() {
this[ this._open ? "close" : "open" ]();
},
_transitionEndEvents: "webkitTransitionEnd oTransitionEnd otransitionend transitionend msTransitionEnd",
_destroy: function() {
var otherPanels,
o = this.options,
multiplePanels = ( $( "body > :mobile-panel" ).length + $.mobile.activePage.find( ":mobile-panel" ).length ) > 1;
if ( o.display !== "overlay" ) {
// remove the wrapper if not in use by another panel
otherPanels = $( "body > :mobile-panel" ).add( $.mobile.activePage.find( ":mobile-panel" ) );
if ( otherPanels.not( ".ui-panel-display-overlay" ).not( this.element ).length === 0 ) {
this._wrapper().children().unwrap();
}
if ( this._open ) {
this._fixedToolbars().removeClass( o.classes.pageContentPrefix + "-open" );
if ( $.support.cssTransform3d && !!o.animate ) {
this._fixedToolbars().removeClass( o.classes.animate );
}
this._page().parent().removeClass( o.classes.pageContainer );
if ( o.theme ) {
this._page().parent().removeClass( o.classes.pageContainer + "-themed " + o.classes.pageContainer + "-" + o.theme );
}
}
}
if ( !multiplePanels ) {
this.document.off( "panelopen panelclose" );
if ( this._open ) {
this.document.off( this._transitionEndEvents );
$.mobile.resetActivePageHeight();
}
}
if ( this._open ) {
this._page().jqmRemoveData( "panel" );
}
this._panelInner.children().unwrap();
this.element
.removeClass( [ this._getPanelClasses(), o.classes.panelOpen, o.classes.animate ].join( " " ) )
.off( "swipeleft.panel swiperight.panel" )
.off( "panelbeforeopen" )
.off( "panelhide" )
.off( "keyup.panel" )
.off( "updatelayout" )
.off( this._transitionEndEvents );
this._closeLink.off( "click.panel" );
if ( this._modal ) {
this._modal.remove();
}
}
});
})( jQuery );
(function( $, undefined ) {
$.widget( "mobile.table", {
options: {
classes: {
table: "ui-table"
},
enhanced: false
},
_create: function() {
if ( !this.options.enhanced ) {
this.element.addClass( this.options.classes.table );
}
// extend here, assign on refresh > _setHeaders
$.extend( this, {
// Expose headers and allHeaders properties on the widget
// headers references the THs within the first TR in the table
headers: undefined,
// allHeaders references headers, plus all THs in the thead, which may
// include several rows, or not
allHeaders: undefined
});
this._refresh( true );
},
_setHeaders: function() {
var trs = this.element.find( "thead tr" );
this.headers = this.element.find( "tr:eq(0)" ).children();
this.allHeaders = this.headers.add( trs.children() );
},
refresh: function() {
this._refresh();
},
rebuild: $.noop,
_refresh: function( /* create */ ) {
var table = this.element,
trs = table.find( "thead tr" );
// updating headers on refresh (fixes #5880)
this._setHeaders();
// Iterate over the trs
trs.each( function() {
var columnCount = 0;
// Iterate over the children of the tr
$( this ).children().each( function() {
var span = parseInt( this.getAttribute( "colspan" ), 10 ),
selector = ":nth-child(" + ( columnCount + 1 ) + ")",
j;
this.setAttribute( "data-" + $.mobile.ns + "colstart", columnCount + 1 );
if ( span ) {
for( j = 0; j < span - 1; j++ ) {
columnCount++;
selector += ", :nth-child(" + ( columnCount + 1 ) + ")";
}
}
// Store "cells" data on header as a reference to all cells in the
// same column as this TH
$( this ).jqmData( "cells", table.find( "tr" ).not( trs.eq( 0 ) ).not( this ).children( selector ) );
columnCount++;
});
});
}
});
})( jQuery );
(function( $, undefined ) {
$.widget( "mobile.table", $.mobile.table, {
options: {
mode: "columntoggle",
columnBtnTheme: null,
columnPopupTheme: null,
columnBtnText: "Columns...",
classes: $.extend( $.mobile.table.prototype.options.classes, {
popup: "ui-table-columntoggle-popup",
columnBtn: "ui-table-columntoggle-btn",
priorityPrefix: "ui-table-priority-",
columnToggleTable: "ui-table-columntoggle"
})
},
_create: function() {
this._super();
if ( this.options.mode !== "columntoggle" ) {
return;
}
$.extend( this, {
_menu: null
});
if ( this.options.enhanced ) {
this._menu = $( this.document[ 0 ].getElementById( this._id() + "-popup" ) ).children().first();
this._addToggles( this._menu, true );
this._bindToggles( this._menu );
} else {
this._menu = this._enhanceColToggle();
this.element.addClass( this.options.classes.columnToggleTable );
}
this._setupEvents();
this._setToggleState();
},
_id: function() {
return ( this.element.attr( "id" ) || ( this.widgetName + this.uuid ) );
},
_setupEvents: function() {
//NOTE: inputs are bound in bindToggles,
// so it can be called on refresh, too
// update column toggles on resize
this._on( this.window, {
throttledresize: "_setToggleState"
});
},
_bindToggles: function( menu ) {
var inputs = menu.find( "input" );
this._on( inputs, {
change: "_menuInputChange"
});
},
_addToggles: function( menu, keep ) {
var inputs,
checkboxIndex = 0,
opts = this.options,
container = menu.controlgroup( "container" );
// allow update of menu on refresh (fixes #5880)
if ( keep ) {
inputs = menu.find( "input" );
} else {
container.empty();
}
// create the hide/show toggles
this.headers.not( "td" ).each( function() {
var header = $( this ),
priority = $.mobile.getAttribute( this, "priority" ),
cells = header.add( header.jqmData( "cells" ) );
if ( priority ) {
cells.addClass( opts.classes.priorityPrefix + priority );
( keep ? inputs.eq( checkboxIndex++ ) :
$("<label><input type='checkbox' checked />" +
( header.children( "abbr" ).first().attr( "title" ) ||
header.text() ) +
"</label>" )
.appendTo( container )
.children( 0 )
.checkboxradio( {
theme: opts.columnPopupTheme
}) )
.jqmData( "cells", cells );
}
});
// set bindings here
if ( !keep ) {
menu.controlgroup( "refresh" );
this._bindToggles( menu );
}
},
_menuInputChange: function( evt ) {
var input = $( evt.target ),
checked = input[ 0 ].checked;
input.jqmData( "cells" )
.toggleClass( "ui-table-cell-hidden", !checked )
.toggleClass( "ui-table-cell-visible", checked );
if ( input[ 0 ].getAttribute( "locked" ) ) {
input.removeAttr( "locked" );
this._unlockCells( input.jqmData( "cells" ) );
} else {
input.attr( "locked", true );
}
},
_unlockCells: function( cells ) {
// allow hide/show via CSS only = remove all toggle-locks
cells.removeClass( "ui-table-cell-hidden ui-table-cell-visible");
},
_enhanceColToggle: function() {
var id , menuButton, popup, menu,
table = this.element,
opts = this.options,
ns = $.mobile.ns,
fragment = this.document[ 0 ].createDocumentFragment();
id = this._id() + "-popup";
menuButton = $( "<a href='#" + id + "' " +
"class='" + opts.classes.columnBtn + " ui-btn " +
"ui-btn-" + ( opts.columnBtnTheme || "a" ) +
" ui-corner-all ui-shadow ui-mini' " +
"data-" + ns + "rel='popup'>" + opts.columnBtnText + "</a>" );
popup = $( "<div class='" + opts.classes.popup + "' id='" + id + "'></div>" );
menu = $( "<fieldset></fieldset>" ).controlgroup();
// set extension here, send "false" to trigger build/rebuild
this._addToggles( menu, false );
menu.appendTo( popup );
fragment.appendChild( popup[ 0 ] );
fragment.appendChild( menuButton[ 0 ] );
table.before( fragment );
popup.popup();
return menu;
},
rebuild: function() {
this._super();
if ( this.options.mode === "columntoggle" ) {
// NOTE: rebuild passes "false", while refresh passes "undefined"
// both refresh the table, but inside addToggles, !false will be true,
// so a rebuild call can be indentified
this._refresh( false );
}
},
_refresh: function( create ) {
this._super( create );
if ( !create && this.options.mode === "columntoggle" ) {
// columns not being replaced must be cleared from input toggle-locks
this._unlockCells( this.allHeaders );
// update columntoggles and cells
this._addToggles( this._menu, create );
// check/uncheck
this._setToggleState();
}
},
_setToggleState: function() {
this._menu.find( "input" ).each( function() {
var checkbox = $( this );
this.checked = checkbox.jqmData( "cells" ).eq( 0 ).css( "display" ) === "table-cell";
checkbox.checkboxradio( "refresh" );
});
},
_destroy: function() {
this._super();
}
});
})( jQuery );
(function( $, undefined ) {
$.widget( "mobile.table", $.mobile.table, {
options: {
mode: "reflow",
classes: $.extend( $.mobile.table.prototype.options.classes, {
reflowTable: "ui-table-reflow",
cellLabels: "ui-table-cell-label"
})
},
_create: function() {
this._super();
// If it's not reflow mode, return here.
if ( this.options.mode !== "reflow" ) {
return;
}
if ( !this.options.enhanced ) {
this.element.addClass( this.options.classes.reflowTable );
this._updateReflow();
}
},
rebuild: function() {
this._super();
if ( this.options.mode === "reflow" ) {
this._refresh( false );
}
},
_refresh: function( create ) {
this._super( create );
if ( !create && this.options.mode === "reflow" ) {
this._updateReflow( );
}
},
_updateReflow: function() {
var table = this,
opts = this.options;
// get headers in reverse order so that top-level headers are appended last
$( table.allHeaders.get().reverse() ).each( function() {
var cells = $( this ).jqmData( "cells" ),
colstart = $.mobile.getAttribute( this, "colstart" ),
hierarchyClass = cells.not( this ).filter( "thead th" ).length && " ui-table-cell-label-top",
text = $( this ).text(),
iteration, filter;
if ( text !== "" ) {
if ( hierarchyClass ) {
iteration = parseInt( this.getAttribute( "colspan" ), 10 );
filter = "";
if ( iteration ) {
filter = "td:nth-child("+ iteration +"n + " + ( colstart ) +")";
}
table._addLabels( cells.filter( filter ), opts.classes.cellLabels + hierarchyClass, text );
} else {
table._addLabels( cells, opts.classes.cellLabels, text );
}
}
});
},
_addLabels: function( cells, label, text ) {
// .not fixes #6006
cells.not( ":has(b." + label + ")" ).prepend( "<b class='" + label + "'>" + text + "</b>" );
}
});
})( jQuery );
(function( $, undefined ) {
// TODO rename filterCallback/deprecate and default to the item itself as the first argument
var defaultFilterCallback = function( index, searchValue ) {
return ( ( "" + ( $.mobile.getAttribute( this, "filtertext" ) || $( this ).text() ) )
.toLowerCase().indexOf( searchValue ) === -1 );
};
$.widget( "mobile.filterable", {
initSelector: ":jqmData(filter='true')",
options: {
filterReveal: false,
filterCallback: defaultFilterCallback,
enhanced: false,
input: null,
children: "> li, > option, > optgroup option, > tbody tr, > .ui-controlgroup-controls > .ui-btn, > .ui-controlgroup-controls > .ui-checkbox, > .ui-controlgroup-controls > .ui-radio"
},
_create: function() {
var opts = this.options;
$.extend( this, {
_search: null,
_timer: 0
});
this._setInput( opts.input );
if ( !opts.enhanced ) {
this._filterItems( ( ( this._search && this._search.val() ) || "" ).toLowerCase() );
}
},
_onKeyUp: function() {
var val, lastval,
search = this._search;
if ( search ) {
val = search.val().toLowerCase(),
lastval = $.mobile.getAttribute( search[ 0 ], "lastval" ) + "";
if ( lastval && lastval === val ) {
// Execute the handler only once per value change
return;
}
if ( this._timer ) {
window.clearTimeout( this._timer );
this._timer = 0;
}
this._timer = this._delay( function() {
this._trigger( "beforefilter", "beforefilter", { input: search } );
// Change val as lastval for next execution
search[ 0 ].setAttribute( "data-" + $.mobile.ns + "lastval", val );
this._filterItems( val );
this._timer = 0;
}, 250 );
}
},
_getFilterableItems: function() {
var elem = this.element,
children = this.options.children,
items = !children ? { length: 0 }:
$.isFunction( children ) ? children():
children.nodeName ? $( children ):
children.jquery ? children:
this.element.find( children );
if ( items.length === 0 ) {
items = elem.children();
}
return items;
},
_filterItems: function( val ) {
var idx, callback, length, dst,
show = [],
hide = [],
opts = this.options,
filterItems = this._getFilterableItems();
if ( val != null ) {
callback = opts.filterCallback || defaultFilterCallback;
length = filterItems.length;
// Partition the items into those to be hidden and those to be shown
for ( idx = 0 ; idx < length ; idx++ ) {
dst = ( callback.call( filterItems[ idx ], idx, val ) ) ? hide : show;
dst.push( filterItems[ idx ] );
}
}
// If nothing is hidden, then the decision whether to hide or show the items
// is based on the "filterReveal" option.
if ( hide.length === 0 ) {
filterItems[ opts.filterReveal ? "addClass" : "removeClass" ]( "ui-screen-hidden" );
} else {
$( hide ).addClass( "ui-screen-hidden" );
$( show ).removeClass( "ui-screen-hidden" );
}
this._refreshChildWidget();
},
// The Default implementation of _refreshChildWidget attempts to call
// refresh on collapsibleset, controlgroup, selectmenu, or listview
_refreshChildWidget: function() {
var widget, idx,
recognizedWidgets = [ "collapsibleset", "selectmenu", "controlgroup", "listview" ];
for ( idx = recognizedWidgets.length - 1 ; idx > -1 ; idx-- ) {
widget = recognizedWidgets[ idx ];
if ( $.mobile[ widget ] ) {
widget = this.element.data( "mobile-" + widget );
if ( widget && $.isFunction( widget.refresh ) ) {
widget.refresh();
}
}
}
},
// TODO: When the input is not internal, do not even store it in this._search
_setInput: function ( selector ) {
var search = this._search;
// Stop a pending filter operation
if ( this._timer ) {
window.clearTimeout( this._timer );
this._timer = 0;
}
if ( search ) {
this._off( search, "keyup change input" );
search = null;
}
if ( selector ) {
search = selector.jquery ? selector:
selector.nodeName ? $( selector ):
this.document.find( selector );
this._on( search, {
keyup: "_onKeyUp",
change: "_onKeyUp",
input: "_onKeyUp"
});
}
this._search = search;
},
_setOptions: function( options ) {
var refilter = !( ( options.filterReveal === undefined ) &&
( options.filterCallback === undefined ) &&
( options.children === undefined ) );
this._super( options );
if ( options.input !== undefined ) {
this._setInput( options.input );
refilter = true;
}
if ( refilter ) {
this.refresh();
}
},
_destroy: function() {
var opts = this.options,
items = this._getFilterableItems();
if ( opts.enhanced ) {
items.toggleClass( "ui-screen-hidden", opts.filterReveal );
} else {
items.removeClass( "ui-screen-hidden" );
}
},
refresh: function() {
if ( this._timer ) {
window.clearTimeout( this._timer );
this._timer = 0;
}
this._filterItems( ( ( this._search && this._search.val() ) || "" ).toLowerCase() );
}
});
})( jQuery );
(function( $, undefined ) {
// Create a function that will replace the _setOptions function of a widget,
// and will pass the options on to the input of the filterable.
var replaceSetOptions = function( self, orig ) {
return function( options ) {
orig.call( this, options );
self._syncTextInputOptions( options );
};
},
rDividerListItem = /(^|\s)ui-li-divider(\s|$)/,
origDefaultFilterCallback = $.mobile.filterable.prototype.options.filterCallback;
// Override the default filter callback with one that does not hide list dividers
$.mobile.filterable.prototype.options.filterCallback = function( index, searchValue ) {
return !this.className.match( rDividerListItem ) &&
origDefaultFilterCallback.call( this, index, searchValue );
};
$.widget( "mobile.filterable", $.mobile.filterable, {
options: {
filterPlaceholder: "Filter items...",
filterTheme: null
},
_create: function() {
var idx, widgetName,
elem = this.element,
recognizedWidgets = [ "collapsibleset", "selectmenu", "controlgroup", "listview" ],
createHandlers = {};
this._super();
$.extend( this, {
_widget: null
});
for ( idx = recognizedWidgets.length - 1 ; idx > -1 ; idx-- ) {
widgetName = recognizedWidgets[ idx ];
if ( $.mobile[ widgetName ] ) {
if ( this._setWidget( elem.data( "mobile-" + widgetName ) ) ) {
break;
} else {
createHandlers[ widgetName + "create" ] = "_handleCreate";
}
}
}
if ( !this._widget ) {
this._on( elem, createHandlers );
}
},
_handleCreate: function( evt ) {
this._setWidget( this.element.data( "mobile-" + evt.type.substring( 0, evt.type.length - 6 ) ) );
},
_setWidget: function( widget ) {
if ( !this._widget && widget ) {
this._widget = widget;
this._widget._setOptions = replaceSetOptions( this, this._widget._setOptions );
}
if ( !!this._widget ) {
this._syncTextInputOptions( this._widget.options );
if ( this._widget.widgetName === "listview" ) {
this._widget.options.hidedividers = true;
this._widget.element.listview( "refresh" );
}
}
return !!this._widget;
},
_isSearchInternal: function() {
return ( this._search && this._search.jqmData( "ui-filterable-" + this.uuid + "-internal" ) );
},
_setInput: function( selector ) {
var opts = this.options,
updatePlaceholder = true,
textinputOpts = {};
if ( !selector ) {
if ( this._isSearchInternal() ) {
// Ignore the call to set a new input if the selector goes to falsy and
// the current textinput is already of the internally generated variety.
return;
} else {
// Generating a new textinput widget. No need to set the placeholder
// further down the function.
updatePlaceholder = false;
selector = $( "<input " +
"data-" + $.mobile.ns + "type='search' " +
"placeholder='" + opts.filterPlaceholder + "'></input>" )
.jqmData( "ui-filterable-" + this.uuid + "-internal", true );
$( "<form class='ui-filterable'></form>" )
.append( selector )
.submit( function( evt ) {
evt.preventDefault();
selector.blur();
})
.insertBefore( this.element );
if ( $.mobile.textinput ) {
if ( this.options.filterTheme != null ) {
textinputOpts[ "theme" ] = opts.filterTheme;
}
selector.textinput( textinputOpts );
}
}
}
this._super( selector );
if ( this._isSearchInternal() && updatePlaceholder ) {
this._search.attr( "placeholder", this.options.filterPlaceholder );
}
},
_setOptions: function( options ) {
var ret = this._super( options );
// Need to set the filterPlaceholder after having established the search input
if ( options.filterPlaceholder !== undefined ) {
if ( this._isSearchInternal() ) {
this._search.attr( "placeholder", options.filterPlaceholder );
}
}
if ( options.filterTheme !== undefined && this._search && $.mobile.textinput ) {
this._search.textinput( "option", "theme", options.filterTheme );
}
return ret;
},
_destroy: function() {
if ( this._isSearchInternal() ) {
this._search.remove();
}
this._super();
},
_syncTextInputOptions: function( options ) {
var idx,
textinputOptions = {};
// We only sync options if the filterable's textinput is of the internally
// generated variety, rather than one specified by the user.
if ( this._isSearchInternal() && $.mobile.textinput ) {
// Apply only the options understood by textinput
for ( idx in $.mobile.textinput.prototype.options ) {
if ( options[ idx ] !== undefined ) {
if ( idx === "theme" && this.options.filterTheme != null ) {
textinputOptions[ idx ] = this.options.filterTheme;
} else {
textinputOptions[ idx ] = options[ idx ];
}
}
}
this._search.textinput( "option", textinputOptions );
}
}
});
})( jQuery );
/*!
* jQuery UI Tabs fadf2b312a05040436451c64bbfaf4814bc62c56
* http://jqueryui.com
*
* Copyright 2013 jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/tabs/
*
* Depends:
* jquery.ui.core.js
* jquery.ui.widget.js
*/
(function( $, undefined ) {
var tabId = 0,
rhash = /#.*$/;
function getNextTabId() {
return ++tabId;
}
function isLocal( anchor ) {
return anchor.hash.length > 1 &&
decodeURIComponent( anchor.href.replace( rhash, "" ) ) ===
decodeURIComponent( location.href.replace( rhash, "" ) );
}
$.widget( "ui.tabs", {
version: "fadf2b312a05040436451c64bbfaf4814bc62c56",
delay: 300,
options: {
active: null,
collapsible: false,
event: "click",
heightStyle: "content",
hide: null,
show: null,
// callbacks
activate: null,
beforeActivate: null,
beforeLoad: null,
load: null
},
_create: function() {
var that = this,
options = this.options;
this.running = false;
this.element
.addClass( "ui-tabs ui-widget ui-widget-content ui-corner-all" )
.toggleClass( "ui-tabs-collapsible", options.collapsible )
// Prevent users from focusing disabled tabs via click
.delegate( ".ui-tabs-nav > li", "mousedown" + this.eventNamespace, function( event ) {
if ( $( this ).is( ".ui-state-disabled" ) ) {
event.preventDefault();
}
})
// support: IE <9
// Preventing the default action in mousedown doesn't prevent IE
// from focusing the element, so if the anchor gets focused, blur.
// We don't have to worry about focusing the previously focused
// element since clicking on a non-focusable element should focus
// the body anyway.
.delegate( ".ui-tabs-anchor", "focus" + this.eventNamespace, function() {
if ( $( this ).closest( "li" ).is( ".ui-state-disabled" ) ) {
this.blur();
}
});
this._processTabs();
options.active = this._initialActive();
// Take disabling tabs via class attribute from HTML
// into account and update option properly.
if ( $.isArray( options.disabled ) ) {
options.disabled = $.unique( options.disabled.concat(
$.map( this.tabs.filter( ".ui-state-disabled" ), function( li ) {
return that.tabs.index( li );
})
) ).sort();
}
// check for length avoids error when initializing empty list
if ( this.options.active !== false && this.anchors.length ) {
this.active = this._findActive( options.active );
} else {
this.active = $();
}
this._refresh();
if ( this.active.length ) {
this.load( options.active );
}
},
_initialActive: function() {
var active = this.options.active,
collapsible = this.options.collapsible,
locationHash = location.hash.substring( 1 );
if ( active === null ) {
// check the fragment identifier in the URL
if ( locationHash ) {
this.tabs.each(function( i, tab ) {
if ( $( tab ).attr( "aria-controls" ) === locationHash ) {
active = i;
return false;
}
});
}
// check for a tab marked active via a class
if ( active === null ) {
active = this.tabs.index( this.tabs.filter( ".ui-tabs-active" ) );
}
// no active tab, set to false
if ( active === null || active === -1 ) {
active = this.tabs.length ? 0 : false;
}
}
// handle numbers: negative, out of range
if ( active !== false ) {
active = this.tabs.index( this.tabs.eq( active ) );
if ( active === -1 ) {
active = collapsible ? false : 0;
}
}
// don't allow collapsible: false and active: false
if ( !collapsible && active === false && this.anchors.length ) {
active = 0;
}
return active;
},
_getCreateEventData: function() {
return {
tab: this.active,
panel: !this.active.length ? $() : this._getPanelForTab( this.active )
};
},
_tabKeydown: function( event ) {
var focusedTab = $( this.document[0].activeElement ).closest( "li" ),
selectedIndex = this.tabs.index( focusedTab ),
goingForward = true;
if ( this._handlePageNav( event ) ) {
return;
}
switch ( event.keyCode ) {
case $.ui.keyCode.RIGHT:
case $.ui.keyCode.DOWN:
selectedIndex++;
break;
case $.ui.keyCode.UP:
case $.ui.keyCode.LEFT:
goingForward = false;
selectedIndex--;
break;
case $.ui.keyCode.END:
selectedIndex = this.anchors.length - 1;
break;
case $.ui.keyCode.HOME:
selectedIndex = 0;
break;
case $.ui.keyCode.SPACE:
// Activate only, no collapsing
event.preventDefault();
clearTimeout( this.activating );
this._activate( selectedIndex );
return;
case $.ui.keyCode.ENTER:
// Toggle (cancel delayed activation, allow collapsing)
event.preventDefault();
clearTimeout( this.activating );
// Determine if we should collapse or activate
this._activate( selectedIndex === this.options.active ? false : selectedIndex );
return;
default:
return;
}
// Focus the appropriate tab, based on which key was pressed
event.preventDefault();
clearTimeout( this.activating );
selectedIndex = this._focusNextTab( selectedIndex, goingForward );
// Navigating with control key will prevent automatic activation
if ( !event.ctrlKey ) {
// Update aria-selected immediately so that AT think the tab is already selected.
// Otherwise AT may confuse the user by stating that they need to activate the tab,
// but the tab will already be activated by the time the announcement finishes.
focusedTab.attr( "aria-selected", "false" );
this.tabs.eq( selectedIndex ).attr( "aria-selected", "true" );
this.activating = this._delay(function() {
this.option( "active", selectedIndex );
}, this.delay );
}
},
_panelKeydown: function( event ) {
if ( this._handlePageNav( event ) ) {
return;
}
// Ctrl+up moves focus to the current tab
if ( event.ctrlKey && event.keyCode === $.ui.keyCode.UP ) {
event.preventDefault();
this.active.focus();
}
},
// Alt+page up/down moves focus to the previous/next tab (and activates)
_handlePageNav: function( event ) {
if ( event.altKey && event.keyCode === $.ui.keyCode.PAGE_UP ) {
this._activate( this._focusNextTab( this.options.active - 1, false ) );
return true;
}
if ( event.altKey && event.keyCode === $.ui.keyCode.PAGE_DOWN ) {
this._activate( this._focusNextTab( this.options.active + 1, true ) );
return true;
}
},
_findNextTab: function( index, goingForward ) {
var lastTabIndex = this.tabs.length - 1;
function constrain() {
if ( index > lastTabIndex ) {
index = 0;
}
if ( index < 0 ) {
index = lastTabIndex;
}
return index;
}
while ( $.inArray( constrain(), this.options.disabled ) !== -1 ) {
index = goingForward ? index + 1 : index - 1;
}
return index;
},
_focusNextTab: function( index, goingForward ) {
index = this._findNextTab( index, goingForward );
this.tabs.eq( index ).focus();
return index;
},
_setOption: function( key, value ) {
if ( key === "active" ) {
// _activate() will handle invalid values and update this.options
this._activate( value );
return;
}
if ( key === "disabled" ) {
// don't use the widget factory's disabled handling
this._setupDisabled( value );
return;
}
this._super( key, value);
if ( key === "collapsible" ) {
this.element.toggleClass( "ui-tabs-collapsible", value );
// Setting collapsible: false while collapsed; open first panel
if ( !value && this.options.active === false ) {
this._activate( 0 );
}
}
if ( key === "event" ) {
this._setupEvents( value );
}
if ( key === "heightStyle" ) {
this._setupHeightStyle( value );
}
},
_tabId: function( tab ) {
return tab.attr( "aria-controls" ) || "ui-tabs-" + getNextTabId();
},
_sanitizeSelector: function( hash ) {
return hash ? hash.replace( /[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g, "\\$&" ) : "";
},
refresh: function() {
var options = this.options,
lis = this.tablist.children( ":has(a[href])" );
// get disabled tabs from class attribute from HTML
// this will get converted to a boolean if needed in _refresh()
options.disabled = $.map( lis.filter( ".ui-state-disabled" ), function( tab ) {
return lis.index( tab );
});
this._processTabs();
// was collapsed or no tabs
if ( options.active === false || !this.anchors.length ) {
options.active = false;
this.active = $();
// was active, but active tab is gone
} else if ( this.active.length && !$.contains( this.tablist[ 0 ], this.active[ 0 ] ) ) {
// all remaining tabs are disabled
if ( this.tabs.length === options.disabled.length ) {
options.active = false;
this.active = $();
// activate previous tab
} else {
this._activate( this._findNextTab( Math.max( 0, options.active - 1 ), false ) );
}
// was active, active tab still exists
} else {
// make sure active index is correct
options.active = this.tabs.index( this.active );
}
this._refresh();
},
_refresh: function() {
this._setupDisabled( this.options.disabled );
this._setupEvents( this.options.event );
this._setupHeightStyle( this.options.heightStyle );
this.tabs.not( this.active ).attr({
"aria-selected": "false",
tabIndex: -1
});
this.panels.not( this._getPanelForTab( this.active ) )
.hide()
.attr({
"aria-expanded": "false",
"aria-hidden": "true"
});
// Make sure one tab is in the tab order
if ( !this.active.length ) {
this.tabs.eq( 0 ).attr( "tabIndex", 0 );
} else {
this.active
.addClass( "ui-tabs-active ui-state-active" )
.attr({
"aria-selected": "true",
tabIndex: 0
});
this._getPanelForTab( this.active )
.show()
.attr({
"aria-expanded": "true",
"aria-hidden": "false"
});
}
},
_processTabs: function() {
var that = this;
this.tablist = this._getList()
.addClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" )
.attr( "role", "tablist" );
this.tabs = this.tablist.find( "> li:has(a[href])" )
.addClass( "ui-state-default ui-corner-top" )
.attr({
role: "tab",
tabIndex: -1
});
this.anchors = this.tabs.map(function() {
return $( "a", this )[ 0 ];
})
.addClass( "ui-tabs-anchor" )
.attr({
role: "presentation",
tabIndex: -1
});
this.panels = $();
this.anchors.each(function( i, anchor ) {
var selector, panel, panelId,
anchorId = $( anchor ).uniqueId().attr( "id" ),
tab = $( anchor ).closest( "li" ),
originalAriaControls = tab.attr( "aria-controls" );
// inline tab
if ( isLocal( anchor ) ) {
selector = anchor.hash;
panel = that.element.find( that._sanitizeSelector( selector ) );
// remote tab
} else {
panelId = that._tabId( tab );
selector = "#" + panelId;
panel = that.element.find( selector );
if ( !panel.length ) {
panel = that._createPanel( panelId );
panel.insertAfter( that.panels[ i - 1 ] || that.tablist );
}
panel.attr( "aria-live", "polite" );
}
if ( panel.length) {
that.panels = that.panels.add( panel );
}
if ( originalAriaControls ) {
tab.data( "ui-tabs-aria-controls", originalAriaControls );
}
tab.attr({
"aria-controls": selector.substring( 1 ),
"aria-labelledby": anchorId
});
panel.attr( "aria-labelledby", anchorId );
});
this.panels
.addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" )
.attr( "role", "tabpanel" );
},
// allow overriding how to find the list for rare usage scenarios (#7715)
_getList: function() {
return this.element.find( "ol,ul" ).eq( 0 );
},
_createPanel: function( id ) {
return $( "<div>" )
.attr( "id", id )
.addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" )
.data( "ui-tabs-destroy", true );
},
_setupDisabled: function( disabled ) {
if ( $.isArray( disabled ) ) {
if ( !disabled.length ) {
disabled = false;
} else if ( disabled.length === this.anchors.length ) {
disabled = true;
}
}
// disable tabs
for ( var i = 0, li; ( li = this.tabs[ i ] ); i++ ) {
if ( disabled === true || $.inArray( i, disabled ) !== -1 ) {
$( li )
.addClass( "ui-state-disabled" )
.attr( "aria-disabled", "true" );
} else {
$( li )
.removeClass( "ui-state-disabled" )
.removeAttr( "aria-disabled" );
}
}
this.options.disabled = disabled;
},
_setupEvents: function( event ) {
var events = {
click: function( event ) {
event.preventDefault();
}
};
if ( event ) {
$.each( event.split(" "), function( index, eventName ) {
events[ eventName ] = "_eventHandler";
});
}
this._off( this.anchors.add( this.tabs ).add( this.panels ) );
this._on( this.anchors, events );
this._on( this.tabs, { keydown: "_tabKeydown" } );
this._on( this.panels, { keydown: "_panelKeydown" } );
this._focusable( this.tabs );
this._hoverable( this.tabs );
},
_setupHeightStyle: function( heightStyle ) {
var maxHeight,
parent = this.element.parent();
if ( heightStyle === "fill" ) {
maxHeight = parent.height();
maxHeight -= this.element.outerHeight() - this.element.height();
this.element.siblings( ":visible" ).each(function() {
var elem = $( this ),
position = elem.css( "position" );
if ( position === "absolute" || position === "fixed" ) {
return;
}
maxHeight -= elem.outerHeight( true );
});
this.element.children().not( this.panels ).each(function() {
maxHeight -= $( this ).outerHeight( true );
});
this.panels.each(function() {
$( this ).height( Math.max( 0, maxHeight -
$( this ).innerHeight() + $( this ).height() ) );
})
.css( "overflow", "auto" );
} else if ( heightStyle === "auto" ) {
maxHeight = 0;
this.panels.each(function() {
maxHeight = Math.max( maxHeight, $( this ).height( "" ).height() );
}).height( maxHeight );
}
},
_eventHandler: function( event ) {
var options = this.options,
active = this.active,
anchor = $( event.currentTarget ),
tab = anchor.closest( "li" ),
clickedIsActive = tab[ 0 ] === active[ 0 ],
collapsing = clickedIsActive && options.collapsible,
toShow = collapsing ? $() : this._getPanelForTab( tab ),
toHide = !active.length ? $() : this._getPanelForTab( active ),
eventData = {
oldTab: active,
oldPanel: toHide,
newTab: collapsing ? $() : tab,
newPanel: toShow
};
event.preventDefault();
if ( tab.hasClass( "ui-state-disabled" ) ||
// tab is already loading
tab.hasClass( "ui-tabs-loading" ) ||
// can't switch durning an animation
this.running ||
// click on active header, but not collapsible
( clickedIsActive && !options.collapsible ) ||
// allow canceling activation
( this._trigger( "beforeActivate", event, eventData ) === false ) ) {
return;
}
options.active = collapsing ? false : this.tabs.index( tab );
this.active = clickedIsActive ? $() : tab;
if ( this.xhr ) {
this.xhr.abort();
}
if ( !toHide.length && !toShow.length ) {
$.error( "jQuery UI Tabs: Mismatching fragment identifier." );
}
if ( toShow.length ) {
this.load( this.tabs.index( tab ), event );
}
this._toggle( event, eventData );
},
// handles show/hide for selecting tabs
_toggle: function( event, eventData ) {
var that = this,
toShow = eventData.newPanel,
toHide = eventData.oldPanel;
this.running = true;
function complete() {
that.running = false;
that._trigger( "activate", event, eventData );
}
function show() {
eventData.newTab.closest( "li" ).addClass( "ui-tabs-active ui-state-active" );
if ( toShow.length && that.options.show ) {
that._show( toShow, that.options.show, complete );
} else {
toShow.show();
complete();
}
}
// start out by hiding, then showing, then completing
if ( toHide.length && this.options.hide ) {
this._hide( toHide, this.options.hide, function() {
eventData.oldTab.closest( "li" ).removeClass( "ui-tabs-active ui-state-active" );
show();
});
} else {
eventData.oldTab.closest( "li" ).removeClass( "ui-tabs-active ui-state-active" );
toHide.hide();
show();
}
toHide.attr({
"aria-expanded": "false",
"aria-hidden": "true"
});
eventData.oldTab.attr( "aria-selected", "false" );
// If we're switching tabs, remove the old tab from the tab order.
// If we're opening from collapsed state, remove the previous tab from the tab order.
// If we're collapsing, then keep the collapsing tab in the tab order.
if ( toShow.length && toHide.length ) {
eventData.oldTab.attr( "tabIndex", -1 );
} else if ( toShow.length ) {
this.tabs.filter(function() {
return $( this ).attr( "tabIndex" ) === 0;
})
.attr( "tabIndex", -1 );
}
toShow.attr({
"aria-expanded": "true",
"aria-hidden": "false"
});
eventData.newTab.attr({
"aria-selected": "true",
tabIndex: 0
});
},
_activate: function( index ) {
var anchor,
active = this._findActive( index );
// trying to activate the already active panel
if ( active[ 0 ] === this.active[ 0 ] ) {
return;
}
// trying to collapse, simulate a click on the current active header
if ( !active.length ) {
active = this.active;
}
anchor = active.find( ".ui-tabs-anchor" )[ 0 ];
this._eventHandler({
target: anchor,
currentTarget: anchor,
preventDefault: $.noop
});
},
_findActive: function( index ) {
return index === false ? $() : this.tabs.eq( index );
},
_getIndex: function( index ) {
// meta-function to give users option to provide a href string instead of a numerical index.
if ( typeof index === "string" ) {
index = this.anchors.index( this.anchors.filter( "[href$='" + index + "']" ) );
}
return index;
},
_destroy: function() {
if ( this.xhr ) {
this.xhr.abort();
}
this.element.removeClass( "ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible" );
this.tablist
.removeClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" )
.removeAttr( "role" );
this.anchors
.removeClass( "ui-tabs-anchor" )
.removeAttr( "role" )
.removeAttr( "tabIndex" )
.removeUniqueId();
this.tabs.add( this.panels ).each(function() {
if ( $.data( this, "ui-tabs-destroy" ) ) {
$( this ).remove();
} else {
$( this )
.removeClass( "ui-state-default ui-state-active ui-state-disabled " +
"ui-corner-top ui-corner-bottom ui-widget-content ui-tabs-active ui-tabs-panel" )
.removeAttr( "tabIndex" )
.removeAttr( "aria-live" )
.removeAttr( "aria-busy" )
.removeAttr( "aria-selected" )
.removeAttr( "aria-labelledby" )
.removeAttr( "aria-hidden" )
.removeAttr( "aria-expanded" )
.removeAttr( "role" );
}
});
this.tabs.each(function() {
var li = $( this ),
prev = li.data( "ui-tabs-aria-controls" );
if ( prev ) {
li
.attr( "aria-controls", prev )
.removeData( "ui-tabs-aria-controls" );
} else {
li.removeAttr( "aria-controls" );
}
});
this.panels.show();
if ( this.options.heightStyle !== "content" ) {
this.panels.css( "height", "" );
}
},
enable: function( index ) {
var disabled = this.options.disabled;
if ( disabled === false ) {
return;
}
if ( index === undefined ) {
disabled = false;
} else {
index = this._getIndex( index );
if ( $.isArray( disabled ) ) {
disabled = $.map( disabled, function( num ) {
return num !== index ? num : null;
});
} else {
disabled = $.map( this.tabs, function( li, num ) {
return num !== index ? num : null;
});
}
}
this._setupDisabled( disabled );
},
disable: function( index ) {
var disabled = this.options.disabled;
if ( disabled === true ) {
return;
}
if ( index === undefined ) {
disabled = true;
} else {
index = this._getIndex( index );
if ( $.inArray( index, disabled ) !== -1 ) {
return;
}
if ( $.isArray( disabled ) ) {
disabled = $.merge( [ index ], disabled ).sort();
} else {
disabled = [ index ];
}
}
this._setupDisabled( disabled );
},
load: function( index, event ) {
index = this._getIndex( index );
var that = this,
tab = this.tabs.eq( index ),
anchor = tab.find( ".ui-tabs-anchor" ),
panel = this._getPanelForTab( tab ),
eventData = {
tab: tab,
panel: panel
};
// not remote
if ( isLocal( anchor[ 0 ] ) ) {
return;
}
this.xhr = $.ajax( this._ajaxSettings( anchor, event, eventData ) );
// support: jQuery <1.8
// jQuery <1.8 returns false if the request is canceled in beforeSend,
// but as of 1.8, $.ajax() always returns a jqXHR object.
if ( this.xhr && this.xhr.statusText !== "canceled" ) {
tab.addClass( "ui-tabs-loading" );
panel.attr( "aria-busy", "true" );
this.xhr
.success(function( response ) {
// support: jQuery <1.8
// http://bugs.jquery.com/ticket/11778
setTimeout(function() {
panel.html( response );
that._trigger( "load", event, eventData );
}, 1 );
})
.complete(function( jqXHR, status ) {
// support: jQuery <1.8
// http://bugs.jquery.com/ticket/11778
setTimeout(function() {
if ( status === "abort" ) {
that.panels.stop( false, true );
}
tab.removeClass( "ui-tabs-loading" );
panel.removeAttr( "aria-busy" );
if ( jqXHR === that.xhr ) {
delete that.xhr;
}
}, 1 );
});
}
},
_ajaxSettings: function( anchor, event, eventData ) {
var that = this;
return {
url: anchor.attr( "href" ),
beforeSend: function( jqXHR, settings ) {
return that._trigger( "beforeLoad", event,
$.extend( { jqXHR : jqXHR, ajaxSettings: settings }, eventData ) );
}
};
},
_getPanelForTab: function( tab ) {
var id = $( tab ).attr( "aria-controls" );
return this.element.find( this._sanitizeSelector( "#" + id ) );
}
});
})( jQuery );
(function( $, undefined ) {
})( jQuery );
(function( $, window ) {
$.mobile.iosorientationfixEnabled = true;
// This fix addresses an iOS bug, so return early if the UA claims it's something else.
var ua = navigator.userAgent,
zoom,
evt, x, y, z, aig;
if ( !( /iPhone|iPad|iPod/.test( navigator.platform ) && /OS [1-5]_[0-9_]* like Mac OS X/i.test( ua ) && ua.indexOf( "AppleWebKit" ) > -1 ) ) {
$.mobile.iosorientationfixEnabled = false;
return;
}
zoom = $.mobile.zoom;
function checkTilt( e ) {
evt = e.originalEvent;
aig = evt.accelerationIncludingGravity;
x = Math.abs( aig.x );
y = Math.abs( aig.y );
z = Math.abs( aig.z );
// If portrait orientation and in one of the danger zones
if ( !window.orientation && ( x > 7 || ( ( z > 6 && y < 8 || z < 8 && y > 6 ) && x > 5 ) ) ) {
if ( zoom.enabled ) {
zoom.disable();
}
} else if ( !zoom.enabled ) {
zoom.enable();
}
}
$.mobile.document.on( "mobileinit", function() {
if ( $.mobile.iosorientationfixEnabled ) {
$.mobile.window
.bind( "orientationchange.iosorientationfix", zoom.enable )
.bind( "devicemotion.iosorientationfix", checkTilt );
}
});
}( jQuery, this ));
(function( $, window, undefined ) {
var $html = $( "html" ),
$window = $.mobile.window;
//remove initial build class (only present on first pageshow)
function hideRenderingClass() {
$html.removeClass( "ui-mobile-rendering" );
}
// trigger mobileinit event - useful hook for configuring $.mobile settings before they're used
$( window.document ).trigger( "mobileinit" );
// support conditions
// if device support condition(s) aren't met, leave things as they are -> a basic, usable experience,
// otherwise, proceed with the enhancements
if ( !$.mobile.gradeA() ) {
return;
}
// override ajaxEnabled on platforms that have known conflicts with hash history updates
// or generally work better browsing in regular http for full page refreshes (BB5, Opera Mini)
if ( $.mobile.ajaxBlacklist ) {
$.mobile.ajaxEnabled = false;
}
// Add mobile, initial load "rendering" classes to docEl
$html.addClass( "ui-mobile ui-mobile-rendering" );
// This is a fallback. If anything goes wrong (JS errors, etc), or events don't fire,
// this ensures the rendering class is removed after 5 seconds, so content is visible and accessible
setTimeout( hideRenderingClass, 5000 );
$.extend( $.mobile, {
// find and enhance the pages in the dom and transition to the first page.
initializePage: function() {
// find present pages
var path = $.mobile.path,
$pages = $( ":jqmData(role='page'), :jqmData(role='dialog')" ),
hash = path.stripHash( path.stripQueryParams(path.parseLocation().hash) ),
hashPage = document.getElementById( hash );
// if no pages are found, create one with body's inner html
if ( !$pages.length ) {
$pages = $( "body" ).wrapInner( "<div data-" + $.mobile.ns + "role='page'></div>" ).children( 0 );
}
// add dialogs, set data-url attrs
$pages.each(function() {
var $this = $( this );
// unless the data url is already set set it to the pathname
if ( !$this[ 0 ].getAttribute( "data-" + $.mobile.ns + "url" ) ) {
$this.attr( "data-" + $.mobile.ns + "url", $this.attr( "id" ) || location.pathname + location.search );
}
});
// define first page in dom case one backs out to the directory root (not always the first page visited, but defined as fallback)
$.mobile.firstPage = $pages.first();
// define page container
$.mobile.pageContainer = $.mobile.firstPage
.parent()
.addClass( "ui-mobile-viewport" )
.pagecontainer();
// initialize navigation events now, after mobileinit has occurred and the page container
// has been created but before the rest of the library is alerted to that fact
$.mobile.navreadyDeferred.resolve();
// alert listeners that the pagecontainer has been determined for binding
// to events triggered on it
$window.trigger( "pagecontainercreate" );
// cue page loading message
$.mobile.loading( "show" );
//remove initial build class (only present on first pageshow)
hideRenderingClass();
// if hashchange listening is disabled, there's no hash deeplink,
// the hash is not valid (contains more than one # or does not start with #)
// or there is no page with that hash, change to the first page in the DOM
// Remember, however, that the hash can also be a path!
if ( ! ( $.mobile.hashListeningEnabled &&
$.mobile.path.isHashValid( location.hash ) &&
( $( hashPage ).is( ":jqmData(role='page')" ) ||
$.mobile.path.isPath( hash ) ||
hash === $.mobile.dialogHashKey ) ) ) {
// Store the initial destination
if ( $.mobile.path.isHashValid( location.hash ) ) {
$.mobile.navigate.history.initialDst = hash.replace( "#", "" );
}
// make sure to set initial popstate state if it exists
// so that navigation back to the initial page works properly
if ( $.event.special.navigate.isPushStateEnabled() ) {
$.mobile.navigate.navigator.squash( path.parseLocation().href );
}
$.mobile.changePage( $.mobile.firstPage, {
transition: "none",
reverse: true,
changeHash: false,
fromHashChange: true
});
} else {
// trigger hashchange or navigate to squash and record the correct
// history entry for an initial hash path
if ( !$.event.special.navigate.isPushStateEnabled() ) {
$window.trigger( "hashchange", [true] );
} else {
// TODO figure out how to simplify this interaction with the initial history entry
// at the bottom js/navigate/navigate.js
$.mobile.navigate.history.stack = [];
$.mobile.navigate( $.mobile.path.isPath( location.hash ) ? location.hash : location.href );
}
}
}
});
$(function() {
//Run inlineSVG support test
$.support.inlineSVG();
// check which scrollTop value should be used by scrolling to 1 immediately at domready
// then check what the scroll top is. Android will report 0... others 1
// note that this initial scroll won't hide the address bar. It's just for the check.
// hide iOS browser chrome on load if hideUrlBar is true this is to try and do it as soon as possible
if ( $.mobile.hideUrlBar ) {
window.scrollTo( 0, 1 );
}
// if defaultHomeScroll hasn't been set yet, see if scrollTop is 1
// it should be 1 in most browsers, but android treats 1 as 0 (for hiding addr bar)
// so if it's 1, use 0 from now on
$.mobile.defaultHomeScroll = ( !$.support.scrollTop || $.mobile.window.scrollTop() === 1 ) ? 0 : 1;
//dom-ready inits
if ( $.mobile.autoInitializePage ) {
$.mobile.initializePage();
}
// window load event
// hide iOS browser chrome on load if hideUrlBar is true this is as fall back incase we were too early before
if ( $.mobile.hideUrlBar ) {
$window.load( $.mobile.silentScroll );
}
if ( !$.support.cssPointerEvents ) {
// IE and Opera don't support CSS pointer-events: none that we use to disable link-based buttons
// by adding the 'ui-disabled' class to them. Using a JavaScript workaround for those browser.
// https://github.com/jquery/jquery-mobile/issues/3558
// DEPRECATED as of 1.4.0 - remove ui-disabled after 1.4.0 release
// only ui-state-disabled should be present thereafter
$.mobile.document.delegate( ".ui-state-disabled,.ui-disabled", "vclick",
function( e ) {
e.preventDefault();
e.stopImmediatePropagation();
}
);
}
});
}( jQuery, this ));
})); |
ajax/libs/yasr/2.4.8/yasr.bundled.min.js | ramda/cdnjs | !function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;"undefined"!=typeof window?e=window:"undefined"!=typeof global?e=global:"undefined"!=typeof self&&(e=self),e.YASR=t()}}(function(){var t;return function e(t,n,r){function i(a,s){if(!n[a]){if(!t[a]){var l="function"==typeof require&&require;if(!s&&l)return l(a,!0);if(o)return o(a,!0);var u=new Error("Cannot find module '"+a+"'");throw u.code="MODULE_NOT_FOUND",u}var c=n[a]={exports:{}};t[a][0].call(c.exports,function(e){var n=t[a][1][e];return i(n?n:e)},c,c.exports,e,t,n,r)}return n[a].exports}for(var o="function"==typeof require&&require,a=0;a<r.length;a++)i(r[a]);return i}({1:[function(t,e){e.exports=t("./main.js")},{"./main.js":37}],2:[function(e,n,r){(function(n,i,o){(function(n){"use strict";"function"==typeof t&&t.amd?t("datatables",["jquery"],n):"object"==typeof r?n(e("jquery")):jQuery&&!jQuery.fn.dataTable&&n(jQuery)})(function(t){"use strict";function e(n){var r,i,o="a aa ai ao as b fn i m o s ",a={};t.each(n,function(t){r=t.match(/^([^A-Z]+?)([A-Z])/);if(r&&-1!==o.indexOf(r[1]+" ")){i=t.replace(r[0],r[2].toLowerCase());a[i]=t;"o"===r[1]&&e(n[t])}});n._hungarianMap=a}function r(n,i,a){n._hungarianMap||e(n);var s;t.each(i,function(e){s=n._hungarianMap[e];if(s!==o&&(a||i[s]===o))if("o"===s.charAt(0)){i[s]||(i[s]={});t.extend(!0,i[s],i[e]);r(n[s],i[s],a)}else i[s]=i[e]})}function a(t){var e=$e.defaults.oLanguage,n=t.sZeroRecords;!t.sEmptyTable&&n&&"No data available in table"===e.sEmptyTable&&Oe(t,t,"sZeroRecords","sEmptyTable");!t.sLoadingRecords&&n&&"Loading..."===e.sLoadingRecords&&Oe(t,t,"sZeroRecords","sLoadingRecords");t.sInfoThousands&&(t.sThousands=t.sInfoThousands);var r=t.sDecimal;r&&Xe(r)}function s(t){yn(t,"ordering","bSort");yn(t,"orderMulti","bSortMulti");yn(t,"orderClasses","bSortClasses");yn(t,"orderCellsTop","bSortCellsTop");yn(t,"order","aaSorting");yn(t,"orderFixed","aaSortingFixed");yn(t,"paging","bPaginate");yn(t,"pagingType","sPaginationType");yn(t,"pageLength","iDisplayLength");yn(t,"searching","bFilter");var e=t.aoSearchCols;if(e)for(var n=0,i=e.length;i>n;n++)e[n]&&r($e.models.oSearch,e[n])}function l(t){yn(t,"orderable","bSortable");yn(t,"orderData","aDataSort");yn(t,"orderSequence","asSorting");yn(t,"orderDataType","sortDataType")}function u(e){var n=e.oBrowser,r=t("<div/>").css({position:"absolute",top:0,left:0,height:1,width:1,overflow:"hidden"}).append(t("<div/>").css({position:"absolute",top:1,left:1,width:100,overflow:"scroll"}).append(t('<div class="test"/>').css({width:"100%",height:10}))).appendTo("body"),i=r.find(".test");n.bScrollOversize=100===i[0].offsetWidth;n.bScrollbarLeft=1!==i.offset().left;r.remove()}function c(t,e,n,r,i,a){var s,l=r,u=!1;if(n!==o){s=n;u=!0}for(;l!==i;)if(t.hasOwnProperty(l)){s=u?e(s,t[l],l,t):t[l];u=!0;l+=a}return s}function f(e,n){var r=$e.defaults.column,o=e.aoColumns.length,a=t.extend({},$e.models.oColumn,r,{nTh:n?n:i.createElement("th"),sTitle:r.sTitle?r.sTitle:n?n.innerHTML:"",aDataSort:r.aDataSort?r.aDataSort:[o],mData:r.mData?r.mData:o,idx:o});e.aoColumns.push(a);var s=e.aoPreSearchCols;s[o]=t.extend({},$e.models.oSearch,s[o]);h(e,o,null)}function h(e,n,i){var a=e.aoColumns[n],s=e.oClasses,u=t(a.nTh);if(!a.sWidthOrig){a.sWidthOrig=u.attr("width")||null;var c=(u.attr("style")||"").match(/width:\s*(\d+[pxem%]+)/);c&&(a.sWidthOrig=c[1])}if(i!==o&&null!==i){l(i);r($e.defaults.column,i);i.mDataProp===o||i.mData||(i.mData=i.mDataProp);i.sType&&(a._sManualType=i.sType);i.className&&!i.sClass&&(i.sClass=i.className);t.extend(a,i);Oe(a,i,"sWidth","sWidthOrig");"number"==typeof i.iDataSort&&(a.aDataSort=[i.iDataSort]);Oe(a,i,"aDataSort")}var f=a.mData,h=M(f),d=a.mRender?M(a.mRender):null,p=function(t){return"string"==typeof t&&-1!==t.indexOf("@")};a._bAttrSrc=t.isPlainObject(f)&&(p(f.sort)||p(f.type)||p(f.filter));a.fnGetData=function(t,e,n){var r=h(t,e,o,n);return d&&e?d(r,e,t,n):r};a.fnSetData=function(t,e,n){return D(f)(t,e,n)};if(!e.oFeatures.bSort){a.bSortable=!1;u.addClass(s.sSortableNone)}var g=-1!==t.inArray("asc",a.asSorting),m=-1!==t.inArray("desc",a.asSorting);if(a.bSortable&&(g||m))if(g&&!m){a.sSortingClass=s.sSortableAsc;a.sSortingClassJUI=s.sSortJUIAscAllowed}else if(!g&&m){a.sSortingClass=s.sSortableDesc;a.sSortingClassJUI=s.sSortJUIDescAllowed}else{a.sSortingClass=s.sSortable;a.sSortingClassJUI=s.sSortJUI}else{a.sSortingClass=s.sSortableNone;a.sSortingClassJUI=""}}function d(t){if(t.oFeatures.bAutoWidth!==!1){var e=t.aoColumns;ye(t);for(var n=0,r=e.length;r>n;n++)e[n].nTh.style.width=e[n].sWidth}var i=t.oScroll;(""!==i.sY||""!==i.sX)&&me(t);ze(t,null,"column-sizing",[t])}function p(t,e){var n=v(t,"bVisible");return"number"==typeof n[e]?n[e]:null}function g(e,n){var r=v(e,"bVisible"),i=t.inArray(n,r);return-1!==i?i:null}function m(t){return v(t,"bVisible").length}function v(e,n){var r=[];t.map(e.aoColumns,function(t,e){t[n]&&r.push(e)});return r}function y(t){var e,n,r,i,a,s,l,u,c,f=t.aoColumns,h=t.aoData,d=$e.ext.type.detect;for(e=0,n=f.length;n>e;e++){l=f[e];c=[];if(!l.sType&&l._sManualType)l.sType=l._sManualType;else if(!l.sType){for(r=0,i=d.length;i>r;r++){for(a=0,s=h.length;s>a;a++){c[a]===o&&(c[a]=T(t,a,e,"type"));u=d[r](c[a],t);if(!u||"html"===u)break}if(u){l.sType=u;break}}l.sType||(l.sType="string")}}}function b(e,n,r,i){var a,s,l,u,c,h,d,p=e.aoColumns;if(n)for(a=n.length-1;a>=0;a--){d=n[a];var g=d.targets!==o?d.targets:d.aTargets;t.isArray(g)||(g=[g]);for(l=0,u=g.length;u>l;l++)if("number"==typeof g[l]&&g[l]>=0){for(;p.length<=g[l];)f(e);i(g[l],d)}else if("number"==typeof g[l]&&g[l]<0)i(p.length+g[l],d);else if("string"==typeof g[l])for(c=0,h=p.length;h>c;c++)("_all"==g[l]||t(p[c].nTh).hasClass(g[l]))&&i(c,d)}if(r)for(a=0,s=r.length;s>a;a++)i(a,r[a])}function x(e,n,r,i){var o=e.aoData.length,a=t.extend(!0,{},$e.models.oRow,{src:r?"dom":"data"});a._aData=n;e.aoData.push(a);for(var s=e.aoColumns,l=0,u=s.length;u>l;l++){r&&k(e,o,l,T(e,o,l));s[l].sType=null}e.aiDisplayMaster.push(o);(r||!e.oFeatures.bDeferRender)&&I(e,o,r,i);return o}function w(e,n){var r;n instanceof t||(n=t(n));return n.map(function(t,n){r=j(e,n);return x(e,r.data,n,r.cells)})}function C(t,e){return e._DT_RowIndex!==o?e._DT_RowIndex:null}function S(e,n,r){return t.inArray(r,e.aoData[n].anCells)}function T(t,e,n,r){var i=t.iDraw,a=t.aoColumns[n],s=t.aoData[e]._aData,l=a.sDefaultContent,u=a.fnGetData(s,r,{settings:t,row:e,col:n});if(u===o){if(t.iDrawError!=i&&null===l){He(t,0,"Requested unknown parameter "+("function"==typeof a.mData?"{function}":"'"+a.mData+"'")+" for row "+e,4);t.iDrawError=i}return l}if(u!==s&&null!==u||null===l){if("function"==typeof u)return u.call(s)}else u=l;return null===u&&"display"==r?"":u}function k(t,e,n,r){var i=t.aoColumns[n],o=t.aoData[e]._aData;i.fnSetData(o,r,{settings:t,row:e,col:n})}function _(e){return t.map(e.match(/(\\.|[^\.])+/g),function(t){return t.replace(/\\./g,".")})}function M(e){if(t.isPlainObject(e)){var n={};t.each(e,function(t,e){e&&(n[t]=M(e))});return function(t,e,r,i){var a=n[e]||n._;return a!==o?a(t,e,r,i):t}}if(null===e)return function(t){return t};if("function"==typeof e)return function(t,n,r,i){return e(t,n,r,i)};if("string"!=typeof e||-1===e.indexOf(".")&&-1===e.indexOf("[")&&-1===e.indexOf("("))return function(t){return t[e]};var r=function(t,e,n){var i,a,s,l;if(""!==n)for(var u=_(n),c=0,f=u.length;f>c;c++){i=u[c].match(bn);a=u[c].match(xn);if(i){u[c]=u[c].replace(bn,"");""!==u[c]&&(t=t[u[c]]);s=[];u.splice(0,c+1);l=u.join(".");for(var h=0,d=t.length;d>h;h++)s.push(r(t[h],e,l));var p=i[0].substring(1,i[0].length-1);t=""===p?s:s.join(p);break}if(a){u[c]=u[c].replace(xn,"");t=t[u[c]]()}else{if(null===t||t[u[c]]===o)return o;t=t[u[c]]}}return t};return function(t,n){return r(t,n,e)}}function D(e){if(t.isPlainObject(e))return D(e._);if(null===e)return function(){};if("function"==typeof e)return function(t,n,r){e(t,"set",n,r)};if("string"!=typeof e||-1===e.indexOf(".")&&-1===e.indexOf("[")&&-1===e.indexOf("("))return function(t,n){t[e]=n};var n=function(t,e,r){for(var i,a,s,l,u,c=_(r),f=c[c.length-1],h=0,d=c.length-1;d>h;h++){a=c[h].match(bn);s=c[h].match(xn);if(a){c[h]=c[h].replace(bn,"");t[c[h]]=[];i=c.slice();i.splice(0,h+1);u=i.join(".");for(var p=0,g=e.length;g>p;p++){l={};n(l,e[p],u);t[c[h]].push(l)}return}if(s){c[h]=c[h].replace(xn,"");t=t[c[h]](e)}(null===t[c[h]]||t[c[h]]===o)&&(t[c[h]]={});t=t[c[h]]}f.match(xn)?t=t[f.replace(xn,"")](e):t[f.replace(bn,"")]=e};return function(t,r){return n(t,r,e)}}function L(t){return dn(t.aoData,"_aData")}function A(t){t.aoData.length=0;t.aiDisplayMaster.length=0;t.aiDisplay.length=0}function N(t,e,n){for(var r=-1,i=0,a=t.length;a>i;i++)t[i]==e?r=i:t[i]>e&&t[i]--;-1!=r&&n===o&&t.splice(r,1)}function E(t,e,n,r){var i,a,s=t.aoData[e];if("dom"!==n&&(n&&"auto"!==n||"dom"!==s.src)){var l,u=s.anCells;if(u)for(i=0,a=u.length;a>i;i++){l=u[i];for(;l.childNodes.length;)l.removeChild(l.firstChild);u[i].innerHTML=T(t,e,i,"display")}}else s._aData=j(t,s).data;s._aSortData=null;s._aFilterData=null;var c=t.aoColumns;if(r!==o)c[r].sType=null;else for(i=0,a=c.length;a>i;i++)c[i].sType=null;P(s)}function j(e,n){var r,i,o,a,s=[],l=[],u=n.firstChild,c=0,f=e.aoColumns,h=function(t,e,n){if("string"==typeof t){var r=t.indexOf("@");if(-1!==r){var i=t.substring(r+1);o["@"+i]=n.getAttribute(i)}}},d=function(e){i=f[c];a=t.trim(e.innerHTML);if(i&&i._bAttrSrc){o={display:a};h(i.mData.sort,o,e);h(i.mData.type,o,e);h(i.mData.filter,o,e);s.push(o)}else s.push(a);c++};if(u)for(;u;){r=u.nodeName.toUpperCase();if("TD"==r||"TH"==r){d(u);l.push(u)}u=u.nextSibling}else{l=n.anCells;for(var p=0,g=l.length;g>p;p++)d(l[p])}return{data:s,cells:l}}function I(t,e,n,r){var o,a,s,l,u,c=t.aoData[e],f=c._aData,h=[];if(null===c.nTr){o=n||i.createElement("tr");c.nTr=o;c.anCells=h;o._DT_RowIndex=e;P(c);for(l=0,u=t.aoColumns.length;u>l;l++){s=t.aoColumns[l];a=n?r[l]:i.createElement(s.sCellType);h.push(a);(!n||s.mRender||s.mData!==l)&&(a.innerHTML=T(t,e,l,"display"));s.sClass&&(a.className+=" "+s.sClass);s.bVisible&&!n?o.appendChild(a):!s.bVisible&&n&&a.parentNode.removeChild(a);s.fnCreatedCell&&s.fnCreatedCell.call(t.oInstance,a,T(t,e,l),f,e,l)}ze(t,"aoRowCreatedCallback",null,[o,f,e])}c.nTr.setAttribute("role","row")}function P(e){var n=e.nTr,r=e._aData;if(n){r.DT_RowId&&(n.id=r.DT_RowId);if(r.DT_RowClass){var i=r.DT_RowClass.split(" ");e.__rowc=e.__rowc?vn(e.__rowc.concat(i)):i;t(n).removeClass(e.__rowc.join(" ")).addClass(r.DT_RowClass)}r.DT_RowData&&t(n).data(r.DT_RowData)}}function H(e){var n,r,i,o,a,s=e.nTHead,l=e.nTFoot,u=0===t("th, td",s).length,c=e.oClasses,f=e.aoColumns;u&&(o=t("<tr/>").appendTo(s));for(n=0,r=f.length;r>n;n++){a=f[n];i=t(a.nTh).addClass(a.sClass);u&&i.appendTo(o);if(e.oFeatures.bSort){i.addClass(a.sSortingClass);if(a.bSortable!==!1){i.attr("tabindex",e.iTabIndex).attr("aria-controls",e.sTableId);Ae(e,a.nTh,n)}}a.sTitle!=i.html()&&i.html(a.sTitle);Ue(e,"header")(e,i,a,c)}u&&z(e.aoHeader,s);t(s).find(">tr").attr("role","row");t(s).find(">tr>th, >tr>td").addClass(c.sHeaderTH);t(l).find(">tr>th, >tr>td").addClass(c.sFooterTH);if(null!==l){var h=e.aoFooter[0];for(n=0,r=h.length;r>n;n++){a=f[n];a.nTf=h[n].cell;a.sClass&&t(a.nTf).addClass(a.sClass)}}}function O(e,n,r){var i,a,s,l,u,c,f,h,d,p=[],g=[],m=e.aoColumns.length;if(n){r===o&&(r=!1);for(i=0,a=n.length;a>i;i++){p[i]=n[i].slice();p[i].nTr=n[i].nTr;for(s=m-1;s>=0;s--)e.aoColumns[s].bVisible||r||p[i].splice(s,1);g.push([])}for(i=0,a=p.length;a>i;i++){f=p[i].nTr;if(f)for(;c=f.firstChild;)f.removeChild(c);for(s=0,l=p[i].length;l>s;s++){h=1;d=1;if(g[i][s]===o){f.appendChild(p[i][s].cell);g[i][s]=1;for(;p[i+h]!==o&&p[i][s].cell==p[i+h][s].cell;){g[i+h][s]=1;h++}for(;p[i][s+d]!==o&&p[i][s].cell==p[i][s+d].cell;){for(u=0;h>u;u++)g[i+u][s+d]=1;d++}t(p[i][s].cell).attr("rowspan",h).attr("colspan",d)}}}}}function R(e){var n=ze(e,"aoPreDrawCallback","preDraw",[e]);if(-1===t.inArray(!1,n)){var r=[],i=0,a=e.asStripeClasses,s=a.length,l=(e.aoOpenRows.length,e.oLanguage),u=e.iInitDisplayStart,c="ssp"==Be(e),f=e.aiDisplay;e.bDrawing=!0;if(u!==o&&-1!==u){e._iDisplayStart=c?u:u>=e.fnRecordsDisplay()?0:u;e.iInitDisplayStart=-1}var h=e._iDisplayStart,d=e.fnDisplayEnd();if(e.bDeferLoading){e.bDeferLoading=!1;e.iDraw++;pe(e,!1)}else if(c){if(!e.bDestroying&&!B(e))return}else e.iDraw++;if(0!==f.length)for(var p=c?0:h,g=c?e.aoData.length:d,v=p;g>v;v++){var y=f[v],b=e.aoData[y];null===b.nTr&&I(e,y);var x=b.nTr;if(0!==s){var w=a[i%s];if(b._sRowStripe!=w){t(x).removeClass(b._sRowStripe).addClass(w);b._sRowStripe=w}}ze(e,"aoRowCallback",null,[x,b._aData,i,v]);r.push(x);i++}else{var C=l.sZeroRecords;1==e.iDraw&&"ajax"==Be(e)?C=l.sLoadingRecords:l.sEmptyTable&&0===e.fnRecordsTotal()&&(C=l.sEmptyTable);r[0]=t("<tr/>",{"class":s?a[0]:""}).append(t("<td />",{valign:"top",colSpan:m(e),"class":e.oClasses.sRowEmpty}).html(C))[0]}ze(e,"aoHeaderCallback","header",[t(e.nTHead).children("tr")[0],L(e),h,d,f]);ze(e,"aoFooterCallback","footer",[t(e.nTFoot).children("tr")[0],L(e),h,d,f]);var S=t(e.nTBody);S.children().detach();S.append(t(r));ze(e,"aoDrawCallback","draw",[e]);e.bSorted=!1;e.bFiltered=!1;e.bDrawing=!1}else pe(e,!1)}function F(t,e){var n=t.oFeatures,r=n.bSort,i=n.bFilter;r&&Me(t);i?Y(t,t.oPreviousSearch):t.aiDisplay=t.aiDisplayMaster.slice();e!==!0&&(t._iDisplayStart=0);t._drawHold=e;R(t);t._drawHold=!1}function W(e){var n=e.oClasses,r=t(e.nTable),i=t("<div/>").insertBefore(r),o=e.oFeatures,a=t("<div/>",{id:e.sTableId+"_wrapper","class":n.sWrapper+(e.nTFoot?"":" "+n.sNoFooter)});e.nHolding=i[0];e.nTableWrapper=a[0];e.nTableReinsertBefore=e.nTable.nextSibling;for(var s,l,u,c,f,h,d=e.sDom.split(""),p=0;p<d.length;p++){s=null;l=d[p];if("<"==l){u=t("<div/>")[0];c=d[p+1];if("'"==c||'"'==c){f="";h=2;for(;d[p+h]!=c;){f+=d[p+h];h++}"H"==f?f=n.sJUIHeader:"F"==f&&(f=n.sJUIFooter);if(-1!=f.indexOf(".")){var g=f.split(".");u.id=g[0].substr(1,g[0].length-1);u.className=g[1]}else"#"==f.charAt(0)?u.id=f.substr(1,f.length-1):u.className=f;p+=h}a.append(u);a=t(u)}else if(">"==l)a=a.parent();else if("l"==l&&o.bPaginate&&o.bLengthChange)s=ce(e);else if("f"==l&&o.bFilter)s=$(e);else if("r"==l&&o.bProcessing)s=de(e);else if("t"==l)s=ge(e);else if("i"==l&&o.bInfo)s=ie(e);else if("p"==l&&o.bPaginate)s=fe(e);else if(0!==$e.ext.feature.length)for(var m=$e.ext.feature,v=0,y=m.length;y>v;v++)if(l==m[v].cFeature){s=m[v].fnInit(e);break}if(s){var b=e.aanFeatures;b[l]||(b[l]=[]);b[l].push(s);a.append(s)}}i.replaceWith(a)}function z(e,n){var r,i,o,a,s,l,u,c,f,h,d,p=t(n).children("tr"),g=function(t,e,n){for(var r=t[e];r[n];)n++;return n};e.splice(0,e.length);for(o=0,l=p.length;l>o;o++)e.push([]);for(o=0,l=p.length;l>o;o++){r=p[o];c=0;i=r.firstChild;for(;i;){if("TD"==i.nodeName.toUpperCase()||"TH"==i.nodeName.toUpperCase()){f=1*i.getAttribute("colspan");h=1*i.getAttribute("rowspan");f=f&&0!==f&&1!==f?f:1;h=h&&0!==h&&1!==h?h:1;u=g(e,o,c);d=1===f?!0:!1;for(s=0;f>s;s++)for(a=0;h>a;a++){e[o+a][u+s]={cell:i,unique:d};e[o+a].nTr=r}}i=i.nextSibling}}}function q(t,e,n){var r=[];if(!n){n=t.aoHeader;if(e){n=[];z(n,e)}}for(var i=0,o=n.length;o>i;i++)for(var a=0,s=n[i].length;s>a;a++)!n[i][a].unique||r[a]&&t.bSortCellsTop||(r[a]=n[i][a].cell);return r}function U(e,n,r){ze(e,"aoServerParams","serverParams",[n]);if(n&&t.isArray(n)){var i={},o=/(.*?)\[\]$/;t.each(n,function(t,e){var n=e.name.match(o);if(n){var r=n[0];i[r]||(i[r]=[]);i[r].push(e.value)}else i[e.name]=e.value});n=i}var a,s=e.ajax,l=e.oInstance;if(t.isPlainObject(s)&&s.data){a=s.data;var u=t.isFunction(a)?a(n):a;n=t.isFunction(a)&&u?u:t.extend(!0,n,u);delete s.data}var c={data:n,success:function(t){var n=t.error||t.sError;n&&e.oApi._fnLog(e,0,n);e.json=t;ze(e,null,"xhr",[e,t]);r(t)},dataType:"json",cache:!1,type:e.sServerMethod,error:function(t,n){var r=e.oApi._fnLog;"parsererror"==n?r(e,0,"Invalid JSON response",1):4===t.readyState&&r(e,0,"Ajax error",7);pe(e,!1)}};e.oAjaxData=n;ze(e,null,"preXhr",[e,n]);if(e.fnServerData)e.fnServerData.call(l,e.sAjaxSource,t.map(n,function(t,e){return{name:e,value:t}}),r,e);else if(e.sAjaxSource||"string"==typeof s)e.jqXHR=t.ajax(t.extend(c,{url:s||e.sAjaxSource}));else if(t.isFunction(s))e.jqXHR=s.call(l,n,r,e);else{e.jqXHR=t.ajax(t.extend(c,s));s.data=a}}function B(t){if(t.bAjaxDataGet){t.iDraw++;pe(t,!0);U(t,V(t),function(e){X(t,e)});return!1}return!0}function V(e){var n,r,i,o,a=e.aoColumns,s=a.length,l=e.oFeatures,u=e.oPreviousSearch,c=e.aoPreSearchCols,f=[],h=_e(e),d=e._iDisplayStart,p=l.bPaginate!==!1?e._iDisplayLength:-1,g=function(t,e){f.push({name:t,value:e})};g("sEcho",e.iDraw);g("iColumns",s);g("sColumns",dn(a,"sName").join(","));g("iDisplayStart",d);g("iDisplayLength",p);var m={draw:e.iDraw,columns:[],order:[],start:d,length:p,search:{value:u.sSearch,regex:u.bRegex}};for(n=0;s>n;n++){i=a[n];o=c[n];r="function"==typeof i.mData?"function":i.mData;m.columns.push({data:r,name:i.sName,searchable:i.bSearchable,orderable:i.bSortable,search:{value:o.sSearch,regex:o.bRegex}});g("mDataProp_"+n,r);if(l.bFilter){g("sSearch_"+n,o.sSearch);g("bRegex_"+n,o.bRegex);g("bSearchable_"+n,i.bSearchable)}l.bSort&&g("bSortable_"+n,i.bSortable)}if(l.bFilter){g("sSearch",u.sSearch);g("bRegex",u.bRegex)}if(l.bSort){t.each(h,function(t,e){m.order.push({column:e.col,dir:e.dir});g("iSortCol_"+t,e.col);g("sSortDir_"+t,e.dir)});g("iSortingCols",h.length)}var v=$e.ext.legacy.ajax;return null===v?e.sAjaxSource?f:m:v?f:m}function X(t,e){var n=function(t,n){return e[t]!==o?e[t]:e[n]},r=n("sEcho","draw"),i=n("iTotalRecords","recordsTotal"),a=n("iTotalDisplayRecords","recordsFiltered");if(r){if(1*r<t.iDraw)return;t.iDraw=1*r}A(t);t._iRecordsTotal=parseInt(i,10);t._iRecordsDisplay=parseInt(a,10);for(var s=G(t,e),l=0,u=s.length;u>l;l++)x(t,s[l]);t.aiDisplay=t.aiDisplayMaster.slice();t.bAjaxDataGet=!1;R(t);t._bInitComplete||le(t,e);t.bAjaxDataGet=!0;pe(t,!1)}function G(e,n){var r=t.isPlainObject(e.ajax)&&e.ajax.dataSrc!==o?e.ajax.dataSrc:e.sAjaxDataProp;return"data"===r?n.aaData||n[r]:""!==r?M(r)(n):n}function $(e){var n=e.oClasses,r=e.sTableId,o=e.oLanguage,a=e.oPreviousSearch,s=e.aanFeatures,l='<input type="search" class="'+n.sFilterInput+'"/>',u=o.sSearch;u=u.match(/_INPUT_/)?u.replace("_INPUT_",l):u+l;var c=t("<div/>",{id:s.f?null:r+"_filter","class":n.sFilter}).append(t("<label/>").append(u)),f=function(){var t=(s.f,this.value?this.value:"");if(t!=a.sSearch){Y(e,{sSearch:t,bRegex:a.bRegex,bSmart:a.bSmart,bCaseInsensitive:a.bCaseInsensitive});e._iDisplayStart=0;R(e)}},h=t("input",c).val(a.sSearch).attr("placeholder",o.sSearchPlaceholder).bind("keyup.DT search.DT input.DT paste.DT cut.DT","ssp"===Be(e)?be(f,400):f).bind("keypress.DT",function(t){return 13==t.keyCode?!1:void 0}).attr("aria-controls",r);t(e.nTable).on("search.dt.DT",function(t,n){if(e===n)try{h[0]!==i.activeElement&&h.val(a.sSearch)}catch(r){}});return c[0]}function Y(t,e,n){var r=t.oPreviousSearch,i=t.aoPreSearchCols,a=function(t){r.sSearch=t.sSearch;r.bRegex=t.bRegex;r.bSmart=t.bSmart;r.bCaseInsensitive=t.bCaseInsensitive},s=function(t){return t.bEscapeRegex!==o?!t.bEscapeRegex:t.bRegex};y(t);if("ssp"!=Be(t)){Z(t,e.sSearch,n,s(e),e.bSmart,e.bCaseInsensitive);a(e);for(var l=0;l<i.length;l++)K(t,i[l].sSearch,l,s(i[l]),i[l].bSmart,i[l].bCaseInsensitive);J(t)}else a(e);t.bFiltered=!0;ze(t,null,"search",[t])}function J(t){for(var e,n,r=$e.ext.search,i=t.aiDisplay,o=0,a=r.length;a>o;o++){for(var s=[],l=0,u=i.length;u>l;l++){n=i[l];e=t.aoData[n];r[o](t,e._aFilterData,n,e._aData,l)&&s.push(n)}i.length=0;i.push.apply(i,s)}}function K(t,e,n,r,i,o){if(""!==e)for(var a,s=t.aiDisplay,l=Q(e,r,i,o),u=s.length-1;u>=0;u--){a=t.aoData[s[u]]._aFilterData[n];l.test(a)||s.splice(u,1)}}function Z(t,e,n,r,i,o){var a,s,l,u=Q(e,r,i,o),c=t.oPreviousSearch.sSearch,f=t.aiDisplayMaster;0!==$e.ext.search.length&&(n=!0);s=ee(t);if(e.length<=0)t.aiDisplay=f.slice();else{(s||n||c.length>e.length||0!==e.indexOf(c)||t.bSorted)&&(t.aiDisplay=f.slice());a=t.aiDisplay;for(l=a.length-1;l>=0;l--)u.test(t.aoData[a[l]]._sFilterRow)||a.splice(l,1)}}function Q(e,n,r,i){e=n?e:te(e);if(r){var o=t.map(e.match(/"[^"]+"|[^ ]+/g)||"",function(t){return'"'===t.charAt(0)?t.match(/^"(.*)"$/)[1]:t});e="^(?=.*?"+o.join(")(?=.*?")+").*$"}return new RegExp(e,i?"i":"")}function te(t){return t.replace(on,"\\$1")}function ee(t){var e,n,r,i,o,a,s,l,u=t.aoColumns,c=$e.ext.type.search,f=!1;for(n=0,i=t.aoData.length;i>n;n++){l=t.aoData[n];if(!l._aFilterData){a=[];for(r=0,o=u.length;o>r;r++){e=u[r];if(e.bSearchable){s=T(t,n,r,"filter");c[e.sType]&&(s=c[e.sType](s));null===s&&(s="");"string"!=typeof s&&s.toString&&(s=s.toString())}else s="";if(s.indexOf&&-1!==s.indexOf("&")){wn.innerHTML=s;s=Cn?wn.textContent:wn.innerText}s.replace&&(s=s.replace(/[\r\n]/g,""));a.push(s)}l._aFilterData=a;l._sFilterRow=a.join(" ");f=!0}}return f}function ne(t){return{search:t.sSearch,smart:t.bSmart,regex:t.bRegex,caseInsensitive:t.bCaseInsensitive}}function re(t){return{sSearch:t.search,bSmart:t.smart,bRegex:t.regex,bCaseInsensitive:t.caseInsensitive}}function ie(e){var n=e.sTableId,r=e.aanFeatures.i,i=t("<div/>",{"class":e.oClasses.sInfo,id:r?null:n+"_info"});if(!r){e.aoDrawCallback.push({fn:oe,sName:"information"});i.attr("role","status").attr("aria-live","polite");t(e.nTable).attr("aria-describedby",n+"_info")}return i[0]}function oe(e){var n=e.aanFeatures.i;if(0!==n.length){var r=e.oLanguage,i=e._iDisplayStart+1,o=e.fnDisplayEnd(),a=e.fnRecordsTotal(),s=e.fnRecordsDisplay(),l=s?r.sInfo:r.sInfoEmpty;s!==a&&(l+=" "+r.sInfoFiltered);l+=r.sInfoPostFix;l=ae(e,l);var u=r.fnInfoCallback;null!==u&&(l=u.call(e.oInstance,e,i,o,a,s,l));t(n).html(l)}}function ae(t,e){var n=t.fnFormatNumber,r=t._iDisplayStart+1,i=t._iDisplayLength,o=t.fnRecordsDisplay(),a=-1===i;return e.replace(/_START_/g,n.call(t,r)).replace(/_END_/g,n.call(t,t.fnDisplayEnd())).replace(/_MAX_/g,n.call(t,t.fnRecordsTotal())).replace(/_TOTAL_/g,n.call(t,o)).replace(/_PAGE_/g,n.call(t,a?1:Math.ceil(r/i))).replace(/_PAGES_/g,n.call(t,a?1:Math.ceil(o/i)))}function se(t){var e,n,r,i=t.iInitDisplayStart,o=t.aoColumns,a=t.oFeatures;if(t.bInitialised){W(t);H(t);O(t,t.aoHeader);O(t,t.aoFooter);pe(t,!0);a.bAutoWidth&&ye(t);for(e=0,n=o.length;n>e;e++){r=o[e];r.sWidth&&(r.nTh.style.width=Te(r.sWidth))}F(t);var s=Be(t);if("ssp"!=s)if("ajax"==s)U(t,[],function(n){var r=G(t,n);for(e=0;e<r.length;e++)x(t,r[e]);t.iInitDisplayStart=i;F(t);pe(t,!1);le(t,n)},t);else{pe(t,!1);le(t)}}else setTimeout(function(){se(t)},200)}function le(t,e){t._bInitComplete=!0;e&&d(t);ze(t,"aoInitComplete","init",[t,e])}function ue(t,e){var n=parseInt(e,10);t._iDisplayLength=n;qe(t);ze(t,null,"length",[t,n])}function ce(e){for(var n=e.oClasses,r=e.sTableId,i=e.aLengthMenu,o=t.isArray(i[0]),a=o?i[0]:i,s=o?i[1]:i,l=t("<select/>",{name:r+"_length","aria-controls":r,"class":n.sLengthSelect}),u=0,c=a.length;c>u;u++)l[0][u]=new Option(s[u],a[u]);var f=t("<div><label/></div>").addClass(n.sLength);e.aanFeatures.l||(f[0].id=r+"_length");f.children().append(e.oLanguage.sLengthMenu.replace("_MENU_",l[0].outerHTML));t("select",f).val(e._iDisplayLength).bind("change.DT",function(){ue(e,t(this).val());R(e)});t(e.nTable).bind("length.dt.DT",function(n,r,i){e===r&&t("select",f).val(i)});return f[0]}function fe(e){var n=e.sPaginationType,r=$e.ext.pager[n],i="function"==typeof r,o=function(t){R(t)},a=t("<div/>").addClass(e.oClasses.sPaging+n)[0],s=e.aanFeatures;i||r.fnInit(e,a,o);if(!s.p){a.id=e.sTableId+"_paginate";e.aoDrawCallback.push({fn:function(t){if(i){var e,n,a=t._iDisplayStart,l=t._iDisplayLength,u=t.fnRecordsDisplay(),c=-1===l,f=c?0:Math.ceil(a/l),h=c?1:Math.ceil(u/l),d=r(f,h);for(e=0,n=s.p.length;n>e;e++)Ue(t,"pageButton")(t,s.p[e],e,d,f,h)}else r.fnUpdate(t,o)},sName:"pagination"})}return a}function he(t,e,n){var r=t._iDisplayStart,i=t._iDisplayLength,o=t.fnRecordsDisplay();if(0===o||-1===i)r=0;else if("number"==typeof e){r=e*i;r>o&&(r=0)}else if("first"==e)r=0;else if("previous"==e){r=i>=0?r-i:0;0>r&&(r=0)}else"next"==e?o>r+i&&(r+=i):"last"==e?r=Math.floor((o-1)/i)*i:He(t,0,"Unknown paging action: "+e,5);var a=t._iDisplayStart!==r;t._iDisplayStart=r;if(a){ze(t,null,"page",[t]);n&&R(t)}return a}function de(e){return t("<div/>",{id:e.aanFeatures.r?null:e.sTableId+"_processing","class":e.oClasses.sProcessing}).html(e.oLanguage.sProcessing).insertBefore(e.nTable)[0]}function pe(e,n){e.oFeatures.bProcessing&&t(e.aanFeatures.r).css("display",n?"block":"none");ze(e,null,"processing",[e,n])}function ge(e){var n=t(e.nTable);n.attr("role","grid");var r=e.oScroll;if(""===r.sX&&""===r.sY)return e.nTable;var i=r.sX,o=r.sY,a=e.oClasses,s=n.children("caption"),l=s.length?s[0]._captionSide:null,u=t(n[0].cloneNode(!1)),c=t(n[0].cloneNode(!1)),f=n.children("tfoot"),h="<div/>",d=function(t){return t?Te(t):null};r.sX&&"100%"===n.attr("width")&&n.removeAttr("width");f.length||(f=null);var p=t(h,{"class":a.sScrollWrapper}).append(t(h,{"class":a.sScrollHead}).css({overflow:"hidden",position:"relative",border:0,width:i?d(i):"100%"}).append(t(h,{"class":a.sScrollHeadInner}).css({"box-sizing":"content-box",width:r.sXInner||"100%"}).append(u.removeAttr("id").css("margin-left",0).append(n.children("thead")))).append("top"===l?s:null)).append(t(h,{"class":a.sScrollBody}).css({overflow:"auto",height:d(o),width:d(i)}).append(n));f&&p.append(t(h,{"class":a.sScrollFoot}).css({overflow:"hidden",border:0,width:i?d(i):"100%"}).append(t(h,{"class":a.sScrollFootInner}).append(c.removeAttr("id").css("margin-left",0).append(n.children("tfoot")))).append("bottom"===l?s:null));var g=p.children(),m=g[0],v=g[1],y=f?g[2]:null;i&&t(v).scroll(function(){var t=this.scrollLeft;m.scrollLeft=t;f&&(y.scrollLeft=t)});e.nScrollHead=m;e.nScrollBody=v;e.nScrollFoot=y;e.aoDrawCallback.push({fn:me,sName:"scrolling"});return p[0]}function me(e){var n,r,i,o,a,s,l,u,c,f=e.oScroll,h=f.sX,d=f.sXInner,g=f.sY,m=f.iBarWidth,v=t(e.nScrollHead),y=v[0].style,b=v.children("div"),x=b[0].style,w=b.children("table"),C=e.nScrollBody,S=t(C),T=C.style,k=t(e.nScrollFoot),_=k.children("div"),M=_.children("table"),D=t(e.nTHead),L=t(e.nTable),A=L[0],N=A.style,E=e.nTFoot?t(e.nTFoot):null,j=e.oBrowser,I=j.bScrollOversize,P=[],H=[],O=[],R=function(t){var e=t.style;e.paddingTop="0";e.paddingBottom="0";e.borderTopWidth="0";e.borderBottomWidth="0";e.height=0};L.children("thead, tfoot").remove();a=D.clone().prependTo(L);n=D.find("tr");i=a.find("tr");a.find("th, td").removeAttr("tabindex");if(E){s=E.clone().prependTo(L);r=E.find("tr");o=s.find("tr")}if(!h){T.width="100%";v[0].style.width="100%"}t.each(q(e,a),function(t,n){l=p(e,t);n.style.width=e.aoColumns[l].sWidth});E&&ve(function(t){t.style.width=""},o);f.bCollapse&&""!==g&&(T.height=S[0].offsetHeight+D[0].offsetHeight+"px");c=L.outerWidth();if(""===h){N.width="100%";I&&(L.find("tbody").height()>C.offsetHeight||"scroll"==S.css("overflow-y"))&&(N.width=Te(L.outerWidth()-m))}else if(""!==d)N.width=Te(d);else if(c==S.width()&&S.height()<L.height()){N.width=Te(c-m);L.outerWidth()>c-m&&(N.width=Te(c))}else N.width=Te(c);c=L.outerWidth();ve(R,i);ve(function(e){O.push(e.innerHTML);P.push(Te(t(e).css("width")))},i);ve(function(t,e){t.style.width=P[e]},n);t(i).height(0);if(E){ve(R,o);ve(function(e){H.push(Te(t(e).css("width")))},o);ve(function(t,e){t.style.width=H[e]},r);t(o).height(0)}ve(function(t,e){t.innerHTML='<div class="dataTables_sizing" style="height:0;overflow:hidden;">'+O[e]+"</div>";t.style.width=P[e]},i);E&&ve(function(t,e){t.innerHTML="";t.style.width=H[e]},o);if(L.outerWidth()<c){u=C.scrollHeight>C.offsetHeight||"scroll"==S.css("overflow-y")?c+m:c;I&&(C.scrollHeight>C.offsetHeight||"scroll"==S.css("overflow-y"))&&(N.width=Te(u-m));(""===h||""!==d)&&He(e,1,"Possible column misalignment",6)}else u="100%";T.width=Te(u);y.width=Te(u);E&&(e.nScrollFoot.style.width=Te(u));g||I&&(T.height=Te(A.offsetHeight+m));if(g&&f.bCollapse){T.height=Te(g);var F=h&&A.offsetWidth>C.offsetWidth?m:0;A.offsetHeight<C.offsetHeight&&(T.height=Te(A.offsetHeight+F))}var W=L.outerWidth();w[0].style.width=Te(W);x.width=Te(W);var z=L.height()>C.clientHeight||"scroll"==S.css("overflow-y"),U="padding"+(j.bScrollbarLeft?"Left":"Right");x[U]=z?m+"px":"0px";if(E){M[0].style.width=Te(W);_[0].style.width=Te(W);_[0].style[U]=z?m+"px":"0px"}S.scroll();!e.bSorted&&!e.bFiltered||e._drawHold||(C.scrollTop=0)}function ve(t,e,n){for(var r,i,o=0,a=0,s=e.length;s>a;){r=e[a].firstChild;i=n?n[a].firstChild:null;for(;r;){if(1===r.nodeType){n?t(r,i,o):t(r,o);o++}r=r.nextSibling;i=n?i.nextSibling:null}a++}}function ye(e){var r,i,o,a,s,l=e.nTable,u=e.aoColumns,c=e.oScroll,f=c.sY,h=c.sX,p=c.sXInner,g=u.length,y=v(e,"bVisible"),b=t("th",e.nTHead),x=l.getAttribute("width"),w=l.parentNode,C=!1;for(r=0;r<y.length;r++){i=u[y[r]];if(null!==i.sWidth){i.sWidth=xe(i.sWidthOrig,w);C=!0}}if(C||h||f||g!=m(e)||g!=b.length){var S=t(l).clone().empty().css("visibility","hidden").removeAttr("id").append(t(e.nTHead).clone(!1)).append(t(e.nTFoot).clone(!1)).append(t("<tbody><tr/></tbody>"));S.find("tfoot th, tfoot td").css("width","");var T=S.find("tbody tr");b=q(e,S.find("thead")[0]);for(r=0;r<y.length;r++){i=u[y[r]];b[r].style.width=null!==i.sWidthOrig&&""!==i.sWidthOrig?Te(i.sWidthOrig):""}if(e.aoData.length)for(r=0;r<y.length;r++){o=y[r];i=u[o];t(Ce(e,o)).clone(!1).append(i.sContentPadding).appendTo(T)}S.appendTo(w);if(h&&p)S.width(p);else if(h){S.css("width","auto");S.width()<w.offsetWidth&&S.width(w.offsetWidth)}else f?S.width(w.offsetWidth):x&&S.width(x);we(e,S[0]);if(h){var k=0;for(r=0;r<y.length;r++){i=u[y[r]];s=t(b[r]).outerWidth();k+=null===i.sWidthOrig?s:parseInt(i.sWidth,10)+s-t(b[r]).width()}S.width(Te(k));l.style.width=Te(k)}for(r=0;r<y.length;r++){i=u[y[r]];a=t(b[r]).width();a&&(i.sWidth=Te(a))}l.style.width=Te(S.css("width"));S.remove()}else for(r=0;g>r;r++)u[r].sWidth=Te(b.eq(r).width());x&&(l.style.width=Te(x));if((x||h)&&!e._reszEvt){t(n).bind("resize.DT-"+e.sInstance,be(function(){d(e)}));e._reszEvt=!0}}function be(t,e){var n,r,i=e||200;return function(){var e=this,a=+new Date,s=arguments;if(n&&n+i>a){clearTimeout(r);r=setTimeout(function(){n=o;t.apply(e,s)},i)}else if(n){n=a;t.apply(e,s)}else n=a}}function xe(e,n){if(!e)return 0;var r=t("<div/>").css("width",Te(e)).appendTo(n||i.body),o=r[0].offsetWidth;r.remove();return o}function we(e,n){var r=e.oScroll;if(r.sX||r.sY){var i=r.sX?0:r.iBarWidth;n.style.width=Te(t(n).outerWidth()-i)}}function Ce(e,n){var r=Se(e,n);if(0>r)return null;var i=e.aoData[r];return i.nTr?i.anCells[n]:t("<td/>").html(T(e,r,n,"display"))[0]}function Se(t,e){for(var n,r=-1,i=-1,o=0,a=t.aoData.length;a>o;o++){n=T(t,o,e,"display")+"";n=n.replace(Sn,"");if(n.length>r){r=n.length;i=o}}return i}function Te(t){return null===t?"0px":"number"==typeof t?0>t?"0px":t+"px":t.match(/\d$/)?t+"px":t}function ke(){if(!$e.__scrollbarWidth){var e=t("<p/>").css({width:"100%",height:200,padding:0})[0],n=t("<div/>").css({position:"absolute",top:0,left:0,width:200,height:150,padding:0,overflow:"hidden",visibility:"hidden"}).append(e).appendTo("body"),r=e.offsetWidth;n.css("overflow","scroll");var i=e.offsetWidth;r===i&&(i=n[0].clientWidth);n.remove();$e.__scrollbarWidth=r-i}return $e.__scrollbarWidth}function _e(e){var n,r,i,o,a,s,l,u=[],c=e.aoColumns,f=e.aaSortingFixed,h=t.isPlainObject(f),d=[],p=function(e){e.length&&!t.isArray(e[0])?d.push(e):d.push.apply(d,e)};t.isArray(f)&&p(f);h&&f.pre&&p(f.pre);p(e.aaSorting);h&&f.post&&p(f.post);for(n=0;n<d.length;n++){l=d[n][0];o=c[l].aDataSort;for(r=0,i=o.length;i>r;r++){a=o[r];s=c[a].sType||"string";u.push({src:l,col:a,dir:d[n][1],index:d[n][2],type:s,formatter:$e.ext.type.order[s+"-pre"]})}}return u}function Me(t){var e,n,r,i,o,a=[],s=$e.ext.type.order,l=t.aoData,u=(t.aoColumns,0),c=t.aiDisplayMaster;y(t);o=_e(t);for(e=0,n=o.length;n>e;e++){i=o[e];i.formatter&&u++;Ee(t,i.col)}if("ssp"!=Be(t)&&0!==o.length){for(e=0,r=c.length;r>e;e++)a[c[e]]=e;c.sort(u===o.length?function(t,e){var n,r,i,s,u,c=o.length,f=l[t]._aSortData,h=l[e]._aSortData;for(i=0;c>i;i++){u=o[i];n=f[u.col];r=h[u.col];s=r>n?-1:n>r?1:0;if(0!==s)return"asc"===u.dir?s:-s}n=a[t];r=a[e];return r>n?-1:n>r?1:0}:function(t,e){var n,r,i,u,c,f,h=o.length,d=l[t]._aSortData,p=l[e]._aSortData;
for(i=0;h>i;i++){c=o[i];n=d[c.col];r=p[c.col];f=s[c.type+"-"+c.dir]||s["string-"+c.dir];u=f(n,r);if(0!==u)return u}n=a[t];r=a[e];return r>n?-1:n>r?1:0})}t.bSorted=!0}function De(t){for(var e,n,r=t.aoColumns,i=_e(t),o=t.oLanguage.oAria,a=0,s=r.length;s>a;a++){var l=r[a],u=l.asSorting,c=l.sTitle.replace(/<.*?>/g,""),f=l.nTh;f.removeAttribute("aria-sort");if(l.bSortable){if(i.length>0&&i[0].col==a){f.setAttribute("aria-sort","asc"==i[0].dir?"ascending":"descending");n=u[i[0].index+1]||u[0]}else n=u[0];e=c+("asc"===n?o.sSortAscending:o.sSortDescending)}else e=c;f.setAttribute("aria-label",e)}}function Le(e,n,r,i){var a,s=e.aoColumns[n],l=e.aaSorting,u=s.asSorting,c=function(e){var n=e._idx;n===o&&(n=t.inArray(e[1],u));return n+1>=u.length?0:n+1};"number"==typeof l[0]&&(l=e.aaSorting=[l]);if(r&&e.oFeatures.bSortMulti){var f=t.inArray(n,dn(l,"0"));if(-1!==f){a=c(l[f]);l[f][1]=u[a];l[f]._idx=a}else{l.push([n,u[0],0]);l[l.length-1]._idx=0}}else if(l.length&&l[0][0]==n){a=c(l[0]);l.length=1;l[0][1]=u[a];l[0]._idx=a}else{l.length=0;l.push([n,u[0]]);l[0]._idx=0}F(e);"function"==typeof i&&i(e)}function Ae(t,e,n,r){var i=t.aoColumns[n];Fe(e,{},function(e){if(i.bSortable!==!1)if(t.oFeatures.bProcessing){pe(t,!0);setTimeout(function(){Le(t,n,e.shiftKey,r);"ssp"!==Be(t)&&pe(t,!1)},0)}else Le(t,n,e.shiftKey,r)})}function Ne(e){var n,r,i,o=e.aLastSort,a=e.oClasses.sSortColumn,s=_e(e),l=e.oFeatures;if(l.bSort&&l.bSortClasses){for(n=0,r=o.length;r>n;n++){i=o[n].src;t(dn(e.aoData,"anCells",i)).removeClass(a+(2>n?n+1:3))}for(n=0,r=s.length;r>n;n++){i=s[n].src;t(dn(e.aoData,"anCells",i)).addClass(a+(2>n?n+1:3))}}e.aLastSort=s}function Ee(t,e){var n,r=t.aoColumns[e],i=$e.ext.order[r.sSortDataType];i&&(n=i.call(t.oInstance,t,e,g(t,e)));for(var o,a,s=$e.ext.type.order[r.sType+"-pre"],l=0,u=t.aoData.length;u>l;l++){o=t.aoData[l];o._aSortData||(o._aSortData=[]);if(!o._aSortData[e]||i){a=i?n[l]:T(t,l,e,"sort");o._aSortData[e]=s?s(a):a}}}function je(e){if(e.oFeatures.bStateSave&&!e.bDestroying){var n={time:+new Date,start:e._iDisplayStart,length:e._iDisplayLength,order:t.extend(!0,[],e.aaSorting),search:ne(e.oPreviousSearch),columns:t.map(e.aoColumns,function(t,n){return{visible:t.bVisible,search:ne(e.aoPreSearchCols[n])}})};ze(e,"aoStateSaveParams","stateSaveParams",[e,n]);e.oSavedState=n;e.fnStateSaveCallback.call(e.oInstance,e,n)}}function Ie(e){var n,r,i=e.aoColumns;if(e.oFeatures.bStateSave){var o=e.fnStateLoadCallback.call(e.oInstance,e);if(o&&o.time){var a=ze(e,"aoStateLoadParams","stateLoadParams",[e,o]);if(-1===t.inArray(!1,a)){var s=e.iStateDuration;if(!(s>0&&o.time<+new Date-1e3*s)&&i.length===o.columns.length){e.oLoadedState=t.extend(!0,{},o);e._iDisplayStart=o.start;e.iInitDisplayStart=o.start;e._iDisplayLength=o.length;e.aaSorting=[];t.each(o.order,function(t,n){e.aaSorting.push(n[0]>=i.length?[0,n[1]]:n)});t.extend(e.oPreviousSearch,re(o.search));for(n=0,r=o.columns.length;r>n;n++){var l=o.columns[n];i[n].bVisible=l.visible;t.extend(e.aoPreSearchCols[n],re(l.search))}ze(e,"aoStateLoaded","stateLoaded",[e,o])}}}}}function Pe(e){var n=$e.settings,r=t.inArray(e,dn(n,"nTable"));return-1!==r?n[r]:null}function He(t,e,r,i){r="DataTables warning: "+(null!==t?"table id="+t.sTableId+" - ":"")+r;i&&(r+=". For more information about this error, please see http://datatables.net/tn/"+i);if(e)n.console&&console.log&&console.log(r);else{var o=$e.ext,a=o.sErrMode||o.errMode;if("alert"!=a)throw new Error(r);alert(r)}}function Oe(e,n,r,i){if(t.isArray(r))t.each(r,function(r,i){t.isArray(i)?Oe(e,n,i[0],i[1]):Oe(e,n,i)});else{i===o&&(i=r);n[r]!==o&&(e[i]=n[r])}}function Re(e,n,r){var i;for(var o in n)if(n.hasOwnProperty(o)){i=n[o];if(t.isPlainObject(i)){t.isPlainObject(e[o])||(e[o]={});t.extend(!0,e[o],i)}else e[o]=r&&"data"!==o&&"aaData"!==o&&t.isArray(i)?i.slice():i}return e}function Fe(e,n,r){t(e).bind("click.DT",n,function(t){e.blur();r(t)}).bind("keypress.DT",n,function(t){if(13===t.which){t.preventDefault();r(t)}}).bind("selectstart.DT",function(){return!1})}function We(t,e,n,r){n&&t[e].push({fn:n,sName:r})}function ze(e,n,r,i){var o=[];n&&(o=t.map(e[n].slice().reverse(),function(t){return t.fn.apply(e.oInstance,i)}));null!==r&&t(e.nTable).trigger(r+".dt",i);return o}function qe(t){var e=t._iDisplayStart,n=t.fnDisplayEnd(),r=t._iDisplayLength;n===t.fnRecordsDisplay()&&(e=n-r);(-1===r||0>e)&&(e=0);t._iDisplayStart=e}function Ue(e,n){var r=e.renderer,i=$e.ext.renderer[n];return t.isPlainObject(r)&&r[n]?i[r[n]]||i._:"string"==typeof r?i[r]||i._:i._}function Be(t){return t.oFeatures.bServerSide?"ssp":t.ajax||t.sAjaxSource?"ajax":"dom"}function Ve(t,e){var n=[],r=Vn.numbers_length,i=Math.floor(r/2);if(r>=e)n=gn(0,e);else if(i>=t){n=gn(0,r-2);n.push("ellipsis");n.push(e-1)}else if(t>=e-1-i){n=gn(e-(r-2),e);n.splice(0,0,"ellipsis");n.splice(0,0,0)}else{n=gn(t-1,t+2);n.push("ellipsis");n.push(e-1);n.splice(0,0,"ellipsis");n.splice(0,0,0)}n.DT_el="span";return n}function Xe(e){t.each({num:function(t){return Xn(t,e)},"num-fmt":function(t){return Xn(t,e,an)},"html-num":function(t){return Xn(t,e,en)},"html-num-fmt":function(t){return Xn(t,e,en,an)}},function(t,n){Ye.type.order[t+e+"-pre"]=n})}function Ge(t){return function(){var e=[Pe(this[$e.ext.iApiIndex])].concat(Array.prototype.slice.call(arguments));return $e.ext.internal[t].apply(this,e)}}var $e,Ye,Je,Ke,Ze,Qe={},tn=/[\r\n]/g,en=/<.*?>/g,nn=/^[\w\+\-]/,rn=/[\w\+\-]$/,on=new RegExp("(\\"+["/",".","*","+","?","|","(",")","[","]","{","}","\\","$","^","-"].join("|\\")+")","g"),an=/[',$£€¥%\u2009\u202F]/g,sn=function(t){return t&&t!==!0&&"-"!==t?!1:!0},ln=function(t){var e=parseInt(t,10);return!isNaN(e)&&isFinite(t)?e:null},un=function(t,e){Qe[e]||(Qe[e]=new RegExp(te(e),"g"));return"string"==typeof t?t.replace(/\./g,"").replace(Qe[e],"."):t},cn=function(t,e,n){var r="string"==typeof t;e&&r&&(t=un(t,e));n&&r&&(t=t.replace(an,""));return sn(t)||!isNaN(parseFloat(t))&&isFinite(t)},fn=function(t){return sn(t)||"string"==typeof t},hn=function(t,e,n){if(sn(t))return!0;var r=fn(t);return r&&cn(mn(t),e,n)?!0:null},dn=function(t,e,n){var r=[],i=0,a=t.length;if(n!==o)for(;a>i;i++)t[i]&&t[i][e]&&r.push(t[i][e][n]);else for(;a>i;i++)t[i]&&r.push(t[i][e]);return r},pn=function(t,e,n,r){var i=[],a=0,s=e.length;if(r!==o)for(;s>a;a++)i.push(t[e[a]][n][r]);else for(;s>a;a++)i.push(t[e[a]][n]);return i},gn=function(t,e){var n,r=[];if(e===o){e=0;n=t}else{n=e;e=t}for(var i=e;n>i;i++)r.push(i);return r},mn=function(t){return t.replace(en,"")},vn=function(t){var e,n,r,i=[],o=t.length,a=0;t:for(n=0;o>n;n++){e=t[n];for(r=0;a>r;r++)if(i[r]===e)continue t;i.push(e);a++}return i},yn=function(t,e,n){t[e]!==o&&(t[n]=t[e])},bn=/\[.*?\]$/,xn=/\(\)$/,wn=t("<div>")[0],Cn=wn.textContent!==o,Sn=/<.*?>/g;$e=function(e){this.$=function(t,e){return this.api(!0).$(t,e)};this._=function(t,e){return this.api(!0).rows(t,e).data()};this.api=function(t){return new Je(t?Pe(this[Ye.iApiIndex]):this)};this.fnAddData=function(e,n){var r=this.api(!0),i=t.isArray(e)&&(t.isArray(e[0])||t.isPlainObject(e[0]))?r.rows.add(e):r.row.add(e);(n===o||n)&&r.draw();return i.flatten().toArray()};this.fnAdjustColumnSizing=function(t){var e=this.api(!0).columns.adjust(),n=e.settings()[0],r=n.oScroll;t===o||t?e.draw(!1):(""!==r.sX||""!==r.sY)&&me(n)};this.fnClearTable=function(t){var e=this.api(!0).clear();(t===o||t)&&e.draw()};this.fnClose=function(t){this.api(!0).row(t).child.hide()};this.fnDeleteRow=function(t,e,n){var r=this.api(!0),i=r.rows(t),a=i.settings()[0],s=a.aoData[i[0][0]];i.remove();e&&e.call(this,a,s);(n===o||n)&&r.draw();return s};this.fnDestroy=function(t){this.api(!0).destroy(t)};this.fnDraw=function(t){this.api(!0).draw(!t)};this.fnFilter=function(t,e,n,r,i,a){var s=this.api(!0);null===e||e===o?s.search(t,n,r,a):s.column(e).search(t,n,r,a);s.draw()};this.fnGetData=function(t,e){var n=this.api(!0);if(t!==o){var r=t.nodeName?t.nodeName.toLowerCase():"";return e!==o||"td"==r||"th"==r?n.cell(t,e).data():n.row(t).data()||null}return n.data().toArray()};this.fnGetNodes=function(t){var e=this.api(!0);return t!==o?e.row(t).node():e.rows().nodes().flatten().toArray()};this.fnGetPosition=function(t){var e=this.api(!0),n=t.nodeName.toUpperCase();if("TR"==n)return e.row(t).index();if("TD"==n||"TH"==n){var r=e.cell(t).index();return[r.row,r.columnVisible,r.column]}return null};this.fnIsOpen=function(t){return this.api(!0).row(t).child.isShown()};this.fnOpen=function(t,e,n){return this.api(!0).row(t).child(e,n).show().child()[0]};this.fnPageChange=function(t,e){var n=this.api(!0).page(t);(e===o||e)&&n.draw(!1)};this.fnSetColumnVis=function(t,e,n){var r=this.api(!0).column(t).visible(e);(n===o||n)&&r.columns.adjust().draw()};this.fnSettings=function(){return Pe(this[Ye.iApiIndex])};this.fnSort=function(t){this.api(!0).order(t).draw()};this.fnSortListener=function(t,e,n){this.api(!0).order.listener(t,e,n)};this.fnUpdate=function(t,e,n,r,i){var a=this.api(!0);n===o||null===n?a.row(e).data(t):a.cell(e,n).data(t);(i===o||i)&&a.columns.adjust();(r===o||r)&&a.draw();return 0};this.fnVersionCheck=Ye.fnVersionCheck;var n=this,i=e===o,c=this.length;i&&(e={});this.oApi=this.internal=Ye.internal;for(var d in $e.ext.internal)d&&(this[d]=Ge(d));this.each(function(){var d,p={},g=c>1?Re(p,e,!0):e,m=0,v=this.getAttribute("id"),y=!1,C=$e.defaults;if("table"==this.nodeName.toLowerCase()){s(C);l(C.column);r(C,C,!0);r(C.column,C.column,!0);r(C,g);var S=$e.settings;for(m=0,d=S.length;d>m;m++){if(S[m].nTable==this){var T=g.bRetrieve!==o?g.bRetrieve:C.bRetrieve,k=g.bDestroy!==o?g.bDestroy:C.bDestroy;if(i||T)return S[m].oInstance;if(k){S[m].oInstance.fnDestroy();break}He(S[m],0,"Cannot reinitialise DataTable",3);return}if(S[m].sTableId==this.id){S.splice(m,1);break}}if(null===v||""===v){v="DataTables_Table_"+$e.ext._unique++;this.id=v}var _=t.extend(!0,{},$e.models.oSettings,{nTable:this,oApi:n.internal,oInit:g,sDestroyWidth:t(this)[0].style.width,sInstance:v,sTableId:v});S.push(_);_.oInstance=1===n.length?n:t(this).dataTable();s(g);g.oLanguage&&a(g.oLanguage);g.aLengthMenu&&!g.iDisplayLength&&(g.iDisplayLength=t.isArray(g.aLengthMenu[0])?g.aLengthMenu[0][0]:g.aLengthMenu[0]);g=Re(t.extend(!0,{},C),g);Oe(_.oFeatures,g,["bPaginate","bLengthChange","bFilter","bSort","bSortMulti","bInfo","bProcessing","bAutoWidth","bSortClasses","bServerSide","bDeferRender"]);Oe(_,g,["asStripeClasses","ajax","fnServerData","fnFormatNumber","sServerMethod","aaSorting","aaSortingFixed","aLengthMenu","sPaginationType","sAjaxSource","sAjaxDataProp","iStateDuration","sDom","bSortCellsTop","iTabIndex","fnStateLoadCallback","fnStateSaveCallback","renderer",["iCookieDuration","iStateDuration"],["oSearch","oPreviousSearch"],["aoSearchCols","aoPreSearchCols"],["iDisplayLength","_iDisplayLength"],["bJQueryUI","bJUI"]]);Oe(_.oScroll,g,[["sScrollX","sX"],["sScrollXInner","sXInner"],["sScrollY","sY"],["bScrollCollapse","bCollapse"]]);Oe(_.oLanguage,g,"fnInfoCallback");We(_,"aoDrawCallback",g.fnDrawCallback,"user");We(_,"aoServerParams",g.fnServerParams,"user");We(_,"aoStateSaveParams",g.fnStateSaveParams,"user");We(_,"aoStateLoadParams",g.fnStateLoadParams,"user");We(_,"aoStateLoaded",g.fnStateLoaded,"user");We(_,"aoRowCallback",g.fnRowCallback,"user");We(_,"aoRowCreatedCallback",g.fnCreatedRow,"user");We(_,"aoHeaderCallback",g.fnHeaderCallback,"user");We(_,"aoFooterCallback",g.fnFooterCallback,"user");We(_,"aoInitComplete",g.fnInitComplete,"user");We(_,"aoPreDrawCallback",g.fnPreDrawCallback,"user");var M=_.oClasses;if(g.bJQueryUI){t.extend(M,$e.ext.oJUIClasses,g.oClasses);g.sDom===C.sDom&&"lfrtip"===C.sDom&&(_.sDom='<"H"lfr>t<"F"ip>');_.renderer?t.isPlainObject(_.renderer)&&!_.renderer.header&&(_.renderer.header="jqueryui"):_.renderer="jqueryui"}else t.extend(M,$e.ext.classes,g.oClasses);t(this).addClass(M.sTable);(""!==_.oScroll.sX||""!==_.oScroll.sY)&&(_.oScroll.iBarWidth=ke());_.oScroll.sX===!0&&(_.oScroll.sX="100%");if(_.iInitDisplayStart===o){_.iInitDisplayStart=g.iDisplayStart;_._iDisplayStart=g.iDisplayStart}if(null!==g.iDeferLoading){_.bDeferLoading=!0;var D=t.isArray(g.iDeferLoading);_._iRecordsDisplay=D?g.iDeferLoading[0]:g.iDeferLoading;_._iRecordsTotal=D?g.iDeferLoading[1]:g.iDeferLoading}if(""!==g.oLanguage.sUrl){_.oLanguage.sUrl=g.oLanguage.sUrl;t.getJSON(_.oLanguage.sUrl,null,function(e){a(e);r(C.oLanguage,e);t.extend(!0,_.oLanguage,g.oLanguage,e);se(_)});y=!0}else t.extend(!0,_.oLanguage,g.oLanguage);null===g.asStripeClasses&&(_.asStripeClasses=[M.sStripeOdd,M.sStripeEven]);var L=_.asStripeClasses,A=t("tbody tr:eq(0)",this);if(-1!==t.inArray(!0,t.map(L,function(t){return A.hasClass(t)}))){t("tbody tr",this).removeClass(L.join(" "));_.asDestroyStripes=L.slice()}var N,E=[],I=this.getElementsByTagName("thead");if(0!==I.length){z(_.aoHeader,I[0]);E=q(_)}if(null===g.aoColumns){N=[];for(m=0,d=E.length;d>m;m++)N.push(null)}else N=g.aoColumns;for(m=0,d=N.length;d>m;m++)f(_,E?E[m]:null);b(_,g.aoColumnDefs,N,function(t,e){h(_,t,e)});if(A.length){var P=function(t,e){return t.getAttribute("data-"+e)?e:null};t.each(j(_,A[0]).cells,function(t,e){var n=_.aoColumns[t];if(n.mData===t){var r=P(e,"sort")||P(e,"order"),i=P(e,"filter")||P(e,"search");if(null!==r||null!==i){n.mData={_:t+".display",sort:null!==r?t+".@data-"+r:o,type:null!==r?t+".@data-"+r:o,filter:null!==i?t+".@data-"+i:o};h(_,t)}}})}var H=_.oFeatures;if(g.bStateSave){H.bStateSave=!0;Ie(_,g);We(_,"aoDrawCallback",je,"state_save")}if(g.aaSorting===o){var O=_.aaSorting;for(m=0,d=O.length;d>m;m++)O[m][1]=_.aoColumns[m].asSorting[0]}Ne(_);H.bSort&&We(_,"aoDrawCallback",function(){if(_.bSorted){var e=_e(_),n={};t.each(e,function(t,e){n[e.src]=e.dir});ze(_,null,"order",[_,e,n]);De(_)}});We(_,"aoDrawCallback",function(){(_.bSorted||"ssp"===Be(_)||H.bDeferRender)&&Ne(_)},"sc");u(_);var R=t(this).children("caption").each(function(){this._captionSide=t(this).css("caption-side")}),F=t(this).children("thead");0===F.length&&(F=t("<thead/>").appendTo(this));_.nTHead=F[0];var W=t(this).children("tbody");0===W.length&&(W=t("<tbody/>").appendTo(this));_.nTBody=W[0];var U=t(this).children("tfoot");0===U.length&&R.length>0&&(""!==_.oScroll.sX||""!==_.oScroll.sY)&&(U=t("<tfoot/>").appendTo(this));if(0===U.length||0===U.children().length)t(this).addClass(M.sNoFooter);else if(U.length>0){_.nTFoot=U[0];z(_.aoFooter,_.nTFoot)}if(g.aaData)for(m=0;m<g.aaData.length;m++)x(_,g.aaData[m]);else(_.bDeferLoading||"dom"==Be(_))&&w(_,t(_.nTBody).children("tr"));_.aiDisplay=_.aiDisplayMaster.slice();_.bInitialised=!0;y===!1&&se(_)}else He(null,0,"Non-table node initialisation ("+this.nodeName+")",2)});n=null;return this};var Tn=[],kn=Array.prototype,_n=function(e){var n,r,i=$e.settings,o=t.map(i,function(t){return t.nTable});if(!e)return[];if(e.nTable&&e.oApi)return[e];if(e.nodeName&&"table"===e.nodeName.toLowerCase()){n=t.inArray(e,o);return-1!==n?[i[n]]:null}if(e&&"function"==typeof e.settings)return e.settings().toArray();"string"==typeof e?r=t(e):e instanceof t&&(r=e);return r?r.map(function(){n=t.inArray(this,o);return-1!==n?i[n]:null}).toArray():void 0};Je=function(e,n){if(!this instanceof Je)throw"DT API must be constructed as a new object";var r=[],i=function(t){var e=_n(t);e&&r.push.apply(r,e)};if(t.isArray(e))for(var o=0,a=e.length;a>o;o++)i(e[o]);else i(e);this.context=vn(r);n&&this.push.apply(this,n.toArray?n.toArray():n);this.selector={rows:null,cols:null,opts:null};Je.extend(this,this,Tn)};$e.Api=Je;Je.prototype={concat:kn.concat,context:[],each:function(t){for(var e=0,n=this.length;n>e;e++)t.call(this,this[e],e,this);return this},eq:function(t){var e=this.context;return e.length>t?new Je(e[t],this[t]):null},filter:function(t){var e=[];if(kn.filter)e=kn.filter.call(this,t,this);else for(var n=0,r=this.length;r>n;n++)t.call(this,this[n],n,this)&&e.push(this[n]);return new Je(this.context,e)},flatten:function(){var t=[];return new Je(this.context,t.concat.apply(t,this.toArray()))},join:kn.join,indexOf:kn.indexOf||function(t,e){for(var n=e||0,r=this.length;r>n;n++)if(this[n]===t)return n;return-1},iterator:function(t,e,n){var r,i,a,s,l,u,c,f,h=[],d=this.context,p=this.selector;if("string"==typeof t){n=e;e=t;t=!1}for(i=0,a=d.length;a>i;i++)if("table"===e){r=n(d[i],i);r!==o&&h.push(r)}else if("columns"===e||"rows"===e){r=n(d[i],this[i],i);r!==o&&h.push(r)}else if("column"===e||"column-rows"===e||"row"===e||"cell"===e){c=this[i];"column-rows"===e&&(u=En(d[i],p.opts));for(s=0,l=c.length;l>s;s++){f=c[s];r="cell"===e?n(d[i],f.row,f.column,i,s):n(d[i],f,i,s,u);r!==o&&h.push(r)}}if(h.length){var g=new Je(d,t?h.concat.apply([],h):h),m=g.selector;m.rows=p.rows;m.cols=p.cols;m.opts=p.opts;return g}return this},lastIndexOf:kn.lastIndexOf||function(){return this.indexOf.apply(this.toArray.reverse(),arguments)},length:0,map:function(t){var e=[];if(kn.map)e=kn.map.call(this,t,this);else for(var n=0,r=this.length;r>n;n++)e.push(t.call(this,this[n],n));return new Je(this.context,e)},pluck:function(t){return this.map(function(e){return e[t]})},pop:kn.pop,push:kn.push,reduce:kn.reduce||function(t,e){return c(this,t,e,0,this.length,1)},reduceRight:kn.reduceRight||function(t,e){return c(this,t,e,this.length-1,-1,-1)},reverse:kn.reverse,selector:null,shift:kn.shift,sort:kn.sort,splice:kn.splice,toArray:function(){return kn.slice.call(this)},to$:function(){return t(this)},toJQuery:function(){return t(this)},unique:function(){return new Je(this.context,vn(this))},unshift:kn.unshift};Je.extend=function(e,n,r){if(n&&(n instanceof Je||n.__dt_wrapper)){var i,o,a,s=function(t,e,n){return function(){var r=e.apply(t,arguments);Je.extend(r,r,n.methodExt);return r}};for(i=0,o=r.length;o>i;i++){a=r[i];n[a.name]="function"==typeof a.val?s(e,a.val,a):t.isPlainObject(a.val)?{}:a.val;n[a.name].__dt_wrapper=!0;Je.extend(e,n[a.name],a.propExt)}}};Je.register=Ke=function(e,n){if(t.isArray(e))for(var r=0,i=e.length;i>r;r++)Je.register(e[r],n);else{var o,a,s,l,u=e.split("."),c=Tn,f=function(t,e){for(var n=0,r=t.length;r>n;n++)if(t[n].name===e)return t[n];return null};for(o=0,a=u.length;a>o;o++){l=-1!==u[o].indexOf("()");s=l?u[o].replace("()",""):u[o];var h=f(c,s);if(!h){h={name:s,val:{},methodExt:[],propExt:[]};c.push(h)}o===a-1?h.val=n:c=l?h.methodExt:h.propExt}}};Je.registerPlural=Ze=function(e,n,r){Je.register(e,r);Je.register(n,function(){var e=r.apply(this,arguments);return e===this?this:e instanceof Je?e.length?t.isArray(e[0])?new Je(e.context,e[0]):e[0]:o:e})};var Mn=function(e,n){if("number"==typeof e)return[n[e]];var r=t.map(n,function(t){return t.nTable});return t(r).filter(e).map(function(){var e=t.inArray(this,r);return n[e]}).toArray()};Ke("tables()",function(t){return t?new Je(Mn(t,this.context)):this});Ke("table()",function(t){var e=this.tables(t),n=e.context;return n.length?new Je(n[0]):e});Ze("tables().nodes()","table().node()",function(){return this.iterator("table",function(t){return t.nTable})});Ze("tables().body()","table().body()",function(){return this.iterator("table",function(t){return t.nTBody})});Ze("tables().header()","table().header()",function(){return this.iterator("table",function(t){return t.nTHead})});Ze("tables().footer()","table().footer()",function(){return this.iterator("table",function(t){return t.nTFoot})});Ze("tables().containers()","table().container()",function(){return this.iterator("table",function(t){return t.nTableWrapper})});Ke("draw()",function(t){return this.iterator("table",function(e){F(e,t===!1)})});Ke("page()",function(t){return t===o?this.page.info().page:this.iterator("table",function(e){he(e,t)})});Ke("page.info()",function(){if(0===this.context.length)return o;var t=this.context[0],e=t._iDisplayStart,n=t._iDisplayLength,r=t.fnRecordsDisplay(),i=-1===n;return{page:i?0:Math.floor(e/n),pages:i?1:Math.ceil(r/n),start:e,end:t.fnDisplayEnd(),length:n,recordsTotal:t.fnRecordsTotal(),recordsDisplay:r}});Ke("page.len()",function(t){return t===o?0!==this.context.length?this.context[0]._iDisplayLength:o:this.iterator("table",function(e){ue(e,t)})});var Dn=function(t,e,n){if("ssp"==Be(t))F(t,e);else{pe(t,!0);U(t,[],function(n){A(t);for(var r=G(t,n),i=0,o=r.length;o>i;i++)x(t,r[i]);F(t,e);pe(t,!1)})}if(n){var r=new Je(t);r.one("draw",function(){n(r.ajax.json())})}};Ke("ajax.json()",function(){var t=this.context;return t.length>0?t[0].json:void 0});Ke("ajax.params()",function(){var t=this.context;return t.length>0?t[0].oAjaxData:void 0});Ke("ajax.reload()",function(t,e){return this.iterator("table",function(n){Dn(n,e===!1,t)})});Ke("ajax.url()",function(e){var n=this.context;if(e===o){if(0===n.length)return o;n=n[0];return n.ajax?t.isPlainObject(n.ajax)?n.ajax.url:n.ajax:n.sAjaxSource}return this.iterator("table",function(n){t.isPlainObject(n.ajax)?n.ajax.url=e:n.ajax=e})});Ke("ajax.url().load()",function(t,e){return this.iterator("table",function(n){Dn(n,e===!1,t)})});var Ln=function(e,n){var r,i,a,s,l,u,c=[];e&&"string"!=typeof e&&e.length!==o||(e=[e]);for(a=0,s=e.length;s>a;a++){i=e[a]&&e[a].split?e[a].split(","):[e[a]];for(l=0,u=i.length;u>l;l++){r=n("string"==typeof i[l]?t.trim(i[l]):i[l]);r&&r.length&&c.push.apply(c,r)}}return c},An=function(t){t||(t={});t.filter&&!t.search&&(t.search=t.filter);return{search:t.search||"none",order:t.order||"current",page:t.page||"all"}},Nn=function(t){for(var e=0,n=t.length;n>e;e++)if(t[e].length>0){t[0]=t[e];t.length=1;t.context=[t.context[e]];return t}t.length=0;return t},En=function(e,n){var r,i,o,a=[],s=e.aiDisplay,l=e.aiDisplayMaster,u=n.search,c=n.order,f=n.page;if("ssp"==Be(e))return"removed"===u?[]:gn(0,l.length);if("current"==f)for(r=e._iDisplayStart,i=e.fnDisplayEnd();i>r;r++)a.push(s[r]);else if("current"==c||"applied"==c)a="none"==u?l.slice():"applied"==u?s.slice():t.map(l,function(e){return-1===t.inArray(e,s)?e:null});else if("index"==c||"original"==c)for(r=0,i=e.aoData.length;i>r;r++)if("none"==u)a.push(r);else{o=t.inArray(r,s);(-1===o&&"removed"==u||o>=0&&"applied"==u)&&a.push(r)}return a},jn=function(e,n,r){return Ln(n,function(n){var i=ln(n);if(null!==i&&!r)return[i];var o=En(e,r);if(null!==i&&-1!==t.inArray(i,o))return[i];if(!n)return o;for(var a=[],s=0,l=o.length;l>s;s++)a.push(e.aoData[o[s]].nTr);return n.nodeName&&-1!==t.inArray(n,a)?[n._DT_RowIndex]:t(a).filter(n).map(function(){return this._DT_RowIndex}).toArray()})};Ke("rows()",function(e,n){if(e===o)e="";else if(t.isPlainObject(e)){n=e;e=""}n=An(n);var r=this.iterator("table",function(t){return jn(t,e,n)});r.selector.rows=e;r.selector.opts=n;return r});Ke("rows().nodes()",function(){return this.iterator("row",function(t,e){return t.aoData[e].nTr||o})});Ke("rows().data()",function(){return this.iterator(!0,"rows",function(t,e){return pn(t.aoData,e,"_aData")})});Ze("rows().cache()","row().cache()",function(t){return this.iterator("row",function(e,n){var r=e.aoData[n];return"search"===t?r._aFilterData:r._aSortData})});Ze("rows().invalidate()","row().invalidate()",function(t){return this.iterator("row",function(e,n){E(e,n,t)})});Ze("rows().indexes()","row().index()",function(){return this.iterator("row",function(t,e){return e})});Ze("rows().remove()","row().remove()",function(){var e=this;return this.iterator("row",function(n,r,i){var o=n.aoData;o.splice(r,1);for(var a=0,s=o.length;s>a;a++)null!==o[a].nTr&&(o[a].nTr._DT_RowIndex=a);t.inArray(r,n.aiDisplay);N(n.aiDisplayMaster,r);N(n.aiDisplay,r);N(e[i],r,!1);qe(n)})});Ke("rows.add()",function(t){var e=this.iterator("table",function(e){var n,r,i,o=[];for(r=0,i=t.length;i>r;r++){n=t[r];o.push(n.nodeName&&"TR"===n.nodeName.toUpperCase()?w(e,n)[0]:x(e,n))}return o}),n=this.rows(-1);n.pop();n.push.apply(n,e.toArray());return n});Ke("row()",function(t,e){return Nn(this.rows(t,e))});Ke("row().data()",function(t){var e=this.context;if(t===o)return e.length&&this.length?e[0].aoData[this[0]]._aData:o;e[0].aoData[this[0]]._aData=t;E(e[0],this[0],"data");return this});Ke("row().node()",function(){var t=this.context;return t.length&&this.length?t[0].aoData[this[0]].nTr||null:null});Ke("row.add()",function(e){e instanceof t&&e.length&&(e=e[0]);var n=this.iterator("table",function(t){return e.nodeName&&"TR"===e.nodeName.toUpperCase()?w(t,e)[0]:x(t,e)});return this.row(n[0])});var In=function(e,n,r,i){var o=[],a=function(n,r){if(n.nodeName&&"tr"===n.nodeName.toLowerCase())o.push(n);else{var i=t("<tr><td/></tr>").addClass(r);t("td",i).addClass(r).html(n)[0].colSpan=m(e);o.push(i[0])}};if(t.isArray(r)||r instanceof t)for(var s=0,l=r.length;l>s;s++)a(r[s],i);else a(r,i);n._details&&n._details.remove();n._details=t(o);n._detailsShow&&n._details.insertAfter(n.nTr)},Pn=function(t){var e=t.context;if(e.length&&t.length){var n=e[0].aoData[t[0]];if(n._details){n._details.remove();n._detailsShow=o;n._details=o}}},Hn=function(t,e){var n=t.context;if(n.length&&t.length){var r=n[0].aoData[t[0]];if(r._details){r._detailsShow=e;e?r._details.insertAfter(r.nTr):r._details.detach();On(n[0])}}},On=function(t){var e=new Je(t),n=".dt.DT_details",r="draw"+n,i="column-visibility"+n,o="destroy"+n,a=t.aoData;e.off(r+" "+i+" "+o);if(dn(a,"_details").length>0){e.on(r,function(n,r){t===r&&e.rows({page:"current"}).eq(0).each(function(t){var e=a[t];e._detailsShow&&e._details.insertAfter(e.nTr)})});e.on(i,function(e,n){if(t===n)for(var r,i=m(n),o=0,s=a.length;s>o;o++){r=a[o];r._details&&r._details.children("td[colspan]").attr("colspan",i)}});e.on(o,function(e,n){if(t===n)for(var r=0,i=a.length;i>r;r++)a[r]._details&&Pn(a[r])})}},Rn="",Fn=Rn+"row().child",Wn=Fn+"()";Ke(Wn,function(t,e){var n=this.context;if(t===o)return n.length&&this.length?n[0].aoData[this[0]]._details:o;t===!0?this.child.show():t===!1?Pn(this):n.length&&this.length&&In(n[0],n[0].aoData[this[0]],t,e);return this});Ke([Fn+".show()",Wn+".show()"],function(){Hn(this,!0);return this});Ke([Fn+".hide()",Wn+".hide()"],function(){Hn(this,!1);return this});Ke([Fn+".remove()",Wn+".remove()"],function(){Pn(this);return this});Ke(Fn+".isShown()",function(){var t=this.context;return t.length&&this.length?t[0].aoData[this[0]]._detailsShow||!1:!1});var zn=/^(.+):(name|visIdx|visible)$/,qn=function(e,n){var r=e.aoColumns,i=dn(r,"sName"),o=dn(r,"nTh");return Ln(n,function(n){var a=ln(n);if(""===n)return gn(r.length);if(null!==a)return[a>=0?a:r.length+a];var s="string"==typeof n?n.match(zn):"";if(!s)return t(o).filter(n).map(function(){return t.inArray(this,o)}).toArray();switch(s[2]){case"visIdx":case"visible":var l=parseInt(s[1],10);if(0>l){var u=t.map(r,function(t,e){return t.bVisible?e:null});return[u[u.length+l]]}return[p(e,l)];case"name":return t.map(i,function(t,e){return t===s[1]?e:null})}})},Un=function(e,n,r,i){var a,s,l,u,c=e.aoColumns,f=c[n],h=e.aoData;if(r===o)return f.bVisible;if(f.bVisible!==r){if(r){var p=t.inArray(!0,dn(c,"bVisible"),n+1);for(s=0,l=h.length;l>s;s++){u=h[s].nTr;a=h[s].anCells;u&&u.insertBefore(a[n],a[p]||null)}}else t(dn(e.aoData,"anCells",n)).detach();f.bVisible=r;O(e,e.aoHeader);O(e,e.aoFooter);if(i===o||i){d(e);(e.oScroll.sX||e.oScroll.sY)&&me(e)}ze(e,null,"column-visibility",[e,n,r]);je(e)}};Ke("columns()",function(e,n){if(e===o)e="";else if(t.isPlainObject(e)){n=e;e=""}n=An(n);var r=this.iterator("table",function(t){return qn(t,e,n)});r.selector.cols=e;r.selector.opts=n;return r});Ze("columns().header()","column().header()",function(){return this.iterator("column",function(t,e){return t.aoColumns[e].nTh})});Ze("columns().footer()","column().footer()",function(){return this.iterator("column",function(t,e){return t.aoColumns[e].nTf})});Ze("columns().data()","column().data()",function(){return this.iterator("column-rows",function(t,e,n,r,i){for(var o=[],a=0,s=i.length;s>a;a++)o.push(T(t,i[a],e,""));return o})});Ze("columns().cache()","column().cache()",function(t){return this.iterator("column-rows",function(e,n,r,i,o){return pn(e.aoData,o,"search"===t?"_aFilterData":"_aSortData",n)})});Ze("columns().nodes()","column().nodes()",function(){return this.iterator("column-rows",function(t,e,n,r,i){return pn(t.aoData,i,"anCells",e)})});Ze("columns().visible()","column().visible()",function(t,e){return this.iterator("column",function(n,r){return t===o?n.aoColumns[r].bVisible:Un(n,r,t,e)})});Ze("columns().indexes()","column().index()",function(t){return this.iterator("column",function(e,n){return"visible"===t?g(e,n):n})});Ke("columns.adjust()",function(){return this.iterator("table",function(t){d(t)})});Ke("column.index()",function(t,e){if(0!==this.context.length){var n=this.context[0];if("fromVisible"===t||"toData"===t)return p(n,e);if("fromData"===t||"toVisible"===t)return g(n,e)}});Ke("column()",function(t,e){return Nn(this.columns(t,e))});var Bn=function(e,n,r){var i,a,s,l,u,c=e.aoData,f=En(e,r),h=pn(c,f,"anCells"),d=t([].concat.apply([],h)),p=e.aoColumns.length;return Ln(n,function(e){if(null===e||e===o){a=[];for(s=0,l=f.length;l>s;s++){i=f[s];for(u=0;p>u;u++)a.push({row:i,column:u})}return a}return t.isPlainObject(e)?[e]:d.filter(e).map(function(e,n){i=n.parentNode._DT_RowIndex;return{row:i,column:t.inArray(n,c[i].anCells)}}).toArray()})};Ke("cells()",function(e,n,r){if(t.isPlainObject(e))if(typeof e.row!==o){r=n;n=null}else{r=e;e=null}if(t.isPlainObject(n)){r=n;n=null}if(null===n||n===o)return this.iterator("table",function(t){return Bn(t,e,An(r))});var i,a,s,l,u,c=this.columns(n,r),f=this.rows(e,r),h=this.iterator("table",function(t,e){i=[];for(a=0,s=f[e].length;s>a;a++)for(l=0,u=c[e].length;u>l;l++)i.push({row:f[e][a],column:c[e][l]});return i});t.extend(h.selector,{cols:n,rows:e,opts:r});return h});Ze("cells().nodes()","cell().node()",function(){return this.iterator("cell",function(t,e,n){return t.aoData[e].anCells[n]})});Ke("cells().data()",function(){return this.iterator("cell",function(t,e,n){return T(t,e,n)})});Ze("cells().cache()","cell().cache()",function(t){t="search"===t?"_aFilterData":"_aSortData";return this.iterator("cell",function(e,n,r){return e.aoData[n][t][r]})});Ze("cells().indexes()","cell().index()",function(){return this.iterator("cell",function(t,e,n){return{row:e,column:n,columnVisible:g(t,n)}})});Ke(["cells().invalidate()","cell().invalidate()"],function(t){var e=this.selector;this.rows(e.rows,e.opts).invalidate(t);return this});Ke("cell()",function(t,e,n){return Nn(this.cells(t,e,n))});Ke("cell().data()",function(t){var e=this.context,n=this[0];if(t===o)return e.length&&n.length?T(e[0],n[0].row,n[0].column):o;k(e[0],n[0].row,n[0].column,t);E(e[0],n[0].row,"data",n[0].column);return this});Ke("order()",function(e,n){var r=this.context;if(e===o)return 0!==r.length?r[0].aaSorting:o;"number"==typeof e?e=[[e,n]]:t.isArray(e[0])||(e=Array.prototype.slice.call(arguments));return this.iterator("table",function(t){t.aaSorting=e.slice()})});Ke("order.listener()",function(t,e,n){return this.iterator("table",function(r){Ae(r,t,e,n)})});Ke(["columns().order()","column().order()"],function(e){var n=this;return this.iterator("table",function(r,i){var o=[];t.each(n[i],function(t,n){o.push([n,e])});r.aaSorting=o})});Ke("search()",function(e,n,r,i){var a=this.context;return e===o?0!==a.length?a[0].oPreviousSearch.sSearch:o:this.iterator("table",function(o){o.oFeatures.bFilter&&Y(o,t.extend({},o.oPreviousSearch,{sSearch:e+"",bRegex:null===n?!1:n,bSmart:null===r?!0:r,bCaseInsensitive:null===i?!0:i}),1)})});Ze("columns().search()","column().search()",function(e,n,r,i){return this.iterator("column",function(a,s){var l=a.aoPreSearchCols;if(e===o)return l[s].sSearch;if(a.oFeatures.bFilter){t.extend(l[s],{sSearch:e+"",bRegex:null===n?!1:n,bSmart:null===r?!0:r,bCaseInsensitive:null===i?!0:i});Y(a,a.oPreviousSearch,1)}})});Ke("state()",function(){return this.context.length?this.context[0].oSavedState:null});Ke("state.clear()",function(){return this.iterator("table",function(t){t.fnStateSaveCallback.call(t.oInstance,t,{})})});Ke("state.loaded()",function(){return this.context.length?this.context[0].oLoadedState:null});Ke("state.save()",function(){return this.iterator("table",function(t){je(t)})});$e.versionCheck=$e.fnVersionCheck=function(t){for(var e,n,r=$e.version.split("."),i=t.split("."),o=0,a=i.length;a>o;o++){e=parseInt(r[o],10)||0;n=parseInt(i[o],10)||0;if(e!==n)return e>n}return!0};$e.isDataTable=$e.fnIsDataTable=function(e){var n=t(e).get(0),r=!1;
t.each($e.settings,function(t,e){(e.nTable===n||e.nScrollHead===n||e.nScrollFoot===n)&&(r=!0)});return r};$e.tables=$e.fnTables=function(e){return jQuery.map($e.settings,function(n){return!e||e&&t(n.nTable).is(":visible")?n.nTable:void 0})};$e.camelToHungarian=r;Ke("$()",function(e,n){var r=this.rows(n).nodes(),i=t(r);return t([].concat(i.filter(e).toArray(),i.find(e).toArray()))});t.each(["on","one","off"],function(e,n){Ke(n+"()",function(){var e=Array.prototype.slice.call(arguments);e[0].match(/\.dt\b/)||(e[0]+=".dt");var r=t(this.tables().nodes());r[n].apply(r,e);return this})});Ke("clear()",function(){return this.iterator("table",function(t){A(t)})});Ke("settings()",function(){return new Je(this.context,this.context)});Ke("data()",function(){return this.iterator("table",function(t){return dn(t.aoData,"_aData")}).flatten()});Ke("destroy()",function(e){e=e||!1;return this.iterator("table",function(r){var i,o=r.nTableWrapper.parentNode,a=r.oClasses,s=r.nTable,l=r.nTBody,u=r.nTHead,c=r.nTFoot,f=t(s),h=t(l),d=t(r.nTableWrapper),p=t.map(r.aoData,function(t){return t.nTr});r.bDestroying=!0;ze(r,"aoDestroyCallback","destroy",[r]);e||new Je(r).columns().visible(!0);d.unbind(".DT").find(":not(tbody *)").unbind(".DT");t(n).unbind(".DT-"+r.sInstance);if(s!=u.parentNode){f.children("thead").detach();f.append(u)}if(c&&s!=c.parentNode){f.children("tfoot").detach();f.append(c)}f.detach();d.detach();r.aaSorting=[];r.aaSortingFixed=[];Ne(r);t(p).removeClass(r.asStripeClasses.join(" "));t("th, td",u).removeClass(a.sSortable+" "+a.sSortableAsc+" "+a.sSortableDesc+" "+a.sSortableNone);if(r.bJUI){t("th span."+a.sSortIcon+", td span."+a.sSortIcon,u).detach();t("th, td",u).each(function(){var e=t("div."+a.sSortJUIWrapper,this);t(this).append(e.contents());e.detach()})}!e&&o&&o.insertBefore(s,r.nTableReinsertBefore);h.children().detach();h.append(p);f.css("width",r.sDestroyWidth).removeClass(a.sTable);i=r.asDestroyStripes.length;i&&h.children().each(function(e){t(this).addClass(r.asDestroyStripes[e%i])});var g=t.inArray(r,$e.settings);-1!==g&&$e.settings.splice(g,1)})});$e.version="1.10.2";$e.settings=[];$e.models={};$e.models.oSearch={bCaseInsensitive:!0,sSearch:"",bRegex:!1,bSmart:!0};$e.models.oRow={nTr:null,anCells:null,_aData:[],_aSortData:null,_aFilterData:null,_sFilterRow:null,_sRowStripe:"",src:null};$e.models.oColumn={idx:null,aDataSort:null,asSorting:null,bSearchable:null,bSortable:null,bVisible:null,_sManualType:null,_bAttrSrc:!1,fnCreatedCell:null,fnGetData:null,fnSetData:null,mData:null,mRender:null,nTh:null,nTf:null,sClass:null,sContentPadding:null,sDefaultContent:null,sName:null,sSortDataType:"std",sSortingClass:null,sSortingClassJUI:null,sTitle:null,sType:null,sWidth:null,sWidthOrig:null};$e.defaults={aaData:null,aaSorting:[[0,"asc"]],aaSortingFixed:[],ajax:null,aLengthMenu:[10,25,50,100],aoColumns:null,aoColumnDefs:null,aoSearchCols:[],asStripeClasses:null,bAutoWidth:!0,bDeferRender:!1,bDestroy:!1,bFilter:!0,bInfo:!0,bJQueryUI:!1,bLengthChange:!0,bPaginate:!0,bProcessing:!1,bRetrieve:!1,bScrollCollapse:!1,bServerSide:!1,bSort:!0,bSortMulti:!0,bSortCellsTop:!1,bSortClasses:!0,bStateSave:!1,fnCreatedRow:null,fnDrawCallback:null,fnFooterCallback:null,fnFormatNumber:function(t){return t.toString().replace(/\B(?=(\d{3})+(?!\d))/g,this.oLanguage.sThousands)},fnHeaderCallback:null,fnInfoCallback:null,fnInitComplete:null,fnPreDrawCallback:null,fnRowCallback:null,fnServerData:null,fnServerParams:null,fnStateLoadCallback:function(t){try{return JSON.parse((-1===t.iStateDuration?sessionStorage:localStorage).getItem("DataTables_"+t.sInstance+"_"+location.pathname))}catch(e){}},fnStateLoadParams:null,fnStateLoaded:null,fnStateSaveCallback:function(t,e){try{(-1===t.iStateDuration?sessionStorage:localStorage).setItem("DataTables_"+t.sInstance+"_"+location.pathname,JSON.stringify(e))}catch(n){}},fnStateSaveParams:null,iStateDuration:7200,iDeferLoading:null,iDisplayLength:10,iDisplayStart:0,iTabIndex:0,oClasses:{},oLanguage:{oAria:{sSortAscending:": activate to sort column ascending",sSortDescending:": activate to sort column descending"},oPaginate:{sFirst:"First",sLast:"Last",sNext:"Next",sPrevious:"Previous"},sEmptyTable:"No data available in table",sInfo:"Showing _START_ to _END_ of _TOTAL_ entries",sInfoEmpty:"Showing 0 to 0 of 0 entries",sInfoFiltered:"(filtered from _MAX_ total entries)",sInfoPostFix:"",sDecimal:"",sThousands:",",sLengthMenu:"Show _MENU_ entries",sLoadingRecords:"Loading...",sProcessing:"Processing...",sSearch:"Search:",sSearchPlaceholder:"",sUrl:"",sZeroRecords:"No matching records found"},oSearch:t.extend({},$e.models.oSearch),sAjaxDataProp:"data",sAjaxSource:null,sDom:"lfrtip",sPaginationType:"simple_numbers",sScrollX:"",sScrollXInner:"",sScrollY:"",sServerMethod:"GET",renderer:null};e($e.defaults);$e.defaults.column={aDataSort:null,iDataSort:-1,asSorting:["asc","desc"],bSearchable:!0,bSortable:!0,bVisible:!0,fnCreatedCell:null,mData:null,mRender:null,sCellType:"td",sClass:"",sContentPadding:"",sDefaultContent:null,sName:"",sSortDataType:"std",sTitle:null,sType:null,sWidth:null};e($e.defaults.column);$e.models.oSettings={oFeatures:{bAutoWidth:null,bDeferRender:null,bFilter:null,bInfo:null,bLengthChange:null,bPaginate:null,bProcessing:null,bServerSide:null,bSort:null,bSortMulti:null,bSortClasses:null,bStateSave:null},oScroll:{bCollapse:null,iBarWidth:0,sX:null,sXInner:null,sY:null},oLanguage:{fnInfoCallback:null},oBrowser:{bScrollOversize:!1,bScrollbarLeft:!1},ajax:null,aanFeatures:[],aoData:[],aiDisplay:[],aiDisplayMaster:[],aoColumns:[],aoHeader:[],aoFooter:[],oPreviousSearch:{},aoPreSearchCols:[],aaSorting:null,aaSortingFixed:[],asStripeClasses:null,asDestroyStripes:[],sDestroyWidth:0,aoRowCallback:[],aoHeaderCallback:[],aoFooterCallback:[],aoDrawCallback:[],aoRowCreatedCallback:[],aoPreDrawCallback:[],aoInitComplete:[],aoStateSaveParams:[],aoStateLoadParams:[],aoStateLoaded:[],sTableId:"",nTable:null,nTHead:null,nTFoot:null,nTBody:null,nTableWrapper:null,bDeferLoading:!1,bInitialised:!1,aoOpenRows:[],sDom:null,sPaginationType:"two_button",iStateDuration:0,aoStateSave:[],aoStateLoad:[],oSavedState:null,oLoadedState:null,sAjaxSource:null,sAjaxDataProp:null,bAjaxDataGet:!0,jqXHR:null,json:o,oAjaxData:o,fnServerData:null,aoServerParams:[],sServerMethod:null,fnFormatNumber:null,aLengthMenu:null,iDraw:0,bDrawing:!1,iDrawError:-1,_iDisplayLength:10,_iDisplayStart:0,_iRecordsTotal:0,_iRecordsDisplay:0,bJUI:null,oClasses:{},bFiltered:!1,bSorted:!1,bSortCellsTop:null,oInit:null,aoDestroyCallback:[],fnRecordsTotal:function(){return"ssp"==Be(this)?1*this._iRecordsTotal:this.aiDisplayMaster.length},fnRecordsDisplay:function(){return"ssp"==Be(this)?1*this._iRecordsDisplay:this.aiDisplay.length},fnDisplayEnd:function(){var t=this._iDisplayLength,e=this._iDisplayStart,n=e+t,r=this.aiDisplay.length,i=this.oFeatures,o=i.bPaginate;return i.bServerSide?o===!1||-1===t?e+r:Math.min(e+t,this._iRecordsDisplay):!o||n>r||-1===t?r:n},oInstance:null,sInstance:null,iTabIndex:0,nScrollHead:null,nScrollFoot:null,aLastSort:[],oPlugins:{}};$e.ext=Ye={classes:{},errMode:"alert",feature:[],search:[],internal:{},legacy:{ajax:null},pager:{},renderer:{pageButton:{},header:{}},order:{},type:{detect:[],search:{},order:{}},_unique:0,fnVersionCheck:$e.fnVersionCheck,iApiIndex:0,oJUIClasses:{},sVersion:$e.version};t.extend(Ye,{afnFiltering:Ye.search,aTypes:Ye.type.detect,ofnSearch:Ye.type.search,oSort:Ye.type.order,afnSortData:Ye.order,aoFeatures:Ye.feature,oApi:Ye.internal,oStdClasses:Ye.classes,oPagination:Ye.pager});t.extend($e.ext.classes,{sTable:"dataTable",sNoFooter:"no-footer",sPageButton:"paginate_button",sPageButtonActive:"current",sPageButtonDisabled:"disabled",sStripeOdd:"odd",sStripeEven:"even",sRowEmpty:"dataTables_empty",sWrapper:"dataTables_wrapper",sFilter:"dataTables_filter",sInfo:"dataTables_info",sPaging:"dataTables_paginate paging_",sLength:"dataTables_length",sProcessing:"dataTables_processing",sSortAsc:"sorting_asc",sSortDesc:"sorting_desc",sSortable:"sorting",sSortableAsc:"sorting_asc_disabled",sSortableDesc:"sorting_desc_disabled",sSortableNone:"sorting_disabled",sSortColumn:"sorting_",sFilterInput:"",sLengthSelect:"",sScrollWrapper:"dataTables_scroll",sScrollHead:"dataTables_scrollHead",sScrollHeadInner:"dataTables_scrollHeadInner",sScrollBody:"dataTables_scrollBody",sScrollFoot:"dataTables_scrollFoot",sScrollFootInner:"dataTables_scrollFootInner",sHeaderTH:"",sFooterTH:"",sSortJUIAsc:"",sSortJUIDesc:"",sSortJUI:"",sSortJUIAscAllowed:"",sSortJUIDescAllowed:"",sSortJUIWrapper:"",sSortIcon:"",sJUIHeader:"",sJUIFooter:""});(function(){var e="";e="";var n=e+"ui-state-default",r=e+"css_right ui-icon ui-icon-",i=e+"fg-toolbar ui-toolbar ui-widget-header ui-helper-clearfix";t.extend($e.ext.oJUIClasses,$e.ext.classes,{sPageButton:"fg-button ui-button "+n,sPageButtonActive:"ui-state-disabled",sPageButtonDisabled:"ui-state-disabled",sPaging:"dataTables_paginate fg-buttonset ui-buttonset fg-buttonset-multi ui-buttonset-multi paging_",sSortAsc:n+" sorting_asc",sSortDesc:n+" sorting_desc",sSortable:n+" sorting",sSortableAsc:n+" sorting_asc_disabled",sSortableDesc:n+" sorting_desc_disabled",sSortableNone:n+" sorting_disabled",sSortJUIAsc:r+"triangle-1-n",sSortJUIDesc:r+"triangle-1-s",sSortJUI:r+"carat-2-n-s",sSortJUIAscAllowed:r+"carat-1-n",sSortJUIDescAllowed:r+"carat-1-s",sSortJUIWrapper:"DataTables_sort_wrapper",sSortIcon:"DataTables_sort_icon",sScrollHead:"dataTables_scrollHead "+n,sScrollFoot:"dataTables_scrollFoot "+n,sHeaderTH:n,sFooterTH:n,sJUIHeader:i+" ui-corner-tl ui-corner-tr",sJUIFooter:i+" ui-corner-bl ui-corner-br"})})();var Vn=$e.ext.pager;t.extend(Vn,{simple:function(){return["previous","next"]},full:function(){return["first","previous","next","last"]},simple_numbers:function(t,e){return["previous",Ve(t,e),"next"]},full_numbers:function(t,e){return["first","previous",Ve(t,e),"next","last"]},_numbers:Ve,numbers_length:7});t.extend(!0,$e.ext.renderer,{pageButton:{_:function(e,n,r,o,a,s){var l,u,c=e.oClasses,f=e.oLanguage.oPaginate,h=0,d=function(n,i){var o,p,g,m,v=function(t){he(e,t.data.action,!0)};for(o=0,p=i.length;p>o;o++){m=i[o];if(t.isArray(m)){var y=t("<"+(m.DT_el||"div")+"/>").appendTo(n);d(y,m)}else{l="";u="";switch(m){case"ellipsis":n.append("<span>…</span>");break;case"first":l=f.sFirst;u=m+(a>0?"":" "+c.sPageButtonDisabled);break;case"previous":l=f.sPrevious;u=m+(a>0?"":" "+c.sPageButtonDisabled);break;case"next":l=f.sNext;u=m+(s-1>a?"":" "+c.sPageButtonDisabled);break;case"last":l=f.sLast;u=m+(s-1>a?"":" "+c.sPageButtonDisabled);break;default:l=m+1;u=a===m?c.sPageButtonActive:""}if(l){g=t("<a>",{"class":c.sPageButton+" "+u,"aria-controls":e.sTableId,"data-dt-idx":h,tabindex:e.iTabIndex,id:0===r&&"string"==typeof m?e.sTableId+"_"+m:null}).html(l).appendTo(n);Fe(g,{action:m},v);h++}}}};try{var p=t(i.activeElement).data("dt-idx");d(t(n).empty(),o);null!==p&&t(n).find("[data-dt-idx="+p+"]").focus()}catch(g){}}}});var Xn=function(t,e,n,r){if(!t||"-"===t)return-1/0;e&&(t=un(t,e));if(t.replace){n&&(t=t.replace(n,""));r&&(t=t.replace(r,""))}return 1*t};t.extend(Ye.type.order,{"date-pre":function(t){return Date.parse(t)||0},"html-pre":function(t){return sn(t)?"":t.replace?t.replace(/<.*?>/g,"").toLowerCase():t+""},"string-pre":function(t){return sn(t)?"":"string"==typeof t?t.toLowerCase():t.toString?t.toString():""},"string-asc":function(t,e){return e>t?-1:t>e?1:0},"string-desc":function(t,e){return e>t?1:t>e?-1:0}});Xe("");t.extend($e.ext.type.detect,[function(t,e){var n=e.oLanguage.sDecimal;return cn(t,n)?"num"+n:null},function(t){if(t&&(!nn.test(t)||!rn.test(t)))return null;var e=Date.parse(t);return null!==e&&!isNaN(e)||sn(t)?"date":null},function(t,e){var n=e.oLanguage.sDecimal;return cn(t,n,!0)?"num-fmt"+n:null},function(t,e){var n=e.oLanguage.sDecimal;return hn(t,n)?"html-num"+n:null},function(t,e){var n=e.oLanguage.sDecimal;return hn(t,n,!0)?"html-num-fmt"+n:null},function(t){return sn(t)||"string"==typeof t&&-1!==t.indexOf("<")?"html":null}]);t.extend($e.ext.type.search,{html:function(t){return sn(t)?t:"string"==typeof t?t.replace(tn," ").replace(en,""):""},string:function(t){return sn(t)?t:"string"==typeof t?t.replace(tn," "):t}});t.extend(!0,$e.ext.renderer,{header:{_:function(e,n,r,i){t(e.nTable).on("order.dt.DT",function(t,o,a,s){if(e===o){var l=r.idx;n.removeClass(r.sSortingClass+" "+i.sSortAsc+" "+i.sSortDesc).addClass("asc"==s[l]?i.sSortAsc:"desc"==s[l]?i.sSortDesc:r.sSortingClass)}})},jqueryui:function(e,n,r,i){var o=r.idx;t("<div/>").addClass(i.sSortJUIWrapper).append(n.contents()).append(t("<span/>").addClass(i.sSortIcon+" "+r.sSortingClassJUI)).appendTo(n);t(e.nTable).on("order.dt.DT",function(t,a,s,l){if(e===a){n.removeClass(i.sSortAsc+" "+i.sSortDesc).addClass("asc"==l[o]?i.sSortAsc:"desc"==l[o]?i.sSortDesc:r.sSortingClass);n.find("span."+i.sSortIcon).removeClass(i.sSortJUIAsc+" "+i.sSortJUIDesc+" "+i.sSortJUI+" "+i.sSortJUIAscAllowed+" "+i.sSortJUIDescAllowed).addClass("asc"==l[o]?i.sSortJUIAsc:"desc"==l[o]?i.sSortJUIDesc:r.sSortingClassJUI)}})}}});$e.render={number:function(t,e,n,r){return{display:function(i){var o=0>i?"-":"";i=Math.abs(parseFloat(i));var a=parseInt(i,10),s=n?e+(i-a).toFixed(n).substring(2):"";return o+(r||"")+a.toString().replace(/\B(?=(\d{3})+(?!\d))/g,t)+s}}}};t.extend($e.ext.internal,{_fnExternApiFunc:Ge,_fnBuildAjax:U,_fnAjaxUpdate:B,_fnAjaxParameters:V,_fnAjaxUpdateDraw:X,_fnAjaxDataSrc:G,_fnAddColumn:f,_fnColumnOptions:h,_fnAdjustColumnSizing:d,_fnVisibleToColumnIndex:p,_fnColumnIndexToVisible:g,_fnVisbleColumns:m,_fnGetColumns:v,_fnColumnTypes:y,_fnApplyColumnDefs:b,_fnHungarianMap:e,_fnCamelToHungarian:r,_fnLanguageCompat:a,_fnBrowserDetect:u,_fnAddData:x,_fnAddTr:w,_fnNodeToDataIndex:C,_fnNodeToColumnIndex:S,_fnGetCellData:T,_fnSetCellData:k,_fnSplitObjNotation:_,_fnGetObjectDataFn:M,_fnSetObjectDataFn:D,_fnGetDataMaster:L,_fnClearTable:A,_fnDeleteIndex:N,_fnInvalidateRow:E,_fnGetRowElements:j,_fnCreateTr:I,_fnBuildHead:H,_fnDrawHead:O,_fnDraw:R,_fnReDraw:F,_fnAddOptionsHtml:W,_fnDetectHeader:z,_fnGetUniqueThs:q,_fnFeatureHtmlFilter:$,_fnFilterComplete:Y,_fnFilterCustom:J,_fnFilterColumn:K,_fnFilter:Z,_fnFilterCreateSearch:Q,_fnEscapeRegex:te,_fnFilterData:ee,_fnFeatureHtmlInfo:ie,_fnUpdateInfo:oe,_fnInfoMacros:ae,_fnInitialise:se,_fnInitComplete:le,_fnLengthChange:ue,_fnFeatureHtmlLength:ce,_fnFeatureHtmlPaginate:fe,_fnPageChange:he,_fnFeatureHtmlProcessing:de,_fnProcessingDisplay:pe,_fnFeatureHtmlTable:ge,_fnScrollDraw:me,_fnApplyToChildren:ve,_fnCalculateColumnWidths:ye,_fnThrottle:be,_fnConvertToWidth:xe,_fnScrollingWidthAdjust:we,_fnGetWidestNode:Ce,_fnGetMaxLenString:Se,_fnStringToCss:Te,_fnScrollBarWidth:ke,_fnSortFlatten:_e,_fnSort:Me,_fnSortAria:De,_fnSortListener:Le,_fnSortAttachListener:Ae,_fnSortingClasses:Ne,_fnSortData:Ee,_fnSaveState:je,_fnLoadState:Ie,_fnSettingsFromNode:Pe,_fnLog:He,_fnMap:Oe,_fnBindAction:Fe,_fnCallbackReg:We,_fnCallbackFire:ze,_fnLengthOverflow:qe,_fnRenderer:Ue,_fnDataSource:Be,_fnRowAttributes:P,_fnCalculateEnd:function(){}});t.fn.dataTable=$e;t.fn.dataTableSettings=$e.settings;t.fn.dataTableExt=$e.ext;t.fn.DataTable=function(e){return t(this).dataTable(e).api()};t.each($e,function(e,n){t.fn.DataTable[e]=n});return t.fn.dataTable})})(window,document)},{jquery:19}],3:[function(t){var e,n=t("jquery"),r=n(document),i=n("head"),o=null,a=[],s=0,l="id",u="px",c="JColResizer",f=parseInt,h=Math,d=navigator.userAgent.indexOf("Trident/4.0")>0;try{e=sessionStorage}catch(p){}i.append("<style type='text/css'> .JColResizer{table-layout:fixed;} .JColResizer td, .JColResizer th{overflow:hidden;padding-left:0!important; padding-right:0!important;} .JCLRgrips{ height:0px; position:relative;} .JCLRgrip{margin-left:-5px; position:absolute; z-index:5; } .JCLRgrip .JColResizer{position:absolute;background-color:red;filter:alpha(opacity=1);opacity:0;width:10px;height:100%;top:0px} .JCLRLastGrip{position:absolute; width:1px; } .JCLRgripDrag{ border-left:1px dotted black; }</style>");var g=function(t,e){var r=n(t);if(e.disable)return m(r);var i=r.id=r.attr(l)||c+s++;r.p=e.postbackSafe;if(r.is("table")&&!a[i]){r.addClass(c).attr(l,i).before('<div class="JCLRgrips"/>');r.opt=e;r.g=[];r.c=[];r.w=r.width();r.gc=r.prev();e.marginLeft&&r.gc.css("marginLeft",e.marginLeft);e.marginRight&&r.gc.css("marginRight",e.marginRight);r.cs=f(d?t.cellSpacing||t.currentStyle.borderSpacing:r.css("border-spacing"))||2;r.b=f(d?t.border||t.currentStyle.borderLeftWidth:r.css("border-left-width"))||1;a[i]=r;v(r)}},m=function(t){var e=t.attr(l),t=a[e];if(t&&t.is("table")){t.removeClass(c).gc.remove();delete a[e]}},v=function(t){var r=t.find(">thead>tr>th,>thead>tr>td");r.length||(r=t.find(">tbody>tr:first>th,>tr:first>th,>tbody>tr:first>td, >tr:first>td"));t.cg=t.find("col");t.ln=r.length;t.p&&e&&e[t.id]&&y(t,r);r.each(function(e){var r=n(this),i=n(t.gc.append('<div class="JCLRgrip"></div>')[0].lastChild);i.t=t;i.i=e;i.c=r;r.w=r.width();t.g.push(i);t.c.push(r);r.width(r.w).removeAttr("width");e<t.ln-1?i.bind("touchstart mousedown",S).append(t.opt.gripInnerHtml).append('<div class="'+c+'" style="cursor:'+t.opt.hoverCursor+'"></div>'):i.addClass("JCLRLastGrip").removeClass("JCLRgrip");i.data(c,{i:e,t:t.attr(l)})});t.cg.removeAttr("width");b(t);t.find("td, th").not(r).not("table th, table td").each(function(){n(this).removeAttr("width")})},y=function(t,n){var r,i=0,o=0,a=[];if(n){t.cg.removeAttr("width");if(t.opt.flush){e[t.id]="";return}r=e[t.id].split(";");for(;o<t.ln;o++){a.push(100*r[o]/r[t.ln]+"%");n.eq(o).css("width",a[o])}for(o=0;o<t.ln;o++)t.cg.eq(o).css("width",a[o])}else{e[t.id]="";for(;o<t.c.length;o++){r=t.c[o].width();e[t.id]+=r+";";i+=r}e[t.id]+=i}},b=function(t){t.gc.width(t.w);for(var e=0;e<t.ln;e++){var n=t.c[e];t.g[e].css({left:n.offset().left-t.offset().left+n.outerWidth(!1)+t.cs/2+u,height:t.opt.headerOnly?t.c[0].outerHeight(!1):t.outerHeight(!1)})}},x=function(t,e,n){var r=o.x-o.l,i=t.c[e],a=t.c[e+1],s=i.w+r,l=a.w-r;i.width(s+u);a.width(l+u);t.cg.eq(e).width(s+u);t.cg.eq(e+1).width(l+u);if(n){i.w=s;a.w=l}},w=function(t){if(o){var e=o.t;if(t.originalEvent.touches)var n=t.originalEvent.touches[0].pageX-o.ox+o.l;else var n=t.pageX-o.ox+o.l;var r=e.opt.minWidth,i=o.i,a=1.5*e.cs+r+e.b,s=i==e.ln-1?e.w-a:e.g[i+1].position().left-e.cs-r,l=i?e.g[i-1].position().left+e.cs+r:a;n=h.max(l,h.min(s,n));o.x=n;o.css("left",n+u);if(e.opt.liveDrag){x(e,i);b(e);var c=e.opt.onDrag;if(c){t.currentTarget=e[0];c(t)}}return!1}},C=function(t){r.unbind("touchend."+c+" mouseup."+c).unbind("touchmove."+c+" mousemove."+c);n("head :last-child").remove();if(o){o.removeClass(o.t.opt.draggingClass);var i=o.t,a=i.opt.onResize;if(o.x){x(i,o.i,!0);b(i);if(a){t.currentTarget=i[0];a(t)}}i.p&&e&&y(i);o=null}},S=function(t){var e=n(this).data(c),s=a[e.t],l=s.g[e.i];l.ox=t.originalEvent.touches?t.originalEvent.touches[0].pageX:t.pageX;l.l=l.position().left;r.bind("touchmove."+c+" mousemove."+c,w).bind("touchend."+c+" mouseup."+c,C);i.append("<style type='text/css'>*{cursor:"+s.opt.dragCursor+"!important}</style>");l.addClass(s.opt.draggingClass);o=l;if(s.c[e.i].l)for(var u,f=0;f<s.ln;f++){u=s.c[f];u.l=!1;u.w=u.width()}return!1},T=function(){for(e in a){var t,e=a[e],n=0;e.removeClass(c);if(e.w!=e.width()){e.w=e.width();for(t=0;t<e.ln;t++)n+=e.c[t].w;for(t=0;t<e.ln;t++)e.c[t].css("width",h.round(1e3*e.c[t].w/n)/10+"%").l=!0}b(e.addClass(c))}};n(window).bind("resize."+c,T);n.fn.extend({colResizable:function(t){var e={draggingClass:"JCLRgripDrag",gripInnerHtml:"",liveDrag:!1,minWidth:15,headerOnly:!1,hoverCursor:"e-resize",dragCursor:"e-resize",postbackSafe:!1,flush:!1,marginLeft:null,marginRight:null,disable:!1,onDrag:null,onResize:null},t=n.extend(e,t);return this.each(function(){g(this,t)})}})},{jquery:19}],4:[function(t){RegExp.escape=function(t){return t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")};var e=t("jquery");e.csv={defaults:{separator:",",delimiter:'"',headers:!0},hooks:{castToScalar:function(t){var e=/\./;if(isNaN(t))return t;if(e.test(t))return parseFloat(t);var n=parseInt(t);return isNaN(n)?null:n}},parsers:{parse:function(t,e){function n(){l=0;u="";if(e.start&&e.state.rowNum<e.start){s=[];e.state.rowNum++;e.state.colNum=1}else{if(void 0===e.onParseEntry)a.push(s);else{var t=e.onParseEntry(s,e.state);t!==!1&&a.push(t)}s=[];e.end&&e.state.rowNum>=e.end&&(c=!0);e.state.rowNum++;e.state.colNum=1}}function r(){if(void 0===e.onParseValue)s.push(u);else{var t=e.onParseValue(u,e.state);t!==!1&&s.push(t)}u="";l=0;e.state.colNum++}var i=e.separator,o=e.delimiter;e.state.rowNum||(e.state.rowNum=1);e.state.colNum||(e.state.colNum=1);var a=[],s=[],l=0,u="",c=!1,f=RegExp.escape(i),h=RegExp.escape(o),d=/(D|S|\n|\r|[^DS\r\n]+)/,p=d.source;p=p.replace(/S/g,f);p=p.replace(/D/g,h);d=RegExp(p,"gm");t.replace(d,function(t){if(!c)switch(l){case 0:if(t===i){u+="";r();break}if(t===o){l=1;break}if("\n"===t){r();n();break}if(/^\r$/.test(t))break;u+=t;l=3;break;case 1:if(t===o){l=2;break}u+=t;l=1;break;case 2:if(t===o){u+=t;l=1;break}if(t===i){r();break}if("\n"===t){r();n();break}if(/^\r$/.test(t))break;throw new Error("CSVDataError: Illegal State [Row:"+e.state.rowNum+"][Col:"+e.state.colNum+"]");case 3:if(t===i){r();break}if("\n"===t){r();n();break}if(/^\r$/.test(t))break;if(t===o)throw new Error("CSVDataError: Illegal Quote [Row:"+e.state.rowNum+"][Col:"+e.state.colNum+"]");throw new Error("CSVDataError: Illegal Data [Row:"+e.state.rowNum+"][Col:"+e.state.colNum+"]");default:throw new Error("CSVDataError: Unknown State [Row:"+e.state.rowNum+"][Col:"+e.state.colNum+"]")}});if(0!==s.length){r();n()}return a},splitLines:function(t,e){function n(){a=0;if(e.start&&e.state.rowNum<e.start){s="";e.state.rowNum++}else{if(void 0===e.onParseEntry)o.push(s);else{var t=e.onParseEntry(s,e.state);t!==!1&&o.push(t)}s="";e.end&&e.state.rowNum>=e.end&&(l=!0);e.state.rowNum++}}var r=e.separator,i=e.delimiter;e.state.rowNum||(e.state.rowNum=1);var o=[],a=0,s="",l=!1,u=RegExp.escape(r),c=RegExp.escape(i),f=/(D|S|\n|\r|[^DS\r\n]+)/,h=f.source;h=h.replace(/S/g,u);h=h.replace(/D/g,c);f=RegExp(h,"gm");t.replace(f,function(t){if(!l)switch(a){case 0:if(t===r){s+=t;a=0;break}if(t===i){s+=t;a=1;break}if("\n"===t){n();break}if(/^\r$/.test(t))break;s+=t;a=3;break;case 1:if(t===i){s+=t;a=2;break}s+=t;a=1;break;case 2:var o=s.substr(s.length-1);if(t===i&&o===i){s+=t;a=1;break}if(t===r){s+=t;a=0;break}if("\n"===t){n();break}if("\r"===t)break;throw new Error("CSVDataError: Illegal state [Row:"+e.state.rowNum+"]");case 3:if(t===r){s+=t;a=0;break}if("\n"===t){n();break}if("\r"===t)break;if(t===i)throw new Error("CSVDataError: Illegal quote [Row:"+e.state.rowNum+"]");throw new Error("CSVDataError: Illegal state [Row:"+e.state.rowNum+"]");default:throw new Error("CSVDataError: Unknown state [Row:"+e.state.rowNum+"]")}});""!==s&&n();return o},parseEntry:function(t,e){function n(){if(void 0===e.onParseValue)o.push(s);else{var t=e.onParseValue(s,e.state);t!==!1&&o.push(t)}s="";a=0;e.state.colNum++}var r=e.separator,i=e.delimiter;e.state.rowNum||(e.state.rowNum=1);e.state.colNum||(e.state.colNum=1);var o=[],a=0,s="";if(!e.match){var l=RegExp.escape(r),u=RegExp.escape(i),c=/(D|S|\n|\r|[^DS\r\n]+)/,f=c.source;f=f.replace(/S/g,l);f=f.replace(/D/g,u);e.match=RegExp(f,"gm")}t.replace(e.match,function(t){switch(a){case 0:if(t===r){s+="";n();break}if(t===i){a=1;break}if("\n"===t||"\r"===t)break;s+=t;a=3;break;case 1:if(t===i){a=2;break}s+=t;a=1;break;case 2:if(t===i){s+=t;a=1;break}if(t===r){n();break}if("\n"===t||"\r"===t)break;throw new Error("CSVDataError: Illegal State [Row:"+e.state.rowNum+"][Col:"+e.state.colNum+"]");case 3:if(t===r){n();break}if("\n"===t||"\r"===t)break;if(t===i)throw new Error("CSVDataError: Illegal Quote [Row:"+e.state.rowNum+"][Col:"+e.state.colNum+"]");throw new Error("CSVDataError: Illegal Data [Row:"+e.state.rowNum+"][Col:"+e.state.colNum+"]");default:throw new Error("CSVDataError: Unknown State [Row:"+e.state.rowNum+"][Col:"+e.state.colNum+"]")}});n();return o}},toArray:function(t,n,r){var n=void 0!==n?n:{},i={};i.callback=void 0!==r&&"function"==typeof r?r:!1;i.separator="separator"in n?n.separator:e.csv.defaults.separator;i.delimiter="delimiter"in n?n.delimiter:e.csv.defaults.delimiter;var o=void 0!==n.state?n.state:{},n={delimiter:i.delimiter,separator:i.separator,onParseEntry:n.onParseEntry,onParseValue:n.onParseValue,state:o},a=e.csv.parsers.parseEntry(t,n);if(!i.callback)return a;i.callback("",a);return void 0},toArrays:function(t,n,r){var n=void 0!==n?n:{},i={};i.callback=void 0!==r&&"function"==typeof r?r:!1;i.separator="separator"in n?n.separator:e.csv.defaults.separator;i.delimiter="delimiter"in n?n.delimiter:e.csv.defaults.delimiter;var o=[],n={delimiter:i.delimiter,separator:i.separator,onParseEntry:n.onParseEntry,onParseValue:n.onParseValue,start:n.start,end:n.end,state:{rowNum:1,colNum:1}};o=e.csv.parsers.parse(t,n);if(!i.callback)return o;i.callback("",o);return void 0},toObjects:function(t,n,r){var n=void 0!==n?n:{},i={};i.callback=void 0!==r&&"function"==typeof r?r:!1;i.separator="separator"in n?n.separator:e.csv.defaults.separator;i.delimiter="delimiter"in n?n.delimiter:e.csv.defaults.delimiter;i.headers="headers"in n?n.headers:e.csv.defaults.headers;n.start="start"in n?n.start:1;i.headers&&n.start++;n.end&&i.headers&&n.end++;var o=[],a=[],n={delimiter:i.delimiter,separator:i.separator,onParseEntry:n.onParseEntry,onParseValue:n.onParseValue,start:n.start,end:n.end,state:{rowNum:1,colNum:1},match:!1},s={delimiter:i.delimiter,separator:i.separator,start:1,end:1,state:{rowNum:1,colNum:1}},l=e.csv.parsers.splitLines(t,s),u=e.csv.toArray(l[0],n),o=e.csv.parsers.splitLines(t,n);n.state.colNum=1;n.state.rowNum=u?2:1;for(var c=0,f=o.length;f>c;c++){var h=e.csv.toArray(o[c],n),d={};for(var p in u)d[u[p]]=h[p];a.push(d);n.state.rowNum++}if(!i.callback)return a;i.callback("",a);return void 0},fromArrays:function(t,n,r){var n=void 0!==n?n:{},o={};o.callback=void 0!==r&&"function"==typeof r?r:!1;o.separator="separator"in n?n.separator:e.csv.defaults.separator;o.delimiter="delimiter"in n?n.delimiter:e.csv.defaults.delimiter;o.escaper="escaper"in n?n.escaper:e.csv.defaults.escaper;o.experimental="experimental"in n?n.experimental:!1;if(!o.experimental)throw new Error("not implemented");var a=[];for(i in t)a.push(t[i]);if(!o.callback)return a;o.callback("",a);return void 0},fromObjects2CSV:function(t,n,r){var n=void 0!==n?n:{},o={};o.callback=void 0!==r&&"function"==typeof r?r:!1;o.separator="separator"in n?n.separator:e.csv.defaults.separator;o.delimiter="delimiter"in n?n.delimiter:e.csv.defaults.delimiter;o.experimental="experimental"in n?n.experimental:!1;if(!o.experimental)throw new Error("not implemented");var a=[];for(i in t)a.push(arrays[i]);if(!o.callback)return a;o.callback("",a);return void 0}};e.csvEntry2Array=e.csv.toArray;e.csv2Array=e.csv.toArrays;e.csv2Dictionary=e.csv.toObjects},{jquery:19}],5:[function(t,e){function n(){this._events=this._events||{};this._maxListeners=this._maxListeners||void 0}function r(t){return"function"==typeof t}function i(t){return"number"==typeof t}function o(t){return"object"==typeof t&&null!==t}function a(t){return void 0===t}e.exports=n;n.EventEmitter=n;n.prototype._events=void 0;n.prototype._maxListeners=void 0;n.defaultMaxListeners=10;n.prototype.setMaxListeners=function(t){if(!i(t)||0>t||isNaN(t))throw TypeError("n must be a positive number");this._maxListeners=t;return this};n.prototype.emit=function(t){var e,n,i,s,l,u;this._events||(this._events={});if("error"===t&&(!this._events.error||o(this._events.error)&&!this._events.error.length)){e=arguments[1];if(e instanceof Error)throw e;throw TypeError('Uncaught, unspecified "error" event.')}n=this._events[t];if(a(n))return!1;if(r(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:i=arguments.length;s=new Array(i-1);for(l=1;i>l;l++)s[l-1]=arguments[l];n.apply(this,s)}else if(o(n)){i=arguments.length;s=new Array(i-1);for(l=1;i>l;l++)s[l-1]=arguments[l];u=n.slice();i=u.length;for(l=0;i>l;l++)u[l].apply(this,s)}return!0};n.prototype.addListener=function(t,e){var i;if(!r(e))throw TypeError("listener must be a function");this._events||(this._events={});this._events.newListener&&this.emit("newListener",t,r(e.listener)?e.listener:e);this._events[t]?o(this._events[t])?this._events[t].push(e):this._events[t]=[this._events[t],e]:this._events[t]=e;if(o(this._events[t])&&!this._events[t].warned){var i;i=a(this._maxListeners)?n.defaultMaxListeners:this._maxListeners;if(i&&i>0&&this._events[t].length>i){this._events[t].warned=!0;console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length);"function"==typeof console.trace&&console.trace()}}return this};n.prototype.on=n.prototype.addListener;n.prototype.once=function(t,e){function n(){this.removeListener(t,n);if(!i){i=!0;e.apply(this,arguments)}}if(!r(e))throw TypeError("listener must be a function");var i=!1;n.listener=e;this.on(t,n);return this};n.prototype.removeListener=function(t,e){var n,i,a,s;if(!r(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;n=this._events[t];a=n.length;i=-1;if(n===e||r(n.listener)&&n.listener===e){delete this._events[t];this._events.removeListener&&this.emit("removeListener",t,e)}else if(o(n)){for(s=a;s-->0;)if(n[s]===e||n[s].listener&&n[s].listener===e){i=s;break}if(0>i)return this;if(1===n.length){n.length=0;delete this._events[t]}else n.splice(i,1);this._events.removeListener&&this.emit("removeListener",t,e)}return this};n.prototype.removeAllListeners=function(t){var e,n;if(!this._events)return this;if(!this._events.removeListener){0===arguments.length?this._events={}:this._events[t]&&delete this._events[t];return this}if(0===arguments.length){for(e in this._events)"removeListener"!==e&&this.removeAllListeners(e);this.removeAllListeners("removeListener");this._events={};return this}n=this._events[t];if(r(n))this.removeListener(t,n);else for(;n.length;)this.removeListener(t,n[n.length-1]);delete this._events[t];return this};n.prototype.listeners=function(t){var e;e=this._events&&this._events[t]?r(this._events[t])?[this._events[t]]:this._events[t].slice():[];return e};n.listenerCount=function(t,e){var n;n=t._events&&t._events[e]?r(t._events[e])?1:t._events[e].length:0;return n}},{}],6:[function(e,n,r){(function(i){"object"==typeof r&&"object"==typeof n?i(e("../../lib/codemirror")):"function"==typeof t&&t.amd?t(["../../lib/codemirror"],i):i(CodeMirror)})(function(t){function e(t,e,r,i){var o=t.getLineHandle(e.line),l=e.ch-1,u=l>=0&&s[o.text.charAt(l)]||s[o.text.charAt(++l)];if(!u)return null;var c=">"==u.charAt(1)?1:-1;if(r&&c>0!=(l==e.ch))return null;var f=t.getTokenTypeAt(a(e.line,l+1)),h=n(t,a(e.line,l+(c>0?1:0)),c,f||null,i);return null==h?null:{from:a(e.line,l),to:h&&h.pos,match:h&&h.ch==u.charAt(0),forward:c>0}}function n(t,e,n,r,i){for(var o=i&&i.maxScanLineLength||1e4,l=i&&i.maxScanLines||1e3,u=[],c=i&&i.bracketRegex?i.bracketRegex:/[(){}[\]]/,f=n>0?Math.min(e.line+l,t.lastLine()+1):Math.max(t.firstLine()-1,e.line-l),h=e.line;h!=f;h+=n){var d=t.getLine(h);if(d){var p=n>0?0:d.length-1,g=n>0?d.length:-1;if(!(d.length>o)){h==e.line&&(p=e.ch-(0>n?1:0));for(;p!=g;p+=n){var m=d.charAt(p);if(c.test(m)&&(void 0===r||t.getTokenTypeAt(a(h,p+1))==r)){var v=s[m];if(">"==v.charAt(1)==n>0)u.push(m);else{if(!u.length)return{pos:a(h,p),ch:m};u.pop()}}}}}}return h-n==(n>0?t.lastLine():t.firstLine())?!1:null}function r(t,n,r){for(var i=t.state.matchBrackets.maxHighlightLineLength||1e3,s=[],l=t.listSelections(),u=0;u<l.length;u++){var c=l[u].empty()&&e(t,l[u].head,!1,r);if(c&&t.getLine(c.from.line).length<=i){var f=c.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket";s.push(t.markText(c.from,a(c.from.line,c.from.ch+1),{className:f}));c.to&&t.getLine(c.to.line).length<=i&&s.push(t.markText(c.to,a(c.to.line,c.to.ch+1),{className:f}))}}if(s.length){o&&t.state.focused&&t.display.input.focus();
var h=function(){t.operation(function(){for(var t=0;t<s.length;t++)s[t].clear()})};if(!n)return h;setTimeout(h,800)}}function i(t){t.operation(function(){if(l){l();l=null}l=r(t,!1,t.state.matchBrackets)})}var o=/MSIE \d/.test(navigator.userAgent)&&(null==document.documentMode||document.documentMode<8),a=t.Pos,s={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"},l=null;t.defineOption("matchBrackets",!1,function(e,n,r){r&&r!=t.Init&&e.off("cursorActivity",i);if(n){e.state.matchBrackets="object"==typeof n?n:{};e.on("cursorActivity",i)}});t.defineExtension("matchBrackets",function(){r(this,!0)});t.defineExtension("findMatchingBracket",function(t,n,r){return e(this,t,n,r)});t.defineExtension("scanForBracket",function(t,e,r,i){return n(this,t,e,r,i)})})},{"../../lib/codemirror":11}],7:[function(e,n,r){(function(i){"object"==typeof r&&"object"==typeof n?i(e("../../lib/codemirror")):"function"==typeof t&&t.amd?t(["../../lib/codemirror"],i):i(CodeMirror)})(function(t){"use strict";t.registerHelper("fold","brace",function(e,n){function r(r){for(var i=n.ch,l=0;;){var u=0>=i?-1:s.lastIndexOf(r,i-1);if(-1!=u){if(1==l&&u<n.ch)break;o=e.getTokenTypeAt(t.Pos(a,u+1));if(!/^(comment|string)/.test(o))return u+1;i=u-1}else{if(1==l)break;l=1;i=s.length}}}var i,o,a=n.line,s=e.getLine(a),l="{",u="}",i=r("{");if(null==i){l="[",u="]";i=r("[")}if(null!=i){var c,f,h=1,d=e.lastLine();t:for(var p=a;d>=p;++p)for(var g=e.getLine(p),m=p==a?i:0;;){var v=g.indexOf(l,m),y=g.indexOf(u,m);0>v&&(v=g.length);0>y&&(y=g.length);m=Math.min(v,y);if(m==g.length)break;if(e.getTokenTypeAt(t.Pos(p,m+1))==o)if(m==v)++h;else if(!--h){c=p;f=m;break t}++m}if(null!=c&&(a!=c||f!=i))return{from:t.Pos(a,i),to:t.Pos(c,f)}}});t.registerHelper("fold","import",function(e,n){function r(n){if(n<e.firstLine()||n>e.lastLine())return null;var r=e.getTokenAt(t.Pos(n,1));/\S/.test(r.string)||(r=e.getTokenAt(t.Pos(n,r.end+1)));if("keyword"!=r.type||"import"!=r.string)return null;for(var i=n,o=Math.min(e.lastLine(),n+10);o>=i;++i){var a=e.getLine(i),s=a.indexOf(";");if(-1!=s)return{startCh:r.end,end:t.Pos(i,s)}}}var i,n=n.line,o=r(n);if(!o||r(n-1)||(i=r(n-2))&&i.end.line==n-1)return null;for(var a=o.end;;){var s=r(a.line+1);if(null==s)break;a=s.end}return{from:e.clipPos(t.Pos(n,o.startCh+1)),to:a}});t.registerHelper("fold","include",function(e,n){function r(n){if(n<e.firstLine()||n>e.lastLine())return null;var r=e.getTokenAt(t.Pos(n,1));/\S/.test(r.string)||(r=e.getTokenAt(t.Pos(n,r.end+1)));return"meta"==r.type&&"#include"==r.string.slice(0,8)?r.start+8:void 0}var n=n.line,i=r(n);if(null==i||null!=r(n-1))return null;for(var o=n;;){var a=r(o+1);if(null==a)break;++o}return{from:t.Pos(n,i+1),to:e.clipPos(t.Pos(o))}})})},{"../../lib/codemirror":11}],8:[function(e,n,r){(function(i){"object"==typeof r&&"object"==typeof n?i(e("../../lib/codemirror")):"function"==typeof t&&t.amd?t(["../../lib/codemirror"],i):i(CodeMirror)})(function(t){"use strict";function e(e,i,o,a){function s(t){var n=l(e,i);if(!n||n.to.line-n.from.line<u)return null;for(var r=e.findMarksAt(n.from),o=0;o<r.length;++o)if(r[o].__isFold&&"fold"!==a){if(!t)return null;n.cleared=!0;r[o].clear()}return n}if(o&&o.call){var l=o;o=null}else var l=r(e,o,"rangeFinder");"number"==typeof i&&(i=t.Pos(i,0));var u=r(e,o,"minFoldSize"),c=s(!0);if(r(e,o,"scanUp"))for(;!c&&i.line>e.firstLine();){i=t.Pos(i.line-1,0);c=s(!1)}if(c&&!c.cleared&&"unfold"!==a){var f=n(e,o);t.on(f,"mousedown",function(e){h.clear();t.e_preventDefault(e)});var h=e.markText(c.from,c.to,{replacedWith:f,clearOnEnter:!0,__isFold:!0});h.on("clear",function(n,r){t.signal(e,"unfold",e,n,r)});t.signal(e,"fold",e,c.from,c.to)}}function n(t,e){var n=r(t,e,"widget");if("string"==typeof n){var i=document.createTextNode(n);n=document.createElement("span");n.appendChild(i);n.className="CodeMirror-foldmarker"}return n}function r(t,e,n){if(e&&void 0!==e[n])return e[n];var r=t.options.foldOptions;return r&&void 0!==r[n]?r[n]:i[n]}t.newFoldFunction=function(t,n){return function(r,i){e(r,i,{rangeFinder:t,widget:n})}};t.defineExtension("foldCode",function(t,n,r){e(this,t,n,r)});t.defineExtension("isFolded",function(t){for(var e=this.findMarksAt(t),n=0;n<e.length;++n)if(e[n].__isFold)return!0});t.commands.toggleFold=function(t){t.foldCode(t.getCursor())};t.commands.fold=function(t){t.foldCode(t.getCursor(),null,"fold")};t.commands.unfold=function(t){t.foldCode(t.getCursor(),null,"unfold")};t.commands.foldAll=function(e){e.operation(function(){for(var n=e.firstLine(),r=e.lastLine();r>=n;n++)e.foldCode(t.Pos(n,0),null,"fold")})};t.commands.unfoldAll=function(e){e.operation(function(){for(var n=e.firstLine(),r=e.lastLine();r>=n;n++)e.foldCode(t.Pos(n,0),null,"unfold")})};t.registerHelper("fold","combine",function(){var t=Array.prototype.slice.call(arguments,0);return function(e,n){for(var r=0;r<t.length;++r){var i=t[r](e,n);if(i)return i}}});t.registerHelper("fold","auto",function(t,e){for(var n=t.getHelpers(e,"fold"),r=0;r<n.length;r++){var i=n[r](t,e);if(i)return i}});var i={rangeFinder:t.fold.auto,widget:"↔",minFoldSize:0,scanUp:!1};t.defineOption("foldOptions",null);t.defineExtension("foldOption",function(t,e){return r(this,t,e)})})},{"../../lib/codemirror":11}],9:[function(e,n,r){(function(i){"object"==typeof r&&"object"==typeof n?i(e("../../lib/codemirror"),e("./foldcode")):"function"==typeof t&&t.amd?t(["../../lib/codemirror","./foldcode"],i):i(CodeMirror)})(function(t){"use strict";function e(t){this.options=t;this.from=this.to=0}function n(t){t===!0&&(t={});null==t.gutter&&(t.gutter="CodeMirror-foldgutter");null==t.indicatorOpen&&(t.indicatorOpen="CodeMirror-foldgutter-open");null==t.indicatorFolded&&(t.indicatorFolded="CodeMirror-foldgutter-folded");return t}function r(t,e){for(var n=t.findMarksAt(f(e)),r=0;r<n.length;++r)if(n[r].__isFold&&n[r].find().from.line==e)return!0}function i(t){if("string"==typeof t){var e=document.createElement("div");e.className=t+" CodeMirror-guttermarker-subtle";return e}return t.cloneNode(!0)}function o(t,e,n){var o=t.state.foldGutter.options,a=e,s=t.foldOption(o,"minFoldSize"),l=t.foldOption(o,"rangeFinder");t.eachLine(e,n,function(e){var n=null;if(r(t,a))n=i(o.indicatorFolded);else{var u=f(a,0),c=l&&l(t,u);c&&c.to.line-c.from.line>=s&&(n=i(o.indicatorOpen))}t.setGutterMarker(e,o.gutter,n);++a})}function a(t){var e=t.getViewport(),n=t.state.foldGutter;if(n){t.operation(function(){o(t,e.from,e.to)});n.from=e.from;n.to=e.to}}function s(t,e,n){var r=t.state.foldGutter.options;n==r.gutter&&t.foldCode(f(e,0),r.rangeFinder)}function l(t){var e=t.state.foldGutter,n=t.state.foldGutter.options;e.from=e.to=0;clearTimeout(e.changeUpdate);e.changeUpdate=setTimeout(function(){a(t)},n.foldOnChangeTimeSpan||600)}function u(t){var e=t.state.foldGutter,n=t.state.foldGutter.options;clearTimeout(e.changeUpdate);e.changeUpdate=setTimeout(function(){var n=t.getViewport();e.from==e.to||n.from-e.to>20||e.from-n.to>20?a(t):t.operation(function(){if(n.from<e.from){o(t,n.from,e.from);e.from=n.from}if(n.to>e.to){o(t,e.to,n.to);e.to=n.to}})},n.updateViewportTimeSpan||400)}function c(t,e){var n=t.state.foldGutter,r=e.line;r>=n.from&&r<n.to&&o(t,r,r+1)}t.defineOption("foldGutter",!1,function(r,i,o){if(o&&o!=t.Init){r.clearGutter(r.state.foldGutter.options.gutter);r.state.foldGutter=null;r.off("gutterClick",s);r.off("change",l);r.off("viewportChange",u);r.off("fold",c);r.off("unfold",c);r.off("swapDoc",a)}if(i){r.state.foldGutter=new e(n(i));a(r);r.on("gutterClick",s);r.on("change",l);r.on("viewportChange",u);r.on("fold",c);r.on("unfold",c);r.on("swapDoc",a)}});var f=t.Pos})},{"../../lib/codemirror":11,"./foldcode":8}],10:[function(e,n,r){(function(i){"object"==typeof r&&"object"==typeof n?i(e("../../lib/codemirror")):"function"==typeof t&&t.amd?t(["../../lib/codemirror"],i):i(CodeMirror)})(function(t){"use strict";function e(t,e){return t.line-e.line||t.ch-e.ch}function n(t,e,n,r){this.line=e;this.ch=n;this.cm=t;this.text=t.getLine(e);this.min=r?r.from:t.firstLine();this.max=r?r.to-1:t.lastLine()}function r(t,e){var n=t.cm.getTokenTypeAt(h(t.line,e));return n&&/\btag\b/.test(n)}function i(t){if(!(t.line>=t.max)){t.ch=0;t.text=t.cm.getLine(++t.line);return!0}}function o(t){if(!(t.line<=t.min)){t.text=t.cm.getLine(--t.line);t.ch=t.text.length;return!0}}function a(t){for(;;){var e=t.text.indexOf(">",t.ch);if(-1==e){if(i(t))continue;return}if(r(t,e+1)){var n=t.text.lastIndexOf("/",e),o=n>-1&&!/\S/.test(t.text.slice(n+1,e));t.ch=e+1;return o?"selfClose":"regular"}t.ch=e+1}}function s(t){for(;;){var e=t.ch?t.text.lastIndexOf("<",t.ch-1):-1;if(-1==e){if(o(t))continue;return}if(r(t,e+1)){g.lastIndex=e;t.ch=e;var n=g.exec(t.text);if(n&&n.index==e)return n}else t.ch=e}}function l(t){for(;;){g.lastIndex=t.ch;var e=g.exec(t.text);if(!e){if(i(t))continue;return}if(r(t,e.index+1)){t.ch=e.index+e[0].length;return e}t.ch=e.index+1}}function u(t){for(;;){var e=t.ch?t.text.lastIndexOf(">",t.ch-1):-1;if(-1==e){if(o(t))continue;return}if(r(t,e+1)){var n=t.text.lastIndexOf("/",e),i=n>-1&&!/\S/.test(t.text.slice(n+1,e));t.ch=e+1;return i?"selfClose":"regular"}t.ch=e}}function c(t,e){for(var n=[];;){var r,i=l(t),o=t.line,s=t.ch-(i?i[0].length:0);if(!i||!(r=a(t)))return;if("selfClose"!=r)if(i[1]){for(var u=n.length-1;u>=0;--u)if(n[u]==i[2]){n.length=u;break}if(0>u&&(!e||e==i[2]))return{tag:i[2],from:h(o,s),to:h(t.line,t.ch)}}else n.push(i[2])}}function f(t,e){for(var n=[];;){var r=u(t);if(!r)return;if("selfClose"!=r){var i=t.line,o=t.ch,a=s(t);if(!a)return;if(a[1])n.push(a[2]);else{for(var l=n.length-1;l>=0;--l)if(n[l]==a[2]){n.length=l;break}if(0>l&&(!e||e==a[2]))return{tag:a[2],from:h(t.line,t.ch),to:h(i,o)}}}else s(t)}}var h=t.Pos,d="A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",p=d+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",g=new RegExp("<(/?)(["+d+"]["+p+"]*)","g");t.registerHelper("fold","xml",function(t,e){for(var r=new n(t,e.line,0);;){var i,o=l(r);if(!o||r.line!=e.line||!(i=a(r)))return;if(!o[1]&&"selfClose"!=i){var e=h(r.line,r.ch),s=c(r,o[2]);return s&&{from:e,to:s.from}}}});t.findMatchingTag=function(t,r,i){var o=new n(t,r.line,r.ch,i);if(-1!=o.text.indexOf(">")||-1!=o.text.indexOf("<")){var l=a(o),u=l&&h(o.line,o.ch),d=l&&s(o);if(l&&d&&!(e(o,r)>0)){var p={from:h(o.line,o.ch),to:u,tag:d[2]};if("selfClose"==l)return{open:p,close:null,at:"open"};if(d[1])return{open:f(o,d[2]),close:p,at:"close"};o=new n(t,u.line,u.ch,i);return{open:p,close:c(o,d[2]),at:"open"}}}};t.findEnclosingTag=function(t,e,r){for(var i=new n(t,e.line,e.ch,r);;){var o=f(i);if(!o)break;var a=new n(t,e.line,e.ch,r),s=c(a,o.tag);if(s)return{open:o,close:s}}};t.scanForClosingTag=function(t,e,r,i){var o=new n(t,e.line,e.ch,i?{from:0,to:i}:null);return c(o,r)}})},{"../../lib/codemirror":11}],11:[function(e,n,r){(function(e){if("object"==typeof r&&"object"==typeof n)n.exports=e();else{if("function"==typeof t&&t.amd)return t([],e);this.CodeMirror=e()}})(function(){"use strict";function t(n,r){if(!(this instanceof t))return new t(n,r);this.options=r=r?To(r):{};To(Fa,r,!1);d(r);var i=r.value;"string"==typeof i&&(i=new us(i,r.mode));this.doc=i;var o=this.display=new e(n,i);o.wrapper.CodeMirror=this;u(this);s(this);r.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap");r.autofocus&&!ga&&Nn(this);v(this);this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,draggingText:!1,highlight:new vo,keySeq:null};ia&&11>oa&&setTimeout(ko(An,this,!0),20);In(this);Oo();on(this);this.curOp.forceUpdate=!0;Oi(this,i);r.autofocus&&!ga||jo()==o.input?setTimeout(ko(ir,this),20):or(this);for(var a in Wa)Wa.hasOwnProperty(a)&&Wa[a](this,r[a],za);C(this);for(var l=0;l<Va.length;++l)Va[l](this);sn(this);aa&&r.lineWrapping&&"optimizelegibility"==getComputedStyle(o.lineDiv).textRendering&&(o.lineDiv.style.textRendering="auto")}function e(t,e){var n=this,r=n.input=Lo("textarea",null,null,"position: absolute; padding: 0; width: 1px; height: 1em; outline: none");aa?r.style.width="1000px":r.setAttribute("wrap","off");pa&&(r.style.border="1px solid black");r.setAttribute("autocorrect","off");r.setAttribute("autocapitalize","off");r.setAttribute("spellcheck","false");n.inputDiv=Lo("div",[r],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");n.scrollbarFiller=Lo("div",null,"CodeMirror-scrollbar-filler");n.scrollbarFiller.setAttribute("not-content","true");n.gutterFiller=Lo("div",null,"CodeMirror-gutter-filler");n.gutterFiller.setAttribute("not-content","true");n.lineDiv=Lo("div",null,"CodeMirror-code");n.selectionDiv=Lo("div",null,null,"position: relative; z-index: 1");n.cursorDiv=Lo("div",null,"CodeMirror-cursors");n.measure=Lo("div",null,"CodeMirror-measure");n.lineMeasure=Lo("div",null,"CodeMirror-measure");n.lineSpace=Lo("div",[n.measure,n.lineMeasure,n.selectionDiv,n.cursorDiv,n.lineDiv],null,"position: relative; outline: none");n.mover=Lo("div",[Lo("div",[n.lineSpace],"CodeMirror-lines")],null,"position: relative");n.sizer=Lo("div",[n.mover],"CodeMirror-sizer");n.sizerWidth=null;n.heightForcer=Lo("div",null,null,"position: absolute; height: "+bs+"px; width: 1px;");n.gutters=Lo("div",null,"CodeMirror-gutters");n.lineGutter=null;n.scroller=Lo("div",[n.sizer,n.heightForcer,n.gutters],"CodeMirror-scroll");n.scroller.setAttribute("tabIndex","-1");n.wrapper=Lo("div",[n.inputDiv,n.scrollbarFiller,n.gutterFiller,n.scroller],"CodeMirror");if(ia&&8>oa){n.gutters.style.zIndex=-1;n.scroller.style.paddingRight=0}pa&&(r.style.width="0px");aa||(n.scroller.draggable=!0);if(fa){n.inputDiv.style.height="1px";n.inputDiv.style.position="absolute"}t&&(t.appendChild?t.appendChild(n.wrapper):t(n.wrapper));n.viewFrom=n.viewTo=e.first;n.reportedViewFrom=n.reportedViewTo=e.first;n.view=[];n.renderedView=null;n.externalMeasured=null;n.viewOffset=0;n.lastWrapHeight=n.lastWrapWidth=0;n.updateLineNumbers=null;n.nativeBarWidth=n.barHeight=n.barWidth=0;n.scrollbarsClipped=!1;n.lineNumWidth=n.lineNumInnerWidth=n.lineNumChars=null;n.prevInput="";n.alignWidgets=!1;n.pollingFast=!1;n.poll=new vo;n.cachedCharWidth=n.cachedTextHeight=n.cachedPaddingH=null;n.inaccurateSelection=!1;n.maxLine=null;n.maxLineLength=0;n.maxLineChanged=!1;n.wheelDX=n.wheelDY=n.wheelStartX=n.wheelStartY=null;n.shift=!1;n.selForContextMenu=null}function n(e){e.doc.mode=t.getMode(e.options,e.doc.modeOption);r(e)}function r(t){t.doc.iter(function(t){t.stateAfter&&(t.stateAfter=null);t.styles&&(t.styles=null)});t.doc.frontier=t.doc.first;Te(t,100);t.state.modeGen++;t.curOp&&xn(t)}function i(t){if(t.options.lineWrapping){Is(t.display.wrapper,"CodeMirror-wrap");t.display.sizer.style.minWidth="";t.display.sizerWidth=null}else{js(t.display.wrapper,"CodeMirror-wrap");h(t)}a(t);xn(t);Ve(t);setTimeout(function(){y(t)},100)}function o(t){var e=nn(t.display),n=t.options.lineWrapping,r=n&&Math.max(5,t.display.scroller.clientWidth/rn(t.display)-3);return function(i){if(ui(t.doc,i))return 0;var o=0;if(i.widgets)for(var a=0;a<i.widgets.length;a++)i.widgets[a].height&&(o+=i.widgets[a].height);return n?o+(Math.ceil(i.text.length/r)||1)*e:o+e}}function a(t){var e=t.doc,n=o(t);e.iter(function(t){var e=n(t);e!=t.height&&zi(t,e)})}function s(t){t.display.wrapper.className=t.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+t.options.theme.replace(/(^|\s)\s*/g," cm-s-");Ve(t)}function l(t){u(t);xn(t);setTimeout(function(){w(t)},20)}function u(t){var e=t.display.gutters,n=t.options.gutters;Ao(e);for(var r=0;r<n.length;++r){var i=n[r],o=e.appendChild(Lo("div",null,"CodeMirror-gutter "+i));if("CodeMirror-linenumbers"==i){t.display.lineGutter=o;o.style.width=(t.display.lineNumWidth||1)+"px"}}e.style.display=r?"":"none";c(t)}function c(t){var e=t.display.gutters.offsetWidth;t.display.sizer.style.marginLeft=e+"px"}function f(t){if(0==t.height)return 0;for(var e,n=t.text.length,r=t;e=ni(r);){var i=e.find(0,!0);r=i.from.line;n+=i.from.ch-i.to.ch}r=t;for(;e=ri(r);){var i=e.find(0,!0);n-=r.text.length-i.from.ch;r=i.to.line;n+=r.text.length-i.to.ch}return n}function h(t){var e=t.display,n=t.doc;e.maxLine=Ri(n,n.first);e.maxLineLength=f(e.maxLine);e.maxLineChanged=!0;n.iter(function(t){var n=f(t);if(n>e.maxLineLength){e.maxLineLength=n;e.maxLine=t}})}function d(t){var e=wo(t.gutters,"CodeMirror-linenumbers");if(-1==e&&t.lineNumbers)t.gutters=t.gutters.concat(["CodeMirror-linenumbers"]);else if(e>-1&&!t.lineNumbers){t.gutters=t.gutters.slice(0);t.gutters.splice(e,1)}}function p(t){var e=t.display,n=e.gutters.offsetWidth,r=Math.round(t.doc.height+Le(t.display));return{clientHeight:e.scroller.clientHeight,viewHeight:e.wrapper.clientHeight,scrollWidth:e.scroller.scrollWidth,clientWidth:e.scroller.clientWidth,viewWidth:e.wrapper.clientWidth,barLeft:t.options.fixedGutter?n:0,docHeight:r,scrollHeight:r+Ne(t)+e.barHeight,nativeBarWidth:e.nativeBarWidth,gutterWidth:n}}function g(t,e,n){this.cm=n;var r=this.vert=Lo("div",[Lo("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=Lo("div",[Lo("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");t(r);t(i);gs(r,"scroll",function(){r.clientHeight&&e(r.scrollTop,"vertical")});gs(i,"scroll",function(){i.clientWidth&&e(i.scrollLeft,"horizontal")});this.checkedOverlay=!1;ia&&8>oa&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")}function m(){}function v(e){if(e.display.scrollbars){e.display.scrollbars.clear();e.display.scrollbars.addClass&&js(e.display.wrapper,e.display.scrollbars.addClass)}e.display.scrollbars=new t.scrollbarModel[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller);gs(t,"mousedown",function(){e.state.focused&&setTimeout(ko(Nn,e),0)});t.setAttribute("not-content","true")},function(t,n){"horizontal"==n?Gn(e,t):Xn(e,t)},e);e.display.scrollbars.addClass&&Is(e.display.wrapper,e.display.scrollbars.addClass)}function y(t,e){e||(e=p(t));var n=t.display.barWidth,r=t.display.barHeight;b(t,e);for(var i=0;4>i&&n!=t.display.barWidth||r!=t.display.barHeight;i++){n!=t.display.barWidth&&t.options.lineWrapping&&N(t);b(t,p(t));n=t.display.barWidth;r=t.display.barHeight}}function b(t,e){var n=t.display,r=n.scrollbars.update(e);n.sizer.style.paddingRight=(n.barWidth=r.right)+"px";n.sizer.style.paddingBottom=(n.barHeight=r.bottom)+"px";if(r.right&&r.bottom){n.scrollbarFiller.style.display="block";n.scrollbarFiller.style.height=r.bottom+"px";n.scrollbarFiller.style.width=r.right+"px"}else n.scrollbarFiller.style.display="";if(r.bottom&&t.options.coverGutterNextToScrollbar&&t.options.fixedGutter){n.gutterFiller.style.display="block";n.gutterFiller.style.height=r.bottom+"px";n.gutterFiller.style.width=e.gutterWidth+"px"}else n.gutterFiller.style.display=""}function x(t,e,n){var r=n&&null!=n.top?Math.max(0,n.top):t.scroller.scrollTop;r=Math.floor(r-De(t));var i=n&&null!=n.bottom?n.bottom:r+t.wrapper.clientHeight,o=Ui(e,r),a=Ui(e,i);if(n&&n.ensure){var s=n.ensure.from.line,l=n.ensure.to.line;if(o>s){o=s;a=Ui(e,Bi(Ri(e,s))+t.wrapper.clientHeight)}else if(Math.min(l,e.lastLine())>=a){o=Ui(e,Bi(Ri(e,l))-t.wrapper.clientHeight);a=l}}return{from:o,to:Math.max(a,o+1)}}function w(t){var e=t.display,n=e.view;if(e.alignWidgets||e.gutters.firstChild&&t.options.fixedGutter){for(var r=T(e)-e.scroller.scrollLeft+t.doc.scrollLeft,i=e.gutters.offsetWidth,o=r+"px",a=0;a<n.length;a++)if(!n[a].hidden){t.options.fixedGutter&&n[a].gutter&&(n[a].gutter.style.left=o);var s=n[a].alignable;if(s)for(var l=0;l<s.length;l++)s[l].style.left=o}t.options.fixedGutter&&(e.gutters.style.left=r+i+"px")}}function C(t){if(!t.options.lineNumbers)return!1;var e=t.doc,n=S(t.options,e.first+e.size-1),r=t.display;if(n.length!=r.lineNumChars){var i=r.measure.appendChild(Lo("div",[Lo("div",n)],"CodeMirror-linenumber CodeMirror-gutter-elt")),o=i.firstChild.offsetWidth,a=i.offsetWidth-o;r.lineGutter.style.width="";r.lineNumInnerWidth=Math.max(o,r.lineGutter.offsetWidth-a);r.lineNumWidth=r.lineNumInnerWidth+a;r.lineNumChars=r.lineNumInnerWidth?n.length:-1;r.lineGutter.style.width=r.lineNumWidth+"px";c(t);return!0}return!1}function S(t,e){return String(t.lineNumberFormatter(e+t.firstLineNumber))}function T(t){return t.scroller.getBoundingClientRect().left-t.sizer.getBoundingClientRect().left}function k(t,e,n){var r=t.display;this.viewport=e;this.visible=x(r,t.doc,e);this.editorIsHidden=!r.wrapper.offsetWidth;this.wrapperHeight=r.wrapper.clientHeight;this.wrapperWidth=r.wrapper.clientWidth;this.oldDisplayWidth=Ee(t);this.force=n;this.dims=j(t)}function _(t){var e=t.display;if(!e.scrollbarsClipped&&e.scroller.offsetWidth){e.nativeBarWidth=e.scroller.offsetWidth-e.scroller.clientWidth;e.heightForcer.style.height=Ne(t)+"px";e.sizer.style.marginBottom=-e.nativeBarWidth+"px";e.sizer.style.borderRightWidth=Ne(t)+"px";e.scrollbarsClipped=!0}}function M(t,e){var n=t.display,r=t.doc;if(e.editorIsHidden){Cn(t);return!1}if(!e.force&&e.visible.from>=n.viewFrom&&e.visible.to<=n.viewTo&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&0==_n(t))return!1;if(C(t)){Cn(t);e.dims=j(t)}var i=r.first+r.size,o=Math.max(e.visible.from-t.options.viewportMargin,r.first),a=Math.min(i,e.visible.to+t.options.viewportMargin);n.viewFrom<o&&o-n.viewFrom<20&&(o=Math.max(r.first,n.viewFrom));n.viewTo>a&&n.viewTo-a<20&&(a=Math.min(i,n.viewTo));if(Ca){o=si(t.doc,o);a=li(t.doc,a)}var s=o!=n.viewFrom||a!=n.viewTo||n.lastWrapHeight!=e.wrapperHeight||n.lastWrapWidth!=e.wrapperWidth;kn(t,o,a);n.viewOffset=Bi(Ri(t.doc,n.viewFrom));t.display.mover.style.top=n.viewOffset+"px";var l=_n(t);if(!s&&0==l&&!e.force&&n.renderedView==n.view&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo))return!1;var u=jo();l>4&&(n.lineDiv.style.display="none");I(t,n.updateLineNumbers,e.dims);l>4&&(n.lineDiv.style.display="");n.renderedView=n.view;u&&jo()!=u&&u.offsetHeight&&u.focus();Ao(n.cursorDiv);Ao(n.selectionDiv);n.gutters.style.height=0;if(s){n.lastWrapHeight=e.wrapperHeight;n.lastWrapWidth=e.wrapperWidth;Te(t,400)}n.updateLineNumbers=null;return!0}function D(t,e){for(var n=e.force,r=e.viewport,i=!0;;i=!1){if(i&&t.options.lineWrapping&&e.oldDisplayWidth!=Ee(t))n=!0;else{n=!1;r&&null!=r.top&&(r={top:Math.min(t.doc.height+Le(t.display)-je(t),r.top)});e.visible=x(t.display,t.doc,r);if(e.visible.from>=t.display.viewFrom&&e.visible.to<=t.display.viewTo)break}if(!M(t,e))break;N(t);var o=p(t);xe(t);A(t,o);y(t,o)}co(t,"update",t);if(t.display.viewFrom!=t.display.reportedViewFrom||t.display.viewTo!=t.display.reportedViewTo){co(t,"viewportChange",t,t.display.viewFrom,t.display.viewTo);t.display.reportedViewFrom=t.display.viewFrom;t.display.reportedViewTo=t.display.viewTo}}function L(t,e){var n=new k(t,e);if(M(t,n)){N(t);D(t,n);var r=p(t);xe(t);A(t,r);y(t,r)}}function A(t,e){t.display.sizer.style.minHeight=e.docHeight+"px";var n=e.docHeight+t.display.barHeight;t.display.heightForcer.style.top=n+"px";t.display.gutters.style.height=Math.max(n+Ne(t),e.clientHeight)+"px"}function N(t){for(var e=t.display,n=e.lineDiv.offsetTop,r=0;r<e.view.length;r++){var i,o=e.view[r];if(!o.hidden){if(ia&&8>oa){var a=o.node.offsetTop+o.node.offsetHeight;i=a-n;n=a}else{var s=o.node.getBoundingClientRect();i=s.bottom-s.top}var l=o.line.height-i;2>i&&(i=nn(e));if(l>.001||-.001>l){zi(o.line,i);E(o.line);if(o.rest)for(var u=0;u<o.rest.length;u++)E(o.rest[u])}}}}function E(t){if(t.widgets)for(var e=0;e<t.widgets.length;++e)t.widgets[e].height=t.widgets[e].node.offsetHeight}function j(t){for(var e=t.display,n={},r={},i=e.gutters.clientLeft,o=e.gutters.firstChild,a=0;o;o=o.nextSibling,++a){n[t.options.gutters[a]]=o.offsetLeft+o.clientLeft+i;r[t.options.gutters[a]]=o.clientWidth}return{fixedPos:T(e),gutterTotalWidth:e.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:e.wrapper.clientWidth}}function I(t,e,n){function r(e){var n=e.nextSibling;aa&&ma&&t.display.currentWheelTarget==e?e.style.display="none":e.parentNode.removeChild(e);return n}for(var i=t.display,o=t.options.lineNumbers,a=i.lineDiv,s=a.firstChild,l=i.view,u=i.viewFrom,c=0;c<l.length;c++){var f=l[c];if(f.hidden);else if(f.node){for(;s!=f.node;)s=r(s);var h=o&&null!=e&&u>=e&&f.lineNumber;if(f.changes){wo(f.changes,"gutter")>-1&&(h=!1);P(t,f,u,n)}if(h){Ao(f.lineNumber);f.lineNumber.appendChild(document.createTextNode(S(t.options,u)))}s=f.node.nextSibling}else{var d=U(t,f,u,n);a.insertBefore(d,s)}u+=f.size}for(;s;)s=r(s)}function P(t,e,n,r){for(var i=0;i<e.changes.length;i++){var o=e.changes[i];"text"==o?F(t,e):"gutter"==o?z(t,e,n,r):"class"==o?W(e):"widget"==o&&q(e,r)}e.changes=null}function H(t){if(t.node==t.text){t.node=Lo("div",null,null,"position: relative");t.text.parentNode&&t.text.parentNode.replaceChild(t.node,t.text);t.node.appendChild(t.text);ia&&8>oa&&(t.node.style.zIndex=2)}return t.node}function O(t){var e=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;e&&(e+=" CodeMirror-linebackground");if(t.background)if(e)t.background.className=e;else{t.background.parentNode.removeChild(t.background);t.background=null}else if(e){var n=H(t);t.background=n.insertBefore(Lo("div",null,e),n.firstChild)}}function R(t,e){var n=t.display.externalMeasured;if(n&&n.line==e.line){t.display.externalMeasured=null;e.measure=n.measure;return n.built}return ki(t,e)}function F(t,e){var n=e.text.className,r=R(t,e);e.text==e.node&&(e.node=r.pre);e.text.parentNode.replaceChild(r.pre,e.text);e.text=r.pre;if(r.bgClass!=e.bgClass||r.textClass!=e.textClass){e.bgClass=r.bgClass;e.textClass=r.textClass;W(e)}else n&&(e.text.className=n)}function W(t){O(t);t.line.wrapClass?H(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var e=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=e||""}function z(t,e,n,r){if(e.gutter){e.node.removeChild(e.gutter);e.gutter=null}var i=e.line.gutterMarkers;if(t.options.lineNumbers||i){var o=H(e),a=e.gutter=o.insertBefore(Lo("div",null,"CodeMirror-gutter-wrapper","left: "+(t.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px; width: "+r.gutterTotalWidth+"px"),e.text);e.line.gutterClass&&(a.className+=" "+e.line.gutterClass);!t.options.lineNumbers||i&&i["CodeMirror-linenumbers"]||(e.lineNumber=a.appendChild(Lo("div",S(t.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+t.display.lineNumInnerWidth+"px")));if(i)for(var s=0;s<t.options.gutters.length;++s){var l=t.options.gutters[s],u=i.hasOwnProperty(l)&&i[l];u&&a.appendChild(Lo("div",[u],"CodeMirror-gutter-elt","left: "+r.gutterLeft[l]+"px; width: "+r.gutterWidth[l]+"px"))}}}function q(t,e){t.alignable&&(t.alignable=null);for(var n,r=t.node.firstChild;r;r=n){var n=r.nextSibling;"CodeMirror-linewidget"==r.className&&t.node.removeChild(r)}B(t,e)}function U(t,e,n,r){var i=R(t,e);e.text=e.node=i.pre;i.bgClass&&(e.bgClass=i.bgClass);i.textClass&&(e.textClass=i.textClass);W(e);z(t,e,n,r);B(e,r);return e.node}function B(t,e){V(t.line,t,e,!0);if(t.rest)for(var n=0;n<t.rest.length;n++)V(t.rest[n],t,e,!1)}function V(t,e,n,r){if(t.widgets)for(var i=H(e),o=0,a=t.widgets;o<a.length;++o){var s=a[o],l=Lo("div",[s.node],"CodeMirror-linewidget");s.handleMouseEvents||l.setAttribute("cm-ignore-events","true");X(s,l,e,n);r&&s.above?i.insertBefore(l,e.gutter||e.text):i.appendChild(l);co(s,"redraw")}}function X(t,e,n,r){if(t.noHScroll){(n.alignable||(n.alignable=[])).push(e);var i=r.wrapperWidth;e.style.left=r.fixedPos+"px";if(!t.coverGutter){i-=r.gutterTotalWidth;e.style.paddingLeft=r.gutterTotalWidth+"px"}e.style.width=i+"px"}if(t.coverGutter){e.style.zIndex=5;e.style.position="relative";t.noHScroll||(e.style.marginLeft=-r.gutterTotalWidth+"px")}}function G(t){return Sa(t.line,t.ch)}function $(t,e){return Ta(t,e)<0?e:t}function Y(t,e){return Ta(t,e)<0?t:e}function J(t,e){this.ranges=t;this.primIndex=e}function K(t,e){this.anchor=t;this.head=e}function Z(t,e){var n=t[e];t.sort(function(t,e){return Ta(t.from(),e.from())});e=wo(t,n);for(var r=1;r<t.length;r++){var i=t[r],o=t[r-1];if(Ta(o.to(),i.from())>=0){var a=Y(o.from(),i.from()),s=$(o.to(),i.to()),l=o.empty()?i.from()==i.head:o.from()==o.head;e>=r&&--e;t.splice(--r,2,new K(l?s:a,l?a:s))}}return new J(t,e)}function Q(t,e){return new J([new K(t,e||t)],0)}function te(t,e){return Math.max(t.first,Math.min(e,t.first+t.size-1))}function ee(t,e){if(e.line<t.first)return Sa(t.first,0);var n=t.first+t.size-1;return e.line>n?Sa(n,Ri(t,n).text.length):ne(e,Ri(t,e.line).text.length)}function ne(t,e){var n=t.ch;return null==n||n>e?Sa(t.line,e):0>n?Sa(t.line,0):t}function re(t,e){return e>=t.first&&e<t.first+t.size}function ie(t,e){for(var n=[],r=0;r<e.length;r++)n[r]=ee(t,e[r]);return n}function oe(t,e,n,r){if(t.cm&&t.cm.display.shift||t.extend){var i=e.anchor;if(r){var o=Ta(n,i)<0;if(o!=Ta(r,i)<0){i=n;n=r}else o!=Ta(n,r)<0&&(n=r)}return new K(i,n)}return new K(r||n,n)}function ae(t,e,n,r){he(t,new J([oe(t,t.sel.primary(),e,n)],0),r)}function se(t,e,n){for(var r=[],i=0;i<t.sel.ranges.length;i++)r[i]=oe(t,t.sel.ranges[i],e[i],null);var o=Z(r,t.sel.primIndex);he(t,o,n)}function le(t,e,n,r){var i=t.sel.ranges.slice(0);i[e]=n;he(t,Z(i,t.sel.primIndex),r)}function ue(t,e,n,r){he(t,Q(e,n),r)}function ce(t,e){var n={ranges:e.ranges,update:function(e){this.ranges=[];for(var n=0;n<e.length;n++)this.ranges[n]=new K(ee(t,e[n].anchor),ee(t,e[n].head))}};vs(t,"beforeSelectionChange",t,n);t.cm&&vs(t.cm,"beforeSelectionChange",t.cm,n);return n.ranges!=e.ranges?Z(n.ranges,n.ranges.length-1):e}function fe(t,e,n){var r=t.history.done,i=xo(r);if(i&&i.ranges){r[r.length-1]=e;de(t,e,n)}else he(t,e,n)}function he(t,e,n){de(t,e,n);Zi(t,t.sel,t.cm?t.cm.curOp.id:0/0,n)}function de(t,e,n){(go(t,"beforeSelectionChange")||t.cm&&go(t.cm,"beforeSelectionChange"))&&(e=ce(t,e));var r=n&&n.bias||(Ta(e.primary().head,t.sel.primary().head)<0?-1:1);pe(t,me(t,e,r,!0));n&&n.scroll===!1||!t.cm||kr(t.cm)}function pe(t,e){if(!e.equals(t.sel)){t.sel=e;if(t.cm){t.cm.curOp.updateInput=t.cm.curOp.selectionChanged=!0;po(t.cm)}co(t,"cursorActivity",t)}}function ge(t){pe(t,me(t,t.sel,null,!1),ws)}function me(t,e,n,r){for(var i,o=0;o<e.ranges.length;o++){var a=e.ranges[o],s=ve(t,a.anchor,n,r),l=ve(t,a.head,n,r);if(i||s!=a.anchor||l!=a.head){i||(i=e.ranges.slice(0,o));i[o]=new K(s,l)}}return i?Z(i,e.primIndex):e}function ve(t,e,n,r){var i=!1,o=e,a=n||1;t.cantEdit=!1;t:for(;;){var s=Ri(t,o.line);if(s.markedSpans)for(var l=0;l<s.markedSpans.length;++l){var u=s.markedSpans[l],c=u.marker;if((null==u.from||(c.inclusiveLeft?u.from<=o.ch:u.from<o.ch))&&(null==u.to||(c.inclusiveRight?u.to>=o.ch:u.to>o.ch))){if(r){vs(c,"beforeCursorEnter");if(c.explicitlyCleared){if(s.markedSpans){--l;continue}break}}if(!c.atomic)continue;var f=c.find(0>a?-1:1);if(0==Ta(f,o)){f.ch+=a;f.ch<0?f=f.line>t.first?ee(t,Sa(f.line-1)):null:f.ch>s.text.length&&(f=f.line<t.first+t.size-1?Sa(f.line+1,0):null);if(!f){if(i){if(!r)return ve(t,e,n,!0);t.cantEdit=!0;return Sa(t.first,0)}i=!0;f=e;a=-a}}o=f;continue t}}return o}}function ye(t){for(var e=t.display,n=t.doc,r={},i=r.cursors=document.createDocumentFragment(),o=r.selection=document.createDocumentFragment(),a=0;a<n.sel.ranges.length;a++){var s=n.sel.ranges[a],l=s.empty();(l||t.options.showCursorWhenSelecting)&&we(t,s,i);l||Ce(t,s,o)}if(t.options.moveInputWithCursor){var u=Ke(t,n.sel.primary().head,"div"),c=e.wrapper.getBoundingClientRect(),f=e.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(e.wrapper.clientHeight-10,u.top+f.top-c.top));r.teLeft=Math.max(0,Math.min(e.wrapper.clientWidth-10,u.left+f.left-c.left))}return r}function be(t,e){No(t.display.cursorDiv,e.cursors);No(t.display.selectionDiv,e.selection);if(null!=e.teTop){t.display.inputDiv.style.top=e.teTop+"px";t.display.inputDiv.style.left=e.teLeft+"px"}}function xe(t){be(t,ye(t))}function we(t,e,n){var r=Ke(t,e.head,"div",null,null,!t.options.singleCursorHeightPerLine),i=n.appendChild(Lo("div"," ","CodeMirror-cursor"));i.style.left=r.left+"px";i.style.top=r.top+"px";i.style.height=Math.max(0,r.bottom-r.top)*t.options.cursorHeight+"px";if(r.other){var o=n.appendChild(Lo("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));
o.style.display="";o.style.left=r.other.left+"px";o.style.top=r.other.top+"px";o.style.height=.85*(r.other.bottom-r.other.top)+"px"}}function Ce(t,e,n){function r(t,e,n,r){0>e&&(e=0);e=Math.round(e);r=Math.round(r);s.appendChild(Lo("div",null,"CodeMirror-selected","position: absolute; left: "+t+"px; top: "+e+"px; width: "+(null==n?c-t:n)+"px; height: "+(r-e)+"px"))}function i(e,n,i){function o(n,r){return Je(t,Sa(e,n),"div",f,r)}var s,l,f=Ri(a,e),h=f.text.length;qo(Vi(f),n||0,null==i?h:i,function(t,e,a){var f,d,p,g=o(t,"left");if(t==e){f=g;d=p=g.left}else{f=o(e-1,"right");if("rtl"==a){var m=g;g=f;f=m}d=g.left;p=f.right}null==n&&0==t&&(d=u);if(f.top-g.top>3){r(d,g.top,null,g.bottom);d=u;g.bottom<f.top&&r(d,g.bottom,null,f.top)}null==i&&e==h&&(p=c);(!s||g.top<s.top||g.top==s.top&&g.left<s.left)&&(s=g);(!l||f.bottom>l.bottom||f.bottom==l.bottom&&f.right>l.right)&&(l=f);u+1>d&&(d=u);r(d,f.top,p-d,f.bottom)});return{start:s,end:l}}var o=t.display,a=t.doc,s=document.createDocumentFragment(),l=Ae(t.display),u=l.left,c=Math.max(o.sizerWidth,Ee(t)-o.sizer.offsetLeft)-l.right,f=e.from(),h=e.to();if(f.line==h.line)i(f.line,f.ch,h.ch);else{var d=Ri(a,f.line),p=Ri(a,h.line),g=oi(d)==oi(p),m=i(f.line,f.ch,g?d.text.length+1:null).end,v=i(h.line,g?0:null,h.ch).start;if(g)if(m.top<v.top-2){r(m.right,m.top,null,m.bottom);r(u,v.top,v.left,v.bottom)}else r(m.right,m.top,v.left-m.right,m.bottom);m.bottom<v.top&&r(u,m.bottom,null,v.top)}n.appendChild(s)}function Se(t){if(t.state.focused){var e=t.display;clearInterval(e.blinker);var n=!0;e.cursorDiv.style.visibility="";t.options.cursorBlinkRate>0?e.blinker=setInterval(function(){e.cursorDiv.style.visibility=(n=!n)?"":"hidden"},t.options.cursorBlinkRate):t.options.cursorBlinkRate<0&&(e.cursorDiv.style.visibility="hidden")}}function Te(t,e){t.doc.mode.startState&&t.doc.frontier<t.display.viewTo&&t.state.highlight.set(e,ko(ke,t))}function ke(t){var e=t.doc;e.frontier<e.first&&(e.frontier=e.first);if(!(e.frontier>=t.display.viewTo)){var n=+new Date+t.options.workTime,r=Ga(e.mode,Me(t,e.frontier)),i=[];e.iter(e.frontier,Math.min(e.first+e.size,t.display.viewTo+500),function(o){if(e.frontier>=t.display.viewFrom){var a=o.styles,s=wi(t,o,r,!0);o.styles=s.styles;var l=o.styleClasses,u=s.classes;u?o.styleClasses=u:l&&(o.styleClasses=null);for(var c=!a||a.length!=o.styles.length||l!=u&&(!l||!u||l.bgClass!=u.bgClass||l.textClass!=u.textClass),f=0;!c&&f<a.length;++f)c=a[f]!=o.styles[f];c&&i.push(e.frontier);o.stateAfter=Ga(e.mode,r)}else{Si(t,o.text,r);o.stateAfter=e.frontier%5==0?Ga(e.mode,r):null}++e.frontier;if(+new Date>n){Te(t,t.options.workDelay);return!0}});i.length&&pn(t,function(){for(var e=0;e<i.length;e++)wn(t,i[e],"text")})}}function _e(t,e,n){for(var r,i,o=t.doc,a=n?-1:e-(t.doc.mode.innerMode?1e3:100),s=e;s>a;--s){if(s<=o.first)return o.first;var l=Ri(o,s-1);if(l.stateAfter&&(!n||s<=o.frontier))return s;var u=Ts(l.text,null,t.options.tabSize);if(null==i||r>u){i=s-1;r=u}}return i}function Me(t,e,n){var r=t.doc,i=t.display;if(!r.mode.startState)return!0;var o=_e(t,e,n),a=o>r.first&&Ri(r,o-1).stateAfter;a=a?Ga(r.mode,a):$a(r.mode);r.iter(o,e,function(n){Si(t,n.text,a);var s=o==e-1||o%5==0||o>=i.viewFrom&&o<i.viewTo;n.stateAfter=s?Ga(r.mode,a):null;++o});n&&(r.frontier=o);return a}function De(t){return t.lineSpace.offsetTop}function Le(t){return t.mover.offsetHeight-t.lineSpace.offsetHeight}function Ae(t){if(t.cachedPaddingH)return t.cachedPaddingH;var e=No(t.measure,Lo("pre","x")),n=window.getComputedStyle?window.getComputedStyle(e):e.currentStyle,r={left:parseInt(n.paddingLeft),right:parseInt(n.paddingRight)};isNaN(r.left)||isNaN(r.right)||(t.cachedPaddingH=r);return r}function Ne(t){return bs-t.display.nativeBarWidth}function Ee(t){return t.display.scroller.clientWidth-Ne(t)-t.display.barWidth}function je(t){return t.display.scroller.clientHeight-Ne(t)-t.display.barHeight}function Ie(t,e,n){var r=t.options.lineWrapping,i=r&&Ee(t);if(!e.measure.heights||r&&e.measure.width!=i){var o=e.measure.heights=[];if(r){e.measure.width=i;for(var a=e.text.firstChild.getClientRects(),s=0;s<a.length-1;s++){var l=a[s],u=a[s+1];Math.abs(l.bottom-u.bottom)>2&&o.push((l.bottom+u.top)/2-n.top)}}o.push(n.bottom-n.top)}}function Pe(t,e,n){if(t.line==e)return{map:t.measure.map,cache:t.measure.cache};for(var r=0;r<t.rest.length;r++)if(t.rest[r]==e)return{map:t.measure.maps[r],cache:t.measure.caches[r]};for(var r=0;r<t.rest.length;r++)if(qi(t.rest[r])>n)return{map:t.measure.maps[r],cache:t.measure.caches[r],before:!0}}function He(t,e){e=oi(e);var n=qi(e),r=t.display.externalMeasured=new yn(t.doc,e,n);r.lineN=n;var i=r.built=ki(t,r);r.text=i.pre;No(t.display.lineMeasure,i.pre);return r}function Oe(t,e,n,r){return We(t,Fe(t,e),n,r)}function Re(t,e){if(e>=t.display.viewFrom&&e<t.display.viewTo)return t.display.view[Sn(t,e)];var n=t.display.externalMeasured;return n&&e>=n.lineN&&e<n.lineN+n.size?n:void 0}function Fe(t,e){var n=qi(e),r=Re(t,n);r&&!r.text?r=null:r&&r.changes&&P(t,r,n,j(t));r||(r=He(t,e));var i=Pe(r,e,n);return{line:e,view:r,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function We(t,e,n,r,i){e.before&&(n=-1);var o,a=n+(r||"");if(e.cache.hasOwnProperty(a))o=e.cache[a];else{e.rect||(e.rect=e.view.text.getBoundingClientRect());if(!e.hasHeights){Ie(t,e.view,e.rect);e.hasHeights=!0}o=ze(t,e,n,r);o.bogus||(e.cache[a]=o)}return{left:o.left,right:o.right,top:i?o.rtop:o.top,bottom:i?o.rbottom:o.bottom}}function ze(t,e,n,r){for(var i,o,a,s,l=e.map,u=0;u<l.length;u+=3){var c=l[u],f=l[u+1];if(c>n){o=0;a=1;s="left"}else if(f>n){o=n-c;a=o+1}else if(u==l.length-3||n==f&&l[u+3]>n){a=f-c;o=a-1;n>=f&&(s="right")}if(null!=o){i=l[u+2];c==f&&r==(i.insertLeft?"left":"right")&&(s=r);if("left"==r&&0==o)for(;u&&l[u-2]==l[u-3]&&l[u-1].insertLeft;){i=l[(u-=3)+2];s="left"}if("right"==r&&o==f-c)for(;u<l.length-3&&l[u+3]==l[u+4]&&!l[u+5].insertLeft;){i=l[(u+=3)+2];s="right"}break}}var h;if(3==i.nodeType){for(var u=0;4>u;u++){for(;o&&Do(e.line.text.charAt(c+o));)--o;for(;f>c+a&&Do(e.line.text.charAt(c+a));)++a;if(ia&&9>oa&&0==o&&a==f-c)h=i.parentNode.getBoundingClientRect();else if(ia&&t.options.lineWrapping){var d=Ms(i,o,a).getClientRects();h=d.length?d["right"==r?d.length-1:0]:Da}else h=Ms(i,o,a).getBoundingClientRect()||Da;if(h.left||h.right||0==o)break;a=o;o-=1;s="right"}ia&&11>oa&&(h=qe(t.display.measure,h))}else{o>0&&(s=r="right");var d;h=t.options.lineWrapping&&(d=i.getClientRects()).length>1?d["right"==r?d.length-1:0]:i.getBoundingClientRect()}if(ia&&9>oa&&!o&&(!h||!h.left&&!h.right)){var p=i.parentNode.getClientRects()[0];h=p?{left:p.left,right:p.left+rn(t.display),top:p.top,bottom:p.bottom}:Da}for(var g=h.top-e.rect.top,m=h.bottom-e.rect.top,v=(g+m)/2,y=e.view.measure.heights,u=0;u<y.length-1&&!(v<y[u]);u++);var b=u?y[u-1]:0,x=y[u],w={left:("right"==s?h.right:h.left)-e.rect.left,right:("left"==s?h.left:h.right)-e.rect.left,top:b,bottom:x};h.left||h.right||(w.bogus=!0);if(!t.options.singleCursorHeightPerLine){w.rtop=g;w.rbottom=m}return w}function qe(t,e){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!zo(t))return e;var n=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:e.left*n,right:e.right*n,top:e.top*r,bottom:e.bottom*r}}function Ue(t){if(t.measure){t.measure.cache={};t.measure.heights=null;if(t.rest)for(var e=0;e<t.rest.length;e++)t.measure.caches[e]={}}}function Be(t){t.display.externalMeasure=null;Ao(t.display.lineMeasure);for(var e=0;e<t.display.view.length;e++)Ue(t.display.view[e])}function Ve(t){Be(t);t.display.cachedCharWidth=t.display.cachedTextHeight=t.display.cachedPaddingH=null;t.options.lineWrapping||(t.display.maxLineChanged=!0);t.display.lineNumChars=null}function Xe(){return window.pageXOffset||(document.documentElement||document.body).scrollLeft}function Ge(){return window.pageYOffset||(document.documentElement||document.body).scrollTop}function $e(t,e,n,r){if(e.widgets)for(var i=0;i<e.widgets.length;++i)if(e.widgets[i].above){var o=hi(e.widgets[i]);n.top+=o;n.bottom+=o}if("line"==r)return n;r||(r="local");var a=Bi(e);"local"==r?a+=De(t.display):a-=t.display.viewOffset;if("page"==r||"window"==r){var s=t.display.lineSpace.getBoundingClientRect();a+=s.top+("window"==r?0:Ge());var l=s.left+("window"==r?0:Xe());n.left+=l;n.right+=l}n.top+=a;n.bottom+=a;return n}function Ye(t,e,n){if("div"==n)return e;var r=e.left,i=e.top;if("page"==n){r-=Xe();i-=Ge()}else if("local"==n||!n){var o=t.display.sizer.getBoundingClientRect();r+=o.left;i+=o.top}var a=t.display.lineSpace.getBoundingClientRect();return{left:r-a.left,top:i-a.top}}function Je(t,e,n,r,i){r||(r=Ri(t.doc,e.line));return $e(t,r,Oe(t,r,e.ch,i),n)}function Ke(t,e,n,r,i,o){function a(e,a){var s=We(t,i,e,a?"right":"left",o);a?s.left=s.right:s.right=s.left;return $e(t,r,s,n)}function s(t,e){var n=l[e],r=n.level%2;if(t==Uo(n)&&e&&n.level<l[e-1].level){n=l[--e];t=Bo(n)-(n.level%2?0:1);r=!0}else if(t==Bo(n)&&e<l.length-1&&n.level<l[e+1].level){n=l[++e];t=Uo(n)-n.level%2;r=!1}return r&&t==n.to&&t>n.from?a(t-1):a(t,r)}r=r||Ri(t.doc,e.line);i||(i=Fe(t,r));var l=Vi(r),u=e.ch;if(!l)return a(u);var c=Ko(l,u),f=s(u,c);null!=qs&&(f.other=s(u,qs));return f}function Ze(t,e){var n=0,e=ee(t.doc,e);t.options.lineWrapping||(n=rn(t.display)*e.ch);var r=Ri(t.doc,e.line),i=Bi(r)+De(t.display);return{left:n,right:n,top:i,bottom:i+r.height}}function Qe(t,e,n,r){var i=Sa(t,e);i.xRel=r;n&&(i.outside=!0);return i}function tn(t,e,n){var r=t.doc;n+=t.display.viewOffset;if(0>n)return Qe(r.first,0,!0,-1);var i=Ui(r,n),o=r.first+r.size-1;if(i>o)return Qe(r.first+r.size-1,Ri(r,o).text.length,!0,1);0>e&&(e=0);for(var a=Ri(r,i);;){var s=en(t,a,i,e,n),l=ri(a),u=l&&l.find(0,!0);if(!l||!(s.ch>u.from.ch||s.ch==u.from.ch&&s.xRel>0))return s;i=qi(a=u.to.line)}}function en(t,e,n,r,i){function o(r){var i=Ke(t,Sa(n,r),"line",e,u);s=!0;if(a>i.bottom)return i.left-l;if(a<i.top)return i.left+l;s=!1;return i.left}var a=i-Bi(e),s=!1,l=2*t.display.wrapper.clientWidth,u=Fe(t,e),c=Vi(e),f=e.text.length,h=Vo(e),d=Xo(e),p=o(h),g=s,m=o(d),v=s;if(r>m)return Qe(n,d,v,1);for(;;){if(c?d==h||d==Qo(e,h,1):1>=d-h){for(var y=p>r||m-r>=r-p?h:d,b=r-(y==h?p:m);Do(e.text.charAt(y));)++y;var x=Qe(n,y,y==h?g:v,-1>b?-1:b>1?1:0);return x}var w=Math.ceil(f/2),C=h+w;if(c){C=h;for(var S=0;w>S;++S)C=Qo(e,C,1)}var T=o(C);if(T>r){d=C;m=T;(v=s)&&(m+=1e3);f=w}else{h=C;p=T;g=s;f-=w}}}function nn(t){if(null!=t.cachedTextHeight)return t.cachedTextHeight;if(null==ka){ka=Lo("pre");for(var e=0;49>e;++e){ka.appendChild(document.createTextNode("x"));ka.appendChild(Lo("br"))}ka.appendChild(document.createTextNode("x"))}No(t.measure,ka);var n=ka.offsetHeight/50;n>3&&(t.cachedTextHeight=n);Ao(t.measure);return n||1}function rn(t){if(null!=t.cachedCharWidth)return t.cachedCharWidth;var e=Lo("span","xxxxxxxxxx"),n=Lo("pre",[e]);No(t.measure,n);var r=e.getBoundingClientRect(),i=(r.right-r.left)/10;i>2&&(t.cachedCharWidth=i);return i||10}function on(t){t.curOp={cm:t,viewChanged:!1,startHeight:t.doc.height,forceUpdate:!1,updateInput:null,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,id:++Aa};La?La.ops.push(t.curOp):t.curOp.ownsGroup=La={ops:[t.curOp],delayedCallbacks:[]}}function an(t){var e=t.delayedCallbacks,n=0;do{for(;n<e.length;n++)e[n]();for(var r=0;r<t.ops.length;r++){var i=t.ops[r];if(i.cursorActivityHandlers)for(;i.cursorActivityCalled<i.cursorActivityHandlers.length;)i.cursorActivityHandlers[i.cursorActivityCalled++](i.cm)}}while(n<e.length)}function sn(t){var e=t.curOp,n=e.ownsGroup;if(n)try{an(n)}finally{La=null;for(var r=0;r<n.ops.length;r++)n.ops[r].cm.curOp=null;ln(n)}}function ln(t){for(var e=t.ops,n=0;n<e.length;n++)un(e[n]);for(var n=0;n<e.length;n++)cn(e[n]);for(var n=0;n<e.length;n++)fn(e[n]);for(var n=0;n<e.length;n++)hn(e[n]);for(var n=0;n<e.length;n++)dn(e[n])}function un(t){var e=t.cm,n=e.display;_(e);t.updateMaxLine&&h(e);t.mustUpdate=t.viewChanged||t.forceUpdate||null!=t.scrollTop||t.scrollToPos&&(t.scrollToPos.from.line<n.viewFrom||t.scrollToPos.to.line>=n.viewTo)||n.maxLineChanged&&e.options.lineWrapping;t.update=t.mustUpdate&&new k(e,t.mustUpdate&&{top:t.scrollTop,ensure:t.scrollToPos},t.forceUpdate)}function cn(t){t.updatedDisplay=t.mustUpdate&&M(t.cm,t.update)}function fn(t){var e=t.cm,n=e.display;t.updatedDisplay&&N(e);t.barMeasure=p(e);if(n.maxLineChanged&&!e.options.lineWrapping){t.adjustWidthTo=Oe(e,n.maxLine,n.maxLine.text.length).left+3;e.display.sizerWidth=t.adjustWidthTo;t.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+t.adjustWidthTo+Ne(e)+e.display.barWidth);t.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+t.adjustWidthTo-Ee(e))}(t.updatedDisplay||t.selectionChanged)&&(t.newSelectionNodes=ye(e))}function hn(t){var e=t.cm;if(null!=t.adjustWidthTo){e.display.sizer.style.minWidth=t.adjustWidthTo+"px";t.maxScrollLeft<e.doc.scrollLeft&&Gn(e,Math.min(e.display.scroller.scrollLeft,t.maxScrollLeft),!0);e.display.maxLineChanged=!1}t.newSelectionNodes&&be(e,t.newSelectionNodes);t.updatedDisplay&&A(e,t.barMeasure);(t.updatedDisplay||t.startHeight!=e.doc.height)&&y(e,t.barMeasure);t.selectionChanged&&Se(e);e.state.focused&&t.updateInput&&An(e,t.typing)}function dn(t){var e=t.cm,n=e.display,r=e.doc;t.updatedDisplay&&D(e,t.update);null==n.wheelStartX||null==t.scrollTop&&null==t.scrollLeft&&!t.scrollToPos||(n.wheelStartX=n.wheelStartY=null);if(null!=t.scrollTop&&(n.scroller.scrollTop!=t.scrollTop||t.forceScroll)){r.scrollTop=Math.max(0,Math.min(n.scroller.scrollHeight-n.scroller.clientHeight,t.scrollTop));n.scrollbars.setScrollTop(r.scrollTop);n.scroller.scrollTop=r.scrollTop}if(null!=t.scrollLeft&&(n.scroller.scrollLeft!=t.scrollLeft||t.forceScroll)){r.scrollLeft=Math.max(0,Math.min(n.scroller.scrollWidth-Ee(e),t.scrollLeft));n.scrollbars.setScrollLeft(r.scrollLeft);n.scroller.scrollLeft=r.scrollLeft;w(e)}if(t.scrollToPos){var i=wr(e,ee(r,t.scrollToPos.from),ee(r,t.scrollToPos.to),t.scrollToPos.margin);t.scrollToPos.isCursor&&e.state.focused&&xr(e,i)}var o=t.maybeHiddenMarkers,a=t.maybeUnhiddenMarkers;if(o)for(var s=0;s<o.length;++s)o[s].lines.length||vs(o[s],"hide");if(a)for(var s=0;s<a.length;++s)a[s].lines.length&&vs(a[s],"unhide");n.wrapper.offsetHeight&&(r.scrollTop=e.display.scroller.scrollTop);t.changeObjs&&vs(e,"changes",e,t.changeObjs)}function pn(t,e){if(t.curOp)return e();on(t);try{return e()}finally{sn(t)}}function gn(t,e){return function(){if(t.curOp)return e.apply(t,arguments);on(t);try{return e.apply(t,arguments)}finally{sn(t)}}}function mn(t){return function(){if(this.curOp)return t.apply(this,arguments);on(this);try{return t.apply(this,arguments)}finally{sn(this)}}}function vn(t){return function(){var e=this.cm;if(!e||e.curOp)return t.apply(this,arguments);on(e);try{return t.apply(this,arguments)}finally{sn(e)}}}function yn(t,e,n){this.line=e;this.rest=ai(e);this.size=this.rest?qi(xo(this.rest))-n+1:1;this.node=this.text=null;this.hidden=ui(t,e)}function bn(t,e,n){for(var r,i=[],o=e;n>o;o=r){var a=new yn(t.doc,Ri(t.doc,o),o);r=o+a.size;i.push(a)}return i}function xn(t,e,n,r){null==e&&(e=t.doc.first);null==n&&(n=t.doc.first+t.doc.size);r||(r=0);var i=t.display;r&&n<i.viewTo&&(null==i.updateLineNumbers||i.updateLineNumbers>e)&&(i.updateLineNumbers=e);t.curOp.viewChanged=!0;if(e>=i.viewTo)Ca&&si(t.doc,e)<i.viewTo&&Cn(t);else if(n<=i.viewFrom)if(Ca&&li(t.doc,n+r)>i.viewFrom)Cn(t);else{i.viewFrom+=r;i.viewTo+=r}else if(e<=i.viewFrom&&n>=i.viewTo)Cn(t);else if(e<=i.viewFrom){var o=Tn(t,n,n+r,1);if(o){i.view=i.view.slice(o.index);i.viewFrom=o.lineN;i.viewTo+=r}else Cn(t)}else if(n>=i.viewTo){var o=Tn(t,e,e,-1);if(o){i.view=i.view.slice(0,o.index);i.viewTo=o.lineN}else Cn(t)}else{var a=Tn(t,e,e,-1),s=Tn(t,n,n+r,1);if(a&&s){i.view=i.view.slice(0,a.index).concat(bn(t,a.lineN,s.lineN)).concat(i.view.slice(s.index));i.viewTo+=r}else Cn(t)}var l=i.externalMeasured;l&&(n<l.lineN?l.lineN+=r:e<l.lineN+l.size&&(i.externalMeasured=null))}function wn(t,e,n){t.curOp.viewChanged=!0;var r=t.display,i=t.display.externalMeasured;i&&e>=i.lineN&&e<i.lineN+i.size&&(r.externalMeasured=null);if(!(e<r.viewFrom||e>=r.viewTo)){var o=r.view[Sn(t,e)];if(null!=o.node){var a=o.changes||(o.changes=[]);-1==wo(a,n)&&a.push(n)}}}function Cn(t){t.display.viewFrom=t.display.viewTo=t.doc.first;t.display.view=[];t.display.viewOffset=0}function Sn(t,e){if(e>=t.display.viewTo)return null;e-=t.display.viewFrom;if(0>e)return null;for(var n=t.display.view,r=0;r<n.length;r++){e-=n[r].size;if(0>e)return r}}function Tn(t,e,n,r){var i,o=Sn(t,e),a=t.display.view;if(!Ca||n==t.doc.first+t.doc.size)return{index:o,lineN:n};for(var s=0,l=t.display.viewFrom;o>s;s++)l+=a[s].size;if(l!=e){if(r>0){if(o==a.length-1)return null;i=l+a[o].size-e;o++}else i=l-e;e+=i;n+=i}for(;si(t.doc,n)!=n;){if(o==(0>r?0:a.length-1))return null;n+=r*a[o-(0>r?1:0)].size;o+=r}return{index:o,lineN:n}}function kn(t,e,n){var r=t.display,i=r.view;if(0==i.length||e>=r.viewTo||n<=r.viewFrom){r.view=bn(t,e,n);r.viewFrom=e}else{r.viewFrom>e?r.view=bn(t,e,r.viewFrom).concat(r.view):r.viewFrom<e&&(r.view=r.view.slice(Sn(t,e)));r.viewFrom=e;r.viewTo<n?r.view=r.view.concat(bn(t,r.viewTo,n)):r.viewTo>n&&(r.view=r.view.slice(0,Sn(t,n)))}r.viewTo=n}function _n(t){for(var e=t.display.view,n=0,r=0;r<e.length;r++){var i=e[r];i.hidden||i.node&&!i.changes||++n}return n}function Mn(t){t.display.pollingFast||t.display.poll.set(t.options.pollInterval,function(){Ln(t);t.state.focused&&Mn(t)})}function Dn(t){function e(){var r=Ln(t);if(r||n){t.display.pollingFast=!1;Mn(t)}else{n=!0;t.display.poll.set(60,e)}}var n=!1;t.display.pollingFast=!0;t.display.poll.set(20,e)}function Ln(t){var e=t.display.input,n=t.display.prevInput,r=t.doc;if(!t.state.focused||Rs(e)&&!n||jn(t)||t.options.disableInput||t.state.keySeq)return!1;if(t.state.pasteIncoming&&t.state.fakedLastChar){e.value=e.value.substring(0,e.value.length-1);t.state.fakedLastChar=!1}var i=e.value;if(i==n&&!t.somethingSelected())return!1;if(ia&&oa>=9&&t.display.inputHasSelection===i||ma&&/[\uf700-\uf7ff]/.test(i)){An(t);return!1}var o=!t.curOp;o&&on(t);t.display.shift=!1;8203!=i.charCodeAt(0)||r.sel!=t.display.selForContextMenu||n||(n="");for(var a=0,s=Math.min(n.length,i.length);s>a&&n.charCodeAt(a)==i.charCodeAt(a);)++a;var l=i.slice(a),u=Os(l),c=null;t.state.pasteIncoming&&r.sel.ranges.length>1&&(Na&&Na.join("\n")==l?c=r.sel.ranges.length%Na.length==0&&Co(Na,Os):u.length==r.sel.ranges.length&&(c=Co(u,function(t){return[t]})));for(var f=r.sel.ranges.length-1;f>=0;f--){var h=r.sel.ranges[f],d=h.from(),p=h.to();a<n.length?d=Sa(d.line,d.ch-(n.length-a)):t.state.overwrite&&h.empty()&&!t.state.pasteIncoming&&(p=Sa(p.line,Math.min(Ri(r,p.line).text.length,p.ch+xo(u).length)));var g=t.curOp.updateInput,m={from:d,to:p,text:c?c[f%c.length]:u,origin:t.state.pasteIncoming?"paste":t.state.cutIncoming?"cut":"+input"};dr(t.doc,m);co(t,"inputRead",t,m);if(l&&!t.state.pasteIncoming&&t.options.electricChars&&t.options.smartIndent&&h.head.ch<100&&(!f||r.sel.ranges[f-1].head.line!=h.head.line)){var v=t.getModeAt(h.head),y=Ra(m);if(v.electricChars){for(var b=0;b<v.electricChars.length;b++)if(l.indexOf(v.electricChars.charAt(b))>-1){Mr(t,y.line,"smart");break}}else v.electricInput&&v.electricInput.test(Ri(r,y.line).text.slice(0,y.ch))&&Mr(t,y.line,"smart")}}kr(t);t.curOp.updateInput=g;t.curOp.typing=!0;i.length>1e3||i.indexOf("\n")>-1?e.value=t.display.prevInput="":t.display.prevInput=i;o&&sn(t);t.state.pasteIncoming=t.state.cutIncoming=!1;return!0}function An(t,e){if(!t.display.contextMenuPending){var n,r,i=t.doc;if(t.somethingSelected()){t.display.prevInput="";var o=i.sel.primary();n=Fs&&(o.to().line-o.from().line>100||(r=t.getSelection()).length>1e3);var a=n?"-":r||t.getSelection();t.display.input.value=a;t.state.focused&&_s(t.display.input);ia&&oa>=9&&(t.display.inputHasSelection=a)}else if(!e){t.display.prevInput=t.display.input.value="";ia&&oa>=9&&(t.display.inputHasSelection=null)}t.display.inaccurateSelection=n}}function Nn(t){"nocursor"==t.options.readOnly||ga&&jo()==t.display.input||t.display.input.focus()}function En(t){if(!t.state.focused){Nn(t);ir(t)}}function jn(t){return t.options.readOnly||t.doc.cantEdit}function In(t){function e(e){ho(t,e)||ps(e)}function n(e){if(t.somethingSelected()){Na=t.getSelections();if(r.inaccurateSelection){r.prevInput="";r.inaccurateSelection=!1;r.input.value=Na.join("\n");_s(r.input)}}else{for(var n=[],i=[],o=0;o<t.doc.sel.ranges.length;o++){var a=t.doc.sel.ranges[o].head.line,s={anchor:Sa(a,0),head:Sa(a+1,0)};i.push(s);n.push(t.getRange(s.anchor,s.head))}if("cut"==e.type)t.setSelections(i,null,ws);else{r.prevInput="";r.input.value=n.join("\n");_s(r.input)}Na=n}"cut"==e.type&&(t.state.cutIncoming=!0)}var r=t.display;gs(r.scroller,"mousedown",gn(t,Rn));ia&&11>oa?gs(r.scroller,"dblclick",gn(t,function(e){if(!ho(t,e)){var n=On(t,e);if(n&&!Un(t,e)&&!Hn(t.display,e)){hs(e);var r=t.findWordAt(n);ae(t.doc,r.anchor,r.head)}}})):gs(r.scroller,"dblclick",function(e){ho(t,e)||hs(e)});gs(r.lineSpace,"selectstart",function(t){Hn(r,t)||hs(t)});xa||gs(r.scroller,"contextmenu",function(e){ar(t,e)});gs(r.scroller,"scroll",function(){if(r.scroller.clientHeight){Xn(t,r.scroller.scrollTop);Gn(t,r.scroller.scrollLeft,!0);vs(t,"scroll",t)}});gs(r.scroller,"mousewheel",function(e){$n(t,e)});gs(r.scroller,"DOMMouseScroll",function(e){$n(t,e)});gs(r.wrapper,"scroll",function(){r.wrapper.scrollTop=r.wrapper.scrollLeft=0});gs(r.input,"keyup",function(e){nr.call(t,e)});gs(r.input,"input",function(){ia&&oa>=9&&t.display.inputHasSelection&&(t.display.inputHasSelection=null);Ln(t)});gs(r.input,"keydown",gn(t,tr));gs(r.input,"keypress",gn(t,rr));gs(r.input,"focus",ko(ir,t));gs(r.input,"blur",ko(or,t));if(t.options.dragDrop){gs(r.scroller,"dragstart",function(e){Vn(t,e)});gs(r.scroller,"dragenter",e);gs(r.scroller,"dragover",e);gs(r.scroller,"drop",gn(t,Bn))}gs(r.scroller,"paste",function(e){if(!Hn(r,e)){t.state.pasteIncoming=!0;Nn(t);Dn(t)}});gs(r.input,"paste",function(){if(aa&&!t.state.fakedLastChar&&!(new Date-t.state.lastMiddleDown<200)){var e=r.input.selectionStart,n=r.input.selectionEnd;r.input.value+="$";r.input.selectionEnd=n;r.input.selectionStart=e;t.state.fakedLastChar=!0}t.state.pasteIncoming=!0;Dn(t)});gs(r.input,"cut",n);gs(r.input,"copy",n);fa&&gs(r.sizer,"mouseup",function(){jo()==r.input&&r.input.blur();Nn(t)})}function Pn(t){var e=t.display;if(e.lastWrapHeight!=e.wrapper.clientHeight||e.lastWrapWidth!=e.wrapper.clientWidth){e.cachedCharWidth=e.cachedTextHeight=e.cachedPaddingH=null;e.scrollbarsClipped=!1;t.setSize()}}function Hn(t,e){for(var n=lo(e);n!=t.wrapper;n=n.parentNode)if(!n||1==n.nodeType&&"true"==n.getAttribute("cm-ignore-events")||n.parentNode==t.sizer&&n!=t.mover)return!0}function On(t,e,n,r){var i=t.display;if(!n&&"true"==lo(e).getAttribute("not-content"))return null;var o,a,s=i.lineSpace.getBoundingClientRect();try{o=e.clientX-s.left;a=e.clientY-s.top}catch(e){return null}var l,u=tn(t,o,a);if(r&&1==u.xRel&&(l=Ri(t.doc,u.line).text).length==u.ch){var c=Ts(l,l.length,t.options.tabSize)-l.length;u=Sa(u.line,Math.max(0,Math.round((o-Ae(t.display).left)/rn(t.display))-c))}return u}function Rn(t){if(!ho(this,t)){var e=this,n=e.display;n.shift=t.shiftKey;if(Hn(n,t)){if(!aa){n.scroller.draggable=!1;setTimeout(function(){n.scroller.draggable=!0},100)}}else if(!Un(e,t)){var r=On(e,t);window.focus();switch(uo(t)){case 1:r?Fn(e,t,r):lo(t)==n.scroller&&hs(t);break;case 2:aa&&(e.state.lastMiddleDown=+new Date);r&&ae(e.doc,r);setTimeout(ko(Nn,e),20);hs(t);break;case 3:xa&&ar(e,t)}}}}function Fn(t,e,n){setTimeout(ko(En,t),0);var r,i=+new Date;if(Ma&&Ma.time>i-400&&0==Ta(Ma.pos,n))r="triple";else if(_a&&_a.time>i-400&&0==Ta(_a.pos,n)){r="double";Ma={time:i,pos:n}}else{r="single";_a={time:i,pos:n}}var o,a=t.doc.sel,s=ma?e.metaKey:e.ctrlKey;t.options.dragDrop&&Hs&&!jn(t)&&"single"==r&&(o=a.contains(n))>-1&&!a.ranges[o].empty()?Wn(t,e,n,s):zn(t,e,n,r,s)}function Wn(t,e,n,r){var i=t.display,o=gn(t,function(a){aa&&(i.scroller.draggable=!1);t.state.draggingText=!1;ms(document,"mouseup",o);ms(i.scroller,"drop",o);if(Math.abs(e.clientX-a.clientX)+Math.abs(e.clientY-a.clientY)<10){hs(a);r||ae(t.doc,n);Nn(t);ia&&9==oa&&setTimeout(function(){document.body.focus();Nn(t)},20)}});aa&&(i.scroller.draggable=!0);t.state.draggingText=o;i.scroller.dragDrop&&i.scroller.dragDrop();gs(document,"mouseup",o);gs(i.scroller,"drop",o)}function zn(t,e,n,r,i){function o(e){if(0!=Ta(m,e)){m=e;if("rect"==r){for(var i=[],o=t.options.tabSize,a=Ts(Ri(u,n.line).text,n.ch,o),s=Ts(Ri(u,e.line).text,e.ch,o),l=Math.min(a,s),d=Math.max(a,s),p=Math.min(n.line,e.line),g=Math.min(t.lastLine(),Math.max(n.line,e.line));g>=p;p++){var v=Ri(u,p).text,y=yo(v,l,o);l==d?i.push(new K(Sa(p,y),Sa(p,y))):v.length>y&&i.push(new K(Sa(p,y),Sa(p,yo(v,d,o))))}i.length||i.push(new K(n,n));he(u,Z(h.ranges.slice(0,f).concat(i),f),{origin:"*mouse",scroll:!1});t.scrollIntoView(e)}else{var b=c,x=b.anchor,w=e;if("single"!=r){if("double"==r)var C=t.findWordAt(e);else var C=new K(Sa(e.line,0),ee(u,Sa(e.line+1,0)));if(Ta(C.anchor,x)>0){w=C.head;x=Y(b.from(),C.anchor)}else{w=C.anchor;x=$(b.to(),C.head)}}var i=h.ranges.slice(0);i[f]=new K(ee(u,x),w);he(u,Z(i,f),Cs)}}}function a(e){var n=++y,i=On(t,e,!0,"rect"==r);if(i)if(0!=Ta(i,m)){En(t);o(i);var s=x(l,u);(i.line>=s.to||i.line<s.from)&&setTimeout(gn(t,function(){y==n&&a(e)}),150)}else{var c=e.clientY<v.top?-20:e.clientY>v.bottom?20:0;c&&setTimeout(gn(t,function(){if(y==n){l.scroller.scrollTop+=c;a(e)}}),50)}}function s(e){y=1/0;hs(e);Nn(t);ms(document,"mousemove",b);ms(document,"mouseup",w);u.history.lastSelOrigin=null}var l=t.display,u=t.doc;hs(e);var c,f,h=u.sel,d=h.ranges;if(i&&!e.shiftKey){f=u.sel.contains(n);c=f>-1?d[f]:new K(n,n)}else c=u.sel.primary();if(e.altKey){r="rect";i||(c=new K(n,n));n=On(t,e,!0,!0);f=-1}else if("double"==r){var p=t.findWordAt(n);c=t.display.shift||u.extend?oe(u,c,p.anchor,p.head):p}else if("triple"==r){var g=new K(Sa(n.line,0),ee(u,Sa(n.line+1,0)));c=t.display.shift||u.extend?oe(u,c,g.anchor,g.head):g}else c=oe(u,c,n);if(i)if(-1==f){f=d.length;he(u,Z(d.concat([c]),f),{scroll:!1,origin:"*mouse"})}else if(d.length>1&&d[f].empty()&&"single"==r){he(u,Z(d.slice(0,f).concat(d.slice(f+1)),0));h=u.sel}else le(u,f,c,Cs);else{f=0;he(u,new J([c],0),Cs);h=u.sel}var m=n,v=l.wrapper.getBoundingClientRect(),y=0,b=gn(t,function(t){uo(t)?a(t):s(t)}),w=gn(t,s);gs(document,"mousemove",b);gs(document,"mouseup",w)}function qn(t,e,n,r,i){try{var o=e.clientX,a=e.clientY}catch(e){return!1}if(o>=Math.floor(t.display.gutters.getBoundingClientRect().right))return!1;r&&hs(e);var s=t.display,l=s.lineDiv.getBoundingClientRect();if(a>l.bottom||!go(t,n))return so(e);a-=l.top-s.viewOffset;for(var u=0;u<t.options.gutters.length;++u){var c=s.gutters.childNodes[u];if(c&&c.getBoundingClientRect().right>=o){var f=Ui(t.doc,a),h=t.options.gutters[u];i(t,n,t,f,h,e);return so(e)}}}function Un(t,e){return qn(t,e,"gutterClick",!0,co)}function Bn(t){var e=this;if(!ho(e,t)&&!Hn(e.display,t)){hs(t);ia&&(Ea=+new Date);var n=On(e,t,!0),r=t.dataTransfer.files;if(n&&!jn(e))if(r&&r.length&&window.FileReader&&window.File)for(var i=r.length,o=Array(i),a=0,s=function(t,r){var s=new FileReader;s.onload=gn(e,function(){o[r]=s.result;if(++a==i){n=ee(e.doc,n);var t={from:n,to:n,text:Os(o.join("\n")),origin:"paste"};dr(e.doc,t);fe(e.doc,Q(n,Ra(t)))}});s.readAsText(t)},l=0;i>l;++l)s(r[l],l);else{if(e.state.draggingText&&e.doc.sel.contains(n)>-1){e.state.draggingText(t);setTimeout(ko(Nn,e),20);return}try{var o=t.dataTransfer.getData("Text");if(o){if(e.state.draggingText&&!(ma?t.metaKey:t.ctrlKey))var u=e.listSelections();de(e.doc,Q(n,n));if(u)for(var l=0;l<u.length;++l)br(e.doc,"",u[l].anchor,u[l].head,"drag");e.replaceSelection(o,"around","paste");Nn(e)}}catch(t){}}}}function Vn(t,e){if(ia&&(!t.state.draggingText||+new Date-Ea<100))ps(e);else if(!ho(t,e)&&!Hn(t.display,e)){e.dataTransfer.setData("Text",t.getSelection());if(e.dataTransfer.setDragImage&&!ca){var n=Lo("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";if(ua){n.width=n.height=1;t.display.wrapper.appendChild(n);n._top=n.offsetTop}e.dataTransfer.setDragImage(n,0,0);ua&&n.parentNode.removeChild(n)}}}function Xn(t,e){if(!(Math.abs(t.doc.scrollTop-e)<2)){t.doc.scrollTop=e;ea||L(t,{top:e});t.display.scroller.scrollTop!=e&&(t.display.scroller.scrollTop=e);t.display.scrollbars.setScrollTop(e);ea&&L(t);Te(t,100)}}function Gn(t,e,n){if(!(n?e==t.doc.scrollLeft:Math.abs(t.doc.scrollLeft-e)<2)){e=Math.min(e,t.display.scroller.scrollWidth-t.display.scroller.clientWidth);t.doc.scrollLeft=e;w(t);t.display.scroller.scrollLeft!=e&&(t.display.scroller.scrollLeft=e);t.display.scrollbars.setScrollLeft(e)}}function $n(t,e){var n=Pa(e),r=n.x,i=n.y,o=t.display,a=o.scroller;if(r&&a.scrollWidth>a.clientWidth||i&&a.scrollHeight>a.clientHeight){if(i&&ma&&aa)t:for(var s=e.target,l=o.view;s!=a;s=s.parentNode)for(var u=0;u<l.length;u++)if(l[u].node==s){t.display.currentWheelTarget=s;break t}if(!r||ea||ua||null==Ia){if(i&&null!=Ia){var c=i*Ia,f=t.doc.scrollTop,h=f+o.wrapper.clientHeight;0>c?f=Math.max(0,f+c-50):h=Math.min(t.doc.height,h+c+50);L(t,{top:f,bottom:h})}if(20>ja)if(null==o.wheelStartX){o.wheelStartX=a.scrollLeft;o.wheelStartY=a.scrollTop;o.wheelDX=r;o.wheelDY=i;setTimeout(function(){if(null!=o.wheelStartX){var t=a.scrollLeft-o.wheelStartX,e=a.scrollTop-o.wheelStartY,n=e&&o.wheelDY&&e/o.wheelDY||t&&o.wheelDX&&t/o.wheelDX;o.wheelStartX=o.wheelStartY=null;if(n){Ia=(Ia*ja+n)/(ja+1);++ja}}},200)}else{o.wheelDX+=r;o.wheelDY+=i}}else{i&&Xn(t,Math.max(0,Math.min(a.scrollTop+i*Ia,a.scrollHeight-a.clientHeight)));Gn(t,Math.max(0,Math.min(a.scrollLeft+r*Ia,a.scrollWidth-a.clientWidth)));hs(e);o.wheelStartX=null}}}function Yn(t,e,n){if("string"==typeof e){e=Ya[e];if(!e)return!1}t.display.pollingFast&&Ln(t)&&(t.display.pollingFast=!1);var r=t.display.shift,i=!1;try{jn(t)&&(t.state.suppressEdits=!0);n&&(t.display.shift=!1);i=e(t)!=xs}finally{t.display.shift=r;t.state.suppressEdits=!1}return i}function Jn(t,e,n){for(var r=0;r<t.state.keyMaps.length;r++){var i=Ka(e,t.state.keyMaps[r],n,t);if(i)return i}return t.options.extraKeys&&Ka(e,t.options.extraKeys,n,t)||Ka(e,t.options.keyMap,n,t)}function Kn(t,e,n,r){var i=t.state.keySeq;if(i){if(Za(e))return"handled";Ha.set(50,function(){if(t.state.keySeq==i){t.state.keySeq=null;An(t)}});e=i+" "+e}var o=Jn(t,e,r);"multi"==o&&(t.state.keySeq=e);"handled"==o&&co(t,"keyHandled",t,e,n);if("handled"==o||"multi"==o){hs(n);Se(t)}if(i&&!o&&/\'$/.test(e)){hs(n);return!0}return!!o}function Zn(t,e){var n=Qa(e,!0);return n?e.shiftKey&&!t.state.keySeq?Kn(t,"Shift-"+n,e,function(e){return Yn(t,e,!0)})||Kn(t,n,e,function(e){return("string"==typeof e?/^go[A-Z]/.test(e):e.motion)?Yn(t,e):void 0}):Kn(t,n,e,function(e){return Yn(t,e)}):!1}function Qn(t,e,n){return Kn(t,"'"+n+"'",e,function(e){return Yn(t,e,!0)})}function tr(t){var e=this;En(e);if(!ho(e,t)){ia&&11>oa&&27==t.keyCode&&(t.returnValue=!1);var n=t.keyCode;e.display.shift=16==n||t.shiftKey;var r=Zn(e,t);if(ua){Oa=r?n:null;!r&&88==n&&!Fs&&(ma?t.metaKey:t.ctrlKey)&&e.replaceSelection("",null,"cut")}18!=n||/\bCodeMirror-crosshair\b/.test(e.display.lineDiv.className)||er(e)}}function er(t){function e(t){if(18==t.keyCode||!t.altKey){js(n,"CodeMirror-crosshair");ms(document,"keyup",e);ms(document,"mouseover",e)}}var n=t.display.lineDiv;Is(n,"CodeMirror-crosshair");gs(document,"keyup",e);gs(document,"mouseover",e)}function nr(t){16==t.keyCode&&(this.doc.sel.shift=!1);ho(this,t)}function rr(t){var e=this;if(!(ho(e,t)||t.ctrlKey&&!t.altKey||ma&&t.metaKey)){var n=t.keyCode,r=t.charCode;if(ua&&n==Oa){Oa=null;hs(t)}else if(!(ua&&(!t.which||t.which<10)||fa)||!Zn(e,t)){var i=String.fromCharCode(null==r?n:r);if(!Qn(e,t,i)){ia&&oa>=9&&(e.display.inputHasSelection=null);Dn(e)}}}}function ir(t){if("nocursor"!=t.options.readOnly){if(!t.state.focused){vs(t,"focus",t);t.state.focused=!0;Is(t.display.wrapper,"CodeMirror-focused");if(!t.curOp&&t.display.selForContextMenu!=t.doc.sel){An(t);
aa&&setTimeout(ko(An,t,!0),0)}}Mn(t);Se(t)}}function or(t){if(t.state.focused){vs(t,"blur",t);t.state.focused=!1;js(t.display.wrapper,"CodeMirror-focused")}clearInterval(t.display.blinker);setTimeout(function(){t.state.focused||(t.display.shift=!1)},150)}function ar(t,e){function n(){if(null!=i.input.selectionStart){var e=t.somethingSelected(),n=i.input.value=""+(e?i.input.value:"");i.prevInput=e?"":"";i.input.selectionStart=1;i.input.selectionEnd=n.length;i.selForContextMenu=t.doc.sel}}function r(){i.contextMenuPending=!1;i.inputDiv.style.position="relative";i.input.style.cssText=l;ia&&9>oa&&i.scrollbars.setScrollTop(i.scroller.scrollTop=a);Mn(t);if(null!=i.input.selectionStart){(!ia||ia&&9>oa)&&n();var e=0,r=function(){i.selForContextMenu==t.doc.sel&&0==i.input.selectionStart?gn(t,Ya.selectAll)(t):e++<10?i.detectingSelectAll=setTimeout(r,500):An(t)};i.detectingSelectAll=setTimeout(r,200)}}if(!ho(t,e,"contextmenu")){var i=t.display;if(!Hn(i,e)&&!sr(t,e)){var o=On(t,e),a=i.scroller.scrollTop;if(o&&!ua){var s=t.options.resetSelectionOnContextMenu;s&&-1==t.doc.sel.contains(o)&&gn(t,he)(t.doc,Q(o),ws);var l=i.input.style.cssText;i.inputDiv.style.position="absolute";i.input.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(e.clientY-5)+"px; left: "+(e.clientX-5)+"px; z-index: 1000; background: "+(ia?"rgba(255, 255, 255, .05)":"transparent")+"; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";if(aa)var u=window.scrollY;Nn(t);aa&&window.scrollTo(null,u);An(t);t.somethingSelected()||(i.input.value=i.prevInput=" ");i.contextMenuPending=!0;i.selForContextMenu=t.doc.sel;clearTimeout(i.detectingSelectAll);ia&&oa>=9&&n();if(xa){ps(e);var c=function(){ms(window,"mouseup",c);setTimeout(r,20)};gs(window,"mouseup",c)}else setTimeout(r,50)}}}}function sr(t,e){return go(t,"gutterContextMenu")?qn(t,e,"gutterContextMenu",!1,vs):!1}function lr(t,e){if(Ta(t,e.from)<0)return t;if(Ta(t,e.to)<=0)return Ra(e);var n=t.line+e.text.length-(e.to.line-e.from.line)-1,r=t.ch;t.line==e.to.line&&(r+=Ra(e).ch-e.to.ch);return Sa(n,r)}function ur(t,e){for(var n=[],r=0;r<t.sel.ranges.length;r++){var i=t.sel.ranges[r];n.push(new K(lr(i.anchor,e),lr(i.head,e)))}return Z(n,t.sel.primIndex)}function cr(t,e,n){return t.line==e.line?Sa(n.line,t.ch-e.ch+n.ch):Sa(n.line+(t.line-e.line),t.ch)}function fr(t,e,n){for(var r=[],i=Sa(t.first,0),o=i,a=0;a<e.length;a++){var s=e[a],l=cr(s.from,i,o),u=cr(Ra(s),i,o);i=s.to;o=u;if("around"==n){var c=t.sel.ranges[a],f=Ta(c.head,c.anchor)<0;r[a]=new K(f?u:l,f?l:u)}else r[a]=new K(l,l)}return new J(r,t.sel.primIndex)}function hr(t,e,n){var r={canceled:!1,from:e.from,to:e.to,text:e.text,origin:e.origin,cancel:function(){this.canceled=!0}};n&&(r.update=function(e,n,r,i){e&&(this.from=ee(t,e));n&&(this.to=ee(t,n));r&&(this.text=r);void 0!==i&&(this.origin=i)});vs(t,"beforeChange",t,r);t.cm&&vs(t.cm,"beforeChange",t.cm,r);return r.canceled?null:{from:r.from,to:r.to,text:r.text,origin:r.origin}}function dr(t,e,n){if(t.cm){if(!t.cm.curOp)return gn(t.cm,dr)(t,e,n);if(t.cm.state.suppressEdits)return}if(go(t,"beforeChange")||t.cm&&go(t.cm,"beforeChange")){e=hr(t,e,!0);if(!e)return}var r=wa&&!n&&Yr(t,e.from,e.to);if(r)for(var i=r.length-1;i>=0;--i)pr(t,{from:r[i].from,to:r[i].to,text:i?[""]:e.text});else pr(t,e)}function pr(t,e){if(1!=e.text.length||""!=e.text[0]||0!=Ta(e.from,e.to)){var n=ur(t,e);Ji(t,e,n,t.cm?t.cm.curOp.id:0/0);vr(t,e,n,Xr(t,e));var r=[];Hi(t,function(t,n){if(!n&&-1==wo(r,t.history)){ao(t.history,e);r.push(t.history)}vr(t,e,null,Xr(t,e))})}}function gr(t,e,n){if(!t.cm||!t.cm.state.suppressEdits){for(var r,i=t.history,o=t.sel,a="undo"==e?i.done:i.undone,s="undo"==e?i.undone:i.done,l=0;l<a.length;l++){r=a[l];if(n?r.ranges&&!r.equals(t.sel):!r.ranges)break}if(l!=a.length){i.lastOrigin=i.lastSelOrigin=null;for(;;){r=a.pop();if(!r.ranges)break;Qi(r,s);if(n&&!r.equals(t.sel)){he(t,r,{clearRedo:!1});return}o=r}var u=[];Qi(o,s);s.push({changes:u,generation:i.generation});i.generation=r.generation||++i.maxGeneration;for(var c=go(t,"beforeChange")||t.cm&&go(t.cm,"beforeChange"),l=r.changes.length-1;l>=0;--l){var f=r.changes[l];f.origin=e;if(c&&!hr(t,f,!1)){a.length=0;return}u.push(Gi(t,f));var h=l?ur(t,f):xo(a);vr(t,f,h,$r(t,f));!l&&t.cm&&t.cm.scrollIntoView({from:f.from,to:Ra(f)});var d=[];Hi(t,function(t,e){if(!e&&-1==wo(d,t.history)){ao(t.history,f);d.push(t.history)}vr(t,f,null,$r(t,f))})}}}}function mr(t,e){if(0!=e){t.first+=e;t.sel=new J(Co(t.sel.ranges,function(t){return new K(Sa(t.anchor.line+e,t.anchor.ch),Sa(t.head.line+e,t.head.ch))}),t.sel.primIndex);if(t.cm){xn(t.cm,t.first,t.first-e,e);for(var n=t.cm.display,r=n.viewFrom;r<n.viewTo;r++)wn(t.cm,r,"gutter")}}}function vr(t,e,n,r){if(t.cm&&!t.cm.curOp)return gn(t.cm,vr)(t,e,n,r);if(e.to.line<t.first)mr(t,e.text.length-1-(e.to.line-e.from.line));else if(!(e.from.line>t.lastLine())){if(e.from.line<t.first){var i=e.text.length-1-(t.first-e.from.line);mr(t,i);e={from:Sa(t.first,0),to:Sa(e.to.line+i,e.to.ch),text:[xo(e.text)],origin:e.origin}}var o=t.lastLine();e.to.line>o&&(e={from:e.from,to:Sa(o,Ri(t,o).text.length),text:[e.text[0]],origin:e.origin});e.removed=Fi(t,e.from,e.to);n||(n=ur(t,e));t.cm?yr(t.cm,e,r):ji(t,e,r);de(t,n,ws)}}function yr(t,e,n){var r=t.doc,i=t.display,a=e.from,s=e.to,l=!1,u=a.line;if(!t.options.lineWrapping){u=qi(oi(Ri(r,a.line)));r.iter(u,s.line+1,function(t){if(t==i.maxLine){l=!0;return!0}})}r.sel.contains(e.from,e.to)>-1&&po(t);ji(r,e,n,o(t));if(!t.options.lineWrapping){r.iter(u,a.line+e.text.length,function(t){var e=f(t);if(e>i.maxLineLength){i.maxLine=t;i.maxLineLength=e;i.maxLineChanged=!0;l=!1}});l&&(t.curOp.updateMaxLine=!0)}r.frontier=Math.min(r.frontier,a.line);Te(t,400);var c=e.text.length-(s.line-a.line)-1;e.full?xn(t):a.line!=s.line||1!=e.text.length||Ei(t.doc,e)?xn(t,a.line,s.line+1,c):wn(t,a.line,"text");var h=go(t,"changes"),d=go(t,"change");if(d||h){var p={from:a,to:s,text:e.text,removed:e.removed,origin:e.origin};d&&co(t,"change",t,p);h&&(t.curOp.changeObjs||(t.curOp.changeObjs=[])).push(p)}t.display.selForContextMenu=null}function br(t,e,n,r,i){r||(r=n);if(Ta(r,n)<0){var o=r;r=n;n=o}"string"==typeof e&&(e=Os(e));dr(t,{from:n,to:r,text:e,origin:i})}function xr(t,e){if(!ho(t,"scrollCursorIntoView")){var n=t.display,r=n.sizer.getBoundingClientRect(),i=null;e.top+r.top<0?i=!0:e.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1);if(null!=i&&!da){var o=Lo("div","",null,"position: absolute; top: "+(e.top-n.viewOffset-De(t.display))+"px; height: "+(e.bottom-e.top+Ne(t)+n.barHeight)+"px; left: "+e.left+"px; width: 2px;");t.display.lineSpace.appendChild(o);o.scrollIntoView(i);t.display.lineSpace.removeChild(o)}}}function wr(t,e,n,r){null==r&&(r=0);for(var i=0;5>i;i++){var o=!1,a=Ke(t,e),s=n&&n!=e?Ke(t,n):a,l=Sr(t,Math.min(a.left,s.left),Math.min(a.top,s.top)-r,Math.max(a.left,s.left),Math.max(a.bottom,s.bottom)+r),u=t.doc.scrollTop,c=t.doc.scrollLeft;if(null!=l.scrollTop){Xn(t,l.scrollTop);Math.abs(t.doc.scrollTop-u)>1&&(o=!0)}if(null!=l.scrollLeft){Gn(t,l.scrollLeft);Math.abs(t.doc.scrollLeft-c)>1&&(o=!0)}if(!o)break}return a}function Cr(t,e,n,r,i){var o=Sr(t,e,n,r,i);null!=o.scrollTop&&Xn(t,o.scrollTop);null!=o.scrollLeft&&Gn(t,o.scrollLeft)}function Sr(t,e,n,r,i){var o=t.display,a=nn(t.display);0>n&&(n=0);var s=t.curOp&&null!=t.curOp.scrollTop?t.curOp.scrollTop:o.scroller.scrollTop,l=je(t),u={};i-n>l&&(i=n+l);var c=t.doc.height+Le(o),f=a>n,h=i>c-a;if(s>n)u.scrollTop=f?0:n;else if(i>s+l){var d=Math.min(n,(h?c:i)-l);d!=s&&(u.scrollTop=d)}var p=t.curOp&&null!=t.curOp.scrollLeft?t.curOp.scrollLeft:o.scroller.scrollLeft,g=Ee(t)-(t.options.fixedGutter?o.gutters.offsetWidth:0),m=r-e>g;m&&(r=e+g);10>e?u.scrollLeft=0:p>e?u.scrollLeft=Math.max(0,e-(m?0:10)):r>g+p-3&&(u.scrollLeft=r+(m?0:10)-g);return u}function Tr(t,e,n){(null!=e||null!=n)&&_r(t);null!=e&&(t.curOp.scrollLeft=(null==t.curOp.scrollLeft?t.doc.scrollLeft:t.curOp.scrollLeft)+e);null!=n&&(t.curOp.scrollTop=(null==t.curOp.scrollTop?t.doc.scrollTop:t.curOp.scrollTop)+n)}function kr(t){_r(t);var e=t.getCursor(),n=e,r=e;if(!t.options.lineWrapping){n=e.ch?Sa(e.line,e.ch-1):e;r=Sa(e.line,e.ch+1)}t.curOp.scrollToPos={from:n,to:r,margin:t.options.cursorScrollMargin,isCursor:!0}}function _r(t){var e=t.curOp.scrollToPos;if(e){t.curOp.scrollToPos=null;var n=Ze(t,e.from),r=Ze(t,e.to),i=Sr(t,Math.min(n.left,r.left),Math.min(n.top,r.top)-e.margin,Math.max(n.right,r.right),Math.max(n.bottom,r.bottom)+e.margin);t.scrollTo(i.scrollLeft,i.scrollTop)}}function Mr(t,e,n,r){var i,o=t.doc;null==n&&(n="add");"smart"==n&&(o.mode.indent?i=Me(t,e):n="prev");var a=t.options.tabSize,s=Ri(o,e),l=Ts(s.text,null,a);s.stateAfter&&(s.stateAfter=null);var u,c=s.text.match(/^\s*/)[0];if(r||/\S/.test(s.text)){if("smart"==n){u=o.mode.indent(i,s.text.slice(c.length),s.text);if(u==xs||u>150){if(!r)return;n="prev"}}}else{u=0;n="not"}"prev"==n?u=e>o.first?Ts(Ri(o,e-1).text,null,a):0:"add"==n?u=l+t.options.indentUnit:"subtract"==n?u=l-t.options.indentUnit:"number"==typeof n&&(u=l+n);u=Math.max(0,u);var f="",h=0;if(t.options.indentWithTabs)for(var d=Math.floor(u/a);d;--d){h+=a;f+=" "}u>h&&(f+=bo(u-h));if(f!=c)br(o,f,Sa(e,0),Sa(e,c.length),"+input");else for(var d=0;d<o.sel.ranges.length;d++){var p=o.sel.ranges[d];if(p.head.line==e&&p.head.ch<c.length){var h=Sa(e,c.length);le(o,d,new K(h,h));break}}s.stateAfter=null}function Dr(t,e,n,r){var i=e,o=e;"number"==typeof e?o=Ri(t,te(t,e)):i=qi(e);if(null==i)return null;r(o,i)&&t.cm&&wn(t.cm,i,n);return o}function Lr(t,e){for(var n=t.doc.sel.ranges,r=[],i=0;i<n.length;i++){for(var o=e(n[i]);r.length&&Ta(o.from,xo(r).to)<=0;){var a=r.pop();if(Ta(a.from,o.from)<0){o.from=a.from;break}}r.push(o)}pn(t,function(){for(var e=r.length-1;e>=0;e--)br(t.doc,"",r[e].from,r[e].to,"+delete");kr(t)})}function Ar(t,e,n,r,i){function o(){var e=s+n;if(e<t.first||e>=t.first+t.size)return f=!1;s=e;return c=Ri(t,e)}function a(t){var e=(i?Qo:ta)(c,l,n,!0);if(null==e){if(t||!o())return f=!1;l=i?(0>n?Xo:Vo)(c):0>n?c.text.length:0}else l=e;return!0}var s=e.line,l=e.ch,u=n,c=Ri(t,s),f=!0;if("char"==r)a();else if("column"==r)a(!0);else if("word"==r||"group"==r)for(var h=null,d="group"==r,p=t.cm&&t.cm.getHelper(e,"wordChars"),g=!0;!(0>n)||a(!g);g=!1){var m=c.text.charAt(l)||"\n",v=_o(m,p)?"w":d&&"\n"==m?"n":!d||/\s/.test(m)?null:"p";!d||g||v||(v="s");if(h&&h!=v){if(0>n){n=1;a()}break}v&&(h=v);if(n>0&&!a(!g))break}var y=ve(t,Sa(s,l),u,!0);f||(y.hitSide=!0);return y}function Nr(t,e,n,r){var i,o=t.doc,a=e.left;if("page"==r){var s=Math.min(t.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight);i=e.top+n*(s-(0>n?1.5:.5)*nn(t.display))}else"line"==r&&(i=n>0?e.bottom+3:e.top-3);for(;;){var l=tn(t,a,i);if(!l.outside)break;if(0>n?0>=i:i>=o.height){l.hitSide=!0;break}i+=5*n}return l}function Er(e,n,r,i){t.defaults[e]=n;r&&(Wa[e]=i?function(t,e,n){n!=za&&r(t,e,n)}:r)}function jr(t){for(var e,n,r,i,o=t.split(/-(?!$)/),t=o[o.length-1],a=0;a<o.length-1;a++){var s=o[a];if(/^(cmd|meta|m)$/i.test(s))i=!0;else if(/^a(lt)?$/i.test(s))e=!0;else if(/^(c|ctrl|control)$/i.test(s))n=!0;else{if(!/^s(hift)$/i.test(s))throw new Error("Unrecognized modifier name: "+s);r=!0}}e&&(t="Alt-"+t);n&&(t="Ctrl-"+t);i&&(t="Cmd-"+t);r&&(t="Shift-"+t);return t}function Ir(t){return"string"==typeof t?Ja[t]:t}function Pr(t,e,n,r,i){if(r&&r.shared)return Hr(t,e,n,r,i);if(t.cm&&!t.cm.curOp)return gn(t.cm,Pr)(t,e,n,r,i);var o=new es(t,i),a=Ta(e,n);r&&To(r,o,!1);if(a>0||0==a&&o.clearWhenEmpty!==!1)return o;if(o.replacedWith){o.collapsed=!0;o.widgetNode=Lo("span",[o.replacedWith],"CodeMirror-widget");r.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true");r.insertLeft&&(o.widgetNode.insertLeft=!0)}if(o.collapsed){if(ii(t,e.line,e,n,o)||e.line!=n.line&&ii(t,n.line,e,n,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");Ca=!0}o.addToHistory&&Ji(t,{from:e,to:n,origin:"markText"},t.sel,0/0);var s,l=e.line,u=t.cm;t.iter(l,n.line+1,function(t){u&&o.collapsed&&!u.options.lineWrapping&&oi(t)==u.display.maxLine&&(s=!0);o.collapsed&&l!=e.line&&zi(t,0);Ur(t,new Wr(o,l==e.line?e.ch:null,l==n.line?n.ch:null));++l});o.collapsed&&t.iter(e.line,n.line+1,function(e){ui(t,e)&&zi(e,0)});o.clearOnEnter&&gs(o,"beforeCursorEnter",function(){o.clear()});if(o.readOnly){wa=!0;(t.history.done.length||t.history.undone.length)&&t.clearHistory()}if(o.collapsed){o.id=++ns;o.atomic=!0}if(u){s&&(u.curOp.updateMaxLine=!0);if(o.collapsed)xn(u,e.line,n.line+1);else if(o.className||o.title||o.startStyle||o.endStyle||o.css)for(var c=e.line;c<=n.line;c++)wn(u,c,"text");o.atomic&&ge(u.doc);co(u,"markerAdded",u,o)}return o}function Hr(t,e,n,r,i){r=To(r);r.shared=!1;var o=[Pr(t,e,n,r,i)],a=o[0],s=r.widgetNode;Hi(t,function(t){s&&(r.widgetNode=s.cloneNode(!0));o.push(Pr(t,ee(t,e),ee(t,n),r,i));for(var l=0;l<t.linked.length;++l)if(t.linked[l].isParent)return;a=xo(o)});return new rs(o,a)}function Or(t){return t.findMarks(Sa(t.first,0),t.clipPos(Sa(t.lastLine())),function(t){return t.parent})}function Rr(t,e){for(var n=0;n<e.length;n++){var r=e[n],i=r.find(),o=t.clipPos(i.from),a=t.clipPos(i.to);if(Ta(o,a)){var s=Pr(t,o,a,r.primary,r.primary.type);r.markers.push(s);s.parent=r}}}function Fr(t){for(var e=0;e<t.length;e++){var n=t[e],r=[n.primary.doc];Hi(n.primary.doc,function(t){r.push(t)});for(var i=0;i<n.markers.length;i++){var o=n.markers[i];if(-1==wo(r,o.doc)){o.parent=null;n.markers.splice(i--,1)}}}}function Wr(t,e,n){this.marker=t;this.from=e;this.to=n}function zr(t,e){if(t)for(var n=0;n<t.length;++n){var r=t[n];if(r.marker==e)return r}}function qr(t,e){for(var n,r=0;r<t.length;++r)t[r]!=e&&(n||(n=[])).push(t[r]);return n}function Ur(t,e){t.markedSpans=t.markedSpans?t.markedSpans.concat([e]):[e];e.marker.attachLine(t)}function Br(t,e,n){if(t)for(var r,i=0;i<t.length;++i){var o=t[i],a=o.marker,s=null==o.from||(a.inclusiveLeft?o.from<=e:o.from<e);if(s||o.from==e&&"bookmark"==a.type&&(!n||!o.marker.insertLeft)){var l=null==o.to||(a.inclusiveRight?o.to>=e:o.to>e);(r||(r=[])).push(new Wr(a,o.from,l?null:o.to))}}return r}function Vr(t,e,n){if(t)for(var r,i=0;i<t.length;++i){var o=t[i],a=o.marker,s=null==o.to||(a.inclusiveRight?o.to>=e:o.to>e);if(s||o.from==e&&"bookmark"==a.type&&(!n||o.marker.insertLeft)){var l=null==o.from||(a.inclusiveLeft?o.from<=e:o.from<e);(r||(r=[])).push(new Wr(a,l?null:o.from-e,null==o.to?null:o.to-e))}}return r}function Xr(t,e){if(e.full)return null;var n=re(t,e.from.line)&&Ri(t,e.from.line).markedSpans,r=re(t,e.to.line)&&Ri(t,e.to.line).markedSpans;if(!n&&!r)return null;var i=e.from.ch,o=e.to.ch,a=0==Ta(e.from,e.to),s=Br(n,i,a),l=Vr(r,o,a),u=1==e.text.length,c=xo(e.text).length+(u?i:0);if(s)for(var f=0;f<s.length;++f){var h=s[f];if(null==h.to){var d=zr(l,h.marker);d?u&&(h.to=null==d.to?null:d.to+c):h.to=i}}if(l)for(var f=0;f<l.length;++f){var h=l[f];null!=h.to&&(h.to+=c);if(null==h.from){var d=zr(s,h.marker);if(!d){h.from=c;u&&(s||(s=[])).push(h)}}else{h.from+=c;u&&(s||(s=[])).push(h)}}s&&(s=Gr(s));l&&l!=s&&(l=Gr(l));var p=[s];if(!u){var g,m=e.text.length-2;if(m>0&&s)for(var f=0;f<s.length;++f)null==s[f].to&&(g||(g=[])).push(new Wr(s[f].marker,null,null));for(var f=0;m>f;++f)p.push(g);p.push(l)}return p}function Gr(t){for(var e=0;e<t.length;++e){var n=t[e];null!=n.from&&n.from==n.to&&n.marker.clearWhenEmpty!==!1&&t.splice(e--,1)}return t.length?t:null}function $r(t,e){var n=no(t,e),r=Xr(t,e);if(!n)return r;if(!r)return n;for(var i=0;i<n.length;++i){var o=n[i],a=r[i];if(o&&a)t:for(var s=0;s<a.length;++s){for(var l=a[s],u=0;u<o.length;++u)if(o[u].marker==l.marker)continue t;o.push(l)}else a&&(n[i]=a)}return n}function Yr(t,e,n){var r=null;t.iter(e.line,n.line+1,function(t){if(t.markedSpans)for(var e=0;e<t.markedSpans.length;++e){var n=t.markedSpans[e].marker;!n.readOnly||r&&-1!=wo(r,n)||(r||(r=[])).push(n)}});if(!r)return null;for(var i=[{from:e,to:n}],o=0;o<r.length;++o)for(var a=r[o],s=a.find(0),l=0;l<i.length;++l){var u=i[l];if(!(Ta(u.to,s.from)<0||Ta(u.from,s.to)>0)){var c=[l,1],f=Ta(u.from,s.from),h=Ta(u.to,s.to);(0>f||!a.inclusiveLeft&&!f)&&c.push({from:u.from,to:s.from});(h>0||!a.inclusiveRight&&!h)&&c.push({from:s.to,to:u.to});i.splice.apply(i,c);l+=c.length-1}}return i}function Jr(t){var e=t.markedSpans;if(e){for(var n=0;n<e.length;++n)e[n].marker.detachLine(t);t.markedSpans=null}}function Kr(t,e){if(e){for(var n=0;n<e.length;++n)e[n].marker.attachLine(t);t.markedSpans=e}}function Zr(t){return t.inclusiveLeft?-1:0}function Qr(t){return t.inclusiveRight?1:0}function ti(t,e){var n=t.lines.length-e.lines.length;if(0!=n)return n;var r=t.find(),i=e.find(),o=Ta(r.from,i.from)||Zr(t)-Zr(e);if(o)return-o;var a=Ta(r.to,i.to)||Qr(t)-Qr(e);return a?a:e.id-t.id}function ei(t,e){var n,r=Ca&&t.markedSpans;if(r)for(var i,o=0;o<r.length;++o){i=r[o];i.marker.collapsed&&null==(e?i.from:i.to)&&(!n||ti(n,i.marker)<0)&&(n=i.marker)}return n}function ni(t){return ei(t,!0)}function ri(t){return ei(t,!1)}function ii(t,e,n,r,i){var o=Ri(t,e),a=Ca&&o.markedSpans;if(a)for(var s=0;s<a.length;++s){var l=a[s];if(l.marker.collapsed){var u=l.marker.find(0),c=Ta(u.from,n)||Zr(l.marker)-Zr(i),f=Ta(u.to,r)||Qr(l.marker)-Qr(i);if(!(c>=0&&0>=f||0>=c&&f>=0)&&(0>=c&&(Ta(u.to,n)>0||l.marker.inclusiveRight&&i.inclusiveLeft)||c>=0&&(Ta(u.from,r)<0||l.marker.inclusiveLeft&&i.inclusiveRight)))return!0}}}function oi(t){for(var e;e=ni(t);)t=e.find(-1,!0).line;return t}function ai(t){for(var e,n;e=ri(t);){t=e.find(1,!0).line;(n||(n=[])).push(t)}return n}function si(t,e){var n=Ri(t,e),r=oi(n);return n==r?e:qi(r)}function li(t,e){if(e>t.lastLine())return e;var n,r=Ri(t,e);if(!ui(t,r))return e;for(;n=ri(r);)r=n.find(1,!0).line;return qi(r)+1}function ui(t,e){var n=Ca&&e.markedSpans;if(n)for(var r,i=0;i<n.length;++i){r=n[i];if(r.marker.collapsed){if(null==r.from)return!0;if(!r.marker.widgetNode&&0==r.from&&r.marker.inclusiveLeft&&ci(t,e,r))return!0}}}function ci(t,e,n){if(null==n.to){var r=n.marker.find(1,!0);return ci(t,r.line,zr(r.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==e.text.length)return!0;for(var i,o=0;o<e.markedSpans.length;++o){i=e.markedSpans[o];if(i.marker.collapsed&&!i.marker.widgetNode&&i.from==n.to&&(null==i.to||i.to!=n.from)&&(i.marker.inclusiveLeft||n.marker.inclusiveRight)&&ci(t,e,i))return!0}}function fi(t,e,n){Bi(e)<(t.curOp&&t.curOp.scrollTop||t.doc.scrollTop)&&Tr(t,null,n)}function hi(t){if(null!=t.height)return t.height;if(!Eo(document.body,t.node)){var e="position: relative;";t.coverGutter&&(e+="margin-left: -"+t.cm.display.gutters.offsetWidth+"px;");t.noHScroll&&(e+="width: "+t.cm.display.wrapper.clientWidth+"px;");No(t.cm.display.measure,Lo("div",[t.node],null,e))}return t.height=t.node.offsetHeight}function di(t,e,n,r){var i=new is(t,n,r);i.noHScroll&&(t.display.alignWidgets=!0);Dr(t.doc,e,"widget",function(e){var n=e.widgets||(e.widgets=[]);null==i.insertAt?n.push(i):n.splice(Math.min(n.length-1,Math.max(0,i.insertAt)),0,i);i.line=e;if(!ui(t.doc,e)){var r=Bi(e)<t.doc.scrollTop;zi(e,e.height+hi(i));r&&Tr(t,null,i.height);t.curOp.forceUpdate=!0}return!0});return i}function pi(t,e,n,r){t.text=e;t.stateAfter&&(t.stateAfter=null);t.styles&&(t.styles=null);null!=t.order&&(t.order=null);Jr(t);Kr(t,n);var i=r?r(t):1;i!=t.height&&zi(t,i)}function gi(t){t.parent=null;Jr(t)}function mi(t,e){if(t)for(;;){var n=t.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!n)break;t=t.slice(0,n.index)+t.slice(n.index+n[0].length);var r=n[1]?"bgClass":"textClass";null==e[r]?e[r]=n[2]:new RegExp("(?:^|s)"+n[2]+"(?:$|s)").test(e[r])||(e[r]+=" "+n[2])}return t}function vi(e,n){if(e.blankLine)return e.blankLine(n);if(e.innerMode){var r=t.innerMode(e,n);return r.mode.blankLine?r.mode.blankLine(r.state):void 0}}function yi(e,n,r,i){for(var o=0;10>o;o++){i&&(i[0]=t.innerMode(e,r).mode);var a=e.token(n,r);if(n.pos>n.start)return a}throw new Error("Mode "+e.name+" failed to advance stream.")}function bi(t,e,n,r){function i(t){return{start:f.start,end:f.pos,string:f.current(),type:o||null,state:t?Ga(a.mode,c):c}}var o,a=t.doc,s=a.mode;e=ee(a,e);var l,u=Ri(a,e.line),c=Me(t,e.line,n),f=new ts(u.text,t.options.tabSize);r&&(l=[]);for(;(r||f.pos<e.ch)&&!f.eol();){f.start=f.pos;o=yi(s,f,c);r&&l.push(i(!0))}return r?l:i()}function xi(t,e,n,r,i,o,a){var s=n.flattenSpans;null==s&&(s=t.options.flattenSpans);var l,u=0,c=null,f=new ts(e,t.options.tabSize),h=t.options.addModeClass&&[null];""==e&&mi(vi(n,r),o);for(;!f.eol();){if(f.pos>t.options.maxHighlightLength){s=!1;a&&Si(t,e,r,f.pos);f.pos=e.length;l=null}else l=mi(yi(n,f,r,h),o);if(h){var d=h[0].name;d&&(l="m-"+(l?d+" "+l:d))}if(!s||c!=l){for(;u<f.start;){u=Math.min(f.start,u+5e4);i(u,c)}c=l}f.start=f.pos}for(;u<f.pos;){var p=Math.min(f.pos,u+5e4);i(p,c);u=p}}function wi(t,e,n,r){var i=[t.state.modeGen],o={};xi(t,e.text,t.doc.mode,n,function(t,e){i.push(t,e)},o,r);for(var a=0;a<t.state.overlays.length;++a){var s=t.state.overlays[a],l=1,u=0;xi(t,e.text,s.mode,!0,function(t,e){for(var n=l;t>u;){var r=i[l];r>t&&i.splice(l,1,t,i[l+1],r);l+=2;u=Math.min(t,r)}if(e)if(s.opaque){i.splice(n,l-n,t,"cm-overlay "+e);l=n+2}else for(;l>n;n+=2){var o=i[n+1];i[n+1]=(o?o+" ":"")+"cm-overlay "+e}},o)}return{styles:i,classes:o.bgClass||o.textClass?o:null}}function Ci(t,e,n){if(!e.styles||e.styles[0]!=t.state.modeGen){var r=wi(t,e,e.stateAfter=Me(t,qi(e)));e.styles=r.styles;r.classes?e.styleClasses=r.classes:e.styleClasses&&(e.styleClasses=null);n===t.doc.frontier&&t.doc.frontier++}return e.styles}function Si(t,e,n,r){var i=t.doc.mode,o=new ts(e,t.options.tabSize);o.start=o.pos=r||0;""==e&&vi(i,n);for(;!o.eol()&&o.pos<=t.options.maxHighlightLength;){yi(i,o,n);o.start=o.pos}}function Ti(t,e){if(!t||/^\s*$/.test(t))return null;var n=e.addModeClass?ss:as;return n[t]||(n[t]=t.replace(/\S+/g,"cm-$&"))}function ki(t,e){var n=Lo("span",null,null,aa?"padding-right: .1px":null),r={pre:Lo("pre",[n]),content:n,col:0,pos:0,cm:t};e.measure={};for(var i=0;i<=(e.rest?e.rest.length:0);i++){var o,a=i?e.rest[i-1]:e.line;r.pos=0;r.addToken=Mi;(ia||aa)&&t.getOption("lineWrapping")&&(r.addToken=Di(r.addToken));Wo(t.display.measure)&&(o=Vi(a))&&(r.addToken=Li(r.addToken,o));r.map=[];var s=e!=t.display.externalMeasured&&qi(a);Ni(a,r,Ci(t,a,s));if(a.styleClasses){a.styleClasses.bgClass&&(r.bgClass=Po(a.styleClasses.bgClass,r.bgClass||""));a.styleClasses.textClass&&(r.textClass=Po(a.styleClasses.textClass,r.textClass||""))}0==r.map.length&&r.map.push(0,0,r.content.appendChild(Fo(t.display.measure)));if(0==i){e.measure.map=r.map;e.measure.cache={}}else{(e.measure.maps||(e.measure.maps=[])).push(r.map);(e.measure.caches||(e.measure.caches=[])).push({})}}aa&&/\bcm-tab\b/.test(r.content.lastChild.className)&&(r.content.className="cm-tab-wrap-hack");vs(t,"renderLine",t,e.line,r.pre);r.pre.className&&(r.textClass=Po(r.pre.className,r.textClass||""));return r}function _i(t){var e=Lo("span","•","cm-invalidchar");e.title="\\u"+t.charCodeAt(0).toString(16);return e}function Mi(t,e,n,r,i,o,a){if(e){var s=t.cm.options.specialChars,l=!1;if(s.test(e))for(var u=document.createDocumentFragment(),c=0;;){s.lastIndex=c;var f=s.exec(e),h=f?f.index-c:e.length-c;if(h){var d=document.createTextNode(e.slice(c,c+h));u.appendChild(ia&&9>oa?Lo("span",[d]):d);t.map.push(t.pos,t.pos+h,d);t.col+=h;t.pos+=h}if(!f)break;c+=h+1;if(" "==f[0]){var p=t.cm.options.tabSize,g=p-t.col%p,d=u.appendChild(Lo("span",bo(g),"cm-tab"));t.col+=g}else{var d=t.cm.options.specialCharPlaceholder(f[0]);u.appendChild(ia&&9>oa?Lo("span",[d]):d);t.col+=1}t.map.push(t.pos,t.pos+1,d);t.pos++}else{t.col+=e.length;var u=document.createTextNode(e);t.map.push(t.pos,t.pos+e.length,u);ia&&9>oa&&(l=!0);t.pos+=e.length}if(n||r||i||l||a){var m=n||"";r&&(m+=r);i&&(m+=i);var v=Lo("span",[u],m,a);o&&(v.title=o);return t.content.appendChild(v)}t.content.appendChild(u)}}function Di(t){function e(t){for(var e=" ",n=0;n<t.length-2;++n)e+=n%2?" ":" ";e+=" ";return e}return function(n,r,i,o,a,s){t(n,r.replace(/ {3,}/g,e),i,o,a,s)}}function Li(t,e){return function(n,r,i,o,a,s){i=i?i+" cm-force-border":"cm-force-border";for(var l=n.pos,u=l+r.length;;){for(var c=0;c<e.length;c++){var f=e[c];if(f.to>l&&f.from<=l)break}if(f.to>=u)return t(n,r,i,o,a,s);t(n,r.slice(0,f.to-l),i,o,null,s);o=null;r=r.slice(f.to-l);l=f.to}}}function Ai(t,e,n,r){var i=!r&&n.widgetNode;if(i){t.map.push(t.pos,t.pos+e,i);t.content.appendChild(i)}t.pos+=e}function Ni(t,e,n){var r=t.markedSpans,i=t.text,o=0;if(r)for(var a,s,l,u,c,f,h,d=i.length,p=0,g=1,m="",v=0;;){if(v==p){l=u=c=f=s="";h=null;v=1/0;for(var y=[],b=0;b<r.length;++b){var x=r[b],w=x.marker;if(x.from<=p&&(null==x.to||x.to>p)){if(null!=x.to&&v>x.to){v=x.to;u=""}w.className&&(l+=" "+w.className);w.css&&(s=w.css);w.startStyle&&x.from==p&&(c+=" "+w.startStyle);w.endStyle&&x.to==v&&(u+=" "+w.endStyle);w.title&&!f&&(f=w.title);w.collapsed&&(!h||ti(h.marker,w)<0)&&(h=x)}else x.from>p&&v>x.from&&(v=x.from);"bookmark"==w.type&&x.from==p&&w.widgetNode&&y.push(w)}if(h&&(h.from||0)==p){Ai(e,(null==h.to?d+1:h.to)-p,h.marker,null==h.from);if(null==h.to)return}if(!h&&y.length)for(var b=0;b<y.length;++b)Ai(e,0,y[b])}if(p>=d)break;for(var C=Math.min(d,v);;){if(m){var S=p+m.length;if(!h){var T=S>C?m.slice(0,C-p):m;e.addToken(e,T,a?a+l:l,c,p+T.length==v?u:"",f,s)}if(S>=C){m=m.slice(C-p);p=C;break}p=S;c=""}m=i.slice(o,o=n[g++]);a=Ti(n[g++],e.cm.options)}}else for(var g=1;g<n.length;g+=2)e.addToken(e,i.slice(o,o=n[g]),Ti(n[g+1],e.cm.options))}function Ei(t,e){return 0==e.from.ch&&0==e.to.ch&&""==xo(e.text)&&(!t.cm||t.cm.options.wholeLineUpdateBefore)}function ji(t,e,n,r){function i(t){return n?n[t]:null}function o(t,n,i){pi(t,n,i,r);co(t,"change",t,e)}function a(t,e){for(var n=t,o=[];e>n;++n)o.push(new os(u[n],i(n),r));return o}var s=e.from,l=e.to,u=e.text,c=Ri(t,s.line),f=Ri(t,l.line),h=xo(u),d=i(u.length-1),p=l.line-s.line;if(e.full){t.insert(0,a(0,u.length));t.remove(u.length,t.size-u.length)}else if(Ei(t,e)){var g=a(0,u.length-1);o(f,f.text,d);p&&t.remove(s.line,p);g.length&&t.insert(s.line,g)}else if(c==f)if(1==u.length)o(c,c.text.slice(0,s.ch)+h+c.text.slice(l.ch),d);else{var g=a(1,u.length-1);g.push(new os(h+c.text.slice(l.ch),d,r));o(c,c.text.slice(0,s.ch)+u[0],i(0));t.insert(s.line+1,g)}else if(1==u.length){o(c,c.text.slice(0,s.ch)+u[0]+f.text.slice(l.ch),i(0));t.remove(s.line+1,p)}else{o(c,c.text.slice(0,s.ch)+u[0],i(0));o(f,h+f.text.slice(l.ch),d);var g=a(1,u.length-1);p>1&&t.remove(s.line+1,p-1);t.insert(s.line+1,g)}co(t,"change",t,e)}function Ii(t){this.lines=t;this.parent=null;for(var e=0,n=0;e<t.length;++e){t[e].parent=this;n+=t[e].height}this.height=n}function Pi(t){this.children=t;for(var e=0,n=0,r=0;r<t.length;++r){var i=t[r];e+=i.chunkSize();n+=i.height;i.parent=this}this.size=e;this.height=n;this.parent=null}function Hi(t,e,n){function r(t,i,o){if(t.linked)for(var a=0;a<t.linked.length;++a){var s=t.linked[a];if(s.doc!=i){var l=o&&s.sharedHist;if(!n||l){e(s.doc,l);r(s.doc,t,l)}}}}r(t,null,!0)}function Oi(t,e){if(e.cm)throw new Error("This document is already in use.");t.doc=e;e.cm=t;a(t);n(t);t.options.lineWrapping||h(t);t.options.mode=e.modeOption;xn(t)}function Ri(t,e){e-=t.first;if(0>e||e>=t.size)throw new Error("There is no line "+(e+t.first)+" in the document.");for(var n=t;!n.lines;)for(var r=0;;++r){var i=n.children[r],o=i.chunkSize();if(o>e){n=i;break}e-=o}return n.lines[e]}function Fi(t,e,n){var r=[],i=e.line;t.iter(e.line,n.line+1,function(t){var o=t.text;i==n.line&&(o=o.slice(0,n.ch));i==e.line&&(o=o.slice(e.ch));r.push(o);++i});return r}function Wi(t,e,n){var r=[];t.iter(e,n,function(t){r.push(t.text)});return r}function zi(t,e){var n=e-t.height;if(n)for(var r=t;r;r=r.parent)r.height+=n}function qi(t){if(null==t.parent)return null;for(var e=t.parent,n=wo(e.lines,t),r=e.parent;r;e=r,r=r.parent)for(var i=0;r.children[i]!=e;++i)n+=r.children[i].chunkSize();return n+e.first}function Ui(t,e){var n=t.first;t:do{for(var r=0;r<t.children.length;++r){var i=t.children[r],o=i.height;if(o>e){t=i;continue t}e-=o;n+=i.chunkSize()}return n}while(!t.lines);for(var r=0;r<t.lines.length;++r){var a=t.lines[r],s=a.height;if(s>e)break;e-=s}return n+r}function Bi(t){t=oi(t);for(var e=0,n=t.parent,r=0;r<n.lines.length;++r){var i=n.lines[r];if(i==t)break;e+=i.height}for(var o=n.parent;o;n=o,o=n.parent)for(var r=0;r<o.children.length;++r){var a=o.children[r];if(a==n)break;e+=a.height}return e}function Vi(t){var e=t.order;null==e&&(e=t.order=Us(t.text));return e}function Xi(t){this.done=[];this.undone=[];this.undoDepth=1/0;this.lastModTime=this.lastSelTime=0;this.lastOp=this.lastSelOp=null;this.lastOrigin=this.lastSelOrigin=null;this.generation=this.maxGeneration=t||1}function Gi(t,e){var n={from:G(e.from),to:Ra(e),text:Fi(t,e.from,e.to)};to(t,n,e.from.line,e.to.line+1);Hi(t,function(t){to(t,n,e.from.line,e.to.line+1)},!0);return n}function $i(t){for(;t.length;){var e=xo(t);if(!e.ranges)break;t.pop()}}function Yi(t,e){if(e){$i(t.done);return xo(t.done)}if(t.done.length&&!xo(t.done).ranges)return xo(t.done);if(t.done.length>1&&!t.done[t.done.length-2].ranges){t.done.pop();return xo(t.done)}}function Ji(t,e,n,r){var i=t.history;i.undone.length=0;var o,a=+new Date;if((i.lastOp==r||i.lastOrigin==e.origin&&e.origin&&("+"==e.origin.charAt(0)&&t.cm&&i.lastModTime>a-t.cm.options.historyEventDelay||"*"==e.origin.charAt(0)))&&(o=Yi(i,i.lastOp==r))){var s=xo(o.changes);0==Ta(e.from,e.to)&&0==Ta(e.from,s.to)?s.to=Ra(e):o.changes.push(Gi(t,e))}else{var l=xo(i.done);l&&l.ranges||Qi(t.sel,i.done);o={changes:[Gi(t,e)],generation:i.generation};i.done.push(o);for(;i.done.length>i.undoDepth;){i.done.shift();i.done[0].ranges||i.done.shift()}}i.done.push(n);i.generation=++i.maxGeneration;i.lastModTime=i.lastSelTime=a;i.lastOp=i.lastSelOp=r;i.lastOrigin=i.lastSelOrigin=e.origin;s||vs(t,"historyAdded")}function Ki(t,e,n,r){var i=e.charAt(0);return"*"==i||"+"==i&&n.ranges.length==r.ranges.length&&n.somethingSelected()==r.somethingSelected()&&new Date-t.history.lastSelTime<=(t.cm?t.cm.options.historyEventDelay:500)}function Zi(t,e,n,r){var i=t.history,o=r&&r.origin;n==i.lastSelOp||o&&i.lastSelOrigin==o&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==o||Ki(t,o,xo(i.done),e))?i.done[i.done.length-1]=e:Qi(e,i.done);i.lastSelTime=+new Date;i.lastSelOrigin=o;i.lastSelOp=n;r&&r.clearRedo!==!1&&$i(i.undone)}function Qi(t,e){var n=xo(e);n&&n.ranges&&n.equals(t)||e.push(t)}function to(t,e,n,r){var i=e["spans_"+t.id],o=0;t.iter(Math.max(t.first,n),Math.min(t.first+t.size,r),function(n){n.markedSpans&&((i||(i=e["spans_"+t.id]={}))[o]=n.markedSpans);++o})}function eo(t){if(!t)return null;for(var e,n=0;n<t.length;++n)t[n].marker.explicitlyCleared?e||(e=t.slice(0,n)):e&&e.push(t[n]);return e?e.length?e:null:t}function no(t,e){var n=e["spans_"+t.id];if(!n)return null;for(var r=0,i=[];r<e.text.length;++r)i.push(eo(n[r]));return i}function ro(t,e,n){for(var r=0,i=[];r<t.length;++r){var o=t[r];if(o.ranges)i.push(n?J.prototype.deepCopy.call(o):o);else{var a=o.changes,s=[];i.push({changes:s});for(var l=0;l<a.length;++l){var u,c=a[l];s.push({from:c.from,to:c.to,text:c.text});if(e)for(var f in c)if((u=f.match(/^spans_(\d+)$/))&&wo(e,Number(u[1]))>-1){xo(s)[f]=c[f];delete c[f]}}}}return i}function io(t,e,n,r){if(n<t.line)t.line+=r;else if(e<t.line){t.line=e;t.ch=0}}function oo(t,e,n,r){for(var i=0;i<t.length;++i){var o=t[i],a=!0;if(o.ranges){if(!o.copied){o=t[i]=o.deepCopy();o.copied=!0}for(var s=0;s<o.ranges.length;s++){io(o.ranges[s].anchor,e,n,r);io(o.ranges[s].head,e,n,r)}}else{for(var s=0;s<o.changes.length;++s){var l=o.changes[s];if(n<l.from.line){l.from=Sa(l.from.line+r,l.from.ch);l.to=Sa(l.to.line+r,l.to.ch)}else if(e<=l.to.line){a=!1;break}}if(!a){t.splice(0,i+1);i=0}}}}function ao(t,e){var n=e.from.line,r=e.to.line,i=e.text.length-(r-n)-1;oo(t.done,n,r,i);oo(t.undone,n,r,i)}function so(t){return null!=t.defaultPrevented?t.defaultPrevented:0==t.returnValue}function lo(t){return t.target||t.srcElement}function uo(t){var e=t.which;null==e&&(1&t.button?e=1:2&t.button?e=3:4&t.button&&(e=2));ma&&t.ctrlKey&&1==e&&(e=3);return e}function co(t,e){function n(t){return function(){t.apply(null,o)}}var r=t._handlers&&t._handlers[e];
if(r){var i,o=Array.prototype.slice.call(arguments,2);if(La)i=La.delayedCallbacks;else if(ys)i=ys;else{i=ys=[];setTimeout(fo,0)}for(var a=0;a<r.length;++a)i.push(n(r[a]))}}function fo(){var t=ys;ys=null;for(var e=0;e<t.length;++e)t[e]()}function ho(t,e,n){"string"==typeof e&&(e={type:e,preventDefault:function(){this.defaultPrevented=!0}});vs(t,n||e.type,t,e);return so(e)||e.codemirrorIgnore}function po(t){var e=t._handlers&&t._handlers.cursorActivity;if(e)for(var n=t.curOp.cursorActivityHandlers||(t.curOp.cursorActivityHandlers=[]),r=0;r<e.length;++r)-1==wo(n,e[r])&&n.push(e[r])}function go(t,e){var n=t._handlers&&t._handlers[e];return n&&n.length>0}function mo(t){t.prototype.on=function(t,e){gs(this,t,e)};t.prototype.off=function(t,e){ms(this,t,e)}}function vo(){this.id=null}function yo(t,e,n){for(var r=0,i=0;;){var o=t.indexOf(" ",r);-1==o&&(o=t.length);var a=o-r;if(o==t.length||i+a>=e)return r+Math.min(a,e-i);i+=o-r;i+=n-i%n;r=o+1;if(i>=e)return r}}function bo(t){for(;ks.length<=t;)ks.push(xo(ks)+" ");return ks[t]}function xo(t){return t[t.length-1]}function wo(t,e){for(var n=0;n<t.length;++n)if(t[n]==e)return n;return-1}function Co(t,e){for(var n=[],r=0;r<t.length;r++)n[r]=e(t[r],r);return n}function So(t,e){var n;if(Object.create)n=Object.create(t);else{var r=function(){};r.prototype=t;n=new r}e&&To(e,n);return n}function To(t,e,n){e||(e={});for(var r in t)!t.hasOwnProperty(r)||n===!1&&e.hasOwnProperty(r)||(e[r]=t[r]);return e}function ko(t){var e=Array.prototype.slice.call(arguments,1);return function(){return t.apply(null,e)}}function _o(t,e){return e?e.source.indexOf("\\w")>-1&&Ls(t)?!0:e.test(t):Ls(t)}function Mo(t){for(var e in t)if(t.hasOwnProperty(e)&&t[e])return!1;return!0}function Do(t){return t.charCodeAt(0)>=768&&As.test(t)}function Lo(t,e,n,r){var i=document.createElement(t);n&&(i.className=n);r&&(i.style.cssText=r);if("string"==typeof e)i.appendChild(document.createTextNode(e));else if(e)for(var o=0;o<e.length;++o)i.appendChild(e[o]);return i}function Ao(t){for(var e=t.childNodes.length;e>0;--e)t.removeChild(t.firstChild);return t}function No(t,e){return Ao(t).appendChild(e)}function Eo(t,e){if(t.contains)return t.contains(e);for(;e=e.parentNode;)if(e==t)return!0}function jo(){return document.activeElement}function Io(t){return new RegExp("(^|\\s)"+t+"(?:$|\\s)\\s*")}function Po(t,e){for(var n=t.split(" "),r=0;r<n.length;r++)n[r]&&!Io(n[r]).test(e)&&(e+=" "+n[r]);return e}function Ho(t){if(document.body.getElementsByClassName)for(var e=document.body.getElementsByClassName("CodeMirror"),n=0;n<e.length;n++){var r=e[n].CodeMirror;r&&t(r)}}function Oo(){if(!Ps){Ro();Ps=!0}}function Ro(){var t;gs(window,"resize",function(){null==t&&(t=setTimeout(function(){t=null;Ho(Pn)},100))});gs(window,"blur",function(){Ho(or)})}function Fo(t){if(null==Ns){var e=Lo("span","");No(t,Lo("span",[e,document.createTextNode("x")]));0!=t.firstChild.offsetHeight&&(Ns=e.offsetWidth<=1&&e.offsetHeight>2&&!(ia&&8>oa))}return Ns?Lo("span",""):Lo("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px")}function Wo(t){if(null!=Es)return Es;var e=No(t,document.createTextNode("AخA")),n=Ms(e,0,1).getBoundingClientRect();if(!n||n.left==n.right)return!1;var r=Ms(e,1,2).getBoundingClientRect();return Es=r.right-n.right<3}function zo(t){if(null!=Ws)return Ws;var e=No(t,Lo("span","x")),n=e.getBoundingClientRect(),r=Ms(e,0,1).getBoundingClientRect();return Ws=Math.abs(n.left-r.left)>1}function qo(t,e,n,r){if(!t)return r(e,n,"ltr");for(var i=!1,o=0;o<t.length;++o){var a=t[o];if(a.from<n&&a.to>e||e==n&&a.to==e){r(Math.max(a.from,e),Math.min(a.to,n),1==a.level?"rtl":"ltr");i=!0}}i||r(e,n,"ltr")}function Uo(t){return t.level%2?t.to:t.from}function Bo(t){return t.level%2?t.from:t.to}function Vo(t){var e=Vi(t);return e?Uo(e[0]):0}function Xo(t){var e=Vi(t);return e?Bo(xo(e)):t.text.length}function Go(t,e){var n=Ri(t.doc,e),r=oi(n);r!=n&&(e=qi(r));var i=Vi(r),o=i?i[0].level%2?Xo(r):Vo(r):0;return Sa(e,o)}function $o(t,e){for(var n,r=Ri(t.doc,e);n=ri(r);){r=n.find(1,!0).line;e=null}var i=Vi(r),o=i?i[0].level%2?Vo(r):Xo(r):r.text.length;return Sa(null==e?qi(r):e,o)}function Yo(t,e){var n=Go(t,e.line),r=Ri(t.doc,n.line),i=Vi(r);if(!i||0==i[0].level){var o=Math.max(0,r.text.search(/\S/)),a=e.line==n.line&&e.ch<=o&&e.ch;return Sa(n.line,a?0:o)}return n}function Jo(t,e,n){var r=t[0].level;return e==r?!0:n==r?!1:n>e}function Ko(t,e){qs=null;for(var n,r=0;r<t.length;++r){var i=t[r];if(i.from<e&&i.to>e)return r;if(i.from==e||i.to==e){if(null!=n){if(Jo(t,i.level,t[n].level)){i.from!=i.to&&(qs=n);return r}i.from!=i.to&&(qs=r);return n}n=r}}return n}function Zo(t,e,n,r){if(!r)return e+n;do e+=n;while(e>0&&Do(t.text.charAt(e)));return e}function Qo(t,e,n,r){var i=Vi(t);if(!i)return ta(t,e,n,r);for(var o=Ko(i,e),a=i[o],s=Zo(t,e,a.level%2?-n:n,r);;){if(s>a.from&&s<a.to)return s;if(s==a.from||s==a.to){if(Ko(i,s)==o)return s;a=i[o+=n];return n>0==a.level%2?a.to:a.from}a=i[o+=n];if(!a)return null;s=n>0==a.level%2?Zo(t,a.to,-1,r):Zo(t,a.from,1,r)}}function ta(t,e,n,r){var i=e+n;if(r)for(;i>0&&Do(t.text.charAt(i));)i+=n;return 0>i||i>t.text.length?null:i}var ea=/gecko\/\d/i.test(navigator.userAgent),na=/MSIE \d/.test(navigator.userAgent),ra=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),ia=na||ra,oa=ia&&(na?document.documentMode||6:ra[1]),aa=/WebKit\//.test(navigator.userAgent),sa=aa&&/Qt\/\d+\.\d+/.test(navigator.userAgent),la=/Chrome\//.test(navigator.userAgent),ua=/Opera\//.test(navigator.userAgent),ca=/Apple Computer/.test(navigator.vendor),fa=/KHTML\//.test(navigator.userAgent),ha=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent),da=/PhantomJS/.test(navigator.userAgent),pa=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent),ga=pa||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(navigator.userAgent),ma=pa||/Mac/.test(navigator.platform),va=/win/i.test(navigator.platform),ya=ua&&navigator.userAgent.match(/Version\/(\d*\.\d*)/);ya&&(ya=Number(ya[1]));if(ya&&ya>=15){ua=!1;aa=!0}var ba=ma&&(sa||ua&&(null==ya||12.11>ya)),xa=ea||ia&&oa>=9,wa=!1,Ca=!1;g.prototype=To({update:function(t){var e=t.scrollWidth>t.clientWidth+1,n=t.scrollHeight>t.clientHeight+1,r=t.nativeBarWidth;if(n){this.vert.style.display="block";this.vert.style.bottom=e?r+"px":"0";var i=t.viewHeight-(e?r:0);this.vert.firstChild.style.height=Math.max(0,t.scrollHeight-t.clientHeight+i)+"px"}else{this.vert.style.display="";this.vert.firstChild.style.height="0"}if(e){this.horiz.style.display="block";this.horiz.style.right=n?r+"px":"0";this.horiz.style.left=t.barLeft+"px";var o=t.viewWidth-t.barLeft-(n?r:0);this.horiz.firstChild.style.width=t.scrollWidth-t.clientWidth+o+"px"}else{this.horiz.style.display="";this.horiz.firstChild.style.width="0"}if(!this.checkedOverlay&&t.clientHeight>0){0==r&&this.overlayHack();this.checkedOverlay=!0}return{right:n?r:0,bottom:e?r:0}},setScrollLeft:function(t){this.horiz.scrollLeft!=t&&(this.horiz.scrollLeft=t)},setScrollTop:function(t){this.vert.scrollTop!=t&&(this.vert.scrollTop=t)},overlayHack:function(){var t=ma&&!ha?"12px":"18px";this.horiz.style.minHeight=this.vert.style.minWidth=t;var e=this,n=function(t){lo(t)!=e.vert&&lo(t)!=e.horiz&&gn(e.cm,Rn)(t)};gs(this.vert,"mousedown",n);gs(this.horiz,"mousedown",n)},clear:function(){var t=this.horiz.parentNode;t.removeChild(this.horiz);t.removeChild(this.vert)}},g.prototype);m.prototype=To({update:function(){return{bottom:0,right:0}},setScrollLeft:function(){},setScrollTop:function(){},clear:function(){}},m.prototype);t.scrollbarModel={"native":g,"null":m};var Sa=t.Pos=function(t,e){if(!(this instanceof Sa))return new Sa(t,e);this.line=t;this.ch=e},Ta=t.cmpPos=function(t,e){return t.line-e.line||t.ch-e.ch};J.prototype={primary:function(){return this.ranges[this.primIndex]},equals:function(t){if(t==this)return!0;if(t.primIndex!=this.primIndex||t.ranges.length!=this.ranges.length)return!1;for(var e=0;e<this.ranges.length;e++){var n=this.ranges[e],r=t.ranges[e];if(0!=Ta(n.anchor,r.anchor)||0!=Ta(n.head,r.head))return!1}return!0},deepCopy:function(){for(var t=[],e=0;e<this.ranges.length;e++)t[e]=new K(G(this.ranges[e].anchor),G(this.ranges[e].head));return new J(t,this.primIndex)},somethingSelected:function(){for(var t=0;t<this.ranges.length;t++)if(!this.ranges[t].empty())return!0;return!1},contains:function(t,e){e||(e=t);for(var n=0;n<this.ranges.length;n++){var r=this.ranges[n];if(Ta(e,r.from())>=0&&Ta(t,r.to())<=0)return n}return-1}};K.prototype={from:function(){return Y(this.anchor,this.head)},to:function(){return $(this.anchor,this.head)},empty:function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch}};var ka,_a,Ma,Da={left:0,right:0,top:0,bottom:0},La=null,Aa=0,Na=null,Ea=0,ja=0,Ia=null;ia?Ia=-.53:ea?Ia=15:la?Ia=-.7:ca&&(Ia=-1/3);var Pa=function(t){var e=t.wheelDeltaX,n=t.wheelDeltaY;null==e&&t.detail&&t.axis==t.HORIZONTAL_AXIS&&(e=t.detail);null==n&&t.detail&&t.axis==t.VERTICAL_AXIS?n=t.detail:null==n&&(n=t.wheelDelta);return{x:e,y:n}};t.wheelEventPixels=function(t){var e=Pa(t);e.x*=Ia;e.y*=Ia;return e};var Ha=new vo,Oa=null,Ra=t.changeEnd=function(t){return t.text?Sa(t.from.line+t.text.length-1,xo(t.text).length+(1==t.text.length?t.from.ch:0)):t.to};t.prototype={constructor:t,focus:function(){window.focus();Nn(this);Dn(this)},setOption:function(t,e){var n=this.options,r=n[t];if(n[t]!=e||"mode"==t){n[t]=e;Wa.hasOwnProperty(t)&&gn(this,Wa[t])(this,e,r)}},getOption:function(t){return this.options[t]},getDoc:function(){return this.doc},addKeyMap:function(t,e){this.state.keyMaps[e?"push":"unshift"](Ir(t))},removeKeyMap:function(t){for(var e=this.state.keyMaps,n=0;n<e.length;++n)if(e[n]==t||e[n].name==t){e.splice(n,1);return!0}},addOverlay:mn(function(e,n){var r=e.token?e:t.getMode(this.options,e);if(r.startState)throw new Error("Overlays may not be stateful.");this.state.overlays.push({mode:r,modeSpec:e,opaque:n&&n.opaque});this.state.modeGen++;xn(this)}),removeOverlay:mn(function(t){for(var e=this.state.overlays,n=0;n<e.length;++n){var r=e[n].modeSpec;if(r==t||"string"==typeof t&&r.name==t){e.splice(n,1);this.state.modeGen++;xn(this);return}}}),indentLine:mn(function(t,e,n){"string"!=typeof e&&"number"!=typeof e&&(e=null==e?this.options.smartIndent?"smart":"prev":e?"add":"subtract");re(this.doc,t)&&Mr(this,t,e,n)}),indentSelection:mn(function(t){for(var e=this.doc.sel.ranges,n=-1,r=0;r<e.length;r++){var i=e[r];if(i.empty()){if(i.head.line>n){Mr(this,i.head.line,t,!0);n=i.head.line;r==this.doc.sel.primIndex&&kr(this)}}else{var o=i.from(),a=i.to(),s=Math.max(n,o.line);n=Math.min(this.lastLine(),a.line-(a.ch?0:1))+1;for(var l=s;n>l;++l)Mr(this,l,t);var u=this.doc.sel.ranges;0==o.ch&&e.length==u.length&&u[r].from().ch>0&&le(this.doc,r,new K(o,u[r].to()),ws)}}}),getTokenAt:function(t,e){return bi(this,t,e)},getLineTokens:function(t,e){return bi(this,Sa(t),e,!0)},getTokenTypeAt:function(t){t=ee(this.doc,t);var e,n=Ci(this,Ri(this.doc,t.line)),r=0,i=(n.length-1)/2,o=t.ch;if(0==o)e=n[2];else for(;;){var a=r+i>>1;if((a?n[2*a-1]:0)>=o)i=a;else{if(!(n[2*a+1]<o)){e=n[2*a+2];break}r=a+1}}var s=e?e.indexOf("cm-overlay "):-1;return 0>s?e:0==s?null:e.slice(0,s-1)},getModeAt:function(e){var n=this.doc.mode;return n.innerMode?t.innerMode(n,this.getTokenAt(e).state).mode:n},getHelper:function(t,e){return this.getHelpers(t,e)[0]},getHelpers:function(t,e){var n=[];if(!Xa.hasOwnProperty(e))return Xa;var r=Xa[e],i=this.getModeAt(t);if("string"==typeof i[e])r[i[e]]&&n.push(r[i[e]]);else if(i[e])for(var o=0;o<i[e].length;o++){var a=r[i[e][o]];a&&n.push(a)}else i.helperType&&r[i.helperType]?n.push(r[i.helperType]):r[i.name]&&n.push(r[i.name]);for(var o=0;o<r._global.length;o++){var s=r._global[o];s.pred(i,this)&&-1==wo(n,s.val)&&n.push(s.val)}return n},getStateAfter:function(t,e){var n=this.doc;t=te(n,null==t?n.first+n.size-1:t);return Me(this,t+1,e)},cursorCoords:function(t,e){var n,r=this.doc.sel.primary();n=null==t?r.head:"object"==typeof t?ee(this.doc,t):t?r.from():r.to();return Ke(this,n,e||"page")},charCoords:function(t,e){return Je(this,ee(this.doc,t),e||"page")},coordsChar:function(t,e){t=Ye(this,t,e||"page");return tn(this,t.left,t.top)},lineAtHeight:function(t,e){t=Ye(this,{top:t,left:0},e||"page").top;return Ui(this.doc,t+this.display.viewOffset)},heightAtLine:function(t,e){var n=!1,r=this.doc.first+this.doc.size-1;if(t<this.doc.first)t=this.doc.first;else if(t>r){t=r;n=!0}var i=Ri(this.doc,t);return $e(this,i,{top:0,left:0},e||"page").top+(n?this.doc.height-Bi(i):0)},defaultTextHeight:function(){return nn(this.display)},defaultCharWidth:function(){return rn(this.display)},setGutterMarker:mn(function(t,e,n){return Dr(this.doc,t,"gutter",function(t){var r=t.gutterMarkers||(t.gutterMarkers={});r[e]=n;!n&&Mo(r)&&(t.gutterMarkers=null);return!0})}),clearGutter:mn(function(t){var e=this,n=e.doc,r=n.first;n.iter(function(n){if(n.gutterMarkers&&n.gutterMarkers[t]){n.gutterMarkers[t]=null;wn(e,r,"gutter");Mo(n.gutterMarkers)&&(n.gutterMarkers=null)}++r})}),addLineWidget:mn(function(t,e,n){return di(this,t,e,n)}),removeLineWidget:function(t){t.clear()},lineInfo:function(t){if("number"==typeof t){if(!re(this.doc,t))return null;var e=t;t=Ri(this.doc,t);if(!t)return null}else{var e=qi(t);if(null==e)return null}return{line:e,handle:t,text:t.text,gutterMarkers:t.gutterMarkers,textClass:t.textClass,bgClass:t.bgClass,wrapClass:t.wrapClass,widgets:t.widgets}},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(t,e,n,r,i){var o=this.display;t=Ke(this,ee(this.doc,t));var a=t.bottom,s=t.left;e.style.position="absolute";e.setAttribute("cm-ignore-events","true");o.sizer.appendChild(e);if("over"==r)a=t.top;else if("above"==r||"near"==r){var l=Math.max(o.wrapper.clientHeight,this.doc.height),u=Math.max(o.sizer.clientWidth,o.lineSpace.clientWidth);("above"==r||t.bottom+e.offsetHeight>l)&&t.top>e.offsetHeight?a=t.top-e.offsetHeight:t.bottom+e.offsetHeight<=l&&(a=t.bottom);s+e.offsetWidth>u&&(s=u-e.offsetWidth)}e.style.top=a+"px";e.style.left=e.style.right="";if("right"==i){s=o.sizer.clientWidth-e.offsetWidth;e.style.right="0px"}else{"left"==i?s=0:"middle"==i&&(s=(o.sizer.clientWidth-e.offsetWidth)/2);e.style.left=s+"px"}n&&Cr(this,s,a,s+e.offsetWidth,a+e.offsetHeight)},triggerOnKeyDown:mn(tr),triggerOnKeyPress:mn(rr),triggerOnKeyUp:nr,execCommand:function(t){return Ya.hasOwnProperty(t)?Ya[t](this):void 0},findPosH:function(t,e,n,r){var i=1;if(0>e){i=-1;e=-e}for(var o=0,a=ee(this.doc,t);e>o;++o){a=Ar(this.doc,a,i,n,r);if(a.hitSide)break}return a},moveH:mn(function(t,e){var n=this;n.extendSelectionsBy(function(r){return n.display.shift||n.doc.extend||r.empty()?Ar(n.doc,r.head,t,e,n.options.rtlMoveVisually):0>t?r.from():r.to()},Ss)}),deleteH:mn(function(t,e){var n=this.doc.sel,r=this.doc;n.somethingSelected()?r.replaceSelection("",null,"+delete"):Lr(this,function(n){var i=Ar(r,n.head,t,e,!1);return 0>t?{from:i,to:n.head}:{from:n.head,to:i}})}),findPosV:function(t,e,n,r){var i=1,o=r;if(0>e){i=-1;e=-e}for(var a=0,s=ee(this.doc,t);e>a;++a){var l=Ke(this,s,"div");null==o?o=l.left:l.left=o;s=Nr(this,l,i,n);if(s.hitSide)break}return s},moveV:mn(function(t,e){var n=this,r=this.doc,i=[],o=!n.display.shift&&!r.extend&&r.sel.somethingSelected();r.extendSelectionsBy(function(a){if(o)return 0>t?a.from():a.to();var s=Ke(n,a.head,"div");null!=a.goalColumn&&(s.left=a.goalColumn);i.push(s.left);var l=Nr(n,s,t,e);"page"==e&&a==r.sel.primary()&&Tr(n,null,Je(n,l,"div").top-s.top);return l},Ss);if(i.length)for(var a=0;a<r.sel.ranges.length;a++)r.sel.ranges[a].goalColumn=i[a]}),findWordAt:function(t){var e=this.doc,n=Ri(e,t.line).text,r=t.ch,i=t.ch;if(n){var o=this.getHelper(t,"wordChars");(t.xRel<0||i==n.length)&&r?--r:++i;for(var a=n.charAt(r),s=_o(a,o)?function(t){return _o(t,o)}:/\s/.test(a)?function(t){return/\s/.test(t)}:function(t){return!/\s/.test(t)&&!_o(t)};r>0&&s(n.charAt(r-1));)--r;for(;i<n.length&&s(n.charAt(i));)++i}return new K(Sa(t.line,r),Sa(t.line,i))},toggleOverwrite:function(t){if(null==t||t!=this.state.overwrite){(this.state.overwrite=!this.state.overwrite)?Is(this.display.cursorDiv,"CodeMirror-overwrite"):js(this.display.cursorDiv,"CodeMirror-overwrite");vs(this,"overwriteToggle",this,this.state.overwrite)}},hasFocus:function(){return jo()==this.display.input},scrollTo:mn(function(t,e){(null!=t||null!=e)&&_r(this);null!=t&&(this.curOp.scrollLeft=t);null!=e&&(this.curOp.scrollTop=e)}),getScrollInfo:function(){var t=this.display.scroller;return{left:t.scrollLeft,top:t.scrollTop,height:t.scrollHeight-Ne(this)-this.display.barHeight,width:t.scrollWidth-Ne(this)-this.display.barWidth,clientHeight:je(this),clientWidth:Ee(this)}},scrollIntoView:mn(function(t,e){if(null==t){t={from:this.doc.sel.primary().head,to:null};null==e&&(e=this.options.cursorScrollMargin)}else"number"==typeof t?t={from:Sa(t,0),to:null}:null==t.from&&(t={from:t,to:null});t.to||(t.to=t.from);t.margin=e||0;if(null!=t.from.line){_r(this);this.curOp.scrollToPos=t}else{var n=Sr(this,Math.min(t.from.left,t.to.left),Math.min(t.from.top,t.to.top)-t.margin,Math.max(t.from.right,t.to.right),Math.max(t.from.bottom,t.to.bottom)+t.margin);this.scrollTo(n.scrollLeft,n.scrollTop)}}),setSize:mn(function(t,e){function n(t){return"number"==typeof t||/^\d+$/.test(String(t))?t+"px":t}var r=this;null!=t&&(r.display.wrapper.style.width=n(t));null!=e&&(r.display.wrapper.style.height=n(e));r.options.lineWrapping&&Be(this);var i=r.display.viewFrom;r.doc.iter(i,r.display.viewTo,function(t){if(t.widgets)for(var e=0;e<t.widgets.length;e++)if(t.widgets[e].noHScroll){wn(r,i,"widget");break}++i});r.curOp.forceUpdate=!0;vs(r,"refresh",this)}),operation:function(t){return pn(this,t)},refresh:mn(function(){var t=this.display.cachedTextHeight;xn(this);this.curOp.forceUpdate=!0;Ve(this);this.scrollTo(this.doc.scrollLeft,this.doc.scrollTop);c(this);(null==t||Math.abs(t-nn(this.display))>.5)&&a(this);vs(this,"refresh",this)}),swapDoc:mn(function(t){var e=this.doc;e.cm=null;Oi(this,t);Ve(this);An(this);this.scrollTo(t.scrollLeft,t.scrollTop);this.curOp.forceScroll=!0;co(this,"swapDoc",this,e);return e}),getInputField:function(){return this.display.input},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}};mo(t);var Fa=t.defaults={},Wa=t.optionHandlers={},za=t.Init={toString:function(){return"CodeMirror.Init"}};Er("value","",function(t,e){t.setValue(e)},!0);Er("mode",null,function(t,e){t.doc.modeOption=e;n(t)},!0);Er("indentUnit",2,n,!0);Er("indentWithTabs",!1);Er("smartIndent",!0);Er("tabSize",4,function(t){r(t);Ve(t);xn(t)},!0);Er("specialChars",/[\t\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g,function(t,e){t.options.specialChars=new RegExp(e.source+(e.test(" ")?"":"| "),"g");t.refresh()},!0);Er("specialCharPlaceholder",_i,function(t){t.refresh()},!0);Er("electricChars",!0);Er("rtlMoveVisually",!va);Er("wholeLineUpdateBefore",!0);Er("theme","default",function(t){s(t);l(t)},!0);Er("keyMap","default",function(e,n,r){var i=Ir(n),o=r!=t.Init&&Ir(r);o&&o.detach&&o.detach(e,i);i.attach&&i.attach(e,o||null)});Er("extraKeys",null);Er("lineWrapping",!1,i,!0);Er("gutters",[],function(t){d(t.options);l(t)},!0);Er("fixedGutter",!0,function(t,e){t.display.gutters.style.left=e?T(t.display)+"px":"0";t.refresh()},!0);Er("coverGutterNextToScrollbar",!1,function(t){y(t)},!0);Er("scrollbarStyle","native",function(t){v(t);y(t);t.display.scrollbars.setScrollTop(t.doc.scrollTop);t.display.scrollbars.setScrollLeft(t.doc.scrollLeft)},!0);Er("lineNumbers",!1,function(t){d(t.options);l(t)},!0);Er("firstLineNumber",1,l,!0);Er("lineNumberFormatter",function(t){return t},l,!0);Er("showCursorWhenSelecting",!1,xe,!0);Er("resetSelectionOnContextMenu",!0);Er("readOnly",!1,function(t,e){if("nocursor"==e){or(t);t.display.input.blur();t.display.disabled=!0}else{t.display.disabled=!1;e||An(t)}});Er("disableInput",!1,function(t,e){e||An(t)},!0);Er("dragDrop",!0);Er("cursorBlinkRate",530);Er("cursorScrollMargin",0);Er("cursorHeight",1,xe,!0);Er("singleCursorHeightPerLine",!0,xe,!0);Er("workTime",100);Er("workDelay",100);Er("flattenSpans",!0,r,!0);Er("addModeClass",!1,r,!0);Er("pollInterval",100);Er("undoDepth",200,function(t,e){t.doc.history.undoDepth=e});Er("historyEventDelay",1250);Er("viewportMargin",10,function(t){t.refresh()},!0);Er("maxHighlightLength",1e4,r,!0);Er("moveInputWithCursor",!0,function(t,e){e||(t.display.inputDiv.style.top=t.display.inputDiv.style.left=0)});Er("tabindex",null,function(t,e){t.display.input.tabIndex=e||""});Er("autofocus",null);var qa=t.modes={},Ua=t.mimeModes={};t.defineMode=function(e,n){t.defaults.mode||"null"==e||(t.defaults.mode=e);arguments.length>2&&(n.dependencies=Array.prototype.slice.call(arguments,2));qa[e]=n};t.defineMIME=function(t,e){Ua[t]=e};t.resolveMode=function(e){if("string"==typeof e&&Ua.hasOwnProperty(e))e=Ua[e];else if(e&&"string"==typeof e.name&&Ua.hasOwnProperty(e.name)){var n=Ua[e.name];"string"==typeof n&&(n={name:n});e=So(n,e);e.name=n.name}else if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return t.resolveMode("application/xml");return"string"==typeof e?{name:e}:e||{name:"null"}};t.getMode=function(e,n){var n=t.resolveMode(n),r=qa[n.name];if(!r)return t.getMode(e,"text/plain");var i=r(e,n);if(Ba.hasOwnProperty(n.name)){var o=Ba[n.name];for(var a in o)if(o.hasOwnProperty(a)){i.hasOwnProperty(a)&&(i["_"+a]=i[a]);i[a]=o[a]}}i.name=n.name;n.helperType&&(i.helperType=n.helperType);if(n.modeProps)for(var a in n.modeProps)i[a]=n.modeProps[a];return i};t.defineMode("null",function(){return{token:function(t){t.skipToEnd()}}});t.defineMIME("text/plain","null");var Ba=t.modeExtensions={};t.extendMode=function(t,e){var n=Ba.hasOwnProperty(t)?Ba[t]:Ba[t]={};To(e,n)};t.defineExtension=function(e,n){t.prototype[e]=n};t.defineDocExtension=function(t,e){us.prototype[t]=e};t.defineOption=Er;var Va=[];t.defineInitHook=function(t){Va.push(t)};var Xa=t.helpers={};t.registerHelper=function(e,n,r){Xa.hasOwnProperty(e)||(Xa[e]=t[e]={_global:[]});Xa[e][n]=r};t.registerGlobalHelper=function(e,n,r,i){t.registerHelper(e,n,i);Xa[e]._global.push({pred:r,val:i})};var Ga=t.copyState=function(t,e){if(e===!0)return e;if(t.copyState)return t.copyState(e);var n={};for(var r in e){var i=e[r];i instanceof Array&&(i=i.concat([]));n[r]=i}return n},$a=t.startState=function(t,e,n){return t.startState?t.startState(e,n):!0};t.innerMode=function(t,e){for(;t.innerMode;){var n=t.innerMode(e);if(!n||n.mode==t)break;e=n.state;t=n.mode}return n||{mode:t,state:e}};var Ya=t.commands={selectAll:function(t){t.setSelection(Sa(t.firstLine(),0),Sa(t.lastLine()),ws)},singleSelection:function(t){t.setSelection(t.getCursor("anchor"),t.getCursor("head"),ws)},killLine:function(t){Lr(t,function(e){if(e.empty()){var n=Ri(t.doc,e.head.line).text.length;return e.head.ch==n&&e.head.line<t.lastLine()?{from:e.head,to:Sa(e.head.line+1,0)}:{from:e.head,to:Sa(e.head.line,n)}}return{from:e.from(),to:e.to()}})},deleteLine:function(t){Lr(t,function(e){return{from:Sa(e.from().line,0),to:ee(t.doc,Sa(e.to().line+1,0))}})},delLineLeft:function(t){Lr(t,function(t){return{from:Sa(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(t){Lr(t,function(e){var n=t.charCoords(e.head,"div").top+5,r=t.coordsChar({left:0,top:n},"div");return{from:r,to:e.from()}})},delWrappedLineRight:function(t){Lr(t,function(e){var n=t.charCoords(e.head,"div").top+5,r=t.coordsChar({left:t.display.lineDiv.offsetWidth+100,top:n},"div");return{from:e.from(),to:r}})},undo:function(t){t.undo()},redo:function(t){t.redo()},undoSelection:function(t){t.undoSelection()},redoSelection:function(t){t.redoSelection()},goDocStart:function(t){t.extendSelection(Sa(t.firstLine(),0))},goDocEnd:function(t){t.extendSelection(Sa(t.lastLine()))},goLineStart:function(t){t.extendSelectionsBy(function(e){return Go(t,e.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(t){t.extendSelectionsBy(function(e){return Yo(t,e.head)},{origin:"+move",bias:1})},goLineEnd:function(t){t.extendSelectionsBy(function(e){return $o(t,e.head.line)},{origin:"+move",bias:-1})},goLineRight:function(t){t.extendSelectionsBy(function(e){var n=t.charCoords(e.head,"div").top+5;return t.coordsChar({left:t.display.lineDiv.offsetWidth+100,top:n},"div")},Ss)},goLineLeft:function(t){t.extendSelectionsBy(function(e){var n=t.charCoords(e.head,"div").top+5;return t.coordsChar({left:0,top:n},"div")},Ss)},goLineLeftSmart:function(t){t.extendSelectionsBy(function(e){var n=t.charCoords(e.head,"div").top+5,r=t.coordsChar({left:0,top:n},"div");return r.ch<t.getLine(r.line).search(/\S/)?Yo(t,e.head):r},Ss)},goLineUp:function(t){t.moveV(-1,"line")},goLineDown:function(t){t.moveV(1,"line")},goPageUp:function(t){t.moveV(-1,"page")},goPageDown:function(t){t.moveV(1,"page")},goCharLeft:function(t){t.moveH(-1,"char")},goCharRight:function(t){t.moveH(1,"char")},goColumnLeft:function(t){t.moveH(-1,"column")},goColumnRight:function(t){t.moveH(1,"column")},goWordLeft:function(t){t.moveH(-1,"word")},goGroupRight:function(t){t.moveH(1,"group")},goGroupLeft:function(t){t.moveH(-1,"group")},goWordRight:function(t){t.moveH(1,"word")},delCharBefore:function(t){t.deleteH(-1,"char")},delCharAfter:function(t){t.deleteH(1,"char")},delWordBefore:function(t){t.deleteH(-1,"word")},delWordAfter:function(t){t.deleteH(1,"word")},delGroupBefore:function(t){t.deleteH(-1,"group")},delGroupAfter:function(t){t.deleteH(1,"group")},indentAuto:function(t){t.indentSelection("smart")},indentMore:function(t){t.indentSelection("add")},indentLess:function(t){t.indentSelection("subtract")},insertTab:function(t){t.replaceSelection(" ")},insertSoftTab:function(t){for(var e=[],n=t.listSelections(),r=t.options.tabSize,i=0;i<n.length;i++){var o=n[i].from(),a=Ts(t.getLine(o.line),o.ch,r);e.push(new Array(r-a%r+1).join(" "))}t.replaceSelections(e)},defaultTab:function(t){t.somethingSelected()?t.indentSelection("add"):t.execCommand("insertTab")},transposeChars:function(t){pn(t,function(){for(var e=t.listSelections(),n=[],r=0;r<e.length;r++){var i=e[r].head,o=Ri(t.doc,i.line).text;if(o){i.ch==o.length&&(i=new Sa(i.line,i.ch-1));if(i.ch>0){i=new Sa(i.line,i.ch+1);t.replaceRange(o.charAt(i.ch-1)+o.charAt(i.ch-2),Sa(i.line,i.ch-2),i,"+transpose")}else if(i.line>t.doc.first){var a=Ri(t.doc,i.line-1).text;a&&t.replaceRange(o.charAt(0)+"\n"+a.charAt(a.length-1),Sa(i.line-1,a.length-1),Sa(i.line,1),"+transpose")}}n.push(new K(i,i))}t.setSelections(n)})},newlineAndIndent:function(t){pn(t,function(){for(var e=t.listSelections().length,n=0;e>n;n++){var r=t.listSelections()[n];t.replaceRange("\n",r.anchor,r.head,"+input");t.indentLine(r.from().line+1,null,!0);kr(t)}})},toggleOverwrite:function(t){t.toggleOverwrite()}},Ja=t.keyMap={};Ja.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"};Ja.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"};Ja.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars"};Ja.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]};Ja["default"]=ma?Ja.macDefault:Ja.pcDefault;t.normalizeKeyMap=function(t){var e={};for(var n in t)if(t.hasOwnProperty(n)){var r=t[n];if(/^(name|fallthrough|(de|at)tach)$/.test(n))continue;if("..."==r){delete t[n];continue}for(var i=Co(n.split(" "),jr),o=0;o<i.length;o++){var a,s;if(o==i.length-1){s=n;a=r}else{s=i.slice(0,o+1).join(" ");a="..."}var l=e[s];if(l){if(l!=a)throw new Error("Inconsistent bindings for "+s)}else e[s]=a}delete t[n]}for(var u in e)t[u]=e[u];return t};var Ka=t.lookupKey=function(t,e,n,r){e=Ir(e);var i=e.call?e.call(t,r):e[t];if(i===!1)return"nothing";if("..."===i)return"multi";if(null!=i&&n(i))return"handled";if(e.fallthrough){if("[object Array]"!=Object.prototype.toString.call(e.fallthrough))return Ka(t,e.fallthrough,n,r);for(var o=0;o<e.fallthrough.length;o++){var a=Ka(t,e.fallthrough[o],n,r);if(a)return a}}},Za=t.isModifierKey=function(t){var e="string"==typeof t?t:zs[t.keyCode];return"Ctrl"==e||"Alt"==e||"Shift"==e||"Mod"==e},Qa=t.keyName=function(t,e){if(ua&&34==t.keyCode&&t["char"])return!1;var n=zs[t.keyCode],r=n;if(null==r||t.altGraphKey)return!1;t.altKey&&"Alt"!=n&&(r="Alt-"+r);(ba?t.metaKey:t.ctrlKey)&&"Ctrl"!=n&&(r="Ctrl-"+r);(ba?t.ctrlKey:t.metaKey)&&"Cmd"!=n&&(r="Cmd-"+r);!e&&t.shiftKey&&"Shift"!=n&&(r="Shift-"+r);return r};t.fromTextArea=function(e,n){function r(){e.value=u.getValue()}n||(n={});n.value=e.value;!n.tabindex&&e.tabindex&&(n.tabindex=e.tabindex);!n.placeholder&&e.placeholder&&(n.placeholder=e.placeholder);if(null==n.autofocus){var i=jo();n.autofocus=i==e||null!=e.getAttribute("autofocus")&&i==document.body}if(e.form){gs(e.form,"submit",r);if(!n.leaveSubmitMethodAlone){var o=e.form,a=o.submit;try{var s=o.submit=function(){r();o.submit=a;o.submit();o.submit=s}}catch(l){}}}e.style.display="none";var u=t(function(t){e.parentNode.insertBefore(t,e.nextSibling)},n);u.save=r;u.getTextArea=function(){return e};u.toTextArea=function(){u.toTextArea=isNaN;r();e.parentNode.removeChild(u.getWrapperElement());e.style.display="";if(e.form){ms(e.form,"submit",r);"function"==typeof e.form.submit&&(e.form.submit=a)}};return u};var ts=t.StringStream=function(t,e){this.pos=this.start=0;this.string=t;this.tabSize=e||8;this.lastColumnPos=this.lastColumnValue=0;this.lineStart=0};ts.prototype={eol:function(){return this.pos>=this.string.length},sol:function(){return this.pos==this.lineStart},peek:function(){return this.string.charAt(this.pos)||void 0},next:function(){return this.pos<this.string.length?this.string.charAt(this.pos++):void 0},eat:function(t){var e=this.string.charAt(this.pos);if("string"==typeof t)var n=e==t;else var n=e&&(t.test?t.test(e):t(e));if(n){++this.pos;return e}},eatWhile:function(t){for(var e=this.pos;this.eat(t););return this.pos>e},eatSpace:function(){for(var t=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>t},skipToEnd:function(){this.pos=this.string.length},skipTo:function(t){var e=this.string.indexOf(t,this.pos);if(e>-1){this.pos=e;return!0}},backUp:function(t){this.pos-=t},column:function(){if(this.lastColumnPos<this.start){this.lastColumnValue=Ts(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue);
this.lastColumnPos=this.start}return this.lastColumnValue-(this.lineStart?Ts(this.string,this.lineStart,this.tabSize):0)},indentation:function(){return Ts(this.string,null,this.tabSize)-(this.lineStart?Ts(this.string,this.lineStart,this.tabSize):0)},match:function(t,e,n){if("string"!=typeof t){var r=this.string.slice(this.pos).match(t);if(r&&r.index>0)return null;r&&e!==!1&&(this.pos+=r[0].length);return r}var i=function(t){return n?t.toLowerCase():t},o=this.string.substr(this.pos,t.length);if(i(o)==i(t)){e!==!1&&(this.pos+=t.length);return!0}},current:function(){return this.string.slice(this.start,this.pos)},hideFirstChars:function(t,e){this.lineStart+=t;try{return e()}finally{this.lineStart-=t}}};var es=t.TextMarker=function(t,e){this.lines=[];this.type=e;this.doc=t};mo(es);es.prototype.clear=function(){if(!this.explicitlyCleared){var t=this.doc.cm,e=t&&!t.curOp;e&&on(t);if(go(this,"clear")){var n=this.find();n&&co(this,"clear",n.from,n.to)}for(var r=null,i=null,o=0;o<this.lines.length;++o){var a=this.lines[o],s=zr(a.markedSpans,this);if(t&&!this.collapsed)wn(t,qi(a),"text");else if(t){null!=s.to&&(i=qi(a));null!=s.from&&(r=qi(a))}a.markedSpans=qr(a.markedSpans,s);null==s.from&&this.collapsed&&!ui(this.doc,a)&&t&&zi(a,nn(t.display))}if(t&&this.collapsed&&!t.options.lineWrapping)for(var o=0;o<this.lines.length;++o){var l=oi(this.lines[o]),u=f(l);if(u>t.display.maxLineLength){t.display.maxLine=l;t.display.maxLineLength=u;t.display.maxLineChanged=!0}}null!=r&&t&&this.collapsed&&xn(t,r,i+1);this.lines.length=0;this.explicitlyCleared=!0;if(this.atomic&&this.doc.cantEdit){this.doc.cantEdit=!1;t&&ge(t.doc)}t&&co(t,"markerCleared",t,this);e&&sn(t);this.parent&&this.parent.clear()}};es.prototype.find=function(t,e){null==t&&"bookmark"==this.type&&(t=1);for(var n,r,i=0;i<this.lines.length;++i){var o=this.lines[i],a=zr(o.markedSpans,this);if(null!=a.from){n=Sa(e?o:qi(o),a.from);if(-1==t)return n}if(null!=a.to){r=Sa(e?o:qi(o),a.to);if(1==t)return r}}return n&&{from:n,to:r}};es.prototype.changed=function(){var t=this.find(-1,!0),e=this,n=this.doc.cm;t&&n&&pn(n,function(){var r=t.line,i=qi(t.line),o=Re(n,i);if(o){Ue(o);n.curOp.selectionChanged=n.curOp.forceUpdate=!0}n.curOp.updateMaxLine=!0;if(!ui(e.doc,r)&&null!=e.height){var a=e.height;e.height=null;var s=hi(e)-a;s&&zi(r,r.height+s)}})};es.prototype.attachLine=function(t){if(!this.lines.length&&this.doc.cm){var e=this.doc.cm.curOp;e.maybeHiddenMarkers&&-1!=wo(e.maybeHiddenMarkers,this)||(e.maybeUnhiddenMarkers||(e.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(t)};es.prototype.detachLine=function(t){this.lines.splice(wo(this.lines,t),1);if(!this.lines.length&&this.doc.cm){var e=this.doc.cm.curOp;(e.maybeHiddenMarkers||(e.maybeHiddenMarkers=[])).push(this)}};var ns=0,rs=t.SharedTextMarker=function(t,e){this.markers=t;this.primary=e;for(var n=0;n<t.length;++n)t[n].parent=this};mo(rs);rs.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var t=0;t<this.markers.length;++t)this.markers[t].clear();co(this,"clear")}};rs.prototype.find=function(t,e){return this.primary.find(t,e)};var is=t.LineWidget=function(t,e,n){if(n)for(var r in n)n.hasOwnProperty(r)&&(this[r]=n[r]);this.cm=t;this.node=e};mo(is);is.prototype.clear=function(){var t=this.cm,e=this.line.widgets,n=this.line,r=qi(n);if(null!=r&&e){for(var i=0;i<e.length;++i)e[i]==this&&e.splice(i--,1);e.length||(n.widgets=null);var o=hi(this);pn(t,function(){fi(t,n,-o);wn(t,r,"widget");zi(n,Math.max(0,n.height-o))})}};is.prototype.changed=function(){var t=this.height,e=this.cm,n=this.line;this.height=null;var r=hi(this)-t;r&&pn(e,function(){e.curOp.forceUpdate=!0;fi(e,n,r);zi(n,n.height+r)})};var os=t.Line=function(t,e,n){this.text=t;Kr(this,e);this.height=n?n(this):1};mo(os);os.prototype.lineNo=function(){return qi(this)};var as={},ss={};Ii.prototype={chunkSize:function(){return this.lines.length},removeInner:function(t,e){for(var n=t,r=t+e;r>n;++n){var i=this.lines[n];this.height-=i.height;gi(i);co(i,"delete")}this.lines.splice(t,e)},collapse:function(t){t.push.apply(t,this.lines)},insertInner:function(t,e,n){this.height+=n;this.lines=this.lines.slice(0,t).concat(e).concat(this.lines.slice(t));for(var r=0;r<e.length;++r)e[r].parent=this},iterN:function(t,e,n){for(var r=t+e;r>t;++t)if(n(this.lines[t]))return!0}};Pi.prototype={chunkSize:function(){return this.size},removeInner:function(t,e){this.size-=e;for(var n=0;n<this.children.length;++n){var r=this.children[n],i=r.chunkSize();if(i>t){var o=Math.min(e,i-t),a=r.height;r.removeInner(t,o);this.height-=a-r.height;if(i==o){this.children.splice(n--,1);r.parent=null}if(0==(e-=o))break;t=0}else t-=i}if(this.size-e<25&&(this.children.length>1||!(this.children[0]instanceof Ii))){var s=[];this.collapse(s);this.children=[new Ii(s)];this.children[0].parent=this}},collapse:function(t){for(var e=0;e<this.children.length;++e)this.children[e].collapse(t)},insertInner:function(t,e,n){this.size+=e.length;this.height+=n;for(var r=0;r<this.children.length;++r){var i=this.children[r],o=i.chunkSize();if(o>=t){i.insertInner(t,e,n);if(i.lines&&i.lines.length>50){for(;i.lines.length>50;){var a=i.lines.splice(i.lines.length-25,25),s=new Ii(a);i.height-=s.height;this.children.splice(r+1,0,s);s.parent=this}this.maybeSpill()}break}t-=o}},maybeSpill:function(){if(!(this.children.length<=10)){var t=this;do{var e=t.children.splice(t.children.length-5,5),n=new Pi(e);if(t.parent){t.size-=n.size;t.height-=n.height;var r=wo(t.parent.children,t);t.parent.children.splice(r+1,0,n)}else{var i=new Pi(t.children);i.parent=t;t.children=[i,n];t=i}n.parent=t.parent}while(t.children.length>10);t.parent.maybeSpill()}},iterN:function(t,e,n){for(var r=0;r<this.children.length;++r){var i=this.children[r],o=i.chunkSize();if(o>t){var a=Math.min(e,o-t);if(i.iterN(t,a,n))return!0;if(0==(e-=a))break;t=0}else t-=o}}};var ls=0,us=t.Doc=function(t,e,n){if(!(this instanceof us))return new us(t,e,n);null==n&&(n=0);Pi.call(this,[new Ii([new os("",null)])]);this.first=n;this.scrollTop=this.scrollLeft=0;this.cantEdit=!1;this.cleanGeneration=1;this.frontier=n;var r=Sa(n,0);this.sel=Q(r);this.history=new Xi(null);this.id=++ls;this.modeOption=e;"string"==typeof t&&(t=Os(t));ji(this,{from:r,to:r,text:t});he(this,Q(r),ws)};us.prototype=So(Pi.prototype,{constructor:us,iter:function(t,e,n){n?this.iterN(t-this.first,e-t,n):this.iterN(this.first,this.first+this.size,t)},insert:function(t,e){for(var n=0,r=0;r<e.length;++r)n+=e[r].height;this.insertInner(t-this.first,e,n)},remove:function(t,e){this.removeInner(t-this.first,e)},getValue:function(t){var e=Wi(this,this.first,this.first+this.size);return t===!1?e:e.join(t||"\n")},setValue:vn(function(t){var e=Sa(this.first,0),n=this.first+this.size-1;dr(this,{from:e,to:Sa(n,Ri(this,n).text.length),text:Os(t),origin:"setValue",full:!0},!0);he(this,Q(e))}),replaceRange:function(t,e,n,r){e=ee(this,e);n=n?ee(this,n):e;br(this,t,e,n,r)},getRange:function(t,e,n){var r=Fi(this,ee(this,t),ee(this,e));return n===!1?r:r.join(n||"\n")},getLine:function(t){var e=this.getLineHandle(t);return e&&e.text},getLineHandle:function(t){return re(this,t)?Ri(this,t):void 0},getLineNumber:function(t){return qi(t)},getLineHandleVisualStart:function(t){"number"==typeof t&&(t=Ri(this,t));return oi(t)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(t){return ee(this,t)},getCursor:function(t){var e,n=this.sel.primary();e=null==t||"head"==t?n.head:"anchor"==t?n.anchor:"end"==t||"to"==t||t===!1?n.to():n.from();return e},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:vn(function(t,e,n){ue(this,ee(this,"number"==typeof t?Sa(t,e||0):t),null,n)}),setSelection:vn(function(t,e,n){ue(this,ee(this,t),ee(this,e||t),n)}),extendSelection:vn(function(t,e,n){ae(this,ee(this,t),e&&ee(this,e),n)}),extendSelections:vn(function(t,e){se(this,ie(this,t,e))}),extendSelectionsBy:vn(function(t,e){se(this,Co(this.sel.ranges,t),e)}),setSelections:vn(function(t,e,n){if(t.length){for(var r=0,i=[];r<t.length;r++)i[r]=new K(ee(this,t[r].anchor),ee(this,t[r].head));null==e&&(e=Math.min(t.length-1,this.sel.primIndex));he(this,Z(i,e),n)}}),addSelection:vn(function(t,e,n){var r=this.sel.ranges.slice(0);r.push(new K(ee(this,t),ee(this,e||t)));he(this,Z(r,r.length-1),n)}),getSelection:function(t){for(var e,n=this.sel.ranges,r=0;r<n.length;r++){var i=Fi(this,n[r].from(),n[r].to());e=e?e.concat(i):i}return t===!1?e:e.join(t||"\n")},getSelections:function(t){for(var e=[],n=this.sel.ranges,r=0;r<n.length;r++){var i=Fi(this,n[r].from(),n[r].to());t!==!1&&(i=i.join(t||"\n"));e[r]=i}return e},replaceSelection:function(t,e,n){for(var r=[],i=0;i<this.sel.ranges.length;i++)r[i]=t;this.replaceSelections(r,e,n||"+input")},replaceSelections:vn(function(t,e,n){for(var r=[],i=this.sel,o=0;o<i.ranges.length;o++){var a=i.ranges[o];r[o]={from:a.from(),to:a.to(),text:Os(t[o]),origin:n}}for(var s=e&&"end"!=e&&fr(this,r,e),o=r.length-1;o>=0;o--)dr(this,r[o]);s?fe(this,s):this.cm&&kr(this.cm)}),undo:vn(function(){gr(this,"undo")}),redo:vn(function(){gr(this,"redo")}),undoSelection:vn(function(){gr(this,"undo",!0)}),redoSelection:vn(function(){gr(this,"redo",!0)}),setExtending:function(t){this.extend=t},getExtending:function(){return this.extend},historySize:function(){for(var t=this.history,e=0,n=0,r=0;r<t.done.length;r++)t.done[r].ranges||++e;for(var r=0;r<t.undone.length;r++)t.undone[r].ranges||++n;return{undo:e,redo:n}},clearHistory:function(){this.history=new Xi(this.history.maxGeneration)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(t){t&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null);return this.history.generation},isClean:function(t){return this.history.generation==(t||this.cleanGeneration)},getHistory:function(){return{done:ro(this.history.done),undone:ro(this.history.undone)}},setHistory:function(t){var e=this.history=new Xi(this.history.maxGeneration);e.done=ro(t.done.slice(0),null,!0);e.undone=ro(t.undone.slice(0),null,!0)},addLineClass:vn(function(t,e,n){return Dr(this,t,"gutter"==e?"gutter":"class",function(t){var r="text"==e?"textClass":"background"==e?"bgClass":"gutter"==e?"gutterClass":"wrapClass";if(t[r]){if(Io(n).test(t[r]))return!1;t[r]+=" "+n}else t[r]=n;return!0})}),removeLineClass:vn(function(t,e,n){return Dr(this,t,"gutter"==e?"gutter":"class",function(t){var r="text"==e?"textClass":"background"==e?"bgClass":"gutter"==e?"gutterClass":"wrapClass",i=t[r];if(!i)return!1;if(null==n)t[r]=null;else{var o=i.match(Io(n));if(!o)return!1;var a=o.index+o[0].length;t[r]=i.slice(0,o.index)+(o.index&&a!=i.length?" ":"")+i.slice(a)||null}return!0})}),markText:function(t,e,n){return Pr(this,ee(this,t),ee(this,e),n,"range")},setBookmark:function(t,e){var n={replacedWith:e&&(null==e.nodeType?e.widget:e),insertLeft:e&&e.insertLeft,clearWhenEmpty:!1,shared:e&&e.shared};t=ee(this,t);return Pr(this,t,t,n,"bookmark")},findMarksAt:function(t){t=ee(this,t);var e=[],n=Ri(this,t.line).markedSpans;if(n)for(var r=0;r<n.length;++r){var i=n[r];(null==i.from||i.from<=t.ch)&&(null==i.to||i.to>=t.ch)&&e.push(i.marker.parent||i.marker)}return e},findMarks:function(t,e,n){t=ee(this,t);e=ee(this,e);var r=[],i=t.line;this.iter(t.line,e.line+1,function(o){var a=o.markedSpans;if(a)for(var s=0;s<a.length;s++){var l=a[s];i==t.line&&t.ch>l.to||null==l.from&&i!=t.line||i==e.line&&l.from>e.ch||n&&!n(l.marker)||r.push(l.marker.parent||l.marker)}++i});return r},getAllMarks:function(){var t=[];this.iter(function(e){var n=e.markedSpans;if(n)for(var r=0;r<n.length;++r)null!=n[r].from&&t.push(n[r].marker)});return t},posFromIndex:function(t){var e,n=this.first;this.iter(function(r){var i=r.text.length+1;if(i>t){e=t;return!0}t-=i;++n});return ee(this,Sa(n,e))},indexFromPos:function(t){t=ee(this,t);var e=t.ch;if(t.line<this.first||t.ch<0)return 0;this.iter(this.first,t.line,function(t){e+=t.text.length+1});return e},copy:function(t){var e=new us(Wi(this,this.first,this.first+this.size),this.modeOption,this.first);e.scrollTop=this.scrollTop;e.scrollLeft=this.scrollLeft;e.sel=this.sel;e.extend=!1;if(t){e.history.undoDepth=this.history.undoDepth;e.setHistory(this.getHistory())}return e},linkedDoc:function(t){t||(t={});var e=this.first,n=this.first+this.size;null!=t.from&&t.from>e&&(e=t.from);null!=t.to&&t.to<n&&(n=t.to);var r=new us(Wi(this,e,n),t.mode||this.modeOption,e);t.sharedHist&&(r.history=this.history);(this.linked||(this.linked=[])).push({doc:r,sharedHist:t.sharedHist});r.linked=[{doc:this,isParent:!0,sharedHist:t.sharedHist}];Rr(r,Or(this));return r},unlinkDoc:function(e){e instanceof t&&(e=e.doc);if(this.linked)for(var n=0;n<this.linked.length;++n){var r=this.linked[n];if(r.doc==e){this.linked.splice(n,1);e.unlinkDoc(this);Fr(Or(this));break}}if(e.history==this.history){var i=[e.id];Hi(e,function(t){i.push(t.id)},!0);e.history=new Xi(null);e.history.done=ro(this.history.done,i);e.history.undone=ro(this.history.undone,i)}},iterLinkedDocs:function(t){Hi(this,t)},getMode:function(){return this.mode},getEditor:function(){return this.cm}});us.prototype.eachLine=us.prototype.iter;var cs="iter insert remove copy getEditor".split(" ");for(var fs in us.prototype)us.prototype.hasOwnProperty(fs)&&wo(cs,fs)<0&&(t.prototype[fs]=function(t){return function(){return t.apply(this.doc,arguments)}}(us.prototype[fs]));mo(us);var hs=t.e_preventDefault=function(t){t.preventDefault?t.preventDefault():t.returnValue=!1},ds=t.e_stopPropagation=function(t){t.stopPropagation?t.stopPropagation():t.cancelBubble=!0},ps=t.e_stop=function(t){hs(t);ds(t)},gs=t.on=function(t,e,n){if(t.addEventListener)t.addEventListener(e,n,!1);else if(t.attachEvent)t.attachEvent("on"+e,n);else{var r=t._handlers||(t._handlers={}),i=r[e]||(r[e]=[]);i.push(n)}},ms=t.off=function(t,e,n){if(t.removeEventListener)t.removeEventListener(e,n,!1);else if(t.detachEvent)t.detachEvent("on"+e,n);else{var r=t._handlers&&t._handlers[e];if(!r)return;for(var i=0;i<r.length;++i)if(r[i]==n){r.splice(i,1);break}}},vs=t.signal=function(t,e){var n=t._handlers&&t._handlers[e];if(n)for(var r=Array.prototype.slice.call(arguments,2),i=0;i<n.length;++i)n[i].apply(null,r)},ys=null,bs=30,xs=t.Pass={toString:function(){return"CodeMirror.Pass"}},ws={scroll:!1},Cs={origin:"*mouse"},Ss={origin:"+move"};vo.prototype.set=function(t,e){clearTimeout(this.id);this.id=setTimeout(e,t)};var Ts=t.countColumn=function(t,e,n,r,i){if(null==e){e=t.search(/[^\s\u00a0]/);-1==e&&(e=t.length)}for(var o=r||0,a=i||0;;){var s=t.indexOf(" ",o);if(0>s||s>=e)return a+(e-o);a+=s-o;a+=n-a%n;o=s+1}},ks=[""],_s=function(t){t.select()};pa?_s=function(t){t.selectionStart=0;t.selectionEnd=t.value.length}:ia&&(_s=function(t){try{t.select()}catch(e){}});var Ms,Ds=/[\u00df\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,Ls=t.isWordChar=function(t){return/\w/.test(t)||t>""&&(t.toUpperCase()!=t.toLowerCase()||Ds.test(t))},As=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;Ms=document.createRange?function(t,e,n){var r=document.createRange();r.setEnd(t,n);r.setStart(t,e);return r}:function(t,e,n){var r=document.body.createTextRange();try{r.moveToElementText(t.parentNode)}catch(i){return r}r.collapse(!0);r.moveEnd("character",n);r.moveStart("character",e);return r};ia&&11>oa&&(jo=function(){try{return document.activeElement}catch(t){return document.body}});var Ns,Es,js=t.rmClass=function(t,e){var n=t.className,r=Io(e).exec(n);if(r){var i=n.slice(r.index+r[0].length);t.className=n.slice(0,r.index)+(i?r[1]+i:"")}},Is=t.addClass=function(t,e){var n=t.className;Io(e).test(n)||(t.className+=(n?" ":"")+e)},Ps=!1,Hs=function(){if(ia&&9>oa)return!1;var t=Lo("div");return"draggable"in t||"dragDrop"in t}(),Os=t.splitLines=3!="\n\nb".split(/\n/).length?function(t){for(var e=0,n=[],r=t.length;r>=e;){var i=t.indexOf("\n",e);-1==i&&(i=t.length);var o=t.slice(e,"\r"==t.charAt(i-1)?i-1:i),a=o.indexOf("\r");if(-1!=a){n.push(o.slice(0,a));e+=a+1}else{n.push(o);e=i+1}}return n}:function(t){return t.split(/\r\n?|\n/)},Rs=window.getSelection?function(t){try{return t.selectionStart!=t.selectionEnd}catch(e){return!1}}:function(t){try{var e=t.ownerDocument.selection.createRange()}catch(n){}return e&&e.parentElement()==t?0!=e.compareEndPoints("StartToEnd",e):!1},Fs=function(){var t=Lo("div");if("oncopy"in t)return!0;t.setAttribute("oncopy","return;");return"function"==typeof t.oncopy}(),Ws=null,zs={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",107:"=",109:"-",127:"Delete",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"};t.keyNames=zs;(function(){for(var t=0;10>t;t++)zs[t+48]=zs[t+96]=String(t);for(var t=65;90>=t;t++)zs[t]=String.fromCharCode(t);for(var t=1;12>=t;t++)zs[t+111]=zs[t+63235]="F"+t})();var qs,Us=function(){function t(t){return 247>=t?n.charAt(t):t>=1424&&1524>=t?"R":t>=1536&&1773>=t?r.charAt(t-1536):t>=1774&&2220>=t?"r":t>=8192&&8203>=t?"w":8204==t?"b":"L"}function e(t,e,n){this.level=t;this.from=e;this.to=n}var n="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",r="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmm",i=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,o=/[stwN]/,a=/[LRr]/,s=/[Lb1n]/,l=/[1n]/,u="L";return function(n){if(!i.test(n))return!1;for(var r,c=n.length,f=[],h=0;c>h;++h)f.push(r=t(n.charCodeAt(h)));for(var h=0,d=u;c>h;++h){var r=f[h];"m"==r?f[h]=d:d=r}for(var h=0,p=u;c>h;++h){var r=f[h];if("1"==r&&"r"==p)f[h]="n";else if(a.test(r)){p=r;"r"==r&&(f[h]="R")}}for(var h=1,d=f[0];c-1>h;++h){var r=f[h];"+"==r&&"1"==d&&"1"==f[h+1]?f[h]="1":","!=r||d!=f[h+1]||"1"!=d&&"n"!=d||(f[h]=d);d=r}for(var h=0;c>h;++h){var r=f[h];if(","==r)f[h]="N";else if("%"==r){for(var g=h+1;c>g&&"%"==f[g];++g);for(var m=h&&"!"==f[h-1]||c>g&&"1"==f[g]?"1":"N",v=h;g>v;++v)f[v]=m;h=g-1}}for(var h=0,p=u;c>h;++h){var r=f[h];"L"==p&&"1"==r?f[h]="L":a.test(r)&&(p=r)}for(var h=0;c>h;++h)if(o.test(f[h])){for(var g=h+1;c>g&&o.test(f[g]);++g);for(var y="L"==(h?f[h-1]:u),b="L"==(c>g?f[g]:u),m=y||b?"L":"R",v=h;g>v;++v)f[v]=m;h=g-1}for(var x,w=[],h=0;c>h;)if(s.test(f[h])){var C=h;for(++h;c>h&&s.test(f[h]);++h);w.push(new e(0,C,h))}else{var S=h,T=w.length;for(++h;c>h&&"L"!=f[h];++h);for(var v=S;h>v;)if(l.test(f[v])){v>S&&w.splice(T,0,new e(1,S,v));var k=v;for(++v;h>v&&l.test(f[v]);++v);w.splice(T,0,new e(2,k,v));S=v}else++v;h>S&&w.splice(T,0,new e(1,S,h))}if(1==w[0].level&&(x=n.match(/^\s+/))){w[0].from=x[0].length;w.unshift(new e(0,0,x[0].length))}if(1==xo(w).level&&(x=n.match(/\s+$/))){xo(w).to-=x[0].length;w.push(new e(0,c-x[0].length,c))}w[0].level!=xo(w).level&&w.push(new e(w[0].level,c,c));return w}}();t.version="4.12.0";return t})},{}],12:[function(e,n,r){(function(i){"object"==typeof r&&"object"==typeof n?i(e("../../lib/codemirror")):"function"==typeof t&&t.amd?t(["../../lib/codemirror"],i):i(CodeMirror)})(function(t){"use strict";t.defineMode("javascript",function(e,n){function r(t){for(var e,n=!1,r=!1;null!=(e=t.next());){if(!n){if("/"==e&&!r)return;"["==e?r=!0:r&&"]"==e&&(r=!1)}n=!n&&"\\"==e}}function i(t,e,n){ge=t;me=n;return e}function o(t,e){var n=t.next();if('"'==n||"'"==n){e.tokenize=a(n);return e.tokenize(t,e)}if("."==n&&t.match(/^\d+(?:[eE][+\-]?\d+)?/))return i("number","number");if("."==n&&t.match(".."))return i("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(n))return i(n);if("="==n&&t.eat(">"))return i("=>","operator");if("0"==n&&t.eat(/x/i)){t.eatWhile(/[\da-f]/i);return i("number","number")}if(/\d/.test(n)){t.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/);return i("number","number")}if("/"==n){if(t.eat("*")){e.tokenize=s;return s(t,e)}if(t.eat("/")){t.skipToEnd();return i("comment","comment")}if("operator"==e.lastType||"keyword c"==e.lastType||"sof"==e.lastType||/^[\[{}\(,;:]$/.test(e.lastType)){r(t);t.eatWhile(/[gimy]/);return i("regexp","string-2")}t.eatWhile(Te);return i("operator","operator",t.current())}if("`"==n){e.tokenize=l;return l(t,e)}if("#"==n){t.skipToEnd();return i("error","error")}if(Te.test(n)){t.eatWhile(Te);return i("operator","operator",t.current())}if(Ce.test(n)){t.eatWhile(Ce);var o=t.current(),u=Se.propertyIsEnumerable(o)&&Se[o];return u&&"."!=e.lastType?i(u.type,u.style,o):i("variable","variable",o)}}function a(t){return function(e,n){var r,a=!1;if(be&&"@"==e.peek()&&e.match(ke)){n.tokenize=o;return i("jsonld-keyword","meta")}for(;null!=(r=e.next())&&(r!=t||a);)a=!a&&"\\"==r;a||(n.tokenize=o);return i("string","string")}}function s(t,e){for(var n,r=!1;n=t.next();){if("/"==n&&r){e.tokenize=o;break}r="*"==n}return i("comment","comment")}function l(t,e){for(var n,r=!1;null!=(n=t.next());){if(!r&&("`"==n||"$"==n&&t.eat("{"))){e.tokenize=o;break}r=!r&&"\\"==n}return i("quasi","string-2",t.current())}function u(t,e){e.fatArrowAt&&(e.fatArrowAt=null);var n=t.string.indexOf("=>",t.start);if(!(0>n)){for(var r=0,i=!1,o=n-1;o>=0;--o){var a=t.string.charAt(o),s=_e.indexOf(a);if(s>=0&&3>s){if(!r){++o;break}if(0==--r)break}else if(s>=3&&6>s)++r;else if(Ce.test(a))i=!0;else{if(/["'\/]/.test(a))return;if(i&&!r){++o;break}}}i&&!r&&(e.fatArrowAt=o)}}function c(t,e,n,r,i,o){this.indented=t;this.column=e;this.type=n;this.prev=i;this.info=o;null!=r&&(this.align=r)}function f(t,e){for(var n=t.localVars;n;n=n.next)if(n.name==e)return!0;for(var r=t.context;r;r=r.prev)for(var n=r.vars;n;n=n.next)if(n.name==e)return!0}function h(t,e,n,r,i){var o=t.cc;De.state=t;De.stream=i;De.marked=null,De.cc=o;De.style=e;t.lexical.hasOwnProperty("align")||(t.lexical.align=!0);for(;;){var a=o.length?o.pop():xe?C:w;if(a(n,r)){for(;o.length&&o[o.length-1].lex;)o.pop()();return De.marked?De.marked:"variable"==n&&f(t,r)?"variable-2":e}}}function d(){for(var t=arguments.length-1;t>=0;t--)De.cc.push(arguments[t])}function p(){d.apply(null,arguments);return!0}function g(t){function e(e){for(var n=e;n;n=n.next)if(n.name==t)return!0;return!1}var r=De.state;if(r.context){De.marked="def";if(e(r.localVars))return;r.localVars={name:t,next:r.localVars}}else{if(e(r.globalVars))return;n.globalVars&&(r.globalVars={name:t,next:r.globalVars})}}function m(){De.state.context={prev:De.state.context,vars:De.state.localVars};De.state.localVars=Le}function v(){De.state.localVars=De.state.context.vars;De.state.context=De.state.context.prev}function y(t,e){var n=function(){var n=De.state,r=n.indented;if("stat"==n.lexical.type)r=n.lexical.indented;else for(var i=n.lexical;i&&")"==i.type&&i.align;i=i.prev)r=i.indented;n.lexical=new c(r,De.stream.column(),t,null,n.lexical,e)};n.lex=!0;return n}function b(){var t=De.state;if(t.lexical.prev){")"==t.lexical.type&&(t.indented=t.lexical.indented);t.lexical=t.lexical.prev}}function x(t){function e(n){return n==t?p():";"==t?d():p(e)}return e}function w(t,e){if("var"==t)return p(y("vardef",e.length),U,x(";"),b);if("keyword a"==t)return p(y("form"),C,w,b);if("keyword b"==t)return p(y("form"),w,b);if("{"==t)return p(y("}"),W,b);if(";"==t)return p();if("if"==t){"else"==De.state.lexical.info&&De.state.cc[De.state.cc.length-1]==b&&De.state.cc.pop()();return p(y("form"),C,w,b,$)}return"function"==t?p(te):"for"==t?p(y("form"),Y,w,b):"variable"==t?p(y("stat"),j):"switch"==t?p(y("form"),C,y("}","switch"),x("{"),W,b,b):"case"==t?p(C,x(":")):"default"==t?p(x(":")):"catch"==t?p(y("form"),m,x("("),ee,x(")"),w,b,v):"module"==t?p(y("form"),m,ae,v,b):"class"==t?p(y("form"),ne,b):"export"==t?p(y("form"),se,b):"import"==t?p(y("form"),le,b):d(y("stat"),C,x(";"),b)}function C(t){return T(t,!1)}function S(t){return T(t,!0)}function T(t,e){if(De.state.fatArrowAt==De.stream.start){var n=e?E:N;if("("==t)return p(m,y(")"),R(B,")"),b,x("=>"),n,v);if("variable"==t)return d(m,B,x("=>"),n,v)}var r=e?D:M;return Me.hasOwnProperty(t)?p(r):"function"==t?p(te,r):"keyword c"==t?p(e?_:k):"("==t?p(y(")"),k,de,x(")"),b,r):"operator"==t||"spread"==t?p(e?S:C):"["==t?p(y("]"),fe,b,r):"{"==t?F(P,"}",null,r):"quasi"==t?d(L,r):p()}function k(t){return t.match(/[;\}\)\],]/)?d():d(C)}function _(t){return t.match(/[;\}\)\],]/)?d():d(S)}function M(t,e){return","==t?p(C):D(t,e,!1)}function D(t,e,n){var r=0==n?M:D,i=0==n?C:S;return"=>"==t?p(m,n?E:N,v):"operator"==t?/\+\+|--/.test(e)?p(r):"?"==e?p(C,x(":"),i):p(i):"quasi"==t?d(L,r):";"!=t?"("==t?F(S,")","call",r):"."==t?p(I,r):"["==t?p(y("]"),k,x("]"),b,r):void 0:void 0}function L(t,e){return"quasi"!=t?d():"${"!=e.slice(e.length-2)?p(L):p(C,A)}function A(t){if("}"==t){De.marked="string-2";De.state.tokenize=l;return p(L)}}function N(t){u(De.stream,De.state);return d("{"==t?w:C)}function E(t){u(De.stream,De.state);return d("{"==t?w:S)}function j(t){return":"==t?p(b,w):d(M,x(";"),b)}function I(t){if("variable"==t){De.marked="property";return p()}}function P(t,e){if("variable"==t||"keyword"==De.style){De.marked="property";return p("get"==e||"set"==e?H:O)}if("number"==t||"string"==t){De.marked=be?"property":De.style+" property";return p(O)}return"jsonld-keyword"==t?p(O):"["==t?p(C,x("]"),O):void 0}function H(t){if("variable"!=t)return d(O);De.marked="property";return p(te)}function O(t){return":"==t?p(S):"("==t?d(te):void 0}function R(t,e){function n(r){if(","==r){var i=De.state.lexical;"call"==i.info&&(i.pos=(i.pos||0)+1);return p(t,n)}return r==e?p():p(x(e))}return function(r){return r==e?p():d(t,n)}}function F(t,e,n){for(var r=3;r<arguments.length;r++)De.cc.push(arguments[r]);return p(y(e,n),R(t,e),b)}function W(t){return"}"==t?p():d(w,W)}function z(t){return we&&":"==t?p(q):void 0}function q(t){if("variable"==t){De.marked="variable-3";return p()}}function U(){return d(B,z,X,G)}function B(t,e){if("variable"==t){g(e);return p()}return"["==t?F(B,"]"):"{"==t?F(V,"}"):void 0}function V(t,e){if("variable"==t&&!De.stream.match(/^\s*:/,!1)){g(e);return p(X)}"variable"==t&&(De.marked="property");return p(x(":"),B,X)}function X(t,e){return"="==e?p(S):void 0}function G(t){return","==t?p(U):void 0}function $(t,e){return"keyword b"==t&&"else"==e?p(y("form","else"),w,b):void 0}function Y(t){return"("==t?p(y(")"),J,x(")"),b):void 0}function J(t){return"var"==t?p(U,x(";"),Z):";"==t?p(Z):"variable"==t?p(K):d(C,x(";"),Z)}function K(t,e){if("in"==e||"of"==e){De.marked="keyword";return p(C)}return p(M,Z)}function Z(t,e){if(";"==t)return p(Q);if("in"==e||"of"==e){De.marked="keyword";return p(C)}return d(C,x(";"),Q)}function Q(t){")"!=t&&p(C)}function te(t,e){if("*"==e){De.marked="keyword";return p(te)}if("variable"==t){g(e);return p(te)}return"("==t?p(m,y(")"),R(ee,")"),b,w,v):void 0}function ee(t){return"spread"==t?p(ee):d(B,z)}function ne(t,e){if("variable"==t){g(e);return p(re)}}function re(t,e){return"extends"==e?p(C,re):"{"==t?p(y("}"),ie,b):void 0}function ie(t,e){if("variable"==t||"keyword"==De.style){De.marked="property";return"get"==e||"set"==e?p(oe,te,ie):p(te,ie)}if("*"==e){De.marked="keyword";return p(ie)}return";"==t?p(ie):"}"==t?p():void 0}function oe(t){if("variable"!=t)return d();De.marked="property";return p()}function ae(t,e){if("string"==t)return p(w);if("variable"==t){g(e);return p(ce)}}function se(t,e){if("*"==e){De.marked="keyword";return p(ce,x(";"))}if("default"==e){De.marked="keyword";return p(C,x(";"))}return d(w)}function le(t){return"string"==t?p():d(ue,ce)}function ue(t,e){if("{"==t)return F(ue,"}");"variable"==t&&g(e);return p()}function ce(t,e){if("from"==e){De.marked="keyword";return p(C)}}function fe(t){return"]"==t?p():d(S,he)}function he(t){return"for"==t?d(de,x("]")):","==t?p(R(_,"]")):d(R(S,"]"))}function de(t){return"for"==t?p(Y,de):"if"==t?p(C,de):void 0}function pe(t,e){return"operator"==t.lastType||","==t.lastType||Te.test(e.charAt(0))||/[,.]/.test(e.charAt(0))}var ge,me,ve=e.indentUnit,ye=n.statementIndent,be=n.jsonld,xe=n.json||be,we=n.typescript,Ce=n.wordCharacters||/[\w$\xa1-\uffff]/,Se=function(){function t(t){return{type:t,style:"keyword"}}var e=t("keyword a"),n=t("keyword b"),r=t("keyword c"),i=t("operator"),o={type:"atom",style:"atom"},a={"if":t("if"),"while":e,"with":e,"else":n,"do":n,"try":n,"finally":n,"return":r,"break":r,"continue":r,"new":r,"delete":r,"throw":r,"debugger":r,"var":t("var"),"const":t("var"),let:t("var"),"function":t("function"),"catch":t("catch"),"for":t("for"),"switch":t("switch"),"case":t("case"),"default":t("default"),"in":i,"typeof":i,"instanceof":i,"true":o,"false":o,"null":o,undefined:o,NaN:o,Infinity:o,"this":t("this"),module:t("module"),"class":t("class"),"super":t("atom"),"yield":r,"export":t("export"),"import":t("import"),"extends":r};if(we){var s={type:"variable",style:"variable-3"},l={"interface":t("interface"),"extends":t("extends"),constructor:t("constructor"),"public":t("public"),"private":t("private"),"protected":t("protected"),"static":t("static"),string:s,number:s,bool:s,any:s};for(var u in l)a[u]=l[u]}return a}(),Te=/[+\-*&%=<>!?|~^]/,ke=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/,_e="([{}])",Me={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,"this":!0,"jsonld-keyword":!0},De={state:null,column:null,marked:null,cc:null},Le={name:"this",next:{name:"arguments"}};b.lex=!0;return{startState:function(t){var e={tokenize:o,lastType:"sof",cc:[],lexical:new c((t||0)-ve,0,"block",!1),localVars:n.localVars,context:n.localVars&&{vars:n.localVars},indented:0};n.globalVars&&"object"==typeof n.globalVars&&(e.globalVars=n.globalVars);return e},token:function(t,e){if(t.sol()){e.lexical.hasOwnProperty("align")||(e.lexical.align=!1);e.indented=t.indentation();
u(t,e)}if(e.tokenize!=s&&t.eatSpace())return null;var n=e.tokenize(t,e);if("comment"==ge)return n;e.lastType="operator"!=ge||"++"!=me&&"--"!=me?ge:"incdec";return h(e,n,ge,me,t)},indent:function(e,r){if(e.tokenize==s)return t.Pass;if(e.tokenize!=o)return 0;var i=r&&r.charAt(0),a=e.lexical;if(!/^\s*else\b/.test(r))for(var l=e.cc.length-1;l>=0;--l){var u=e.cc[l];if(u==b)a=a.prev;else if(u!=$)break}"stat"==a.type&&"}"==i&&(a=a.prev);ye&&")"==a.type&&"stat"==a.prev.type&&(a=a.prev);var c=a.type,f=i==c;return"vardef"==c?a.indented+("operator"==e.lastType||","==e.lastType?a.info+1:0):"form"==c&&"{"==i?a.indented:"form"==c?a.indented+ve:"stat"==c?a.indented+(pe(e,r)?ye||ve:0):"switch"!=a.info||f||0==n.doubleIndentSwitch?a.align?a.column+(f?0:1):a.indented+(f?0:ve):a.indented+(/^(?:case|default)\b/.test(r)?ve:2*ve)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:xe?null:"/*",blockCommentEnd:xe?null:"*/",lineComment:xe?null:"//",fold:"brace",helperType:xe?"json":"javascript",jsonldMode:be,jsonMode:xe}});t.registerHelper("wordChars","javascript",/[\w$]/);t.defineMIME("text/javascript","javascript");t.defineMIME("text/ecmascript","javascript");t.defineMIME("application/javascript","javascript");t.defineMIME("application/x-javascript","javascript");t.defineMIME("application/ecmascript","javascript");t.defineMIME("application/json",{name:"javascript",json:!0});t.defineMIME("application/x-json",{name:"javascript",json:!0});t.defineMIME("application/ld+json",{name:"javascript",jsonld:!0});t.defineMIME("text/typescript",{name:"javascript",typescript:!0});t.defineMIME("application/typescript",{name:"javascript",typescript:!0})})},{"../../lib/codemirror":11}],13:[function(e,n,r){(function(i){"object"==typeof r&&"object"==typeof n?i(e("../../lib/codemirror")):"function"==typeof t&&t.amd?t(["../../lib/codemirror"],i):i(CodeMirror)})(function(t){"use strict";t.defineMode("xml",function(e,n){function r(t,e){function n(n){e.tokenize=n;return n(t,e)}var r=t.next();if("<"==r){if(t.eat("!")){if(t.eat("["))return t.match("CDATA[")?n(a("atom","]]>")):null;if(t.match("--"))return n(a("comment","-->"));if(t.match("DOCTYPE",!0,!0)){t.eatWhile(/[\w\._\-]/);return n(s(1))}return null}if(t.eat("?")){t.eatWhile(/[\w\._\-]/);e.tokenize=a("meta","?>");return"meta"}S=t.eat("/")?"closeTag":"openTag";e.tokenize=i;return"tag bracket"}if("&"==r){var o;o=t.eat("#")?t.eat("x")?t.eatWhile(/[a-fA-F\d]/)&&t.eat(";"):t.eatWhile(/[\d]/)&&t.eat(";"):t.eatWhile(/[\w\.\-:]/)&&t.eat(";");return o?"atom":"error"}t.eatWhile(/[^&<]/);return null}function i(t,e){var n=t.next();if(">"==n||"/"==n&&t.eat(">")){e.tokenize=r;S=">"==n?"endTag":"selfcloseTag";return"tag bracket"}if("="==n){S="equals";return null}if("<"==n){e.tokenize=r;e.state=f;e.tagName=e.tagStart=null;var i=e.tokenize(t,e);return i?i+" tag error":"tag error"}if(/[\'\"]/.test(n)){e.tokenize=o(n);e.stringStartCol=t.column();return e.tokenize(t,e)}t.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/);return"word"}function o(t){var e=function(e,n){for(;!e.eol();)if(e.next()==t){n.tokenize=i;break}return"string"};e.isInAttribute=!0;return e}function a(t,e){return function(n,i){for(;!n.eol();){if(n.match(e)){i.tokenize=r;break}n.next()}return t}}function s(t){return function(e,n){for(var i;null!=(i=e.next());){if("<"==i){n.tokenize=s(t+1);return n.tokenize(e,n)}if(">"==i){if(1==t){n.tokenize=r;break}n.tokenize=s(t-1);return n.tokenize(e,n)}}return"meta"}}function l(t,e,n){this.prev=t.context;this.tagName=e;this.indent=t.indented;this.startOfLine=n;(k.doNotIndent.hasOwnProperty(e)||t.context&&t.context.noIndent)&&(this.noIndent=!0)}function u(t){t.context&&(t.context=t.context.prev)}function c(t,e){for(var n;;){if(!t.context)return;n=t.context.tagName;if(!k.contextGrabbers.hasOwnProperty(n)||!k.contextGrabbers[n].hasOwnProperty(e))return;u(t)}}function f(t,e,n){if("openTag"==t){n.tagStart=e.column();return h}return"closeTag"==t?d:f}function h(t,e,n){if("word"==t){n.tagName=e.current();T="tag";return m}T="error";return h}function d(t,e,n){if("word"==t){var r=e.current();n.context&&n.context.tagName!=r&&k.implicitlyClosed.hasOwnProperty(n.context.tagName)&&u(n);if(n.context&&n.context.tagName==r){T="tag";return p}T="tag error";return g}T="error";return g}function p(t,e,n){if("endTag"!=t){T="error";return p}u(n);return f}function g(t,e,n){T="error";return p(t,e,n)}function m(t,e,n){if("word"==t){T="attribute";return v}if("endTag"==t||"selfcloseTag"==t){var r=n.tagName,i=n.tagStart;n.tagName=n.tagStart=null;if("selfcloseTag"==t||k.autoSelfClosers.hasOwnProperty(r))c(n,r);else{c(n,r);n.context=new l(n,r,i==n.indented)}return f}T="error";return m}function v(t,e,n){if("equals"==t)return y;k.allowMissing||(T="error");return m(t,e,n)}function y(t,e,n){if("string"==t)return b;if("word"==t&&k.allowUnquoted){T="string";return m}T="error";return m(t,e,n)}function b(t,e,n){return"string"==t?b:m(t,e,n)}var x=e.indentUnit,w=n.multilineTagIndentFactor||1,C=n.multilineTagIndentPastTag;null==C&&(C=!0);var S,T,k=n.htmlMode?{autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0}:{autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,caseFold:!1},_=n.alignCDATA;return{startState:function(){return{tokenize:r,state:f,indented:0,tagName:null,tagStart:null,context:null}},token:function(t,e){!e.tagName&&t.sol()&&(e.indented=t.indentation());if(t.eatSpace())return null;S=null;var n=e.tokenize(t,e);if((n||S)&&"comment"!=n){T=null;e.state=e.state(S||n,t,e);T&&(n="error"==T?n+" error":T)}return n},indent:function(e,n,o){var a=e.context;if(e.tokenize.isInAttribute)return e.tagStart==e.indented?e.stringStartCol+1:e.indented+x;if(a&&a.noIndent)return t.Pass;if(e.tokenize!=i&&e.tokenize!=r)return o?o.match(/^(\s*)/)[0].length:0;if(e.tagName)return C?e.tagStart+e.tagName.length+2:e.tagStart+x*w;if(_&&/<!\[CDATA\[/.test(n))return 0;var s=n&&/^<(\/)?([\w_:\.-]*)/.exec(n);if(s&&s[1])for(;a;){if(a.tagName==s[2]){a=a.prev;break}if(!k.implicitlyClosed.hasOwnProperty(a.tagName))break;a=a.prev}else if(s)for(;a;){var l=k.contextGrabbers[a.tagName];if(!l||!l.hasOwnProperty(s[2]))break;a=a.prev}for(;a&&!a.startOfLine;)a=a.prev;return a?a.indent+x:0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:n.htmlMode?"html":"xml",helperType:n.htmlMode?"html":"xml"}});t.defineMIME("text/xml","xml");t.defineMIME("application/xml","xml");t.mimeModes.hasOwnProperty("text/html")||t.defineMIME("text/html",{name:"xml",htmlMode:!0})})},{"../../lib/codemirror":11}],14:[function(e,n){!function(){function e(t,e){return e>t?-1:t>e?1:t>=e?0:0/0}function r(t){return null===t?0/0:+t}function i(t){return!isNaN(t)}function o(t){return{left:function(e,n,r,i){arguments.length<3&&(r=0);arguments.length<4&&(i=e.length);for(;i>r;){var o=r+i>>>1;t(e[o],n)<0?r=o+1:i=o}return r},right:function(e,n,r,i){arguments.length<3&&(r=0);arguments.length<4&&(i=e.length);for(;i>r;){var o=r+i>>>1;t(e[o],n)>0?i=o:r=o+1}return r}}}function a(t){return t.length}function s(t){for(var e=1;t*e%1;)e*=10;return e}function l(t,e){for(var n in e)Object.defineProperty(t.prototype,n,{value:e[n],enumerable:!1})}function u(){this._=Object.create(null)}function c(t){return(t+="")===bs||t[0]===xs?xs+t:t}function f(t){return(t+="")[0]===xs?t.slice(1):t}function h(t){return c(t)in this._}function d(t){return(t=c(t))in this._&&delete this._[t]}function p(){var t=[];for(var e in this._)t.push(f(e));return t}function g(){var t=0;for(var e in this._)++t;return t}function m(){for(var t in this._)return!1;return!0}function v(){this._=Object.create(null)}function y(t,e,n){return function(){var r=n.apply(e,arguments);return r===e?t:r}}function b(t,e){if(e in t)return e;e=e.charAt(0).toUpperCase()+e.slice(1);for(var n=0,r=ws.length;r>n;++n){var i=ws[n]+e;if(i in t)return i}}function x(){}function w(){}function C(t){function e(){for(var e,r=n,i=-1,o=r.length;++i<o;)(e=r[i].on)&&e.apply(this,arguments);return t}var n=[],r=new u;e.on=function(e,i){var o,a=r.get(e);if(arguments.length<2)return a&&a.on;if(a){a.on=null;n=n.slice(0,o=n.indexOf(a)).concat(n.slice(o+1));r.remove(e)}i&&n.push(r.set(e,{on:i}));return t};return e}function S(){is.event.preventDefault()}function T(){for(var t,e=is.event;t=e.sourceEvent;)e=t;return e}function k(t){for(var e=new w,n=0,r=arguments.length;++n<r;)e[arguments[n]]=C(e);e.of=function(n,r){return function(i){try{var o=i.sourceEvent=is.event;i.target=t;is.event=i;e[i.type].apply(n,r)}finally{is.event=o}}};return e}function _(t){Ss(t,Ds);return t}function M(t){return"function"==typeof t?t:function(){return Ts(t,this)}}function D(t){return"function"==typeof t?t:function(){return ks(t,this)}}function L(t,e){function n(){this.removeAttribute(t)}function r(){this.removeAttributeNS(t.space,t.local)}function i(){this.setAttribute(t,e)}function o(){this.setAttributeNS(t.space,t.local,e)}function a(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}function s(){var n=e.apply(this,arguments);null==n?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}t=is.ns.qualify(t);return null==e?t.local?r:n:"function"==typeof e?t.local?s:a:t.local?o:i}function A(t){return t.trim().replace(/\s+/g," ")}function N(t){return new RegExp("(?:^|\\s+)"+is.requote(t)+"(?:\\s+|$)","g")}function E(t){return(t+"").trim().split(/^|\s+/)}function j(t,e){function n(){for(var n=-1;++n<i;)t[n](this,e)}function r(){for(var n=-1,r=e.apply(this,arguments);++n<i;)t[n](this,r)}t=E(t).map(I);var i=t.length;return"function"==typeof e?r:n}function I(t){var e=N(t);return function(n,r){if(i=n.classList)return r?i.add(t):i.remove(t);var i=n.getAttribute("class")||"";if(r){e.lastIndex=0;e.test(i)||n.setAttribute("class",A(i+" "+t))}else n.setAttribute("class",A(i.replace(e," ")))}}function P(t,e,n){function r(){this.style.removeProperty(t)}function i(){this.style.setProperty(t,e,n)}function o(){var r=e.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,n)}return null==e?r:"function"==typeof e?o:i}function H(t,e){function n(){delete this[t]}function r(){this[t]=e}function i(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}return null==e?n:"function"==typeof e?i:r}function O(t){return"function"==typeof t?t:(t=is.ns.qualify(t)).local?function(){return this.ownerDocument.createElementNS(t.space,t.local)}:function(){return this.ownerDocument.createElementNS(this.namespaceURI,t)}}function R(){var t=this.parentNode;t&&t.removeChild(this)}function F(t){return{__data__:t}}function W(t){return function(){return Ms(this,t)}}function z(t){arguments.length||(t=e);return function(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}}function q(t,e){for(var n=0,r=t.length;r>n;n++)for(var i,o=t[n],a=0,s=o.length;s>a;a++)(i=o[a])&&e(i,a,n);return t}function U(t){Ss(t,As);return t}function B(t){var e,n;return function(r,i,o){var a,s=t[o].update,l=s.length;o!=n&&(n=o,e=0);i>=e&&(e=i+1);for(;!(a=s[e])&&++e<l;);return a}}function V(t,e,n){function r(){var e=this[a];if(e){this.removeEventListener(t,e,e.$);delete this[a]}}function i(){var i=l(e,as(arguments));r.call(this);this.addEventListener(t,this[a]=i,i.$=n);i._=e}function o(){var e,n=new RegExp("^__on([^.]+)"+is.requote(t)+"$");for(var r in this)if(e=r.match(n)){var i=this[r];this.removeEventListener(e[1],i,i.$);delete this[r]}}var a="__on"+t,s=t.indexOf("."),l=X;s>0&&(t=t.slice(0,s));var u=Es.get(t);u&&(t=u,l=G);return s?e?i:r:e?x:o}function X(t,e){return function(n){var r=is.event;is.event=n;e[0]=this.__data__;try{t.apply(this,e)}finally{is.event=r}}}function G(t,e){var n=X(t,e);return function(t){var e=this,r=t.relatedTarget;r&&(r===e||8&r.compareDocumentPosition(e))||n.call(e,t)}}function $(){var t=".dragsuppress-"+ ++Is,e="click"+t,n=is.select(us).on("touchmove"+t,S).on("dragstart"+t,S).on("selectstart"+t,S);if(js){var r=ls.style,i=r[js];r[js]="none"}return function(o){n.on(t,null);js&&(r[js]=i);if(o){var a=function(){n.on(e,null)};n.on(e,function(){S();a()},!0);setTimeout(a,0)}}}function Y(t,e){e.changedTouches&&(e=e.changedTouches[0]);var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();if(0>Ps&&(us.scrollX||us.scrollY)){n=is.select("body").append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important");var i=n[0][0].getScreenCTM();Ps=!(i.f||i.e);n.remove()}Ps?(r.x=e.pageX,r.y=e.pageY):(r.x=e.clientX,r.y=e.clientY);r=r.matrixTransform(t.getScreenCTM().inverse());return[r.x,r.y]}var o=t.getBoundingClientRect();return[e.clientX-o.left-t.clientLeft,e.clientY-o.top-t.clientTop]}function J(){return is.event.changedTouches[0].identifier}function K(){return is.event.target}function Z(){return us}function Q(t){return t>0?1:0>t?-1:0}function te(t,e,n){return(e[0]-t[0])*(n[1]-t[1])-(e[1]-t[1])*(n[0]-t[0])}function ee(t){return t>1?0:-1>t?Rs:Math.acos(t)}function ne(t){return t>1?zs:-1>t?-zs:Math.asin(t)}function re(t){return((t=Math.exp(t))-1/t)/2}function ie(t){return((t=Math.exp(t))+1/t)/2}function oe(t){return((t=Math.exp(2*t))-1)/(t+1)}function ae(t){return(t=Math.sin(t/2))*t}function se(){}function le(t,e,n){return this instanceof le?void(this.h=+t,this.s=+e,this.l=+n):arguments.length<2?t instanceof le?new le(t.h,t.s,t.l):Ce(""+t,Se,le):new le(t,e,n)}function ue(t,e,n){function r(t){t>360?t-=360:0>t&&(t+=360);return 60>t?o+(a-o)*t/60:180>t?a:240>t?o+(a-o)*(240-t)/60:o}function i(t){return Math.round(255*r(t))}var o,a;t=isNaN(t)?0:(t%=360)<0?t+360:t;e=isNaN(e)?0:0>e?0:e>1?1:e;n=0>n?0:n>1?1:n;a=.5>=n?n*(1+e):n+e-n*e;o=2*n-a;return new ye(i(t+120),i(t),i(t-120))}function ce(t,e,n){return this instanceof ce?void(this.h=+t,this.c=+e,this.l=+n):arguments.length<2?t instanceof ce?new ce(t.h,t.c,t.l):t instanceof he?pe(t.l,t.a,t.b):pe((t=Te((t=is.rgb(t)).r,t.g,t.b)).l,t.a,t.b):new ce(t,e,n)}function fe(t,e,n){isNaN(t)&&(t=0);isNaN(e)&&(e=0);return new he(n,Math.cos(t*=qs)*e,Math.sin(t)*e)}function he(t,e,n){return this instanceof he?void(this.l=+t,this.a=+e,this.b=+n):arguments.length<2?t instanceof he?new he(t.l,t.a,t.b):t instanceof ce?fe(t.h,t.c,t.l):Te((t=ye(t)).r,t.g,t.b):new he(t,e,n)}function de(t,e,n){var r=(t+16)/116,i=r+e/500,o=r-n/200;i=ge(i)*Qs;r=ge(r)*tl;o=ge(o)*el;return new ye(ve(3.2404542*i-1.5371385*r-.4985314*o),ve(-.969266*i+1.8760108*r+.041556*o),ve(.0556434*i-.2040259*r+1.0572252*o))}function pe(t,e,n){return t>0?new ce(Math.atan2(n,e)*Us,Math.sqrt(e*e+n*n),t):new ce(0/0,0/0,t)}function ge(t){return t>.206893034?t*t*t:(t-4/29)/7.787037}function me(t){return t>.008856?Math.pow(t,1/3):7.787037*t+4/29}function ve(t){return Math.round(255*(.00304>=t?12.92*t:1.055*Math.pow(t,1/2.4)-.055))}function ye(t,e,n){return this instanceof ye?void(this.r=~~t,this.g=~~e,this.b=~~n):arguments.length<2?t instanceof ye?new ye(t.r,t.g,t.b):Ce(""+t,ye,ue):new ye(t,e,n)}function be(t){return new ye(t>>16,t>>8&255,255&t)}function xe(t){return be(t)+""}function we(t){return 16>t?"0"+Math.max(0,t).toString(16):Math.min(255,t).toString(16)}function Ce(t,e,n){var r,i,o,a=0,s=0,l=0;r=/([a-z]+)\((.*)\)/i.exec(t);if(r){i=r[2].split(",");switch(r[1]){case"hsl":return n(parseFloat(i[0]),parseFloat(i[1])/100,parseFloat(i[2])/100);case"rgb":return e(_e(i[0]),_e(i[1]),_e(i[2]))}}if(o=il.get(t))return e(o.r,o.g,o.b);if(null!=t&&"#"===t.charAt(0)&&!isNaN(o=parseInt(t.slice(1),16)))if(4===t.length){a=(3840&o)>>4;a=a>>4|a;s=240&o;s=s>>4|s;l=15&o;l=l<<4|l}else if(7===t.length){a=(16711680&o)>>16;s=(65280&o)>>8;l=255&o}return e(a,s,l)}function Se(t,e,n){var r,i,o=Math.min(t/=255,e/=255,n/=255),a=Math.max(t,e,n),s=a-o,l=(a+o)/2;if(s){i=.5>l?s/(a+o):s/(2-a-o);r=t==a?(e-n)/s+(n>e?6:0):e==a?(n-t)/s+2:(t-e)/s+4;r*=60}else{r=0/0;i=l>0&&1>l?0:r}return new le(r,i,l)}function Te(t,e,n){t=ke(t);e=ke(e);n=ke(n);var r=me((.4124564*t+.3575761*e+.1804375*n)/Qs),i=me((.2126729*t+.7151522*e+.072175*n)/tl),o=me((.0193339*t+.119192*e+.9503041*n)/el);return he(116*i-16,500*(r-i),200*(i-o))}function ke(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function _e(t){var e=parseFloat(t);return"%"===t.charAt(t.length-1)?Math.round(2.55*e):e}function Me(t){return"function"==typeof t?t:function(){return t}}function De(t){return t}function Le(t){return function(e,n,r){2===arguments.length&&"function"==typeof n&&(r=n,n=null);return Ae(e,n,t,r)}}function Ae(t,e,n,r){function i(){var t,e=l.status;if(!e&&Ee(l)||e>=200&&300>e||304===e){try{t=n.call(o,l)}catch(r){a.error.call(o,r);return}a.load.call(o,t)}else a.error.call(o,l)}var o={},a=is.dispatch("beforesend","progress","load","error"),s={},l=new XMLHttpRequest,u=null;!us.XDomainRequest||"withCredentials"in l||!/^(http(s)?:)?\/\//.test(t)||(l=new XDomainRequest);"onload"in l?l.onload=l.onerror=i:l.onreadystatechange=function(){l.readyState>3&&i()};l.onprogress=function(t){var e=is.event;is.event=t;try{a.progress.call(o,l)}finally{is.event=e}};o.header=function(t,e){t=(t+"").toLowerCase();if(arguments.length<2)return s[t];null==e?delete s[t]:s[t]=e+"";return o};o.mimeType=function(t){if(!arguments.length)return e;e=null==t?null:t+"";return o};o.responseType=function(t){if(!arguments.length)return u;u=t;return o};o.response=function(t){n=t;return o};["get","post"].forEach(function(t){o[t]=function(){return o.send.apply(o,[t].concat(as(arguments)))}});o.send=function(n,r,i){2===arguments.length&&"function"==typeof r&&(i=r,r=null);l.open(n,t,!0);null==e||"accept"in s||(s.accept=e+",*/*");if(l.setRequestHeader)for(var c in s)l.setRequestHeader(c,s[c]);null!=e&&l.overrideMimeType&&l.overrideMimeType(e);null!=u&&(l.responseType=u);null!=i&&o.on("error",i).on("load",function(t){i(null,t)});a.beforesend.call(o,l);l.send(null==r?null:r);return o};o.abort=function(){l.abort();return o};is.rebind(o,a,"on");return null==r?o:o.get(Ne(r))}function Ne(t){return 1===t.length?function(e,n){t(null==e?n:null)}:t}function Ee(t){var e=t.responseType;return e&&"text"!==e?t.response:t.responseText}function je(){var t=Ie(),e=Pe()-t;if(e>24){if(isFinite(e)){clearTimeout(ll);ll=setTimeout(je,e)}sl=0}else{sl=1;cl(je)}}function Ie(){var t=Date.now();ul=ol;for(;ul;){t>=ul.t&&(ul.f=ul.c(t-ul.t));ul=ul.n}return t}function Pe(){for(var t,e=ol,n=1/0;e;)if(e.f)e=t?t.n=e.n:ol=e.n;else{e.t<n&&(n=e.t);e=(t=e).n}al=t;return n}function He(t,e){return e-(t?Math.ceil(Math.log(t)/Math.LN10):1)}function Oe(t,e){var n=Math.pow(10,3*ys(8-e));return{scale:e>8?function(t){return t/n}:function(t){return t*n},symbol:t}}function Re(t){var e=t.decimal,n=t.thousands,r=t.grouping,i=t.currency,o=r&&n?function(t,e){for(var i=t.length,o=[],a=0,s=r[0],l=0;i>0&&s>0;){l+s+1>e&&(s=Math.max(1,e-l));o.push(t.substring(i-=s,i+s));if((l+=s+1)>e)break;s=r[a=(a+1)%r.length]}return o.reverse().join(n)}:De;return function(t){var n=hl.exec(t),r=n[1]||" ",a=n[2]||">",s=n[3]||"-",l=n[4]||"",u=n[5],c=+n[6],f=n[7],h=n[8],d=n[9],p=1,g="",m="",v=!1,y=!0;h&&(h=+h.substring(1));if(u||"0"===r&&"="===a){u=r="0";a="="}switch(d){case"n":f=!0;d="g";break;case"%":p=100;m="%";d="f";break;case"p":p=100;m="%";d="r";break;case"b":case"o":case"x":case"X":"#"===l&&(g="0"+d.toLowerCase());case"c":y=!1;case"d":v=!0;h=0;break;case"s":p=-1;d="r"}"$"===l&&(g=i[0],m=i[1]);"r"!=d||h||(d="g");null!=h&&("g"==d?h=Math.max(1,Math.min(21,h)):("e"==d||"f"==d)&&(h=Math.max(0,Math.min(20,h))));d=dl.get(d)||Fe;var b=u&&f;return function(t){var n=m;if(v&&t%1)return"";var i=0>t||0===t&&0>1/t?(t=-t,"-"):"-"===s?"":s;if(0>p){var l=is.formatPrefix(t,h);t=l.scale(t);n=l.symbol+m}else t*=p;t=d(t,h);var x,w,C=t.lastIndexOf(".");if(0>C){var S=y?t.lastIndexOf("e"):-1;0>S?(x=t,w=""):(x=t.substring(0,S),w=t.substring(S))}else{x=t.substring(0,C);w=e+t.substring(C+1)}!u&&f&&(x=o(x,1/0));var T=g.length+x.length+w.length+(b?0:i.length),k=c>T?new Array(T=c-T+1).join(r):"";b&&(x=o(k+x,k.length?c-w.length:1/0));i+=g;t=x+w;return("<"===a?i+t+k:">"===a?k+i+t:"^"===a?k.substring(0,T>>=1)+i+t+k.substring(T):i+(b?t:k+t))+n}}}function Fe(t){return t+""}function We(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function ze(t,e,n){function r(e){var n=t(e),r=o(n,1);return r-e>e-n?n:r}function i(n){e(n=t(new gl(n-1)),1);return n}function o(t,n){e(t=new gl(+t),n);return t}function a(t,r,o){var a=i(t),s=[];if(o>1)for(;r>a;){n(a)%o||s.push(new Date(+a));e(a,1)}else for(;r>a;)s.push(new Date(+a)),e(a,1);return s}function s(t,e,n){try{gl=We;var r=new We;r._=t;return a(r,e,n)}finally{gl=Date}}t.floor=t;t.round=r;t.ceil=i;t.offset=o;t.range=a;var l=t.utc=qe(t);l.floor=l;l.round=qe(r);l.ceil=qe(i);l.offset=qe(o);l.range=s;return t}function qe(t){return function(e,n){try{gl=We;var r=new We;r._=e;return t(r,n)._}finally{gl=Date}}}function Ue(t){function e(t){function e(e){for(var n,i,o,a=[],s=-1,l=0;++s<r;)if(37===t.charCodeAt(s)){a.push(t.slice(l,s));null!=(i=vl[n=t.charAt(++s)])&&(n=t.charAt(++s));(o=D[n])&&(n=o(e,null==i?"e"===n?" ":"0":i));a.push(n);l=s+1}a.push(t.slice(l,s));return a.join("")}var r=t.length;e.parse=function(e){var r={y:1900,m:0,d:1,H:0,M:0,S:0,L:0,Z:null},i=n(r,t,e,0);if(i!=e.length)return null;"p"in r&&(r.H=r.H%12+12*r.p);var o=null!=r.Z&&gl!==We,a=new(o?We:gl);if("j"in r)a.setFullYear(r.y,0,r.j);else if("w"in r&&("W"in r||"U"in r)){a.setFullYear(r.y,0,1);a.setFullYear(r.y,0,"W"in r?(r.w+6)%7+7*r.W-(a.getDay()+5)%7:r.w+7*r.U-(a.getDay()+6)%7)}else a.setFullYear(r.y,r.m,r.d);a.setHours(r.H+(r.Z/100|0),r.M+r.Z%100,r.S,r.L);return o?a._:a};e.toString=function(){return t};return e}function n(t,e,n,r){for(var i,o,a,s=0,l=e.length,u=n.length;l>s;){if(r>=u)return-1;i=e.charCodeAt(s++);if(37===i){a=e.charAt(s++);o=L[a in vl?e.charAt(s++):a];if(!o||(r=o(t,n,r))<0)return-1}else if(i!=n.charCodeAt(r++))return-1}return r}function r(t,e,n){C.lastIndex=0;var r=C.exec(e.slice(n));return r?(t.w=S.get(r[0].toLowerCase()),n+r[0].length):-1}function i(t,e,n){x.lastIndex=0;var r=x.exec(e.slice(n));return r?(t.w=w.get(r[0].toLowerCase()),n+r[0].length):-1}function o(t,e,n){_.lastIndex=0;var r=_.exec(e.slice(n));return r?(t.m=M.get(r[0].toLowerCase()),n+r[0].length):-1}function a(t,e,n){T.lastIndex=0;var r=T.exec(e.slice(n));return r?(t.m=k.get(r[0].toLowerCase()),n+r[0].length):-1}function s(t,e,r){return n(t,D.c.toString(),e,r)}function l(t,e,r){return n(t,D.x.toString(),e,r)}function u(t,e,r){return n(t,D.X.toString(),e,r)}function c(t,e,n){var r=b.get(e.slice(n,n+=2).toLowerCase());return null==r?-1:(t.p=r,n)}var f=t.dateTime,h=t.date,d=t.time,p=t.periods,g=t.days,m=t.shortDays,v=t.months,y=t.shortMonths;e.utc=function(t){function n(t){try{gl=We;var e=new gl;e._=t;return r(e)}finally{gl=Date}}var r=e(t);n.parse=function(t){try{gl=We;var e=r.parse(t);return e&&e._}finally{gl=Date}};n.toString=r.toString;return n};e.multi=e.utc.multi=cn;var b=is.map(),x=Ve(g),w=Xe(g),C=Ve(m),S=Xe(m),T=Ve(v),k=Xe(v),_=Ve(y),M=Xe(y);p.forEach(function(t,e){b.set(t.toLowerCase(),e)});var D={a:function(t){return m[t.getDay()]},A:function(t){return g[t.getDay()]},b:function(t){return y[t.getMonth()]},B:function(t){return v[t.getMonth()]},c:e(f),d:function(t,e){return Be(t.getDate(),e,2)},e:function(t,e){return Be(t.getDate(),e,2)},H:function(t,e){return Be(t.getHours(),e,2)},I:function(t,e){return Be(t.getHours()%12||12,e,2)},j:function(t,e){return Be(1+pl.dayOfYear(t),e,3)},L:function(t,e){return Be(t.getMilliseconds(),e,3)},m:function(t,e){return Be(t.getMonth()+1,e,2)},M:function(t,e){return Be(t.getMinutes(),e,2)},p:function(t){return p[+(t.getHours()>=12)]},S:function(t,e){return Be(t.getSeconds(),e,2)},U:function(t,e){return Be(pl.sundayOfYear(t),e,2)},w:function(t){return t.getDay()},W:function(t,e){return Be(pl.mondayOfYear(t),e,2)},x:e(h),X:e(d),y:function(t,e){return Be(t.getFullYear()%100,e,2)},Y:function(t,e){return Be(t.getFullYear()%1e4,e,4)},Z:ln,"%":function(){return"%"}},L={a:r,A:i,b:o,B:a,c:s,d:en,e:en,H:rn,I:rn,j:nn,L:sn,m:tn,M:on,p:c,S:an,U:$e,w:Ge,W:Ye,x:l,X:u,y:Ke,Y:Je,Z:Ze,"%":un};return e}function Be(t,e,n){var r=0>t?"-":"",i=(r?-t:t)+"",o=i.length;return r+(n>o?new Array(n-o+1).join(e)+i:i)}function Ve(t){return new RegExp("^(?:"+t.map(is.requote).join("|")+")","i")}function Xe(t){for(var e=new u,n=-1,r=t.length;++n<r;)e.set(t[n].toLowerCase(),n);return e}function Ge(t,e,n){yl.lastIndex=0;var r=yl.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function $e(t,e,n){yl.lastIndex=0;var r=yl.exec(e.slice(n));return r?(t.U=+r[0],n+r[0].length):-1}function Ye(t,e,n){yl.lastIndex=0;var r=yl.exec(e.slice(n));return r?(t.W=+r[0],n+r[0].length):-1}function Je(t,e,n){yl.lastIndex=0;var r=yl.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function Ke(t,e,n){yl.lastIndex=0;var r=yl.exec(e.slice(n,n+2));return r?(t.y=Qe(+r[0]),n+r[0].length):-1}function Ze(t,e,n){return/^[+-]\d{4}$/.test(e=e.slice(n,n+5))?(t.Z=-e,n+5):-1}function Qe(t){return t+(t>68?1900:2e3)}function tn(t,e,n){yl.lastIndex=0;var r=yl.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function en(t,e,n){yl.lastIndex=0;var r=yl.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function nn(t,e,n){yl.lastIndex=0;var r=yl.exec(e.slice(n,n+3));return r?(t.j=+r[0],n+r[0].length):-1}function rn(t,e,n){yl.lastIndex=0;var r=yl.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function on(t,e,n){yl.lastIndex=0;var r=yl.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function an(t,e,n){yl.lastIndex=0;var r=yl.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function sn(t,e,n){yl.lastIndex=0;var r=yl.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function ln(t){var e=t.getTimezoneOffset(),n=e>0?"-":"+",r=ys(e)/60|0,i=ys(e)%60;return n+Be(r,"0",2)+Be(i,"0",2)}function un(t,e,n){bl.lastIndex=0;var r=bl.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function cn(t){for(var e=t.length,n=-1;++n<e;)t[n][0]=this(t[n][0]);return function(e){for(var n=0,r=t[n];!r[1](e);)r=t[++n];return r[0](e)}}function fn(){}function hn(t,e,n){var r=n.s=t+e,i=r-t,o=r-i;n.t=t-o+(e-i)}function dn(t,e){t&&Sl.hasOwnProperty(t.type)&&Sl[t.type](t,e)}function pn(t,e,n){var r,i=-1,o=t.length-n;e.lineStart();for(;++i<o;)r=t[i],e.point(r[0],r[1],r[2]);e.lineEnd()}function gn(t,e){var n=-1,r=t.length;e.polygonStart();for(;++n<r;)pn(t[n],e,1);e.polygonEnd()}function mn(){function t(t,e){t*=qs;e=e*qs/2+Rs/4;var n=t-r,a=n>=0?1:-1,s=a*n,l=Math.cos(e),u=Math.sin(e),c=o*u,f=i*l+c*Math.cos(s),h=c*a*Math.sin(s);kl.add(Math.atan2(h,f));r=t,i=l,o=u}var e,n,r,i,o;_l.point=function(a,s){_l.point=t;r=(e=a)*qs,i=Math.cos(s=(n=s)*qs/2+Rs/4),o=Math.sin(s)};_l.lineEnd=function(){t(e,n)}}function vn(t){var e=t[0],n=t[1],r=Math.cos(n);return[r*Math.cos(e),r*Math.sin(e),Math.sin(n)]}function yn(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function bn(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function xn(t,e){t[0]+=e[0];t[1]+=e[1];t[2]+=e[2]}function wn(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function Cn(t){var e=Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e;t[1]/=e;t[2]/=e}function Sn(t){return[Math.atan2(t[1],t[0]),ne(t[2])]}function Tn(t,e){return ys(t[0]-e[0])<Hs&&ys(t[1]-e[1])<Hs}function kn(t,e){t*=qs;var n=Math.cos(e*=qs);_n(n*Math.cos(t),n*Math.sin(t),Math.sin(e))}function _n(t,e,n){++Ml;Ll+=(t-Ll)/Ml;Al+=(e-Al)/Ml;Nl+=(n-Nl)/Ml}function Mn(){function t(t,i){t*=qs;var o=Math.cos(i*=qs),a=o*Math.cos(t),s=o*Math.sin(t),l=Math.sin(i),u=Math.atan2(Math.sqrt((u=n*l-r*s)*u+(u=r*a-e*l)*u+(u=e*s-n*a)*u),e*a+n*s+r*l);Dl+=u;El+=u*(e+(e=a));jl+=u*(n+(n=s));Il+=u*(r+(r=l));_n(e,n,r)}var e,n,r;Rl.point=function(i,o){i*=qs;var a=Math.cos(o*=qs);e=a*Math.cos(i);n=a*Math.sin(i);r=Math.sin(o);Rl.point=t;_n(e,n,r)}}function Dn(){Rl.point=kn}function Ln(){function t(t,e){t*=qs;var n=Math.cos(e*=qs),a=n*Math.cos(t),s=n*Math.sin(t),l=Math.sin(e),u=i*l-o*s,c=o*a-r*l,f=r*s-i*a,h=Math.sqrt(u*u+c*c+f*f),d=r*a+i*s+o*l,p=h&&-ee(d)/h,g=Math.atan2(h,d);Pl+=p*u;Hl+=p*c;Ol+=p*f;Dl+=g;El+=g*(r+(r=a));jl+=g*(i+(i=s));Il+=g*(o+(o=l));_n(r,i,o)}var e,n,r,i,o;Rl.point=function(a,s){e=a,n=s;Rl.point=t;a*=qs;var l=Math.cos(s*=qs);r=l*Math.cos(a);i=l*Math.sin(a);o=Math.sin(s);_n(r,i,o)};Rl.lineEnd=function(){t(e,n);Rl.lineEnd=Dn;Rl.point=kn}}function An(t,e){function n(n,r){return n=t(n,r),e(n[0],n[1])}t.invert&&e.invert&&(n.invert=function(n,r){return n=e.invert(n,r),n&&t.invert(n[0],n[1])});return n}function Nn(){return!0}function En(t,e,n,r,i){var o=[],a=[];t.forEach(function(t){if(!((e=t.length-1)<=0)){var e,n=t[0],r=t[e];if(Tn(n,r)){i.lineStart();for(var s=0;e>s;++s)i.point((n=t[s])[0],n[1]);i.lineEnd()}else{var l=new In(n,t,null,!0),u=new In(n,null,l,!1);l.o=u;o.push(l);a.push(u);l=new In(r,t,null,!1);u=new In(r,null,l,!0);l.o=u;o.push(l);a.push(u)}}});a.sort(e);jn(o);jn(a);if(o.length){for(var s=0,l=n,u=a.length;u>s;++s)a[s].e=l=!l;for(var c,f,h=o[0];;){for(var d=h,p=!0;d.v;)if((d=d.n)===h)return;c=d.z;i.lineStart();do{d.v=d.o.v=!0;if(d.e){if(p)for(var s=0,u=c.length;u>s;++s)i.point((f=c[s])[0],f[1]);else r(d.x,d.n.x,1,i);d=d.n}else{if(p){c=d.p.z;for(var s=c.length-1;s>=0;--s)i.point((f=c[s])[0],f[1])}else r(d.x,d.p.x,-1,i);d=d.p}d=d.o;c=d.z;p=!p}while(!d.v);i.lineEnd()}}}function jn(t){if(e=t.length){for(var e,n,r=0,i=t[0];++r<e;){i.n=n=t[r];n.p=i;i=n}i.n=n=t[0];n.p=i}}function In(t,e,n,r){this.x=t;this.z=e;this.o=n;this.e=r;this.v=!1;this.n=this.p=null}function Pn(t,e,n,r){return function(i,o){function a(e,n){var r=i(e,n);t(e=r[0],n=r[1])&&o.point(e,n)}function s(t,e){var n=i(t,e);m.point(n[0],n[1])}function l(){y.point=s;m.lineStart()}function u(){y.point=a;m.lineEnd()}function c(t,e){g.push([t,e]);var n=i(t,e);x.point(n[0],n[1])}function f(){x.lineStart();g=[]}function h(){c(g[0][0],g[0][1]);x.lineEnd();var t,e=x.clean(),n=b.buffer(),r=n.length;g.pop();p.push(g);g=null;if(r)if(1&e){t=n[0];var i,r=t.length-1,a=-1;if(r>0){w||(o.polygonStart(),w=!0);o.lineStart();for(;++a<r;)o.point((i=t[a])[0],i[1]);o.lineEnd()}}else{r>1&&2&e&&n.push(n.pop().concat(n.shift()));d.push(n.filter(Hn))}}var d,p,g,m=e(o),v=i.invert(r[0],r[1]),y={point:a,lineStart:l,lineEnd:u,polygonStart:function(){y.point=c;y.lineStart=f;y.lineEnd=h;d=[];p=[]},polygonEnd:function(){y.point=a;y.lineStart=l;y.lineEnd=u;d=is.merge(d);var t=qn(v,p);if(d.length){w||(o.polygonStart(),w=!0);En(d,Rn,t,n,o)}else if(t){w||(o.polygonStart(),w=!0);o.lineStart();n(null,null,1,o);o.lineEnd()}w&&(o.polygonEnd(),w=!1);d=p=null},sphere:function(){o.polygonStart();o.lineStart();n(null,null,1,o);o.lineEnd();o.polygonEnd()}},b=On(),x=e(b),w=!1;return y}}function Hn(t){return t.length>1}function On(){var t,e=[];return{lineStart:function(){e.push(t=[])},point:function(e,n){t.push([e,n])},lineEnd:x,buffer:function(){var n=e;e=[];t=null;return n},rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))}}}function Rn(t,e){return((t=t.x)[0]<0?t[1]-zs-Hs:zs-t[1])-((e=e.x)[0]<0?e[1]-zs-Hs:zs-e[1])}function Fn(t){var e,n=0/0,r=0/0,i=0/0;return{lineStart:function(){t.lineStart();e=1},point:function(o,a){var s=o>0?Rs:-Rs,l=ys(o-n);if(ys(l-Rs)<Hs){t.point(n,r=(r+a)/2>0?zs:-zs);t.point(i,r);t.lineEnd();t.lineStart();t.point(s,r);t.point(o,r);e=0}else if(i!==s&&l>=Rs){ys(n-i)<Hs&&(n-=i*Hs);ys(o-s)<Hs&&(o-=s*Hs);r=Wn(n,r,o,a);t.point(i,r);t.lineEnd();t.lineStart();t.point(s,r);e=0}t.point(n=o,r=a);i=s},lineEnd:function(){t.lineEnd();n=r=0/0},clean:function(){return 2-e}}}function Wn(t,e,n,r){var i,o,a=Math.sin(t-n);return ys(a)>Hs?Math.atan((Math.sin(e)*(o=Math.cos(r))*Math.sin(n)-Math.sin(r)*(i=Math.cos(e))*Math.sin(t))/(i*o*a)):(e+r)/2
}function zn(t,e,n,r){var i;if(null==t){i=n*zs;r.point(-Rs,i);r.point(0,i);r.point(Rs,i);r.point(Rs,0);r.point(Rs,-i);r.point(0,-i);r.point(-Rs,-i);r.point(-Rs,0);r.point(-Rs,i)}else if(ys(t[0]-e[0])>Hs){var o=t[0]<e[0]?Rs:-Rs;i=n*o/2;r.point(-o,i);r.point(0,i);r.point(o,i)}else r.point(e[0],e[1])}function qn(t,e){var n=t[0],r=t[1],i=[Math.sin(n),-Math.cos(n),0],o=0,a=0;kl.reset();for(var s=0,l=e.length;l>s;++s){var u=e[s],c=u.length;if(c)for(var f=u[0],h=f[0],d=f[1]/2+Rs/4,p=Math.sin(d),g=Math.cos(d),m=1;;){m===c&&(m=0);t=u[m];var v=t[0],y=t[1]/2+Rs/4,b=Math.sin(y),x=Math.cos(y),w=v-h,C=w>=0?1:-1,S=C*w,T=S>Rs,k=p*b;kl.add(Math.atan2(k*C*Math.sin(S),g*x+k*Math.cos(S)));o+=T?w+C*Fs:w;if(T^h>=n^v>=n){var _=bn(vn(f),vn(t));Cn(_);var M=bn(i,_);Cn(M);var D=(T^w>=0?-1:1)*ne(M[2]);(r>D||r===D&&(_[0]||_[1]))&&(a+=T^w>=0?1:-1)}if(!m++)break;h=v,p=b,g=x,f=t}}return(-Hs>o||Hs>o&&0>kl)^1&a}function Un(t){function e(t,e){return Math.cos(t)*Math.cos(e)>o}function n(t){var n,o,l,u,c;return{lineStart:function(){u=l=!1;c=1},point:function(f,h){var d,p=[f,h],g=e(f,h),m=a?g?0:i(f,h):g?i(f+(0>f?Rs:-Rs),h):0;!n&&(u=l=g)&&t.lineStart();if(g!==l){d=r(n,p);if(Tn(n,d)||Tn(p,d)){p[0]+=Hs;p[1]+=Hs;g=e(p[0],p[1])}}if(g!==l){c=0;if(g){t.lineStart();d=r(p,n);t.point(d[0],d[1])}else{d=r(n,p);t.point(d[0],d[1]);t.lineEnd()}n=d}else if(s&&n&&a^g){var v;if(!(m&o)&&(v=r(p,n,!0))){c=0;if(a){t.lineStart();t.point(v[0][0],v[0][1]);t.point(v[1][0],v[1][1]);t.lineEnd()}else{t.point(v[1][0],v[1][1]);t.lineEnd();t.lineStart();t.point(v[0][0],v[0][1])}}}!g||n&&Tn(n,p)||t.point(p[0],p[1]);n=p,l=g,o=m},lineEnd:function(){l&&t.lineEnd();n=null},clean:function(){return c|(u&&l)<<1}}}function r(t,e,n){var r=vn(t),i=vn(e),a=[1,0,0],s=bn(r,i),l=yn(s,s),u=s[0],c=l-u*u;if(!c)return!n&&t;var f=o*l/c,h=-o*u/c,d=bn(a,s),p=wn(a,f),g=wn(s,h);xn(p,g);var m=d,v=yn(p,m),y=yn(m,m),b=v*v-y*(yn(p,p)-1);if(!(0>b)){var x=Math.sqrt(b),w=wn(m,(-v-x)/y);xn(w,p);w=Sn(w);if(!n)return w;var C,S=t[0],T=e[0],k=t[1],_=e[1];S>T&&(C=S,S=T,T=C);var M=T-S,D=ys(M-Rs)<Hs,L=D||Hs>M;!D&&k>_&&(C=k,k=_,_=C);if(L?D?k+_>0^w[1]<(ys(w[0]-S)<Hs?k:_):k<=w[1]&&w[1]<=_:M>Rs^(S<=w[0]&&w[0]<=T)){var A=wn(m,(-v+x)/y);xn(A,p);return[w,Sn(A)]}}}function i(e,n){var r=a?t:Rs-t,i=0;-r>e?i|=1:e>r&&(i|=2);-r>n?i|=4:n>r&&(i|=8);return i}var o=Math.cos(t),a=o>0,s=ys(o)>Hs,l=mr(t,6*qs);return Pn(e,n,l,a?[0,-t]:[-Rs,t-Rs])}function Bn(t,e,n,r){return function(i){var o,a=i.a,s=i.b,l=a.x,u=a.y,c=s.x,f=s.y,h=0,d=1,p=c-l,g=f-u;o=t-l;if(p||!(o>0)){o/=p;if(0>p){if(h>o)return;d>o&&(d=o)}else if(p>0){if(o>d)return;o>h&&(h=o)}o=n-l;if(p||!(0>o)){o/=p;if(0>p){if(o>d)return;o>h&&(h=o)}else if(p>0){if(h>o)return;d>o&&(d=o)}o=e-u;if(g||!(o>0)){o/=g;if(0>g){if(h>o)return;d>o&&(d=o)}else if(g>0){if(o>d)return;o>h&&(h=o)}o=r-u;if(g||!(0>o)){o/=g;if(0>g){if(o>d)return;o>h&&(h=o)}else if(g>0){if(h>o)return;d>o&&(d=o)}h>0&&(i.a={x:l+h*p,y:u+h*g});1>d&&(i.b={x:l+d*p,y:u+d*g});return i}}}}}}function Vn(t,e,n,r){function i(r,i){return ys(r[0]-t)<Hs?i>0?0:3:ys(r[0]-n)<Hs?i>0?2:1:ys(r[1]-e)<Hs?i>0?1:0:i>0?3:2}function o(t,e){return a(t.x,e.x)}function a(t,e){var n=i(t,1),r=i(e,1);return n!==r?n-r:0===n?e[1]-t[1]:1===n?t[0]-e[0]:2===n?t[1]-e[1]:e[0]-t[0]}return function(s){function l(t){for(var e=0,n=m.length,r=t[1],i=0;n>i;++i)for(var o,a=1,s=m[i],l=s.length,u=s[0];l>a;++a){o=s[a];u[1]<=r?o[1]>r&&te(u,o,t)>0&&++e:o[1]<=r&&te(u,o,t)<0&&--e;u=o}return 0!==e}function u(o,s,l,u){var c=0,f=0;if(null==o||(c=i(o,l))!==(f=i(s,l))||a(o,s)<0^l>0){do u.point(0===c||3===c?t:n,c>1?r:e);while((c=(c+l+4)%4)!==f)}else u.point(s[0],s[1])}function c(i,o){return i>=t&&n>=i&&o>=e&&r>=o}function f(t,e){c(t,e)&&s.point(t,e)}function h(){L.point=p;m&&m.push(v=[]);T=!0;S=!1;w=C=0/0}function d(){if(g){p(y,b);x&&S&&M.rejoin();g.push(M.buffer())}L.point=f;S&&s.lineEnd()}function p(t,e){t=Math.max(-Wl,Math.min(Wl,t));e=Math.max(-Wl,Math.min(Wl,e));var n=c(t,e);m&&v.push([t,e]);if(T){y=t,b=e,x=n;T=!1;if(n){s.lineStart();s.point(t,e)}}else if(n&&S)s.point(t,e);else{var r={a:{x:w,y:C},b:{x:t,y:e}};if(D(r)){if(!S){s.lineStart();s.point(r.a.x,r.a.y)}s.point(r.b.x,r.b.y);n||s.lineEnd();k=!1}else if(n){s.lineStart();s.point(t,e);k=!1}}w=t,C=e,S=n}var g,m,v,y,b,x,w,C,S,T,k,_=s,M=On(),D=Bn(t,e,n,r),L={point:f,lineStart:h,lineEnd:d,polygonStart:function(){s=M;g=[];m=[];k=!0},polygonEnd:function(){s=_;g=is.merge(g);var e=l([t,r]),n=k&&e,i=g.length;if(n||i){s.polygonStart();if(n){s.lineStart();u(null,null,1,s);s.lineEnd()}i&&En(g,o,e,u,s);s.polygonEnd()}g=m=v=null}};return L}}function Xn(t){var e=0,n=Rs/3,r=lr(t),i=r(e,n);i.parallels=function(t){return arguments.length?r(e=t[0]*Rs/180,n=t[1]*Rs/180):[e/Rs*180,n/Rs*180]};return i}function Gn(t,e){function n(t,e){var n=Math.sqrt(o-2*i*Math.sin(e))/i;return[n*Math.sin(t*=i),a-n*Math.cos(t)]}var r=Math.sin(t),i=(r+Math.sin(e))/2,o=1+r*(2*i-r),a=Math.sqrt(o)/i;n.invert=function(t,e){var n=a-e;return[Math.atan2(t,n)/i,ne((o-(t*t+n*n)*i*i)/(2*i))]};return n}function $n(){function t(t,e){ql+=i*t-r*e;r=t,i=e}var e,n,r,i;Gl.point=function(o,a){Gl.point=t;e=r=o,n=i=a};Gl.lineEnd=function(){t(e,n)}}function Yn(t,e){Ul>t&&(Ul=t);t>Vl&&(Vl=t);Bl>e&&(Bl=e);e>Xl&&(Xl=e)}function Jn(){function t(t,e){a.push("M",t,",",e,o)}function e(t,e){a.push("M",t,",",e);s.point=n}function n(t,e){a.push("L",t,",",e)}function r(){s.point=t}function i(){a.push("Z")}var o=Kn(4.5),a=[],s={point:t,lineStart:function(){s.point=e},lineEnd:r,polygonStart:function(){s.lineEnd=i},polygonEnd:function(){s.lineEnd=r;s.point=t},pointRadius:function(t){o=Kn(t);return s},result:function(){if(a.length){var t=a.join("");a=[];return t}}};return s}function Kn(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Zn(t,e){Ll+=t;Al+=e;++Nl}function Qn(){function t(t,r){var i=t-e,o=r-n,a=Math.sqrt(i*i+o*o);El+=a*(e+t)/2;jl+=a*(n+r)/2;Il+=a;Zn(e=t,n=r)}var e,n;Yl.point=function(r,i){Yl.point=t;Zn(e=r,n=i)}}function tr(){Yl.point=Zn}function er(){function t(t,e){var n=t-r,o=e-i,a=Math.sqrt(n*n+o*o);El+=a*(r+t)/2;jl+=a*(i+e)/2;Il+=a;a=i*t-r*e;Pl+=a*(r+t);Hl+=a*(i+e);Ol+=3*a;Zn(r=t,i=e)}var e,n,r,i;Yl.point=function(o,a){Yl.point=t;Zn(e=r=o,n=i=a)};Yl.lineEnd=function(){t(e,n)}}function nr(t){function e(e,n){t.moveTo(e+a,n);t.arc(e,n,a,0,Fs)}function n(e,n){t.moveTo(e,n);s.point=r}function r(e,n){t.lineTo(e,n)}function i(){s.point=e}function o(){t.closePath()}var a=4.5,s={point:e,lineStart:function(){s.point=n},lineEnd:i,polygonStart:function(){s.lineEnd=o},polygonEnd:function(){s.lineEnd=i;s.point=e},pointRadius:function(t){a=t;return s},result:x};return s}function rr(t){function e(t){return(s?r:n)(t)}function n(e){return ar(e,function(n,r){n=t(n,r);e.point(n[0],n[1])})}function r(e){function n(n,r){n=t(n,r);e.point(n[0],n[1])}function r(){b=0/0;T.point=o;e.lineStart()}function o(n,r){var o=vn([n,r]),a=t(n,r);i(b,x,y,w,C,S,b=a[0],x=a[1],y=n,w=o[0],C=o[1],S=o[2],s,e);e.point(b,x)}function a(){T.point=n;e.lineEnd()}function l(){r();T.point=u;T.lineEnd=c}function u(t,e){o(f=t,h=e),d=b,p=x,g=w,m=C,v=S;T.point=o}function c(){i(b,x,y,w,C,S,d,p,f,g,m,v,s,e);T.lineEnd=a;a()}var f,h,d,p,g,m,v,y,b,x,w,C,S,T={point:n,lineStart:r,lineEnd:a,polygonStart:function(){e.polygonStart();T.lineStart=l},polygonEnd:function(){e.polygonEnd();T.lineStart=r}};return T}function i(e,n,r,s,l,u,c,f,h,d,p,g,m,v){var y=c-e,b=f-n,x=y*y+b*b;if(x>4*o&&m--){var w=s+d,C=l+p,S=u+g,T=Math.sqrt(w*w+C*C+S*S),k=Math.asin(S/=T),_=ys(ys(S)-1)<Hs||ys(r-h)<Hs?(r+h)/2:Math.atan2(C,w),M=t(_,k),D=M[0],L=M[1],A=D-e,N=L-n,E=b*A-y*N;if(E*E/x>o||ys((y*A+b*N)/x-.5)>.3||a>s*d+l*p+u*g){i(e,n,r,s,l,u,D,L,_,w/=T,C/=T,S,m,v);v.point(D,L);i(D,L,_,w,C,S,c,f,h,d,p,g,m,v)}}}var o=.5,a=Math.cos(30*qs),s=16;e.precision=function(t){if(!arguments.length)return Math.sqrt(o);s=(o=t*t)>0&&16;return e};return e}function ir(t){var e=rr(function(e,n){return t([e*Us,n*Us])});return function(t){return ur(e(t))}}function or(t){this.stream=t}function ar(t,e){return{point:e,sphere:function(){t.sphere()},lineStart:function(){t.lineStart()},lineEnd:function(){t.lineEnd()},polygonStart:function(){t.polygonStart()},polygonEnd:function(){t.polygonEnd()}}}function sr(t){return lr(function(){return t})()}function lr(t){function e(t){t=s(t[0]*qs,t[1]*qs);return[t[0]*h+l,u-t[1]*h]}function n(t){t=s.invert((t[0]-l)/h,(u-t[1])/h);return t&&[t[0]*Us,t[1]*Us]}function r(){s=An(a=hr(v,y,b),o);var t=o(g,m);l=d-t[0]*h;u=p+t[1]*h;return i()}function i(){c&&(c.valid=!1,c=null);return e}var o,a,s,l,u,c,f=rr(function(t,e){t=o(t,e);return[t[0]*h+l,u-t[1]*h]}),h=150,d=480,p=250,g=0,m=0,v=0,y=0,b=0,x=Fl,w=De,C=null,S=null;e.stream=function(t){c&&(c.valid=!1);c=ur(x(a,f(w(t))));c.valid=!0;return c};e.clipAngle=function(t){if(!arguments.length)return C;x=null==t?(C=t,Fl):Un((C=+t)*qs);return i()};e.clipExtent=function(t){if(!arguments.length)return S;S=t;w=t?Vn(t[0][0],t[0][1],t[1][0],t[1][1]):De;return i()};e.scale=function(t){if(!arguments.length)return h;h=+t;return r()};e.translate=function(t){if(!arguments.length)return[d,p];d=+t[0];p=+t[1];return r()};e.center=function(t){if(!arguments.length)return[g*Us,m*Us];g=t[0]%360*qs;m=t[1]%360*qs;return r()};e.rotate=function(t){if(!arguments.length)return[v*Us,y*Us,b*Us];v=t[0]%360*qs;y=t[1]%360*qs;b=t.length>2?t[2]%360*qs:0;return r()};is.rebind(e,f,"precision");return function(){o=t.apply(this,arguments);e.invert=o.invert&&n;return r()}}function ur(t){return ar(t,function(e,n){t.point(e*qs,n*qs)})}function cr(t,e){return[t,e]}function fr(t,e){return[t>Rs?t-Fs:-Rs>t?t+Fs:t,e]}function hr(t,e,n){return t?e||n?An(pr(t),gr(e,n)):pr(t):e||n?gr(e,n):fr}function dr(t){return function(e,n){return e+=t,[e>Rs?e-Fs:-Rs>e?e+Fs:e,n]}}function pr(t){var e=dr(t);e.invert=dr(-t);return e}function gr(t,e){function n(t,e){var n=Math.cos(e),s=Math.cos(t)*n,l=Math.sin(t)*n,u=Math.sin(e),c=u*r+s*i;return[Math.atan2(l*o-c*a,s*r-u*i),ne(c*o+l*a)]}var r=Math.cos(t),i=Math.sin(t),o=Math.cos(e),a=Math.sin(e);n.invert=function(t,e){var n=Math.cos(e),s=Math.cos(t)*n,l=Math.sin(t)*n,u=Math.sin(e),c=u*o-l*a;return[Math.atan2(l*o+u*a,s*r+c*i),ne(c*r-s*i)]};return n}function mr(t,e){var n=Math.cos(t),r=Math.sin(t);return function(i,o,a,s){var l=a*e;if(null!=i){i=vr(n,i);o=vr(n,o);(a>0?o>i:i>o)&&(i+=a*Fs)}else{i=t+a*Fs;o=t-.5*l}for(var u,c=i;a>0?c>o:o>c;c-=l)s.point((u=Sn([n,-r*Math.cos(c),-r*Math.sin(c)]))[0],u[1])}}function vr(t,e){var n=vn(e);n[0]-=t;Cn(n);var r=ee(-n[1]);return((-n[2]<0?-r:r)+2*Math.PI-Hs)%(2*Math.PI)}function yr(t,e,n){var r=is.range(t,e-Hs,n).concat(e);return function(t){return r.map(function(e){return[t,e]})}}function br(t,e,n){var r=is.range(t,e-Hs,n).concat(e);return function(t){return r.map(function(e){return[e,t]})}}function xr(t){return t.source}function wr(t){return t.target}function Cr(t,e,n,r){var i=Math.cos(e),o=Math.sin(e),a=Math.cos(r),s=Math.sin(r),l=i*Math.cos(t),u=i*Math.sin(t),c=a*Math.cos(n),f=a*Math.sin(n),h=2*Math.asin(Math.sqrt(ae(r-e)+i*a*ae(n-t))),d=1/Math.sin(h),p=h?function(t){var e=Math.sin(t*=h)*d,n=Math.sin(h-t)*d,r=n*l+e*c,i=n*u+e*f,a=n*o+e*s;return[Math.atan2(i,r)*Us,Math.atan2(a,Math.sqrt(r*r+i*i))*Us]}:function(){return[t*Us,e*Us]};p.distance=h;return p}function Sr(){function t(t,i){var o=Math.sin(i*=qs),a=Math.cos(i),s=ys((t*=qs)-e),l=Math.cos(s);Jl+=Math.atan2(Math.sqrt((s=a*Math.sin(s))*s+(s=r*o-n*a*l)*s),n*o+r*a*l);e=t,n=o,r=a}var e,n,r;Kl.point=function(i,o){e=i*qs,n=Math.sin(o*=qs),r=Math.cos(o);Kl.point=t};Kl.lineEnd=function(){Kl.point=Kl.lineEnd=x}}function Tr(t,e){function n(e,n){var r=Math.cos(e),i=Math.cos(n),o=t(r*i);return[o*i*Math.sin(e),o*Math.sin(n)]}n.invert=function(t,n){var r=Math.sqrt(t*t+n*n),i=e(r),o=Math.sin(i),a=Math.cos(i);return[Math.atan2(t*o,r*a),Math.asin(r&&n*o/r)]};return n}function kr(t,e){function n(t,e){a>0?-zs+Hs>e&&(e=-zs+Hs):e>zs-Hs&&(e=zs-Hs);var n=a/Math.pow(i(e),o);return[n*Math.sin(o*t),a-n*Math.cos(o*t)]}var r=Math.cos(t),i=function(t){return Math.tan(Rs/4+t/2)},o=t===e?Math.sin(t):Math.log(r/Math.cos(e))/Math.log(i(e)/i(t)),a=r*Math.pow(i(t),o)/o;if(!o)return Mr;n.invert=function(t,e){var n=a-e,r=Q(o)*Math.sqrt(t*t+n*n);return[Math.atan2(t,n)/o,2*Math.atan(Math.pow(a/r,1/o))-zs]};return n}function _r(t,e){function n(t,e){var n=o-e;return[n*Math.sin(i*t),o-n*Math.cos(i*t)]}var r=Math.cos(t),i=t===e?Math.sin(t):(r-Math.cos(e))/(e-t),o=r/i+t;if(ys(i)<Hs)return cr;n.invert=function(t,e){var n=o-e;return[Math.atan2(t,n)/i,o-Q(i)*Math.sqrt(t*t+n*n)]};return n}function Mr(t,e){return[t,Math.log(Math.tan(Rs/4+e/2))]}function Dr(t){var e,n=sr(t),r=n.scale,i=n.translate,o=n.clipExtent;n.scale=function(){var t=r.apply(n,arguments);return t===n?e?n.clipExtent(null):n:t};n.translate=function(){var t=i.apply(n,arguments);return t===n?e?n.clipExtent(null):n:t};n.clipExtent=function(t){var a=o.apply(n,arguments);if(a===n){if(e=null==t){var s=Rs*r(),l=i();o([[l[0]-s,l[1]-s],[l[0]+s,l[1]+s]])}}else e&&(a=null);return a};return n.clipExtent(null)}function Lr(t,e){return[Math.log(Math.tan(Rs/4+e/2)),-t]}function Ar(t){return t[0]}function Nr(t){return t[1]}function Er(t){for(var e=t.length,n=[0,1],r=2,i=2;e>i;i++){for(;r>1&&te(t[n[r-2]],t[n[r-1]],t[i])<=0;)--r;n[r++]=i}return n.slice(0,r)}function jr(t,e){return t[0]-e[0]||t[1]-e[1]}function Ir(t,e,n){return(n[0]-e[0])*(t[1]-e[1])<(n[1]-e[1])*(t[0]-e[0])}function Pr(t,e,n,r){var i=t[0],o=n[0],a=e[0]-i,s=r[0]-o,l=t[1],u=n[1],c=e[1]-l,f=r[1]-u,h=(s*(l-u)-f*(i-o))/(f*a-s*c);return[i+h*a,l+h*c]}function Hr(t){var e=t[0],n=t[t.length-1];return!(e[0]-n[0]||e[1]-n[1])}function Or(){ii(this);this.edge=this.site=this.circle=null}function Rr(t){var e=uu.pop()||new Or;e.site=t;return e}function Fr(t){Yr(t);au.remove(t);uu.push(t);ii(t)}function Wr(t){var e=t.circle,n=e.x,r=e.cy,i={x:n,y:r},o=t.P,a=t.N,s=[t];Fr(t);for(var l=o;l.circle&&ys(n-l.circle.x)<Hs&&ys(r-l.circle.cy)<Hs;){o=l.P;s.unshift(l);Fr(l);l=o}s.unshift(l);Yr(l);for(var u=a;u.circle&&ys(n-u.circle.x)<Hs&&ys(r-u.circle.cy)<Hs;){a=u.N;s.push(u);Fr(u);u=a}s.push(u);Yr(u);var c,f=s.length;for(c=1;f>c;++c){u=s[c];l=s[c-1];ei(u.edge,l.site,u.site,i)}l=s[0];u=s[f-1];u.edge=Qr(l.site,u.site,null,i);$r(l);$r(u)}function zr(t){for(var e,n,r,i,o=t.x,a=t.y,s=au._;s;){r=qr(s,a)-o;if(r>Hs)s=s.L;else{i=o-Ur(s,a);if(!(i>Hs)){if(r>-Hs){e=s.P;n=s}else if(i>-Hs){e=s;n=s.N}else e=n=s;break}if(!s.R){e=s;break}s=s.R}}var l=Rr(t);au.insert(e,l);if(e||n)if(e!==n)if(n){Yr(e);Yr(n);var u=e.site,c=u.x,f=u.y,h=t.x-c,d=t.y-f,p=n.site,g=p.x-c,m=p.y-f,v=2*(h*m-d*g),y=h*h+d*d,b=g*g+m*m,x={x:(m*y-d*b)/v+c,y:(h*b-g*y)/v+f};ei(n.edge,u,p,x);l.edge=Qr(u,t,null,x);n.edge=Qr(t,p,null,x);$r(e);$r(n)}else l.edge=Qr(e.site,l.site);else{Yr(e);n=Rr(e.site);au.insert(l,n);l.edge=n.edge=Qr(e.site,l.site);$r(e);$r(n)}}function qr(t,e){var n=t.site,r=n.x,i=n.y,o=i-e;if(!o)return r;var a=t.P;if(!a)return-1/0;n=a.site;var s=n.x,l=n.y,u=l-e;if(!u)return s;var c=s-r,f=1/o-1/u,h=c/u;return f?(-h+Math.sqrt(h*h-2*f*(c*c/(-2*u)-l+u/2+i-o/2)))/f+r:(r+s)/2}function Ur(t,e){var n=t.N;if(n)return qr(n,e);var r=t.site;return r.y===e?r.x:1/0}function Br(t){this.site=t;this.edges=[]}function Vr(t){for(var e,n,r,i,o,a,s,l,u,c,f=t[0][0],h=t[1][0],d=t[0][1],p=t[1][1],g=ou,m=g.length;m--;){o=g[m];if(o&&o.prepare()){s=o.edges;l=s.length;a=0;for(;l>a;){c=s[a].end(),r=c.x,i=c.y;u=s[++a%l].start(),e=u.x,n=u.y;if(ys(r-e)>Hs||ys(i-n)>Hs){s.splice(a,0,new ni(ti(o.site,c,ys(r-f)<Hs&&p-i>Hs?{x:f,y:ys(e-f)<Hs?n:p}:ys(i-p)<Hs&&h-r>Hs?{x:ys(n-p)<Hs?e:h,y:p}:ys(r-h)<Hs&&i-d>Hs?{x:h,y:ys(e-h)<Hs?n:d}:ys(i-d)<Hs&&r-f>Hs?{x:ys(n-d)<Hs?e:f,y:d}:null),o.site,null));++l}}}}}function Xr(t,e){return e.angle-t.angle}function Gr(){ii(this);this.x=this.y=this.arc=this.site=this.cy=null}function $r(t){var e=t.P,n=t.N;if(e&&n){var r=e.site,i=t.site,o=n.site;if(r!==o){var a=i.x,s=i.y,l=r.x-a,u=r.y-s,c=o.x-a,f=o.y-s,h=2*(l*f-u*c);if(!(h>=-Os)){var d=l*l+u*u,p=c*c+f*f,g=(f*d-u*p)/h,m=(l*p-c*d)/h,f=m+s,v=cu.pop()||new Gr;v.arc=t;v.site=i;v.x=g+a;v.y=f+Math.sqrt(g*g+m*m);v.cy=f;t.circle=v;for(var y=null,b=lu._;b;)if(v.y<b.y||v.y===b.y&&v.x<=b.x){if(!b.L){y=b.P;break}b=b.L}else{if(!b.R){y=b;break}b=b.R}lu.insert(y,v);y||(su=v)}}}}function Yr(t){var e=t.circle;if(e){e.P||(su=e.N);lu.remove(e);cu.push(e);ii(e);t.circle=null}}function Jr(t){for(var e,n=iu,r=Bn(t[0][0],t[0][1],t[1][0],t[1][1]),i=n.length;i--;){e=n[i];if(!Kr(e,t)||!r(e)||ys(e.a.x-e.b.x)<Hs&&ys(e.a.y-e.b.y)<Hs){e.a=e.b=null;n.splice(i,1)}}}function Kr(t,e){var n=t.b;if(n)return!0;var r,i,o=t.a,a=e[0][0],s=e[1][0],l=e[0][1],u=e[1][1],c=t.l,f=t.r,h=c.x,d=c.y,p=f.x,g=f.y,m=(h+p)/2,v=(d+g)/2;if(g===d){if(a>m||m>=s)return;if(h>p){if(o){if(o.y>=u)return}else o={x:m,y:l};n={x:m,y:u}}else{if(o){if(o.y<l)return}else o={x:m,y:u};n={x:m,y:l}}}else{r=(h-p)/(g-d);i=v-r*m;if(-1>r||r>1)if(h>p){if(o){if(o.y>=u)return}else o={x:(l-i)/r,y:l};n={x:(u-i)/r,y:u}}else{if(o){if(o.y<l)return}else o={x:(u-i)/r,y:u};n={x:(l-i)/r,y:l}}else if(g>d){if(o){if(o.x>=s)return}else o={x:a,y:r*a+i};n={x:s,y:r*s+i}}else{if(o){if(o.x<a)return}else o={x:s,y:r*s+i};n={x:a,y:r*a+i}}}t.a=o;t.b=n;return!0}function Zr(t,e){this.l=t;this.r=e;this.a=this.b=null}function Qr(t,e,n,r){var i=new Zr(t,e);iu.push(i);n&&ei(i,t,e,n);r&&ei(i,e,t,r);ou[t.i].edges.push(new ni(i,t,e));ou[e.i].edges.push(new ni(i,e,t));return i}function ti(t,e,n){var r=new Zr(t,null);r.a=e;r.b=n;iu.push(r);return r}function ei(t,e,n,r){if(t.a||t.b)t.l===n?t.b=r:t.a=r;else{t.a=r;t.l=e;t.r=n}}function ni(t,e,n){var r=t.a,i=t.b;this.edge=t;this.site=e;this.angle=n?Math.atan2(n.y-e.y,n.x-e.x):t.l===e?Math.atan2(i.x-r.x,r.y-i.y):Math.atan2(r.x-i.x,i.y-r.y)}function ri(){this._=null}function ii(t){t.U=t.C=t.L=t.R=t.P=t.N=null}function oi(t,e){var n=e,r=e.R,i=n.U;i?i.L===n?i.L=r:i.R=r:t._=r;r.U=i;n.U=r;n.R=r.L;n.R&&(n.R.U=n);r.L=n}function ai(t,e){var n=e,r=e.L,i=n.U;i?i.L===n?i.L=r:i.R=r:t._=r;r.U=i;n.U=r;n.L=r.R;n.L&&(n.L.U=n);r.R=n}function si(t){for(;t.L;)t=t.L;return t}function li(t,e){var n,r,i,o=t.sort(ui).pop();iu=[];ou=new Array(t.length);au=new ri;lu=new ri;for(;;){i=su;if(o&&(!i||o.y<i.y||o.y===i.y&&o.x<i.x)){if(o.x!==n||o.y!==r){ou[o.i]=new Br(o);zr(o);n=o.x,r=o.y}o=t.pop()}else{if(!i)break;Wr(i.arc)}}e&&(Jr(e),Vr(e));var a={cells:ou,edges:iu};au=lu=iu=ou=null;return a}function ui(t,e){return e.y-t.y||e.x-t.x}function ci(t,e,n){return(t.x-n.x)*(e.y-t.y)-(t.x-e.x)*(n.y-t.y)}function fi(t){return t.x}function hi(t){return t.y}function di(){return{leaf:!0,nodes:[],point:null,x:null,y:null}}function pi(t,e,n,r,i,o){if(!t(e,n,r,i,o)){var a=.5*(n+i),s=.5*(r+o),l=e.nodes;l[0]&&pi(t,l[0],n,r,a,s);l[1]&&pi(t,l[1],a,r,i,s);l[2]&&pi(t,l[2],n,s,a,o);l[3]&&pi(t,l[3],a,s,i,o)}}function gi(t,e,n,r,i,o,a){var s,l=1/0;(function u(t,c,f,h,d){if(!(c>o||f>a||r>h||i>d)){if(p=t.point){var p,g=e-p[0],m=n-p[1],v=g*g+m*m;if(l>v){var y=Math.sqrt(l=v);r=e-y,i=n-y;o=e+y,a=n+y;s=p}}for(var b=t.nodes,x=.5*(c+h),w=.5*(f+d),C=e>=x,S=n>=w,T=S<<1|C,k=T+4;k>T;++T)if(t=b[3&T])switch(3&T){case 0:u(t,c,f,x,w);break;case 1:u(t,x,f,h,w);break;case 2:u(t,c,w,x,d);break;case 3:u(t,x,w,h,d)}}})(t,r,i,o,a);return s}function mi(t,e){t=is.rgb(t);e=is.rgb(e);var n=t.r,r=t.g,i=t.b,o=e.r-n,a=e.g-r,s=e.b-i;return function(t){return"#"+we(Math.round(n+o*t))+we(Math.round(r+a*t))+we(Math.round(i+s*t))}}function vi(t,e){var n,r={},i={};for(n in t)n in e?r[n]=xi(t[n],e[n]):i[n]=t[n];for(n in e)n in t||(i[n]=e[n]);return function(t){for(n in r)i[n]=r[n](t);return i}}function yi(t,e){t=+t,e=+e;return function(n){return t*(1-n)+e*n}}function bi(t,e){var n,r,i,o=hu.lastIndex=du.lastIndex=0,a=-1,s=[],l=[];t+="",e+="";for(;(n=hu.exec(t))&&(r=du.exec(e));){if((i=r.index)>o){i=e.slice(o,i);s[a]?s[a]+=i:s[++a]=i}if((n=n[0])===(r=r[0]))s[a]?s[a]+=r:s[++a]=r;else{s[++a]=null;l.push({i:a,x:yi(n,r)})}o=du.lastIndex}if(o<e.length){i=e.slice(o);s[a]?s[a]+=i:s[++a]=i}return s.length<2?l[0]?(e=l[0].x,function(t){return e(t)+""}):function(){return e}:(e=l.length,function(t){for(var n,r=0;e>r;++r)s[(n=l[r]).i]=n.x(t);return s.join("")})}function xi(t,e){for(var n,r=is.interpolators.length;--r>=0&&!(n=is.interpolators[r](t,e)););return n}function wi(t,e){var n,r=[],i=[],o=t.length,a=e.length,s=Math.min(t.length,e.length);for(n=0;s>n;++n)r.push(xi(t[n],e[n]));for(;o>n;++n)i[n]=t[n];for(;a>n;++n)i[n]=e[n];return function(t){for(n=0;s>n;++n)i[n]=r[n](t);return i}}function Ci(t){return function(e){return 0>=e?0:e>=1?1:t(e)}}function Si(t){return function(e){return 1-t(1-e)}}function Ti(t){return function(e){return.5*(.5>e?t(2*e):2-t(2-2*e))}}function ki(t){return t*t}function _i(t){return t*t*t}function Mi(t){if(0>=t)return 0;if(t>=1)return 1;var e=t*t,n=e*t;return 4*(.5>t?n:3*(t-e)+n-.75)}function Di(t){return function(e){return Math.pow(e,t)}}function Li(t){return 1-Math.cos(t*zs)}function Ai(t){return Math.pow(2,10*(t-1))}function Ni(t){return 1-Math.sqrt(1-t*t)}function Ei(t,e){var n;arguments.length<2&&(e=.45);arguments.length?n=e/Fs*Math.asin(1/t):(t=1,n=e/4);return function(r){return 1+t*Math.pow(2,-10*r)*Math.sin((r-n)*Fs/e)}}function ji(t){t||(t=1.70158);return function(e){return e*e*((t+1)*e-t)}}function Ii(t){return 1/2.75>t?7.5625*t*t:2/2.75>t?7.5625*(t-=1.5/2.75)*t+.75:2.5/2.75>t?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}function Pi(t,e){t=is.hcl(t);e=is.hcl(e);var n=t.h,r=t.c,i=t.l,o=e.h-n,a=e.c-r,s=e.l-i;isNaN(a)&&(a=0,r=isNaN(r)?e.c:r);isNaN(o)?(o=0,n=isNaN(n)?e.h:n):o>180?o-=360:-180>o&&(o+=360);return function(t){return fe(n+o*t,r+a*t,i+s*t)+""}}function Hi(t,e){t=is.hsl(t);e=is.hsl(e);var n=t.h,r=t.s,i=t.l,o=e.h-n,a=e.s-r,s=e.l-i;isNaN(a)&&(a=0,r=isNaN(r)?e.s:r);isNaN(o)?(o=0,n=isNaN(n)?e.h:n):o>180?o-=360:-180>o&&(o+=360);return function(t){return ue(n+o*t,r+a*t,i+s*t)+""}}function Oi(t,e){t=is.lab(t);e=is.lab(e);var n=t.l,r=t.a,i=t.b,o=e.l-n,a=e.a-r,s=e.b-i;return function(t){return de(n+o*t,r+a*t,i+s*t)+""}}function Ri(t,e){e-=t;return function(n){return Math.round(t+e*n)}}function Fi(t){var e=[t.a,t.b],n=[t.c,t.d],r=zi(e),i=Wi(e,n),o=zi(qi(n,e,-i))||0;if(e[0]*n[1]<n[0]*e[1]){e[0]*=-1;e[1]*=-1;r*=-1;i*=-1}this.rotate=(r?Math.atan2(e[1],e[0]):Math.atan2(-n[0],n[1]))*Us;this.translate=[t.e,t.f];this.scale=[r,o];this.skew=o?Math.atan2(i,o)*Us:0}function Wi(t,e){return t[0]*e[0]+t[1]*e[1]}function zi(t){var e=Math.sqrt(Wi(t,t));if(e){t[0]/=e;t[1]/=e}return e}function qi(t,e,n){t[0]+=n*e[0];t[1]+=n*e[1];return t}function Ui(t,e){var n,r=[],i=[],o=is.transform(t),a=is.transform(e),s=o.translate,l=a.translate,u=o.rotate,c=a.rotate,f=o.skew,h=a.skew,d=o.scale,p=a.scale;if(s[0]!=l[0]||s[1]!=l[1]){r.push("translate(",null,",",null,")");i.push({i:1,x:yi(s[0],l[0])},{i:3,x:yi(s[1],l[1])})}else r.push(l[0]||l[1]?"translate("+l+")":"");if(u!=c){u-c>180?c+=360:c-u>180&&(u+=360);i.push({i:r.push(r.pop()+"rotate(",null,")")-2,x:yi(u,c)})}else c&&r.push(r.pop()+"rotate("+c+")");f!=h?i.push({i:r.push(r.pop()+"skewX(",null,")")-2,x:yi(f,h)}):h&&r.push(r.pop()+"skewX("+h+")");if(d[0]!=p[0]||d[1]!=p[1]){n=r.push(r.pop()+"scale(",null,",",null,")");i.push({i:n-4,x:yi(d[0],p[0])},{i:n-2,x:yi(d[1],p[1])})}else(1!=p[0]||1!=p[1])&&r.push(r.pop()+"scale("+p+")");n=i.length;return function(t){for(var e,o=-1;++o<n;)r[(e=i[o]).i]=e.x(t);return r.join("")}}function Bi(t,e){e=(e-=t=+t)||1/e;return function(n){return(n-t)/e}}function Vi(t,e){e=(e-=t=+t)||1/e;return function(n){return Math.max(0,Math.min(1,(n-t)/e))}}function Xi(t){for(var e=t.source,n=t.target,r=$i(e,n),i=[e];e!==r;){e=e.parent;i.push(e)}for(var o=i.length;n!==r;){i.splice(o,0,n);n=n.parent}return i}function Gi(t){for(var e=[],n=t.parent;null!=n;){e.push(t);t=n;n=n.parent}e.push(t);return e}function $i(t,e){if(t===e)return t;for(var n=Gi(t),r=Gi(e),i=n.pop(),o=r.pop(),a=null;i===o;){a=i;i=n.pop();o=r.pop()}return a}function Yi(t){t.fixed|=2}function Ji(t){t.fixed&=-7}function Ki(t){t.fixed|=4;t.px=t.x,t.py=t.y}function Zi(t){t.fixed&=-5}function Qi(t,e,n){var r=0,i=0;t.charge=0;if(!t.leaf)for(var o,a=t.nodes,s=a.length,l=-1;++l<s;){o=a[l];if(null!=o){Qi(o,e,n);t.charge+=o.charge;r+=o.charge*o.cx;i+=o.charge*o.cy}}if(t.point){if(!t.leaf){t.point.x+=Math.random()-.5;t.point.y+=Math.random()-.5}var u=e*n[t.point.index];t.charge+=t.pointCharge=u;r+=u*t.point.x;i+=u*t.point.y}t.cx=r/t.charge;t.cy=i/t.charge}function to(t,e){is.rebind(t,e,"sort","children","value");t.nodes=t;t.links=ao;return t}function eo(t,e){for(var n=[t];null!=(t=n.pop());){e(t);if((i=t.children)&&(r=i.length))for(var r,i;--r>=0;)n.push(i[r])}}function no(t,e){for(var n=[t],r=[];null!=(t=n.pop());){r.push(t);if((o=t.children)&&(i=o.length))for(var i,o,a=-1;++a<i;)n.push(o[a])}for(;null!=(t=r.pop());)e(t)}function ro(t){return t.children}function io(t){return t.value}function oo(t,e){return e.value-t.value}function ao(t){return is.merge(t.map(function(t){return(t.children||[]).map(function(e){return{source:t,target:e}})}))}function so(t){return t.x}function lo(t){return t.y}function uo(t,e,n){t.y0=e;t.y=n}function co(t){return is.range(t.length)}function fo(t){for(var e=-1,n=t[0].length,r=[];++e<n;)r[e]=0;return r}function ho(t){for(var e,n=1,r=0,i=t[0][1],o=t.length;o>n;++n)if((e=t[n][1])>i){r=n;i=e}return r}function po(t){return t.reduce(go,0)}function go(t,e){return t+e[1]}function mo(t,e){return vo(t,Math.ceil(Math.log(e.length)/Math.LN2+1))}function vo(t,e){for(var n=-1,r=+t[0],i=(t[1]-r)/e,o=[];++n<=e;)o[n]=i*n+r;return o}function yo(t){return[is.min(t),is.max(t)]}function bo(t,e){return t.value-e.value}function xo(t,e){var n=t._pack_next;t._pack_next=e;e._pack_prev=t;e._pack_next=n;n._pack_prev=e}function wo(t,e){t._pack_next=e;e._pack_prev=t}function Co(t,e){var n=e.x-t.x,r=e.y-t.y,i=t.r+e.r;return.999*i*i>n*n+r*r}function So(t){function e(t){c=Math.min(t.x-t.r,c);f=Math.max(t.x+t.r,f);h=Math.min(t.y-t.r,h);d=Math.max(t.y+t.r,d)}if((n=t.children)&&(u=n.length)){var n,r,i,o,a,s,l,u,c=1/0,f=-1/0,h=1/0,d=-1/0;n.forEach(To);r=n[0];r.x=-r.r;r.y=0;e(r);if(u>1){i=n[1];i.x=i.r;i.y=0;e(i);if(u>2){o=n[2];Mo(r,i,o);e(o);xo(r,o);r._pack_prev=o;xo(o,i);i=r._pack_next;for(a=3;u>a;a++){Mo(r,i,o=n[a]);var p=0,g=1,m=1;for(s=i._pack_next;s!==i;s=s._pack_next,g++)if(Co(s,o)){p=1;break}if(1==p)for(l=r._pack_prev;l!==s._pack_prev&&!Co(l,o);l=l._pack_prev,m++);if(p){m>g||g==m&&i.r<r.r?wo(r,i=s):wo(r=l,i);a--}else{xo(r,o);i=o;e(o)}}}}var v=(c+f)/2,y=(h+d)/2,b=0;for(a=0;u>a;a++){o=n[a];o.x-=v;o.y-=y;b=Math.max(b,o.r+Math.sqrt(o.x*o.x+o.y*o.y))}t.r=b;n.forEach(ko)}}function To(t){t._pack_next=t._pack_prev=t}function ko(t){delete t._pack_next;delete t._pack_prev}function _o(t,e,n,r){var i=t.children;t.x=e+=r*t.x;t.y=n+=r*t.y;t.r*=r;if(i)for(var o=-1,a=i.length;++o<a;)_o(i[o],e,n,r)}function Mo(t,e,n){var r=t.r+n.r,i=e.x-t.x,o=e.y-t.y;if(r&&(i||o)){var a=e.r+n.r,s=i*i+o*o;a*=a;r*=r;var l=.5+(r-a)/(2*s),u=Math.sqrt(Math.max(0,2*a*(r+s)-(r-=s)*r-a*a))/(2*s);n.x=t.x+l*i+u*o;n.y=t.y+l*o-u*i}else{n.x=t.x+r;n.y=t.y}}function Do(t,e){return t.parent==e.parent?1:2}function Lo(t){var e=t.children;return e.length?e[0]:t.t}function Ao(t){var e,n=t.children;return(e=n.length)?n[e-1]:t.t}function No(t,e,n){var r=n/(e.i-t.i);e.c-=r;e.s+=n;t.c+=r;e.z+=n;e.m+=n}function Eo(t){for(var e,n=0,r=0,i=t.children,o=i.length;--o>=0;){e=i[o];e.z+=n;e.m+=n;n+=e.s+(r+=e.c)}}function jo(t,e,n){return t.a.parent===e.parent?t.a:n}function Io(t){return 1+is.max(t,function(t){return t.y})}function Po(t){return t.reduce(function(t,e){return t+e.x},0)/t.length}function Ho(t){var e=t.children;return e&&e.length?Ho(e[0]):t}function Oo(t){var e,n=t.children;return n&&(e=n.length)?Oo(n[e-1]):t}function Ro(t){return{x:t.x,y:t.y,dx:t.dx,dy:t.dy}}function Fo(t,e){var n=t.x+e[3],r=t.y+e[0],i=t.dx-e[1]-e[3],o=t.dy-e[0]-e[2];if(0>i){n+=i/2;i=0}if(0>o){r+=o/2;o=0}return{x:n,y:r,dx:i,dy:o}}function Wo(t){var e=t[0],n=t[t.length-1];return n>e?[e,n]:[n,e]}function zo(t){return t.rangeExtent?t.rangeExtent():Wo(t.range())}function qo(t,e,n,r){var i=n(t[0],t[1]),o=r(e[0],e[1]);return function(t){return o(i(t))}}function Uo(t,e){var n,r=0,i=t.length-1,o=t[r],a=t[i];if(o>a){n=r,r=i,i=n;n=o,o=a,a=n}t[r]=e.floor(o);t[i]=e.ceil(a);return t}function Bo(t){return t?{floor:function(e){return Math.floor(e/t)*t},ceil:function(e){return Math.ceil(e/t)*t}}:Tu}function Vo(t,e,n,r){var i=[],o=[],a=0,s=Math.min(t.length,e.length)-1;if(t[s]<t[0]){t=t.slice().reverse();e=e.slice().reverse()}for(;++a<=s;){i.push(n(t[a-1],t[a]));o.push(r(e[a-1],e[a]))}return function(e){var n=is.bisect(t,e,1,s)-1;return o[n](i[n](e))}}function Xo(t,e,n,r){function i(){var i=Math.min(t.length,e.length)>2?Vo:qo,l=r?Vi:Bi;a=i(t,e,l,n);s=i(e,t,l,xi);return o}function o(t){return a(t)}var a,s;o.invert=function(t){return s(t)};o.domain=function(e){if(!arguments.length)return t;t=e.map(Number);return i()};o.range=function(t){if(!arguments.length)return e;e=t;return i()};o.rangeRound=function(t){return o.range(t).interpolate(Ri)};o.clamp=function(t){if(!arguments.length)return r;r=t;return i()};o.interpolate=function(t){if(!arguments.length)return n;n=t;return i()};o.ticks=function(e){return Jo(t,e)};o.tickFormat=function(e,n){return Ko(t,e,n)};o.nice=function(e){$o(t,e);return i()};o.copy=function(){return Xo(t,e,n,r)};return i()}function Go(t,e){return is.rebind(t,e,"range","rangeRound","interpolate","clamp")}function $o(t,e){return Uo(t,Bo(Yo(t,e)[2]))}function Yo(t,e){null==e&&(e=10);var n=Wo(t),r=n[1]-n[0],i=Math.pow(10,Math.floor(Math.log(r/e)/Math.LN10)),o=e/r*i;.15>=o?i*=10:.35>=o?i*=5:.75>=o&&(i*=2);n[0]=Math.ceil(n[0]/i)*i;n[1]=Math.floor(n[1]/i)*i+.5*i;n[2]=i;return n}function Jo(t,e){return is.range.apply(is,Yo(t,e))}function Ko(t,e,n){var r=Yo(t,e);if(n){var i=hl.exec(n);i.shift();if("s"===i[8]){var o=is.formatPrefix(Math.max(ys(r[0]),ys(r[1])));i[7]||(i[7]="."+Zo(o.scale(r[2])));i[8]="f";n=is.format(i.join(""));return function(t){return n(o.scale(t))+o.symbol}}i[7]||(i[7]="."+Qo(i[8],r));n=i.join("")}else n=",."+Zo(r[2])+"f";return is.format(n)}function Zo(t){return-Math.floor(Math.log(t)/Math.LN10+.01)}function Qo(t,e){var n=Zo(e[2]);return t in ku?Math.abs(n-Zo(Math.max(ys(e[0]),ys(e[1]))))+ +("e"!==t):n-2*("%"===t)}function ta(t,e,n,r){function i(t){return(n?Math.log(0>t?0:t):-Math.log(t>0?0:-t))/Math.log(e)}function o(t){return n?Math.pow(e,t):-Math.pow(e,-t)}function a(e){return t(i(e))}a.invert=function(e){return o(t.invert(e))};a.domain=function(e){if(!arguments.length)return r;n=e[0]>=0;t.domain((r=e.map(Number)).map(i));return a};a.base=function(n){if(!arguments.length)return e;e=+n;t.domain(r.map(i));return a};a.nice=function(){var e=Uo(r.map(i),n?Math:Mu);t.domain(e);r=e.map(o);return a};a.ticks=function(){var t=Wo(r),a=[],s=t[0],l=t[1],u=Math.floor(i(s)),c=Math.ceil(i(l)),f=e%1?2:e;if(isFinite(c-u)){if(n){for(;c>u;u++)for(var h=1;f>h;h++)a.push(o(u)*h);a.push(o(u))}else{a.push(o(u));for(;u++<c;)for(var h=f-1;h>0;h--)a.push(o(u)*h)}for(u=0;a[u]<s;u++);for(c=a.length;a[c-1]>l;c--);a=a.slice(u,c)}return a};a.tickFormat=function(t,e){if(!arguments.length)return _u;arguments.length<2?e=_u:"function"!=typeof e&&(e=is.format(e));var r,s=Math.max(.1,t/a.ticks().length),l=n?(r=1e-12,Math.ceil):(r=-1e-12,Math.floor);return function(t){return t/o(l(i(t)+r))<=s?e(t):""}};a.copy=function(){return ta(t.copy(),e,n,r)};return Go(a,t)}function ea(t,e,n){function r(e){return t(i(e))}var i=na(e),o=na(1/e);r.invert=function(e){return o(t.invert(e))};r.domain=function(e){if(!arguments.length)return n;t.domain((n=e.map(Number)).map(i));return r};r.ticks=function(t){return Jo(n,t)};r.tickFormat=function(t,e){return Ko(n,t,e)};r.nice=function(t){return r.domain($o(n,t))};r.exponent=function(a){if(!arguments.length)return e;i=na(e=a);o=na(1/e);t.domain(n.map(i));return r};r.copy=function(){return ea(t.copy(),e,n)};return Go(r,t)}function na(t){return function(e){return 0>e?-Math.pow(-e,t):Math.pow(e,t)}}function ra(t,e){function n(n){return o[((i.get(n)||("range"===e.t?i.set(n,t.push(n)):0/0))-1)%o.length]}function r(e,n){return is.range(t.length).map(function(t){return e+n*t})}var i,o,a;n.domain=function(r){if(!arguments.length)return t;t=[];i=new u;for(var o,a=-1,s=r.length;++a<s;)i.has(o=r[a])||i.set(o,t.push(o));return n[e.t].apply(n,e.a)};n.range=function(t){if(!arguments.length)return o;o=t;a=0;e={t:"range",a:arguments};return n};n.rangePoints=function(i,s){arguments.length<2&&(s=0);
var l=i[0],u=i[1],c=t.length<2?(l=(l+u)/2,0):(u-l)/(t.length-1+s);o=r(l+c*s/2,c);a=0;e={t:"rangePoints",a:arguments};return n};n.rangeRoundPoints=function(i,s){arguments.length<2&&(s=0);var l=i[0],u=i[1],c=t.length<2?(l=u=Math.round((l+u)/2),0):(u-l)/(t.length-1+s)|0;o=r(l+Math.round(c*s/2+(u-l-(t.length-1+s)*c)/2),c);a=0;e={t:"rangeRoundPoints",a:arguments};return n};n.rangeBands=function(i,s,l){arguments.length<2&&(s=0);arguments.length<3&&(l=s);var u=i[1]<i[0],c=i[u-0],f=i[1-u],h=(f-c)/(t.length-s+2*l);o=r(c+h*l,h);u&&o.reverse();a=h*(1-s);e={t:"rangeBands",a:arguments};return n};n.rangeRoundBands=function(i,s,l){arguments.length<2&&(s=0);arguments.length<3&&(l=s);var u=i[1]<i[0],c=i[u-0],f=i[1-u],h=Math.floor((f-c)/(t.length-s+2*l));o=r(c+Math.round((f-c-(t.length-s)*h)/2),h);u&&o.reverse();a=Math.round(h*(1-s));e={t:"rangeRoundBands",a:arguments};return n};n.rangeBand=function(){return a};n.rangeExtent=function(){return Wo(e.a[0])};n.copy=function(){return ra(t,e)};return n.domain(t)}function ia(t,n){function o(){var e=0,r=n.length;s=[];for(;++e<r;)s[e-1]=is.quantile(t,e/r);return a}function a(t){return isNaN(t=+t)?void 0:n[is.bisect(s,t)]}var s;a.domain=function(n){if(!arguments.length)return t;t=n.map(r).filter(i).sort(e);return o()};a.range=function(t){if(!arguments.length)return n;n=t;return o()};a.quantiles=function(){return s};a.invertExtent=function(e){e=n.indexOf(e);return 0>e?[0/0,0/0]:[e>0?s[e-1]:t[0],e<s.length?s[e]:t[t.length-1]]};a.copy=function(){return ia(t,n)};return o()}function oa(t,e,n){function r(e){return n[Math.max(0,Math.min(a,Math.floor(o*(e-t))))]}function i(){o=n.length/(e-t);a=n.length-1;return r}var o,a;r.domain=function(n){if(!arguments.length)return[t,e];t=+n[0];e=+n[n.length-1];return i()};r.range=function(t){if(!arguments.length)return n;n=t;return i()};r.invertExtent=function(e){e=n.indexOf(e);e=0>e?0/0:e/o+t;return[e,e+1/o]};r.copy=function(){return oa(t,e,n)};return i()}function aa(t,e){function n(n){return n>=n?e[is.bisect(t,n)]:void 0}n.domain=function(e){if(!arguments.length)return t;t=e;return n};n.range=function(t){if(!arguments.length)return e;e=t;return n};n.invertExtent=function(n){n=e.indexOf(n);return[t[n-1],t[n]]};n.copy=function(){return aa(t,e)};return n}function sa(t){function e(t){return+t}e.invert=e;e.domain=e.range=function(n){if(!arguments.length)return t;t=n.map(e);return e};e.ticks=function(e){return Jo(t,e)};e.tickFormat=function(e,n){return Ko(t,e,n)};e.copy=function(){return sa(t)};return e}function la(){return 0}function ua(t){return t.innerRadius}function ca(t){return t.outerRadius}function fa(t){return t.startAngle}function ha(t){return t.endAngle}function da(t){return t&&t.padAngle}function pa(t,e,n,r){return(t-n)*e-(e-r)*t>0?0:1}function ga(t,e,n,r,i){var o=t[0]-e[0],a=t[1]-e[1],s=(i?r:-r)/Math.sqrt(o*o+a*a),l=s*a,u=-s*o,c=t[0]+l,f=t[1]+u,h=e[0]+l,d=e[1]+u,p=(c+h)/2,g=(f+d)/2,m=h-c,v=d-f,y=m*m+v*v,b=n-r,x=c*d-h*f,w=(0>v?-1:1)*Math.sqrt(b*b*y-x*x),C=(x*v-m*w)/y,S=(-x*m-v*w)/y,T=(x*v+m*w)/y,k=(-x*m+v*w)/y,_=C-p,M=S-g,D=T-p,L=k-g;_*_+M*M>D*D+L*L&&(C=T,S=k);return[[C-l,S-u],[C*n/b,S*n/b]]}function ma(t){function e(e){function a(){u.push("M",o(t(c),s))}for(var l,u=[],c=[],f=-1,h=e.length,d=Me(n),p=Me(r);++f<h;)if(i.call(this,l=e[f],f))c.push([+d.call(this,l,f),+p.call(this,l,f)]);else if(c.length){a();c=[]}c.length&&a();return u.length?u.join(""):null}var n=Ar,r=Nr,i=Nn,o=va,a=o.key,s=.7;e.x=function(t){if(!arguments.length)return n;n=t;return e};e.y=function(t){if(!arguments.length)return r;r=t;return e};e.defined=function(t){if(!arguments.length)return i;i=t;return e};e.interpolate=function(t){if(!arguments.length)return a;a="function"==typeof t?o=t:(o=ju.get(t)||va).key;return e};e.tension=function(t){if(!arguments.length)return s;s=t;return e};return e}function va(t){return t.join("L")}function ya(t){return va(t)+"Z"}function ba(t){for(var e=0,n=t.length,r=t[0],i=[r[0],",",r[1]];++e<n;)i.push("H",(r[0]+(r=t[e])[0])/2,"V",r[1]);n>1&&i.push("H",r[0]);return i.join("")}function xa(t){for(var e=0,n=t.length,r=t[0],i=[r[0],",",r[1]];++e<n;)i.push("V",(r=t[e])[1],"H",r[0]);return i.join("")}function wa(t){for(var e=0,n=t.length,r=t[0],i=[r[0],",",r[1]];++e<n;)i.push("H",(r=t[e])[0],"V",r[1]);return i.join("")}function Ca(t,e){return t.length<4?va(t):t[1]+ka(t.slice(1,-1),_a(t,e))}function Sa(t,e){return t.length<3?va(t):t[0]+ka((t.push(t[0]),t),_a([t[t.length-2]].concat(t,[t[1]]),e))}function Ta(t,e){return t.length<3?va(t):t[0]+ka(t,_a(t,e))}function ka(t,e){if(e.length<1||t.length!=e.length&&t.length!=e.length+2)return va(t);var n=t.length!=e.length,r="",i=t[0],o=t[1],a=e[0],s=a,l=1;if(n){r+="Q"+(o[0]-2*a[0]/3)+","+(o[1]-2*a[1]/3)+","+o[0]+","+o[1];i=t[1];l=2}if(e.length>1){s=e[1];o=t[l];l++;r+="C"+(i[0]+a[0])+","+(i[1]+a[1])+","+(o[0]-s[0])+","+(o[1]-s[1])+","+o[0]+","+o[1];for(var u=2;u<e.length;u++,l++){o=t[l];s=e[u];r+="S"+(o[0]-s[0])+","+(o[1]-s[1])+","+o[0]+","+o[1]}}if(n){var c=t[l];r+="Q"+(o[0]+2*s[0]/3)+","+(o[1]+2*s[1]/3)+","+c[0]+","+c[1]}return r}function _a(t,e){for(var n,r=[],i=(1-e)/2,o=t[0],a=t[1],s=1,l=t.length;++s<l;){n=o;o=a;a=t[s];r.push([i*(a[0]-n[0]),i*(a[1]-n[1])])}return r}function Ma(t){if(t.length<3)return va(t);var e=1,n=t.length,r=t[0],i=r[0],o=r[1],a=[i,i,i,(r=t[1])[0]],s=[o,o,o,r[1]],l=[i,",",o,"L",Na(Hu,a),",",Na(Hu,s)];t.push(t[n-1]);for(;++e<=n;){r=t[e];a.shift();a.push(r[0]);s.shift();s.push(r[1]);Ea(l,a,s)}t.pop();l.push("L",r);return l.join("")}function Da(t){if(t.length<4)return va(t);for(var e,n=[],r=-1,i=t.length,o=[0],a=[0];++r<3;){e=t[r];o.push(e[0]);a.push(e[1])}n.push(Na(Hu,o)+","+Na(Hu,a));--r;for(;++r<i;){e=t[r];o.shift();o.push(e[0]);a.shift();a.push(e[1]);Ea(n,o,a)}return n.join("")}function La(t){for(var e,n,r=-1,i=t.length,o=i+4,a=[],s=[];++r<4;){n=t[r%i];a.push(n[0]);s.push(n[1])}e=[Na(Hu,a),",",Na(Hu,s)];--r;for(;++r<o;){n=t[r%i];a.shift();a.push(n[0]);s.shift();s.push(n[1]);Ea(e,a,s)}return e.join("")}function Aa(t,e){var n=t.length-1;if(n)for(var r,i,o=t[0][0],a=t[0][1],s=t[n][0]-o,l=t[n][1]-a,u=-1;++u<=n;){r=t[u];i=u/n;r[0]=e*r[0]+(1-e)*(o+i*s);r[1]=e*r[1]+(1-e)*(a+i*l)}return Ma(t)}function Na(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]}function Ea(t,e,n){t.push("C",Na(Iu,e),",",Na(Iu,n),",",Na(Pu,e),",",Na(Pu,n),",",Na(Hu,e),",",Na(Hu,n))}function ja(t,e){return(e[1]-t[1])/(e[0]-t[0])}function Ia(t){for(var e=0,n=t.length-1,r=[],i=t[0],o=t[1],a=r[0]=ja(i,o);++e<n;)r[e]=(a+(a=ja(i=o,o=t[e+1])))/2;r[e]=a;return r}function Pa(t){for(var e,n,r,i,o=[],a=Ia(t),s=-1,l=t.length-1;++s<l;){e=ja(t[s],t[s+1]);if(ys(e)<Hs)a[s]=a[s+1]=0;else{n=a[s]/e;r=a[s+1]/e;i=n*n+r*r;if(i>9){i=3*e/Math.sqrt(i);a[s]=i*n;a[s+1]=i*r}}}s=-1;for(;++s<=l;){i=(t[Math.min(l,s+1)][0]-t[Math.max(0,s-1)][0])/(6*(1+a[s]*a[s]));o.push([i||0,a[s]*i||0])}return o}function Ha(t){return t.length<3?va(t):t[0]+ka(t,Pa(t))}function Oa(t){for(var e,n,r,i=-1,o=t.length;++i<o;){e=t[i];n=e[0];r=e[1]-zs;e[0]=n*Math.cos(r);e[1]=n*Math.sin(r)}return t}function Ra(t){function e(e){function l(){g.push("M",s(t(v),f),c,u(t(m.reverse()),f),"Z")}for(var h,d,p,g=[],m=[],v=[],y=-1,b=e.length,x=Me(n),w=Me(i),C=n===r?function(){return d}:Me(r),S=i===o?function(){return p}:Me(o);++y<b;)if(a.call(this,h=e[y],y)){m.push([d=+x.call(this,h,y),p=+w.call(this,h,y)]);v.push([+C.call(this,h,y),+S.call(this,h,y)])}else if(m.length){l();m=[];v=[]}m.length&&l();return g.length?g.join(""):null}var n=Ar,r=Ar,i=0,o=Nr,a=Nn,s=va,l=s.key,u=s,c="L",f=.7;e.x=function(t){if(!arguments.length)return r;n=r=t;return e};e.x0=function(t){if(!arguments.length)return n;n=t;return e};e.x1=function(t){if(!arguments.length)return r;r=t;return e};e.y=function(t){if(!arguments.length)return o;i=o=t;return e};e.y0=function(t){if(!arguments.length)return i;i=t;return e};e.y1=function(t){if(!arguments.length)return o;o=t;return e};e.defined=function(t){if(!arguments.length)return a;a=t;return e};e.interpolate=function(t){if(!arguments.length)return l;l="function"==typeof t?s=t:(s=ju.get(t)||va).key;u=s.reverse||s;c=s.closed?"M":"L";return e};e.tension=function(t){if(!arguments.length)return f;f=t;return e};return e}function Fa(t){return t.radius}function Wa(t){return[t.x,t.y]}function za(t){return function(){var e=t.apply(this,arguments),n=e[0],r=e[1]-zs;return[n*Math.cos(r),n*Math.sin(r)]}}function qa(){return 64}function Ua(){return"circle"}function Ba(t){var e=Math.sqrt(t/Rs);return"M0,"+e+"A"+e+","+e+" 0 1,1 0,"+-e+"A"+e+","+e+" 0 1,1 0,"+e+"Z"}function Va(t){return function(){var e,n;if((e=this[t])&&(n=e[e.active])){--e.count?delete e[e.active]:delete this[t];e.active+=.5;n.event&&n.event.interrupt.call(this,this.__data__,n.index)}}}function Xa(t,e,n){Ss(t,Uu);t.namespace=e;t.id=n;return t}function Ga(t,e,n,r){var i=t.id,o=t.namespace;return q(t,"function"==typeof n?function(t,a,s){t[o][i].tween.set(e,r(n.call(t,t.__data__,a,s)))}:(n=r(n),function(t){t[o][i].tween.set(e,n)}))}function $a(t){null==t&&(t="");return function(){this.textContent=t}}function Ya(t){return null==t?"__transition__":"__transition_"+t+"__"}function Ja(t,e,n,r,i){var o=t[n]||(t[n]={active:0,count:0}),a=o[r];if(!a){var s=i.time;a=o[r]={tween:new u,time:s,delay:i.delay,duration:i.duration,ease:i.ease,index:e};i=null;++o.count;is.timer(function(i){function l(n){if(o.active>r)return c();var i=o[o.active];if(i){--o.count;delete o[o.active];i.event&&i.event.interrupt.call(t,t.__data__,i.index)}o.active=r;a.event&&a.event.start.call(t,t.__data__,e);a.tween.forEach(function(n,r){(r=r.call(t,t.__data__,e))&&g.push(r)});h=a.ease;f=a.duration;is.timer(function(){p.c=u(n||1)?Nn:u;return 1},0,s)}function u(n){if(o.active!==r)return 1;for(var i=n/f,s=h(i),l=g.length;l>0;)g[--l].call(t,s);if(i>=1){a.event&&a.event.end.call(t,t.__data__,e);return c()}}function c(){--o.count?delete o[r]:delete t[n];return 1}var f,h,d=a.delay,p=ul,g=[];p.t=d+s;if(i>=d)return l(i-d);p.c=l;return void 0},0,s)}}function Ka(t,e,n){t.attr("transform",function(t){var r=e(t);return"translate("+(isFinite(r)?r:n(t))+",0)"})}function Za(t,e,n){t.attr("transform",function(t){var r=e(t);return"translate(0,"+(isFinite(r)?r:n(t))+")"})}function Qa(t){return t.toISOString()}function ts(t,e,n){function r(e){return t(e)}function i(t,n){var r=t[1]-t[0],i=r/n,o=is.bisect(Zu,i);return o==Zu.length?[e.year,Yo(t.map(function(t){return t/31536e6}),n)[2]]:o?e[i/Zu[o-1]<Zu[o]/i?o-1:o]:[ec,Yo(t,n)[2]]}r.invert=function(e){return es(t.invert(e))};r.domain=function(e){if(!arguments.length)return t.domain().map(es);t.domain(e);return r};r.nice=function(t,e){function n(n){return!isNaN(n)&&!t.range(n,es(+n+1),e).length}var o=r.domain(),a=Wo(o),s=null==t?i(a,10):"number"==typeof t&&i(a,t);s&&(t=s[0],e=s[1]);return r.domain(Uo(o,e>1?{floor:function(e){for(;n(e=t.floor(e));)e=es(e-1);return e},ceil:function(e){for(;n(e=t.ceil(e));)e=es(+e+1);return e}}:t))};r.ticks=function(t,e){var n=Wo(r.domain()),o=null==t?i(n,10):"number"==typeof t?i(n,t):!t.range&&[{range:t},e];o&&(t=o[0],e=o[1]);return t.range(n[0],es(+n[1]+1),1>e?1:e)};r.tickFormat=function(){return n};r.copy=function(){return ts(t.copy(),e,n)};return Go(r,t)}function es(t){return new Date(t)}function ns(t){return JSON.parse(t.responseText)}function rs(t){var e=ss.createRange();e.selectNode(ss.body);return e.createContextualFragment(t.responseText)}var is={version:"3.5.3"};Date.now||(Date.now=function(){return+new Date});var os=[].slice,as=function(t){return os.call(t)},ss=document,ls=ss.documentElement,us=window;try{as(ls.childNodes)[0].nodeType}catch(cs){as=function(t){for(var e=t.length,n=new Array(e);e--;)n[e]=t[e];return n}}try{ss.createElement("div").style.setProperty("opacity",0,"")}catch(fs){var hs=us.Element.prototype,ds=hs.setAttribute,ps=hs.setAttributeNS,gs=us.CSSStyleDeclaration.prototype,ms=gs.setProperty;hs.setAttribute=function(t,e){ds.call(this,t,e+"")};hs.setAttributeNS=function(t,e,n){ps.call(this,t,e,n+"")};gs.setProperty=function(t,e,n){ms.call(this,t,e+"",n)}}is.ascending=e;is.descending=function(t,e){return t>e?-1:e>t?1:e>=t?0:0/0};is.min=function(t,e){var n,r,i=-1,o=t.length;if(1===arguments.length){for(;++i<o;)if(null!=(r=t[i])&&r>=r){n=r;break}for(;++i<o;)null!=(r=t[i])&&n>r&&(n=r)}else{for(;++i<o;)if(null!=(r=e.call(t,t[i],i))&&r>=r){n=r;break}for(;++i<o;)null!=(r=e.call(t,t[i],i))&&n>r&&(n=r)}return n};is.max=function(t,e){var n,r,i=-1,o=t.length;if(1===arguments.length){for(;++i<o;)if(null!=(r=t[i])&&r>=r){n=r;break}for(;++i<o;)null!=(r=t[i])&&r>n&&(n=r)}else{for(;++i<o;)if(null!=(r=e.call(t,t[i],i))&&r>=r){n=r;break}for(;++i<o;)null!=(r=e.call(t,t[i],i))&&r>n&&(n=r)}return n};is.extent=function(t,e){var n,r,i,o=-1,a=t.length;if(1===arguments.length){for(;++o<a;)if(null!=(r=t[o])&&r>=r){n=i=r;break}for(;++o<a;)if(null!=(r=t[o])){n>r&&(n=r);r>i&&(i=r)}}else{for(;++o<a;)if(null!=(r=e.call(t,t[o],o))&&r>=r){n=i=r;break}for(;++o<a;)if(null!=(r=e.call(t,t[o],o))){n>r&&(n=r);r>i&&(i=r)}}return[n,i]};is.sum=function(t,e){var n,r=0,o=t.length,a=-1;if(1===arguments.length)for(;++a<o;)i(n=+t[a])&&(r+=n);else for(;++a<o;)i(n=+e.call(t,t[a],a))&&(r+=n);return r};is.mean=function(t,e){var n,o=0,a=t.length,s=-1,l=a;if(1===arguments.length)for(;++s<a;)i(n=r(t[s]))?o+=n:--l;else for(;++s<a;)i(n=r(e.call(t,t[s],s)))?o+=n:--l;return l?o/l:void 0};is.quantile=function(t,e){var n=(t.length-1)*e+1,r=Math.floor(n),i=+t[r-1],o=n-r;return o?i+o*(t[r]-i):i};is.median=function(t,n){var o,a=[],s=t.length,l=-1;if(1===arguments.length)for(;++l<s;)i(o=r(t[l]))&&a.push(o);else for(;++l<s;)i(o=r(n.call(t,t[l],l)))&&a.push(o);return a.length?is.quantile(a.sort(e),.5):void 0};is.variance=function(t,e){var n,o,a=t.length,s=0,l=0,u=-1,c=0;if(1===arguments.length){for(;++u<a;)if(i(n=r(t[u]))){o=n-s;s+=o/++c;l+=o*(n-s)}}else for(;++u<a;)if(i(n=r(e.call(t,t[u],u)))){o=n-s;s+=o/++c;l+=o*(n-s)}return c>1?l/(c-1):void 0};is.deviation=function(){var t=is.variance.apply(this,arguments);return t?Math.sqrt(t):t};var vs=o(e);is.bisectLeft=vs.left;is.bisect=is.bisectRight=vs.right;is.bisector=function(t){return o(1===t.length?function(n,r){return e(t(n),r)}:t)};is.shuffle=function(t,e,n){if((o=arguments.length)<3){n=t.length;2>o&&(e=0)}for(var r,i,o=n-e;o;){i=Math.random()*o--|0;r=t[o+e],t[o+e]=t[i+e],t[i+e]=r}return t};is.permute=function(t,e){for(var n=e.length,r=new Array(n);n--;)r[n]=t[e[n]];return r};is.pairs=function(t){for(var e,n=0,r=t.length-1,i=t[0],o=new Array(0>r?0:r);r>n;)o[n]=[e=i,i=t[++n]];return o};is.zip=function(){if(!(r=arguments.length))return[];for(var t=-1,e=is.min(arguments,a),n=new Array(e);++t<e;)for(var r,i=-1,o=n[t]=new Array(r);++i<r;)o[i]=arguments[i][t];return n};is.transpose=function(t){return is.zip.apply(is,t)};is.keys=function(t){var e=[];for(var n in t)e.push(n);return e};is.values=function(t){var e=[];for(var n in t)e.push(t[n]);return e};is.entries=function(t){var e=[];for(var n in t)e.push({key:n,value:t[n]});return e};is.merge=function(t){for(var e,n,r,i=t.length,o=-1,a=0;++o<i;)a+=t[o].length;n=new Array(a);for(;--i>=0;){r=t[i];e=r.length;for(;--e>=0;)n[--a]=r[e]}return n};var ys=Math.abs;is.range=function(t,e,n){if(arguments.length<3){n=1;if(arguments.length<2){e=t;t=0}}if((e-t)/n===1/0)throw new Error("infinite range");var r,i=[],o=s(ys(n)),a=-1;t*=o,e*=o,n*=o;if(0>n)for(;(r=t+n*++a)>e;)i.push(r/o);else for(;(r=t+n*++a)<e;)i.push(r/o);return i};is.map=function(t,e){var n=new u;if(t instanceof u)t.forEach(function(t,e){n.set(t,e)});else if(Array.isArray(t)){var r,i=-1,o=t.length;if(1===arguments.length)for(;++i<o;)n.set(i,t[i]);else for(;++i<o;)n.set(e.call(t,r=t[i],i),r)}else for(var a in t)n.set(a,t[a]);return n};var bs="__proto__",xs="\x00";l(u,{has:h,get:function(t){return this._[c(t)]},set:function(t,e){return this._[c(t)]=e},remove:d,keys:p,values:function(){var t=[];for(var e in this._)t.push(this._[e]);return t},entries:function(){var t=[];for(var e in this._)t.push({key:f(e),value:this._[e]});return t},size:g,empty:m,forEach:function(t){for(var e in this._)t.call(this,f(e),this._[e])}});is.nest=function(){function t(e,a,s){if(s>=o.length)return r?r.call(i,a):n?a.sort(n):a;for(var l,c,f,h,d=-1,p=a.length,g=o[s++],m=new u;++d<p;)(h=m.get(l=g(c=a[d])))?h.push(c):m.set(l,[c]);if(e){c=e();f=function(n,r){c.set(n,t(e,r,s))}}else{c={};f=function(n,r){c[n]=t(e,r,s)}}m.forEach(f);return c}function e(t,n){if(n>=o.length)return t;var r=[],i=a[n++];t.forEach(function(t,i){r.push({key:t,values:e(i,n)})});return i?r.sort(function(t,e){return i(t.key,e.key)}):r}var n,r,i={},o=[],a=[];i.map=function(e,n){return t(n,e,0)};i.entries=function(n){return e(t(is.map,n,0),0)};i.key=function(t){o.push(t);return i};i.sortKeys=function(t){a[o.length-1]=t;return i};i.sortValues=function(t){n=t;return i};i.rollup=function(t){r=t;return i};return i};is.set=function(t){var e=new v;if(t)for(var n=0,r=t.length;r>n;++n)e.add(t[n]);return e};l(v,{has:h,add:function(t){this._[c(t+="")]=!0;return t},remove:d,values:p,size:g,empty:m,forEach:function(t){for(var e in this._)t.call(this,f(e))}});is.behavior={};is.rebind=function(t,e){for(var n,r=1,i=arguments.length;++r<i;)t[n=arguments[r]]=y(t,e,e[n]);return t};var ws=["webkit","ms","moz","Moz","o","O"];is.dispatch=function(){for(var t=new w,e=-1,n=arguments.length;++e<n;)t[arguments[e]]=C(t);return t};w.prototype.on=function(t,e){var n=t.indexOf("."),r="";if(n>=0){r=t.slice(n+1);t=t.slice(0,n)}if(t)return arguments.length<2?this[t].on(r):this[t].on(r,e);if(2===arguments.length){if(null==e)for(t in this)this.hasOwnProperty(t)&&this[t].on(r,null);return this}};is.event=null;is.requote=function(t){return t.replace(Cs,"\\$&")};var Cs=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,Ss={}.__proto__?function(t,e){t.__proto__=e}:function(t,e){for(var n in e)t[n]=e[n]},Ts=function(t,e){return e.querySelector(t)},ks=function(t,e){return e.querySelectorAll(t)},_s=ls.matches||ls[b(ls,"matchesSelector")],Ms=function(t,e){return _s.call(t,e)};if("function"==typeof Sizzle){Ts=function(t,e){return Sizzle(t,e)[0]||null};ks=Sizzle;Ms=Sizzle.matchesSelector}is.selection=function(){return Ns};var Ds=is.selection.prototype=[];Ds.select=function(t){var e,n,r,i,o=[];t=M(t);for(var a=-1,s=this.length;++a<s;){o.push(e=[]);e.parentNode=(r=this[a]).parentNode;for(var l=-1,u=r.length;++l<u;)if(i=r[l]){e.push(n=t.call(i,i.__data__,l,a));n&&"__data__"in i&&(n.__data__=i.__data__)}else e.push(null)}return _(o)};Ds.selectAll=function(t){var e,n,r=[];t=D(t);for(var i=-1,o=this.length;++i<o;)for(var a=this[i],s=-1,l=a.length;++s<l;)if(n=a[s]){r.push(e=as(t.call(n,n.__data__,s,i)));e.parentNode=n}return _(r)};var Ls={svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};is.ns={prefix:Ls,qualify:function(t){var e=t.indexOf(":"),n=t;if(e>=0){n=t.slice(0,e);t=t.slice(e+1)}return Ls.hasOwnProperty(n)?{space:Ls[n],local:t}:t}};Ds.attr=function(t,e){if(arguments.length<2){if("string"==typeof t){var n=this.node();t=is.ns.qualify(t);return t.local?n.getAttributeNS(t.space,t.local):n.getAttribute(t)}for(e in t)this.each(L(e,t[e]));return this}return this.each(L(t,e))};Ds.classed=function(t,e){if(arguments.length<2){if("string"==typeof t){var n=this.node(),r=(t=E(t)).length,i=-1;if(e=n.classList){for(;++i<r;)if(!e.contains(t[i]))return!1}else{e=n.getAttribute("class");for(;++i<r;)if(!N(t[i]).test(e))return!1}return!0}for(e in t)this.each(j(e,t[e]));return this}return this.each(j(t,e))};Ds.style=function(t,e,n){var r=arguments.length;if(3>r){if("string"!=typeof t){2>r&&(e="");for(n in t)this.each(P(n,t[n],e));return this}if(2>r)return us.getComputedStyle(this.node(),null).getPropertyValue(t);n=""}return this.each(P(t,e,n))};Ds.property=function(t,e){if(arguments.length<2){if("string"==typeof t)return this.node()[t];for(e in t)this.each(H(e,t[e]));return this}return this.each(H(t,e))};Ds.text=function(t){return arguments.length?this.each("function"==typeof t?function(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}:null==t?function(){this.textContent=""}:function(){this.textContent=t}):this.node().textContent};Ds.html=function(t){return arguments.length?this.each("function"==typeof t?function(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}:null==t?function(){this.innerHTML=""}:function(){this.innerHTML=t}):this.node().innerHTML};Ds.append=function(t){t=O(t);return this.select(function(){return this.appendChild(t.apply(this,arguments))})};Ds.insert=function(t,e){t=O(t);e=M(e);return this.select(function(){return this.insertBefore(t.apply(this,arguments),e.apply(this,arguments)||null)})};Ds.remove=function(){return this.each(R)};Ds.data=function(t,e){function n(t,n){var r,i,o,a=t.length,f=n.length,h=Math.min(a,f),d=new Array(f),p=new Array(f),g=new Array(a);if(e){var m,v=new u,y=new Array(a);for(r=-1;++r<a;){v.has(m=e.call(i=t[r],i.__data__,r))?g[r]=i:v.set(m,i);y[r]=m}for(r=-1;++r<f;){if(i=v.get(m=e.call(n,o=n[r],r))){if(i!==!0){d[r]=i;i.__data__=o}}else p[r]=F(o);v.set(m,!0)}for(r=-1;++r<a;)v.get(y[r])!==!0&&(g[r]=t[r])}else{for(r=-1;++r<h;){i=t[r];o=n[r];if(i){i.__data__=o;d[r]=i}else p[r]=F(o)}for(;f>r;++r)p[r]=F(n[r]);for(;a>r;++r)g[r]=t[r]}p.update=d;p.parentNode=d.parentNode=g.parentNode=t.parentNode;s.push(p);l.push(d);c.push(g)}var r,i,o=-1,a=this.length;if(!arguments.length){t=new Array(a=(r=this[0]).length);for(;++o<a;)(i=r[o])&&(t[o]=i.__data__);return t}var s=U([]),l=_([]),c=_([]);if("function"==typeof t)for(;++o<a;)n(r=this[o],t.call(r,r.parentNode.__data__,o));else for(;++o<a;)n(r=this[o],t);l.enter=function(){return s};l.exit=function(){return c};return l};Ds.datum=function(t){return arguments.length?this.property("__data__",t):this.property("__data__")};Ds.filter=function(t){var e,n,r,i=[];"function"!=typeof t&&(t=W(t));for(var o=0,a=this.length;a>o;o++){i.push(e=[]);e.parentNode=(n=this[o]).parentNode;for(var s=0,l=n.length;l>s;s++)(r=n[s])&&t.call(r,r.__data__,s,o)&&e.push(r)}return _(i)};Ds.order=function(){for(var t=-1,e=this.length;++t<e;)for(var n,r=this[t],i=r.length-1,o=r[i];--i>=0;)if(n=r[i]){o&&o!==n.nextSibling&&o.parentNode.insertBefore(n,o);o=n}return this};Ds.sort=function(t){t=z.apply(this,arguments);for(var e=-1,n=this.length;++e<n;)this[e].sort(t);return this.order()};Ds.each=function(t){return q(this,function(e,n,r){t.call(e,e.__data__,n,r)})};Ds.call=function(t){var e=as(arguments);t.apply(e[0]=this,e);return this};Ds.empty=function(){return!this.node()};Ds.node=function(){for(var t=0,e=this.length;e>t;t++)for(var n=this[t],r=0,i=n.length;i>r;r++){var o=n[r];if(o)return o}return null};Ds.size=function(){var t=0;q(this,function(){++t});return t};var As=[];is.selection.enter=U;is.selection.enter.prototype=As;As.append=Ds.append;As.empty=Ds.empty;As.node=Ds.node;As.call=Ds.call;As.size=Ds.size;As.select=function(t){for(var e,n,r,i,o,a=[],s=-1,l=this.length;++s<l;){r=(i=this[s]).update;a.push(e=[]);e.parentNode=i.parentNode;for(var u=-1,c=i.length;++u<c;)if(o=i[u]){e.push(r[u]=n=t.call(i.parentNode,o.__data__,u,s));n.__data__=o.__data__}else e.push(null)}return _(a)};As.insert=function(t,e){arguments.length<2&&(e=B(this));return Ds.insert.call(this,t,e)};is.select=function(t){var e=["string"==typeof t?Ts(t,ss):t];e.parentNode=ls;return _([e])};is.selectAll=function(t){var e=as("string"==typeof t?ks(t,ss):t);e.parentNode=ls;return _([e])};var Ns=is.select(ls);Ds.on=function(t,e,n){var r=arguments.length;if(3>r){if("string"!=typeof t){2>r&&(e=!1);for(n in t)this.each(V(n,t[n],e));return this}if(2>r)return(r=this.node()["__on"+t])&&r._;n=!1}return this.each(V(t,e,n))};var Es=is.map({mouseenter:"mouseover",mouseleave:"mouseout"});Es.forEach(function(t){"on"+t in ss&&Es.remove(t)});var js="onselectstart"in ss?null:b(ls.style,"userSelect"),Is=0;is.mouse=function(t){return Y(t,T())};var Ps=/WebKit/.test(us.navigator.userAgent)?-1:0;is.touch=function(t,e,n){arguments.length<3&&(n=e,e=T().changedTouches);if(e)for(var r,i=0,o=e.length;o>i;++i)if((r=e[i]).identifier===n)return Y(t,r)};is.behavior.drag=function(){function t(){this.on("mousedown.drag",i).on("touchstart.drag",o)}function e(t,e,i,o,a){return function(){function s(){var t,n,r=e(h,g);if(r){t=r[0]-b[0];n=r[1]-b[1];p|=t|n;b=r;d({type:"drag",x:r[0]+u[0],y:r[1]+u[1],dx:t,dy:n})}}function l(){if(e(h,g)){v.on(o+m,null).on(a+m,null);y(p&&is.event.target===f);d({type:"dragend"})}}var u,c=this,f=is.event.target,h=c.parentNode,d=n.of(c,arguments),p=0,g=t(),m=".drag"+(null==g?"":"-"+g),v=is.select(i()).on(o+m,s).on(a+m,l),y=$(),b=e(h,g);if(r){u=r.apply(c,arguments);u=[u.x-b[0],u.y-b[1]]}else u=[0,0];d({type:"dragstart"})}}var n=k(t,"drag","dragstart","dragend"),r=null,i=e(x,is.mouse,Z,"mousemove","mouseup"),o=e(J,is.touch,K,"touchmove","touchend");t.origin=function(e){if(!arguments.length)return r;r=e;return t};return is.rebind(t,n,"on")};is.touches=function(t,e){arguments.length<2&&(e=T().touches);return e?as(e).map(function(e){var n=Y(t,e);n.identifier=e.identifier;return n}):[]};var Hs=1e-6,Os=Hs*Hs,Rs=Math.PI,Fs=2*Rs,Ws=Fs-Hs,zs=Rs/2,qs=Rs/180,Us=180/Rs,Bs=Math.SQRT2,Vs=2,Xs=4;is.interpolateZoom=function(t,e){function n(t){var e=t*y;if(v){var n=ie(g),a=o/(Vs*h)*(n*oe(Bs*e+g)-re(g));return[r+a*u,i+a*c,o*n/ie(Bs*e+g)]}return[r+t*u,i+t*c,o*Math.exp(Bs*e)]}var r=t[0],i=t[1],o=t[2],a=e[0],s=e[1],l=e[2],u=a-r,c=s-i,f=u*u+c*c,h=Math.sqrt(f),d=(l*l-o*o+Xs*f)/(2*o*Vs*h),p=(l*l-o*o-Xs*f)/(2*l*Vs*h),g=Math.log(Math.sqrt(d*d+1)-d),m=Math.log(Math.sqrt(p*p+1)-p),v=m-g,y=(v||Math.log(l/o))/Bs;n.duration=1e3*y;return n};is.behavior.zoom=function(){function t(t){t.on(A,c).on(Ys+".zoom",h).on("dblclick.zoom",d).on(j,f)}function e(t){return[(t[0]-T.x)/T.k,(t[1]-T.y)/T.k]}function n(t){return[t[0]*T.k+T.x,t[1]*T.k+T.y]}function r(t){T.k=Math.max(M[0],Math.min(M[1],t))}function i(t,e){e=n(e);T.x+=t[0]-e[0];T.y+=t[1]-e[1]}function o(e,n,o,a){e.__chart__={x:T.x,y:T.y,k:T.k};r(Math.pow(2,a));i(g=n,o);e=is.select(e);D>0&&(e=e.transition().duration(D));e.call(t.event)}function a(){x&&x.domain(b.range().map(function(t){return(t-T.x)/T.k}).map(b.invert));C&&C.domain(w.range().map(function(t){return(t-T.y)/T.k}).map(w.invert))}function s(t){L++||t({type:"zoomstart"})}function l(t){a();t({type:"zoom",scale:T.k,translate:[T.x,T.y]})}function u(t){--L||t({type:"zoomend"});g=null}function c(){function t(){c=1;i(is.mouse(r),h);l(a)}function n(){f.on(N,null).on(E,null);d(c&&is.event.target===o);u(a)}var r=this,o=is.event.target,a=I.of(r,arguments),c=0,f=is.select(us).on(N,t).on(E,n),h=e(is.mouse(r)),d=$();qu.call(r);s(a)}function f(){function t(){var t=is.touches(p);d=T.k;t.forEach(function(t){t.identifier in m&&(m[t.identifier]=e(t))});return t}function n(){var e=is.event.target;is.select(e).on(x,a).on(w,h);C.push(e);for(var n=is.event.changedTouches,r=0,i=n.length;i>r;++r)m[n[r].identifier]=null;var s=t(),l=Date.now();if(1===s.length){if(500>l-y){var u=s[0];o(p,u,m[u.identifier],Math.floor(Math.log(T.k)/Math.LN2)+1);S()}y=l}else if(s.length>1){var u=s[0],c=s[1],f=u[0]-c[0],d=u[1]-c[1];v=f*f+d*d}}function a(){var t,e,n,o,a=is.touches(p);qu.call(p);for(var s=0,u=a.length;u>s;++s,o=null){n=a[s];if(o=m[n.identifier]){if(e)break;t=n,e=o}}if(o){var c=(c=n[0]-t[0])*c+(c=n[1]-t[1])*c,f=v&&Math.sqrt(c/v);t=[(t[0]+n[0])/2,(t[1]+n[1])/2];e=[(e[0]+o[0])/2,(e[1]+o[1])/2];r(f*d)}y=null;i(t,e);l(g)}function h(){if(is.event.touches.length){for(var e=is.event.changedTouches,n=0,r=e.length;r>n;++n)delete m[e[n].identifier];for(var i in m)return void t()}is.selectAll(C).on(b,null);k.on(A,c).on(j,f);_();u(g)}var d,p=this,g=I.of(p,arguments),m={},v=0,b=".zoom-"+is.event.changedTouches[0].identifier,x="touchmove"+b,w="touchend"+b,C=[],k=is.select(p),_=$();n();s(g);k.on(A,null).on(j,n)}function h(){var t=I.of(this,arguments);v?clearTimeout(v):(p=e(g=m||is.mouse(this)),qu.call(this),s(t));v=setTimeout(function(){v=null;u(t)},50);S();r(Math.pow(2,.002*Gs())*T.k);i(g,p);l(t)}function d(){var t=is.mouse(this),n=Math.log(T.k)/Math.LN2;o(this,t,e(t),is.event.shiftKey?Math.ceil(n)-1:Math.floor(n)+1)}var p,g,m,v,y,b,x,w,C,T={x:0,y:0,k:1},_=[960,500],M=$s,D=250,L=0,A="mousedown.zoom",N="mousemove.zoom",E="mouseup.zoom",j="touchstart.zoom",I=k(t,"zoomstart","zoom","zoomend");t.event=function(t){t.each(function(){var t=I.of(this,arguments),e=T;if(Wu)is.select(this).transition().each("start.zoom",function(){T=this.__chart__||{x:0,y:0,k:1};s(t)}).tween("zoom:zoom",function(){var n=_[0],r=_[1],i=g?g[0]:n/2,o=g?g[1]:r/2,a=is.interpolateZoom([(i-T.x)/T.k,(o-T.y)/T.k,n/T.k],[(i-e.x)/e.k,(o-e.y)/e.k,n/e.k]);return function(e){var r=a(e),s=n/r[2];this.__chart__=T={x:i-r[0]*s,y:o-r[1]*s,k:s};l(t)}}).each("interrupt.zoom",function(){u(t)}).each("end.zoom",function(){u(t)});else{this.__chart__=T;s(t);l(t);u(t)}})};t.translate=function(e){if(!arguments.length)return[T.x,T.y];T={x:+e[0],y:+e[1],k:T.k};a();return t};t.scale=function(e){if(!arguments.length)return T.k;T={x:T.x,y:T.y,k:+e};a();return t};t.scaleExtent=function(e){if(!arguments.length)return M;M=null==e?$s:[+e[0],+e[1]];return t};t.center=function(e){if(!arguments.length)return m;m=e&&[+e[0],+e[1]];return t};t.size=function(e){if(!arguments.length)return _;_=e&&[+e[0],+e[1]];return t};t.duration=function(e){if(!arguments.length)return D;D=+e;return t};t.x=function(e){if(!arguments.length)return x;x=e;b=e.copy();T={x:0,y:0,k:1};return t};t.y=function(e){if(!arguments.length)return C;C=e;w=e.copy();T={x:0,y:0,k:1};return t};return is.rebind(t,I,"on")};var Gs,$s=[0,1/0],Ys="onwheel"in ss?(Gs=function(){return-is.event.deltaY*(is.event.deltaMode?120:1)},"wheel"):"onmousewheel"in ss?(Gs=function(){return is.event.wheelDelta},"mousewheel"):(Gs=function(){return-is.event.detail},"MozMousePixelScroll");is.color=se;se.prototype.toString=function(){return this.rgb()+""};is.hsl=le;var Js=le.prototype=new se;Js.brighter=function(t){t=Math.pow(.7,arguments.length?t:1);return new le(this.h,this.s,this.l/t)};Js.darker=function(t){t=Math.pow(.7,arguments.length?t:1);return new le(this.h,this.s,t*this.l)};Js.rgb=function(){return ue(this.h,this.s,this.l)};is.hcl=ce;var Ks=ce.prototype=new se;Ks.brighter=function(t){return new ce(this.h,this.c,Math.min(100,this.l+Zs*(arguments.length?t:1)))};Ks.darker=function(t){return new ce(this.h,this.c,Math.max(0,this.l-Zs*(arguments.length?t:1)))};Ks.rgb=function(){return fe(this.h,this.c,this.l).rgb()};is.lab=he;var Zs=18,Qs=.95047,tl=1,el=1.08883,nl=he.prototype=new se;nl.brighter=function(t){return new he(Math.min(100,this.l+Zs*(arguments.length?t:1)),this.a,this.b)};nl.darker=function(t){return new he(Math.max(0,this.l-Zs*(arguments.length?t:1)),this.a,this.b)};nl.rgb=function(){return de(this.l,this.a,this.b)};is.rgb=ye;var rl=ye.prototype=new se;rl.brighter=function(t){t=Math.pow(.7,arguments.length?t:1);var e=this.r,n=this.g,r=this.b,i=30;if(!e&&!n&&!r)return new ye(i,i,i);e&&i>e&&(e=i);n&&i>n&&(n=i);r&&i>r&&(r=i);return new ye(Math.min(255,e/t),Math.min(255,n/t),Math.min(255,r/t))};rl.darker=function(t){t=Math.pow(.7,arguments.length?t:1);return new ye(t*this.r,t*this.g,t*this.b)};rl.hsl=function(){return Se(this.r,this.g,this.b)};rl.toString=function(){return"#"+we(this.r)+we(this.g)+we(this.b)};var il=is.map({aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074});
il.forEach(function(t,e){il.set(t,be(e))});is.functor=Me;is.xhr=Le(De);is.dsv=function(t,e){function n(t,n,o){arguments.length<3&&(o=n,n=null);var a=Ae(t,e,null==n?r:i(n),o);a.row=function(t){return arguments.length?a.response(null==(n=t)?r:i(t)):n};return a}function r(t){return n.parse(t.responseText)}function i(t){return function(e){return n.parse(e.responseText,t)}}function o(e){return e.map(a).join(t)}function a(t){return s.test(t)?'"'+t.replace(/\"/g,'""')+'"':t}var s=new RegExp('["'+t+"\n]"),l=t.charCodeAt(0);n.parse=function(t,e){var r;return n.parseRows(t,function(t,n){if(r)return r(t,n-1);var i=new Function("d","return {"+t.map(function(t,e){return JSON.stringify(t)+": d["+e+"]"}).join(",")+"}");r=e?function(t,n){return e(i(t),n)}:i})};n.parseRows=function(t,e){function n(){if(c>=u)return a;if(i)return i=!1,o;var e=c;if(34===t.charCodeAt(e)){for(var n=e;n++<u;)if(34===t.charCodeAt(n)){if(34!==t.charCodeAt(n+1))break;++n}c=n+2;var r=t.charCodeAt(n+1);if(13===r){i=!0;10===t.charCodeAt(n+2)&&++c}else 10===r&&(i=!0);return t.slice(e+1,n).replace(/""/g,'"')}for(;u>c;){var r=t.charCodeAt(c++),s=1;if(10===r)i=!0;else if(13===r){i=!0;10===t.charCodeAt(c)&&(++c,++s)}else if(r!==l)continue;return t.slice(e,c-s)}return t.slice(e)}for(var r,i,o={},a={},s=[],u=t.length,c=0,f=0;(r=n())!==a;){for(var h=[];r!==o&&r!==a;){h.push(r);r=n()}e&&null==(h=e(h,f++))||s.push(h)}return s};n.format=function(e){if(Array.isArray(e[0]))return n.formatRows(e);var r=new v,i=[];e.forEach(function(t){for(var e in t)r.has(e)||i.push(r.add(e))});return[i.map(a).join(t)].concat(e.map(function(e){return i.map(function(t){return a(e[t])}).join(t)})).join("\n")};n.formatRows=function(t){return t.map(o).join("\n")};return n};is.csv=is.dsv(",","text/csv");is.tsv=is.dsv(" ","text/tab-separated-values");var ol,al,sl,ll,ul,cl=us[b(us,"requestAnimationFrame")]||function(t){setTimeout(t,17)};is.timer=function(t,e,n){var r=arguments.length;2>r&&(e=0);3>r&&(n=Date.now());var i=n+e,o={c:t,t:i,f:!1,n:null};al?al.n=o:ol=o;al=o;if(!sl){ll=clearTimeout(ll);sl=1;cl(je)}};is.timer.flush=function(){Ie();Pe()};is.round=function(t,e){return e?Math.round(t*(e=Math.pow(10,e)))/e:Math.round(t)};var fl=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"].map(Oe);is.formatPrefix=function(t,e){var n=0;if(t){0>t&&(t*=-1);e&&(t=is.round(t,He(t,e)));n=1+Math.floor(1e-12+Math.log(t)/Math.LN10);n=Math.max(-24,Math.min(24,3*Math.floor((n-1)/3)))}return fl[8+n/3]};var hl=/(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,dl=is.map({b:function(t){return t.toString(2)},c:function(t){return String.fromCharCode(t)},o:function(t){return t.toString(8)},x:function(t){return t.toString(16)},X:function(t){return t.toString(16).toUpperCase()},g:function(t,e){return t.toPrecision(e)},e:function(t,e){return t.toExponential(e)},f:function(t,e){return t.toFixed(e)},r:function(t,e){return(t=is.round(t,He(t,e))).toFixed(Math.max(0,Math.min(20,He(t*(1+1e-15),e))))}}),pl=is.time={},gl=Date;We.prototype={getDate:function(){return this._.getUTCDate()},getDay:function(){return this._.getUTCDay()},getFullYear:function(){return this._.getUTCFullYear()},getHours:function(){return this._.getUTCHours()},getMilliseconds:function(){return this._.getUTCMilliseconds()},getMinutes:function(){return this._.getUTCMinutes()},getMonth:function(){return this._.getUTCMonth()},getSeconds:function(){return this._.getUTCSeconds()},getTime:function(){return this._.getTime()},getTimezoneOffset:function(){return 0},valueOf:function(){return this._.valueOf()},setDate:function(){ml.setUTCDate.apply(this._,arguments)},setDay:function(){ml.setUTCDay.apply(this._,arguments)},setFullYear:function(){ml.setUTCFullYear.apply(this._,arguments)},setHours:function(){ml.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){ml.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){ml.setUTCMinutes.apply(this._,arguments)},setMonth:function(){ml.setUTCMonth.apply(this._,arguments)},setSeconds:function(){ml.setUTCSeconds.apply(this._,arguments)},setTime:function(){ml.setTime.apply(this._,arguments)}};var ml=Date.prototype;pl.year=ze(function(t){t=pl.day(t);t.setMonth(0,1);return t},function(t,e){t.setFullYear(t.getFullYear()+e)},function(t){return t.getFullYear()});pl.years=pl.year.range;pl.years.utc=pl.year.utc.range;pl.day=ze(function(t){var e=new gl(2e3,0);e.setFullYear(t.getFullYear(),t.getMonth(),t.getDate());return e},function(t,e){t.setDate(t.getDate()+e)},function(t){return t.getDate()-1});pl.days=pl.day.range;pl.days.utc=pl.day.utc.range;pl.dayOfYear=function(t){var e=pl.year(t);return Math.floor((t-e-6e4*(t.getTimezoneOffset()-e.getTimezoneOffset()))/864e5)};["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach(function(t,e){e=7-e;var n=pl[t]=ze(function(t){(t=pl.day(t)).setDate(t.getDate()-(t.getDay()+e)%7);return t},function(t,e){t.setDate(t.getDate()+7*Math.floor(e))},function(t){var n=pl.year(t).getDay();return Math.floor((pl.dayOfYear(t)+(n+e)%7)/7)-(n!==e)});pl[t+"s"]=n.range;pl[t+"s"].utc=n.utc.range;pl[t+"OfYear"]=function(t){var n=pl.year(t).getDay();return Math.floor((pl.dayOfYear(t)+(n+e)%7)/7)}});pl.week=pl.sunday;pl.weeks=pl.sunday.range;pl.weeks.utc=pl.sunday.utc.range;pl.weekOfYear=pl.sundayOfYear;var vl={"-":"",_:" ",0:"0"},yl=/^\s*\d+/,bl=/^%/;is.locale=function(t){return{numberFormat:Re(t),timeFormat:Ue(t)}};var xl=is.locale({decimal:".",thousands:",",grouping:[3],currency:["$",""],dateTime:"%a %b %e %X %Y",date:"%m/%d/%Y",time:"%H:%M:%S",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});is.format=xl.numberFormat;is.geo={};fn.prototype={s:0,t:0,add:function(t){hn(t,this.t,wl);hn(wl.s,this.s,this);this.s?this.t+=wl.t:this.s=wl.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var wl=new fn;is.geo.stream=function(t,e){t&&Cl.hasOwnProperty(t.type)?Cl[t.type](t,e):dn(t,e)};var Cl={Feature:function(t,e){dn(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,i=n.length;++r<i;)dn(n[r].geometry,e)}},Sl={Sphere:function(t,e){e.sphere()},Point:function(t,e){t=t.coordinates;e.point(t[0],t[1],t[2])},MultiPoint:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)t=n[r],e.point(t[0],t[1],t[2])},LineString:function(t,e){pn(t.coordinates,e,0)},MultiLineString:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)pn(n[r],e,0)},Polygon:function(t,e){gn(t.coordinates,e)},MultiPolygon:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)gn(n[r],e)},GeometryCollection:function(t,e){for(var n=t.geometries,r=-1,i=n.length;++r<i;)dn(n[r],e)}};is.geo.area=function(t){Tl=0;is.geo.stream(t,_l);return Tl};var Tl,kl=new fn,_l={sphere:function(){Tl+=4*Rs},point:x,lineStart:x,lineEnd:x,polygonStart:function(){kl.reset();_l.lineStart=mn},polygonEnd:function(){var t=2*kl;Tl+=0>t?4*Rs+t:t;_l.lineStart=_l.lineEnd=_l.point=x}};is.geo.bounds=function(){function t(t,e){b.push(x=[c=t,h=t]);f>e&&(f=e);e>d&&(d=e)}function e(e,n){var r=vn([e*qs,n*qs]);if(v){var i=bn(v,r),o=[i[1],-i[0],0],a=bn(o,i);Cn(a);a=Sn(a);var l=e-p,u=l>0?1:-1,g=a[0]*Us*u,m=ys(l)>180;if(m^(g>u*p&&u*e>g)){var y=a[1]*Us;y>d&&(d=y)}else if(g=(g+360)%360-180,m^(g>u*p&&u*e>g)){var y=-a[1]*Us;f>y&&(f=y)}else{f>n&&(f=n);n>d&&(d=n)}if(m)p>e?s(c,e)>s(c,h)&&(h=e):s(e,h)>s(c,h)&&(c=e);else if(h>=c){c>e&&(c=e);e>h&&(h=e)}else e>p?s(c,e)>s(c,h)&&(h=e):s(e,h)>s(c,h)&&(c=e)}else t(e,n);v=r,p=e}function n(){w.point=e}function r(){x[0]=c,x[1]=h;w.point=t;v=null}function i(t,n){if(v){var r=t-p;y+=ys(r)>180?r+(r>0?360:-360):r}else g=t,m=n;_l.point(t,n);e(t,n)}function o(){_l.lineStart()}function a(){i(g,m);_l.lineEnd();ys(y)>Hs&&(c=-(h=180));x[0]=c,x[1]=h;v=null}function s(t,e){return(e-=t)<0?e+360:e}function l(t,e){return t[0]-e[0]}function u(t,e){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:t<e[0]||e[1]<t}var c,f,h,d,p,g,m,v,y,b,x,w={point:t,lineStart:n,lineEnd:r,polygonStart:function(){w.point=i;w.lineStart=o;w.lineEnd=a;y=0;_l.polygonStart()},polygonEnd:function(){_l.polygonEnd();w.point=t;w.lineStart=n;w.lineEnd=r;0>kl?(c=-(h=180),f=-(d=90)):y>Hs?d=90:-Hs>y&&(f=-90);x[0]=c,x[1]=h}};return function(t){d=h=-(c=f=1/0);b=[];is.geo.stream(t,w);var e=b.length;if(e){b.sort(l);for(var n,r=1,i=b[0],o=[i];e>r;++r){n=b[r];if(u(n[0],i)||u(n[1],i)){s(i[0],n[1])>s(i[0],i[1])&&(i[1]=n[1]);s(n[0],i[1])>s(i[0],i[1])&&(i[0]=n[0])}else o.push(i=n)}for(var a,n,p=-1/0,e=o.length-1,r=0,i=o[e];e>=r;i=n,++r){n=o[r];(a=s(i[1],n[0]))>p&&(p=a,c=n[0],h=i[1])}}b=x=null;return 1/0===c||1/0===f?[[0/0,0/0],[0/0,0/0]]:[[c,f],[h,d]]}}();is.geo.centroid=function(t){Ml=Dl=Ll=Al=Nl=El=jl=Il=Pl=Hl=Ol=0;is.geo.stream(t,Rl);var e=Pl,n=Hl,r=Ol,i=e*e+n*n+r*r;if(Os>i){e=El,n=jl,r=Il;Hs>Dl&&(e=Ll,n=Al,r=Nl);i=e*e+n*n+r*r;if(Os>i)return[0/0,0/0]}return[Math.atan2(n,e)*Us,ne(r/Math.sqrt(i))*Us]};var Ml,Dl,Ll,Al,Nl,El,jl,Il,Pl,Hl,Ol,Rl={sphere:x,point:kn,lineStart:Mn,lineEnd:Dn,polygonStart:function(){Rl.lineStart=Ln},polygonEnd:function(){Rl.lineStart=Mn}},Fl=Pn(Nn,Fn,zn,[-Rs,-Rs/2]),Wl=1e9;is.geo.clipExtent=function(){var t,e,n,r,i,o,a={stream:function(t){i&&(i.valid=!1);i=o(t);i.valid=!0;return i},extent:function(s){if(!arguments.length)return[[t,e],[n,r]];o=Vn(t=+s[0][0],e=+s[0][1],n=+s[1][0],r=+s[1][1]);i&&(i.valid=!1,i=null);return a}};return a.extent([[0,0],[960,500]])};(is.geo.conicEqualArea=function(){return Xn(Gn)}).raw=Gn;is.geo.albers=function(){return is.geo.conicEqualArea().rotate([96,0]).center([-.6,38.7]).parallels([29.5,45.5]).scale(1070)};is.geo.albersUsa=function(){function t(t){var o=t[0],a=t[1];e=null;(n(o,a),e)||(r(o,a),e)||i(o,a);return e}var e,n,r,i,o=is.geo.albers(),a=is.geo.conicEqualArea().rotate([154,0]).center([-2,58.5]).parallels([55,65]),s=is.geo.conicEqualArea().rotate([157,0]).center([-3,19.9]).parallels([8,18]),l={point:function(t,n){e=[t,n]}};t.invert=function(t){var e=o.scale(),n=o.translate(),r=(t[0]-n[0])/e,i=(t[1]-n[1])/e;return(i>=.12&&.234>i&&r>=-.425&&-.214>r?a:i>=.166&&.234>i&&r>=-.214&&-.115>r?s:o).invert(t)};t.stream=function(t){var e=o.stream(t),n=a.stream(t),r=s.stream(t);return{point:function(t,i){e.point(t,i);n.point(t,i);r.point(t,i)},sphere:function(){e.sphere();n.sphere();r.sphere()},lineStart:function(){e.lineStart();n.lineStart();r.lineStart()},lineEnd:function(){e.lineEnd();n.lineEnd();r.lineEnd()},polygonStart:function(){e.polygonStart();n.polygonStart();r.polygonStart()},polygonEnd:function(){e.polygonEnd();n.polygonEnd();r.polygonEnd()}}};t.precision=function(e){if(!arguments.length)return o.precision();o.precision(e);a.precision(e);s.precision(e);return t};t.scale=function(e){if(!arguments.length)return o.scale();o.scale(e);a.scale(.35*e);s.scale(e);return t.translate(o.translate())};t.translate=function(e){if(!arguments.length)return o.translate();var u=o.scale(),c=+e[0],f=+e[1];n=o.translate(e).clipExtent([[c-.455*u,f-.238*u],[c+.455*u,f+.238*u]]).stream(l).point;r=a.translate([c-.307*u,f+.201*u]).clipExtent([[c-.425*u+Hs,f+.12*u+Hs],[c-.214*u-Hs,f+.234*u-Hs]]).stream(l).point;i=s.translate([c-.205*u,f+.212*u]).clipExtent([[c-.214*u+Hs,f+.166*u+Hs],[c-.115*u-Hs,f+.234*u-Hs]]).stream(l).point;return t};return t.scale(1070)};var zl,ql,Ul,Bl,Vl,Xl,Gl={point:x,lineStart:x,lineEnd:x,polygonStart:function(){ql=0;Gl.lineStart=$n},polygonEnd:function(){Gl.lineStart=Gl.lineEnd=Gl.point=x;zl+=ys(ql/2)}},$l={point:Yn,lineStart:x,lineEnd:x,polygonStart:x,polygonEnd:x},Yl={point:Zn,lineStart:Qn,lineEnd:tr,polygonStart:function(){Yl.lineStart=er},polygonEnd:function(){Yl.point=Zn;Yl.lineStart=Qn;Yl.lineEnd=tr}};is.geo.path=function(){function t(t){if(t){"function"==typeof s&&o.pointRadius(+s.apply(this,arguments));a&&a.valid||(a=i(o));is.geo.stream(t,a)}return o.result()}function e(){a=null;return t}var n,r,i,o,a,s=4.5;t.area=function(t){zl=0;is.geo.stream(t,i(Gl));return zl};t.centroid=function(t){Ll=Al=Nl=El=jl=Il=Pl=Hl=Ol=0;is.geo.stream(t,i(Yl));return Ol?[Pl/Ol,Hl/Ol]:Il?[El/Il,jl/Il]:Nl?[Ll/Nl,Al/Nl]:[0/0,0/0]};t.bounds=function(t){Vl=Xl=-(Ul=Bl=1/0);is.geo.stream(t,i($l));return[[Ul,Bl],[Vl,Xl]]};t.projection=function(t){if(!arguments.length)return n;i=(n=t)?t.stream||ir(t):De;return e()};t.context=function(t){if(!arguments.length)return r;o=null==(r=t)?new Jn:new nr(t);"function"!=typeof s&&o.pointRadius(s);return e()};t.pointRadius=function(e){if(!arguments.length)return s;s="function"==typeof e?e:(o.pointRadius(+e),+e);return t};return t.projection(is.geo.albersUsa()).context(null)};is.geo.transform=function(t){return{stream:function(e){var n=new or(e);for(var r in t)n[r]=t[r];return n}}};or.prototype={point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};is.geo.projection=sr;is.geo.projectionMutator=lr;(is.geo.equirectangular=function(){return sr(cr)}).raw=cr.invert=cr;is.geo.rotation=function(t){function e(e){e=t(e[0]*qs,e[1]*qs);return e[0]*=Us,e[1]*=Us,e}t=hr(t[0]%360*qs,t[1]*qs,t.length>2?t[2]*qs:0);e.invert=function(e){e=t.invert(e[0]*qs,e[1]*qs);return e[0]*=Us,e[1]*=Us,e};return e};fr.invert=cr;is.geo.circle=function(){function t(){var t="function"==typeof r?r.apply(this,arguments):r,e=hr(-t[0]*qs,-t[1]*qs,0).invert,i=[];n(null,null,1,{point:function(t,n){i.push(t=e(t,n));t[0]*=Us,t[1]*=Us}});return{type:"Polygon",coordinates:[i]}}var e,n,r=[0,0],i=6;t.origin=function(e){if(!arguments.length)return r;r=e;return t};t.angle=function(r){if(!arguments.length)return e;n=mr((e=+r)*qs,i*qs);return t};t.precision=function(r){if(!arguments.length)return i;n=mr(e*qs,(i=+r)*qs);return t};return t.angle(90)};is.geo.distance=function(t,e){var n,r=(e[0]-t[0])*qs,i=t[1]*qs,o=e[1]*qs,a=Math.sin(r),s=Math.cos(r),l=Math.sin(i),u=Math.cos(i),c=Math.sin(o),f=Math.cos(o);return Math.atan2(Math.sqrt((n=f*a)*n+(n=u*c-l*f*s)*n),l*c+u*f*s)};is.geo.graticule=function(){function t(){return{type:"MultiLineString",coordinates:e()}}function e(){return is.range(Math.ceil(o/m)*m,i,m).map(h).concat(is.range(Math.ceil(u/v)*v,l,v).map(d)).concat(is.range(Math.ceil(r/p)*p,n,p).filter(function(t){return ys(t%m)>Hs}).map(c)).concat(is.range(Math.ceil(s/g)*g,a,g).filter(function(t){return ys(t%v)>Hs}).map(f))}var n,r,i,o,a,s,l,u,c,f,h,d,p=10,g=p,m=90,v=360,y=2.5;t.lines=function(){return e().map(function(t){return{type:"LineString",coordinates:t}})};t.outline=function(){return{type:"Polygon",coordinates:[h(o).concat(d(l).slice(1),h(i).reverse().slice(1),d(u).reverse().slice(1))]}};t.extent=function(e){return arguments.length?t.majorExtent(e).minorExtent(e):t.minorExtent()};t.majorExtent=function(e){if(!arguments.length)return[[o,u],[i,l]];o=+e[0][0],i=+e[1][0];u=+e[0][1],l=+e[1][1];o>i&&(e=o,o=i,i=e);u>l&&(e=u,u=l,l=e);return t.precision(y)};t.minorExtent=function(e){if(!arguments.length)return[[r,s],[n,a]];r=+e[0][0],n=+e[1][0];s=+e[0][1],a=+e[1][1];r>n&&(e=r,r=n,n=e);s>a&&(e=s,s=a,a=e);return t.precision(y)};t.step=function(e){return arguments.length?t.majorStep(e).minorStep(e):t.minorStep()};t.majorStep=function(e){if(!arguments.length)return[m,v];m=+e[0],v=+e[1];return t};t.minorStep=function(e){if(!arguments.length)return[p,g];p=+e[0],g=+e[1];return t};t.precision=function(e){if(!arguments.length)return y;y=+e;c=yr(s,a,90);f=br(r,n,y);h=yr(u,l,90);d=br(o,i,y);return t};return t.majorExtent([[-180,-90+Hs],[180,90-Hs]]).minorExtent([[-180,-80-Hs],[180,80+Hs]])};is.geo.greatArc=function(){function t(){return{type:"LineString",coordinates:[e||r.apply(this,arguments),n||i.apply(this,arguments)]}}var e,n,r=xr,i=wr;t.distance=function(){return is.geo.distance(e||r.apply(this,arguments),n||i.apply(this,arguments))};t.source=function(n){if(!arguments.length)return r;r=n,e="function"==typeof n?null:n;return t};t.target=function(e){if(!arguments.length)return i;i=e,n="function"==typeof e?null:e;return t};t.precision=function(){return arguments.length?t:0};return t};is.geo.interpolate=function(t,e){return Cr(t[0]*qs,t[1]*qs,e[0]*qs,e[1]*qs)};is.geo.length=function(t){Jl=0;is.geo.stream(t,Kl);return Jl};var Jl,Kl={sphere:x,point:x,lineStart:Sr,lineEnd:x,polygonStart:x,polygonEnd:x},Zl=Tr(function(t){return Math.sqrt(2/(1+t))},function(t){return 2*Math.asin(t/2)});(is.geo.azimuthalEqualArea=function(){return sr(Zl)}).raw=Zl;var Ql=Tr(function(t){var e=Math.acos(t);return e&&e/Math.sin(e)},De);(is.geo.azimuthalEquidistant=function(){return sr(Ql)}).raw=Ql;(is.geo.conicConformal=function(){return Xn(kr)}).raw=kr;(is.geo.conicEquidistant=function(){return Xn(_r)}).raw=_r;var tu=Tr(function(t){return 1/t},Math.atan);(is.geo.gnomonic=function(){return sr(tu)}).raw=tu;Mr.invert=function(t,e){return[t,2*Math.atan(Math.exp(e))-zs]};(is.geo.mercator=function(){return Dr(Mr)}).raw=Mr;var eu=Tr(function(){return 1},Math.asin);(is.geo.orthographic=function(){return sr(eu)}).raw=eu;var nu=Tr(function(t){return 1/(1+t)},function(t){return 2*Math.atan(t)});(is.geo.stereographic=function(){return sr(nu)}).raw=nu;Lr.invert=function(t,e){return[-e,2*Math.atan(Math.exp(t))-zs]};(is.geo.transverseMercator=function(){var t=Dr(Lr),e=t.center,n=t.rotate;t.center=function(t){return t?e([-t[1],t[0]]):(t=e(),[t[1],-t[0]])};t.rotate=function(t){return t?n([t[0],t[1],t.length>2?t[2]+90:90]):(t=n(),[t[0],t[1],t[2]-90])};return n([0,0,90])}).raw=Lr;is.geom={};is.geom.hull=function(t){function e(t){if(t.length<3)return[];var e,i=Me(n),o=Me(r),a=t.length,s=[],l=[];for(e=0;a>e;e++)s.push([+i.call(this,t[e],e),+o.call(this,t[e],e),e]);s.sort(jr);for(e=0;a>e;e++)l.push([s[e][0],-s[e][1]]);var u=Er(s),c=Er(l),f=c[0]===u[0],h=c[c.length-1]===u[u.length-1],d=[];for(e=u.length-1;e>=0;--e)d.push(t[s[u[e]][2]]);for(e=+f;e<c.length-h;++e)d.push(t[s[c[e]][2]]);return d}var n=Ar,r=Nr;if(arguments.length)return e(t);e.x=function(t){return arguments.length?(n=t,e):n};e.y=function(t){return arguments.length?(r=t,e):r};return e};is.geom.polygon=function(t){Ss(t,ru);return t};var ru=is.geom.polygon.prototype=[];ru.area=function(){for(var t,e=-1,n=this.length,r=this[n-1],i=0;++e<n;){t=r;r=this[e];i+=t[1]*r[0]-t[0]*r[1]}return.5*i};ru.centroid=function(t){var e,n,r=-1,i=this.length,o=0,a=0,s=this[i-1];arguments.length||(t=-1/(6*this.area()));for(;++r<i;){e=s;s=this[r];n=e[0]*s[1]-s[0]*e[1];o+=(e[0]+s[0])*n;a+=(e[1]+s[1])*n}return[o*t,a*t]};ru.clip=function(t){for(var e,n,r,i,o,a,s=Hr(t),l=-1,u=this.length-Hr(this),c=this[u-1];++l<u;){e=t.slice();t.length=0;i=this[l];o=e[(r=e.length-s)-1];n=-1;for(;++n<r;){a=e[n];if(Ir(a,c,i)){Ir(o,c,i)||t.push(Pr(o,a,c,i));t.push(a)}else Ir(o,c,i)&&t.push(Pr(o,a,c,i));o=a}s&&t.push(t[0]);c=i}return t};var iu,ou,au,su,lu,uu=[],cu=[];Br.prototype.prepare=function(){for(var t,e=this.edges,n=e.length;n--;){t=e[n].edge;t.b&&t.a||e.splice(n,1)}e.sort(Xr);return e.length};ni.prototype={start:function(){return this.edge.l===this.site?this.edge.a:this.edge.b},end:function(){return this.edge.l===this.site?this.edge.b:this.edge.a}};ri.prototype={insert:function(t,e){var n,r,i;if(t){e.P=t;e.N=t.N;t.N&&(t.N.P=e);t.N=e;if(t.R){t=t.R;for(;t.L;)t=t.L;t.L=e}else t.R=e;n=t}else if(this._){t=si(this._);e.P=null;e.N=t;t.P=t.L=e;n=t}else{e.P=e.N=null;this._=e;n=null}e.L=e.R=null;e.U=n;e.C=!0;t=e;for(;n&&n.C;){r=n.U;if(n===r.L){i=r.R;if(i&&i.C){n.C=i.C=!1;r.C=!0;t=r}else{if(t===n.R){oi(this,n);t=n;n=t.U}n.C=!1;r.C=!0;ai(this,r)}}else{i=r.L;if(i&&i.C){n.C=i.C=!1;r.C=!0;t=r}else{if(t===n.L){ai(this,n);t=n;n=t.U}n.C=!1;r.C=!0;oi(this,r)}}n=t.U}this._.C=!1},remove:function(t){t.N&&(t.N.P=t.P);t.P&&(t.P.N=t.N);t.N=t.P=null;var e,n,r,i=t.U,o=t.L,a=t.R;n=o?a?si(a):o:a;i?i.L===t?i.L=n:i.R=n:this._=n;if(o&&a){r=n.C;n.C=t.C;n.L=o;o.U=n;if(n!==a){i=n.U;n.U=t.U;t=n.R;i.L=t;n.R=a;a.U=n}else{n.U=i;i=n;t=n.R}}else{r=t.C;t=n}t&&(t.U=i);if(!r)if(t&&t.C)t.C=!1;else{do{if(t===this._)break;if(t===i.L){e=i.R;if(e.C){e.C=!1;i.C=!0;oi(this,i);e=i.R}if(e.L&&e.L.C||e.R&&e.R.C){if(!e.R||!e.R.C){e.L.C=!1;e.C=!0;ai(this,e);e=i.R}e.C=i.C;i.C=e.R.C=!1;oi(this,i);t=this._;break}}else{e=i.L;if(e.C){e.C=!1;i.C=!0;ai(this,i);e=i.L}if(e.L&&e.L.C||e.R&&e.R.C){if(!e.L||!e.L.C){e.R.C=!1;e.C=!0;oi(this,e);e=i.L}e.C=i.C;i.C=e.L.C=!1;ai(this,i);t=this._;break}}e.C=!0;t=i;i=i.U}while(!t.C);t&&(t.C=!1)}}};is.geom.voronoi=function(t){function e(t){var e=new Array(t.length),r=s[0][0],i=s[0][1],o=s[1][0],a=s[1][1];li(n(t),s).cells.forEach(function(n,s){var l=n.edges,u=n.site,c=e[s]=l.length?l.map(function(t){var e=t.start();return[e.x,e.y]}):u.x>=r&&u.x<=o&&u.y>=i&&u.y<=a?[[r,a],[o,a],[o,i],[r,i]]:[];c.point=t[s]});return e}function n(t){return t.map(function(t,e){return{x:Math.round(o(t,e)/Hs)*Hs,y:Math.round(a(t,e)/Hs)*Hs,i:e}})}var r=Ar,i=Nr,o=r,a=i,s=fu;if(t)return e(t);e.links=function(t){return li(n(t)).edges.filter(function(t){return t.l&&t.r}).map(function(e){return{source:t[e.l.i],target:t[e.r.i]}})};e.triangles=function(t){var e=[];li(n(t)).cells.forEach(function(n,r){for(var i,o,a=n.site,s=n.edges.sort(Xr),l=-1,u=s.length,c=s[u-1].edge,f=c.l===a?c.r:c.l;++l<u;){i=c;o=f;c=s[l].edge;f=c.l===a?c.r:c.l;r<o.i&&r<f.i&&ci(a,o,f)<0&&e.push([t[r],t[o.i],t[f.i]])}});return e};e.x=function(t){return arguments.length?(o=Me(r=t),e):r};e.y=function(t){return arguments.length?(a=Me(i=t),e):i};e.clipExtent=function(t){if(!arguments.length)return s===fu?null:s;s=null==t?fu:t;return e};e.size=function(t){return arguments.length?e.clipExtent(t&&[[0,0],t]):s===fu?null:s&&s[1]};return e};var fu=[[-1e6,-1e6],[1e6,1e6]];is.geom.delaunay=function(t){return is.geom.voronoi().triangles(t)};is.geom.quadtree=function(t,e,n,r,i){function o(t){function o(t,e,n,r,i,o,a,s){if(!isNaN(n)&&!isNaN(r))if(t.leaf){var l=t.x,c=t.y;if(null!=l)if(ys(l-n)+ys(c-r)<.01)u(t,e,n,r,i,o,a,s);else{var f=t.point;t.x=t.y=t.point=null;u(t,f,l,c,i,o,a,s);u(t,e,n,r,i,o,a,s)}else t.x=n,t.y=r,t.point=e}else u(t,e,n,r,i,o,a,s)}function u(t,e,n,r,i,a,s,l){var u=.5*(i+s),c=.5*(a+l),f=n>=u,h=r>=c,d=h<<1|f;t.leaf=!1;t=t.nodes[d]||(t.nodes[d]=di());f?i=u:s=u;h?a=c:l=c;o(t,e,n,r,i,a,s,l)}var c,f,h,d,p,g,m,v,y,b=Me(s),x=Me(l);if(null!=e)g=e,m=n,v=r,y=i;else{v=y=-(g=m=1/0);f=[],h=[];p=t.length;if(a)for(d=0;p>d;++d){c=t[d];c.x<g&&(g=c.x);c.y<m&&(m=c.y);c.x>v&&(v=c.x);c.y>y&&(y=c.y);f.push(c.x);h.push(c.y)}else for(d=0;p>d;++d){var w=+b(c=t[d],d),C=+x(c,d);g>w&&(g=w);m>C&&(m=C);w>v&&(v=w);C>y&&(y=C);f.push(w);h.push(C)}}var S=v-g,T=y-m;S>T?y=m+S:v=g+T;var k=di();k.add=function(t){o(k,t,+b(t,++d),+x(t,d),g,m,v,y)};k.visit=function(t){pi(t,k,g,m,v,y)};k.find=function(t){return gi(k,t[0],t[1],g,m,v,y)};d=-1;if(null==e){for(;++d<p;)o(k,t[d],f[d],h[d],g,m,v,y);--d}else t.forEach(k.add);f=h=t=c=null;return k}var a,s=Ar,l=Nr;if(a=arguments.length){s=fi;l=hi;if(3===a){i=n;r=e;n=e=0}return o(t)}o.x=function(t){return arguments.length?(s=t,o):s};o.y=function(t){return arguments.length?(l=t,o):l};o.extent=function(t){if(!arguments.length)return null==e?null:[[e,n],[r,i]];null==t?e=n=r=i=null:(e=+t[0][0],n=+t[0][1],r=+t[1][0],i=+t[1][1]);return o};o.size=function(t){if(!arguments.length)return null==e?null:[r-e,i-n];null==t?e=n=r=i=null:(e=n=0,r=+t[0],i=+t[1]);return o};return o};is.interpolateRgb=mi;is.interpolateObject=vi;is.interpolateNumber=yi;is.interpolateString=bi;var hu=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,du=new RegExp(hu.source,"g");is.interpolate=xi;is.interpolators=[function(t,e){var n=typeof e;return("string"===n?il.has(e)||/^(#|rgb\(|hsl\()/.test(e)?mi:bi:e instanceof se?mi:Array.isArray(e)?wi:"object"===n&&isNaN(e)?vi:yi)(t,e)}];is.interpolateArray=wi;var pu=function(){return De},gu=is.map({linear:pu,poly:Di,quad:function(){return ki},cubic:function(){return _i},sin:function(){return Li},exp:function(){return Ai},circle:function(){return Ni},elastic:Ei,back:ji,bounce:function(){return Ii}}),mu=is.map({"in":De,out:Si,"in-out":Ti,"out-in":function(t){return Ti(Si(t))}});is.ease=function(t){var e=t.indexOf("-"),n=e>=0?t.slice(0,e):t,r=e>=0?t.slice(e+1):"in";n=gu.get(n)||pu;r=mu.get(r)||De;return Ci(r(n.apply(null,os.call(arguments,1))))};is.interpolateHcl=Pi;is.interpolateHsl=Hi;is.interpolateLab=Oi;is.interpolateRound=Ri;is.transform=function(t){var e=ss.createElementNS(is.ns.prefix.svg,"g");return(is.transform=function(t){if(null!=t){e.setAttribute("transform",t);var n=e.transform.baseVal.consolidate()}return new Fi(n?n.matrix:vu)})(t)};Fi.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var vu={a:1,b:0,c:0,d:1,e:0,f:0};is.interpolateTransform=Ui;is.layout={};is.layout.bundle=function(){return function(t){for(var e=[],n=-1,r=t.length;++n<r;)e.push(Xi(t[n]));return e}};is.layout.chord=function(){function t(){var t,u,f,h,d,p={},g=[],m=is.range(o),v=[];n=[];r=[];t=0,h=-1;for(;++h<o;){u=0,d=-1;for(;++d<o;)u+=i[h][d];g.push(u);v.push(is.range(o));t+=u}a&&m.sort(function(t,e){return a(g[t],g[e])});s&&v.forEach(function(t,e){t.sort(function(t,n){return s(i[e][t],i[e][n])})});t=(Fs-c*o)/t;u=0,h=-1;for(;++h<o;){f=u,d=-1;for(;++d<o;){var y=m[h],b=v[y][d],x=i[y][b],w=u,C=u+=x*t;p[y+"-"+b]={index:y,subindex:b,startAngle:w,endAngle:C,value:x}}r[y]={index:y,startAngle:f,endAngle:u,value:(u-f)/t};u+=c}h=-1;for(;++h<o;){d=h-1;for(;++d<o;){var S=p[h+"-"+d],T=p[d+"-"+h];(S.value||T.value)&&n.push(S.value<T.value?{source:T,target:S}:{source:S,target:T})}}l&&e()}function e(){n.sort(function(t,e){return l((t.source.value+t.target.value)/2,(e.source.value+e.target.value)/2)})}var n,r,i,o,a,s,l,u={},c=0;u.matrix=function(t){if(!arguments.length)return i;o=(i=t)&&i.length;n=r=null;return u};u.padding=function(t){if(!arguments.length)return c;c=t;n=r=null;return u};u.sortGroups=function(t){if(!arguments.length)return a;a=t;n=r=null;return u};u.sortSubgroups=function(t){if(!arguments.length)return s;s=t;n=null;return u};u.sortChords=function(t){if(!arguments.length)return l;l=t;n&&e();return u};u.chords=function(){n||t();return n};u.groups=function(){r||t();return r};return u};is.layout.force=function(){function t(t){return function(e,n,r,i){if(e.point!==t){var o=e.cx-t.x,a=e.cy-t.y,s=i-n,l=o*o+a*a;if(l>s*s/m){if(p>l){var u=e.charge/l;t.px-=o*u;t.py-=a*u}return!0}if(e.point&&l&&p>l){var u=e.pointCharge/l;t.px-=o*u;t.py-=a*u}}return!e.charge}}function e(t){t.px=is.event.x,t.py=is.event.y;s.resume()}var n,r,i,o,a,s={},l=is.dispatch("start","tick","end"),u=[1,1],c=.9,f=yu,h=bu,d=-30,p=xu,g=.1,m=.64,v=[],y=[];s.tick=function(){if((r*=.99)<.005){l.end({type:"end",alpha:r=0});return!0}var e,n,s,f,h,p,m,b,x,w=v.length,C=y.length;for(n=0;C>n;++n){s=y[n];f=s.source;h=s.target;b=h.x-f.x;x=h.y-f.y;if(p=b*b+x*x){p=r*o[n]*((p=Math.sqrt(p))-i[n])/p;b*=p;x*=p;h.x-=b*(m=f.weight/(h.weight+f.weight));h.y-=x*m;f.x+=b*(m=1-m);f.y+=x*m}}if(m=r*g){b=u[0]/2;x=u[1]/2;n=-1;if(m)for(;++n<w;){s=v[n];s.x+=(b-s.x)*m;s.y+=(x-s.y)*m}}if(d){Qi(e=is.geom.quadtree(v),r,a);n=-1;for(;++n<w;)(s=v[n]).fixed||e.visit(t(s))}n=-1;for(;++n<w;){s=v[n];if(s.fixed){s.x=s.px;s.y=s.py}else{s.x-=(s.px-(s.px=s.x))*c;s.y-=(s.py-(s.py=s.y))*c}}l.tick({type:"tick",alpha:r})};s.nodes=function(t){if(!arguments.length)return v;v=t;return s};s.links=function(t){if(!arguments.length)return y;y=t;return s};s.size=function(t){if(!arguments.length)return u;u=t;return s};s.linkDistance=function(t){if(!arguments.length)return f;f="function"==typeof t?t:+t;return s};s.distance=s.linkDistance;s.linkStrength=function(t){if(!arguments.length)return h;h="function"==typeof t?t:+t;return s};s.friction=function(t){if(!arguments.length)return c;c=+t;return s};s.charge=function(t){if(!arguments.length)return d;d="function"==typeof t?t:+t;return s};s.chargeDistance=function(t){if(!arguments.length)return Math.sqrt(p);p=t*t;return s};s.gravity=function(t){if(!arguments.length)return g;g=+t;return s};s.theta=function(t){if(!arguments.length)return Math.sqrt(m);m=t*t;return s};s.alpha=function(t){if(!arguments.length)return r;t=+t;if(r)r=t>0?t:0;else if(t>0){l.start({type:"start",alpha:r=t});is.timer(s.tick)}return s};s.start=function(){function t(t,r){if(!n){n=new Array(l);for(s=0;l>s;++s)n[s]=[];for(s=0;u>s;++s){var i=y[s];n[i.source.index].push(i.target);n[i.target.index].push(i.source)}}for(var o,a=n[e],s=-1,u=a.length;++s<u;)if(!isNaN(o=a[s][t]))return o;return Math.random()*r}var e,n,r,l=v.length,c=y.length,p=u[0],g=u[1];for(e=0;l>e;++e){(r=v[e]).index=e;r.weight=0}for(e=0;c>e;++e){r=y[e];"number"==typeof r.source&&(r.source=v[r.source]);"number"==typeof r.target&&(r.target=v[r.target]);++r.source.weight;++r.target.weight}for(e=0;l>e;++e){r=v[e];isNaN(r.x)&&(r.x=t("x",p));isNaN(r.y)&&(r.y=t("y",g));isNaN(r.px)&&(r.px=r.x);isNaN(r.py)&&(r.py=r.y)}i=[];if("function"==typeof f)for(e=0;c>e;++e)i[e]=+f.call(this,y[e],e);else for(e=0;c>e;++e)i[e]=f;o=[];if("function"==typeof h)for(e=0;c>e;++e)o[e]=+h.call(this,y[e],e);else for(e=0;c>e;++e)o[e]=h;a=[];if("function"==typeof d)for(e=0;l>e;++e)a[e]=+d.call(this,v[e],e);else for(e=0;l>e;++e)a[e]=d;return s.resume()};s.resume=function(){return s.alpha(.1)};s.stop=function(){return s.alpha(0)};s.drag=function(){n||(n=is.behavior.drag().origin(De).on("dragstart.force",Yi).on("drag.force",e).on("dragend.force",Ji));if(!arguments.length)return n;this.on("mouseover.force",Ki).on("mouseout.force",Zi).call(n);return void 0};return is.rebind(s,l,"on")};var yu=20,bu=1,xu=1/0;is.layout.hierarchy=function(){function t(i){var o,a=[i],s=[];i.depth=0;for(;null!=(o=a.pop());){s.push(o);if((u=n.call(t,o,o.depth))&&(l=u.length)){for(var l,u,c;--l>=0;){a.push(c=u[l]);c.parent=o;c.depth=o.depth+1}r&&(o.value=0);o.children=u}else{r&&(o.value=+r.call(t,o,o.depth)||0);delete o.children}}no(i,function(t){var n,i;e&&(n=t.children)&&n.sort(e);r&&(i=t.parent)&&(i.value+=t.value)});return s}var e=oo,n=ro,r=io;t.sort=function(n){if(!arguments.length)return e;e=n;return t};t.children=function(e){if(!arguments.length)return n;n=e;return t};t.value=function(e){if(!arguments.length)return r;r=e;return t};t.revalue=function(e){if(r){eo(e,function(t){t.children&&(t.value=0)});no(e,function(e){var n;e.children||(e.value=+r.call(t,e,e.depth)||0);(n=e.parent)&&(n.value+=e.value)})}return e};return t};is.layout.partition=function(){function t(e,n,r,i){var o=e.children;e.x=n;e.y=e.depth*i;e.dx=r;e.dy=i;if(o&&(a=o.length)){var a,s,l,u=-1;r=e.value?r/e.value:0;for(;++u<a;){t(s=o[u],n,l=s.value*r,i);n+=l}}}function e(t){var n=t.children,r=0;if(n&&(i=n.length))for(var i,o=-1;++o<i;)r=Math.max(r,e(n[o]));return 1+r}function n(n,o){var a=r.call(this,n,o);t(a[0],0,i[0],i[1]/e(a[0]));return a}var r=is.layout.hierarchy(),i=[1,1];n.size=function(t){if(!arguments.length)return i;i=t;return n};return to(n,r)};is.layout.pie=function(){function t(a){var s,l=a.length,u=a.map(function(n,r){return+e.call(t,n,r)}),c=+("function"==typeof r?r.apply(this,arguments):r),f=("function"==typeof i?i.apply(this,arguments):i)-c,h=Math.min(Math.abs(f)/l,+("function"==typeof o?o.apply(this,arguments):o)),d=h*(0>f?-1:1),p=(f-l*d)/is.sum(u),g=is.range(l),m=[];null!=n&&g.sort(n===wu?function(t,e){return u[e]-u[t]}:function(t,e){return n(a[t],a[e])});g.forEach(function(t){m[t]={data:a[t],value:s=u[t],startAngle:c,endAngle:c+=s*p+d,padAngle:h}});return m}var e=Number,n=wu,r=0,i=Fs,o=0;t.value=function(n){if(!arguments.length)return e;e=n;return t};t.sort=function(e){if(!arguments.length)return n;n=e;return t};t.startAngle=function(e){if(!arguments.length)return r;r=e;return t};t.endAngle=function(e){if(!arguments.length)return i;i=e;return t};t.padAngle=function(e){if(!arguments.length)return o;o=e;return t};return t};var wu={};is.layout.stack=function(){function t(s,l){if(!(h=s.length))return s;var u=s.map(function(n,r){return e.call(t,n,r)}),c=u.map(function(e){return e.map(function(e,n){return[o.call(t,e,n),a.call(t,e,n)]})}),f=n.call(t,c,l);u=is.permute(u,f);c=is.permute(c,f);var h,d,p,g,m=r.call(t,c,l),v=u[0].length;
for(p=0;v>p;++p){i.call(t,u[0][p],g=m[p],c[0][p][1]);for(d=1;h>d;++d)i.call(t,u[d][p],g+=c[d-1][p][1],c[d][p][1])}return s}var e=De,n=co,r=fo,i=uo,o=so,a=lo;t.values=function(n){if(!arguments.length)return e;e=n;return t};t.order=function(e){if(!arguments.length)return n;n="function"==typeof e?e:Cu.get(e)||co;return t};t.offset=function(e){if(!arguments.length)return r;r="function"==typeof e?e:Su.get(e)||fo;return t};t.x=function(e){if(!arguments.length)return o;o=e;return t};t.y=function(e){if(!arguments.length)return a;a=e;return t};t.out=function(e){if(!arguments.length)return i;i=e;return t};return t};var Cu=is.map({"inside-out":function(t){var e,n,r=t.length,i=t.map(ho),o=t.map(po),a=is.range(r).sort(function(t,e){return i[t]-i[e]}),s=0,l=0,u=[],c=[];for(e=0;r>e;++e){n=a[e];if(l>s){s+=o[n];u.push(n)}else{l+=o[n];c.push(n)}}return c.reverse().concat(u)},reverse:function(t){return is.range(t.length).reverse()},"default":co}),Su=is.map({silhouette:function(t){var e,n,r,i=t.length,o=t[0].length,a=[],s=0,l=[];for(n=0;o>n;++n){for(e=0,r=0;i>e;e++)r+=t[e][n][1];r>s&&(s=r);a.push(r)}for(n=0;o>n;++n)l[n]=(s-a[n])/2;return l},wiggle:function(t){var e,n,r,i,o,a,s,l,u,c=t.length,f=t[0],h=f.length,d=[];d[0]=l=u=0;for(n=1;h>n;++n){for(e=0,i=0;c>e;++e)i+=t[e][n][1];for(e=0,o=0,s=f[n][0]-f[n-1][0];c>e;++e){for(r=0,a=(t[e][n][1]-t[e][n-1][1])/(2*s);e>r;++r)a+=(t[r][n][1]-t[r][n-1][1])/s;o+=a*t[e][n][1]}d[n]=l-=i?o/i*s:0;u>l&&(u=l)}for(n=0;h>n;++n)d[n]-=u;return d},expand:function(t){var e,n,r,i=t.length,o=t[0].length,a=1/i,s=[];for(n=0;o>n;++n){for(e=0,r=0;i>e;e++)r+=t[e][n][1];if(r)for(e=0;i>e;e++)t[e][n][1]/=r;else for(e=0;i>e;e++)t[e][n][1]=a}for(n=0;o>n;++n)s[n]=0;return s},zero:fo});is.layout.histogram=function(){function t(t,o){for(var a,s,l=[],u=t.map(n,this),c=r.call(this,u,o),f=i.call(this,c,u,o),o=-1,h=u.length,d=f.length-1,p=e?1:1/h;++o<d;){a=l[o]=[];a.dx=f[o+1]-(a.x=f[o]);a.y=0}if(d>0){o=-1;for(;++o<h;){s=u[o];if(s>=c[0]&&s<=c[1]){a=l[is.bisect(f,s,1,d)-1];a.y+=p;a.push(t[o])}}}return l}var e=!0,n=Number,r=yo,i=mo;t.value=function(e){if(!arguments.length)return n;n=e;return t};t.range=function(e){if(!arguments.length)return r;r=Me(e);return t};t.bins=function(e){if(!arguments.length)return i;i="number"==typeof e?function(t){return vo(t,e)}:Me(e);return t};t.frequency=function(n){if(!arguments.length)return e;e=!!n;return t};return t};is.layout.pack=function(){function t(t,o){var a=n.call(this,t,o),s=a[0],l=i[0],u=i[1],c=null==e?Math.sqrt:"function"==typeof e?e:function(){return e};s.x=s.y=0;no(s,function(t){t.r=+c(t.value)});no(s,So);if(r){var f=r*(e?1:Math.max(2*s.r/l,2*s.r/u))/2;no(s,function(t){t.r+=f});no(s,So);no(s,function(t){t.r-=f})}_o(s,l/2,u/2,e?1:1/Math.max(2*s.r/l,2*s.r/u));return a}var e,n=is.layout.hierarchy().sort(bo),r=0,i=[1,1];t.size=function(e){if(!arguments.length)return i;i=e;return t};t.radius=function(n){if(!arguments.length)return e;e=null==n||"function"==typeof n?n:+n;return t};t.padding=function(e){if(!arguments.length)return r;r=+e;return t};return to(t,n)};is.layout.tree=function(){function t(t,i){var c=a.call(this,t,i),f=c[0],h=e(f);no(h,n),h.parent.m=-h.z;eo(h,r);if(u)eo(f,o);else{var d=f,p=f,g=f;eo(f,function(t){t.x<d.x&&(d=t);t.x>p.x&&(p=t);t.depth>g.depth&&(g=t)});var m=s(d,p)/2-d.x,v=l[0]/(p.x+s(p,d)/2+m),y=l[1]/(g.depth||1);eo(f,function(t){t.x=(t.x+m)*v;t.y=t.depth*y})}return c}function e(t){for(var e,n={A:null,children:[t]},r=[n];null!=(e=r.pop());)for(var i,o=e.children,a=0,s=o.length;s>a;++a)r.push((o[a]=i={_:o[a],parent:e,children:(i=o[a].children)&&i.slice()||[],A:null,a:null,z:0,m:0,c:0,s:0,t:null,i:a}).a=i);return n.children[0]}function n(t){var e=t.children,n=t.parent.children,r=t.i?n[t.i-1]:null;if(e.length){Eo(t);var o=(e[0].z+e[e.length-1].z)/2;if(r){t.z=r.z+s(t._,r._);t.m=t.z-o}else t.z=o}else r&&(t.z=r.z+s(t._,r._));t.parent.A=i(t,r,t.parent.A||n[0])}function r(t){t._.x=t.z+t.parent.m;t.m+=t.parent.m}function i(t,e,n){if(e){for(var r,i=t,o=t,a=e,l=i.parent.children[0],u=i.m,c=o.m,f=a.m,h=l.m;a=Ao(a),i=Lo(i),a&&i;){l=Lo(l);o=Ao(o);o.a=t;r=a.z+f-i.z-u+s(a._,i._);if(r>0){No(jo(a,t,n),t,r);u+=r;c+=r}f+=a.m;u+=i.m;h+=l.m;c+=o.m}if(a&&!Ao(o)){o.t=a;o.m+=f-c}if(i&&!Lo(l)){l.t=i;l.m+=u-h;n=t}}return n}function o(t){t.x*=l[0];t.y=t.depth*l[1]}var a=is.layout.hierarchy().sort(null).value(null),s=Do,l=[1,1],u=null;t.separation=function(e){if(!arguments.length)return s;s=e;return t};t.size=function(e){if(!arguments.length)return u?null:l;u=null==(l=e)?o:null;return t};t.nodeSize=function(e){if(!arguments.length)return u?l:null;u=null==(l=e)?null:o;return t};return to(t,a)};is.layout.cluster=function(){function t(t,o){var a,s=e.call(this,t,o),l=s[0],u=0;no(l,function(t){var e=t.children;if(e&&e.length){t.x=Po(e);t.y=Io(e)}else{t.x=a?u+=n(t,a):0;t.y=0;a=t}});var c=Ho(l),f=Oo(l),h=c.x-n(c,f)/2,d=f.x+n(f,c)/2;no(l,i?function(t){t.x=(t.x-l.x)*r[0];t.y=(l.y-t.y)*r[1]}:function(t){t.x=(t.x-h)/(d-h)*r[0];t.y=(1-(l.y?t.y/l.y:1))*r[1]});return s}var e=is.layout.hierarchy().sort(null).value(null),n=Do,r=[1,1],i=!1;t.separation=function(e){if(!arguments.length)return n;n=e;return t};t.size=function(e){if(!arguments.length)return i?null:r;i=null==(r=e);return t};t.nodeSize=function(e){if(!arguments.length)return i?r:null;i=null!=(r=e);return t};return to(t,e)};is.layout.treemap=function(){function t(t,e){for(var n,r,i=-1,o=t.length;++i<o;){r=(n=t[i]).value*(0>e?0:e);n.area=isNaN(r)||0>=r?0:r}}function e(n){var o=n.children;if(o&&o.length){var a,s,l,u=f(n),c=[],h=o.slice(),p=1/0,g="slice"===d?u.dx:"dice"===d?u.dy:"slice-dice"===d?1&n.depth?u.dy:u.dx:Math.min(u.dx,u.dy);t(h,u.dx*u.dy/n.value);c.area=0;for(;(l=h.length)>0;){c.push(a=h[l-1]);c.area+=a.area;if("squarify"!==d||(s=r(c,g))<=p){h.pop();p=s}else{c.area-=c.pop().area;i(c,g,u,!1);g=Math.min(u.dx,u.dy);c.length=c.area=0;p=1/0}}if(c.length){i(c,g,u,!0);c.length=c.area=0}o.forEach(e)}}function n(e){var r=e.children;if(r&&r.length){var o,a=f(e),s=r.slice(),l=[];t(s,a.dx*a.dy/e.value);l.area=0;for(;o=s.pop();){l.push(o);l.area+=o.area;if(null!=o.z){i(l,o.z?a.dx:a.dy,a,!s.length);l.length=l.area=0}}r.forEach(n)}}function r(t,e){for(var n,r=t.area,i=0,o=1/0,a=-1,s=t.length;++a<s;)if(n=t[a].area){o>n&&(o=n);n>i&&(i=n)}r*=r;e*=e;return r?Math.max(e*i*p/r,r/(e*o*p)):1/0}function i(t,e,n,r){var i,o=-1,a=t.length,s=n.x,u=n.y,c=e?l(t.area/e):0;if(e==n.dx){(r||c>n.dy)&&(c=n.dy);for(;++o<a;){i=t[o];i.x=s;i.y=u;i.dy=c;s+=i.dx=Math.min(n.x+n.dx-s,c?l(i.area/c):0)}i.z=!0;i.dx+=n.x+n.dx-s;n.y+=c;n.dy-=c}else{(r||c>n.dx)&&(c=n.dx);for(;++o<a;){i=t[o];i.x=s;i.y=u;i.dx=c;u+=i.dy=Math.min(n.y+n.dy-u,c?l(i.area/c):0)}i.z=!1;i.dy+=n.y+n.dy-u;n.x+=c;n.dx-=c}}function o(r){var i=a||s(r),o=i[0];o.x=0;o.y=0;o.dx=u[0];o.dy=u[1];a&&s.revalue(o);t([o],o.dx*o.dy/o.value);(a?n:e)(o);h&&(a=i);return i}var a,s=is.layout.hierarchy(),l=Math.round,u=[1,1],c=null,f=Ro,h=!1,d="squarify",p=.5*(1+Math.sqrt(5));o.size=function(t){if(!arguments.length)return u;u=t;return o};o.padding=function(t){function e(e){var n=t.call(o,e,e.depth);return null==n?Ro(e):Fo(e,"number"==typeof n?[n,n,n,n]:n)}function n(e){return Fo(e,t)}if(!arguments.length)return c;var r;f=null==(c=t)?Ro:"function"==(r=typeof t)?e:"number"===r?(t=[t,t,t,t],n):n;return o};o.round=function(t){if(!arguments.length)return l!=Number;l=t?Math.round:Number;return o};o.sticky=function(t){if(!arguments.length)return h;h=t;a=null;return o};o.ratio=function(t){if(!arguments.length)return p;p=t;return o};o.mode=function(t){if(!arguments.length)return d;d=t+"";return o};return to(o,s)};is.random={normal:function(t,e){var n=arguments.length;2>n&&(e=1);1>n&&(t=0);return function(){var n,r,i;do{n=2*Math.random()-1;r=2*Math.random()-1;i=n*n+r*r}while(!i||i>1);return t+e*n*Math.sqrt(-2*Math.log(i)/i)}},logNormal:function(){var t=is.random.normal.apply(is,arguments);return function(){return Math.exp(t())}},bates:function(t){var e=is.random.irwinHall(t);return function(){return e()/t}},irwinHall:function(t){return function(){for(var e=0,n=0;t>n;n++)e+=Math.random();return e}}};is.scale={};var Tu={floor:De,ceil:De};is.scale.linear=function(){return Xo([0,1],[0,1],xi,!1)};var ku={s:1,g:1,p:1,r:1,e:1};is.scale.log=function(){return ta(is.scale.linear().domain([0,1]),10,!0,[1,10])};var _u=is.format(".0e"),Mu={floor:function(t){return-Math.ceil(-t)},ceil:function(t){return-Math.floor(-t)}};is.scale.pow=function(){return ea(is.scale.linear(),1,[0,1])};is.scale.sqrt=function(){return is.scale.pow().exponent(.5)};is.scale.ordinal=function(){return ra([],{t:"range",a:[[]]})};is.scale.category10=function(){return is.scale.ordinal().range(Du)};is.scale.category20=function(){return is.scale.ordinal().range(Lu)};is.scale.category20b=function(){return is.scale.ordinal().range(Au)};is.scale.category20c=function(){return is.scale.ordinal().range(Nu)};var Du=[2062260,16744206,2924588,14034728,9725885,9197131,14907330,8355711,12369186,1556175].map(xe),Lu=[2062260,11454440,16744206,16759672,2924588,10018698,14034728,16750742,9725885,12955861,9197131,12885140,14907330,16234194,8355711,13092807,12369186,14408589,1556175,10410725].map(xe),Au=[3750777,5395619,7040719,10264286,6519097,9216594,11915115,13556636,9202993,12426809,15186514,15190932,8666169,11356490,14049643,15177372,8077683,10834324,13528509,14589654].map(xe),Nu=[3244733,7057110,10406625,13032431,15095053,16616764,16625259,16634018,3253076,7652470,10607003,13101504,7695281,10394312,12369372,14342891,6513507,9868950,12434877,14277081].map(xe);is.scale.quantile=function(){return ia([],[])};is.scale.quantize=function(){return oa(0,1,[0,1])};is.scale.threshold=function(){return aa([.5],[0,1])};is.scale.identity=function(){return sa([0,1])};is.svg={};is.svg.arc=function(){function t(){var t=Math.max(0,+n.apply(this,arguments)),u=Math.max(0,+r.apply(this,arguments)),c=a.apply(this,arguments)-zs,f=s.apply(this,arguments)-zs,h=Math.abs(f-c),d=c>f?0:1;t>u&&(p=u,u=t,t=p);if(h>=Ws)return e(u,d)+(t?e(t,1-d):"")+"Z";var p,g,m,v,y,b,x,w,C,S,T,k,_=0,M=0,D=[];if(v=(+l.apply(this,arguments)||0)/2){m=o===Eu?Math.sqrt(t*t+u*u):+o.apply(this,arguments);d||(M*=-1);u&&(M=ne(m/u*Math.sin(v)));t&&(_=ne(m/t*Math.sin(v)))}if(u){y=u*Math.cos(c+M);b=u*Math.sin(c+M);x=u*Math.cos(f-M);w=u*Math.sin(f-M);var L=Math.abs(f-c-2*M)<=Rs?0:1;if(M&&pa(y,b,x,w)===d^L){var A=(c+f)/2;y=u*Math.cos(A);b=u*Math.sin(A);x=w=null}}else y=b=0;if(t){C=t*Math.cos(f-_);S=t*Math.sin(f-_);T=t*Math.cos(c+_);k=t*Math.sin(c+_);var N=Math.abs(c-f+2*_)<=Rs?0:1;if(_&&pa(C,S,T,k)===1-d^N){var E=(c+f)/2;C=t*Math.cos(E);S=t*Math.sin(E);T=k=null}}else C=S=0;if((p=Math.min(Math.abs(u-t)/2,+i.apply(this,arguments)))>.001){g=u>t^d?0:1;var j=null==T?[C,S]:null==x?[y,b]:Pr([y,b],[T,k],[x,w],[C,S]),I=y-j[0],P=b-j[1],H=x-j[0],O=w-j[1],R=1/Math.sin(Math.acos((I*H+P*O)/(Math.sqrt(I*I+P*P)*Math.sqrt(H*H+O*O)))/2),F=Math.sqrt(j[0]*j[0]+j[1]*j[1]);if(null!=x){var W=Math.min(p,(u-F)/(R+1)),z=ga(null==T?[C,S]:[T,k],[y,b],u,W,d),q=ga([x,w],[C,S],u,W,d);p===W?D.push("M",z[0],"A",W,",",W," 0 0,",g," ",z[1],"A",u,",",u," 0 ",1-d^pa(z[1][0],z[1][1],q[1][0],q[1][1]),",",d," ",q[1],"A",W,",",W," 0 0,",g," ",q[0]):D.push("M",z[0],"A",W,",",W," 0 1,",g," ",q[0])}else D.push("M",y,",",b);if(null!=T){var U=Math.min(p,(t-F)/(R-1)),B=ga([y,b],[T,k],t,-U,d),V=ga([C,S],null==x?[y,b]:[x,w],t,-U,d);p===U?D.push("L",V[0],"A",U,",",U," 0 0,",g," ",V[1],"A",t,",",t," 0 ",d^pa(V[1][0],V[1][1],B[1][0],B[1][1]),",",1-d," ",B[1],"A",U,",",U," 0 0,",g," ",B[0]):D.push("L",V[0],"A",U,",",U," 0 0,",g," ",B[0])}else D.push("L",C,",",S)}else{D.push("M",y,",",b);null!=x&&D.push("A",u,",",u," 0 ",L,",",d," ",x,",",w);D.push("L",C,",",S);null!=T&&D.push("A",t,",",t," 0 ",N,",",1-d," ",T,",",k)}D.push("Z");return D.join("")}function e(t,e){return"M0,"+t+"A"+t+","+t+" 0 1,"+e+" 0,"+-t+"A"+t+","+t+" 0 1,"+e+" 0,"+t}var n=ua,r=ca,i=la,o=Eu,a=fa,s=ha,l=da;t.innerRadius=function(e){if(!arguments.length)return n;n=Me(e);return t};t.outerRadius=function(e){if(!arguments.length)return r;r=Me(e);return t};t.cornerRadius=function(e){if(!arguments.length)return i;i=Me(e);return t};t.padRadius=function(e){if(!arguments.length)return o;o=e==Eu?Eu:Me(e);return t};t.startAngle=function(e){if(!arguments.length)return a;a=Me(e);return t};t.endAngle=function(e){if(!arguments.length)return s;s=Me(e);return t};t.padAngle=function(e){if(!arguments.length)return l;l=Me(e);return t};t.centroid=function(){var t=(+n.apply(this,arguments)+ +r.apply(this,arguments))/2,e=(+a.apply(this,arguments)+ +s.apply(this,arguments))/2-zs;return[Math.cos(e)*t,Math.sin(e)*t]};return t};var Eu="auto";is.svg.line=function(){return ma(De)};var ju=is.map({linear:va,"linear-closed":ya,step:ba,"step-before":xa,"step-after":wa,basis:Ma,"basis-open":Da,"basis-closed":La,bundle:Aa,cardinal:Ta,"cardinal-open":Ca,"cardinal-closed":Sa,monotone:Ha});ju.forEach(function(t,e){e.key=t;e.closed=/-closed$/.test(t)});var Iu=[0,2/3,1/3,0],Pu=[0,1/3,2/3,0],Hu=[0,1/6,2/3,1/6];is.svg.line.radial=function(){var t=ma(Oa);t.radius=t.x,delete t.x;t.angle=t.y,delete t.y;return t};xa.reverse=wa;wa.reverse=xa;is.svg.area=function(){return Ra(De)};is.svg.area.radial=function(){var t=Ra(Oa);t.radius=t.x,delete t.x;t.innerRadius=t.x0,delete t.x0;t.outerRadius=t.x1,delete t.x1;t.angle=t.y,delete t.y;t.startAngle=t.y0,delete t.y0;t.endAngle=t.y1,delete t.y1;return t};is.svg.chord=function(){function t(t,s){var l=e(this,o,t,s),u=e(this,a,t,s);return"M"+l.p0+r(l.r,l.p1,l.a1-l.a0)+(n(l,u)?i(l.r,l.p1,l.r,l.p0):i(l.r,l.p1,u.r,u.p0)+r(u.r,u.p1,u.a1-u.a0)+i(u.r,u.p1,l.r,l.p0))+"Z"}function e(t,e,n,r){var i=e.call(t,n,r),o=s.call(t,i,r),a=l.call(t,i,r)-zs,c=u.call(t,i,r)-zs;return{r:o,a0:a,a1:c,p0:[o*Math.cos(a),o*Math.sin(a)],p1:[o*Math.cos(c),o*Math.sin(c)]}}function n(t,e){return t.a0==e.a0&&t.a1==e.a1}function r(t,e,n){return"A"+t+","+t+" 0 "+ +(n>Rs)+",1 "+e}function i(t,e,n,r){return"Q 0,0 "+r}var o=xr,a=wr,s=Fa,l=fa,u=ha;t.radius=function(e){if(!arguments.length)return s;s=Me(e);return t};t.source=function(e){if(!arguments.length)return o;o=Me(e);return t};t.target=function(e){if(!arguments.length)return a;a=Me(e);return t};t.startAngle=function(e){if(!arguments.length)return l;l=Me(e);return t};t.endAngle=function(e){if(!arguments.length)return u;u=Me(e);return t};return t};is.svg.diagonal=function(){function t(t,i){var o=e.call(this,t,i),a=n.call(this,t,i),s=(o.y+a.y)/2,l=[o,{x:o.x,y:s},{x:a.x,y:s},a];l=l.map(r);return"M"+l[0]+"C"+l[1]+" "+l[2]+" "+l[3]}var e=xr,n=wr,r=Wa;t.source=function(n){if(!arguments.length)return e;e=Me(n);return t};t.target=function(e){if(!arguments.length)return n;n=Me(e);return t};t.projection=function(e){if(!arguments.length)return r;r=e;return t};return t};is.svg.diagonal.radial=function(){var t=is.svg.diagonal(),e=Wa,n=t.projection;t.projection=function(t){return arguments.length?n(za(e=t)):e};return t};is.svg.symbol=function(){function t(t,r){return(Ou.get(e.call(this,t,r))||Ba)(n.call(this,t,r))}var e=Ua,n=qa;t.type=function(n){if(!arguments.length)return e;e=Me(n);return t};t.size=function(e){if(!arguments.length)return n;n=Me(e);return t};return t};var Ou=is.map({circle:Ba,cross:function(t){var e=Math.sqrt(t/5)/2;return"M"+-3*e+","+-e+"H"+-e+"V"+-3*e+"H"+e+"V"+-e+"H"+3*e+"V"+e+"H"+e+"V"+3*e+"H"+-e+"V"+e+"H"+-3*e+"Z"},diamond:function(t){var e=Math.sqrt(t/(2*Fu)),n=e*Fu;return"M0,"+-e+"L"+n+",0 0,"+e+" "+-n+",0Z"},square:function(t){var e=Math.sqrt(t)/2;return"M"+-e+","+-e+"L"+e+","+-e+" "+e+","+e+" "+-e+","+e+"Z"},"triangle-down":function(t){var e=Math.sqrt(t/Ru),n=e*Ru/2;return"M0,"+n+"L"+e+","+-n+" "+-e+","+-n+"Z"},"triangle-up":function(t){var e=Math.sqrt(t/Ru),n=e*Ru/2;return"M0,"+-n+"L"+e+","+n+" "+-e+","+n+"Z"}});is.svg.symbolTypes=Ou.keys();var Ru=Math.sqrt(3),Fu=Math.tan(30*qs);Ds.transition=function(t){for(var e,n,r=Wu||++Bu,i=Ya(t),o=[],a=zu||{time:Date.now(),ease:Mi,delay:0,duration:250},s=-1,l=this.length;++s<l;){o.push(e=[]);for(var u=this[s],c=-1,f=u.length;++c<f;){(n=u[c])&&Ja(n,c,i,r,a);e.push(n)}}return Xa(o,i,r)};Ds.interrupt=function(t){return this.each(null==t?qu:Va(Ya(t)))};var Wu,zu,qu=Va(Ya()),Uu=[],Bu=0;Uu.call=Ds.call;Uu.empty=Ds.empty;Uu.node=Ds.node;Uu.size=Ds.size;is.transition=function(t,e){return t&&t.transition?Wu?t.transition(e):t:Ns.transition(t)};is.transition.prototype=Uu;Uu.select=function(t){var e,n,r,i=this.id,o=this.namespace,a=[];t=M(t);for(var s=-1,l=this.length;++s<l;){a.push(e=[]);for(var u=this[s],c=-1,f=u.length;++c<f;)if((r=u[c])&&(n=t.call(r,r.__data__,c,s))){"__data__"in r&&(n.__data__=r.__data__);Ja(n,c,o,i,r[o][i]);e.push(n)}else e.push(null)}return Xa(a,o,i)};Uu.selectAll=function(t){var e,n,r,i,o,a=this.id,s=this.namespace,l=[];t=D(t);for(var u=-1,c=this.length;++u<c;)for(var f=this[u],h=-1,d=f.length;++h<d;)if(r=f[h]){o=r[s][a];n=t.call(r,r.__data__,h,u);l.push(e=[]);for(var p=-1,g=n.length;++p<g;){(i=n[p])&&Ja(i,p,s,a,o);e.push(i)}}return Xa(l,s,a)};Uu.filter=function(t){var e,n,r,i=[];"function"!=typeof t&&(t=W(t));for(var o=0,a=this.length;a>o;o++){i.push(e=[]);for(var n=this[o],s=0,l=n.length;l>s;s++)(r=n[s])&&t.call(r,r.__data__,s,o)&&e.push(r)}return Xa(i,this.namespace,this.id)};Uu.tween=function(t,e){var n=this.id,r=this.namespace;return arguments.length<2?this.node()[r][n].tween.get(t):q(this,null==e?function(e){e[r][n].tween.remove(t)}:function(i){i[r][n].tween.set(t,e)})};Uu.attr=function(t,e){function n(){this.removeAttribute(s)}function r(){this.removeAttributeNS(s.space,s.local)}function i(t){return null==t?n:(t+="",function(){var e,n=this.getAttribute(s);return n!==t&&(e=a(n,t),function(t){this.setAttribute(s,e(t))})})}function o(t){return null==t?r:(t+="",function(){var e,n=this.getAttributeNS(s.space,s.local);return n!==t&&(e=a(n,t),function(t){this.setAttributeNS(s.space,s.local,e(t))})})}if(arguments.length<2){for(e in t)this.attr(e,t[e]);return this}var a="transform"==t?Ui:xi,s=is.ns.qualify(t);return Ga(this,"attr."+t,e,s.local?o:i)};Uu.attrTween=function(t,e){function n(t,n){var r=e.call(this,t,n,this.getAttribute(i));return r&&function(t){this.setAttribute(i,r(t))}}function r(t,n){var r=e.call(this,t,n,this.getAttributeNS(i.space,i.local));return r&&function(t){this.setAttributeNS(i.space,i.local,r(t))}}var i=is.ns.qualify(t);return this.tween("attr."+t,i.local?r:n)};Uu.style=function(t,e,n){function r(){this.style.removeProperty(t)}function i(e){return null==e?r:(e+="",function(){var r,i=us.getComputedStyle(this,null).getPropertyValue(t);return i!==e&&(r=xi(i,e),function(e){this.style.setProperty(t,r(e),n)})})}var o=arguments.length;if(3>o){if("string"!=typeof t){2>o&&(e="");for(n in t)this.style(n,t[n],e);return this}n=""}return Ga(this,"style."+t,e,i)};Uu.styleTween=function(t,e,n){function r(r,i){var o=e.call(this,r,i,us.getComputedStyle(this,null).getPropertyValue(t));return o&&function(e){this.style.setProperty(t,o(e),n)}}arguments.length<3&&(n="");return this.tween("style."+t,r)};Uu.text=function(t){return Ga(this,"text",t,$a)};Uu.remove=function(){var t=this.namespace;return this.each("end.transition",function(){var e;this[t].count<2&&(e=this.parentNode)&&e.removeChild(this)})};Uu.ease=function(t){var e=this.id,n=this.namespace;if(arguments.length<1)return this.node()[n][e].ease;"function"!=typeof t&&(t=is.ease.apply(is,arguments));return q(this,function(r){r[n][e].ease=t})};Uu.delay=function(t){var e=this.id,n=this.namespace;return arguments.length<1?this.node()[n][e].delay:q(this,"function"==typeof t?function(r,i,o){r[n][e].delay=+t.call(r,r.__data__,i,o)}:(t=+t,function(r){r[n][e].delay=t}))};Uu.duration=function(t){var e=this.id,n=this.namespace;return arguments.length<1?this.node()[n][e].duration:q(this,"function"==typeof t?function(r,i,o){r[n][e].duration=Math.max(1,t.call(r,r.__data__,i,o))}:(t=Math.max(1,t),function(r){r[n][e].duration=t}))};Uu.each=function(t,e){var n=this.id,r=this.namespace;if(arguments.length<2){var i=zu,o=Wu;try{Wu=n;q(this,function(e,i,o){zu=e[r][n];t.call(e,e.__data__,i,o)})}finally{zu=i;Wu=o}}else q(this,function(i){var o=i[r][n];(o.event||(o.event=is.dispatch("start","end","interrupt"))).on(t,e)});return this};Uu.transition=function(){for(var t,e,n,r,i=this.id,o=++Bu,a=this.namespace,s=[],l=0,u=this.length;u>l;l++){s.push(t=[]);for(var e=this[l],c=0,f=e.length;f>c;c++){if(n=e[c]){r=n[a][i];Ja(n,c,a,o,{time:r.time,ease:r.ease,delay:r.delay+r.duration,duration:r.duration})}t.push(n)}}return Xa(s,a,o)};is.svg.axis=function(){function t(t){t.each(function(){var t,u=is.select(this),c=this.__chart__||n,f=this.__chart__=n.copy(),h=null==l?f.ticks?f.ticks.apply(f,s):f.domain():l,d=null==e?f.tickFormat?f.tickFormat.apply(f,s):De:e,p=u.selectAll(".tick").data(h,f),g=p.enter().insert("g",".domain").attr("class","tick").style("opacity",Hs),m=is.transition(p.exit()).style("opacity",Hs).remove(),v=is.transition(p.order()).style("opacity",1),y=Math.max(i,0)+a,b=zo(f),x=u.selectAll(".domain").data([0]),w=(x.enter().append("path").attr("class","domain"),is.transition(x));g.append("line");g.append("text");var C,S,T,k,_=g.select("line"),M=v.select("line"),D=p.select("text").text(d),L=g.select("text"),A=v.select("text"),N="top"===r||"left"===r?-1:1;if("bottom"===r||"top"===r){t=Ka,C="x",T="y",S="x2",k="y2";D.attr("dy",0>N?"0em":".71em").style("text-anchor","middle");w.attr("d","M"+b[0]+","+N*o+"V0H"+b[1]+"V"+N*o)}else{t=Za,C="y",T="x",S="y2",k="x2";D.attr("dy",".32em").style("text-anchor",0>N?"end":"start");w.attr("d","M"+N*o+","+b[0]+"H0V"+b[1]+"H"+N*o)}_.attr(k,N*i);L.attr(T,N*y);M.attr(S,0).attr(k,N*i);A.attr(C,0).attr(T,N*y);if(f.rangeBand){var E=f,j=E.rangeBand()/2;c=f=function(t){return E(t)+j}}else c.rangeBand?c=f:m.call(t,f,c);g.call(t,c,f);v.call(t,f,f)})}var e,n=is.scale.linear(),r=Vu,i=6,o=6,a=3,s=[10],l=null;t.scale=function(e){if(!arguments.length)return n;n=e;return t};t.orient=function(e){if(!arguments.length)return r;r=e in Xu?e+"":Vu;return t};t.ticks=function(){if(!arguments.length)return s;s=arguments;return t};t.tickValues=function(e){if(!arguments.length)return l;l=e;return t};t.tickFormat=function(n){if(!arguments.length)return e;e=n;return t};t.tickSize=function(e){var n=arguments.length;if(!n)return i;i=+e;o=+arguments[n-1];return t};t.innerTickSize=function(e){if(!arguments.length)return i;i=+e;return t};t.outerTickSize=function(e){if(!arguments.length)return o;o=+e;return t};t.tickPadding=function(e){if(!arguments.length)return a;a=+e;return t};t.tickSubdivide=function(){return arguments.length&&t};return t};var Vu="bottom",Xu={top:1,right:1,bottom:1,left:1};is.svg.brush=function(){function t(o){o.each(function(){var o=is.select(this).style("pointer-events","all").style("-webkit-tap-highlight-color","rgba(0,0,0,0)").on("mousedown.brush",i).on("touchstart.brush",i),a=o.selectAll(".background").data([0]);a.enter().append("rect").attr("class","background").style("visibility","hidden").style("cursor","crosshair");o.selectAll(".extent").data([0]).enter().append("rect").attr("class","extent").style("cursor","move");var s=o.selectAll(".resize").data(p,De);s.exit().remove();s.enter().append("g").attr("class",function(t){return"resize "+t}).style("cursor",function(t){return Gu[t]}).append("rect").attr("x",function(t){return/[ew]$/.test(t)?-3:null}).attr("y",function(t){return/^[ns]/.test(t)?-3:null}).attr("width",6).attr("height",6).style("visibility","hidden");s.style("display",t.empty()?"none":null);var c,f=is.transition(o),h=is.transition(a);if(l){c=zo(l);h.attr("x",c[0]).attr("width",c[1]-c[0]);n(f)}if(u){c=zo(u);h.attr("y",c[0]).attr("height",c[1]-c[0]);r(f)}e(f)})}function e(t){t.selectAll(".resize").attr("transform",function(t){return"translate("+c[+/e$/.test(t)]+","+f[+/^s/.test(t)]+")"})}function n(t){t.select(".extent").attr("x",c[0]);t.selectAll(".extent,.n>rect,.s>rect").attr("width",c[1]-c[0])}function r(t){t.select(".extent").attr("y",f[0]);t.selectAll(".extent,.e>rect,.w>rect").attr("height",f[1]-f[0])}function i(){function i(){if(32==is.event.keyCode){if(!D){y=null;A[0]-=c[1];A[1]-=f[1];D=2}S()}}function p(){if(32==is.event.keyCode&&2==D){A[0]+=c[1];A[1]+=f[1];D=0;S()}}function g(){var t=is.mouse(x),i=!1;if(b){t[0]+=b[0];t[1]+=b[1]}if(!D)if(is.event.altKey){y||(y=[(c[0]+c[1])/2,(f[0]+f[1])/2]);A[0]=c[+(t[0]<y[0])];A[1]=f[+(t[1]<y[1])]}else y=null;if(_&&m(t,l,0)){n(T);i=!0}if(M&&m(t,u,1)){r(T);i=!0}if(i){e(T);C({type:"brush",mode:D?"move":"resize"})}}function m(t,e,n){var r,i,s=zo(e),l=s[0],u=s[1],p=A[n],g=n?f:c,m=g[1]-g[0];if(D){l-=p;u-=m+p}r=(n?d:h)?Math.max(l,Math.min(u,t[n])):t[n];if(D)i=(r+=p)+m;else{y&&(p=Math.max(l,Math.min(u,2*y[n]-r)));if(r>p){i=r;r=p}else i=p}if(g[0]!=r||g[1]!=i){n?a=null:o=null;g[0]=r;g[1]=i;return!0}}function v(){g();T.style("pointer-events","all").selectAll(".resize").style("display",t.empty()?"none":null);is.select("body").style("cursor",null);N.on("mousemove.brush",null).on("mouseup.brush",null).on("touchmove.brush",null).on("touchend.brush",null).on("keydown.brush",null).on("keyup.brush",null);L();C({type:"brushend"})}var y,b,x=this,w=is.select(is.event.target),C=s.of(x,arguments),T=is.select(x),k=w.datum(),_=!/^(n|s)$/.test(k)&&l,M=!/^(e|w)$/.test(k)&&u,D=w.classed("extent"),L=$(),A=is.mouse(x),N=is.select(us).on("keydown.brush",i).on("keyup.brush",p);is.event.changedTouches?N.on("touchmove.brush",g).on("touchend.brush",v):N.on("mousemove.brush",g).on("mouseup.brush",v);T.interrupt().selectAll("*").interrupt();if(D){A[0]=c[0]-A[0];A[1]=f[0]-A[1]}else if(k){var E=+/w$/.test(k),j=+/^n/.test(k);b=[c[1-E]-A[0],f[1-j]-A[1]];A[0]=c[E];A[1]=f[j]}else is.event.altKey&&(y=A.slice());T.style("pointer-events","none").selectAll(".resize").style("display",null);is.select("body").style("cursor",w.style("cursor"));C({type:"brushstart"});g()}var o,a,s=k(t,"brushstart","brush","brushend"),l=null,u=null,c=[0,0],f=[0,0],h=!0,d=!0,p=$u[0];t.event=function(t){t.each(function(){var t=s.of(this,arguments),e={x:c,y:f,i:o,j:a},n=this.__chart__||e;this.__chart__=e;if(Wu)is.select(this).transition().each("start.brush",function(){o=n.i;a=n.j;c=n.x;f=n.y;t({type:"brushstart"})}).tween("brush:brush",function(){var n=wi(c,e.x),r=wi(f,e.y);o=a=null;return function(i){c=e.x=n(i);f=e.y=r(i);t({type:"brush",mode:"resize"})}}).each("end.brush",function(){o=e.i;a=e.j;t({type:"brush",mode:"resize"});t({type:"brushend"})});else{t({type:"brushstart"});t({type:"brush",mode:"resize"});t({type:"brushend"})}})};t.x=function(e){if(!arguments.length)return l;l=e;p=$u[!l<<1|!u];return t};t.y=function(e){if(!arguments.length)return u;u=e;p=$u[!l<<1|!u];return t};t.clamp=function(e){if(!arguments.length)return l&&u?[h,d]:l?h:u?d:null;l&&u?(h=!!e[0],d=!!e[1]):l?h=!!e:u&&(d=!!e);return t};t.extent=function(e){var n,r,i,s,h;if(!arguments.length){if(l)if(o)n=o[0],r=o[1];else{n=c[0],r=c[1];l.invert&&(n=l.invert(n),r=l.invert(r));n>r&&(h=n,n=r,r=h)}if(u)if(a)i=a[0],s=a[1];else{i=f[0],s=f[1];u.invert&&(i=u.invert(i),s=u.invert(s));i>s&&(h=i,i=s,s=h)}return l&&u?[[n,i],[r,s]]:l?[n,r]:u&&[i,s]}if(l){n=e[0],r=e[1];u&&(n=n[0],r=r[0]);o=[n,r];l.invert&&(n=l(n),r=l(r));n>r&&(h=n,n=r,r=h);(n!=c[0]||r!=c[1])&&(c=[n,r])}if(u){i=e[0],s=e[1];l&&(i=i[1],s=s[1]);a=[i,s];u.invert&&(i=u(i),s=u(s));i>s&&(h=i,i=s,s=h);(i!=f[0]||s!=f[1])&&(f=[i,s])}return t};t.clear=function(){if(!t.empty()){c=[0,0],f=[0,0];o=a=null}return t};t.empty=function(){return!!l&&c[0]==c[1]||!!u&&f[0]==f[1]};return is.rebind(t,s,"on")};var Gu={n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},$u=[["n","e","s","w","nw","ne","se","sw"],["e","w"],["n","s"],[]],Yu=pl.format=xl.timeFormat,Ju=Yu.utc,Ku=Ju("%Y-%m-%dT%H:%M:%S.%LZ");Yu.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?Qa:Ku;Qa.parse=function(t){var e=new Date(t);return isNaN(e)?null:e};Qa.toString=Ku.toString;pl.second=ze(function(t){return new gl(1e3*Math.floor(t/1e3))},function(t,e){t.setTime(t.getTime()+1e3*Math.floor(e))},function(t){return t.getSeconds()});pl.seconds=pl.second.range;pl.seconds.utc=pl.second.utc.range;pl.minute=ze(function(t){return new gl(6e4*Math.floor(t/6e4))},function(t,e){t.setTime(t.getTime()+6e4*Math.floor(e))},function(t){return t.getMinutes()});pl.minutes=pl.minute.range;pl.minutes.utc=pl.minute.utc.range;pl.hour=ze(function(t){var e=t.getTimezoneOffset()/60;return new gl(36e5*(Math.floor(t/36e5-e)+e))},function(t,e){t.setTime(t.getTime()+36e5*Math.floor(e))},function(t){return t.getHours()});pl.hours=pl.hour.range;pl.hours.utc=pl.hour.utc.range;pl.month=ze(function(t){t=pl.day(t);t.setDate(1);return t},function(t,e){t.setMonth(t.getMonth()+e)},function(t){return t.getMonth()});pl.months=pl.month.range;pl.months.utc=pl.month.utc.range;var Zu=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],Qu=[[pl.second,1],[pl.second,5],[pl.second,15],[pl.second,30],[pl.minute,1],[pl.minute,5],[pl.minute,15],[pl.minute,30],[pl.hour,1],[pl.hour,3],[pl.hour,6],[pl.hour,12],[pl.day,1],[pl.day,2],[pl.week,1],[pl.month,1],[pl.month,3],[pl.year,1]],tc=Yu.multi([[".%L",function(t){return t.getMilliseconds()}],[":%S",function(t){return t.getSeconds()}],["%I:%M",function(t){return t.getMinutes()}],["%I %p",function(t){return t.getHours()}],["%a %d",function(t){return t.getDay()&&1!=t.getDate()}],["%b %d",function(t){return 1!=t.getDate()}],["%B",function(t){return t.getMonth()}],["%Y",Nn]]),ec={range:function(t,e,n){return is.range(Math.ceil(t/n)*n,+e,n).map(es)},floor:De,ceil:De};Qu.year=pl.year;pl.scale=function(){return ts(is.scale.linear(),Qu,tc)};var nc=Qu.map(function(t){return[t[0].utc,t[1]]}),rc=Ju.multi([[".%L",function(t){return t.getUTCMilliseconds()}],[":%S",function(t){return t.getUTCSeconds()}],["%I:%M",function(t){return t.getUTCMinutes()}],["%I %p",function(t){return t.getUTCHours()}],["%a %d",function(t){return t.getUTCDay()&&1!=t.getUTCDate()}],["%b %d",function(t){return 1!=t.getUTCDate()}],["%B",function(t){return t.getUTCMonth()}],["%Y",Nn]]);nc.year=pl.year.utc;pl.scale.utc=function(){return ts(is.scale.linear(),nc,rc)};is.text=Le(function(t){return t.responseText});is.json=function(t,e){return Ae(t,"application/json",ns,e)};is.html=function(t,e){return Ae(t,"text/html",rs,e)};is.xml=Le(function(t){return t.responseXML});"function"==typeof t&&t.amd?t(is):"object"==typeof n&&n.exports&&(n.exports=is);this.d3=is}()},{}],15:[function(t){var e=t("jquery");(function(t,e){function n(e,n){var i,o,a,s=e.nodeName.toLowerCase();if("area"===s){i=e.parentNode;o=i.name;if(!e.href||!o||"map"!==i.nodeName.toLowerCase())return!1;a=t("img[usemap=#"+o+"]")[0];return!!a&&r(a)}return(/input|select|textarea|button|object/.test(s)?!e.disabled:"a"===s?e.href||n:n)&&r(e)}function r(e){return t.expr.filters.visible(e)&&!t(e).parents().addBack().filter(function(){return"hidden"===t.css(this,"visibility")}).length}var i=0,o=/^ui-id-\d+$/;t.ui=t.ui||{};t.extend(t.ui,{version:"1.10.4",keyCode:{BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}});t.fn.extend({focus:function(e){return function(n,r){return"number"==typeof n?this.each(function(){var e=this;setTimeout(function(){t(e).focus();r&&r.call(e)},n)}):e.apply(this,arguments)}}(t.fn.focus),scrollParent:function(){var e;e=t.ui.ie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(t.css(this,"position"))&&/(auto|scroll)/.test(t.css(this,"overflow")+t.css(this,"overflow-y")+t.css(this,"overflow-x"))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(t.css(this,"overflow")+t.css(this,"overflow-y")+t.css(this,"overflow-x"))}).eq(0);return/fixed/.test(this.css("position"))||!e.length?t(document):e},zIndex:function(n){if(n!==e)return this.css("zIndex",n);if(this.length)for(var r,i,o=t(this[0]);o.length&&o[0]!==document;){r=o.css("position");if("absolute"===r||"relative"===r||"fixed"===r){i=parseInt(o.css("zIndex"),10);if(!isNaN(i)&&0!==i)return i}o=o.parent()}return 0},uniqueId:function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++i)
})},removeUniqueId:function(){return this.each(function(){o.test(this.id)&&t(this).removeAttr("id")})}});t.extend(t.expr[":"],{data:t.expr.createPseudo?t.expr.createPseudo(function(e){return function(n){return!!t.data(n,e)}}):function(e,n,r){return!!t.data(e,r[3])},focusable:function(e){return n(e,!isNaN(t.attr(e,"tabindex")))},tabbable:function(e){var r=t.attr(e,"tabindex"),i=isNaN(r);return(i||r>=0)&&n(e,!i)}});t("<a>").outerWidth(1).jquery||t.each(["Width","Height"],function(n,r){function i(e,n,r,i){t.each(o,function(){n-=parseFloat(t.css(e,"padding"+this))||0;r&&(n-=parseFloat(t.css(e,"border"+this+"Width"))||0);i&&(n-=parseFloat(t.css(e,"margin"+this))||0)});return n}var o="Width"===r?["Left","Right"]:["Top","Bottom"],a=r.toLowerCase(),s={innerWidth:t.fn.innerWidth,innerHeight:t.fn.innerHeight,outerWidth:t.fn.outerWidth,outerHeight:t.fn.outerHeight};t.fn["inner"+r]=function(n){return n===e?s["inner"+r].call(this):this.each(function(){t(this).css(a,i(this,n)+"px")})};t.fn["outer"+r]=function(e,n){return"number"!=typeof e?s["outer"+r].call(this,e):this.each(function(){t(this).css(a,i(this,e,!0,n)+"px")})}});t.fn.addBack||(t.fn.addBack=function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))});t("<a>").data("a-b","a").removeData("a-b").data("a-b")&&(t.fn.removeData=function(e){return function(n){return arguments.length?e.call(this,t.camelCase(n)):e.call(this)}}(t.fn.removeData));t.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase());t.support.selectstart="onselectstart"in document.createElement("div");t.fn.extend({disableSelection:function(){return this.bind((t.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(t){t.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}});t.extend(t.ui,{plugin:{add:function(e,n,r){var i,o=t.ui[e].prototype;for(i in r){o.plugins[i]=o.plugins[i]||[];o.plugins[i].push([n,r[i]])}},call:function(t,e,n){var r,i=t.plugins[e];if(i&&t.element[0].parentNode&&11!==t.element[0].parentNode.nodeType)for(r=0;r<i.length;r++)t.options[i[r][0]]&&i[r][1].apply(t.element,n)}},hasScroll:function(e,n){if("hidden"===t(e).css("overflow"))return!1;var r=n&&"left"===n?"scrollLeft":"scrollTop",i=!1;if(e[r]>0)return!0;e[r]=1;i=e[r]>0;e[r]=0;return i}})})(e)},{jquery:19}],16:[function(t){var e=t("jquery");t("./widget");(function(t){var e=!1;t(document).mouseup(function(){e=!1});t.widget("ui.mouse",{version:"1.10.4",options:{cancel:"input,textarea,button,select,option",distance:1,delay:0},_mouseInit:function(){var e=this;this.element.bind("mousedown."+this.widgetName,function(t){return e._mouseDown(t)}).bind("click."+this.widgetName,function(n){if(!0===t.data(n.target,e.widgetName+".preventClickEvent")){t.removeData(n.target,e.widgetName+".preventClickEvent");n.stopImmediatePropagation();return!1}});this.started=!1},_mouseDestroy:function(){this.element.unbind("."+this.widgetName);this._mouseMoveDelegate&&t(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(n){if(!e){this._mouseStarted&&this._mouseUp(n);this._mouseDownEvent=n;var r=this,i=1===n.which,o="string"==typeof this.options.cancel&&n.target.nodeName?t(n.target).closest(this.options.cancel).length:!1;if(!i||o||!this._mouseCapture(n))return!0;this.mouseDelayMet=!this.options.delay;this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){r.mouseDelayMet=!0},this.options.delay));if(this._mouseDistanceMet(n)&&this._mouseDelayMet(n)){this._mouseStarted=this._mouseStart(n)!==!1;if(!this._mouseStarted){n.preventDefault();return!0}}!0===t.data(n.target,this.widgetName+".preventClickEvent")&&t.removeData(n.target,this.widgetName+".preventClickEvent");this._mouseMoveDelegate=function(t){return r._mouseMove(t)};this._mouseUpDelegate=function(t){return r._mouseUp(t)};t(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);n.preventDefault();e=!0;return!0}},_mouseMove:function(e){if(t.ui.ie&&(!document.documentMode||document.documentMode<9)&&!e.button)return this._mouseUp(e);if(this._mouseStarted){this._mouseDrag(e);return e.preventDefault()}if(this._mouseDistanceMet(e)&&this._mouseDelayMet(e)){this._mouseStarted=this._mouseStart(this._mouseDownEvent,e)!==!1;this._mouseStarted?this._mouseDrag(e):this._mouseUp(e)}return!this._mouseStarted},_mouseUp:function(e){t(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=!1;e.target===this._mouseDownEvent.target&&t.data(e.target,this.widgetName+".preventClickEvent",!0);this._mouseStop(e)}return!1},_mouseDistanceMet:function(t){return Math.max(Math.abs(this._mouseDownEvent.pageX-t.pageX),Math.abs(this._mouseDownEvent.pageY-t.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}})})(e)},{"./widget":18,jquery:19}],17:[function(t){var e=t("jquery");t("./core");t("./mouse");t("./widget");(function(t){function e(t,e,n){return t>e&&e+n>t}function n(t){return/left|right/.test(t.css("float"))||/inline|table-cell/.test(t.css("display"))}t.widget("ui.sortable",t.ui.mouse,{version:"1.10.4",widgetEventPrefix:"sort",ready:!1,options:{appendTo:"parent",axis:!1,connectWith:!1,containment:!1,cursor:"auto",cursorAt:!1,dropOnEmpty:!0,forcePlaceholderSize:!1,forceHelperSize:!1,grid:!1,handle:!1,helper:"original",items:"> *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3,activate:null,beforeStop:null,change:null,deactivate:null,out:null,over:null,receive:null,remove:null,sort:null,start:null,stop:null,update:null},_create:function(){var t=this.options;this.containerCache={};this.element.addClass("ui-sortable");this.refresh();this.floating=this.items.length?"x"===t.axis||n(this.items[0].item):!1;this.offset=this.element.offset();this._mouseInit();this.ready=!0},_destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled");this._mouseDestroy();for(var t=this.items.length-1;t>=0;t--)this.items[t].item.removeData(this.widgetName+"-item");return this},_setOption:function(e,n){if("disabled"===e){this.options[e]=n;this.widget().toggleClass("ui-sortable-disabled",!!n)}else t.Widget.prototype._setOption.apply(this,arguments)},_mouseCapture:function(e,n){var r=null,i=!1,o=this;if(this.reverting)return!1;if(this.options.disabled||"static"===this.options.type)return!1;this._refreshItems(e);t(e.target).parents().each(function(){if(t.data(this,o.widgetName+"-item")===o){r=t(this);return!1}});t.data(e.target,o.widgetName+"-item")===o&&(r=t(e.target));if(!r)return!1;if(this.options.handle&&!n){t(this.options.handle,r).find("*").addBack().each(function(){this===e.target&&(i=!0)});if(!i)return!1}this.currentItem=r;this._removeCurrentsFromItems();return!0},_mouseStart:function(e,n,r){var i,o,a=this.options;this.currentContainer=this;this.refreshPositions();this.helper=this._createHelper(e);this._cacheHelperProportions();this._cacheMargins();this.scrollParent=this.helper.scrollParent();this.offset=this.currentItem.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};t.extend(this.offset,{click:{left:e.pageX-this.offset.left,top:e.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.helper.css("position","absolute");this.cssPosition=this.helper.css("position");this.originalPosition=this._generatePosition(e);this.originalPageX=e.pageX;this.originalPageY=e.pageY;a.cursorAt&&this._adjustOffsetFromHelper(a.cursorAt);this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]};this.helper[0]!==this.currentItem[0]&&this.currentItem.hide();this._createPlaceholder();a.containment&&this._setContainment();if(a.cursor&&"auto"!==a.cursor){o=this.document.find("body");this.storedCursor=o.css("cursor");o.css("cursor",a.cursor);this.storedStylesheet=t("<style>*{ cursor: "+a.cursor+" !important; }</style>").appendTo(o)}if(a.opacity){this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity"));this.helper.css("opacity",a.opacity)}if(a.zIndex){this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex"));this.helper.css("zIndex",a.zIndex)}this.scrollParent[0]!==document&&"HTML"!==this.scrollParent[0].tagName&&(this.overflowOffset=this.scrollParent.offset());this._trigger("start",e,this._uiHash());this._preserveHelperProportions||this._cacheHelperProportions();if(!r)for(i=this.containers.length-1;i>=0;i--)this.containers[i]._trigger("activate",e,this._uiHash(this));t.ui.ddmanager&&(t.ui.ddmanager.current=this);t.ui.ddmanager&&!a.dropBehaviour&&t.ui.ddmanager.prepareOffsets(this,e);this.dragging=!0;this.helper.addClass("ui-sortable-helper");this._mouseDrag(e);return!0},_mouseDrag:function(e){var n,r,i,o,a=this.options,s=!1;this.position=this._generatePosition(e);this.positionAbs=this._convertPositionTo("absolute");this.lastPositionAbs||(this.lastPositionAbs=this.positionAbs);if(this.options.scroll){if(this.scrollParent[0]!==document&&"HTML"!==this.scrollParent[0].tagName){this.overflowOffset.top+this.scrollParent[0].offsetHeight-e.pageY<a.scrollSensitivity?this.scrollParent[0].scrollTop=s=this.scrollParent[0].scrollTop+a.scrollSpeed:e.pageY-this.overflowOffset.top<a.scrollSensitivity&&(this.scrollParent[0].scrollTop=s=this.scrollParent[0].scrollTop-a.scrollSpeed);this.overflowOffset.left+this.scrollParent[0].offsetWidth-e.pageX<a.scrollSensitivity?this.scrollParent[0].scrollLeft=s=this.scrollParent[0].scrollLeft+a.scrollSpeed:e.pageX-this.overflowOffset.left<a.scrollSensitivity&&(this.scrollParent[0].scrollLeft=s=this.scrollParent[0].scrollLeft-a.scrollSpeed)}else{e.pageY-t(document).scrollTop()<a.scrollSensitivity?s=t(document).scrollTop(t(document).scrollTop()-a.scrollSpeed):t(window).height()-(e.pageY-t(document).scrollTop())<a.scrollSensitivity&&(s=t(document).scrollTop(t(document).scrollTop()+a.scrollSpeed));e.pageX-t(document).scrollLeft()<a.scrollSensitivity?s=t(document).scrollLeft(t(document).scrollLeft()-a.scrollSpeed):t(window).width()-(e.pageX-t(document).scrollLeft())<a.scrollSensitivity&&(s=t(document).scrollLeft(t(document).scrollLeft()+a.scrollSpeed))}s!==!1&&t.ui.ddmanager&&!a.dropBehaviour&&t.ui.ddmanager.prepareOffsets(this,e)}this.positionAbs=this._convertPositionTo("absolute");this.options.axis&&"y"===this.options.axis||(this.helper[0].style.left=this.position.left+"px");this.options.axis&&"x"===this.options.axis||(this.helper[0].style.top=this.position.top+"px");for(n=this.items.length-1;n>=0;n--){r=this.items[n];i=r.item[0];o=this._intersectsWithPointer(r);if(o&&r.instance===this.currentContainer&&i!==this.currentItem[0]&&this.placeholder[1===o?"next":"prev"]()[0]!==i&&!t.contains(this.placeholder[0],i)&&("semi-dynamic"===this.options.type?!t.contains(this.element[0],i):!0)){this.direction=1===o?"down":"up";if("pointer"!==this.options.tolerance&&!this._intersectsWithSides(r))break;this._rearrange(e,r);this._trigger("change",e,this._uiHash());break}}this._contactContainers(e);t.ui.ddmanager&&t.ui.ddmanager.drag(this,e);this._trigger("sort",e,this._uiHash());this.lastPositionAbs=this.positionAbs;return!1},_mouseStop:function(e,n){if(e){t.ui.ddmanager&&!this.options.dropBehaviour&&t.ui.ddmanager.drop(this,e);if(this.options.revert){var r=this,i=this.placeholder.offset(),o=this.options.axis,a={};o&&"x"!==o||(a.left=i.left-this.offset.parent.left-this.margins.left+(this.offsetParent[0]===document.body?0:this.offsetParent[0].scrollLeft));o&&"y"!==o||(a.top=i.top-this.offset.parent.top-this.margins.top+(this.offsetParent[0]===document.body?0:this.offsetParent[0].scrollTop));this.reverting=!0;t(this.helper).animate(a,parseInt(this.options.revert,10)||500,function(){r._clear(e)})}else this._clear(e,n);return!1}},cancel:function(){if(this.dragging){this._mouseUp({target:null});"original"===this.options.helper?this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"):this.currentItem.show();for(var e=this.containers.length-1;e>=0;e--){this.containers[e]._trigger("deactivate",null,this._uiHash(this));if(this.containers[e].containerCache.over){this.containers[e]._trigger("out",null,this._uiHash(this));this.containers[e].containerCache.over=0}}}if(this.placeholder){this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]);"original"!==this.options.helper&&this.helper&&this.helper[0].parentNode&&this.helper.remove();t.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null});this.domPosition.prev?t(this.domPosition.prev).after(this.currentItem):t(this.domPosition.parent).prepend(this.currentItem)}return this},serialize:function(e){var n=this._getItemsAsjQuery(e&&e.connected),r=[];e=e||{};t(n).each(function(){var n=(t(e.item||this).attr(e.attribute||"id")||"").match(e.expression||/(.+)[\-=_](.+)/);n&&r.push((e.key||n[1]+"[]")+"="+(e.key&&e.expression?n[1]:n[2]))});!r.length&&e.key&&r.push(e.key+"=");return r.join("&")},toArray:function(e){var n=this._getItemsAsjQuery(e&&e.connected),r=[];e=e||{};n.each(function(){r.push(t(e.item||this).attr(e.attribute||"id")||"")});return r},_intersectsWith:function(t){var e=this.positionAbs.left,n=e+this.helperProportions.width,r=this.positionAbs.top,i=r+this.helperProportions.height,o=t.left,a=o+t.width,s=t.top,l=s+t.height,u=this.offset.click.top,c=this.offset.click.left,f="x"===this.options.axis||r+u>s&&l>r+u,h="y"===this.options.axis||e+c>o&&a>e+c,d=f&&h;return"pointer"===this.options.tolerance||this.options.forcePointerForContainers||"pointer"!==this.options.tolerance&&this.helperProportions[this.floating?"width":"height"]>t[this.floating?"width":"height"]?d:o<e+this.helperProportions.width/2&&n-this.helperProportions.width/2<a&&s<r+this.helperProportions.height/2&&i-this.helperProportions.height/2<l},_intersectsWithPointer:function(t){var n="x"===this.options.axis||e(this.positionAbs.top+this.offset.click.top,t.top,t.height),r="y"===this.options.axis||e(this.positionAbs.left+this.offset.click.left,t.left,t.width),i=n&&r,o=this._getDragVerticalDirection(),a=this._getDragHorizontalDirection();return i?this.floating?a&&"right"===a||"down"===o?2:1:o&&("down"===o?2:1):!1},_intersectsWithSides:function(t){var n=e(this.positionAbs.top+this.offset.click.top,t.top+t.height/2,t.height),r=e(this.positionAbs.left+this.offset.click.left,t.left+t.width/2,t.width),i=this._getDragVerticalDirection(),o=this._getDragHorizontalDirection();return this.floating&&o?"right"===o&&r||"left"===o&&!r:i&&("down"===i&&n||"up"===i&&!n)},_getDragVerticalDirection:function(){var t=this.positionAbs.top-this.lastPositionAbs.top;return 0!==t&&(t>0?"down":"up")},_getDragHorizontalDirection:function(){var t=this.positionAbs.left-this.lastPositionAbs.left;return 0!==t&&(t>0?"right":"left")},refresh:function(t){this._refreshItems(t);this.refreshPositions();return this},_connectWith:function(){var t=this.options;return t.connectWith.constructor===String?[t.connectWith]:t.connectWith},_getItemsAsjQuery:function(e){function n(){s.push(this)}var r,i,o,a,s=[],l=[],u=this._connectWith();if(u&&e)for(r=u.length-1;r>=0;r--){o=t(u[r]);for(i=o.length-1;i>=0;i--){a=t.data(o[i],this.widgetFullName);a&&a!==this&&!a.options.disabled&&l.push([t.isFunction(a.options.items)?a.options.items.call(a.element):t(a.options.items,a.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),a])}}l.push([t.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):t(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]);for(r=l.length-1;r>=0;r--)l[r][0].each(n);return t(s)},_removeCurrentsFromItems:function(){var e=this.currentItem.find(":data("+this.widgetName+"-item)");this.items=t.grep(this.items,function(t){for(var n=0;n<e.length;n++)if(e[n]===t.item[0])return!1;return!0})},_refreshItems:function(e){this.items=[];this.containers=[this];var n,r,i,o,a,s,l,u,c=this.items,f=[[t.isFunction(this.options.items)?this.options.items.call(this.element[0],e,{item:this.currentItem}):t(this.options.items,this.element),this]],h=this._connectWith();if(h&&this.ready)for(n=h.length-1;n>=0;n--){i=t(h[n]);for(r=i.length-1;r>=0;r--){o=t.data(i[r],this.widgetFullName);if(o&&o!==this&&!o.options.disabled){f.push([t.isFunction(o.options.items)?o.options.items.call(o.element[0],e,{item:this.currentItem}):t(o.options.items,o.element),o]);this.containers.push(o)}}}for(n=f.length-1;n>=0;n--){a=f[n][1];s=f[n][0];for(r=0,u=s.length;u>r;r++){l=t(s[r]);l.data(this.widgetName+"-item",a);c.push({item:l,instance:a,width:0,height:0,left:0,top:0})}}},refreshPositions:function(e){this.offsetParent&&this.helper&&(this.offset.parent=this._getParentOffset());var n,r,i,o;for(n=this.items.length-1;n>=0;n--){r=this.items[n];if(r.instance===this.currentContainer||!this.currentContainer||r.item[0]===this.currentItem[0]){i=this.options.toleranceElement?t(this.options.toleranceElement,r.item):r.item;if(!e){r.width=i.outerWidth();r.height=i.outerHeight()}o=i.offset();r.left=o.left;r.top=o.top}}if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(n=this.containers.length-1;n>=0;n--){o=this.containers[n].element.offset();this.containers[n].containerCache.left=o.left;this.containers[n].containerCache.top=o.top;this.containers[n].containerCache.width=this.containers[n].element.outerWidth();this.containers[n].containerCache.height=this.containers[n].element.outerHeight()}return this},_createPlaceholder:function(e){e=e||this;var n,r=e.options;if(!r.placeholder||r.placeholder.constructor===String){n=r.placeholder;r.placeholder={element:function(){var r=e.currentItem[0].nodeName.toLowerCase(),i=t("<"+r+">",e.document[0]).addClass(n||e.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper");"tr"===r?e.currentItem.children().each(function(){t("<td> </td>",e.document[0]).attr("colspan",t(this).attr("colspan")||1).appendTo(i)}):"img"===r&&i.attr("src",e.currentItem.attr("src"));n||i.css("visibility","hidden");return i},update:function(t,i){if(!n||r.forcePlaceholderSize){i.height()||i.height(e.currentItem.innerHeight()-parseInt(e.currentItem.css("paddingTop")||0,10)-parseInt(e.currentItem.css("paddingBottom")||0,10));i.width()||i.width(e.currentItem.innerWidth()-parseInt(e.currentItem.css("paddingLeft")||0,10)-parseInt(e.currentItem.css("paddingRight")||0,10))}}}}e.placeholder=t(r.placeholder.element.call(e.element,e.currentItem));e.currentItem.after(e.placeholder);r.placeholder.update(e,e.placeholder)},_contactContainers:function(r){var i,o,a,s,l,u,c,f,h,d,p=null,g=null;for(i=this.containers.length-1;i>=0;i--)if(!t.contains(this.currentItem[0],this.containers[i].element[0]))if(this._intersectsWith(this.containers[i].containerCache)){if(p&&t.contains(this.containers[i].element[0],p.element[0]))continue;p=this.containers[i];g=i}else if(this.containers[i].containerCache.over){this.containers[i]._trigger("out",r,this._uiHash(this));this.containers[i].containerCache.over=0}if(p)if(1===this.containers.length){if(!this.containers[g].containerCache.over){this.containers[g]._trigger("over",r,this._uiHash(this));this.containers[g].containerCache.over=1}}else{a=1e4;s=null;d=p.floating||n(this.currentItem);l=d?"left":"top";u=d?"width":"height";c=this.positionAbs[l]+this.offset.click[l];for(o=this.items.length-1;o>=0;o--)if(t.contains(this.containers[g].element[0],this.items[o].item[0])&&this.items[o].item[0]!==this.currentItem[0]&&(!d||e(this.positionAbs.top+this.offset.click.top,this.items[o].top,this.items[o].height))){f=this.items[o].item.offset()[l];h=!1;if(Math.abs(f-c)>Math.abs(f+this.items[o][u]-c)){h=!0;f+=this.items[o][u]}if(Math.abs(f-c)<a){a=Math.abs(f-c);s=this.items[o];this.direction=h?"up":"down"}}if(!s&&!this.options.dropOnEmpty)return;if(this.currentContainer===this.containers[g])return;s?this._rearrange(r,s,null,!0):this._rearrange(r,null,this.containers[g].element,!0);this._trigger("change",r,this._uiHash());this.containers[g]._trigger("change",r,this._uiHash(this));this.currentContainer=this.containers[g];this.options.placeholder.update(this.currentContainer,this.placeholder);this.containers[g]._trigger("over",r,this._uiHash(this));this.containers[g].containerCache.over=1}},_createHelper:function(e){var n=this.options,r=t.isFunction(n.helper)?t(n.helper.apply(this.element[0],[e,this.currentItem])):"clone"===n.helper?this.currentItem.clone():this.currentItem;r.parents("body").length||t("parent"!==n.appendTo?n.appendTo:this.currentItem[0].parentNode)[0].appendChild(r[0]);r[0]===this.currentItem[0]&&(this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")});(!r[0].style.width||n.forceHelperSize)&&r.width(this.currentItem.width());(!r[0].style.height||n.forceHelperSize)&&r.height(this.currentItem.height());return r},_adjustOffsetFromHelper:function(e){"string"==typeof e&&(e=e.split(" "));t.isArray(e)&&(e={left:+e[0],top:+e[1]||0});"left"in e&&(this.offset.click.left=e.left+this.margins.left);"right"in e&&(this.offset.click.left=this.helperProportions.width-e.right+this.margins.left);"top"in e&&(this.offset.click.top=e.top+this.margins.top);"bottom"in e&&(this.offset.click.top=this.helperProportions.height-e.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var e=this.offsetParent.offset();if("absolute"===this.cssPosition&&this.scrollParent[0]!==document&&t.contains(this.scrollParent[0],this.offsetParent[0])){e.left+=this.scrollParent.scrollLeft();e.top+=this.scrollParent.scrollTop()}(this.offsetParent[0]===document.body||this.offsetParent[0].tagName&&"html"===this.offsetParent[0].tagName.toLowerCase()&&t.ui.ie)&&(e={top:0,left:0});return{top:e.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:e.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"===this.cssPosition){var t=this.currentItem.position();return{top:t.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:t.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var e,n,r,i=this.options;"parent"===i.containment&&(i.containment=this.helper[0].parentNode);("document"===i.containment||"window"===i.containment)&&(this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,t("document"===i.containment?document:window).width()-this.helperProportions.width-this.margins.left,(t("document"===i.containment?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]);if(!/^(document|window|parent)$/.test(i.containment)){e=t(i.containment)[0];n=t(i.containment).offset();r="hidden"!==t(e).css("overflow");this.containment=[n.left+(parseInt(t(e).css("borderLeftWidth"),10)||0)+(parseInt(t(e).css("paddingLeft"),10)||0)-this.margins.left,n.top+(parseInt(t(e).css("borderTopWidth"),10)||0)+(parseInt(t(e).css("paddingTop"),10)||0)-this.margins.top,n.left+(r?Math.max(e.scrollWidth,e.offsetWidth):e.offsetWidth)-(parseInt(t(e).css("borderLeftWidth"),10)||0)-(parseInt(t(e).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,n.top+(r?Math.max(e.scrollHeight,e.offsetHeight):e.offsetHeight)-(parseInt(t(e).css("borderTopWidth"),10)||0)-(parseInt(t(e).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top]}},_convertPositionTo:function(e,n){n||(n=this.position);var r="absolute"===e?1:-1,i="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&t.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,o=/(html|body)/i.test(i[0].tagName);return{top:n.top+this.offset.relative.top*r+this.offset.parent.top*r-("fixed"===this.cssPosition?-this.scrollParent.scrollTop():o?0:i.scrollTop())*r,left:n.left+this.offset.relative.left*r+this.offset.parent.left*r-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():o?0:i.scrollLeft())*r}},_generatePosition:function(e){var n,r,i=this.options,o=e.pageX,a=e.pageY,s="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&t.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,l=/(html|body)/i.test(s[0].tagName);"relative"!==this.cssPosition||this.scrollParent[0]!==document&&this.scrollParent[0]!==this.offsetParent[0]||(this.offset.relative=this._getRelativeOffset());if(this.originalPosition){if(this.containment){e.pageX-this.offset.click.left<this.containment[0]&&(o=this.containment[0]+this.offset.click.left);e.pageY-this.offset.click.top<this.containment[1]&&(a=this.containment[1]+this.offset.click.top);e.pageX-this.offset.click.left>this.containment[2]&&(o=this.containment[2]+this.offset.click.left);e.pageY-this.offset.click.top>this.containment[3]&&(a=this.containment[3]+this.offset.click.top)}if(i.grid){n=this.originalPageY+Math.round((a-this.originalPageY)/i.grid[1])*i.grid[1];a=this.containment?n-this.offset.click.top>=this.containment[1]&&n-this.offset.click.top<=this.containment[3]?n:n-this.offset.click.top>=this.containment[1]?n-i.grid[1]:n+i.grid[1]:n;r=this.originalPageX+Math.round((o-this.originalPageX)/i.grid[0])*i.grid[0];o=this.containment?r-this.offset.click.left>=this.containment[0]&&r-this.offset.click.left<=this.containment[2]?r:r-this.offset.click.left>=this.containment[0]?r-i.grid[0]:r+i.grid[0]:r}}return{top:a-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():l?0:s.scrollTop()),left:o-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():l?0:s.scrollLeft())}},_rearrange:function(t,e,n,r){n?n[0].appendChild(this.placeholder[0]):e.item[0].parentNode.insertBefore(this.placeholder[0],"down"===this.direction?e.item[0]:e.item[0].nextSibling);this.counter=this.counter?++this.counter:1;var i=this.counter;this._delay(function(){i===this.counter&&this.refreshPositions(!r)})},_clear:function(t,e){function n(t,e,n){return function(r){n._trigger(t,r,e._uiHash(e))}}this.reverting=!1;var r,i=[];!this._noFinalSort&&this.currentItem.parent().length&&this.placeholder.before(this.currentItem);this._noFinalSort=null;if(this.helper[0]===this.currentItem[0]){for(r in this._storedCSS)("auto"===this._storedCSS[r]||"static"===this._storedCSS[r])&&(this._storedCSS[r]="");this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else this.currentItem.show();this.fromOutside&&!e&&i.push(function(t){this._trigger("receive",t,this._uiHash(this.fromOutside))});!this.fromOutside&&this.domPosition.prev===this.currentItem.prev().not(".ui-sortable-helper")[0]&&this.domPosition.parent===this.currentItem.parent()[0]||e||i.push(function(t){this._trigger("update",t,this._uiHash())});if(this!==this.currentContainer&&!e){i.push(function(t){this._trigger("remove",t,this._uiHash())});i.push(function(t){return function(e){t._trigger("receive",e,this._uiHash(this))}}.call(this,this.currentContainer));i.push(function(t){return function(e){t._trigger("update",e,this._uiHash(this))}}.call(this,this.currentContainer))}for(r=this.containers.length-1;r>=0;r--){e||i.push(n("deactivate",this,this.containers[r]));if(this.containers[r].containerCache.over){i.push(n("out",this,this.containers[r]));this.containers[r].containerCache.over=0}}if(this.storedCursor){this.document.find("body").css("cursor",this.storedCursor);this.storedStylesheet.remove()}this._storedOpacity&&this.helper.css("opacity",this._storedOpacity);this._storedZIndex&&this.helper.css("zIndex","auto"===this._storedZIndex?"":this._storedZIndex);this.dragging=!1;if(this.cancelHelperRemoval){if(!e){this._trigger("beforeStop",t,this._uiHash());for(r=0;r<i.length;r++)i[r].call(this,t);this._trigger("stop",t,this._uiHash())}this.fromOutside=!1;return!1}e||this._trigger("beforeStop",t,this._uiHash());this.placeholder[0].parentNode.removeChild(this.placeholder[0]);this.helper[0]!==this.currentItem[0]&&this.helper.remove();this.helper=null;if(!e){for(r=0;r<i.length;r++)i[r].call(this,t);this._trigger("stop",t,this._uiHash())}this.fromOutside=!1;return!0},_trigger:function(){t.Widget.prototype._trigger.apply(this,arguments)===!1&&this.cancel()},_uiHash:function(e){var n=e||this;return{helper:n.helper,placeholder:n.placeholder||t([]),position:n.position,originalPosition:n.originalPosition,offset:n.positionAbs,item:n.currentItem,sender:e?e.element:null}}})})(e)},{"./core":15,"./mouse":16,"./widget":18,jquery:19}],18:[function(t){var e=t("jquery");(function(t,e){var n=0,r=Array.prototype.slice,i=t.cleanData;t.cleanData=function(e){for(var n,r=0;null!=(n=e[r]);r++)try{t(n).triggerHandler("remove")}catch(o){}i(e)};t.widget=function(e,n,r){var i,o,a,s,l={},u=e.split(".")[0];e=e.split(".")[1];i=u+"-"+e;if(!r){r=n;n=t.Widget}t.expr[":"][i.toLowerCase()]=function(e){return!!t.data(e,i)};t[u]=t[u]||{};o=t[u][e];a=t[u][e]=function(t,e){if(!this._createWidget)return new a(t,e);arguments.length&&this._createWidget(t,e);return void 0};t.extend(a,o,{version:r.version,_proto:t.extend({},r),_childConstructors:[]});s=new n;s.options=t.widget.extend({},s.options);t.each(r,function(e,r){l[e]=t.isFunction(r)?function(){var t=function(){return n.prototype[e].apply(this,arguments)},i=function(t){return n.prototype[e].apply(this,t)};return function(){var e,n=this._super,o=this._superApply;this._super=t;this._superApply=i;e=r.apply(this,arguments);this._super=n;this._superApply=o;return e}}():r});a.prototype=t.widget.extend(s,{widgetEventPrefix:o?s.widgetEventPrefix||e:e},l,{constructor:a,namespace:u,widgetName:e,widgetFullName:i});if(o){t.each(o._childConstructors,function(e,n){var r=n.prototype;t.widget(r.namespace+"."+r.widgetName,a,n._proto)});delete o._childConstructors}else n._childConstructors.push(a);t.widget.bridge(e,a)};t.widget.extend=function(n){for(var i,o,a=r.call(arguments,1),s=0,l=a.length;l>s;s++)for(i in a[s]){o=a[s][i];a[s].hasOwnProperty(i)&&o!==e&&(n[i]=t.isPlainObject(o)?t.isPlainObject(n[i])?t.widget.extend({},n[i],o):t.widget.extend({},o):o)}return n};t.widget.bridge=function(n,i){var o=i.prototype.widgetFullName||n;t.fn[n]=function(a){var s="string"==typeof a,l=r.call(arguments,1),u=this;a=!s&&l.length?t.widget.extend.apply(null,[a].concat(l)):a;this.each(s?function(){var r,i=t.data(this,o);if(!i)return t.error("cannot call methods on "+n+" prior to initialization; attempted to call method '"+a+"'");if(!t.isFunction(i[a])||"_"===a.charAt(0))return t.error("no such method '"+a+"' for "+n+" widget instance");r=i[a].apply(i,l);if(r!==i&&r!==e){u=r&&r.jquery?u.pushStack(r.get()):r;return!1}}:function(){var e=t.data(this,o);e?e.option(a||{})._init():t.data(this,o,new i(a,this))});return u}};t.Widget=function(){};t.Widget._childConstructors=[];t.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{disabled:!1,create:null},_createWidget:function(e,r){r=t(r||this.defaultElement||this)[0];this.element=t(r);this.uuid=n++;this.eventNamespace="."+this.widgetName+this.uuid;this.options=t.widget.extend({},this.options,this._getCreateOptions(),e);this.bindings=t();this.hoverable=t();this.focusable=t();if(r!==this){t.data(r,this.widgetFullName,this);
this._on(!0,this.element,{remove:function(t){t.target===r&&this.destroy()}});this.document=t(r.style?r.ownerDocument:r.document||r);this.window=t(this.document[0].defaultView||this.document[0].parentWindow)}this._create();this._trigger("create",null,this._getCreateEventData());this._init()},_getCreateOptions:t.noop,_getCreateEventData:t.noop,_create:t.noop,_init:t.noop,destroy:function(){this._destroy();this.element.unbind(this.eventNamespace).removeData(this.widgetName).removeData(this.widgetFullName).removeData(t.camelCase(this.widgetFullName));this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled ui-state-disabled");this.bindings.unbind(this.eventNamespace);this.hoverable.removeClass("ui-state-hover");this.focusable.removeClass("ui-state-focus")},_destroy:t.noop,widget:function(){return this.element},option:function(n,r){var i,o,a,s=n;if(0===arguments.length)return t.widget.extend({},this.options);if("string"==typeof n){s={};i=n.split(".");n=i.shift();if(i.length){o=s[n]=t.widget.extend({},this.options[n]);for(a=0;a<i.length-1;a++){o[i[a]]=o[i[a]]||{};o=o[i[a]]}n=i.pop();if(1===arguments.length)return o[n]===e?null:o[n];o[n]=r}else{if(1===arguments.length)return this.options[n]===e?null:this.options[n];s[n]=r}}this._setOptions(s);return this},_setOptions:function(t){var e;for(e in t)this._setOption(e,t[e]);return this},_setOption:function(t,e){this.options[t]=e;if("disabled"===t){this.widget().toggleClass(this.widgetFullName+"-disabled ui-state-disabled",!!e).attr("aria-disabled",e);this.hoverable.removeClass("ui-state-hover");this.focusable.removeClass("ui-state-focus")}return this},enable:function(){return this._setOption("disabled",!1)},disable:function(){return this._setOption("disabled",!0)},_on:function(e,n,r){var i,o=this;if("boolean"!=typeof e){r=n;n=e;e=!1}if(r){n=i=t(n);this.bindings=this.bindings.add(n)}else{r=n;n=this.element;i=this.widget()}t.each(r,function(r,a){function s(){return e||o.options.disabled!==!0&&!t(this).hasClass("ui-state-disabled")?("string"==typeof a?o[a]:a).apply(o,arguments):void 0}"string"!=typeof a&&(s.guid=a.guid=a.guid||s.guid||t.guid++);var l=r.match(/^(\w+)\s*(.*)$/),u=l[1]+o.eventNamespace,c=l[2];c?i.delegate(c,u,s):n.bind(u,s)})},_off:function(t,e){e=(e||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace;t.unbind(e).undelegate(e)},_delay:function(t,e){function n(){return("string"==typeof t?r[t]:t).apply(r,arguments)}var r=this;return setTimeout(n,e||0)},_hoverable:function(e){this.hoverable=this.hoverable.add(e);this._on(e,{mouseenter:function(e){t(e.currentTarget).addClass("ui-state-hover")},mouseleave:function(e){t(e.currentTarget).removeClass("ui-state-hover")}})},_focusable:function(e){this.focusable=this.focusable.add(e);this._on(e,{focusin:function(e){t(e.currentTarget).addClass("ui-state-focus")},focusout:function(e){t(e.currentTarget).removeClass("ui-state-focus")}})},_trigger:function(e,n,r){var i,o,a=this.options[e];r=r||{};n=t.Event(n);n.type=(e===this.widgetEventPrefix?e:this.widgetEventPrefix+e).toLowerCase();n.target=this.element[0];o=n.originalEvent;if(o)for(i in o)i in n||(n[i]=o[i]);this.element.trigger(n,r);return!(t.isFunction(a)&&a.apply(this.element[0],[n].concat(r))===!1||n.isDefaultPrevented())}};t.each({show:"fadeIn",hide:"fadeOut"},function(e,n){t.Widget.prototype["_"+e]=function(r,i,o){"string"==typeof i&&(i={effect:i});var a,s=i?i===!0||"number"==typeof i?n:i.effect||n:e;i=i||{};"number"==typeof i&&(i={duration:i});a=!t.isEmptyObject(i);i.complete=o;i.delay&&r.delay(i.delay);a&&t.effects&&t.effects.effect[s]?r[e](i):s!==e&&r[s]?r[s](i.duration,i.easing,o):r.queue(function(n){t(this)[e]();o&&o.call(r[0]);n()})}})})(e)},{jquery:19}],19:[function(e,n){(function(t,e){"object"==typeof n&&"object"==typeof n.exports?n.exports=t.document?e(t,!0):function(t){if(!t.document)throw new Error("jQuery requires a window with a document");return e(t)}:e(t)})("undefined"!=typeof window?window:this,function(e,n){function r(t){var e=t.length,n=oe.type(t);return"function"===n||oe.isWindow(t)?!1:1===t.nodeType&&e?!0:"array"===n||0===e||"number"==typeof e&&e>0&&e-1 in t}function i(t,e,n){if(oe.isFunction(e))return oe.grep(t,function(t,r){return!!e.call(t,r,t)!==n});if(e.nodeType)return oe.grep(t,function(t){return t===e!==n});if("string"==typeof e){if(de.test(e))return oe.filter(e,t,n);e=oe.filter(e,t)}return oe.grep(t,function(t){return oe.inArray(t,e)>=0!==n})}function o(t,e){do t=t[e];while(t&&1!==t.nodeType);return t}function a(t){var e=we[t]={};oe.each(t.match(xe)||[],function(t,n){e[n]=!0});return e}function s(){if(ge.addEventListener){ge.removeEventListener("DOMContentLoaded",l,!1);e.removeEventListener("load",l,!1)}else{ge.detachEvent("onreadystatechange",l);e.detachEvent("onload",l)}}function l(){if(ge.addEventListener||"load"===event.type||"complete"===ge.readyState){s();oe.ready()}}function u(t,e,n){if(void 0===n&&1===t.nodeType){var r="data-"+e.replace(_e,"-$1").toLowerCase();n=t.getAttribute(r);if("string"==typeof n){try{n="true"===n?!0:"false"===n?!1:"null"===n?null:+n+""===n?+n:ke.test(n)?oe.parseJSON(n):n}catch(i){}oe.data(t,e,n)}else n=void 0}return n}function c(t){var e;for(e in t)if(("data"!==e||!oe.isEmptyObject(t[e]))&&"toJSON"!==e)return!1;return!0}function f(t,e,n,r){if(oe.acceptData(t)){var i,o,a=oe.expando,s=t.nodeType,l=s?oe.cache:t,u=s?t[a]:t[a]&&a;if(u&&l[u]&&(r||l[u].data)||void 0!==n||"string"!=typeof e){u||(u=s?t[a]=Y.pop()||oe.guid++:a);l[u]||(l[u]=s?{}:{toJSON:oe.noop});("object"==typeof e||"function"==typeof e)&&(r?l[u]=oe.extend(l[u],e):l[u].data=oe.extend(l[u].data,e));o=l[u];if(!r){o.data||(o.data={});o=o.data}void 0!==n&&(o[oe.camelCase(e)]=n);if("string"==typeof e){i=o[e];null==i&&(i=o[oe.camelCase(e)])}else i=o;return i}}}function h(t,e,n){if(oe.acceptData(t)){var r,i,o=t.nodeType,a=o?oe.cache:t,s=o?t[oe.expando]:oe.expando;if(a[s]){if(e){r=n?a[s]:a[s].data;if(r){if(oe.isArray(e))e=e.concat(oe.map(e,oe.camelCase));else if(e in r)e=[e];else{e=oe.camelCase(e);e=e in r?[e]:e.split(" ")}i=e.length;for(;i--;)delete r[e[i]];if(n?!c(r):!oe.isEmptyObject(r))return}}if(!n){delete a[s].data;if(!c(a[s]))return}o?oe.cleanData([t],!0):re.deleteExpando||a!=a.window?delete a[s]:a[s]=null}}}function d(){return!0}function p(){return!1}function g(){try{return ge.activeElement}catch(t){}}function m(t){var e=Oe.split("|"),n=t.createDocumentFragment();if(n.createElement)for(;e.length;)n.createElement(e.pop());return n}function v(t,e){var n,r,i=0,o=typeof t.getElementsByTagName!==Te?t.getElementsByTagName(e||"*"):typeof t.querySelectorAll!==Te?t.querySelectorAll(e||"*"):void 0;if(!o)for(o=[],n=t.childNodes||t;null!=(r=n[i]);i++)!e||oe.nodeName(r,e)?o.push(r):oe.merge(o,v(r,e));return void 0===e||e&&oe.nodeName(t,e)?oe.merge([t],o):o}function y(t){Ne.test(t.type)&&(t.defaultChecked=t.checked)}function b(t,e){return oe.nodeName(t,"table")&&oe.nodeName(11!==e.nodeType?e:e.firstChild,"tr")?t.getElementsByTagName("tbody")[0]||t.appendChild(t.ownerDocument.createElement("tbody")):t}function x(t){t.type=(null!==oe.find.attr(t,"type"))+"/"+t.type;return t}function w(t){var e=$e.exec(t.type);e?t.type=e[1]:t.removeAttribute("type");return t}function C(t,e){for(var n,r=0;null!=(n=t[r]);r++)oe._data(n,"globalEval",!e||oe._data(e[r],"globalEval"))}function S(t,e){if(1===e.nodeType&&oe.hasData(t)){var n,r,i,o=oe._data(t),a=oe._data(e,o),s=o.events;if(s){delete a.handle;a.events={};for(n in s)for(r=0,i=s[n].length;i>r;r++)oe.event.add(e,n,s[n][r])}a.data&&(a.data=oe.extend({},a.data))}}function T(t,e){var n,r,i;if(1===e.nodeType){n=e.nodeName.toLowerCase();if(!re.noCloneEvent&&e[oe.expando]){i=oe._data(e);for(r in i.events)oe.removeEvent(e,r,i.handle);e.removeAttribute(oe.expando)}if("script"===n&&e.text!==t.text){x(e).text=t.text;w(e)}else if("object"===n){e.parentNode&&(e.outerHTML=t.outerHTML);re.html5Clone&&t.innerHTML&&!oe.trim(e.innerHTML)&&(e.innerHTML=t.innerHTML)}else if("input"===n&&Ne.test(t.type)){e.defaultChecked=e.checked=t.checked;e.value!==t.value&&(e.value=t.value)}else"option"===n?e.defaultSelected=e.selected=t.defaultSelected:("input"===n||"textarea"===n)&&(e.defaultValue=t.defaultValue)}}function k(t,n){var r,i=oe(n.createElement(t)).appendTo(n.body),o=e.getDefaultComputedStyle&&(r=e.getDefaultComputedStyle(i[0]))?r.display:oe.css(i[0],"display");i.detach();return o}function _(t){var e=ge,n=tn[t];if(!n){n=k(t,e);if("none"===n||!n){Qe=(Qe||oe("<iframe frameborder='0' width='0' height='0'/>")).appendTo(e.documentElement);e=(Qe[0].contentWindow||Qe[0].contentDocument).document;e.write();e.close();n=k(t,e);Qe.detach()}tn[t]=n}return n}function M(t,e){return{get:function(){var n=t();if(null!=n){if(!n)return(this.get=e).apply(this,arguments);delete this.get}}}}function D(t,e){if(e in t)return e;for(var n=e.charAt(0).toUpperCase()+e.slice(1),r=e,i=pn.length;i--;){e=pn[i]+n;if(e in t)return e}return r}function L(t,e){for(var n,r,i,o=[],a=0,s=t.length;s>a;a++){r=t[a];if(r.style){o[a]=oe._data(r,"olddisplay");n=r.style.display;if(e){o[a]||"none"!==n||(r.style.display="");""===r.style.display&&Le(r)&&(o[a]=oe._data(r,"olddisplay",_(r.nodeName)))}else{i=Le(r);(n&&"none"!==n||!i)&&oe._data(r,"olddisplay",i?n:oe.css(r,"display"))}}}for(a=0;s>a;a++){r=t[a];r.style&&(e&&"none"!==r.style.display&&""!==r.style.display||(r.style.display=e?o[a]||"":"none"))}return t}function A(t,e,n){var r=cn.exec(e);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):e}function N(t,e,n,r,i){for(var o=n===(r?"border":"content")?4:"width"===e?1:0,a=0;4>o;o+=2){"margin"===n&&(a+=oe.css(t,n+De[o],!0,i));if(r){"content"===n&&(a-=oe.css(t,"padding"+De[o],!0,i));"margin"!==n&&(a-=oe.css(t,"border"+De[o]+"Width",!0,i))}else{a+=oe.css(t,"padding"+De[o],!0,i);"padding"!==n&&(a+=oe.css(t,"border"+De[o]+"Width",!0,i))}}return a}function E(t,e,n){var r=!0,i="width"===e?t.offsetWidth:t.offsetHeight,o=en(t),a=re.boxSizing&&"border-box"===oe.css(t,"boxSizing",!1,o);if(0>=i||null==i){i=nn(t,e,o);(0>i||null==i)&&(i=t.style[e]);if(on.test(i))return i;r=a&&(re.boxSizingReliable()||i===t.style[e]);i=parseFloat(i)||0}return i+N(t,e,n||(a?"border":"content"),r,o)+"px"}function j(t,e,n,r,i){return new j.prototype.init(t,e,n,r,i)}function I(){setTimeout(function(){gn=void 0});return gn=oe.now()}function P(t,e){var n,r={height:t},i=0;e=e?1:0;for(;4>i;i+=2-e){n=De[i];r["margin"+n]=r["padding"+n]=t}e&&(r.opacity=r.width=t);return r}function H(t,e,n){for(var r,i=(wn[e]||[]).concat(wn["*"]),o=0,a=i.length;a>o;o++)if(r=i[o].call(n,e,t))return r}function O(t,e,n){var r,i,o,a,s,l,u,c,f=this,h={},d=t.style,p=t.nodeType&&Le(t),g=oe._data(t,"fxshow");if(!n.queue){s=oe._queueHooks(t,"fx");if(null==s.unqueued){s.unqueued=0;l=s.empty.fire;s.empty.fire=function(){s.unqueued||l()}}s.unqueued++;f.always(function(){f.always(function(){s.unqueued--;oe.queue(t,"fx").length||s.empty.fire()})})}if(1===t.nodeType&&("height"in e||"width"in e)){n.overflow=[d.overflow,d.overflowX,d.overflowY];u=oe.css(t,"display");c="none"===u?oe._data(t,"olddisplay")||_(t.nodeName):u;"inline"===c&&"none"===oe.css(t,"float")&&(re.inlineBlockNeedsLayout&&"inline"!==_(t.nodeName)?d.zoom=1:d.display="inline-block")}if(n.overflow){d.overflow="hidden";re.shrinkWrapBlocks()||f.always(function(){d.overflow=n.overflow[0];d.overflowX=n.overflow[1];d.overflowY=n.overflow[2]})}for(r in e){i=e[r];if(vn.exec(i)){delete e[r];o=o||"toggle"===i;if(i===(p?"hide":"show")){if("show"!==i||!g||void 0===g[r])continue;p=!0}h[r]=g&&g[r]||oe.style(t,r)}else u=void 0}if(oe.isEmptyObject(h))"inline"===("none"===u?_(t.nodeName):u)&&(d.display=u);else{g?"hidden"in g&&(p=g.hidden):g=oe._data(t,"fxshow",{});o&&(g.hidden=!p);p?oe(t).show():f.done(function(){oe(t).hide()});f.done(function(){var e;oe._removeData(t,"fxshow");for(e in h)oe.style(t,e,h[e])});for(r in h){a=H(p?g[r]:0,r,f);if(!(r in g)){g[r]=a.start;if(p){a.end=a.start;a.start="width"===r||"height"===r?1:0}}}}}function R(t,e){var n,r,i,o,a;for(n in t){r=oe.camelCase(n);i=e[r];o=t[n];if(oe.isArray(o)){i=o[1];o=t[n]=o[0]}if(n!==r){t[r]=o;delete t[n]}a=oe.cssHooks[r];if(a&&"expand"in a){o=a.expand(o);delete t[r];for(n in o)if(!(n in t)){t[n]=o[n];e[n]=i}}else e[r]=i}}function F(t,e,n){var r,i,o=0,a=xn.length,s=oe.Deferred().always(function(){delete l.elem}),l=function(){if(i)return!1;for(var e=gn||I(),n=Math.max(0,u.startTime+u.duration-e),r=n/u.duration||0,o=1-r,a=0,l=u.tweens.length;l>a;a++)u.tweens[a].run(o);s.notifyWith(t,[u,o,n]);if(1>o&&l)return n;s.resolveWith(t,[u]);return!1},u=s.promise({elem:t,props:oe.extend({},e),opts:oe.extend(!0,{specialEasing:{}},n),originalProperties:e,originalOptions:n,startTime:gn||I(),duration:n.duration,tweens:[],createTween:function(e,n){var r=oe.Tween(t,u.opts,e,n,u.opts.specialEasing[e]||u.opts.easing);u.tweens.push(r);return r},stop:function(e){var n=0,r=e?u.tweens.length:0;if(i)return this;i=!0;for(;r>n;n++)u.tweens[n].run(1);e?s.resolveWith(t,[u,e]):s.rejectWith(t,[u,e]);return this}}),c=u.props;R(c,u.opts.specialEasing);for(;a>o;o++){r=xn[o].call(u,t,c,u.opts);if(r)return r}oe.map(c,H,u);oe.isFunction(u.opts.start)&&u.opts.start.call(t,u);oe.fx.timer(oe.extend(l,{elem:t,anim:u,queue:u.opts.queue}));return u.progress(u.opts.progress).done(u.opts.done,u.opts.complete).fail(u.opts.fail).always(u.opts.always)}function W(t){return function(e,n){if("string"!=typeof e){n=e;e="*"}var r,i=0,o=e.toLowerCase().match(xe)||[];if(oe.isFunction(n))for(;r=o[i++];)if("+"===r.charAt(0)){r=r.slice(1)||"*";(t[r]=t[r]||[]).unshift(n)}else(t[r]=t[r]||[]).push(n)}}function z(t,e,n,r){function i(s){var l;o[s]=!0;oe.each(t[s]||[],function(t,s){var u=s(e,n,r);if("string"==typeof u&&!a&&!o[u]){e.dataTypes.unshift(u);i(u);return!1}return a?!(l=u):void 0});return l}var o={},a=t===Vn;return i(e.dataTypes[0])||!o["*"]&&i("*")}function q(t,e){var n,r,i=oe.ajaxSettings.flatOptions||{};for(r in e)void 0!==e[r]&&((i[r]?t:n||(n={}))[r]=e[r]);n&&oe.extend(!0,t,n);return t}function U(t,e,n){for(var r,i,o,a,s=t.contents,l=t.dataTypes;"*"===l[0];){l.shift();void 0===i&&(i=t.mimeType||e.getResponseHeader("Content-Type"))}if(i)for(a in s)if(s[a]&&s[a].test(i)){l.unshift(a);break}if(l[0]in n)o=l[0];else{for(a in n){if(!l[0]||t.converters[a+" "+l[0]]){o=a;break}r||(r=a)}o=o||r}if(o){o!==l[0]&&l.unshift(o);return n[o]}}function B(t,e,n,r){var i,o,a,s,l,u={},c=t.dataTypes.slice();if(c[1])for(a in t.converters)u[a.toLowerCase()]=t.converters[a];o=c.shift();for(;o;){t.responseFields[o]&&(n[t.responseFields[o]]=e);!l&&r&&t.dataFilter&&(e=t.dataFilter(e,t.dataType));l=o;o=c.shift();if(o)if("*"===o)o=l;else if("*"!==l&&l!==o){a=u[l+" "+o]||u["* "+o];if(!a)for(i in u){s=i.split(" ");if(s[1]===o){a=u[l+" "+s[0]]||u["* "+s[0]];if(a){if(a===!0)a=u[i];else if(u[i]!==!0){o=s[0];c.unshift(s[1])}break}}}if(a!==!0)if(a&&t["throws"])e=a(e);else try{e=a(e)}catch(f){return{state:"parsererror",error:a?f:"No conversion from "+l+" to "+o}}}}return{state:"success",data:e}}function V(t,e,n,r){var i;if(oe.isArray(e))oe.each(e,function(e,i){n||Yn.test(t)?r(t,i):V(t+"["+("object"==typeof i?e:"")+"]",i,n,r)});else if(n||"object"!==oe.type(e))r(t,e);else for(i in e)V(t+"["+i+"]",e[i],n,r)}function X(){try{return new e.XMLHttpRequest}catch(t){}}function G(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}function $(t){return oe.isWindow(t)?t:9===t.nodeType?t.defaultView||t.parentWindow:!1}var Y=[],J=Y.slice,K=Y.concat,Z=Y.push,Q=Y.indexOf,te={},ee=te.toString,ne=te.hasOwnProperty,re={},ie="1.11.2",oe=function(t,e){return new oe.fn.init(t,e)},ae=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,se=/^-ms-/,le=/-([\da-z])/gi,ue=function(t,e){return e.toUpperCase()};oe.fn=oe.prototype={jquery:ie,constructor:oe,selector:"",length:0,toArray:function(){return J.call(this)},get:function(t){return null!=t?0>t?this[t+this.length]:this[t]:J.call(this)},pushStack:function(t){var e=oe.merge(this.constructor(),t);e.prevObject=this;e.context=this.context;return e},each:function(t,e){return oe.each(this,t,e)},map:function(t){return this.pushStack(oe.map(this,function(e,n){return t.call(e,n,e)}))},slice:function(){return this.pushStack(J.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(t){var e=this.length,n=+t+(0>t?e:0);return this.pushStack(n>=0&&e>n?[this[n]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:Z,sort:Y.sort,splice:Y.splice};oe.extend=oe.fn.extend=function(){var t,e,n,r,i,o,a=arguments[0]||{},s=1,l=arguments.length,u=!1;if("boolean"==typeof a){u=a;a=arguments[s]||{};s++}"object"==typeof a||oe.isFunction(a)||(a={});if(s===l){a=this;s--}for(;l>s;s++)if(null!=(i=arguments[s]))for(r in i){t=a[r];n=i[r];if(a!==n)if(u&&n&&(oe.isPlainObject(n)||(e=oe.isArray(n)))){if(e){e=!1;o=t&&oe.isArray(t)?t:[]}else o=t&&oe.isPlainObject(t)?t:{};a[r]=oe.extend(u,o,n)}else void 0!==n&&(a[r]=n)}return a};oe.extend({expando:"jQuery"+(ie+Math.random()).replace(/\D/g,""),isReady:!0,error:function(t){throw new Error(t)},noop:function(){},isFunction:function(t){return"function"===oe.type(t)},isArray:Array.isArray||function(t){return"array"===oe.type(t)},isWindow:function(t){return null!=t&&t==t.window},isNumeric:function(t){return!oe.isArray(t)&&t-parseFloat(t)+1>=0},isEmptyObject:function(t){var e;for(e in t)return!1;return!0},isPlainObject:function(t){var e;if(!t||"object"!==oe.type(t)||t.nodeType||oe.isWindow(t))return!1;try{if(t.constructor&&!ne.call(t,"constructor")&&!ne.call(t.constructor.prototype,"isPrototypeOf"))return!1}catch(n){return!1}if(re.ownLast)for(e in t)return ne.call(t,e);for(e in t);return void 0===e||ne.call(t,e)},type:function(t){return null==t?t+"":"object"==typeof t||"function"==typeof t?te[ee.call(t)]||"object":typeof t},globalEval:function(t){t&&oe.trim(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(t){return t.replace(se,"ms-").replace(le,ue)},nodeName:function(t,e){return t.nodeName&&t.nodeName.toLowerCase()===e.toLowerCase()},each:function(t,e,n){var i,o=0,a=t.length,s=r(t);if(n)if(s)for(;a>o;o++){i=e.apply(t[o],n);if(i===!1)break}else for(o in t){i=e.apply(t[o],n);if(i===!1)break}else if(s)for(;a>o;o++){i=e.call(t[o],o,t[o]);if(i===!1)break}else for(o in t){i=e.call(t[o],o,t[o]);if(i===!1)break}return t},trim:function(t){return null==t?"":(t+"").replace(ae,"")},makeArray:function(t,e){var n=e||[];null!=t&&(r(Object(t))?oe.merge(n,"string"==typeof t?[t]:t):Z.call(n,t));return n},inArray:function(t,e,n){var r;if(e){if(Q)return Q.call(e,t,n);r=e.length;n=n?0>n?Math.max(0,r+n):n:0;for(;r>n;n++)if(n in e&&e[n]===t)return n}return-1},merge:function(t,e){for(var n=+e.length,r=0,i=t.length;n>r;)t[i++]=e[r++];if(n!==n)for(;void 0!==e[r];)t[i++]=e[r++];t.length=i;return t},grep:function(t,e,n){for(var r,i=[],o=0,a=t.length,s=!n;a>o;o++){r=!e(t[o],o);r!==s&&i.push(t[o])}return i},map:function(t,e,n){var i,o=0,a=t.length,s=r(t),l=[];if(s)for(;a>o;o++){i=e(t[o],o,n);null!=i&&l.push(i)}else for(o in t){i=e(t[o],o,n);null!=i&&l.push(i)}return K.apply([],l)},guid:1,proxy:function(t,e){var n,r,i;if("string"==typeof e){i=t[e];e=t;t=i}if(!oe.isFunction(t))return void 0;n=J.call(arguments,2);r=function(){return t.apply(e||this,n.concat(J.call(arguments)))};r.guid=t.guid=t.guid||oe.guid++;return r},now:function(){return+new Date},support:re});oe.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(t,e){te["[object "+e+"]"]=e.toLowerCase()});var ce=function(t){function e(t,e,n,r){var i,o,a,s,l,u,f,d,p,g;(e?e.ownerDocument||e:W)!==E&&N(e);e=e||E;n=n||[];s=e.nodeType;if("string"!=typeof t||!t||1!==s&&9!==s&&11!==s)return n;if(!r&&I){if(11!==s&&(i=ye.exec(t)))if(a=i[1]){if(9===s){o=e.getElementById(a);if(!o||!o.parentNode)return n;if(o.id===a){n.push(o);return n}}else if(e.ownerDocument&&(o=e.ownerDocument.getElementById(a))&&R(e,o)&&o.id===a){n.push(o);return n}}else{if(i[2]){Z.apply(n,e.getElementsByTagName(t));return n}if((a=i[3])&&w.getElementsByClassName){Z.apply(n,e.getElementsByClassName(a));return n}}if(w.qsa&&(!P||!P.test(t))){d=f=F;p=e;g=1!==s&&t;if(1===s&&"object"!==e.nodeName.toLowerCase()){u=k(t);(f=e.getAttribute("id"))?d=f.replace(xe,"\\$&"):e.setAttribute("id",d);d="[id='"+d+"'] ";l=u.length;for(;l--;)u[l]=d+h(u[l]);p=be.test(t)&&c(e.parentNode)||e;g=u.join(",")}if(g)try{Z.apply(n,p.querySelectorAll(g));return n}catch(m){}finally{f||e.removeAttribute("id")}}}return M(t.replace(le,"$1"),e,n,r)}function n(){function t(n,r){e.push(n+" ")>C.cacheLength&&delete t[e.shift()];return t[n+" "]=r}var e=[];return t}function r(t){t[F]=!0;return t}function i(t){var e=E.createElement("div");try{return!!t(e)}catch(n){return!1}finally{e.parentNode&&e.parentNode.removeChild(e);e=null}}function o(t,e){for(var n=t.split("|"),r=t.length;r--;)C.attrHandle[n[r]]=e}function a(t,e){var n=e&&t,r=n&&1===t.nodeType&&1===e.nodeType&&(~e.sourceIndex||G)-(~t.sourceIndex||G);if(r)return r;if(n)for(;n=n.nextSibling;)if(n===e)return-1;return t?1:-1}function s(t){return function(e){var n=e.nodeName.toLowerCase();return"input"===n&&e.type===t}}function l(t){return function(e){var n=e.nodeName.toLowerCase();return("input"===n||"button"===n)&&e.type===t}}function u(t){return r(function(e){e=+e;return r(function(n,r){for(var i,o=t([],n.length,e),a=o.length;a--;)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))})})}function c(t){return t&&"undefined"!=typeof t.getElementsByTagName&&t}function f(){}function h(t){for(var e=0,n=t.length,r="";n>e;e++)r+=t[e].value;return r}function d(t,e,n){var r=e.dir,i=n&&"parentNode"===r,o=q++;return e.first?function(e,n,o){for(;e=e[r];)if(1===e.nodeType||i)return t(e,n,o)}:function(e,n,a){var s,l,u=[z,o];if(a){for(;e=e[r];)if((1===e.nodeType||i)&&t(e,n,a))return!0}else for(;e=e[r];)if(1===e.nodeType||i){l=e[F]||(e[F]={});if((s=l[r])&&s[0]===z&&s[1]===o)return u[2]=s[2];l[r]=u;if(u[2]=t(e,n,a))return!0}}}function p(t){return t.length>1?function(e,n,r){for(var i=t.length;i--;)if(!t[i](e,n,r))return!1;return!0}:t[0]}function g(t,n,r){for(var i=0,o=n.length;o>i;i++)e(t,n[i],r);return r}function m(t,e,n,r,i){for(var o,a=[],s=0,l=t.length,u=null!=e;l>s;s++)if((o=t[s])&&(!n||n(o,r,i))){a.push(o);u&&e.push(s)}return a}function v(t,e,n,i,o,a){i&&!i[F]&&(i=v(i));o&&!o[F]&&(o=v(o,a));return r(function(r,a,s,l){var u,c,f,h=[],d=[],p=a.length,v=r||g(e||"*",s.nodeType?[s]:s,[]),y=!t||!r&&e?v:m(v,h,t,s,l),b=n?o||(r?t:p||i)?[]:a:y;n&&n(y,b,s,l);if(i){u=m(b,d);i(u,[],s,l);c=u.length;for(;c--;)(f=u[c])&&(b[d[c]]=!(y[d[c]]=f))}if(r){if(o||t){if(o){u=[];c=b.length;for(;c--;)(f=b[c])&&u.push(y[c]=f);o(null,b=[],u,l)}c=b.length;for(;c--;)(f=b[c])&&(u=o?te(r,f):h[c])>-1&&(r[u]=!(a[u]=f))}}else{b=m(b===a?b.splice(p,b.length):b);o?o(null,a,b,l):Z.apply(a,b)}})}function y(t){for(var e,n,r,i=t.length,o=C.relative[t[0].type],a=o||C.relative[" "],s=o?1:0,l=d(function(t){return t===e},a,!0),u=d(function(t){return te(e,t)>-1},a,!0),c=[function(t,n,r){var i=!o&&(r||n!==D)||((e=n).nodeType?l(t,n,r):u(t,n,r));e=null;return i}];i>s;s++)if(n=C.relative[t[s].type])c=[d(p(c),n)];else{n=C.filter[t[s].type].apply(null,t[s].matches);if(n[F]){r=++s;for(;i>r&&!C.relative[t[r].type];r++);return v(s>1&&p(c),s>1&&h(t.slice(0,s-1).concat({value:" "===t[s-2].type?"*":""})).replace(le,"$1"),n,r>s&&y(t.slice(s,r)),i>r&&y(t=t.slice(r)),i>r&&h(t))}c.push(n)}return p(c)}function b(t,n){var i=n.length>0,o=t.length>0,a=function(r,a,s,l,u){var c,f,h,d=0,p="0",g=r&&[],v=[],y=D,b=r||o&&C.find.TAG("*",u),x=z+=null==y?1:Math.random()||.1,w=b.length;u&&(D=a!==E&&a);for(;p!==w&&null!=(c=b[p]);p++){if(o&&c){f=0;for(;h=t[f++];)if(h(c,a,s)){l.push(c);break}u&&(z=x)}if(i){(c=!h&&c)&&d--;r&&g.push(c)}}d+=p;if(i&&p!==d){f=0;for(;h=n[f++];)h(g,v,a,s);if(r){if(d>0)for(;p--;)g[p]||v[p]||(v[p]=J.call(l));v=m(v)}Z.apply(l,v);u&&!r&&v.length>0&&d+n.length>1&&e.uniqueSort(l)}if(u){z=x;D=y}return g};return i?r(a):a}var x,w,C,S,T,k,_,M,D,L,A,N,E,j,I,P,H,O,R,F="sizzle"+1*new Date,W=t.document,z=0,q=0,U=n(),B=n(),V=n(),X=function(t,e){t===e&&(A=!0);return 0},G=1<<31,$={}.hasOwnProperty,Y=[],J=Y.pop,K=Y.push,Z=Y.push,Q=Y.slice,te=function(t,e){for(var n=0,r=t.length;r>n;n++)if(t[n]===e)return n;return-1},ee="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",ne="[\\x20\\t\\r\\n\\f]",re="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",ie=re.replace("w","w#"),oe="\\["+ne+"*("+re+")(?:"+ne+"*([*^$|!~]?=)"+ne+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+ie+"))|)"+ne+"*\\]",ae=":("+re+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+oe+")*)|.*)\\)|)",se=new RegExp(ne+"+","g"),le=new RegExp("^"+ne+"+|((?:^|[^\\\\])(?:\\\\.)*)"+ne+"+$","g"),ue=new RegExp("^"+ne+"*,"+ne+"*"),ce=new RegExp("^"+ne+"*([>+~]|"+ne+")"+ne+"*"),fe=new RegExp("="+ne+"*([^\\]'\"]*?)"+ne+"*\\]","g"),he=new RegExp(ae),de=new RegExp("^"+ie+"$"),pe={ID:new RegExp("^#("+re+")"),CLASS:new RegExp("^\\.("+re+")"),TAG:new RegExp("^("+re.replace("w","w*")+")"),ATTR:new RegExp("^"+oe),PSEUDO:new RegExp("^"+ae),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+ne+"*(even|odd|(([+-]|)(\\d*)n|)"+ne+"*(?:([+-]|)"+ne+"*(\\d+)|))"+ne+"*\\)|)","i"),bool:new RegExp("^(?:"+ee+")$","i"),needsContext:new RegExp("^"+ne+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+ne+"*((?:-\\d)?\\d*)"+ne+"*\\)|)(?=[^-]|$)","i")},ge=/^(?:input|select|textarea|button)$/i,me=/^h\d$/i,ve=/^[^{]+\{\s*\[native \w/,ye=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,be=/[+~]/,xe=/'|\\/g,we=new RegExp("\\\\([\\da-f]{1,6}"+ne+"?|("+ne+")|.)","ig"),Ce=function(t,e,n){var r="0x"+e-65536;return r!==r||n?e:0>r?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,1023&r|56320)},Se=function(){N()};try{Z.apply(Y=Q.call(W.childNodes),W.childNodes);Y[W.childNodes.length].nodeType}catch(Te){Z={apply:Y.length?function(t,e){K.apply(t,Q.call(e))}:function(t,e){for(var n=t.length,r=0;t[n++]=e[r++];);t.length=n-1}}}w=e.support={};T=e.isXML=function(t){var e=t&&(t.ownerDocument||t).documentElement;return e?"HTML"!==e.nodeName:!1};N=e.setDocument=function(t){var e,n,r=t?t.ownerDocument||t:W;if(r===E||9!==r.nodeType||!r.documentElement)return E;E=r;j=r.documentElement;n=r.defaultView;n&&n!==n.top&&(n.addEventListener?n.addEventListener("unload",Se,!1):n.attachEvent&&n.attachEvent("onunload",Se));I=!T(r);w.attributes=i(function(t){t.className="i";return!t.getAttribute("className")});w.getElementsByTagName=i(function(t){t.appendChild(r.createComment(""));return!t.getElementsByTagName("*").length});w.getElementsByClassName=ve.test(r.getElementsByClassName);w.getById=i(function(t){j.appendChild(t).id=F;return!r.getElementsByName||!r.getElementsByName(F).length});if(w.getById){C.find.ID=function(t,e){if("undefined"!=typeof e.getElementById&&I){var n=e.getElementById(t);return n&&n.parentNode?[n]:[]}};C.filter.ID=function(t){var e=t.replace(we,Ce);return function(t){return t.getAttribute("id")===e}}}else{delete C.find.ID;C.filter.ID=function(t){var e=t.replace(we,Ce);return function(t){var n="undefined"!=typeof t.getAttributeNode&&t.getAttributeNode("id");return n&&n.value===e}}}C.find.TAG=w.getElementsByTagName?function(t,e){return"undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t):w.qsa?e.querySelectorAll(t):void 0}:function(t,e){var n,r=[],i=0,o=e.getElementsByTagName(t);if("*"===t){for(;n=o[i++];)1===n.nodeType&&r.push(n);return r}return o};C.find.CLASS=w.getElementsByClassName&&function(t,e){return I?e.getElementsByClassName(t):void 0};H=[];P=[];if(w.qsa=ve.test(r.querySelectorAll)){i(function(t){j.appendChild(t).innerHTML="<a id='"+F+"'></a><select id='"+F+"-\f]' msallowcapture=''><option selected=''></option></select>";t.querySelectorAll("[msallowcapture^='']").length&&P.push("[*^$]="+ne+"*(?:''|\"\")");t.querySelectorAll("[selected]").length||P.push("\\["+ne+"*(?:value|"+ee+")");t.querySelectorAll("[id~="+F+"-]").length||P.push("~=");t.querySelectorAll(":checked").length||P.push(":checked");t.querySelectorAll("a#"+F+"+*").length||P.push(".#.+[+~]")});i(function(t){var e=r.createElement("input");e.setAttribute("type","hidden");t.appendChild(e).setAttribute("name","D");t.querySelectorAll("[name=d]").length&&P.push("name"+ne+"*[*^$|!~]?=");t.querySelectorAll(":enabled").length||P.push(":enabled",":disabled");t.querySelectorAll("*,:x");P.push(",.*:")})}(w.matchesSelector=ve.test(O=j.matches||j.webkitMatchesSelector||j.mozMatchesSelector||j.oMatchesSelector||j.msMatchesSelector))&&i(function(t){w.disconnectedMatch=O.call(t,"div");O.call(t,"[s!='']:x");H.push("!=",ae)});P=P.length&&new RegExp(P.join("|"));H=H.length&&new RegExp(H.join("|"));e=ve.test(j.compareDocumentPosition);R=e||ve.test(j.contains)?function(t,e){var n=9===t.nodeType?t.documentElement:t,r=e&&e.parentNode;return t===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):t.compareDocumentPosition&&16&t.compareDocumentPosition(r)))}:function(t,e){if(e)for(;e=e.parentNode;)if(e===t)return!0;return!1};X=e?function(t,e){if(t===e){A=!0;return 0}var n=!t.compareDocumentPosition-!e.compareDocumentPosition;if(n)return n;n=(t.ownerDocument||t)===(e.ownerDocument||e)?t.compareDocumentPosition(e):1;return 1&n||!w.sortDetached&&e.compareDocumentPosition(t)===n?t===r||t.ownerDocument===W&&R(W,t)?-1:e===r||e.ownerDocument===W&&R(W,e)?1:L?te(L,t)-te(L,e):0:4&n?-1:1}:function(t,e){if(t===e){A=!0;return 0}var n,i=0,o=t.parentNode,s=e.parentNode,l=[t],u=[e];if(!o||!s)return t===r?-1:e===r?1:o?-1:s?1:L?te(L,t)-te(L,e):0;if(o===s)return a(t,e);n=t;for(;n=n.parentNode;)l.unshift(n);n=e;for(;n=n.parentNode;)u.unshift(n);for(;l[i]===u[i];)i++;return i?a(l[i],u[i]):l[i]===W?-1:u[i]===W?1:0};return r};e.matches=function(t,n){return e(t,null,null,n)};e.matchesSelector=function(t,n){(t.ownerDocument||t)!==E&&N(t);n=n.replace(fe,"='$1']");if(!(!w.matchesSelector||!I||H&&H.test(n)||P&&P.test(n)))try{var r=O.call(t,n);if(r||w.disconnectedMatch||t.document&&11!==t.document.nodeType)return r}catch(i){}return e(n,E,null,[t]).length>0};e.contains=function(t,e){(t.ownerDocument||t)!==E&&N(t);return R(t,e)};e.attr=function(t,e){(t.ownerDocument||t)!==E&&N(t);var n=C.attrHandle[e.toLowerCase()],r=n&&$.call(C.attrHandle,e.toLowerCase())?n(t,e,!I):void 0;return void 0!==r?r:w.attributes||!I?t.getAttribute(e):(r=t.getAttributeNode(e))&&r.specified?r.value:null};e.error=function(t){throw new Error("Syntax error, unrecognized expression: "+t)};e.uniqueSort=function(t){var e,n=[],r=0,i=0;A=!w.detectDuplicates;L=!w.sortStable&&t.slice(0);t.sort(X);if(A){for(;e=t[i++];)e===t[i]&&(r=n.push(i));for(;r--;)t.splice(n[r],1)}L=null;return t};S=e.getText=function(t){var e,n="",r=0,i=t.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof t.textContent)return t.textContent;for(t=t.firstChild;t;t=t.nextSibling)n+=S(t)}else if(3===i||4===i)return t.nodeValue}else for(;e=t[r++];)n+=S(e);return n};C=e.selectors={cacheLength:50,createPseudo:r,match:pe,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(t){t[1]=t[1].replace(we,Ce);t[3]=(t[3]||t[4]||t[5]||"").replace(we,Ce);"~="===t[2]&&(t[3]=" "+t[3]+" ");return t.slice(0,4)},CHILD:function(t){t[1]=t[1].toLowerCase();if("nth"===t[1].slice(0,3)){t[3]||e.error(t[0]);t[4]=+(t[4]?t[5]+(t[6]||1):2*("even"===t[3]||"odd"===t[3]));t[5]=+(t[7]+t[8]||"odd"===t[3])}else t[3]&&e.error(t[0]);return t},PSEUDO:function(t){var e,n=!t[6]&&t[2];if(pe.CHILD.test(t[0]))return null;if(t[3])t[2]=t[4]||t[5]||"";else if(n&&he.test(n)&&(e=k(n,!0))&&(e=n.indexOf(")",n.length-e)-n.length)){t[0]=t[0].slice(0,e);t[2]=n.slice(0,e)}return t.slice(0,3)}},filter:{TAG:function(t){var e=t.replace(we,Ce).toLowerCase();return"*"===t?function(){return!0}:function(t){return t.nodeName&&t.nodeName.toLowerCase()===e}},CLASS:function(t){var e=U[t+" "];return e||(e=new RegExp("(^|"+ne+")"+t+"("+ne+"|$)"))&&U(t,function(t){return e.test("string"==typeof t.className&&t.className||"undefined"!=typeof t.getAttribute&&t.getAttribute("class")||"")})},ATTR:function(t,n,r){return function(i){var o=e.attr(i,t);if(null==o)return"!="===n;
if(!n)return!0;o+="";return"="===n?o===r:"!="===n?o!==r:"^="===n?r&&0===o.indexOf(r):"*="===n?r&&o.indexOf(r)>-1:"$="===n?r&&o.slice(-r.length)===r:"~="===n?(" "+o.replace(se," ")+" ").indexOf(r)>-1:"|="===n?o===r||o.slice(0,r.length+1)===r+"-":!1}},CHILD:function(t,e,n,r,i){var o="nth"!==t.slice(0,3),a="last"!==t.slice(-4),s="of-type"===e;return 1===r&&0===i?function(t){return!!t.parentNode}:function(e,n,l){var u,c,f,h,d,p,g=o!==a?"nextSibling":"previousSibling",m=e.parentNode,v=s&&e.nodeName.toLowerCase(),y=!l&&!s;if(m){if(o){for(;g;){f=e;for(;f=f[g];)if(s?f.nodeName.toLowerCase()===v:1===f.nodeType)return!1;p=g="only"===t&&!p&&"nextSibling"}return!0}p=[a?m.firstChild:m.lastChild];if(a&&y){c=m[F]||(m[F]={});u=c[t]||[];d=u[0]===z&&u[1];h=u[0]===z&&u[2];f=d&&m.childNodes[d];for(;f=++d&&f&&f[g]||(h=d=0)||p.pop();)if(1===f.nodeType&&++h&&f===e){c[t]=[z,d,h];break}}else if(y&&(u=(e[F]||(e[F]={}))[t])&&u[0]===z)h=u[1];else for(;f=++d&&f&&f[g]||(h=d=0)||p.pop();)if((s?f.nodeName.toLowerCase()===v:1===f.nodeType)&&++h){y&&((f[F]||(f[F]={}))[t]=[z,h]);if(f===e)break}h-=i;return h===r||h%r===0&&h/r>=0}}},PSEUDO:function(t,n){var i,o=C.pseudos[t]||C.setFilters[t.toLowerCase()]||e.error("unsupported pseudo: "+t);if(o[F])return o(n);if(o.length>1){i=[t,t,"",n];return C.setFilters.hasOwnProperty(t.toLowerCase())?r(function(t,e){for(var r,i=o(t,n),a=i.length;a--;){r=te(t,i[a]);t[r]=!(e[r]=i[a])}}):function(t){return o(t,0,i)}}return o}},pseudos:{not:r(function(t){var e=[],n=[],i=_(t.replace(le,"$1"));return i[F]?r(function(t,e,n,r){for(var o,a=i(t,null,r,[]),s=t.length;s--;)(o=a[s])&&(t[s]=!(e[s]=o))}):function(t,r,o){e[0]=t;i(e,null,o,n);e[0]=null;return!n.pop()}}),has:r(function(t){return function(n){return e(t,n).length>0}}),contains:r(function(t){t=t.replace(we,Ce);return function(e){return(e.textContent||e.innerText||S(e)).indexOf(t)>-1}}),lang:r(function(t){de.test(t||"")||e.error("unsupported lang: "+t);t=t.replace(we,Ce).toLowerCase();return function(e){var n;do if(n=I?e.lang:e.getAttribute("xml:lang")||e.getAttribute("lang")){n=n.toLowerCase();return n===t||0===n.indexOf(t+"-")}while((e=e.parentNode)&&1===e.nodeType);return!1}}),target:function(e){var n=t.location&&t.location.hash;return n&&n.slice(1)===e.id},root:function(t){return t===j},focus:function(t){return t===E.activeElement&&(!E.hasFocus||E.hasFocus())&&!!(t.type||t.href||~t.tabIndex)},enabled:function(t){return t.disabled===!1},disabled:function(t){return t.disabled===!0},checked:function(t){var e=t.nodeName.toLowerCase();return"input"===e&&!!t.checked||"option"===e&&!!t.selected},selected:function(t){t.parentNode&&t.parentNode.selectedIndex;return t.selected===!0},empty:function(t){for(t=t.firstChild;t;t=t.nextSibling)if(t.nodeType<6)return!1;return!0},parent:function(t){return!C.pseudos.empty(t)},header:function(t){return me.test(t.nodeName)},input:function(t){return ge.test(t.nodeName)},button:function(t){var e=t.nodeName.toLowerCase();return"input"===e&&"button"===t.type||"button"===e},text:function(t){var e;return"input"===t.nodeName.toLowerCase()&&"text"===t.type&&(null==(e=t.getAttribute("type"))||"text"===e.toLowerCase())},first:u(function(){return[0]}),last:u(function(t,e){return[e-1]}),eq:u(function(t,e,n){return[0>n?n+e:n]}),even:u(function(t,e){for(var n=0;e>n;n+=2)t.push(n);return t}),odd:u(function(t,e){for(var n=1;e>n;n+=2)t.push(n);return t}),lt:u(function(t,e,n){for(var r=0>n?n+e:n;--r>=0;)t.push(r);return t}),gt:u(function(t,e,n){for(var r=0>n?n+e:n;++r<e;)t.push(r);return t})}};C.pseudos.nth=C.pseudos.eq;for(x in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})C.pseudos[x]=s(x);for(x in{submit:!0,reset:!0})C.pseudos[x]=l(x);f.prototype=C.filters=C.pseudos;C.setFilters=new f;k=e.tokenize=function(t,n){var r,i,o,a,s,l,u,c=B[t+" "];if(c)return n?0:c.slice(0);s=t;l=[];u=C.preFilter;for(;s;){if(!r||(i=ue.exec(s))){i&&(s=s.slice(i[0].length)||s);l.push(o=[])}r=!1;if(i=ce.exec(s)){r=i.shift();o.push({value:r,type:i[0].replace(le," ")});s=s.slice(r.length)}for(a in C.filter)if((i=pe[a].exec(s))&&(!u[a]||(i=u[a](i)))){r=i.shift();o.push({value:r,type:a,matches:i});s=s.slice(r.length)}if(!r)break}return n?s.length:s?e.error(t):B(t,l).slice(0)};_=e.compile=function(t,e){var n,r=[],i=[],o=V[t+" "];if(!o){e||(e=k(t));n=e.length;for(;n--;){o=y(e[n]);o[F]?r.push(o):i.push(o)}o=V(t,b(i,r));o.selector=t}return o};M=e.select=function(t,e,n,r){var i,o,a,s,l,u="function"==typeof t&&t,f=!r&&k(t=u.selector||t);n=n||[];if(1===f.length){o=f[0]=f[0].slice(0);if(o.length>2&&"ID"===(a=o[0]).type&&w.getById&&9===e.nodeType&&I&&C.relative[o[1].type]){e=(C.find.ID(a.matches[0].replace(we,Ce),e)||[])[0];if(!e)return n;u&&(e=e.parentNode);t=t.slice(o.shift().value.length)}i=pe.needsContext.test(t)?0:o.length;for(;i--;){a=o[i];if(C.relative[s=a.type])break;if((l=C.find[s])&&(r=l(a.matches[0].replace(we,Ce),be.test(o[0].type)&&c(e.parentNode)||e))){o.splice(i,1);t=r.length&&h(o);if(!t){Z.apply(n,r);return n}break}}}(u||_(t,f))(r,e,!I,n,be.test(t)&&c(e.parentNode)||e);return n};w.sortStable=F.split("").sort(X).join("")===F;w.detectDuplicates=!!A;N();w.sortDetached=i(function(t){return 1&t.compareDocumentPosition(E.createElement("div"))});i(function(t){t.innerHTML="<a href='#'></a>";return"#"===t.firstChild.getAttribute("href")})||o("type|href|height|width",function(t,e,n){return n?void 0:t.getAttribute(e,"type"===e.toLowerCase()?1:2)});w.attributes&&i(function(t){t.innerHTML="<input/>";t.firstChild.setAttribute("value","");return""===t.firstChild.getAttribute("value")})||o("value",function(t,e,n){return n||"input"!==t.nodeName.toLowerCase()?void 0:t.defaultValue});i(function(t){return null==t.getAttribute("disabled")})||o(ee,function(t,e,n){var r;return n?void 0:t[e]===!0?e.toLowerCase():(r=t.getAttributeNode(e))&&r.specified?r.value:null});return e}(e);oe.find=ce;oe.expr=ce.selectors;oe.expr[":"]=oe.expr.pseudos;oe.unique=ce.uniqueSort;oe.text=ce.getText;oe.isXMLDoc=ce.isXML;oe.contains=ce.contains;var fe=oe.expr.match.needsContext,he=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,de=/^.[^:#\[\.,]*$/;oe.filter=function(t,e,n){var r=e[0];n&&(t=":not("+t+")");return 1===e.length&&1===r.nodeType?oe.find.matchesSelector(r,t)?[r]:[]:oe.find.matches(t,oe.grep(e,function(t){return 1===t.nodeType}))};oe.fn.extend({find:function(t){var e,n=[],r=this,i=r.length;if("string"!=typeof t)return this.pushStack(oe(t).filter(function(){for(e=0;i>e;e++)if(oe.contains(r[e],this))return!0}));for(e=0;i>e;e++)oe.find(t,r[e],n);n=this.pushStack(i>1?oe.unique(n):n);n.selector=this.selector?this.selector+" "+t:t;return n},filter:function(t){return this.pushStack(i(this,t||[],!1))},not:function(t){return this.pushStack(i(this,t||[],!0))},is:function(t){return!!i(this,"string"==typeof t&&fe.test(t)?oe(t):t||[],!1).length}});var pe,ge=e.document,me=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,ve=oe.fn.init=function(t,e){var n,r;if(!t)return this;if("string"==typeof t){n="<"===t.charAt(0)&&">"===t.charAt(t.length-1)&&t.length>=3?[null,t,null]:me.exec(t);if(!n||!n[1]&&e)return!e||e.jquery?(e||pe).find(t):this.constructor(e).find(t);if(n[1]){e=e instanceof oe?e[0]:e;oe.merge(this,oe.parseHTML(n[1],e&&e.nodeType?e.ownerDocument||e:ge,!0));if(he.test(n[1])&&oe.isPlainObject(e))for(n in e)oe.isFunction(this[n])?this[n](e[n]):this.attr(n,e[n]);return this}r=ge.getElementById(n[2]);if(r&&r.parentNode){if(r.id!==n[2])return pe.find(t);this.length=1;this[0]=r}this.context=ge;this.selector=t;return this}if(t.nodeType){this.context=this[0]=t;this.length=1;return this}if(oe.isFunction(t))return"undefined"!=typeof pe.ready?pe.ready(t):t(oe);if(void 0!==t.selector){this.selector=t.selector;this.context=t.context}return oe.makeArray(t,this)};ve.prototype=oe.fn;pe=oe(ge);var ye=/^(?:parents|prev(?:Until|All))/,be={children:!0,contents:!0,next:!0,prev:!0};oe.extend({dir:function(t,e,n){for(var r=[],i=t[e];i&&9!==i.nodeType&&(void 0===n||1!==i.nodeType||!oe(i).is(n));){1===i.nodeType&&r.push(i);i=i[e]}return r},sibling:function(t,e){for(var n=[];t;t=t.nextSibling)1===t.nodeType&&t!==e&&n.push(t);return n}});oe.fn.extend({has:function(t){var e,n=oe(t,this),r=n.length;return this.filter(function(){for(e=0;r>e;e++)if(oe.contains(this,n[e]))return!0})},closest:function(t,e){for(var n,r=0,i=this.length,o=[],a=fe.test(t)||"string"!=typeof t?oe(t,e||this.context):0;i>r;r++)for(n=this[r];n&&n!==e;n=n.parentNode)if(n.nodeType<11&&(a?a.index(n)>-1:1===n.nodeType&&oe.find.matchesSelector(n,t))){o.push(n);break}return this.pushStack(o.length>1?oe.unique(o):o)},index:function(t){return t?"string"==typeof t?oe.inArray(this[0],oe(t)):oe.inArray(t.jquery?t[0]:t,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(t,e){return this.pushStack(oe.unique(oe.merge(this.get(),oe(t,e))))},addBack:function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}});oe.each({parent:function(t){var e=t.parentNode;return e&&11!==e.nodeType?e:null},parents:function(t){return oe.dir(t,"parentNode")},parentsUntil:function(t,e,n){return oe.dir(t,"parentNode",n)},next:function(t){return o(t,"nextSibling")},prev:function(t){return o(t,"previousSibling")},nextAll:function(t){return oe.dir(t,"nextSibling")},prevAll:function(t){return oe.dir(t,"previousSibling")},nextUntil:function(t,e,n){return oe.dir(t,"nextSibling",n)},prevUntil:function(t,e,n){return oe.dir(t,"previousSibling",n)},siblings:function(t){return oe.sibling((t.parentNode||{}).firstChild,t)},children:function(t){return oe.sibling(t.firstChild)},contents:function(t){return oe.nodeName(t,"iframe")?t.contentDocument||t.contentWindow.document:oe.merge([],t.childNodes)}},function(t,e){oe.fn[t]=function(n,r){var i=oe.map(this,e,n);"Until"!==t.slice(-5)&&(r=n);r&&"string"==typeof r&&(i=oe.filter(r,i));if(this.length>1){be[t]||(i=oe.unique(i));ye.test(t)&&(i=i.reverse())}return this.pushStack(i)}});var xe=/\S+/g,we={};oe.Callbacks=function(t){t="string"==typeof t?we[t]||a(t):oe.extend({},t);var e,n,r,i,o,s,l=[],u=!t.once&&[],c=function(a){n=t.memory&&a;r=!0;o=s||0;s=0;i=l.length;e=!0;for(;l&&i>o;o++)if(l[o].apply(a[0],a[1])===!1&&t.stopOnFalse){n=!1;break}e=!1;l&&(u?u.length&&c(u.shift()):n?l=[]:f.disable())},f={add:function(){if(l){var r=l.length;(function o(e){oe.each(e,function(e,n){var r=oe.type(n);"function"===r?t.unique&&f.has(n)||l.push(n):n&&n.length&&"string"!==r&&o(n)})})(arguments);if(e)i=l.length;else if(n){s=r;c(n)}}return this},remove:function(){l&&oe.each(arguments,function(t,n){for(var r;(r=oe.inArray(n,l,r))>-1;){l.splice(r,1);if(e){i>=r&&i--;o>=r&&o--}}});return this},has:function(t){return t?oe.inArray(t,l)>-1:!(!l||!l.length)},empty:function(){l=[];i=0;return this},disable:function(){l=u=n=void 0;return this},disabled:function(){return!l},lock:function(){u=void 0;n||f.disable();return this},locked:function(){return!u},fireWith:function(t,n){if(l&&(!r||u)){n=n||[];n=[t,n.slice?n.slice():n];e?u.push(n):c(n)}return this},fire:function(){f.fireWith(this,arguments);return this},fired:function(){return!!r}};return f};oe.extend({Deferred:function(t){var e=[["resolve","done",oe.Callbacks("once memory"),"resolved"],["reject","fail",oe.Callbacks("once memory"),"rejected"],["notify","progress",oe.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){i.done(arguments).fail(arguments);return this},then:function(){var t=arguments;return oe.Deferred(function(n){oe.each(e,function(e,o){var a=oe.isFunction(t[e])&&t[e];i[o[1]](function(){var t=a&&a.apply(this,arguments);t&&oe.isFunction(t.promise)?t.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[o[0]+"With"](this===r?n.promise():this,a?[t]:arguments)})});t=null}).promise()},promise:function(t){return null!=t?oe.extend(t,r):r}},i={};r.pipe=r.then;oe.each(e,function(t,o){var a=o[2],s=o[3];r[o[1]]=a.add;s&&a.add(function(){n=s},e[1^t][2].disable,e[2][2].lock);i[o[0]]=function(){i[o[0]+"With"](this===i?r:this,arguments);return this};i[o[0]+"With"]=a.fireWith});r.promise(i);t&&t.call(i,i);return i},when:function(t){var e,n,r,i=0,o=J.call(arguments),a=o.length,s=1!==a||t&&oe.isFunction(t.promise)?a:0,l=1===s?t:oe.Deferred(),u=function(t,n,r){return function(i){n[t]=this;r[t]=arguments.length>1?J.call(arguments):i;r===e?l.notifyWith(n,r):--s||l.resolveWith(n,r)}};if(a>1){e=new Array(a);n=new Array(a);r=new Array(a);for(;a>i;i++)o[i]&&oe.isFunction(o[i].promise)?o[i].promise().done(u(i,r,o)).fail(l.reject).progress(u(i,n,e)):--s}s||l.resolveWith(r,o);return l.promise()}});var Ce;oe.fn.ready=function(t){oe.ready.promise().done(t);return this};oe.extend({isReady:!1,readyWait:1,holdReady:function(t){t?oe.readyWait++:oe.ready(!0)},ready:function(t){if(t===!0?!--oe.readyWait:!oe.isReady){if(!ge.body)return setTimeout(oe.ready);oe.isReady=!0;if(!(t!==!0&&--oe.readyWait>0)){Ce.resolveWith(ge,[oe]);if(oe.fn.triggerHandler){oe(ge).triggerHandler("ready");oe(ge).off("ready")}}}}});oe.ready.promise=function(t){if(!Ce){Ce=oe.Deferred();if("complete"===ge.readyState)setTimeout(oe.ready);else if(ge.addEventListener){ge.addEventListener("DOMContentLoaded",l,!1);e.addEventListener("load",l,!1)}else{ge.attachEvent("onreadystatechange",l);e.attachEvent("onload",l);var n=!1;try{n=null==e.frameElement&&ge.documentElement}catch(r){}n&&n.doScroll&&function i(){if(!oe.isReady){try{n.doScroll("left")}catch(t){return setTimeout(i,50)}s();oe.ready()}}()}}return Ce.promise(t)};var Se,Te="undefined";for(Se in oe(re))break;re.ownLast="0"!==Se;re.inlineBlockNeedsLayout=!1;oe(function(){var t,e,n,r;n=ge.getElementsByTagName("body")[0];if(n&&n.style){e=ge.createElement("div");r=ge.createElement("div");r.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px";n.appendChild(r).appendChild(e);if(typeof e.style.zoom!==Te){e.style.cssText="display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1";re.inlineBlockNeedsLayout=t=3===e.offsetWidth;t&&(n.style.zoom=1)}n.removeChild(r)}});(function(){var t=ge.createElement("div");if(null==re.deleteExpando){re.deleteExpando=!0;try{delete t.test}catch(e){re.deleteExpando=!1}}t=null})();oe.acceptData=function(t){var e=oe.noData[(t.nodeName+" ").toLowerCase()],n=+t.nodeType||1;return 1!==n&&9!==n?!1:!e||e!==!0&&t.getAttribute("classid")===e};var ke=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,_e=/([A-Z])/g;oe.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(t){t=t.nodeType?oe.cache[t[oe.expando]]:t[oe.expando];return!!t&&!c(t)},data:function(t,e,n){return f(t,e,n)},removeData:function(t,e){return h(t,e)},_data:function(t,e,n){return f(t,e,n,!0)},_removeData:function(t,e){return h(t,e,!0)}});oe.fn.extend({data:function(t,e){var n,r,i,o=this[0],a=o&&o.attributes;if(void 0===t){if(this.length){i=oe.data(o);if(1===o.nodeType&&!oe._data(o,"parsedAttrs")){n=a.length;for(;n--;)if(a[n]){r=a[n].name;if(0===r.indexOf("data-")){r=oe.camelCase(r.slice(5));u(o,r,i[r])}}oe._data(o,"parsedAttrs",!0)}}return i}return"object"==typeof t?this.each(function(){oe.data(this,t)}):arguments.length>1?this.each(function(){oe.data(this,t,e)}):o?u(o,t,oe.data(o,t)):void 0},removeData:function(t){return this.each(function(){oe.removeData(this,t)})}});oe.extend({queue:function(t,e,n){var r;if(t){e=(e||"fx")+"queue";r=oe._data(t,e);n&&(!r||oe.isArray(n)?r=oe._data(t,e,oe.makeArray(n)):r.push(n));return r||[]}},dequeue:function(t,e){e=e||"fx";var n=oe.queue(t,e),r=n.length,i=n.shift(),o=oe._queueHooks(t,e),a=function(){oe.dequeue(t,e)};if("inprogress"===i){i=n.shift();r--}if(i){"fx"===e&&n.unshift("inprogress");delete o.stop;i.call(t,a,o)}!r&&o&&o.empty.fire()},_queueHooks:function(t,e){var n=e+"queueHooks";return oe._data(t,n)||oe._data(t,n,{empty:oe.Callbacks("once memory").add(function(){oe._removeData(t,e+"queue");oe._removeData(t,n)})})}});oe.fn.extend({queue:function(t,e){var n=2;if("string"!=typeof t){e=t;t="fx";n--}return arguments.length<n?oe.queue(this[0],t):void 0===e?this:this.each(function(){var n=oe.queue(this,t,e);oe._queueHooks(this,t);"fx"===t&&"inprogress"!==n[0]&&oe.dequeue(this,t)})},dequeue:function(t){return this.each(function(){oe.dequeue(this,t)})},clearQueue:function(t){return this.queue(t||"fx",[])},promise:function(t,e){var n,r=1,i=oe.Deferred(),o=this,a=this.length,s=function(){--r||i.resolveWith(o,[o])};if("string"!=typeof t){e=t;t=void 0}t=t||"fx";for(;a--;){n=oe._data(o[a],t+"queueHooks");if(n&&n.empty){r++;n.empty.add(s)}}s();return i.promise(e)}});var Me=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,De=["Top","Right","Bottom","Left"],Le=function(t,e){t=e||t;return"none"===oe.css(t,"display")||!oe.contains(t.ownerDocument,t)},Ae=oe.access=function(t,e,n,r,i,o,a){var s=0,l=t.length,u=null==n;if("object"===oe.type(n)){i=!0;for(s in n)oe.access(t,e,s,n[s],!0,o,a)}else if(void 0!==r){i=!0;oe.isFunction(r)||(a=!0);if(u)if(a){e.call(t,r);e=null}else{u=e;e=function(t,e,n){return u.call(oe(t),n)}}if(e)for(;l>s;s++)e(t[s],n,a?r:r.call(t[s],s,e(t[s],n)))}return i?t:u?e.call(t):l?e(t[0],n):o},Ne=/^(?:checkbox|radio)$/i;(function(){var t=ge.createElement("input"),e=ge.createElement("div"),n=ge.createDocumentFragment();e.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";re.leadingWhitespace=3===e.firstChild.nodeType;re.tbody=!e.getElementsByTagName("tbody").length;re.htmlSerialize=!!e.getElementsByTagName("link").length;re.html5Clone="<:nav></:nav>"!==ge.createElement("nav").cloneNode(!0).outerHTML;t.type="checkbox";t.checked=!0;n.appendChild(t);re.appendChecked=t.checked;e.innerHTML="<textarea>x</textarea>";re.noCloneChecked=!!e.cloneNode(!0).lastChild.defaultValue;n.appendChild(e);e.innerHTML="<input type='radio' checked='checked' name='t'/>";re.checkClone=e.cloneNode(!0).cloneNode(!0).lastChild.checked;re.noCloneEvent=!0;if(e.attachEvent){e.attachEvent("onclick",function(){re.noCloneEvent=!1});e.cloneNode(!0).click()}if(null==re.deleteExpando){re.deleteExpando=!0;try{delete e.test}catch(r){re.deleteExpando=!1}}})();(function(){var t,n,r=ge.createElement("div");for(t in{submit:!0,change:!0,focusin:!0}){n="on"+t;if(!(re[t+"Bubbles"]=n in e)){r.setAttribute(n,"t");re[t+"Bubbles"]=r.attributes[n].expando===!1}}r=null})();var Ee=/^(?:input|select|textarea)$/i,je=/^key/,Ie=/^(?:mouse|pointer|contextmenu)|click/,Pe=/^(?:focusinfocus|focusoutblur)$/,He=/^([^.]*)(?:\.(.+)|)$/;oe.event={global:{},add:function(t,e,n,r,i){var o,a,s,l,u,c,f,h,d,p,g,m=oe._data(t);if(m){if(n.handler){l=n;n=l.handler;i=l.selector}n.guid||(n.guid=oe.guid++);(a=m.events)||(a=m.events={});if(!(c=m.handle)){c=m.handle=function(t){return typeof oe===Te||t&&oe.event.triggered===t.type?void 0:oe.event.dispatch.apply(c.elem,arguments)};c.elem=t}e=(e||"").match(xe)||[""];s=e.length;for(;s--;){o=He.exec(e[s])||[];d=g=o[1];p=(o[2]||"").split(".").sort();if(d){u=oe.event.special[d]||{};d=(i?u.delegateType:u.bindType)||d;u=oe.event.special[d]||{};f=oe.extend({type:d,origType:g,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&oe.expr.match.needsContext.test(i),namespace:p.join(".")},l);if(!(h=a[d])){h=a[d]=[];h.delegateCount=0;u.setup&&u.setup.call(t,r,p,c)!==!1||(t.addEventListener?t.addEventListener(d,c,!1):t.attachEvent&&t.attachEvent("on"+d,c))}if(u.add){u.add.call(t,f);f.handler.guid||(f.handler.guid=n.guid)}i?h.splice(h.delegateCount++,0,f):h.push(f);oe.event.global[d]=!0}}t=null}},remove:function(t,e,n,r,i){var o,a,s,l,u,c,f,h,d,p,g,m=oe.hasData(t)&&oe._data(t);if(m&&(c=m.events)){e=(e||"").match(xe)||[""];u=e.length;for(;u--;){s=He.exec(e[u])||[];d=g=s[1];p=(s[2]||"").split(".").sort();if(d){f=oe.event.special[d]||{};d=(r?f.delegateType:f.bindType)||d;h=c[d]||[];s=s[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)");l=o=h.length;for(;o--;){a=h[o];if(!(!i&&g!==a.origType||n&&n.guid!==a.guid||s&&!s.test(a.namespace)||r&&r!==a.selector&&("**"!==r||!a.selector))){h.splice(o,1);a.selector&&h.delegateCount--;f.remove&&f.remove.call(t,a)}}if(l&&!h.length){f.teardown&&f.teardown.call(t,p,m.handle)!==!1||oe.removeEvent(t,d,m.handle);delete c[d]}}else for(d in c)oe.event.remove(t,d+e[u],n,r,!0)}if(oe.isEmptyObject(c)){delete m.handle;oe._removeData(t,"events")}}},trigger:function(t,n,r,i){var o,a,s,l,u,c,f,h=[r||ge],d=ne.call(t,"type")?t.type:t,p=ne.call(t,"namespace")?t.namespace.split("."):[];s=c=r=r||ge;if(3!==r.nodeType&&8!==r.nodeType&&!Pe.test(d+oe.event.triggered)){if(d.indexOf(".")>=0){p=d.split(".");d=p.shift();p.sort()}a=d.indexOf(":")<0&&"on"+d;t=t[oe.expando]?t:new oe.Event(d,"object"==typeof t&&t);t.isTrigger=i?2:3;t.namespace=p.join(".");t.namespace_re=t.namespace?new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"):null;t.result=void 0;t.target||(t.target=r);n=null==n?[t]:oe.makeArray(n,[t]);u=oe.event.special[d]||{};if(i||!u.trigger||u.trigger.apply(r,n)!==!1){if(!i&&!u.noBubble&&!oe.isWindow(r)){l=u.delegateType||d;Pe.test(l+d)||(s=s.parentNode);for(;s;s=s.parentNode){h.push(s);c=s}c===(r.ownerDocument||ge)&&h.push(c.defaultView||c.parentWindow||e)}f=0;for(;(s=h[f++])&&!t.isPropagationStopped();){t.type=f>1?l:u.bindType||d;o=(oe._data(s,"events")||{})[t.type]&&oe._data(s,"handle");o&&o.apply(s,n);o=a&&s[a];if(o&&o.apply&&oe.acceptData(s)){t.result=o.apply(s,n);t.result===!1&&t.preventDefault()}}t.type=d;if(!i&&!t.isDefaultPrevented()&&(!u._default||u._default.apply(h.pop(),n)===!1)&&oe.acceptData(r)&&a&&r[d]&&!oe.isWindow(r)){c=r[a];c&&(r[a]=null);oe.event.triggered=d;try{r[d]()}catch(g){}oe.event.triggered=void 0;c&&(r[a]=c)}return t.result}}},dispatch:function(t){t=oe.event.fix(t);var e,n,r,i,o,a=[],s=J.call(arguments),l=(oe._data(this,"events")||{})[t.type]||[],u=oe.event.special[t.type]||{};s[0]=t;t.delegateTarget=this;if(!u.preDispatch||u.preDispatch.call(this,t)!==!1){a=oe.event.handlers.call(this,t,l);e=0;for(;(i=a[e++])&&!t.isPropagationStopped();){t.currentTarget=i.elem;o=0;for(;(r=i.handlers[o++])&&!t.isImmediatePropagationStopped();)if(!t.namespace_re||t.namespace_re.test(r.namespace)){t.handleObj=r;t.data=r.data;n=((oe.event.special[r.origType]||{}).handle||r.handler).apply(i.elem,s);if(void 0!==n&&(t.result=n)===!1){t.preventDefault();t.stopPropagation()}}}u.postDispatch&&u.postDispatch.call(this,t);return t.result}},handlers:function(t,e){var n,r,i,o,a=[],s=e.delegateCount,l=t.target;if(s&&l.nodeType&&(!t.button||"click"!==t.type))for(;l!=this;l=l.parentNode||this)if(1===l.nodeType&&(l.disabled!==!0||"click"!==t.type)){i=[];for(o=0;s>o;o++){r=e[o];n=r.selector+" ";void 0===i[n]&&(i[n]=r.needsContext?oe(n,this).index(l)>=0:oe.find(n,this,null,[l]).length);i[n]&&i.push(r)}i.length&&a.push({elem:l,handlers:i})}s<e.length&&a.push({elem:this,handlers:e.slice(s)});return a},fix:function(t){if(t[oe.expando])return t;var e,n,r,i=t.type,o=t,a=this.fixHooks[i];a||(this.fixHooks[i]=a=Ie.test(i)?this.mouseHooks:je.test(i)?this.keyHooks:{});r=a.props?this.props.concat(a.props):this.props;t=new oe.Event(o);e=r.length;for(;e--;){n=r[e];t[n]=o[n]}t.target||(t.target=o.srcElement||ge);3===t.target.nodeType&&(t.target=t.target.parentNode);t.metaKey=!!t.metaKey;return a.filter?a.filter(t,o):t},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(t,e){null==t.which&&(t.which=null!=e.charCode?e.charCode:e.keyCode);return t}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(t,e){var n,r,i,o=e.button,a=e.fromElement;if(null==t.pageX&&null!=e.clientX){r=t.target.ownerDocument||ge;i=r.documentElement;n=r.body;t.pageX=e.clientX+(i&&i.scrollLeft||n&&n.scrollLeft||0)-(i&&i.clientLeft||n&&n.clientLeft||0);t.pageY=e.clientY+(i&&i.scrollTop||n&&n.scrollTop||0)-(i&&i.clientTop||n&&n.clientTop||0)}!t.relatedTarget&&a&&(t.relatedTarget=a===t.target?e.toElement:a);t.which||void 0===o||(t.which=1&o?1:2&o?3:4&o?2:0);return t}},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==g()&&this.focus)try{this.focus();return!1}catch(t){}},delegateType:"focusin"},blur:{trigger:function(){if(this===g()&&this.blur){this.blur();return!1}},delegateType:"focusout"},click:{trigger:function(){if(oe.nodeName(this,"input")&&"checkbox"===this.type&&this.click){this.click();return!1}},_default:function(t){return oe.nodeName(t.target,"a")}},beforeunload:{postDispatch:function(t){void 0!==t.result&&t.originalEvent&&(t.originalEvent.returnValue=t.result)}}},simulate:function(t,e,n,r){var i=oe.extend(new oe.Event,n,{type:t,isSimulated:!0,originalEvent:{}});r?oe.event.trigger(i,null,e):oe.event.dispatch.call(e,i);i.isDefaultPrevented()&&n.preventDefault()}};oe.removeEvent=ge.removeEventListener?function(t,e,n){t.removeEventListener&&t.removeEventListener(e,n,!1)}:function(t,e,n){var r="on"+e;if(t.detachEvent){typeof t[r]===Te&&(t[r]=null);t.detachEvent(r,n)}};oe.Event=function(t,e){if(!(this instanceof oe.Event))return new oe.Event(t,e);if(t&&t.type){this.originalEvent=t;this.type=t.type;this.isDefaultPrevented=t.defaultPrevented||void 0===t.defaultPrevented&&t.returnValue===!1?d:p}else this.type=t;e&&oe.extend(this,e);this.timeStamp=t&&t.timeStamp||oe.now();this[oe.expando]=!0};oe.Event.prototype={isDefaultPrevented:p,isPropagationStopped:p,isImmediatePropagationStopped:p,preventDefault:function(){var t=this.originalEvent;this.isDefaultPrevented=d;t&&(t.preventDefault?t.preventDefault():t.returnValue=!1)},stopPropagation:function(){var t=this.originalEvent;this.isPropagationStopped=d;if(t){t.stopPropagation&&t.stopPropagation();t.cancelBubble=!0}},stopImmediatePropagation:function(){var t=this.originalEvent;this.isImmediatePropagationStopped=d;t&&t.stopImmediatePropagation&&t.stopImmediatePropagation();this.stopPropagation()}};oe.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(t,e){oe.event.special[t]={delegateType:e,bindType:e,handle:function(t){var n,r=this,i=t.relatedTarget,o=t.handleObj;if(!i||i!==r&&!oe.contains(r,i)){t.type=o.origType;n=o.handler.apply(this,arguments);t.type=e}return n}}});re.submitBubbles||(oe.event.special.submit={setup:function(){if(oe.nodeName(this,"form"))return!1;oe.event.add(this,"click._submit keypress._submit",function(t){var e=t.target,n=oe.nodeName(e,"input")||oe.nodeName(e,"button")?e.form:void 0;if(n&&!oe._data(n,"submitBubbles")){oe.event.add(n,"submit._submit",function(t){t._submit_bubble=!0});oe._data(n,"submitBubbles",!0)}});return void 0},postDispatch:function(t){if(t._submit_bubble){delete t._submit_bubble;this.parentNode&&!t.isTrigger&&oe.event.simulate("submit",this.parentNode,t,!0)}},teardown:function(){if(oe.nodeName(this,"form"))return!1;oe.event.remove(this,"._submit");return void 0}});re.changeBubbles||(oe.event.special.change={setup:function(){if(Ee.test(this.nodeName)){if("checkbox"===this.type||"radio"===this.type){oe.event.add(this,"propertychange._change",function(t){"checked"===t.originalEvent.propertyName&&(this._just_changed=!0)});oe.event.add(this,"click._change",function(t){this._just_changed&&!t.isTrigger&&(this._just_changed=!1);oe.event.simulate("change",this,t,!0)})}return!1}oe.event.add(this,"beforeactivate._change",function(t){var e=t.target;if(Ee.test(e.nodeName)&&!oe._data(e,"changeBubbles")){oe.event.add(e,"change._change",function(t){!this.parentNode||t.isSimulated||t.isTrigger||oe.event.simulate("change",this.parentNode,t,!0)});oe._data(e,"changeBubbles",!0)}})},handle:function(t){var e=t.target;return this!==e||t.isSimulated||t.isTrigger||"radio"!==e.type&&"checkbox"!==e.type?t.handleObj.handler.apply(this,arguments):void 0},teardown:function(){oe.event.remove(this,"._change");return!Ee.test(this.nodeName)}});re.focusinBubbles||oe.each({focus:"focusin",blur:"focusout"},function(t,e){var n=function(t){oe.event.simulate(e,t.target,oe.event.fix(t),!0)};oe.event.special[e]={setup:function(){var r=this.ownerDocument||this,i=oe._data(r,e);i||r.addEventListener(t,n,!0);oe._data(r,e,(i||0)+1)},teardown:function(){var r=this.ownerDocument||this,i=oe._data(r,e)-1;if(i)oe._data(r,e,i);else{r.removeEventListener(t,n,!0);oe._removeData(r,e)}}}});oe.fn.extend({on:function(t,e,n,r,i){var o,a;if("object"==typeof t){if("string"!=typeof e){n=n||e;e=void 0}for(o in t)this.on(o,e,n,t[o],i);return this}if(null==n&&null==r){r=e;n=e=void 0}else if(null==r)if("string"==typeof e){r=n;n=void 0}else{r=n;n=e;e=void 0}if(r===!1)r=p;else if(!r)return this;if(1===i){a=r;r=function(t){oe().off(t);return a.apply(this,arguments)};r.guid=a.guid||(a.guid=oe.guid++)}return this.each(function(){oe.event.add(this,t,r,n,e)})},one:function(t,e,n,r){return this.on(t,e,n,r,1)},off:function(t,e,n){var r,i;if(t&&t.preventDefault&&t.handleObj){r=t.handleObj;oe(t.delegateTarget).off(r.namespace?r.origType+"."+r.namespace:r.origType,r.selector,r.handler);return this}if("object"==typeof t){for(i in t)this.off(i,e,t[i]);return this}if(e===!1||"function"==typeof e){n=e;e=void 0}n===!1&&(n=p);return this.each(function(){oe.event.remove(this,t,n,e)})},trigger:function(t,e){return this.each(function(){oe.event.trigger(t,e,this)})},triggerHandler:function(t,e){var n=this[0];return n?oe.event.trigger(t,e,n,!0):void 0}});var Oe="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",Re=/ jQuery\d+="(?:null|\d+)"/g,Fe=new RegExp("<(?:"+Oe+")[\\s/>]","i"),We=/^\s+/,ze=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,qe=/<([\w:]+)/,Ue=/<tbody/i,Be=/<|&#?\w+;/,Ve=/<(?:script|style|link)/i,Xe=/checked\s*(?:[^=]|=\s*.checked.)/i,Ge=/^$|\/(?:java|ecma)script/i,$e=/^true\/(.*)/,Ye=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,Je={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:re.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},Ke=m(ge),Ze=Ke.appendChild(ge.createElement("div"));Je.optgroup=Je.option;Je.tbody=Je.tfoot=Je.colgroup=Je.caption=Je.thead;Je.th=Je.td;oe.extend({clone:function(t,e,n){var r,i,o,a,s,l=oe.contains(t.ownerDocument,t);if(re.html5Clone||oe.isXMLDoc(t)||!Fe.test("<"+t.nodeName+">"))o=t.cloneNode(!0);else{Ze.innerHTML=t.outerHTML;Ze.removeChild(o=Ze.firstChild)}if(!(re.noCloneEvent&&re.noCloneChecked||1!==t.nodeType&&11!==t.nodeType||oe.isXMLDoc(t))){r=v(o);s=v(t);for(a=0;null!=(i=s[a]);++a)r[a]&&T(i,r[a])}if(e)if(n){s=s||v(t);r=r||v(o);for(a=0;null!=(i=s[a]);a++)S(i,r[a])}else S(t,o);r=v(o,"script");r.length>0&&C(r,!l&&v(t,"script"));r=s=i=null;return o},buildFragment:function(t,e,n,r){for(var i,o,a,s,l,u,c,f=t.length,h=m(e),d=[],p=0;f>p;p++){o=t[p];if(o||0===o)if("object"===oe.type(o))oe.merge(d,o.nodeType?[o]:o);else if(Be.test(o)){s=s||h.appendChild(e.createElement("div"));l=(qe.exec(o)||["",""])[1].toLowerCase();c=Je[l]||Je._default;s.innerHTML=c[1]+o.replace(ze,"<$1></$2>")+c[2];i=c[0];for(;i--;)s=s.lastChild;!re.leadingWhitespace&&We.test(o)&&d.push(e.createTextNode(We.exec(o)[0]));if(!re.tbody){o="table"!==l||Ue.test(o)?"<table>"!==c[1]||Ue.test(o)?0:s:s.firstChild;i=o&&o.childNodes.length;for(;i--;)oe.nodeName(u=o.childNodes[i],"tbody")&&!u.childNodes.length&&o.removeChild(u)}oe.merge(d,s.childNodes);s.textContent="";for(;s.firstChild;)s.removeChild(s.firstChild);s=h.lastChild}else d.push(e.createTextNode(o))}s&&h.removeChild(s);re.appendChecked||oe.grep(v(d,"input"),y);p=0;for(;o=d[p++];)if(!r||-1===oe.inArray(o,r)){a=oe.contains(o.ownerDocument,o);s=v(h.appendChild(o),"script");a&&C(s);if(n){i=0;for(;o=s[i++];)Ge.test(o.type||"")&&n.push(o)}}s=null;return h},cleanData:function(t,e){for(var n,r,i,o,a=0,s=oe.expando,l=oe.cache,u=re.deleteExpando,c=oe.event.special;null!=(n=t[a]);a++)if(e||oe.acceptData(n)){i=n[s];o=i&&l[i];if(o){if(o.events)for(r in o.events)c[r]?oe.event.remove(n,r):oe.removeEvent(n,r,o.handle);if(l[i]){delete l[i];
u?delete n[s]:typeof n.removeAttribute!==Te?n.removeAttribute(s):n[s]=null;Y.push(i)}}}}});oe.fn.extend({text:function(t){return Ae(this,function(t){return void 0===t?oe.text(this):this.empty().append((this[0]&&this[0].ownerDocument||ge).createTextNode(t))},null,t,arguments.length)},append:function(){return this.domManip(arguments,function(t){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var e=b(this,t);e.appendChild(t)}})},prepend:function(){return this.domManip(arguments,function(t){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var e=b(this,t);e.insertBefore(t,e.firstChild)}})},before:function(){return this.domManip(arguments,function(t){this.parentNode&&this.parentNode.insertBefore(t,this)})},after:function(){return this.domManip(arguments,function(t){this.parentNode&&this.parentNode.insertBefore(t,this.nextSibling)})},remove:function(t,e){for(var n,r=t?oe.filter(t,this):this,i=0;null!=(n=r[i]);i++){e||1!==n.nodeType||oe.cleanData(v(n));if(n.parentNode){e&&oe.contains(n.ownerDocument,n)&&C(v(n,"script"));n.parentNode.removeChild(n)}}return this},empty:function(){for(var t,e=0;null!=(t=this[e]);e++){1===t.nodeType&&oe.cleanData(v(t,!1));for(;t.firstChild;)t.removeChild(t.firstChild);t.options&&oe.nodeName(t,"select")&&(t.options.length=0)}return this},clone:function(t,e){t=null==t?!1:t;e=null==e?t:e;return this.map(function(){return oe.clone(this,t,e)})},html:function(t){return Ae(this,function(t){var e=this[0]||{},n=0,r=this.length;if(void 0===t)return 1===e.nodeType?e.innerHTML.replace(Re,""):void 0;if(!("string"!=typeof t||Ve.test(t)||!re.htmlSerialize&&Fe.test(t)||!re.leadingWhitespace&&We.test(t)||Je[(qe.exec(t)||["",""])[1].toLowerCase()])){t=t.replace(ze,"<$1></$2>");try{for(;r>n;n++){e=this[n]||{};if(1===e.nodeType){oe.cleanData(v(e,!1));e.innerHTML=t}}e=0}catch(i){}}e&&this.empty().append(t)},null,t,arguments.length)},replaceWith:function(){var t=arguments[0];this.domManip(arguments,function(e){t=this.parentNode;oe.cleanData(v(this));t&&t.replaceChild(e,this)});return t&&(t.length||t.nodeType)?this:this.remove()},detach:function(t){return this.remove(t,!0)},domManip:function(t,e){t=K.apply([],t);var n,r,i,o,a,s,l=0,u=this.length,c=this,f=u-1,h=t[0],d=oe.isFunction(h);if(d||u>1&&"string"==typeof h&&!re.checkClone&&Xe.test(h))return this.each(function(n){var r=c.eq(n);d&&(t[0]=h.call(this,n,r.html()));r.domManip(t,e)});if(u){s=oe.buildFragment(t,this[0].ownerDocument,!1,this);n=s.firstChild;1===s.childNodes.length&&(s=n);if(n){o=oe.map(v(s,"script"),x);i=o.length;for(;u>l;l++){r=s;if(l!==f){r=oe.clone(r,!0,!0);i&&oe.merge(o,v(r,"script"))}e.call(this[l],r,l)}if(i){a=o[o.length-1].ownerDocument;oe.map(o,w);for(l=0;i>l;l++){r=o[l];Ge.test(r.type||"")&&!oe._data(r,"globalEval")&&oe.contains(a,r)&&(r.src?oe._evalUrl&&oe._evalUrl(r.src):oe.globalEval((r.text||r.textContent||r.innerHTML||"").replace(Ye,"")))}}s=n=null}}return this}});oe.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(t,e){oe.fn[t]=function(t){for(var n,r=0,i=[],o=oe(t),a=o.length-1;a>=r;r++){n=r===a?this:this.clone(!0);oe(o[r])[e](n);Z.apply(i,n.get())}return this.pushStack(i)}});var Qe,tn={};(function(){var t;re.shrinkWrapBlocks=function(){if(null!=t)return t;t=!1;var e,n,r;n=ge.getElementsByTagName("body")[0];if(n&&n.style){e=ge.createElement("div");r=ge.createElement("div");r.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px";n.appendChild(r).appendChild(e);if(typeof e.style.zoom!==Te){e.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:1px;width:1px;zoom:1";e.appendChild(ge.createElement("div")).style.width="5px";t=3!==e.offsetWidth}n.removeChild(r);return t}}})();var en,nn,rn=/^margin/,on=new RegExp("^("+Me+")(?!px)[a-z%]+$","i"),an=/^(top|right|bottom|left)$/;if(e.getComputedStyle){en=function(t){return t.ownerDocument.defaultView.opener?t.ownerDocument.defaultView.getComputedStyle(t,null):e.getComputedStyle(t,null)};nn=function(t,e,n){var r,i,o,a,s=t.style;n=n||en(t);a=n?n.getPropertyValue(e)||n[e]:void 0;if(n){""!==a||oe.contains(t.ownerDocument,t)||(a=oe.style(t,e));if(on.test(a)&&rn.test(e)){r=s.width;i=s.minWidth;o=s.maxWidth;s.minWidth=s.maxWidth=s.width=a;a=n.width;s.width=r;s.minWidth=i;s.maxWidth=o}}return void 0===a?a:a+""}}else if(ge.documentElement.currentStyle){en=function(t){return t.currentStyle};nn=function(t,e,n){var r,i,o,a,s=t.style;n=n||en(t);a=n?n[e]:void 0;null==a&&s&&s[e]&&(a=s[e]);if(on.test(a)&&!an.test(e)){r=s.left;i=t.runtimeStyle;o=i&&i.left;o&&(i.left=t.currentStyle.left);s.left="fontSize"===e?"1em":a;a=s.pixelLeft+"px";s.left=r;o&&(i.left=o)}return void 0===a?a:a+""||"auto"}}(function(){function t(){var t,n,r,i;n=ge.getElementsByTagName("body")[0];if(n&&n.style){t=ge.createElement("div");r=ge.createElement("div");r.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px";n.appendChild(r).appendChild(t);t.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;display:block;margin-top:1%;top:1%;border:1px;padding:1px;width:4px;position:absolute";o=a=!1;l=!0;if(e.getComputedStyle){o="1%"!==(e.getComputedStyle(t,null)||{}).top;a="4px"===(e.getComputedStyle(t,null)||{width:"4px"}).width;i=t.appendChild(ge.createElement("div"));i.style.cssText=t.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0";i.style.marginRight=i.style.width="0";t.style.width="1px";l=!parseFloat((e.getComputedStyle(i,null)||{}).marginRight);t.removeChild(i)}t.innerHTML="<table><tr><td></td><td>t</td></tr></table>";i=t.getElementsByTagName("td");i[0].style.cssText="margin:0;border:0;padding:0;display:none";s=0===i[0].offsetHeight;if(s){i[0].style.display="";i[1].style.display="none";s=0===i[0].offsetHeight}n.removeChild(r)}}var n,r,i,o,a,s,l;n=ge.createElement("div");n.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";i=n.getElementsByTagName("a")[0];r=i&&i.style;if(r){r.cssText="float:left;opacity:.5";re.opacity="0.5"===r.opacity;re.cssFloat=!!r.cssFloat;n.style.backgroundClip="content-box";n.cloneNode(!0).style.backgroundClip="";re.clearCloneStyle="content-box"===n.style.backgroundClip;re.boxSizing=""===r.boxSizing||""===r.MozBoxSizing||""===r.WebkitBoxSizing;oe.extend(re,{reliableHiddenOffsets:function(){null==s&&t();return s},boxSizingReliable:function(){null==a&&t();return a},pixelPosition:function(){null==o&&t();return o},reliableMarginRight:function(){null==l&&t();return l}})}})();oe.swap=function(t,e,n,r){var i,o,a={};for(o in e){a[o]=t.style[o];t.style[o]=e[o]}i=n.apply(t,r||[]);for(o in e)t.style[o]=a[o];return i};var sn=/alpha\([^)]*\)/i,ln=/opacity\s*=\s*([^)]*)/,un=/^(none|table(?!-c[ea]).+)/,cn=new RegExp("^("+Me+")(.*)$","i"),fn=new RegExp("^([+-])=("+Me+")","i"),hn={position:"absolute",visibility:"hidden",display:"block"},dn={letterSpacing:"0",fontWeight:"400"},pn=["Webkit","O","Moz","ms"];oe.extend({cssHooks:{opacity:{get:function(t,e){if(e){var n=nn(t,"opacity");return""===n?"1":n}}}},cssNumber:{columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":re.cssFloat?"cssFloat":"styleFloat"},style:function(t,e,n,r){if(t&&3!==t.nodeType&&8!==t.nodeType&&t.style){var i,o,a,s=oe.camelCase(e),l=t.style;e=oe.cssProps[s]||(oe.cssProps[s]=D(l,s));a=oe.cssHooks[e]||oe.cssHooks[s];if(void 0===n)return a&&"get"in a&&void 0!==(i=a.get(t,!1,r))?i:l[e];o=typeof n;if("string"===o&&(i=fn.exec(n))){n=(i[1]+1)*i[2]+parseFloat(oe.css(t,e));o="number"}if(null!=n&&n===n){"number"!==o||oe.cssNumber[s]||(n+="px");re.clearCloneStyle||""!==n||0!==e.indexOf("background")||(l[e]="inherit");if(!(a&&"set"in a&&void 0===(n=a.set(t,n,r))))try{l[e]=n}catch(u){}}}},css:function(t,e,n,r){var i,o,a,s=oe.camelCase(e);e=oe.cssProps[s]||(oe.cssProps[s]=D(t.style,s));a=oe.cssHooks[e]||oe.cssHooks[s];a&&"get"in a&&(o=a.get(t,!0,n));void 0===o&&(o=nn(t,e,r));"normal"===o&&e in dn&&(o=dn[e]);if(""===n||n){i=parseFloat(o);return n===!0||oe.isNumeric(i)?i||0:o}return o}});oe.each(["height","width"],function(t,e){oe.cssHooks[e]={get:function(t,n,r){return n?un.test(oe.css(t,"display"))&&0===t.offsetWidth?oe.swap(t,hn,function(){return E(t,e,r)}):E(t,e,r):void 0},set:function(t,n,r){var i=r&&en(t);return A(t,n,r?N(t,e,r,re.boxSizing&&"border-box"===oe.css(t,"boxSizing",!1,i),i):0)}}});re.opacity||(oe.cssHooks.opacity={get:function(t,e){return ln.test((e&&t.currentStyle?t.currentStyle.filter:t.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":e?"1":""},set:function(t,e){var n=t.style,r=t.currentStyle,i=oe.isNumeric(e)?"alpha(opacity="+100*e+")":"",o=r&&r.filter||n.filter||"";n.zoom=1;if((e>=1||""===e)&&""===oe.trim(o.replace(sn,""))&&n.removeAttribute){n.removeAttribute("filter");if(""===e||r&&!r.filter)return}n.filter=sn.test(o)?o.replace(sn,i):o+" "+i}});oe.cssHooks.marginRight=M(re.reliableMarginRight,function(t,e){return e?oe.swap(t,{display:"inline-block"},nn,[t,"marginRight"]):void 0});oe.each({margin:"",padding:"",border:"Width"},function(t,e){oe.cssHooks[t+e]={expand:function(n){for(var r=0,i={},o="string"==typeof n?n.split(" "):[n];4>r;r++)i[t+De[r]+e]=o[r]||o[r-2]||o[0];return i}};rn.test(t)||(oe.cssHooks[t+e].set=A)});oe.fn.extend({css:function(t,e){return Ae(this,function(t,e,n){var r,i,o={},a=0;if(oe.isArray(e)){r=en(t);i=e.length;for(;i>a;a++)o[e[a]]=oe.css(t,e[a],!1,r);return o}return void 0!==n?oe.style(t,e,n):oe.css(t,e)},t,e,arguments.length>1)},show:function(){return L(this,!0)},hide:function(){return L(this)},toggle:function(t){return"boolean"==typeof t?t?this.show():this.hide():this.each(function(){Le(this)?oe(this).show():oe(this).hide()})}});oe.Tween=j;j.prototype={constructor:j,init:function(t,e,n,r,i,o){this.elem=t;this.prop=n;this.easing=i||"swing";this.options=e;this.start=this.now=this.cur();this.end=r;this.unit=o||(oe.cssNumber[n]?"":"px")},cur:function(){var t=j.propHooks[this.prop];return t&&t.get?t.get(this):j.propHooks._default.get(this)},run:function(t){var e,n=j.propHooks[this.prop];this.pos=e=this.options.duration?oe.easing[this.easing](t,this.options.duration*t,0,1,this.options.duration):t;this.now=(this.end-this.start)*e+this.start;this.options.step&&this.options.step.call(this.elem,this.now,this);n&&n.set?n.set(this):j.propHooks._default.set(this);return this}};j.prototype.init.prototype=j.prototype;j.propHooks={_default:{get:function(t){var e;if(null!=t.elem[t.prop]&&(!t.elem.style||null==t.elem.style[t.prop]))return t.elem[t.prop];e=oe.css(t.elem,t.prop,"");return e&&"auto"!==e?e:0},set:function(t){oe.fx.step[t.prop]?oe.fx.step[t.prop](t):t.elem.style&&(null!=t.elem.style[oe.cssProps[t.prop]]||oe.cssHooks[t.prop])?oe.style(t.elem,t.prop,t.now+t.unit):t.elem[t.prop]=t.now}}};j.propHooks.scrollTop=j.propHooks.scrollLeft={set:function(t){t.elem.nodeType&&t.elem.parentNode&&(t.elem[t.prop]=t.now)}};oe.easing={linear:function(t){return t},swing:function(t){return.5-Math.cos(t*Math.PI)/2}};oe.fx=j.prototype.init;oe.fx.step={};var gn,mn,vn=/^(?:toggle|show|hide)$/,yn=new RegExp("^(?:([+-])=|)("+Me+")([a-z%]*)$","i"),bn=/queueHooks$/,xn=[O],wn={"*":[function(t,e){var n=this.createTween(t,e),r=n.cur(),i=yn.exec(e),o=i&&i[3]||(oe.cssNumber[t]?"":"px"),a=(oe.cssNumber[t]||"px"!==o&&+r)&&yn.exec(oe.css(n.elem,t)),s=1,l=20;if(a&&a[3]!==o){o=o||a[3];i=i||[];a=+r||1;do{s=s||".5";a/=s;oe.style(n.elem,t,a+o)}while(s!==(s=n.cur()/r)&&1!==s&&--l)}if(i){a=n.start=+a||+r||0;n.unit=o;n.end=i[1]?a+(i[1]+1)*i[2]:+i[2]}return n}]};oe.Animation=oe.extend(F,{tweener:function(t,e){if(oe.isFunction(t)){e=t;t=["*"]}else t=t.split(" ");for(var n,r=0,i=t.length;i>r;r++){n=t[r];wn[n]=wn[n]||[];wn[n].unshift(e)}},prefilter:function(t,e){e?xn.unshift(t):xn.push(t)}});oe.speed=function(t,e,n){var r=t&&"object"==typeof t?oe.extend({},t):{complete:n||!n&&e||oe.isFunction(t)&&t,duration:t,easing:n&&e||e&&!oe.isFunction(e)&&e};r.duration=oe.fx.off?0:"number"==typeof r.duration?r.duration:r.duration in oe.fx.speeds?oe.fx.speeds[r.duration]:oe.fx.speeds._default;(null==r.queue||r.queue===!0)&&(r.queue="fx");r.old=r.complete;r.complete=function(){oe.isFunction(r.old)&&r.old.call(this);r.queue&&oe.dequeue(this,r.queue)};return r};oe.fn.extend({fadeTo:function(t,e,n,r){return this.filter(Le).css("opacity",0).show().end().animate({opacity:e},t,n,r)},animate:function(t,e,n,r){var i=oe.isEmptyObject(t),o=oe.speed(e,n,r),a=function(){var e=F(this,oe.extend({},t),o);(i||oe._data(this,"finish"))&&e.stop(!0)};a.finish=a;return i||o.queue===!1?this.each(a):this.queue(o.queue,a)},stop:function(t,e,n){var r=function(t){var e=t.stop;delete t.stop;e(n)};if("string"!=typeof t){n=e;e=t;t=void 0}e&&t!==!1&&this.queue(t||"fx",[]);return this.each(function(){var e=!0,i=null!=t&&t+"queueHooks",o=oe.timers,a=oe._data(this);if(i)a[i]&&a[i].stop&&r(a[i]);else for(i in a)a[i]&&a[i].stop&&bn.test(i)&&r(a[i]);for(i=o.length;i--;)if(o[i].elem===this&&(null==t||o[i].queue===t)){o[i].anim.stop(n);e=!1;o.splice(i,1)}(e||!n)&&oe.dequeue(this,t)})},finish:function(t){t!==!1&&(t=t||"fx");return this.each(function(){var e,n=oe._data(this),r=n[t+"queue"],i=n[t+"queueHooks"],o=oe.timers,a=r?r.length:0;n.finish=!0;oe.queue(this,t,[]);i&&i.stop&&i.stop.call(this,!0);for(e=o.length;e--;)if(o[e].elem===this&&o[e].queue===t){o[e].anim.stop(!0);o.splice(e,1)}for(e=0;a>e;e++)r[e]&&r[e].finish&&r[e].finish.call(this);delete n.finish})}});oe.each(["toggle","show","hide"],function(t,e){var n=oe.fn[e];oe.fn[e]=function(t,r,i){return null==t||"boolean"==typeof t?n.apply(this,arguments):this.animate(P(e,!0),t,r,i)}});oe.each({slideDown:P("show"),slideUp:P("hide"),slideToggle:P("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(t,e){oe.fn[t]=function(t,n,r){return this.animate(e,t,n,r)}});oe.timers=[];oe.fx.tick=function(){var t,e=oe.timers,n=0;gn=oe.now();for(;n<e.length;n++){t=e[n];t()||e[n]!==t||e.splice(n--,1)}e.length||oe.fx.stop();gn=void 0};oe.fx.timer=function(t){oe.timers.push(t);t()?oe.fx.start():oe.timers.pop()};oe.fx.interval=13;oe.fx.start=function(){mn||(mn=setInterval(oe.fx.tick,oe.fx.interval))};oe.fx.stop=function(){clearInterval(mn);mn=null};oe.fx.speeds={slow:600,fast:200,_default:400};oe.fn.delay=function(t,e){t=oe.fx?oe.fx.speeds[t]||t:t;e=e||"fx";return this.queue(e,function(e,n){var r=setTimeout(e,t);n.stop=function(){clearTimeout(r)}})};(function(){var t,e,n,r,i;e=ge.createElement("div");e.setAttribute("className","t");e.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";r=e.getElementsByTagName("a")[0];n=ge.createElement("select");i=n.appendChild(ge.createElement("option"));t=e.getElementsByTagName("input")[0];r.style.cssText="top:1px";re.getSetAttribute="t"!==e.className;re.style=/top/.test(r.getAttribute("style"));re.hrefNormalized="/a"===r.getAttribute("href");re.checkOn=!!t.value;re.optSelected=i.selected;re.enctype=!!ge.createElement("form").enctype;n.disabled=!0;re.optDisabled=!i.disabled;t=ge.createElement("input");t.setAttribute("value","");re.input=""===t.getAttribute("value");t.value="t";t.setAttribute("type","radio");re.radioValue="t"===t.value})();var Cn=/\r/g;oe.fn.extend({val:function(t){var e,n,r,i=this[0];if(arguments.length){r=oe.isFunction(t);return this.each(function(n){var i;if(1===this.nodeType){i=r?t.call(this,n,oe(this).val()):t;null==i?i="":"number"==typeof i?i+="":oe.isArray(i)&&(i=oe.map(i,function(t){return null==t?"":t+""}));e=oe.valHooks[this.type]||oe.valHooks[this.nodeName.toLowerCase()];e&&"set"in e&&void 0!==e.set(this,i,"value")||(this.value=i)}})}if(i){e=oe.valHooks[i.type]||oe.valHooks[i.nodeName.toLowerCase()];if(e&&"get"in e&&void 0!==(n=e.get(i,"value")))return n;n=i.value;return"string"==typeof n?n.replace(Cn,""):null==n?"":n}}});oe.extend({valHooks:{option:{get:function(t){var e=oe.find.attr(t,"value");return null!=e?e:oe.trim(oe.text(t))}},select:{get:function(t){for(var e,n,r=t.options,i=t.selectedIndex,o="select-one"===t.type||0>i,a=o?null:[],s=o?i+1:r.length,l=0>i?s:o?i:0;s>l;l++){n=r[l];if(!(!n.selected&&l!==i||(re.optDisabled?n.disabled:null!==n.getAttribute("disabled"))||n.parentNode.disabled&&oe.nodeName(n.parentNode,"optgroup"))){e=oe(n).val();if(o)return e;a.push(e)}}return a},set:function(t,e){for(var n,r,i=t.options,o=oe.makeArray(e),a=i.length;a--;){r=i[a];if(oe.inArray(oe.valHooks.option.get(r),o)>=0)try{r.selected=n=!0}catch(s){r.scrollHeight}else r.selected=!1}n||(t.selectedIndex=-1);return i}}}});oe.each(["radio","checkbox"],function(){oe.valHooks[this]={set:function(t,e){return oe.isArray(e)?t.checked=oe.inArray(oe(t).val(),e)>=0:void 0}};re.checkOn||(oe.valHooks[this].get=function(t){return null===t.getAttribute("value")?"on":t.value})});var Sn,Tn,kn=oe.expr.attrHandle,_n=/^(?:checked|selected)$/i,Mn=re.getSetAttribute,Dn=re.input;oe.fn.extend({attr:function(t,e){return Ae(this,oe.attr,t,e,arguments.length>1)},removeAttr:function(t){return this.each(function(){oe.removeAttr(this,t)})}});oe.extend({attr:function(t,e,n){var r,i,o=t.nodeType;if(t&&3!==o&&8!==o&&2!==o){if(typeof t.getAttribute===Te)return oe.prop(t,e,n);if(1!==o||!oe.isXMLDoc(t)){e=e.toLowerCase();r=oe.attrHooks[e]||(oe.expr.match.bool.test(e)?Tn:Sn)}if(void 0===n){if(r&&"get"in r&&null!==(i=r.get(t,e)))return i;i=oe.find.attr(t,e);return null==i?void 0:i}if(null!==n){if(r&&"set"in r&&void 0!==(i=r.set(t,n,e)))return i;t.setAttribute(e,n+"");return n}oe.removeAttr(t,e)}},removeAttr:function(t,e){var n,r,i=0,o=e&&e.match(xe);if(o&&1===t.nodeType)for(;n=o[i++];){r=oe.propFix[n]||n;oe.expr.match.bool.test(n)?Dn&&Mn||!_n.test(n)?t[r]=!1:t[oe.camelCase("default-"+n)]=t[r]=!1:oe.attr(t,n,"");t.removeAttribute(Mn?n:r)}},attrHooks:{type:{set:function(t,e){if(!re.radioValue&&"radio"===e&&oe.nodeName(t,"input")){var n=t.value;t.setAttribute("type",e);n&&(t.value=n);return e}}}}});Tn={set:function(t,e,n){e===!1?oe.removeAttr(t,n):Dn&&Mn||!_n.test(n)?t.setAttribute(!Mn&&oe.propFix[n]||n,n):t[oe.camelCase("default-"+n)]=t[n]=!0;return n}};oe.each(oe.expr.match.bool.source.match(/\w+/g),function(t,e){var n=kn[e]||oe.find.attr;kn[e]=Dn&&Mn||!_n.test(e)?function(t,e,r){var i,o;if(!r){o=kn[e];kn[e]=i;i=null!=n(t,e,r)?e.toLowerCase():null;kn[e]=o}return i}:function(t,e,n){return n?void 0:t[oe.camelCase("default-"+e)]?e.toLowerCase():null}});Dn&&Mn||(oe.attrHooks.value={set:function(t,e,n){if(!oe.nodeName(t,"input"))return Sn&&Sn.set(t,e,n);t.defaultValue=e;return void 0}});if(!Mn){Sn={set:function(t,e,n){var r=t.getAttributeNode(n);r||t.setAttributeNode(r=t.ownerDocument.createAttribute(n));r.value=e+="";return"value"===n||e===t.getAttribute(n)?e:void 0}};kn.id=kn.name=kn.coords=function(t,e,n){var r;return n?void 0:(r=t.getAttributeNode(e))&&""!==r.value?r.value:null};oe.valHooks.button={get:function(t,e){var n=t.getAttributeNode(e);return n&&n.specified?n.value:void 0},set:Sn.set};oe.attrHooks.contenteditable={set:function(t,e,n){Sn.set(t,""===e?!1:e,n)}};oe.each(["width","height"],function(t,e){oe.attrHooks[e]={set:function(t,n){if(""===n){t.setAttribute(e,"auto");return n}}}})}re.style||(oe.attrHooks.style={get:function(t){return t.style.cssText||void 0},set:function(t,e){return t.style.cssText=e+""}});var Ln=/^(?:input|select|textarea|button|object)$/i,An=/^(?:a|area)$/i;oe.fn.extend({prop:function(t,e){return Ae(this,oe.prop,t,e,arguments.length>1)},removeProp:function(t){t=oe.propFix[t]||t;return this.each(function(){try{this[t]=void 0;delete this[t]}catch(e){}})}});oe.extend({propFix:{"for":"htmlFor","class":"className"},prop:function(t,e,n){var r,i,o,a=t.nodeType;if(t&&3!==a&&8!==a&&2!==a){o=1!==a||!oe.isXMLDoc(t);if(o){e=oe.propFix[e]||e;i=oe.propHooks[e]}return void 0!==n?i&&"set"in i&&void 0!==(r=i.set(t,n,e))?r:t[e]=n:i&&"get"in i&&null!==(r=i.get(t,e))?r:t[e]}},propHooks:{tabIndex:{get:function(t){var e=oe.find.attr(t,"tabindex");return e?parseInt(e,10):Ln.test(t.nodeName)||An.test(t.nodeName)&&t.href?0:-1}}}});re.hrefNormalized||oe.each(["href","src"],function(t,e){oe.propHooks[e]={get:function(t){return t.getAttribute(e,4)}}});re.optSelected||(oe.propHooks.selected={get:function(t){var e=t.parentNode;if(e){e.selectedIndex;e.parentNode&&e.parentNode.selectedIndex}return null}});oe.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){oe.propFix[this.toLowerCase()]=this});re.enctype||(oe.propFix.enctype="encoding");var Nn=/[\t\r\n\f]/g;oe.fn.extend({addClass:function(t){var e,n,r,i,o,a,s=0,l=this.length,u="string"==typeof t&&t;if(oe.isFunction(t))return this.each(function(e){oe(this).addClass(t.call(this,e,this.className))});if(u){e=(t||"").match(xe)||[];for(;l>s;s++){n=this[s];r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(Nn," "):" ");if(r){o=0;for(;i=e[o++];)r.indexOf(" "+i+" ")<0&&(r+=i+" ");a=oe.trim(r);n.className!==a&&(n.className=a)}}}return this},removeClass:function(t){var e,n,r,i,o,a,s=0,l=this.length,u=0===arguments.length||"string"==typeof t&&t;if(oe.isFunction(t))return this.each(function(e){oe(this).removeClass(t.call(this,e,this.className))});if(u){e=(t||"").match(xe)||[];for(;l>s;s++){n=this[s];r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(Nn," "):"");if(r){o=0;for(;i=e[o++];)for(;r.indexOf(" "+i+" ")>=0;)r=r.replace(" "+i+" "," ");a=t?oe.trim(r):"";n.className!==a&&(n.className=a)}}}return this},toggleClass:function(t,e){var n=typeof t;return"boolean"==typeof e&&"string"===n?e?this.addClass(t):this.removeClass(t):this.each(oe.isFunction(t)?function(n){oe(this).toggleClass(t.call(this,n,this.className,e),e)}:function(){if("string"===n)for(var e,r=0,i=oe(this),o=t.match(xe)||[];e=o[r++];)i.hasClass(e)?i.removeClass(e):i.addClass(e);else if(n===Te||"boolean"===n){this.className&&oe._data(this,"__className__",this.className);this.className=this.className||t===!1?"":oe._data(this,"__className__")||""}})},hasClass:function(t){for(var e=" "+t+" ",n=0,r=this.length;r>n;n++)if(1===this[n].nodeType&&(" "+this[n].className+" ").replace(Nn," ").indexOf(e)>=0)return!0;return!1}});oe.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(t,e){oe.fn[e]=function(t,n){return arguments.length>0?this.on(e,null,t,n):this.trigger(e)}});oe.fn.extend({hover:function(t,e){return this.mouseenter(t).mouseleave(e||t)},bind:function(t,e,n){return this.on(t,null,e,n)},unbind:function(t,e){return this.off(t,null,e)},delegate:function(t,e,n,r){return this.on(e,t,n,r)},undelegate:function(t,e,n){return 1===arguments.length?this.off(t,"**"):this.off(e,t||"**",n)}});var En=oe.now(),jn=/\?/,In=/(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;oe.parseJSON=function(t){if(e.JSON&&e.JSON.parse)return e.JSON.parse(t+"");var n,r=null,i=oe.trim(t+"");return i&&!oe.trim(i.replace(In,function(t,e,i,o){n&&e&&(r=0);if(0===r)return t;n=i||e;r+=!o-!i;return""}))?Function("return "+i)():oe.error("Invalid JSON: "+t)};oe.parseXML=function(t){var n,r;if(!t||"string"!=typeof t)return null;try{if(e.DOMParser){r=new DOMParser;n=r.parseFromString(t,"text/xml")}else{n=new ActiveXObject("Microsoft.XMLDOM");n.async="false";n.loadXML(t)}}catch(i){n=void 0}n&&n.documentElement&&!n.getElementsByTagName("parsererror").length||oe.error("Invalid XML: "+t);return n};var Pn,Hn,On=/#.*$/,Rn=/([?&])_=[^&]*/,Fn=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Wn=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,zn=/^(?:GET|HEAD)$/,qn=/^\/\//,Un=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,Bn={},Vn={},Xn="*/".concat("*");try{Hn=location.href}catch(Gn){Hn=ge.createElement("a");Hn.href="";Hn=Hn.href}Pn=Un.exec(Hn.toLowerCase())||[];oe.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Hn,type:"GET",isLocal:Wn.test(Pn[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Xn,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":oe.parseJSON,"text xml":oe.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(t,e){return e?q(q(t,oe.ajaxSettings),e):q(oe.ajaxSettings,t)},ajaxPrefilter:W(Bn),ajaxTransport:W(Vn),ajax:function(t,e){function n(t,e,n,r){var i,c,v,y,x,C=e;if(2!==b){b=2;s&&clearTimeout(s);u=void 0;a=r||"";w.readyState=t>0?4:0;i=t>=200&&300>t||304===t;n&&(y=U(f,w,n));y=B(f,y,w,i);if(i){if(f.ifModified){x=w.getResponseHeader("Last-Modified");x&&(oe.lastModified[o]=x);x=w.getResponseHeader("etag");x&&(oe.etag[o]=x)}if(204===t||"HEAD"===f.type)C="nocontent";else if(304===t)C="notmodified";else{C=y.state;c=y.data;v=y.error;i=!v}}else{v=C;if(t||!C){C="error";0>t&&(t=0)}}w.status=t;w.statusText=(e||C)+"";i?p.resolveWith(h,[c,C,w]):p.rejectWith(h,[w,C,v]);w.statusCode(m);m=void 0;l&&d.trigger(i?"ajaxSuccess":"ajaxError",[w,f,i?c:v]);g.fireWith(h,[w,C]);if(l){d.trigger("ajaxComplete",[w,f]);--oe.active||oe.event.trigger("ajaxStop")}}}if("object"==typeof t){e=t;t=void 0}e=e||{};var r,i,o,a,s,l,u,c,f=oe.ajaxSetup({},e),h=f.context||f,d=f.context&&(h.nodeType||h.jquery)?oe(h):oe.event,p=oe.Deferred(),g=oe.Callbacks("once memory"),m=f.statusCode||{},v={},y={},b=0,x="canceled",w={readyState:0,getResponseHeader:function(t){var e;if(2===b){if(!c){c={};for(;e=Fn.exec(a);)c[e[1].toLowerCase()]=e[2]}e=c[t.toLowerCase()]}return null==e?null:e},getAllResponseHeaders:function(){return 2===b?a:null},setRequestHeader:function(t,e){var n=t.toLowerCase();if(!b){t=y[n]=y[n]||t;v[t]=e}return this},overrideMimeType:function(t){b||(f.mimeType=t);return this},statusCode:function(t){var e;if(t)if(2>b)for(e in t)m[e]=[m[e],t[e]];else w.always(t[w.status]);return this},abort:function(t){var e=t||x;u&&u.abort(e);n(0,e);return this}};p.promise(w).complete=g.add;w.success=w.done;w.error=w.fail;f.url=((t||f.url||Hn)+"").replace(On,"").replace(qn,Pn[1]+"//");f.type=e.method||e.type||f.method||f.type;f.dataTypes=oe.trim(f.dataType||"*").toLowerCase().match(xe)||[""];if(null==f.crossDomain){r=Un.exec(f.url.toLowerCase());f.crossDomain=!(!r||r[1]===Pn[1]&&r[2]===Pn[2]&&(r[3]||("http:"===r[1]?"80":"443"))===(Pn[3]||("http:"===Pn[1]?"80":"443")))}f.data&&f.processData&&"string"!=typeof f.data&&(f.data=oe.param(f.data,f.traditional));z(Bn,f,e,w);if(2===b)return w;l=oe.event&&f.global;l&&0===oe.active++&&oe.event.trigger("ajaxStart");f.type=f.type.toUpperCase();f.hasContent=!zn.test(f.type);o=f.url;if(!f.hasContent){if(f.data){o=f.url+=(jn.test(o)?"&":"?")+f.data;delete f.data}f.cache===!1&&(f.url=Rn.test(o)?o.replace(Rn,"$1_="+En++):o+(jn.test(o)?"&":"?")+"_="+En++)}if(f.ifModified){oe.lastModified[o]&&w.setRequestHeader("If-Modified-Since",oe.lastModified[o]);oe.etag[o]&&w.setRequestHeader("If-None-Match",oe.etag[o])}(f.data&&f.hasContent&&f.contentType!==!1||e.contentType)&&w.setRequestHeader("Content-Type",f.contentType);w.setRequestHeader("Accept",f.dataTypes[0]&&f.accepts[f.dataTypes[0]]?f.accepts[f.dataTypes[0]]+("*"!==f.dataTypes[0]?", "+Xn+"; q=0.01":""):f.accepts["*"]);for(i in f.headers)w.setRequestHeader(i,f.headers[i]);if(f.beforeSend&&(f.beforeSend.call(h,w,f)===!1||2===b))return w.abort();x="abort";for(i in{success:1,error:1,complete:1})w[i](f[i]);u=z(Vn,f,e,w);if(u){w.readyState=1;l&&d.trigger("ajaxSend",[w,f]);f.async&&f.timeout>0&&(s=setTimeout(function(){w.abort("timeout")},f.timeout));try{b=1;u.send(v,n)}catch(C){if(!(2>b))throw C;n(-1,C)}}else n(-1,"No Transport");return w},getJSON:function(t,e,n){return oe.get(t,e,n,"json")},getScript:function(t,e){return oe.get(t,void 0,e,"script")}});oe.each(["get","post"],function(t,e){oe[e]=function(t,n,r,i){if(oe.isFunction(n)){i=i||r;r=n;n=void 0}return oe.ajax({url:t,type:e,dataType:i,data:n,success:r})}});oe._evalUrl=function(t){return oe.ajax({url:t,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})};oe.fn.extend({wrapAll:function(t){if(oe.isFunction(t))return this.each(function(e){oe(this).wrapAll(t.call(this,e))});if(this[0]){var e=oe(t,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&e.insertBefore(this[0]);e.map(function(){for(var t=this;t.firstChild&&1===t.firstChild.nodeType;)t=t.firstChild;return t}).append(this)}return this},wrapInner:function(t){return this.each(oe.isFunction(t)?function(e){oe(this).wrapInner(t.call(this,e))}:function(){var e=oe(this),n=e.contents();n.length?n.wrapAll(t):e.append(t)})},wrap:function(t){var e=oe.isFunction(t);return this.each(function(n){oe(this).wrapAll(e?t.call(this,n):t)})},unwrap:function(){return this.parent().each(function(){oe.nodeName(this,"body")||oe(this).replaceWith(this.childNodes)}).end()}});oe.expr.filters.hidden=function(t){return t.offsetWidth<=0&&t.offsetHeight<=0||!re.reliableHiddenOffsets()&&"none"===(t.style&&t.style.display||oe.css(t,"display"))};oe.expr.filters.visible=function(t){return!oe.expr.filters.hidden(t)};var $n=/%20/g,Yn=/\[\]$/,Jn=/\r?\n/g,Kn=/^(?:submit|button|image|reset|file)$/i,Zn=/^(?:input|select|textarea|keygen)/i;oe.param=function(t,e){var n,r=[],i=function(t,e){e=oe.isFunction(e)?e():null==e?"":e;r[r.length]=encodeURIComponent(t)+"="+encodeURIComponent(e)};void 0===e&&(e=oe.ajaxSettings&&oe.ajaxSettings.traditional);if(oe.isArray(t)||t.jquery&&!oe.isPlainObject(t))oe.each(t,function(){i(this.name,this.value)});else for(n in t)V(n,t[n],e,i);return r.join("&").replace($n,"+")};oe.fn.extend({serialize:function(){return oe.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var t=oe.prop(this,"elements");return t?oe.makeArray(t):this}).filter(function(){var t=this.type;return this.name&&!oe(this).is(":disabled")&&Zn.test(this.nodeName)&&!Kn.test(t)&&(this.checked||!Ne.test(t))}).map(function(t,e){var n=oe(this).val();return null==n?null:oe.isArray(n)?oe.map(n,function(t){return{name:e.name,value:t.replace(Jn,"\r\n")}}):{name:e.name,value:n.replace(Jn,"\r\n")}}).get()}});oe.ajaxSettings.xhr=void 0!==e.ActiveXObject?function(){return!this.isLocal&&/^(get|post|head|put|delete|options)$/i.test(this.type)&&X()||G()}:X;var Qn=0,tr={},er=oe.ajaxSettings.xhr();e.attachEvent&&e.attachEvent("onunload",function(){for(var t in tr)tr[t](void 0,!0)});re.cors=!!er&&"withCredentials"in er;er=re.ajax=!!er;er&&oe.ajaxTransport(function(t){if(!t.crossDomain||re.cors){var e;return{send:function(n,r){var i,o=t.xhr(),a=++Qn;o.open(t.type,t.url,t.async,t.username,t.password);if(t.xhrFields)for(i in t.xhrFields)o[i]=t.xhrFields[i];t.mimeType&&o.overrideMimeType&&o.overrideMimeType(t.mimeType);t.crossDomain||n["X-Requested-With"]||(n["X-Requested-With"]="XMLHttpRequest");for(i in n)void 0!==n[i]&&o.setRequestHeader(i,n[i]+"");o.send(t.hasContent&&t.data||null);e=function(n,i){var s,l,u;if(e&&(i||4===o.readyState)){delete tr[a];e=void 0;o.onreadystatechange=oe.noop;if(i)4!==o.readyState&&o.abort();else{u={};s=o.status;"string"==typeof o.responseText&&(u.text=o.responseText);try{l=o.statusText}catch(c){l=""}s||!t.isLocal||t.crossDomain?1223===s&&(s=204):s=u.text?200:404}}u&&r(s,l,u,o.getAllResponseHeaders())};t.async?4===o.readyState?setTimeout(e):o.onreadystatechange=tr[a]=e:e()},abort:function(){e&&e(void 0,!0)}}}});oe.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(t){oe.globalEval(t);return t}}});oe.ajaxPrefilter("script",function(t){void 0===t.cache&&(t.cache=!1);if(t.crossDomain){t.type="GET";t.global=!1}});oe.ajaxTransport("script",function(t){if(t.crossDomain){var e,n=ge.head||oe("head")[0]||ge.documentElement;
return{send:function(r,i){e=ge.createElement("script");e.async=!0;t.scriptCharset&&(e.charset=t.scriptCharset);e.src=t.url;e.onload=e.onreadystatechange=function(t,n){if(n||!e.readyState||/loaded|complete/.test(e.readyState)){e.onload=e.onreadystatechange=null;e.parentNode&&e.parentNode.removeChild(e);e=null;n||i(200,"success")}};n.insertBefore(e,n.firstChild)},abort:function(){e&&e.onload(void 0,!0)}}}});var nr=[],rr=/(=)\?(?=&|$)|\?\?/;oe.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var t=nr.pop()||oe.expando+"_"+En++;this[t]=!0;return t}});oe.ajaxPrefilter("json jsonp",function(t,n,r){var i,o,a,s=t.jsonp!==!1&&(rr.test(t.url)?"url":"string"==typeof t.data&&!(t.contentType||"").indexOf("application/x-www-form-urlencoded")&&rr.test(t.data)&&"data");if(s||"jsonp"===t.dataTypes[0]){i=t.jsonpCallback=oe.isFunction(t.jsonpCallback)?t.jsonpCallback():t.jsonpCallback;s?t[s]=t[s].replace(rr,"$1"+i):t.jsonp!==!1&&(t.url+=(jn.test(t.url)?"&":"?")+t.jsonp+"="+i);t.converters["script json"]=function(){a||oe.error(i+" was not called");return a[0]};t.dataTypes[0]="json";o=e[i];e[i]=function(){a=arguments};r.always(function(){e[i]=o;if(t[i]){t.jsonpCallback=n.jsonpCallback;nr.push(i)}a&&oe.isFunction(o)&&o(a[0]);a=o=void 0});return"script"}});oe.parseHTML=function(t,e,n){if(!t||"string"!=typeof t)return null;if("boolean"==typeof e){n=e;e=!1}e=e||ge;var r=he.exec(t),i=!n&&[];if(r)return[e.createElement(r[1])];r=oe.buildFragment([t],e,i);i&&i.length&&oe(i).remove();return oe.merge([],r.childNodes)};var ir=oe.fn.load;oe.fn.load=function(t,e,n){if("string"!=typeof t&&ir)return ir.apply(this,arguments);var r,i,o,a=this,s=t.indexOf(" ");if(s>=0){r=oe.trim(t.slice(s,t.length));t=t.slice(0,s)}if(oe.isFunction(e)){n=e;e=void 0}else e&&"object"==typeof e&&(o="POST");a.length>0&&oe.ajax({url:t,type:o,dataType:"html",data:e}).done(function(t){i=arguments;a.html(r?oe("<div>").append(oe.parseHTML(t)).find(r):t)}).complete(n&&function(t,e){a.each(n,i||[t.responseText,e,t])});return this};oe.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(t,e){oe.fn[e]=function(t){return this.on(e,t)}});oe.expr.filters.animated=function(t){return oe.grep(oe.timers,function(e){return t===e.elem}).length};var or=e.document.documentElement;oe.offset={setOffset:function(t,e,n){var r,i,o,a,s,l,u,c=oe.css(t,"position"),f=oe(t),h={};"static"===c&&(t.style.position="relative");s=f.offset();o=oe.css(t,"top");l=oe.css(t,"left");u=("absolute"===c||"fixed"===c)&&oe.inArray("auto",[o,l])>-1;if(u){r=f.position();a=r.top;i=r.left}else{a=parseFloat(o)||0;i=parseFloat(l)||0}oe.isFunction(e)&&(e=e.call(t,n,s));null!=e.top&&(h.top=e.top-s.top+a);null!=e.left&&(h.left=e.left-s.left+i);"using"in e?e.using.call(t,h):f.css(h)}};oe.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){oe.offset.setOffset(this,t,e)});var e,n,r={top:0,left:0},i=this[0],o=i&&i.ownerDocument;if(o){e=o.documentElement;if(!oe.contains(e,i))return r;typeof i.getBoundingClientRect!==Te&&(r=i.getBoundingClientRect());n=$(o);return{top:r.top+(n.pageYOffset||e.scrollTop)-(e.clientTop||0),left:r.left+(n.pageXOffset||e.scrollLeft)-(e.clientLeft||0)}}},position:function(){if(this[0]){var t,e,n={top:0,left:0},r=this[0];if("fixed"===oe.css(r,"position"))e=r.getBoundingClientRect();else{t=this.offsetParent();e=this.offset();oe.nodeName(t[0],"html")||(n=t.offset());n.top+=oe.css(t[0],"borderTopWidth",!0);n.left+=oe.css(t[0],"borderLeftWidth",!0)}return{top:e.top-n.top-oe.css(r,"marginTop",!0),left:e.left-n.left-oe.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){for(var t=this.offsetParent||or;t&&!oe.nodeName(t,"html")&&"static"===oe.css(t,"position");)t=t.offsetParent;return t||or})}});oe.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,e){var n=/Y/.test(e);oe.fn[t]=function(r){return Ae(this,function(t,r,i){var o=$(t);if(void 0===i)return o?e in o?o[e]:o.document.documentElement[r]:t[r];o?o.scrollTo(n?oe(o).scrollLeft():i,n?i:oe(o).scrollTop()):t[r]=i;return void 0},t,r,arguments.length,null)}});oe.each(["top","left"],function(t,e){oe.cssHooks[e]=M(re.pixelPosition,function(t,n){if(n){n=nn(t,e);return on.test(n)?oe(t).position()[e]+"px":n}})});oe.each({Height:"height",Width:"width"},function(t,e){oe.each({padding:"inner"+t,content:e,"":"outer"+t},function(n,r){oe.fn[r]=function(r,i){var o=arguments.length&&(n||"boolean"!=typeof r),a=n||(r===!0||i===!0?"margin":"border");return Ae(this,function(e,n,r){var i;if(oe.isWindow(e))return e.document.documentElement["client"+t];if(9===e.nodeType){i=e.documentElement;return Math.max(e.body["scroll"+t],i["scroll"+t],e.body["offset"+t],i["offset"+t],i["client"+t])}return void 0===r?oe.css(e,n,a):oe.style(e,n,r,a)},e,o?r:void 0,o,null)}})});oe.fn.size=function(){return this.length};oe.fn.andSelf=oe.fn.addBack;"function"==typeof t&&t.amd&&t("jquery",[],function(){return oe});var ar=e.jQuery,sr=e.$;oe.noConflict=function(t){e.$===oe&&(e.$=sr);t&&e.jQuery===oe&&(e.jQuery=ar);return oe};typeof n===Te&&(e.jQuery=e.$=oe);return oe})},{}],20:[function(e,n,r){(function(){var i;i=function(i){return"object"==typeof r&&"object"==typeof n?i(e("jquery")):"function"==typeof t&&t.amd?t(["jquery"],i):i(jQuery)};i(function(t){return t.pivotUtilities.d3_renderers={Treemap:function(e,n){var r,i,o,a,s,l,u,c,f,h,d,p,g,m;o={localeStrings:{}};n=t.extend(o,n);l=t("<div style='width: 100%; height: 100%;'>");c={name:"All",children:[]};r=function(t,e,n){var i,o,a,s,l,u;if(0!==e.length){null==t.children&&(t.children=[]);a=e.shift();u=t.children;for(s=0,l=u.length;l>s;s++){i=u[s];if(i.name===a){r(i,e,n);return}}o={name:a};r(o,e,n);return t.children.push(o)}t.value=n};m=e.getRowKeys();for(p=0,g=m.length;g>p;p++){u=m[p];h=e.getAggregator(u,[]).value();null!=h&&r(c,u,h)}i=d3.scale.category10();d=t(window).width()/1.4;a=t(window).height()/1.4;s=10;f=d3.layout.treemap().size([d,a]).sticky(!0).value(function(t){return t.size});d3.select(l[0]).append("div").style("position","relative").style("width",d+2*s+"px").style("height",a+2*s+"px").style("left",s+"px").style("top",s+"px").datum(c).selectAll(".node").data(f.padding([15,0,0,0]).value(function(t){return t.value}).nodes).enter().append("div").attr("class","node").style("background",function(t){return null!=t.children?"lightgrey":i(t.name)}).text(function(t){return t.name}).call(function(){this.style("left",function(t){return t.x+"px"}).style("top",function(t){return t.y+"px"}).style("width",function(t){return Math.max(0,t.dx-1)+"px"}).style("height",function(t){return Math.max(0,t.dy-1)+"px"})});return l}}})}).call(this)},{jquery:19}],21:[function(e,n,r){(function(){var i;i=function(i){return"object"==typeof r&&"object"==typeof n?i(e("jquery")):"function"==typeof t&&t.amd?t(["jquery"],i):i(jQuery)};i(function(t){var e;e=function(e,n){return function(r,i){var o,a,s,l,u,c,f,h,d,p,g,m,v,y,b,x,w,C,S,T,k,_,M,D,L;c={localeStrings:{vs:"vs",by:"by"}};i=t.extend(c,i);w=r.getRowKeys();0===w.length&&w.push([]);s=r.getColKeys();0===s.length&&s.push([]);p=function(){var t,e,n;n=[];for(t=0,e=w.length;e>t;t++){h=w[t];n.push(h.join("-"))}return n}();p.unshift("");m=0;l=[p];for(_=0,D=s.length;D>_;_++){a=s[_];b=[a.join("-")];m+=b[0].length;for(M=0,L=w.length;L>M;M++){x=w[M];o=r.getAggregator(x,a);b.push(null!=o.value()?o.value():null)}l.push(b)}C=T=r.aggregatorName+(r.valAttrs.length?"("+r.valAttrs.join(", ")+")":"");d=r.colAttrs.join("-");""!==d&&(C+=" "+i.localeStrings.vs+" "+d);f=r.rowAttrs.join("-");""!==f&&(C+=" "+i.localeStrings.by+" "+f);v={width:t(window).width()/1.4,height:t(window).height()/1.4,title:C,hAxis:{title:d,slantedText:m>50},vAxis:{title:T}};2===l[0].length&&""===l[0][1]&&(v.legend={position:"none"});for(g in n){S=n[g];v[g]=S}u=google.visualization.arrayToDataTable(l);y=t("<div style='width: 100%; height: 100%;'>");k=new google.visualization.ChartWrapper({dataTable:u,chartType:e,options:v});k.draw(y[0]);y.bind("dblclick",function(){var t;t=new google.visualization.ChartEditor;google.visualization.events.addListener(t,"ok",function(){return t.getChartWrapper().draw(y[0])});return t.openDialog(k)});return y}};return t.pivotUtilities.gchart_renderers={"Line Chart":e("LineChart"),"Bar Chart":e("ColumnChart"),"Stacked Bar Chart":e("ColumnChart",{isStacked:!0}),"Area Chart":e("AreaChart",{isStacked:!0})}})}).call(this)},{jquery:19}],22:[function(e,n,r){(function(){var i,o=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1},a=[].slice,s=function(t,e){return function(){return t.apply(e,arguments)}},l={}.hasOwnProperty;i=function(i){return"object"==typeof r&&"object"==typeof n?i(e("jquery")):"function"==typeof t&&t.amd?t(["jquery"],i):i(jQuery)};i(function(t){var e,n,r,i,u,c,f,h,d,p,g,m,v,y,b,x;n=function(t,e,n){var r,i,o,a;t+="";i=t.split(".");o=i[0];a=i.length>1?n+i[1]:"";r=/(\d+)(\d{3})/;for(;r.test(o);)o=o.replace(r,"$1"+e+"$2");return o+a};p=function(e){var r;r={digitsAfterDecimal:2,scaler:1,thousandsSep:",",decimalSep:".",prefix:"",suffix:"",showZero:!1};e=t.extend(r,e);return function(t){var r;if(isNaN(t)||!isFinite(t))return"";if(0===t&&!e.showZero)return"";r=n((e.scaler*t).toFixed(e.digitsAfterDecimal),e.thousandsSep,e.decimalSep);return""+e.prefix+r+e.suffix}};v=p();y=p({digitsAfterDecimal:0});b=p({digitsAfterDecimal:1,scaler:100,suffix:"%"});r={count:function(t){null==t&&(t=y);return function(){return function(){return{count:0,push:function(){return this.count++},value:function(){return this.count},format:t}}}},countUnique:function(t){null==t&&(t=y);return function(e){var n;n=e[0];return function(){return{uniq:[],push:function(t){var e;return e=t[n],o.call(this.uniq,e)<0?this.uniq.push(t[n]):void 0},value:function(){return this.uniq.length},format:t,numInputs:null!=n?0:1}}}},listUnique:function(t){return function(e){var n;n=e[0];return function(){return{uniq:[],push:function(t){var e;return e=t[n],o.call(this.uniq,e)<0?this.uniq.push(t[n]):void 0},value:function(){return this.uniq.join(t)},format:function(t){return t},numInputs:null!=n?0:1}}}},sum:function(t){null==t&&(t=v);return function(e){var n;n=e[0];return function(){return{sum:0,push:function(t){return isNaN(parseFloat(t[n]))?void 0:this.sum+=parseFloat(t[n])},value:function(){return this.sum},format:t,numInputs:null!=n?0:1}}}},average:function(t){null==t&&(t=v);return function(e){var n;n=e[0];return function(){return{sum:0,len:0,push:function(t){if(!isNaN(parseFloat(t[n]))){this.sum+=parseFloat(t[n]);return this.len++}},value:function(){return this.sum/this.len},format:t,numInputs:null!=n?0:1}}}},sumOverSum:function(t){null==t&&(t=v);return function(e){var n,r;r=e[0],n=e[1];return function(){return{sumNum:0,sumDenom:0,push:function(t){isNaN(parseFloat(t[r]))||(this.sumNum+=parseFloat(t[r]));return isNaN(parseFloat(t[n]))?void 0:this.sumDenom+=parseFloat(t[n])},value:function(){return this.sumNum/this.sumDenom},format:t,numInputs:null!=r&&null!=n?0:2}}}},sumOverSumBound80:function(t,e){null==t&&(t=!0);null==e&&(e=v);return function(n){var r,i;i=n[0],r=n[1];return function(){return{sumNum:0,sumDenom:0,push:function(t){isNaN(parseFloat(t[i]))||(this.sumNum+=parseFloat(t[i]));return isNaN(parseFloat(t[r]))?void 0:this.sumDenom+=parseFloat(t[r])},value:function(){var e;e=t?1:-1;return(.821187207574908/this.sumDenom+this.sumNum/this.sumDenom+1.2815515655446004*e*Math.sqrt(.410593603787454/(this.sumDenom*this.sumDenom)+this.sumNum*(1-this.sumNum/this.sumDenom)/(this.sumDenom*this.sumDenom)))/(1+1.642374415149816/this.sumDenom)},format:e,numInputs:null!=i&&null!=r?0:2}}}},fractionOf:function(t,e,n){null==e&&(e="total");null==n&&(n=b);return function(){var r;r=1<=arguments.length?a.call(arguments,0):[];return function(i,o,a){return{selector:{total:[[],[]],row:[o,[]],col:[[],a]}[e],inner:t.apply(null,r)(i,o,a),push:function(t){return this.inner.push(t)},format:n,value:function(){return this.inner.value()/i.getAggregator.apply(i,this.selector).inner.value()},numInputs:t.apply(null,r)().numInputs}}}}};i=function(t){return{Count:t.count(y),"Count Unique Values":t.countUnique(y),"List Unique Values":t.listUnique(", "),Sum:t.sum(v),"Integer Sum":t.sum(y),Average:t.average(v),"Sum over Sum":t.sumOverSum(v),"80% Upper Bound":t.sumOverSumBound80(!0,v),"80% Lower Bound":t.sumOverSumBound80(!1,v),"Sum as Fraction of Total":t.fractionOf(t.sum(),"total",b),"Sum as Fraction of Rows":t.fractionOf(t.sum(),"row",b),"Sum as Fraction of Columns":t.fractionOf(t.sum(),"col",b),"Count as Fraction of Total":t.fractionOf(t.count(),"total",b),"Count as Fraction of Rows":t.fractionOf(t.count(),"row",b),"Count as Fraction of Columns":t.fractionOf(t.count(),"col",b)}}(r);m={Table:function(t,e){return g(t,e)},"Table Barchart":function(e,n){return t(g(e,n)).barchart()},Heatmap:function(e,n){return t(g(e,n)).heatmap()},"Row Heatmap":function(e,n){return t(g(e,n)).heatmap("rowheatmap")},"Col Heatmap":function(e,n){return t(g(e,n)).heatmap("colheatmap")}};f={en:{aggregators:i,renderers:m,localeStrings:{renderError:"An error occurred rendering the PivotTable results.",computeError:"An error occurred computing the PivotTable results.",uiRenderError:"An error occurred rendering the PivotTable UI.",selectAll:"Select All",selectNone:"Select None",tooMany:"(too many to list)",filterResults:"Filter results",totals:"Totals",vs:"vs",by:"by"}}};h=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];u=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];x=function(t){return("0"+t).substr(-2,2)};c={bin:function(t,e){return function(n){return n[t]-n[t]%e}},dateFormat:function(t,e,n,r){null==n&&(n=h);null==r&&(r=u);return function(i){var o;o=new Date(Date.parse(i[t]));return isNaN(o)?"":e.replace(/%(.)/g,function(t,e){switch(e){case"y":return o.getFullYear();case"m":return x(o.getMonth()+1);case"n":return n[o.getMonth()];case"d":return x(o.getDate());case"w":return r[o.getDay()];case"x":return o.getDay();case"H":return x(o.getHours());case"M":return x(o.getMinutes());case"S":return x(o.getSeconds());default:return"%"+e}})}}};d=function(){return function(t,e){var n,r,i,o,a,s,l;s=/(\d+)|(\D+)/g;a=/\d/;l=/^0/;if("number"==typeof t||"number"==typeof e)return isNaN(t)?1:isNaN(e)?-1:t-e;n=String(t).toLowerCase();i=String(e).toLowerCase();if(n===i)return 0;if(!a.test(n)||!a.test(i))return n>i?1:-1;n=n.match(s);i=i.match(s);for(;n.length&&i.length;){r=n.shift();o=i.shift();if(r!==o)return a.test(r)&&a.test(o)?r.replace(l,".0")-o.replace(l,".0"):r>o?1:-1}return n.length-i.length}}(this);t.pivotUtilities={aggregatorTemplates:r,aggregators:i,renderers:m,derivers:c,locales:f,naturalSort:d,numberFormat:p};e=function(){function e(t,n){this.getAggregator=s(this.getAggregator,this);this.getRowKeys=s(this.getRowKeys,this);this.getColKeys=s(this.getColKeys,this);this.sortKeys=s(this.sortKeys,this);this.arrSort=s(this.arrSort,this);this.natSort=s(this.natSort,this);this.aggregator=n.aggregator;this.aggregatorName=n.aggregatorName;this.colAttrs=n.cols;this.rowAttrs=n.rows;this.valAttrs=n.vals;this.tree={};this.rowKeys=[];this.colKeys=[];this.rowTotals={};this.colTotals={};this.allTotal=this.aggregator(this,[],[]);this.sorted=!1;e.forEachRecord(t,n.derivedAttributes,function(t){return function(e){return n.filter(e)?t.processRecord(e):void 0}}(this))}e.forEachRecord=function(e,n,r){var i,o,a,s,u,c,f,h,d,p,g,m;i=t.isEmptyObject(n)?r:function(t){var e,i,o;for(e in n){i=n[e];t[e]=null!=(o=i(t))?o:t[e]}return r(t)};if(t.isFunction(e))return e(i);if(t.isArray(e)){if(t.isArray(e[0])){g=[];for(a in e)if(l.call(e,a)){o=e[a];if(a>0){c={};p=e[0];for(s in p)if(l.call(p,s)){u=p[s];c[u]=o[s]}g.push(i(c))}}return g}m=[];for(h=0,d=e.length;d>h;h++){c=e[h];m.push(i(c))}return m}if(e instanceof jQuery){f=[];t("thead > tr > th",e).each(function(){return f.push(t(this).text())});return t("tbody > tr",e).each(function(){c={};t("td",this).each(function(e){return c[f[e]]=t(this).text()});return i(c)})}throw new Error("unknown input format")};e.convertToArray=function(t){var n;n=[];e.forEachRecord(t,{},function(t){return n.push(t)});return n};e.prototype.natSort=function(t,e){return d(t,e)};e.prototype.arrSort=function(t,e){return this.natSort(t.join(),e.join())};e.prototype.sortKeys=function(){if(!this.sorted){this.rowKeys.sort(this.arrSort);this.colKeys.sort(this.arrSort)}return this.sorted=!0};e.prototype.getColKeys=function(){this.sortKeys();return this.colKeys};e.prototype.getRowKeys=function(){this.sortKeys();return this.rowKeys};e.prototype.processRecord=function(t){var e,n,r,i,o,a,s,l,u,c,f,h,d;e=[];i=[];c=this.colAttrs;for(a=0,l=c.length;l>a;a++){o=c[a];e.push(null!=(f=t[o])?f:"null")}h=this.rowAttrs;for(s=0,u=h.length;u>s;s++){o=h[s];i.push(null!=(d=t[o])?d:"null")}r=i.join(String.fromCharCode(0));n=e.join(String.fromCharCode(0));this.allTotal.push(t);if(0!==i.length){if(!this.rowTotals[r]){this.rowKeys.push(i);this.rowTotals[r]=this.aggregator(this,i,[])}this.rowTotals[r].push(t)}if(0!==e.length){if(!this.colTotals[n]){this.colKeys.push(e);this.colTotals[n]=this.aggregator(this,[],e)}this.colTotals[n].push(t)}if(0!==e.length&&0!==i.length){this.tree[r]||(this.tree[r]={});this.tree[r][n]||(this.tree[r][n]=this.aggregator(this,i,e));return this.tree[r][n].push(t)}};e.prototype.getAggregator=function(t,e){var n,r,i;i=t.join(String.fromCharCode(0));r=e.join(String.fromCharCode(0));n=0===t.length&&0===e.length?this.allTotal:0===t.length?this.colTotals[r]:0===e.length?this.rowTotals[i]:this.tree[i][r];return null!=n?n:{value:function(){return null},format:function(){return""}}};return e}();g=function(e,n){var r,i,o,a,s,u,c,f,h,d,p,g,m,v,y,b,x,w,C,S,T;u={localeStrings:{totals:"Totals"}};n=t.extend(u,n);o=e.colAttrs;p=e.rowAttrs;m=e.getRowKeys();s=e.getColKeys();d=document.createElement("table");d.className="pvtTable";v=function(t,e,n){var r,i,o,a,s,l;if(0!==e){i=!0;for(a=s=0;n>=0?n>=s:s>=n;a=n>=0?++s:--s)t[e-1][a]!==t[e][a]&&(i=!1);if(i)return-1}r=0;for(;e+r<t.length;){o=!1;for(a=l=0;n>=0?n>=l:l>=n;a=n>=0?++l:--l)t[e][a]!==t[e+r][a]&&(o=!0);if(o)break;r++}return r};for(f in o)if(l.call(o,f)){i=o[f];w=document.createElement("tr");if(0===parseInt(f)&&0!==p.length){b=document.createElement("th");b.setAttribute("colspan",p.length);b.setAttribute("rowspan",o.length);w.appendChild(b)}b=document.createElement("th");b.className="pvtAxisLabel";b.textContent=i;w.appendChild(b);for(c in s)if(l.call(s,c)){a=s[c];T=v(s,parseInt(c),parseInt(f));if(-1!==T){b=document.createElement("th");b.className="pvtColLabel";b.textContent=a[f];b.setAttribute("colspan",T);parseInt(f)===o.length-1&&0!==p.length&&b.setAttribute("rowspan",2);w.appendChild(b)}}if(0===parseInt(f)){b=document.createElement("th");b.className="pvtTotalLabel";b.innerHTML=n.localeStrings.totals;b.setAttribute("rowspan",o.length+(0===p.length?0:1));w.appendChild(b)}d.appendChild(w)}if(0!==p.length){w=document.createElement("tr");for(c in p)if(l.call(p,c)){h=p[c];b=document.createElement("th");b.className="pvtAxisLabel";b.textContent=h;w.appendChild(b)}b=document.createElement("th");if(0===o.length){b.className="pvtTotalLabel";b.innerHTML=n.localeStrings.totals}w.appendChild(b);d.appendChild(w)}for(c in m)if(l.call(m,c)){g=m[c];w=document.createElement("tr");for(f in g)if(l.call(g,f)){C=g[f];T=v(m,parseInt(c),parseInt(f));if(-1!==T){b=document.createElement("th");b.className="pvtRowLabel";b.textContent=C;b.setAttribute("rowspan",T);parseInt(f)===p.length-1&&0!==o.length&&b.setAttribute("colspan",2);w.appendChild(b)}}for(f in s)if(l.call(s,f)){a=s[f];r=e.getAggregator(g,a);S=r.value();y=document.createElement("td");y.className="pvtVal row"+c+" col"+f;y.innerHTML=r.format(S);y.setAttribute("data-value",S);w.appendChild(y)}x=e.getAggregator(g,[]);S=x.value();y=document.createElement("td");y.className="pvtTotal rowTotal";y.innerHTML=x.format(S);y.setAttribute("data-value",S);y.setAttribute("data-for","row"+c);w.appendChild(y);d.appendChild(w)}w=document.createElement("tr");b=document.createElement("th");b.className="pvtTotalLabel";b.innerHTML=n.localeStrings.totals;b.setAttribute("colspan",p.length+(0===o.length?0:1));w.appendChild(b);for(f in s)if(l.call(s,f)){a=s[f];x=e.getAggregator([],a);S=x.value();y=document.createElement("td");y.className="pvtTotal colTotal";y.innerHTML=x.format(S);y.setAttribute("data-value",S);y.setAttribute("data-for","col"+f);w.appendChild(y)}x=e.getAggregator([],[]);S=x.value();y=document.createElement("td");y.className="pvtGrandTotal";y.innerHTML=x.format(S);y.setAttribute("data-value",S);w.appendChild(y);d.appendChild(w);d.setAttribute("data-numrows",m.length);d.setAttribute("data-numcols",s.length);return d};t.fn.pivot=function(n,i){var o,a,s,l,u;o={cols:[],rows:[],filter:function(){return!0},aggregator:r.count()(),aggregatorName:"Count",derivedAttributes:{},renderer:g,rendererOptions:null,localeStrings:f.en.localeStrings};i=t.extend(o,i);l=null;try{s=new e(n,i);try{l=i.renderer(s,i.rendererOptions)}catch(c){a=c;"undefined"!=typeof console&&null!==console&&console.error(a.stack);l=t("<span>").html(i.localeStrings.renderError)}}catch(c){a=c;"undefined"!=typeof console&&null!==console&&console.error(a.stack);l=t("<span>").html(i.localeStrings.computeError)}u=this[0];for(;u.hasChildNodes();)u.removeChild(u.lastChild);return this.append(l)};t.fn.pivotUI=function(n,r,i,a){var s,u,c,h,p,g,m,v,y,b,x,w,C,S,T,k,_,M,D,L,A,N,E,j,I,P,H,O,R,F,W,z,q,U,B,V,X,G,$;null==i&&(i=!1);null==a&&(a="en");m={derivedAttributes:{},aggregators:f[a].aggregators,renderers:f[a].renderers,hiddenAttributes:[],menuLimit:200,cols:[],rows:[],vals:[],exclusions:{},unusedAttrsVertical:"auto",autoSortUnusedAttrs:!1,rendererOptions:{localeStrings:f[a].localeStrings},onRefresh:null,filter:function(){return!0},localeStrings:f[a].localeStrings};y=this.data("pivotUIOptions");C=null==y||i?t.extend(m,r):y;try{n=e.convertToArray(n);L=function(){var t,e;t=n[0];e=[];for(w in t)l.call(t,w)&&e.push(w);return e}();B=C.derivedAttributes;for(p in B)l.call(B,p)&&o.call(L,p)<0&&L.push(p);h={};for(H=0,W=L.length;W>H;H++){I=L[H];h[I]={}}e.forEachRecord(n,C.derivedAttributes,function(t){var e,n,r;r=[];for(w in t)if(l.call(t,w)){e=t[w];if(C.filter(t)){null==e&&(e="null");null==(n=h[w])[e]&&(n[e]=0);r.push(h[w][e]++)}}return r});E=t("<table cellpadding='5'>");M=t("<td>");_=t("<select class='pvtRenderer'>").appendTo(M).bind("change",function(){return T()});V=C.renderers;for(I in V)l.call(V,I)&&t("<option>").val(I).html(I).appendTo(_);g=t("<td class='pvtAxisContainer pvtUnused'>");D=function(){var t,e,n;n=[];for(t=0,e=L.length;e>t;t++){p=L[t];o.call(C.hiddenAttributes,p)<0&&n.push(p)}return n}();j=!1;if("auto"===C.unusedAttrsVertical){c=0;for(O=0,z=D.length;z>O;O++){s=D[O];c+=s.length}j=c>120}g.addClass(C.unusedAttrsVertical===!0||j?"pvtVertList":"pvtHorizList");P=function(e){var n,r,i,a,s,l,u,c,f,p,m,v,y,x,S;u=function(){var t;t=[];for(w in h[e])t.push(w);return t}();l=!1;v=t("<div>").addClass("pvtFilterBox").hide();v.append(t("<h4>").text(""+e+" ("+u.length+")"));if(u.length>C.menuLimit)v.append(t("<p>").html(C.localeStrings.tooMany));else{r=t("<p>").appendTo(v);r.append(t("<button>").html(C.localeStrings.selectAll).bind("click",function(){return v.find("input:visible").prop("checked",!0)}));r.append(t("<button>").html(C.localeStrings.selectNone).bind("click",function(){return v.find("input:visible").prop("checked",!1)}));r.append(t("<input>").addClass("pvtSearch").attr("placeholder",C.localeStrings.filterResults).bind("keyup",function(){var e;e=t(this).val().toLowerCase();return t(this).parents(".pvtFilterBox").find("label span").each(function(){var n;n=t(this).text().toLowerCase().indexOf(e);return-1!==n?t(this).parent().show():t(this).parent().hide()})}));i=t("<div>").addClass("pvtCheckContainer").appendTo(v);S=u.sort(d);for(y=0,x=S.length;x>y;y++){w=S[y];m=h[e][w];a=t("<label>");s=C.exclusions[e]?o.call(C.exclusions[e],w)>=0:!1;l||(l=s);t("<input type='checkbox' class='pvtFilter'>").attr("checked",!s).data("filter",[e,w]).appendTo(a);a.append(t("<span>").text(""+w+" ("+m+")"));i.append(t("<p>").append(a))}}p=function(){var e;e=t(v).find("[type='checkbox']").length-t(v).find("[type='checkbox']:checked").length;e>0?n.addClass("pvtFilteredAttribute"):n.removeClass("pvtFilteredAttribute");return u.length>C.menuLimit?v.toggle():v.toggle(0,T)};t("<p>").appendTo(v).append(t("<button>").text("OK").bind("click",p));c=function(e){v.css({left:e.pageX,top:e.pageY}).toggle();t(".pvtSearch").val("");return t("label").show()};f=t("<span class='pvtTriangle'>").html(" ▾").bind("click",c);n=t("<li class='axis_"+b+"'>").append(t("<span class='pvtAttr'>").text(e).data("attrName",e).append(f));l&&n.addClass("pvtFilteredAttribute");g.append(n).append(v);return n.bind("dblclick",c)};for(b in D){p=D[b];P(p)}A=t("<tr>").appendTo(E);u=t("<select class='pvtAggregator'>").bind("change",function(){return T()});X=C.aggregators;for(I in X)l.call(X,I)&&u.append(t("<option>").val(I).html(I));t("<td class='pvtVals'>").appendTo(A).append(u).append(t("<br>"));t("<td class='pvtAxisContainer pvtHorizList pvtCols'>").appendTo(A);N=t("<tr>").appendTo(E);N.append(t("<td valign='top' class='pvtAxisContainer pvtRows'>"));S=t("<td valign='top' class='pvtRendererArea'>").appendTo(N);if(C.unusedAttrsVertical===!0||j){E.find("tr:nth-child(1)").prepend(M);E.find("tr:nth-child(2)").prepend(g)}else E.prepend(t("<tr>").append(M).append(g));this.html(E);G=C.cols;for(R=0,q=G.length;q>R;R++){I=G[R];this.find(".pvtCols").append(this.find(".axis_"+D.indexOf(I)))}$=C.rows;for(F=0,U=$.length;U>F;F++){I=$[F];this.find(".pvtRows").append(this.find(".axis_"+D.indexOf(I)))}null!=C.aggregatorName&&this.find(".pvtAggregator").val(C.aggregatorName);null!=C.rendererName&&this.find(".pvtRenderer").val(C.rendererName);x=!0;k=function(e){return function(){var r,i,a,s,l,c,f,h,d,p,g,m,v,y;h={derivedAttributes:C.derivedAttributes,localeStrings:C.localeStrings,rendererOptions:C.rendererOptions,cols:[],rows:[]};l=null!=(y=C.aggregators[u.val()]([])().numInputs)?y:0;p=[];e.find(".pvtRows li span.pvtAttr").each(function(){return h.rows.push(t(this).data("attrName"))});e.find(".pvtCols li span.pvtAttr").each(function(){return h.cols.push(t(this).data("attrName"))});e.find(".pvtVals select.pvtAttrDropdown").each(function(){if(0===l)return t(this).remove();l--;return""!==t(this).val()?p.push(t(this).val()):void 0});if(0!==l){f=e.find(".pvtVals");for(I=m=0;l>=0?l>m:m>l;I=l>=0?++m:--m){s=t("<select class='pvtAttrDropdown'>").append(t("<option>")).bind("change",function(){return T()});for(v=0,g=D.length;g>v;v++){r=D[v];s.append(t("<option>").val(r).text(r))}f.append(s)}}if(x){p=C.vals;b=0;e.find(".pvtVals select.pvtAttrDropdown").each(function(){t(this).val(p[b]);return b++});x=!1}h.aggregatorName=u.val();h.vals=p;h.aggregator=C.aggregators[u.val()](p);h.renderer=C.renderers[_.val()];i={};e.find("input.pvtFilter").not(":checked").each(function(){var e;e=t(this).data("filter");return null!=i[e[0]]?i[e[0]].push(e[1]):i[e[0]]=[e[1]]});h.filter=function(t){var e,n;if(!C.filter(t))return!1;for(w in i){e=i[w];if(n=""+t[w],o.call(e,n)>=0)return!1}return!0};S.pivot(n,h);c=t.extend(C,{cols:h.cols,rows:h.rows,vals:p,exclusions:i,aggregatorName:u.val(),rendererName:_.val()});e.data("pivotUIOptions",c);if(C.autoSortUnusedAttrs){a=t.pivotUtilities.naturalSort;d=e.find("td.pvtUnused.pvtAxisContainer");t(d).children("li").sort(function(e,n){return a(t(e).text(),t(n).text())}).appendTo(d)}S.css("opacity",1);return null!=C.onRefresh?C.onRefresh(c):void 0}}(this);T=function(){return function(){S.css("opacity",.5);return setTimeout(k,10)}}(this);T();this.find(".pvtAxisContainer").sortable({update:function(t,e){return null==e.sender?T():void 0},connectWith:this.find(".pvtAxisContainer"),items:"li",placeholder:"pvtPlaceholder"})}catch(Y){v=Y;"undefined"!=typeof console&&null!==console&&console.error(v.stack);this.html(C.localeStrings.uiRenderError)}return this};t.fn.heatmap=function(e){var n,r,i,o,a,s,l,u;null==e&&(e="heatmap");s=this.data("numrows");a=this.data("numcols");n=function(t,e,n){var r;r=function(){switch(t){case"red":return function(t){return"ff"+t+t};case"green":return function(t){return""+t+"ff"+t};case"blue":return function(t){return""+t+t+"ff"}}}();return function(t){var i,o;o=255-Math.round(255*(t-e)/(n-e));i=o.toString(16).split(".")[0];1===i.length&&(i=0+i);return r(i)}};r=function(e){return function(r,i){var o,a,s;a=function(n){return e.find(r).each(function(){var e;e=t(this).data("value");return null!=e&&isFinite(e)?n(e,t(this)):void 0})};s=[];a(function(t){return s.push(t)});o=n(i,Math.min.apply(Math,s),Math.max.apply(Math,s));return a(function(t,e){return e.css("background-color","#"+o(t))})}}(this);switch(e){case"heatmap":r(".pvtVal","red");break;case"rowheatmap":for(i=l=0;s>=0?s>l:l>s;i=s>=0?++l:--l)r(".pvtVal.row"+i,"red");break;case"colheatmap":for(o=u=0;a>=0?a>u:u>a;o=a>=0?++u:--u)r(".pvtVal.col"+o,"red")}r(".pvtTotal.rowTotal","red");r(".pvtTotal.colTotal","red");return this};return t.fn.barchart=function(){var e,n,r,i,o;i=this.data("numrows");r=this.data("numcols");e=function(e){return function(n){var r,i,o,a;r=function(r){return e.find(n).each(function(){var e;e=t(this).data("value");return null!=e&&isFinite(e)?r(e,t(this)):void 0})};a=[];r(function(t){return a.push(t)});i=Math.max.apply(Math,a);o=function(t){return 100*t/(1.4*i)};return r(function(e,n){var r,i;r=n.text();i=t("<div>").css({position:"relative",height:"55px"});i.append(t("<div>").css({position:"absolute",bottom:0,left:0,right:0,height:o(e)+"%","background-color":"gray"}));i.append(t("<div>").text(r).css({position:"relative","padding-left":"5px","padding-right":"5px"}));return n.css({padding:0,"padding-top":"5px","text-align":"center"}).html(i)})}}(this);for(n=o=0;i>=0?i>o:o>i;n=i>=0?++o:--o)e(".pvtVal.row"+n);e(".pvtTotal.colTotal");return this}})}).call(this)},{jquery:19}],23:[function(e,n){(function(e){function r(){try{return l in e&&e[l]}catch(t){return!1}}function i(t){return t.replace(/^d/,"___$&").replace(p,"___")}var o,a={},s=e.document,l="localStorage",u="script";a.disabled=!1;a.version="1.3.17";a.set=function(){};a.get=function(){};a.has=function(t){return void 0!==a.get(t)};a.remove=function(){};a.clear=function(){};a.transact=function(t,e,n){if(null==n){n=e;e=null}null==e&&(e={});var r=a.get(t,e);n(r);a.set(t,r)};a.getAll=function(){};a.forEach=function(){};a.serialize=function(t){return JSON.stringify(t)};a.deserialize=function(t){if("string"!=typeof t)return void 0;try{return JSON.parse(t)}catch(e){return t||void 0}};if(r()){o=e[l];a.set=function(t,e){if(void 0===e)return a.remove(t);o.setItem(t,a.serialize(e));return e};a.get=function(t,e){var n=a.deserialize(o.getItem(t));return void 0===n?e:n};a.remove=function(t){o.removeItem(t)};a.clear=function(){o.clear()};a.getAll=function(){var t={};a.forEach(function(e,n){t[e]=n});return t};a.forEach=function(t){for(var e=0;e<o.length;e++){var n=o.key(e);t(n,a.get(n))}}}else if(s.documentElement.addBehavior){var c,f;try{f=new ActiveXObject("htmlfile");f.open();f.write("<"+u+">document.w=window</"+u+'><iframe src="/favicon.ico"></iframe>');f.close();c=f.w.frames[0].document;o=c.createElement("div")}catch(h){o=s.createElement("div");c=s.body}var d=function(t){return function(){var e=Array.prototype.slice.call(arguments,0);e.unshift(o);c.appendChild(o);o.addBehavior("#default#userData");o.load(l);var n=t.apply(a,e);c.removeChild(o);return n}},p=new RegExp("[!\"#$%&'()*+,/\\\\:;<=>?@[\\]^`{|}~]","g");a.set=d(function(t,e,n){e=i(e);if(void 0===n)return a.remove(e);t.setAttribute(e,a.serialize(n));t.save(l);return n});a.get=d(function(t,e,n){e=i(e);var r=a.deserialize(t.getAttribute(e));return void 0===r?n:r});a.remove=d(function(t,e){e=i(e);t.removeAttribute(e);t.save(l)});a.clear=d(function(t){var e=t.XMLDocument.documentElement.attributes;t.load(l);for(var n,r=0;n=e[r];r++)t.removeAttribute(n.name);t.save(l)});a.getAll=function(){var t={};a.forEach(function(e,n){t[e]=n});return t};a.forEach=d(function(t,e){for(var n,r=t.XMLDocument.documentElement.attributes,i=0;n=r[i];++i)e(n.name,a.deserialize(t.getAttribute(n.name)))
})}try{var g="__storejs__";a.set(g,g);a.get(g)!=g&&(a.disabled=!0);a.remove(g)}catch(h){a.disabled=!0}a.enabled=!a.disabled;"undefined"!=typeof n&&n.exports&&this.module!==n?n.exports=a:"function"==typeof t&&t.amd?t(a):e.store=a})(Function("return this")())},{}],24:[function(t,e){e.exports={name:"yasgui-utils",version:"1.5.0",description:"Utils for YASGUI libs",main:"src/main.js",repository:{type:"git",url:"git://github.com/YASGUI/Utils.git"},licenses:[{type:"MIT",url:"http://yasgui.github.io/license.txt"}],author:"Laurens Rietveld",maintainers:[{name:"Laurens Rietveld",email:"laurens.rietveld@gmail.com",web:"http://laurensrietveld.nl"}],bugs:{url:"https://github.com/YASGUI/Utils/issues"},homepage:"https://github.com/YASGUI/Utils",dependencies:{store:"^1.3.14"}}},{}],25:[function(t,e){window.console=window.console||{log:function(){}};e.exports={storage:t("./storage.js"),svg:t("./svg.js"),version:{"yasgui-utils":t("../package.json").version}}},{"../package.json":24,"./storage.js":26,"./svg.js":27}],26:[function(t,e){{var n=t("store"),r={day:function(){return 864e5},month:function(){30*r.day()},year:function(){12*r.month()}};e.exports={set:function(t,e,i){if(n.enabled&&t&&e){"string"==typeof i&&(i=r[i]());e.documentElement&&(e=(new XMLSerializer).serializeToString(e.documentElement));n.set(t,{val:e,exp:i,time:(new Date).getTime()})}},remove:function(t){n.enabled&&t&&n.remove(t)},get:function(t){if(!n.enabled)return null;if(t){var e=n.get(t);return e?e.exp&&(new Date).getTime()-e.time>e.exp?null:e.val:null}return null}}}},{store:23}],27:[function(t,e){e.exports={draw:function(t,n){if(t){var r=e.exports.getElement(n);r&&(t.append?t.append(r):t.appendChild(r))}},getElement:function(t){if(t&&0==t.indexOf("<svg")){var e=new DOMParser,n=e.parseFromString(t,"text/xml"),r=n.documentElement,i=document.createElement("div");i.className="svgImg";i.appendChild(r);return i}return!1}}},{}],28:[function(t,e){e.exports={name:"yasgui-yasr",description:"Yet Another SPARQL Resultset GUI",version:"2.4.8",main:"src/main.js",licenses:[{type:"MIT",url:"http://yasr.yasgui.org/license.txt"}],author:"Laurens Rietveld",homepage:"http://yasr.yasgui.org",devDependencies:{browserify:"^6.1.0",gulp:"~3.6.0","gulp-bump":"^0.1.11","gulp-concat":"^2.4.1","gulp-connect":"^2.0.5","gulp-embedlr":"^0.5.2","gulp-filter":"^1.0.2","gulp-git":"^0.5.2","gulp-jsvalidate":"^0.2.0","gulp-livereload":"^1.3.1","gulp-minify-css":"^0.3.11","gulp-notify":"^2.0.1","gulp-rename":"^1.2.0","gulp-streamify":"0.0.5","gulp-tag-version":"^1.1.0","gulp-uglify":"^1.0.1","require-dir":"^0.1.0","run-sequence":"^1.0.1","vinyl-buffer":"^1.0.0","vinyl-source-stream":"~0.1.1",watchify:"^0.6.4","gulp-sourcemaps":"^1.2.8",exorcist:"^0.1.6","vinyl-transform":"0.0.1","gulp-sass":"^1.2.2","bootstrap-sass":"^3.3.1","browserify-transform-tools":"^1.2.1","gulp-cssimport":"^1.3.1","gulp-html-replace":"^1.4.1","browserify-shim":"^3.8.1"},bugs:"https://github.com/YASGUI/YASR/issues/",keywords:["JavaScript","SPARQL","Editor","Semantic Web","Linked Data"],maintainers:[{name:"Laurens Rietveld",email:"laurens.rietveld@gmail.com",web:"http://laurensrietveld.nl"}],repository:{type:"git",url:"https://github.com/YASGUI/YASR.git"},dependencies:{jquery:"~ 1.11.0",codemirror:"^4.7.0","yasgui-utils":"^1.4.1",pivottable:"^1.2.2","jquery-ui":"^1.10.5",d3:"^3.4.13"},"browserify-shim":{google:"global:google"},browserify:{transform:["browserify-shim"]},optionalShim:{codemirror:{require:"codemirror",global:"CodeMirror"},jquery:{require:"jquery",global:"jQuery"},"../../lib/codemirror":{require:"codemirror",global:"CodeMirror"},"../lib/DataTables/media/js/jquery.dataTables.js":{require:"datatables",global:"jQuery"},datatables:{require:"datatables",global:"jQuery"},d3:{require:"d3",global:"d3"},"jquery-ui/sortable":{require:"jquery-ui/sortable",global:"jQuery"},pivottable:{require:"pivottable",global:"jQuery"}}}},{}],29:[function(t,e){"use strict";e.exports=function(t){var e='"',n=",",r="\n",i=t.head.vars,o=t.results.bindings,a=function(){for(var t=0;t<i.length;t++)u(i[t]);f+=r},s=function(){for(var t=0;t<o.length;t++){l(o[t]);f+=r}},l=function(t){for(var e=0;e<i.length;e++){var n=i[e];u(t.hasOwnProperty(n)?t[n].value:"")}},u=function(t){t.replace(e,e+e);c(t)&&(t=e+t+e);f+=" "+t+" "+n},c=function(t){var r=!1;t.match("[\\w|"+n+"|"+e+"]")&&(r=!0);return r},f="";a();s();return f}},{}],30:[function(t,e){"use strict";var n=t("jquery"),r=e.exports=function(e){var r=n("<div class='booleanResult'></div>"),i=function(){r.empty().appendTo(e.resultsContainer);var i=e.results.getBoolean(),o=null,a=null;if(i===!0){o="check";a="True"}else if(i===!1){o="cross";a="False"}else{r.width("140");a="Could not find boolean value in response"}o&&t("yasgui-utils").svg.draw(r,t("./imgs.js")[o]);n("<span></span>").text(a).appendTo(r)},o=function(){return e.results.getBoolean&&(e.results.getBoolean()===!0||0==e.results.getBoolean())};return{name:null,draw:i,hideFromSelection:!0,getPriority:10,canHandleResults:o}};r.version={"YASR-boolean":t("../package.json").version,jquery:n.fn.jquery}},{"../package.json":28,"./imgs.js":36,jquery:19,"yasgui-utils":25}],31:[function(t,e){"use strict";var n=t("jquery");e.exports={output:"table",useGoogleCharts:!0,outputPlugins:["table","error","boolean","rawResponse"],drawOutputSelector:!0,drawDownloadIcon:!0,getUsedPrefixes:null,persistency:{prefix:function(t){return"yasr_"+n(t.container).closest("[id]").attr("id")+"_"},outputSelector:function(){return"selector"},results:{id:function(t){return"results_"+n(t.container).closest("[id]").attr("id")},key:"results",maxSize:1e5}}}},{jquery:19}],32:[function(t,e){"use strict";var n=t("jquery"),r=e.exports=function(t){var e=n("<div class='errorResult'></div>"),i=n.extend(!0,{},r.defaults),o=function(){var t=null;if(i.tryQueryLink){var e=i.tryQueryLink();t=n("<button>",{"class":"yasr_btn yasr_tryQuery"}).text("Try query in new browser window").click(function(){window.open(e,"_blank");n(this).blur()})}return t},a=function(){var r=t.results.getException();e.empty().appendTo(t.resultsContainer);var a=n("<div>",{"class":"errorHeader"}).appendTo(e);if(0!==r.status){var s="Error";r.statusText&&r.statusText.length<100&&(s=r.statusText);s+=" (#"+r.status+")";a.append(n("<span>",{"class":"exception"}).text(s)).append(o());var l=null;r.responseText?l=r.responseText:"string"==typeof r&&(l=r);l&&e.append(n("<pre>").text(l))}else{a.append(o());e.append(n("<div>",{"class":"corsMessage"}).append(i.corsMessage))}},s=function(t){return t.results.getException()||!1};return{name:null,draw:a,getPriority:20,hideFromSelection:!0,canHandleResults:s}};r.defaults={corsMessage:"Unable to get response from endpoint",tryQueryLink:null}},{jquery:19}],33:[function(t,e){e.exports={GoogleTypeException:function(t,e){this.foundTypes=t;this.varName=e;this.toString=function(){var t="Conflicting data types found for variable "+this.varName+'. Assuming all values of this variable are "string".';t+=" To avoid this issue, cast the values in your SPARQL query to the intended xsd datatype";return t};this.toHtml=function(){var t="Conflicting data types found for variable <i>"+this.varName+'</i>. Assuming all values of this variable are "string".';t+=" As a result, several Google Charts will not render values of this particular variable.";t+=" To avoid this issue, cast the values in your SPARQL query to the intended xsd datatype";return t}}}},{}],34:[function(t,e){(function(n){var r=t("events").EventEmitter,i=(t("jquery"),!1),o=!1,a=function(){r.call(this);var t=this;this.init=function(){if(o||("undefined"!=typeof window?window.google:"undefined"!=typeof n?n.google:null)||i)("undefined"!=typeof window?window.google:"undefined"!=typeof n?n.google:null)?t.emit("initDone"):o&&t.emit("initError");else{i=!0;s("//google.com/jsapi",function(){i=!1;t.emit("initDone")});var e=100,r=6e3,a=+new Date,l=function(){if(!("undefined"!=typeof window?window.google:"undefined"!=typeof n?n.google:null))if(+new Date-a>r){o=!0;i=!1;t.emit("initError")}else setTimeout(l,e)};l()}};this.googleLoad=function(){var e=function(){("undefined"!=typeof window?window.google:"undefined"!=typeof n?n.google:null).load("visualization","1",{packages:["corechart","charteditor"],callback:function(){t.emit("done")}})};if(i){t.once("initDone",e);t.once("initError",function(){t.emit("error","Could not load google loader")})}else if("undefined"!=typeof window?window.google:"undefined"!=typeof n?n.google:null)e();else if(o)t.emit("error","Could not load google loader");else{t.once("initDone",e);t.once("initError",function(){t.emit("error","Could not load google loader")})}}},s=function(t,e){var n=document.createElement("script");n.type="text/javascript";n.readyState?n.onreadystatechange=function(){if("loaded"==n.readyState||"complete"==n.readyState){n.onreadystatechange=null;e()}}:n.onload=function(){e()};n.src=t;document.body.appendChild(n)};a.prototype=new r;e.exports=new a}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{events:5,jquery:19}],35:[function(t,e){(function(n){"use strict";function r(t,e,n){function r(t,e,o){var l,u,c,f,h,d,p,g;if(null==t||null==e)return t===e;if(t.__placeholder__||e.__placeholder__)return!0;if(t===e)return 0!==t||1/t==1/e;l=i.call(t);if(i.call(e)!=l)return!1;switch(l){case"[object String]":return t==String(e);case"[object Number]":return t!=+t?e!=+e:0==t?1/t==1/e:t==+e;case"[object Date]":case"[object Boolean]":return+t==+e;case"[object RegExp]":return t.source==e.source&&t.global==e.global&&t.multiline==e.multiline&&t.ignoreCase==e.ignoreCase}if("object"!=typeof t||"object"!=typeof e)return!1;u=o.length;for(;u--;)if(o[u]==t)return!0;o.push(t);c=0;f=!0;if("[object Array]"==l){h=t.length;d=e.length;if(s){switch(n){case"===":f=h===d;break;case"<==":f=d>=h;break;case"<<=":f=d>h}c=h;s=!1}else{f=h===d;c=h}if(f)for(;c--&&(f=c in t==c in e&&r(t[c],e[c],o)););}else{if("constructor"in t!="constructor"in e||t.constructor!=e.constructor)return!1;for(p in t)if(a(t,p)){c++;if(!(f=a(e,p)&&r(t[p],e[p],o)))break}if(f){g=0;for(p in e)a(e,p)&&++g;if(s)f="<<="===n?g>c:"<=="===n?g>=c:c===g;else{s=!1;f=c===g}}}o.pop();return f}var i={}.toString,o={}.hasOwnProperty,a=function(t,e){return o.call(t,e)},s=!0;return r(t,e,[])}var i=t("jquery"),o=t("./utils.js"),a=t("yasgui-utils"),s=e.exports=function(e){var l=i.extend(!0,{},s.defaults),u=e.container.closest("[id]").attr("id");null==e.options.gchart&&(e.options.gchart={});var c=e.getPersistencyId("motionchart"),f=e.getPersistencyId("chartConfig");null==e.options.gchart.motionChartState&&(e.options.gchart.motionChartState=a.storage.get(c));null==e.options.gchart.chartConfig&&(e.options.gchart.chartConfig=a.storage.get(f));var h=null,d=function(t){var i="undefined"!=typeof window?window.google:"undefined"!=typeof n?n.google:null;h=new i.visualization.ChartEditor;i.visualization.events.addListener(h,"ok",function(){var t,n;t=h.getChartWrapper();if(!r(t.getChartType,"MotionChart","===")){e.options.gchart.motionChartState=t.n;a.storage.set(c,e.options.gchart.motionChartState);t.setOption("state",e.options.gchart.motionChartState);i.visualization.events.addListener(t,"ready",function(){var n;n=t.getChart();i.visualization.events.addListener(n,"statechange",function(){e.options.gchart.motionChartState=n.getState();a.storage.set(c,e.options.gchart.motionChartState)})})}n=t.getDataTable();t.setDataTable(null);e.options.gchart.chartConfig=t.toJSON();a.storage.set(f,e.options.gchart.chartConfig);t.setDataTable(n);t.draw()});t&&t()};return{name:"Google Chart",hideFromSelection:!1,priority:7,canHandleResults:function(t){var e,n;return null!=(e=t.results)&&(n=e.getVariables())&&n.length>0},getDownloadInfo:function(){if(!e.results)return null;var t=e.resultsContainer.find("svg");return 0==t.length?null:{getContent:function(){return t[0].outerHTML},filename:"queryResults.svg",contentType:"image/svg+xml",buttonTitle:"Download SVG Image"}},draw:function(){var r=function(){e.resultsContainer.empty();var n=u+"_gchartWrapper",r=null;e.resultsContainer.append(i("<button>",{"class":"openGchartBtn yasr_btn"}).text("Chart Config").click(function(){h.openDialog(r)})).append(i("<div>",{id:n,"class":"gchartWrapper"}));var s=new google.visualization.DataTable,f=e.results.getAsJson();f.head.vars.forEach(function(n){var r="string";try{r=o.getGoogleTypeForBindings(f.results.bindings,n)}catch(i){if(!(i instanceof t("./exceptions.js").GoogleTypeException))throw i;e.warn(i.toHtml())}s.addColumn(r,n)});var d=null;e.options.getUsedPrefixes&&(d="function"==typeof e.options.getUsedPrefixes?e.options.getUsedPrefixes(e):e.options.getUsedPrefixes);f.results.bindings.forEach(function(t){var e=[];f.head.vars.forEach(function(n,r){e.push(o.castGoogleType(t[n],d,s.getColumnType(r)))});s.addRow(e)});if(e.options.gchart.chartConfig){r=new google.visualization.ChartWrapper(e.options.gchart.chartConfig);if("MotionChart"===r.getChartType()&&null!=e.options.gchart.motionChartState){r.setOption("state",e.options.gchart.motionChartState);google.visualization.events.addListener(r,"ready",function(){var t;t=r.getChart();google.visualization.events.addListener(t,"statechange",function(){e.options.gchart.motionChartState=t.getState();a.storage.set(c,e.options.gchart.motionChartState)})})}r.setDataTable(s)}else r=new google.visualization.ChartWrapper({chartType:"Table",dataTable:s,containerId:n});r.setOption("width",l.width);r.setOption("height",l.height);r.draw();e.updateHeader()};("undefined"!=typeof window?window.google:"undefined"!=typeof n?n.google:null)&&("undefined"!=typeof window?window.google:"undefined"!=typeof n?n.google:null).visualization&&h?r():t("./gChartLoader.js").on("done",function(){d();r()}).on("error",function(){console.log("errorrr")}).googleLoad()}}};s.defaults={height:"600px",width:"100%",persistencyId:"gchart"}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./exceptions.js":33,"./gChartLoader.js":34,"./utils.js":47,jquery:19,"yasgui-utils":25}],36:[function(t,e){"use strict";e.exports={cross:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" x="0px" y="0px" width="30px" height="30px" viewBox="0 0 100 100" enable-background="new 0 0 100 100" xml:space="preserve"><g> <path d="M83.288,88.13c-2.114,2.112-5.575,2.112-7.689,0L53.659,66.188c-2.114-2.112-5.573-2.112-7.687,0L24.251,87.907 c-2.113,2.114-5.571,2.114-7.686,0l-4.693-4.691c-2.114-2.114-2.114-5.573,0-7.688l21.719-21.721c2.113-2.114,2.113-5.573,0-7.686 L11.872,24.4c-2.114-2.113-2.114-5.571,0-7.686l4.842-4.842c2.113-2.114,5.571-2.114,7.686,0L46.12,33.591 c2.114,2.114,5.572,2.114,7.688,0l21.721-21.719c2.114-2.114,5.573-2.114,7.687,0l4.695,4.695c2.111,2.113,2.111,5.571-0.003,7.686 L66.188,45.973c-2.112,2.114-2.112,5.573,0,7.686L88.13,75.602c2.112,2.111,2.112,5.572,0,7.687L83.288,88.13z"/></g></svg>',check:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" x="0px" y="0px" width="30px" height="30px" viewBox="0 0 100 100" enable-background="new 0 0 100 100" xml:space="preserve"><path fill="#000000" d="M14.301,49.982l22.606,17.047L84.361,4.903c2.614-3.733,7.76-4.64,11.493-2.026l0.627,0.462 c3.732,2.614,4.64,7.758,2.025,11.492l-51.783,79.77c-1.955,2.791-3.896,3.762-7.301,3.988c-3.405,0.225-5.464-1.039-7.508-3.084 L2.447,61.814c-3.263-3.262-3.263-8.553,0-11.814l0.041-0.019C5.75,46.718,11.039,46.718,14.301,49.982z"/></svg>',unsorted:'<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" version="1.1" id="Layer_1" x="0px" y="0px" width="100%" height="100%" viewBox="0 0 54.552711 113.78478" enable-background="new 0 0 100 100" xml:space="preserve"><g id="g5" transform="matrix(-0.70522156,-0.70898699,-0.70898699,0.70522156,97.988199,55.081205)"><path style="fill:#000000" inkscape:connector-curvature="0" id="path7" d="M 57.911,66.915 45.808,55.063 42.904,52.238 31.661,41.25 31.435,41.083 31.131,40.775 30.794,40.523 30.486,40.3 30.069,40.05 29.815,39.911 29.285,39.659 29.089,39.576 28.474,39.326 28.363,39.297 H 28.336 L 27.665,39.128 27.526,39.1 26.94,38.99 26.714,38.961 26.212,38.934 h -0.31 -0.444 l -0.339,0.027 c -1.45,0.139 -2.876,0.671 -4.11,1.564 l -0.223,0.141 -0.279,0.25 -0.335,0.308 -0.054,0.029 -0.171,0.194 -0.334,0.364 -0.224,0.279 -0.25,0.336 -0.225,0.362 -0.192,0.308 -0.197,0.421 -0.142,0.279 -0.193,0.477 -0.084,0.222 -12.441,38.414 c -0.814,2.458 -0.313,5.029 1.115,6.988 v 0.026 l 0.418,0.532 0.17,0.165 0.251,0.281 0.084,0.079 0.283,0.281 0.25,0.194 0.474,0.367 0.083,0.053 c 2.015,1.371 4.641,1.874 7.131,1.094 L 55.228,80.776 c 4.303,-1.342 6.679,-5.814 5.308,-10.006 -0.387,-1.259 -1.086,-2.35 -1.979,-3.215 l -0.368,-0.337 -0.278,-0.303 z m -6.318,5.896 0.079,0.114 -37.369,11.57 11.854,-36.538 10.565,10.317 2.876,2.825 11.995,11.712 z" /></g><path style="fill:#000000" inkscape:connector-curvature="0" id="path7-9" d="m 8.8748339,52.571766 16.9382111,-0.222584 4.050851,-0.06665 15.719154,-0.222166 0.27778,-0.04246 0.43276,0.0017 0.41632,-0.06121 0.37532,-0.0611 0.47132,-0.119342 0.27767,-0.08206 0.55244,-0.198047 0.19707,-0.08043 0.61095,-0.259721 0.0988,-0.05825 0.019,-0.01914 0.59303,-0.356548 0.11787,-0.0788 0.49125,-0.337892 0.17994,-0.139779 0.37317,-0.336871 0.21862,-0.219786 0.31311,-0.31479 0.21993,-0.259387 c 0.92402,-1.126057 1.55249,-2.512251 1.78961,-4.016904 l 0.0573,-0.25754 0.0195,-0.374113 0.0179,-0.454719 0.0175,-0.05874 -0.0169,-0.258049 -0.0225,-0.493503 -0.0398,-0.355569 -0.0619,-0.414201 -0.098,-0.414812 -0.083,-0.353334 L 53.23955,41.1484 53.14185,40.850967 52.93977,40.377742 52.84157,40.161628 34.38021,4.2507375 C 33.211567,1.9401875 31.035446,0.48226552 28.639484,0.11316952 l -0.01843,-0.01834 -0.671963,-0.07882 -0.236871,0.0042 L 27.335984,-4.7826577e-7 27.220736,0.00379952 l -0.398804,0.0025 -0.313848,0.04043 -0.594474,0.07724 -0.09611,0.02147 C 23.424549,0.60716252 21.216017,2.1142355 20.013025,4.4296865 L 0.93967491,40.894479 c -2.08310801,3.997178 -0.588125,8.835482 3.35080799,10.819749 1.165535,0.613495 2.43199,0.88731 3.675026,0.864202 l 0.49845,-0.02325 0.410875,0.01658 z M 9.1502369,43.934401 9.0136999,43.910011 27.164145,9.2564625 44.70942,43.42818 l -14.765289,0.214677 -4.031106,0.0468 -16.7627881,0.244744 z" /></svg>',sortDesc:'<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" version="1.1" id="Layer_1" x="0px" y="0px" width="100%" height="100%" viewBox="0 0 54.552711 113.78478" enable-background="new 0 0 100 100" xml:space="preserve"><g id="g5" transform="matrix(-0.70522156,-0.70898699,-0.70898699,0.70522156,97.988199,55.081205)"><path style="fill:#000000" inkscape:connector-curvature="0" id="path7" d="M 57.911,66.915 45.808,55.063 42.904,52.238 31.661,41.25 31.435,41.083 31.131,40.775 30.794,40.523 30.486,40.3 30.069,40.05 29.815,39.911 29.285,39.659 29.089,39.576 28.474,39.326 28.363,39.297 H 28.336 L 27.665,39.128 27.526,39.1 26.94,38.99 26.714,38.961 26.212,38.934 h -0.31 -0.444 l -0.339,0.027 c -1.45,0.139 -2.876,0.671 -4.11,1.564 l -0.223,0.141 -0.279,0.25 -0.335,0.308 -0.054,0.029 -0.171,0.194 -0.334,0.364 -0.224,0.279 -0.25,0.336 -0.225,0.362 -0.192,0.308 -0.197,0.421 -0.142,0.279 -0.193,0.477 -0.084,0.222 -12.441,38.414 c -0.814,2.458 -0.313,5.029 1.115,6.988 v 0.026 l 0.418,0.532 0.17,0.165 0.251,0.281 0.084,0.079 0.283,0.281 0.25,0.194 0.474,0.367 0.083,0.053 c 2.015,1.371 4.641,1.874 7.131,1.094 L 55.228,80.776 c 4.303,-1.342 6.679,-5.814 5.308,-10.006 -0.387,-1.259 -1.086,-2.35 -1.979,-3.215 l -0.368,-0.337 -0.278,-0.303 z m -6.318,5.896 0.079,0.114 -37.369,11.57 11.854,-36.538 10.565,10.317 2.876,2.825 11.995,11.712 z" /></g><path style="fill:#000000" inkscape:connector-curvature="0" id="path9" d="m 27.813273,0.12823506 0.09753,0.02006 c 2.39093,0.458209 4.599455,1.96811104 5.80244,4.28639004 L 52.785897,40.894525 c 2.088044,4.002139 0.590949,8.836902 -3.348692,10.821875 -1.329078,0.688721 -2.766603,0.943695 -4.133174,0.841768 l -0.454018,0.02 L 27.910392,52.354171 23.855313,52.281851 8.14393,52.061827 7.862608,52.021477 7.429856,52.021738 7.014241,51.959818 6.638216,51.900838 6.164776,51.779369 5.889216,51.699439 5.338907,51.500691 5.139719,51.419551 4.545064,51.145023 4.430618,51.105123 4.410168,51.084563 3.817138,50.730843 3.693615,50.647783 3.207314,50.310611 3.028071,50.174369 2.652795,49.833957 2.433471,49.613462 2.140099,49.318523 1.901127,49.041407 C 0.97781,47.916059 0.347935,46.528448 0.11153,45.021676 L 0.05352,44.766255 0.05172,44.371683 0.01894,43.936017 0,43.877277 0.01836,43.62206 0.03666,43.122889 0.0765,42.765905 0.13912,42.352413 0.23568,41.940425 0.32288,41.588517 0.481021,41.151945 0.579391,40.853806 0.77369,40.381268 0.876097,40.162336 19.338869,4.2542801 c 1.172169,-2.308419 3.34759,-3.76846504 5.740829,-4.17716604 l 0.01975,0.01985 0.69605,-0.09573 0.218437,0.0225 0.490791,-0.02132 0.39809,0.0046 0.315972,0.03973 0.594462,0.08149 z" /></svg>',sortAsc:'<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" version="1.1" id="Layer_1" x="0px" y="0px" width="100%" height="100%" viewBox="0 0 54.552711 113.78478" enable-background="new 0 0 100 100" xml:space="preserve"><g id="g5" transform="matrix(-0.70522156,0.70898699,-0.70898699,-0.70522156,97.988199,58.704807)"><path style="fill:#000000" inkscape:connector-curvature="0" id="path7" d="M 57.911,66.915 45.808,55.063 42.904,52.238 31.661,41.25 31.435,41.083 31.131,40.775 30.794,40.523 30.486,40.3 30.069,40.05 29.815,39.911 29.285,39.659 29.089,39.576 28.474,39.326 28.363,39.297 H 28.336 L 27.665,39.128 27.526,39.1 26.94,38.99 26.714,38.961 26.212,38.934 h -0.31 -0.444 l -0.339,0.027 c -1.45,0.139 -2.876,0.671 -4.11,1.564 l -0.223,0.141 -0.279,0.25 -0.335,0.308 -0.054,0.029 -0.171,0.194 -0.334,0.364 -0.224,0.279 -0.25,0.336 -0.225,0.362 -0.192,0.308 -0.197,0.421 -0.142,0.279 -0.193,0.477 -0.084,0.222 -12.441,38.414 c -0.814,2.458 -0.313,5.029 1.115,6.988 v 0.026 l 0.418,0.532 0.17,0.165 0.251,0.281 0.084,0.079 0.283,0.281 0.25,0.194 0.474,0.367 0.083,0.053 c 2.015,1.371 4.641,1.874 7.131,1.094 L 55.228,80.776 c 4.303,-1.342 6.679,-5.814 5.308,-10.006 -0.387,-1.259 -1.086,-2.35 -1.979,-3.215 l -0.368,-0.337 -0.278,-0.303 z m -6.318,5.896 0.079,0.114 -37.369,11.57 11.854,-36.538 10.565,10.317 2.876,2.825 11.995,11.712 z" /></g><path style="fill:#000000" inkscape:connector-curvature="0" id="path9" d="m 27.813273,113.65778 0.09753,-0.0201 c 2.39093,-0.45821 4.599455,-1.96811 5.80244,-4.28639 L 52.785897,72.891487 c 2.088044,-4.002139 0.590949,-8.836902 -3.348692,-10.821875 -1.329078,-0.688721 -2.766603,-0.943695 -4.133174,-0.841768 l -0.454018,-0.02 -16.939621,0.223997 -4.055079,0.07232 -15.711383,0.220024 -0.281322,0.04035 -0.432752,-2.61e-4 -0.415615,0.06192 -0.376025,0.05898 -0.47344,0.121469 -0.27556,0.07993 -0.550309,0.198748 -0.199188,0.08114 -0.594655,0.274528 -0.114446,0.0399 -0.02045,0.02056 -0.59303,0.35372 -0.123523,0.08306 -0.486301,0.337172 -0.179243,0.136242 -0.375276,0.340412 -0.219324,0.220495 -0.293372,0.294939 -0.238972,0.277116 C 0.97781,65.869953 0.347935,67.257564 0.11153,68.764336 L 0.05352,69.019757 0.05172,69.414329 0.01894,69.849995 0,69.908735 l 0.01836,0.255217 0.0183,0.499171 0.03984,0.356984 0.06262,0.413492 0.09656,0.411988 0.0872,0.351908 0.158141,0.436572 0.09837,0.298139 0.194299,0.472538 0.102407,0.218932 18.462772,35.908054 c 1.172169,2.30842 3.34759,3.76847 5.740829,4.17717 l 0.01975,-0.0199 0.69605,0.0957 0.218437,-0.0225 0.490791,0.0213 0.39809,-0.005 0.315972,-0.0397 0.594462,-0.0815 z" /></svg>',download:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" baseProfile="tiny" x="0px" y="0px" width="100%" height="100%" viewBox="0 0 100 100" xml:space="preserve"><g id="Captions"></g><g id="Your_Icon"> <path fill-rule="evenodd" fill="#000000" d="M88,84v-2c0-2.961-0.859-4-4-4H16c-2.961,0-4,0.98-4,4v2c0,3.102,1.039,4,4,4h68 C87.02,88,88,87.039,88,84z M58,12H42c-5,0-6,0.941-6,6v22H16l34,34l34-34H64V18C64,12.941,62.939,12,58,12z"/></g></svg>',move:'<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" version="1.1" id="Layer_1" x="0px" y="0px" width="100%" height="100%" viewBox="5 -10 74.074074 100" enable-background="new 0 0 100 100" xml:space="preserve" inkscape:version="0.48.4 r9939" sodipodi:docname="noun_11656_cc.svg"><metadata ><rdf:RDF><cc:Work rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs /><sodipodi:namedview pagecolor="#ffffff" bordercolor="#666666" borderopacity="1" objecttolerance="10" gridtolerance="10" guidetolerance="10" inkscape:pageopacity="0" inkscape:pageshadow="2" inkscape:window-width="753" inkscape:window-height="480" showgrid="false" fit-margin-top="0" fit-margin-left="0" fit-margin-right="0" fit-margin-bottom="0" inkscape:zoom="2.36" inkscape:cx="44.101509" inkscape:cy="31.481481" inkscape:window-x="287" inkscape:window-y="249" inkscape:window-maximized="0" inkscape:current-layer="Layer_1" /><polygon points="33,83 50,100 67,83 54,83 54,17 67,17 50,0 33,17 46,17 46,83 " transform="translate(-7.962963,-10)" /><polygon points="83,67 100,50 83,33 83,46 17,46 17,33 0,50 17,67 17,54 83,54 " transform="translate(-7.962963,-10)" /></svg>',fullscreen:'<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" version="1.1" x="0px" y="0px" width="100%" height="100%" viewBox="5 -10 74.074074 100" enable-background="new 0 0 100 100" xml:space="preserve" inkscape:version="0.48.4 r9939" sodipodi:docname="noun_2186_cc.svg"><metadata ><rdf:RDF><cc:Work rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs /><sodipodi:namedview pagecolor="#ffffff" bordercolor="#666666" borderopacity="1" objecttolerance="10" gridtolerance="10" guidetolerance="10" inkscape:pageopacity="0" inkscape:pageshadow="2" inkscape:window-width="640" inkscape:window-height="480" showgrid="false" fit-margin-top="0" fit-margin-left="0" fit-margin-right="0" fit-margin-bottom="0" inkscape:zoom="2.36" inkscape:cx="44.101509" inkscape:cy="31.481481" inkscape:window-x="65" inkscape:window-y="24" inkscape:window-maximized="0" inkscape:current-layer="Layer_1" /><path d="m -7.962963,-10 v 38.889 l 16.667,-16.667 16.667,16.667 5.555,-5.555 -16.667,-16.667 16.667,-16.667 h -38.889 z" inkscape:connector-curvature="0" style="fill:#010101" /><path d="m 92.037037,-10 v 38.889 l -16.667,-16.667 -16.666,16.667 -5.556,-5.555 16.666,-16.667 -16.666,-16.667 h 38.889 z" inkscape:connector-curvature="0" style="fill:#010101" /><path d="M -7.962963,90 V 51.111 l 16.667,16.666 16.667,-16.666 5.555,5.556 -16.667,16.666 16.667,16.667 h -38.889 z" inkscape:connector-curvature="0" style="fill:#010101" /><path d="M 92.037037,90 V 51.111 l -16.667,16.666 -16.666,-16.666 -5.556,5.556 16.666,16.666 -16.666,16.667 h 38.889 z" inkscape:connector-curvature="0" style="fill:#010101" /></svg>',smallscreen:'<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" version="1.1" x="0px" y="0px" width="100%" height="100%" viewBox="5 -10 74.074074 100" enable-background="new 0 0 100 100" xml:space="preserve" inkscape:version="0.48.4 r9939" sodipodi:docname="noun_2186_cc.svg"><metadata ><rdf:RDF><cc:Work rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs /><sodipodi:namedview pagecolor="#ffffff" bordercolor="#666666" borderopacity="1" objecttolerance="10" gridtolerance="10" guidetolerance="10" inkscape:pageopacity="0" inkscape:pageshadow="2" inkscape:window-width="1855" inkscape:window-height="1056" showgrid="false" fit-margin-top="0" fit-margin-left="0" fit-margin-right="0" fit-margin-bottom="0" inkscape:zoom="2.36" inkscape:cx="44.101509" inkscape:cy="31.481481" inkscape:window-x="65" inkscape:window-y="24" inkscape:window-maximized="1" inkscape:current-layer="Layer_1" /><path d="m 30.926037,28.889 0,-38.889 -16.667,16.667 -16.667,-16.667 -5.555,5.555 16.667,16.667 -16.667,16.667 38.889,0 z" inkscape:connector-curvature="0" style="fill:#010101" /><path d="m 53.148037,28.889 0,-38.889 16.667,16.667 16.666,-16.667 5.556,5.555 -16.666,16.667 16.666,16.667 -38.889,0 z" inkscape:connector-curvature="0" style="fill:#010101" /><path d="m 30.926037,51.111 0,38.889 -16.667,-16.666 -16.667,16.666 -5.555,-5.556 16.667,-16.666 -16.667,-16.667 38.889,0 z" inkscape:connector-curvature="0" style="fill:#010101" /><path d="m 53.148037,51.111 0,38.889 16.667,-16.666 16.666,16.666 5.556,-5.556 -16.666,-16.666 16.666,-16.667 -38.889,0 z" inkscape:connector-curvature="0" style="fill:#010101" /></svg>'}},{}],37:[function(t,e){"use strict";var n=t("jquery"),r=t("yasgui-utils");console=console||{log:function(){}};var i=e.exports=function(e,o,a){var s={};s.options=n.extend(!0,{},i.defaults,o);s.container=n("<div class='yasr'></div>").appendTo(e);s.header=n("<div class='yasr_header'></div>").appendTo(s.container);s.resultsContainer=n("<div class='yasr_results'></div>").appendTo(s.container);s.storage=r.storage;var l=null;s.getPersistencyId=function(t){null===l&&(l=s.options.persistency&&s.options.persistency.prefix?"string"==typeof s.options.persistency.prefix?s.options.persistency.prefix:s.options.persistency.prefix(s):!1);return l&&t?l+("string"==typeof t?t:t(s)):null};s.options.useGoogleCharts&&t("./gChartLoader.js").once("initError",function(){s.options.useGoogleCharts=!1
}).init();s.plugins={};for(var u in i.plugins)(s.options.useGoogleCharts||"gchart"!=u)&&(s.plugins[u]=new i.plugins[u](s));s.updateHeader=function(){var t=s.header.find(".yasr_downloadIcon").removeAttr("title"),e=s.plugins[s.options.output];if(e){var n=e.getDownloadInfo?e.getDownloadInfo():null;if(n){n.buttonTitle&&t.attr("title",n.buttonTitle);t.prop("disabled",!1);t.find("path").each(function(){this.style.fill="black"})}else{t.prop("disabled",!0).prop("title","Download not supported for this result representation");t.find("path").each(function(){this.style.fill="gray"})}}};s.draw=function(t){if(!s.results)return!1;t||(t=s.options.output);var e=null,r=-1,i=[];for(var o in s.plugins)if(s.plugins[o].canHandleResults(s)){var a=s.plugins[o].getPriority;"function"==typeof a&&(a=a(s));if(null!=a&&void 0!=a&&a>r){r=a;e=o}}else i.push(o);c(i);if(t in s.plugins&&s.plugins[t].canHandleResults(s)){n(s.resultsContainer).empty();s.plugins[t].draw();return!0}if(e){n(s.resultsContainer).empty();s.plugins[e].draw();return!0}return!1};var c=function(t){s.header.find(".yasr_btnGroup .yasr_btn").removeClass("disabled");t.forEach(function(t){s.header.find(".yasr_btnGroup .select_"+t).addClass("disabled")})};s.somethingDrawn=function(){return!s.resultsContainer.is(":empty")};s.setResponse=function(e,n,i){try{s.results=t("./parsers/wrapper.js")(e,n,i)}catch(o){s.results={getException:function(){return o}}}s.draw();var a=s.getPersistencyId(s.options.persistency.results.key);a&&(s.results.getOriginalResponseAsString&&s.results.getOriginalResponseAsString().length<s.options.persistency.results.maxSize?r.storage.set(a,s.results.getAsStoreObject(),"month"):r.storage.remove(a))};var f=null,h=null,d=null;s.warn=function(t){if(!f){f=n("<div>",{"class":"toggableWarning"}).prependTo(s.container).hide();h=n("<span>",{"class":"toggleWarning"}).html("×").click(function(){f.hide(400)}).appendTo(f);d=n("<span>",{"class":"toggableMsg"}).appendTo(f)}d.empty();t instanceof n?d.append(t):d.html(t);f.show(400)};var p=function(e){var i=function(){var t=n('<div class="yasr_btnGroup"></div>');n.each(e.plugins,function(i,o){if(!o.hideFromSelection){var a=o.name||i,s=n("<button class='yasr_btn'></button>").text(a).addClass("select_"+i).click(function(){t.find("button.selected").removeClass("selected");n(this).addClass("selected");e.options.output=i;var o=e.getPersistencyId(e.options.persistency.outputSelector);o&&r.storage.set(o,e.options.output,"month");f&&f.hide(400);e.draw();e.updateHeader()}).appendTo(t);e.options.output==i&&s.addClass("selected")}});t.children().length>1&&e.header.append(t)},o=function(){var r=function(t,e){var n=null,r=window.URL||window.webkitURL||window.mozURL||window.msURL;if(r&&Blob){var i=new Blob([t],{type:e});n=r.createObjectURL(i)}return n},i=n("<button class='yasr_btn yasr_downloadIcon btn_icon'></button>").append(t("yasgui-utils").svg.getElement(t("./imgs.js").download)).click(function(){var i=e.plugins[e.options.output];if(i&&i.getDownloadInfo){var o=i.getDownloadInfo(),a=r(o.getContent(),o.contentType?o.contentType:"text/plain"),s=n("<a></a>",{href:a,download:o.filename});t("./utils.js").fireClick(s)}});e.header.append(i)},a=function(){var r=n("<button class='yasr_btn btn_fullscreen btn_icon'></button>").append(t("yasgui-utils").svg.getElement(t("./imgs.js").fullscreen)).click(function(){e.container.addClass("yasr_fullscreen")});e.header.append(r)},s=function(){var r=n("<button class='yasr_btn btn_smallscreen btn_icon'></button>").append(t("yasgui-utils").svg.getElement(t("./imgs.js").smallscreen)).click(function(){e.container.removeClass("yasr_fullscreen")});e.header.append(r)};a();s();e.options.drawOutputSelector&&i();e.options.drawDownloadIcon&&o()},g=s.getPersistencyId(s.options.persistency.outputSelector);if(g){var m=r.storage.get(g);m&&(s.options.output=m)}p(s);if(!a&&s.options.persistency&&s.options.persistency.results){var v,y=s.getPersistencyId(s.options.persistency.results.key);y&&(v=r.storage.get(y));if(!v&&s.options.persistency.results.id){var b="string"==typeof s.options.persistency.results.id?s.options.persistency.results.id:s.options.persistency.results.id(s);if(b){v=r.storage.get(b);v&&r.storage.remove(b)}}v&&(n.isArray(v)?s.setResponse.apply(this,v):s.setResponse(v))}a&&s.setResponse(a);s.updateHeader();return s};i.plugins={};i.registerOutput=function(t,e){i.plugins[t]=e};i.defaults=t("./defaults.js");i.version={YASR:t("../package.json").version,jquery:n.fn.jquery,"yasgui-utils":t("yasgui-utils").version};i.$=n;try{i.registerOutput("boolean",t("./boolean.js"))}catch(o){}try{i.registerOutput("rawResponse",t("./rawResponse.js"))}catch(o){}try{i.registerOutput("table",t("./table.js"))}catch(o){}try{i.registerOutput("error",t("./error.js"))}catch(o){}try{i.registerOutput("pivot",t("./pivot.js"))}catch(o){}try{i.registerOutput("gchart",t("./gchart.js"))}catch(o){}},{"../package.json":28,"./boolean.js":30,"./defaults.js":31,"./error.js":32,"./gChartLoader.js":34,"./gchart.js":35,"./imgs.js":36,"./parsers/wrapper.js":42,"./pivot.js":44,"./rawResponse.js":45,"./table.js":46,"./utils.js":47,jquery:19,"yasgui-utils":25}],38:[function(t,e){"use strict";t("jquery"),e.exports=function(e){return t("./dlv.js")(e,",")}},{"./dlv.js":39,jquery:19}],39:[function(t,e){"use strict";var n=t("jquery");t("../../lib/jquery.csv-0.71.js");e.exports=function(t,e){var r={},i=n.csv.toArrays(t,{separator:e}),o=function(t){return 0==t.indexOf("http")?"uri":null},a=function(){if(2==i.length&&1==i[0].length&&1==i[1].length&&"boolean"==i[0][0]&&("1"==i[1][0]||"0"==i[1][0])){r.boolean="1"==i[1][0]?!0:!1;return!0}return!1},s=function(){if(i.length>0&&i[0].length>0){r.head={vars:i[0]};return!0}return!1},l=function(){if(i.length>1){r.results={bindings:[]};for(var t=1;t<i.length;t++){for(var e={},n=0;n<i[t].length;n++){var a=r.head.vars[n];if(a){var s=i[t][n],l=o(s);e[a]={value:s};l&&(e[a].type=l)}}r.results.bindings.push(e)}r.head={vars:i[0]};return!0}return!1},u=a();if(!u){var c=s();c&&l()}return r}},{"../../lib/jquery.csv-0.71.js":4,jquery:19}],40:[function(t,e){"use strict";t("jquery"),e.exports=function(t){if("string"==typeof t)try{return JSON.parse(t)}catch(e){return!1}return"object"==typeof t&&t.constructor==={}.constructor?t:!1}},{jquery:19}],41:[function(t,e){"use strict";t("jquery"),e.exports=function(e){return t("./dlv.js")(e," ")}},{"./dlv.js":39,jquery:19}],42:[function(t,e){"use strict";t("jquery"),e.exports=function(e,n,r){var i={xml:t("./xml.js"),json:t("./json.js"),tsv:t("./tsv.js"),csv:t("./csv.js")},o=null,a=null,s=null,l=null,u=null,c=function(){if("object"==typeof e){if(e.exception)u=e.exception;else if(void 0!=e.status&&(e.status>=300||0===e.status)){u={status:e.status};"string"==typeof r&&(u.errorString=r);e.responseText&&(u.responseText=e.responseText);e.statusText&&(u.statusText=e.statusText)}if(e.contentType)o=e.contentType.toLowerCase();else if(e.getResponseHeader&&e.getResponseHeader("content-type")){var t=e.getResponseHeader("content-type").trim().toLowerCase();t.length>0&&(o=t)}e.response?a=e.response:n||r||(a=e)}u||a||(a=e.responseText?e.responseText:e)},f=function(){if(s)return s;if(s===!1||u)return!1;var t=function(){if(o)if(o.indexOf("json")>-1){try{s=i.json(a)}catch(t){u=t}l="json"}else if(o.indexOf("xml")>-1){try{s=i.xml(a)}catch(t){u=t}l="xml"}else if(o.indexOf("csv")>-1){try{s=i.csv(a)}catch(t){u=t}l="csv"}else if(o.indexOf("tab-separated")>-1){try{s=i.tsv(a)}catch(t){u=t}l="tsv"}},e=function(){s=i.json(a);if(s)l="json";else try{s=i.xml(a);s&&(l="xml")}catch(t){}};t();s||e();s||(s=!1);return s},h=function(){var t=f();return t&&"head"in t?t.head.vars:null},d=function(){var t=f();return t&&"results"in t?t.results.bindings:null},p=function(){var t=f();return t&&"boolean"in t?t.boolean:null},g=function(){return a},m=function(){var t="";"string"==typeof a?t=a:"json"==l?t=JSON.stringify(a,void 0,2):"xml"==l&&(t=(new XMLSerializer).serializeToString(a));return t},v=function(){return u},y=function(){null==l&&f();return l},b=function(){var t={};if(e.status){t.status=e.status;t.responseText=e.responseText;t.statusText=e.statusText;t.contentType=o}else t=e;var i=n,a=void 0;"string"==typeof r&&(a=r);return[t,i,a]};c();s=f();return{getAsStoreObject:b,getAsJson:f,getOriginalResponse:g,getOriginalResponseAsString:m,getOriginalContentType:function(){return o},getVariables:h,getBindings:d,getBoolean:p,getType:y,getException:v}}},{"./csv.js":38,"./json.js":40,"./tsv.js":41,"./xml.js":43,jquery:19}],43:[function(t,e){"use strict";{var n=t("jquery");e.exports=function(t){var e=function(t){a.head={};for(var e=0;e<t.childNodes.length;e++){var n=t.childNodes[e];if("variable"==n.nodeName){a.head.vars||(a.head.vars=[]);var r=n.getAttribute("name");r&&a.head.vars.push(r)}}},r=function(t){a.results={};a.results.bindings=[];for(var e=0;e<t.childNodes.length;e++){for(var n=t.childNodes[e],r=null,i=0;i<n.childNodes.length;i++){var o=n.childNodes[i];if("binding"==o.nodeName){var s=o.getAttribute("name");if(s){r=r||{};r[s]={};for(var l=0;l<o.childNodes.length;l++){var u=o.childNodes[l],c=u.nodeName;if("#text"!=c){r[s].type=c;r[s].value=u.innerHTML;var f=u.getAttribute("datatype");f&&(r[s].datatype=f)}}}}}r&&a.results.bindings.push(r)}},i=function(t){a.boolean="true"==t.innerHTML?!0:!1},o=null;"string"==typeof t?o=n.parseXML(t):n.isXMLDoc(t)&&(o=t);var t=null;if(!(o.childNodes.length>0))return null;t=o.childNodes[0];for(var a={},s=0;s<t.childNodes.length;s++){var l=t.childNodes[s];"head"==l.nodeName&&e(l);"results"==l.nodeName&&r(l);"boolean"==l.nodeName&&i(l)}return a}}},{jquery:19}],44:[function(t,e){"use strict";var n=t("jquery"),r=t("./utils.js"),i=t("yasgui-utils"),o=t("./imgs.js");t("jquery-ui/sortable");t("pivottable");if(!n.fn.pivotUI)throw new Error("Pivot lib not loaded");var a=e.exports=function(e){var s=n.extend(!0,{},a.defaults);if(s.useD3Chart){try{var l=t("d3");l&&t("../node_modules/pivottable/dist/d3_renderers.js")}catch(u){}n.pivotUtilities.d3_renderers&&n.extend(!0,n.pivotUtilities.renderers,n.pivotUtilities.d3_renderers)}var c,f=null,h=function(){var t=e.results.getVariables();if(!s.mergeLabelsWithUris)return t;var n=[];f="string"==typeof s.mergeLabelsWithUris?s.mergeLabelsWithUris:"Label";t.forEach(function(e){-1!==e.indexOf(f,e.length-f.length)&&t.indexOf(e.substring(0,e.length-f.length))>=0||n.push(e)});return n},d=function(t){var n=h(),i=null;e.options.getUsedPrefixes&&(i="function"==typeof e.options.getUsedPrefixes?e.options.getUsedPrefixes(e):e.options.getUsedPrefixes);e.results.getBindings().forEach(function(e){var o={};n.forEach(function(t){if(t in e){var n=e[t].value;f&&e[t+f]?n=e[t+f].value:"uri"==e[t].type&&(n=r.uriToPrefixed(i,n));o[t]=n}else o[t]=null});t(o)})},p=e.getPersistencyId(s.persistencyId),g=function(){var t=i.storage.get(p);if(t){var r=e.results.getVariables(),o=!0;t.cols.forEach(function(t){r.indexOf(t)<0&&(o=!1)});o&&t.rows.forEach(function(t){r.indexOf(t)<0&&(o=!1)});if(!o){t.cols=[];t.rows=[]}n.pivotUtilities.renderers[t.rendererName]||delete t.rendererName}else t={};return t},m=function(){var r=function(){var t=function(t){if(p){var n={cols:t.cols,rows:t.rows,rendererName:t.rendererName,aggregatorName:t.aggregatorName,vals:t.vals};i.storage.set(p,n,"month")}t.rendererName.toLowerCase().indexOf(" chart")>=0?r.show():r.hide();e.updateHeader()},r=n("<button>",{"class":"openPivotGchart yasr_btn"}).text("Chart Config").click(function(){c.find('div[dir="ltr"]').dblclick()}).appendTo(e.resultsContainer);c=n("<div>",{"class":"pivotTable"}).appendTo(n(e.resultsContainer));var s=n.extend(!0,{},g(),a.defaults.pivotTable);s.onRefresh=function(){var e=s.onRefresh;return function(n){t(n);e&&e(n)}}();window.pivot=c.pivotUI(d,s);var l=n(i.svg.getElement(o.move));c.find(".pvtTriangle").replaceWith(l);n(".pvtCols").prepend(n("<div>",{"class":"containerHeader"}).text("Columns"));n(".pvtRows").prepend(n("<div>",{"class":"containerHeader"}).text("Rows"));n(".pvtUnused").prepend(n("<div>",{"class":"containerHeader"}).text("Available Variables"));n(".pvtVals").prepend(n("<div>",{"class":"containerHeader"}).text("Cells"));setTimeout(e.updateHeader,400)};e.options.useGoogleCharts&&s.useGoogleCharts&&!n.pivotUtilities.gchart_renderers?t("./gChartLoader.js").on("done",function(){try{t("../node_modules/pivottable/dist/gchart_renderers.js");n.extend(!0,n.pivotUtilities.renderers,n.pivotUtilities.gchart_renderers)}catch(e){s.useGoogleCharts=!1}r()}).on("error",function(){console.log("could not load gchart");s.useGoogleCharts=!1;r()}).googleLoad():r()},v=function(){return e.results&&e.results.getVariables&&e.results.getVariables()&&e.results.getVariables().length>0},y=function(){if(!e.results)return null;var t=e.resultsContainer.find(".pvtRendererArea svg");return 0==t.length?null:{getContent:function(){return t[0].outerHTML},filename:"queryResults.svg",contentType:"image/svg+xml",buttonTitle:"Download SVG Image"}};return{getDownloadInfo:y,options:s,draw:m,name:"Pivot Table",canHandleResults:v,getPriority:4}};a.defaults={mergeLabelsWithUris:!1,useGoogleCharts:!0,useD3Chart:!0,persistencyId:"pivot",pivotTable:{}};a.version={"YASR-rawResponse":t("../package.json").version,jquery:n.fn.jquery}},{"../node_modules/pivottable/dist/d3_renderers.js":20,"../node_modules/pivottable/dist/gchart_renderers.js":21,"../package.json":28,"./gChartLoader.js":34,"./imgs.js":36,"./utils.js":47,d3:14,jquery:19,"jquery-ui/sortable":17,pivottable:22,"yasgui-utils":25}],45:[function(t,e){"use strict";var n=t("jquery"),r=t("codemirror");t("codemirror/addon/fold/foldcode.js");t("codemirror/addon/fold/foldgutter.js");t("codemirror/addon/fold/xml-fold.js");t("codemirror/addon/fold/brace-fold.js");t("codemirror/addon/edit/matchbrackets.js");t("codemirror/mode/xml/xml.js");t("codemirror/mode/javascript/javascript.js");var i=e.exports=function(t){var e=n.extend(!0,{},i.defaults),o=null,a=function(){var n=e.CodeMirror;n.value=t.results.getOriginalResponseAsString();var i=t.results.getType();if(i){"json"==i&&(i={name:"javascript",json:!0});n.mode=i}o=r(t.resultsContainer.get()[0],n);o.on("fold",function(){o.refresh()});o.on("unfold",function(){o.refresh()})},s=function(){if(!t.results)return!1;if(!t.results.getOriginalResponseAsString)return!1;var e=t.results.getOriginalResponseAsString();return e&&0!=e.length||!t.results.getException()?!0:!1},l=function(){if(!t.results)return null;var e=t.results.getOriginalContentType(),n=t.results.getType();return{getContent:function(){return t.results.getOriginalResponse()},filename:"queryResults"+(n?"."+n:""),contentType:e?e:"text/plain",buttonTitle:"Download raw response"}};return{draw:a,name:"Raw Response",canHandleResults:s,getPriority:2,getDownloadInfo:l}};i.defaults={CodeMirror:{readOnly:!0,lineNumbers:!0,lineWrapping:!0,foldGutter:!0,gutters:["CodeMirror-linenumbers","CodeMirror-foldgutter"]}};i.version={"YASR-rawResponse":t("../package.json").version,jquery:n.fn.jquery,CodeMirror:r.version}},{"../package.json":28,codemirror:11,"codemirror/addon/edit/matchbrackets.js":6,"codemirror/addon/fold/brace-fold.js":7,"codemirror/addon/fold/foldcode.js":8,"codemirror/addon/fold/foldgutter.js":9,"codemirror/addon/fold/xml-fold.js":10,"codemirror/mode/javascript/javascript.js":12,"codemirror/mode/xml/xml.js":13,jquery:19}],46:[function(t,e){"use strict";var n=t("jquery"),r=t("yasgui-utils"),i=t("./utils.js"),o=t("./imgs.js");t("../lib/DataTables/media/js/jquery.dataTables.js");t("../lib/colResizable-1.4.js");var a=e.exports=function(e){var i=null,s={name:"Table",getPriority:10},l=s.options=n.extend(!0,{},a.defaults),c=l.persistency?e.getPersistencyId(l.persistency.tableLength):null,f=function(){var t=[],n=e.results.getBindings(),r=e.results.getVariables(),i=null;e.options.getUsedPrefixes&&(i="function"==typeof e.options.getUsedPrefixes?e.options.getUsedPrefixes(e):e.options.getUsedPrefixes);for(var o=0;o<n.length;o++){var a=[];a.push("");for(var u=n[o],c=0;c<r.length;c++){var f=r[c];a.push(f in u?l.getCellContent?l.getCellContent(e,s,u,f,{rowId:o,colId:c,usedPrefixes:i}):"":"")}t.push(a)}return t},h=e.getPersistencyId("eventId")||"",d=function(){i.on("order.dt",function(){p()});c&&i.on("length.dt",function(t,e,n){r.storage.set(c,n,"month")});n.extend(!0,l.callbacks,l.handlers);i.delegate("td","click",function(t){if(l.callbacks&&l.callbacks.onCellClick){var e=l.callbacks.onCellClick(this,t);if(e===!1)return!1}}).delegate("td","mouseenter",function(t){l.callbacks&&l.callbacks.onCellMouseEnter&&l.callbacks.onCellMouseEnter(this,t);var e=n(this);l.fetchTitlesFromPreflabel&&void 0===e.attr("title")&&0==e.text().trim().indexOf("http")&&u(e)}).delegate("td","mouseleave",function(t){l.callbacks&&l.callbacks.onCellMouseLeave&&l.callbacks.onCellMouseLeave(this,t)});n(window).off("resize."+h);n(window).on("resize."+h,g);g()};s.draw=function(){i=n('<table cellpadding="0" cellspacing="0" border="0" class="resultsTable"></table>');n(e.resultsContainer).html(i);var t=l.datatable;t.data=f();t.columns=l.getColumns(e,s);var o=r.storage.get(c);o&&(t.pageLength=o);i.DataTable(n.extend(!0,{},t));p();d();i.colResizable();i.find("thead").outerHeight();n(e.resultsContainer).find(".JCLRgrip").height(i.find("thead").outerHeight());var a=e.header.outerHeight()-5;if(a>0){e.resultsContainer.find(".dataTables_wrapper").css("position","relative").css("top","-"+a+"px").css("margin-bottom","-"+a+"px");n(e.resultsContainer).find(".JCLRgrip").css("marginTop",a+"px")}};var p=function(){var t={sorting:"unsorted",sorting_asc:"sortAsc",sorting_desc:"sortDesc"};i.find(".sortIcons").remove();for(var e in t){var a=n("<div class='sortIcons'></div>");r.svg.draw(a,o[t[e]]);i.find("th."+e).append(a)}};s.canHandleResults=function(){return e.results&&e.results.getVariables&&e.results.getVariables()&&e.results.getVariables().length>0};s.getDownloadInfo=function(){return e.results?{getContent:function(){return t("./bindingsToCsv.js")(e.results.getAsJson())},filename:"queryResults.csv",contentType:"text/csv",buttonTitle:"Download as CSV"}:null};var g=function(){var t=!0,n=e.container.find(".yasr_downloadIcon"),r=e.container.find(".dataTables_filter"),i=n.offset().left;if(i>0){var o=i+n.outerWidth(),a=r.offset().left;a>0&&o>a&&(t=!1)}t?r.css("visibility","visible"):r.css("visibility","hidden")};return s},s=function(t,e,n){var r=i.escapeHtmlEntities(n.value);if(n["xml:lang"])r='"'+r+'"<sup>@'+n["xml:lang"]+"</sup>";else if(n.datatype){var o="http://www.w3.org/2001/XMLSchema#",a=n.datatype;a=0===a.indexOf(o)?"xsd:"+a.substring(o.length):"<"+a+">";r='"'+r+'"<sup>^^'+a+"</sup>"}return r},l=function(t,e,n,r,i){var o=n[r],a=null;if("uri"==o.type){var l=null,u=o.value,c=u;if(i.usedPrefixes)for(var f in i.usedPrefixes)if(0==c.indexOf(i.usedPrefixes[f])){c=f+":"+u.substring(i.usedPrefixes[f].length);break}if(e.options.mergeLabelsWithUris){var h="string"==typeof e.options.mergeLabelsWithUris?e.options.mergeLabelsWithUris:"Label";if(n[r+h]){c=s(t,e,n[r+h]);l=u}}a="<a "+(l?"title='"+u+"' ":"")+"class='uri' target='_blank' href='"+u+"'>"+c+"</a>"}else a="<span class='nonUri'>"+s(t,e,o)+"</span>";return"<div>"+a+"</div>"},u=function(t){var e=function(){t.attr("title","")};n.get("http://preflabel.org/api/v1/label/"+encodeURIComponent(t.text())+"?silent=true").success(function(n){"object"==typeof n&&n.label?t.attr("title",n.label):"string"==typeof n&&n.length>0?t.attr("title",n):e()}).fail(e)};a.defaults={getCellContent:l,persistency:{tableLength:"tableLength"},getColumns:function(t,e){var n=function(n){if(!e.options.mergeLabelsWithUris)return!0;var r="string"==typeof e.options.mergeLabelsWithUris?e.options.mergeLabelsWithUris:"Label";return-1!==n.indexOf(r,n.length-r.length)&&t.results.getVariables().indexOf(n.substring(0,n.length-r.length))>=0?!1:!0},r=[];r.push({title:""});t.results.getVariables().forEach(function(t){r.push({title:"<span>"+t+"</span>",visible:n(t)})});return r},fetchTitlesFromPreflabel:!0,mergeLabelsWithUris:!1,callbacks:{onCellMouseEnter:null,onCellMouseLeave:null,onCellClick:null},datatable:{autoWidth:!1,order:[],pageLength:50,lengthMenu:[[10,50,100,1e3,-1],[10,50,100,1e3,"All"]],lengthChange:!0,pagingType:"full_numbers",drawCallback:function(t){for(var e=0;e<t.aiDisplay.length;e++)n("td:eq(0)",t.aoData[t.aiDisplay[e]].nTr).html(e+1);var r=!1;n(t.nTableWrapper).find(".paginate_button").each(function(){-1==n(this).attr("class").indexOf("current")&&-1==n(this).attr("class").indexOf("disabled")&&(r=!0)});r?n(t.nTableWrapper).find(".dataTables_paginate").show():n(t.nTableWrapper).find(".dataTables_paginate").hide()},columnDefs:[{width:"32px",orderable:!1,targets:0}]}};a.version={"YASR-table":t("../package.json").version,jquery:n.fn.jquery,"jquery-datatables":n.fn.DataTable.version}},{"../lib/DataTables/media/js/jquery.dataTables.js":2,"../lib/colResizable-1.4.js":3,"../package.json":28,"./bindingsToCsv.js":29,"./imgs.js":36,"./utils.js":47,jquery:19,"yasgui-utils":25}],47:[function(t,e){"use strict";var n=t("jquery"),r=t("./exceptions.js").GoogleTypeException;e.exports={escapeHtmlEntities:function(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")},uriToPrefixed:function(t,e){if(t)for(var n in t)if(0==e.indexOf(t[n])){e=n+":"+e.substring(t[n].length);break}return e},getGoogleTypeForBinding:function(t){if(null==t)return null;if(null==t.type||"typed-literal"!==t.type&&"literal"!==t.type)return"string";switch(t.datatype){case"http://www.w3.org/2001/XMLSchema#float":case"http://www.w3.org/2001/XMLSchema#decimal":case"http://www.w3.org/2001/XMLSchema#int":case"http://www.w3.org/2001/XMLSchema#integer":case"http://www.w3.org/2001/XMLSchema#long":case"http://www.w3.org/2001/XMLSchema#gYearMonth":case"http://www.w3.org/2001/XMLSchema#gYear":case"http://www.w3.org/2001/XMLSchema#gMonthDay":case"http://www.w3.org/2001/XMLSchema#gDay":case"http://www.w3.org/2001/XMLSchema#gMonth":return"number";case"http://www.w3.org/2001/XMLSchema#date":return"date";case"http://www.w3.org/2001/XMLSchema#dateTime":return"datetime";case"http://www.w3.org/2001/XMLSchema#time":return"timeofday";default:return"string"}},getGoogleTypeForBindings:function(t,n){var i={},o=0;t.forEach(function(t){var r=e.exports.getGoogleTypeForBinding(t[n]);if(null!=r){if(!(r in i)){i[r]=0;o++}i[r]++}});if(0==o)return"string";if(1!=o)throw new r(i,n);for(var a in i)return a},castGoogleType:function(t,n,r){if(null==t)return null;if("string"==r||null==t.type||"typed-literal"!==t.type&&"literal"!==t.type)return(t.type="uri")?e.exports.uriToPrefixed(n,t.value):t.value;switch(t.datatype){case"http://www.w3.org/2001/XMLSchema#float":case"http://www.w3.org/2001/XMLSchema#decimal":case"http://www.w3.org/2001/XMLSchema#int":case"http://www.w3.org/2001/XMLSchema#integer":case"http://www.w3.org/2001/XMLSchema#long":case"http://www.w3.org/2001/XMLSchema#gYearMonth":case"http://www.w3.org/2001/XMLSchema#gYear":case"http://www.w3.org/2001/XMLSchema#gMonthDay":case"http://www.w3.org/2001/XMLSchema#gDay":case"http://www.w3.org/2001/XMLSchema#gMonth":return Number(t.value);case"http://www.w3.org/2001/XMLSchema#date":var o=i(t.value);if(o)return o;case"http://www.w3.org/2001/XMLSchema#dateTime":case"http://www.w3.org/2001/XMLSchema#time":return new Date(t.value);default:return t.value}},fireClick:function(t){t&&t.each(function(t,e){var r=n(e);if(document.dispatchEvent){var i=document.createEvent("MouseEvents");i.initMouseEvent("click",!0,!0,window,1,1,1,1,1,!1,!1,!1,!1,0,r[0]);r[0].dispatchEvent(i)}else document.fireEvent&&r[0].click()})}};var i=function(t){var e=new Date(t.replace(/(\d)([\+-]\d{2}:\d{2})/,"$1Z$2"));return isNaN(e)?null:e}},{"./exceptions.js":33,jquery:19}]},{},[1])(1)});
//# sourceMappingURL=yasr.bundled.min.js.map |
app/javascript/mastodon/features/ui/components/column_subheading.js | riku6460/chikuwagoddon | import React from 'react';
import PropTypes from 'prop-types';
const ColumnSubheading = ({ text }) => {
return (
<div className='column-subheading'>
{text}
</div>
);
};
ColumnSubheading.propTypes = {
text: PropTypes.string.isRequired,
};
export default ColumnSubheading;
|
ajax/libs/qooxdoo/2.1.1/q.js | Nivl/cdnjs | /** qooxdoo v.2.1.1 | (c) 2012 1&1 Internet AG 1und1.de | qooxdoo.org/license */
(function(){
if (!window.qx) window.qx = {};
var qx = window.qx;
if (!qx.$$environment) qx.$$environment = {};
var envinfo = {"json":true,"qx.application":"library.Application","qx.debug":false,"qx.debug.databinding":false,"qx.debug.dispose":false,"qx.debug.ui.queue":false,"qx.optimization.variants":true,"qx.revision":"","qx.theme":"qx.theme.Modern","qx.version":"2.1.1"};
for (var k in envinfo) qx.$$environment[k] = envinfo[k];
qx.$$packageData = {};
/** qooxdoo v.2.1.1 | (c) 2012 1&1 Internet AG 1und1.de | qooxdoo.org/license */
qx.$$packageData['0']={"locales":{},"resources":{},"translations":{"C":{},"en":{}}};
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2004-2008 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Sebastian Werner (wpbasti)
* Andreas Ecker (ecker)
* Martin Wittemann (martinwittemann)
************************************************************************ */
/* ************************************************************************
#ignore(qx.data)
#ignore(qx.data.IListData)
#ignore(qx.util.OOUtil)
************************************************************************ */
/**
* Create namespace
*/
if(!window.qx){
window.qx = {
};
};
/**
* Bootstrap qx.Bootstrap to create myself later
* This is needed for the API browser etc. to let them detect me
*/
qx.Bootstrap = {
genericToString : function(){
return "[Class " + this.classname + "]";
},
createNamespace : function(name, object){
var splits = name.split(".");
var parent = window;
var part = splits[0];
for(var i = 0,len = splits.length - 1;i < len;i++,part = splits[i]){
if(!parent[part]){
parent = parent[part] = {
};
} else {
parent = parent[part];
};
};
// store object
parent[part] = object;
// return last part name (e.g. classname)
return part;
},
setDisplayName : function(fcn, classname, name){
fcn.displayName = classname + "." + name + "()";
},
setDisplayNames : function(functionMap, classname){
for(var name in functionMap){
var value = functionMap[name];
if(value instanceof Function){
value.displayName = classname + "." + name + "()";
};
};
},
define : function(name, config){
if(!config){
var config = {
statics : {
}
};
};
var clazz;
var proto = null;
qx.Bootstrap.setDisplayNames(config.statics, name);
if(config.members || config.extend){
qx.Bootstrap.setDisplayNames(config.members, name + ".prototype");
clazz = config.construct || new Function;
if(config.extend){
this.extendClass(clazz, clazz, config.extend, name, basename);
};
var statics = config.statics || {
};
// use keys to include the shadowed in IE
for(var i = 0,keys = qx.Bootstrap.keys(statics),l = keys.length;i < l;i++){
var key = keys[i];
clazz[key] = statics[key];
};
proto = clazz.prototype;
var members = config.members || {
};
// use keys to include the shadowed in IE
for(var i = 0,keys = qx.Bootstrap.keys(members),l = keys.length;i < l;i++){
var key = keys[i];
proto[key] = members[key];
};
} else {
clazz = config.statics || {
};
};
// Create namespace
var basename = name ? this.createNamespace(name, clazz) : "";
// Store names in constructor/object
clazz.name = clazz.classname = name;
clazz.basename = basename;
// Store type info
clazz.$$type = "Class";
// Attach toString
if(!clazz.hasOwnProperty("toString")){
clazz.toString = this.genericToString;
};
// Execute defer section
if(config.defer){
config.defer(clazz, proto);
};
// Store class reference in global class registry
qx.Bootstrap.$$registry[name] = clazz;
return clazz;
}
};
/**
* Internal class that is responsible for bootstrapping the qooxdoo
* framework at load time.
*
* Does support:
*
* * Construct
* * Statics
* * Members
* * Extend
* * Defer
*
* Does not support:
*
* * Super class calls
* * Mixins, Interfaces, Properties, ...
*/
qx.Bootstrap.define("qx.Bootstrap", {
statics : {
/** Timestamp of qooxdoo based application startup */
LOADSTART : qx.$$start || new Date(),
/**
* Mapping for early use of the qx.debug environment setting.
*/
DEBUG : (function(){
// make sure to reflect all changes here to the environment class!
var debug = true;
if(qx.$$environment && qx.$$environment["qx.debug"] === false){
debug = false;
};
return debug;
})(),
/**
* Minimal accessor API for the environment settings given from the
* generator.
*
* WARNING: This method only should be used if the
* {@link qx.core.Environment} class is not loaded!
*
* @param key {String} The key to get the value from.
* @return {var} The value of the setting or <code>undefined</code>.
*/
getEnvironmentSetting : function(key){
if(qx.$$environment){
return qx.$$environment[key];
};
},
/**
* Minimal mutator for the environment settings given from the generator.
* It checks for the existance of the environment settings and sets the
* key if its not given from the generator. If a setting is available from
* the generator, the setting will be ignored.
*
* WARNING: This method only should be used if the
* {@link qx.core.Environment} class is not loaded!
*
* @param key {String} The key of the setting.
* @param value {var} The value for the setting.
*/
setEnvironmentSetting : function(key, value){
if(!qx.$$environment){
qx.$$environment = {
};
};
if(qx.$$environment[key] === undefined){
qx.$$environment[key] = value;
};
},
/**
* Creates a namespace and assigns the given object to it.
*
* @internal
* @param name {String} The complete namespace to create. Typically, the last part is the class name itself
* @param object {Object} The object to attach to the namespace
* @return {Object} last part of the namespace (typically the class name)
* @throws {Error} when the given object already exists.
*/
createNamespace : qx.Bootstrap.createNamespace,
/**
* Define a new class using the qooxdoo class system.
* Lightweight version of {@link qx.Class#define} only used during bootstrap phase.
*
* @internal
* @signature function(name, config)
* @param name {String?} Name of the class. If null, the class will not be
* attached to a namespace.
* @param config {Map ? null} Class definition structure.
* @return {Class} The defined class
*/
define : qx.Bootstrap.define,
/**
* Sets the display name of the given function
*
* @signature function(fcn, classname, name)
* @param fcn {Function} the function to set the display name for
* @param classname {String} the name of the class the function is defined in
* @param name {String} the function name
*/
setDisplayName : qx.Bootstrap.setDisplayName,
/**
* Set the names of all functions defined in the given map
*
* @signature function(functionMap, classname)
* @param functionMap {Object} a map with functions as values
* @param classname {String} the name of the class, the functions are
* defined in
*/
setDisplayNames : qx.Bootstrap.setDisplayNames,
/**
* This method will be attached to all classes to return
* a nice identifier for them.
*
* @internal
* @signature function()
* @return {String} The class identifier
*/
genericToString : qx.Bootstrap.genericToString,
/**
* Inherit a clazz from a super class.
*
* This function differentiates between class and constructor because the
* constructor written by the user might be wrapped and the <code>base</code>
* property has to be attached to the constructor, while the <code>superclass</code>
* property has to be attached to the wrapped constructor.
*
* @param clazz {Function} The class's wrapped constructor
* @param construct {Function} The unwrapped constructor
* @param superClass {Function} The super class
* @param name {Function} fully qualified class name
* @param basename {Function} the base name
*/
extendClass : function(clazz, construct, superClass, name, basename){
var superproto = superClass.prototype;
// Use helper function/class to save the unnecessary constructor call while
// setting up inheritance.
var helper = new Function();
helper.prototype = superproto;
var proto = new helper();
// Apply prototype to new helper instance
clazz.prototype = proto;
// Store names in prototype
proto.name = proto.classname = name;
proto.basename = basename;
/*
- Store base constructor to constructor-
- Store reference to extend class
*/
construct.base = superClass;
clazz.superclass = superClass;
/*
- Store statics/constructor onto constructor/prototype
- Store correct constructor
- Store statics onto prototype
*/
construct.self = clazz.constructor = proto.constructor = clazz;
},
/**
* Find a class by its name
*
* @param name {String} class name to resolve
* @return {Class} the class
*/
getByName : function(name){
return qx.Bootstrap.$$registry[name];
},
/** {Map} Stores all defined classes */
$$registry : {
},
/*
---------------------------------------------------------------------------
OBJECT UTILITY FUNCTIONS
---------------------------------------------------------------------------
*/
/**
* Get the number of own properties in the object.
*
* @param map {Object} the map
* @return {Integer} number of objects in the map
* @lint ignoreUnused(key)
*/
objectGetLength : function(map){
return qx.Bootstrap.keys(map).length;
},
/**
* Inserts all keys of the source object into the
* target objects. Attention: The target map gets modified.
*
* @param target {Object} target object
* @param source {Object} object to be merged
* @param overwrite {Boolean ? true} If enabled existing keys will be overwritten
* @return {Object} Target with merged values from the source object
*/
objectMergeWith : function(target, source, overwrite){
if(overwrite === undefined){
overwrite = true;
};
for(var key in source){
if(overwrite || target[key] === undefined){
target[key] = source[key];
};
};
return target;
},
/**
* IE does not return "shadowed" keys even if they are defined directly
* in the object.
*
* @internal
*/
__shadowedKeys : ["isPrototypeOf", "hasOwnProperty", "toLocaleString", "toString", "valueOf", "propertyIsEnumerable", "constructor"],
/**
* Get the keys of a map as array as returned by a "for ... in" statement.
*
* @deprecated {2.1.} Please use Object.keys instead.
* @param map {Object} the map
* @return {Array} array of the keys of the map
*/
getKeys : function(map){
if(qx.Bootstrap.DEBUG){
qx.Bootstrap.warn("'qx.Bootstrap.getKeys' is deprecated. " + "Please use the native 'Object.keys()' instead.");
};
return qx.Bootstrap.keys(map);
},
/**
* Get the keys of a map as array as returned by a "for ... in" statement.
*
* @signature function(map)
* @internal
* @param map {Object} the map
* @return {Array} array of the keys of the map
*/
keys : ({
"ES5" : Object.keys,
"BROKEN_IE" : function(map){
if(map === null || (typeof map != "object" && typeof map != "function")){
throw new TypeError("Object.keys requires an object as argument.");
};
var arr = [];
var hasOwnProperty = Object.prototype.hasOwnProperty;
for(var key in map){
if(hasOwnProperty.call(map, key)){
arr.push(key);
};
};
// IE does not return "shadowed" keys even if they are defined directly
// in the object. This is incompatible with the ECMA standard!!
// This is why this checks are needed.
var shadowedKeys = qx.Bootstrap.__shadowedKeys;
for(var i = 0,a = shadowedKeys,l = a.length;i < l;i++){
if(hasOwnProperty.call(map, a[i])){
arr.push(a[i]);
};
};
return arr;
},
"default" : function(map){
if(map === null || (typeof map != "object" && typeof map != "function")){
throw new TypeError("Object.keys requires an object as argument.");
};
var arr = [];
var hasOwnProperty = Object.prototype.hasOwnProperty;
for(var key in map){
if(hasOwnProperty.call(map, key)){
arr.push(key);
};
};
return arr;
}
})[typeof (Object.keys) == "function" ? "ES5" : (function(){
for(var key in {
toString : 1
}){
return key;
};
})() !== "toString" ? "BROKEN_IE" : "default"],
/**
* Get the keys of a map as string
*
* @param map {Object} the map
* @deprecated {2.1} Object.keys(map).join('\", "').
* @return {String} String of the keys of the map
* The keys are separated by ", "
*/
getKeysAsString : function(map){
{
};
var keys = qx.Bootstrap.keys(map);
if(keys.length == 0){
return "";
};
return '"' + keys.join('\", "') + '"';
},
/**
* Mapping from JavaScript string representation of objects to names
* @internal
*/
__classToTypeMap : {
"[object String]" : "String",
"[object Array]" : "Array",
"[object Object]" : "Object",
"[object RegExp]" : "RegExp",
"[object Number]" : "Number",
"[object Boolean]" : "Boolean",
"[object Date]" : "Date",
"[object Function]" : "Function",
"[object Error]" : "Error"
},
/*
---------------------------------------------------------------------------
FUNCTION UTILITY FUNCTIONS
---------------------------------------------------------------------------
*/
/**
* Returns a function whose "this" is altered.
*
* *Syntax*
*
* <pre class='javascript'>qx.Bootstrap.bind(myFunction, [self, [varargs...]]);</pre>
*
* *Example*
*
* <pre class='javascript'>
* function myFunction()
* {
* this.setStyle('color', 'red');
* // note that 'this' here refers to myFunction, not an element
* // we'll need to bind this function to the element we want to alter
* };
*
* var myBoundFunction = qx.Bootstrap.bind(myFunction, myElement);
* myBoundFunction(); // this will make the element myElement red.
* </pre>
*
* @param func {Function} Original function to wrap
* @param self {Object ? null} The object that the "this" of the function will refer to.
* @param varargs {arguments ? null} The arguments to pass to the function.
* @return {Function} The bound function.
*/
bind : function(func, self, varargs){
var fixedArgs = Array.prototype.slice.call(arguments, 2, arguments.length);
return function(){
var args = Array.prototype.slice.call(arguments, 0, arguments.length);
return func.apply(self, fixedArgs.concat(args));
};
},
/*
---------------------------------------------------------------------------
STRING UTILITY FUNCTIONS
---------------------------------------------------------------------------
*/
/**
* Convert the first character of the string to upper case.
*
* @param str {String} the string
* @return {String} the string with an upper case first character
*/
firstUp : function(str){
return str.charAt(0).toUpperCase() + str.substr(1);
},
/**
* Convert the first character of the string to lower case.
*
* @param str {String} the string
* @return {String} the string with a lower case first character
*/
firstLow : function(str){
return str.charAt(0).toLowerCase() + str.substr(1);
},
/*
---------------------------------------------------------------------------
TYPE UTILITY FUNCTIONS
---------------------------------------------------------------------------
*/
/**
* Get the internal class of the value. See
* http://perfectionkills.com/instanceof-considered-harmful-or-how-to-write-a-robust-isarray/
* for details.
*
* @param value {var} value to get the class for
* @return {String} the internal class of the value
*/
getClass : function(value){
var classString = Object.prototype.toString.call(value);
return (qx.Bootstrap.__classToTypeMap[classString] || classString.slice(8, -1));
},
/**
* Whether the value is a string.
*
* @param value {var} Value to check.
* @return {Boolean} Whether the value is a string.
*/
isString : function(value){
// Added "value !== null" because IE throws an exception "Object expected"
// by executing "value instanceof String" if value is a DOM element that
// doesn't exist. It seems that there is an internal different between a
// JavaScript null and a null returned from calling DOM.
// e.q. by document.getElementById("ReturnedNull").
return (value !== null && (typeof value === "string" || qx.Bootstrap.getClass(value) == "String" || value instanceof String || (!!value && !!value.$$isString)));
},
/**
* Whether the value is an array.
*
* @param value {var} Value to check.
* @return {Boolean} Whether the value is an array.
*/
isArray : function(value){
// Added "value !== null" because IE throws an exception "Object expected"
// by executing "value instanceof Array" if value is a DOM element that
// doesn't exist. It seems that there is an internal different between a
// JavaScript null and a null returned from calling DOM.
// e.q. by document.getElementById("ReturnedNull").
return (value !== null && (value instanceof Array || (value && qx.data && qx.data.IListData && qx.util.OOUtil.hasInterface(value.constructor, qx.data.IListData)) || qx.Bootstrap.getClass(value) == "Array" || (!!value && !!value.$$isArray)));
},
/**
* Whether the value is an object. Note that built-in types like Window are
* not reported to be objects.
*
* @param value {var} Value to check.
* @return {Boolean} Whether the value is an object.
*/
isObject : function(value){
return (value !== undefined && value !== null && qx.Bootstrap.getClass(value) == "Object");
},
/**
* Whether the value is a function.
*
* @param value {var} Value to check.
* @return {Boolean} Whether the value is a function.
*/
isFunction : function(value){
return qx.Bootstrap.getClass(value) == "Function";
},
/*
---------------------------------------------------------------------------
LOGGING UTILITY FUNCTIONS
---------------------------------------------------------------------------
*/
$$logs : [],
/**
* Sending a message at level "debug" to the logger.
*
* @param object {Object} Contextual object (either instance or static class)
* @param message {var} Any number of arguments supported. An argument may
* have any JavaScript data type. All data is serialized immediately and
* does not keep references to other objects.
*/
debug : function(object, message){
qx.Bootstrap.$$logs.push(["debug", arguments]);
},
/**
* Sending a message at level "info" to the logger.
*
* @param object {Object} Contextual object (either instance or static class)
* @param message {var} Any number of arguments supported. An argument may
* have any JavaScript data type. All data is serialized immediately and
* does not keep references to other objects.
*/
info : function(object, message){
qx.Bootstrap.$$logs.push(["info", arguments]);
},
/**
* Sending a message at level "warn" to the logger.
*
* @param object {Object} Contextual object (either instance or static class)
* @param message {var} Any number of arguments supported. An argument may
* have any JavaScript data type. All data is serialized immediately and
* does not keep references to other objects.
*/
warn : function(object, message){
qx.Bootstrap.$$logs.push(["warn", arguments]);
},
/**
* Sending a message at level "error" to the logger.
*
* @param object {Object} Contextual object (either instance or static class)
* @param message {var} Any number of arguments supported. An argument may
* have any JavaScript data type. All data is serialized immediately and
* does not keep references to other objects.
*/
error : function(object, message){
qx.Bootstrap.$$logs.push(["error", arguments]);
},
/**
* Prints the current stack trace at level "info"
*
* @param object {Object} Contextual object (either instance or static class)
*/
trace : function(object){
}
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2005-2011 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Martin Wittemann (martinwittemann)
************************************************************************ */
/**
* This class is the single point to access all settings that may be different
* in different environments. This contains e.g. the browser name, engine
* version but also qooxdoo or application specific settings.
*
* Its public API can be found in its four main methods. One pair of methods
* is used to check the synchronous values of the environment. The other pair
* of methods is used for asynchronous checks.
*
* The most often used method should be {@link #get}, which returns the
* current value for a given environment check.
*
* All qooxdoo settings can be changed via the generator's config. See the manual
* for more details about the environment key in the config. As you can see
* from the methods API, there is no way to override an existing key. So if you
* need to change a qooxdoo setting, you have to use the generator to do so.
*
* The following table shows the available checks. If you are
* interested in more details, check the reference to the implementation of
* each check. Please do not use those check implementations directly, as the
* Environment class comes with a smart caching feature.
*
* <table border="0" cellspacing="10">
* <tbody>
* <tr>
* <td colspan="4"><h2>Synchronous checks</h2>
* </td>
* </tr>
* <tr>
* <th><h3>Key</h3></th>
* <th><h3>Type</h3></th>
* <th><h3>Example</h3></th>
* <th><h3>Details</h3></th>
* </tr>
* <tr>
* <td colspan="4"><b>browser</b></td>
* </tr>
* <tr>
* <td>browser.documentmode</td><td><i>Integer</i></td><td><code>0</code></td>
* <td>{@link qx.bom.client.Browser#getDocumentMode}</td>
* </tr>
* <tr>
* <td>browser.name</td><td><i>String</i></td><td><code> chrome </code></td>
* <td>{@link qx.bom.client.Browser#getName}</td>
* </tr>
* <tr>
* <td>browser.quirksmode</td><td><i>Boolean</i></td><td><code>false</code></td>
* <td>{@link qx.bom.client.Browser#getQuirksMode}</td>
* </tr>
* <tr>
* <td>browser.version</td><td><i>String</i></td><td><code>11.0</code></td>
* <td>{@link qx.bom.client.Browser#getVersion}</td>
* </tr>
* <tr>
* <td colspan="4"><b>runtime</b></td>
* </tr>
* <tr>
* <td>runtime.name</td><td><i> String </i></td><td><code> node.js </code></td>
* <td>{@link qx.bom.client.Runtime#getName}</td>
* </tr>
* <tr>
* <td colspan="4"><b>css</b></td>
* </tr>
* <tr>
* <td>css.borderradius</td><td><i>String</i> or <i>null</i></td><td><code>borderRadius</code></td>
* <td>{@link qx.bom.client.Css#getBorderRadius}</td>
* </tr>
* <tr>
* <td>css.borderimage</td><td><i>String</i> or <i>null</i></td><td><code>WebkitBorderImage</code></td>
* <td>{@link qx.bom.client.Css#getBorderImage}</td>
* </tr>
* <tr>
* <td>css.borderimage.standardsyntax</td><td><i>Boolean</i> or <i>null</i></td><td><code>true</code></td>
* <td>{@link qx.bom.client.Css#getBorderImageSyntax}</td>
* </tr>
* <tr>
* <td>css.boxmodel</td><td><i>String</i></td><td><code>content</code></td>
* <td>{@link qx.bom.client.Css#getBoxModel}</td>
* </tr>
* <tr>
* <td>css.boxshadow</td><td><i>String</i> or <i>null</i></td><td><code>boxShadow</code></td>
* <td>{@link qx.bom.client.Css#getBoxShadow}</td>
* </tr>
* <tr>
* <td>css.gradient.linear</td><td><i>String</i> or <i>null</i></td><td><code>-moz-linear-gradient</code></td>
* <td>{@link qx.bom.client.Css#getLinearGradient}</td>
* </tr>
* <tr>
* <td>css.gradient.filter</td><td><i>Boolean</i></td><td><code>true</code></td>
* <td>{@link qx.bom.client.Css#getFilterGradient}</td>
* </tr>
* <tr>
* <td>css.gradient.radial</td><td><i>String</i> or <i>null</i></td><td><code>-moz-radial-gradient</code></td>
* <td>{@link qx.bom.client.Css#getRadialGradient}</td>
* </tr>
* <tr>
* <td>css.gradient.legacywebkit</td><td><i>Boolean</i></td><td><code>false</code></td>
* <td>{@link qx.bom.client.Css#getLegacyWebkitGradient}</td>
* </tr>
* <tr>
* <td>css.placeholder</td><td><i>Boolean</i></td><td><code>true</code></td>
* <td>{@link qx.bom.client.Css#getPlaceholder}</td>
* </tr>
* <tr>
* <td>css.textoverflow</td><td><i>String</i> or <i>null</i></td><td><code>textOverflow</code></td>
* <td>{@link qx.bom.client.Css#getTextOverflow}</td>
* </tr>
* <tr>
* <td>css.rgba</td><td><i>Boolean</i></td><td><code>true</code></td>
* <td>{@link qx.bom.client.Css#getRgba}</td>
* </tr>
* <tr>
* <td>css.usermodify</td><td><i>String</i> or <i>null</i></td><td><code>WebkitUserModify</code></td>
* <td>{@link qx.bom.client.Css#getUserModify}</td>
* </tr>
* <tr>
* <td>css.appearance</td><td><i>String</i> or <i>null</i></td><td><code>WebkitAppearance</code></td>
* <td>{@link qx.bom.client.Css#getAppearance}</td>
* </tr>
* <tr>
* <td>css.float</td><td><i>String</i> or <i>null</i></td><td><code>cssFloat</code></td>
* <td>{@link qx.bom.client.Css#getFloat}</td>
* </tr>
* <tr>
* <td>css.userselect</td><td><i>String</i> or <i>null</i></td><td><code>WebkitUserSelect</code></td>
* <td>{@link qx.bom.client.Css#getUserSelect}</td>
* </tr>
* <tr>
* <td>css.userselect.none</td><td><i>String</i> or <i>null</i></td><td><code>-moz-none</code></td>
* <td>{@link qx.bom.client.Css#getUserSelectNone}</td>
* </tr>
* <tr>
* <td>css.boxsizing</td><td><i>String</i> or <i>null</i></td><td><code>boxSizing</code></td>
* <td>{@link qx.bom.client.Css#getBoxSizing}</td>
* </tr>
* <tr>
* <td>css.animation</td><td><i>Object</i> or <i>null</i></td><td><code>{end-event: "webkitAnimationEnd", keyframes: "@-webkit-keyframes", play-state: null, name: "WebkitAnimation"}</code></td>
* <td>{@link qx.bom.client.CssAnimation#getSupport}</td>
* </tr>
* <tr>
* <td>css.animation.requestframe</td><td><i>String</i> or <i>null</i></td><td><code>mozRequestAnimationFrame</code></td>
* <td>{@link qx.bom.client.CssAnimation#getRequestAnimationFrame}</td>
* </tr>
* <tr>
* <td>css.transform</td><td><i>Object</i> or <i>null</i></td><td><code>{3d: true, origin: "WebkitTransformOrigin", name: "WebkitTransform", style: "WebkitTransformStyle", perspective: "WebkitPerspective", perspective-origin: "WebkitPerspectiveOrigin", backface-visibility: "WebkitBackfaceVisibility"}</code></td>
* <td>{@link qx.bom.client.CssTransform#getSupport}</td>
* </tr>
* <tr>
* <td>css.transform.3d</td><td><i>Boolean</i></td><td><code>false</code></td>
* <td>{@link qx.bom.client.CssTransform#get3D}</td>
* </tr>
* <tr>
* <td>css.inlineblock</td><td><i>String</i> or <i>null</i></td><td><code>inline-block</code></td>
* <td>{@link qx.bom.client.Css#getInlineBlock}</td>
* </tr>
* <tr>
* <td>css.opacity</td><td><i>Boolean</i></td><td><code>true</code></td>
* <td>{@link qx.bom.client.Css#getOpacity}</td>
* </tr>
* <tr>
* <td>deprecated since 2.1: css.overflowxy</td><td><i>Boolean</i></td><td><code>true</code></td>
* <td>{@link qx.bom.client.Css#getOverflowXY}</td>
* </tr>
* <tr>
* <td>css.textShadow</td><td><i>Boolean</i></td><td><code>true</code></td>
* <td>{@link qx.bom.client.Css#getTextShadow}</td>
* </tr>
* <tr>
* <td>css.textShadow.filter</td><td><i>Boolean</i></td><td><code>true</code></td>
* <td>{@link qx.bom.client.Css#getFilterTextShadow}</td>
* </tr>
* <tr>
* <td colspan="4"><b>device</b></td>
* </tr>
* <tr>
* <td>device.name</td><td><i>String</i></td><td><code>pc</code></td>
* <td>{@link qx.bom.client.Device#getName}</td>
* </tr>
* <tr>
* <td>device.type</td><td><i>String</i></td><td><code>mobile</code></td>
* <td>{@link qx.bom.client.Device#getType}</td>
* </tr>
* <tr>
* <td colspan="4"><b>ecmascript</b></td>
* </tr>
* <tr>
* <td>ecmascript.error.stacktrace</td><td><i>String</i> or <i>null</i></td><td><code>stack</code></td>
* <td>{@link qx.bom.client.EcmaScript#getStackTrace}</td>
* </tr>
* <tr>
* <td>ecmascript.array.indexof<td><i>Boolean</i></td><td><code>true</code></td>
* <td>{@link qx.bom.client.EcmaScript#getArrayIndexOf}</td>
* </tr>
* <tr>
* <td>ecmascript.array.lastindexof<td><i>Boolean</i></td><td><code>true</code></td>
* <td>{@link qx.bom.client.EcmaScript#getArrayLastIndexOf}</td>
* </tr>
* <tr>
* <td>ecmascript.array.foreach<td><i>Boolean</i></td><td><code>true</code></td>
* <td>{@link qx.bom.client.EcmaScript#getArrayForEach}</td>
* </tr>
* <tr>
* <td>ecmascript.array.filter<td><i>Boolean</i></td><td><code>true</code></td>
* <td>{@link qx.bom.client.EcmaScript#getArrayFilter}</td>
* </tr>
* <tr>
* <td>ecmascript.array.map<td><i>Boolean</i></td><td><code>true</code></td>
* <td>{@link qx.bom.client.EcmaScript#getArrayMap}</td>
* </tr>
* <tr>
* <td>ecmascript.array.some<td><i>Boolean</i></td><td><code>true</code></td>
* <td>{@link qx.bom.client.EcmaScript#getArraySome}</td>
* </tr>
* <tr>
* <td>ecmascript.array.every<td><i>Boolean</i></td><td><code>true</code></td>
* <td>{@link qx.bom.client.EcmaScript#getArrayEvery}</td>
* </tr>
* <tr>
* <td>ecmascript.array.reduce<td><i>Boolean</i></td><td><code>true</code></td>
* <td>{@link qx.bom.client.EcmaScript#getArrayReduce}</td>
* </tr>
* <tr>
* <td>ecmascript.array.reduceright<td><i>Boolean</i></td><td><code>true</code></td>
* <td>{@link qx.bom.client.EcmaScript#getArrayReduceRight}</td>
* </tr>
* <tr>
* <td>ecmascript.function.bind<td><i>Boolean</i></td><td><code>true</code></td>
* <td>{@link qx.bom.client.EcmaScript#getFunctionBind}</td>
* </tr>
* <tr>
* <td>ecmascript.object.keys<td><i>Boolean</i></td><td><code>true</code></td>
* <td>{@link qx.bom.client.EcmaScript#getObjectKeys}</td>
* </tr>
* <tr>
* <td>ecmascript.date.now<td><i>Boolean</i></td><td><code>true</code></td>
* <td>{@link qx.bom.client.EcmaScript#getDateNow}</td>
* </tr>
* <tr>
* <td>ecmascript.error.toString</td><td><i>Boolean</i></td><td><code>true</code></td>
* <td>{@link qx.bom.client.EcmaScript#getErrorToString}</td>
* </tr>
* <tr>
* <td>ecmascript.string.trim</td><td><i>Boolean</i></td><td><code>true</code></td>
* <td>{@link qx.bom.client.EcmaScript#getStringTrim}</td>
* </tr>
* <tr>
* <td colspan="4"><b>engine</b></td>
* </tr>
* <tr>
* <td>engine.name</td><td><i>String</i></td><td><code>webkit</code></td>
* <td>{@link qx.bom.client.Engine#getName}</td>
* </tr>
* <tr>
* <td>engine.version</td><td><i>String</i></td><td><code>534.24</code></td>
* <td>{@link qx.bom.client.Engine#getVersion}</td>
* </tr>
* <tr>
* <td colspan="4"><b>event</b></td>
* </tr>
* <tr>
* <td>event.pointer</td><td><i>Boolean</i></td><td><code>true</code></td>
* <td>{@link qx.bom.client.Event#getPointer}</td>
* </tr>
* <tr>
* <td>event.mspointer</td><td><i>Boolean</i></td><td><code>true</code></td>
* <td>{@link qx.bom.client.Event#getMsPointer}</td>
* </tr>
* <tr>
* <td>event.touch</td><td><i>Boolean</i></td><td><code>false</code></td>
* <td>{@link qx.bom.client.Event#getTouch}</td>
* </tr>
* <tr>
* <td>event.help</td><td><i>Boolean</i></td><td><code>false</code></td>
* <td>{@link qx.bom.client.Event#getHelp}</td>
* </tr>
* <tr>
* <td>event.hashchange</td><td><i>Boolean</i></td><td><code>true</code></td>
* <td>{@link qx.bom.client.Event#getHashChange}</td>
* </tr>
* <tr>
* <td colspan="4"><b>html</b></td>
* </tr>
* <tr>
* <td>html.audio</td><td><i>Boolean</i></td><td><code>true</code></td>
* <td>{@link qx.bom.client.Html#getAudio}</td>
* </tr>
* <tr>
* <td>html.audio.mp3</td><td><i>String</i></td><td><code>""</code></td>
* <td>{@link qx.bom.client.Html#getAudioMp3}</td>
* </tr>
* <tr>
* <td>html.audio.ogg</td><td><i>String</i></td><td><code>"maybe"</code></td>
* <td>{@link qx.bom.client.Html#getAudioOgg}</td>
* </tr>
* <tr>
* <td>html.audio.wav</td><td><i>String</i></td><td><code>"probably"</code></td>
* <td>{@link qx.bom.client.Html#getAudioWav}</td>
* </tr>
* <tr>
* <td>html.audio.au</td><td><i>String</i></td><td><code>"maybe"</code></td>
* <td>{@link qx.bom.client.Html#getAudioAu}</td>
* </tr>
* <tr>
* <td>html.audio.aif</td><td><i>String</i></td><td><code>"probably"</code></td>
* <td>{@link qx.bom.client.Html#getAudioAif}</td>
* </tr>
* <tr>
* <td>html.canvas</td><td><i>Boolean</i></td><td><code>true</code></td>
* <td>{@link qx.bom.client.Html#getCanvas}</td>
* </tr>
* <tr>
* <td>html.classlist</td><td><i>Boolean</i></td><td><code>true</code></td>
* <td>{@link qx.bom.client.Html#getClassList}</td>
* </tr>
* <tr>
* <td>html.geolocation</td><td><i>Boolean</i></td><td><code>true</code></td>
* <td>{@link qx.bom.client.Html#getGeoLocation}</td>
* </tr>
* <tr>
* <td>html.storage.local</td><td><i>Boolean</i></td><td><code>true</code></td>
* <td>{@link qx.bom.client.Html#getLocalStorage}</td>
* </tr>
* <tr>
* <td>html.storage.session</td><td><i>Boolean</i></td><td><code>true</code></td>
* <td>{@link qx.bom.client.Html#getSessionStorage}</td>
* </tr>
* <tr>
* <td>html.storage.userdata</td><td><i>Boolean</i></td><td><code>true</code></td>
* <td>{@link qx.bom.client.Html#getUserDataStorage}</td>
* </tr>
* <tr>
* <td>html.svg</td><td><i>Boolean</i></td><td><code>true</code></td>
* <td>{@link qx.bom.client.Html#getSvg}</td>
* </tr>
* <tr>
* <td>html.video</td><td><i>Boolean</i></td><td><code>true</code></td>
* <td>{@link qx.bom.client.Html#getVideo}</td>
* </tr>
* <tr>
* <td>html.video.h264</td><td><i>String</i></td><td><code>"probably"</code></td>
* <td>{@link qx.bom.client.Html#getVideoH264}</td>
* </tr>
* <tr>
* <td>html.video.ogg</td><td><i>String</i></td><td><code>""</code></td>
* <td>{@link qx.bom.client.Html#getVideoOgg}</td>
* </tr>
* <tr>
* <td>html.video.webm</td><td><i>String</i></td><td><code>"maybe"</code></td>
* <td>{@link qx.bom.client.Html#getVideoWebm}</td>
* </tr>
* <tr>
* <td>html.vml</td><td><i>Boolean</i></td><td><code>false</code></td>
* <td>{@link qx.bom.client.Html#getVml}</td>
* </tr>
* <tr>
* <td>html.webworker</td><td><i>Boolean</i></td><td><code>true</code></td>
* <td>{@link qx.bom.client.Html#getWebWorker}</td>
* <tr>
* <td>html.filereader</td><td><i>Boolean</i></td><td><code>true</code></td>
* <td>{@link qx.bom.client.Html#getFileReader}</td>
* </tr>
* <tr>
* <td>html.xpath</td><td><i>Boolean</i></td><td><code>true</code></td>
* <td>{@link qx.bom.client.Html#getXPath}</td>
* </tr>
* <tr>
* <td>html.xul</td><td><i>Boolean</i></td><td><code>true</code></td>
* <td>{@link qx.bom.client.Html#getXul}</td>
* </tr>
* <tr>
* <td>html.console</td><td><i>Boolean</i></td><td><code>true</code></td>
* <td>{@link qx.bom.client.Html#getConsole}</td>
* </tr>
* <tr>
* <td>html.element.contains</td><td><i>Boolean</i></td><td><code>true</code></td>
* <td>{@link qx.bom.client.Html#getContains}</td>
* </tr>
* <tr>
* <td>html.element.compareDocumentPosition</td><td><i>Boolean</i></td><td><code>true</code></td>
* <td>{@link qx.bom.client.Html#getCompareDocumentPosition}</td>
* </tr>
* <tr>
* <td>html.element.textContent</td><td><i>Boolean</i></td><td><code>true</code></td>
* <td>{@link qx.bom.client.Html#getTextContent}</td>
* </tr>
* <tr>
* <td>html.image.naturaldimensions</td><td><i>Boolean</i></td><td><code>true</code></td>
* <td>{@link qx.bom.client.Html#getNaturalDimensions}</td>
* </tr>
* <tr>
* <td>html.history.state</td><td><i>Boolean</i></td><td><code>true</code></td>
* <td>{@link qx.bom.client.Html#getHistoryState}</td>
* </tr>
* <tr>
* <td colspan="4"><b>XML</b></td>
* </tr>
* <tr>
* <td>xml.implementation</td><td><i>Boolean</i></td><td><code>true</code></td>
* <td>{@link qx.bom.client.Xml#getImplementation}</td>
* </tr>
* <tr>
* <td>xml.domparser</td><td><i>Boolean</i></td><td><code>true</code></td>
* <td>{@link qx.bom.client.Xml#getDomParser}</td>
* </tr>
* <tr>
* <td>xml.selectsinglenode</td><td><i>Boolean</i></td><td><code>false</code></td>
* <td>{@link qx.bom.client.Xml#getSelectSingleNode}</td>
* </tr>
* <tr>
* <td>xml.selectnodes</td><td><i>Boolean</i></td><td><code>false</code></td>
* <td>{@link qx.bom.client.Xml#getSelectNodes}</td>
* </tr>
* <tr>
* <td>xml.getelementsbytagnamens</td><td><i>Boolean</i></td><td><code>true</code></td>
* <td>{@link qx.bom.client.Xml#getElementsByTagNameNS}</td>
* </tr>
* <tr>
* <td>xml.domproperties</td><td><i>Boolean</i></td><td><code>false</code></td>
* <td>{@link qx.bom.client.Xml#getDomProperties}</td>
* </tr>
* <tr>
* <td>xml.attributens</td><td><i>Boolean</i></td><td><code>true</code></td>
* <td>{@link qx.bom.client.Xml#getAttributeNS}</td>
* </tr>
* <tr>
* <td>xml.createelementns</td><td><i>Boolean</i></td><td><code>true</code></td>
* <td>{@link qx.bom.client.Xml#getCreateElementNS}</td>
* </tr>
* <tr>
* <td>xml.createnode</td><td><i>Boolean</i></td><td><code>false</code></td>
* <td>{@link qx.bom.client.Xml#getCreateNode}</td>
* </tr>
* <tr>
* <td>xml.getqualifieditem</td><td><i>Boolean</i></td><td><code>false</code></td>
* <td>{@link qx.bom.client.Xml#getQualifiedItem}</td>
* </tr>
* <tr>
* <td colspan="4"><b>Stylesheets</b></td>
* </tr>
* <tr>
* <td>html.stylesheet.createstylesheet</td><td><i>Boolean</i></td><td><code>false</code></td>
* <td>{@link qx.bom.client.Stylesheet#getCreateStyleSheet}</td>
* </tr>
* <tr>
* <td>html.stylesheet.insertrule</td><td><i>Boolean</i></td><td><code>true</code></td>
* <td>{@link qx.bom.client.Stylesheet#getInsertRule}</td>
* </tr>
* <tr>
* <td>html.stylesheet.deleterule</td><td><i>Boolean</i></td><td><code>true</code></td>
* <td>{@link qx.bom.client.Stylesheet#getDeleteRule}</td>
* </tr>
* <tr>
* <td>html.stylesheet.addimport</td><td><i>Boolean</i></td><td><code>false</code></td>
* <td>{@link qx.bom.client.Stylesheet#getAddImport}</td>
* </tr>
* <tr>
* <td>html.stylesheet.removeimport</td><td><i>Boolean</i></td><td><code>false</code></td>
* <td>{@link qx.bom.client.Stylesheet#getRemoveImport}</td>
* </tr>
* <tr>
* <td colspan="4"><b>io</b></td>
* </tr>
* <tr>
* <td>io.maxrequests</td><td><i>Integer</i></td><td><code>4</code></td>
* <td>{@link qx.bom.client.Transport#getMaxConcurrentRequestCount}</td>
* </tr>
* <tr>
* <td>io.ssl</td><td><i>Boolean</i></td><td><code>false</code></td>
* <td>{@link qx.bom.client.Transport#getSsl}</td>
* </tr>
* <tr>
* <td>io.xhr</td><td><i>String</i></td><td><code>xhr</code></td>
* <td>{@link qx.bom.client.Transport#getXmlHttpRequest}</td>
* </tr>
* <tr>
* <td colspan="4"><b>locale</b></td>
* </tr>
* <tr>
* <td>locale</td><td><i>String</i></td><td><code>de</code></td>
* <td>{@link qx.bom.client.Locale#getLocale}</td>
* </tr>
* <tr>
* <td>locale.variant</td><td><i>String</i></td><td><code>de</code></td>
* <td>{@link qx.bom.client.Locale#getVariant}</td>
* </tr>
* <tr>
* <td colspan="4"><b>os</b></td>
* </tr>
* <tr>
* <td>os.name</td><td><i>String</i></td><td><code>osx</code></td>
* <td>{@link qx.bom.client.OperatingSystem#getName}</td>
* </tr>
* <tr>
* <td>os.version</td><td><i>String</i></td><td><code>10.6</code></td>
* <td>{@link qx.bom.client.OperatingSystem#getVersion}</td>
* </tr>
* <tr>
* <td>os.scrollBarOverlayed</td><td><i>Boolean</i></td><td><code>false</code></td>
* <td>{@link qx.bom.client.Scroll#scrollBarOverlayed}</td>
* </tr>
* <tr>
* <td colspan="4"><b>phonegap</b></td>
* </tr>
* <tr>
* <td>phonegap</td><td><i>Boolean</i></td><td><code>false</code></td>
* <td>{@link qx.bom.client.PhoneGap#getPhoneGap}</td>
* </tr>
* <tr>
* <td>phonegap.notification</td><td><i>Boolean</i></td><td><code>false</code></td>
* <td>{@link qx.bom.client.PhoneGap#getNotification}</td>
* </tr>
* <tr>
* <td colspan="4"><b>plugin</b></td>
* </tr>
* <tr>
* <td>plugin.divx</td><td><i>Boolean</i></td><td><code>false</code></td>
* <td>{@link qx.bom.client.Plugin#getDivX}</td>
* </tr>
* <tr>
* <td>plugin.divx.version</td><td><i>String</i></td><td></td>
* <td>{@link qx.bom.client.Plugin#getDivXVersion}</td>
* </tr>
* <tr>
* <td>plugin.flash</td><td><i>Boolean</i></td><td><code>true</code></td>
* <td>{@link qx.bom.client.Flash#isAvailable}</td>
* </tr>
* <tr>
* <td>plugin.flash.express</td><td><i>Boolean</i></td><td><code>true</code></td>
* <td>{@link qx.bom.client.Flash#getExpressInstall}</td>
* </tr>
* <tr>
* <td>plugin.flash.strictsecurity</td><td><i>Boolean</i></td><td><code>true</code></td>
* <td>{@link qx.bom.client.Flash#getStrictSecurityModel}</td>
* </tr>
* <tr>
* <td>plugin.flash.version</td><td><i>String</i></td><td><code>10.2.154</code></td>
* <td>{@link qx.bom.client.Flash#getVersion}</td>
* </tr>
* <tr>
* <td>plugin.gears</td><td><i>Boolean</i></td><td><code>false</code></td>
* <td>{@link qx.bom.client.Plugin#getGears}</td>
* </tr>
* <tr>
* <td>plugin.activex</td><td><i>Boolean</i></td><td><code>false</code></td>
* <td>{@link qx.bom.client.Plugin#getActiveX}</td>
* </tr>
* <tr>
* <td>plugin.skype</td><td><i>Boolean</i></td><td><code>false</code></td>
* <td>{@link qx.bom.client.Plugin#getSkype}</td>
* </tr>
* <tr>
* <td>plugin.pdf</td><td><i>Boolean</i></td><td><code>false</code></td>
* <td>{@link qx.bom.client.Plugin#getPdf}</td>
* </tr>
* <tr>
* <td>plugin.pdf.version</td><td><i>String</i></td><td></td>
* <td>{@link qx.bom.client.Plugin#getPdfVersion}</td>
* </tr>
* <tr>
* <td>plugin.quicktime</td><td><i>Boolean</i></td><td><code>true</code></td>
* <td>{@link qx.bom.client.Plugin#getQuicktime}</td>
* </tr>
* <tr>
* <td>plugin.quicktime.version</td><td><i>String</i></td><td><code>7.6</code></td>
* <td>{@link qx.bom.client.Plugin#getQuicktimeVersion}</td>
* </tr>
* <tr>
* <td>plugin.silverlight</td><td><i>Boolean</i></td><td><code>false</code></td>
* <td>{@link qx.bom.client.Plugin#getSilverlight}</td>
* </tr>
* <tr>
* <td>plugin.silverlight.version</td><td><i>String</i></td><td></td>
* <td>{@link qx.bom.client.Plugin#getSilverlightVersion}</td>
* </tr>
* <tr>
* <td>plugin.windowsmedia</td><td><i>Boolean</i></td><td><code>false</code></td>
* <td>{@link qx.bom.client.Plugin#getWindowsMedia}</td>
* </tr>
* <tr>
* <td>plugin.windowsmedia.version</td><td><i>String</i></td><td></td>
* <td>{@link qx.bom.client.Plugin#getWindowsMediaVersion}</td>
* </tr>
* <tr>
* <td colspan="4"><b>qx</b></td>
* </tr>
* <tr>
* <td>qx.allowUrlSettings</td><td><i>Boolean</i></td><td><code>true</code></td>
* <td><i>default:</i> <code>false</code></td>
* </tr>
* <tr>
* <td>qx.allowUrlVariants</td><td><i>Boolean</i></td><td><code>true</code></td>
* <td><i>default:</i> <code>false</code></td>
* </tr>
* <tr>
* <td>qx.application</td><td><i>String</i></td><td><code>name.space</code></td>
* <td><i>default:</i> <code><<application name>></code></td>
* </tr>
* <tr>
* <td>qx.aspects</td><td><i>Boolean</i></td><td><code>false</code></td>
* <td><i>default:</i> <code>false</code></td>
* </tr>
* <tr>
* <td>qx.debug</td><td><i>Boolean</i></td><td><code>true</code></td>
* <td><i>default:</i> <code>true</code></td>
* </tr>
* <tr>
* <td>qx.debug.databinding</td><td><i>Boolean</i></td><td><code>false</code></td>
* <td><i>default:</i> <code>false</code></td>
* </tr>
* <tr>
* <td>qx.debug.dispose</td><td><i>Boolean</i></td><td><code>false</code></td>
* <td><i>default:</i> <code>false</code></td>
* </tr>
* <tr>
* <td>qx.debug.dispose.level</td><td><i>Integer</i></td><td><code>0</code></td>
* <td><i>default:</i> <code>0</code></td>
* </tr>
* <tr>
* <td>qx.debug.io</td><td><i>Boolean</i></td><td><code>true</code></td>
* <td><i>default:</i> <code>false</code></td>
* </tr>
* <tr>
* <tr>
* <td>qx.debug.io.remote</td><td><i>Boolean</i></td><td><code>true</code></td>
* <td><i>default:</i> <code>false</code></td>
* </tr>
* <tr>
* <tr>
* <td>qx.debug.io.remote.data</td><td><i>Boolean</i></td><td><code>true</code></td>
* <td><i>default:</i> <code>false</code></td>
* </tr>
* <tr>
* <td>qx.debug.property.level</td><td><i>Integer</i></td><td><code>0</code></td>
* <td><i>default:</i> <code>0</code></td>
* </tr>
* <tr>
* <td>qx.debug.ui.queue</td><td><i>Boolean</i></td><td><code>true</code></td>
* <td><i>default:</i> <code>true</code></td>
* </tr>
* <tr>
* <td>qx.dynamicmousewheel</td><td><i>Boolean</i></td><td><code>true</code></td>
* <td><i>default:</i> <code>true</code></td>
* </tr>
* <tr>
* <td>qx.dynlocale</td><td><i>Boolean</i></td><td><code>true</code></td>
* <td><i>default:</i> <code>true</code></td>
* </tr>
* <tr>
* <td>qx.globalErrorHandling</td><td><i>Boolean</i></td><td><code>true</code></td>
* <td><i>default:</i> <code>true</code></td>
* </tr>
* <tr>
* <td>qx.mobile.emulatetouch</td><td><i>Boolean</i></td><td><code>false</code></td>
* <td><i>default:</i> <code>false</code></td>
* </tr>
* <tr>
* <td>qx.mobile.nativescroll</td><td><i>Boolean</i></td><td><code>false</code></td>
* <td><i>default:</i> <code>false</code></td>
* </tr>
* <tr>
* <td>qx.optimization.basecalls</td><td><i>Boolean</i></td><td><code>true</code></td>
* <td>true if the corresp. <i>optimize</i> key is set in the config</td>
* </tr>
* <tr>
* <td>qx.optimization.comments</td><td><i>Boolean</i></td><td><code>true</code></td>
* <td>true if the corresp. <i>optimize</i> key is set in the config</td>
* </tr>
* <tr>
* <td>qx.optimization.privates</td><td><i>Boolean</i></td><td><code>true</code></td>
* <td>true if the corresp. <i>optimize</i> key is set in the config</td>
* </tr>
* <tr>
* <td>qx.optimization.strings</td><td><i>Boolean</i></td><td><code>true</code></td>
* <td>true if the corresp. <i>optimize</i> key is set in the config</td>
* </tr>
* <tr>
* <td>qx.optimization.variables</td><td><i>Boolean</i></td><td><code>true</code></td>
* <td>true if the corresp. <i>optimize</i> key is set in the config</td>
* </tr>
* <tr>
* <td>qx.optimization.variants</td><td><i>Boolean</i></td><td><code>true</code></td>
* <td>true if the corresp. <i>optimize</i> key is set in the config</td>
* </tr>
* <tr>
* <td>qx.revision</td><td><i>String</i></td><td><code>27348</code></td>
* </tr>
* <tr>
* <td>qx.theme</td><td><i>String</i></td><td><code>qx.theme.Modern</code></td>
* <td><i>default:</i> <code><<initial theme name>></code></td>
* </tr>
* <tr>
* <td>qx.version</td><td><i>String</i></td><td><code>${qxversion}</code></td>
* </tr>
* <tr>
* <td>qx.blankpage</td><td><i>String</i></td><td><code>URI to blank.html page</code></td>
* </tr>
* <tr>
* <td colspan="4"><b>module</b></td>
* </tr>
* <tr>
* <td>module.databinding</td><td><i>Boolean</i></td><td><code>true</code></td>
* <td><i>default:</i> <code>true</code></td>
* </tr>
* <tr>
* <td>module.logger</td><td><i>Boolean</i></td><td><code>true</code></td>
* <td><i>default:</i> <code>true</code></td>
* </tr>
* <tr>
* <td>module.property</td><td><i>Boolean</i></td><td><code>true</code></td>
* <td><i>default:</i> <code>true</code></td>
* </tr>
* <tr>
* <td>module.events</td><td><i>Boolean</i></td><td><code>true</code></td>
* <td><i>default:</i> <code>true</code></td>
* </tr>
* <tr>
* <td colspan="4"><h3>Asynchronous checks</h3>
* </td>
* </tr>
* <tr>
* <td>html.dataurl</td><td><i>Boolean</i></td><td><code>true</code></td>
* <td>{@link qx.bom.client.Html#getDataUrl}</td>
* </tr>
* </tbody>
* </table>
*
*/
qx.Bootstrap.define("qx.core.Environment", {
statics : {
/** Map containing the synchronous check functions. */
_checks : {
},
/** Map containing the asynchronous check functions. */
_asyncChecks : {
},
/** Internal cache for all checks. */
__cache : {
},
/** Internal map for environment keys to check methods. */
_checksMap : {
"engine.version" : "qx.bom.client.Engine.getVersion",
"engine.name" : "qx.bom.client.Engine.getName",
"browser.name" : "qx.bom.client.Browser.getName",
"browser.version" : "qx.bom.client.Browser.getVersion",
"browser.documentmode" : "qx.bom.client.Browser.getDocumentMode",
"browser.quirksmode" : "qx.bom.client.Browser.getQuirksMode",
"runtime.name" : "qx.bom.client.Runtime.getName",
"device.name" : "qx.bom.client.Device.getName",
"device.type" : "qx.bom.client.Device.getType",
"locale" : "qx.bom.client.Locale.getLocale",
"locale.variant" : "qx.bom.client.Locale.getVariant",
"os.name" : "qx.bom.client.OperatingSystem.getName",
"os.version" : "qx.bom.client.OperatingSystem.getVersion",
"os.scrollBarOverlayed" : "qx.bom.client.Scroll.scrollBarOverlayed",
"plugin.gears" : "qx.bom.client.Plugin.getGears",
"plugin.activex" : "qx.bom.client.Plugin.getActiveX",
"plugin.skype" : "qx.bom.client.Plugin.getSkype",
"plugin.quicktime" : "qx.bom.client.Plugin.getQuicktime",
"plugin.quicktime.version" : "qx.bom.client.Plugin.getQuicktimeVersion",
"plugin.windowsmedia" : "qx.bom.client.Plugin.getWindowsMedia",
"plugin.windowsmedia.version" : "qx.bom.client.Plugin.getWindowsMediaVersion",
"plugin.divx" : "qx.bom.client.Plugin.getDivX",
"plugin.divx.version" : "qx.bom.client.Plugin.getDivXVersion",
"plugin.silverlight" : "qx.bom.client.Plugin.getSilverlight",
"plugin.silverlight.version" : "qx.bom.client.Plugin.getSilverlightVersion",
"plugin.flash" : "qx.bom.client.Flash.isAvailable",
"plugin.flash.version" : "qx.bom.client.Flash.getVersion",
"plugin.flash.express" : "qx.bom.client.Flash.getExpressInstall",
"plugin.flash.strictsecurity" : "qx.bom.client.Flash.getStrictSecurityModel",
"plugin.pdf" : "qx.bom.client.Plugin.getPdf",
"plugin.pdf.version" : "qx.bom.client.Plugin.getPdfVersion",
"io.maxrequests" : "qx.bom.client.Transport.getMaxConcurrentRequestCount",
"io.ssl" : "qx.bom.client.Transport.getSsl",
"io.xhr" : "qx.bom.client.Transport.getXmlHttpRequest",
"event.touch" : "qx.bom.client.Event.getTouch",
"event.pointer" : "qx.bom.client.Event.getPointer",
"event.help" : "qx.bom.client.Event.getHelp",
"event.hashchange" : "qx.bom.client.Event.getHashChange",
"ecmascript.stacktrace" : "qx.bom.client.EcmaScript.getStackTrace",
// @deprecated {2.1}
"ecmascript.error.stacktrace" : "qx.bom.client.EcmaScript.getStackTrace",
"ecmascript.array.indexof" : "qx.bom.client.EcmaScript.getArrayIndexOf",
"ecmascript.array.lastindexof" : "qx.bom.client.EcmaScript.getArrayLastIndexOf",
"ecmascript.array.foreach" : "qx.bom.client.EcmaScript.getArrayForEach",
"ecmascript.array.filter" : "qx.bom.client.EcmaScript.getArrayFilter",
"ecmascript.array.map" : "qx.bom.client.EcmaScript.getArrayMap",
"ecmascript.array.some" : "qx.bom.client.EcmaScript.getArraySome",
"ecmascript.array.every" : "qx.bom.client.EcmaScript.getArrayEvery",
"ecmascript.array.reduce" : "qx.bom.client.EcmaScript.getArrayReduce",
"ecmascript.array.reduceright" : "qx.bom.client.EcmaScript.getArrayReduceRight",
"ecmascript.function.bind" : "qx.bom.client.EcmaScript.getFunctionBind",
"ecmascript.object.keys" : "qx.bom.client.EcmaScript.getObjectKeys",
"ecmascript.date.now" : "qx.bom.client.EcmaScript.getDateNow",
"ecmascript.error.toString" : "qx.bom.client.EcmaScript.getErrorToString",
"ecmascript.string.trim" : "qx.bom.client.EcmaScript.getStringTrim",
"html.webworker" : "qx.bom.client.Html.getWebWorker",
"html.filereader" : "qx.bom.client.Html.getFileReader",
"html.geolocation" : "qx.bom.client.Html.getGeoLocation",
"html.audio" : "qx.bom.client.Html.getAudio",
"html.audio.ogg" : "qx.bom.client.Html.getAudioOgg",
"html.audio.mp3" : "qx.bom.client.Html.getAudioMp3",
"html.audio.wav" : "qx.bom.client.Html.getAudioWav",
"html.audio.au" : "qx.bom.client.Html.getAudioAu",
"html.audio.aif" : "qx.bom.client.Html.getAudioAif",
"html.video" : "qx.bom.client.Html.getVideo",
"html.video.ogg" : "qx.bom.client.Html.getVideoOgg",
"html.video.h264" : "qx.bom.client.Html.getVideoH264",
"html.video.webm" : "qx.bom.client.Html.getVideoWebm",
"html.storage.local" : "qx.bom.client.Html.getLocalStorage",
"html.storage.session" : "qx.bom.client.Html.getSessionStorage",
"html.storage.userdata" : "qx.bom.client.Html.getUserDataStorage",
"html.classlist" : "qx.bom.client.Html.getClassList",
"html.xpath" : "qx.bom.client.Html.getXPath",
"html.xul" : "qx.bom.client.Html.getXul",
"html.canvas" : "qx.bom.client.Html.getCanvas",
"html.svg" : "qx.bom.client.Html.getSvg",
"html.vml" : "qx.bom.client.Html.getVml",
"html.dataset" : "qx.bom.client.Html.getDataset",
"html.dataurl" : "qx.bom.client.Html.getDataUrl",
"html.console" : "qx.bom.client.Html.getConsole",
"html.stylesheet.createstylesheet" : "qx.bom.client.Stylesheet.getCreateStyleSheet",
"html.stylesheet.insertrule" : "qx.bom.client.Stylesheet.getInsertRule",
"html.stylesheet.deleterule" : "qx.bom.client.Stylesheet.getDeleteRule",
"html.stylesheet.addimport" : "qx.bom.client.Stylesheet.getAddImport",
"html.stylesheet.removeimport" : "qx.bom.client.Stylesheet.getRemoveImport",
"html.element.contains" : "qx.bom.client.Html.getContains",
"html.element.compareDocumentPosition" : "qx.bom.client.Html.getCompareDocumentPosition",
"html.element.textcontent" : "qx.bom.client.Html.getTextContent",
"html.image.naturaldimensions" : "qx.bom.client.Html.getNaturalDimensions",
"html.history.state" : "qx.bom.client.Html.getHistoryState",
"json" : "qx.bom.client.Json.getJson",
"css.textoverflow" : "qx.bom.client.Css.getTextOverflow",
"css.placeholder" : "qx.bom.client.Css.getPlaceholder",
"css.borderradius" : "qx.bom.client.Css.getBorderRadius",
"css.borderimage" : "qx.bom.client.Css.getBorderImage",
"css.borderimage.standardsyntax" : "qx.bom.client.Css.getBorderImageSyntax",
"css.boxshadow" : "qx.bom.client.Css.getBoxShadow",
"css.gradient.linear" : "qx.bom.client.Css.getLinearGradient",
"css.gradient.filter" : "qx.bom.client.Css.getFilterGradient",
"css.gradient.radial" : "qx.bom.client.Css.getRadialGradient",
"css.gradient.legacywebkit" : "qx.bom.client.Css.getLegacyWebkitGradient",
"css.boxmodel" : "qx.bom.client.Css.getBoxModel",
"css.rgba" : "qx.bom.client.Css.getRgba",
"css.userselect" : "qx.bom.client.Css.getUserSelect",
"css.userselect.none" : "qx.bom.client.Css.getUserSelectNone",
"css.usermodify" : "qx.bom.client.Css.getUserModify",
"css.appearance" : "qx.bom.client.Css.getAppearance",
"css.float" : "qx.bom.client.Css.getFloat",
"css.boxsizing" : "qx.bom.client.Css.getBoxSizing",
"css.animation" : "qx.bom.client.CssAnimation.getSupport",
"css.animation.requestframe" : "qx.bom.client.CssAnimation.getRequestAnimationFrame",
"css.transform" : "qx.bom.client.CssTransform.getSupport",
"css.transform.3d" : "qx.bom.client.CssTransform.get3D",
"css.inlineblock" : "qx.bom.client.Css.getInlineBlock",
"css.opacity" : "qx.bom.client.Css.getOpacity",
"css.overflowxy" : "qx.bom.client.Css.getOverflowXY",
// @deprecated {2.1}
"css.textShadow" : "qx.bom.client.Css.getTextShadow",
"css.textShadow.filter" : "qx.bom.client.Css.getFilterTextShadow",
"phonegap" : "qx.bom.client.PhoneGap.getPhoneGap",
"phonegap.notification" : "qx.bom.client.PhoneGap.getNotification",
"xml.implementation" : "qx.bom.client.Xml.getImplementation",
"xml.domparser" : "qx.bom.client.Xml.getDomParser",
"xml.selectsinglenode" : "qx.bom.client.Xml.getSelectSingleNode",
"xml.selectnodes" : "qx.bom.client.Xml.getSelectNodes",
"xml.getelementsbytagnamens" : "qx.bom.client.Xml.getElementsByTagNameNS",
"xml.domproperties" : "qx.bom.client.Xml.getDomProperties",
"xml.attributens" : "qx.bom.client.Xml.getAttributeNS",
"xml.createnode" : "qx.bom.client.Xml.getCreateNode",
"xml.getqualifieditem" : "qx.bom.client.Xml.getQualifiedItem",
"xml.createelementns" : "qx.bom.client.Xml.getCreateElementNS"
},
/**
* The default accessor for the checks. It returns the value the current
* environment has for the given key. The key could be something like
* "qx.debug", "css.textoverflow" or "io.ssl". A complete list of
* checks can be found in the class comment of this class.
*
* Please keep in mind that the result is cached. If you want to run the
* check function again in case something could have been changed, take a
* look at the {@link #invalidateCacheKey} function.
*
* @param key {String} The name of the check you want to query.
* @return {var} The stored value depending on the given key.
* (Details in the class doc)
*/
get : function(key){
if(qx.Bootstrap.DEBUG){
// @deprecated {2.1}
if(key == "css.overflowxy"){
qx.Bootstrap.warn("The environment key 'css.overflowxy' is deprecated.");
};
// @deprecated {2.1}
if(key == "ecmascript.stacktrace"){
qx.Bootstrap.warn("The environment key 'ecmascript.stacktrace' is now 'ecmascript.error.stacktrace'.");
key = "ecmascript.error.stacktrace";
};
};
// check the cache
if(this.__cache[key] != undefined){
return this.__cache[key];
};
// search for a matching check
var check = this._checks[key];
if(check){
// execute the check and write the result in the cache
var value = check();
this.__cache[key] = value;
return value;
};
// try class lookup
var classAndMethod = this._getClassNameFromEnvKey(key);
if(classAndMethod[0] != undefined){
var clazz = classAndMethod[0];
var method = classAndMethod[1];
var value = clazz[method]();
// call the check method
this.__cache[key] = value;
return value;
};
// debug flag
if(qx.Bootstrap.DEBUG){
qx.Bootstrap.warn(key + " is not a valid key. Please see the API-doc of " + "qx.core.Environment for a list of predefined keys.");
qx.Bootstrap.trace(this);
};
},
/**
* Maps an environment key to a check class and method name.
*
* @param key {String} The name of the check you want to query.
* @return {Array} [className, methodName] of
* the corresponding implementation.
*/
_getClassNameFromEnvKey : function(key){
var envmappings = this._checksMap;
if(envmappings[key] != undefined){
var implementation = envmappings[key];
// separate class from method
var lastdot = implementation.lastIndexOf(".");
if(lastdot > -1){
var classname = implementation.slice(0, lastdot);
var methodname = implementation.slice(lastdot + 1);
var clazz = qx.Bootstrap.getByName(classname);
if(clazz != undefined){
return [clazz, methodname];
};
};
};
return [undefined, undefined];
},
/**
* Invokes the callback as soon as the check has been done. If no check
* could be found, a warning will be printed.
*
* @param key {String} The key of the asynchronous check.
* @param callback {Function} The function to call as soon as the check is
* done. The function should have one argument which is the result of the
* check.
* @param self {var} The context to use when invoking the callback.
*/
getAsync : function(key, callback, self){
// check the cache
var env = this;
if(this.__cache[key] != undefined){
// force async behavior
window.setTimeout(function(){
callback.call(self, env.__cache[key]);
}, 0);
return;
};
var check = this._asyncChecks[key];
if(check){
check(function(result){
env.__cache[key] = result;
callback.call(self, result);
});
return;
};
// try class lookup
var classAndMethod = this._getClassNameFromEnvKey(key);
if(classAndMethod[0] != undefined){
var clazz = classAndMethod[0];
var method = classAndMethod[1];
clazz[method](function(result){
// call the check method
env.__cache[key] = result;
callback.call(self, result);
});
return;
};
// debug flag
if(qx.Bootstrap.DEBUG){
qx.Bootstrap.warn(key + " is not a valid key. Please see the API-doc of " + "qx.core.Environment for a list of predefined keys.");
qx.Bootstrap.trace(this);
};
},
/**
* Returns the proper value dependent on the check for the given key.
*
* @param key {String} The name of the check the select depends on.
* @param values {Map} A map containing the values which should be returned
* in any case. The "default" key could be used as a catch all statement.
* @return {var} The value which is stored in the map for the given
* check of the key.
*/
select : function(key, values){
return this.__pickFromValues(this.get(key), values);
},
/**
* Selects the proper function dependent on the asynchronous check.
*
* @param key {String} The key for the async check.
* @param values {Map} A map containing functions. The map keys should
* contain all possibilities which could be returned by the given check
* key. The "default" key could be used as a catch all statement.
* The called function will get one parameter, the result of the query.
* @param self {var} The context which should be used when calling the
* method in the values map.
*/
selectAsync : function(key, values, self){
this.getAsync(key, function(result){
var value = this.__pickFromValues(key, values);
value.call(self, result);
}, this);
},
/**
* Internal helper which tries to pick the given key from the given values
* map. If that key is not found, it tries to use a key named "default".
* If there is also no default key, it prints out a warning and returns
* undefined.
*
* @param key {String} The key to search for in the values.
* @param values {Map} A map containing some keys.
* @return {var} The value stored as values[key] usually.
*/
__pickFromValues : function(key, values){
var value = values[key];
if(values.hasOwnProperty(key)){
return value;
};
// check for piped values
for(var id in values){
if(id.indexOf("|") != -1){
var ids = id.split("|");
for(var i = 0;i < ids.length;i++){
if(ids[i] == key){
return values[id];
};
};
};
};
if(values["default"] !== undefined){
return values["default"];
};
if(qx.Bootstrap.DEBUG){
throw new Error('No match for variant "' + key + '" (' + (typeof key) + ' type)' + ' in variants [' + qx.Bootstrap.keys(values) + '] found, and no default ("default") given');
};
},
/**
* Takes a given map containing the check names as keys and converts
* the map to an array only containing the values for check evaluating
* to <code>true</code>. This is especially handy for conditional
* includes of mixins.
* @param map {Map} A map containing check names as keys and values.
* @return {Array} An array containing the values.
*/
filter : function(map){
var returnArray = [];
for(var check in map){
if(this.get(check)){
returnArray.push(map[check]);
};
};
return returnArray;
},
/**
* Invalidates the cache for the given key.
*
* @param key {String} The key of the check.
*/
invalidateCacheKey : function(key){
delete this.__cache[key];
},
/**
* Add a check to the environment class. If there is already a check
* added for the given key, the add will be ignored.
*
* @param key {String} The key for the check e.g. html.featurexyz.
* @param check {var} It could be either a function or a simple value.
* The function should be responsible for the check and should return the
* result of the check.
*/
add : function(key, check){
// ignore already added checks.
if(this._checks[key] == undefined){
// add functions directly
if(check instanceof Function){
this._checks[key] = check;
} else {
this._checks[key] = this.__createCheck(check);
};
};
},
/**
* Adds an asynchronous check to the environment. If there is already a check
* added for the given key, the add will be ignored.
*
* @param key {String} The key of the check e.g. html.featureabc
* @param check {Function} A function which should check for a specific
* environment setting in an asynchronous way. The method should take two
* arguments. First one is the callback and the second one is the context.
*/
addAsync : function(key, check){
if(this._checks[key] == undefined){
this._asyncChecks[key] = check;
};
},
/**
* Returns all currently defined synchronous checks.
*
* @internal
* @return {Map} The map of synchronous checks
*/
getChecks : function(){
return this._checks;
},
/**
* Returns all currently defined asynchronous checks.
*
* @internal
* @return {Map} The map of asynchronous checks
*/
getAsyncChecks : function(){
return this._asyncChecks;
},
/**
* Initializer for the default values of the framework settings.
*/
_initDefaultQxValues : function(){
// an always-true key (e.g. for use in qx.core.Environment.filter() calls)
this.add("true", function(){
return true;
});
// old settings
this.add("qx.allowUrlSettings", function(){
return false;
});
this.add("qx.allowUrlVariants", function(){
return false;
});
this.add("qx.debug.property.level", function(){
return 0;
});
// old variants
// make sure to reflect all changes to qx.debug here in the bootstrap class!
this.add("qx.debug", function(){
return true;
});
this.add("qx.debug.ui.queue", function(){
return true;
});
this.add("qx.aspects", function(){
return false;
});
this.add("qx.dynlocale", function(){
return true;
});
this.add("qx.mobile.emulatetouch", function(){
return false;
});
this.add("qx.mobile.nativescroll", function(){
return false;
});
this.add("qx.blankpage", function(){
return "qx/static/blank.html";
});
this.add("qx.dynamicmousewheel", function(){
return true;
});
this.add("qx.debug.databinding", function(){
return false;
});
this.add("qx.debug.dispose", function(){
return false;
});
// generator optimization vectors
this.add("qx.optimization.basecalls", function(){
return false;
});
this.add("qx.optimization.comments", function(){
return false;
});
this.add("qx.optimization.privates", function(){
return false;
});
this.add("qx.optimization.strings", function(){
return false;
});
this.add("qx.optimization.variables", function(){
return false;
});
this.add("qx.optimization.variants", function(){
return false;
});
// qooxdoo modules
this.add("module.databinding", function(){
return true;
});
this.add("module.logger", function(){
return true;
});
this.add("module.property", function(){
return true;
});
this.add("module.events", function(){
return true;
});
this.add("qx.nativeScrollBars", function(){
return false;
});
},
/**
* Import checks from global qx.$$environment into the Environment class.
*/
__importFromGenerator : function(){
// import the environment map
if(qx && qx.$$environment){
for(var key in qx.$$environment){
var value = qx.$$environment[key];
this._checks[key] = this.__createCheck(value);
};
};
},
/**
* Checks the URL for environment settings and imports these into the
* Environment class.
*/
__importFromUrl : function(){
if(window.document && window.document.location){
var urlChecks = window.document.location.search.slice(1).split("&");
for(var i = 0;i < urlChecks.length;i++){
var check = urlChecks[i].split(":");
if(check.length != 3 || check[0] != "qxenv"){
continue;
};
var key = check[1];
var value = decodeURIComponent(check[2]);
// implicit type conversion
if(value == "true"){
value = true;
} else if(value == "false"){
value = false;
} else if(/^(\d|\.)+$/.test(value)){
value = parseFloat(value);
};;
this._checks[key] = this.__createCheck(value);
};
};
},
/**
* Internal helper which creates a function returning the given value.
*
* @param value {var} The value which should be returned.
* @return {Function} A function which could be used by a test.
*/
__createCheck : function(value){
return qx.Bootstrap.bind(function(value){
return value;
}, null, value);
}
},
defer : function(statics){
// create default values for the environment class
statics._initDefaultQxValues();
// load the checks from the generator
statics.__importFromGenerator();
// load the checks from the url
if(statics.get("qx.allowUrlSettings") === true){
statics.__importFromUrl();
};
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2004-2008 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Sebastian Werner (wpbasti)
* Martin Wittemann (martinwittemann)
======================================================================
This class contains code from:
Copyright:
2011 Pocket Widget S.L., Spain, http://www.pocketwidget.com
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
Authors:
* Javier Martinez Villacampa
************************************************************************ */
/**
* This class comes with all relevant information regarding
* the client's engine.
*
* This class is used by {@link qx.core.Environment} and should not be used
* directly. Please check its class comment for details how to use it.
*
* @internal
*/
qx.Bootstrap.define("qx.bom.client.Engine", {
// General: http://en.wikipedia.org/wiki/Browser_timeline
// Webkit: http://developer.apple.com/internet/safari/uamatrix.html
// Firefox: http://en.wikipedia.org/wiki/History_of_Mozilla_Firefox
// Maple: http://www.scribd.com/doc/46675822/2011-SDK2-0-Maple-Browser-Specification-V1-00
statics : {
/**
* Returns the version of the engine.
*
* @return {String} The version number of the current engine.
* @internal
*/
getVersion : function(){
var agent = window.navigator.userAgent;
var version = "";
if(qx.bom.client.Engine.__isOpera()){
// Opera has a special versioning scheme, where the second part is combined
// e.g. 8.54 which should be handled like 8.5.4 to be compatible to the
// common versioning system used by other browsers
if(/Opera[\s\/]([0-9]+)\.([0-9])([0-9]*)/.test(agent)){
// opera >= 10 has as a first verison 9.80 and adds the proper version
// in a separate "Version/" postfix
// http://my.opera.com/chooseopera/blog/2009/05/29/changes-in-operas-user-agent-string-format
if(agent.indexOf("Version/") != -1){
var match = agent.match(/Version\/(\d+)\.(\d+)/);
// ignore the first match, its the whole version string
version = match[1] + "." + match[2].charAt(0) + "." + match[2].substring(1, match[2].length);
} else {
version = RegExp.$1 + "." + RegExp.$2;
if(RegExp.$3 != ""){
version += "." + RegExp.$3;
};
};
};
} else if(qx.bom.client.Engine.__isWebkit()){
if(/AppleWebKit\/([^ ]+)/.test(agent)){
version = RegExp.$1;
// We need to filter these invalid characters
var invalidCharacter = RegExp("[^\\.0-9]").exec(version);
if(invalidCharacter){
version = version.slice(0, invalidCharacter.index);
};
};
} else if(qx.bom.client.Engine.__isGecko() || qx.bom.client.Engine.__isMaple()){
// Parse "rv" section in user agent string
if(/rv\:([^\);]+)(\)|;)/.test(agent)){
version = RegExp.$1;
};
} else if(qx.bom.client.Engine.__isMshtml()){
if(/MSIE\s+([^\);]+)(\)|;)/.test(agent)){
version = RegExp.$1;
// If the IE8 or IE9 is running in the compatibility mode, the MSIE value
// is set to an older version, but we need the correct version. The only
// way is to compare the trident version.
if(version < 8 && /Trident\/([^\);]+)(\)|;)/.test(agent)){
if(RegExp.$1 == "4.0"){
version = "8.0";
} else if(RegExp.$1 == "5.0"){
version = "9.0";
};
};
};
} else {
var failFunction = window.qxFail;
if(failFunction && typeof failFunction === "function"){
version = failFunction().FULLVERSION;
} else {
version = "1.9.0.0";
qx.Bootstrap.warn("Unsupported client: " + agent + "! Assumed gecko version 1.9.0.0 (Firefox 3.0).");
};
};;;
return version;
},
/**
* Returns the name of the engine.
*
* @return {String} The name of the current engine.
* @internal
*/
getName : function(){
var name;
if(qx.bom.client.Engine.__isOpera()){
name = "opera";
} else if(qx.bom.client.Engine.__isWebkit()){
name = "webkit";
} else if(qx.bom.client.Engine.__isGecko() || qx.bom.client.Engine.__isMaple()){
name = "gecko";
} else if(qx.bom.client.Engine.__isMshtml()){
name = "mshtml";
} else {
// check for the fallback
var failFunction = window.qxFail;
if(failFunction && typeof failFunction === "function"){
name = failFunction().NAME;
} else {
name = "gecko";
qx.Bootstrap.warn("Unsupported client: " + window.navigator.userAgent + "! Assumed gecko version 1.9.0.0 (Firefox 3.0).");
};
};;;
return name;
},
/**
* Internal helper for checking for opera.
* @return {Boolean} true, if its opera.
*/
__isOpera : function(){
return window.opera && Object.prototype.toString.call(window.opera) == "[object Opera]";
},
/**
* Internal helper for checking for webkit.
* @return {Boolean} true, if its webkit.
*/
__isWebkit : function(){
return window.navigator.userAgent.indexOf("AppleWebKit/") != -1;
},
/**
* Internal helper for checking for Maple .
* Maple is used in Samsung SMART TV 2010-2011 models. It's based on Gecko
* engine 1.8.1.11.
* @return {Boolean} true, if its maple.
*/
__isMaple : function(){
return window.navigator.userAgent.indexOf("Maple") != -1;
},
/**
* Internal helper for checking for gecko.
* @return {Boolean} true, if its gecko.
*/
__isGecko : function(){
return window.controllers && window.navigator.product === "Gecko" && window.navigator.userAgent.indexOf("Maple") == -1;
},
/**
* Internal helper to check for MSHTML.
* @return {Boolean} true, if its MSHTML.
*/
__isMshtml : function(){
return window.navigator.cpuClass && /MSIE\s+([^\);]+)(\)|;)/.test(window.navigator.userAgent);
}
},
defer : function(statics){
qx.core.Environment.add("engine.version", statics.getVersion);
qx.core.Environment.add("engine.name", statics.getName);
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2004-2011 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Martin Wittemann (martinwittemann)
************************************************************************ */
/**
* The main purpose of this class to hold all checks about ECMAScript.
*
* This class is used by {@link qx.core.Environment} and should not be used
* directly. Please check its class comment for details how to use it.
*
* @internal
*/
qx.Bootstrap.define("qx.bom.client.EcmaScript", {
statics : {
/**
* Returns the name of the Error object property that holds stack trace
* information or null if the client does not provide any.
*
* @internal
* @return {String|null} <code>stack</code>, <code>stacktrace</code> or
* <code>null</code>
*/
getStackTrace : function(){
var propName;
var e = new Error("e");
propName = e.stack ? "stack" : e.stacktrace ? "stacktrace" : null;
// only thrown errors have the stack property in IE10 and PhantomJS
if(!propName){
try{
throw e;
} catch(ex) {
e = ex;
};
};
return e.stacktrace ? "stacktrace" : e.stack ? "stack" : null;
},
/**
* Checks if 'indexOf' is supported on the Array object.
* @internal
* @return {Boolean} <code>true</code>, if the method is available.
*/
getArrayIndexOf : function(){
return !!Array.prototype.indexOf;
},
/**
* Checks if 'lastIndexOf' is supported on the Array object.
* @internal
* @return {Boolean} <code>true</code>, if the method is available.
*/
getArrayLastIndexOf : function(){
return !!Array.prototype.lastIndexOf;
},
/**
* Checks if 'forEach' is supported on the Array object.
* @internal
* @return {Boolean} <code>true</code>, if the method is available.
*/
getArrayForEach : function(){
return !!Array.prototype.forEach;
},
/**
* Checks if 'filter' is supported on the Array object.
* @internal
* @return {Boolean} <code>true</code>, if the method is available.
*/
getArrayFilter : function(){
return !!Array.prototype.filter;
},
/**
* Checks if 'map' is supported on the Array object.
* @internal
* @return {Boolean} <code>true</code>, if the method is available.
*/
getArrayMap : function(){
return !!Array.prototype.map;
},
/**
* Checks if 'some' is supported on the Array object.
* @internal
* @return {Boolean} <code>true</code>, if the method is available.
*/
getArraySome : function(){
return !!Array.prototype.some;
},
/**
* Checks if 'every' is supported on the Array object.
* @internal
* @return {Boolean} <code>true</code>, if the method is available.
*/
getArrayEvery : function(){
return !!Array.prototype.every;
},
/**
* Checks if 'reduce' is supported on the Array object.
* @internal
* @return {Boolean} <code>true</code>, if the method is available.
*/
getArrayReduce : function(){
return !!Array.prototype.reduce;
},
/**
* Checks if 'reduceRight' is supported on the Array object.
* @internal
* @return {Boolean} <code>true</code>, if the method is available.
*/
getArrayReduceRight : function(){
return !!Array.prototype.reduceRight;
},
/**
* Checks if 'toString' is supported on the Error object and
* its working as expected.
* @internal
* @return {Boolean} <code>true</code>, if the method is available.
*/
getErrorToString : function(){
return typeof Error.prototype.toString == "function" && Error.prototype.toString() !== "[object Error]";
},
/**
* Checks if 'bind' is supported on the Function object.
* @internal
* @return {Boolean} <code>true</code>, if the method is available.
*/
getFunctionBind : function(){
return typeof Function.prototype.bind === "function";
},
/**
* Checks if 'keys' is supported on the Object object.
* @internal
* @return {Boolean} <code>true</code>, if the method is available.
*/
getObjectKeys : function(){
return !!Object.keys;
},
/**
* Checks if 'now' is supported on the Date object.
* @internal
* @return {Boolean} <code>true</code>, if the method is available.
*/
getDateNow : function(){
return !!Date.now;
},
/**
* Checks if 'trim' is supported on the String object.
* @internal
* @return {Boolean} <code>true</code>, if the method is available.
*/
getStringTrim : function(){
return typeof String.prototype.trim === "function";
}
},
defer : function(statics){
// array polyfill
qx.core.Environment.add("ecmascript.array.indexof", statics.getArrayIndexOf);
qx.core.Environment.add("ecmascript.array.lastindexof", statics.getArrayLastIndexOf);
qx.core.Environment.add("ecmascript.array.foreach", statics.getArrayForEach);
qx.core.Environment.add("ecmascript.array.filter", statics.getArrayFilter);
qx.core.Environment.add("ecmascript.array.map", statics.getArrayMap);
qx.core.Environment.add("ecmascript.array.some", statics.getArraySome);
qx.core.Environment.add("ecmascript.array.every", statics.getArrayEvery);
qx.core.Environment.add("ecmascript.array.reduce", statics.getArrayReduce);
qx.core.Environment.add("ecmascript.array.reduceright", statics.getArrayReduceRight);
// date polyfill
qx.core.Environment.add("ecmascript.date.now", statics.getDateNow);
// error bugfix
qx.core.Environment.add("ecmascript.error.toString", statics.getErrorToString);
qx.core.Environment.add("ecmascript.error.stacktrace", statics.getStackTrace);
// function polyfill
qx.core.Environment.add("ecmascript.function.bind", statics.getFunctionBind);
// object polyfill
qx.core.Environment.add("ecmascript.object.keys", statics.getObjectKeys);
// string polyfill
qx.core.Environment.add("ecmascript.string.trim", statics.getStringTrim);
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2004-2011 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Martin Wittemann (wittemann)
************************************************************************ */
/**
* This class takes care of the normalization of the native 'Array' object.
* Therefore it checks the availability of the following methods and appends
* it, if not available. This means you can use the methods during
* development in every browser. For usage samples, check out the attached links.
*
* *indexOf*:
* <a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/indexOf">MDN documentation</a> |
* <a href="http://es5.github.com/#x15.4.4.14">Annotated ES5 Spec</a>
*
* *lastIndexOf*:
* <a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/lastIndexOf">MDN documentation</a> |
* <a href="http://es5.github.com/#x15.4.4.15">Annotated ES5 Spec</a>
*
* *forEach*:
* <a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/forEach">MDN documentation</a> |
* <a href="http://es5.github.com/#x15.4.4.18">Annotated ES5 Spec</a>
*
* *filter*:
* <a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/filter">MDN documentation</a> |
* <a href="http://es5.github.com/#x15.4.4.20">Annotated ES5 Spec</a>
*
* *map*:
* <a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/map">MDN documentation</a> |
* <a href="http://es5.github.com/#x15.4.4.19">Annotated ES5 Spec</a>
*
* *some*:
* <a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/some">MDN documentation</a> |
* <a href="http://es5.github.com/#x15.4.4.17">Annotated ES5 Spec</a>
*
* *every*:
* <a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/every">MDN documentation</a> |
* <a href="http://es5.github.com/#x15.4.4.16">Annotated ES5 Spec</a>
*
* *reduce*:
* <a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/reduce">MDN documentation</a> |
* <a href="http://es5.github.com/#x15.4.4.21">Annotated ES5 Spec</a>
*
* *reduceRight*:
* <a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/reduceRight">MDN documentation</a> |
* <a href="http://es5.github.com/#x15.4.4.22">Annotated ES5 Spec</a>
*
* Here is a little sample of how to use <code>indexOf</code> e.g.
* <pre class="javascript">var a = ["a", "b", "c"];
* a.indexOf("b"); // returns 1</pre>
*/
qx.Bootstrap.define("qx.lang.normalize.Array", {
defer : function(){
// fix indexOf
if(!qx.core.Environment.get("ecmascript.array.indexof")){
Array.prototype.indexOf = function(searchElement, fromIndex){
if(fromIndex == null){
fromIndex = 0;
} else if(fromIndex < 0){
fromIndex = Math.max(0, this.length + fromIndex);
};
for(var i = fromIndex;i < this.length;i++){
if(this[i] === searchElement){
return i;
};
};
return -1;
};
};
// lastIndexOf
if(!qx.core.Environment.get("ecmascript.array.lastindexof")){
Array.prototype.lastIndexOf = function(searchElement, fromIndex){
if(fromIndex == null){
fromIndex = this.length - 1;
} else if(fromIndex < 0){
fromIndex = Math.max(0, this.length + fromIndex);
};
for(var i = fromIndex;i >= 0;i--){
if(this[i] === searchElement){
return i;
};
};
return -1;
};
};
// forEach
if(!qx.core.Environment.get("ecmascript.array.foreach")){
Array.prototype.forEach = function(callback, obj){
var l = this.length;
for(var i = 0;i < l;i++){
var value = this[i];
if(value !== undefined){
callback.call(obj || window, value, i, this);
};
};
};
};
// filter
if(!qx.core.Environment.get("ecmascript.array.filter")){
Array.prototype.filter = function(callback, obj){
var res = [];
var l = this.length;
for(var i = 0;i < l;i++){
var value = this[i];
if(value !== undefined){
if(callback.call(obj || window, value, i, this)){
res.push(this[i]);
};
};
};
return res;
};
};
// map
if(!qx.core.Environment.get("ecmascript.array.map")){
Array.prototype.map = function(callback, obj){
var res = [];
var l = this.length;
for(var i = 0;i < l;i++){
var value = this[i];
if(value !== undefined){
res[i] = callback.call(obj || window, value, i, this);
};
};
return res;
};
};
// some
if(!qx.core.Environment.get("ecmascript.array.some")){
Array.prototype.some = function(callback, obj){
var l = this.length;
for(var i = 0;i < l;i++){
var value = this[i];
if(value !== undefined){
if(callback.call(obj || window, value, i, this)){
return true;
};
};
};
return false;
};
};
// every
if(!qx.core.Environment.get("ecmascript.array.every")){
Array.prototype.every = function(callback, obj){
var l = this.length;
for(var i = 0;i < l;i++){
var value = this[i];
if(value !== undefined){
if(!callback.call(obj || window, value, i, this)){
return false;
};
};
};
return true;
};
};
// reduce
if(!qx.core.Environment.get("ecmascript.array.reduce")){
Array.prototype.reduce = function(callback, init){
if(typeof callback !== "function"){
throw new TypeError("First argument is not callable");
};
if(init === undefined && this.length === 0){
throw new TypeError("Length is 0 and no second argument given");
};
var ret = init === undefined ? this[0] : init;
for(var i = init === undefined ? 1 : 0;i < this.length;i++){
if(i in this){
ret = callback.call(undefined, ret, this[i], i, this);
};
};
return ret;
};
};
// reduceRight
if(!qx.core.Environment.get("ecmascript.array.reduceright")){
Array.prototype.reduceRight = function(callback, init){
if(typeof callback !== "function"){
throw new TypeError("First argument is not callable");
};
if(init === undefined && this.length === 0){
throw new TypeError("Length is 0 and no second argument given");
};
var ret = init === undefined ? this[this.length - 1] : init;
for(var i = init === undefined ? this.length - 2 : this.length - 1;i >= 0;i--){
if(i in this){
ret = callback.call(undefined, ret, this[i], i, this);
};
};
return ret;
};
};
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2007-2009 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Sebastian Werner (wpbasti)
* Fabian Jakobs (fjakobs)
======================================================================
This class uses ideas and code snipplets presented at
http://webreflection.blogspot.com/2008/05/habemus-array-unlocked-length-in-ie8.html
http://webreflection.blogspot.com/2008/05/stack-and-arrayobject-how-to-create.html
Author:
Andrea Giammarchi
License:
MIT: http://www.opensource.org/licenses/mit-license.php
======================================================================
This class uses documentation of the native Array methods from the MDC
documentation of Mozilla.
License:
CC Attribution-Sharealike License:
http://creativecommons.org/licenses/by-sa/2.5/
************************************************************************ */
/* ************************************************************************
#require(qx.bom.client.Engine)
#require(qx.lang.normalize.Array)
************************************************************************ */
/**
* This class is the common superclass for most array classes in
* qooxdoo. It supports all of the shiny 1.6 JavaScript array features
* like <code>forEach</code> and <code>map</code>.
*
* This class may be instantiated instead of the native Array if
* one wants to work with a feature-unified Array instead of the native
* one. This class uses native features whereever possible but fills
* all missing implementations with custom ones.
*
* Through the ability to extend from this class one could add even
* more utility features on top of it.
*/
qx.Bootstrap.define("qx.type.BaseArray", {
extend : Array,
/*
*****************************************************************************
CONSTRUCTOR
*****************************************************************************
*/
/**
* Creates a new Array with the given length or the listed elements.
*
* <pre class="javascript">
* var arr1 = new qx.type.BaseArray(arrayLength);
* var arr2 = new qx.type.BaseArray(item0, item1, ..., itemN);
* </pre>
*
* * <code>arrayLength</code>: The initial length of the array. You can access
* this value using the length property. If the value specified is not a
* number, an array of length 1 is created, with the first element having
* the specified value. The maximum length allowed for an
* array is 2^32-1, i.e. 4,294,967,295.
* * <code>itemN</code>: A value for the element in that position in the
* array. When this form is used, the array is initialized with the specified
* values as its elements, and the array's length property is set to the
* number of arguments.
*
* @param length_or_items {Integer|var?null} The initial length of the array
* OR an argument list of values.
*/
construct : function(length_or_items){
},
/*
*****************************************************************************
MEMBERS
*****************************************************************************
*/
members : {
/**
* Converts a base array to a native Array
*
* @signature function()
* @return {Array} The native array
*/
toArray : null,
/**
* Returns the current number of items stored in the Array
*
* @signature function()
* @return {Integer} number of items
*/
valueOf : null,
/**
* Removes the last element from an array and returns that element.
*
* This method modifies the array.
*
* @signature function()
* @return {var} The last element of the array.
*/
pop : null,
/**
* Adds one or more elements to the end of an array and returns the new length of the array.
*
* This method modifies the array.
*
* @signature function(varargs)
* @param varargs {var} The elements to add to the end of the array.
* @return {Integer} The new array's length
*/
push : null,
/**
* Reverses the order of the elements of an array -- the first becomes the last, and the last becomes the first.
*
* This method modifies the array.
*
* @signature function()
* @return {Array} Returns the modified array (works in place)
*/
reverse : null,
/**
* Removes the first element from an array and returns that element.
*
* This method modifies the array.
*
* @signature function()
* @return {var} The first element of the array.
*/
shift : null,
/**
* Sorts the elements of an array.
*
* This method modifies the array.
*
* @signature function(compareFunction)
* @param compareFunction {Function?null} Specifies a function that defines the sort order. If omitted,
* the array is sorted lexicographically (in dictionary order) according to the string conversion of each element.
* @return {Array} Returns the modified array (works in place)
*/
sort : null,
/**
* Adds and/or removes elements from an array.
*
* @signature function(index, howMany, varargs)
* @param index {Integer} Index at which to start changing the array. If negative, will begin
* that many elements from the end.
* @param howMany {Integer} An integer indicating the number of old array elements to remove.
* If <code>howMany</code> is 0, no elements are removed. In this case, you should specify
* at least one new element.
* @param varargs {var?null} The elements to add to the array. If you don't specify any elements,
* splice simply removes elements from the array.
* @return {BaseArray} New array with the removed elements.
*/
splice : null,
/**
* Adds one or more elements to the front of an array and returns the new length of the array.
*
* This method modifies the array.
*
* @signature function(varargs)
* @param varargs {var} The elements to add to the front of the array.
* @return {Integer} The new array's length
*/
unshift : null,
/**
* Returns a new array comprised of this array joined with other array(s) and/or value(s).
*
* This method does not modify the array and returns a modified copy of the original.
*
* @signature function(varargs)
* @param varargs {Array|var} Arrays and/or values to concatenate to the resulting array.
* @return {qx.type.BaseArray} New array built of the given arrays or values.
*/
concat : null,
/**
* Joins all elements of an array into a string.
*
* @signature function(separator)
* @param separator {String} Specifies a string to separate each element of the array. The separator is
* converted to a string if necessary. If omitted, the array elements are separated with a comma.
* @return {String} The stringified values of all elements divided by the given separator.
*/
join : null,
/**
* Extracts a section of an array and returns a new array.
*
* @signature function(begin, end)
* @param begin {Integer} Zero-based index at which to begin extraction. As a negative index, start indicates
* an offset from the end of the sequence. slice(-2) extracts the second-to-last element and the last element
* in the sequence.
* @param end {Integer?length} Zero-based index at which to end extraction. slice extracts up to but not including end.
* <code>slice(1,4)</code> extracts the second element through the fourth element (elements indexed 1, 2, and 3).
* As a negative index, end indicates an offset from the end of the sequence. slice(2,-1) extracts the third element through the second-to-last element in the sequence.
* If end is omitted, slice extracts to the end of the sequence.
* @return {BaseArray} An new array which contains a copy of the given region.
*/
slice : null,
/**
* Returns a string representing the array and its elements. Overrides the Object.prototype.toString method.
*
* @signature function()
* @return {String} The string representation of the array.
*/
toString : null,
/**
* Returns the first (least) index of an element within the array equal to the specified value, or -1 if none is found.
*
* @signature function(searchElement, fromIndex)
* @param searchElement {var} Element to locate in the array.
* @param fromIndex {Integer?0} The index at which to begin the search. Defaults to 0, i.e. the
* whole array will be searched. If the index is greater than or equal to the length of the
* array, -1 is returned, i.e. the array will not be searched. If negative, it is taken as
* the offset from the end of the array. Note that even when the index is negative, the array
* is still searched from front to back. If the calculated index is less than 0, the whole
* array will be searched.
* @return {Integer} The index of the given element
*/
indexOf : null,
/**
* Returns the last (greatest) index of an element within the array equal to the specified value, or -1 if none is found.
*
* @signature function(searchElement, fromIndex)
* @param searchElement {var} Element to locate in the array.
* @param fromIndex {Integer?length} The index at which to start searching backwards. Defaults to
* the array's length, i.e. the whole array will be searched. If the index is greater than
* or equal to the length of the array, the whole array will be searched. If negative, it
* is taken as the offset from the end of the array. Note that even when the index is
* negative, the array is still searched from back to front. If the calculated index is
* less than 0, -1 is returned, i.e. the array will not be searched.
* @return {Integer} The index of the given element
*/
lastIndexOf : null,
/**
* Executes a provided function once per array element.
*
* <code>forEach</code> executes the provided function (<code>callback</code>) once for each
* element present in the array. <code>callback</code> is invoked only for indexes of the array
* which have assigned values; it is not invoked for indexes which have been deleted or which
* have never been assigned values.
*
* <code>callback</code> is invoked with three arguments: the value of the element, the index
* of the element, and the Array object being traversed.
*
* If a <code>obj</code> parameter is provided to <code>forEach</code>, it will be used
* as the <code>this</code> for each invocation of the <code>callback</code>. If it is not
* provided, or is <code>null</code>, the global object associated with <code>callback</code>
* is used instead.
*
* <code>forEach</code> does not mutate the array on which it is called.
*
* The range of elements processed by <code>forEach</code> is set before the first invocation of
* <code>callback</code>. Elements which are appended to the array after the call to
* <code>forEach</code> begins will not be visited by <code>callback</code>. If existing elements
* of the array are changed, or deleted, their value as passed to <code>callback</code> will be
* the value at the time <code>forEach</code> visits them; elements that are deleted are not visited.
*
* @signature function(callback, obj)
* @param callback {Function} Function to execute for each element.
* @param obj {Object} Object to use as this when executing callback.
*/
forEach : null,
/**
* Creates a new array with all elements that pass the test implemented by the provided
* function.
*
* <code>filter</code> calls a provided <code>callback</code> function once for each
* element in an array, and constructs a new array of all the values for which
* <code>callback</code> returns a true value. <code>callback</code> is invoked only
* for indexes of the array which have assigned values; it is not invoked for indexes
* which have been deleted or which have never been assigned values. Array elements which
* do not pass the <code>callback</code> test are simply skipped, and are not included
* in the new array.
*
* <code>callback</code> is invoked with three arguments: the value of the element, the
* index of the element, and the Array object being traversed.
*
* If a <code>obj</code> parameter is provided to <code>filter</code>, it will
* be used as the <code>this</code> for each invocation of the <code>callback</code>.
* If it is not provided, or is <code>null</code>, the global object associated with
* <code>callback</code> is used instead.
*
* <code>filter</code> does not mutate the array on which it is called. The range of
* elements processed by <code>filter</code> is set before the first invocation of
* <code>callback</code>. Elements which are appended to the array after the call to
* <code>filter</code> begins will not be visited by <code>callback</code>. If existing
* elements of the array are changed, or deleted, their value as passed to <code>callback</code>
* will be the value at the time <code>filter</code> visits them; elements that are deleted
* are not visited.
*
* @signature function(callback, obj)
* @param callback {Function} Function to test each element of the array.
* @param obj {Object} Object to use as <code>this</code> when executing <code>callback</code>.
* @return {BaseArray} The newly created array with all matching elements
*/
filter : null,
/**
* Creates a new array with the results of calling a provided function on every element in this array.
*
* <code>map</code> calls a provided <code>callback</code> function once for each element in an array,
* in order, and constructs a new array from the results. <code>callback</code> is invoked only for
* indexes of the array which have assigned values; it is not invoked for indexes which have been
* deleted or which have never been assigned values.
*
* <code>callback</code> is invoked with three arguments: the value of the element, the index of the
* element, and the Array object being traversed.
*
* If a <code>obj</code> parameter is provided to <code>map</code>, it will be used as the
* <code>this</code> for each invocation of the <code>callback</code>. If it is not provided, or is
* <code>null</code>, the global object associated with <code>callback</code> is used instead.
*
* <code>map</code> does not mutate the array on which it is called.
*
* The range of elements processed by <code>map</code> is set before the first invocation of
* <code>callback</code>. Elements which are appended to the array after the call to <code>map</code>
* begins will not be visited by <code>callback</code>. If existing elements of the array are changed,
* or deleted, their value as passed to <code>callback</code> will be the value at the time
* <code>map</code> visits them; elements that are deleted are not visited.
*
* @signature function(callback, obj)
* @param callback {Function} Function produce an element of the new Array from an element of the current one.
* @param obj {Object} Object to use as <code>this</code> when executing <code>callback</code>.
* @return {BaseArray} A new array which contains the return values of every item executed through the given function
*/
map : null,
/**
* Tests whether some element in the array passes the test implemented by the provided function.
*
* <code>some</code> executes the <code>callback</code> function once for each element present in
* the array until it finds one where <code>callback</code> returns a true value. If such an element
* is found, <code>some</code> immediately returns <code>true</code>. Otherwise, <code>some</code>
* returns <code>false</code>. <code>callback</code> is invoked only for indexes of the array which
* have assigned values; it is not invoked for indexes which have been deleted or which have never
* been assigned values.
*
* <code>callback</code> is invoked with three arguments: the value of the element, the index of the
* element, and the Array object being traversed.
*
* If a <code>obj</code> parameter is provided to <code>some</code>, it will be used as the
* <code>this</code> for each invocation of the <code>callback</code>. If it is not provided, or is
* <code>null</code>, the global object associated with <code>callback</code> is used instead.
*
* <code>some</code> does not mutate the array on which it is called.
*
* The range of elements processed by <code>some</code> is set before the first invocation of
* <code>callback</code>. Elements that are appended to the array after the call to <code>some</code>
* begins will not be visited by <code>callback</code>. If an existing, unvisited element of the array
* is changed by <code>callback</code>, its value passed to the visiting <code>callback</code> will
* be the value at the time that <code>some</code> visits that element's index; elements that are
* deleted are not visited.
*
* @signature function(callback, obj)
* @param callback {Function} Function to test for each element.
* @param obj {Object} Object to use as <code>this</code> when executing <code>callback</code>.
* @return {Boolean} Whether at least one elements passed the test
*/
some : null,
/**
* Tests whether all elements in the array pass the test implemented by the provided function.
*
* <code>every</code> executes the provided <code>callback</code> function once for each element
* present in the array until it finds one where <code>callback</code> returns a false value. If
* such an element is found, the <code>every</code> method immediately returns <code>false</code>.
* Otherwise, if <code>callback</code> returned a true value for all elements, <code>every</code>
* will return <code>true</code>. <code>callback</code> is invoked only for indexes of the array
* which have assigned values; it is not invoked for indexes which have been deleted or which have
* never been assigned values.
*
* <code>callback</code> is invoked with three arguments: the value of the element, the index of
* the element, and the Array object being traversed.
*
* If a <code>obj</code> parameter is provided to <code>every</code>, it will be used as
* the <code>this</code> for each invocation of the <code>callback</code>. If it is not provided,
* or is <code>null</code>, the global object associated with <code>callback</code> is used instead.
*
* <code>every</code> does not mutate the array on which it is called. The range of elements processed
* by <code>every</code> is set before the first invocation of <code>callback</code>. Elements which
* are appended to the array after the call to <code>every</code> begins will not be visited by
* <code>callback</code>. If existing elements of the array are changed, their value as passed
* to <code>callback</code> will be the value at the time <code>every</code> visits them; elements
* that are deleted are not visited.
*
* @signature function(callback, obj)
* @param callback {Function} Function to test for each element.
* @param obj {Object} Object to use as <code>this</code> when executing <code>callback</code>.
* @return {Boolean} Whether all elements passed the test
*/
every : null
}
});
(function(){
function createStackConstructor(stack){
// In IE don't inherit from Array but use an empty object as prototype
// and copy the methods from Array
if((qx.core.Environment.get("engine.name") == "mshtml")){
Stack.prototype = {
length : 0,
$$isArray : true
};
var args = "pop.push.reverse.shift.sort.splice.unshift.join.slice".split(".");
for(var length = args.length;length;){
Stack.prototype[args[--length]] = Array.prototype[args[length]];
};
};
// Remember Array's slice method
var slice = Array.prototype.slice;
// Fix "concat" method
Stack.prototype.concat = function(){
var constructor = this.slice(0);
for(var i = 0,length = arguments.length;i < length;i++){
var copy;
if(arguments[i] instanceof Stack){
copy = slice.call(arguments[i], 0);
} else if(arguments[i] instanceof Array){
copy = arguments[i];
} else {
copy = [arguments[i]];
};
constructor.push.apply(constructor, copy);
};
return constructor;
};
// Fix "toString" method
Stack.prototype.toString = function(){
return slice.call(this, 0).toString();
};
// Fix "toLocaleString"
Stack.prototype.toLocaleString = function(){
return slice.call(this, 0).toLocaleString();
};
// Fix constructor
Stack.prototype.constructor = Stack;
// Add JS 1.6 Array features
Stack.prototype.indexOf = Array.prototype.indexOf;
Stack.prototype.lastIndexOf = Array.prototype.lastIndexOf;
Stack.prototype.forEach = Array.prototype.forEach;
Stack.prototype.some = Array.prototype.some;
Stack.prototype.every = Array.prototype.every;
var filter = Array.prototype.filter;
var map = Array.prototype.map;
// Fix methods which generates a new instance
// to return an instance of the same class
Stack.prototype.filter = function(){
var ret = new this.constructor;
ret.push.apply(ret, filter.apply(this, arguments));
return ret;
};
Stack.prototype.map = function(){
var ret = new this.constructor;
ret.push.apply(ret, map.apply(this, arguments));
return ret;
};
Stack.prototype.slice = function(){
var ret = new this.constructor;
ret.push.apply(ret, Array.prototype.slice.apply(this, arguments));
return ret;
};
Stack.prototype.splice = function(){
var ret = new this.constructor;
ret.push.apply(ret, Array.prototype.splice.apply(this, arguments));
return ret;
};
// Add new "toArray" method for convert a base array to a native Array
Stack.prototype.toArray = function(){
return Array.prototype.slice.call(this, 0);
};
// Add valueOf() to return the length
Stack.prototype.valueOf = function(){
return this.length;
};
// Return final class
return Stack;
};
function Stack(length){
if(arguments.length === 1 && typeof length === "number"){
this.length = -1 < length && length === length >> .5 ? length : this.push(length);
} else if(arguments.length){
this.push.apply(this, arguments);
};
};
function PseudoArray(){
};
PseudoArray.prototype = [];
Stack.prototype = new PseudoArray;
Stack.prototype.length = 0;
qx.type.BaseArray = createStackConstructor(Stack);
})();
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2012 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Martin Wittemann (wittemann)
************************************************************************ */
/* ************************************************************************
#ignore(q)
************************************************************************ */
/**
* The Core module's responsibility is to query the DOM for elements and offer
* these elements as a collection. The Core module itself does not offer any methods to
* work with the collection. These methods are added by the other included modules,
* such as Manipulating or Attributes.
*
* Core also provides the plugin API which allows modules to attach either
* static functions to the global <code>q</code> object or define methods on the
* collection it returns.
*
* By default, the core module is assigned to a global module named <code>q</code>.
* In case <code>q</code> is already defined, the name <code>qxWeb</code>
* is used instead.
*
* For further details, take a look at the documentation in the
* <a href='http://manual.qooxdoo.org/${qxversion}/pages/website.html' target='_blank'>user manual</a>.
*/
qx.Bootstrap.define("qxWeb", {
extend : qx.type.BaseArray,
statics : {
// internal storage for all initializers
__init : [],
// internal reference to the used qx namespace
$$qx : qx,
/**
* Internal helper to initialize collections.
*
* @param arg {var} An array of Elements which will
* be initialized as {@link q}. All items in the array which are not
* either a window object or a node object will be ignored.
* @return {q} A new initialized collection.
*/
$init : function(arg){
var clean = [];
for(var i = 0;i < arg.length;i++){
var isNode = !!(arg[i] && arg[i].nodeType != null);
if(isNode){
clean.push(arg[i]);
continue;
};
var isWindow = !!(arg[i] && arg[i].history && arg[i].location && arg[i].document);
if(isWindow){
clean.push(arg[i]);
};
};
// check for node or window object
var col = qx.lang.Array.cast(clean, qxWeb);
for(var i = 0;i < qxWeb.__init.length;i++){
qxWeb.__init[i].call(col);
};
return col;
},
/**
* This is an API for module development and can be used to attach new methods
* to {@link q}.
*
* @param module {Map} A map containing the methods to attach.
*/
$attach : function(module){
for(var name in module){
{
};
qxWeb.prototype[name] = module[name];
};
},
/**
* This is an API for module development and can be used to attach new methods
* to {@link q}.
*
* @param module {Map} A map containing the methods to attach.
*/
$attachStatic : function(module){
for(var name in module){
{
};
qxWeb[name] = module[name];
};
},
/**
* This is an API for module development and can be used to attach new initialization
* methods to {@link q} which will be called when a new collection is
* created.
*
* @param init {Function} The initialization method for a module.
*/
$attachInit : function(init){
this.__init.push(init);
},
/**
* Define a new class using the qooxdoo class system.
*
* @signature function(name, config)
* @param name {String?} Name of the class. If null, the class will not be
* attached to a namespace.
* @param config {Map} Class definition structure.
* @return {Function} The defined class.
*/
define : function(name, config){
if(config == undefined){
config = name;
name = null;
};
return qx.Bootstrap.define.call(qx.Bootstrap, name, config);
}
},
/**
* Accepts a selector string and returns a set of found items. The optional context
* element can be used to reduce the amount of found elements to children of the
* context element.
*
* <a href="http://sizzlejs.com/" target="_blank">Sizzle</a> is used as selector engine.
* Check out the <a href="https://github.com/jquery/sizzle/wiki/Sizzle-Home" target="_blank">documentation</a>
* for more details.
*
* @param selector {String|Element|Array} Valid selector (CSS3 + extensions)
* or DOM element or Array of DOM Elements.
* @param context {Element} Only the children of this element are considered.
* @return {q} A collection of DOM elements.
*/
construct : function(selector, context){
if(!selector && this instanceof qxWeb){
return this;
};
if(qx.Bootstrap.isString(selector)){
selector = qx.bom.Selector.query(selector, context);
} else if(!(qx.Bootstrap.isArray(selector))){
selector = [selector];
};
return qxWeb.$init(selector);
},
members : {
/**
* Gets a new collection containing only those elements that passed the
* given filter. This can be either a selector expression or a filter
* function.
*
* @param selector {String|Function} Selector expression or filter function
* @return {q} New collection containing the elements that passed the filter
*/
filter : function(selector){
if(qx.lang.Type.isFunction(selector)){
return qxWeb.$init(Array.prototype.filter.call(this, selector));
};
return qxWeb.$init(qx.bom.Selector.matches(selector, this));
},
/**
* Returns a copy of the collection within the given range.
*
* @param begin {Number} The index to begin.
* @param end {Number?} The index to end.
* @return {q} A new collection containing a slice of the original collection.
*/
slice : function(begin, end){
// Old IEs return an empty array if the second argument is undefined
if(end){
return qxWeb.$init(Array.prototype.slice.call(this, begin, end));
} else {
return qxWeb.$init(Array.prototype.slice.call(this, begin));
};
},
/**
* Removes the given number of items and returns the removed items as a new collection.
* This method can also add items. Take a look at the
* <a href='https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/splice' target='_blank'>documentation of MDN</a> for more details.
*
* @param index {Number} The index to begin.
* @param howMany {Number} the amount of items to remove.
* @param varargs {var} As many items as you want to add.
* @return {q} A new collection containing the removed items.
*/
splice : function(index, howMany, varargs){
return qxWeb.$init(Array.prototype.splice.apply(this, arguments));
},
/**
* Returns a new collection containing the modified elements. For more details, check out the
* <a href='https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/map' target='_blank'>MDN documentation</a>.
*
* @param callback {Function} Function which produces the new element.
* @param thisarg {var} Context of the callback.
* @return {q} New collection containing the elements that passed the filter
*/
map : function(callback, thisarg){
return qxWeb.$init(Array.prototype.map.apply(this, arguments));
},
/**
* Returns a copy of the collection including the given elements.
*
* @param varargs {var} As many items as you want to add.
* @return {q} A new collection containing all items.
*/
concat : function(varargs){
var clone = Array.prototype.slice.call(this, 0);
for(var i = 0;i < arguments.length;i++){
if(arguments[i] instanceof qxWeb){
clone = clone.concat(Array.prototype.slice.call(arguments[i], 0));
} else {
clone.push(arguments[i]);
};
};
return qxWeb.$init(clone);
}
},
/**
* @lint ignoreUndefined(q)
*/
defer : function(statics){
if(window.q == undefined){
q = statics;
};
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2004-2012 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Martin Wittemann (wittemann)
************************************************************************ */
/**
* This class takes care of the normalization of the native 'Date' object.
* Therefore it checks the availability of the following methods and appends
* it, if not available. This means you can use the methods during
* development in every browser. For usage samples, check out the attached links.
*
* *now*:
* <a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Date/now">MDN documentation</a> |
* <a href="http://es5.github.com/#x15.9.4.4">Annotated ES5 Spec</a>
*/
qx.Bootstrap.define("qx.lang.normalize.Date", {
defer : function(){
// Date.now
if(!qx.core.Environment.get("ecmascript.date.now")){
Date.now = function(){
return +new Date();
};
};
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2004-2008 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Sebastian Werner (wpbasti)
* Andreas Ecker (ecker)
======================================================================
This class contains code based on the following work:
* jQuery
http://jquery.com
Version 1.3.1
Copyright:
2009 John Resig
License:
MIT: http://www.opensource.org/licenses/mit-license.php
************************************************************************ */
/* ************************************************************************
#ignore(qx.data.IListData)
#ignore(qx.Class)
#require(qx.lang.normalize.Date)
************************************************************************ */
/**
* Static helper functions for arrays with a lot of often used convenience
* methods like <code>remove</code> or <code>contains</code>.
*
* The native JavaScript Array is not modified by this class. However,
* there are modifications to the native Array in {@link qx.lang.normalize.Array} for
* browsers that do not support certain JavaScript features natively .
*/
qx.Bootstrap.define("qx.lang.Array", {
statics : {
/**
* Converts array like constructions like the <code>argument</code> object,
* node collections like the ones returned by <code>getElementsByTagName</code>
* or extended array objects like <code>qx.type.BaseArray</code> to an
* native Array instance.
*
* @deprecated {2.1} Please use cast with 'Array' as constructor.
* @param object {var} any array like object
* @param offset {Integer?0} position to start from
* @return {Array} New array with the content of the incoming object
*/
toArray : function(object, offset){
{
};
return this.cast(object, Array, offset);
},
/**
* Converts an array like object to any other array like
* object.
*
* Attention: The returned array may be same
* instance as the incoming one if the constructor is identical!
*
* @param object {var} any array-like object
* @param constructor {Function} constructor of the new instance
* @param offset {Integer?0} position to start from
* @return {Array} the converted array
*/
cast : function(object, constructor, offset){
if(object.constructor === constructor){
return object;
};
if(qx.data && qx.data.IListData){
if(qx.Class && qx.Class.hasInterface(object, qx.data.IListData)){
var object = object.toArray();
};
};
// Create from given constructor
var ret = new constructor;
// Some collections in mshtml are not able to be sliced.
// These lines are a special workaround for this client.
if((qx.core.Environment.get("engine.name") == "mshtml")){
if(object.item){
for(var i = offset || 0,l = object.length;i < l;i++){
ret.push(object[i]);
};
return ret;
};
};
// Copy over items
if(Object.prototype.toString.call(object) === "[object Array]" && offset == null){
ret.push.apply(ret, object);
} else {
ret.push.apply(ret, Array.prototype.slice.call(object, offset || 0));
};
return ret;
},
/**
* Convert an arguments object into an array.
*
* @param args {arguments} arguments object
* @param offset {Integer?0} position to start from
* @return {Array} a newly created array (copy) with the content of the arguments object.
*/
fromArguments : function(args, offset){
return Array.prototype.slice.call(args, offset || 0);
},
/**
* Convert a (node) collection into an array
*
* @param coll {var} node collection
* @return {Array} a newly created array (copy) with the content of the node collection.
*/
fromCollection : function(coll){
// The native Array.slice cannot be used with some Array-like objects
// including NodeLists in older IEs
if((qx.core.Environment.get("engine.name") == "mshtml")){
if(coll.item){
var arr = [];
for(var i = 0,l = coll.length;i < l;i++){
arr[i] = coll[i];
};
return arr;
};
};
return Array.prototype.slice.call(coll, 0);
},
/**
* Expand shorthand definition to a four element list.
* This is an utility function for padding/margin and all other shorthand handling.
*
* @param input {Array} arr with one to four elements
* @return {Array} an arr with four elements
*/
fromShortHand : function(input){
var len = input.length;
var result = qx.lang.Array.clone(input);
// Copy Values (according to the length)
switch(len){case 1:
result[1] = result[2] = result[3] = result[0];
break;case 2:
result[2] = result[0];// no break here
case 3:
result[3] = result[1];};
// Return list with 4 items
return result;
},
/**
* Return a copy of the given array
*
* @param arr {Array} the array to copy
* @return {Array} copy of the array
*/
clone : function(arr){
return arr.concat();
},
/**
* Insert an element at a given position into the array
*
* @param arr {Array} the array
* @param obj {var} the element to insert
* @param i {Integer} position where to insert the element into the array
* @return {Array} the array
*/
insertAt : function(arr, obj, i){
arr.splice(i, 0, obj);
return arr;
},
/**
* Insert an element into the array before a given second element.
*
* @param arr {Array} the array
* @param obj {var} object to be inserted
* @param obj2 {var} insert obj1 before this object
* @return {Array} the array
*/
insertBefore : function(arr, obj, obj2){
var i = arr.indexOf(obj2);
if(i == -1){
arr.push(obj);
} else {
arr.splice(i, 0, obj);
};
return arr;
},
/**
* Insert an element into the array after a given second element.
*
* @param arr {Array} the array
* @param obj {var} object to be inserted
* @param obj2 {var} insert obj1 after this object
* @return {Array} the array
*/
insertAfter : function(arr, obj, obj2){
var i = arr.indexOf(obj2);
if(i == -1 || i == (arr.length - 1)){
arr.push(obj);
} else {
arr.splice(i + 1, 0, obj);
};
return arr;
},
/**
* Remove an element from the array at the given index
*
* @param arr {Array} the array
* @param i {Integer} index of the element to be removed
* @return {var} The removed element.
*/
removeAt : function(arr, i){
return arr.splice(i, 1)[0];
},
/**
* Remove all elements from the array
*
* @param arr {Array} the array
* @return {Array} empty array
*/
removeAll : function(arr){
arr.length = 0;
return this;
},
/**
* Append the elements of an array to the array
*
* @param arr1 {Array} the array
* @param arr2 {Array} the elements of this array will be appended to other one
* @return {Array} The modified array.
* @throws {Error} if one of the arguments is not an array
*/
append : function(arr1, arr2){
{
};
Array.prototype.push.apply(arr1, arr2);
return arr1;
},
/**
* Modifies the first array as it removes all elements
* which are listed in the second array as well.
*
* @param arr1 {Array} the array
* @param arr2 {Array} the elements of this array will be excluded from the other one
* @return {Array} The modified array.
* @throws {Error} if one of the arguments is not an array
*/
exclude : function(arr1, arr2){
{
};
for(var i = 0,il = arr2.length,index;i < il;i++){
index = arr1.indexOf(arr2[i]);
if(index != -1){
arr1.splice(index, 1);
};
};
return arr1;
},
/**
* Remove an element from the array.
*
* @param arr {Array} the array
* @param obj {var} element to be removed from the array
* @return {var} the removed element
*/
remove : function(arr, obj){
var i = arr.indexOf(obj);
if(i != -1){
arr.splice(i, 1);
return obj;
};
},
/**
* Whether the array contains the given element
*
* @param arr {Array} the array
* @param obj {var} object to look for
* @return {Boolean} whether the arr contains the element
*/
contains : function(arr, obj){
return arr.indexOf(obj) !== -1;
},
/**
* Check whether the two arrays have the same content. Checks only the
* equality of the arrays' content.
*
* @param arr1 {Array} first array
* @param arr2 {Array} second array
* @return {Boolean} Whether the two arrays are equal
*/
equals : function(arr1, arr2){
var length = arr1.length;
if(length !== arr2.length){
return false;
};
for(var i = 0;i < length;i++){
if(arr1[i] !== arr2[i]){
return false;
};
};
return true;
},
/**
* Returns the sum of all values in the given array. Supports
* numeric values only.
*
* @param arr {Number[]} Array to process
* @return {Number} The sum of all values.
*/
sum : function(arr){
var result = 0;
for(var i = 0,l = arr.length;i < l;i++){
result += arr[i];
};
return result;
},
/**
* Returns the highest value in the given array. Supports
* numeric values only.
*
* @param arr {Number[]} Array to process
* @return {Number | null} The highest of all values or undefined if array is empty.
*/
max : function(arr){
{
};
var i,len = arr.length,result = arr[0];
for(i = 1;i < len;i++){
if(arr[i] > result){
result = arr[i];
};
};
return result === undefined ? null : result;
},
/**
* Returns the lowest value in the given array. Supports
* numeric values only.
*
* @param arr {Number[]} Array to process
* @return {Number | null} The lowest of all values or undefined if array is empty.
*/
min : function(arr){
{
};
var i,len = arr.length,result = arr[0];
for(i = 1;i < len;i++){
if(arr[i] < result){
result = arr[i];
};
};
return result === undefined ? null : result;
},
/**
* Recreates an array which is free of all duplicate elements from the original.
*
* This method do not modifies the original array!
*
* Keep in mind that this methods deletes undefined indexes.
*
* @param arr {Array} Incoming array
* @return {Array} Returns a copy with no duplicates or the original array if no duplicates were found
*/
unique : function(arr){
var ret = [],doneStrings = {
},doneNumbers = {
},doneObjects = {
};
var value,count = 0;
var key = "qx" + Date.now();
var hasNull = false,hasFalse = false,hasTrue = false;
// Rebuild array and omit duplicates
for(var i = 0,len = arr.length;i < len;i++){
value = arr[i];
// Differ between null, primitives and reference types
if(value === null){
if(!hasNull){
hasNull = true;
ret.push(value);
};
} else if(value === undefined){
} else if(value === false){
if(!hasFalse){
hasFalse = true;
ret.push(value);
};
} else if(value === true){
if(!hasTrue){
hasTrue = true;
ret.push(value);
};
} else if(typeof value === "string"){
if(!doneStrings[value]){
doneStrings[value] = 1;
ret.push(value);
};
} else if(typeof value === "number"){
if(!doneNumbers[value]){
doneNumbers[value] = 1;
ret.push(value);
};
} else {
var hash = value[key];
if(hash == null){
hash = value[key] = count++;
};
if(!doneObjects[hash]){
doneObjects[hash] = value;
ret.push(value);
};
};;;;;
};
// Clear object hashs
for(var hash in doneObjects){
try{
// TODO: The following delete seems to fail in IE7
delete doneObjects[hash][key];
} catch(ex) {
try{
doneObjects[hash][key] = null;
} catch(ex1) {
throw new Error("Cannot clean-up map entry doneObjects[" + hash + "][" + key + "]");
};
};
};
return ret;
}
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2008-2010 Sebastian Werner, http://sebastian-werner.net
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Sebastian Werner (wpbasti)
* Fabian Jakobs (fjakobs)
* Andreas Ecker (ecker)
======================================================================
This class contains code based on the following work:
* Sizzle CSS Selector Engine - v1.8.2
Homepage:
http://sizzlejs.com/
Documentation:
http://wiki.github.com/jeresig/sizzle
Discussion:
http://groups.google.com/group/sizzlejs
Code:
http://github.com/jeresig/sizzle/tree
Copyright:
(c) 2009, The Dojo Foundation
License:
MIT: http://www.opensource.org/licenses/mit-license.php
----------------------------------------------------------------------
Copyright (c) 2009 John Resig
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation files
(the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
----------------------------------------------------------------------
Version:
Snapshot taken on 2012-10-02, latest Sizzle commit on 2012-09-20:
commit 41a7c2ce9be6c66e0c9b8b15e0a29c8e3ca6fb31
************************************************************************ */
/**
* The selector engine supports virtually all CSS 3 Selectors – this even
* includes some parts that are infrequently implemented such as escaped
* selectors (<code>.foo\\+bar</code>), Unicode selectors, and results returned
* in document order. There are a few notable exceptions to the CSS 3 selector
* support:
*
* * <code>:root</code>
* * <code>:target</code>
* * <code>:nth-last-child</code>
* * <code>:nth-of-type</code>
* * <code>:nth-last-of-type</code>
* * <code>:first-of-type</code>
* * <code>:last-of-type</code>
* * <code>:only-of-type</code>
* * <code>:lang()</code>
*
* In addition to the CSS 3 Selectors the engine supports the following
* additional selectors or conventions.
*
* *Changes*
*
* * <code>:not(a.b)</code>: Supports non-simple selectors in <code>:not()</code> (most browsers only support <code>:not(a)</code>, for example).
* * <code>:not(div > p)</code>: Supports full selectors in <code>:not()</code>.
* * <code>:not(div, p)</code>: Supports multiple selectors in <code>:not()</code>.
* * <code>[NAME=VALUE]</code>: Doesn't require quotes around the specified value in an attribute selector.
*
* *Additions*
*
* * <code>[NAME!=VALUE]</code>: Finds all elements whose <code>NAME</code> attribute doesn't match the specified value. Is equivalent to doing <code>:not([NAME=VALUE])</code>.
* * <code>:contains(TEXT)</code>: Finds all elements whose textual context contains the word <code>TEXT</code> (case sensitive).
* * <code>:header</code>: Finds all elements that are a header element (h1, h2, h3, h4, h5, h6).
* * <code>:parent</code>: Finds all elements that contains another element.
*
* *Positional Selector Additions*
*
* * <code>:first</code>/</code>:last</code>: Finds the first or last matching element on the page. (e.g. <code>div:first</code> would find the first div on the page, in document order)
* * <code>:even</code>/<code>:odd</code>: Finds every other element on the page (counting begins at 0, so <code>:even</code> would match the first element).
* * <code>:eq</code>/<code>:nth</code>: Finds the Nth element on the page (e.g. <code>:eq(5)</code> finds the 6th element on the page).
* * <code>:lt</code>/<code>:gt</code>: Finds all elements at positions less than or greater than the specified positions.
*
* *Form Selector Additions*
*
* * <code>:input</code>: Finds all input elements (includes textareas, selects, and buttons).
* * <code>:text</code>, <code>:checkbox</code>, <code>:file</code>, <code>:password</code>, <code>:submit</code>, <code>:image</code>, <code>:reset</code>, <code>:button</code>: Finds the input element with the specified input type (<code>:button</code> also finds button elements).
*
* Based on Sizzle by John Resig, see:
*
* * http://sizzlejs.com/
*
* For further usage details also have a look at the wiki page at:
*
* * https://github.com/jquery/sizzle/wiki/Sizzle-Home
*/
qx.Bootstrap.define("qx.bom.Selector", {
statics : {
/**
* Queries the document for the given selector. Supports all CSS3 selectors
* plus some extensions as mentioned in the class description.
*
* @signature function(selector, context)
* @param selector {String} Valid selector (CSS3 + extensions)
* @param context {Element} Context element (result elements must be children of this element)
* @return {Array} Matching elements
*/
query : null,
/**
* Returns an reduced array which only contains the elements from the given
* array which matches the given selector
*
* @signature function(selector, set)
* @param selector {String} Selector to filter given set
* @param set {Array} List to filter according to given selector
* @return {Array} New array containing matching elements
*/
matches : null
}
});
/**
* Below is the original Sizzle code. Snapshot date is mentioned in the head of
* this file.
* @lint ignoreUnused(j, rnot, rendsWithNot)
*/
/*!
* Sizzle CSS Selector Engine
* Copyright 2012 jQuery Foundation and other contributors
* Released under the MIT license
* http://sizzlejs.com/
*/
(function(window, undefined){
var cachedruns,assertGetIdNotName,Expr,getText,isXML,contains,compile,sortOrder,hasDuplicate,outermostContext,baseHasDuplicate = true,strundefined = "undefined",expando = ("sizcache" + Math.random()).replace(".", ""),Token = String,document = window.document,docElem = document.documentElement,dirruns = 0,done = 0,pop = [].pop,push = [].push,slice = [].slice,// Use a stripped-down indexOf if a native one is unavailable
indexOf = [].indexOf || function(elem){
var i = 0,len = this.length;
for(;i < len;i++){
if(this[i] === elem){
return i;
};
};
return -1;
},// Augment a function for special use by Sizzle
markFunction = function(fn, value){
fn[expando] = value == null || value;
return fn;
},createCache = function(){
var cache = {
},keys = [];
return markFunction(function(key, value){
// Only keep the most recent entries
if(keys.push(key) > Expr.cacheLength){
delete cache[keys.shift()];
};
return (cache[key] = value);
}, cache);
},classCache = createCache(),tokenCache = createCache(),compilerCache = createCache(),// Regex
// Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace
whitespace = "[\\x20\\t\\r\\n\\f]",// http://www.w3.org/TR/css3-syntax/#characters
characterEncoding = "(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+",// Loosely modeled on CSS identifier characters
// An unquoted value should be a CSS identifier (http://www.w3.org/TR/css3-selectors/#attribute-selectors)
// Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
identifier = characterEncoding.replace("w", "w#"),// Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors
operators = "([*^$|!~]?=)",attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace + "*(?:" + operators + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]",// Prefer arguments not in parens/brackets,
// then attribute selectors and non-pseudos (denoted by :),
// then anything else
// These preferences are here to reduce the number of selectors
// needing tokenize in the PSEUDO preFilter
pseudos = ":(" + characterEncoding + ")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|([^()[\\]]*|(?:(?:" + attributes + ")|[^:]|\\\\.)*|.*))\\)|)",// For matchExpr.POS and matchExpr.needsContext
pos = ":(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)",// Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
rtrim = new RegExp("^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g"),rcomma = new RegExp("^" + whitespace + "*," + whitespace + "*"),rcombinators = new RegExp("^" + whitespace + "*([\\x20\\t\\r\\n\\f>+~])" + whitespace + "*"),rpseudo = new RegExp(pseudos),// Easily-parseable/retrievable ID or TAG or CLASS selectors
rquickExpr = /^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/,rnot = /^:not/,rsibling = /[\x20\t\r\n\f]*[+~]/,rendsWithNot = /:not\($/,rheader = /h\d/i,rinputs = /input|select|textarea|button/i,rbackslash = /\\(?!\\)/g,matchExpr = {
"ID" : new RegExp("^#(" + characterEncoding + ")"),
"CLASS" : new RegExp("^\\.(" + characterEncoding + ")"),
"NAME" : new RegExp("^\\[name=['\"]?(" + characterEncoding + ")['\"]?\\]"),
"TAG" : new RegExp("^(" + characterEncoding.replace("w", "w*") + ")"),
"ATTR" : new RegExp("^" + attributes),
"PSEUDO" : new RegExp("^" + pseudos),
"POS" : new RegExp(pos, "i"),
"CHILD" : new RegExp("^:(only|nth|first|last)-child(?:\\(" + whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i"),
// For use in libraries implementing .is()
"needsContext" : new RegExp("^" + whitespace + "*[>+~]|" + pos, "i")
},// Support
// Used for testing something on an element
assert = function(fn){
var div = document.createElement("div");
try{
return fn(div);
} catch(e) {
return false;
}finally{
// release memory in IE
div = null;
};
},// Check if getElementsByTagName("*") returns only elements
assertTagNameNoComments = assert(function(div){
div.appendChild(document.createComment(""));
return !div.getElementsByTagName("*").length;
}),// Check if getAttribute returns normalized href attributes
assertHrefNotNormalized = assert(function(div){
div.innerHTML = "<a href='#'></a>";
return div.firstChild && typeof div.firstChild.getAttribute !== strundefined && div.firstChild.getAttribute("href") === "#";
}),// Check if attributes should be retrieved by attribute nodes
assertAttributes = assert(function(div){
div.innerHTML = "<select></select>";
var type = typeof div.lastChild.getAttribute("multiple");
// IE8 returns a string for some attributes even when not present
return type !== "boolean" && type !== "string";
}),// Check if getElementsByClassName can be trusted
assertUsableClassName = assert(function(div){
// Opera can't find a second classname (in 9.6)
div.innerHTML = "<div class='hidden e'></div><div class='hidden'></div>";
if(!div.getElementsByClassName || !div.getElementsByClassName("e").length){
return false;
};
// Safari 3.2 caches class attributes and doesn't catch changes
div.lastChild.className = "e";
return div.getElementsByClassName("e").length === 2;
}),// Check if getElementById returns elements by name
// Check if getElementsByName privileges form controls or returns elements by ID
assertUsableName = assert(function(div){
// Inject content
div.id = expando + 0;
div.innerHTML = "<a name='" + expando + "'></a><div name='" + expando + "'></div>";
docElem.insertBefore(div, docElem.firstChild);
// Test
var pass = document.getElementsByName && // buggy browsers will return fewer than the correct 2
document.getElementsByName(expando).length === 2 + // buggy browsers will return more than the correct 0
document.getElementsByName(expando + 0).length;
assertGetIdNotName = !document.getElementById(expando);
// Cleanup
docElem.removeChild(div);
return pass;
});
// If slice is not available, provide a backup
try{
slice.call(docElem.childNodes, 0)[0].nodeType;
} catch(e) {
slice = function(i){
var elem,results = [];
for(;(elem = this[i]);i++){
results.push(elem);
};
return results;
};
};
function Sizzle(selector, context, results, seed){
results = results || [];
context = context || document;
var match,elem,xml,m,nodeType = context.nodeType;
if(!selector || typeof selector !== "string"){
return results;
};
if(nodeType !== 1 && nodeType !== 9){
return [];
};
xml = isXML(context);
if(!xml && !seed){
if((match = rquickExpr.exec(selector))){
// Speed-up: Sizzle("#ID")
if((m = match[1])){
if(nodeType === 9){
elem = context.getElementById(m);
// Check parentNode to catch when Blackberry 4.6 returns
// nodes that are no longer in the document #6963
if(elem && elem.parentNode){
// Handle the case where IE, Opera, and Webkit return items
// by name instead of ID
if(elem.id === m){
results.push(elem);
return results;
};
} else {
return results;
};
} else {
// Context is not a document
if(context.ownerDocument && (elem = context.ownerDocument.getElementById(m)) && contains(context, elem) && elem.id === m){
results.push(elem);
return results;
};
};
} else if(match[2]){
push.apply(results, slice.call(context.getElementsByTagName(selector), 0));
return results;
} else if((m = match[3]) && assertUsableClassName && context.getElementsByClassName){
push.apply(results, slice.call(context.getElementsByClassName(m), 0));
return results;
};;
};
};
// All others
return select(selector.replace(rtrim, "$1"), context, results, seed, xml);
};
Sizzle.matches = function(expr, elements){
return Sizzle(expr, null, null, elements);
};
Sizzle.matchesSelector = function(elem, expr){
return Sizzle(expr, null, null, [elem]).length > 0;
};
// Returns a function to use in pseudos for input types
function createInputPseudo(type){
return function(elem){
var name = elem.nodeName.toLowerCase();
return name === "input" && elem.type === type;
};
};
// Returns a function to use in pseudos for buttons
function createButtonPseudo(type){
return function(elem){
var name = elem.nodeName.toLowerCase();
return (name === "input" || name === "button") && elem.type === type;
};
};
// Returns a function to use in pseudos for positionals
function createPositionalPseudo(fn){
return markFunction(function(argument){
argument = +argument;
return markFunction(function(seed, matches){
var j,matchIndexes = fn([], seed.length, argument),i = matchIndexes.length;
// Match elements found at the specified indexes
while(i--){
if(seed[(j = matchIndexes[i])]){
seed[j] = !(matches[j] = seed[j]);
};
};
});
});
};
/**
* Utility function for retrieving the text value of an array of DOM nodes
* @param {Array|Element} elem
*/
getText = Sizzle.getText = function(elem){
var node,ret = "",i = 0,nodeType = elem.nodeType;
if(nodeType){
if(nodeType === 1 || nodeType === 9 || nodeType === 11){
// Use textContent for elements
// innerText usage removed for consistency of new lines (see #11153)
if(typeof elem.textContent === "string"){
return elem.textContent;
} else {
// Traverse its children
for(elem = elem.firstChild;elem;elem = elem.nextSibling){
ret += getText(elem);
};
};
} else if(nodeType === 3 || nodeType === 4){
return elem.nodeValue;
};
} else {
// If no nodeType, this is expected to be an array
for(;(node = elem[i]);i++){
// Do not traverse comment nodes
ret += getText(node);
};
};
return ret;
};
isXML = Sizzle.isXML = function(elem){
// documentElement is verified for cases where it doesn't yet exist
// (such as loading iframes in IE - #4833)
var documentElement = elem && (elem.ownerDocument || elem).documentElement;
return documentElement ? documentElement.nodeName !== "HTML" : false;
};
// Element contains another
contains = Sizzle.contains = docElem.contains ? function(a, b){
var adown = a.nodeType === 9 ? a.documentElement : a,bup = b && b.parentNode;
return a === bup || !!(bup && bup.nodeType === 1 && adown.contains && adown.contains(bup));
} : docElem.compareDocumentPosition ? function(a, b){
return b && !!(a.compareDocumentPosition(b) & 16);
} : function(a, b){
while((b = b.parentNode)){
if(b === a){
return true;
};
};
return false;
};
Sizzle.attr = function(elem, name){
var val,xml = isXML(elem);
if(!xml){
name = name.toLowerCase();
};
if((val = Expr.attrHandle[name])){
return val(elem);
};
if(xml || assertAttributes){
return elem.getAttribute(name);
};
val = elem.getAttributeNode(name);
return val ? typeof elem[name] === "boolean" ? elem[name] ? name : null : val.specified ? val.value : null : null;
};
Expr = Sizzle.selectors = {
// Can be adjusted by the user
cacheLength : 50,
createPseudo : markFunction,
match : matchExpr,
// IE6/7 return a modified href
attrHandle : assertHrefNotNormalized ? {
} : {
"href" : function(elem){
return elem.getAttribute("href", 2);
},
"type" : function(elem){
return elem.getAttribute("type");
}
},
find : {
"ID" : assertGetIdNotName ? function(id, context, xml){
if(typeof context.getElementById !== strundefined && !xml){
var m = context.getElementById(id);
// Check parentNode to catch when Blackberry 4.6 returns
// nodes that are no longer in the document #6963
return m && m.parentNode ? [m] : [];
};
} : function(id, context, xml){
if(typeof context.getElementById !== strundefined && !xml){
var m = context.getElementById(id);
return m ? m.id === id || typeof m.getAttributeNode !== strundefined && m.getAttributeNode("id").value === id ? [m] : undefined : [];
};
},
"TAG" : assertTagNameNoComments ? function(tag, context){
if(typeof context.getElementsByTagName !== strundefined){
return context.getElementsByTagName(tag);
};
} : function(tag, context){
var results = context.getElementsByTagName(tag);
// Filter out possible comments
if(tag === "*"){
var elem,tmp = [],i = 0;
for(;(elem = results[i]);i++){
if(elem.nodeType === 1){
tmp.push(elem);
};
};
return tmp;
};
return results;
},
"NAME" : assertUsableName && function(tag, context){
if(typeof context.getElementsByName !== strundefined){
return context.getElementsByName(name);
};
},
"CLASS" : assertUsableClassName && function(className, context, xml){
if(typeof context.getElementsByClassName !== strundefined && !xml){
return context.getElementsByClassName(className);
};
}
},
relative : {
">" : {
dir : "parentNode",
first : true
},
" " : {
dir : "parentNode"
},
"+" : {
dir : "previousSibling",
first : true
},
"~" : {
dir : "previousSibling"
}
},
preFilter : {
"ATTR" : function(match){
match[1] = match[1].replace(rbackslash, "");
// Move the given value to match[3] whether quoted or unquoted
match[3] = (match[4] || match[5] || "").replace(rbackslash, "");
if(match[2] === "~="){
match[3] = " " + match[3] + " ";
};
return match.slice(0, 4);
},
"CHILD" : function(match){
/* matches from matchExpr["CHILD"]
1 type (only|nth|...)
2 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
3 xn-component of xn+y argument ([+-]?\d*n|)
4 sign of xn-component
5 x of xn-component
6 sign of y-component
7 y of y-component
*/
match[1] = match[1].toLowerCase();
if(match[1] === "nth"){
// nth-child requires argument
if(!match[2]){
Sizzle.error(match[0]);
};
// numeric x and y parameters for Expr.filter.CHILD
// remember that false/true cast respectively to 0/1
match[3] = +(match[3] ? match[4] + (match[5] || 1) : 2 * (match[2] === "even" || match[2] === "odd"));
match[4] = +((match[6] + match[7]) || match[2] === "odd");
} else if(match[2]){
Sizzle.error(match[0]);
};
return match;
},
"PSEUDO" : function(match){
var unquoted,excess;
if(matchExpr["CHILD"].test(match[0])){
return null;
};
if(match[3]){
match[2] = match[3];
} else if((unquoted = match[4])){
// Only check arguments that contain a pseudo
if(rpseudo.test(unquoted) && // Get excess from tokenize (recursively)
(excess = tokenize(unquoted, true)) && // advance to the next closing parenthesis
(excess = unquoted.indexOf(")", unquoted.length - excess) - unquoted.length)){
// excess is a negative index
unquoted = unquoted.slice(0, excess);
match[0] = match[0].slice(0, excess);
};
match[2] = unquoted;
};
// Return only captures needed by the pseudo filter method (type and argument)
return match.slice(0, 3);
}
},
filter : {
"ID" : assertGetIdNotName ? function(id){
id = id.replace(rbackslash, "");
return function(elem){
return elem.getAttribute("id") === id;
};
} : function(id){
id = id.replace(rbackslash, "");
return function(elem){
var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id");
return node && node.value === id;
};
},
"TAG" : function(nodeName){
if(nodeName === "*"){
return function(){
return true;
};
};
nodeName = nodeName.replace(rbackslash, "").toLowerCase();
return function(elem){
return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
};
},
"CLASS" : function(className){
var pattern = classCache[expando][className];
if(!pattern){
pattern = classCache(className, new RegExp("(^|" + whitespace + ")" + className + "(" + whitespace + "|$)"));
};
return function(elem){
return pattern.test(elem.className || (typeof elem.getAttribute !== strundefined && elem.getAttribute("class")) || "");
};
},
"ATTR" : function(name, operator, check){
return function(elem, context){
var result = Sizzle.attr(elem, name);
if(result == null){
return operator === "!=";
};
if(!operator){
return true;
};
result += "";
return operator === "=" ? result === check : operator === "!=" ? result !== check : operator === "^=" ? check && result.indexOf(check) === 0 : operator === "*=" ? check && result.indexOf(check) > -1 : operator === "$=" ? check && result.substr(result.length - check.length) === check : operator === "~=" ? (" " + result + " ").indexOf(check) > -1 : operator === "|=" ? result === check || result.substr(0, check.length + 1) === check + "-" : false;
};
},
"CHILD" : function(type, argument, first, last){
if(type === "nth"){
return function(elem){
var node,diff,parent = elem.parentNode;
if(first === 1 && last === 0){
return true;
};
if(parent){
diff = 0;
for(node = parent.firstChild;node;node = node.nextSibling){
if(node.nodeType === 1){
diff++;
if(elem === node){
break;
};
};
};
};
// Incorporate the offset (or cast to NaN), then check against cycle size
diff -= last;
return diff === first || (diff % first === 0 && diff / first >= 0);
};
};
return function(elem){
var node = elem;
switch(type){case "only":case "first":
while((node = node.previousSibling)){
if(node.nodeType === 1){
return false;
};
};
if(type === "first"){
return true;
};
node = elem;/* falls through */
case "last":
while((node = node.nextSibling)){
if(node.nodeType === 1){
return false;
};
};
return true;};
};
},
"PSEUDO" : function(pseudo, argument){
// pseudo-class names are case-insensitive
// http://www.w3.org/TR/selectors/#pseudo-classes
// Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
// Remember that setFilters inherits from pseudos
var args,fn = Expr.pseudos[pseudo] || Expr.setFilters[pseudo.toLowerCase()] || Sizzle.error("unsupported pseudo: " + pseudo);
// The user may use createPseudo to indicate that
// arguments are needed to create the filter function
// just as Sizzle does
if(fn[expando]){
return fn(argument);
};
// But maintain support for old signatures
if(fn.length > 1){
args = [pseudo, pseudo, "", argument];
return Expr.setFilters.hasOwnProperty(pseudo.toLowerCase()) ? markFunction(function(seed, matches){
var idx,matched = fn(seed, argument),i = matched.length;
while(i--){
idx = indexOf.call(seed, matched[i]);
seed[idx] = !(matches[idx] = matched[i]);
};
}) : function(elem){
return fn(elem, 0, args);
};
};
return fn;
}
},
pseudos : {
"not" : markFunction(function(selector){
// Trim the selector passed to compile
// to avoid treating leading and trailing
// spaces as combinators
var input = [],results = [],matcher = compile(selector.replace(rtrim, "$1"));
return matcher[expando] ? markFunction(function(seed, matches, context, xml){
var elem,unmatched = matcher(seed, null, xml, []),i = seed.length;
// Match elements unmatched by `matcher`
while(i--){
if((elem = unmatched[i])){
seed[i] = !(matches[i] = elem);
};
};
}) : function(elem, context, xml){
input[0] = elem;
matcher(input, null, xml, results);
return !results.pop();
};
}),
"has" : markFunction(function(selector){
return function(elem){
return Sizzle(selector, elem).length > 0;
};
}),
"contains" : markFunction(function(text){
return function(elem){
return (elem.textContent || elem.innerText || getText(elem)).indexOf(text) > -1;
};
}),
"enabled" : function(elem){
return elem.disabled === false;
},
"disabled" : function(elem){
return elem.disabled === true;
},
"checked" : function(elem){
// In CSS3, :checked should return both checked and selected elements
// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
var nodeName = elem.nodeName.toLowerCase();
return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
},
"selected" : function(elem){
// Accessing this property makes selected-by-default
// options in Safari work properly
if(elem.parentNode){
elem.parentNode.selectedIndex;
};
return elem.selected === true;
},
"parent" : function(elem){
return !Expr.pseudos["empty"](elem);
},
"empty" : function(elem){
// http://www.w3.org/TR/selectors/#empty-pseudo
// :empty is only affected by element nodes and content nodes(including text(3), cdata(4)),
// not comment, processing instructions, or others
// Thanks to Diego Perini for the nodeName shortcut
// Greater than "@" means alpha characters (specifically not starting with "#" or "?")
var nodeType;
elem = elem.firstChild;
while(elem){
if(elem.nodeName > "@" || (nodeType = elem.nodeType) === 3 || nodeType === 4){
return false;
};
elem = elem.nextSibling;
};
return true;
},
"header" : function(elem){
return rheader.test(elem.nodeName);
},
"text" : function(elem){
var type,attr;
// IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc)
// use getAttribute instead to test this case
return elem.nodeName.toLowerCase() === "input" && (type = elem.type) === "text" && ((attr = elem.getAttribute("type")) == null || attr.toLowerCase() === type);
},
// Input types
"radio" : createInputPseudo("radio"),
"checkbox" : createInputPseudo("checkbox"),
"file" : createInputPseudo("file"),
"password" : createInputPseudo("password"),
"image" : createInputPseudo("image"),
"submit" : createButtonPseudo("submit"),
"reset" : createButtonPseudo("reset"),
"button" : function(elem){
var name = elem.nodeName.toLowerCase();
return name === "input" && elem.type === "button" || name === "button";
},
"input" : function(elem){
return rinputs.test(elem.nodeName);
},
"focus" : function(elem){
var doc = elem.ownerDocument;
return elem === doc.activeElement && (!doc.hasFocus || doc.hasFocus()) && !!(elem.type || elem.href);
},
"active" : function(elem){
return elem === elem.ownerDocument.activeElement;
},
// Positional types
"first" : createPositionalPseudo(function(matchIndexes, length, argument){
return [0];
}),
"last" : createPositionalPseudo(function(matchIndexes, length, argument){
return [length - 1];
}),
"eq" : createPositionalPseudo(function(matchIndexes, length, argument){
return [argument < 0 ? argument + length : argument];
}),
"even" : createPositionalPseudo(function(matchIndexes, length, argument){
for(var i = 0;i < length;i += 2){
matchIndexes.push(i);
};
return matchIndexes;
}),
"odd" : createPositionalPseudo(function(matchIndexes, length, argument){
for(var i = 1;i < length;i += 2){
matchIndexes.push(i);
};
return matchIndexes;
}),
"lt" : createPositionalPseudo(function(matchIndexes, length, argument){
for(var i = argument < 0 ? argument + length : argument;--i >= 0;){
matchIndexes.push(i);
};
return matchIndexes;
}),
"gt" : createPositionalPseudo(function(matchIndexes, length, argument){
for(var i = argument < 0 ? argument + length : argument;++i < length;){
matchIndexes.push(i);
};
return matchIndexes;
})
}
};
function siblingCheck(a, b, ret){
if(a === b){
return ret;
};
var cur = a.nextSibling;
while(cur){
if(cur === b){
return -1;
};
cur = cur.nextSibling;
};
return 1;
};
sortOrder = docElem.compareDocumentPosition ? function(a, b){
if(a === b){
hasDuplicate = true;
return 0;
};
return (!a.compareDocumentPosition || !b.compareDocumentPosition ? a.compareDocumentPosition : a.compareDocumentPosition(b) & 4) ? -1 : 1;
} : function(a, b){
// The nodes are identical, we can exit early
if(a === b){
hasDuplicate = true;
return 0;
} else if(a.sourceIndex && b.sourceIndex){
return a.sourceIndex - b.sourceIndex;
};
var al,bl,ap = [],bp = [],aup = a.parentNode,bup = b.parentNode,cur = aup;
// If the nodes are siblings (or identical) we can do a quick check
if(aup === bup){
return siblingCheck(a, b);
} else if(!aup){
return -1;
} else if(!bup){
return 1;
};;
// Otherwise they're somewhere else in the tree so we need
// to build up a full list of the parentNodes for comparison
while(cur){
ap.unshift(cur);
cur = cur.parentNode;
};
cur = bup;
while(cur){
bp.unshift(cur);
cur = cur.parentNode;
};
al = ap.length;
bl = bp.length;
// Start walking down the tree looking for a discrepancy
for(var i = 0;i < al && i < bl;i++){
if(ap[i] !== bp[i]){
return siblingCheck(ap[i], bp[i]);
};
};
// We ended someplace up the tree so do a sibling check
return i === al ? siblingCheck(a, bp[i], -1) : siblingCheck(ap[i], b, 1);
};
// Always assume the presence of duplicates if sort doesn't
// pass them to our comparison function (as in Google Chrome).
[0, 0].sort(sortOrder);
baseHasDuplicate = !hasDuplicate;
// Document sorting and removing duplicates
Sizzle.uniqueSort = function(results){
var elem,i = 1;
hasDuplicate = baseHasDuplicate;
results.sort(sortOrder);
if(hasDuplicate){
for(;(elem = results[i]);i++){
if(elem === results[i - 1]){
results.splice(i--, 1);
};
};
};
return results;
};
Sizzle.error = function(msg){
throw new Error("Syntax error, unrecognized expression: " + msg);
};
function tokenize(selector, parseOnly){
var matched,match,tokens,type,soFar,groups,preFilters,cached = tokenCache[expando][selector];
if(cached){
return parseOnly ? 0 : cached.slice(0);
};
soFar = selector;
groups = [];
preFilters = Expr.preFilter;
while(soFar){
// Comma and first run
if(!matched || (match = rcomma.exec(soFar))){
if(match){
soFar = soFar.slice(match[0].length);
};
groups.push(tokens = []);
};
matched = false;
// Combinators
if((match = rcombinators.exec(soFar))){
tokens.push(matched = new Token(match.shift()));
soFar = soFar.slice(matched.length);
// Cast descendant combinators to space
matched.type = match[0].replace(rtrim, " ");
};
// Filters
for(type in Expr.filter){
if((match = matchExpr[type].exec(soFar)) && (!preFilters[type] || // The last two arguments here are (context, xml) for backCompat
(match = preFilters[type](match, document, true)))){
tokens.push(matched = new Token(match.shift()));
soFar = soFar.slice(matched.length);
matched.type = type;
matched.matches = match;
};
};
if(!matched){
break;
};
};
// Return the length of the invalid excess
// if we're just parsing
// Otherwise, throw an error or return tokens
return parseOnly ? soFar.length : soFar ? Sizzle.error(selector) : // Cache the tokens
tokenCache(selector, groups).slice(0);
};
function addCombinator(matcher, combinator, base){
var dir = combinator.dir,checkNonElements = base && combinator.dir === "parentNode",doneName = done++;
return combinator.first ? // Check against closest ancestor/preceding element
function(elem, context, xml){
while((elem = elem[dir])){
if(checkNonElements || elem.nodeType === 1){
return matcher(elem, context, xml);
};
};
} : // Check against all ancestor/preceding elements
function(elem, context, xml){
// We can't set arbitrary data on XML nodes, so they don't benefit from dir caching
if(!xml){
var cache,dirkey = dirruns + " " + doneName + " ",cachedkey = dirkey + cachedruns;
while((elem = elem[dir])){
if(checkNonElements || elem.nodeType === 1){
if((cache = elem[expando]) === cachedkey){
return elem.sizset;
} else if(typeof cache === "string" && cache.indexOf(dirkey) === 0){
if(elem.sizset){
return elem;
};
} else {
elem[expando] = cachedkey;
if(matcher(elem, context, xml)){
elem.sizset = true;
return elem;
};
elem.sizset = false;
};
};
};
} else {
while((elem = elem[dir])){
if(checkNonElements || elem.nodeType === 1){
if(matcher(elem, context, xml)){
return elem;
};
};
};
};
};
};
function elementMatcher(matchers){
return matchers.length > 1 ? function(elem, context, xml){
var i = matchers.length;
while(i--){
if(!matchers[i](elem, context, xml)){
return false;
};
};
return true;
} : matchers[0];
};
function condense(unmatched, map, filter, context, xml){
var elem,newUnmatched = [],i = 0,len = unmatched.length,mapped = map != null;
for(;i < len;i++){
if((elem = unmatched[i])){
if(!filter || filter(elem, context, xml)){
newUnmatched.push(elem);
if(mapped){
map.push(i);
};
};
};
};
return newUnmatched;
};
function setMatcher(preFilter, selector, matcher, postFilter, postFinder, postSelector){
if(postFilter && !postFilter[expando]){
postFilter = setMatcher(postFilter);
};
if(postFinder && !postFinder[expando]){
postFinder = setMatcher(postFinder, postSelector);
};
return markFunction(function(seed, results, context, xml){
// Positional selectors apply to seed elements, so it is invalid to follow them with relative ones
if(seed && postFinder){
return;
};
var i,elem,postFilterIn,preMap = [],postMap = [],preexisting = results.length,// Get initial elements from seed or context
elems = seed || multipleContexts(selector || "*", context.nodeType ? [context] : context, [], seed),// Prefilter to get matcher input, preserving a map for seed-results synchronization
matcherIn = preFilter && (seed || !selector) ? condense(elems, preMap, preFilter, context, xml) : elems,matcherOut = matcher ? // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
postFinder || (seed ? preFilter : preexisting || postFilter) ? // ...intermediate processing is necessary
[] : // ...otherwise use results directly
results : matcherIn;
// Find primary matches
if(matcher){
matcher(matcherIn, matcherOut, context, xml);
};
// Apply postFilter
if(postFilter){
postFilterIn = condense(matcherOut, postMap);
postFilter(postFilterIn, [], context, xml);
// Un-match failing elements by moving them back to matcherIn
i = postFilterIn.length;
while(i--){
if((elem = postFilterIn[i])){
matcherOut[postMap[i]] = !(matcherIn[postMap[i]] = elem);
};
};
};
// Keep seed and results synchronized
if(seed){
// Ignore postFinder because it can't coexist with seed
i = preFilter && matcherOut.length;
while(i--){
if((elem = matcherOut[i])){
seed[preMap[i]] = !(results[preMap[i]] = elem);
};
};
} else {
matcherOut = condense(matcherOut === results ? matcherOut.splice(preexisting, matcherOut.length) : matcherOut);
if(postFinder){
postFinder(null, results, matcherOut, xml);
} else {
push.apply(results, matcherOut);
};
};
});
};
function matcherFromTokens(tokens){
var checkContext,matcher,j,len = tokens.length,leadingRelative = Expr.relative[tokens[0].type],implicitRelative = leadingRelative || Expr.relative[" "],i = leadingRelative ? 1 : 0,// The foundational matcher ensures that elements are reachable from top-level context(s)
matchContext = addCombinator(function(elem){
return elem === checkContext;
}, implicitRelative, true),matchAnyContext = addCombinator(function(elem){
return indexOf.call(checkContext, elem) > -1;
}, implicitRelative, true),matchers = [function(elem, context, xml){
return (!leadingRelative && (xml || context !== outermostContext)) || ((checkContext = context).nodeType ? matchContext(elem, context, xml) : matchAnyContext(elem, context, xml));
}];
for(;i < len;i++){
if((matcher = Expr.relative[tokens[i].type])){
matchers = [addCombinator(elementMatcher(matchers), matcher)];
} else {
// The concatenated values are (context, xml) for backCompat
matcher = Expr.filter[tokens[i].type].apply(null, tokens[i].matches);
// Return special upon seeing a positional matcher
if(matcher[expando]){
// Find the next relative operator (if any) for proper handling
j = ++i;
for(;j < len;j++){
if(Expr.relative[tokens[j].type]){
break;
};
};
return setMatcher(i > 1 && elementMatcher(matchers), i > 1 && tokens.slice(0, i - 1).join("").replace(rtrim, "$1"), matcher, i < j && matcherFromTokens(tokens.slice(i, j)), j < len && matcherFromTokens((tokens = tokens.slice(j))), j < len && tokens.join(""));
};
matchers.push(matcher);
};
};
return elementMatcher(matchers);
};
function matcherFromGroupMatchers(elementMatchers, setMatchers){
var bySet = setMatchers.length > 0,byElement = elementMatchers.length > 0,superMatcher = function(seed, context, xml, results, expandContext){
var elem,j,matcher,setMatched = [],matchedCount = 0,i = "0",unmatched = seed && [],outermost = expandContext != null,contextBackup = outermostContext,// We must always have either seed elements or context
elems = seed || byElement && Expr.find["TAG"]("*", expandContext && context.parentNode || context),// Nested matchers should use non-integer dirruns
dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.E);
if(outermost){
outermostContext = context !== document && context;
cachedruns = superMatcher.el;
};
// Add elements passing elementMatchers directly to results
for(;(elem = elems[i]) != null;i++){
if(byElement && elem){
for(j = 0;(matcher = elementMatchers[j]);j++){
if(matcher(elem, context, xml)){
results.push(elem);
break;
};
};
if(outermost){
dirruns = dirrunsUnique;
cachedruns = ++superMatcher.el;
};
};
// Track unmatched elements for set filters
if(bySet){
// They will have gone through all possible matchers
if((elem = !matcher && elem)){
matchedCount--;
};
// Lengthen the array for every element, matched or not
if(seed){
unmatched.push(elem);
};
};
};
// Apply set filters to unmatched elements
matchedCount += i;
if(bySet && i !== matchedCount){
for(j = 0;(matcher = setMatchers[j]);j++){
matcher(unmatched, setMatched, context, xml);
};
if(seed){
// Reintegrate element matches to eliminate the need for sorting
if(matchedCount > 0){
while(i--){
if(!(unmatched[i] || setMatched[i])){
setMatched[i] = pop.call(results);
};
};
};
// Discard index placeholder values to get only actual matches
setMatched = condense(setMatched);
};
// Add matches to results
push.apply(results, setMatched);
// Seedless set matches succeeding multiple successful matchers stipulate sorting
if(outermost && !seed && setMatched.length > 0 && (matchedCount + setMatchers.length) > 1){
Sizzle.uniqueSort(results);
};
};
// Override manipulation of globals by nested matchers
if(outermost){
dirruns = dirrunsUnique;
outermostContext = contextBackup;
};
return unmatched;
};
superMatcher.el = 0;
return bySet ? markFunction(superMatcher) : superMatcher;
};
compile = Sizzle.compile = function(selector, group){
var i,setMatchers = [],elementMatchers = [],cached = compilerCache[expando][selector];
if(!cached){
// Generate a function of recursive functions that can be used to check each element
if(!group){
group = tokenize(selector);
};
i = group.length;
while(i--){
cached = matcherFromTokens(group[i]);
if(cached[expando]){
setMatchers.push(cached);
} else {
elementMatchers.push(cached);
};
};
// Cache the compiled function
cached = compilerCache(selector, matcherFromGroupMatchers(elementMatchers, setMatchers));
};
return cached;
};
function multipleContexts(selector, contexts, results, seed){
var i = 0,len = contexts.length;
for(;i < len;i++){
Sizzle(selector, contexts[i], results, seed);
};
return results;
};
function select(selector, context, results, seed, xml){
var i,tokens,token,type,find,match = tokenize(selector),j = match.length;
if(!seed){
// Try to minimize operations if there is only one group
if(match.length === 1){
// Take a shortcut and set the context if the root selector is an ID
tokens = match[0] = match[0].slice(0);
if(tokens.length > 2 && (token = tokens[0]).type === "ID" && context.nodeType === 9 && !xml && Expr.relative[tokens[1].type]){
context = Expr.find["ID"](token.matches[0].replace(rbackslash, ""), context, xml)[0];
if(!context){
return results;
};
selector = selector.slice(tokens.shift().length);
};
// Fetch a seed set for right-to-left matching
for(i = matchExpr["POS"].test(selector) ? -1 : tokens.length - 1;i >= 0;i--){
token = tokens[i];
// Abort if we hit a combinator
if(Expr.relative[(type = token.type)]){
break;
};
if((find = Expr.find[type])){
// Search, expanding context for leading sibling combinators
if((seed = find(token.matches[0].replace(rbackslash, ""), rsibling.test(tokens[0].type) && context.parentNode || context, xml))){
// If seed is empty or no tokens remain, we can return early
tokens.splice(i, 1);
selector = seed.length && tokens.join("");
if(!selector){
push.apply(results, slice.call(seed, 0));
return results;
};
break;
};
};
};
};
};
// Compile and execute a filtering function
// Provide `match` to avoid retokenization if we modified the selector above
compile(selector, match)(seed, context, xml, results, rsibling.test(selector));
return results;
};
if(document.querySelectorAll){
(function(){
var disconnectedMatch,oldSelect = select,rescape = /'|\\/g,rattributeQuotes = /\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,// qSa(:focus) reports false when true (Chrome 21),
// A support test would require too much code (would include document ready)
rbuggyQSA = [":focus"],// matchesSelector(:focus) reports false when true (Chrome 21),
// matchesSelector(:active) reports false when true (IE9/Opera 11.5)
// A support test would require too much code (would include document ready)
// just skip matchesSelector for :active
rbuggyMatches = [":active", ":focus"],matches = docElem.matchesSelector || docElem.mozMatchesSelector || docElem.webkitMatchesSelector || docElem.oMatchesSelector || docElem.msMatchesSelector;
// Build QSA regex
// Regex strategy adopted from Diego Perini
assert(function(div){
// Select is set to empty string on purpose
// This is to test IE's treatment of not explictly
// setting a boolean content attribute,
// since its presence should be enough
// http://bugs.jquery.com/ticket/12359
div.innerHTML = "<select><option selected=''></option></select>";
// IE8 - Some boolean attributes are not treated correctly
if(!div.querySelectorAll("[selected]").length){
rbuggyQSA.push("\\[" + whitespace + "*(?:checked|disabled|ismap|multiple|readonly|selected|value)");
};
// Webkit/Opera - :checked should return selected option elements
// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
// IE8 throws error here (do not put tests after this one)
if(!div.querySelectorAll(":checked").length){
rbuggyQSA.push(":checked");
};
});
assert(function(div){
// Opera 10-12/IE9 - ^= $= *= and empty values
// Should not select anything
div.innerHTML = "<p test=''></p>";
if(div.querySelectorAll("[test^='']").length){
rbuggyQSA.push("[*^$]=" + whitespace + "*(?:\"\"|'')");
};
// FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
// IE8 throws error here (do not put tests after this one)
div.innerHTML = "<input type='hidden'/>";
if(!div.querySelectorAll(":enabled").length){
rbuggyQSA.push(":enabled", ":disabled");
};
});
// rbuggyQSA always contains :focus, so no need for a length check
rbuggyQSA = /* rbuggyQSA.length && */ new RegExp(rbuggyQSA.join("|"));
select = function(selector, context, results, seed, xml){
// Only use querySelectorAll when not filtering,
// when this is not xml,
// and when no QSA bugs apply
if(!seed && !xml && (!rbuggyQSA || !rbuggyQSA.test(selector))){
var groups,i,old = true,nid = expando,newContext = context,newSelector = context.nodeType === 9 && selector;
// qSA works strangely on Element-rooted queries
// We can work around this by specifying an extra ID on the root
// and working up from there (Thanks to Andrew Dupont for the technique)
// IE 8 doesn't work on object elements
if(context.nodeType === 1 && context.nodeName.toLowerCase() !== "object"){
groups = tokenize(selector);
if((old = context.getAttribute("id"))){
nid = old.replace(rescape, "\\$&");
} else {
context.setAttribute("id", nid);
};
nid = "[id='" + nid + "'] ";
i = groups.length;
while(i--){
groups[i] = nid + groups[i].join("");
};
newContext = rsibling.test(selector) && context.parentNode || context;
newSelector = groups.join(",");
};
if(newSelector){
try{
push.apply(results, slice.call(newContext.querySelectorAll(newSelector), 0));
return results;
} catch(qsaError) {
}finally{
if(!old){
context.removeAttribute("id");
};
};
};
};
return oldSelect(selector, context, results, seed, xml);
};
if(matches){
assert(function(div){
// Check to see if it's possible to do matchesSelector
// on a disconnected node (IE 9)
disconnectedMatch = matches.call(div, "div");
// This should fail with an exception
// Gecko does not error, returns false instead
try{
matches.call(div, "[test!='']:sizzle");
rbuggyMatches.push("!=", pseudos);
} catch(e) {
};
});
// rbuggyMatches always contains :active and :focus, so no need for a length check
rbuggyMatches = /* rbuggyMatches.length && */ new RegExp(rbuggyMatches.join("|"));
Sizzle.matchesSelector = function(elem, expr){
// Make sure that attribute selectors are quoted
expr = expr.replace(rattributeQuotes, "='$1']");
// rbuggyMatches always contains :active, so no need for an existence check
if(!isXML(elem) && !rbuggyMatches.test(expr) && (!rbuggyQSA || !rbuggyQSA.test(expr))){
try{
var ret = matches.call(elem, expr);
// IE 9's matchesSelector returns false on disconnected nodes
if(ret || disconnectedMatch || // As well, disconnected nodes are said to be in a document
// fragment in IE 9
elem.document && elem.document.nodeType !== 11){
return ret;
};
} catch(e) {
};
};
return Sizzle(expr, null, null, [elem]).length > 0;
};
};
})();
};
// Deprecated
Expr.pseudos["nth"] = Expr.pseudos["eq"];
// Back-compat
function setFilters(){
};
Expr.filters = setFilters.prototype = Expr.pseudos;
Expr.setFilters = new setFilters();
// EXPOSE qooxdoo variant
qx.bom.Selector.query = function(selector, context){
return Sizzle(selector, context);
};
qx.bom.Selector.matches = function(selector, set){
return Sizzle(selector, null, null, set);
};
})(window);
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2007-2008 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Fabian Jakobs (fjakobs)
************************************************************************ */
/**
* Utility class with type check for all native JavaScript data types.
*/
qx.Bootstrap.define("qx.lang.Type", {
statics : {
/**
* Get the internal class of the value. See
* http://perfectionkills.com/instanceof-considered-harmful-or-how-to-write-a-robust-isarray/
* for details.
*
* @signature function(value)
* @param value {var} value to get the class for
* @return {String} the internal class of the value
*/
getClass : qx.Bootstrap.getClass,
/**
* Whether the value is a string.
*
* @signature function(value)
* @param value {var} Value to check.
* @return {Boolean} Whether the value is a string.
*/
isString : qx.Bootstrap.isString,
/**
* Whether the value is an array.
*
* @signature function(value)
* @param value {var} Value to check.
* @return {Boolean} Whether the value is an array.
*/
isArray : qx.Bootstrap.isArray,
/**
* Whether the value is an object. Note that built-in types like Window are
* not reported to be objects.
*
* @signature function(value)
* @param value {var} Value to check.
* @return {Boolean} Whether the value is an object.
*/
isObject : qx.Bootstrap.isObject,
/**
* Whether the value is a function.
*
* @signature function(value)
* @param value {var} Value to check.
* @return {Boolean} Whether the value is a function.
*/
isFunction : qx.Bootstrap.isFunction,
/**
* Whether the value is a regular expression.
*
* @param value {var} Value to check.
* @return {Boolean} Whether the value is a regular expression.
*/
isRegExp : function(value){
return this.getClass(value) == "RegExp";
},
/**
* Whether the value is a number.
*
* @param value {var} Value to check.
* @return {Boolean} Whether the value is a number.
*/
isNumber : function(value){
// Added "value !== null" because IE throws an exception "Object expected"
// by executing "value instanceof Number" if value is a DOM element that
// doesn't exist. It seems that there is an internal different between a
// JavaScript null and a null returned from calling DOM.
// e.q. by document.getElementById("ReturnedNull").
return (value !== null && (this.getClass(value) == "Number" || value instanceof Number));
},
/**
* Whether the value is a boolean.
*
* @param value {var} Value to check.
* @return {Boolean} Whether the value is a boolean.
*/
isBoolean : function(value){
// Added "value !== null" because IE throws an exception "Object expected"
// by executing "value instanceof Boolean" if value is a DOM element that
// doesn't exist. It seems that there is an internal different between a
// JavaScript null and a null returned from calling DOM.
// e.q. by document.getElementById("ReturnedNull").
return (value !== null && (this.getClass(value) == "Boolean" || value instanceof Boolean));
},
/**
* Whether the value is a date.
*
* @param value {var} Value to check.
* @return {Boolean} Whether the value is a date.
*/
isDate : function(value){
// Added "value !== null" because IE throws an exception "Object expected"
// by executing "value instanceof Date" if value is a DOM element that
// doesn't exist. It seems that there is an internal different between a
// JavaScript null and a null returned from calling DOM.
// e.q. by document.getElementById("ReturnedNull").
return (value !== null && (this.getClass(value) == "Date" || value instanceof Date));
},
/**
* Whether the value is a Error.
*
* @param value {var} Value to check.
* @return {Boolean} Whether the value is a Error.
*/
isError : function(value){
// Added "value !== null" because IE throws an exception "Object expected"
// by executing "value instanceof Error" if value is a DOM element that
// doesn't exist. It seems that there is an internal different between a
// JavaScript null and a null returned from calling DOM.
// e.q. by document.getElementById("ReturnedNull").
return (value !== null && (this.getClass(value) == "Error" || value instanceof Error));
}
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2012 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Martin Wittemann (wittemann)
************************************************************************ */
/**
* This module offers a cross browser storage implementation. The API is aligned
* with the API of the HTML web storage (http://www.w3.org/TR/webstorage/) which is
* also the preferred implementation used. As fallback for IE < 8, we use user data.
* If both techniques are unsupported, we supply a in memory storage, which is
* of course, not persistent.
*/
qx.Bootstrap.define("qx.module.Storage", {
statics : {
/**
* Store an item in the storage.
*
* @attachStatic {qxWeb, localStorage.setItem}
* @param key {String} The identifier key.
* @param value {var} The data, which will be stored as JSON.
*/
setLocalItem : function(key, value){
qx.bom.Storage.getLocal().setItem(key, value);
},
/**
* Returns the stored item.
*
* @attachStatic {qxWeb, localStorage.getItem}
* @param key {String} The identifier to get the data.
* @return {var} The stored data.
*/
getLocalItem : function(key){
return qx.bom.Storage.getLocal().getItem(key);
},
/**
* Removes an item form the storage.
* @attachStatic {qxWeb, localStorage.removeItem}
* @param key {String} The identifier.
*/
removeLocalItem : function(key){
qx.bom.Storage.getLocal().removeItem(key);
},
/**
* Returns the amount of key-value pairs stored.
* @attachStatic {qxWeb, localStorage.getLength}
* @return {Number} The length of the storage.
*/
getLocalLength : function(){
return qx.bom.Storage.getLocal().getLength();
},
/**
* Returns the named key at the given index.
* @attachStatic {qxWeb, localStorage.getKey}
* @param index {Number} The index in the storage.
* @return {String} The key stored at the given index.
*/
getLocalKey : function(index){
return qx.bom.Storage.getLocal().getKey(index);
},
/**
* Deletes every stored item in the storage.
* @attachStatic {qxWeb, localStorage.clear}
*/
clearLocal : function(){
qx.bom.Storage.getLocal().clear();
},
/**
* Helper to access every stored item.
*
* @attachStatic {qxWeb, localStorage.forEach}
* @param callback {Function} A function which will be called for every item.
* The function will have two arguments, first the key and second the value
* of the stored data.
* @param scope {var} The scope of the function.
*/
forEachLocal : function(callback, scope){
qx.bom.Storage.getLocal().forEach(callback, scope);
},
/**
* Store an item in the storage.
*
* @attachStatic {qxWeb, sessionStorage.setItem}
* @param key {String} The identifier key.
* @param value {var} The data, which will be stored as JSON.
*/
setSessionItem : function(key, value){
qx.bom.Storage.getSession().setItem(key, value);
},
/**
* Returns the stored item.
*
* @attachStatic {qxWeb, sessionStorage.getItem}
* @param key {String} The identifier to get the data.
* @return {var} The stored data.
*/
getSessionItem : function(key){
return qx.bom.Storage.getSession().getItem(key);
},
/**
* Removes an item form the storage.
* @attachStatic {qxWeb, sessionStorage.removeItem}
* @param key {String} The identifier.
*/
removeSessionItem : function(key){
qx.bom.Storage.getSession().removeItem(key);
},
/**
* Returns the amount of key-value pairs stored.
* @attachStatic {qxWeb, sessionStorage.getLength}
* @return {Number} The length of the storage.
*/
getSessionLength : function(){
return qx.bom.Storage.getSession().getLength();
},
/**
* Returns the named key at the given index.
* @attachStatic {qxWeb, sessionStorage.getKey}
* @param index {Number} The index in the storage.
* @return {String} The key stored at the given index.
*/
getSessionKey : function(index){
return qx.bom.Storage.getSession().getKey(index);
},
/**
* Deletes every stored item in the storage.
* @attachStatic {qxWeb, sessionStorage.clear}
*/
clearSession : function(){
qx.bom.Storage.getSession().clear();
},
/**
* Helper to access every stored item.
*
* @attachStatic {qxWeb, sessionStorage.forEach}
* @param callback {Function} A function which will be called for every item.
* The function will have two arguments, first the key and second the value
* of the stored data.
* @param scope {var} The scope of the function.
*/
forEachSession : function(callback, scope){
qx.bom.Storage.getSession().forEach(callback, scope);
}
},
defer : function(statics){
qxWeb.$attachStatic({
"localStorage" : {
setItem : statics.setLocalItem,
getItem : statics.getLocalItem,
removeItem : statics.removeLocalItem,
getLength : statics.getLocalLength,
getKey : statics.getLocalKey,
clear : statics.clearLocal,
forEach : statics.forEachLocal
},
"sessionStorage" : {
setItem : statics.setSessionItem,
getItem : statics.getSessionItem,
removeItem : statics.removeSessionItem,
getLength : statics.getSessionLength,
getKey : statics.getSessionKey,
clear : statics.clearSession,
forEach : statics.forEachSession
}
});
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2004-2011 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Martin Wittemann (wittemann)
************************************************************************ */
/**
* This is a cross browser storage implementation. The API is aligned with the
* API of the HTML web storage (http://www.w3.org/TR/webstorage/) which is also
* the preferred implementation used. As fallback for IE < 8, we use user data.
* If both techniques are unsupported, we supply a in memory storage, which is
* of course, not persistent.
*/
qx.Bootstrap.define("qx.bom.Storage", {
statics : {
__impl : null,
/**
* Get an instance of a local storage.
* @return {qx.bom.storage.Web|qx.bom.storage.UserData|qx.bom.storage.Memory}
* An instance of a storage implementation.
*/
getLocal : function(){
// always use HTML5 web storage if available
if(qx.core.Environment.get("html.storage.local")){
return qx.bom.storage.Web.getLocal();
} else if(qx.core.Environment.get("html.storage.userdata")){
// IE <8 fallback
// as fallback,use the userdata storage for IE5.5 - 8
return qx.bom.storage.UserData.getLocal();
};
// as last fallback, use a in memory storage (this one is not persistent)
return qx.bom.storage.Memory.getLocal();
},
/**
* Get an instance of a session storage.
* @return {qx.bom.storage.Web|qx.bom.storage.UserData|qx.bom.storage.Memory}
* An instance of a storage implementation.
*/
getSession : function(){
// always use HTML5 web storage if available
if(qx.core.Environment.get("html.storage.local")){
return qx.bom.storage.Web.getSession();
} else if(qx.core.Environment.get("html.storage.userdata")){
// IE <8 fallback
// as fallback,use the userdata storage for IE5.5 - 8
return qx.bom.storage.UserData.getSession();
};
// as last fallback, use a in memory storage (this one is not persistent)
return qx.bom.storage.Memory.getSession();
}
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2004-2011 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Martin Wittemann (martinwittemann)
************************************************************************ */
/**
* Internal class which contains the checks used by {@link qx.core.Environment}.
* All checks in here are marked as internal which means you should never use
* them directly.
*
* This class should contain all checks about HTML.
*
* @internal
*/
qx.Bootstrap.define("qx.bom.client.Html", {
statics : {
/**
* Whether the client supports Web Workers.
*
* @internal
* @return {Boolean} <code>true</code> if webworkers are supported
*/
getWebWorker : function(){
return window.Worker != null;
},
/**
* Whether the client supports File Readers
*
* @internal
* @return {Boolean} <code>true</code> if FileReaders are supported
*/
getFileReader : function(){
return window.FileReader != null;
},
/**
* Whether the client supports Geo Location.
*
* @internal
* @return {Boolean} <code>true</code> if geolocation supported
*/
getGeoLocation : function(){
return navigator.geolocation != null;
},
/**
* Whether the client supports audio.
*
* @internal
* @return {Boolean} <code>true</code> if audio is supported
*/
getAudio : function(){
return !!document.createElement('audio').canPlayType;
},
/**
* Whether the client can play ogg audio format.
*
* @internal
* @return {String} "" or "maybe" or "probably"
*/
getAudioOgg : function(){
if(!qx.bom.client.Html.getAudio()){
return "";
};
var a = document.createElement("audio");
return a.canPlayType("audio/ogg");
},
/**
* Whether the client can play mp3 audio format.
*
* @internal
* @return {String} "" or "maybe" or "probably"
*/
getAudioMp3 : function(){
if(!qx.bom.client.Html.getAudio()){
return "";
};
var a = document.createElement("audio");
return a.canPlayType("audio/mpeg");
},
/**
* Whether the client can play wave audio wave format.
*
* @internal
* @return {String} "" or "maybe" or "probably"
*/
getAudioWav : function(){
if(!qx.bom.client.Html.getAudio()){
return "";
};
var a = document.createElement("audio");
return a.canPlayType("audio/x-wav");
},
/**
* Whether the client can play au audio format.
*
* @internal
* @return {String} "" or "maybe" or "probably"
*/
getAudioAu : function(){
if(!qx.bom.client.Html.getAudio()){
return "";
};
var a = document.createElement("audio");
return a.canPlayType("audio/basic");
},
/**
* Whether the client can play aif audio format.
*
* @internal
* @return {String} "" or "maybe" or "probably"
*/
getAudioAif : function(){
if(!qx.bom.client.Html.getAudio()){
return "";
};
var a = document.createElement("audio");
return a.canPlayType("audio/x-aiff");
},
/**
* Whether the client supports video.
*
* @internal
* @return {Boolean} <code>true</code> if video is supported
*/
getVideo : function(){
return !!document.createElement('video').canPlayType;
},
/**
* Whether the client supports ogg video.
*
* @internal
* @return {String} "" or "maybe" or "probably"
*/
getVideoOgg : function(){
if(!qx.bom.client.Html.getVideo()){
return "";
};
var v = document.createElement("video");
return v.canPlayType('video/ogg; codecs="theora, vorbis"');
},
/**
* Whether the client supports mp4 video.
*
* @internal
* @return {String} "" or "maybe" or "probably"
*/
getVideoH264 : function(){
if(!qx.bom.client.Html.getVideo()){
return "";
};
var v = document.createElement("video");
return v.canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"');
},
/**
* Whether the client supports webm video.
*
* @internal
* @return {String} "" or "maybe" or "probably"
*/
getVideoWebm : function(){
if(!qx.bom.client.Html.getVideo()){
return "";
};
var v = document.createElement("video");
return v.canPlayType('video/webm; codecs="vp8, vorbis"');
},
/**
* Whether the client supports local storage.
*
* @internal
* @return {Boolean} <code>true</code> if local storage is supported
*/
getLocalStorage : function(){
try{
return window.localStorage != null;
} catch(exc) {
// Firefox Bug: Local execution of window.sessionStorage throws error
// see https://bugzilla.mozilla.org/show_bug.cgi?id=357323
return false;
};
},
/**
* Whether the client supports session storage.
*
* @internal
* @return {Boolean} <code>true</code> if session storage is supported
*/
getSessionStorage : function(){
try{
return window.sessionStorage != null;
} catch(exc) {
// Firefox Bug: Local execution of window.sessionStorage throws error
// see https://bugzilla.mozilla.org/show_bug.cgi?id=357323
return false;
};
},
/**
* Whether the client supports user data to persist data. This is only
* relevant for IE < 8.
*
* @internal
* @return {Boolean} <code>true</code> if the user data is supported.
*/
getUserDataStorage : function(){
var el = document.createElement("div");
el.style["display"] = "none";
document.getElementsByTagName("head")[0].appendChild(el);
var supported = false;
try{
el.addBehavior("#default#userdata");
el.load("qxtest");
supported = true;
} catch(e) {
};
document.getElementsByTagName("head")[0].removeChild(el);
return supported;
},
/**
* Whether the browser supports CSS class lists.
* https://developer.mozilla.org/en/DOM/element.classList
*
* @internal
* @return {Boolean} <code>true</code> if class list is supported.
*/
getClassList : function(){
return !!(document.documentElement.classList && qx.Bootstrap.getClass(document.documentElement.classList) === "DOMTokenList");
},
/**
* Checks if XPath could be used.
*
* @internal
* @return {Boolean} <code>true</code> if xpath is supported.
*/
getXPath : function(){
return !!document.evaluate;
},
/**
* Checks if XUL could be used.
*
* @internal
* @return {Boolean} <code>true</code> if XUL is supported.
*/
getXul : function(){
try{
document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", "label");
return true;
} catch(e) {
return false;
};
},
/**
* Checks if SVG could be used
*
* @internal
* @return {Boolean} <code>true</code> if SVG is supported.
*/
getSvg : function(){
return document.implementation && document.implementation.hasFeature && (document.implementation.hasFeature("org.w3c.dom.svg", "1.0") || document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1"));
},
/**
* Checks if VML is supported
*
* @internal
* @return {Boolean} <code>true</code> if VML is supported.
*/
getVml : function(){
var el = document.createElement("div");
document.body.appendChild(el);
el.innerHTML = '<v:shape id="vml_flag1" adj="1" />';
el.firstChild.style.behavior = "url(#default#VML)";
var hasVml = typeof el.firstChild.adj == "object";
document.body.removeChild(el);
return hasVml;
},
/**
* Checks if canvas could be used
*
* @internal
* @return {Boolean} <code>true</code> if canvas is supported.
*/
getCanvas : function(){
return !!window.CanvasRenderingContext2D;
},
/**
* Asynchronous check for using data urls.
*
* @internal
* @param callback {Function} The function which should be executed as
* soon as the check is done.
*/
getDataUrl : function(callback){
var data = new Image();
data.onload = data.onerror = function(){
// wrap that into a timeout because IE might execute it synchronously
window.setTimeout(function(){
callback.call(null, (data.width == 1 && data.height == 1));
}, 0);
};
data.src = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==";
},
/**
* Checks if dataset could be used
*
* @internal
* @return {Boolean} <code>true</code> if dataset is supported.
*/
getDataset : function(){
return !!document.documentElement.dataset;
},
/**
* Check for element.contains
*
* @internal
* @return {Boolean} <code>true</code> if element.contains is supported
*/
getContains : function(){
// "object" in IE6/7/8, "function" in IE9
return (typeof document.documentElement.contains !== "undefined");
},
/**
* Check for element.compareDocumentPosition
*
* @internal
* @return {Boolean} <code>true</code> if element.compareDocumentPosition is supported
*/
getCompareDocumentPosition : function(){
return (typeof document.documentElement.compareDocumentPosition === "function");
},
/**
* Check for element.textContent. Legacy IEs do not support this, use
* innerText instead.
*
* @internal
* @return {Boolean} <code>true</code> if textContent is supported
*/
getTextContent : function(){
var el = document.createElement("span");
return (typeof el.textContent !== "undefined");
},
/**
* Check for a console object.
*
* @internal
* @return {Boolean} <code>true</code> if a console is available.
*/
getConsole : function(){
return typeof window.console !== "undefined";
},
/**
* Check for the <code>naturalHeight</code> and <code>naturalWidth</code>
* image element attributes.
*
* @internal
* @return {Boolean} <code>true</code> if both attributes are supported
*/
getNaturalDimensions : function(){
var img = document.createElement("img");
return typeof img.naturalHeight === "number" && typeof img.naturalWidth === "number";
},
/**
* Check for HTML5 history manipulation support.
* @internal
* @return {Boolean} <code>true</code> if the HTML5 history API is supported
*/
getHistoryState : function(){
return (typeof window.onpopstate !== "undefined" && typeof window.history.replaceState !== "undefined" && typeof window.history.pushState !== "undefined");
}
},
defer : function(statics){
qx.core.Environment.add("html.webworker", statics.getWebWorker);
qx.core.Environment.add("html.filereader", statics.getFileReader);
qx.core.Environment.add("html.geolocation", statics.getGeoLocation);
qx.core.Environment.add("html.audio", statics.getAudio);
qx.core.Environment.add("html.audio.ogg", statics.getAudioOgg);
qx.core.Environment.add("html.audio.mp3", statics.getAudioMp3);
qx.core.Environment.add("html.audio.wav", statics.getAudioWav);
qx.core.Environment.add("html.audio.au", statics.getAudioAu);
qx.core.Environment.add("html.audio.aif", statics.getAudioAif);
qx.core.Environment.add("html.video", statics.getVideo);
qx.core.Environment.add("html.video.ogg", statics.getVideoOgg);
qx.core.Environment.add("html.video.h264", statics.getVideoH264);
qx.core.Environment.add("html.video.webm", statics.getVideoWebm);
qx.core.Environment.add("html.storage.local", statics.getLocalStorage);
qx.core.Environment.add("html.storage.session", statics.getSessionStorage);
qx.core.Environment.add("html.storage.userdata", statics.getUserDataStorage);
qx.core.Environment.add("html.classlist", statics.getClassList);
qx.core.Environment.add("html.xpath", statics.getXPath);
qx.core.Environment.add("html.xul", statics.getXul);
qx.core.Environment.add("html.canvas", statics.getCanvas);
qx.core.Environment.add("html.svg", statics.getSvg);
qx.core.Environment.add("html.vml", statics.getVml);
qx.core.Environment.add("html.dataset", statics.getDataset);
qx.core.Environment.addAsync("html.dataurl", statics.getDataUrl);
qx.core.Environment.add("html.element.contains", statics.getContains);
qx.core.Environment.add("html.element.compareDocumentPosition", statics.getCompareDocumentPosition);
qx.core.Environment.add("html.element.textcontent", statics.getTextContent);
qx.core.Environment.add("html.console", statics.getConsole);
qx.core.Environment.add("html.image.naturaldimensions", statics.getNaturalDimensions);
qx.core.Environment.add("html.history.state", statics.getHistoryState);
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2004-2011 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Martin Wittemann (wittemann)
************************************************************************ */
/* ************************************************************************
#require(qx.bom.storage.Web#getLength)
#require(qx.bom.storage.Web#setItem)
#require(qx.bom.storage.Web#getItem)
#require(qx.bom.storage.Web#removeItem)
#require(qx.bom.storage.Web#clear)
#require(qx.bom.storage.Web#getKey)
#require(qx.bom.storage.Web#forEach)
************************************************************************ */
/**
* Storage implementation using HTML web storage:
* http://www.w3.org/TR/webstorage/
*/
qx.Bootstrap.define("qx.bom.storage.Web", {
statics : {
__local : null,
__session : null,
/**
* Static accessor for the local storage.
* @return {qx.bom.storage.Web} An instance of a local storage.
*/
getLocal : function(){
if(this.__local){
return this.__local;
};
return this.__local = new qx.bom.storage.Web("local");
},
/**
* Static accessor for the session storage.
* @return {qx.bom.storage.Web} An instance of a session storage.
*/
getSession : function(){
if(this.__session){
return this.__session;
};
return this.__session = new qx.bom.storage.Web("session");
}
},
/**
* Create a new instance. Usually, you should take the static
* accessors to get your instance.
*
* @param type {String} type of storage, either
* <code>local</code> or <code>session</code>.
*/
construct : function(type){
this.__type = type;
},
members : {
__type : null,
/**
* Returns the internal used storage (the native object).
*
* @internal
* @return {Storage} The native storage implementation.
*/
getStorage : function(){
return window[this.__type + "Storage"];
},
/**
* Returns the amount of key-value pairs stored.
* @return {Integer} The length of the storage.
*/
getLength : function(){
return this.getStorage(this.__type).length;
},
/**
* Store an item in the storage.
*
* @param key {String} The identifier key.
* @param value {var} The data, which will be stored as JSON.
*/
setItem : function(key, value){
value = qx.lang.Json.stringify(value);
try{
this.getStorage(this.__type).setItem(key, value);
} catch(e) {
throw new Error("Storage full.");
};
},
/**
* Returns the stored item.
*
* @param key {String} The identifier to get the data.
* @return {var} The stored data.
*/
getItem : function(key){
var item = this.getStorage(this.__type).getItem(key);
if(qx.lang.Type.isString(item)){
item = qx.lang.Json.parse(item);
} else if(item && item.value && qx.lang.Type.isString(item.value)){
item = qx.lang.Json.parse(item.value);
};
return item;
},
/**
* Removes an item form the storage.
* @param key {String} The identifier.
*/
removeItem : function(key){
this.getStorage(this.__type).removeItem(key);
},
/**
* Deletes every stored item in the storage.
*/
clear : function(){
var storage = this.getStorage(this.__type);
if(!storage.clear){
for(var i = storage.length - 1;i >= 0;i--){
storage.removeItem(storage.key(i));
};
} else {
storage.clear();
};
},
/**
* Returns the named key at the given index.
* @param index {Integer} The index in the storage.
* @return {String} The key stored at the given index.
*/
getKey : function(index){
return this.getStorage(this.__type).key(index);
},
/**
* Helper to access every stored item.
*
* @param callback {Function} A function which will be called for every item.
* The function will have two arguments, first the key and second the value
* of the stored data.
* @param scope {var} The scope of the function.
*/
forEach : function(callback, scope){
var length = this.getLength();
for(var i = 0;i < length;i++){
var key = this.getKey(i);
callback.call(scope, key, this.getItem(key));
};
}
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2004-2008 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Fabian Jakobs (fjakobs)
________________________________________________________________________
This class contains code based on the following work:
http://www.JSON.org/json2.js
2009-06-29
Public Domain.
NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
See http://www.JSON.org/js.html
************************************************************************ */
/**
* Pure JavaScript implementation of the EcmaScript 3.1 JSON object. This class
* is used, if the browser does not support it natively.
*
* @internal
*/
qx.Bootstrap.define("qx.lang.JsonImpl", {
extend : Object,
construct : function(){
// bind parse and stringify so they can be called without a context.
this.stringify = qx.lang.Function.bind(this.stringify, this);
this.parse = qx.lang.Function.bind(this.parse, this);
},
members : {
__gap : null,
__indent : null,
__rep : null,
__stack : null,
/**
* This method produces a JSON text from a JavaScript value.
*
* @param value {var} any JavaScript value, usually an object or array.
*
* @param replacer {Function?} an optional parameter that determines how
* object values are stringified for objects. It can be a function or an
* array of strings.
*
* @param space {String?} an optional parameter that specifies the
* indentation of nested structures. If it is omitted, the text will
* be packed without extra whitespace. If it is a number, it will specify
* the number of spaces to indent at each level. If it is a string
* (such as '\t' or ' '), it contains the characters used to indent
* at each level.
*
* @return {String} The JSON string of the value
*/
stringify : function(value, replacer, space){
this.__gap = '';
this.__indent = '';
this.__stack = [];
if(qx.lang.Type.isNumber(space)){
// If the space parameter is a number, make an indent string containing that
// many spaces.
var space = Math.min(10, Math.floor(space));
for(var i = 0;i < space;i += 1){
this.__indent += ' ';
};
} else if(qx.lang.Type.isString(space)){
if(space.length > 10){
space = space.slice(0, 10);
};
// If the space parameter is a string, it will be used as the indent string.
this.__indent = space;
};
// If there is a replacer, it must be a function or an array.
// Otherwise, ignore it.
if(replacer && (qx.lang.Type.isFunction(replacer) || qx.lang.Type.isArray(replacer))){
this.__rep = replacer;
} else {
this.__rep = null;
};
// Make a fake root object containing our value under the key of ''.
// Return the result of stringifying the value.
return this.__str('', {
'' : value
});
},
/**
* Produce a string from holder[key].
*
* @param key {String} the map key
* @param holder {Object} an object with the given key
* @return {String} The string representation of holder[key]
*/
__str : function(key, holder){
var mind = this.__gap,partial,value = holder[key];
// If the value has a toJSON method, call it to obtain a replacement value.
if(value && qx.lang.Type.isFunction(value.toJSON)){
value = value.toJSON(key);
} else if(qx.lang.Type.isDate(value)){
value = this.dateToJSON(value);
};
// If we were called with a replacer function, then call the replacer to
// obtain a replacement value.
if(typeof this.__rep === 'function'){
value = this.__rep.call(holder, key, value);
};
if(value === null){
return 'null';
};
if(value === undefined){
return undefined;
};
// What happens next depends on the value's type.
switch(qx.lang.Type.getClass(value)){case 'String':
return this.__quote(value);case 'Number':
// JSON numbers must be finite. Encode non-finite numbers as null.
return isFinite(value) ? String(value) : 'null';case 'Boolean':
// If the value is a boolean or null, convert it to a string. Note:
// typeof null does not produce 'null'. The case is included here in
// the remote chance that this gets fixed someday.
return String(value);case 'Array':
// Make an array to hold the partial results of stringifying this array value.
this.__gap += this.__indent;
partial = [];
if(this.__stack.indexOf(value) !== -1){
throw new TypeError("Cannot stringify a recursive object.");
};
this.__stack.push(value);
// The value is an array. Stringify every element. Use null as a placeholder
// for non-JSON values.
var length = value.length;
for(var i = 0;i < length;i += 1){
partial[i] = this.__str(i, value) || 'null';
};
this.__stack.pop();
// Join all of the elements together, separated with commas, and wrap them in
// brackets.
if(partial.length === 0){
var string = '[]';
} else if(this.__gap){
string = '[\n' + this.__gap + partial.join(',\n' + this.__gap) + '\n' + mind + ']';
} else {
string = '[' + partial.join(',') + ']';
};
this.__gap = mind;
return string;case 'Object':
// Make an array to hold the partial results of stringifying this object value.
this.__gap += this.__indent;
partial = [];
if(this.__stack.indexOf(value) !== -1){
throw new TypeError("Cannot stringify a recursive object.");
};
this.__stack.push(value);
// If the replacer is an array, use it to select the members to be stringified.
if(this.__rep && typeof this.__rep === 'object'){
var length = this.__rep.length;
for(var i = 0;i < length;i += 1){
var k = this.__rep[i];
if(typeof k === 'string'){
var v = this.__str(k, value);
if(v){
partial.push(this.__quote(k) + (this.__gap ? ': ' : ':') + v);
};
};
};
} else {
// Otherwise, iterate through all of the keys in the object.
for(var k in value){
if(Object.hasOwnProperty.call(value, k)){
var v = this.__str(k, value);
if(v){
partial.push(this.__quote(k) + (this.__gap ? ': ' : ':') + v);
};
};
};
};
this.__stack.pop();
// Join all of the member texts together, separated with commas,
// and wrap them in braces.
if(partial.length === 0){
var string = '{}';
} else if(this.__gap){
string = '{\n' + this.__gap + partial.join(',\n' + this.__gap) + '\n' + mind + '}';
} else {
string = '{' + partial.join(',') + '}';
};
this.__gap = mind;
return string;};
},
/**
* Convert a date to JSON
*
* @param date {Date} The date to convert
* @return {String} The JSON representation of the date
*/
dateToJSON : function(date){
// Format integers to have at least two digits.
var f2 = function(n){
return n < 10 ? '0' + n : n;
};
var f3 = function(n){
var value = f2(n);
return n < 100 ? '0' + value : value;
};
return isFinite(date.valueOf()) ? date.getUTCFullYear() + '-' + f2(date.getUTCMonth() + 1) + '-' + f2(date.getUTCDate()) + 'T' + f2(date.getUTCHours()) + ':' + f2(date.getUTCMinutes()) + ':' + f2(date.getUTCSeconds()) + '.' + f3(date.getUTCMilliseconds()) + 'Z' : null;
},
/**
* If the string contains no control characters, no quote characters, and no
* backslash characters, then we can safely slap some quotes around it.
* Otherwise we must also replace the offending characters with safe escape
* sequences.
*
* @param string {String} The string to quote
* @return {String} The quoted string
*/
__quote : function(string){
var meta = {
// table of character substitutions
'\b' : '\\b',
'\t' : '\\t',
'\n' : '\\n',
'\f' : '\\f',
'\r' : '\\r',
'"' : '\\"',
'\\' : '\\\\'
};
var escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
escapable.lastIndex = 0;
if(escapable.test(string)){
return '"' + string.replace(escapable, function(a){
var c = meta[a];
return typeof c === 'string' ? c : '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
}) + '"';
} else {
return '"' + string + '"';
};
},
/**
* This method parses a JSON text to produce an object or array.
* It can throw a SyntaxError exception.
*
* @param text {String} JSON string to parse
*
* @param reviver {Function?} Optional reviver function to filter and
* transform the results
*
* @return {Object} The parsed JSON object
*
* @lint ignoreDeprecated(eval)
*/
parse : function(text, reviver){
var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
cx.lastIndex = 0;
// Parsing happens in four stages. In the first stage, we replace certain
// Unicode characters with escape sequences. JavaScript handles many characters
// incorrectly, either silently deleting them, or treating them as line endings.
if(cx.test(text)){
text = text.replace(cx, function(a){
return '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
});
};
// In the second stage, we run the text against regular expressions that look
// for non-JSON patterns. We are especially concerned with '()' and 'new'
// because they can cause invocation, and '=' because it can cause mutation.
// But just to be safe, we want to reject all unexpected forms.
// We split the second stage into 4 regexp operations in order to work around
// crippling inefficiencies in IE's and Safari's regexp engines. First we
// replace the JSON backslash pairs with '@' (a non-JSON character). Second, we
// replace all simple value tokens with ']' characters. Third, we delete all
// open brackets that follow a colon or comma or that begin the text. Finally,
// we look to see that the remaining characters are only whitespace or ']' or
// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.
if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').replace(/(?:^|:|,)(?:\s*\[)+/g, ''))){
// In the third stage we use the eval function to compile the text into a
// JavaScript structure. The '{' operator is subject to a syntactic ambiguity
// in JavaScript: it can begin a block or an object literal. We wrap the text
// in parens to eliminate the ambiguity.
var j = eval('(' + text + ')');
// In the optional fourth stage, we recursively walk the new structure, passing
// each name/value pair to a reviver function for possible transformation.
return typeof reviver === 'function' ? this.__walk({
'' : j
}, '', reviver) : j;
};
// If the text is not JSON parseable, then a SyntaxError is thrown.
throw new SyntaxError('JSON.parse');
},
/**
* The walk method is used to recursively walk the resulting structure so
* that modifications can be made.
*
* @param holder {Object} the root object
* @param key {String} walk holder[key]
* @param reviver {Function} callback, which is called on every node.
* @return {var} The reviver's return value
*/
__walk : function(holder, key, reviver){
var value = holder[key];
if(value && typeof value === 'object'){
for(var k in value){
if(Object.hasOwnProperty.call(value, k)){
var v = this.__walk(value, k, reviver);
if(v !== undefined){
value[k] = v;
} else {
delete value[k];
};
};
};
};
return reviver.call(holder, key, value);
}
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2004-2008 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Sebastian Werner (wpbasti)
* Andreas Ecker (ecker)
======================================================================
This class contains code based on the following work:
* Mootools
http://mootools.net
Version 1.1.1
Copyright:
2007 Valerio Proietti
License:
MIT: http://www.opensource.org/licenses/mit-license.php
************************************************************************ */
/* ************************************************************************
#require(qx.lang.Array)
#ignore(qx.core.Object)
#ignore(qx.event.GlobalError)
************************************************************************ */
/**
* Collection of helper methods operating on functions.
*/
qx.Bootstrap.define("qx.lang.Function", {
statics : {
/**
* Extract the caller of a function from the arguments variable.
* This will not work in Opera < 9.6.
*
* @param args {arguments} The local arguments variable
* @return {Function} A reference to the calling function or "undefined" if caller is not supported.
*/
getCaller : function(args){
return args.caller ? args.caller.callee : args.callee.caller;
},
/**
* Try to get a sensible textual description of a function object.
* This may be the class/mixin and method name of a function
* or at least the signature of the function.
*
* @param fcn {Function} function the get the name for.
* @return {String} Name of the function.
*/
getName : function(fcn){
if(fcn.displayName){
return fcn.displayName;
};
if(fcn.$$original || fcn.wrapper || fcn.classname){
return fcn.classname + ".constructor()";
};
if(fcn.$$mixin){
//members
for(var key in fcn.$$mixin.$$members){
if(fcn.$$mixin.$$members[key] == fcn){
return fcn.$$mixin.name + ".prototype." + key + "()";
};
};
// statics
for(var key in fcn.$$mixin){
if(fcn.$$mixin[key] == fcn){
return fcn.$$mixin.name + "." + key + "()";
};
};
};
if(fcn.self){
var clazz = fcn.self.constructor;
if(clazz){
// members
for(var key in clazz.prototype){
if(clazz.prototype[key] == fcn){
return clazz.classname + ".prototype." + key + "()";
};
};
// statics
for(var key in clazz){
if(clazz[key] == fcn){
return clazz.classname + "." + key + "()";
};
};
};
};
var fcnReResult = fcn.toString().match(/function\s*(\w*)\s*\(.*/);
if(fcnReResult && fcnReResult.length >= 1 && fcnReResult[1]){
return fcnReResult[1] + "()";
};
return 'anonymous()';
},
/**
* Evaluates JavaScript code globally
*
* @lint ignoreDeprecated(eval)
*
* @param data {String} JavaScript commands
* @return {var} Result of the execution
*/
globalEval : function(data){
if(window.execScript){
return window.execScript(data);
} else {
return eval.call(window, data);
};
},
/**
* empty function
* @deprecated {2.1} Please use a new empty function.
*/
empty : function(){
},
/**
* Simply return true.
* @deprecated {2.1} Please use a custom function.
* @return {Boolean} Always returns true.
*/
returnTrue : function(){
return true;
},
/**
* Simply return false.
* @deprecated {2.1} Please use a custom function.
* @return {Boolean} Always returns false.
*/
returnFalse : function(){
return false;
},
/**
* Simply return null.
* @deprecated {2.1} Please use a custom function.
* @return {var} Always returns null.
*/
returnNull : function(){
return null;
},
/**
* Return "this".
* @deprecated {2.1} Please use a custom function.
* @return {Object} Always returns "this".
*/
returnThis : function(){
return this;
},
/**
* Simply return 0.
* @deprecated {2.1} Please use a custom function.
* @return {Number} Always returns 0.
*/
returnZero : function(){
return 0;
},
/**
* Base function for creating functional closures which is used by most other methods here.
*
* *Syntax*
*
* <pre class='javascript'>var createdFunction = qx.lang.Function.create(myFunction, [options]);</pre>
*
* @param func {Function} Original function to wrap
* @param options {Map?} Map of options
* <ul>
* <li><strong>self</strong>: The object that the "this" of the function will refer to. Default is the same as the wrapper function is called.</li>
* <li><strong>args</strong>: An array of arguments that will be passed as arguments to the function when called.
* Default is no custom arguments; the function will receive the standard arguments when called.</li>
* <li><strong>delay</strong>: If set, the returned function will delay the actual execution by this amount of milliseconds and return a timer handle when called.
* Default is no delay.</li>
* <li><strong>periodical</strong>: If set the returned function will periodically perform the actual execution with this specified interval
* and return a timer handle when called. Default is no periodical execution.</li>
* <li><strong>attempt</strong>: If set to true, the returned function will try to execute and return either the results or false on error. Default is false.</li>
* </ul>
*
* @return {Function} Wrapped function
*/
create : function(func, options){
{
};
// Nothing to be done when there are no options.
if(!options){
return func;
};
// Check for at least one attribute.
if(!(options.self || options.args || options.delay != null || options.periodical != null || options.attempt)){
return func;
};
return function(event){
{
};
// Convert (and copy) incoming arguments
var args = qx.lang.Array.fromArguments(arguments);
// Prepend static arguments
if(options.args){
args = options.args.concat(args);
};
if(options.delay || options.periodical){
var returns = function(){
return func.apply(options.self || this, args);
};
if(qx.core.Environment.get("qx.globalErrorHandling")){
returns = qx.event.GlobalError.observeMethod(returns);
};
if(options.delay){
return window.setTimeout(returns, options.delay);
};
if(options.periodical){
return window.setInterval(returns, options.periodical);
};
} else if(options.attempt){
var ret = false;
try{
ret = func.apply(options.self || this, args);
} catch(ex) {
};
return ret;
} else {
return func.apply(options.self || this, args);
};
};
},
/**
* Returns a function whose "this" is altered.
*
*
* *Native way*
*
* This is also a feature of JavaScript 1.8.5 and will be supplied
* by modern browsers. Including {@link qx.lang.normalize.Function}
* will supply a cross browser normalization of the native
* implementation. We like to encourage you to use the native function!
*
*
* *Syntax*
*
* <pre class='javascript'>qx.lang.Function.bind(myFunction, [self, [varargs...]]);</pre>
*
* *Example*
*
* <pre class='javascript'>
* function myFunction()
* {
* this.setStyle('color', 'red');
* // note that 'this' here refers to myFunction, not an element
* // we'll need to bind this function to the element we want to alter
* };
*
* var myBoundFunction = qx.lang.Function.bind(myFunction, myElement);
* myBoundFunction(); // this will make the element myElement red.
* </pre>
*
* If you find yourself using this static method a lot, you may be
* interested in the bindTo() method in the mixin qx.core.MBindTo.
*
* @see qx.core.MBindTo
*
* @param func {Function} Original function to wrap
* @param self {Object ? null} The object that the "this" of the function will refer to.
* @param varargs {arguments ? null} The arguments to pass to the function.
* @return {Function} The bound function.
*/
bind : function(func, self, varargs){
return this.create(func, {
self : self,
args : arguments.length > 2 ? qx.lang.Array.fromArguments(arguments, 2) : null
});
},
/**
* Returns a function whose arguments are pre-configured.
*
* *Syntax*
*
* <pre class='javascript'>qx.lang.Function.curry(myFunction, [varargs...]);</pre>
*
* *Example*
*
* <pre class='javascript'>
* function myFunction(elem) {
* elem.setStyle('color', 'red');
* };
*
* var myBoundFunction = qx.lang.Function.curry(myFunction, myElement);
* myBoundFunction(); // this will make the element myElement red.
* </pre>
*
* @param func {Function} Original function to wrap
* @param varargs {arguments} The arguments to pass to the function.
* @return {var} The pre-configured function.
*/
curry : function(func, varargs){
return this.create(func, {
args : arguments.length > 1 ? qx.lang.Array.fromArguments(arguments, 1) : null
});
},
/**
* Returns a function which could be used as a listener for a native event callback.
*
* *Syntax*
*
* <pre class='javascript'>qx.lang.Function.listener(myFunction, [self, [varargs...]]);</pre>
*
* @param func {Function} Original function to wrap
* @param self {Object ? null} The object that the "this" of the function will refer to.
* @param varargs {arguments ? null} The arguments to pass to the function.
* @return {var} The bound function.
*/
listener : function(func, self, varargs){
if(arguments.length < 3){
return function(event){
// Directly execute, but force first parameter to be the event object.
return func.call(self || this, event || window.event);
};
} else {
var optargs = qx.lang.Array.fromArguments(arguments, 2);
return function(event){
var args = [event || window.event];
// Append static arguments
args.push.apply(args, optargs);
// Finally execute original method
func.apply(self || this, args);
};
};
},
/**
* Tries to execute the function.
*
* *Syntax*
*
* <pre class='javascript'>var result = qx.lang.Function.attempt(myFunction, [self, [varargs...]]);</pre>
*
* *Example*
*
* <pre class='javascript'>
* var myObject = {
* 'cow': 'moo!'
* };
*
* var myFunction = function()
* {
* for(var i = 0; i < arguments.length; i++) {
* if(!this[arguments[i]]) throw('doh!');
* }
* };
*
* var result = qx.lang.Function.attempt(myFunction, myObject, 'pig', 'cow'); // false
* </pre>
*
* @param func {Function} Original function to wrap
* @param self {Object ? null} The object that the "this" of the function will refer to.
* @param varargs {arguments ? null} The arguments to pass to the function.
* @return {Boolean|var} <code>false</code> if an exception is thrown, else the function's return.
*/
attempt : function(func, self, varargs){
return this.create(func, {
self : self,
attempt : true,
args : arguments.length > 2 ? qx.lang.Array.fromArguments(arguments, 2) : null
})();
},
/**
* Delays the execution of a function by a specified duration.
*
* *Syntax*
*
* <pre class='javascript'>var timeoutID = qx.lang.Function.delay(myFunction, [delay, [self, [varargs...]]]);</pre>
*
* *Example*
*
* <pre class='javascript'>
* var myFunction = function(){ alert('moo! Element id is: ' + this.id); };
* //wait 50 milliseconds, then call myFunction and bind myElement to it
* qx.lang.Function.delay(myFunction, 50, myElement); // alerts: 'moo! Element id is: ... '
*
* // An anonymous function, example
* qx.lang.Function.delay(function(){ alert('one second later...'); }, 1000); //wait a second and alert
* </pre>
*
* @param func {Function} Original function to wrap
* @param delay {Integer} The duration to wait (in milliseconds).
* @param self {Object ? null} The object that the "this" of the function will refer to.
* @param varargs {arguments ? null} The arguments to pass to the function.
* @return {Integer} The JavaScript Timeout ID (useful for clearing delays).
*/
delay : function(func, delay, self, varargs){
return this.create(func, {
delay : delay,
self : self,
args : arguments.length > 3 ? qx.lang.Array.fromArguments(arguments, 3) : null
})();
},
/**
* Executes a function in the specified intervals of time
*
* *Syntax*
*
* <pre class='javascript'>var intervalID = qx.lang.Function.periodical(myFunction, [period, [self, [varargs...]]]);</pre>
*
* *Example*
*
* <pre class='javascript'>
* var Site = { counter: 0 };
* var addCount = function(){ this.counter++; };
* qx.lang.Function.periodical(addCount, 1000, Site); // will add the number of seconds at the Site
* </pre>
*
* @param func {Function} Original function to wrap
* @param interval {Integer} The duration of the intervals between executions.
* @param self {Object ? null} The object that the "this" of the function will refer to.
* @param varargs {arguments ? null} The arguments to pass to the function.
* @return {Integer} The Interval ID (useful for clearing a periodical).
*/
periodical : function(func, interval, self, varargs){
return this.create(func, {
periodical : interval,
self : self,
args : arguments.length > 3 ? qx.lang.Array.fromArguments(arguments, 3) : null
})();
}
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2004-2008 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Fabian Jakobs (fjakobs)
________________________________________________________________________
This class contains code based on the following work:
http://www.JSON.org/json2.js
2009-06-29
Public Domain.
NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
See http://www.JSON.org/js.html
************************************************************************ */
/**
* JSON (JavaScript Object Notation) parser, serializer for qooxdoo
*
* This class implements EcmaScript 3.1 JSON support.
*
* http://wiki.ecmascript.org/doku.php?id=es3.1:json_support
*
* If the browser supports native JSON the browser implementation is used.
*/
qx.Bootstrap.define("qx.lang.Json", {
statics : {
/**
* {JSON} The JSON object to use. If the browser has native JSON support
* this member points to <code>window.JSON</code>. Otherwise it points to
* the qooxdoo implementation {@link JsonImpl}.
*/
JSON : true ? window.JSON : new qx.lang.JsonImpl(),
/**
* This method produces a JSON text from a JavaScript value.
*
* When an object value is found, if the object contains a toJSON
* method, its toJSON method will be called and the result will be
* stringified. A toJSON method does not serialize: it returns the
* value represented by the name/value pair that should be serialized,
* or undefined if nothing should be serialized. The toJSON method
* will be passed the key associated with the value, and this will be
* bound to the object holding the key.
*
* For example, this would serialize Dates as ISO strings.
*
* <pre class="javascript">
* Date.prototype.toJSON = function (key) {
* function f(n) {
* // Format integers to have at least two digits.
* return n < 10 ? '0' + n : n;
* }
*
* return this.getUTCFullYear() + '-' +
* f(this.getUTCMonth() + 1) + '-' +
* f(this.getUTCDate()) + 'T' +
* f(this.getUTCHours()) + ':' +
* f(this.getUTCMinutes()) + ':' +
* f(this.getUTCSeconds()) + 'Z';
* };
* </pre>
*
* You can provide an optional replacer method. It will be passed the
* key and value of each member, with this bound to the containing
* object. The value that is returned from your method will be
* serialized. If your method returns undefined, then the member will
* be excluded from the serialization.
*
* If the replacer parameter is an array of strings, then it will be
* used to select the members to be serialized. It filters the results
* such that only members with keys listed in the replacer array are
* stringified.
*
* Values that do not have JSON representations, such as undefined or
* functions, will not be serialized. Such values in objects will be
* dropped; in arrays they will be replaced with null. You can use
* a replacer function to replace those with JSON values.
* JSON.stringify(undefined) returns undefined.
*
* The optional space parameter produces a stringification of the
* value that is filled with line breaks and indentation to make it
* easier to read.
*
* If the space parameter is a non-empty string, then that string will
* be used for indentation. If the space parameter is a number, then
* the indentation will be that many spaces.
*
* Example:
*
* <pre class="javascript">
* text = JSON.stringify(['e', {pluribus: 'unum'}]);
* // text is '["e",{"pluribus":"unum"}]'
*
*
* text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t');
* // text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]'
*
* text = JSON.stringify([new Date()], function (key, value) {
* return this[key] instanceof Date ?
* 'Date(' + this[key] + ')' : value;
* });
* // text is '["Date(---current time---)"]'
* </pre>
*
* @signature function(value, replacer, space)
*
* @param value {var} any JavaScript value, usually an object or array.
*
* @param replacer {Function?} an optional parameter that determines how
* object values are stringified for objects. It can be a function or an
* array of strings.
*
* @param space {String?} an optional parameter that specifies the
* indentation of nested structures. If it is omitted, the text will
* be packed without extra whitespace. If it is a number, it will specify
* the number of spaces to indent at each level. If it is a string
* (such as '\t' or ' '), it contains the characters used to indent
* at each level.
*
* @return {String} The JSON string of the value
*/
stringify : null,
// will be set in the defer block
/**
* This method parses a JSON text to produce an object or array.
* It can throw a SyntaxError exception.
*
* The optional reviver parameter is a function that can filter and
* transform the results. It receives each of the keys and values,
* and its return value is used instead of the original value.
* If it returns what it received, then the structure is not modified.
* If it returns undefined then the member is deleted.
*
* Example:
*
* <pre class="javascript">
* // Parse the text. Values that look like ISO date strings will
* // be converted to Date objects.
*
* myData = JSON.parse(text, function (key, value)
* {
* if (typeof value === 'string')
* {
* var a = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value);
* if (a) {
* return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4], +a[5], +a[6]));
* }
* }
* return value;
* });
*
* myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) {
* var d;
* if (typeof value === 'string' &&
* value.slice(0, 5) === 'Date(' &&
* value.slice(-1) === ')') {
* d = new Date(value.slice(5, -1));
* if (d) {
* return d;
* }
* }
* return value;
* });
* </pre>
*
* @signature function(text, reviver)
*
* @param text {String} JSON string to parse
*
* @param reviver {Function?} Optional reviver function to filter and
* transform the results
*
* @return {Object} The parsed JSON object
*/
parse : null
},
defer : function(statics){
statics.stringify = statics.JSON.stringify;
statics.parse = statics.JSON.parse;
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2004-2012 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Martin Wittemann (wittemann)
************************************************************************ */
/* ************************************************************************
#require(qx.bom.storage.UserData#getLength)
#require(qx.bom.storage.UserData#setItem)
#require(qx.bom.storage.UserData#getItem)
#require(qx.bom.storage.UserData#removeItem)
#require(qx.bom.storage.UserData#clear)
#require(qx.bom.storage.UserData#getKey)
#require(qx.bom.storage.UserData#forEach)
************************************************************************ */
/**
* Fallback storage implementation usable in IE browsers. It is recommended to use
* these implementation only in IE < 8 because IE >= 8 supports
* {@link qx.bom.storage.Web}.
*/
qx.Bootstrap.define("qx.bom.storage.UserData", {
statics : {
__local : null,
__session : null,
// global id used as key for the storage
__id : 0,
/**
* Returns an instance of {@link qx.bom.storage.UserData} used to store
* data persistent.
* @return {qx.bom.storage.UserData} A storage instance.
*/
getLocal : function(){
if(this.__local){
return this.__local;
};
return this.__local = new qx.bom.storage.UserData("local");
},
/**
* Returns an instance of {@link qx.bom.storage.UserData} used to store
* data persistent.
* @return {qx.bom.storage.UserData} A storage instance.
*/
getSession : function(){
if(this.__session){
return this.__session;
};
return this.__session = new qx.bom.storage.UserData("session");
}
},
/**
* Create a new instance. Usually, you should take the static
* accessors to get your instance.
*
* @param storeName {String} type of storage.
*/
construct : function(storeName){
// create a dummy DOM element used for storage
this.__el = document.createElement("div");
this.__el.style["display"] = "none";
document.getElementsByTagName("head")[0].appendChild(this.__el);
this.__el.addBehavior("#default#userdata");
this.__storeName = storeName;
// load the inital data which might be stored
this.__el.load(this.__storeName);
// set up the internal reference maps
this.__storage = {
};
this.__reference = {
};
// initialize
var value = this.__el.getAttribute("qx" + qx.bom.storage.UserData.__id);
while(value != undefined){
value = qx.lang.Json.parse(value);
// save the data in the internal storage
this.__storage[value.key] = value.value;
// save the reference
this.__reference[value.key] = "qx" + qx.bom.storage.UserData.__id;
qx.bom.storage.UserData.__id++;
value = this.__el.getAttribute("qx" + qx.bom.storage.UserData.__id);
};
},
members : {
__el : null,
__storeName : "qxtest",
// storage which holds the key and the value
__storage : null,
// reference store which holds the key and the key used to store
__reference : null,
/**
* Returns the map used to keep a in memory copy of the stored data.
* @return {Map} The stored data.
* @internal
*/
getStorage : function(){
return this.__storage;
},
/**
* Returns the amount of key-value pairs stored.
* @return {Integer} The length of the storage.
*/
getLength : function(){
return Object.keys(this.__storage).length;
},
/**
* Store an item in the storage.
*
* @param key {String} The identifier key.
* @param value {var} The data, which will be stored as JSON.
*/
setItem : function(key, value){
// override case
if(this.__reference[key]){
var storageKey = this.__reference[key];
} else {
var storageKey = "qx" + qx.bom.storage.UserData.__id;
qx.bom.storage.UserData.__id++;
};
// build and save the data used to store both, key and value
var storageValue = qx.lang.Json.stringify({
key : key,
value : value
});
this.__el.setAttribute(storageKey, storageValue);
this.__el.save(this.__storeName);
// also update the internal mappings
this.__storage[key] = value;
this.__reference[key] = storageKey;
},
/**
* Returns the stored item.
*
* @param key {String} The identifier to get the data.
* @return {var} The stored data.
*/
getItem : function(key){
return this.__storage[key] || null;
},
/**
* Removes an item form the storage.
* @param key {String} The identifier.
*/
removeItem : function(key){
// check if the item is availabel
var storageName = this.__reference[key];
if(storageName == undefined){
return;
};
// remove the item
this.__el.removeAttribute(storageName);
// decrease the id because we removed one item
qx.bom.storage.UserData.__id--;
// update the internal maps
delete this.__storage[key];
delete this.__reference[key];
// check if we have deleted the last item
var lastStoreName = "qx" + qx.bom.storage.UserData.__id;
if(this.__el.getAttribute(lastStoreName)){
// if not, move the last item to the deleted spot
var lastItem = this.__el.getAttribute("qx" + qx.bom.storage.UserData.__id);
this.__el.removeAttribute(lastStoreName);
this.__el.setAttribute(storageName, lastItem);
// update the reference map
var lastKey = qx.lang.Json.parse(lastItem).key;
this.__reference[lastKey] = storageName;
};
this.__el.save(this.__storeName);
},
/**
* Deletes every stored item in the storage.
*/
clear : function(){
// delete all entries from the storage
for(var key in this.__reference){
this.__el.removeAttribute(this.__reference[key]);
};
this.__el.save(this.__storeName);
// reset the internal maps
this.__storage = {
};
this.__reference = {
};
},
/**
* Returns the named key at the given index.
* @param index {Integer} The index in the storage.
* @return {String} The key stored at the given index.
*/
getKey : function(index){
return Object.keys(this.__storage)[index];
},
/**
* Helper to access every stored item.
*
* @param callback {Function} A function which will be called for every item.
* The function will have two arguments, first the key and second the value
* of the stored data.
* @param scope {var} The scope of the function.
*/
forEach : function(callback, scope){
var length = this.getLength();
for(var i = 0;i < length;i++){
var key = this.getKey(i);
callback.call(scope, key, this.getItem(key));
};
}
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2004-2012 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Martin Wittemann (wittemann)
************************************************************************ */
/* ************************************************************************
#require(qx.bom.storage.Memory#getLength)
#require(qx.bom.storage.Memory#setItem)
#require(qx.bom.storage.Memory#getItem)
#require(qx.bom.storage.Memory#removeItem)
#require(qx.bom.storage.Memory#clear)
#require(qx.bom.storage.Memory#getKey)
#require(qx.bom.storage.Memory#forEach)
************************************************************************ */
/**
* Fallback storage implementation which offers the same API as every other storage
* but is not persistent. Basically, its just a storage API on a JavaScript map.
*/
qx.Bootstrap.define("qx.bom.storage.Memory", {
statics : {
__local : null,
__session : null,
/**
* Returns an instance of {@link qx.bom.storage.Memory} which is of course
* not persisted on reload.
* @return {qx.bom.storage.Memory} A memory storage.
*/
getLocal : function(){
if(this.__local){
return this.__local;
};
return this.__local = new qx.bom.storage.Memory();
},
/**
* Returns an instance of {@link qx.bom.storage.Memory} which is of course
* not persisted on reload.
* @return {qx.bom.storage.Memory} A memory storage.
*/
getSession : function(){
if(this.__session){
return this.__session;
};
return this.__session = new qx.bom.storage.Memory();
}
},
construct : function(){
this.__storage = {
};
},
members : {
__storage : null,
/**
* Returns the internal used map.
* @return {Map} The storage.
* @internal
*/
getStorage : function(){
return this.__storage;
},
/**
* Returns the amount of key-value pairs stored.
* @return {Integer} The length of the storage.
*/
getLength : function(){
return Object.keys(this.__storage).length;
},
/**
* Store an item in the storage.
*
* @param key {String} The identifier key.
* @param value {var} The data, which will be stored as JSON.
*/
setItem : function(key, value){
value = qx.lang.Json.stringify(value);
this.__storage[key] = value;
},
/**
* Returns the stored item.
*
* @param key {String} The identifier to get the data.
* @return {var} The stored data.
*/
getItem : function(key){
var item = this.__storage[key];
if(qx.lang.Type.isString(item)){
item = qx.lang.Json.parse(item);
};
return item;
},
/**
* Removes an item form the storage.
* @param key {String} The identifier.
*/
removeItem : function(key){
delete this.__storage[key];
},
/**
* Deletes every stored item in the storage.
*/
clear : function(){
this.__storage = {
};
},
/**
* Returns the named key at the given index.
* @param index {Integer} The index in the storage.
* @return {String} The key stored at the given index.
*/
getKey : function(index){
var keys = Object.keys(this.__storage);
return keys[index];
},
/**
* Helper to access every stored item.
*
* @param callback {Function} A function which will be called for every item.
* The function will have two arguments, first the key and second the value
* of the stored data.
* @param scope {var} The scope of the function.
*/
forEach : function(callback, scope){
var length = this.getLength();
for(var i = 0;i < length;i++){
var key = this.getKey(i);
callback.call(scope, key, this.getItem(key));
};
}
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2011-2012 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Martin Wittemann (wittemann)
* Daniel Wagner (danielwagner)
************************************************************************ */
/**
* CSS/Style property manipulation module
*/
qx.Bootstrap.define("qx.module.Css", {
statics : {
/**
* Modifies the given style property on all elements in the collection.
*
* @attach {qxWeb}
* @param name {String} Name of the style property to modify
* @param value {var} The value to apply
* @return {qxWeb} The collection for chaining
*/
setStyle : function(name, value){
if(/\w-\w/.test(name)){
name = qx.lang.String.camelCase(name);
};
for(var i = 0;i < this.length;i++){
qx.bom.element.Style.set(this[i], name, value);
};
return this;
},
/**
* Returns the value of the given style property for the first item in the
* collection.
*
* @attach {qxWeb}
* @param name {String} Style property name
* @return {var} Style property value
*/
getStyle : function(name){
if(this[0]){
if(/\w-\w/.test(name)){
name = qx.lang.String.camelCase(name);
};
return qx.bom.element.Style.get(this[0], name);
};
return null;
},
/**
* Sets multiple style properties for each item in the collection.
*
* @attach {qxWeb}
* @param styles {Map} A map of style property name/value pairs
* @return {qxWeb} The collection for chaining
*/
setStyles : function(styles){
for(var name in styles){
this.setStyle(name, styles[name]);
};
return this;
},
/**
* Returns the values of multiple style properties for each item in the
* collection
*
* @attach {qxWeb}
* @param names {String[]} List of style property names
* @return {Map} Map of style property name/value pairs
*/
getStyles : function(names){
var styles = {
};
for(var i = 0;i < names.length;i++){
styles[names[i]] = this.getStyle(names[i]);
};
return styles;
},
/**
* Adds a class name to each element in the collection
*
* @attach {qxWeb}
* @param name {String} Class name
* @return {qxWeb} The collection for chaining
*/
addClass : function(name){
for(var i = 0;i < this.length;i++){
qx.bom.element.Class.add(this[i], name);
};
return this;
},
/**
* Adds multiple class names to each element in the collection
*
* @attach {qxWeb}
* @param names {String[]} List of class names to add
* @return {qxWeb} The collection for chaining
*/
addClasses : function(names){
for(var i = 0;i < this.length;i++){
qx.bom.element.Class.addClasses(this[i], names);
};
return this;
},
/**
* Removes a class name from each element in the collection
*
* @attach {qxWeb}
* @param name {String} The class name to remove
* @return {qxWeb} The collection for chaining
*/
removeClass : function(name){
for(var i = 0;i < this.length;i++){
qx.bom.element.Class.remove(this[i], name);
};
return this;
},
/**
* Removes multiple class names from each element in the collection
*
* @attach {qxWeb}
* @param names {String[]} List of class names to remove
* @return {qxWeb} The collection for chaining
*/
removeClasses : function(names){
for(var i = 0;i < this.length;i++){
qx.bom.element.Class.removeClasses(this[i], names);
};
return this;
},
/**
* Checks if the first element in the collection has the given class name
*
* @attach {qxWeb}
* @param name {String} Class name to check for
* @return {Boolean} <code>true</code> if the first item has the given class name
*/
hasClass : function(name){
if(!this[0]){
return false;
};
return qx.bom.element.Class.has(this[0], name);
},
/**
* Returns the class name of the first element in the collection
*
* @attach {qxWeb}
* @return {String} Class name
*/
getClass : function(){
if(!this[0]){
return "";
};
return qx.bom.element.Class.get(this[0]);
},
/**
* Toggles the given class name on each item in the collection
*
* @attach {qxWeb}
* @param name {String} Class name
* @return {qxWeb} The collection for chaining
*/
toggleClass : function(name){
var bCls = qx.bom.element.Class;
for(var i = 0,l = this.length;i < l;i++){
bCls.has(this[i], name) ? bCls.remove(this[i], name) : bCls.add(this[i], name);
};
return this;
},
/**
* Toggles the given list of class names on each item in the collection
*
* @attach {qxWeb}
* @param names {String[]} Class names
* @return {qxWeb} The collection for chaining
*/
toggleClasses : function(names){
for(var i = 0,l = names.length;i < l;i++){
this.toggleClass(names[i]);
};
return this;
},
/**
* Replaces a class name on each element in the collection
*
* @attach {qxWeb}
* @param oldName {String} Class name to remove
* @param newName {String} Class name to add
* @return {qxWeb} The collection for chaining
*/
replaceClass : function(oldName, newName){
for(var i = 0,l = this.length;i < l;i++){
qx.bom.element.Class.replace(this[i], oldName, newName);
};
return this;
},
/**
* Returns the rendered height of the first element in the collection.
* @attach {qxWeb}
* @return {Number} The first item's rendered height
*/
getHeight : function(){
var elem = this[0];
if(elem){
if(qx.dom.Node.isElement(elem)){
return qx.bom.element.Dimension.getHeight(elem);
} else if(qx.dom.Node.isDocument(elem)){
return qx.bom.Document.getHeight(qx.dom.Node.getWindow(elem));
} else if(qx.dom.Node.isWindow(elem)){
return qx.bom.Viewport.getHeight(elem);
};;
};
return null;
},
/**
* Returns the rendered width of the first element in the collection
* @attach {qxWeb}
* @return {Number} The first item's rendered width
*/
getWidth : function(){
var elem = this[0];
if(elem){
if(qx.dom.Node.isElement(elem)){
return qx.bom.element.Dimension.getWidth(elem);
} else if(qx.dom.Node.isDocument(elem)){
return qx.bom.Document.getWidth(qx.dom.Node.getWindow(elem));
} else if(qx.dom.Node.isWindow(elem)){
return qx.bom.Viewport.getWidth(elem);
};;
};
return null;
},
/**
* Returns the computed location of the given element in the context of the
* document dimensions.
*
* @attach {qxWeb}
* @return {Map} A map with the keys <code>left<code/>, <code>top<code/>,
* <code>right<code/> and <code>bottom<code/> which contains the distance
* of the element relative to the document.
*/
getOffset : function(){
var elem = this[0];
if(elem){
return qx.bom.element.Location.get(elem);
};
return null;
},
/**
* Returns the content height of the first element in the collection.
* This is the maximum height the element can use, excluding borders,
* margins, padding or scroll bars.
* @attach {qxWeb}
* @return {Number} Computed content height
*/
getContentHeight : function(){
var obj = this[0];
if(qx.dom.Node.isElement(obj)){
return qx.bom.element.Dimension.getContentHeight(obj);
};
return null;
},
/**
* Returns the content width of the first element in the collection.
* This is the maximum width the element can use, excluding borders,
* margins, padding or scroll bars.
* @attach {qxWeb}
* @return {Number} Computed content width
*/
getContentWidth : function(){
var obj = this[0];
if(qx.dom.Node.isElement(obj)){
return qx.bom.element.Dimension.getContentWidth(obj);
};
return null;
},
/**
* Returns the distance between the first element in the collection and its
* offset parent
*
* @attach {qxWeb}
* @return {Map} a map with the keys <code>left</code> and <code>top</code>
* containing the distance between the elements
*/
getPosition : function(){
var obj = this[0];
if(qx.dom.Node.isElement(obj)){
return qx.bom.element.Location.getPosition(obj);
};
return null;
},
/**
* Includes a Stylesheet file
*
* @attachStatic {qxWeb}
* @param uri {String} The stylesheet's URI
* @param doc {Document?} Document to modify
*/
includeStylesheet : function(uri, doc){
qx.bom.Stylesheet.includeFile(uri, doc);
},
/**
* Hides all elements in the collection by setting their "display"
* style to "none". The previous value is stored so it can be re-applied
* when {@link #show} is called.
*
* @attach {qxWeb}
* @return {qxWeb} The collection for chaining
*/
hide : function(){
for(var i = 0,l = this.length;i < l;i++){
var item = this.slice(i, i + 1);
var prevStyle = item.getStyle("display");
if(prevStyle !== "none"){
item[0].$$qPrevDisp = prevStyle;
item.setStyle("display", "none");
};
};
return this;
},
/**
* Shows any elements with "display: none" in the collection. If an element
* was hidden by using the {@link #hide} method, its previous
* "display" style value will be re-applied. Otherwise, the
* default "display" value for the element type will be applied.
*
* @attach {qxWeb}
* @return {qxWeb} The collection for chaining
*/
show : function(){
for(var i = 0,l = this.length;i < l;i++){
var item = this.slice(i, i + 1);
var currentVal = item.getStyle("display");
var prevVal = item[0].$$qPrevDisp;
var newVal;
if(currentVal == "none"){
if(prevVal && prevVal != "none"){
newVal = prevVal;
} else {
var doc = qxWeb.getDocument(item[0]);
newVal = qx.module.Css.__getDisplayDefault(item[0].tagName, doc);
};
item.setStyle("display", newVal);
item[0].$$qPrevDisp = "none";
};
};
return this;
},
/**
* Maps HTML elements to their default "display" style values.
*/
__displayDefaults : {
},
/**
* Attempts tp determine the default "display" style value for
* elements with the given tag name.
*
* @param tagName {String} Tag name
* @param doc {Document?} Document element. Default: The current document
* @return {String} The default "display" value, e.g. <code>inline</code>
* or <code>block</code>
*/
__getDisplayDefault : function(tagName, doc){
var defaults = qx.module.Css.__displayDefaults;
if(!defaults[tagName]){
var docu = doc || document;
var tempEl = qxWeb(docu.createElement(tagName)).appendTo(doc.body);
defaults[tagName] = tempEl.getStyle("display");
tempEl.remove();
};
return defaults[tagName] || "";
}
},
defer : function(statics){
qxWeb.$attach({
"setStyle" : statics.setStyle,
"getStyle" : statics.getStyle,
"setStyles" : statics.setStyles,
"getStyles" : statics.getStyles,
"addClass" : statics.addClass,
"addClasses" : statics.addClasses,
"removeClass" : statics.removeClass,
"removeClasses" : statics.removeClasses,
"hasClass" : statics.hasClass,
"getClass" : statics.getClass,
"toggleClass" : statics.toggleClass,
"toggleClasses" : statics.toggleClasses,
"replaceClass" : statics.replaceClass,
"getHeight" : statics.getHeight,
"getWidth" : statics.getWidth,
"getOffset" : statics.getOffset,
"getContentHeight" : statics.getContentHeight,
"getContentWidth" : statics.getContentWidth,
"getPosition" : statics.getPosition,
"hide" : statics.hide,
"show" : statics.show
});
qxWeb.$attachStatic({
"includeStylesheet" : statics.includeStylesheet
});
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2004-2012 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Martin Wittemann (wittemann)
************************************************************************ */
/**
* This class takes care of the normalization of the native 'String' object.
* Therefore it checks the availability of the following methods and appends
* it, if not available. This means you can use the methods during
* development in every browser. For usage samples, check out the attached links.
*
* *trim*:
* <a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String/Trim">MDN documentation</a> |
* <a href="http://es5.github.com/#x15.5.4.20">Annotated ES5 Spec</a>
*/
qx.Bootstrap.define("qx.lang.normalize.String", {
defer : function(){
// trim
if(!qx.core.Environment.get("ecmascript.string.trim")){
String.prototype.trim = function(context){
return this.replace(/^\s+|\s+$/g, '');
};
};
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2004-2008 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Sebastian Werner (wpbasti)
* Andreas Ecker (ecker)
======================================================================
This class contains code based on the following work:
* Mootools
http://mootools.net/
Version 1.1.1
Copyright:
(c) 2007 Valerio Proietti
License:
MIT: http://www.opensource.org/licenses/mit-license.php
and
* XRegExp
http://xregexp.com/
Version 1.5
Copyright:
(c) 2006-2007, Steven Levithan <http://stevenlevithan.com>
License:
MIT: http://www.opensource.org/licenses/mit-license.php
Authors:
* Steven Levithan
************************************************************************ */
/* ************************************************************************
#require(qx.lang.normalize.String)
************************************************************************ */
/**
* String helper functions
*
* The native JavaScript String is not modified by this class. However,
* there are modifications to the native String in {@link qx.lang.normalize.String} for
* browsers that do not support certain features.
*/
qx.Bootstrap.define("qx.lang.String", {
statics : {
/**
* Unicode letters. they are taken from Steve Levithan's excellent XRegExp library [http://xregexp.com/plugins/xregexp-unicode-base.js]
*/
__unicodeLetters : "0041-005A0061-007A00AA00B500BA00C0-00D600D8-00F600F8-02C102C6-02D102E0-02E402EC02EE0370-037403760377037A-037D03860388-038A038C038E-03A103A3-03F503F7-0481048A-05250531-055605590561-058705D0-05EA05F0-05F20621-064A066E066F0671-06D306D506E506E606EE06EF06FA-06FC06FF07100712-072F074D-07A507B107CA-07EA07F407F507FA0800-0815081A082408280904-0939093D09500958-0961097109720979-097F0985-098C098F09900993-09A809AA-09B009B209B6-09B909BD09CE09DC09DD09DF-09E109F009F10A05-0A0A0A0F0A100A13-0A280A2A-0A300A320A330A350A360A380A390A59-0A5C0A5E0A72-0A740A85-0A8D0A8F-0A910A93-0AA80AAA-0AB00AB20AB30AB5-0AB90ABD0AD00AE00AE10B05-0B0C0B0F0B100B13-0B280B2A-0B300B320B330B35-0B390B3D0B5C0B5D0B5F-0B610B710B830B85-0B8A0B8E-0B900B92-0B950B990B9A0B9C0B9E0B9F0BA30BA40BA8-0BAA0BAE-0BB90BD00C05-0C0C0C0E-0C100C12-0C280C2A-0C330C35-0C390C3D0C580C590C600C610C85-0C8C0C8E-0C900C92-0CA80CAA-0CB30CB5-0CB90CBD0CDE0CE00CE10D05-0D0C0D0E-0D100D12-0D280D2A-0D390D3D0D600D610D7A-0D7F0D85-0D960D9A-0DB10DB3-0DBB0DBD0DC0-0DC60E01-0E300E320E330E40-0E460E810E820E840E870E880E8A0E8D0E94-0E970E99-0E9F0EA1-0EA30EA50EA70EAA0EAB0EAD-0EB00EB20EB30EBD0EC0-0EC40EC60EDC0EDD0F000F40-0F470F49-0F6C0F88-0F8B1000-102A103F1050-1055105A-105D106110651066106E-10701075-1081108E10A0-10C510D0-10FA10FC1100-1248124A-124D1250-12561258125A-125D1260-1288128A-128D1290-12B012B2-12B512B8-12BE12C012C2-12C512C8-12D612D8-13101312-13151318-135A1380-138F13A0-13F41401-166C166F-167F1681-169A16A0-16EA1700-170C170E-17111720-17311740-17511760-176C176E-17701780-17B317D717DC1820-18771880-18A818AA18B0-18F51900-191C1950-196D1970-19741980-19AB19C1-19C71A00-1A161A20-1A541AA71B05-1B331B45-1B4B1B83-1BA01BAE1BAF1C00-1C231C4D-1C4F1C5A-1C7D1CE9-1CEC1CEE-1CF11D00-1DBF1E00-1F151F18-1F1D1F20-1F451F48-1F4D1F50-1F571F591F5B1F5D1F5F-1F7D1F80-1FB41FB6-1FBC1FBE1FC2-1FC41FC6-1FCC1FD0-1FD31FD6-1FDB1FE0-1FEC1FF2-1FF41FF6-1FFC2071207F2090-209421022107210A-211321152119-211D212421262128212A-212D212F-2139213C-213F2145-2149214E218321842C00-2C2E2C30-2C5E2C60-2CE42CEB-2CEE2D00-2D252D30-2D652D6F2D80-2D962DA0-2DA62DA8-2DAE2DB0-2DB62DB8-2DBE2DC0-2DC62DC8-2DCE2DD0-2DD62DD8-2DDE2E2F300530063031-3035303B303C3041-3096309D-309F30A1-30FA30FC-30FF3105-312D3131-318E31A0-31B731F0-31FF3400-4DB54E00-9FCBA000-A48CA4D0-A4FDA500-A60CA610-A61FA62AA62BA640-A65FA662-A66EA67F-A697A6A0-A6E5A717-A71FA722-A788A78BA78CA7FB-A801A803-A805A807-A80AA80C-A822A840-A873A882-A8B3A8F2-A8F7A8FBA90A-A925A930-A946A960-A97CA984-A9B2A9CFAA00-AA28AA40-AA42AA44-AA4BAA60-AA76AA7AAA80-AAAFAAB1AAB5AAB6AAB9-AABDAAC0AAC2AADB-AADDABC0-ABE2AC00-D7A3D7B0-D7C6D7CB-D7FBF900-FA2DFA30-FA6DFA70-FAD9FB00-FB06FB13-FB17FB1DFB1F-FB28FB2A-FB36FB38-FB3CFB3EFB40FB41FB43FB44FB46-FBB1FBD3-FD3DFD50-FD8FFD92-FDC7FDF0-FDFBFE70-FE74FE76-FEFCFF21-FF3AFF41-FF5AFF66-FFBEFFC2-FFC7FFCA-FFCFFFD2-FFD7FFDA-FFDC",
/**
* A RegExp that matches the first letter in a word - unicode aware
*/
__unicodeFirstLetterInWordRegexp : null,
/**
* {Map} Cache for often used string operations [camelCasing and hyphenation]
* e.g. marginTop => margin-top
*/
__stringsMap : {
},
/**
* Converts a hyphenated string (separated by '-') to camel case.
*
* Example:
* <pre class='javascript'>qx.lang.String.camelCase("I-like-cookies"); //returns "ILikeCookies"</pre>
*
* @param str {String} hyphenated string
* @return {String} camelcase string
*/
camelCase : function(str){
var result = this.__stringsMap[str];
if(!result){
result = str.replace(/\-([a-z])/g, function(match, chr){
return chr.toUpperCase();
});
this.__stringsMap[str] = result;
};
return result;
},
/**
* Converts a camelcased string to a hyphenated (separated by '-') string.
*
* Example:
* <pre class='javascript'>qx.lang.String.hyphenate("weLikeCookies"); //returns "we-like-cookies"</pre>
*
* @param str {String} camelcased string
* @return {String} hyphenated string
*/
hyphenate : function(str){
var result = this.__stringsMap[str];
if(!result){
result = str.replace(/[A-Z]/g, function(match){
return ('-' + match.charAt(0).toLowerCase());
});
this.__stringsMap[str] = result;
};
return result;
},
/**
* Converts a string to camel case.
*
* Example:
* <pre class='javascript'>qx.lang.String.camelCase("i like cookies"); //returns "I Like Cookies"</pre>
*
* @param str {String} any string
* @return {String} capitalized string
*/
capitalize : function(str){
if(this.__unicodeFirstLetterInWordRegexp === null){
var unicodeEscapePrefix = '\\u';
this.__unicodeFirstLetterInWordRegexp = new RegExp("(^|[^" + this.__unicodeLetters.replace(/[0-9A-F]{4}/g, function(match){
return unicodeEscapePrefix + match;
}) + "])[" + this.__unicodeLetters.replace(/[0-9A-F]{4}/g, function(match){
return unicodeEscapePrefix + match;
}) + "]", "g");
};
return str.replace(this.__unicodeFirstLetterInWordRegexp, function(match){
return match.toUpperCase();
});
},
/**
* Removes all extraneous whitespace from a string and trims it
*
* Example:
*
* <code>
* qx.lang.String.clean(" i like cookies \n\n");
* </code>
*
* Returns "i like cookies"
*
* @param str {String} the string to clean up
* @return {String} Cleaned up string
*/
clean : function(str){
return str.replace(/\s+/g, ' ').trim();
},
/**
* removes white space from the left side of a string
*
* @param str {String} the string to trim
* @return {String} the trimmed string
*/
trimLeft : function(str){
return str.replace(/^\s+/, "");
},
/**
* removes white space from the right side of a string
*
* @param str {String} the string to trim
* @return {String} the trimmed string
*/
trimRight : function(str){
return str.replace(/\s+$/, "");
},
/**
* removes white space from the left and the right side of a string
*
* @deprecated {2.1} please use the native trim method.
* @param str {String} the string to trim
* @return {String} the trimmed string
*/
trim : function(str){
{
};
return str.replace(/^\s+|\s+$/g, "");
},
/**
* Check whether the string starts with the given substring
*
* @param fullstr {String} the string to search in
* @param substr {String} the substring to look for
* @return {Boolean} whether the string starts with the given substring
*/
startsWith : function(fullstr, substr){
return fullstr.indexOf(substr) === 0;
},
/**
* Check whether the string ends with the given substring
*
* @param fullstr {String} the string to search in
* @param substr {String} the substring to look for
* @return {Boolean} whether the string ends with the given substring
*/
endsWith : function(fullstr, substr){
return fullstr.substring(fullstr.length - substr.length, fullstr.length) === substr;
},
/**
* Returns a string, which repeats a string 'length' times
*
* @param str {String} string used to repeat
* @param times {Integer} the number of repetitions
* @return {String} repeated string
*/
repeat : function(str, times){
return str.length > 0 ? new Array(times + 1).join(str) : "";
},
/**
* Pad a string up to a given length. Padding characters are added to the left of the string.
*
* @param str {String} the string to pad
* @param length {Integer} the final length of the string
* @param ch {String} character used to fill up the string
* @return {String} padded string
*/
pad : function(str, length, ch){
var padLength = length - str.length;
if(padLength > 0){
if(typeof ch === "undefined"){
ch = "0";
};
return this.repeat(ch, padLength) + str;
} else {
return str;
};
},
/**
* Convert the first character of the string to upper case.
*
* @signature function(str)
* @param str {String} the string
* @return {String} the string with an upper case first character
*/
firstUp : qx.Bootstrap.firstUp,
/**
* Convert the first character of the string to lower case.
*
* @signature function(str)
* @param str {String} the string
* @return {String} the string with a lower case first character
*/
firstLow : qx.Bootstrap.firstLow,
/**
* Check whether the string contains a given substring
*
* @param str {String} the string
* @param substring {String} substring to search for
* @return {Boolean} whether the string contains the substring
*/
contains : function(str, substring){
return str.indexOf(substring) != -1;
},
/**
* Print a list of arguments using a format string
* In the format string occurrences of %n are replaced by the n'th element of the args list.
* Example:
* <pre class='javascript'>qx.lang.String.format("Hello %1, my name is %2", ["Egon", "Franz"]) == "Hello Egon, my name is Franz"</pre>
*
* @param pattern {String} format string
* @param args {Array} array of arguments to insert into the format string
* @return {String} the formatted string
*/
format : function(pattern, args){
var str = pattern;
var i = args.length;
while(i--){
// be sure to always use a string for replacement.
str = str.replace(new RegExp("%" + (i + 1), "g"), args[i] + "");
};
return str;
},
/**
* Escapes all chars that have a special meaning in regular expressions
*
* @param str {String} the string where to escape the chars.
* @return {String} the string with the escaped chars.
*/
escapeRegexpChars : function(str){
return str.replace(/([.*+?^${}()|[\]\/\\])/g, '\\$1');
},
/**
* Converts a string to an array of characters.
* <pre>"hello" => [ "h", "e", "l", "l", "o" ];</pre>
*
* @param str {String} the string which should be split
* @return {Array} the result array of characters
*/
toArray : function(str){
return str.split(/\B|\b/g);
},
/**
* Remove HTML/XML tags from a string
* Example:
* <pre class='javascript'>qx.lang.String.stripTags("<h1>Hello</h1>") == "Hello"</pre>
*
* @param str {String} string containing tags
* @return {String} the string with stripped tags
*/
stripTags : function(str){
return str.replace(/<\/?[^>]+>/gi, "");
},
/**
* Strips <script> tags including its content from the given string.
*
* @param str {String} string containing tags
* @param exec {Boolean?false} Whether the filtered code should be executed
* @return {String} The filtered string
*/
stripScripts : function(str, exec){
var scripts = "";
var text = str.replace(/<script[^>]*>([\s\S]*?)<\/script>/gi, function(){
scripts += arguments[1] + '\n';
return "";
});
if(exec === true){
qx.lang.Function.globalEval(scripts);
};
return text;
},
/**
* Quotes the given string.
* @param str {String} String to quote.
* @return {String} The quoted string.
*/
quote : function(str){
return '"' + str.replace(/\\/g, "\\\\").replace(/\"/g, "\\\"") + '"';
}
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2004-2011 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Martin Wittemann (martinwittemann)
************************************************************************ */
/* ************************************************************************
#ignore(WebKitCSSMatrix)
************************************************************************ */
/**
* The purpose of this class is to contain all checks about css.
*
* This class is used by {@link qx.core.Environment} and should not be used
* directly. Please check its class comment for details how to use it.
*
* @internal
*/
qx.Bootstrap.define("qx.bom.client.Css", {
statics : {
__WEBKIT_LEGACY_GRADIENT : null,
/**
* Checks what box model is used in the current environemnt.
* @return {String} It either returns "content" or "border".
* @internal
*/
getBoxModel : function(){
var content = qx.bom.client.Engine.getName() !== "mshtml" || !qx.bom.client.Browser.getQuirksMode();
return content ? "content" : "border";
},
/**
* Returns the (possibly vendor-prefixed) name the browser uses for the
* <code>textOverflow</code> style property.
*
* @return {String|null} textOverflow property name or <code>null</code> if
* textOverflow is not supported.
* @internal
*/
getTextOverflow : function(){
return qx.bom.Style.getPropertyName("textOverflow");
},
/**
* Checks if a placeholder could be used.
* @return {Boolean} <code>true</code>, if it could be used.
* @internal
*/
getPlaceholder : function(){
var i = document.createElement("input");
return "placeholder" in i;
},
/**
* Returns the (possibly vendor-prefixed) name the browser uses for the
* <code>appearance</code> style property.
*
* @return {String|null} appearance property name or <code>null</code> if
* appearance is not supported.
* @internal
*/
getAppearance : function(){
return qx.bom.Style.getPropertyName("appearance");
},
/**
* Returns the (possibly vendor-prefixed) name the browser uses for the
* <code>borderRadius</code> style property.
*
* @return {String|null} borderRadius property name or <code>null</code> if
* borderRadius is not supported.
* @internal
*/
getBorderRadius : function(){
return qx.bom.Style.getPropertyName("borderRadius");
},
/**
* Returns the (possibly vendor-prefixed) name the browser uses for the
* <code>boxShadow</code> style property.
*
* @return {String|null} boxShadow property name or <code>null</code> if
* boxShadow is not supported.
* @internal
*/
getBoxShadow : function(){
return qx.bom.Style.getPropertyName("boxShadow");
},
/**
* Returns the (possibly vendor-prefixed) name the browser uses for the
* <code>borderImage</code> style property.
*
* @return {String|null} borderImage property name or <code>null</code> if
* borderImage is not supported.
* @internal
*/
getBorderImage : function(){
return qx.bom.Style.getPropertyName("borderImage");
},
/**
* Returns the type of syntax this client supports for its CSS border-image
* implementation. Some browsers do not support the "fill" keyword defined
* in the W3C draft (http://www.w3.org/TR/css3-background/) and will not
* show the border image if it's set. Others follow the standard closely and
* will omit the center image if "fill" is not set.
*
* @return {Boolean|null} <code>true</code> if the standard syntax is supported.
* <code>null</code> if the supported syntax could not be detected.
* @internal
*/
getBorderImageSyntax : function(){
var styleName = qx.bom.client.Css.getBorderImage();
if(!styleName){
return null;
};
var el = document.createElement("div");
if(styleName === "borderImage"){
// unprefixed implementation: check individual properties
el.style[styleName] = 'url("foo.png") 4 4 4 4 fill stretch';
if(el.style.borderImageSource.indexOf("foo.png") >= 0 && el.style.borderImageSlice.indexOf("4 fill") >= 0 && el.style.borderImageRepeat.indexOf("stretch") >= 0){
return true;
};
} else {
// prefixed implementation, assume no support for "fill"
el.style[styleName] = 'url("foo.png") 4 4 4 4 stretch';
// serialized value is unreliable, so just a simple check
if(el.style[styleName].indexOf("foo.png") >= 0){
return false;
};
};
// unable to determine syntax
return null;
},
/**
* Returns the (possibly vendor-prefixed) name the browser uses for the
* <code>userSelect</code> style property.
*
* @return {String|null} userSelect property name or <code>null</code> if
* userSelect is not supported.
* @internal
*/
getUserSelect : function(){
return qx.bom.Style.getPropertyName("userSelect");
},
/**
* Returns the (possibly vendor-prefixed) value for the
* <code>userSelect</code> style property that disables selection. For Gecko,
* "-moz-none" is returned since "none" only makes the target element appear
* as if its text could not be selected
*
* @internal
* @return {String|null} the userSelect property value that disables
* selection or <code>null</code> if userSelect is not supported
*/
getUserSelectNone : function(){
var styleProperty = qx.bom.client.Css.getUserSelect();
if(styleProperty){
var el = document.createElement("span");
el.style[styleProperty] = "-moz-none";
return el.style[styleProperty] === "-moz-none" ? "-moz-none" : "none";
};
return null;
},
/**
* Returns the (possibly vendor-prefixed) name the browser uses for the
* <code>userModify</code> style property.
*
* @return {String|null} userModify property name or <code>null</code> if
* userModify is not supported.
* @internal
*/
getUserModify : function(){
return qx.bom.Style.getPropertyName("userModify");
},
/**
* Returns the vendor-specific name of the <code>float</code> style property
*
* @return {String|null} <code>cssFloat</code> for standards-compliant
* browsers, <code>styleFloat</code> for legacy IEs, <code>null</code> if
* the client supports neither property.
* @internal
*/
getFloat : function(){
var style = document.documentElement.style;
return style.cssFloat !== undefined ? "cssFloat" : style.styleFloat !== undefined ? "styleFloat" : null;
},
/**
* Checks if translate3d can be used.
* @return {Boolean} <code>true</code>, if it could be used.
* @internal
* @lint ignoreUndefined(WebKitCSSMatrix)
*/
getTranslate3d : function(){
return 'WebKitCSSMatrix' in window && 'm11' in new WebKitCSSMatrix();
},
/**
* Returns the (possibly vendor-prefixed) name this client uses for
* <code>linear-gradient</code>.
* http://dev.w3.org/csswg/css3-images/#linear-gradients
*
* @return {String|null} Prefixed linear-gradient name or <code>null</code>
* if linear gradients are not supported
* @internal
*/
getLinearGradient : function(){
qx.bom.client.Css.__WEBKIT_LEGACY_GRADIENT = false;
var value = "linear-gradient(0deg, #fff, #000)";
var el = document.createElement("div");
var style = qx.bom.Style.getAppliedStyle(el, "backgroundImage", value);
if(!style){
//try old WebKit syntax (versions 528 - 534.16)
value = "-webkit-gradient(linear,0% 0%,100% 100%,from(white), to(red))";
var style = qx.bom.Style.getAppliedStyle(el, "backgroundImage", value, false);
if(style){
qx.bom.client.Css.__WEBKIT_LEGACY_GRADIENT = true;
};
};
// not supported
if(!style){
return null;
};
var match = /(.*?)\(/.exec(style);
return match ? match[1] : null;
},
/**
* Returns <code>true</code> if the browser supports setting gradients
* using the filter style. This usually only applies for IE browsers
* starting from IE5.5.
* http://msdn.microsoft.com/en-us/library/ms532997(v=vs.85).aspx
*
* @return {Boolean} <code>true</code> if supported.
* @internal
*/
getFilterGradient : function(){
return qx.bom.client.Css.__isFilterSupported("DXImageTransform.Microsoft.Gradient", "startColorStr=#550000FF, endColorStr=#55FFFF00");
},
/**
* Returns the (possibly vendor-prefixed) name this client uses for
* <code>radial-gradient</code>.
*
* @return {String|null} Prefixed radial-gradient name or <code>null</code>
* if radial gradients are not supported
* @internal
*/
getRadialGradient : function(){
var value = "radial-gradient(0px 0px, cover, red 50%, blue 100%)";
var el = document.createElement("div");
var style = qx.bom.Style.getAppliedStyle(el, "backgroundImage", value);
if(!style){
return null;
};
var match = /(.*?)\(/.exec(style);
return match ? match[1] : null;
},
/**
* Checks if **only** the old WebKit (version < 534.16) syntax for
* linear gradients is supported, e.g.
* <code>linear-gradient(0deg, #fff, #000)</code>
*
* @return {Boolean} <code>true</code> if the legacy syntax must be used
* @internal
*/
getLegacyWebkitGradient : function(){
if(qx.bom.client.Css.__WEBKIT_LEGACY_GRADIENT === null){
qx.bom.client.Css.getLinearGradient();
};
return qx.bom.client.Css.__WEBKIT_LEGACY_GRADIENT;
},
/**
* Checks if rgba colors can be used:
* http://www.w3.org/TR/2010/PR-css3-color-20101028/#rgba-color
*
* @return {Boolean} <code>true</code>, if rgba colors are supported.
* @internal
*/
getRgba : function(){
var el;
try{
el = document.createElement("div");
} catch(ex) {
el = document.createElement();
};
// try catch for IE
try{
el.style["color"] = "rgba(1, 2, 3, 0.5)";
if(el.style["color"].indexOf("rgba") != -1){
return true;
};
} catch(ex) {
};
return false;
},
/**
* Returns the (possibly vendor-prefixed) name the browser uses for the
* <code>boxSizing</code> style property.
*
* @return {String|null} boxSizing property name or <code>null</code> if
* boxSizing is not supported.
* @internal
*/
getBoxSizing : function(){
return qx.bom.Style.getPropertyName("boxSizing");
},
/**
* Returns the browser-specific name used for the <code>display</code> style
* property's <code>inline-block</code> value.
*
* @internal
* @return {String|null}
*/
getInlineBlock : function(){
var el = document.createElement("span");
el.style.display = "inline-block";
if(el.style.display == "inline-block"){
return "inline-block";
};
el.style.display = "-moz-inline-box";
if(el.style.display !== "-moz-inline-box"){
return "-moz-inline-box";
};
return null;
},
/**
* Checks if CSS opacity is supported
*
* @internal
* @return {Boolean} <code>true</code> if opacity is supported
*/
getOpacity : function(){
return (typeof document.documentElement.style.opacity == "string");
},
/**
* Checks if the overflowX and overflowY style properties are supported
*
* @internal
* @return {Boolean} <code>true</code> if overflow-x and overflow-y can be
* used
* @deprecated {2.1}
*/
getOverflowXY : function(){
return (typeof document.documentElement.style.overflowX == "string") && (typeof document.documentElement.style.overflowY == "string");
},
/**
* Checks if CSS texShadow is supported
*
* @internal
* @return {Boolean} <code>true</code> if textShadow is supported
*/
getTextShadow : function(){
return !!qx.bom.Style.getPropertyName("textShadow");
},
/**
* Returns <code>true</code> if the browser supports setting text shadow
* using the filter style. This usually only applies for IE browsers
* starting from IE5.5.
*
* @internal
* @return {Boolean} <code>true</code> if textShadow is supported
*/
getFilterTextShadow : function(){
return qx.bom.client.Css.__isFilterSupported("DXImageTransform.Microsoft.Shadow", "color=#666666,direction=45");
},
/**
* Checks if the given filter is supported.
*
* @param filterClass {String} The name of the filter class
* @param initParams {String} Init values for the filter
* @return {Boolean} <code>true</code> if the given filter is supported
*/
__isFilterSupported : function(filterClass, initParams){
var supported = false;
var value = "progid:" + filterClass + "(" + initParams + ");";
var el = document.createElement("div");
document.body.appendChild(el);
el.style.filter = value;
if(el.filters && el.filters.length > 0 && el.filters.item(filterClass).enabled == true){
supported = true;
};
document.body.removeChild(el);
return supported;
}
},
defer : function(statics){
qx.core.Environment.add("css.textoverflow", statics.getTextOverflow);
qx.core.Environment.add("css.placeholder", statics.getPlaceholder);
qx.core.Environment.add("css.borderradius", statics.getBorderRadius);
qx.core.Environment.add("css.boxshadow", statics.getBoxShadow);
qx.core.Environment.add("css.gradient.linear", statics.getLinearGradient);
qx.core.Environment.add("css.gradient.filter", statics.getFilterGradient);
qx.core.Environment.add("css.gradient.radial", statics.getRadialGradient);
qx.core.Environment.add("css.gradient.legacywebkit", statics.getLegacyWebkitGradient);
qx.core.Environment.add("css.boxmodel", statics.getBoxModel);
qx.core.Environment.add("css.rgba", statics.getRgba);
qx.core.Environment.add("css.borderimage", statics.getBorderImage);
qx.core.Environment.add("css.borderimage.standardsyntax", statics.getBorderImageSyntax);
qx.core.Environment.add("css.usermodify", statics.getUserModify);
qx.core.Environment.add("css.userselect", statics.getUserSelect);
qx.core.Environment.add("css.userselect.none", statics.getUserSelectNone);
qx.core.Environment.add("css.appearance", statics.getAppearance);
qx.core.Environment.add("css.float", statics.getFloat);
qx.core.Environment.add("css.boxsizing", statics.getBoxSizing);
qx.core.Environment.add("css.inlineblock", statics.getInlineBlock);
qx.core.Environment.add("css.opacity", statics.getOpacity);
qx.core.Environment.add("css.overflowxy", statics.getOverflowXY);
qx.core.Environment.add("css.textShadow", statics.getTextShadow);
qx.core.Environment.add("css.textShadow.filter", statics.getFilterTextShadow);
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2004-2011 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Martin Wittemann (martinwittemann)
* Sebastian Fastner (fastner)
************************************************************************ */
/**
* This class is responsible for checking the operating systems name.
*
* This class is used by {@link qx.core.Environment} and should not be used
* directly. Please check its class comment for details how to use it.
*
* @internal
*/
qx.Bootstrap.define("qx.bom.client.OperatingSystem", {
statics : {
/**
* Checks for the name of the operating system.
* @return {String} The name of the operating system.
* @internal
*/
getName : function(){
if(!navigator){
return "";
};
var input = navigator.platform || "";
var agent = navigator.userAgent || "";
if(input.indexOf("Windows") != -1 || input.indexOf("Win32") != -1 || input.indexOf("Win64") != -1){
return "win";
} else if(input.indexOf("Macintosh") != -1 || input.indexOf("MacPPC") != -1 || input.indexOf("MacIntel") != -1 || input.indexOf("Mac OS X") != -1){
return "osx";
} else if(agent.indexOf("RIM Tablet OS") != -1){
return "rim_tabletos";
} else if(agent.indexOf("webOS") != -1){
return "webos";
} else if(input.indexOf("iPod") != -1 || input.indexOf("iPhone") != -1 || input.indexOf("iPad") != -1){
return "ios";
} else if(agent.indexOf("Android") != -1){
return "android";
} else if(input.indexOf("Linux") != -1){
return "linux";
} else if(input.indexOf("X11") != -1 || input.indexOf("BSD") != -1 || input.indexOf("Darwin") != -1){
return "unix";
} else if(input.indexOf("SymbianOS") != -1){
return "symbian";
} else if(input.indexOf("BlackBerry") != -1){
return "blackberry";
};;;;;;;;;
// don't know
return "";
},
/** Maps user agent names to system IDs */
__ids : {
// Windows
"Windows NT 6.2" : "8",
"Windows NT 6.1" : "7",
"Windows NT 6.0" : "vista",
"Windows NT 5.2" : "2003",
"Windows NT 5.1" : "xp",
"Windows NT 5.0" : "2000",
"Windows 2000" : "2000",
"Windows NT 4.0" : "nt4",
"Win 9x 4.90" : "me",
"Windows CE" : "ce",
"Windows 98" : "98",
"Win98" : "98",
"Windows 95" : "95",
"Win95" : "95",
// OS X
"Mac OS X 10_7" : "10.7",
"Mac OS X 10.7" : "10.7",
"Mac OS X 10_6" : "10.6",
"Mac OS X 10.6" : "10.6",
"Mac OS X 10_5" : "10.5",
"Mac OS X 10.5" : "10.5",
"Mac OS X 10_4" : "10.4",
"Mac OS X 10.4" : "10.4",
"Mac OS X 10_3" : "10.3",
"Mac OS X 10.3" : "10.3",
"Mac OS X 10_2" : "10.2",
"Mac OS X 10.2" : "10.2",
"Mac OS X 10_1" : "10.1",
"Mac OS X 10.1" : "10.1",
"Mac OS X 10_0" : "10.0",
"Mac OS X 10.0" : "10.0"
},
/**
* Checks for the version of the operating system using the internal map.
*
* @internal
* @return {String} The version as strin or an empty string if the version
* could not be detected.
*/
getVersion : function(){
var version = qx.bom.client.OperatingSystem.__getVersionForDesktopOs(navigator.userAgent);
if(version == null){
version = qx.bom.client.OperatingSystem.__getVersionForMobileOs(navigator.userAgent);
};
if(version != null){
return version;
} else {
return "";
};
},
/**
* Detect OS version for desktop devices
* @param userAgent {String} userAgent parameter, needed for detection.
* @return {String} version number as string or null.
*/
__getVersionForDesktopOs : function(userAgent){
var str = [];
for(var key in qx.bom.client.OperatingSystem.__ids){
str.push(key);
};
var reg = new RegExp("(" + str.join("|").replace(/\./g, "\.") + ")", "g");
var match = reg.exec(userAgent);
if(match && match[1]){
return qx.bom.client.OperatingSystem.__ids[match[1]];
};
return null;
},
/**
* Detect OS version for mobile devices
* @param userAgent {String} userAgent parameter, needed for detection.
* @return {String} version number as string or null.
*/
__getVersionForMobileOs : function(userAgent){
var android = userAgent.indexOf("Android") != -1;
var iOs = userAgent.match(/(iPad|iPhone|iPod)/i) ? true : false;
if(android){
var androidVersionRegExp = new RegExp(/ Android (\d+(?:\.\d+)+)/i);
var androidMatch = androidVersionRegExp.exec(userAgent);
if(androidMatch && androidMatch[1]){
return androidMatch[1];
};
} else if(iOs){
var iOsVersionRegExp = new RegExp(/(CPU|iPhone|iPod) OS (\d+)_(\d+)\s+/);
var iOsMatch = iOsVersionRegExp.exec(userAgent);
if(iOsMatch && iOsMatch[2] && iOsMatch[3]){
return iOsMatch[2] + "." + iOsMatch[3];
};
};
return null;
}
},
defer : function(statics){
qx.core.Environment.add("os.name", statics.getName);
qx.core.Environment.add("os.version", statics.getVersion);
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2004-2009 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Christian Hagendorn (chris_schmidt)
* Martin Wittemann (martinwittemann)
======================================================================
This class contains code from:
Copyright:
2009 Deutsche Telekom AG, Germany, http://telekom.com
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
Authors:
* Sebastian Werner (wpbasti)
======================================================================
This class contains code from:
Copyright:
2011 Pocket Widget S.L., Spain, http://www.pocketwidget.com
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
Authors:
* Javier Martinez Villacampa
************************************************************************ */
/**
#require(qx.bom.client.OperatingSystem#getVersion)
*/
/**
* Basic browser detection for qooxdoo.
*
* This class is used by {@link qx.core.Environment} and should not be used
* directly. Please check its class comment for details how to use it.
*
* @internal
*/
qx.Bootstrap.define("qx.bom.client.Browser", {
statics : {
/**
* Checks for the name of the browser and returns it.
* @return {String} The name of the current browser.
* @internal
*/
getName : function(){
var agent = navigator.userAgent;
var reg = new RegExp("(" + qx.bom.client.Browser.__agents + ")(/| )([0-9]+\.[0-9])");
var match = agent.match(reg);
if(!match){
return "";
};
var name = match[1].toLowerCase();
var engine = qx.bom.client.Engine.getName();
if(engine === "webkit"){
if(name === "android"){
// Fix Chrome name (for instance wrongly defined in user agent on Android 1.6)
name = "mobile chrome";
} else if(agent.indexOf("Mobile Safari") !== -1 || agent.indexOf("Mobile/") !== -1){
// Fix Safari name
name = "mobile safari";
};
} else if(engine === "mshtml"){
if(name === "msie"){
name = "ie";
// Fix IE mobile before Microsoft added IEMobile string
if(qx.bom.client.OperatingSystem.getVersion() === "ce"){
name = "iemobile";
};
};
} else if(engine === "opera"){
if(name === "opera mobi"){
name = "operamobile";
} else if(name === "opera mini"){
name = "operamini";
};
} else if(engine === "gecko"){
if(agent.indexOf("Maple") !== -1){
name = "maple";
};
};;;
return name;
},
/**
* Determines the version of the current browser.
* @return {String} The name of the current browser.
* @internal
*/
getVersion : function(){
var agent = navigator.userAgent;
var reg = new RegExp("(" + qx.bom.client.Browser.__agents + ")(/| )([0-9]+\.[0-9])");
var match = agent.match(reg);
if(!match){
return "";
};
var name = match[1].toLowerCase();
var version = match[3];
// Support new style version string used by Opera and Safari
if(agent.match(/Version(\/| )([0-9]+\.[0-9])/)){
version = RegExp.$2;
};
if(qx.bom.client.Engine.getName() == "mshtml"){
// Use the Engine version, because IE8 and higher change the user agent
// string to an older version in compatibility mode
version = qx.bom.client.Engine.getVersion();
if(name === "msie" && qx.bom.client.OperatingSystem.getVersion() == "ce"){
// Fix IE mobile before Microsoft added IEMobile string
version = "5.0";
};
};
if(qx.bom.client.Browser.getName() == "maple"){
// Fix version detection for Samsung Smart TVs Maple browser from 2010 and 2011 models
reg = new RegExp("(Maple )([0-9]+\.[0-9]+\.[0-9]*)");
match = agent.match(reg);
if(!match){
return "";
};
version = match[2];
};
return version;
},
/**
* Returns in which document mode the current document is (only for IE).
*
* @internal
* @return {Number} The mode in which the browser is.
*/
getDocumentMode : function(){
if(document.documentMode){
return document.documentMode;
};
return 0;
},
/**
* Check if in quirks mode.
*
* @internal
* @return {Boolean} <code>true</code>, if the environment is in quirks mode
*/
getQuirksMode : function(){
if(qx.bom.client.Engine.getName() == "mshtml" && parseFloat(qx.bom.client.Engine.getVersion()) >= 8){
return qx.bom.client.Engine.DOCUMENT_MODE === 5;
} else {
return document.compatMode !== "CSS1Compat";
};
},
/**
* Internal helper map for picking the right browser names to check.
*/
__agents : {
// Safari should be the last one to check, because some other Webkit-based browsers
// use this identifier together with their own one.
// "Version" is used in Safari 4 to define the Safari version. After "Safari" they place the
// Webkit version instead. Silly.
// Palm Pre uses both Safari (contains Webkit version) and "Version" contains the "Pre" version. But
// as "Version" is not Safari here, we better detect this as the Pre-Browser version. So place
// "Pre" in front of both "Version" and "Safari".
"webkit" : "AdobeAIR|Titanium|Fluid|Chrome|Android|Epiphany|Konqueror|iCab|OmniWeb|Maxthon|Pre|Mobile Safari|Safari",
// Better security by keeping Firefox the last one to match
"gecko" : "prism|Fennec|Camino|Kmeleon|Galeon|Netscape|SeaMonkey|Namoroka|Firefox",
// No idea what other browsers based on IE's engine
"mshtml" : "IEMobile|Maxthon|MSIE",
// Keep "Opera" the last one to correctly prefer/match the mobile clients
"opera" : "Opera Mini|Opera Mobi|Opera"
}[qx.bom.client.Engine.getName()]
},
defer : function(statics){
qx.core.Environment.add("browser.name", statics.getName),qx.core.Environment.add("browser.version", statics.getVersion),qx.core.Environment.add("browser.documentmode", statics.getDocumentMode),qx.core.Environment.add("browser.quirksmode", statics.getQuirksMode);
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2004-2011 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Martin Wittemann (wittemann)
* Daniel Wagner (danielwagner)
************************************************************************ */
/**
* Responsible class for everything concerning styles without the need of
* an element.
*
* If you want to query or modify styles of HTML elements,
* take a look at {@link qx.bom.element.Style}.
*/
qx.Bootstrap.define("qx.bom.Style", {
statics : {
/** Vendor-specific style property prefixes */
VENDOR_PREFIXES : ["Webkit", "Moz", "O", "ms", "Khtml"],
/**
* Internal lookup table to map property names to CSS names
* @internal
*/
__cssName : {
},
/**
* Takes the name of a style property and returns the name the browser uses
* for its implementation, which might include a vendor prefix.
*
* @param propertyName {String} Style property name to check
* @return {String|null} The supported property name or <code>null</code> if
* not supported
*/
getPropertyName : function(propertyName){
var style = document.documentElement.style;
if(style[propertyName] !== undefined){
return propertyName;
};
for(var i = 0,l = this.VENDOR_PREFIXES.length;i < l;i++){
var prefixedProp = this.VENDOR_PREFIXES[i] + qx.lang.String.firstUp(propertyName);
if(style[prefixedProp] !== undefined){
return prefixedProp;
};
};
return null;
},
/**
* Takes the name of a JavaScript style property and returns the
* corresponding CSS name.
*
* The name of the style property is taken as is, i.e. it gets not
* extended by vendor prefixes. The conversion into the CSS name is
* done by string manipulation, not involving the DOM.
*
* Example:
* <pre class='javascript'>qx.bom.Style.getCssName("MozTransform"); //returns "-moz-transform"</pre>
*
* @param propertyName {String} JavaScript style property
* @return {String} CSS property
*/
getCssName : function(propertyName){
var cssName = this.__cssName[propertyName];
if(!cssName){
// all vendor prefixes (except for "ms") start with an uppercase letter
cssName = propertyName.replace(/[A-Z]/g, function(match){
return ('-' + match.charAt(0).toLowerCase());
});
// lowercase "ms" vendor prefix needs special handling
if((/^ms/.test(cssName))){
cssName = "-" + cssName;
};
this.__cssName[propertyName] = cssName;
};
return cssName;
},
/**
* Detects CSS support by applying a style to a DOM element of the given type
* and verifying the result. Also checks for vendor-prefixed variants of the
* value, e.g. "linear-gradient" -> "-webkit-linear-gradient". Returns the
* (possibly vendor-prefixed) value if successful or <code>null</code> if
* the property and/or value are not supported.
*
* @param element {Element} element to be used for the detection
* @param propertyName {String} the style property to be tested
* @param value {String} style property value to be tested
* @param prefixed {Boolean?} try to determine the appropriate vendor prefix
* for the value. Default: <code>true</code>
* @return {String|null} prefixed style value or <code>null</code> if not supported
* @internal
*/
getAppliedStyle : function(element, propertyName, value, prefixed){
var vendorPrefixes = (prefixed !== false) ? [null].concat(this.VENDOR_PREFIXES) : [null];
for(var i = 0,l = vendorPrefixes.length;i < l;i++){
var prefixedVal = vendorPrefixes[i] ? "-" + vendorPrefixes[i].toLowerCase() + "-" + value : value;
// IE might throw an exception
try{
element.style[propertyName] = prefixedVal;
if(typeof element.style[propertyName] == "string" && element.style[propertyName] !== ""){
return prefixedVal;
};
} catch(ex) {
};
};
return null;
}
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2004-2008 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Sebastian Werner (wpbasti)
* Christian Hagendorn (chris_schmidt)
======================================================================
This class contains code based on the following work:
* Prototype JS
http://www.prototypejs.org/
Version 1.5
Copyright:
(c) 2006-2007, Prototype Core Team
License:
MIT: http://www.opensource.org/licenses/mit-license.php
Authors:
* Prototype Core Team
----------------------------------------------------------------------
Copyright (c) 2005-2008 Sam Stephenson
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
************************************************************************ */
/**
* Cross-browser opacity support.
*
* Optimized for animations (contains workarounds for typical flickering
* in some browsers). Reduced class dependencies for optimal size and
* performance.
*/
qx.Bootstrap.define("qx.bom.element.Opacity", {
statics : {
/**
* {Boolean} <code>true</code> when the style attribute "opacity" is supported,
* <code>false</code> otherwise.
* @deprecated {2.1} Please use qx.core.Environment.get("css.opacity") instead.
*/
SUPPORT_CSS3_OPACITY : false,
/**
* Compiles the given opacity value into a cross-browser CSS string.
* Accepts numbers between zero and one
* where "0" means transparent, "1" means opaque.
*
* @signature function(opacity)
* @param opacity {Float} A float number between 0 and 1
* @return {String} CSS compatible string
*/
compile : qx.core.Environment.select("engine.name", {
"mshtml" : function(opacity){
if(opacity >= 1){
opacity = 1;
};
if(opacity < 0.00001){
opacity = 0;
};
if(qx.core.Environment.get("css.opacity")){
return "opacity:" + opacity + ";";
} else {
return "zoom:1;filter:alpha(opacity=" + (opacity * 100) + ");";
};
},
"default" : function(opacity){
if(opacity >= 1){
return "";
};
return "opacity:" + opacity + ";";
}
}),
/**
* Sets opacity of given element. Accepts numbers between zero and one
* where "0" means transparent, "1" means opaque.
*
* @param element {Element} DOM element to modify
* @param opacity {Float} A float number between 0 and 1
* @signature function(element, opacity)
*/
set : qx.core.Environment.select("engine.name", {
"mshtml" : function(element, opacity){
if(qx.core.Environment.get("css.opacity")){
if(opacity >= 1){
opacity = "";
};
element.style.opacity = opacity;
} else {
// Read in computed filter
var filter = qx.bom.element.Style.get(element, "filter", qx.bom.element.Style.COMPUTED_MODE, false);
if(opacity >= 1){
opacity = 1;
};
if(opacity < 0.00001){
opacity = 0;
};
// IE has trouble with opacity if it does not have layout (hasLayout)
// Force it by setting the zoom level
if(!element.currentStyle || !element.currentStyle.hasLayout){
element.style.zoom = 1;
};
// Remove old alpha filter and add new one
element.style.filter = filter.replace(/alpha\([^\)]*\)/gi, "") + "alpha(opacity=" + opacity * 100 + ")";
};
},
"default" : function(element, opacity){
if(opacity >= 1){
opacity = "";
};
element.style.opacity = opacity;
}
}),
/**
* Resets opacity of given element.
*
* @param element {Element} DOM element to modify
* @signature function(element)
*/
reset : qx.core.Environment.select("engine.name", {
"mshtml" : function(element){
if(qx.core.Environment.get("css.opacity")){
element.style.opacity = "";
} else {
// Read in computed filter
var filter = qx.bom.element.Style.get(element, "filter", qx.bom.element.Style.COMPUTED_MODE, false);
// Remove old alpha filter
element.style.filter = filter.replace(/alpha\([^\)]*\)/gi, "");
};
},
"default" : function(element){
element.style.opacity = "";
}
}),
/**
* Gets computed opacity of given element. Accepts numbers between zero and one
* where "0" means transparent, "1" means opaque.
*
* @param element {Element} DOM element to modify
* @param mode {Number} Choose one of the modes {@link qx.bom.element.Style#COMPUTED_MODE},
* {@link qx.bom.element.Style#CASCADED_MODE}, {@link qx.bom.element.Style#LOCAL_MODE}.
* The computed mode is the default one.
* @return {Float} A float number between 0 and 1
* @signature function(element, mode)
*/
get : qx.core.Environment.select("engine.name", {
"mshtml" : function(element, mode){
if(qx.core.Environment.get("css.opacity")){
var opacity = qx.bom.element.Style.get(element, "opacity", mode, false);
if(opacity != null){
return parseFloat(opacity);
};
return 1.0;
} else {
var filter = qx.bom.element.Style.get(element, "filter", mode, false);
if(filter){
var opacity = filter.match(/alpha\(opacity=(.*)\)/);
if(opacity && opacity[1]){
return parseFloat(opacity[1]) / 100;
};
};
return 1.0;
};
},
"default" : function(element, mode){
var opacity = qx.bom.element.Style.get(element, "opacity", mode, false);
if(opacity != null){
return parseFloat(opacity);
};
return 1.0;
}
})
},
// @deprecated {2.1}
defer : function(statics){
statics.SUPPORT_CSS3_OPACITY = qx.core.Environment.get("css.opacity");
}
});
{
};
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2004-2008 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Sebastian Werner (wpbasti)
************************************************************************ */
/* ************************************************************************
#require(qx.lang.normalize.String)
************************************************************************ */
/**
* Contains methods to control and query the element's clip property
*/
qx.Bootstrap.define("qx.bom.element.Clip", {
/*
*****************************************************************************
STATICS
*****************************************************************************
*/
statics : {
/**
* Compiles the given clipping into a CSS compatible string. This
* is a simple square which describes the visible area of an DOM element.
* Changing the clipping does not change the dimensions of
* an element.
*
* @param map {Map} Map which contains <code>left</code>, <code>top</code>
* <code>width</code> and <code>height</code> of the clipped area.
* @return {String} CSS compatible string
*/
compile : function(map){
if(!map){
return "clip:auto;";
};
var left = map.left;
var top = map.top;
var width = map.width;
var height = map.height;
var right,bottom;
if(left == null){
right = (width == null ? "auto" : width + "px");
left = "auto";
} else {
right = (width == null ? "auto" : left + width + "px");
left = left + "px";
};
if(top == null){
bottom = (height == null ? "auto" : height + "px");
top = "auto";
} else {
bottom = (height == null ? "auto" : top + height + "px");
top = top + "px";
};
return "clip:rect(" + top + "," + right + "," + bottom + "," + left + ");";
},
/**
* Gets the clipping of the given element.
*
* @param element {Element} DOM element to query
* @param mode {Number} Choose one of the modes {@link qx.bom.element.Style#COMPUTED_MODE},
* {@link qx.bom.element.Style#CASCADED_MODE}, {@link qx.bom.element.Style#LOCAL_MODE}.
* The computed mode is the default one.
* @return {Map} Map which contains <code>left</code>, <code>top</code>
* <code>width</code> and <code>height</code> of the clipped area.
* Each one could be null or any integer value.
*/
get : function(element, mode){
var clip = qx.bom.element.Style.get(element, "clip", mode, false);
var left,top,width,height;
var right,bottom;
if(typeof clip === "string" && clip !== "auto" && clip !== ""){
clip = clip.trim();
// Do not use "global" here. This will break Firefox because of
// an issue that the lastIndex will not be resetted on separate calls.
if(/\((.*)\)/.test(clip)){
var result = RegExp.$1;
// Process result
// Some browsers store values space-separated, others comma-separated.
// Handle both cases by means of feature-detection.
if(/,/.test(result)){
var split = result.split(",");
} else {
var split = result.split(" ");
};
top = split[0].trim();
right = split[1].trim();
bottom = split[2].trim();
left = split[3].trim();
// Normalize "auto" to null
if(left === "auto"){
left = null;
};
if(top === "auto"){
top = null;
};
if(right === "auto"){
right = null;
};
if(bottom === "auto"){
bottom = null;
};
// Convert to integer values
if(top != null){
top = parseInt(top, 10);
};
if(right != null){
right = parseInt(right, 10);
};
if(bottom != null){
bottom = parseInt(bottom, 10);
};
if(left != null){
left = parseInt(left, 10);
};
// Compute width and height
if(right != null && left != null){
width = right - left;
} else if(right != null){
width = right;
};
if(bottom != null && top != null){
height = bottom - top;
} else if(bottom != null){
height = bottom;
};
} else {
throw new Error("Could not parse clip string: " + clip);
};
};
// Return map when any value is available.
return {
left : left || null,
top : top || null,
width : width || null,
height : height || null
};
},
/**
* Sets the clipping of the given element. This is a simple
* square which describes the visible area of an DOM element.
* Changing the clipping does not change the dimensions of
* an element.
*
* @param element {Element} DOM element to modify
* @param map {Map} A map with one or more of these available keys:
* <code>left</code>, <code>top</code>, <code>width</code>, <code>height</code>.
*/
set : function(element, map){
if(!map){
element.style.clip = "rect(auto,auto,auto,auto)";
return;
};
var left = map.left;
var top = map.top;
var width = map.width;
var height = map.height;
var right,bottom;
if(left == null){
right = (width == null ? "auto" : width + "px");
left = "auto";
} else {
right = (width == null ? "auto" : left + width + "px");
left = left + "px";
};
if(top == null){
bottom = (height == null ? "auto" : height + "px");
top = "auto";
} else {
bottom = (height == null ? "auto" : top + height + "px");
top = top + "px";
};
element.style.clip = "rect(" + top + "," + right + "," + bottom + "," + left + ")";
},
/**
* Resets the clipping of the given DOM element.
*
* @param element {Element} DOM element to modify
*/
reset : function(element){
element.style.clip = "rect(auto, auto, auto, auto)";
}
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2004-2008 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Sebastian Werner (wpbasti)
************************************************************************ */
/**
* Contains methods to control and query the element's cursor property
*/
qx.Bootstrap.define("qx.bom.element.Cursor", {
/*
*****************************************************************************
STATICS
*****************************************************************************
*/
statics : {
/** Internal helper structure to map cursor values to supported ones */
__map : {
},
/**
* Compiles the given cursor into a CSS compatible string.
*
* @param cursor {String} Valid CSS cursor name
* @return {String} CSS string
*/
compile : function(cursor){
return "cursor:" + (this.__map[cursor] || cursor) + ";";
},
/**
* Returns the computed cursor style for the given element.
*
* @param element {Element} The element to query
* @param mode {Number} Choose one of the modes {@link qx.bom.element.Style#COMPUTED_MODE},
* {@link qx.bom.element.Style#CASCADED_MODE}, {@link qx.bom.element.Style#LOCAL_MODE}.
* The computed mode is the default one.
* @return {String} Computed cursor value of the given element.
*/
get : function(element, mode){
return qx.bom.element.Style.get(element, "cursor", mode, false);
},
/**
* Applies a new cursor style to the given element
*
* @param element {Element} The element to modify
* @param value {String} New cursor value to set
*/
set : function(element, value){
element.style.cursor = this.__map[value] || value;
},
/**
* Removes the local cursor style applied to the element
*
* @param element {Element} The element to modify
*/
reset : function(element){
element.style.cursor = "";
}
},
defer : function(statics){
// < IE 9
if(qx.core.Environment.get("engine.name") == "mshtml" && ((parseFloat(qx.core.Environment.get("engine.version")) < 9 || qx.core.Environment.get("browser.documentmode") < 9) && !qx.core.Environment.get("browser.quirksmode"))){
statics.__map["nesw-resize"] = "ne-resize";
statics.__map["nwse-resize"] = "nw-resize";
// < IE 8
if(((parseFloat(qx.core.Environment.get("engine.version")) < 8 || qx.core.Environment.get("browser.documentmode") < 8) && !qx.core.Environment.get("browser.quirksmode"))){
statics.__map["ew-resize"] = "e-resize";
statics.__map["ns-resize"] = "n-resize";
};
} else if(qx.core.Environment.get("engine.name") == "opera" && parseInt(qx.core.Environment.get("engine.version")) < 12){
statics.__map["nesw-resize"] = "ne-resize";
statics.__map["nwse-resize"] = "nw-resize";
};
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2004-2012 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Martin Wittemann (wittemann)
************************************************************************ */
/**
* This class takes care of the normalization of the native 'Object' object.
* Therefore it checks the availability of the following methods and appends
* it, if not available. This means you can use the methods during
* development in every browser. For usage samples, check out the attached links.
*
* *keys*:
* <a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object/keys">MDN documentation</a> |
* <a href="http://es5.github.com/#x15.2.3.14">Annotated ES5 Spec</a>
*/
qx.Bootstrap.define("qx.lang.normalize.Object", {
defer : function(){
// keys
if(!qx.core.Environment.get("ecmascript.object.keys")){
Object.keys = qx.Bootstrap.keys;
};
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2004-2008 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Sebastian Werner (wpbasti)
* Andreas Ecker (ecker)
************************************************************************ */
/* ************************************************************************
#require(qx.lang.normalize.Object)
************************************************************************ */
/**
* Helper functions to handle Object as a Hash map.
*/
qx.Bootstrap.define("qx.lang.Object", {
statics : {
/**
* Clears the map from all values
*
* @param map {Object} the map to clear
*/
empty : function(map){
{
};
for(var key in map){
if(map.hasOwnProperty(key)){
delete map[key];
};
};
},
/**
* Check if the hash has any keys
*
* @signature function(map)
* @param map {Object} the map to check
* @return {Boolean} whether the map has any keys
* @lint ignoreUnused(key)
*/
isEmpty : function(map){
{
};
for(var key in map){
return false;
};
return true;
},
/**
* Check whether the number of objects in the maps is at least "length"
*
* @signature function(map, minLength)
* @param map {Object} the map to check
* @param minLength {Integer} minimum number of objects in the map
* @deprecated {2.1} Please use a check and 'qx.lang.Object.getLength'.
* @return {Boolean} whether the map contains at least "length" objects.
* @lint ignoreUnused(key)
*/
hasMinLength : function(map, minLength){
{
};
if(minLength <= 0){
return true;
};
var length = 0;
for(var key in map){
if((++length) >= minLength){
return true;
};
};
return false;
},
/**
* Get the number of objects in the map
*
* @signature function(map)
* @param map {Object} the map
* @return {Integer} number of objects in the map
*/
getLength : qx.Bootstrap.objectGetLength,
/**
* Get the keys of a map as array as returned by a "for ... in" statement.
*
* @deprecated {2.1.} Please use Object.keys instead.
* @signature function(map)
* @param map {Object} the map
* @return {Array} array of the keys of the map
*/
getKeys : qx.Bootstrap.getKeys,
/**
* Get the keys of a map as string
*
* @signature function(map)
* @param map {Object} the map
* @deprecated {2.1} Object.keys(map).join().
* @return {String} String of the keys of the map
* The keys are separated by ", "
*/
getKeysAsString : qx.Bootstrap.getKeysAsString,
/**
* Get the values of a map as array
*
* @param map {Object} the map
* @return {Array} array of the values of the map
*/
getValues : function(map){
{
};
var arr = [];
var keys = Object.keys(map);
for(var i = 0,l = keys.length;i < l;i++){
arr.push(map[keys[i]]);
};
return arr;
},
/**
* Inserts all keys of the source object into the
* target objects. Attention: The target map gets modified.
*
* @signature function(target, source, overwrite)
* @param target {Object} target object
* @param source {Object} object to be merged
* @param overwrite {Boolean ? true} If enabled existing keys will be overwritten
* @return {Object} Target with merged values from the source object
*/
mergeWith : qx.Bootstrap.objectMergeWith,
/**
* Inserts all key/value pairs of the source object into the
* target object but doesn't override existing keys
*
* @param target {Object} target object
* @param source {Object} object to be merged
* @return {Object} target with merged values from source
* @deprecated {2.1} please use mergeWith instead with override set to false
*/
carefullyMergeWith : function(target, source){
{
};
return qx.lang.Object.mergeWith(target, source, false);
},
/**
* Merge a number of objects.
*
* @param target {Object} target object
* @param varargs {Object} variable number of objects to merged with target
* @return {Object} target with merged values from the other objects
* @deprecated {2.1} Please use mergeWith instead.
*/
merge : function(target, varargs){
{
};
var len = arguments.length;
for(var i = 1;i < len;i++){
qx.lang.Object.mergeWith(target, arguments[i]);
};
return target;
},
/**
* Return a copy of an Object
*
* @param source {Object} Object to copy
* @param deep {Boolean} If the clone should be a deep clone.
* @return {Object} A copy of the object
*/
clone : function(source, deep){
if(qx.lang.Type.isObject(source)){
var clone = {
};
for(var key in source){
if(deep){
clone[key] = qx.lang.Object.clone(source[key], deep);
} else {
clone[key] = source[key];
};
};
return clone;
} else if(qx.lang.Type.isArray(source)){
var clone = [];
for(var i = 0;i < source.length;i++){
if(deep){
clone[i] = qx.lang.Object.clone(source[i]);
} else {
clone[i] = source[i];
};
};
return clone;
};
return source;
},
/**
* Inverts a map by exchanging the keys with the values.
*
* If the map has the same values for different keys, information will get lost.
* The values will be converted to strings using the toString methods.
*
* @param map {Object} Map to invert
* @return {Object} inverted Map
*/
invert : function(map){
{
};
var result = {
};
for(var key in map){
result[map[key].toString()] = key;
};
return result;
},
/**
* Get the key of the given value from a map.
* If the map has more than one key matching the value, the first match is returned.
* If the map does not contain the value, <code>null</code> is returned.
*
* @param map {Object} Map to search for the key
* @param value {var} Value to look for
* @return {String|null} Name of the key (null if not found).
*/
getKeyFromValue : function(map, value){
{
};
for(var key in map){
if(map.hasOwnProperty(key) && map[key] === value){
return key;
};
};
return null;
},
/**
* Whether the map contains the given value.
*
* @param map {Object} Map to search for the value
* @param value {var} Value to look for
* @return {Boolean} Whether the value was found in the map.
*/
contains : function(map, value){
{
};
return this.getKeyFromValue(map, value) !== null;
},
/**
* Selects the value with the given key from the map.
*
* @param key {String} name of the key to get the value from
* @param map {Object} map to get the value from
* @return {var} value for the given key from the map
* @deprecated {2.1}
*/
select : function(key, map){
{
};
{
};
return map[key];
},
/**
* Convert an array into a map.
*
* All elements of the array become keys of the returned map by
* calling <code>toString</code> on the array elements. The values of the
* map are set to <code>true</code>
*
* @param array {Array} array to convert
* @return {Map} the array converted to a map.
*/
fromArray : function(array){
{
};
var obj = {
};
for(var i = 0,l = array.length;i < l;i++){
{
};
obj[array[i].toString()] = true;
};
return obj;
},
/**
* Serializes an object to URI parameters (also known as query string).
*
* Escapes characters that have a special meaning in URIs as well as
* umlauts. Uses the global function encodeURIComponent, see
* https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/encodeURIComponent
*
* Note: For URI parameters that are to be sent as
* application/x-www-form-urlencoded (POST), spaces should be encoded
* with "+".
*
* @param obj {Object} Object to serialize.
* @param post {Boolean} Whether spaces should be encoded with "+".
* @return {String} Serialized object. Safe to append to URIs or send as
* URL encoded string.
* @deprecated {2.1} Please use qx.util.Uri.toParameter instead.
*/
toUriParameter : function(obj, post){
{
};
return qx.util.Uri.toParameter(obj, post);
}
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2004-2011 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Tristan Koch (tristankoch)
************************************************************************ */
/**
* Static helpers for parsing and modifying URIs.
*/
qx.Bootstrap.define("qx.util.Uri", {
statics : {
/**
* Split URL
*
* Code taken from:
* parseUri 1.2.2
* (c) Steven Levithan <stevenlevithan.com>
* MIT License
*
*
* @param str {String} String to parse as URI
* @param strict {Boolean} Whether to parse strictly by the rules
* @return {Object} Map with parts of URI as properties
*/
parseUri : function(str, strict){
var options = {
key : ["source", "protocol", "authority", "userInfo", "user", "password", "host", "port", "relative", "path", "directory", "file", "query", "anchor"],
q : {
name : "queryKey",
parser : /(?:^|&)([^&=]*)=?([^&]*)/g
},
parser : {
strict : /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,
loose : /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/
}
};
var o = options,m = options.parser[strict ? "strict" : "loose"].exec(str),uri = {
},i = 14;
while(i--){
uri[o.key[i]] = m[i] || "";
};
uri[o.q.name] = {
};
uri[o.key[12]].replace(o.q.parser, function($0, $1, $2){
if($1){
uri[o.q.name][$1] = $2;
};
});
return uri;
},
/**
* Append string to query part of URL. Respects existing query.
*
* @param url {String} URL to append string to.
* @param params {String} Parameters to append to URL.
* @return {String} URL with string appended in query part.
*/
appendParamsToUrl : function(url, params){
if(params === undefined){
return url;
};
{
};
if(qx.lang.Type.isObject(params)){
params = qx.util.Uri.toParameter(params);
};
if(!params){
return url;
};
return url += (/\?/).test(url) ? "&" + params : "?" + params;
},
/**
* Serializes an object to URI parameters (also known as query string).
*
* Escapes characters that have a special meaning in URIs as well as
* umlauts. Uses the global function encodeURIComponent, see
* https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/encodeURIComponent
*
* Note: For URI parameters that are to be sent as
* application/x-www-form-urlencoded (POST), spaces should be encoded
* with "+".
*
* @param obj {Object} Object to serialize.
* @param post {Boolean} Whether spaces should be encoded with "+".
* @return {String} Serialized object. Safe to append to URIs or send as
* URL encoded string.
*/
toParameter : function(obj, post){
var key,parts = [];
for(key in obj){
if(obj.hasOwnProperty(key)){
var value = obj[key];
if(value instanceof Array){
for(var i = 0;i < value.length;i++){
this.__toParameterPair(key, value[i], parts, post);
};
} else {
this.__toParameterPair(key, value, parts, post);
};
};
};
return parts.join("&");
},
/**
* Encodes key/value to URI safe string and pushes to given array.
*
* @param key {String} Key.
* @param value {String} Value.
* @param parts {Array} Array to push to.
* @param post {Boolean} Whether spaces should be encoded with "+".
*/
__toParameterPair : function(key, value, parts, post){
var encode = window.encodeURIComponent;
if(post){
parts.push(encode(key).replace(/%20/g, "+") + "=" + encode(value).replace(/%20/g, "+"));
} else {
parts.push(encode(key) + "=" + encode(value));
};
},
/**
* Takes a relative URI and returns an absolute one.
*
* @param uri {String} relative URI
* @return {String} absolute URI
*/
getAbsolute : function(uri){
var div = document.createElement("div");
div.innerHTML = '<a href="' + uri + '">0</a>';
return div.firstChild.href;
}
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2004-2008 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Sebastian Werner (wpbasti)
************************************************************************ */
/**
* Contains methods to control and query the element's box-sizing property.
*
* Supported values:
*
* * "content-box" = W3C model (dimensions are content specific)
* * "border-box" = Microsoft model (dimensions are box specific incl. border and padding)
*/
qx.Bootstrap.define("qx.bom.element.BoxSizing", {
/*
*****************************************************************************
STATICS
*****************************************************************************
*/
statics : {
/** {Map} Internal data structure for __usesNativeBorderBox() */
__nativeBorderBox : {
tags : {
button : true,
select : true
},
types : {
search : true,
button : true,
submit : true,
reset : true,
checkbox : true,
radio : true
}
},
/**
* Whether the given elements defaults to the "border-box" Microsoft model in all cases.
*
* @param element {Element} DOM element to query
* @return {Boolean} true when the element uses "border-box" independently from the doctype
*/
__usesNativeBorderBox : function(element){
var map = this.__nativeBorderBox;
return map.tags[element.tagName.toLowerCase()] || map.types[element.type];
},
/**
* Compiles the given box sizing into a CSS compatible string.
*
* @param value {String} Valid CSS box-sizing value
* @return {String} CSS string
*/
compile : function(value){
if(qx.core.Environment.get("css.boxsizing")){
var prop = qx.bom.Style.getCssName(qx.core.Environment.get("css.boxsizing"));
return prop + ":" + value + ";";
} else {
{
};
};
},
/**
* Returns the box sizing for the given element.
*
* @param element {Element} The element to query
* @return {String} Box sizing value of the given element.
*/
get : function(element){
if(qx.core.Environment.get("css.boxsizing")){
return qx.bom.element.Style.get(element, "boxSizing", null, false) || "";
};
if(qx.bom.Document.isStandardMode(qx.dom.Node.getWindow(element))){
if(!this.__usesNativeBorderBox(element)){
return "content-box";
};
};
return "border-box";
},
/**
* Applies a new box sizing to the given element
*
* @param element {Element} The element to modify
* @param value {String} New box sizing value to set
*/
set : function(element, value){
if(qx.core.Environment.get("css.boxsizing")){
// IE8 bombs when trying to apply an unsupported value
try{
element.style[qx.core.Environment.get("css.boxsizing")] = value;
} catch(ex) {
{
};
};
} else {
{
};
};
},
/**
* Removes the local box sizing applied to the element
*
* @param element {Element} The element to modify
*/
reset : function(element){
this.set(element, "");
}
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2004-2008 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Sebastian Werner (wpbasti)
======================================================================
This class contains code based on the following work:
* Prototype JS
http://www.prototypejs.org/
Version 1.5
Copyright:
(c) 2006-2007, Prototype Core Team
License:
MIT: http://www.opensource.org/licenses/mit-license.php
Authors:
* Prototype Core Team
----------------------------------------------------------------------
Copyright (c) 2005-2008 Sam Stephenson
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
************************************************************************ */
/* ************************************************************************
#require(qx.lang.String)
#require(qx.bom.client.Css)
#require(qx.bom.element.Clip#set)
#require(qx.bom.element.Cursor#set)
#require(qx.bom.element.Opacity#set)
#require(qx.bom.element.BoxSizing#set)
#require(qx.bom.element.Clip#get)
#require(qx.bom.element.Cursor#get)
#require(qx.bom.element.Opacity#get)
#require(qx.bom.element.BoxSizing#get)
#require(qx.bom.element.Clip#reset)
#require(qx.bom.element.Cursor#reset)
#require(qx.bom.element.Opacity#reset)
#require(qx.bom.element.BoxSizing#reset)
#require(qx.bom.element.Clip#compile)
#require(qx.bom.element.Cursor#compile)
#require(qx.bom.element.Opacity#compile)
#require(qx.bom.element.BoxSizing#compile)
************************************************************************ */
/**
* Style querying and modification of HTML elements.
*
* Automatically normalizes cross-browser differences for setting and reading
* CSS attributes. Optimized for performance.
*/
qx.Bootstrap.define("qx.bom.element.Style", {
/*
*****************************************************************************
STATICS
*****************************************************************************
*/
statics : {
__styleNames : null,
__cssNames : null,
/**
* Detect vendor specific properties.
*/
__detectVendorProperties : function(){
var styleNames = {
"appearance" : qx.core.Environment.get("css.appearance"),
"userSelect" : qx.core.Environment.get("css.userselect"),
"textOverflow" : qx.core.Environment.get("css.textoverflow"),
"borderImage" : qx.core.Environment.get("css.borderimage"),
"float" : qx.core.Environment.get("css.float"),
"userModify" : qx.core.Environment.get("css.usermodify"),
"boxSizing" : qx.core.Environment.get("css.boxsizing")
};
this.__cssNames = {
};
for(var key in qx.lang.Object.clone(styleNames)){
if(!styleNames[key]){
delete styleNames[key];
} else {
this.__cssNames[key] = key == "float" ? "float" : qx.bom.Style.getCssName(styleNames[key]);
};
};
this.__styleNames = styleNames;
},
/**
* Gets the (possibly vendor-prefixed) name of a style property and stores
* it to avoid multiple checks.
*
* @param name {String} Style property name to check
* @return {String|null} The client-specific name of the property, or
* <code>null</code> if it's not supported.
*/
__getStyleName : function(name){
var styleName = qx.bom.Style.getPropertyName(name);
if(styleName){
this.__styleNames[name] = styleName;
};
return styleName;
},
/**
* Mshtml has proprietary pixel* properties for locations and dimensions
* which return the pixel value. Used by getComputed() in mshtml variant.
*
* @internal
*/
__mshtmlPixel : {
width : "pixelWidth",
height : "pixelHeight",
left : "pixelLeft",
right : "pixelRight",
top : "pixelTop",
bottom : "pixelBottom"
},
/**
* Whether a special class is available for the processing of this style.
*
* @internal
*/
__special : {
clip : qx.bom.element.Clip,
cursor : qx.bom.element.Cursor,
opacity : qx.bom.element.Opacity,
boxSizing : qx.bom.element.BoxSizing
},
/*
---------------------------------------------------------------------------
COMPILE SUPPORT
---------------------------------------------------------------------------
*/
/**
* Compiles the given styles into a string which can be used to
* concat a HTML string for innerHTML usage.
*
* @param map {Map} Map of style properties to compile
* @return {String} Compiled string of given style properties.
*/
compile : function(map){
var html = [];
var special = this.__special;
var cssNames = this.__cssNames;
var name,value;
for(name in map){
// read value
value = map[name];
if(value == null){
continue;
};
// normalize name
name = this.__styleNames[name] || this.__getStyleName(name) || name;
// process special properties
if(special[name]){
html.push(special[name].compile(value));
} else {
if(!cssNames[name]){
cssNames[name] = qx.bom.Style.getCssName(name);
};
html.push(cssNames[name], ":", value, ";");
};
};
return html.join("");
},
/*
---------------------------------------------------------------------------
CSS TEXT SUPPORT
---------------------------------------------------------------------------
*/
/**
* Set the full CSS content of the style attribute
*
* @param element {Element} The DOM element to modify
* @param value {String} The full CSS string
*/
setCss : function(element, value){
if(qx.core.Environment.get("engine.name") === "mshtml" && parseInt(qx.core.Environment.get("browser.documentmode"), 10) < 8){
element.style.cssText = value;
} else {
element.setAttribute("style", value);
};
},
/**
* Returns the full content of the style attribute.
*
* @param element {Element} The DOM element to query
* @return {String} the full CSS string
* @signature function(element)
*/
getCss : function(element){
if(qx.core.Environment.get("engine.name") === "mshtml" && parseInt(qx.core.Environment.get("browser.documentmode"), 10) < 8){
return element.style.cssText.toLowerCase();
} else {
return element.getAttribute("style");
};
},
/*
---------------------------------------------------------------------------
STYLE ATTRIBUTE SUPPORT
---------------------------------------------------------------------------
*/
/**
* Checks whether the browser supports the given CSS property.
*
* @param propertyName {String} The name of the property
* @return {Boolean} Whether the property id supported
*/
isPropertySupported : function(propertyName){
return (this.__special[propertyName] || this.__styleNames[propertyName] || propertyName in document.documentElement.style);
},
/** {Integer} Computed value of a style property. Compared to the cascaded style,
* this one also interprets the values e.g. translates <code>em</code> units to
* <code>px</code>.
*/
COMPUTED_MODE : 1,
/** {Integer} Cascaded value of a style property. */
CASCADED_MODE : 2,
/**
* {Integer} Local value of a style property. Ignores inheritance cascade.
* Does not interpret values.
*/
LOCAL_MODE : 3,
/**
* Sets the value of a style property
*
* @param element {Element} The DOM element to modify
* @param name {String} Name of the style attribute (js variant e.g. marginTop, wordSpacing)
* @param value {var} The value for the given style
* @param smart {Boolean?true} Whether the implementation should automatically use
* special implementations for some properties
*/
set : function(element, name, value, smart){
{
};
// normalize name
name = this.__styleNames[name] || this.__getStyleName(name) || name;
// special handling for specific properties
// through this good working switch this part costs nothing when
// processing non-smart properties
if(smart !== false && this.__special[name]){
this.__special[name].set(element, value);
} else {
element.style[name] = value !== null ? value : "";
};
},
/**
* Convenience method to modify a set of styles at once.
*
* @param element {Element} The DOM element to modify
* @param styles {Map} a map where the key is the name of the property
* and the value is the value to use.
* @param smart {Boolean?true} Whether the implementation should automatically use
* special implementations for some properties
*/
setStyles : function(element, styles, smart){
{
};
// inline calls to "set" and "reset" because this method is very
// performance critical!
var styleNames = this.__styleNames;
var special = this.__special;
var style = element.style;
for(var key in styles){
var value = styles[key];
var name = styleNames[key] || this.__getStyleName(key) || key;
if(value === undefined){
if(smart !== false && special[name]){
special[name].reset(element);
} else {
style[name] = "";
};
} else {
if(smart !== false && special[name]){
special[name].set(element, value);
} else {
style[name] = value !== null ? value : "";
};
};
};
},
/**
* Resets the value of a style property
*
* @param element {Element} The DOM element to modify
* @param name {String} Name of the style attribute (js variant e.g. marginTop, wordSpacing)
* @param smart {Boolean?true} Whether the implementation should automatically use
* special implementations for some properties
*/
reset : function(element, name, smart){
// normalize name
name = this.__styleNames[name] || this.__getStyleName(name) || name;
// special handling for specific properties
if(smart !== false && this.__special[name]){
this.__special[name].reset(element);
} else {
element.style[name] = "";
};
},
/**
* Gets the value of a style property.
*
* *Computed*
*
* Returns the computed value of a style property. Compared to the cascaded style,
* this one also interprets the values e.g. translates <code>em</code> units to
* <code>px</code>.
*
* *Cascaded*
*
* Returns the cascaded value of a style property.
*
* *Local*
*
* Ignores inheritance cascade. Does not interpret values.
*
* @signature function(element, name, mode, smart)
* @param element {Element} The DOM element to modify
* @param name {String} Name of the style attribute (js variant e.g. marginTop, wordSpacing)
* @param mode {Number} Choose one of the modes {@link #COMPUTED_MODE}, {@link #CASCADED_MODE},
* {@link #LOCAL_MODE}. The computed mode is the default one.
* @param smart {Boolean?true} Whether the implementation should automatically use
* special implementations for some properties
* @return {var} The value of the property
*/
get : qx.core.Environment.select("engine.name", {
"mshtml" : function(element, name, mode, smart){
// normalize name
name = this.__styleNames[name] || this.__getStyleName(name) || name;
// special handling
if(smart !== false && this.__special[name]){
return this.__special[name].get(element, mode);
};
// if the element is not inserted into the document "currentStyle"
// may be undefined. In this case always return the local style.
if(!element.currentStyle){
return element.style[name] || "";
};
// switch to right mode
switch(mode){case this.LOCAL_MODE:
return element.style[name] || "";case this.CASCADED_MODE:
return element.currentStyle[name] || "";default:
// Read cascaded style
var currentStyle = element.currentStyle[name] || "";
// Pixel values are always OK
if(/^-?[\.\d]+(px)?$/i.test(currentStyle)){
return currentStyle;
};
// Try to convert non-pixel values
var pixel = this.__mshtmlPixel[name];
if(pixel){
// Backup local and runtime style
var localStyle = element.style[name];
// Overwrite local value with cascaded value
// This is needed to have the pixel value setupped
element.style[name] = currentStyle || 0;
// Read pixel value and add "px"
var value = element.style[pixel] + "px";
// Recover old local value
element.style[name] = localStyle;
// Return value
return value;
};
// Just the current style
return currentStyle;};
},
"default" : function(element, name, mode, smart){
// normalize name
name = this.__styleNames[name] || this.__getStyleName(name) || name;
// special handling
if(smart !== false && this.__special[name]){
return this.__special[name].get(element, mode);
};
// switch to right mode
switch(mode){case this.LOCAL_MODE:
return element.style[name] || "";case this.CASCADED_MODE:
// Currently only supported by Opera and Internet Explorer
if(element.currentStyle){
return element.currentStyle[name] || "";
};
throw new Error("Cascaded styles are not supported in this browser!");// Support for the DOM2 getComputedStyle method
//
// Safari >= 3 & Gecko > 1.4 expose all properties to the returned
// CSSStyleDeclaration object. In older browsers the function
// "getPropertyValue" is needed to access the values.
//
// On a computed style object all properties are read-only which is
// identical to the behavior of MSHTML's "currentStyle".
default:
// Opera, Mozilla and Safari 3+ also have a global getComputedStyle which is identical
// to the one found under document.defaultView.
// The problem with this is however that this does not work correctly
// when working with frames and access an element of another frame.
// Then we must use the <code>getComputedStyle</code> of the document
// where the element is defined.
var doc = qx.dom.Node.getDocument(element);
var computed = doc.defaultView.getComputedStyle(element, null);
// All relevant browsers expose the configured style properties to
// the CSSStyleDeclaration objects
return computed ? computed[name] : "";};
}
})
},
defer : function(statics){
statics.__detectVendorProperties();
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2004-2008 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Sebastian Werner (wpbasti)
************************************************************************ */
/**
* Basic node creation and type detection
*/
qx.Bootstrap.define("qx.dom.Node", {
/*
*****************************************************************************
STATICS
*****************************************************************************
*/
statics : {
/*
---------------------------------------------------------------------------
NODE TYPES
---------------------------------------------------------------------------
*/
/**
* {Map} Node type:
*
* * ELEMENT
* * ATTRIBUTE
* * TEXT
* * CDATA_SECTION
* * ENTITY_REFERENCE
* * ENTITY
* * PROCESSING_INSTRUCTION
* * COMMENT
* * DOCUMENT
* * DOCUMENT_TYPE
* * DOCUMENT_FRAGMENT
* * NOTATION
*/
ELEMENT : 1,
ATTRIBUTE : 2,
TEXT : 3,
CDATA_SECTION : 4,
ENTITY_REFERENCE : 5,
ENTITY : 6,
PROCESSING_INSTRUCTION : 7,
COMMENT : 8,
DOCUMENT : 9,
DOCUMENT_TYPE : 10,
DOCUMENT_FRAGMENT : 11,
NOTATION : 12,
/*
---------------------------------------------------------------------------
DOCUMENT ACCESS
---------------------------------------------------------------------------
*/
/**
* Returns the owner document of the given node
*
* @param node {Node|Document|Window} the node which should be tested
* @return {Document|null} The document of the given DOM node
*/
getDocument : function(node){
return node.nodeType === this.DOCUMENT ? node : // is document already
node.ownerDocument || // is DOM node
node.document;
},
/**
* Returns the DOM2 <code>defaultView</code> (window).
*
* @param node {Node|Document|Window} node to inspect
* @return {Window} the <code>defaultView</code> of the given node
*/
getWindow : function(node){
// is a window already
if(node.nodeType == null){
return node;
};
// jump to document
if(node.nodeType !== this.DOCUMENT){
node = node.ownerDocument;
};
// jump to window
return node.defaultView || node.parentWindow;
},
/**
* Returns the document element. (Logical root node)
*
* This is a convenience attribute that allows direct access to the child
* node that is the root element of the document. For HTML documents,
* this is the element with the tagName "HTML".
*
* @param node {Node|Document|Window} node to inspect
* @return {Element} document element of the given node
*/
getDocumentElement : function(node){
return this.getDocument(node).documentElement;
},
/**
* Returns the body element. (Visual root node)
*
* This normally only makes sense for HTML documents. It returns
* the content area of the HTML document.
*
* @param node {Node|Document|Window} node to inspect
* @return {Element} document body of the given node
*/
getBodyElement : function(node){
return this.getDocument(node).body;
},
/*
---------------------------------------------------------------------------
TYPE TESTS
---------------------------------------------------------------------------
*/
/**
* Whether the given object is a DOM node
*
* @param node {Node} the node which should be tested
* @return {Boolean} true if the node is a DOM node
*/
isNode : function(node){
return !!(node && node.nodeType != null);
},
/**
* Whether the given object is a DOM element node
*
* @param node {Node} the node which should be tested
* @return {Boolean} true if the node is a DOM element
*/
isElement : function(node){
return !!(node && node.nodeType === this.ELEMENT);
},
/**
* Whether the given object is a DOM document node
*
* @param node {Node} the node which should be tested
* @return {Boolean} true when the node is a DOM document
*/
isDocument : function(node){
return !!(node && node.nodeType === this.DOCUMENT);
},
/**
* Whether the given object is a DOM text node
*
* @param node {Node} the node which should be tested
* @return {Boolean} true if the node is a DOM text node
*/
isText : function(node){
return !!(node && node.nodeType === this.TEXT);
},
/**
* Check whether the given object is a browser window object.
*
* @param obj {Object} the object which should be tested
* @return {Boolean} true if the object is a window object
*/
isWindow : function(obj){
return !!(obj && obj.history && obj.location && obj.document);
},
/**
* Whether the node has the given node name
*
* @param node {Node} the node
* @param nodeName {String} the node name to check for
* @return {Boolean} Whether the node has the given node name
*/
isNodeName : function(node, nodeName){
if(!nodeName || !node || !node.nodeName){
return false;
};
return nodeName.toLowerCase() == qx.dom.Node.getName(node);
},
/*
---------------------------------------------------------------------------
UTILITIES
---------------------------------------------------------------------------
*/
/**
* Get the node name as lower case string
*
* @param node {Node} the node
* @return {String} the node name
*/
getName : function(node){
if(!node || !node.nodeName){
return null;
};
return node.nodeName.toLowerCase();
},
/**
* Returns the text content of an node where the node may be of node type
* NODE_ELEMENT, NODE_ATTRIBUTE, NODE_TEXT or NODE_CDATA
*
* @param node {Node} the node from where the search should start.
* If the node has subnodes the text contents are recursively retreived and joined.
* @return {String} the joined text content of the given node or null if not appropriate.
* @signature function(node)
*/
getText : function(node){
if(!node || !node.nodeType){
return null;
};
switch(node.nodeType){case 1:
// NODE_ELEMENT
var i,a = [],nodes = node.childNodes,length = nodes.length;
for(i = 0;i < length;i++){
a[i] = this.getText(nodes[i]);
};
return a.join("");case 2:// NODE_ATTRIBUTE
case 3:// NODE_TEXT
case 4:
// CDATA
return node.nodeValue;};
return null;
},
/**
* Checks if the given node is a block node
*
* @param node {Node} Node
* @return {Boolean} whether it is a block node
*/
isBlockNode : function(node){
if(!qx.dom.Node.isElement(node)){
return false;
};
node = qx.dom.Node.getName(node);
return /^(body|form|textarea|fieldset|ul|ol|dl|dt|dd|li|div|hr|p|h[1-6]|quote|pre|table|thead|tbody|tfoot|tr|td|th|iframe|address|blockquote)$/.test(node);
}
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2004-2008 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Sebastian Werner (wpbasti)
======================================================================
This class contains code based on the following work:
* Yahoo! UI Library
http://developer.yahoo.com/yui
Version 2.2.0
Copyright:
(c) 2007, Yahoo! Inc.
License:
BSD: http://developer.yahoo.com/yui/license.txt
----------------------------------------------------------------------
http://developer.yahoo.com/yui/license.html
Copyright (c) 2009, Yahoo! Inc.
All rights reserved.
Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the
following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
* Neither the name of Yahoo! Inc. nor the names of its contributors
may be used to endorse or promote products derived from this
software without specific prior written permission of Yahoo! Inc.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
OF THE POSSIBILITY OF SUCH DAMAGE.
************************************************************************ */
/**
* Includes library functions to work with the current document.
*/
qx.Bootstrap.define("qx.bom.Document", {
statics : {
/**
* Whether the document is in quirks mode (e.g. non XHTML, HTML4 Strict or missing doctype)
*
* @signature function(win)
* @param win {Window?window} The window to query
* @return {Boolean} true when containing document is in quirks mode
*/
isQuirksMode : qx.core.Environment.select("engine.name", {
"mshtml" : function(win){
if(qx.core.Environment.get("engine.version") >= 8){
return (win || window).document.documentMode === 5;
} else {
return (win || window).document.compatMode !== "CSS1Compat";
};
},
"webkit" : function(win){
if(document.compatMode === undefined){
var el = (win || window).document.createElement("div");
el.style.cssText = "position:absolute;width:0;height:0;width:1";
return el.style.width === "1px" ? true : false;
} else {
return (win || window).document.compatMode !== "CSS1Compat";
};
},
"default" : function(win){
return (win || window).document.compatMode !== "CSS1Compat";
}
}),
/**
* Whether the document is in standard mode (e.g. XHTML, HTML4 Strict or doctype defined)
*
* @param win {Window?window} The window to query
* @return {Boolean} true when containing document is in standard mode
*/
isStandardMode : function(win){
return !this.isQuirksMode(win);
},
/**
* Returns the width of the document.
*
* Internet Explorer in standard mode stores the proprietary <code>scrollWidth</code> property
* on the <code>documentElement</code>, but in quirks mode on the body element. All
* other known browsers simply store the correct value on the <code>documentElement</code>.
*
* If the viewport is wider than the document the viewport width is returned.
*
* As the html element has no visual appearance it also can not scroll. This
* means that we must use the body <code>scrollWidth</code> in all non mshtml clients.
*
* Verified to correctly work with:
*
* * Mozilla Firefox 2.0.0.4
* * Opera 9.2.1
* * Safari 3.0 beta (3.0.2)
* * Internet Explorer 7.0
*
* @param win {Window?window} The window to query
* @return {Integer} The width of the actual document (which includes the body and its margin).
*
* NOTE: Opera 9.5x and 9.6x have wrong value for the scrollWidth property,
* if an element use negative value for top and left to be outside the viewport!
* See: http://bugzilla.qooxdoo.org/show_bug.cgi?id=2869
*/
getWidth : function(win){
var doc = (win || window).document;
var view = qx.bom.Viewport.getWidth(win);
var scroll = this.isStandardMode(win) ? doc.documentElement.scrollWidth : doc.body.scrollWidth;
return Math.max(scroll, view);
},
/**
* Returns the height of the document.
*
* Internet Explorer in standard mode stores the proprietary <code>scrollHeight</code> property
* on the <code>documentElement</code>, but in quirks mode on the body element. All
* other known browsers simply store the correct value on the <code>documentElement</code>.
*
* If the viewport is higher than the document the viewport height is returned.
*
* As the html element has no visual appearance it also can not scroll. This
* means that we must use the body <code>scrollHeight</code> in all non mshtml clients.
*
* Verified to correctly work with:
*
* * Mozilla Firefox 2.0.0.4
* * Opera 9.2.1
* * Safari 3.0 beta (3.0.2)
* * Internet Explorer 7.0
*
* @param win {Window?window} The window to query
* @return {Integer} The height of the actual document (which includes the body and its margin).
*
* NOTE: Opera 9.5x and 9.6x have wrong value for the scrollWidth property,
* if an element use negative value for top and left to be outside the viewport!
* See: http://bugzilla.qooxdoo.org/show_bug.cgi?id=2869
*/
getHeight : function(win){
var doc = (win || window).document;
var view = qx.bom.Viewport.getHeight(win);
var scroll = this.isStandardMode(win) ? doc.documentElement.scrollHeight : doc.body.scrollHeight;
return Math.max(scroll, view);
}
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2004-2008 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Sebastian Werner (wpbasti)
* Sebastian Fastner (fastner)
* Tino Butz (tbtz)
======================================================================
This class contains code based on the following work:
* Unify Project
Homepage:
http://unify-project.org
Copyright:
2009-2010 Deutsche Telekom AG, Germany, http://telekom.com
License:
MIT: http://www.opensource.org/licenses/mit-license.php
* Yahoo! UI Library
http://developer.yahoo.com/yui
Version 2.2.0
Copyright:
(c) 2007, Yahoo! Inc.
License:
BSD: http://developer.yahoo.com/yui/license.txt
----------------------------------------------------------------------
http://developer.yahoo.com/yui/license.html
Copyright (c) 2009, Yahoo! Inc.
All rights reserved.
Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the
following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
* Neither the name of Yahoo! Inc. nor the names of its contributors
may be used to endorse or promote products derived from this
software without specific prior written permission of Yahoo! Inc.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
OF THE POSSIBILITY OF SUCH DAMAGE.
************************************************************************ */
/**
* Includes library functions to work with the client's viewport (window).
* Orientation related functions are point to window.top as default.
*/
qx.Bootstrap.define("qx.bom.Viewport", {
statics : {
/**
* Returns the current width of the viewport (excluding the vertical scrollbar
* if present).
*
* @param win {Window?window} The window to query
* @return {Integer} The width of the viewable area of the page (excluding scrollbars).
*/
getWidth : function(win){
var win = win || window;
var doc = win.document;
return qx.bom.Document.isStandardMode(win) ? doc.documentElement.clientWidth : doc.body.clientWidth;
},
/**
* Returns the current height of the viewport (excluding the horizontal scrollbar
* if present).
*
* @param win {Window?window} The window to query
* @return {Integer} The Height of the viewable area of the page (excluding scrollbars).
*/
getHeight : function(win){
var win = win || window;
var doc = win.document;
return qx.bom.Document.isStandardMode(win) ? doc.documentElement.clientHeight : doc.body.clientHeight;
},
/**
* Returns the scroll position of the viewport
*
* All clients except IE < 9 support the non-standard property <code>pageXOffset</code>.
* As this is easier to evaluate we prefer this property over <code>scrollLeft</code>.
* Since the window could differ from the one the application is running in, we can't
* use a one-time environment check to decide which property to use.
*
* @param win {Window?window} The window to query
* @return {Integer} Scroll position in pixels from left edge, always a positive integer or zero
*/
getScrollLeft : function(win){
var win = win ? win : window;
if(typeof win.pageXOffset !== "undefined"){
return win.pageXOffset;
};
// Firefox is using 'documentElement.scrollLeft' and Chrome is using
// 'document.body.scrollLeft'. For the other value each browser is returning
// 0, so we can use this check to get the positive value without using specific
// browser checks.
var doc = win.document;
return doc.documentElement.scrollLeft || doc.body.scrollLeft;
},
/**
* Returns the scroll position of the viewport
*
* All clients except MSHTML support the non-standard property <code>pageYOffset</code>.
* As this is easier to evaluate we prefer this property over <code>scrollTop</code>.
* Since the window could differ from the one the application is running in, we can't
* use a one-time environment check to decide which property to use.
*
* @param win {Window?window} The window to query
* @return {Integer} Scroll position in pixels from top edge, always a positive integer or zero
*/
getScrollTop : function(win){
var win = win ? win : window;
if(typeof win.pageYOffeset !== "undefined"){
return win.pageYOffset;
};
// Firefox is using 'documentElement.scrollTop' and Chrome is using
// 'document.body.scrollTop'. For the other value each browser is returning
// 0, so we can use this check to get the positive value without using specific
// browser checks.
var doc = win.document;
return doc.documentElement.scrollTop || doc.body.scrollTop;
},
/**
* Returns an orientation normalizer value that should be added to device orientation
* to normalize behaviour on different devices.
*
* @param win {Window} The window to query
* @return {Map} Orientation normalizing value
*/
__getOrientationNormalizer : function(win){
// Calculate own understanding of orientation (0 = portrait, 90 = landscape)
var currentOrientation = this.getWidth(win) > this.getHeight(win) ? 90 : 0;
var deviceOrientation = win.orientation;
if(deviceOrientation == null || Math.abs(deviceOrientation % 180) == currentOrientation){
// No device orientation available or device orientation equals own understanding of orientation
return {
"-270" : 90,
"-180" : 180,
"-90" : -90,
"0" : 0,
"90" : 90,
"180" : 180,
"270" : -90
};
} else {
// Device orientation is not equal to own understanding of orientation
return {
"-270" : 180,
"-180" : -90,
"-90" : 0,
"0" : 90,
"90" : 180,
"180" : -90,
"270" : 0
};
};
},
// Cache orientation normalizer map on start
__orientationNormalizer : null,
/**
* Returns the current orientation of the viewport in degree.
*
* All possible values and their meaning:
*
* * <code>-90</code>: "Landscape"
* * <code>0</code>: "Portrait"
* * <code>90</code>: "Landscape"
* * <code>180</code>: "Portrait"
*
* @param win {Window?window.top} The window to query. (Default = top window)
* @return {Integer} The current orientation in degree
*/
getOrientation : function(win){
// Set window.top as default, because orientationChange event is only fired top window
var win = win || window.top;
// The orientation property of window does not have the same behaviour over all devices
// iPad has 0degrees = Portrait, Playbook has 90degrees = Portrait, same for Android Honeycomb
//
// To fix this an orientationNormalizer map is calculated on application start
//
// The calculation of getWidth and getHeight returns wrong values if you are in an input field
// on iPad and rotate your device!
var orientation = win.orientation;
if(orientation == null){
// Calculate orientation from window width and window height
orientation = this.getWidth(win) > this.getHeight(win) ? 90 : 0;
} else {
if(this.__orientationNormalizer == null){
this.__orientationNormalizer = this.__getOrientationNormalizer(win);
};
// Normalize orientation value
orientation = this.__orientationNormalizer[orientation];
};
return orientation;
},
/**
* Whether the viewport orientation is currently in landscape mode.
*
* @param win {Window?window} The window to query
* @return {Boolean} <code>true</code> when the viewport orientation
* is currently in landscape mode.
*/
isLandscape : function(win){
return this.getWidth(win) >= this.getHeight(win);
},
/**
* Whether the viewport orientation is currently in portrait mode.
*
* @param win {Window?window} The window to query
* @return {Boolean} <code>true</code> when the viewport orientation
* is currently in portrait mode.
*/
isPortrait : function(win){
return this.getWidth(win) < this.getHeight(win);
}
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2004-2008 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Sebastian Werner (wpbasti)
======================================================================
This class contains code based on the following work:
* Base2
http://code.google.com/p/base2/
Version 0.9
Copyright:
(c) 2006-2007, Dean Edwards
License:
MIT: http://www.opensource.org/licenses/mit-license.php
Authors:
* Dean Edwards
************************************************************************ */
/**
* CSS class name support for HTML elements. Supports multiple class names
* for each element. Can query and apply class names to HTML elements.
*/
qx.Bootstrap.define("qx.bom.element.Class", {
/*
*****************************************************************************
STATICS
*****************************************************************************
*/
statics : {
/** {RegExp} Regular expressions to split class names */
__splitter : /\s+/g,
/** {RegExp} String trim regular expression. */
__trim : /^\s+|\s+$/g,
/**
* Adds a className to the given element
* If successfully added the given className will be returned
*
* @signature function(element, name)
* @param element {Element} The element to modify
* @param name {String} The class name to add
* @return {String} The added classname (if so)
*/
add : {
"native" : function(element, name){
element.classList.add(name);
return name;
},
"default" : function(element, name){
if(!this.has(element, name)){
element.className += (element.className ? " " : "") + name;
};
return name;
}
}[qx.core.Environment.get("html.classlist") ? "native" : "default"],
/**
* Adds multiple classes to the given element
*
* @signature function(element, classes)
* @param element {Element} DOM element to modify
* @param classes {String[]} List of classes to add.
* @return {String} The resulting class name which was applied
*/
addClasses : {
"native" : function(element, classes){
for(var i = 0;i < classes.length;i++){
element.classList.add(classes[i]);
};
return element.className;
},
"default" : function(element, classes){
var keys = {
};
var result;
var old = element.className;
if(old){
result = old.split(this.__splitter);
for(var i = 0,l = result.length;i < l;i++){
keys[result[i]] = true;
};
for(var i = 0,l = classes.length;i < l;i++){
if(!keys[classes[i]]){
result.push(classes[i]);
};
};
} else {
result = classes;
};
return element.className = result.join(" ");
}
}[qx.core.Environment.get("html.classlist") ? "native" : "default"],
/**
* Gets the classname of the given element
*
* @param element {Element} The element to query
* @return {String} The retrieved classname
*/
get : function(element){
var className = element.className;
if(typeof className.split !== 'function'){
if(typeof className === 'object'){
if(qx.Bootstrap.getClass(className) == 'SVGAnimatedString'){
className = className.baseVal;
} else {
{
};
className = '';
};
};
if(typeof className === 'undefined'){
{
};
className = '';
};
};
return className;
},
/**
* Whether the given element has the given className.
*
* @signature function(element, name)
* @param element {Element} The DOM element to check
* @param name {String} The class name to check for
* @return {Boolean} true when the element has the given classname
*/
has : {
"native" : function(element, name){
return element.classList.contains(name);
},
"default" : function(element, name){
var regexp = new RegExp("(^|\\s)" + name + "(\\s|$)");
return regexp.test(element.className);
}
}[qx.core.Environment.get("html.classlist") ? "native" : "default"],
/**
* Removes a className from the given element
*
* @signature function(element, name)
* @param element {Element} The DOM element to modify
* @param name {String} The class name to remove
* @return {String} The removed class name
*/
remove : {
"native" : function(element, name){
element.classList.remove(name);
return name;
},
"default" : function(element, name){
var regexp = new RegExp("(^|\\s)" + name + "(\\s|$)");
element.className = element.className.replace(regexp, "$2");
return name;
}
}[qx.core.Environment.get("html.classlist") ? "native" : "default"],
/**
* Removes multiple classes from the given element
*
* @signature function(element, classes)
* @param element {Element} DOM element to modify
* @param classes {String[]} List of classes to remove.
* @return {String} The resulting class name which was applied
*/
removeClasses : {
"native" : function(element, classes){
for(var i = 0;i < classes.length;i++){
element.classList.remove(classes[i]);
};
return element.className;
},
"default" : function(element, classes){
var reg = new RegExp("\\b" + classes.join("\\b|\\b") + "\\b", "g");
return element.className = element.className.replace(reg, "").replace(this.__trim, "").replace(this.__splitter, " ");
}
}[qx.core.Environment.get("html.classlist") ? "native" : "default"],
/**
* Replaces the first given class name with the second one
*
* @param element {Element} The DOM element to modify
* @param oldName {String} The class name to remove
* @param newName {String} The class name to add
* @return {String} The added class name
*/
replace : function(element, oldName, newName){
this.remove(element, oldName);
return this.add(element, newName);
},
/**
* Toggles a className of the given element
*
* @signature function(element, name, toggle)
* @param element {Element} The DOM element to modify
* @param name {String} The class name to toggle
* @param toggle {Boolean?null} Whether to switch class on/off. Without
* the parameter an automatic toggling would happen.
* @return {String} The class name
*/
toggle : {
"native" : function(element, name, toggle){
if(toggle === undefined){
element.classList.toggle(name);
} else {
toggle ? this.add(element, name) : this.remove(element, name);
};
return name;
},
"default" : function(element, name, toggle){
if(toggle == null){
toggle = !this.has(element, name);
};
toggle ? this.add(element, name) : this.remove(element, name);
return name;
}
}[qx.core.Environment.get("html.classlist") ? "native" : "default"]
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2004-2009 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Sebastian Werner (wpbasti)
* Fabian Jakobs (fjakobs)
************************************************************************ */
/**
* Contains support for calculating dimensions of HTML elements.
*
* We differ between the box (or border) size which is available via
* {@link #getWidth} and {@link #getHeight} and the content or scroll
* sizes which are available via {@link #getContentWidth} and
* {@link #getContentHeight}.
*/
qx.Bootstrap.define("qx.bom.element.Dimension", {
/*
*****************************************************************************
STATICS
*****************************************************************************
*/
statics : {
/**
* Returns the rendered width of the given element.
*
* This is the visible width of the object, which need not to be identical
* to the width configured via CSS. This highly depends on the current
* box-sizing for the document and maybe even for the element.
*
* @signature function(element)
* @param element {Element} element to query
* @return {Integer} width of the element
*/
getWidth : qx.core.Environment.select("engine.name", {
"gecko" : function(element){
// offsetWidth in Firefox does not always return the rendered pixel size
// of an element.
// Starting with Firefox 3 the rendered size can be determined by using
// getBoundingClientRect
// https://bugzilla.mozilla.org/show_bug.cgi?id=450422
if(element.getBoundingClientRect){
var rect = element.getBoundingClientRect();
return Math.round(rect.right) - Math.round(rect.left);
} else {
return element.offsetWidth;
};
},
"default" : function(element){
return element.offsetWidth;
}
}),
/**
* Returns the rendered height of the given element.
*
* This is the visible height of the object, which need not to be identical
* to the height configured via CSS. This highly depends on the current
* box-sizing for the document and maybe even for the element.
*
* @signature function(element)
* @param element {Element} element to query
* @return {Integer} height of the element
*/
getHeight : qx.core.Environment.select("engine.name", {
"gecko" : function(element){
if(element.getBoundingClientRect){
var rect = element.getBoundingClientRect();
return Math.round(rect.bottom) - Math.round(rect.top);
} else {
return element.offsetHeight;
};
},
"default" : function(element){
return element.offsetHeight;
}
}),
/**
* Returns the rendered size of the given element.
*
* @param element {Element} element to query
* @return {Map} map containing the width and height of the element
*/
getSize : function(element){
return {
width : this.getWidth(element),
height : this.getHeight(element)
};
},
/** {Map} Contains all overflow values where scrollbars are invisible */
__hiddenScrollbars : {
visible : true,
hidden : true
},
/**
* Returns the content width.
*
* The content width is basically the maximum
* width used or the maximum width which can be used by the content. This
* excludes all kind of styles of the element like borders, paddings, margins,
* and even scrollbars.
*
* Please note that with visible scrollbars the content width returned
* may be larger than the box width returned via {@link #getWidth}.
*
* @param element {Element} element to query
* @return {Integer} Computed content width
*/
getContentWidth : function(element){
var Style = qx.bom.element.Style;
var overflowX = qx.bom.element.Style.get(element, "overflowX");
var paddingLeft = parseInt(Style.get(element, "paddingLeft") || "0px", 10);
var paddingRight = parseInt(Style.get(element, "paddingRight") || "0px", 10);
if(this.__hiddenScrollbars[overflowX]){
var contentWidth = element.clientWidth;
if((qx.core.Environment.get("engine.name") == "opera") || qx.dom.Node.isBlockNode(element)){
contentWidth = contentWidth - paddingLeft - paddingRight;
};
return contentWidth;
} else {
if(element.clientWidth >= element.scrollWidth){
// Scrollbars visible, but not needed? We need to substract both paddings
return Math.max(element.clientWidth, element.scrollWidth) - paddingLeft - paddingRight;
} else {
// Scrollbars visible and needed. We just remove the left padding,
// as the right padding is not respected in rendering.
var width = element.scrollWidth - paddingLeft;
// IE renders the paddingRight as well with scrollbars on
if(qx.core.Environment.get("engine.name") == "mshtml" && qx.core.Environment.get("engine.version") >= 6){
width -= paddingRight;
};
return width;
};
};
},
/**
* Returns the content height.
*
* The content height is basically the maximum
* height used or the maximum height which can be used by the content. This
* excludes all kind of styles of the element like borders, paddings, margins,
* and even scrollbars.
*
* Please note that with visible scrollbars the content height returned
* may be larger than the box height returned via {@link #getHeight}.
*
* @param element {Element} element to query
* @return {Integer} Computed content height
*/
getContentHeight : function(element){
var Style = qx.bom.element.Style;
var overflowY = qx.bom.element.Style.get(element, "overflowY");
var paddingTop = parseInt(Style.get(element, "paddingTop") || "0px", 10);
var paddingBottom = parseInt(Style.get(element, "paddingBottom") || "0px", 10);
if(this.__hiddenScrollbars[overflowY]){
return element.clientHeight - paddingTop - paddingBottom;
} else {
if(element.clientHeight >= element.scrollHeight){
// Scrollbars visible, but not needed? We need to substract both paddings
return Math.max(element.clientHeight, element.scrollHeight) - paddingTop - paddingBottom;
} else {
// Scrollbars visible and needed. We just remove the top padding,
// as the bottom padding is not respected in rendering.
var height = element.scrollHeight - paddingTop;
// IE renders the paddingBottom as well with scrollbars on
if(qx.core.Environment.get("engine.name") == "mshtml" && qx.core.Environment.get("engine.version") == 6){
height -= paddingBottom;
};
return height;
};
};
},
/**
* Returns the rendered content size of the given element.
*
* @param element {Element} element to query
* @return {Map} map containing the content width and height of the element
*/
getContentSize : function(element){
return {
width : this.getContentWidth(element),
height : this.getContentHeight(element)
};
}
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2004-2008 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Sebastian Werner (wpbasti)
======================================================================
This class contains code based on the following work:
* jQuery Dimension Plugin
http://jquery.com/
Version 1.1.3
Copyright:
(c) 2007, Paul Bakaus & Brandon Aaron
License:
MIT: http://www.opensource.org/licenses/mit-license.php
Authors:
Paul Bakaus
Brandon Aaron
************************************************************************ */
/**
* Query the location of an arbitrary DOM element in relation to its top
* level body element. Works in all major browsers:
*
* * Mozilla 1.5 + 2.0
* * Internet Explorer 6.0 + 7.0 (both standard & quirks mode)
* * Opera 9.2
* * Safari 3.0 beta
*/
qx.Bootstrap.define("qx.bom.element.Location", {
statics : {
/**
* Queries a style property for the given element
*
* @param elem {Element} DOM element to query
* @param style {String} Style property
* @return {String} Value of given style property
*/
__style : function(elem, style){
return qx.bom.element.Style.get(elem, style, qx.bom.element.Style.COMPUTED_MODE, false);
},
/**
* Queries a style property for the given element and parses it to an integer value
*
* @param elem {Element} DOM element to query
* @param style {String} Style property
* @return {Integer} Value of given style property
*/
__num : function(elem, style){
return parseInt(qx.bom.element.Style.get(elem, style, qx.bom.element.Style.COMPUTED_MODE, false), 10) || 0;
},
/**
* Computes the scroll offset of the given element relative to the document
* <code>body</code>.
*
* @param elem {Element} DOM element to query
* @return {Map} Map which contains the <code>left</code> and <code>top</code> scroll offsets
*/
__computeScroll : function(elem){
var left = 0,top = 0;
// Find window
var win = qx.dom.Node.getWindow(elem);
left -= qx.bom.Viewport.getScrollLeft(win);
top -= qx.bom.Viewport.getScrollTop(win);
return {
left : left,
top : top
};
},
/**
* Computes the offset of the given element relative to the document
* <code>body</code>.
*
* @param elem {Element} DOM element to query
* @return {Map} Map which contains the <code>left</code> and <code>top</code> offsets
*/
__computeBody : qx.core.Environment.select("engine.name", {
"mshtml" : function(elem){
// Find body element
var doc = qx.dom.Node.getDocument(elem);
var body = doc.body;
var left = 0;
var top = 0;
left -= body.clientLeft + doc.documentElement.clientLeft;
top -= body.clientTop + doc.documentElement.clientTop;
if(!qx.core.Environment.get("browser.quirksmode")){
left += this.__num(body, "borderLeftWidth");
top += this.__num(body, "borderTopWidth");
};
return {
left : left,
top : top
};
},
"webkit" : function(elem){
// Find body element
var doc = qx.dom.Node.getDocument(elem);
var body = doc.body;
// Start with the offset
var left = body.offsetLeft;
var top = body.offsetTop;
// only for safari < version 4.0
if(parseFloat(qx.core.Environment.get("engine.version")) < 530.17){
left += this.__num(body, "borderLeftWidth");
top += this.__num(body, "borderTopWidth");
};
return {
left : left,
top : top
};
},
"gecko" : function(elem){
// Find body element
var body = qx.dom.Node.getDocument(elem).body;
// Start with the offset
var left = body.offsetLeft;
var top = body.offsetTop;
// add the body margin for firefox 3.0 and below
if(parseFloat(qx.core.Environment.get("engine.version")) < 1.9){
left += this.__num(body, "marginLeft");
top += this.__num(body, "marginTop");
};
// Correct substracted border (only in content-box mode)
if(qx.bom.element.BoxSizing.get(body) !== "border-box"){
left += this.__num(body, "borderLeftWidth");
top += this.__num(body, "borderTopWidth");
};
return {
left : left,
top : top
};
},
// At the moment only correctly supported by Opera
"default" : function(elem){
// Find body element
var body = qx.dom.Node.getDocument(elem).body;
// Start with the offset
var left = body.offsetLeft;
var top = body.offsetTop;
return {
left : left,
top : top
};
}
}),
/**
* Computes the sum of all offsets of the given element node.
*
* Traditionally this is a loop which goes up the whole parent tree
* and sums up all found offsets.
*
* But both <code>mshtml</code> and <code>gecko >= 1.9</code> support
* <code>getBoundingClientRect</code> which allows a
* much faster access to the offset position.
*
* Please note: When gecko 1.9 does not use the <code>getBoundingClientRect</code>
* implementation, and therefore use the traditional offset calculation
* the gecko 1.9 fix in <code>__computeBody</code> must not be applied.
*
* @signature function(elem)
* @param elem {Element} DOM element to query
* @return {Map} Map which contains the <code>left</code> and <code>top</code> offsets
*/
__computeOffset : qx.core.Environment.select("engine.name", {
"gecko" : function(elem){
// Use faster getBoundingClientRect() if available (gecko >= 1.9)
if(elem.getBoundingClientRect){
var rect = elem.getBoundingClientRect();
// Firefox 3.0 alpha 6 (gecko 1.9) returns floating point numbers
// use Math.round() to round them to style compatible numbers
// MSHTML returns integer numbers
var left = Math.round(rect.left);
var top = Math.round(rect.top);
} else {
var left = 0;
var top = 0;
// Stop at the body
var body = qx.dom.Node.getDocument(elem).body;
var box = qx.bom.element.BoxSizing;
if(box.get(elem) !== "border-box"){
left -= this.__num(elem, "borderLeftWidth");
top -= this.__num(elem, "borderTopWidth");
};
while(elem && elem !== body){
// Add node offsets
left += elem.offsetLeft;
top += elem.offsetTop;
// Mozilla does not add the borders to the offset
// when using box-sizing=content-box
if(box.get(elem) !== "border-box"){
left += this.__num(elem, "borderLeftWidth");
top += this.__num(elem, "borderTopWidth");
};
// Mozilla does not add the border for a parent that has
// overflow set to anything but visible
if(elem.parentNode && this.__style(elem.parentNode, "overflow") != "visible"){
left += this.__num(elem.parentNode, "borderLeftWidth");
top += this.__num(elem.parentNode, "borderTopWidth");
};
// One level up (offset hierarchy)
elem = elem.offsetParent;
};
};
return {
left : left,
top : top
};
},
"default" : function(elem){
var doc = qx.dom.Node.getDocument(elem);
// Use faster getBoundingClientRect() if available
if(elem.getBoundingClientRect){
var rect = elem.getBoundingClientRect();
var left = Math.round(rect.left);
var top = Math.round(rect.top);
} else {
// Offset of the incoming element
var left = elem.offsetLeft;
var top = elem.offsetTop;
// Start with the first offset parent
elem = elem.offsetParent;
// Stop at the body
var body = doc.body;
// Border correction is only needed for each parent
// not for the incoming element itself
while(elem && elem != body){
// Add node offsets
left += elem.offsetLeft;
top += elem.offsetTop;
// Fix missing border
left += this.__num(elem, "borderLeftWidth");
top += this.__num(elem, "borderTopWidth");
// One level up (offset hierarchy)
elem = elem.offsetParent;
};
};
return {
left : left,
top : top
};
}
}),
/**
* Computes the location of the given element in context of
* the document dimensions.
*
* Supported modes:
*
* * <code>margin</code>: Calculate from the margin box of the element (bigger than the visual appearance: including margins of given element)
* * <code>box</code>: Calculates the offset box of the element (default, uses the same size as visible)
* * <code>border</code>: Calculate the border box (useful to align to border edges of two elements).
* * <code>scroll</code>: Calculate the scroll box (relevant for absolute positioned content).
* * <code>padding</code>: Calculate the padding box (relevant for static/relative positioned content).
*
* @param elem {Element} DOM element to query
* @param mode {String?box} A supported option. See comment above.
* @return {Map} Returns a map with <code>left</code>, <code>top</code>,
* <code>right</code> and <code>bottom</code> which contains the distance
* of the element relative to the document.
*/
get : function(elem, mode){
if(elem.tagName == "BODY"){
var location = this.__getBodyLocation(elem);
var left = location.left;
var top = location.top;
} else {
var body = this.__computeBody(elem);
var offset = this.__computeOffset(elem);
// Reduce by viewport scrolling.
// Hint: getBoundingClientRect returns the location of the
// element in relation to the viewport which includes
// the scrolling
var scroll = this.__computeScroll(elem);
var left = offset.left + body.left - scroll.left;
var top = offset.top + body.top - scroll.top;
};
var right = left + elem.offsetWidth;
var bottom = top + elem.offsetHeight;
if(mode){
// In this modes we want the size as seen from a child what means that we want the full width/height
// which may be higher than the outer width/height when the element has scrollbars.
if(mode == "padding" || mode == "scroll"){
var overX = qx.bom.element.Style.get(elem, "overflowX");
if(overX == "scroll" || overX == "auto"){
right += elem.scrollWidth - elem.offsetWidth + this.__num(elem, "borderLeftWidth") + this.__num(elem, "borderRightWidth");
};
var overY = qx.bom.element.Style.get(elem, "overflowY");
if(overY == "scroll" || overY == "auto"){
bottom += elem.scrollHeight - elem.offsetHeight + this.__num(elem, "borderTopWidth") + this.__num(elem, "borderBottomWidth");
};
};
switch(mode){case "padding":
left += this.__num(elem, "paddingLeft");
top += this.__num(elem, "paddingTop");
right -= this.__num(elem, "paddingRight");
bottom -= this.__num(elem, "paddingBottom");// no break here
case "scroll":
left -= elem.scrollLeft;
top -= elem.scrollTop;
right -= elem.scrollLeft;
bottom -= elem.scrollTop;// no break here
case "border":
left += this.__num(elem, "borderLeftWidth");
top += this.__num(elem, "borderTopWidth");
right -= this.__num(elem, "borderRightWidth");
bottom -= this.__num(elem, "borderBottomWidth");
break;case "margin":
left -= this.__num(elem, "marginLeft");
top -= this.__num(elem, "marginTop");
right += this.__num(elem, "marginRight");
bottom += this.__num(elem, "marginBottom");
break;};
};
return {
left : left,
top : top,
right : right,
bottom : bottom
};
},
/**
* Get the location of the body element relative to the document.
* @param body {Element} The body element.
* @return {Map} map with the keys <code>left</code> and <code>top</code>
*/
__getBodyLocation : function(body){
var top = body.offsetTop;
var left = body.offsetLeft;
if(qx.core.Environment.get("engine.name") !== "mshtml" || !((parseFloat(qx.core.Environment.get("engine.version")) < 8 || qx.core.Environment.get("browser.documentmode") < 8) && !qx.core.Environment.get("browser.quirksmode"))){
top += this.__num(body, "marginTop");
left += this.__num(body, "marginLeft");
};
if(qx.core.Environment.get("engine.name") === "gecko"){
top += this.__num(body, "borderLeftWidth");
left += this.__num(body, "borderTopWidth");
};
return {
left : left,
top : top
};
},
/**
* Computes the location of the given element in context of
* the document dimensions. For supported modes please
* have a look at the {@link qx.bom.element.Location#get} method.
*
* @param elem {Element} DOM element to query
* @param mode {String} A supported option. See comment above.
* @return {Integer} The left distance
* of the element relative to the document.
*/
getLeft : function(elem, mode){
return this.get(elem, mode).left;
},
/**
* Computes the location of the given element in context of
* the document dimensions. For supported modes please
* have a look at the {@link qx.bom.element.Location#get} method.
*
* @param elem {Element} DOM element to query
* @param mode {String} A supported option. See comment above.
* @return {Integer} The top distance
* of the element relative to the document.
*/
getTop : function(elem, mode){
return this.get(elem, mode).top;
},
/**
* Computes the location of the given element in context of
* the document dimensions. For supported modes please
* have a look at the {@link qx.bom.element.Location#get} method.
*
* @param elem {Element} DOM element to query
* @param mode {String} A supported option. See comment above.
* @return {Integer} The right distance
* of the element relative to the document.
*/
getRight : function(elem, mode){
return this.get(elem, mode).right;
},
/**
* Computes the location of the given element in context of
* the document dimensions. For supported modes please
* have a look at the {@link qx.bom.element.Location#get} method.
*
* @param elem {Element} DOM element to query
* @param mode {String} A supported option. See comment above.
* @return {Integer} The bottom distance
* of the element relative to the document.
*/
getBottom : function(elem, mode){
return this.get(elem, mode).bottom;
},
/**
* Returns the distance between two DOM elements. For supported modes please
* have a look at the {@link qx.bom.element.Location#get} method.
*
* @param elem1 {Element} First element
* @param elem2 {Element} Second element
* @param mode1 {String?null} Mode for first element
* @param mode2 {String?null} Mode for second element
* @return {Map} Returns a map with <code>left</code> and <code>top</code>
* which contains the distance of the elements from each other.
*/
getRelative : function(elem1, elem2, mode1, mode2){
var loc1 = this.get(elem1, mode1);
var loc2 = this.get(elem2, mode2);
return {
left : loc1.left - loc2.left,
top : loc1.top - loc2.top,
right : loc1.right - loc2.right,
bottom : loc1.bottom - loc2.bottom
};
},
/**
* Returns the distance between the given element to its offset parent.
*
* @param elem {Element} DOM element to query
* @return {Map} Returns a map with <code>left</code> and <code>top</code>
* which contains the distance of the elements from each other.
*/
getPosition : function(elem){
return this.getRelative(elem, this.getOffsetParent(elem));
},
/**
* Detects the offset parent of the given element
*
* @param element {Element} Element to query for offset parent
* @return {Element} Detected offset parent
*/
getOffsetParent : function(element){
var offsetParent = element.offsetParent || document.body;
var Style = qx.bom.element.Style;
while(offsetParent && (!/^body|html$/i.test(offsetParent.tagName) && Style.get(offsetParent, "position") === "static")){
offsetParent = offsetParent.offsetParent;
};
return offsetParent;
}
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2004-2008 1&1 Internet AG, Germany, http://www.1und1.de
2006 STZ-IDA, Germany, http://www.stz-ida.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Sebastian Werner (wpbasti)
* Andreas Ecker (ecker)
* Andreas Junghans (lucidcake)
************************************************************************ */
/**
* Cross-browser wrapper to work with CSS stylesheets.
*/
qx.Bootstrap.define("qx.bom.Stylesheet", {
/*
*****************************************************************************
STATICS
*****************************************************************************
*/
statics : {
/**
* Include a CSS file
*
* <em>Note:</em> Using a resource ID as the <code>href</code> parameter
* will no longer be supported. Call
* <code>qx.util.ResourceManager.getInstance().toUri(href)</code> to get
* valid URI to be used with this method.
*
* @param href {String} Href value
* @param doc {Document?} Document to modify
*/
includeFile : function(href, doc){
if(!doc){
doc = document;
};
var el = doc.createElement("link");
el.type = "text/css";
el.rel = "stylesheet";
el.href = href;
var head = doc.getElementsByTagName("head")[0];
head.appendChild(el);
},
/**
* Create a new Stylesheet node and append it to the document
*
* @param text {String?} optional string of css rules
* @return {Stylesheet} the generates stylesheet element
*/
createElement : function(text){
if(qx.core.Environment.get("html.stylesheet.createstylesheet")){
var sheet = document.createStyleSheet();
if(text){
sheet.cssText = text;
};
return sheet;
} else {
var elem = document.createElement("style");
elem.type = "text/css";
if(text){
elem.appendChild(document.createTextNode(text));
};
document.getElementsByTagName("head")[0].appendChild(elem);
return elem.sheet;
};
},
/**
* Insert a new CSS rule into a given Stylesheet
*
* @param sheet {Object} the target Stylesheet object
* @param selector {String} the selector
* @param entry {String} style rule
*/
addRule : function(sheet, selector, entry){
if(qx.core.Environment.get("html.stylesheet.insertrule")){
sheet.insertRule(selector + "{" + entry + "}", sheet.cssRules.length);
} else {
sheet.addRule(selector, entry);
};
},
/**
* Remove a CSS rule from a stylesheet
*
* @param sheet {Object} the Stylesheet
* @param selector {String} the Selector of the rule to remove
*/
removeRule : function(sheet, selector){
if(qx.core.Environment.get("html.stylesheet.deleterule")){
var rules = sheet.cssRules;
var len = rules.length;
for(var i = len - 1;i >= 0;--i){
if(rules[i].selectorText == selector){
sheet.deleteRule(i);
};
};
} else {
var rules = sheet.rules;
var len = rules.length;
for(var i = len - 1;i >= 0;--i){
if(rules[i].selectorText == selector){
sheet.removeRule(i);
};
};
};
},
/**
* Remove the given sheet from its owner.
* @param sheet {Object} the stylesheet object
*/
removeSheet : function(sheet){
var owner = sheet.ownerNode ? sheet.ownerNode : sheet.owningElement;
qx.dom.Element.removeChild(owner, owner.parentNode);
},
/**
* Remove all CSS rules from a stylesheet
*
* @param sheet {Object} the stylesheet object
*/
removeAllRules : function(sheet){
if(qx.core.Environment.get("html.stylesheet.deleterule")){
var rules = sheet.cssRules;
var len = rules.length;
for(var i = len - 1;i >= 0;i--){
sheet.deleteRule(i);
};
} else {
var rules = sheet.rules;
var len = rules.length;
for(var i = len - 1;i >= 0;i--){
sheet.removeRule(i);
};
};
},
/**
* Add an import of an external CSS file to a stylesheet
*
* @param sheet {Object} the stylesheet object
* @param url {String} URL of the external stylesheet file
*/
addImport : function(sheet, url){
if(qx.core.Environment.get("html.stylesheet.addimport")){
sheet.addImport(url);
} else {
sheet.insertRule('@import "' + url + '";', sheet.cssRules.length);
};
},
/**
* Removes an import from a stylesheet
*
* @param sheet {Object} the stylesheet object
* @param url {String} URL of the imported CSS file
*/
removeImport : function(sheet, url){
if(qx.core.Environment.get("html.stylesheet.removeimport")){
var imports = sheet.imports;
var len = imports.length;
for(var i = len - 1;i >= 0;i--){
if(imports[i].href == url || imports[i].href == qx.util.Uri.getAbsolute(url)){
sheet.removeImport(i);
};
};
} else {
var rules = sheet.cssRules;
var len = rules.length;
for(var i = len - 1;i >= 0;i--){
if(rules[i].href == url){
sheet.deleteRule(i);
};
};
};
},
/**
* Remove all imports from a stylesheet
*
* @param sheet {Object} the stylesheet object
*/
removeAllImports : function(sheet){
if(qx.core.Environment.get("html.stylesheet.removeimport")){
var imports = sheet.imports;
var len = imports.length;
for(var i = len - 1;i >= 0;i--){
sheet.removeImport(i);
};
} else {
var rules = sheet.cssRules;
var len = rules.length;
for(var i = len - 1;i >= 0;i--){
if(rules[i].type == rules[i].IMPORT_RULE){
sheet.deleteRule(i);
};
};
};
}
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2004-2011 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Daniel Wagner (d_wagner)
************************************************************************ */
/**
* Internal class which contains the checks used by {@link qx.core.Environment}.
* All checks in here are marked as internal which means you should never use
* them directly.
*
* This class contains checks related to Stylesheet objects.
*
* @internal
*/
qx.Bootstrap.define("qx.bom.client.Stylesheet", {
statics : {
/**
* Returns a stylesheet to be used for feature checks
*
* @return {Stylesheet} Stylesheet element
*/
__getStylesheet : function(){
if(!qx.bom.client.Stylesheet.__stylesheet){
qx.bom.client.Stylesheet.__stylesheet = qx.bom.Stylesheet.createElement();
};
return qx.bom.client.Stylesheet.__stylesheet;
},
/**
* Check for IE's non-standard document.createStyleSheet function.
* In IE9 (standards mode), the typeof check returns "function" so false is
* returned. This is intended since IE9 supports the DOM-standard
* createElement("style") which should be used instead.
*
* @internal
* @return {Boolean} <code>true</code> if the browser supports
* document.createStyleSheet
*/
getCreateStyleSheet : function(){
return typeof document.createStyleSheet === "object";
},
/**
* Check for stylesheet.insertRule. Legacy IEs do not support this.
*
* @internal
* @return {Boolean} <code>true</code> if insertRule is supported
*/
getInsertRule : function(){
return typeof qx.bom.client.Stylesheet.__getStylesheet().insertRule === "function";
},
/**
* Check for stylesheet.deleteRule. Legacy IEs do not support this.
*
* @internal
* @return {Boolean} <code>true</code> if deleteRule is supported
*/
getDeleteRule : function(){
return typeof qx.bom.client.Stylesheet.__getStylesheet().deleteRule === "function";
},
/**
* Decides whether to use the legacy IE-only stylesheet.addImport or the
* DOM-standard stylesheet.insertRule('@import [...]')
*
* @internal
* @return {Boolean} <code>true</code> if stylesheet.addImport is supported
*/
getAddImport : function(){
return (typeof qx.bom.client.Stylesheet.__getStylesheet().addImport === "object");
},
/**
* Decides whether to use the legacy IE-only stylesheet.removeImport or the
* DOM-standard stylesheet.deleteRule('@import [...]')
*
* @internal
* @return {Boolean} <code>true</code> if stylesheet.removeImport is supported
*/
getRemoveImport : function(){
return (typeof qx.bom.client.Stylesheet.__getStylesheet().removeImport === "object");
}
},
defer : function(statics){
qx.core.Environment.add("html.stylesheet.createstylesheet", statics.getCreateStyleSheet);
qx.core.Environment.add("html.stylesheet.insertrule", statics.getInsertRule);
qx.core.Environment.add("html.stylesheet.deleterule", statics.getDeleteRule);
qx.core.Environment.add("html.stylesheet.addimport", statics.getAddImport);
qx.core.Environment.add("html.stylesheet.removeimport", statics.getRemoveImport);
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2004-2008 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Sebastian Werner (wpbasti)
************************************************************************ */
/**
* Manages children structures of an element. Easy and convenient APIs
* to insert, remove and replace children.
*/
qx.Bootstrap.define("qx.dom.Element", {
statics : {
/**
* {Map} A list of all attributes which needs to be part of the initial element to work correctly
*
* @internal
*/
__initialAttributes : {
"onload" : true,
"onpropertychange" : true,
"oninput" : true,
"onchange" : true,
"name" : true,
"type" : true,
"checked" : true,
"disabled" : true
},
/**
* Whether the given <code>child</code> is a child of <code>parent</code>
*
* @param parent {Element} parent element
* @param child {Node} child node
* @return {Boolean} true when the given <code>child</code> is a child of <code>parent</code>
*/
hasChild : function(parent, child){
return child.parentNode === parent;
},
/**
* Whether the given <code>element</code> has children.
*
* @param element {Element} element to test
* @return {Boolean} true when the given <code>element</code> has at least one child node
*/
hasChildren : function(element){
return !!element.firstChild;
},
/**
* Whether the given <code>element</code> has any child elements.
*
* @param element {Element} element to test
* @return {Boolean} true when the given <code>element</code> has at least one child element
*/
hasChildElements : function(element){
element = element.firstChild;
while(element){
if(element.nodeType === 1){
return true;
};
element = element.nextSibling;
};
return false;
},
/**
* Returns the parent element of the given element.
*
* @param element {Element} Element to find the parent for
* @return {Element} The parent element
*/
getParentElement : function(element){
return element.parentNode;
},
/**
* Checks if the <code>element</code> is in the DOM, but note that
* the method is very expensive!
*
* @param element {Element} The DOM element to check.
* @param win {Window} The window to check for.
* @return {Boolean} <code>true</code> if the <code>element</code> is in
* the DOM, <code>false</code> otherwise.
*/
isInDom : function(element, win){
if(!win){
win = window;
};
var domElements = win.document.getElementsByTagName(element.nodeName);
for(var i = 0,l = domElements.length;i < l;i++){
if(domElements[i] === element){
return true;
};
};
return false;
},
/*
---------------------------------------------------------------------------
INSERTION
---------------------------------------------------------------------------
*/
/**
* Inserts <code>node</code> at the given <code>index</code>
* inside <code>parent</code>.
*
* @param node {Node} node to insert
* @param parent {Element} parent element node
* @param index {Integer} where to insert
* @return {Boolean} returns true (successful)
*/
insertAt : function(node, parent, index){
var ref = parent.childNodes[index];
if(ref){
parent.insertBefore(node, ref);
} else {
parent.appendChild(node);
};
return true;
},
/**
* Insert <code>node</code> into <code>parent</code> as first child.
* Indexes of other children will be incremented by one.
*
* @param node {Node} Node to insert
* @param parent {Element} parent element node
* @return {Boolean} returns true (successful)
*/
insertBegin : function(node, parent){
if(parent.firstChild){
this.insertBefore(node, parent.firstChild);
} else {
parent.appendChild(node);
};
return true;
},
/**
* Insert <code>node</code> into <code>parent</code> as last child.
*
* @param node {Node} Node to insert
* @param parent {Element} parent element node
* @return {Boolean} returns true (successful)
*/
insertEnd : function(node, parent){
parent.appendChild(node);
return true;
},
/**
* Inserts <code>node</code> before <code>ref</code> in the same parent.
*
* @param node {Node} Node to insert
* @param ref {Node} Node which will be used as reference for insertion
* @return {Boolean} returns true (successful)
*/
insertBefore : function(node, ref){
ref.parentNode.insertBefore(node, ref);
return true;
},
/**
* Inserts <code>node</code> after <code>ref</code> in the same parent.
*
* @param node {Node} Node to insert
* @param ref {Node} Node which will be used as reference for insertion
* @return {Boolean} returns true (successful)
*/
insertAfter : function(node, ref){
var parent = ref.parentNode;
if(ref == parent.lastChild){
parent.appendChild(node);
} else {
return this.insertBefore(node, ref.nextSibling);
};
return true;
},
/*
---------------------------------------------------------------------------
REMOVAL
---------------------------------------------------------------------------
*/
/**
* Removes the given <code>node</code> from its parent element.
*
* @param node {Node} Node to remove
* @return {Boolean} <code>true</code> when node was successfully removed,
* otherwise <code>false</code>
*/
remove : function(node){
if(!node.parentNode){
return false;
};
node.parentNode.removeChild(node);
return true;
},
/**
* Removes the given <code>node</code> from the <code>parent</code>.
*
* @param node {Node} Node to remove
* @param parent {Element} parent element which contains the <code>node</code>
* @return {Boolean} <code>true</code> when node was successfully removed,
* otherwise <code>false</code>
*/
removeChild : function(node, parent){
if(node.parentNode !== parent){
return false;
};
parent.removeChild(node);
return true;
},
/**
* Removes the node at the given <code>index</code>
* from the <code>parent</code>.
*
* @param index {Integer} position of the node which should be removed
* @param parent {Element} parent DOM element
* @return {Boolean} <code>true</code> when node was successfully removed,
* otherwise <code>false</code>
*/
removeChildAt : function(index, parent){
var child = parent.childNodes[index];
if(!child){
return false;
};
parent.removeChild(child);
return true;
},
/*
---------------------------------------------------------------------------
REPLACE
---------------------------------------------------------------------------
*/
/**
* Replaces <code>oldNode</code> with <code>newNode</code> in the current
* parent of <code>oldNode</code>.
*
* @param newNode {Node} DOM node to insert
* @param oldNode {Node} DOM node to remove
* @return {Boolean} <code>true</code> when node was successfully replaced
*/
replaceChild : function(newNode, oldNode){
if(!oldNode.parentNode){
return false;
};
oldNode.parentNode.replaceChild(newNode, oldNode);
return true;
},
/**
* Replaces the node at <code>index</code> with <code>newNode</code> in
* the given parent.
*
* @param newNode {Node} DOM node to insert
* @param index {Integer} position of old DOM node
* @param parent {Element} parent DOM element
* @return {Boolean} <code>true</code> when node was successfully replaced
*/
replaceAt : function(newNode, index, parent){
var oldNode = parent.childNodes[index];
if(!oldNode){
return false;
};
parent.replaceChild(newNode, oldNode);
return true;
},
/**
* Stores helper element for element creation in WebKit
*
* @internal
*/
__helperElement : {
},
/**
* Saves whether a helper element is needed for each window.
*
* @internal
*/
__allowMarkup : {
},
/**
* Detects if the DOM support a <code>document.createElement</code> call with a
* <code>String</code> as markup like:
*
* <pre class="javascript">
* document.createElement("<INPUT TYPE='RADIO' NAME='RADIOTEST' VALUE='Second Choice'>");
* </pre>
*
* Element creation with markup is not standard compatible with Document Object Model (Core) Level 1, but
* Internet Explorer supports it. With an exception that IE9 in IE9 standard mode is standard compatible and
* doesn't support element creation with markup.
*
* @param win {Window?} Window to check for
* @return {Boolean} <code>true</code> if the DOM supports it, <code>false</code> otherwise.
*/
_allowCreationWithMarkup : function(win){
if(!win){
win = window;
};
// key is needed to allow using different windows
var key = win.location.href;
if(qx.dom.Element.__allowMarkup[key] == undefined){
try{
win.document.createElement("<INPUT TYPE='RADIO' NAME='RADIOTEST' VALUE='Second Choice'>");
qx.dom.Element.__allowMarkup[key] = true;
} catch(e) {
qx.dom.Element.__allowMarkup[key] = false;
};
};
return qx.dom.Element.__allowMarkup[key];
},
/**
* Creates and returns a DOM helper element.
*
* @param win {Window?} Window to create the element for
* @return {Element} The created element node
*/
getHelperElement : function(win){
if(!win){
win = window;
};
// key is needed to allow using different windows
var key = win.location.href;
if(!qx.dom.Element.__helperElement[key]){
var helper = qx.dom.Element.__helperElement[key] = win.document.createElement("div");
// innerHTML will only parsed correctly if element is appended to document
if(qx.core.Environment.get("engine.name") == "webkit"){
helper.style.display = "none";
win.document.body.appendChild(helper);
};
};
return qx.dom.Element.__helperElement[key];
},
/**
* Creates a DOM element.
*
* Attributes may be given directly with this call. This is critical
* for some attributes e.g. name, type, ... in many clients.
*
* Depending on the kind of attributes passed, <code>innerHTML</code> may be
* used internally to assemble the element. Please make sure you understand
* the security implications. See {@link qx.bom.Html#clean}.
*
* @param name {String} Tag name of the element
* @param attributes {Map?} Map of attributes to apply
* @param win {Window?} Window to create the element for
* @return {Element} The created element node
*/
create : function(name, attributes, win){
if(!win){
win = window;
};
if(!name){
throw new Error("The tag name is missing!");
};
var initial = this.__initialAttributes;
var attributesHtml = "";
for(var key in attributes){
if(initial[key]){
attributesHtml += key + "='" + attributes[key] + "' ";
};
};
var element;
// If specific attributes are defined we need to process
// the element creation in a more complex way.
if(attributesHtml != ""){
if(qx.dom.Element._allowCreationWithMarkup(win)){
element = win.document.createElement("<" + name + " " + attributesHtml + ">");
} else {
var helper = qx.dom.Element.getHelperElement(win);
helper.innerHTML = "<" + name + " " + attributesHtml + "></" + name + ">";
element = helper.firstChild;
};
} else {
element = win.document.createElement(name);
};
for(var key in attributes){
if(!initial[key]){
qx.bom.element.Attribute.set(element, key, attributes[key]);
};
};
return element;
},
/**
* Removes all content from the given element
*
* @param element {Element} element to clean
* @return {String} empty string (new HTML content)
*/
empty : function(element){
return element.innerHTML = "";
}
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2004-2010 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Sebastian Werner (wpbasti)
* Alexander Steitz (aback)
======================================================================
This class contains code based on the following work:
* Prototype JS
http://www.prototypejs.org/
Version 1.5
Copyright:
(c) 2006-2007, Prototype Core Team
License:
MIT: http://www.opensource.org/licenses/mit-license.php
Authors:
* Prototype Core Team
----------------------------------------------------------------------
Copyright (c) 2005-2008 Sam Stephenson
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
************************************************************************ */
/**
* Attribute/Property handling for DOM HTML elements.
*
* Also includes support for HTML properties like <code>checked</code>
* or <code>value</code>. This feature set is supported cross-browser
* through one common interface and is independent of the differences between
* the multiple implementations.
*
* Supports applying text and HTML content using the attribute names
* <code>text</code> and <code>html</code>.
*/
qx.Bootstrap.define("qx.bom.element.Attribute", {
/*
*****************************************************************************
STATICS
*****************************************************************************
*/
statics : {
/** Internal map of attribute conversions */
__hints : {
// Name translation table (camelcase is important for some attributes)
names : {
"class" : "className",
"for" : "htmlFor",
html : "innerHTML",
text : qx.core.Environment.get("html.element.textcontent") ? "textContent" : "innerText",
colspan : "colSpan",
rowspan : "rowSpan",
valign : "vAlign",
datetime : "dateTime",
accesskey : "accessKey",
tabindex : "tabIndex",
maxlength : "maxLength",
readonly : "readOnly",
longdesc : "longDesc",
cellpadding : "cellPadding",
cellspacing : "cellSpacing",
frameborder : "frameBorder",
usemap : "useMap"
},
// Attributes which are only applyable on a DOM element (not using compile())
runtime : {
"html" : 1,
"text" : 1
},
// Attributes which are (forced) boolean
bools : {
compact : 1,
nowrap : 1,
ismap : 1,
declare : 1,
noshade : 1,
checked : 1,
disabled : 1,
readOnly : 1,
multiple : 1,
selected : 1,
noresize : 1,
defer : 1,
allowTransparency : 1
},
// Interpreted as property (element.property)
property : {
// Used by qx.html.Element
$$html : 1,
// Used by qx.ui.core.Widget
$$widget : 1,
// Native properties
disabled : 1,
checked : 1,
readOnly : 1,
multiple : 1,
selected : 1,
value : 1,
maxLength : 1,
className : 1,
innerHTML : 1,
innerText : 1,
textContent : 1,
htmlFor : 1,
tabIndex : 1
},
qxProperties : {
$$widget : 1,
$$html : 1
},
// Default values when "null" is given to a property
propertyDefault : {
disabled : false,
checked : false,
readOnly : false,
multiple : false,
selected : false,
value : "",
className : "",
innerHTML : "",
innerText : "",
textContent : "",
htmlFor : "",
tabIndex : 0,
maxLength : qx.core.Environment.select("engine.name", {
"mshtml" : 2147483647,
"webkit" : 524288,
"default" : -1
})
},
// Properties which can be removed to reset them
removeableProperties : {
disabled : 1,
multiple : 1,
maxLength : 1
},
// Use getAttribute(name, 2) for these to query for the real value, not
// the interpreted one.
original : {
href : 1,
src : 1,
type : 1
}
},
/**
* Compiles an incoming attribute map to a string which
* could be used when building HTML blocks using innerHTML.
*
* This method silently ignores runtime attributes like
* <code>html</code> or <code>text</code>.
*
* @param map {Map} Map of attributes. The key is the name of the attribute.
* @return {String} Returns a compiled string ready for usage.
*/
compile : function(map){
var html = [];
var runtime = this.__hints.runtime;
for(var key in map){
if(!runtime[key]){
html.push(key, "='", map[key], "'");
};
};
return html.join("");
},
/**
* Returns the value of the given HTML attribute
*
* @param element {Element} The DOM element to query
* @param name {String} Name of the attribute
* @return {var} The value of the attribute
*/
get : function(element, name){
var hints = this.__hints;
var value;
// normalize name
name = hints.names[name] || name;
// respect original values
// http://msdn2.microsoft.com/en-us/library/ms536429.aspx
if(qx.core.Environment.get("engine.name") == "mshtml" && parseInt(qx.core.Environment.get("browser.documentmode"), 10) < 8 && hints.original[name]){
value = element.getAttribute(name, 2);
} else if(hints.property[name]){
value = element[name];
if(typeof hints.propertyDefault[name] !== "undefined" && value == hints.propertyDefault[name]){
// only return null for all non-boolean properties
if(typeof hints.bools[name] === "undefined"){
return null;
} else {
return value;
};
};
} else {
// fallback to attribute
value = element.getAttribute(name);
};
if(hints.bools[name]){
return !!value;
};
return value;
},
/**
* Sets an HTML attribute on the given DOM element
*
* @param element {Element} The DOM element to modify
* @param name {String} Name of the attribute
* @param value {var} New value of the attribute
*/
set : function(element, name, value){
if(typeof value === "undefined"){
return;
};
var hints = this.__hints;
// normalize name
name = hints.names[name] || name;
// respect booleans
if(hints.bools[name]){
value = !!value;
};
// apply attribute
// only properties which can be applied by the browser or qxProperties
// otherwise use the attribute methods
if(hints.property[name] && (!(element[name] === undefined) || hints.qxProperties[name])){
// resetting the attribute/property
if(value == null){
// for properties which need to be removed for a correct reset
if(hints.removeableProperties[name]){
element.removeAttribute(name);
return;
} else if(typeof hints.propertyDefault[name] !== "undefined"){
value = hints.propertyDefault[name];
};
};
element[name] = value;
} else {
if(value === true){
element.setAttribute(name, name);
} else if(value === false || value === null){
element.removeAttribute(name);
} else {
element.setAttribute(name, value);
};
};
},
/**
* Resets an HTML attribute on the given DOM element
*
* @param element {Element} The DOM element to modify
* @param name {String} Name of the attribute
*/
reset : function(element, name){
this.set(element, name, null);
}
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2012 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Martin Wittemann (wittemann)
************************************************************************ */
/**
* Utility for checking the type of a variable.
* It adds a <code>type</code> key static to q and offers the given method.
*
* <pre class="javascript">
* q.type.get("abc"); // return "String" e.g.
* </pre>
*/
qx.Bootstrap.define("qx.module.util.Type", {
statics : {
/**
* Get the internal class of the value. The following classes are possible:
* <code>"String"</code>,
* <code>"Array"</code>,
* <code>"Object"</code>,
* <code>"RegExp"</code>,
* <code>"Number"</code>,
* <code>"Boolean"</code>,
* <code>"Date"</code>,
* <code>"Function"</code>,
* <code>"Error"</code>
* </pre>
* @attachStatic {qxWeb, type.get}
* @signature function(value)
* @param value {var} Value to get the class for.
* @return {String} The internal class of the value.
*/
get : qx.Bootstrap.getClass
},
defer : function(statics){
qxWeb.$attachStatic({
type : {
get : statics.get
}
});
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2004-2012 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Martin Wittemann (wittemann)
======================================================================
This class contains code based on the following work:
* es5-shim
Code:
https://github.com/kriskowal/es5-shim/
Copyright:
(c) 2009, 2010 Kristopher Michael Kowal
License:
https://github.com/kriskowal/es5-shim/blob/master/LICENSE
----------------------------------------------------------------------
Copyright 2009, 2010 Kristopher Michael Kowal. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
----------------------------------------------------------------------
Version:
Snapshot taken on 2012-07-25,:
commit 9f539abd9aa9950e1d907077a4be7f5133a00e52
************************************************************************ */
/**
* This class takes care of the normalization of the native 'Function' object.
* Therefore it checks the availability of the following methods and appends
* it, if not available. This means you can use the methods during
* development in every browser. For usage samples, check out the attached links.
*
* *bind*:
* <a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Function/bind">MDN documentation</a> |
* <a href="http://es5.github.com/#x15.3.4.5">Annotated ES5 Spec</a>
*/
qx.Bootstrap.define("qx.lang.normalize.Function", {
defer : function(){
// bind
if(!qx.core.Environment.get("ecmascript.function.bind")){
var slice = Array.prototype.slice;
Function.prototype.bind = function(that){
// .length is 1
// 1. Let Target be the this value.
var target = this;
// 2. If IsCallable(Target) is false, throw a TypeError exception.
if(typeof target != "function"){
throw new TypeError("Function.prototype.bind called on incompatible " + target);
};
// 3. Let A be a new (possibly empty) internal list of all of the
// argument values provided after thisArg (arg1, arg2 etc), in order.
// XXX slicedArgs will stand in for "A" if used
var args = slice.call(arguments, 1);
// for normal call
// 4. Let F be a new native ECMAScript object.
// 11. Set the [[Prototype]] internal property of F to the standard
// built-in Function prototype object as specified in 15.3.3.1.
// 12. Set the [[Call]] internal property of F as described in
// 15.3.4.5.1.
// 13. Set the [[Construct]] internal property of F as described in
// 15.3.4.5.2.
// 14. Set the [[HasInstance]] internal property of F as described in
// 15.3.4.5.3.
var bound = function(){
if(this instanceof bound){
// 15.3.4.5.2 [[Construct]]
// When the [[Construct]] internal method of a function object,
// F that was created using the bind function is called with a
// list of arguments ExtraArgs, the following steps are taken:
// 1. Let target be the value of F's [[TargetFunction]]
// internal property.
// 2. If target has no [[Construct]] internal method, a
// TypeError exception is thrown.
// 3. Let boundArgs be the value of F's [[BoundArgs]] internal
// property.
// 4. Let args be a new list containing the same values as the
// list boundArgs in the same order followed by the same
// values as the list ExtraArgs in the same order.
// 5. Return the result of calling the [[Construct]] internal
// method of target providing args as the arguments.
var F = function(){
};
F.prototype = target.prototype;
var self = new F;
var result = target.apply(self, args.concat(slice.call(arguments)));
if(Object(result) === result){
return result;
};
return self;
} else {
// 15.3.4.5.1 [[Call]]
// When the [[Call]] internal method of a function object, F,
// which was created using the bind function is called with a
// this value and a list of arguments ExtraArgs, the following
// steps are taken:
// 1. Let boundArgs be the value of F's [[BoundArgs]] internal
// property.
// 2. Let boundThis be the value of F's [[BoundThis]] internal
// property.
// 3. Let target be the value of F's [[TargetFunction]] internal
// property.
// 4. Let args be a new list containing the same values as the
// list boundArgs in the same order followed by the same
// values as the list ExtraArgs in the same order.
// 5. Return the result of calling the [[Call]] internal method
// of target providing boundThis as the this value and
// providing args as the arguments.
// equiv: target.call(this, ...boundArgs, ...args)
return target.apply(that, args.concat(slice.call(arguments)));
};
};
// XXX bound.length is never writable, so don't even try
//
// 15. If the [[Class]] internal property of Target is "Function", then
// a. Let L be the length property of Target minus the length of A.
// b. Set the length own property of F to either 0 or L, whichever is
// larger.
// 16. Else set the length own property of F to 0.
// 17. Set the attributes of the length own property of F to the values
// specified in 15.3.5.1.
// TODO
// 18. Set the [[Extensible]] internal property of F to true.
// TODO
// 19. Let thrower be the [[ThrowTypeError]] function Object (13.2.3).
// 20. Call the [[DefineOwnProperty]] internal method of F with
// arguments "caller", PropertyDescriptor {[[Get]]: thrower, [[Set]]:
// thrower, [[Enumerable]]: false, [[Configurable]]: false}, and
// false.
// 21. Call the [[DefineOwnProperty]] internal method of F with
// arguments "arguments", PropertyDescriptor {[[Get]]: thrower,
// [[Set]]: thrower, [[Enumerable]]: false, [[Configurable]]: false},
// and false.
// NOTE Function objects created using Function.prototype.bind do not
// have a prototype property or the [[Code]], [[FormalParameters]], and
// [[Scope]] internal properties.
// XXX can't delete prototype in pure-js.
// 22. Return F.
return bound;
};
};
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2004-2012 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Martin Wittemann (wittemann)
************************************************************************ */
/**
* This class takes care of the normalization of the native 'Error' object.
* It contains a simple bugfix for toString which might not print out the proper
* error message.
*
* *toString*:
* <a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error/toString">MDN documentation</a> |
* <a href="http://es5.github.com/#x15.11.4.4">Annotated ES5 Spec</a>
*/
qx.Bootstrap.define("qx.lang.normalize.Error", {
defer : function(){
// toString
if(!qx.core.Environment.get("ecmascript.error.toString")){
Error.prototype.toString = function(){
var name = this.name || "Error";
var message = this.message || "";
if(name === "" && message === ""){
return "Error";
};
if(name === ""){
return message;
};
if(message === ""){
return name;
};
return name + ": " + message;
};
};
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2012 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Martin Wittemann (wittemann)
* Daniel Wagner (danielwagner)
************************************************************************ */
/* ************************************************************************
#require(qx.lang.normalize.Function)
#require(qx.lang.normalize.String)
#require(qx.lang.normalize.Date)
#require(qx.lang.normalize.Array)
#require(qx.lang.normalize.Error)
#require(qx.lang.normalize.Object)
************************************************************************ */
/**
* Adds JavaScript features that may not be supported by all clients.
*/
qx.Bootstrap.define("qx.module.Polyfill", {
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2011-2012 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Martin Wittemann (wittemann)
* Daniel Wagner (danielwagner)
************************************************************************ */
/* ************************************************************************
#require(qx.module.Polyfill)
************************************************************************ */
/**
* Support for native and custom events.
*/
qx.Bootstrap.define("qx.module.Event", {
statics : {
/**
* Event normalization registry
*
* @internal
*/
__normalizations : {
},
/**
* Registry of event hooks
* @internal
*/
__hooks : {
on : {
},
off : {
}
},
/**
* Registers a listener for the given event type on each item in the
* collection. This can be either native or custom events.
*
* @attach {qxWeb}
* @param type {String} Type of the event to listen for
* @param listener {Function} Listener callback
* @param context {Object?} Context the callback function will be executed in.
* Default: The element on which the listener was registered
* @return {qxWeb} The collection for chaining
*/
on : function(type, listener, context){
for(var i = 0;i < this.length;i++){
var el = this[i];
var ctx = context || qxWeb(el);
// call hooks
var hooks = qx.module.Event.__hooks.on;
// generic
var typeHooks = hooks["*"] || [];
// type specific
if(hooks[type]){
typeHooks = typeHooks.concat(hooks[type]);
};
for(var j = 0,m = typeHooks.length;j < m;j++){
typeHooks[j](el, type, listener, context);
};
var bound = function(event){
// apply normalizations
var registry = qx.module.Event.__normalizations;
// generic
var normalizations = registry["*"] || [];
// type specific
if(registry[type]){
normalizations = normalizations.concat(registry[type]);
};
for(var x = 0,y = normalizations.length;x < y;x++){
event = normalizations[x](event, el, type);
};
// call original listener with normalized event
listener.apply(this, [event]);
}.bind(ctx);
bound.original = listener;
// add native listener
if(qx.bom.Event.supportsEvent(el, type)){
qx.bom.Event.addNativeListener(el, type, bound);
};
// create an emitter if necessary
if(!el.__emitter){
el.__emitter = new qx.event.Emitter();
};
var id = el.__emitter.on(type, bound, ctx);
if(!el.__listener){
el.__listener = {
};
};
if(!el.__listener[type]){
el.__listener[type] = {
};
};
el.__listener[type][id] = bound;
if(!context){
// store a reference to the dynamically created context so we know
// what to check for when removing the listener
if(!el.__ctx){
el.__ctx = {
};
};
el.__ctx[id] = ctx;
};
};
return this;
},
/**
* Unregisters event listeners for the given type from each element in the
* collection.
*
* @attach {qxWeb}
* @param type {String} Type of the event
* @param listener {Function} Listener callback
* @param context {Object?} Listener callback context
* @return {qxWeb} The collection for chaining
*/
off : function(type, listener, context){
for(var j = 0;j < this.length;j++){
var el = this[j];
// continue if no listener are available
if(!el.__listener){
continue;
};
for(var id in el.__listener[type]){
var storedListener = el.__listener[type][id];
if(storedListener == listener || storedListener.original == listener){
// get the stored context
var hasStoredContext = typeof el.__ctx !== "undefined" && el.__ctx[id];
if(!context && hasStoredContext){
var storedContext = el.__ctx[id];
};
// remove the listener from the emitter
el.__emitter.off(type, storedListener, storedContext || context);
// check if it's a bound listener which means it was a native event
if(storedListener.original == listener){
// remove the native listener
qx.bom.Event.removeNativeListener(el, type, storedListener);
};
delete el.__listener[type][id];
if(hasStoredContext){
delete el.__ctx[id];
};
};
};
// call hooks
var hooks = qx.module.Event.__hooks.off;
// generic
var typeHooks = hooks["*"] || [];
// type specific
if(hooks[type]){
typeHooks = typeHooks.concat(hooks[type]);
};
for(var i = 0,m = typeHooks.length;i < m;i++){
typeHooks[i](el, type, listener, context);
};
};
return this;
},
/**
* Fire an event of the given type.
*
* @attach {qxWeb}
* @param type {String} Event type
* @param data {var?} Optional data that will be passed to the listener
* callback function.
* @return {qxWeb} The collection for chaining
*/
emit : function(type, data){
for(var j = 0;j < this.length;j++){
var el = this[j];
if(el.__emitter){
el.__emitter.emit(type, data);
};
};
return this;
},
/**
* Attaches a listener for the given event that will be executed only once.
*
* @attach {qxWeb}
* @param type {String} Type of the event to listen for
* @param listener {Function} Listener callback
* @param context {Object?} Context the callback function will be executed in.
* Default: The element on which the listener was registered
* @return {qxWeb} The collection for chaining
*/
once : function(type, listener, context){
var self = this;
var wrappedListener = function(data){
self.off(type, wrappedListener, context);
listener.call(this, data);
};
this.on(type, wrappedListener, context);
return this;
},
/**
* Checks if one or more listeners for the given event type are attached to
* the first element in the collection
*
* @attach {qxWeb}
* @param type {String} Event type, e.g. <code>mousedown</code>
* @return {Boolean} <code>true</code> if one or more listeners are attached
*/
hasListener : function(type){
if(!this[0] || !this[0].__emitter || !this[0].__emitter.getListeners()[type]){
return false;
};
return this[0].__emitter.getListeners()[type].length > 0;
},
/**
* Copies any event listeners that are attached to the elements in the
* collection to the provided target element
*
* @internal
* @param target {Element} Element to attach the copied listeners to
*/
copyEventsTo : function(target){
var source = this.concat();
// get all children of source and target
for(var i = source.length - 1;i >= 0;i--){
var descendants = source[i].getElementsByTagName("*");
for(var j = 0;j < descendants.length;j++){
source.push(descendants[j]);
};
};
for(var i = target.length - 1;i >= 0;i--){
var descendants = target[i].getElementsByTagName("*");
for(var j = 0;j < descendants.length;j++){
target.push(descendants[j]);
};
};
// make sure no emitter object has been copied
target.forEach(function(el){
el.__emitter = null;
});
for(var i = 0;i < source.length;i++){
var el = source[i];
if(!el.__emitter){
continue;
};
var storage = el.__emitter.getListeners();
for(var name in storage){
for(var j = storage[name].length - 1;j >= 0;j--){
var listener = storage[name][j].listener;
if(listener.original){
listener = listener.original;
};
qxWeb(target[i]).on(name, listener, storage[name][j].ctx);
};
};
};
},
__isReady : false,
/**
* Executes the given function once the document is ready.
*
* @attachStatic {qxWeb}
* @param callback {Function} callback function
*/
ready : function(callback){
// DOM is already ready
if(document.readyState === "complete"){
window.setTimeout(callback, 1);
return;
};
// listen for the load event so the callback is executed no matter what
var onWindowLoad = function(){
qx.module.Event.__isReady = true;
callback();
};
qxWeb(window).on("load", onWindowLoad);
var wrappedCallback = function(){
qxWeb(window).off("load", onWindowLoad);
callback();
};
// Listen for DOMContentLoaded event if available (no way to reliably detect
// support)
if(qxWeb.env.get("engine.name") !== "mshtml" || qxWeb.env.get("browser.documentmode") > 8){
qx.bom.Event.addNativeListener(document, "DOMContentLoaded", wrappedCallback);
} else {
// Continually check to see if the document is ready
var timer = function(){
// onWindowLoad already executed
if(qx.module.Event.__isReady){
return;
};
try{
// If DOMContentLoaded is unavailable, use the trick by Diego Perini
// http://javascript.nwbox.com/IEContentLoaded/
document.documentElement.doScroll("left");
if(document.body){
wrappedCallback();
};
} catch(error) {
window.setTimeout(timer, 100);
};
};
timer();
};
},
/**
* Registers a normalization function for the given event types. Listener
* callbacks for these types will be called with the return value of the
* normalization function instead of the regular event object.
*
* The normalizer will be called with two arguments: The original event
* object and the element on which the event was triggered
*
* @attachStatic {qxWeb, $registerEventNormalization}
* @param types {String[]} List of event types to be normalized. Use an
* asterisk (<code>*</code>) to normalize all event types
* @param normalizer {Function} Normalizer function
*/
$registerNormalization : function(types, normalizer){
if(!qx.lang.Type.isArray(types)){
types = [types];
};
var registry = qx.module.Event.__normalizations;
for(var i = 0,l = types.length;i < l;i++){
var type = types[i];
if(qx.lang.Type.isFunction(normalizer)){
if(!registry[type]){
registry[type] = [];
};
registry[type].push(normalizer);
};
};
},
/**
* Unregisters a normalization function from the given event types.
*
* @attachStatic {qxWeb, $unregisterEventNormalization}
* @param types {String[]} List of event types
* @param normalizer {Function} Normalizer function
*/
$unregisterNormalization : function(types, normalizer){
if(!qx.lang.Type.isArray(types)){
types = [types];
};
var registry = qx.module.Event.__normalizations;
for(var i = 0,l = types.length;i < l;i++){
var type = types[i];
if(registry[type]){
qx.lang.Array.remove(registry[type], normalizer);
};
};
},
/**
* Returns all registered event normalizers
*
* @attachStatic {qxWeb, $getEventNormalizationRegistry}
* @return {Map} Map of event types/normalizer functions
*/
$getRegistry : function(){
return qx.module.Event.__normalizations;
},
/**
* Registers an event hook for the given event types.
*
* @attachStatic {qxWeb, $registerEventHook}
* @param types {String[]} List of event types
* @param registerHook {Function} Hook function to be called on event registration
* @param unregisterHook {Function?} Hook function to be called on event deregistration
* @internal
*/
$registerEventHook : function(types, registerHook, unregisterHook){
if(!qx.lang.Type.isArray(types)){
types = [types];
};
var onHooks = qx.module.Event.__hooks.on;
for(var i = 0,l = types.length;i < l;i++){
var type = types[i];
if(qx.lang.Type.isFunction(registerHook)){
if(!onHooks[type]){
onHooks[type] = [];
};
onHooks[type].push(registerHook);
};
};
if(!unregisterHook){
return;
};
var offHooks = qx.module.Event.__hooks.off;
for(var i = 0,l = types.length;i < l;i++){
var type = types[i];
if(qx.lang.Type.isFunction(unregisterHook)){
if(!offHooks[type]){
offHooks[type] = [];
};
offHooks[type].push(unregisterHook);
};
};
},
/**
* Unregisters a hook from the given event types.
*
* @attachStatic {qxWeb, $unregisterEventHooks}
* @param types {String[]} List of event types
* @param registerHook {Function} Hook function to be called on event registration
* @param unregisterHook {Function?} Hook function to be called on event deregistration
* @internal
*/
$unregisterEventHook : function(types, registerHook, unregisterHook){
if(!qx.lang.Type.isArray(types)){
types = [types];
};
var onHooks = qx.module.Event.__hooks.on;
for(var i = 0,l = types.length;i < l;i++){
var type = types[i];
if(onHooks[type]){
qx.lang.Array.remove(onHooks[type], registerHook);
};
};
if(!unregisterHook){
return;
};
var offHooks = qx.module.Event.__hooks.off;
for(var i = 0,l = types.length;i < l;i++){
var type = types[i];
if(offHooks[type]){
qx.lang.Array.remove(offHooks[type], unregisterHook);
};
};
},
/**
* Returns all registered event hooks
*
* @attachStatic {qxWeb, $getEventHookRegistry}
* @return {Map} Map of event types/registration hook functions
* @internal
*/
$getHookRegistry : function(){
return qx.module.Event.__hooks;
}
},
defer : function(statics){
qxWeb.$attach({
"on" : statics.on,
"off" : statics.off,
"once" : statics.once,
"emit" : statics.emit,
"hasListener" : statics.hasListener,
"copyEventsTo" : statics.copyEventsTo
});
qxWeb.$attachStatic({
"ready" : statics.ready,
"$registerEventNormalization" : statics.$registerNormalization,
"$unregisterEventNormalization" : statics.$unregisterNormalization,
"$getEventNormalizationRegistry" : statics.$getRegistry,
"$registerEventHook" : statics.$registerEventHook,
"$unregisterEventHook" : statics.$unregisterEventHook,
"$getEventHookRegistry" : statics.$getHookRegistry
});
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2007-2008 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Fabian Jakobs (fjakobs)
* Sebastian Werner (wpbasti)
* Alexander Steitz (aback)
* Christian Hagendorn (chris_schmidt)
======================================================================
This class contains code based on the following work:
* Juriy Zaytsev
http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/
Copyright (c) 2009 Juriy Zaytsev
Licence:
BSD: http://github.com/kangax/iseventsupported/blob/master/LICENSE
----------------------------------------------------------------------
http://github.com/kangax/iseventsupported/blob/master/LICENSE
Copyright (c) 2009 Juriy Zaytsev
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
************************************************************************ */
/**
* Wrapper around native event management capabilities of the browser.
* This class should not be used directly normally. It's better
* to use {@link qx.event.Registration} instead.
*/
qx.Bootstrap.define("qx.bom.Event", {
statics : {
/**
* Use the low level browser functionality to attach event listeners
* to DOM nodes.
*
* Use this with caution. This is only thought for event handlers and
* qualified developers. These are not mem-leak protected!
*
* @param target {Object} Any valid native event target
* @param type {String} Name of the event
* @param listener {Function} The pointer to the function to assign
* @param useCapture {Boolean ? false} A Boolean value that specifies the event phase to add
* the event handler for the capturing phase or the bubbling phase.
*/
addNativeListener : function(target, type, listener, useCapture){
if(target.addEventListener){
target.addEventListener(type, listener, !!useCapture);
} else if(target.attachEvent){
target.attachEvent("on" + type, listener);
} else if(typeof target["on" + type] != "undefined"){
target["on" + type] = listener;
} else {
{
};
};;
},
/**
* Use the low level browser functionality to remove event listeners
* from DOM nodes.
*
* @param target {Object} Any valid native event target
* @param type {String} Name of the event
* @param listener {Function} The pointer to the function to assign
* @param useCapture {Boolean ? false} A Boolean value that specifies the event phase to remove
* the event handler for the capturing phase or the bubbling phase.
*/
removeNativeListener : function(target, type, listener, useCapture){
if(target.removeEventListener){
target.removeEventListener(type, listener, !!useCapture);
} else if(target.detachEvent){
try{
target.detachEvent("on" + type, listener);
} catch(e) {
// IE7 sometimes dispatches "unload" events on protected windows
// Ignore the "permission denied" errors.
if(e.number !== -2146828218){
throw e;
};
};
} else if(typeof target["on" + type] != "undefined"){
target["on" + type] = null;
} else {
{
};
};;
},
/**
* Returns the target of the event.
*
* @param e {Event} Native event object
* @return {Object} Any valid native event target
*/
getTarget : function(e){
return e.target || e.srcElement;
},
/**
* Computes the related target from the native DOM event
*
* @param e {Event} Native DOM event object
* @return {Element} The related target
*/
getRelatedTarget : function(e){
if(e.relatedTarget !== undefined){
// In Firefox the related target of mouse events is sometimes an
// anonymous div inside of a text area, which raises an exception if
// the nodeType is read. This is why the try/catch block is needed.
if((qx.core.Environment.get("engine.name") == "gecko")){
try{
e.relatedTarget && e.relatedTarget.nodeType;
} catch(ex) {
return null;
};
};
return e.relatedTarget;
} else if(e.fromElement !== undefined && e.type === "mouseover"){
return e.fromElement;
} else if(e.toElement !== undefined){
return e.toElement;
} else {
return null;
};;
},
/**
* Prevent the native default of the event to be processed.
*
* This is useful to stop native keybindings, native selection
* and other native functionality behind events.
*
* @param e {Event} Native event object
*/
preventDefault : function(e){
if(e.preventDefault){
e.preventDefault();
} else {
try{
// this allows us to prevent some key press events in IE.
// See bug #1049
e.keyCode = 0;
} catch(ex) {
};
e.returnValue = false;
};
},
/**
* Stops the propagation of the given event to the parent element.
*
* Only useful for events which bubble e.g. mousedown.
*
* @param e {Event} Native event object
*/
stopPropagation : function(e){
if(e.stopPropagation){
e.stopPropagation();
} else {
e.cancelBubble = true;
};
},
/**
* Fires a synthetic native event on the given element.
*
* @param target {Element} DOM element to fire event on
* @param type {String} Name of the event to fire
* @return {Boolean} A value that indicates whether any of the event handlers called {@link #preventDefault}.
* <code>true</code> The default action is permitted, <code>false</code> the caller should prevent the default action.
*/
fire : function(target, type){
// dispatch for standard first
if(document.createEvent){
var evt = document.createEvent("HTMLEvents");
evt.initEvent(type, true, true);
return !target.dispatchEvent(evt);
} else {
var evt = document.createEventObject();
return target.fireEvent("on" + type, evt);
};
},
/**
* Whether the given target supports the given event type.
*
* Useful for testing for support of new features like
* touch events, gesture events, orientation change, on/offline, etc.
*
* @signature function(target, type)
* @param target {var} Any valid target e.g. window, dom node, etc.
* @param type {String} Type of the event e.g. click, mousedown
* @return {Boolean} Whether the given event is supported
*/
supportsEvent : function(target, type){
var eventName = "on" + type;
var supportsEvent = (eventName in target);
if(!supportsEvent){
supportsEvent = typeof target[eventName] == "function";
if(!supportsEvent && target.setAttribute){
target.setAttribute(eventName, "return;");
supportsEvent = typeof target[eventName] == "function";
target.removeAttribute(eventName);
};
};
return supportsEvent;
}
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2004-2012 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Martin Wittemann (wittemann)
************************************************************************ */
/**
* EXPERIMENTAL - NOT READY FOR PRODUCTION
*
* Basic implementation for an event emitter. This supplies a basic and
* minimalistic event mechanism.
*/
qx.Bootstrap.define("qx.event.Emitter", {
extend : Object,
statics : {
/** Static storage for all event listener */
__storage : []
},
members : {
__listener : null,
__any : null,
/**
* Attach a listener to the event emitter. The given <code>name</code>
* will define the type of event. Handing in a <code>'*'</code> will
* listen to all events emitted by the event emitter.
*
* @param name {String} The name of the event to listen to.
* @param listener {Function} The function execute on {@link #emit}.
* @param ctx {var?Window} The context of the listener.
* @return {Integer} An unique <code>id</code> for the attached listener.
*/
on : function(name, listener, ctx){
var id = qx.event.Emitter.__storage.length;
this.__getStorage(name).push({
listener : listener,
ctx : ctx,
id : id
});
qx.event.Emitter.__storage.push({
name : name,
listener : listener,
ctx : ctx
});
return id;
},
/**
* Attach a listener to the event emitter which will be executed only once.
* The given <code>name</code> will define the type of event. Handing in a
* <code>'*'</code> will listen to all events emitted by the event emitter.
*
* @param name {String} The name of the event to listen to.
* @param listener {Function} The function execute on {@link #emit}.
* @param ctx {var?Window} The context of the listener.
* @return {Integer} An unique <code>id</code> for the attached listener.
*/
once : function(name, listener, ctx){
var id = qx.event.Emitter.__storage.length;
this.__getStorage(name).push({
listener : listener,
ctx : ctx,
once : true,
id : id
});
qx.event.Emitter.__storage.push({
name : name,
listener : listener,
ctx : ctx
});
return id;
},
/**
* Remove a listener from the event emitter. The given <code>name</code>
* will define the type of event.
*
* @param name {String} The name of the event to listen to.
* @param listener {Function} The function execute on {@link #emit}.
* @param ctx {var?Window} The context of the listener.
* @return {Integer|null} The listener's id if it was removed or
* <code>null</code> if it wasn't found
*/
off : function(name, listener, ctx){
var storage = this.__getStorage(name);
for(var i = storage.length - 1;i >= 0;i--){
var entry = storage[i];
if(entry.listener == listener && entry.ctx == ctx){
storage.splice(i, 1);
qx.event.Emitter.__storage[entry.id] = null;
return entry.id;
};
};
return null;
},
/**
* Removes the listener identified by the given <code>id</code>. The id
* will be return on attaching the listener and can be stored for removing.
*
* @param id {Integer} The id of the listener.
*/
offById : function(id){
var entry = qx.event.Emitter.__storage[id];
this.off(entry.name, entry.listener, entry.ctx);
},
/**
* Alternative for {@link #on}.
* @param name {String} The name of the event to listen to.
* @param listener {Function} The function execute on {@link #emit}.
* @param ctx {var?Window} The context of the listener.
* @return {Integer} An unique <code>id</code> for the attached listener.
*/
addListener : function(name, listener, ctx){
return this.on(name, listener, ctx);
},
/**
* Alternative for {@link #once}.
* @param name {String} The name of the event to listen to.
* @param listener {Function} The function execute on {@link #emit}.
* @param ctx {var?Window} The context of the listener.
* @return {Integer} An unique <code>id</code> for the attached listener.
*/
addListenerOnce : function(name, listener, ctx){
return this.once(name, listener, ctx);
},
/**
* Alternative for {@link #off}.
* @param name {String} The name of the event to listen to.
* @param listener {Function} The function execute on {@link #emit}.
* @param ctx {var?Window} The context of the listener.
*/
removeListener : function(name, listener, ctx){
this.off(name, listener, ctx);
},
/**
* Alternative for {@link #offById}.
* @param id {Integer} The id of the listener.
*/
removeListenerById : function(id){
this.offById(id);
},
/**
* Emits an event with the given name. The data will be passed
* to the listener.
* @param name {String} The name of the event to emit.
* @param data {var?undefined} The data which should be passed to the listener.
*/
emit : function(name, data){
var storage = this.__getStorage(name);
for(var i = 0;i < storage.length;i++){
var entry = storage[i];
entry.listener.call(entry.ctx, data);
if(entry.once){
storage.splice(i, 1);
i--;
};
};
// call on any
storage = this.__getStorage("*");
for(var i = storage.length - 1;i >= 0;i--){
var entry = storage[i];
entry.listener.call(entry.ctx, data);
};
},
/**
* Returns the internal attached listener.
* @internal
* @return {Map} A map which has the event name as key. The values are
* arrays containing a map with 'listener' and 'ctx'.
*/
getListeners : function(){
return this.__listener;
},
/**
* Internal helper which will return the storage for the given name.
* @param name {String} The name of the event.
* @return {Array} An array which is the storage for the listener and
* the given event name.
*/
__getStorage : function(name){
if(this.__listener == null){
this.__listener = {
};
};
if(this.__listener[name] == null){
this.__listener[name] = [];
};
return this.__listener[name];
}
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2012 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Daniel Wagner (danielwagner)
************************************************************************ */
/* ************************************************************************
#require(qx.module.Event)
************************************************************************ */
/**
* Normalization for touch events
*/
qx.Bootstrap.define("qx.module.event.Touch", {
statics : {
/**
* List of event types to be normalized
* @type {Array}
*/
TYPES : ["tap", "swipe"],
/**
* Manipulates the native event object, adding methods if they're not
* already present
*
* @param event {Event} Native event object
* @param element {Element} DOM element the listener was attached to
* @param type {String} Event type
* @return {Event} Normalized event object
* @internal
*/
normalize : function(event, element, type){
if(!event){
return event;
};
event._type = type;
return event;
}
},
defer : function(statics){
qxWeb.$registerEventNormalization(statics.TYPES, statics.normalize);
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2004-2011 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Martin Wittemann (martinwittemann)
************************************************************************ */
/**
* The class is responsible for device detection. This is specially usefull
* if you are on a mobile device.
*
* This class is used by {@link qx.core.Environment} and should not be used
* directly. Please check its class comment for details how to use it.
*
* @internal
*/
qx.Bootstrap.define("qx.bom.client.Device", {
statics : {
/** Maps user agent names to device IDs */
__ids : {
"iPod" : "ipod",
"iPad" : "ipad",
"iPhone" : "iPhone",
"PSP" : "psp",
"PLAYSTATION 3" : "ps3",
"Nintendo Wii" : "wii",
"Nintendo DS" : "ds",
"XBOX" : "xbox",
"Xbox" : "xbox"
},
/**
* Returns the name of the current device if detectable. It falls back to
* <code>pc</code> if the detection for other devices fails.
*
* @internal
* @return {String} The string of the device found.
*/
getName : function(){
var str = [];
for(var key in this.__ids){
str.push(key);
};
var reg = new RegExp("(" + str.join("|").replace(/\./g, "\.") + ")", "g");
var match = reg.exec(navigator.userAgent);
if(match && match[1]){
return qx.bom.client.Device.__ids[match[1]];
};
return "pc";
},
/**
* Determines on what type of device the application is running.
* Valid values are: "mobile", "tablet" or "desktop".
* @return {String} The device type name of determined device.
*/
getType : function(){
return qx.bom.client.Device.detectDeviceType(navigator.userAgent);
},
/**
* Detects the device type, based on given userAgentString.
*
* @param userAgentString {String} userAgent parameter, needed for decision.
* @return {String} The device type name of determined device: "mobile","desktop","tablet"
*/
detectDeviceType : function(userAgentString){
if(qx.bom.client.Device.detectTabletDevice(userAgentString)){
return "tablet";
} else if(qx.bom.client.Device.detectMobileDevice(userAgentString)){
return "mobile";
};
return "desktop";
},
/**
* Detects if a device is a mobile phone. (Tablets excluded.)
* @param userAgentString {String} userAgent parameter, needed for decision.
* @return {Boolean} Flag which indicates whether it is a mobile device.
*/
detectMobileDevice : function(userAgentString){
return /android.+mobile|ip(hone|od)|bada\/|blackberry|maemo|opera m(ob|in)i|fennec|NetFront|phone|psp|symbian|IEMobile|windows (ce|phone)|xda/i.test(userAgentString);
},
/**
* Detects if a device is a tablet device.
* @param userAgentString {String} userAgent parameter, needed for decision.
* @return {Boolean} Flag which indicates whether it is a tablet device.
*/
detectTabletDevice : function(userAgentString){
var isIE10Tablet = (/MSIE 10/i.test(userAgentString)) && (/ARM/i.test(userAgentString)) && !(/windows phone/i.test(userAgentString));
var isCommonTablet = (!(/Fennec|HTC.Magic|Nexus|android.+mobile|Tablet PC/i.test(userAgentString)) && (/Android|ipad|tablet|playbook|silk|kindle|psp/i.test(userAgentString)));
return isIE10Tablet || isCommonTablet;
}
},
defer : function(statics){
qx.core.Environment.add("device.name", statics.getName);
qx.core.Environment.add("device.type", statics.getType);
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2012 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Martin Wittemann (wittemann)
************************************************************************ */
/**
* Module for querying information about the environment / runtime.
* It adds a static key <code>env</code> to qxWeb and offers the given methods.
*
* <pre class="javascript">
* q.env.get("engine.name"); // return "webkit" e.g.
* </pre>
*
* The following values are predefined:
*
* * <code>browser.name</code> : The name of the browser
* * <code>browser.version</code> : The version of the browser
* * <code>browser.quirksmode</code> : <code>true</code> if the browser is in quirksmode
* * <code>browser.documentmode</code> : The document mode of the browser
*
* * <code>device.name</code> : The name of the device e.g. <code>iPad</code>.
* * <code>device.type</code> : Either <code>desktop</code>, <code>tablet</code> or <code>mobile</code>.
*
* * <code>engine.name</code> : The name of the browser engine
* * <code>engine.version</code> : The version of the browser engine
*/
qx.Bootstrap.define("qx.module.Environment", {
statics : {
/**
* Get the value stored for the given key.
*
* @attachStatic {qxWeb, env.get}
* @param key {String} The key to check for.
* @return {var} The value stored for the given key.
* @lint environmentNonLiteralKey(key)
*/
get : function(key){
return qx.core.Environment.get(key);
},
/**
* Adds a new environment setting which can be queried via {@link #get}.
* @param key {String} The key to store the value for.
*
* @attachStatic {qxWeb, env.add}
* @param value {var} The value to store.
* @return {qxWeb} The collection for chaining.
*/
add : function(key, value){
qx.core.Environment.add(key, value);
return this;
}
},
defer : function(statics){
// make sure the desired keys are available (browser.* and engine.*)
qx.core.Environment.get("browser.name");
qx.core.Environment.get("browser.version");
qx.core.Environment.get("browser.quirksmode");
qx.core.Environment.get("browser.documentmode");
qx.core.Environment.get("engine.name");
qx.core.Environment.get("engine.version");
qx.core.Environment.get("device.type");
qxWeb.$attachStatic({
"env" : {
get : statics.get,
add : statics.add
}
});
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2012 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Daniel Wagner (danielwagner)
************************************************************************ */
/* ************************************************************************
#require(qx.module.Environment)
#require(qx.module.Event)
************************************************************************ */
/**
* Normalization for native mouse events
*/
qx.Bootstrap.define("qx.module.event.Mouse", {
statics : {
/**
* List of event types to be normalized
*/
TYPES : ["click", "dblclick", "mousedown", "mouseup", "mouseover", "mousemove", "mouseout"],
/**
* List qx.module.event.Mouse methods to be attached to native mouse event
* objects
* @internal
*/
BIND_METHODS : ["getButton", "getViewportLeft", "getViewportTop", "getDocumentLeft", "getDocumentTop", "getScreenLeft", "getScreenTop"],
/**
* Standard mouse button mapping
*/
BUTTONS_DOM2 : {
'0' : "left",
'2' : "right",
'1' : "middle"
},
/**
* Legacy Internet Explorer mouse button mapping
*/
BUTTONS_MSHTML : {
'1' : "left",
'2' : "right",
'4' : "middle"
},
/**
* Returns the identifier of the mouse button that change state when the
* event was triggered
*
* @return {String} One of <code>left</code>, <code>right</code> or
* <code>middle</code>
*/
getButton : function(){
switch(this.type){case "contextmenu":
return "right";case "click":
// IE does not support buttons on click --> assume left button
if(qxWeb.env.get("browser.name") === "ie" && qxWeb.env.get("browser.documentmode") < 9){
return "left";
};default:
if(this.target !== undefined){
return qx.module.event.Mouse.BUTTONS_DOM2[this.button] || "none";
} else {
return qx.module.event.Mouse.BUTTONS_MSHTML[this.button] || "none";
};};
},
/**
* Get the horizontal coordinate at which the event occurred relative
* to the viewport.
*
* @return {Number} The horizontal mouse position
*/
getViewportLeft : function(){
return this.clientX;
},
/**
* Get the vertical coordinate at which the event occurred relative
* to the viewport.
*
* @return {Number} The vertical mouse position
* @signature function()
*/
getViewportTop : function(){
return this.clientY;
},
/**
* Get the horizontal position at which the event occurred relative to the
* left of the document. This property takes into account any scrolling of
* the page.
*
* @return {Number} The horizontal mouse position in the document.
*/
getDocumentLeft : function(){
if(this.pageX !== undefined){
return this.pageX;
} else {
var win = qx.dom.Node.getWindow(this.srcElement);
return this.clientX + qx.bom.Viewport.getScrollLeft(win);
};
},
/**
* Get the vertical position at which the event occurred relative to the
* top of the document. This property takes into account any scrolling of
* the page.
*
* @return {Number} The vertical mouse position in the document.
*/
getDocumentTop : function(){
if(this.pageY !== undefined){
return this.pageY;
} else {
var win = qx.dom.Node.getWindow(this.srcElement);
return this.clientY + qx.bom.Viewport.getScrollTop(win);
};
},
/**
* Get the horizontal coordinate at which the event occurred relative to
* the origin of the screen coordinate system.
*
* Note: This value is usually not very useful unless you want to
* position a native popup window at this coordinate.
*
* @return {Number} The horizontal mouse position on the screen.
*/
getScreenLeft : function(){
return this.screenX;
},
/**
* Get the vertical coordinate at which the event occurred relative to
* the origin of the screen coordinate system.
*
* Note: This value is usually not very useful unless you want to
* position a native popup window at this coordinate.
*
* @return {Number} The vertical mouse position on the screen.
*/
getScreenTop : function(){
return this.screenY;
},
/**
* Manipulates the native event object, adding methods if they're not
* already present
*
* @param event {Event} Native event object
* @param element {Element} DOM element the listener was attached to
* @return {Event} Normalized event object
* @internal
*/
normalize : function(event, element){
if(!event){
return event;
};
var bindMethods = qx.module.event.Mouse.BIND_METHODS;
for(var i = 0,l = bindMethods.length;i < l;i++){
if(typeof event[bindMethods[i]] != "function"){
event[bindMethods[i]] = qx.module.event.Mouse[bindMethods[i]].bind(event);
};
};
return event;
}
},
defer : function(statics){
qxWeb.$registerEventNormalization(qx.module.event.Mouse.TYPES, statics.normalize);
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2004-2011 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Tino Butz (tbtz)
* Martin Wittemann (wittemann)
************************************************************************ */
/**
* Define messages to react on certain channels.
*
* The channel names will be used in the {@link #on} method to define handlers which will
* be called on certain channels and routes. The {@link #emit} method can be used
* to execute a given route on a channel. {@link #onAny} defines a handler on any channel.
*
* *Example*
*
* Here is a little example of how to use the messaging.
*
* <pre class='javascript'>
* var m = new qx.event.Messaging();
*
* m.on("get", "/address/{id}", function(data) {
* var id = data.params.id; // 1234
* // do something with the id...
* },this);
*
* m.emit("get", "/address/1234");
* </pre>
*/
qx.Bootstrap.define("qx.event.Messaging", {
construct : function(){
this._listener = {
},this.__listenerIdCount = 0;
this.__channelToIdMapping = {
};
},
members : {
_listener : null,
__listenerIdCount : null,
__channelToIdMapping : null,
/**
* Adds a route handler for the given channel. The route is called
* if the {@link #emit} method finds a match.
*
* @param channel {String} The channel of the message.
* @param type {String|RegExp} The type, used for checking if the executed path matches.
* @param handler {Function} The handler to call if the route matches the executed path.
* @param scope {var ? null} The scope of the handler.
* @return {String} The id of the route used to remove the route.
*/
on : function(channel, type, handler, scope){
return this._addListener(channel, type, handler, scope);
},
/**
* Adds a handler for the "any" channel. The "any" channel is called
* before all other channels.
*
* @param type {String|RegExp} The route, used for checking if the executed path matches
* @param handler {Function} The handler to call if the route matches the executed path
* @param scope {var ? null} The scope of the handler.
* @return {String} The id of the route used to remove the route.
*/
onAny : function(type, handler, scope){
return this._addListener("any", type, handler, scope);
},
/**
* Adds a listener for a certain channel.
*
* @param channel {String} The channel the route should be registered for
* @param type {String|RegExp} The type, used for checking if the executed path matches
* @param handler {Function} The handler to call if the route matches the executed path
* @param scope {var ? null} The scope of the handler.
* @return {String} The id of the route used to remove the route.
*/
_addListener : function(channel, type, handler, scope){
var listeners = this._listener[channel] = this._listener[channel] || {
};
var id = this.__listenerIdCount++;
var params = [];
var param = null;
// Convert the route to a regular expression.
if(qx.lang.Type.isString(type)){
var paramsRegexp = /\{([\w\d]+)\}/g;
while((param = paramsRegexp.exec(type)) !== null){
params.push(param[1]);
};
type = new RegExp("^" + type.replace(paramsRegexp, "([^\/]+)") + "$");
};
listeners[id] = {
regExp : type,
params : params,
handler : handler,
scope : scope
};
this.__channelToIdMapping[id] = channel;
return id;
},
/**
* Removes a registered listener by the given id.
*
* @param id {String} The id of the registered listener.
*/
remove : function(id){
var channel = this.__channelToIdMapping[id];
var listener = this._listener[channel];
delete listener[id];
delete this.__channelToIdMapping[id];
},
/**
* Sends a message on the given channel and informs all matching route handlers.
*
* @param channel {String} The channel of the message.
* @param path {String} The path to execute
* @param params {Map} The given parameters that should be propagated
* @param customData {var} The given custom data that should be propagated
*/
emit : function(channel, path, params, customData){
this._emit(channel, path, params, customData);
},
/**
* Executes a certain channel with a given path. Informs all
* route handlers that match with the path.
*
* @param channel {String} The channel to execute.
* @param path {String} The path to check
* @param params {Map} The given parameters that should be propagated
* @param customData {var} The given custom data that should be propagated
*/
_emit : function(channel, path, params, customData){
var listenerMatchedAny = false;
var listener = this._listener["any"];
listenerMatchedAny = this._emitListeners(channel, path, listener, params, customData);
var listenerMatched = false;
listener = this._listener[channel];
listenerMatched = this._emitListeners(channel, path, listener, params, customData);
if(!listenerMatched && !listenerMatchedAny){
qx.Bootstrap.info("No listener found for " + path);
};
},
/**
* Executes all given listener for a certain channel. Checks all listeners if they match
* with the given path and executes the stored handler of the matching route.
*
* @param channel {String} The channel to execute.
* @param path {String} The path to check
* @param listeners {Map[]} All routes to test and execute.
* @param params {Map} The given parameters that should be propagated
* @param customData {var} The given custom data that should be propagated
*
* @return {Boolean} Whether the route has been executed
*/
_emitListeners : function(channel, path, listeners, params, customData){
if(!listeners || qx.lang.Object.isEmpty(listeners)){
return false;
};
var listenerMatched = false;
for(var id in listeners){
var listener = listeners[id];
listenerMatched |= this._emitRoute(channel, path, listener, params, customData);
};
return listenerMatched;
},
/**
* Executes a certain listener. Checks if the listener matches the given path and
* executes the stored handler of the route.
*
* @param channel {String} The channel to execute.
* @param path {String} The path to check
* @param listener {Map} The route data.
* @param params {Map} The given parameters that should be propagated
* @param customData {var} The given custom data that should be propagated
*
* @return {Boolean} Whether the route has been executed
*/
_emitRoute : function(channel, path, listener, params, customData){
var match = listener.regExp.exec(path);
if(match){
var params = params || {
};
var param = null;
var value = null;
match.shift();
// first match is the whole path
for(var i = 0;i < match.length;i++){
value = match[i];
param = listener.params[i];
if(param){
params[param] = value;
} else {
params[i] = value;
};
};
listener.handler.call(listener.scope, {
path : path,
params : params,
customData : customData
});
};
return match != undefined;
}
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2004-2012 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Martin Wittemann (wittemann)
************************************************************************ */
/* ************************************************************************
#require(qx.event.Messaging#on)
#require(qx.event.Messaging#onAny)
#require(qx.event.Messaging#remove)
#require(qx.event.Messaging#emit)
************************************************************************ */
/**
* Define messages to react on certain channels.
*
* The channel names will be used in the q.messaging.on method to define handlers which will
* be called on certain channels and routes. The q.messaging.emit method can be used
* to execute a given route on a channel. q.messaging.onAny defines a handler on any channel.
*/
qx.Bootstrap.define("qx.module.Messaging", {
statics : {
/**
* Adds a route handler for the given channel. The route is called
* if the {@link #emit} method finds a match.
*
* @attachStatic{qxWeb, messaging.on}
* @param channel {String} The channel of the message.
* @param type {String|RegExp} The type, used for checking if the executed path matches.
* @param handler {Function} The handler to call if the route matches the executed path.
* @param scope {var ? null} The scope of the handler.
* @return {String} The id of the route used to remove the route.
* @signature function(channel, type, handler, scope)
*/
on : null,
/**
* Adds a handler for the "any" channel. The "any" channel is called
* before all other channels.
*
* @attachStatic{qxWeb, messaging.onAny}
* @param type {String|RegExp} The route, used for checking if the executed path matches
* @param handler {Function} The handler to call if the route matches the executed path
* @param scope {var ? null} The scope of the handler.
* @return {String} The id of the route used to remove the route.
* @signature function(type, handler, scope)
*/
onAny : null,
/**
* Removes a registered listener by the given id.
*
* @attachStatic{qxWeb, messaging.remove}
* @param id {String} The id of the registered listener.
* @signature function(id)
*/
remove : null,
/**
* Sends a message on the given channel and informs all matching route handlers.
*
* @attachStatic{qxWeb, messaging.emit}
* @param channel {String} The channel of the message.
* @param path {String} The path to execute
* @param params {Map} The given parameters that should be propagated
* @param customData {var} The given custom data that should be propagated
* @signature function(channel, path, params, customData)
*/
emit : null
},
defer : function(statics){
qxWeb.$attachStatic({
"messaging" : new qx.event.Messaging()
});
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2012 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Martin Wittemann (wittemann)
************************************************************************ */
/**
* Utility module to give some support to work with arrays.
*/
qx.Bootstrap.define("qx.module.util.Array", {
statics : {
/**
* Converts an array like object to any other array like
* object.
*
* Attention: The returned array may be same
* instance as the incoming one if the constructor is identical!
*
* @signature function(object, constructor, offset)
* @attachStatic {qxWeb, array.cast}
*
* @param object {var} any array-like object
* @param constructor {Function} constructor of the new instance
* @param offset {Number?0} position to start from
* @return {Array} the converted array
*/
cast : qx.lang.Array.cast,
/**
* Check whether the two arrays have the same content. Checks only the
* equality of the arrays' content.
*
* @signature function(arr1, arr2)
* @attachStatic {qxWeb, array.equals}
*
* @param arr1 {Array} first array
* @param arr2 {Array} second array
* @return {Boolean} Whether the two arrays are equal
*/
equals : qx.lang.Array.equals,
/**
* Modifies the first array as it removes all elements
* which are listed in the second array as well.
*
* @signature function(arr1, arr2)
* @attachStatic {qxWeb, array.exclude}
*
* @param arr1 {Array} the array
* @param arr2 {Array} the elements of this array will be excluded from the other one
* @return {Array} The modified array.
*/
exclude : qx.lang.Array.exclude,
/**
* Convert an arguments object into an array.
*
* @signature function(args, offset)
* @attachStatic {qxWeb, array.fromArguments}
*
* @param args {arguments} arguments object
* @param offset {Number?0} position to start from
* @return {Array} a newly created array (copy) with the content of the arguments object.
*/
fromArguments : qx.lang.Array.fromArguments,
/**
* Insert an element into the array after a given second element.
*
* @signature function(arr, obj, obj2)
* @attachStatic {qxWeb, array.insertAfter}
*
* @param arr {Array} the array
* @param obj {var} object to be inserted
* @param obj2 {var} insert obj1 after this object
* @return {Array} The given array.
*/
insertAfter : qx.lang.Array.insertAfter,
/**
* Insert an element into the array before a given second element.
*
* @signature function(arr, obj, obj2)
* @attachStatic {qxWeb, array.insertBefore}
*
* @param arr {Array} the array
* @param obj {var} object to be inserted
* @param obj2 {var} insert obj1 before this object
* @return {Array} The given array.
*/
insertBefore : qx.lang.Array.insertBefore,
/**
* Returns the highest value in the given array. Supports
* numeric values only.
*
* @signature function(arr)
* @attachStatic {qxWeb, array.max}
*
* @param arr {Array} Array to process.
* @return {Number | undefined} The highest of all values or undefined if array is empty.
*/
max : qx.lang.Array.max,
/**
* Returns the lowest value in the given array. Supports
* numeric values only.
*
* @signature function(arr)
* @attachStatic {qxWeb, array.min}
*
* @param arr {Array} Array to process.
* @return {Number | undefined} The lowest of all values or undefined if array is empty.
*/
min : qx.lang.Array.min,
/**
* Remove an element from the array.
*
* @signature function(arr, obj)
* @attachStatic {qxWeb, array.remove}
*
* @param arr {Array} the array
* @param obj {var} element to be removed from the array
* @return {var} the removed element
*/
remove : qx.lang.Array.remove,
/**
* Remove all elements from the array
*
* @signature function(arr)
* @attachStatic {qxWeb, array.removeAll}
*
* @param arr {Array} the array
* @return {Array} empty array
*/
removeAll : qx.lang.Array.removeAll,
/**
* Recreates an array which is free of all duplicate elements from the original.
* This method do not modifies the original array!
* Keep in mind that this methods deletes undefined indexes.
*
* @signature function(arr)
* @attachStatic {qxWeb, array.unique}
*
* @param arr {Array} Incoming array
* @return {Array} Returns a copy with no duplicates
* or the original array if no duplicates were found.
*/
unique : qx.lang.Array.unique
},
defer : function(statics){
qxWeb.$attachStatic({
array : {
cast : statics.cast,
equals : statics.equals,
exclude : statics.exclude,
fromArguments : statics.fromArguments,
insertAfter : statics.insertAfter,
insertBefore : statics.insertBefore,
max : statics.max,
min : statics.min,
remove : statics.remove,
removeAll : statics.removeAll,
unique : statics.unique
}
});
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2012 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Martin Wittemann (wittemann)
************************************************************************ */
/**
* Utility module to give some support to work with strings.
*/
qx.Bootstrap.define("qx.module.util.String", {
statics : {
/**
* Converts a hyphenated string (separated by '-') to camel case.
*
* Example:
* <pre class='javascript'>q.string.camelCase("I-like-cookies"); //returns "ILikeCookies"</pre>
*
* @attachStatic {qxWeb, string.camelCase}
* @param str {String} hyphenated string
* @return {String} camelcase string
*/
camelCase : function(str){
return qx.lang.String.camelCase.call(qx.lang.String, str);
},
/**
* Converts a camelcased string to a hyphenated (separated by '-') string.
*
* Example:
* <pre class='javascript'>q.string.hyphenate("weLikeCookies"); //returns "we-like-cookies"</pre>
*
* @attachStatic {qxWeb, string.hyphenate}
* @param str {String} camelcased string
* @return {String} hyphenated string
*/
hyphenate : function(str){
return qx.lang.String.hyphenate.call(qx.lang.String, str);
},
/**
* Convert the first character of the string to upper case.
*
* @attachStatic {qxWeb, string.firstUp}
* @signature function(str)
* @param str {String} the string
* @return {String} the string with an upper case first character
*/
firstUp : qx.lang.String.firstUp,
/**
* Convert the first character of the string to lower case.
*
* @attachStatic {qxWeb, string.firstLow}
* @signature function(str)
* @param str {String} the string
* @return {String} the string with a lower case first character
*/
firstLow : qx.lang.String.firstLow,
/**
* Check whether the string starts with the given substring.
*
* @attachStatic {qxWeb, string.startsWith}
* @signature function(fullstr, substr)
* @param fullstr {String} the string to search in
* @param substr {String} the substring to look for
* @return {Boolean} whether the string starts with the given substring
*/
startsWith : qx.lang.String.startsWith,
/**
* Check whether the string ends with the given substring.
*
* @attachStatic {qxWeb, string.endsWith}
* @signature function(fullstr, substr)
* @param fullstr {String} the string to search in
* @param substr {String} the substring to look for
* @return {Boolean} whether the string ends with the given substring
*/
endsWith : qx.lang.String.endsWith,
/**
* Escapes all chars that have a special meaning in regular expressions.
*
* @attachStatic {qxWeb, string.escapeRegexpChars}
* @signature function(str)
* @param str {String} the string where to escape the chars.
* @return {String} the string with the escaped chars.
*/
escapeRegexpChars : qx.lang.String.escapeRegexpChars
},
defer : function(statics){
qxWeb.$attachStatic({
string : {
camelCase : statics.camelCase,
hyphenate : statics.hyphenate,
firstUp : statics.firstUp,
firstLow : statics.firstLow,
startsWith : statics.startsWith,
endsWith : statics.endsWith,
escapeRegexpChars : statics.escapeRegexpChars
}
});
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2004-2012 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Martin Wittemann (wittemann)
************************************************************************ */
/**
* This class is responsible for applying CSS3 transforms to the collection.
* The implementation is mostly a cross browser wrapper for applying the
* transforms.
* The API is keep to the spec as close as possible.
*
* http://www.w3.org/TR/css3-3d-transforms/
*/
qx.Bootstrap.define("qx.module.Transform", {
statics : {
/**
* Method to apply multiple transforms at once to the given element. It
* takes a map containing the transforms you want to apply plus the values
* e.g.<code>{scale: 2, rotate: "5deg"}</code>.
* The values can be either singular, which means a single value will
* be added to the CSS. If you give an array, the values will be split up
* and each array entry will be used for the X, Y or Z dimension in that
* order e.g. <code>{scale: [2, 0.5]}</code> will result in a element
* double the size in X direction and half the size in Y direction.
* Make sure your browser supports all transformations you apply.
*
* @attach {qxWeb}
* @param transforms {Map} The map containing the transforms and value.
* @return {qxWeb} This reference for chaining.
*/
transform : function(transforms){
this.forEach(function(el){
qx.bom.element.Transform.transform(el, transforms);
});
return this;
},
/**
* Translates by the given value. For further details, take
* a look at the {@link #transform} method.
*
* @attach {qxWeb}
* @param value {String|Array} The value to translate e.g. <code>"10px"</code>.
* @return {qxWeb} This reference for chaining.
*/
translate : function(value){
return this.transform({
translate : value
});
},
/**
* Scales by the given value. For further details, take
* a look at the {@link #transform} method.
*
* @attach {qxWeb}
* @param value {Number|Array} The value to scale.
* @return {qxWeb} This reference for chaining.
*/
scale : function(value){
return this.transform({
scale : value
});
},
/**
* Rotates by the given value. For further details, take
* a look at the {@link #transform} method.
* @param value {String|Array} The value to rotate e.g. <code>"90deg"</code>.
* @return {qxWeb} This reference for chaining.
*/
rotate : function(value){
return this.transform({
rotate : value
});
},
/**
* Skews by the given value. For further details, take
* a look at the {@link #transform} method.
*
* @attach {qxWeb}
* @param value {String|Array} The value to skew e.g. <code>"90deg"</code>.
* @return {qxWeb} This reference for chaining.
*/
skew : function(value){
return this.transform({
skew : value
});
},
/**
* Sets the transform-origin property.
*
* Spec: http://www.w3.org/TR/css3-3d-transforms/#transform-origin-property
*
* @attach {qxWeb}
* @param value {String} CSS position values like <code>50% 50%</code> or
* <code>left top</code>.
* @return {qxWeb} This reference for chaining.
*/
setTransformOrigin : function(value){
this.forEach(function(el){
qx.bom.element.Transform.setOrigin(el, value);
});
return this;
},
/**
* Returns the transform-origin property of the first element.
*
* Spec: http://www.w3.org/TR/css3-3d-transforms/#transform-origin-property
*
* @attach {qxWeb}
* @return {String} The set property, e.g. <code>50% 50%</code> or null,
* of the collection is empty.
*/
getTransformOrigin : function(){
if(this[0]){
return qx.bom.element.Transform.getOrigin(this[0]);
};
return "";
},
/**
* Sets the transform-style property.
*
* Spec: http://www.w3.org/TR/css3-3d-transforms/#transform-style-property
*
* @attach {qxWeb}
* @param value {String} Either <code>flat</code> or <code>preserve-3d</code>.
* @return {qxWeb} This reference for chaining.
*/
setTransformStyle : function(value){
this.forEach(function(el){
qx.bom.element.Transform.setStyle(el, value);
});
return this;
},
/**
* Returns the transform-style property of the first element.
*
* Spec: http://www.w3.org/TR/css3-3d-transforms/#transform-style-property
*
* @attach {qxWeb}
* @return {String} The set property, either <code>flat</code> or
* <code>preserve-3d</code>.
*/
getTransformStyle : function(){
if(this[0]){
return qx.bom.element.Transform.getStyle(this[0]);
};
return "";
},
/**
* Sets the perspective property.
*
* Spec: http://www.w3.org/TR/css3-3d-transforms/#perspective-property
*
* @attach {qxWeb}
* @param value {Number} The perspective layer. Numbers between 100
* and 5000 give the best results.
* @return {qxWeb} This reference for chaining.
*/
setTransformPerspective : function(value){
this.forEach(function(el){
qx.bom.element.Transform.setPerspective(el, value);
});
return this;
},
/**
* Returns the perspective property of the first element.
*
* Spec: http://www.w3.org/TR/css3-3d-transforms/#perspective-property
*
* @attach {qxWeb}
* @return {String} The set property, e.g. <code>500</code>
*/
getTransformPerspective : function(){
if(this[0]){
return qx.bom.element.Transform.getPerspective(this[0]);
};
return "";
},
/**
* Sets the perspective-origin property.
*
* Spec: http://www.w3.org/TR/css3-3d-transforms/#perspective-origin-property
*
* @attach {qxWeb}
* @param value {String} CSS position values like <code>50% 50%</code> or
* <code>left top</code>.
* @return {qxWeb} This reference for chaining.
*/
setTransformPerspectiveOrigin : function(value){
this.forEach(function(el){
qx.bom.element.Transform.setPerspectiveOrigin(el, value);
});
return this;
},
/**
* Returns the perspective-origin property of the first element.
*
* Spec: http://www.w3.org/TR/css3-3d-transforms/#perspective-origin-property
*
* @attach {qxWeb}
* @return {String} The set property, e.g. <code>50% 50%</code>
*/
getTransformPerspectiveOrigin : function(){
if(this[0]){
return qx.bom.element.Transform.getPerspectiveOrigin(this[0]);
};
return "";
},
/**
* Sets the backface-visibility property.
*
* Spec: http://www.w3.org/TR/css3-3d-transforms/#backface-visibility-property
*
* @attach {qxWeb}
* @param value {Boolean} <code>true</code> if the backface should be visible.
* @return {qxWeb} This reference for chaining.
*/
setTransformBackfaceVisibility : function(value){
this.forEach(function(el){
qx.bom.element.Transform.setBackfaceVisibility(el, value);
});
return this;
},
/**
* Returns the backface-visibility property of the first element.
*
* Spec: http://www.w3.org/TR/css3-3d-transforms/#backface-visibility-property
*
* @attach {qxWeb}
* @return {Boolean} <code>true</code>, if the backface is visible.
*/
getTransformBackfaceVisibility : function(){
if(this[0]){
return qx.bom.element.Transform.getBackfaceVisibility(this[0]);
};
return "";
}
},
defer : function(statics){
qxWeb.$attach({
"transform" : statics.transform,
"translate" : statics.translate,
"rotate" : statics.rotate,
"skew" : statics.skew,
"scale" : statics.scale,
"setTransformStyle" : statics.setTransformStyle,
"getTransformStyle" : statics.getTransformStyle,
"setTransformOrigin" : statics.setTransformOrigin,
"getTransformOrigin" : statics.getTransformOrigin,
"setTransformPerspective" : statics.setTransformPerspective,
"getTransformPerspective" : statics.getTransformPerspective,
"setTransformPerspectiveOrigin" : statics.setTransformPerspectiveOrigin,
"getTransformPerspectiveOrigin" : statics.getTransformPerspectiveOrigin,
"setTransformBackfaceVisibility" : statics.setTransformBackfaceVisibility,
"getTransformBackfaceVisibility" : statics.getTransformBackfaceVisibility
});
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2004-2011 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Martin Wittemann (wittemann)
************************************************************************ */
/**
* Responsible for checking all relevant CSS transform properties.
*
* Specs:
* http://www.w3.org/TR/css3-2d-transforms/
* http://www.w3.org/TR/css3-3d-transforms/
*
* @internal
*/
qx.Bootstrap.define("qx.bom.client.CssTransform", {
statics : {
/**
* Main check method which returns an object if CSS animations are
* supported. This object contains all necessary keys to work with CSS
* animations.
* <ul>
* <li><code>name</code> The name of the css transform style</li>
* <li><code>style</code> The name of the css transform-style style</li>
* <li><code>origin</code> The name of the transform-origin style</li>
* <li><code>3d</code> Whether 3d transforms are supported</li>
* <li><code>perspective</code> The name of the perspective style</li>
* <li><code>perspective-origin</code> The name of the perspective-origin style</li>
* <li><code>backface-visibility</code> The name of the backface-visibility style</li>
* </ul>
*
* @internal
* @return {Object|null} The described object or null, if animations are
* not supported.
*/
getSupport : function(){
var name = qx.bom.client.CssTransform.getName();
if(name != null){
return {
"name" : name,
"style" : qx.bom.client.CssTransform.getStyle(),
"origin" : qx.bom.client.CssTransform.getOrigin(),
"3d" : qx.bom.client.CssTransform.get3D(),
"perspective" : qx.bom.client.CssTransform.getPerspective(),
"perspective-origin" : qx.bom.client.CssTransform.getPerspectiveOrigin(),
"backface-visibility" : qx.bom.client.CssTransform.getBackFaceVisibility()
};
};
return null;
},
/**
* Checks for the style name used to set the transform origin.
* @internal
* @return {String|null} The name of the style or null, if the style is
* not supported.
*/
getStyle : function(){
return qx.bom.Style.getPropertyName("transformStyle");
},
/**
* Checks for the style name used to set the transform origin.
* @internal
* @return {String|null} The name of the style or null, if the style is
* not supported.
*/
getPerspective : function(){
return qx.bom.Style.getPropertyName("perspective");
},
/**
* Checks for the style name used to set the perspective origin.
* @internal
* @return {String|null} The name of the style or null, if the style is
* not supported.
*/
getPerspectiveOrigin : function(){
return qx.bom.Style.getPropertyName("perspectiveOrigin");
},
/**
* Checks for the style name used to set the backface visibility.
* @internal
* @return {String|null} The name of the style or null, if the style is
* not supported.
*/
getBackFaceVisibility : function(){
return qx.bom.Style.getPropertyName("backfaceVisibility");
},
/**
* Checks for the style name used to set the transform origin.
* @internal
* @return {String|null} The name of the style or null, if the style is
* not supported.
*/
getOrigin : function(){
return qx.bom.Style.getPropertyName("transformOrigin");
},
/**
* Checks for the style name used for transforms.
* @internal
* @return {String|null} The name of the style or null, if the style is
* not supported.
*/
getName : function(){
return qx.bom.Style.getPropertyName("transform");
},
/**
* Checks if 3D transforms are supported.
* @internal
* @return {Boolean} <code>true</code>, if 3D transformations are supported
*/
get3D : function(){
return qx.bom.client.CssTransform.getPerspective() != null;
}
},
defer : function(statics){
qx.core.Environment.add("css.transform", statics.getSupport);
qx.core.Environment.add("css.transform.3d", statics.get3D);
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2004-2011 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Martin Wittemann (wittemann)
************************************************************************ */
/**
* This class is responsible for applying CSS3 transforms to plain DOM elements.
* The implementation is mostly a cross browser wrapper for applying the
* transforms.
* The API is keep to the spec as close as possible.
*
* http://www.w3.org/TR/css3-3d-transforms/
*/
qx.Bootstrap.define("qx.bom.element.Transform", {
statics : {
/** The dimensions of the transforms */
__dimensions : ["X", "Y", "Z"],
/** Internal storage of the CSS names */
__cssKeys : qx.core.Environment.get("css.transform"),
/**
* Method to apply multiple transforms at once to the given element. It
* takes a map containing the transforms you want to apply plus the values
* e.g.<code>{scale: 2, rotate: "5deg"}</code>.
* The values can be either singular, which means a single value will
* be added to the CSS. If you give an array, the values will be split up
* and each array entry will be used for the X, Y or Z dimension in that
* order e.g. <code>{scale: [2, 0.5]}</code> will result in a element
* double the size in X direction and half the size in Y direction.
* Make sure your browser supports all transformations you apply.
* @param el {Element} The element to apply the transformation.
* @param transforms {Map} The map containing the transforms and value.
*/
transform : function(el, transforms){
var transformCss = this.__mapToCss(transforms);
if(this.__cssKeys != null){
var style = this.__cssKeys["name"];
el.style[style] = transformCss;
};
},
/**
* Translates the given element by the given value. For further details, take
* a look at the {@link #transform} method.
* @param el {Element} The element to apply the transformation.
* @param value {String|Array} The value to translate e.g. <code>"10px"</code>.
*/
translate : function(el, value){
this.transform(el, {
translate : value
});
},
/**
* Scales the given element by the given value. For further details, take
* a look at the {@link #transform} method.
* @param el {Element} The element to apply the transformation.
* @param value {Number|Array} The value to scale.
*/
scale : function(el, value){
this.transform(el, {
scale : value
});
},
/**
* Rotates the given element by the given value. For further details, take
* a look at the {@link #transform} method.
* @param el {Element} The element to apply the transformation.
* @param value {String|Array} The value to rotate e.g. <code>"90deg"</code>.
*/
rotate : function(el, value){
this.transform(el, {
rotate : value
});
},
/**
* Skews the given element by the given value. For further details, take
* a look at the {@link #transform} method.
* @param el {Element} The element to apply the transformation.
* @param value {String|Array} The value to skew e.g. <code>"90deg"</code>.
*/
skew : function(el, value){
this.transform(el, {
skew : value
});
},
/**
* Converts the given map to a string which could be added to a css
* stylesheet.
* @param transforms {Map} The transforms map. For a detailed description,
* take a look at the {@link #transform} method.
* @return {String} The CSS value.
*/
getCss : function(transforms){
var transformCss = this.__mapToCss(transforms);
if(this.__cssKeys != null){
var style = this.__cssKeys["name"];
return qx.bom.Style.getCssName(style) + ":" + transformCss + ";";
};
return "";
},
/**
* Sets the transform-origin property of the given element.
*
* Spec: http://www.w3.org/TR/css3-3d-transforms/#transform-origin-property
* @param el {Element} The dom element to set the property.
* @param value {String} CSS position values like <code>50% 50%</code> or
* <code>left top</code>.
*/
setOrigin : function(el, value){
if(this.__cssKeys != null){
el.style[this.__cssKeys["origin"]] = value;
};
},
/**
* Returns the transform-origin property of the given element.
*
* Spec: http://www.w3.org/TR/css3-3d-transforms/#transform-origin-property
* @param el {Element} The dom element to read the property.
* @return {String} The set property, e.g. <code>50% 50%</code>
*/
getOrigin : function(el){
if(this.__cssKeys != null){
return el.style[this.__cssKeys["origin"]];
};
return "";
},
/**
* Sets the transform-style property of the given element.
*
* Spec: http://www.w3.org/TR/css3-3d-transforms/#transform-style-property
* @param el {Element} The dom element to set the property.
* @param value {String} Either <code>flat</code> or <code>preserve-3d</code>.
*/
setStyle : function(el, value){
if(this.__cssKeys != null){
el.style[this.__cssKeys["style"]] = value;
};
},
/**
* Returns the transform-style property of the given element.
*
* Spec: http://www.w3.org/TR/css3-3d-transforms/#transform-style-property
* @param el {Element} The dom element to read the property.
* @return {String} The set property, either <code>flat</code> or
* <code>preserve-3d</code>.
*/
getStyle : function(el){
if(this.__cssKeys != null){
return el.style[this.__cssKeys["style"]];
};
return "";
},
/**
* Sets the perspective property of the given element.
*
* Spec: http://www.w3.org/TR/css3-3d-transforms/#perspective-property
* @param el {Element} The dom element to set the property.
* @param value {Number} The perspective layer. Numbers between 100
* and 5000 give the best results.
*/
setPerspective : function(el, value){
if(this.__cssKeys != null){
el.style[this.__cssKeys["perspective"]] = value + "px";
};
},
/**
* Returns the perspective property of the given element.
*
* Spec: http://www.w3.org/TR/css3-3d-transforms/#perspective-property
* @param el {Element} The dom element to read the property.
* @return {String} The set property, e.g. <code>500</code>
*/
getPerspective : function(el){
if(this.__cssKeys != null){
return el.style[this.__cssKeys["perspective"]];
};
return "";
},
/**
* Sets the perspective-origin property of the given element.
*
* Spec: http://www.w3.org/TR/css3-3d-transforms/#perspective-origin-property
* @param el {Element} The dom element to set the property.
* @param value {String} CSS position values like <code>50% 50%</code> or
* <code>left top</code>.
*/
setPerspectiveOrigin : function(el, value){
if(this.__cssKeys != null){
el.style[this.__cssKeys["perspective-origin"]] = value;
};
},
/**
* Returns the perspective-origin property of the given element.
*
* Spec: http://www.w3.org/TR/css3-3d-transforms/#perspective-origin-property
* @param el {Element} The dom element to read the property.
* @return {String} The set property, e.g. <code>50% 50%</code>
*/
getPerspectiveOrigin : function(el){
if(this.__cssKeys != null){
var value = el.style[this.__cssKeys["perspective-origin"]];
if(value != ""){
return value;
} else {
var valueX = el.style[this.__cssKeys["perspective-origin"] + "X"];
var valueY = el.style[this.__cssKeys["perspective-origin"] + "Y"];
if(valueX != ""){
return valueX + " " + valueY;
};
};
};
return "";
},
/**
* Sets the backface-visibility property of the given element.
*
* Spec: http://www.w3.org/TR/css3-3d-transforms/#backface-visibility-property
* @param el {Element} The dom element to set the property.
* @param value {Boolean} <code>true</code> if the backface should be visible.
*/
setBackfaceVisibility : function(el, value){
if(this.__cssKeys != null){
el.style[this.__cssKeys["backface-visibility"]] = value ? "visible" : "hidden";
};
},
/**
* Returns the backface-visibility property of the given element.
*
* Spec: http://www.w3.org/TR/css3-3d-transforms/#backface-visibility-property
* @param el {Element} The dom element to read the property.
* @return {Boolean} <code>true</code>, if the backface is visible.
*/
getBackfaceVisibility : function(el){
if(this.__cssKeys != null){
return el.style[this.__cssKeys["backface-visibility"]] == "visible";
};
return true;
},
/**
* Internal helper which converts the given transforms map to a valid CSS
* string.
* @param transforms {Map} A map containing the transforms.
* @return {String} The CSS transforms.
*/
__mapToCss : function(transforms){
var value = "";
for(var func in transforms){
var params = transforms[func];
// if an array is given
if(qx.Bootstrap.isArray(params)){
for(var i = 0;i < params.length;i++){
if(params[i] == undefined){
continue;
};
value += func + this.__dimensions[i] + "(";
value += params[i];
value += ") ";
};
} else {
// single value case
value += func + "(" + transforms[func] + ") ";
};
};
return value;
}
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2012 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Daniel Wagner (danielwagner)
************************************************************************ */
/* ************************************************************************
#require(qx.module.Event)
#require(qx.bom.Event#getTarget)
#require(qx.bom.Event#getRelatedTarget)
************************************************************************ */
/**
* Common normalizations for native events
*/
qx.Bootstrap.define("qx.module.event.Native", {
statics : {
/**
* List of event types to be normalized
*/
TYPES : ["*"],
/**
* List of qx.bom.Event methods to be attached to native event objects
* @internal
*/
FORWARD_METHODS : ["getTarget", "getRelatedTarget"],
/**
* List of qx.module.event.Native methods to be attached to native event objects
* @internal
*/
BIND_METHODS : ["preventDefault", "stopPropagation", "getType"],
/**
* Prevent the native default behavior of the event.
*/
preventDefault : function(){
try{
// this allows us to prevent some key press events in IE.
// See bug #1049
this.keyCode = 0;
} catch(ex) {
};
this.returnValue = false;
},
/**
* Stops the event's propagation to the element's parent
*/
stopPropagation : function(){
this.cancelBubble = true;
},
/**
* Returns the event's type
*
* @return {String} event type
*/
getType : function(){
return this._type || this.type;
},
/**
* Manipulates the native event object, adding methods if they're not
* already present
*
* @param event {Event} Native event object
* @param element {Element} DOM element the listener was attached to
* @return {Event} Normalized event object
* @internal
*/
normalize : function(event, element){
if(!event){
return event;
};
var fwdMethods = qx.module.event.Native.FORWARD_METHODS;
for(var i = 0,l = fwdMethods.length;i < l;i++){
event[fwdMethods[i]] = qx.lang.Function.curry(qx.bom.Event[fwdMethods[i]], event);
};
var bindMethods = qx.module.event.Native.BIND_METHODS;
for(var i = 0,l = bindMethods.length;i < l;i++){
if(typeof event[bindMethods[i]] != "function"){
event[bindMethods[i]] = qx.module.event.Native[bindMethods[i]].bind(event);
};
};
event.getCurrentTarget = function(){
return event.currentTarget || element;
};
return event;
}
},
defer : function(statics){
qxWeb.$registerEventNormalization(statics.TYPES, statics.normalize);
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2004-2008 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Sebastian Werner (wpbasti)
======================================================================
This class contains code based on the following work:
* Prototype JS
http://www.prototypejs.org/
Version 1.5
Copyright:
(c) 2006-2007, Prototype Core Team
License:
MIT: http://www.opensource.org/licenses/mit-license.php
Authors:
* Prototype Core Team
----------------------------------------------------------------------
Copyright (c) 2005-2008 Sam Stephenson
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
************************************************************************ */
/**
* Methods to operate on nodes and elements on a DOM tree. This contains
* special getters to query for child nodes, siblings, etc. This class also
* supports to operate on one element and reorganize the content with
* the insertion of new HTML or nodes.
*/
qx.Bootstrap.define("qx.dom.Hierarchy", {
statics : {
/**
* Returns the DOM index of the given node
*
* @param node {Node} Node to look for
* @return {Integer} The DOM index
*/
getNodeIndex : function(node){
var index = 0;
while(node && (node = node.previousSibling)){
index++;
};
return index;
},
/**
* Returns the DOM index of the given element (ignoring non-elements)
*
* @param element {Element} Element to look for
* @return {Integer} The DOM index
*/
getElementIndex : function(element){
var index = 0;
var type = qx.dom.Node.ELEMENT;
while(element && (element = element.previousSibling)){
if(element.nodeType == type){
index++;
};
};
return index;
},
/**
* Return the next element to the supplied element
*
* "nextSibling" is not good enough as it might return a text or comment element
*
* @param element {Element} Starting element node
* @return {Element | null} Next element node
*/
getNextElementSibling : function(element){
while(element && (element = element.nextSibling) && !qx.dom.Node.isElement(element)){
continue;
};
return element || null;
},
/**
* Return the previous element to the supplied element
*
* "previousSibling" is not good enough as it might return a text or comment element
*
* @param element {Element} Starting element node
* @return {Element | null} Previous element node
*/
getPreviousElementSibling : function(element){
while(element && (element = element.previousSibling) && !qx.dom.Node.isElement(element)){
continue;
};
return element || null;
},
/**
* Whether the first element contains the second one
*
* Uses native non-standard contains() in Internet Explorer,
* Opera and Webkit (supported since Safari 3.0 beta)
*
* @param element {Element} Parent element
* @param target {Node} Child node
* @return {Boolean}
*/
contains : function(element, target){
if(qx.core.Environment.get("html.element.contains")){
if(qx.dom.Node.isDocument(element)){
var doc = qx.dom.Node.getDocument(target);
return element && doc == element;
} else if(qx.dom.Node.isDocument(target)){
return false;
} else {
return element.contains(target);
};
} else if(qx.core.Environment.get("html.element.compareDocumentPosition")){
// http://developer.mozilla.org/en/docs/DOM:Node.compareDocumentPosition
return !!(element.compareDocumentPosition(target) & 16);
} else {
while(target){
if(element == target){
return true;
};
target = target.parentNode;
};
return false;
};
},
/**
* Whether the element is inserted into the document
* for which it was created.
*
* @param element {Element} DOM element to check
* @return {Boolean} <code>true</code> when the element is inserted
* into the document.
*/
isRendered : function(element){
var doc = element.ownerDocument || element.document;
if(qx.core.Environment.get("html.element.contains")){
// Fast check for all elements which are not in the DOM
if(!element.parentNode || !element.offsetParent){
return false;
};
return doc.body.contains(element);
} else if(qx.core.Environment.get("html.element.compareDocumentPosition")){
// Gecko way, DOM3 method
return !!(doc.compareDocumentPosition(element) & 16);
} else {
while(element){
if(element == doc.body){
return true;
};
element = element.parentNode;
};
return false;
};
},
/**
* Checks if <code>element</code> is a descendant of <code>ancestor</code>.
*
* @param element {Element} first element
* @param ancestor {Element} second element
* @return {Boolean} Element is a descendant of ancestor
*/
isDescendantOf : function(element, ancestor){
return this.contains(ancestor, element);
},
/**
* Get the common parent element of two given elements. Returns
* <code>null</code> when no common element has been found.
*
* Uses native non-standard contains() in Opera and Internet Explorer
*
* @param element1 {Element} First element
* @param element2 {Element} Second element
* @return {Element} the found parent, if none was found <code>null</code>
*/
getCommonParent : function(element1, element2){
if(element1 === element2){
return element1;
};
if(qx.core.Environment.get("html.element.contains")){
while(element1 && qx.dom.Node.isElement(element1)){
if(element1.contains(element2)){
return element1;
};
element1 = element1.parentNode;
};
return null;
} else {
var known = [];
while(element1 || element2){
if(element1){
if(qx.lang.Array.contains(known, element1)){
return element1;
};
known.push(element1);
element1 = element1.parentNode;
};
if(element2){
if(qx.lang.Array.contains(known, element2)){
return element2;
};
known.push(element2);
element2 = element2.parentNode;
};
};
return null;
};
},
/**
* Collects all of element's ancestors and returns them as an array of
* elements.
*
* @param element {Element} DOM element to query for ancestors
* @return {Array} list of all parents
*/
getAncestors : function(element){
return this._recursivelyCollect(element, "parentNode");
},
/**
* Returns element's children.
*
* @param element {Element} DOM element to query for child elements
* @return {Array} list of all child elements
*/
getChildElements : function(element){
element = element.firstChild;
if(!element){
return [];
};
var arr = this.getNextSiblings(element);
if(element.nodeType === 1){
arr.unshift(element);
};
return arr;
},
/**
* Collects all of element's descendants (deep) and returns them as an array
* of elements.
*
* @param element {Element} DOM element to query for child elements
* @return {Array} list of all found elements
*/
getDescendants : function(element){
return qx.lang.Array.fromCollection(element.getElementsByTagName("*"));
},
/**
* Returns the first child that is an element. This is opposed to firstChild DOM
* property which will return any node (whitespace in most usual cases).
*
* @param element {Element} DOM element to query for first descendant
* @return {Element} the first descendant
*/
getFirstDescendant : function(element){
element = element.firstChild;
while(element && element.nodeType != 1){
element = element.nextSibling;
};
return element;
},
/**
* Returns the last child that is an element. This is opposed to lastChild DOM
* property which will return any node (whitespace in most usual cases).
*
* @param element {Element} DOM element to query for last descendant
* @return {Element} the last descendant
*/
getLastDescendant : function(element){
element = element.lastChild;
while(element && element.nodeType != 1){
element = element.previousSibling;
};
return element;
},
/**
* Collects all of element's previous siblings and returns them as an array of elements.
*
* @param element {Element} DOM element to query for previous siblings
* @return {Array} list of found DOM elements
*/
getPreviousSiblings : function(element){
return this._recursivelyCollect(element, "previousSibling");
},
/**
* Collects all of element's next siblings and returns them as an array of
* elements.
*
* @param element {Element} DOM element to query for next siblings
* @return {Array} list of found DOM elements
*/
getNextSiblings : function(element){
return this._recursivelyCollect(element, "nextSibling");
},
/**
* Recursively collects elements whose relationship is specified by
* property. <code>property</code> has to be a property (a method won't
* do!) of element that points to a single DOM node. Returns an array of
* elements.
*
* @param element {Element} DOM element to start with
* @param property {String} property to look for
* @return {Array} result list
*/
_recursivelyCollect : function(element, property){
var list = [];
while(element = element[property]){
if(element.nodeType == 1){
list.push(element);
};
};
return list;
},
/**
* Collects all of element's siblings and returns them as an array of elements.
*
* @param element {var} DOM element to start with
* @return {Array} list of all found siblings
*/
getSiblings : function(element){
return this.getPreviousSiblings(element).reverse().concat(this.getNextSiblings(element));
},
/**
* Whether the given element is empty.
* Inspired by Base2 (Dean Edwards)
*
* @param element {Element} The element to check
* @return {Boolean} true when the element is empty
*/
isEmpty : function(element){
element = element.firstChild;
while(element){
if(element.nodeType === qx.dom.Node.ELEMENT || element.nodeType === qx.dom.Node.TEXT){
return false;
};
element = element.nextSibling;
};
return true;
},
/**
* Removes all of element's text nodes which contain only whitespace
*
* @param element {Element} Element to cleanup
*/
cleanWhitespace : function(element){
var node = element.firstChild;
while(node){
var nextNode = node.nextSibling;
if(node.nodeType == 3 && !/\S/.test(node.nodeValue)){
element.removeChild(node);
};
node = nextNode;
};
}
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2011-2012 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Martin Wittemann (wittemann)
* Daniel Wagner (danielwagner)
************************************************************************ */
/* ************************************************************************
#require(qx.dom.Hierarchy#getSiblings)
#require(qx.dom.Hierarchy#getNextSiblings)
#require(qx.dom.Hierarchy#getPreviousSiblings)
************************************************************************ */
/**
* DOM traversal module
*/
qx.Bootstrap.define("qx.module.Traversing", {
statics : {
/**
* Adds an element to the collection
*
* @attach {qxWeb}
* @param el {Element} DOM element to add to the collection
* @return {qxWeb} The collection for chaining
*/
add : function(el){
this.push(el);
return this;
},
/**
* Gets a set of elements containing all of the unique immediate children of
* each of the matched set of elements.
* This set can be filtered with an optional expression that will cause only
* elements matching the selector to be collected.
*
* @attach {qxWeb}
* @param selector {String?null} Optional selector to match
* @return {qxWeb} Collection containing the child elements
*/
getChildren : function(selector){
var children = [];
for(var i = 0;i < this.length;i++){
var found = qx.dom.Hierarchy.getChildElements(this[i]);
if(selector){
found = qx.bom.Selector.matches(selector, found);
};
children = children.concat(found);
};
return qxWeb.$init(children);
},
/**
* Executes the provided callback function once for each item in the
* collection.
*
* @attach {qxWeb}
* @param fn {Function} Callback function
* @param ctx {Object} Context object
* @return {qxWeb} The collection for chaining
*/
forEach : function(fn, ctx){
for(var i = 0;i < this.length;i++){
fn.call(ctx, this[i], i, this);
};
return this;
},
/**
* Gets a set of elements containing the parent of each element in the
* collection.
* This set can be filtered with an optional expression that will cause only
* elements matching the selector to be collected.
*
* @attach {qxWeb}
* @param selector {String?null} Optional selector to match
* @return {qxWeb} Collection containing the parent elements
*/
getParents : function(selector){
var parents = [];
for(var i = 0;i < this.length;i++){
var found = qx.dom.Element.getParentElement(this[i]);
if(selector){
found = qx.bom.Selector.matches(selector, [found]);
};
parents = parents.concat(found);
};
return qxWeb.$init(parents);
},
/**
* Gets a set of elements containing all ancestors of each element in the
* collection.
* This set can be filtered with an optional expression that will cause only
* elements matching the selector to be collected.
*
* @attach {qxWeb}
* @param filter {String?null} Optional selector to match
* @return {qxWeb} Collection containing the ancestor elements
*/
getAncestors : function(filter){
return this.__getAncestors(null, filter);
},
/**
* Gets a set of elements containing all ancestors of each element in the
* collection, up to (but not including) the element matched by the provided
* selector.
* This set can be filtered with an optional expression that will cause only
* elements matching the selector to be collected.
*
* @attach {qxWeb}
* @param selector {String} Selector that indicates where to stop including
* ancestor elements
* @param filter {String?null} Optional selector to match
* @return {qxWeb} Collection containing the ancestor elements
*/
getAncestorsUntil : function(selector, filter){
return this.__getAncestors(selector, filter);
},
/**
* Internal helper for getAncestors and getAncestorsUntil
*
* @attach {qxWeb}
* @param selector {String} Selector that indicates where to stop including
* ancestor elements
* @param filter {String?null} Optional selector to match
* @return {qxWeb} Collection containing the ancestor elements
* @internal
*/
__getAncestors : function(selector, filter){
var ancestors = [];
for(var i = 0;i < this.length;i++){
var parent = qx.dom.Element.getParentElement(this[i]);
while(parent){
var found = [parent];
if(selector && qx.bom.Selector.matches(selector, found).length > 0){
break;
};
if(filter){
found = qx.bom.Selector.matches(filter, found);
};
ancestors = ancestors.concat(found);
parent = qx.dom.Element.getParentElement(parent);
};
};
return qxWeb.$init(ancestors);
},
/**
* Gets a set containing the closest matching ancestor for each item in
* the collection.
* If the item itself matches, it is added to the new set. Otherwise, the
* item's parent chain will be traversed until a match is found.
*
* @attach {qxWeb}
* @param selector {String} Selector expression to match
* @return {qxWeb} New collection containing the closest matching ancestors
*/
getClosest : function(selector){
var closest = [];
var findClosest = function findClosest(current){
var found = qx.bom.Selector.matches(selector, current);
if(found.length){
closest.push(found[0]);
} else {
current = current.getParents();
// One up
if(current[0] && current[0].parentNode){
findClosest(current);
};
};
};
for(var i = 0;i < this.length;i++){
findClosest(qxWeb(this[i]));
};
return qxWeb.$init(closest);
},
/**
* Searches the child elements of each item in the collection and returns
* a new collection containing the children that match the provided selector
*
* @attach {qxWeb}
* @param selector {String} Selector expression to match the child elements
* against
* @return {qxWeb} New collection containing the matching child elements
*/
find : function(selector){
var found = [];
for(var i = 0;i < this.length;i++){
found = found.concat(qx.bom.Selector.query(selector, this[i]));
};
return qxWeb.$init(found);
},
/**
* Gets a new set of elements containing the child nodes of each item in the
* current set.
*
* @attach {qxWeb}
* @return {qxWeb} New collection containing the child nodes
*/
getContents : function(){
var found = [];
for(var i = 0;i < this.length;i++){
found = found.concat(qx.lang.Array.fromCollection(this[i].childNodes));
};
return qxWeb.$init(found);
},
/**
* Checks if at least one element in the collection passes the provided
* filter. This can be either a selector expression or a filter
* function
*
* @attach {qxWeb}
* @param selector {String|Function} Selector expression or filter function
* @return {Boolean} <code>true</code> if at least one element matches
*/
is : function(selector){
if(qx.lang.Type.isFunction(selector)){
return this.filter(selector).length > 0;
};
return !!selector && qx.bom.Selector.matches(selector, this).length > 0;
},
/**
* Reduce the set of matched elements to a single element.
*
* @attach {qxWeb}
* @param index {Number} The position of the element in the collection
* @return {qxWeb} A new collection containing one element
*/
eq : function(index){
return this.slice(index, +index + 1);
},
/**
* Reduces the collection to the first element.
*
* @attach {qxWeb}
* @return {qxWeb} A new collection containing one element
*/
getFirst : function(){
return this.slice(0, 1);
},
/**
* Reduces the collection to the last element.
*
* @attach {qxWeb}
* @return {qxWeb} A new collection containing one element
*/
getLast : function(){
return this.slice(this.length - 1);
},
/**
* Gets a collection containing only the elements that have descendants
* matching the given selector
*
* @attach {qxWeb}
* @param selector {String} Selector expression
* @return {qxWeb} a new collection containing only elements with matching descendants
*/
has : function(selector){
var found = [];
for(var i = 0;i < this.length;i++){
var descendants = qx.bom.Selector.matches(selector, this.eq(i).getContents());
if(descendants.length > 0){
found.push(this[i]);
};
};
return qxWeb.$init(found);
},
/**
* Gets a collection containing the next sibling element of each item in
* the current set (ignoring text and comment nodes).
* This set can be filtered with an optional expression that will cause only
* elements matching the selector to be collected.
*
* @attach {qxWeb}
* @param selector {String?} Optional selector expression
* @return {qxWeb} New set containing next siblings
*/
getNext : function(selector){
var found = this.map(qx.dom.Hierarchy.getNextElementSibling, qx.dom.Hierarchy);
if(selector){
found = qx.bom.Selector.matches(selector, found);
};
return found;
},
/**
* Gets a collection containing all following sibling elements of each
* item in the current set (ignoring text and comment nodes).
* This set can be filtered with an optional expression that will cause only
* elements matching the selector to be collected.
*
* @attach {qxWeb}
* @param selector {String?} Optional selector expression
* @return {qxWeb} New set containing following siblings
*/
getNextAll : function(selector){
var ret = qx.module.Traversing.__hierarchyHelper(this, "getNextSiblings", selector);
return qxWeb.$init(ret);
},
/**
* Gets a collection containing the following sibling elements of each
* item in the current set (ignoring text and comment nodes) up to but not
* including any element that matches the given selector.
*
* @attach {qxWeb}
* @param selector {String?} Optional selector expression
* @return {qxWeb} New set containing following siblings
*/
getNextUntil : function(selector){
var found = [];
this.forEach(function(item, index){
var nextSiblings = qx.dom.Hierarchy.getNextSiblings(item);
for(var i = 0,l = nextSiblings.length;i < l;i++){
if(qx.bom.Selector.matches(selector, [nextSiblings[i]]).length > 0){
break;
};
found.push(nextSiblings[i]);
};
});
return qxWeb.$init(found);
},
/**
* Gets a collection containing the previous sibling element of each item in
* the current set (ignoring text and comment nodes).
* This set can be filtered with an optional expression that will cause only
* elements matching the selector to be collected.
*
* @attach {qxWeb}
* @param selector {String?} Optional selector expression
* @return {qxWeb} New set containing previous siblings
*/
getPrev : function(selector){
var found = this.map(qx.dom.Hierarchy.getPreviousElementSibling, qx.dom.Hierarchy);
if(selector){
found = qx.bom.Selector.matches(selector, found);
};
return found;
},
/**
* Gets a collection containing all preceding sibling elements of each
* item in the current set (ignoring text and comment nodes).
* This set can be filtered with an optional expression that will cause only
* elements matching the selector to be collected.
*
* @attach {qxWeb}
* @param selector {String?} Optional selector expression
* @return {qxWeb} New set containing preceding siblings
*/
getPrevAll : function(selector){
var ret = qx.module.Traversing.__hierarchyHelper(this, "getPreviousSiblings", selector);
return qxWeb.$init(ret);
},
/**
* Gets a collection containing the preceding sibling elements of each
* item in the current set (ignoring text and comment nodes) up to but not
* including any element that matches the given selector.
*
* @attach {qxWeb}
* @param selector {String?} Optional selector expression
* @return {qxWeb} New set containing preceding siblings
*/
getPrevUntil : function(selector){
var found = [];
this.forEach(function(item, index){
var previousSiblings = qx.dom.Hierarchy.getPreviousSiblings(item);
for(var i = 0,l = previousSiblings.length;i < l;i++){
if(qx.bom.Selector.matches(selector, [previousSiblings[i]]).length > 0){
break;
};
found.push(previousSiblings[i]);
};
});
return qxWeb.$init(found);
},
/**
* Gets a collection containing all sibling elements of the items in the
* current set.
* This set can be filtered with an optional expression that will cause only
* elements matching the selector to be collected.
*
* @attach {qxWeb}
* @param selector {String?} Optional selector expression
* @return {qxWeb} New set containing sibling elements
*/
getSiblings : function(selector){
var ret = qx.module.Traversing.__hierarchyHelper(this, "getSiblings", selector);
return qxWeb.$init(ret);
},
/**
* Remove elements from the collection that do not pass the given filter.
* This can be either a selector expression or a filter function
*
* @attach {qxWeb}
* @param selector {String|Function} Selector or filter function
* @return {qxWeb} Reduced collection
*/
not : function(selector){
if(qx.lang.Type.isFunction(selector)){
return this.filter(function(item, index, obj){
return !selector(item, index, obj);
});
};
var res = qx.bom.Selector.matches(selector, this);
return this.filter(function(value){
return res.indexOf(value) === -1;
});
},
/**
* Gets a new collection containing the offset parent of each item in the
* current set.
*
* @attach {qxWeb}
* @return {qxWeb} New collection containing offset parents
*/
getOffsetParent : function(){
return this.map(qx.bom.element.Location.getOffsetParent);
},
/**
* Whether the first element in the collection is inserted into
* the document for which it was created.
*
* @return {Boolean} <code>true</code> when the element is inserted
* into the document.
*/
isRendered : function(){
if(!this[0]){
return false;
};
return qx.dom.Hierarchy.isRendered(this[0]);
},
/**
* Checks if the given object is a DOM element
*
* @attachStatic{qxWeb}
* @param element {Object} Object to check
* @return {Boolean} <code>true</code> if the object is a DOM element
*/
isElement : function(element){
return qx.dom.Node.isElement(element);
},
/**
* Checks if the given object is a DOM node
*
* @attachStatic{qxWeb}
* @param node {Object} Object to check
* @return {Boolean} <code>true</code> if the object is a DOM node
*/
isNode : function(node){
return qx.dom.Node.isNode(node);
},
/**
* Checks if the given object is a DOM document object
*
* @attachStatic{qxWeb}
* @param node {Object} Object to check
* @return {Boolean} <code>true</code> if the object is a DOM document
*/
isDocument : function(node){
return qx.dom.Node.isDocument(node);
},
/**
* Returns the DOM2 <code>defaultView</code> (window) for the given node.
*
* @attachStatic{qxWeb}
* @param node {Node|Document|Window} Node to inspect
* @return {Window} the <code>defaultView</code> for the given node
*/
getWindow : function(node){
return qx.dom.Node.getWindow(node);
},
/**
* Returns the owner document of the given node
*
* @attachStatic{qxWeb}
* @param node {Node } Node to get the document for
* @return {Document|null} The document of the given DOM node
*/
getDocument : function(node){
return qx.dom.Node.getDocument(node);
},
/**
* Helper function that iterates over a set of items and applies the given
* qx.dom.Hierarchy method to each entry, storing the results in a new Array.
* Duplicates are removed and the items are filtered if a selector is
* provided.
*
* @attach{qxWeb}
* @param collection {Array} Collection to iterate over (any Array-like object)
* @param method {String} Name of the qx.dom.Hierarchy method to apply
* @param selector {String?} Optional selector that elements to be included
* must match
* @return {Array} Result array
* @internal
*/
__hierarchyHelper : function(collection, method, selector){
// Iterate ourself, as we want to directly combine the result
var all = [];
var Hierarchy = qx.dom.Hierarchy;
for(var i = 0,l = collection.length;i < l;i++){
all.push.apply(all, Hierarchy[method](collection[i]));
};
// Remove duplicates
var ret = qx.lang.Array.unique(all);
// Post reduce result by selector
if(selector){
ret = qx.bom.Selector.matches(selector, ret);
};
return ret;
}
},
defer : function(statics){
qxWeb.$attach({
"add" : statics.add,
"getChildren" : statics.getChildren,
"forEach" : statics.forEach,
"getParents" : statics.getParents,
"getAncestors" : statics.getAncestors,
"getAncestorsUntil" : statics.getAncestorsUntil,
"__getAncestors" : statics.__getAncestors,
"getClosest" : statics.getClosest,
"find" : statics.find,
"getContents" : statics.getContents,
"is" : statics.is,
"eq" : statics.eq,
"getFirst" : statics.getFirst,
"getLast" : statics.getLast,
"has" : statics.has,
"getNext" : statics.getNext,
"getNextAll" : statics.getNextAll,
"getNextUntil" : statics.getNextUntil,
"getPrev" : statics.getPrev,
"getPrevAll" : statics.getPrevAll,
"getPrevUntil" : statics.getPrevUntil,
"getSiblings" : statics.getSiblings,
"not" : statics.not,
"getOffsetParent" : statics.getOffsetParent,
"isRendered" : statics.isRendered
});
qxWeb.$attachStatic({
"isElement" : statics.isElement,
"isNode" : statics.isNode,
"isDocument" : statics.isDocument,
"getDocument" : statics.getDocument,
"getWindow" : statics.getWindow
});
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2011-2012 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Martin Wittemann (wittemann)
* Daniel Wagner (danielwagner)
************************************************************************ */
/**
* Attribute/Property handling for DOM elements.
*/
qx.Bootstrap.define("qx.module.Attribute", {
statics : {
/**
* Returns the HTML content of the first item in the collection
* @attach {qxWeb}
* @return {String|null} HTML content or null if the collection is empty
*/
getHtml : function(){
if(this[0]){
return qx.bom.element.Attribute.get(this[0], "html");
};
return null;
},
/**
* Sets the HTML content of each item in the collection
*
* @attach {qxWeb}
* @param html {String} HTML string
* @return {qxWeb} The collection for chaining
*/
setHtml : function(html){
for(var i = 0;i < this.length;i++){
qx.bom.element.Attribute.set(this[i], "html", html);
};
return this;
},
/**
* Sets an HTML attribute on each item in the collection
*
* @attach {qxWeb}
* @param name {String} Attribute name
* @param value {var} Attribute value
* @return {qxWeb} The collection for chaining
*/
setAttribute : function(name, value){
for(var i = 0;i < this.length;i++){
qx.bom.element.Attribute.set(this[i], name, value);
};
return this;
},
/**
* Returns the value of the given attribute for the first item in the
* collection.
*
* @attach {qxWeb}
* @param name {String} Attribute name
* @return {var} Attribute value
*/
getAttribute : function(name){
if(this[0]){
return qx.bom.element.Attribute.get(this[0], name);
};
return null;
},
/**
* Removes the given attribute from all elements in the collection
*
* @attach {qxWeb}
* @param name {String} Attribute name
* @return {qxWeb} The collection for chaining
*/
removeAttribute : function(name){
for(var i = 0;i < this.length;i++){
qx.bom.element.Attribute.set(this[i], name, null);
};
return this;
},
/**
* Sets multiple attributes for each item in the collection.
*
* @attach {qxWeb}
* @param attributes {Map} A map of attribute name/value pairs
* @return {qxWeb} The collection for chaining
*/
setAttributes : function(attributes){
for(var name in attributes){
this.setAttribute(name, attributes[name]);
};
return this;
},
/**
* Returns the values of multiple attributes for the first item in the collection
*
* @attach {qxWeb}
* @param names {String[]} List of attribute names
* @return {Map} Map of attribute name/value pairs
*/
getAttributes : function(names){
var attributes = {
};
for(var i = 0;i < names.length;i++){
attributes[names[i]] = this.getAttribute(names[i]);
};
return attributes;
},
/**
* Removes multiple attributes from each item in the collection.
*
* @attach {qxWeb}
* @param attributes {String[]} List of attribute names
* @return {qxWeb} The collection for chaining
*/
removeAttributes : function(attributes){
for(var i = 0,l = attributes.length;i < l;i++){
this.removeAttribute(attributes[i]);
};
return this;
},
/**
* Sets a property on each item in the collection
*
* @attach {qxWeb}
* @param name {String} Property name
* @param value {var} Property value
* @return {qxWeb} The collection for chaining
*/
setProperty : function(name, value){
for(var i = 0;i < this.length;i++){
this[i][name] = value;
};
return this;
},
/**
* Returns the value of the given property for the first item in the
* collection
*
* @attach {qxWeb}
* @param name {String} Property name
* @return {var} Property value
*/
getProperty : function(name){
if(this[0]){
return this[0][name];
};
return null;
},
/**
* Sets multiple properties for each item in the collection.
*
* @attach {qxWeb}
* @param properties {Map} A map of property name/value pairs
* @return {qxWeb} The collection for chaining
*/
setProperties : function(properties){
for(var name in properties){
this.setProperty(name, properties[name]);
};
return this;
},
/**
* Returns the values of multiple properties for the first item in the collection
*
* @attach {qxWeb}
* @param names {String[]} List of property names
* @return {Map} Map of property name/value pairs
*/
getProperties : function(names){
var properties = {
};
for(var i = 0;i < names.length;i++){
properties[names[i]] = this.getProperty(names[i]);
};
return properties;
},
/**
* Returns the currently configured value for the first item in the collection.
* Works with simple input fields as well as with select boxes or option
* elements. Returns an array for select boxes with multi selection. In all
* other cases, a string is returned.
*
* @attach {qxWeb}
* @return {String|Array}
*/
getValue : function(){
if(this[0]){
return qx.bom.Input.getValue(this[0]);
};
return null;
},
/**
* Applies the given value to each element in the collection.
* Normally the value is given as a string/number value and applied to the
* field content (textfield, textarea) or used to detect whether the field
* is checked (checkbox, radiobutton).
* Supports array values for selectboxes (multiple selection) and checkboxes
* or radiobuttons (for convenience).
* Please note: To modify the value attribute of a checkbox or radiobutton
* use @link{#set} instead.
*
* @attach {qxWeb}
* @param value {String|Number|Array} The value to apply
* @return {qxWeb} The collection for chaining
*/
setValue : function(value){
for(var i = 0,l = this.length;i < l;i++){
qx.bom.Input.setValue(this[i], value);
};
return this;
}
},
defer : function(statics){
qxWeb.$attach({
"getHtml" : statics.getHtml,
"setHtml" : statics.setHtml,
"getAttribute" : statics.getAttribute,
"setAttribute" : statics.setAttribute,
"removeAttribute" : statics.removeAttribute,
"getAttributes" : statics.getAttributes,
"setAttributes" : statics.setAttributes,
"removeAttributes" : statics.removeAttributes,
"getProperty" : statics.getProperty,
"setProperty" : statics.setProperty,
"getProperties" : statics.getProperties,
"setProperties" : statics.setProperties,
"getValue" : statics.getValue,
"setValue" : statics.setValue
});
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2004-2008 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Sebastian Werner (wpbasti)
* Andreas Ecker (ecker)
======================================================================
This class contains code based on the following work:
* jQuery
http://jquery.com
Version 1.3.1
Copyright:
2009 John Resig
License:
MIT: http://www.opensource.org/licenses/mit-license.php
************************************************************************ */
/* ************************************************************************
#require(qx.lang.Array#contains)
************************************************************************ */
/**
* Cross browser abstractions to work with input elements.
*/
qx.Bootstrap.define("qx.bom.Input", {
/*
*****************************************************************************
STATICS
*****************************************************************************
*/
statics : {
/** {Map} Internal data structures with all supported input types */
__types : {
text : 1,
textarea : 1,
select : 1,
checkbox : 1,
radio : 1,
password : 1,
hidden : 1,
submit : 1,
image : 1,
file : 1,
search : 1,
reset : 1,
button : 1
},
/**
* Creates an DOM input/textarea/select element.
*
* Attributes may be given directly with this call. This is critical
* for some attributes e.g. name, type, ... in many clients.
*
* Note: <code>select</code> and <code>textarea</code> elements are created
* using the identically named <code>type</code>.
*
* @param type {String} Any valid type for HTML, <code>select</code>
* and <code>textarea</code>
* @param attributes {Map} Map of attributes to apply
* @param win {Window} Window to create the element for
* @return {Element} The created input node
*/
create : function(type, attributes, win){
{
};
// Work on a copy to not modify given attributes map
var attributes = attributes ? qx.lang.Object.clone(attributes) : {
};
var tag;
if(type === "textarea" || type === "select"){
tag = type;
} else {
tag = "input";
attributes.type = type;
};
return qx.dom.Element.create(tag, attributes, win);
},
/**
* Applies the given value to the element.
*
* Normally the value is given as a string/number value and applied
* to the field content (textfield, textarea) or used to
* detect whether the field is checked (checkbox, radiobutton).
*
* Supports array values for selectboxes (multiple-selection)
* and checkboxes or radiobuttons (for convenience).
*
* Please note: To modify the value attribute of a checkbox or
* radiobutton use {@link qx.bom.element.Attribute#set} instead.
*
* @param element {Element} element to update
* @param value {String|Number|Array} the value to apply
*/
setValue : function(element, value){
var tag = element.nodeName.toLowerCase();
var type = element.type;
var Array = qx.lang.Array;
var Type = qx.lang.Type;
if(typeof value === "number"){
value += "";
};
if((type === "checkbox" || type === "radio")){
if(Type.isArray(value)){
element.checked = Array.contains(value, element.value);
} else {
element.checked = element.value == value;
};
} else if(tag === "select"){
var isArray = Type.isArray(value);
var options = element.options;
var subel,subval;
for(var i = 0,l = options.length;i < l;i++){
subel = options[i];
subval = subel.getAttribute("value");
if(subval == null){
subval = subel.text;
};
subel.selected = isArray ? Array.contains(value, subval) : value == subval;
};
if(isArray && value.length == 0){
element.selectedIndex = -1;
};
} else if((type === "text" || type === "textarea") && (qx.core.Environment.get("engine.name") == "mshtml")){
// These flags are required to detect self-made property-change
// events during value modification. They are used by the Input
// event handler to filter events.
element.$$inValueSet = true;
element.value = value;
element.$$inValueSet = null;
} else {
element.value = value;
};;
},
/**
* Returns the currently configured value.
*
* Works with simple input fields as well as with
* select boxes or option elements.
*
* Returns an array in cases of multi-selection in
* select boxes but in all other cases a string.
*
* @param element {Element} DOM element to query
* @return {String|Array} The value of the given element
*/
getValue : function(element){
var tag = element.nodeName.toLowerCase();
if(tag === "option"){
return (element.attributes.value || {
}).specified ? element.value : element.text;
};
if(tag === "select"){
var index = element.selectedIndex;
// Nothing was selected
if(index < 0){
return null;
};
var values = [];
var options = element.options;
var one = element.type == "select-one";
var clazz = qx.bom.Input;
var value;
// Loop through all the selected options
for(var i = one ? index : 0,max = one ? index + 1 : options.length;i < max;i++){
var option = options[i];
if(option.selected){
// Get the specifc value for the option
value = clazz.getValue(option);
// We don't need an array for one selects
if(one){
return value;
};
// Multi-Selects return an array
values.push(value);
};
};
return values;
} else {
return (element.value || "").replace(/\r/g, "");
};
},
/**
* Sets the text wrap behaviour of a text area element.
* This property uses the attribute "wrap" respectively
* the style property "whiteSpace"
*
* @signature function(element, wrap)
* @param element {Element} DOM element to modify
* @param wrap {Boolean} Whether to turn text wrap on or off.
*/
setWrap : qx.core.Environment.select("engine.name", {
"mshtml" : function(element, wrap){
var wrapValue = wrap ? "soft" : "off";
// Explicitly set overflow-y CSS property to auto when wrapped,
// allowing the vertical scroll-bar to appear if necessary
var styleValue = wrap ? "auto" : "";
element.wrap = wrapValue;
element.style.overflowY = styleValue;
},
"gecko|webkit" : function(element, wrap){
var wrapValue = wrap ? "soft" : "off";
var styleValue = wrap ? "" : "auto";
element.setAttribute("wrap", wrapValue);
element.style.overflow = styleValue;
},
"default" : function(element, wrap){
element.style.whiteSpace = wrap ? "normal" : "nowrap";
}
})
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2011-2012 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Martin Wittemann (wittemann)
* Daniel Wagner (danielwagner)
************************************************************************ */
/* ************************************************************************
#ignore(qx.bom.element.AnimationJs)
#ignore(qx.bom)
************************************************************************ */
/**
* DOM manipulation module
*/
qx.Bootstrap.define("qx.module.Manipulating", {
statics : {
/**
* Creates a new collection from the given argument. This can either be an
* HTML string, a single DOM element or an array of elements
*
* @attachStatic{qxWeb}
* @param html {String|Element[]} HTML string or DOM element(s)
* @return {qxWeb} Collection of elements
*/
create : function(html){
return qxWeb.$init(qx.bom.Html.clean([html]));
},
/**
* Clones the items in the current collection and returns them in a new set.
* Event listeners can also be cloned.
*
* @attach{qxWeb}
* @param events {Boolean} clone event listeners. Default: <pre>false</pre>
* @return {qxWeb} New collection with clones
*/
clone : function(events){
var clones = [];
for(var i = 0;i < this.length;i++){
clones[i] = this[i].cloneNode(true);
};
if(events === true && this.copyEventsTo){
this.copyEventsTo(clones);
};
return qxWeb(clones);
},
/**
* Appends content to each element in the current set. Accepts an HTML string,
* a single DOM element or an array of elements
*
* @attach{qxWeb}
* @param html {String|Element[]} HTML string or DOM element(s) to append
* @return {qxWeb} The collection for chaining
*/
append : function(html){
var arr = qx.bom.Html.clean([html]);
var children = qxWeb.$init(arr);
for(var i = 0,l = this.length;i < l;i++){
for(var j = 0,m = children.length;j < m;j++){
if(i == 0){
// first parent: move the target node(s)
qx.dom.Element.insertEnd(children[j], this[i]);
} else {
qx.dom.Element.insertEnd(children.eq(j).clone(true)[0], this[i]);
};
};
};
return this;
},
/**
* Appends all items in the collection to the specified parents. If multiple
* parents are given, the items will be moved to the first parent, while
* clones of the items will be appended to subsequent parents.
*
* @attach{qxWeb}
* @param parent {String|Element[]} Parent selector expression or list of
* parent elements
* @return {qxWeb} The collection for chaining
*/
appendTo : function(parent){
parent = qx.module.Manipulating.__getElementArray(parent);
for(var i = 0,l = parent.length;i < l;i++){
for(var j = 0,m = this.length;j < m;j++){
if(i == 0){
// first parent: move the target node(s)
qx.dom.Element.insertEnd(this[j], parent[i]);
} else {
// further parents: clone the target node(s)
qx.dom.Element.insertEnd(this.eq(j).clone(true)[0], parent[i]);
};
};
};
return this;
},
/**
* Inserts the current collection before each target item. The collection
* items are moved before the first target. For subsequent targets,
* clones of the collection items are created and inserted.
*
* @attach{qxWeb}
* @param target {String|Element} Selector expression or DOM element
* @return {qxWeb} The collection for chaining
*/
insertBefore : function(target){
target = qx.module.Manipulating.__getElementArray(target);
for(var i = 0,l = target.length;i < l;i++){
for(var j = 0,m = this.length;j < m;j++){
if(i == 0){
// first target: move the target node(s)
qx.dom.Element.insertBefore(this[j], target[i]);
} else {
// further targets: clone the target node(s)
qx.dom.Element.insertBefore(this.eq(j).clone(true)[0], target[i]);
};
};
};
return this;
},
/**
* Inserts the current collection after each target item. The collection
* items are moved after the first target. For subsequent targets,
* clones of the collection items are created and inserted.
*
* @attach{qxWeb}
* @param target {String|Element} Selector expression or DOM element
* @return {qxWeb} The collection for chaining
*/
insertAfter : function(target){
target = qx.module.Manipulating.__getElementArray(target);
for(var i = 0,l = target.length;i < l;i++){
for(var j = this.length - 1;j >= 0;j--){
if(i == 0){
// first target: move the target node(s)
qx.dom.Element.insertAfter(this[j], target[i]);
} else {
// further targets: clone the target node(s)
qx.dom.Element.insertAfter(this.eq(j).clone(true)[0], target[i]);
};
};
};
return this;
},
/**
* Returns an array from a selector expression or a single element
*
* @attach{qxWeb}
* @param arg {String|Element} Selector expression or DOM element
* @return {Element[]} Array of elements
* @internal
*/
__getElementArray : function(arg){
if(!qx.lang.Type.isArray(arg)){
var fromSelector = qxWeb(arg);
arg = fromSelector.length > 0 ? fromSelector : [arg];
};
return arg;
},
/**
* Wraps each element in the collection in a copy of an HTML structure.
* Elements will be appended to the deepest nested element in the structure
* as determined by a depth-first search.
*
* @attach{qxWeb}
* @param wrapper {var} Selector expression, HTML string, DOM element or
* list of DOM elements
* @return {qxWeb} The collection for chaining
*/
wrap : function(wrapper){
var wrapper = qx.module.Manipulating.__getCollectionFromArgument(wrapper);
if(wrapper.length == 0 || !qx.dom.Node.isElement(wrapper[0])){
return this;
};
for(var i = 0,l = this.length;i < l;i++){
var clonedwrapper = wrapper.eq(0).clone(true);
qx.dom.Element.insertAfter(clonedwrapper[0], this[i]);
var innermost = qx.module.Manipulating.__getInnermostElement(clonedwrapper[0]);
qx.dom.Element.insertEnd(this[i], innermost);
};
return this;
},
/**
* Creates a new collection from the given argument
* @param arg {var} Selector expression, HTML string, DOM element or list of
* DOM elements
* @return {qxWeb} Collection
* @internal
*/
__getCollectionFromArgument : function(arg){
var coll;
// Collection/array of DOM elements
if(qx.lang.Type.isArray(arg)){
coll = qxWeb(arg);
} else {
var arr = qx.bom.Html.clean([arg]);
if(arr.length > 0 && qx.dom.Node.isElement(arr[0])){
coll = qxWeb(arr);
} else {
coll = qxWeb(arg);
};
};
return coll;
},
/**
* Returns the innermost element of a DOM tree as determined by a simple
* depth-first search.
*
* @param element {Element} Root element
* @return {Element} innermost element
* @internal
*/
__getInnermostElement : function(element){
if(element.childNodes.length == 0){
return element;
};
for(var i = 0,l = element.childNodes.length;i < l;i++){
if(element.childNodes[i].nodeType === 1){
return this.__getInnermostElement(element.childNodes[i]);
};
};
return element;
},
/**
* Removes each element in the current collection from the DOM
*
* @attach{qxWeb}
* @return {qxWeb} The collection for chaining
*/
remove : function(){
for(var i = 0;i < this.length;i++){
qx.dom.Element.remove(this[i]);
};
return this;
},
/**
* Removes all content from the elements in the collection
*
* @attach{qxWeb}
* @return {qxWeb} The collection for chaining
*/
empty : function(){
for(var i = 0;i < this.length;i++){
this[i].innerHTML = "";
};
return this;
},
/**
* Inserts content before each element in the collection. This can either
* be an HTML string, an array of HTML strings, a single DOM element or an
* array of elements.
*
* @attach{qxWeb}
* @param content {String[]|Element[]} HTML string(s) or DOM element(s)
* @return {qxWeb} The collection for chaining
*/
before : function(content){
if(!qx.lang.Type.isArray(content)){
content = [content];
};
var fragment = document.createDocumentFragment();
qx.bom.Html.clean(content, document, fragment);
this.forEach(function(item, index){
var kids = qx.lang.Array.cast(fragment.childNodes, Array);
for(var i = 0,l = kids.length;i < l;i++){
var child;
if(index < this.length - 1){
child = kids[i].cloneNode(true);
} else {
child = kids[i];
};
item.parentNode.insertBefore(child, item);
};
}, this);
return this;
},
/**
* Inserts content after each element in the collection. This can either
* be an HTML string, an array of HTML strings, a single DOM element or an
* array of elements.
*
* @attach{qxWeb}
* @param content {String[]|Element[]} HTML string(s) or DOM element(s)
* @return {qxWeb} The collection for chaining
*/
after : function(content){
if(!qx.lang.Type.isArray(content)){
content = [content];
};
var fragment = document.createDocumentFragment();
qx.bom.Html.clean(content, document, fragment);
this.forEach(function(item, index){
var kids = qx.lang.Array.cast(fragment.childNodes, Array);
for(var i = kids.length - 1;i >= 0;i--){
var child;
if(index < this.length - 1){
child = kids[i].cloneNode(true);
} else {
child = kids[i];
};
item.parentNode.insertBefore(child, item.nextSibling);
};
}, this);
return this;
},
/**
* Returns the left scroll position of the first element in the collection.
*
* @attach{qxWeb}
* @return {Number} Current left scroll position
*/
getScrollLeft : function(){
var obj = this[0];
if(!obj){
return null;
};
var Node = qx.dom.Node;
if(Node.isWindow(obj) || Node.isDocument(obj)){
return qx.bom.Viewport.getScrollLeft();
};
return obj.scrollLeft;
},
/**
* Returns the top scroll position of the first element in the collection.
*
* @attach{qxWeb}
* @return {Number} Current top scroll position
*/
getScrollTop : function(){
var obj = this[0];
if(!obj){
return null;
};
var Node = qx.dom.Node;
if(Node.isWindow(obj) || Node.isDocument(obj)){
return qx.bom.Viewport.getScrollTop();
};
return obj.scrollTop;
},
/** Default animation descriptions for animated scrolling **/
_animationDescription : {
scrollLeft : {
duration : 700,
timing : "ease-in",
keep : 100,
keyFrames : {
'0' : {
},
'100' : {
scrollLeft : 1
}
}
},
scrollTop : {
duration : 700,
timing : "ease-in",
keep : 100,
keyFrames : {
'0' : {
},
'100' : {
scrollTop : 1
}
}
}
},
/**
* Performs animated scrolling
*
* @param property {String} Element property to animate: <code>scrollLeft</code>
* or <code>scrollTop</code>
* @param value {Number} Final scroll position
* @param duration {Number} The animation's duration in ms
* @return {q} The collection for chaining.
*/
__animateScroll : function(property, value, duration){
var desc = qx.lang.Object.clone(qx.module.Manipulating._animationDescription[property], true);
desc.keyFrames[100][property] = value;
return this.animate(desc, duration);
},
/**
* Scrolls the elements of the collection to the given coordinate.
*
* @attach{qxWeb}
* @param value {Number} Left scroll position
* @param duration {Number?} Optional: Duration in ms for animated scrolling
* @return {qxWeb} The collection for chaining
*/
setScrollLeft : function(value, duration){
var Node = qx.dom.Node;
if(duration && qx.bom.element && qx.bom.element.AnimationJs){
qx.module.Manipulating.__animateScroll.bind(this, "scrollLeft", value, duration)();
};
for(var i = 0,l = this.length,obj;i < l;i++){
obj = this[i];
if(Node.isElement(obj)){
if(!(duration && qx.bom.element && qx.bom.element.AnimationJs)){
obj.scrollLeft = value;
};
} else if(Node.isWindow(obj)){
obj.scrollTo(value, this.getScrollTop(obj));
} else if(Node.isDocument(obj)){
Node.getWindow(obj).scrollTo(value, this.getScrollTop(obj));
};;
};
return this;
},
/**
* Scrolls the elements of the collection to the given coordinate.
*
* @attach{qxWeb}
* @param value {Number} Top scroll position
* @param duration {Number?} Optional: Duration in ms for animated scrolling
* @return {qxWeb} The collection for chaining
*/
setScrollTop : function(value, duration){
var Node = qx.dom.Node;
if(duration && qx.bom.element && qx.bom.element.AnimationJs){
qx.module.Manipulating.__animateScroll.bind(this, "scrollTop", value, duration)();
};
for(var i = 0,l = this.length,obj;i < l;i++){
obj = this[i];
if(Node.isElement(obj)){
if(!(duration && qx.bom.element && qx.bom.element.AnimationJs)){
obj.scrollTop = value;
};
} else if(Node.isWindow(obj)){
obj.scrollTo(this.getScrollLeft(obj), value);
} else if(Node.isDocument(obj)){
Node.getWindow(obj).scrollTo(this.getScrollLeft(obj), value);
};;
};
return this;
},
/**
* Focuses the first element in the collection
*
* @attach{qxWeb}
* @return {qxWeb} The collection for chaining
*/
focus : function(){
try{
this[0].focus();
} catch(ex) {
};
return this;
},
/**
* Blurs each element in the collection
*
* @attach{qxWeb}
* @return {qxWeb} The collection for chaining
*/
blur : function(){
this.forEach(function(item, index){
try{
item.blur();
} catch(ex) {
};
});
return this;
}
},
defer : function(statics){
qxWeb.$attachStatic({
"create" : statics.create
});
qxWeb.$attach({
"append" : statics.append,
"appendTo" : statics.appendTo,
"remove" : statics.remove,
"empty" : statics.empty,
"before" : statics.before,
"insertBefore" : statics.insertBefore,
"after" : statics.after,
"insertAfter" : statics.insertAfter,
"wrap" : statics.wrap,
"clone" : statics.clone,
"getScrollLeft" : statics.getScrollLeft,
"setScrollLeft" : statics.setScrollLeft,
"getScrollTop" : statics.getScrollTop,
"setScrollTop" : statics.setScrollTop,
"focus" : statics.focus,
"blur" : statics.blur
});
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2009 Sebastian Werner, http://sebastian-werner.net
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Sebastian Werner (wpbasti)
======================================================================
This class contains code based on the following work:
* jQuery
http://jquery.com
Version 1.3.1
Copyright:
2009 John Resig
License:
MIT: http://www.opensource.org/licenses/mit-license.php
************************************************************************ */
/* ************************************************************************
#ignore(qxWeb)
************************************************************************ */
/**
* This class is mainly a convenience wrapper for DOM elements to
* qooxdoo's event system.
*/
qx.Bootstrap.define("qx.bom.Html", {
/*
*****************************************************************************
STATICS
*****************************************************************************
*/
statics : {
/**
* Helper method for XHTML replacement.
*
* @param all {String} Complete string
* @param front {String} Front of the match
* @param tag {String} Tag name
* @return {String} XHTML corrected tag
*/
__fixNonDirectlyClosableHelper : function(all, front, tag){
return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i) ? all : front + "></" + tag + ">";
},
/** {Map} Contains wrap fragments for specific HTML matches */
__convertMap : {
opt : [1, "<select multiple='multiple'>", "</select>"],
// option or optgroup
leg : [1, "<fieldset>", "</fieldset>"],
table : [1, "<table>", "</table>"],
tr : [2, "<table><tbody>", "</tbody></table>"],
td : [3, "<table><tbody><tr>", "</tr></tbody></table>"],
col : [2, "<table><tbody></tbody><colgroup>", "</colgroup></table>"],
def : qx.core.Environment.select("engine.name", {
"mshtml" : [1, "div<div>", "</div>"],
"default" : null
})
},
/**
* Translates a HTML string into an array of elements.
*
* @param html {String} HTML string
* @param context {Document} Context document in which (helper) elements should be created
* @return {Array} List of resulting elements
*/
__convertHtmlString : function(html, context){
var div = context.createElement("div");
// Fix "XHTML"-style tags in all browsers
// Replaces tags which are not allowed to be directly closed like
// <code>div</code> or <code>p</code>. They are patched to use an
// open and close tag instead e.g. <p> => <p></p>
html = html.replace(/(<(\w+)[^>]*?)\/>/g, this.__fixNonDirectlyClosableHelper);
// Trim whitespace, otherwise indexOf won't work as expected
var tags = html.replace(/^\s+/, "").substring(0, 5).toLowerCase();
// Auto-wrap content into required DOM structure
var wrap,map = this.__convertMap;
if(!tags.indexOf("<opt")){
wrap = map.opt;
} else if(!tags.indexOf("<leg")){
wrap = map.leg;
} else if(tags.match(/^<(thead|tbody|tfoot|colg|cap)/)){
wrap = map.table;
} else if(!tags.indexOf("<tr")){
wrap = map.tr;
} else if(!tags.indexOf("<td") || !tags.indexOf("<th")){
wrap = map.td;
} else if(!tags.indexOf("<col")){
wrap = map.col;
} else {
wrap = map.def;
};;;;;
// Omit string concat when no wrapping is needed
if(wrap){
// Go to html and back, then peel off extra wrappers
div.innerHTML = wrap[1] + html + wrap[2];
// Move to the right depth
var depth = wrap[0];
while(depth--){
div = div.lastChild;
};
} else {
div.innerHTML = html;
};
// Fix IE specific bugs
if((qx.core.Environment.get("engine.name") == "mshtml")){
// Remove IE's autoinserted <tbody> from table fragments
// String was a <table>, *may* have spurious <tbody>
var hasBody = /<tbody/i.test(html);
// String was a bare <thead> or <tfoot>
var tbody = !tags.indexOf("<table") && !hasBody ? div.firstChild && div.firstChild.childNodes : wrap[1] == "<table>" && !hasBody ? div.childNodes : [];
for(var j = tbody.length - 1;j >= 0;--j){
if(tbody[j].tagName.toLowerCase() === "tbody" && !tbody[j].childNodes.length){
tbody[j].parentNode.removeChild(tbody[j]);
};
};
// IE completely kills leading whitespace when innerHTML is used
if(/^\s/.test(html)){
div.insertBefore(context.createTextNode(html.match(/^\s*/)[0]), div.firstChild);
};
};
return qx.lang.Array.fromCollection(div.childNodes);
},
/**
* Cleans-up the given HTML and append it to a fragment
*
* When no <code>context</code> is given the global document is used to
* create new DOM elements.
*
* When a <code>fragment</code> is given the nodes are appended to this
* fragment except the script tags. These are returned in a separate Array.
*
* Please note: HTML coming from user input must be validated prior
* to passing it to this method. HTML is temporarily inserted to the DOM
* using <code>innerHTML</code>. As a consequence, scripts included in
* attribute event handlers may be executed.
*
* @param objs {Element[]|String[]} Array of DOM elements or HTML strings
* @param context {Document?document} Context in which the elements should be created
* @param fragment {Element?null} Document fragment to appends elements to
* @return {Element[]} Array of elements (when a fragment is given it only contains script elements)
*/
clean : function(objs, context, fragment){
context = context || document;
// !context.createElement fails in IE with an error but returns typeof 'object'
if(typeof context.createElement === "undefined"){
context = context.ownerDocument || context[0] && context[0].ownerDocument || document;
};
// Fast-Path:
// If a single string is passed in and it's a single tag
// just do a createElement and skip the rest
if(!fragment && objs.length === 1 && typeof objs[0] === "string"){
var match = /^<(\w+)\s*\/?>$/.exec(objs[0]);
if(match){
return [context.createElement(match[1])];
};
};
// Interate through items in incoming array
var obj,ret = [];
for(var i = 0,l = objs.length;i < l;i++){
obj = objs[i];
// Convert HTML string into DOM nodes
if(typeof obj === "string"){
obj = this.__convertHtmlString(obj, context);
};
// Append or merge depending on type
if(obj.nodeType){
ret.push(obj);
} else if(obj instanceof qx.type.BaseArray || (typeof qxWeb !== "undefined" && obj instanceof qxWeb)){
ret.push.apply(ret, Array.prototype.slice.call(obj, 0));
} else if(obj.toElement){
ret.push(obj.toElement());
} else {
ret.push.apply(ret, obj);
};;
};
// Append to fragment and filter out scripts... or...
if(fragment){
var scripts = [],elem;
for(var i = 0;ret[i];i++){
elem = ret[i];
if(elem.nodeType == 1 && elem.tagName.toLowerCase() === "script" && (!elem.type || elem.type.toLowerCase() === "text/javascript")){
// Trying to remove the element from DOM
if(elem.parentNode){
elem.parentNode.removeChild(ret[i]);
};
// Store in script list
scripts.push(elem);
} else {
if(elem.nodeType === 1){
// Recursively search for scripts and append them to the list of elements to process
var scriptList = qx.lang.Array.fromCollection(elem.getElementsByTagName("script"));
ret.splice.apply(ret, [i + 1, 0].concat(scriptList));
};
// Finally append element to fragment
fragment.appendChild(elem);
};
};
return scripts;
};
// Otherwise return the array of all elements
return ret;
}
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2012 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Martin Wittemann (wittemann)
************************************************************************ */
/* ************************************************************************
#require(qx.module.Manipulating)
#require(qx.module.Css)
#require(qx.module.Attribute)
#require(qx.module.Event)
#require(qx.module.Environment)
#require(qx.module.Polyfill)
#require(qx.module.Traversing)
************************************************************************ */
/**
* The module supplies a fallback implementation for placeholders, which is
* used on input and textarea elements. If the browser supports native placeholders
* the API silently ignores all calls. If not, an element will be created for every
* given input element and acts as placeholder. Most modern browsers support
* placeholders which makes the fallback only relevant for IE < 10 and FF < 4.
*
* * <a href="http://dev.w3.org/html5/spec/single-page.html#the-placeholder-attribute">HTML Spec</a>
*
* * <a href="http://caniuse.com/#feat=input-placeholder">Browser Support</a>
*/
qx.Bootstrap.define("qx.module.Placeholder", {
statics : {
/**
* String holding the property name which holds the placeholder
* element for each input.
*/
PLACEHOLDER_NAME : "$qx_placeholder",
/**
* Queries for all input and textarea elements on the page and updates
* their placeholder.
* @attachStatic{qxWeb, placeholder.update}
*/
update : function(){
// ignore if native placeholder are supported
if(!qxWeb.env.get("css.placeholder")){
qxWeb("input[placeholder], textarea[placeholder]").updatePlaceholder();
};
},
/**
* Updates the placeholders for input's and textarea's in the collection.
* This includes positioning, styles and DOM positioning.
* In case the browser supports native placeholders, this methods simply
* does nothing.
*
* @attach {qxWeb}
* @return {qxWeb} The collection for chaining
*/
updatePlaceholder : function(){
// ignore everything if native placeholder are supported
if(!qxWeb.env.get("css.placeholder")){
for(var i = 0;i < this.length;i++){
var item = qxWeb(this[i]);
// ignore all not fitting items in the collection
var placeholder = item.getAttribute("placeholder");
var tagName = item.getProperty("tagName");
if(!placeholder || (tagName != "TEXTAREA" && tagName != "INPUT")){
continue;
};
// create the element if necessary
var placeholderEl = item.getProperty(qx.module.Placeholder.PLACEHOLDER_NAME);
if(!placeholderEl){
placeholderEl = qx.module.Placeholder.__createPlaceholderElement(item);
};
// remove and add handling
var itemInBody = item.isRendered();
var placeholderElInBody = placeholderEl.isRendered();
if(itemInBody && !placeholderElInBody){
item.before(placeholderEl);
} else if(!itemInBody && placeholderElInBody){
placeholderEl.remove();
return this;
};
qx.module.Placeholder.__syncStyles(item);
};
};
return this;
},
/**
* Internal helper method to update the styles for a given input element.
* @param item {qxWeb} The input element to update.
*/
__syncStyles : function(item){
var placeholder = item.getAttribute("placeholder");
var placeholderEl = item.getProperty(qx.module.Placeholder.PLACEHOLDER_NAME);
var zIndex = item.getStyle("z-index");
var paddingHor = parseInt(item.getStyle("padding-left")) + 2 * parseInt(item.getStyle("padding-right"));
var paddingVer = parseInt(item.getStyle("padding-top")) + 2 * parseInt(item.getStyle("padding-bottom"));
placeholderEl.setHtml(placeholder).setStyles({
display : item.getValue() == "" ? "inline" : "none",
zIndex : zIndex == "auto" ? 1 : zIndex + 1,
textAlign : item.getStyle("text-align"),
width : (item.getWidth() - paddingHor - 4) + "px",
height : (item.getHeight() - paddingVer - 4) + "px",
left : item.getOffset().left + "px",
top : item.getOffset().top + "px",
fontFamily : item.getStyle("font-family"),
fontStyle : item.getStyle("font-style"),
fontVariant : item.getStyle("font-variant"),
fontWeight : item.getStyle("font-weight"),
fontSize : item.getStyle("font-size"),
paddingTop : (parseInt(item.getStyle("padding-top")) + 2) + "px",
paddingRight : (parseInt(item.getStyle("padding-right")) + 2) + "px",
paddingBottom : (parseInt(item.getStyle("padding-bottom")) + 2) + "px",
paddingLeft : (parseInt(item.getStyle("padding-left")) + 2) + "px"
});
},
/**
* Creates a placeholder element based on the given input element.
* @param item {qxWeb} The input element.
* @return {qxWeb} The placeholder element.
*/
__createPlaceholderElement : function(item){
// create the label with initial styles
var placeholderEl = qxWeb.create("<label>").setStyles({
position : "absolute",
color : "#989898",
overflow : "hidden",
pointerEvents : "none"
});
// store the label at the input field
item.setProperty(qx.module.Placeholder.PLACEHOLDER_NAME, placeholderEl);
// update the placeholders visibility on keyUp
item.on("keyup", function(item){
var el = item.getProperty(qx.module.Placeholder.PLACEHOLDER_NAME);
el.setStyle("display", item.getValue() == "" ? "inline" : "none");
}.bind(this, item));
// for browsers not supporting pointer events
if(!qxWeb.env.get("event.pointer")){
placeholderEl.setStyle("cursor", "text").on("click", function(item){
item.focus();
}.bind(this, item));
};
return placeholderEl;
}
},
defer : function(statics){
qxWeb.$attachStatic({
"placeholder" : {
update : statics.update
}
});
qxWeb.$attach({
"updatePlaceholder" : statics.updatePlaceholder
});
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2012 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Martin Wittemann (wittemann)
************************************************************************ */
/**
* HTML templating module. This is a wrapper for mustache.js which is a
* "framework-agnostic way to render logic-free views".
*
* Here is a basic example how to use it:
* <pre class="javascript">
* var template = "Hi, my name is {{name}}!";
* var view = {name: "qooxdoo"};
* q.template.render(template, view);
* // return "Hi, my name is qooxdoo!"
* </pre>
*
* For further details, please visit the mustache.js documentation here:
* https://github.com/janl/mustache.js/blob/master/README.md
*/
qx.Bootstrap.define("qx.module.Template", {
statics : {
/**
* Helper method which provides direct access to templates stored as HTML in
* the DOM. The DOM node with the given ID will be treated as a template,
* parsed and a new DOM node will be returned containing the parsed data.
* Keep in mind that templates can only have one root element.
* Additionally, you should not put the template into a regular, hidden
* DOM element because the template may not be valid HTML due to the containing
* mustache tags. We suggest to put it into a script tag with the type
* <code>text/template</code>.
*
* @attachStatic{qxWeb, template.get}
* @param id {String} The id of the HTML template in the DOM.
* @param view {Object} The object holding the data to render.
* @param partials {Object} Object holding parts of a template.
* @return {qxWeb} Collection containing a single DOM element with the parsed
* template data.
*/
get : function(id, view, partials){
var el = qx.bom.Template.get(id, view, partials);
return qxWeb.$init([el]);
},
/**
* Original and only template method of mustache.js. For further
* documentation, please visit https://github.com/janl/mustache.js
*
* @attachStatic{qxWeb, template.render}
* @param template {String} The String containing the template.
* @param view {Object} The object holding the data to render.
* @param partials {Object} Object holding parts of a template.
* @return {String} The parsed template.
*/
render : function(template, view, partials){
return qx.bom.Template.render(template, view, partials);
}
},
defer : function(statics){
qxWeb.$attachStatic({
"template" : {
get : statics.get,
render : statics.render
}
});
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2004-2012 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Martin Wittemann (martinwittemann)
======================================================================
This class contains code based on the following work:
* Mustache.js version 0.7.0
Code:
https://github.com/janl/mustache.js
Copyright:
(c) 2009 Chris Wanstrath (Ruby)
(c) 2010 Jan Lehnardt (JavaScript)
License:
MIT: http://www.opensource.org/licenses/mit-license.php
----------------------------------------------------------------------
Copyright (c) 2009 Chris Wanstrath (Ruby)
Copyright (c) 2010 Jan Lehnardt (JavaScript)
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
************************************************************************ */
/* ************************************************************************
#ignore(module)
************************************************************************ */
/**
* The is a template class which can be used for HTML templating. In fact,
* this is a wrapper for mustache.js which is a "framework-agnostic way to
* render logic-free views".
*
* Here is a basic example how to use it:
* Template:
* <pre class="javascript">
* var template = "Hi, my name is {{name}}!";
* var view = {name: "qooxdoo"};
* qx.bom.Template.render(template, view);
* // return "Hi, my name is qooxdoo!"
* </pre>
*
* For further details, please visit the mustache.js documentation here:
* https://github.com/janl/mustache.js/blob/master/README.md
*
*/
qx.Bootstrap.define("qx.bom.Template", {
statics : {
/** Contains the mustache.js version. */
version : null,
/**
* Original and only template method of mustache.js. For further
* documentation, please visit https://github.com/janl/mustache.js
*
* @signature function(template, view, partials)
* @param template {String} The String containing the template.
* @param view {Object} The object holding the data to render.
* @param partials {Object} Object holding parts of a template.
* @return {String} The parsed template.
*/
render : null,
/**
* Helper method which provides you with a direct access to templates
* stored as HTML in the DOM. The DOM node with the given ID will be used
* as a template, parsed and a new DOM node will be returned containing the
* parsed data. Keep in mind to have only one root DOM element in the the
* template.
* Additionally, you should not put the template into a regular, hidden
* DOM element because the template may not be valid HTML due to the containing
* mustache tags. We suggest to put it into a script tag with the type
* <code>text/template</code>.
*
* @param id {String} The id of the HTML template in the DOM.
* @param view {Object} The object holding the data to render.
* @param partials {Object} Object holding parts of a template.
* @return {Element} A DOM element holding the parsed template data.
*/
get : function(id, view, partials){
// get the content stored in the DOM
var template = document.getElementById(id);
var inner = template.innerHTML;
// apply the view
inner = this.render(inner, view, partials);
// special case for text only conversion
if(inner.search(/<|>/) === -1){
return document.createTextNode(inner);
};
// create a helper to convert the string into DOM nodes
var helper = qx.dom.Element.create("div");
helper.innerHTML = inner;
return helper.children[0];
}
}
});
(function(){
/**
* Below is the original mustache.js code. Snapshot date is mentioned in
* the head of this file.
* @lint ignoreUndefined(module)
*/
/*!
* mustache.js - Logic-less {{mustache}} templates with JavaScript
* http://github.com/janl/mustache.js
*/
/*global define: false*/
var Mustache;
/**
* @lint ignoreUndefined(module,define)
*/
(function(exports){
Mustache = exports;
}((function(){
var exports = {
};
exports.name = "mustache.js";
exports.version = "0.7.0";
exports.tags = ["{{", "}}"];
exports.Scanner = Scanner;
exports.Context = Context;
exports.Writer = Writer;
var whiteRe = /\s*/;
var spaceRe = /\s+/;
var nonSpaceRe = /\S/;
var eqRe = /\s*=/;
var curlyRe = /\s*\}/;
var tagRe = /#|\^|\/|>|\{|&|=|!/;
// Workaround for https://issues.apache.org/jira/browse/COUCHDB-577
// See https://github.com/janl/mustache.js/issues/189
function testRe(re, string){
return RegExp.prototype.test.call(re, string);
};
function isWhitespace(string){
return !testRe(nonSpaceRe, string);
};
var isArray = Array.isArray || function(obj){
return Object.prototype.toString.call(obj) === "[object Array]";
};
function escapeRe(string){
return string.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&");
};
var entityMap = {
"&" : "&",
"<" : "<",
">" : ">",
'"' : '"',
"'" : ''',
"/" : '/'
};
function escapeHtml(string){
return String(string).replace(/[&<>"'\/]/g, function(s){
return entityMap[s];
});
};
// Export the escaping function so that the user may override it.
// See https://github.com/janl/mustache.js/issues/244
exports.escape = escapeHtml;
function Scanner(string){
this.string = string;
this.tail = string;
this.pos = 0;
};
/**
* Returns `true` if the tail is empty (end of string).
*/
Scanner.prototype.eos = function(){
return this.tail === "";
};
/**
* Tries to match the given regular expression at the current position.
* Returns the matched text if it can match, the empty string otherwise.
*/
Scanner.prototype.scan = function(re){
var match = this.tail.match(re);
if(match && match.index === 0){
this.tail = this.tail.substring(match[0].length);
this.pos += match[0].length;
return match[0];
};
return "";
};
/**
* Skips all text until the given regular expression can be matched. Returns
* the skipped string, which is the entire tail if no match can be made.
*/
Scanner.prototype.scanUntil = function(re){
var match,pos = this.tail.search(re);
switch(pos){case -1:
match = this.tail;
this.pos += this.tail.length;
this.tail = "";
break;case 0:
match = "";
break;default:
match = this.tail.substring(0, pos);
this.tail = this.tail.substring(pos);
this.pos += pos;};
return match;
};
function Context(view, parent){
this.view = view;
this.parent = parent;
this.clearCache();
};
Context.make = function(view){
return (view instanceof Context) ? view : new Context(view);
};
Context.prototype.clearCache = function(){
this._cache = {
};
};
Context.prototype.push = function(view){
return new Context(view, this);
};
Context.prototype.lookup = function(name){
var value = this._cache[name];
if(!value){
if(name === "."){
value = this.view;
} else {
var context = this;
while(context){
if(name.indexOf(".") > 0){
var names = name.split("."),i = 0;
value = context.view;
while(value && i < names.length){
value = value[names[i++]];
};
} else {
value = context.view[name];
};
if(value != null){
break;
};
context = context.parent;
};
};
this._cache[name] = value;
};
if(typeof value === "function"){
value = value.call(this.view);
};
return value;
};
function Writer(){
this.clearCache();
};
Writer.prototype.clearCache = function(){
this._cache = {
};
this._partialCache = {
};
};
Writer.prototype.compile = function(template, tags){
var fn = this._cache[template];
if(!fn){
var tokens = exports.parse(template, tags);
fn = this._cache[template] = this.compileTokens(tokens, template);
};
return fn;
};
Writer.prototype.compilePartial = function(name, template, tags){
var fn = this.compile(template, tags);
this._partialCache[name] = fn;
return fn;
};
Writer.prototype.compileTokens = function(tokens, template){
var fn = compileTokens(tokens);
var self = this;
return function(view, partials){
if(partials){
if(typeof partials === "function"){
self._loadPartial = partials;
} else {
for(var name in partials){
self.compilePartial(name, partials[name]);
};
};
};
return fn(self, Context.make(view), template);
};
};
Writer.prototype.render = function(template, view, partials){
return this.compile(template)(view, partials);
};
Writer.prototype._section = function(name, context, text, callback){
var value = context.lookup(name);
switch(typeof value){case "object":
if(isArray(value)){
var buffer = "";
for(var i = 0,len = value.length;i < len;++i){
buffer += callback(this, context.push(value[i]));
};
return buffer;
};
return value ? callback(this, context.push(value)) : "";case "function":
var self = this;
var scopedRender = function(template){
return self.render(template, context);
};
return value.call(context.view, text, scopedRender) || "";default:
if(value){
return callback(this, context);
};};
return "";
};
Writer.prototype._inverted = function(name, context, callback){
var value = context.lookup(name);
// Use JavaScript's definition of falsy. Include empty arrays.
// See https://github.com/janl/mustache.js/issues/186
if(!value || (isArray(value) && value.length === 0)){
return callback(this, context);
};
return "";
};
Writer.prototype._partial = function(name, context){
if(!(name in this._partialCache) && this._loadPartial){
this.compilePartial(name, this._loadPartial(name));
};
var fn = this._partialCache[name];
return fn ? fn(context) : "";
};
Writer.prototype._name = function(name, context){
var value = context.lookup(name);
if(typeof value === "function"){
value = value.call(context.view);
};
return (value == null) ? "" : String(value);
};
Writer.prototype._escaped = function(name, context){
return exports.escape(this._name(name, context));
};
/**
* Calculates the bounds of the section represented by the given `token` in
* the original template by drilling down into nested sections to find the
* last token that is part of that section. Returns an array of [start, end].
*/
function sectionBounds(token){
var start = token[3];
var end = start;
var tokens;
while((tokens = token[4]) && tokens.length){
token = tokens[tokens.length - 1];
end = token[3];
};
return [start, end];
};
/**
* Low-level function that compiles the given `tokens` into a function
* that accepts three arguments: a Writer, a Context, and the template.
*/
function compileTokens(tokens){
var subRenders = {
};
function subRender(i, tokens, template){
if(!subRenders[i]){
var fn = compileTokens(tokens);
subRenders[i] = function(writer, context){
return fn(writer, context, template);
};
};
return subRenders[i];
};
return function(writer, context, template){
var buffer = "";
var token,sectionText;
for(var i = 0,len = tokens.length;i < len;++i){
token = tokens[i];
switch(token[0]){case "#":
sectionText = template.slice.apply(template, sectionBounds(token));
buffer += writer._section(token[1], context, sectionText, subRender(i, token[4], template));
break;case "^":
buffer += writer._inverted(token[1], context, subRender(i, token[4], template));
break;case ">":
buffer += writer._partial(token[1], context);
break;case "&":
buffer += writer._name(token[1], context);
break;case "name":
buffer += writer._escaped(token[1], context);
break;case "text":
buffer += token[1];
break;};
};
return buffer;
};
};
/**
* Forms the given array of `tokens` into a nested tree structure where
* tokens that represent a section have a fifth item: an array that contains
* all tokens in that section.
*/
function nestTokens(tokens){
var tree = [];
var collector = tree;
var sections = [];
var token,section;
for(var i = 0;i < tokens.length;++i){
token = tokens[i];
switch(token[0]){case "#":case "^":
token[4] = [];
sections.push(token);
collector.push(token);
collector = token[4];
break;case "/":
if(sections.length === 0){
throw new Error("Unopened section: " + token[1]);
};
section = sections.pop();
if(section[1] !== token[1]){
throw new Error("Unclosed section: " + section[1]);
};
if(sections.length > 0){
collector = sections[sections.length - 1][4];
} else {
collector = tree;
};
break;default:
collector.push(token);};
};
// Make sure there were no open sections when we're done.
section = sections.pop();
if(section){
throw new Error("Unclosed section: " + section[1]);
};
return tree;
};
/**
* Combines the values of consecutive text tokens in the given `tokens` array
* to a single token.
*/
function squashTokens(tokens){
var token,lastToken;
for(var i = 0;i < tokens.length;++i){
token = tokens[i];
if(lastToken && lastToken[0] === "text" && token[0] === "text"){
lastToken[1] += token[1];
lastToken[3] = token[3];
tokens.splice(i--, 1);
} else {
lastToken = token;
};
};
};
function escapeTags(tags){
if(tags.length !== 2){
throw new Error("Invalid tags: " + tags.join(" "));
};
return [new RegExp(escapeRe(tags[0]) + "\\s*"), new RegExp("\\s*" + escapeRe(tags[1]))];
};
/**
* Breaks up the given `template` string into a tree of token objects. If
* `tags` is given here it must be an array with two string values: the
* opening and closing tags used in the template (e.g. ["<%", "%>"]). Of
* course, the default is to use mustaches (i.e. Mustache.tags).
*/
exports.parse = function(template, tags){
tags = tags || exports.tags;
var tagRes = escapeTags(tags);
var scanner = new Scanner(template);
var tokens = [],// Buffer to hold the tokens
spaces = [],// Indices of whitespace tokens on the current line
hasTag = false,// Is there a {{tag}} on the current line?
nonSpace = false;
// Is there a non-space char on the current line?
// Strips all whitespace tokens array for the current line
// if there was a {{#tag}} on it and otherwise only space.
function stripSpace(){
if(hasTag && !nonSpace){
while(spaces.length){
tokens.splice(spaces.pop(), 1);
};
} else {
spaces = [];
};
hasTag = false;
nonSpace = false;
};
var start,type,value,chr;
while(!scanner.eos()){
start = scanner.pos;
value = scanner.scanUntil(tagRes[0]);
if(value){
for(var i = 0,len = value.length;i < len;++i){
chr = value.charAt(i);
if(isWhitespace(chr)){
spaces.push(tokens.length);
} else {
nonSpace = true;
};
tokens.push(["text", chr, start, start + 1]);
start += 1;
if(chr === "\n"){
stripSpace();
};
};
};
start = scanner.pos;
// Match the opening tag.
if(!scanner.scan(tagRes[0])){
break;
};
hasTag = true;
type = scanner.scan(tagRe) || "name";
// Skip any whitespace between tag and value.
scanner.scan(whiteRe);
// Extract the tag value.
if(type === "="){
value = scanner.scanUntil(eqRe);
scanner.scan(eqRe);
scanner.scanUntil(tagRes[1]);
} else if(type === "{"){
var closeRe = new RegExp("\\s*" + escapeRe("}" + tags[1]));
value = scanner.scanUntil(closeRe);
scanner.scan(curlyRe);
scanner.scanUntil(tagRes[1]);
type = "&";
} else {
value = scanner.scanUntil(tagRes[1]);
};
// Match the closing tag.
if(!scanner.scan(tagRes[1])){
throw new Error("Unclosed tag at " + scanner.pos);
};
tokens.push([type, value, start, scanner.pos]);
if(type === "name" || type === "{" || type === "&"){
nonSpace = true;
};
// Set the tags for the next time around.
if(type === "="){
tags = value.split(spaceRe);
tagRes = escapeTags(tags);
};
};
squashTokens(tokens);
return nestTokens(tokens);
};
// The high-level clearCache, compile, compilePartial, and render functions
// use this default writer.
var _writer = new Writer();
/**
* Clears all cached templates and partials in the default writer.
*/
exports.clearCache = function(){
return _writer.clearCache();
};
/**
* Compiles the given `template` to a reusable function using the default
* writer.
*/
exports.compile = function(template, tags){
return _writer.compile(template, tags);
};
/**
* Compiles the partial with the given `name` and `template` to a reusable
* function using the default writer.
*/
exports.compilePartial = function(name, template, tags){
return _writer.compilePartial(name, template, tags);
};
/**
* Compiles the given array of tokens (the output of a parse) to a reusable
* function using the default writer.
*/
exports.compileTokens = function(tokens, template){
return _writer.compileTokens(tokens, template);
};
/**
* Renders the `template` with the given `view` and `partials` using the
* default writer.
*/
exports.render = function(template, view, partials){
return _writer.render(template, view, partials);
};
// This is here for backwards compatibility with 0.4.x.
exports.to_html = function(template, view, partials, send){
var result = exports.render(template, view, partials);
if(typeof send === "function"){
send(result);
} else {
return result;
};
};
return exports;
}())));
/**
* Above is the original mustache code.
*/
// EXPOSE qooxdoo variant
qx.bom.Template.version = Mustache.version;
qx.bom.Template.render = Mustache.render;
})();
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2012 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Daniel Wagner (danielwagner)
************************************************************************ */
/* ************************************************************************
#require(qx.module.Event)
************************************************************************ */
/**
* Orientation handler which is responsible for registering and unregistering a
* {@link qx.event.handler.OrientationCore} handler for each given element.
*/
qx.Bootstrap.define("qx.module.event.OrientationHandler", {
statics : {
/**
* List of events that require an orientation handler
* @type {Array}
*/
TYPES : ["orientationchange"],
/**
* Creates an orientation handler for the given window when an
* orientationchange event listener is attached to it
*
* @param element {Window} DOM Window
*/
register : function(element){
if(!qx.dom.Node.isWindow(element)){
throw new Error("The 'orientationchange' event is only available on window objects!");
};
if(!element.__orientationHandler){
if(!element.__emitter){
element.__emitter = new qx.event.Emitter();
};
element.__orientationHandler = new qx.event.handler.OrientationCore(element, element.__emitter);
};
},
/**
* Removes the orientation event handler from the element if there are no more
* orientationchange event listeners attached to it
* @param element {Element} DOM element
*/
unregister : function(element){
if(element.__orientationHandler){
if(!element.__emitter){
element.__orientationHandler = null;
} else {
var hasListener = false;
var listeners = element.__emitter.getListeners();
qx.module.event.OrientationHandler.TYPES.forEach(function(type){
if(type in listeners && listeners[type].length > 0){
hasListener = true;
};
});
if(!hasListener){
element.__orientationHandler = null;
};
};
};
}
},
defer : function(statics){
qxWeb.$registerEventHook(statics.TYPES, statics.register, statics.unregister);
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2004-2012 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Tino Butz (tbtz)
* Daniel Wagner (danielwagner)
======================================================================
This class contains code based on the following work:
* Unify Project
Homepage:
http://unify-project.org
Copyright:
2009-2010 Deutsche Telekom AG, Germany, http://telekom.com
License:
MIT: http://www.opensource.org/licenses/mit-license.php
************************************************************************ */
/**
* Listens for native orientation change events
*/
qx.Bootstrap.define("qx.event.handler.OrientationCore", {
extend : Object,
/**
*
* @param targetWindow {Window} DOM window object
* @param emitter {qx.event.Emitter} Event emitter object
*/
construct : function(targetWindow, emitter){
this._window = targetWindow || window;
this.__emitter = emitter;
this._initObserver();
},
members : {
__emitter : null,
_window : null,
_currentOrientation : null,
__onNativeWrapper : null,
__nativeEventType : null,
/*
---------------------------------------------------------------------------
OBSERVER INIT
---------------------------------------------------------------------------
*/
/**
* Initializes the native orientation change event listeners.
*/
_initObserver : function(){
this.__onNativeWrapper = qx.lang.Function.listener(this._onNative, this);
// Handle orientation change event for Android devices by the resize event.
// See http://stackoverflow.com/questions/1649086/detect-rotation-of-android-phone-in-the-browser-with-javascript
// for more information.
this.__nativeEventType = qx.bom.Event.supportsEvent(this._window, "orientationchange") ? "orientationchange" : "resize";
qx.bom.Event.addNativeListener(this._window, this.__nativeEventType, this.__onNativeWrapper);
},
/*
---------------------------------------------------------------------------
OBSERVER STOP
---------------------------------------------------------------------------
*/
/**
* Disconnects the native orientation change event listeners.
*/
_stopObserver : function(){
qx.bom.Event.removeNativeListener(this._window, this.__nativeEventType, this.__onNativeWrapper);
},
/*
---------------------------------------------------------------------------
NATIVE EVENT OBSERVERS
---------------------------------------------------------------------------
*/
/**
* Handler for the native orientation change event.
*
* @signature function(domEvent)
* @param domEvent {Event} The touch event from the browser.
*/
_onNative : function(domEvent){
var orientation = qx.bom.Viewport.getOrientation();
if(this._currentOrientation != orientation){
this._currentOrientation = orientation;
var mode = qx.bom.Viewport.isLandscape() ? "landscape" : "portrait";
domEvent._orientation = orientation;
domEvent._mode = mode;
if(this.__emitter){
this.__emitter.emit("orientationchange", domEvent);
};
};
}
},
/*
*****************************************************************************
DESTRUCTOR
*****************************************************************************
*/
destruct : function(){
this._stopObserver();
this.__manager = this.__emitter = null;
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2004-2011 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Tristan Koch (tristankoch)
************************************************************************ */
/* ************************************************************************
#ignore(XDomainRequest)
#require(qx.bom.request.Xhr#open)
#require(qx.bom.request.Xhr#send)
#require(qx.bom.request.Xhr#on)
#require(qx.bom.request.Xhr#onreadystatechange)
#require(qx.bom.request.Xhr#onload)
#require(qx.bom.request.Xhr#onloadend)
#require(qx.bom.request.Xhr#onerror)
#require(qx.bom.request.Xhr#onabort)
#require(qx.bom.request.Xhr#ontimeout)
#require(qx.bom.request.Xhr#setRequestHeader)
#require(qx.bom.request.Xhr#getAllResponseHeaders)
#require(qx.bom.request.Xhr#getRequest)
************************************************************************ */
/**
* A wrapper of the XMLHttpRequest host object (or equivalent). The interface is
* similar to <a href="http://www.w3.org/TR/XMLHttpRequest/">XmlHttpRequest</a>.
*
* Hides browser inconsistencies and works around bugs found in popular
* implementations.
*
* <div class="desktop">
* Example:
*
* <pre class="javascript">
* var req = new qx.bom.request.Xhr();
* req.onload = function() {
* // Handle data received
* req.responseText;
* }
*
* req.open("GET", url);
* req.send();
* </pre>
* </div>
*/
qx.Bootstrap.define("qx.bom.request.Xhr", {
construct : function(){
this.__onNativeReadyStateChangeBound = qx.Bootstrap.bind(this.__onNativeReadyStateChange, this);
this.__onNativeAbortBound = qx.Bootstrap.bind(this.__onNativeAbort, this);
this.__onTimeoutBound = qx.Bootstrap.bind(this.__onTimeout, this);
this.__initNativeXhr();
this._emitter = new qx.event.Emitter();
// BUGFIX: IE
// IE keeps connections alive unless aborted on unload
if(window.attachEvent){
this.__onUnloadBound = qx.Bootstrap.bind(this.__onUnload, this);
window.attachEvent("onunload", this.__onUnloadBound);
};
},
statics : {
UNSENT : 0,
OPENED : 1,
HEADERS_RECEIVED : 2,
LOADING : 3,
DONE : 4
},
events : {
/** Fired at ready state changes. */
"readystatechange" : "qx.bom.request.Xhr",
/** Fired on error. */
"error" : "qx.bom.request.Xhr",
/** Fired at loadend. */
"loadend" : "qx.bom.request.Xhr",
/** Fired on timeouts. */
"timeout" : "qx.bom.request.Xhr",
/** Fired when the request is aborted. */
"abort" : "qx.bom.request.Xhr",
/** Fired on successful retrieval. */
"load" : "qx.bom.request.Xhr"
},
members : {
/*
---------------------------------------------------------------------------
PUBLIC
---------------------------------------------------------------------------
*/
/**
* {Number} Ready state.
*
* States can be:
* UNSENT: 0,
* OPENED: 1,
* HEADERS_RECEIVED: 2,
* LOADING: 3,
* DONE: 4
*/
readyState : 0,
/**
* {String} The response of the request as text.
*/
responseText : "",
/**
* {Object} The response of the request as a Document object.
*/
responseXML : null,
/**
* {Number} The HTTP status code.
*/
status : 0,
/**
* {String} The HTTP status text.
*/
statusText : "",
/**
* {Number} Timeout limit in milliseconds.
*
* 0 (default) means no timeout. Not supported for synchronous requests.
*/
timeout : 0,
/**
* Initializes (prepares) request.
*
* @lint ignoreUndefined(XDomainRequest)
*
* @param method {String?"GET"}
* The HTTP method to use.
* @param url {String}
* The URL to which to send the request.
* @param async {Boolean?true}
* Whether or not to perform the operation asynchronously.
* @param user {String?null}
* Optional user name to use for authentication purposes.
* @param password {String?null}
* Optional password to use for authentication purposes.
*/
open : function(method, url, async, user, password){
this.__checkDisposed();
// Mimick native behavior
if(typeof url === "undefined"){
throw new Error("Not enough arguments");
} else if(typeof method === "undefined"){
method = "GET";
};
// Reset flags that may have been set on previous request
this.__abort = false;
this.__send = false;
this.__conditional = false;
// Store URL for later checks
this.__url = url;
if(typeof async == "undefined"){
async = true;
};
this.__async = async;
// BUGFIX
// IE < 9 and FF < 3.5 cannot reuse the native XHR to issue many requests
if(!this.__supportsManyRequests() && this.readyState > qx.bom.request.Xhr.UNSENT){
// XmlHttpRequest Level 1 requires open() to abort any pending requests
// associated to the object. Since we're dealing with a new object here,
// we have to emulate this behavior. Moreover, allow old native XHR to be garbage collected
//
// Dispose and abort.
//
this.dispose();
// Replace the underlying native XHR with a new one that can
// be used to issue new requests.
this.__initNativeXhr();
};
// Restore handler in case it was removed before
this.__nativeXhr.onreadystatechange = this.__onNativeReadyStateChangeBound;
try{
if(qx.core.Environment.get("qx.debug.io")){
qx.Bootstrap.debug(qx.bom.request.Xhr, "Open native request with method: " + method + ", url: " + url + ", async: " + async);
};
this.__nativeXhr.open(method, url, async, user, password);
} catch(OpenError) {
// Only work around exceptions caused by cross domain request attempts
if(!qx.util.Request.isCrossDomain(url)){
// Is same origin
throw OpenError;
};
if(!this.__async){
this.__openError = OpenError;
};
if(this.__async){
// Try again with XDomainRequest
// (Success case not handled on purpose)
// - IE 9
if(window.XDomainRequest){
this.readyState = 4;
this.__nativeXhr = new XDomainRequest();
this.__nativeXhr.onerror = qx.Bootstrap.bind(function(){
this._emit("readystatechange");
this._emit("error");
this._emit("loadend");
}, this);
if(qx.core.Environment.get("qx.debug.io")){
qx.Bootstrap.debug(qx.bom.request.Xhr, "Retry open native request with method: " + method + ", url: " + url + ", async: " + async);
};
this.__nativeXhr.open(method, url, async, user, password);
return;
};
// Access denied
// - IE 6: -2146828218
// - IE 7: -2147024891
// - Legacy Firefox
window.setTimeout(qx.Bootstrap.bind(function(){
if(this.__disposed){
return;
};
this.readyState = 4;
this._emit("readystatechange");
this._emit("error");
this._emit("loadend");
}, this));
};
};
// BUGFIX: IE < 9
// IE < 9 tends to cache overly agressive. This may result in stale
// representations. Force validating freshness of cached representation.
if(qx.core.Environment.get("engine.name") === "mshtml" && qx.core.Environment.get("browser.documentmode") < 9 && this.__nativeXhr.readyState > 0){
this.__nativeXhr.setRequestHeader("If-Modified-Since", "-1");
};
// BUGFIX: Firefox
// Firefox < 4 fails to trigger onreadystatechange OPENED for sync requests
if(qx.core.Environment.get("engine.name") === "gecko" && parseInt(qx.core.Environment.get("engine.version"), 10) < 2 && !this.__async){
// Native XHR is already set to readyState DONE. Fake readyState
// and call onreadystatechange manually.
this.readyState = qx.bom.request.Xhr.OPENED;
this._emit("readystatechange");
};
},
/**
* Sets an HTTP request header to be used by the request.
*
* Note: The request must be initialized before using this method.
*
* @param key {String}
* The name of the header whose value is to be set.
* @param value {String}
* The value to set as the body of the header.
* @return {qx.bom.request.Xhr} Self for chaining.
*/
setRequestHeader : function(key, value){
this.__checkDisposed();
// Detect conditional requests
if(key == "If-Match" || key == "If-Modified-Since" || key == "If-None-Match" || key == "If-Range"){
this.__conditional = true;
};
this.__nativeXhr.setRequestHeader(key, value);
return this;
},
/**
* Sends request.
*
* @param data {String|Document?null}
* Optional data to send.
* @return {qx.bom.request.Xhr} Self for chaining.
*/
send : function(data){
this.__checkDisposed();
// BUGFIX: IE & Firefox < 3.5
// For sync requests, some browsers throw error on open()
// while it should be on send()
//
if(!this.__async && this.__openError){
throw this.__openError;
};
// BUGFIX: Opera
// On network error, Opera stalls at readyState HEADERS_RECEIVED
// This violates the spec. See here http://www.w3.org/TR/XMLHttpRequest2/#send
// (Section: If there is a network error)
//
// To fix, assume a default timeout of 10 seconds. Note: The "error"
// event will be fired correctly, because the error flag is inferred
// from the statusText property. Of course, compared to other
// browsers there is an additional call to ontimeout(), but this call
// should not harm.
//
if(qx.core.Environment.get("engine.name") === "opera" && this.timeout === 0){
this.timeout = 10000;
};
// Timeout
if(this.timeout > 0){
this.__timerId = window.setTimeout(this.__onTimeoutBound, this.timeout);
};
// BUGFIX: Firefox 2
// "NS_ERROR_XPC_NOT_ENOUGH_ARGS" when calling send() without arguments
data = typeof data == "undefined" ? null : data;
// Some browsers may throw an error when sending of async request fails.
// This violates the spec which states only sync requests should.
try{
if(qx.core.Environment.get("qx.debug.io")){
qx.Bootstrap.debug(qx.bom.request.Xhr, "Send native request");
};
this.__nativeXhr.send(data);
} catch(SendError) {
if(!this.__async){
throw SendError;
};
// BUGFIX
// Some browsers throws error when file not found via file:// protocol.
// Synthesize readyState changes.
if(this._getProtocol() === "file:"){
this.readyState = 2;
this.__readyStateChange();
var that = this;
window.setTimeout(function(){
if(that.__disposed){
return;
};
that.readyState = 3;
that.__readyStateChange();
that.readyState = 4;
that.__readyStateChange();
});
};
};
// BUGFIX: Firefox
// Firefox fails to trigger onreadystatechange DONE for sync requests
if(qx.core.Environment.get("engine.name") === "gecko" && !this.__async){
// Properties all set, only missing native readystatechange event
this.__onNativeReadyStateChange();
};
// Set send flag
this.__send = true;
return this;
},
/**
* Abort request.
*
* Cancels any network activity.
* @return {qx.bom.request.Xhr} Self for chaining.
*/
abort : function(){
this.__checkDisposed();
this.__abort = true;
this.__nativeXhr.abort();
if(this.__nativeXhr){
this.readyState = this.__nativeXhr.readyState;
};
return this;
},
/**
* Helper to emit events and call the callback methods.
* @param event {String} The name of the event.
*/
_emit : function(event){
this["on" + event]();
this._emitter.emit(event, this);
},
/**
* Event handler for XHR event that fires at every state change.
*
* Replace with custom method to get informed about the communication progress.
*/
onreadystatechange : function(){
},
/**
* Event handler for XHR event "load" that is fired on successful retrieval.
*
* Note: This handler is called even when the HTTP status indicates an error.
*
* Replace with custom method to listen to the "load" event.
*/
onload : function(){
},
/**
* Event handler for XHR event "loadend" that is fired on retrieval.
*
* Note: This handler is called even when a network error (or similar)
* occurred.
*
* Replace with custom method to listen to the "loadend" event.
*/
onloadend : function(){
},
/**
* Event handler for XHR event "error" that is fired on a network error.
*
* Replace with custom method to listen to the "error" event.
*/
onerror : function(){
},
/**
* Event handler for XHR event "abort" that is fired when request
* is aborted.
*
* Replace with custom method to listen to the "abort" event.
*/
onabort : function(){
},
/**
* Event handler for XHR event "timeout" that is fired when timeout
* interval has passed.
*
* Replace with custom method to listen to the "timeout" event.
*/
ontimeout : function(){
},
/**
* Add an event listener for the given event name.
*
* @param name {String} The name of the event to listen to.
* @param listener {Function} The function to execute when the event is fired
* @param ctx {var?} The context of the listener.
* @return {qx.bom.request.Xhr} Self for chaining.
*/
on : function(name, listener, ctx){
this._emitter.on(name, listener, ctx);
return this;
},
/**
* Get a single response header from response.
*
* @param header {String}
* Key of the header to get the value from.
* @return {String}
* Response header.
*/
getResponseHeader : function(header){
this.__checkDisposed();
return this.__nativeXhr.getResponseHeader(header);
},
/**
* Get all response headers from response.
*
* @return {String} All response headers.
*/
getAllResponseHeaders : function(){
this.__checkDisposed();
return this.__nativeXhr.getAllResponseHeaders();
},
/**
* Get wrapped native XMLHttpRequest (or equivalent).
*
* Can be XMLHttpRequest or ActiveX.
*
* @return {Object} XMLHttpRequest or equivalent.
*/
getRequest : function(){
return this.__nativeXhr;
},
/*
---------------------------------------------------------------------------
HELPER
---------------------------------------------------------------------------
*/
/**
* Dispose object and wrapped native XHR.
* @return {Boolean} <code>true</code> if the object was successfully disposed
*/
dispose : function(){
if(this.__disposed){
return false;
};
window.clearTimeout(this.__timerId);
// Remove unload listener in IE. Aborting on unload is no longer required
// for this instance.
if(window.detachEvent){
window.detachEvent("onunload", this.__onUnloadBound);
};
// May fail in IE
try{
this.__nativeXhr.onreadystatechange;
} catch(PropertiesNotAccessable) {
return false;
};
// Clear out listeners
var noop = function(){
};
this.__nativeXhr.onreadystatechange = noop;
this.__nativeXhr.onload = noop;
this.__nativeXhr.onerror = noop;
// Abort any network activity
this.abort();
// Remove reference to native XHR
this.__nativeXhr = null;
this.__disposed = true;
return true;
},
/*
---------------------------------------------------------------------------
PROTECTED
---------------------------------------------------------------------------
*/
/**
* Create XMLHttpRequest (or equivalent).
*
* @return {Object} XMLHttpRequest or equivalent.
*/
_createNativeXhr : function(){
var xhr = qx.core.Environment.get("io.xhr");
if(xhr === "xhr"){
return new XMLHttpRequest();
};
if(xhr == "activex"){
return new window.ActiveXObject("Microsoft.XMLHTTP");
};
qx.Bootstrap.error(this, "No XHR support available.");
},
/**
* Get protocol of requested URL.
*
* @return {String} The used protocol.
*/
_getProtocol : function(){
var url = this.__url;
var protocolRe = /^(\w+:)\/\//;
// Could be http:// from file://
if(url !== null && url.match){
var match = url.match(protocolRe);
if(match && match[1]){
return match[1];
};
};
return window.location.protocol;
},
/*
---------------------------------------------------------------------------
PRIVATE
---------------------------------------------------------------------------
*/
/**
* {Object} XMLHttpRequest or equivalent.
*/
__nativeXhr : null,
/**
* {Boolean} Whether request is async.
*/
__async : null,
/**
* {Function} Bound __onNativeReadyStateChange handler.
*/
__onNativeReadyStateChangeBound : null,
/**
* {Function} Bound __onNativeAbort handler.
*/
__onNativeAbortBound : null,
/**
* {Function} Bound __onUnload handler.
*/
__onUnloadBound : null,
/**
* {Function} Bound __onTimeout handler.
*/
__onTimeoutBound : null,
/**
* {Boolean} Send flag
*/
__send : null,
/**
* {String} Requested URL
*/
__url : null,
/**
* {Boolean} Abort flag
*/
__abort : null,
/**
* {Boolean} Timeout flag
*/
__timeout : null,
/**
* {Boolean} Whether object has been disposed.
*/
__disposed : null,
/**
* {Number} ID of timeout timer.
*/
__timerId : null,
/**
* {Error} Error thrown on open, if any.
*/
__openError : null,
/**
* {Boolean} Conditional get flag
*/
__conditional : null,
/**
* Init native XHR.
*/
__initNativeXhr : function(){
// Create native XHR or equivalent and hold reference
this.__nativeXhr = this._createNativeXhr();
// Track native ready state changes
this.__nativeXhr.onreadystatechange = this.__onNativeReadyStateChangeBound;
// Track native abort, when supported
if(this.__nativeXhr.onabort){
this.__nativeXhr.onabort = this.__onNativeAbortBound;
};
// Reset flags
this.__disposed = this.__send = this.__abort = false;
},
/**
* Track native abort.
*
* In case the end user cancels the request by other
* means than calling abort().
*/
__onNativeAbort : function(){
// When the abort that triggered this method was not a result from
// calling abort()
if(!this.__abort){
this.abort();
};
},
/**
* Handle native onreadystatechange.
*
* Calls user-defined function onreadystatechange on each
* state change and syncs the XHR status properties.
*/
__onNativeReadyStateChange : function(){
var nxhr = this.__nativeXhr,propertiesReadable = true;
if(qx.core.Environment.get("qx.debug.io")){
qx.Bootstrap.debug(qx.bom.request.Xhr, "Received native readyState: " + nxhr.readyState);
};
// BUGFIX: IE, Firefox
// onreadystatechange() is called twice for readyState OPENED.
//
// Call onreadystatechange only when readyState has changed.
if(this.readyState == nxhr.readyState){
return;
};
// Sync current readyState
this.readyState = nxhr.readyState;
// BUGFIX: IE
// Superfluous onreadystatechange DONE when aborting OPENED
// without send flag
if(this.readyState === qx.bom.request.Xhr.DONE && this.__abort && !this.__send){
return;
};
// BUGFIX: IE
// IE fires onreadystatechange HEADERS_RECEIVED and LOADING when sync
//
// According to spec, only onreadystatechange OPENED and DONE should
// be fired.
if(!this.__async && (nxhr.readyState == 2 || nxhr.readyState == 3)){
return;
};
// Default values according to spec.
this.status = 0;
this.statusText = this.responseText = "";
this.responseXML = null;
if(this.readyState >= qx.bom.request.Xhr.HEADERS_RECEIVED){
// In some browsers, XHR properties are not readable
// while request is in progress.
try{
this.status = nxhr.status;
this.statusText = nxhr.statusText;
this.responseText = nxhr.responseText;
this.responseXML = nxhr.responseXML;
} catch(XhrPropertiesNotReadable) {
propertiesReadable = false;
};
if(propertiesReadable){
this.__normalizeStatus();
this.__normalizeResponseXML();
};
};
this.__readyStateChange();
// BUGFIX: IE
// Memory leak in XMLHttpRequest (on-page)
if(this.readyState == qx.bom.request.Xhr.DONE){
// Allow garbage collecting of native XHR
if(nxhr){
nxhr.onreadystatechange = function(){
};
};
};
},
/**
* Handle readystatechange. Called internally when readyState is changed.
*/
__readyStateChange : function(){
var that = this;
// Cancel timeout before invoking handlers because they may throw
if(this.readyState === qx.bom.request.Xhr.DONE){
// Request determined DONE. Cancel timeout.
window.clearTimeout(this.__timerId);
};
// BUGFIX: IE
// IE < 8 fires LOADING and DONE on open() - before send() - when from cache
if(qx.core.Environment.get("engine.name") == "mshtml" && qx.core.Environment.get("browser.documentmode") < 8){
// Detect premature events when async. LOADING and DONE is
// illogical to happen before request was sent.
if(this.__async && !this.__send && this.readyState >= qx.bom.request.Xhr.LOADING){
if(this.readyState == qx.bom.request.Xhr.LOADING){
// To early to fire, skip.
return;
};
if(this.readyState == qx.bom.request.Xhr.DONE){
window.setTimeout(function(){
if(that.__disposed){
return;
};
// Replay previously skipped
that.readyState = 3;
that._emit("readystatechange");
that.readyState = 4;
that._emit("readystatechange");
that.__readyStateChangeDone();
});
return;
};
};
};
// Always fire "readystatechange"
this._emit("readystatechange");
if(this.readyState === qx.bom.request.Xhr.DONE){
this.__readyStateChangeDone();
};
},
/**
* Handle readystatechange. Called internally by
* {@link #__readyStateChange} when readyState is DONE.
*/
__readyStateChangeDone : function(){
// Fire "timeout" if timeout flag is set
if(this.__timeout){
this._emit("timeout");
// BUGFIX: Opera
// Since Opera does not fire "error" on network error, fire additional
// "error" on timeout (may well be related to network error)
if(qx.core.Environment.get("engine.name") === "opera"){
this._emit("error");
};
this.__timeout = false;
} else {
if(this.__abort){
this._emit("abort");
} else {
if(this.__isNetworkError()){
this._emit("error");
} else {
this._emit("load");
};
};
};
// Always fire "onloadend" when DONE
this._emit("loadend");
},
/**
* Check for network error.
*
* @return {Boolean} Whether a network error occured.
*/
__isNetworkError : function(){
var error;
// Infer the XHR internal error flag from statusText when not aborted.
// See http://www.w3.org/TR/XMLHttpRequest2/#error-flag and
// http://www.w3.org/TR/XMLHttpRequest2/#the-statustext-attribute
//
// With file://, statusText is always falsy. Assume network error when
// response is empty.
if(this._getProtocol() === "file:"){
error = !this.responseText;
} else {
error = !this.statusText;
};
return error;
},
/**
* Handle faked timeout.
*/
__onTimeout : function(){
// Basically, mimick http://www.w3.org/TR/XMLHttpRequest2/#timeout-error
var nxhr = this.__nativeXhr;
this.readyState = qx.bom.request.Xhr.DONE;
// Set timeout flag
this.__timeout = true;
// No longer consider request. Abort.
nxhr.abort();
this.responseText = "";
this.responseXML = null;
// Signal readystatechange
this.__readyStateChange();
},
/**
* Normalize status property across browsers.
*/
__normalizeStatus : function(){
var isDone = this.readyState === qx.bom.request.Xhr.DONE;
// BUGFIX: Most browsers
// Most browsers tell status 0 when it should be 200 for local files
if(this._getProtocol() === "file:" && this.status === 0 && isDone){
if(!this.__isNetworkError()){
this.status = 200;
};
};
// BUGFIX: IE
// IE sometimes tells 1223 when it should be 204
if(this.status === 1223){
this.status = 204;
};
// BUGFIX: Opera
// Opera tells 0 for conditional requests when it should be 304
//
// Detect response to conditional request that signals fresh cache.
if(qx.core.Environment.get("engine.name") === "opera"){
if(isDone && // Done
this.__conditional && // Conditional request
!this.__abort && // Not aborted
this.status === 0){
this.status = 304;
};
};
},
/**
* Normalize responseXML property across browsers.
*/
__normalizeResponseXML : function(){
// BUGFIX: IE
// IE does not recognize +xml extension, resulting in empty responseXML.
//
// Check if Content-Type is +xml, verify missing responseXML then parse
// responseText as XML.
if(qx.core.Environment.get("engine.name") == "mshtml" && (this.getResponseHeader("Content-Type") || "").match(/[^\/]+\/[^\+]+\+xml/) && this.responseXML && !this.responseXML.documentElement){
var dom = new window.ActiveXObject("Microsoft.XMLDOM");
dom.async = false;
dom.validateOnParse = false;
dom.loadXML(this.responseText);
this.responseXML = dom;
};
},
/**
* Handler for native unload event.
*/
__onUnload : function(){
try{
// Abort and dispose
if(this){
this.dispose();
};
} catch(e) {
};
},
/**
* Helper method to determine whether browser supports reusing the
* same native XHR to send more requests.
* @return {Boolean} <code>true</code> if request object reuse is supported
*/
__supportsManyRequests : function(){
var name = qx.core.Environment.get("engine.name");
var version = qx.core.Environment.get("browser.version");
return !(name == "mshtml" && version < 9 || name == "gecko" && version < 3.5);
},
/**
* Throw when already disposed.
*/
__checkDisposed : function(){
if(this.__disposed){
throw new Error("Already disposed");
};
}
},
defer : function(){
qx.core.Environment.add("qx.debug.io", false);
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2004-2011 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Tristan Koch (tristankoch)
************************************************************************ */
/**
* Static helpers for handling requests.
*/
qx.Bootstrap.define("qx.util.Request", {
statics : {
/**
* Whether URL given points to resource that is cross-domain,
* i.e. not of same origin.
*
* @param url {String} URL.
* @return {Boolean} Whether URL is cross domain.
*/
isCrossDomain : function(url){
var result = qx.util.Uri.parseUri(url),location = window.location;
if(!location){
return false;
};
var protocol = location.protocol;
// URL is relative in the sence that it points to origin host
if(!(url.indexOf("//") !== -1)){
return false;
};
if(protocol.substr(0, protocol.length - 1) == result.protocol && location.host === result.host && location.port === result.port){
return false;
};
return true;
},
/**
* Determine if given HTTP status is considered successful.
*
* @param status {Number} HTTP status.
* @return {Boolean} Whether status is considered successful.
*/
isSuccessful : function(status){
return (status >= 200 && status < 300 || status === 304);
},
/**
* Request body is ignored for HTTP method GET and HEAD.
*
* See http://www.w3.org/TR/XMLHttpRequest2/#the-send-method.
*
* @param method {String} The HTTP method.
* @return {Boolean} Whether request may contain body.
*/
methodAllowsRequestBody : function(method){
return !((/^(GET)|(HEAD)$/).test(method));
}
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2004-2008 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Carsten Lergenmueller (carstenl)
* Fabian Jakobs (fbjakobs)
* Martin Wittemann (martinwittemann)
************************************************************************ */
/**
* Determines browser-dependent information about the transport layer.
*
* This class is used by {@link qx.core.Environment} and should not be used
* directly. Please check its class comment for details how to use it.
*
* @internal
*/
qx.Bootstrap.define("qx.bom.client.Transport", {
/*
*****************************************************************************
STATICS
*****************************************************************************
*/
statics : {
/**
* Returns the maximum number of parallel requests the current browser
* supports per host addressed.
*
* Note that this assumes one connection can support one request at a time
* only. Technically, this is not correct when pipelining is enabled (which
* it currently is only for IE 8 and Opera). In this case, the number
* returned will be too low, as one connection supports multiple pipelined
* requests. This is accepted for now because pipelining cannot be
* detected from JavaScript and because modern browsers have enough
* parallel connections already - it's unlikely an app will require more
* than 4 parallel XMLHttpRequests to one server at a time.
*
* @internal
* @return {Integer} Maximum number of parallel requests
*/
getMaxConcurrentRequestCount : function(){
var maxConcurrentRequestCount;
// Parse version numbers.
var versionParts = qx.bom.client.Engine.getVersion().split(".");
var versionMain = 0;
var versionMajor = 0;
var versionMinor = 0;
// Main number
if(versionParts[0]){
versionMain = versionParts[0];
};
// Major number
if(versionParts[1]){
versionMajor = versionParts[1];
};
// Minor number
if(versionParts[2]){
versionMinor = versionParts[2];
};
// IE 8 gives the max number of connections in a property
// see http://msdn.microsoft.com/en-us/library/cc197013(VS.85).aspx
if(window.maxConnectionsPerServer){
maxConcurrentRequestCount = window.maxConnectionsPerServer;
} else if(qx.bom.client.Engine.getName() == "opera"){
// Opera: 8 total
// see http://operawiki.info/HttpProtocol
maxConcurrentRequestCount = 8;
} else if(qx.bom.client.Engine.getName() == "webkit"){
// Safari: 4
// http://www.stevesouders.com/blog/2008/03/20/roundup-on-parallel-connections/
// Bug #6917: Distinguish Chrome from Safari, Chrome has 6 connections
// according to
// http://stackoverflow.com/questions/561046/how-many-concurrent-ajax-xmlhttprequest-requests-are-allowed-in-popular-browser
maxConcurrentRequestCount = 4;
} else if(qx.bom.client.Engine.getName() == "gecko" && ((versionMain > 1) || ((versionMain == 1) && (versionMajor > 9)) || ((versionMain == 1) && (versionMajor == 9) && (versionMinor >= 1)))){
// FF 3.5 (== Gecko 1.9.1): 6 Connections.
// see http://gemal.dk/blog/2008/03/18/firefox_3_beta_5_will_have_improved_connection_parallelism/
maxConcurrentRequestCount = 6;
} else {
// Default is 2, as demanded by RFC 2616
// see http://blogs.msdn.com/ie/archive/2005/04/11/407189.aspx
maxConcurrentRequestCount = 2;
};;;
return maxConcurrentRequestCount;
},
/**
* Checks whether the app is loaded with SSL enabled which means via https.
*
* @internal
* @return {Boolean} <code>true</code>, if the app runs on https
*/
getSsl : function(){
return window.location.protocol === "https:";
},
/**
* Checks what kind of XMLHttpRequest object the browser supports
* for the current protocol, if any.
*
* The standard XMLHttpRequest is preferred over ActiveX XMLHTTP.
*
* @internal
* @return {String}
* <code>"xhr"</code>, if the browser provides standard XMLHttpRequest.<br/>
* <code>"activex"</code>, if the browser provides ActiveX XMLHTTP.<br/>
* <code>""</code>, if there is not XHR support at all.
*/
getXmlHttpRequest : function(){
// Standard XHR can be disabled in IE's security settings,
// therefore provide ActiveX as fallback. Additionaly,
// standard XHR in IE7 is broken for file protocol.
var supports = window.ActiveXObject ? (function(){
if(window.location.protocol !== "file:"){
try{
new window.XMLHttpRequest();
return "xhr";
} catch(noXhr) {
};
};
try{
new window.ActiveXObject("Microsoft.XMLHTTP");
return "activex";
} catch(noActiveX) {
};
})() : (function(){
try{
new window.XMLHttpRequest();
return "xhr";
} catch(noXhr) {
};
})();
return supports || "";
}
},
defer : function(statics){
qx.core.Environment.add("io.maxrequests", statics.getMaxConcurrentRequestCount);
qx.core.Environment.add("io.ssl", statics.getSsl);
qx.core.Environment.add("io.xhr", statics.getXmlHttpRequest);
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2012 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Martin Wittemann (wittemann)
************************************************************************ */
/* ************************************************************************
#require(qx.bom.request.Xhr#open)
************************************************************************ */
/**
* This module provides basic IO functionality. It contains three ways to load
* data:
*
* * XMLHttpRequest: {@link #xhr}
* * Script tag: {@link #script}
* * Script tag using JSONP: {@link #jsonp}
*/
qx.Bootstrap.define("qx.module.Io", {
statics : {
/**
* Returns a configured XMLHttpRequest object. Using the send method will
* finally send the request.
*
* @param url {String} Mandatory URL to load the data from.
* @param settings {Map?} Optional settings map which may contain one of
* the following settings:
* <ul>
* <li><code>method</code> The method of the request. Default: <code>GET</code></li>
* <li><code>async</code> flag to mark the request as asynchronous. Default: <code>true</code></li>
* <li><code>header</code> A map of request headers.</li>
* </ul>
*
* @attachStatic {qxWeb, io.xhr}
* @return {qx.bom.request.Xhr} The request object.
*/
xhr : function(url, settings){
if(!settings){
settings = {
};
};
var xhr = new qx.bom.request.Xhr();
xhr.open(settings.method, url, settings.async);
if(settings.header){
var header = settings.header;
for(var key in header){
xhr.setRequestHeader(key, header[key]);
};
};
return xhr;
},
/**
* Returns a predefined script tag wrapper which can be used to load data
* from cross-domain origins.
*
* @param url {String} Mandatory URL to load the data from.
* @attachStatic {qxWeb, io.script}
* @return {qx.bom.request.Script} The request object.
*/
script : function(url){
var script = new qx.bom.request.Script();
script.open("get", url);
return script;
},
/**
* Returns a predefined script tag wrapper which can be used to load data
* from cross-domain origins via JSONP.
*
* @param url {String} Mandatory URL to load the data from.
* @param settings {Map?} Optional settings map which may contain one of
* the following settings:
*
* * <code>callbackName</code>: The name of the callback which will
* be called by the loaded script.
* * <code>callbackParam</code>: The name of the callback expected by the server
* @attachStatic {qxWeb, io.jsonp}
* @return {qx.bom.request.Jsonp} The request object.
*/
jsonp : function(url, settings){
var script = new qx.bom.request.Jsonp();
if(settings && settings.callbackName){
script.setCallbackName(settings.callbackName);
};
if(settings && settings.callbackParam){
script.setCallbackParam(settings.callbackParam);
};
script.setPrefix("qxWeb.$$");
// needed in case no callback name is given
script.open("get", url);
return script;
}
},
defer : function(statics){
qxWeb.$attachStatic({
io : {
xhr : statics.xhr,
script : statics.script,
jsonp : statics.jsonp
}
});
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2004-2011 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Tristan Koch (tristankoch)
************************************************************************ */
/**
* Script loader with interface similar to
* <a href="http://www.w3.org/TR/XMLHttpRequest/">XmlHttpRequest</a>.
*
* The script loader can be used to load scripts from arbitrary sources.
* <span class="desktop">
* For JSONP requests, consider the {@link qx.bom.request.Jsonp} transport
* that derives from the script loader.
* </span>
*
* <div class="desktop">
* Example:
*
* <pre class="javascript">
* var req = new qx.bom.request.Script();
* req.onload = function() {
* // Script is loaded and parsed and
* // globals set are available
* }
*
* req.open("GET", url);
* req.send();
* </pre>
* </div>
*/
/* ************************************************************************
#ignore(qx.core.Environment)
#require(qx.bom.request.Script#_success)
#require(qx.bom.request.Script#abort)
#require(qx.bom.request.Script#dispose)
#require(qx.bom.request.Script#getAllResponseHeaders)
#require(qx.bom.request.Script#getResponseHeader)
#require(qx.bom.request.Script#setDetermineSuccess)
#require(qx.bom.request.Script#setRequestHeader)
************************************************************************ */
qx.Bootstrap.define("qx.bom.request.Script", {
construct : function(){
this.__initXhrProperties();
this.__onNativeLoadBound = qx.Bootstrap.bind(this._onNativeLoad, this);
this.__onNativeErrorBound = qx.Bootstrap.bind(this._onNativeError, this);
this.__onTimeoutBound = qx.Bootstrap.bind(this._onTimeout, this);
this.__headElement = document.head || document.getElementsByTagName("head")[0] || document.documentElement;
this._emitter = new qx.event.Emitter();
// BUGFIX: Browsers not supporting error handler
// Set default timeout to capture network errors
//
// Note: The script is parsed and executed, before a "load" is fired.
this.timeout = this.__supportsErrorHandler() ? 0 : 15000;
},
events : {
/** Fired at ready state changes. */
"readystatechange" : "qx.bom.request.Script",
/** Fired on error. */
"error" : "qx.bom.request.Script",
/** Fired at loadend. */
"loadend" : "qx.bom.request.Script",
/** Fired on timeouts. */
"timeout" : "qx.bom.request.Script",
/** Fired when the request is aborted. */
"abort" : "qx.bom.request.Script",
/** Fired on successful retrieval. */
"load" : "qx.bom.request.Script"
},
members : {
/**
* {Number} Ready state.
*
* States can be:
* UNSENT: 0,
* OPENED: 1,
* LOADING: 2,
* LOADING: 3,
* DONE: 4
*
* Contrary to {@link qx.bom.request.Xhr#readyState}, the script transport
* does not receive response headers. For compatibility, another LOADING
* state is implemented that replaces the HEADERS_RECEIVED state.
*/
readyState : null,
/**
* {Number} The status code.
*
* Note: The script transport cannot determine the HTTP status code.
*/
status : null,
/**
* {String} The status text.
*
* The script transport does not receive response headers. For compatibility,
* the statusText property is set to the status casted to string.
*/
statusText : null,
/**
* {Number} Timeout limit in milliseconds.
*
* 0 (default) means no timeout.
*/
timeout : null,
/**
* {Function} Function that is executed once the script was loaded.
*/
__determineSuccess : null,
/**
* Add an event listener for the given event name.
*
* @param name {String} The name of the event to listen to.
* @param listener {Function} The function to execute when the event is fired
* @param ctx {var?} The context of the listener.
* @return {qx.bom.request.Script} Self for chaining.
*/
on : function(name, listener, ctx){
this._emitter.on(name, listener, ctx);
return this;
},
/**
* Initializes (prepares) request.
*
* @param method {String}
* The HTTP method to use.
* This parameter exists for compatibility reasons. The script transport
* does not support methods other than GET.
* @param url {String}
* The URL to which to send the request.
*/
open : function(method, url){
if(this.__disposed){
return;
};
// Reset XHR properties that may have been set by previous request
this.__initXhrProperties();
this.__abort = null;
this.__url = url;
if(this.__environmentGet("qx.debug.io")){
qx.Bootstrap.debug(qx.bom.request.Script, "Open native request with " + "url: " + url);
};
this._readyStateChange(1);
},
/**
* Appends a query parameter to URL.
*
* This method exists for compatibility reasons. The script transport
* does not support request headers. However, many services parse query
* parameters like request headers.
*
* Note: The request must be initialized before using this method.
*
* @param key {String}
* The name of the header whose value is to be set.
* @param value {String}
* The value to set as the body of the header.
* @return {qx.bom.request.Script} Self for chaining.
*/
setRequestHeader : function(key, value){
if(this.__disposed){
return null;
};
var param = {
};
if(this.readyState !== 1){
throw new Error("Invalid state");
};
param[key] = value;
this.__url = qx.util.Uri.appendParamsToUrl(this.__url, param);
return this;
},
/**
* Sends request.
* @return {qx.bom.request.Script} Self for chaining.
*/
send : function(){
if(this.__disposed){
return null;
};
var script = this.__createScriptElement(),head = this.__headElement,that = this;
if(this.timeout > 0){
this.__timeoutId = window.setTimeout(this.__onTimeoutBound, this.timeout);
};
if(this.__environmentGet("qx.debug.io")){
qx.Bootstrap.debug(qx.bom.request.Script, "Send native request");
};
// Attach script to DOM
head.insertBefore(script, head.firstChild);
// The resource is loaded once the script is in DOM.
// Assume HEADERS_RECEIVED and LOADING and dispatch async.
window.setTimeout(function(){
that._readyStateChange(2);
that._readyStateChange(3);
});
return this;
},
/**
* Aborts request.
* @return {qx.bom.request.Script} Self for chaining.
*/
abort : function(){
if(this.__disposed){
return null;
};
this.__abort = true;
this.__disposeScriptElement();
this._emit("abort");
return this;
},
/**
* Helper to emit events and call the callback methods.
* @param event {String} The name of the event.
*/
_emit : function(event){
this["on" + event]();
this._emitter.emit(event, this);
},
/**
* Event handler for an event that fires at every state change.
*
* Replace with custom method to get informed about the communication progress.
*/
onreadystatechange : function(){
},
/**
* Event handler for XHR event "load" that is fired on successful retrieval.
*
* Note: This handler is called even when an invalid script is returned.
*
* Warning: Internet Explorer < 9 receives a false "load" for invalid URLs.
* This "load" is fired about 2 seconds after sending the request. To
* distinguish from a real "load", consider defining a custom check
* function using {@link #setDetermineSuccess} and query the status
* property. However, the script loaded needs to have a known impact on
* the global namespace. If this does not work for you, you may be able
* to set a timeout lower than 2 seconds, depending on script size,
* complexity and execution time.
*
* Replace with custom method to listen to the "load" event.
*/
onload : function(){
},
/**
* Event handler for XHR event "loadend" that is fired on retrieval.
*
* Note: This handler is called even when a network error (or similar)
* occurred.
*
* Replace with custom method to listen to the "loadend" event.
*/
onloadend : function(){
},
/**
* Event handler for XHR event "error" that is fired on a network error.
*
* Note: Some browsers do not support the "error" event.
*
* Replace with custom method to listen to the "error" event.
*/
onerror : function(){
},
/**
* Event handler for XHR event "abort" that is fired when request
* is aborted.
*
* Replace with custom method to listen to the "abort" event.
*/
onabort : function(){
},
/**
* Event handler for XHR event "timeout" that is fired when timeout
* interval has passed.
*
* Replace with custom method to listen to the "timeout" event.
*/
ontimeout : function(){
},
/**
* Get a single response header from response.
*
* Note: This method exists for compatibility reasons. The script
* transport does not receive response headers.
*
* @param key {String}
* Key of the header to get the value from.
* @return {String|null} Warning message or <code>null</code> if the request
* is disposed
*/
getResponseHeader : function(key){
if(this.__disposed){
return null;
};
if(this.__environmentGet("qx.debug")){
qx.Bootstrap.debug("Response header cannot be determined for " + "requests made with script transport.");
};
return "unknown";
},
/**
* Get all response headers from response.
*
* Note: This method exists for compatibility reasons. The script
* transport does not receive response headers.
* @return {String|null} Warning message or <code>null</code> if the request
* is disposed
*/
getAllResponseHeaders : function(){
if(this.__disposed){
return null;
};
if(this.__environmentGet("qx.debug")){
qx.Bootstrap.debug("Response headers cannot be determined for" + "requests made with script transport.");
};
return "Unknown response headers";
},
/**
* Determine if loaded script has expected impact on global namespace.
*
* The function is called once the script was loaded and must return a
* boolean indicating if the response is to be considered successful.
*
* @param check {Function} Function executed once the script was loaded.
*
*/
setDetermineSuccess : function(check){
this.__determineSuccess = check;
},
/**
* Dispose object.
*/
dispose : function(){
var script = this.__scriptElement;
if(!this.__disposed){
// Prevent memory leaks
if(script){
script.onload = script.onreadystatechange = null;
this.__disposeScriptElement();
};
if(this.__timeoutId){
window.clearTimeout(this.__timeoutId);
};
this.__disposed = true;
};
},
/*
---------------------------------------------------------------------------
PROTECTED
---------------------------------------------------------------------------
*/
/**
* Get URL of request.
*
* @return {String} URL of request.
*/
_getUrl : function(){
return this.__url;
},
/**
* Get script element used for request.
*
* @return {Element} Script element.
*/
_getScriptElement : function(){
return this.__scriptElement;
},
/**
* Handle timeout.
*/
_onTimeout : function(){
this.__failure();
if(!this.__supportsErrorHandler()){
this._emit("error");
};
this._emit("timeout");
if(!this.__supportsErrorHandler()){
this._emit("loadend");
};
},
/**
* Handle native load.
*/
_onNativeLoad : function(){
var script = this.__scriptElement,determineSuccess = this.__determineSuccess,that = this;
// Aborted request must not fire load
if(this.__abort){
return;
};
// BUGFIX: IE < 9
// When handling "readystatechange" event, skip if readyState
// does not signal loaded script
if(this.__environmentGet("engine.name") === "mshtml" && this.__environmentGet("browser.documentmode") < 9){
if(!(/loaded|complete/).test(script.readyState)){
return;
} else {
if(this.__environmentGet("qx.debug.io")){
qx.Bootstrap.debug(qx.bom.request.Script, "Received native readyState: loaded");
};
};
};
if(this.__environmentGet("qx.debug.io")){
qx.Bootstrap.debug(qx.bom.request.Script, "Received native load");
};
// Determine status by calling user-provided check function
if(determineSuccess){
// Status set before has higher precedence
if(!this.status){
this.status = determineSuccess() ? 200 : 500;
};
};
if(this.status === 500){
if(this.__environmentGet("qx.debug.io")){
qx.Bootstrap.debug(qx.bom.request.Script, "Detected error");
};
};
if(this.__timeoutId){
window.clearTimeout(this.__timeoutId);
};
window.setTimeout(function(){
that._success();
that._readyStateChange(4);
that._emit("load");
that._emit("loadend");
});
},
/**
* Handle native error.
*/
_onNativeError : function(){
this.__failure();
this._emit("error");
this._emit("loadend");
},
/*
---------------------------------------------------------------------------
PRIVATE
---------------------------------------------------------------------------
*/
/**
* {Element} Script element
*/
__scriptElement : null,
/**
* {Element} Head element
*/
__headElement : null,
/**
* {String} URL
*/
__url : "",
/**
* {Function} Bound _onNativeLoad handler.
*/
__onNativeLoadBound : null,
/**
* {Function} Bound _onNativeError handler.
*/
__onNativeErrorBound : null,
/**
* {Function} Bound _onTimeout handler.
*/
__onTimeoutBound : null,
/**
* {Number} Timeout timer iD.
*/
__timeoutId : null,
/**
* {Boolean} Whether request was aborted.
*/
__abort : null,
/**
* {Boolean} Whether request was disposed.
*/
__disposed : null,
/*
---------------------------------------------------------------------------
HELPER
---------------------------------------------------------------------------
*/
/**
* Initialize properties.
*/
__initXhrProperties : function(){
this.readyState = 0;
this.status = 0;
this.statusText = "";
},
/**
* Change readyState.
*
* @param readyState {Number} The desired readyState
*/
_readyStateChange : function(readyState){
this.readyState = readyState;
this._emit("readystatechange");
},
/**
* Handle success.
*/
_success : function(){
this.__disposeScriptElement();
this.readyState = 4;
// By default, load is considered successful
if(!this.status){
this.status = 200;
};
this.statusText = "" + this.status;
},
/**
* Handle failure.
*/
__failure : function(){
this.__disposeScriptElement();
this.readyState = 4;
this.status = 0;
this.statusText = null;
},
/**
* Looks up whether browser supports error handler.
*
* @return {Boolean} Whether browser supports error handler.
*/
__supportsErrorHandler : function(){
var isLegacyIe = this.__environmentGet("engine.name") === "mshtml" && this.__environmentGet("browser.documentmode") < 9;
var isOpera = this.__environmentGet("engine.name") === "opera";
return !(isLegacyIe || isOpera);
},
/**
* Create and configure script element.
*
* @return {Element} Configured script element.
*/
__createScriptElement : function(){
var script = this.__scriptElement = document.createElement("script");
script.src = this.__url;
script.onerror = this.__onNativeErrorBound;
script.onload = this.__onNativeLoadBound;
// BUGFIX: IE < 9
// Legacy IEs do not fire the "load" event for script elements.
// Instead, they support the "readystatechange" event
if(this.__environmentGet("engine.name") === "mshtml" && this.__environmentGet("browser.documentmode") < 9){
script.onreadystatechange = this.__onNativeLoadBound;
};
return script;
},
/**
* Remove script element from DOM.
*/
__disposeScriptElement : function(){
var script = this.__scriptElement;
if(script && script.parentNode){
this.__headElement.removeChild(script);
};
},
/**
* Proxy Environment.get to guard against env not being present yet.
*
* @param key {String} Environment key.
* @return {var} Value of the queried environment key
* @lint environmentNonLiteralKey(key)
*/
__environmentGet : function(key){
if(qx && qx.core && qx.core.Environment){
return qx.core.Environment.get(key);
} else {
if(key === "engine.name"){
return qx.bom.client.Engine.getName();
};
if(key === "browser.documentmode"){
return qx.bom.client.Browser.getDocumentMode();
};
if(key == "qx.debug.io"){
return false;
};
throw new Error("Unknown environment key at this phase");
};
}
},
defer : function(){
if(qx && qx.core && qx.core.Environment){
qx.core.Environment.add("qx.debug.io", false);
};
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2004-2011 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Tristan Koch (tristankoch)
************************************************************************ */
/* ************************************************************************
#require(qx.bom.request.Script#open)
#require(qx.bom.request.Script#on)
#require(qx.bom.request.Script#onreadystatechange)
#require(qx.bom.request.Script#onload)
#require(qx.bom.request.Script#onloadend)
#require(qx.bom.request.Script#onerror)
#require(qx.bom.request.Script#onabort)
#require(qx.bom.request.Script#ontimeout)
#require(qx.bom.request.Script#send)
************************************************************************ */
/**
* A special script loader handling JSONP responses. Automatically
* provides callbacks and populates responseJson property.
*
* Example:
*
* <pre class="javascript">
* var req = new qx.bom.request.Jsonp();
*
* // Some services have a fixed callback name
* // req.setCallbackName("callback");
*
* req.onload = function() {
* // Handle data received
* req.responseJson;
* }
*
* req.open("GET", url);
* req.send();
* </pre>
*/
qx.Bootstrap.define("qx.bom.request.Jsonp", {
extend : qx.bom.request.Script,
construct : function(){
// Borrow super-class constructor
qx.bom.request.Script.apply(this);
this.__generateId();
},
members : {
/**
* {Object} Parsed JSON response.
*/
responseJson : null,
/**
* {Number} Identifier of this instance.
*/
__id : null,
/**
* {String} Callback parameter.
*/
__callbackParam : null,
/**
* {String} Callback name.
*/
__callbackName : null,
/**
* {Boolean} Whether callback was called.
*/
__callbackCalled : null,
/**
* {Boolean} Whether a custom callback was created automatically.
*/
__customCallbackCreated : null,
/**
* {Boolean} Whether request was disposed.
*/
__disposed : null,
/** Prefix used for the internal callback name. */
__prefix : "",
/**
* Initializes (prepares) request.
*
* @param method {String}
* The HTTP method to use.
* This parameter exists for compatibility reasons. The script transport
* does not support methods other than GET.
* @param url {String}
* The URL to which to send the request.
*/
open : function(method, url){
if(this.__disposed){
return;
};
var query = {
},callbackParam,callbackName,that = this;
// Reset properties that may have been set by previous request
this.responseJson = null;
this.__callbackCalled = false;
callbackParam = this.__callbackParam || "callback";
callbackName = this.__callbackName || this.__prefix + "qx.bom.request.Jsonp[" + this.__id + "].callback";
// Default callback
if(!this.__callbackName){
// Store globally available reference to this object
this.constructor[this.__id] = this;
} else {
// Dynamically create globally available callback (if it does not
// exist yet) with user defined name. Delegate to this object’s
// callback method.
if(!window[this.__callbackName]){
this.__customCallbackCreated = true;
window[this.__callbackName] = function(data){
that.callback(data);
};
} else {
if(qx.core.Environment.get("qx.debug.io")){
qx.Bootstrap.debug(qx.bom.request.Jsonp, "Callback " + this.__callbackName + " already exists");
};
};
};
if(qx.core.Environment.get("qx.debug.io")){
qx.Bootstrap.debug(qx.bom.request.Jsonp, "Expecting JavaScript response to call: " + callbackName);
};
query[callbackParam] = callbackName;
url = qx.util.Uri.appendParamsToUrl(url, query);
this.__callBase("open", [method, url]);
},
/**
* Callback provided for JSONP response to pass data.
*
* Called internally to populate responseJson property
* and indicate successful status.
*
* Note: If you write a custom callback you’ll need to call
* this method in order to notify the request about the data
* loaded. Writing a custom callback should not be necessary
* in most cases.
*
* @param data {Object} JSON
*/
callback : function(data){
if(this.__disposed){
return;
};
// Signal callback was called
this.__callbackCalled = true;
{
};
// Set response
this.responseJson = data;
// Delete global reference to this
this.constructor[this.__id] = undefined;
this.__deleteCustomCallback();
},
/**
* Set callback parameter.
*
* Some JSONP services expect the callback name to be passed labeled with a
* special URL parameter key, e.g. "jsonp" in "?jsonp=myCallback". The
* default is "callback".
*
* @param param {String} Name of the callback parameter.
* @return {qx.bom.request.Jsonp} Self reference for chaining.
*/
setCallbackParam : function(param){
this.__callbackParam = param;
return this;
},
/**
* Set callback name.
*
* Must be set to the name of the callback function that is called by the
* script returned from the JSONP service. By default, the callback name
* references this instance’s {@link #callback} method, allowing to connect
* multiple JSONP responses to different requests.
*
* If the JSONP service allows to set custom callback names, it should not
* be necessary to change the default. However, some services use a fixed
* callback name. This is when setting the callbackName is useful. A
* function is created and made available globally under the given name.
* The function receives the JSON data and dispatches it to this instance’s
* {@link #callback} method. Please note that this function is only created
* if it does not exist before.
*
* @param name {String} Name of the callback function.
* @return {qx.bom.request.Jsonp} Self reference for chaining.
*/
setCallbackName : function(name){
this.__callbackName = name;
return this;
},
/**
* Set the prefix used in front of 'qx.' in case 'qx' is not available
* (for qx.Website e.g.)
* @internal
* @param prefix {String} The prefix to put in front of 'qx'
*/
setPrefix : function(prefix){
this.__prefix = prefix;
},
dispose : function(){
// In case callback was not called
this.__deleteCustomCallback();
this.__callBase("dispose");
},
/**
* Handle native load.
*/
_onNativeLoad : function(){
// Indicate erroneous status (500) if callback was not called.
//
// Why 500? 5xx belongs to the range of server errors. If the callback was
// not called, it is assumed the server failed to provide an appropriate
// response. Since the exact reason of the error is unknown, the most
// generic message ("500 Internal Server Error") is chosen.
this.status = this.__callbackCalled ? 200 : 500;
this.__callBase("_onNativeLoad");
},
/**
* Delete custom callback if dynamically created before.
*/
__deleteCustomCallback : function(){
if(this.__customCallbackCreated && window[this.__callbackName]){
window[this.__callbackName] = undefined;
this.__customCallbackCreated = false;
};
},
/**
* Call overriden method.
*
* @param method {String} Name of the overriden method.
* @param args {Array} Arguments.
*/
__callBase : function(method, args){
qx.bom.request.Script.prototype[method].apply(this, args || []);
},
/**
* Generate ID.
*/
__generateId : function(){
// Add random digits to date to allow immediately following requests
// that may be send at the same time
this.__id = (new Date().valueOf()) + ("" + Math.random()).substring(2, 5);
}
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2012 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Daniel Wagner (danielwagner)
************************************************************************ */
/* ************************************************************************
#require(qx.module.Environment)
#require(qx.module.Manipulating)
#require(qx.module.Traversing)
#require(qx.module.Css)
#require(qx.module.Attribute)
************************************************************************ */
/**
* Provides a way to block elements so they will no longer receive (native)
* events by overlaying them with a div.
* For Internet Explorer, an additional Iframe element will be overlayed since
* native form controls cannot be blocked otherwise.
*
* The blocker can also be applied to the entire document, e.g.:
*
* <pre class="javascript">
* q(document).block();
* </pre>
*/
qxWeb.define("qx.module.Blocker", {
statics : {
/**
* Attaches a blocker div (and additionally a blocker Iframe for IE) to the
* given element.
*
* @param item {Element|Document} The element to be overlaid with the blocker
* @param color {String} The color for the blocker element (any CSS color value)
* @param opacity {Number} The CSS opacity value for the blocker
* @param zIndex {Number} The zIndex value for the blocker
*/
__attachBlocker : function(item, color, opacity, zIndex){
var win = qxWeb.getWindow(item);
var isDocument = qxWeb.isDocument(item);
if(!item.__blocker){
item.__blocker = {
div : qxWeb.create("<div/>")
};
if((qxWeb.env.get("engine.name") == "mshtml")){
item.__blocker.iframe = qx.module.Blocker.__getIframeElement(win);
};
};
qx.module.Blocker.__styleBlocker(item, color, opacity, zIndex, isDocument);
item.__blocker.div.appendTo(win.document.body);
if(item.__blocker.iframe){
item.__blocker.iframe.appendTo(win.document.body);
};
if(isDocument){
qxWeb(win).on("resize", qx.module.Blocker.__onWindowResize);
};
},
/**
* Styles the blocker element(s)
*
* @param item {Element|Document} The element to be overlaid with the blocker
* @param color {String} The color for the blocker element (any CSS color value)
* @param opacity {Number} The CSS opacity value for the blocker
* @param zIndex {Number} The zIndex value for the blocker
* @param isDocument {Boolean} Whether the item is a document node
*/
__styleBlocker : function(item, color, opacity, zIndex, isDocument){
var qItem = qxWeb(item);
var styles = {
"zIndex" : zIndex,
"display" : "block",
"position" : "absolute",
"backgroundColor" : color,
"opacity" : opacity,
"width" : qItem.getWidth() + "px",
"height" : qItem.getHeight() + "px"
};
if(isDocument){
styles.top = 0 + "px";
styles.left = 0 + "px";
} else {
var pos = qItem.getOffset();
styles.top = pos.top + "px";
styles.left = pos.left + "px";
};
item.__blocker.div.setStyles(styles);
if(item.__blocker.iframe){
styles.zIndex = styles.zIndex - 1;
styles.backgroundColor = "transparent";
styles.opacity = 0;
item.__blocker.iframe.setStyles(styles);
};
},
/**
* Creates an iframe element used as a blocker in IE
*
* @param win {Window} The parent window of the item to be blocked
* @return {Element} Iframe blocker
*/
__getIframeElement : function(win){
var iframe = qxWeb.create('<iframe></iframe>');
iframe.setAttributes({
frameBorder : 0,
frameSpacing : 0,
marginWidth : 0,
marginHeight : 0,
hspace : 0,
vspace : 0,
border : 0,
allowTransparency : false,
src : "javascript:false"
});
return iframe;
},
/**
* Callback for the Window's resize event. Applies the window's new sizes
* to the blocker element(s).
*
* @param ev {Event} resize event
*/
__onWindowResize : function(ev){
var win = this[0];
var size = {
width : this.getWidth() + "px",
height : this.getHeight() + "px"
};
qxWeb(win.document.__blocker.div).setStyles(size);
if(win.document.__blocker.iframe){
qxWeb(win.document.__blocker.iframe).setStyles(size);
};
},
/**
* Removes the given item's blocker element(s) from the DOM
*
* @param item {Element} Blocked element
* @param index {Number} index of the item in the collection
*/
__detachBlocker : function(item, index){
if(!item.__blocker){
return;
};
item.__blocker.div.remove();
if(item.__blocker.iframe){
item.__blocker.iframe.remove();
};
if(qxWeb.isDocument(item)){
qxWeb(qxWeb.getWindow(item)).off("resize", qx.module.Blocker.__onWindowResize);
};
},
/**
* Adds an overlay to all items in the collection that intercepts mouse
* events.
*
* @attach {qxWeb}
* @param color {String ? transparent} The color for the blocker element (any CSS color value)
* @param opacity {Float ? 0} The CSS opacity value for the blocker
* @param zIndex {Number ? 10000} The zIndex value for the blocker
* @return {qxWeb} The collection for chaining
*/
block : function(color, opacity, zIndex){
if(!this[0]){
return this;
};
color = color || "transparent";
opacity = opacity || 0;
zIndex = zIndex || 10000;
this.forEach(function(item, index){
qx.module.Blocker.__attachBlocker(item, color, opacity, zIndex);
});
return this;
},
/**
* Removes the blockers from all items in the collection
*
* @attach {qxWeb}
* @return {qxWeb} The collection for chaining
*/
unblock : function(){
if(!this[0]){
return this;
};
this.forEach(qx.module.Blocker.__detachBlocker);
return this;
}
},
defer : function(statics){
qxWeb.$attach({
"block" : statics.block,
"unblock" : statics.unblock
});
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2012 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Martin Wittemann (wittemann)
************************************************************************ */
/* ************************************************************************
#require(qx.module.Css)
#require(qx.module.Event)
************************************************************************ */
/**
* Cross browser animation layer. It uses feature detection to check if CSS
* animations are available and ready to use. If not, a JavaScript-based
* fallback will be used.
*/
qx.Bootstrap.define("qx.module.Animation", {
events : {
/** Fired when an animation starts. */
"animationStart" : undefined,
/** Fired when an animation has ended one iteration. */
"animationIteration" : undefined,
/** Fired when an animation has ended. */
"animationEnd" : undefined
},
statics : {
/**
* Returns the stored animation handles. The handles are only
* available while an animation is running.
*
* @internal
* @return {Array} An array of animation handles.
*/
getAnimationHandles : function(){
var animationHandles = [];
for(var i = 0;i < this.length;i++){
animationHandles[i] = this[i].$$animation;
};
return animationHandles;
},
/**
* Animation description used in {@link #fadeOut}.
*/
_fadeOut : {
duration : 700,
timing : "ease-out",
keep : 100,
keyFrames : {
'0' : {
opacity : 1
},
'100' : {
opacity : 0,
display : "none"
}
}
},
/**
* Animation description used in {@link #fadeIn}.
*/
_fadeIn : {
duration : 700,
timing : "ease-in",
keep : 100,
keyFrames : {
'0' : {
opacity : 0
},
'100' : {
opacity : 1
}
}
},
/**
* Starts the animation with the given description.
* The description should be a map, which could look like this:
*
* <pre class="javascript">
* {
* "duration": 1000,
* "keep": 100,
* "keyFrames": {
* 0 : {"opacity": 1, "scale": 1},
* 100 : {"opacity": 0, "scale": 0}
* },
* "origin": "50% 50%",
* "repeat": 1,
* "timing": "ease-out",
* "alternate": false,
* "delay": 2000
* }
* </pre>
*
* *duration* is the time in milliseconds one animation cycle should take.
*
* *keep* is the key frame to apply at the end of the animation. (optional)
*
* *keyFrames* is a map of separate frames. Each frame is defined by a
* number which is the percentage value of time in the animation. The value
* is a map itself which holds css properties or transforms
* (Transforms only for CSS Animations).
*
* *origin* maps to the transform origin {@link qx.bom.element.Transform#setOrigin}
* (Only for CSS animations).
*
* *repeat* is the amount of time the animation should be run in
* sequence. You can also use "infinite".
*
* *timing* takes one of these predefined values:
* <code>ease</code> | <code>linear</code> | <code>ease-in</code>
* | <code>ease-out</code> | <code>ease-in-out</code> |
* <code>cubic-bezier(<number>, <number>, <number>, <number>)</code>
* (cubic-bezier only available for CSS animations)
*
* *alternate* defines if every other animation should be run in reverse order.
*
* *delay* is the time in milliseconds the animation should wait before start.
*
* @attach {qxWeb}
* @param desc {Map} The animation's description.
* @param duration {Number?} The duration in milliseconds of the animation,
* which will override the duration given in the description.
* @return {qxWeb} The collection for chaining.
*/
animate : function(desc, duration){
qx.module.Animation._animate.bind(this)(desc, duration, false);
return this;
},
/**
* Starts an animation in reversed order. For further details, take a look at
* the {@link #animate} method.
* @attach {qxWeb}
* @param desc {Map} The animation's description.
* @param duration {Number?} The duration in milliseconds of the animation,
* which will override the duration given in the description.
* @return {qxWeb} The collection for chaining.
*/
animateReverse : function(desc, duration){
qx.module.Animation._animate.bind(this)(desc, duration, true);
return this;
},
/**
* Animation execute either regular or reversed direction.
* @param desc {Map} The animation's description.
* @param duration {Number?} The duration in milliseconds of the animation,
* which will override the duration given in the description.
* @param reverse {Boolean} <code>true</code>, if the animation should be reversed
*/
_animate : function(desc, duration, reverse){
for(var i = 0;i < this.length;i++){
var el = this[i];
// stop all running animations
if(el.$$animation){
el.$$animation.stop();
};
if(reverse){
var handle = qx.bom.element.Animation.animateReverse(el, desc, duration);
} else {
var handle = qx.bom.element.Animation.animate(el, desc, duration);
};
var self = this;
// only register for the first element
if(i == 0){
handle.on("start", function(){
self.emit("animationStart");
}, handle);
handle.on("iteration", function(){
self.emit("animationIteration");
}, handle);
};
handle.on("end", function(){
for(var i = 0;i < self.length;i++){
if(self[i].$$animation){
return;
};
};
self.emit("animationEnd");
}, el);
};
},
/**
* Manipulates the play state of the animation.
* This can be used to continue an animation when paused.
* @attach {qxWeb}
* @return {qxWeb} The collection for chaining.
*/
play : function(){
for(var i = 0;i < this.length;i++){
var handle = this[i].$$animation;
if(handle){
handle.play();
};
};
return this;
},
/**
* Manipulates the play state of the animation.
* This can be used to pause an animation when running.
* @attach {qxWeb}
* @return {qxWeb} The collection for chaining.
*/
pause : function(){
for(var i = 0;i < this.length;i++){
var handle = this[i].$$animation;
if(handle){
handle.pause();
};
};
return this;
},
/**
* Stops a running animation.
* @attach {qxWeb}
* @return {qxWeb} The collection for chaining.
*/
stop : function(){
for(var i = 0;i < this.length;i++){
var handle = this[i].$$animation;
if(handle){
handle.stop();
};
};
return this;
},
/**
* Returns whether an animation is running or not.
* @attach {qxWeb}
* @return {Boolean} <code>true</code>, if an animation is running.
*/
isPlaying : function(){
for(var i = 0;i < this.length;i++){
var handle = this[i].$$animation;
if(handle && handle.isPlaying()){
return true;
};
};
return false;
},
/**
* Returns whether an animation has ended or not.
* @attach {qxWeb}
* @return {Boolean} <code>true</code>, if an animation has ended.
*/
isEnded : function(){
for(var i = 0;i < this.length;i++){
var handle = this[i].$$animation;
if(handle && !handle.isEnded()){
return false;
};
};
return true;
},
/**
* Fades in all elements in the collection.
* @attach {qxWeb}
* @param duration {Number?} The duration in milliseconds.
* @return {qxWeb} The collection for chaining.
*/
fadeIn : function(duration){
// remove 'display: none' style
this.setStyle("display", "");
return this.animate(qx.module.Animation._fadeIn, duration);
},
/**
* Fades out all elements in the collection.
* @attach {qxWeb}
* @param duration {Number?} The duration in milliseconds.
* @return {qxWeb} The collection for chaining.
*/
fadeOut : function(duration){
return this.animate(qx.module.Animation._fadeOut, duration);
}
},
defer : function(statics){
qxWeb.$attach({
"animate" : statics.animate,
"animateReverse" : statics.animateReverse,
"fadeIn" : statics.fadeIn,
"fadeOut" : statics.fadeOut,
"play" : statics.play,
"pause" : statics.pause,
"stop" : statics.stop,
"isEnded" : statics.isEnded,
"isPlaying" : statics.isPlaying,
"getAnimationHandles" : statics.getAnimationHandles
});
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2012 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Martin Wittemann (martinwittemann)
************************************************************************ */
/**
* Wrapper for {@link qx.bom.element.AnimationCss} and
* {@link qx.bom.element.AnimationJs}. It offers the pubilc API and decides using
* feature checks either to use CSS animations or JS animations.
*
* If you use this class, the restrictions of the JavaScript animations apply.
* This means that you can not use transforms and custom bezier timing functions.
*/
qx.Bootstrap.define("qx.bom.element.Animation", {
statics : {
/**
* This function takes care of the feature check and starts the animation.
* It takes a DOM element to apply the animation to, and a description.
* The description should be a map, which could look like this:
*
* <pre class="javascript">
* {
* "duration": 1000,
* "keep": 100,
* "keyFrames": {
* 0 : {"opacity": 1, "scale": 1},
* 100 : {"opacity": 0, "scale": 0}
* },
* "origin": "50% 50%",
* "repeat": 1,
* "timing": "ease-out",
* "alternate": false,
* "delay" : 2000
* }
* </pre>
*
* *duration* is the time in milliseconds one animation cycle should take.
*
* *keep* is the key frame to apply at the end of the animation. (optional)
* Keep in mind that the keep key is reversed in case you use an reverse
* animation or set the alternate key and a even repeat count.
*
* *keyFrames* is a map of separate frames. Each frame is defined by a
* number which is the percentage value of time in the animation. The value
* is a map itself which holds css properties or transforms
* {@link qx.bom.element.Transform} (Transforms only for CSS Animations).
*
* *origin* maps to the transform origin {@link qx.bom.element.Transform#setOrigin}
* (Only for CSS animations).
*
* *repeat* is the amount of time the animation should be run in
* sequence. You can also use "infinite".
*
* *timing* takes one of the predefined value:
* <code>ease</code> | <code>linear</code> | <code>ease-in</code>
* | <code>ease-out</code> | <code>ease-in-out</code> |
* <code>cubic-bezier(<number>, <number>, <number>, <number>)</code>
* (cubic-bezier only available for CSS animations)
*
* *alternate* defines if every other animation should be run in reverse order.
*
* *delay* is the time in milliseconds the animation should wait before start.
*
* @param el {Element} The element to animate.
* @param desc {Map} The animations description.
* @param duration {Integer?} The duration in milliseconds of the animation
* which will override the duration given in the description.
* @return {qx.bom.element.AnimationHandle} AnimationHandle instance to control
* the animation.
*/
animate : function(el, desc, duration){
var onlyCssKeys = qx.bom.element.Animation.__hasOnlyCssKeys(el, desc.keyFrames);
if(qx.core.Environment.get("css.animation") && onlyCssKeys){
return qx.bom.element.AnimationCss.animate(el, desc, duration);
} else {
return qx.bom.element.AnimationJs.animate(el, desc, duration);
};
},
/**
* Starts an animation in reversed order. For further details, take a look at
* the {@link #animate} method.
* @param el {Element} The element to animate.
* @param desc {Map} The animations description.
* @param duration {Integer?} The duration in milliseconds of the animation
* which will override the duration given in the description.
* @return {qx.bom.element.AnimationHandle} AnimationHandle instance to control
* the animation.
*/
animateReverse : function(el, desc, duration){
var onlyCssKeys = qx.bom.element.Animation.__hasOnlyCssKeys(el, desc.keyFrames);
if(qx.core.Environment.get("css.animation") && onlyCssKeys){
return qx.bom.element.AnimationCss.animateReverse(el, desc, duration);
} else {
return qx.bom.element.AnimationJs.animateReverse(el, desc, duration);
};
},
/**
* Detection helper which detects if only CSS keys are in
* the animations key frames.
* @param el {Element} The element to check for the styles.
* @param keyFrames {Map} The keyFrames of the animation.
* @return {Boolean} <code>true</code> if only css properties are included.
*/
__hasOnlyCssKeys : function(el, keyFrames){
var keys = [];
for(var nr in keyFrames){
var frame = keyFrames[nr];
for(var key in frame){
if(keys.indexOf(key) == -1){
keys.push(key);
};
};
};
var transformKeys = ["scale", "rotate", "skew", "translate"];
for(var i = 0;i < keys.length;i++){
var key = qx.lang.String.camelCase(keys[i]);
if(!(key in el.style)){
// check for transform keys
if(transformKeys.indexOf(keys[i]) != -1){
continue;
};
return false;
};
};
return true;
}
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2004-2011 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Martin Wittemann (wittemann)
************************************************************************ */
/* ************************************************************************
#require(qx.bom.Stylesheet)
************************************************************************ */
/**
* Responsible for checking all relevant animation properties.
*
* Spec: http://www.w3.org/TR/css3-animations/
*
* @internal
*/
qx.Bootstrap.define("qx.bom.client.CssAnimation", {
statics : {
/**
* Main check method which returns an object if CSS animations are
* supported. This object contains all necessary keys to work with CSS
* animations.
* <ul>
* <li><code>name</code> The name of the css animation style</li>
* <li><code>play-state</code> The name of the play-state style</li>
* <li><code>start-event</code> The name of the start event</li>
* <li><code>iternation-event</code> The name of the iternation event</li>
* <li><code>end-event</code> The name of the end event</li>
* <li><code>fill-mode</code> The fill-mode style</li>
* <li><code>keyframes</code> The name of the keyframes selector.</li>
* </ul>
*
* @internal
* @return {Object|null} The described object or null, if animations are
* not supported.
*/
getSupport : function(){
var name = qx.bom.client.CssAnimation.getName();
if(name != null){
return {
"name" : name,
"play-state" : qx.bom.client.CssAnimation.getPlayState(),
"start-event" : qx.bom.client.CssAnimation.getAnimationStart(),
"iteration-event" : qx.bom.client.CssAnimation.getAnimationIteration(),
"end-event" : qx.bom.client.CssAnimation.getAnimationEnd(),
"fill-mode" : qx.bom.client.CssAnimation.getFillMode(),
"keyframes" : qx.bom.client.CssAnimation.getKeyFrames()
};
};
return null;
},
/**
* Checks for the 'animation-fill-mode' CSS style.
* @internal
* @return {String|null} The name of the style or null, if the style is
* not supported.
*/
getFillMode : function(){
return qx.bom.Style.getPropertyName("AnimationFillMode");
},
/**
* Checks for the 'animation-play-state' CSS style.
* @internal
* @return {String|null} The name of the style or null, if the style is
* not supported.
*/
getPlayState : function(){
return qx.bom.Style.getPropertyName("AnimationPlayState");
},
/**
* Checks for the style name used for animations.
* @internal
* @return {String|null} The name of the style or null, if the style is
* not supported.
*/
getName : function(){
return qx.bom.Style.getPropertyName("animation");
},
/**
* Checks for the event name of animation start.
* @internal
* @return {String} The name of the event.
*/
getAnimationStart : function(){
var mapping = {
"msAnimation" : "MSAnimationStart",
"WebkitAnimation" : "webkitAnimationStart",
"MozAnimation" : "animationstart",
"OAnimation" : "oAnimationStart",
"animation" : "animationstart"
};
return mapping[this.getName()];
},
/**
* Checks for the event name of animation end.
* @internal
* @return {String} The name of the event.
*/
getAnimationIteration : function(){
var mapping = {
"msAnimation" : "MSAnimationIteration",
"WebkitAnimation" : "webkitAnimationIteration",
"MozAnimation" : "animationiteration",
"OAnimation" : "oAnimationIteration",
"animation" : "animationiteration"
};
return mapping[this.getName()];
},
/**
* Checks for the event name of animation end.
* @internal
* @return {String} The name of the event.
*/
getAnimationEnd : function(){
var mapping = {
"msAnimation" : "MSAnimationEnd",
"WebkitAnimation" : "webkitAnimationEnd",
"MozAnimation" : "animationend",
"OAnimation" : "oAnimationEnd",
"animation" : "animationend"
};
return mapping[this.getName()];
},
/**
* Checks what selector should be used to add keyframes to stylesheets.
* @internal
* @return {String|null} The name of the selector or null, if the selector
* is not supported.
*/
getKeyFrames : function(){
var prefixes = qx.bom.Style.VENDOR_PREFIXES;
var keyFrames = [];
for(var i = 0;i < prefixes.length;i++){
var key = "@" + qx.bom.Style.getCssName(prefixes[i]) + "-keyframes";
keyFrames.push(key);
};
keyFrames.unshift("@keyframes");
var sheet = qx.bom.Stylesheet.createElement();
for(var i = 0;i < keyFrames.length;i++){
try{
qx.bom.Stylesheet.addRule(sheet, keyFrames[i] + " name", "");
return keyFrames[i];
} catch(e) {
};
};
return null;
},
/**
* Checks for the requestAnimationFrame method and return the prefixed name.
* @internal
* @return {String|null} A string the method name or null, if the method
* is not supported.
*/
getRequestAnimationFrame : function(){
var choices = ["requestAnimationFrame", "msRequestAnimationFrame", "webkitRequestAnimationFrame", "mozRequestAnimationFrame", "oRequestAnimationFrame"];
for(var i = 0;i < choices.length;i++){
if(window[choices[i]] != undefined){
return choices[i];
};
};
return null;
}
},
defer : function(statics){
qx.core.Environment.add("css.animation", statics.getSupport);
qx.core.Environment.add("css.animation.requestframe", statics.getRequestAnimationFrame);
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2011 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Martin Wittemann (martinwittemann)
************************************************************************ */
/**
* This class is responsible for applying CSS3 animations to plain DOM elements.
*
* The implementation is mostly a cross-browser wrapper for applying the
* animations, including transforms. If the browser does not support
* CSS animations, but you have set a keep frame, the keep frame will be applied
* immediately, thus making the animations optional.
*
* The API aligns closely to the spec wherever possible.
*
* http://www.w3.org/TR/css3-animations/
*
* {@link qx.bom.element.Animation} is the class, which takes care of the
* feature detection for CSS animations and decides which implementation
* (CSS or JavaScript) should be used. Most likely, this implementation should
* be the one to use.
*/
qx.Bootstrap.define("qx.bom.element.AnimationCss", {
statics : {
// initialization
__sheet : null,
__rulePrefix : "Anni",
__id : 0,
/** Static map of rules */
__rules : {
},
/** The used keys for transforms. */
__transitionKeys : {
"scale" : true,
"rotate" : true,
"skew" : true,
"translate" : true
},
/** Map of cross browser CSS keys. */
__cssAnimationKeys : qx.core.Environment.get("css.animation"),
/**
* This is the main function to start the animation in reverse mode.
* For further details, take a look at the documentation of the wrapper
* {@link qx.bom.element.Animation}.
* @param el {Element} The element to animate.
* @param desc {Map} Animation description.
* @param duration {Integer?} The duration of the animation which will
* override the duration given in the description.
* @return {qx.bom.element.AnimationHandle} The handle.
*/
animateReverse : function(el, desc, duration){
return this._animate(el, desc, duration, true);
},
/**
* This is the main function to start the animation. For further details,
* take a look at the documentation of the wrapper
* {@link qx.bom.element.Animation}.
* @param el {Element} The element to animate.
* @param desc {Map} Animation description.
* @param duration {Integer?} The duration of the animation which will
* override the duration given in the description.
* @return {qx.bom.element.AnimationHandle} The handle.
*/
animate : function(el, desc, duration){
return this._animate(el, desc, duration, false);
},
/**
* Internal method to start an animation either reverse or not.
* {@link qx.bom.element.Animation}.
* @param el {Element} The element to animate.
* @param desc {Map} Animation description.
* @param duration {Integer?} The duration of the animation which will
* override the duration given in the description.
* @param reverse {Boolean} <code>true</code>, if the animation should be
* reversed.
* @return {qx.bom.element.AnimationHandle} The handle.
*/
_animate : function(el, desc, duration, reverse){
this.__normalizeDesc(desc);
{
};
// reverse the keep property if the animation is reverse as well
var keep = desc.keep;
if(keep != null && (reverse || (desc.alternate && desc.repeat % 2 == 0))){
keep = 100 - keep;
};
if(!this.__sheet){
this.__sheet = qx.bom.Stylesheet.createElement();
};
var keyFrames = desc.keyFrames;
if(duration == undefined){
duration = desc.duration;
};
// if animations are supported
if(this.__cssAnimationKeys != null){
var name = this.__addKeyFrames(keyFrames, reverse);
var style = name + " " + duration + "ms " + desc.repeat + " " + desc.timing + " " + (desc.delay ? desc.delay + "ms " : "") + (desc.alternate ? "alternate" : "");
qx.bom.Event.addNativeListener(el, this.__cssAnimationKeys["start-event"], this.__onAnimationStart);
qx.bom.Event.addNativeListener(el, this.__cssAnimationKeys["iteration-event"], this.__onAnimationIteration);
qx.bom.Event.addNativeListener(el, this.__cssAnimationKeys["end-event"], this.__onAnimationEnd);
el.style[qx.lang.String.camelCase(this.__cssAnimationKeys["name"])] = style;
// use the fill mode property if available and suitable
if(keep && keep == 100 && this.__cssAnimationKeys["fill-mode"]){
el.style[this.__cssAnimationKeys["fill-mode"]] = "forwards";
};
};
var animation = new qx.bom.element.AnimationHandle();
animation.desc = desc;
animation.el = el;
animation.keep = keep;
el.$$animation = animation;
// additional transform keys
if(desc.origin != null){
qx.bom.element.Transform.setOrigin(el, desc.origin);
};
// fallback for browsers not supporting animations
if(this.__cssAnimationKeys == null){
window.setTimeout(function(){
qx.bom.element.AnimationCss.__onAnimationEnd({
target : el
});
}, 0);
};
return animation;
},
/**
* Handler for the animation start.
* @param e {Event} The native event from the browser.
*/
__onAnimationStart : function(e){
e.target.$$animation.emit("start", e.target);
},
/**
* Handler for the animation iteration.
* @param e {Event} The native event from the browser.
*/
__onAnimationIteration : function(e){
// It could happen that an animation end event is fired before an
// animation iteration appears [BUG #6928]
if(e.target != null && e.target.$$animation != null){
e.target.$$animation.emit("iteration", e.target);
};
},
/**
* Handler for the animation end.
* @param e {Event} The native event from the browser.
*/
__onAnimationEnd : function(e){
var el = e.target;
var animation = el.$$animation;
// ignore events when already cleaned up
if(!animation){
return;
};
var desc = animation.desc;
if(qx.bom.element.AnimationCss.__cssAnimationKeys != null){
// reset the styling
var key = qx.lang.String.camelCase(qx.bom.element.AnimationCss.__cssAnimationKeys["name"]);
el.style[key] = "";
qx.bom.Event.removeNativeListener(el, qx.bom.element.AnimationCss.__cssAnimationKeys["name"], qx.bom.element.AnimationCss.__onAnimationEnd);
};
if(desc.origin != null){
qx.bom.element.Transform.setOrigin(el, "");
};
qx.bom.element.AnimationCss.__keepFrame(el, desc.keyFrames[animation.keep]);
el.$$animation = null;
animation.el = null;
animation.ended = true;
animation.emit("end", el);
},
/**
* Helper method which takes an element and a key frame description and
* applies the properties defined in the given frame to the element. This
* method is used to keep the state of the animation.
* @param el {Element} The element to apply the frame to.
* @param endFrame {Map} The description of the end frame, which is basically
* a map containing CSS properties and values including transforms.
*/
__keepFrame : function(el, endFrame){
// keep the element at this animation step
var transforms;
for(var style in endFrame){
if(style in qx.bom.element.AnimationCss.__transitionKeys){
if(!transforms){
transforms = {
};
};
transforms[style] = endFrame[style];
} else {
el.style[qx.lang.String.camelCase(style)] = endFrame[style];
};
};
// transform keeping
if(transforms){
qx.bom.element.Transform.transform(el, transforms);
};
},
/**
* Preprocessing of the description to make sure every necessary key is
* set to its default.
* @param desc {Map} The description of the animation.
*/
__normalizeDesc : function(desc){
if(!desc.hasOwnProperty("alternate")){
desc.alternate = false;
};
if(!desc.hasOwnProperty("keep")){
desc.keep = null;
};
if(!desc.hasOwnProperty("repeat")){
desc.repeat = 1;
};
if(!desc.hasOwnProperty("timing")){
desc.timing = "linear";
};
if(!desc.hasOwnProperty("origin")){
desc.origin = null;
};
},
/**
* Debugging helper to validate the description.
* @signature function(desc)
* @param desc {Map} The description of the animation.
*/
__validateDesc : null,
/**
* Helper to add the given frames to an internal CSS stylesheet. It parses
* the description and adds the key frames to the sheet.
* @param frames {Map} A map of key frames that describe the animation.
* @param reverse {Boolean} <code>true</code>, if the key frames should
* be added in reverse order.
* @return {String} The generated name of the keyframes rule.
*/
__addKeyFrames : function(frames, reverse){
var rule = "";
// for each key frame
for(var position in frames){
rule += (reverse ? -(position - 100) : position) + "% {";
var frame = frames[position];
var transforms;
// each style
for(var style in frame){
if(style in this.__transitionKeys){
if(!transforms){
transforms = {
};
};
transforms[style] = frame[style];
} else {
rule += style + ":" + frame[style] + ";";
};
};
// transform handling
if(transforms){
rule += qx.bom.element.Transform.getCss(transforms);
};
rule += "} ";
};
// cached shorthand
if(this.__rules[rule]){
return this.__rules[rule];
};
var name = this.__rulePrefix + this.__id++;
var selector = this.__cssAnimationKeys["keyframes"] + " " + name;
qx.bom.Stylesheet.addRule(this.__sheet, selector, rule);
this.__rules[rule] = name;
return name;
}
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2011 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Martin Wittemann (wittemann)
************************************************************************ */
/* ************************************************************************
#ignore(qx.bom.element.AnimationJs)
************************************************************************ */
/**
* This is a simple handle, which will be returned when an animation is
* started using the {@link qx.bom.element.Animation#animate} method. It
* basically controls the animation.
*/
qx.Bootstrap.define("qx.bom.element.AnimationHandle", {
extend : qx.event.Emitter,
construct : function(){
var css = qx.core.Environment.get("css.animation");
this.__playState = css && css["play-state"];
this.__playing = true;
},
events : {
/** Fired when the animation started via {@link qx.bom.element.Animation}. */
"start" : "Element",
/**
* Fired when the animation started via {@link qx.bom.element.Animation} has
* ended.
*/
"end" : "Element",
/** Fired on every iteration of the animation. */
"iteration" : "Element"
},
members : {
__playState : null,
__playing : false,
__ended : false,
/**
* Accessor of the playing state.
* @return {Boolean} <code>true</code>, if the animations is playing.
*/
isPlaying : function(){
return this.__playing;
},
/**
* Accessor of the ended state.
* @return {Boolean} <code>true</code>, if the animations has ended.
*/
isEnded : function(){
return this.__ended;
},
/**
* Accessor of the paused state.
* @return {Boolean} <code>true</code>, if the animations is paused.
*/
isPaused : function(){
return this.el.style[this.__playState] == "paused";
},
/**
* Pauses the animation, if running. If not running, it will be ignored.
*/
pause : function(){
if(this.el){
this.el.style[this.__playState] = "paused";
this.el.$$animation.__playing = false;
// in case the animation is based on JS
if(this.animationId && qx.bom.element.AnimationJs){
qx.bom.element.AnimationJs.pause(this);
};
};
},
/**
* Resumes an animation. This does not start the animation once it has ended.
* You need to create start a new Animation if you want to restart the animation.
*/
play : function(){
if(this.el){
this.el.style[this.__playState] = "running";
this.el.$$animation.__playing = true;
// in case the animation is based on JS
if(this.i != undefined && qx.bom.element.AnimationJs){
qx.bom.element.AnimationJs.play(this);
};
};
},
/**
* Stops the animation if running.
*/
stop : function(){
if(this.el && qx.core.Environment.get("css.animation") && !this.animationId){
this.el.style[this.__playState] = "";
this.el.style[qx.core.Environment.get("css.animation").name] = "";
this.el.$$animation.__playing = false;
this.el.$$animation.__ended = true;
};
// in case the animation is based on JS
if(qx.bom.element.AnimationJs){
qx.bom.element.AnimationJs.stop(this);
};
}
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2004-2012 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Martin Wittemann (wittemann)
************************************************************************ */
/* ************************************************************************
#ignore(qx.bom.element.Style)
#use(qx.bom.element.AnimationJs#play)
************************************************************************ */
/**
* This class offers the same API as the CSS3 animation layer in
* {@link qx.bom.element.AnimationCss} but uses JavaScript to fake the behavior.
*
* {@link qx.bom.element.Animation} is the class, which takes care of the
* feature detection for CSS animations and decides which implementation
* (CSS or JavaScript) should be used. Most likely, this implementation should
* be the one to use.
*/
qx.Bootstrap.define("qx.bom.element.AnimationJs", {
statics : {
/**
* The maximal time a frame should take.
*/
__maxStepTime : 30,
/**
* The supported CSS units.
*/
__units : ["%", "in", "cm", "mm", "em", "ex", "pt", "pc", "px"],
/**
* This is the main function to start the animation. For further details,
* take a look at the documentation of the wrapper
* {@link qx.bom.element.Animation}.
* @param el {Element} The element to animate.
* @param desc {Map} Animation description.
* @param duration {Integer?} The duration of the animation which will
* override the duration given in the description.
* @return {qx.bom.element.AnimationHandle} The handle.
*/
animate : function(el, desc, duration){
return this._animate(el, desc, duration, false);
},
/**
* This is the main function to start the animation in reversed mode.
* For further details, take a look at the documentation of the wrapper
* {@link qx.bom.element.Animation}.
* @param el {Element} The element to animate.
* @param desc {Map} Animation description.
* @param duration {Integer?} The duration of the animation which will
* override the duration given in the description.
* @return {qx.bom.element.AnimationHandle} The handle.
*/
animateReverse : function(el, desc, duration){
return this._animate(el, desc, duration, true);
},
/**
* Helper to start the animation, either in reversed order or not.
*
* @param el {Element} The element to animate.
* @param desc {Map} Animation description.
* @param duration {Integer?} The duration of the animation which will
* override the duration given in the description.
* @param reverse {Boolean} <code>true</code>, if the animation should be
* reversed.
* @return {qx.bom.element.AnimationHandle} The handle.
*/
_animate : function(el, desc, duration, reverse){
// stop if an animation is already running
if(el.$$animation){
return el.$$animation;
};
desc = qx.lang.Object.clone(desc, true);
if(duration == undefined){
duration = desc.duration;
};
var keyFrames = desc.keyFrames;
var keys = this.__getOrderedKeys(keyFrames);
var stepTime = this.__getStepTime(duration, keys);
var steps = parseInt(duration / stepTime, 10);
this.__normalizeKeyFrames(keyFrames, el);
var delta = this.__calculateDelta(steps, stepTime, keys, keyFrames, duration, desc.timing);
var handle = new qx.bom.element.AnimationHandle();
if(reverse){
delta.reverse();
handle.reverse = true;
};
handle.desc = desc;
handle.el = el;
handle.delta = delta;
handle.stepTime = stepTime;
handle.steps = steps;
el.$$animation = handle;
handle.i = 0;
handle.initValues = {
};
handle.repeatSteps = this.__applyRepeat(steps, desc.repeat);
var delay = desc.delay || 0;
var self = this;
handle.delayId = window.setTimeout(function(){
handle.delayId = null;
self.play(handle);
}, delay);
return handle;
},
/**
* Try to normalize the keyFrames by adding the default / set values of the
* element.
* @param keyFrames {Map} The map of key frames.
* @param el {Element} The element to animate.
*/
__normalizeKeyFrames : function(keyFrames, el){
// collect all possible keys and its units
var units = {
};
for(var percent in keyFrames){
for(var name in keyFrames[percent]){
if(units[name] == undefined){
var item = keyFrames[percent][name];
if(typeof item == "string"){
units[name] = item.substring((parseInt(item, 10) + "").length, item.length);
} else {
units[name] = "";
};
};
};
};
// add all missing keys
for(var percent in keyFrames){
var frame = keyFrames[percent];
for(var name in units){
if(frame[name] == undefined){
if(name in el.style){
// get the computed style if possible
if(window.getComputedStyle){
frame[name] = getComputedStyle(el, null)[name];
} else {
frame[name] = el.style[name];
};
} else {
frame[name] = el[name];
};
// if its a unit we know, set 0 as fallback
if(frame[name] === "" && this.__units.indexOf(units[name]) != -1){
frame[name] = "0" + units[name];
};
};
};
};
},
/**
* Precalculation of the delta which will be applied during the animation.
* The whole deltas will be calculated prior to the animation and stored
* in a single array. This method takes care of that calculation.
*
* @param steps {Integer} The amount of steps to take to the end of the
* animation.
* @param stepTime {Integer} The amount of milliseconds each step takes.
* @param keys {Array} Ordered list of keys in the key frames map.
* @param keyFrames {Map} The map of key frames.
* @param duration {Integer} Time in milliseconds the animation should take.
* @param timing {String} The given timing function.
* @return {Array} An array containing the animation deltas.
*/
__calculateDelta : function(steps, stepTime, keys, keyFrames, duration, timing){
var delta = new Array(steps);
var keyIndex = 1;
delta[0] = keyFrames[0];
var last = keyFrames[0];
var next = keyFrames[keys[keyIndex]];
// for every step
for(var i = 1;i < delta.length;i++){
// switch key frames if we crossed a percent border
if(i * stepTime / duration * 100 > keys[keyIndex]){
last = next;
keyIndex++;
next = keyFrames[keys[keyIndex]];
};
delta[i] = {
};
// for every property
for(var name in next){
var nItem = next[name] + "";
// color values
if(nItem.charAt(0) == "#"){
// get the two values from the frames as RGB arrays
var value0 = qx.util.ColorUtil.cssStringToRgb(last[name]);
var value1 = qx.util.ColorUtil.cssStringToRgb(nItem);
var stepValue = [];
// calculate every color chanel
for(var j = 0;j < value0.length;j++){
var range = value0[j] - value1[j];
stepValue[j] = parseInt(value0[j] - range * qx.bom.AnimationFrame.calculateTiming(timing, i / steps), 10);
};
delta[i][name] = qx.util.ColorUtil.rgbToHexString(stepValue);
} else if(!isNaN(parseInt(nItem, 10))){
var unit = nItem.substring((parseInt(nItem, 10) + "").length, nItem.length);
var range = parseFloat(nItem) - parseFloat(last[name]);
delta[i][name] = (parseFloat(last[name]) + range * qx.bom.AnimationFrame.calculateTiming(timing, i / steps)) + unit;
} else {
delta[i][name] = last[name] + "";
};
};
};
// make sure the last key frame is right
delta[delta.length - 1] = keyFrames[100];
return delta;
},
/**
* Internal helper for the {@link qx.bom.element.AnimationHandle} to play
* the animation.
* @internal
* @param handle {qx.bom.element.AnimationHandle} The hand which
* represents the animation.
* @return {qx.bom.element.AnimationHandle} The handle for chaining.
*/
play : function(handle){
handle.emit("start", handle.el);
var id = window.setInterval(function(){
handle.repeatSteps--;
var values = handle.delta[handle.i % handle.steps];
// save the init values
if(handle.i === 0){
for(var name in values){
if(handle.initValues[name] === undefined){
// animate element property
if(handle.el[name] !== undefined){
handle.initValues[name] = handle.el[name];
} else if(qx.bom.element.Style){
handle.initValues[name] = qx.bom.element.Style.get(handle.el, qx.lang.String.camelCase(name));
} else {
handle.initValues[name] = handle.el.style[qx.lang.String.camelCase(name)];
};
};
};
};
qx.bom.element.AnimationJs.__applyStyles(handle.el, values);
handle.i++;
// iteration condition
if(handle.i % handle.steps == 0){
handle.emit("iteration", handle.el);
if(handle.desc.alternate){
handle.delta.reverse();
};
};
// end condition
if(handle.repeatSteps < 0){
qx.bom.element.AnimationJs.stop(handle);
};
}, handle.stepTime);
handle.animationId = id;
return handle;
},
/**
* Internal helper for the {@link qx.bom.element.AnimationHandle} to pause
* the animation.
* @internal
* @param handle {qx.bom.element.AnimationHandle} The hand which
* represents the animation.
* @return {qx.bom.element.AnimationHandle} The handle for chaining.
*/
pause : function(handle){
// stop the interval
window.clearInterval(handle.animationId);
handle.animationId = null;
return handle;
},
/**
* Internal helper for the {@link qx.bom.element.AnimationHandle} to stop
* the animation.
* @internal
* @param handle {qx.bom.element.AnimationHandle} The hand which
* represents the animation.
* @return {qx.bom.element.AnimationHandle} The handle for chaining.
*/
stop : function(handle){
var desc = handle.desc;
var el = handle.el;
var initValues = handle.initValues;
if(handle.animationId){
window.clearInterval(handle.animationId);
};
// clear the delay if the animation has not been started
if(handle.delayId){
window.clearTimeout(handle.delayId);
};
// check if animation is already stopped
if(el == undefined){
return handle;
};
// if we should keep a frame
var keep = desc.keep;
if(keep != undefined){
if(handle.reverse || (desc.alternate && desc.repeat && desc.repeat % 2 == 0)){
keep = 100 - keep;
};
this.__applyStyles(el, desc.keyFrames[keep]);
} else {
this.__applyStyles(el, initValues);
};
el.$$animation = null;
handle.el = null;
handle.ended = true;
handle.animationId = null;
handle.emit("end", el);
return handle;
},
/**
* Takes care of the repeat key of the description.
* @param steps {Integer} The number of steps one iteration would take.
* @param repeat {Integer|String} It can be either a number how often the
* animation should be repeated or the string 'infinite'.
* @return {Integer} The number of steps to animate.
*/
__applyRepeat : function(steps, repeat){
if(repeat == undefined){
return steps;
};
if(repeat == "infinite"){
return Number.MAX_VALUE;
};
return steps * repeat;
},
/**
* Central method to apply css styles and element properties.
* @param el {Element} The DOM element to apply the styles.
* @param styles {Map} A map containing styles and values.
*/
__applyStyles : function(el, styles){
for(var key in styles){
// ignore undefined values (might be a bad detection)
if(styles[key] === undefined){
continue;
};
// apply element property value
if(key in el){
el[key] = styles[key];
continue;
};
var name = qx.lang.String.camelCase(key);
if(qx.bom.element.Style){
qx.bom.element.Style.set(el, name, styles[key]);
} else {
el.style[name] = styles[key];
};
};
},
/**
* Dynamic calculation of the steps time considering a max step time.
* @param duration {Number} The duration of the animation.
* @param keys {Array} An array containing the orderd set of key frame keys.
* @return {Integer} The best suited step time.
*/
__getStepTime : function(duration, keys){
// get min difference
var minDiff = 100;
for(var i = 0;i < keys.length - 1;i++){
minDiff = Math.min(minDiff, keys[i + 1] - keys[i]);
};
var stepTime = duration * minDiff / 100;
while(stepTime > this.__maxStepTime){
stepTime = stepTime / 2;
};
return Math.round(stepTime);
},
/**
* Helper which returns the orderd keys of the key frame map.
* @param keyFrames {Map} The map of key frames.
* @return {Array} An orderd list of kyes.
*/
__getOrderedKeys : function(keyFrames){
var keys = Object.keys(keyFrames);
for(var i = 0;i < keys.length;i++){
keys[i] = parseInt(keys[i], 10);
};
keys.sort(function(a, b){
return a - b;
});
return keys;
}
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2004-2008 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Sebastian Werner (wpbasti)
* Andreas Ecker (ecker)
* Christian Hagendorn (cs)
************************************************************************ */
/* ************************************************************************
#ignore(qx.theme.*)
#ignore(qx.theme)
#ignore(qx.Class)
************************************************************************ */
/**
* Methods to convert colors between different color spaces.
*/
qx.Bootstrap.define("qx.util.ColorUtil", {
statics : {
/**
* Regular expressions for color strings
*/
REGEXP : {
hex3 : /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
hex6 : /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
rgb : /^rgb\(\s*([0-9]{1,3}\.{0,1}[0-9]*)\s*,\s*([0-9]{1,3}\.{0,1}[0-9]*)\s*,\s*([0-9]{1,3}\.{0,1}[0-9]*)\s*\)$/,
rgba : /^rgba\(\s*([0-9]{1,3}\.{0,1}[0-9]*)\s*,\s*([0-9]{1,3}\.{0,1}[0-9]*)\s*,\s*([0-9]{1,3}\.{0,1}[0-9]*)\s*,\s*([0-9]{1,3}\.{0,1}[0-9]*)\s*\)$/
},
/**
* CSS3 system color names.
*/
SYSTEM : {
activeborder : true,
activecaption : true,
appworkspace : true,
background : true,
buttonface : true,
buttonhighlight : true,
buttonshadow : true,
buttontext : true,
captiontext : true,
graytext : true,
highlight : true,
highlighttext : true,
inactiveborder : true,
inactivecaption : true,
inactivecaptiontext : true,
infobackground : true,
infotext : true,
menu : true,
menutext : true,
scrollbar : true,
threeddarkshadow : true,
threedface : true,
threedhighlight : true,
threedlightshadow : true,
threedshadow : true,
window : true,
windowframe : true,
windowtext : true
},
/**
* Named colors, only the 16 basic colors plus the following ones:
* transparent, grey, magenta, orange and brown
*/
NAMED : {
black : [0, 0, 0],
silver : [192, 192, 192],
gray : [128, 128, 128],
white : [255, 255, 255],
maroon : [128, 0, 0],
red : [255, 0, 0],
purple : [128, 0, 128],
fuchsia : [255, 0, 255],
green : [0, 128, 0],
lime : [0, 255, 0],
olive : [128, 128, 0],
yellow : [255, 255, 0],
navy : [0, 0, 128],
blue : [0, 0, 255],
teal : [0, 128, 128],
aqua : [0, 255, 255],
// Additional values
transparent : [-1, -1, -1],
magenta : [255, 0, 255],
// alias for fuchsia
orange : [255, 165, 0],
brown : [165, 42, 42]
},
/**
* Whether the incoming value is a named color.
*
* @param value {String} the color value to test
* @return {Boolean} true if the color is a named color
*/
isNamedColor : function(value){
return this.NAMED[value] !== undefined;
},
/**
* Whether the incoming value is a system color.
*
* @param value {String} the color value to test
* @return {Boolean} true if the color is a system color
*/
isSystemColor : function(value){
return this.SYSTEM[value] !== undefined;
},
/**
* Whether the color theme manager is loaded. Generally
* part of the GUI of qooxdoo.
*
* @return {Boolean} <code>true</code> when color theme support is ready.
**/
supportsThemes : function(){
if(qx.Class){
return qx.Class.isDefined("qx.theme.manager.Color");
};
return false;
},
/**
* Whether the incoming value is a themed color.
*
* @param value {String} the color value to test
* @return {Boolean} true if the color is a themed color
*/
isThemedColor : function(value){
if(!this.supportsThemes()){
return false;
};
if(qx.theme && qx.theme.manager && qx.theme.manager.Color){
return qx.theme.manager.Color.getInstance().isDynamic(value);
};
return false;
},
/**
* Try to convert an incoming string to an RGB array.
* Supports themed, named and system colors, but also RGB strings,
* hex3 and hex6 values.
*
* @param str {String} any string
* @return {Array} returns an array of red, green, blue on a successful transformation
* @throws {Error} if the string could not be parsed
*/
stringToRgb : function(str){
if(this.supportsThemes() && this.isThemedColor(str)){
var str = qx.theme.manager.Color.getInstance().resolveDynamic(str);
};
if(this.isNamedColor(str)){
return this.NAMED[str];
} else if(this.isSystemColor(str)){
throw new Error("Could not convert system colors to RGB: " + str);
} else if(this.isRgbString(str)){
return this.__rgbStringToRgb();
} else if(this.isHex3String(str)){
return this.__hex3StringToRgb();
} else if(this.isHex6String(str)){
return this.__hex6StringToRgb();
};;;;
throw new Error("Could not parse color: " + str);
},
/**
* Try to convert an incoming string to an RGB array.
* Support named colors, RGB strings, hex3 and hex6 values.
*
* @param str {String} any string
* @return {Array} returns an array of red, green, blue on a successful transformation
* @throws {Error} if the string could not be parsed
*/
cssStringToRgb : function(str){
if(this.isNamedColor(str)){
return this.NAMED[str];
} else if(this.isSystemColor(str)){
throw new Error("Could not convert system colors to RGB: " + str);
} else if(this.isRgbString(str)){
return this.__rgbStringToRgb();
} else if(this.isRgbaString(str)){
return this.__rgbaStringToRgb();
} else if(this.isHex3String(str)){
return this.__hex3StringToRgb();
} else if(this.isHex6String(str)){
return this.__hex6StringToRgb();
};;;;;
throw new Error("Could not parse color: " + str);
},
/**
* Try to convert an incoming string to an RGB string, which can be used
* for all color properties.
* Supports themed, named and system colors, but also RGB strings,
* hex3 and hex6 values.
*
* @param str {String} any string
* @return {String} a RGB string
* @throws {Error} if the string could not be parsed
*/
stringToRgbString : function(str){
return this.rgbToRgbString(this.stringToRgb(str));
},
/**
* Converts a RGB array to an RGB string
*
* @param rgb {Array} an array with red, green and blue
* @return {String} a RGB string
*/
rgbToRgbString : function(rgb){
return "rgb(" + rgb[0] + "," + rgb[1] + "," + rgb[2] + ")";
},
/**
* Converts a RGB array to an hex6 string
*
* @param rgb {Array} an array with red, green and blue
* @return {String} a hex6 string (#xxxxxx)
*/
rgbToHexString : function(rgb){
return ("#" + qx.lang.String.pad(rgb[0].toString(16).toUpperCase(), 2) + qx.lang.String.pad(rgb[1].toString(16).toUpperCase(), 2) + qx.lang.String.pad(rgb[2].toString(16).toUpperCase(), 2));
},
/**
* Detects if a string is a valid qooxdoo color
*
* @param str {String} any string
* @return {Boolean} true when the incoming value is a valid qooxdoo color
*/
isValidPropertyValue : function(str){
return (this.isThemedColor(str) || this.isNamedColor(str) || this.isHex3String(str) || this.isHex6String(str) || this.isRgbString(str) || this.isRgbaString(str));
},
/**
* Detects if a string is a valid CSS color string
*
* @param str {String} any string
* @return {Boolean} true when the incoming value is a valid CSS color string
*/
isCssString : function(str){
return (this.isSystemColor(str) || this.isNamedColor(str) || this.isHex3String(str) || this.isHex6String(str) || this.isRgbString(str) || this.isRgbaString(str));
},
/**
* Detects if a string is a valid hex3 string
*
* @param str {String} any string
* @return {Boolean} true when the incoming value is a valid hex3 string
*/
isHex3String : function(str){
return this.REGEXP.hex3.test(str);
},
/**
* Detects if a string is a valid hex6 string
*
* @param str {String} any string
* @return {Boolean} true when the incoming value is a valid hex6 string
*/
isHex6String : function(str){
return this.REGEXP.hex6.test(str);
},
/**
* Detects if a string is a valid RGB string
*
* @param str {String} any string
* @return {Boolean} true when the incoming value is a valid RGB string
*/
isRgbString : function(str){
return this.REGEXP.rgb.test(str);
},
/**
* Detects if a string is a valid RGBA string
*
* @param str {String} any string
* @return {Boolean} true when the incoming value is a valid RGBA string
*/
isRgbaString : function(str){
return this.REGEXP.rgba.test(str);
},
/**
* Converts a regexp object match of a rgb string to an RGB array.
*
* @return {Array} an array with red, green, blue
*/
__rgbStringToRgb : function(){
var red = parseInt(RegExp.$1, 10);
var green = parseInt(RegExp.$2, 10);
var blue = parseInt(RegExp.$3, 10);
return [red, green, blue];
},
/**
* Converts a regexp object match of a rgba string to an RGB array.
*
* @return {Array} an array with red, green, blue
*/
__rgbaStringToRgb : function(){
var red = parseInt(RegExp.$1, 10);
var green = parseInt(RegExp.$2, 10);
var blue = parseInt(RegExp.$3, 10);
return [red, green, blue];
},
/**
* Converts a regexp object match of a hex3 string to an RGB array.
*
* @return {Array} an array with red, green, blue
*/
__hex3StringToRgb : function(){
var red = parseInt(RegExp.$1, 16) * 17;
var green = parseInt(RegExp.$2, 16) * 17;
var blue = parseInt(RegExp.$3, 16) * 17;
return [red, green, blue];
},
/**
* Converts a regexp object match of a hex6 string to an RGB array.
*
* @return {Array} an array with red, green, blue
*/
__hex6StringToRgb : function(){
var red = (parseInt(RegExp.$1, 16) * 16) + parseInt(RegExp.$2, 16);
var green = (parseInt(RegExp.$3, 16) * 16) + parseInt(RegExp.$4, 16);
var blue = (parseInt(RegExp.$5, 16) * 16) + parseInt(RegExp.$6, 16);
return [red, green, blue];
},
/**
* Converts a hex3 string to an RGB array
*
* @param value {String} a hex3 (#xxx) string
* @return {Array} an array with red, green, blue
*/
hex3StringToRgb : function(value){
if(this.isHex3String(value)){
return this.__hex3StringToRgb(value);
};
throw new Error("Invalid hex3 value: " + value);
},
/**
* Converts a hex3 (#xxx) string to a hex6 (#xxxxxx) string.
*
* @param value {String} a hex3 (#xxx) string
* @return {String} The hex6 (#xxxxxx) string or the passed value when the
* passed value is not an hex3 (#xxx) value.
*/
hex3StringToHex6String : function(value){
if(this.isHex3String(value)){
return this.rgbToHexString(this.hex3StringToRgb(value));
};
return value;
},
/**
* Converts a hex6 string to an RGB array
*
* @param value {String} a hex6 (#xxxxxx) string
* @return {Array} an array with red, green, blue
*/
hex6StringToRgb : function(value){
if(this.isHex6String(value)){
return this.__hex6StringToRgb(value);
};
throw new Error("Invalid hex6 value: " + value);
},
/**
* Converts a hex string to an RGB array
*
* @param value {String} a hex3 (#xxx) or hex6 (#xxxxxx) string
* @return {Array} an array with red, green, blue
*/
hexStringToRgb : function(value){
if(this.isHex3String(value)){
return this.__hex3StringToRgb(value);
};
if(this.isHex6String(value)){
return this.__hex6StringToRgb(value);
};
throw new Error("Invalid hex value: " + value);
},
/**
* Convert RGB colors to HSB
*
* @param rgb {Number[]} red, blue and green as array
* @return {Array} an array with hue, saturation and brightness
*/
rgbToHsb : function(rgb){
var hue,saturation,brightness;
var red = rgb[0];
var green = rgb[1];
var blue = rgb[2];
var cmax = (red > green) ? red : green;
if(blue > cmax){
cmax = blue;
};
var cmin = (red < green) ? red : green;
if(blue < cmin){
cmin = blue;
};
brightness = cmax / 255.0;
if(cmax != 0){
saturation = (cmax - cmin) / cmax;
} else {
saturation = 0;
};
if(saturation == 0){
hue = 0;
} else {
var redc = (cmax - red) / (cmax - cmin);
var greenc = (cmax - green) / (cmax - cmin);
var bluec = (cmax - blue) / (cmax - cmin);
if(red == cmax){
hue = bluec - greenc;
} else if(green == cmax){
hue = 2.0 + redc - bluec;
} else {
hue = 4.0 + greenc - redc;
};
hue = hue / 6.0;
if(hue < 0){
hue = hue + 1.0;
};
};
return [Math.round(hue * 360), Math.round(saturation * 100), Math.round(brightness * 100)];
},
/**
* Convert HSB colors to RGB
*
* @param hsb {Number[]} an array with hue, saturation and brightness
* @return {Integer[]} an array with red, green, blue
*/
hsbToRgb : function(hsb){
var i,f,p,q,t;
var hue = hsb[0] / 360;
var saturation = hsb[1] / 100;
var brightness = hsb[2] / 100;
if(hue >= 1.0){
hue %= 1.0;
};
if(saturation > 1.0){
saturation = 1.0;
};
if(brightness > 1.0){
brightness = 1.0;
};
var tov = Math.floor(255 * brightness);
var rgb = {
};
if(saturation == 0.0){
rgb.red = rgb.green = rgb.blue = tov;
} else {
hue *= 6.0;
i = Math.floor(hue);
f = hue - i;
p = Math.floor(tov * (1.0 - saturation));
q = Math.floor(tov * (1.0 - (saturation * f)));
t = Math.floor(tov * (1.0 - (saturation * (1.0 - f))));
switch(i){case 0:
rgb.red = tov;
rgb.green = t;
rgb.blue = p;
break;case 1:
rgb.red = q;
rgb.green = tov;
rgb.blue = p;
break;case 2:
rgb.red = p;
rgb.green = tov;
rgb.blue = t;
break;case 3:
rgb.red = p;
rgb.green = q;
rgb.blue = tov;
break;case 4:
rgb.red = t;
rgb.green = p;
rgb.blue = tov;
break;case 5:
rgb.red = tov;
rgb.green = p;
rgb.blue = q;
break;};
};
return [rgb.red, rgb.green, rgb.blue];
},
/**
* Creates a random color.
*
* @return {String} a valid qooxdoo/CSS rgb color string.
*/
randomColor : function(){
var r = Math.round(Math.random() * 255);
var g = Math.round(Math.random() * 255);
var b = Math.round(Math.random() * 255);
return this.rgbToRgbString([r, g, b]);
}
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2004-2011 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Martin Wittemann (wittemann)
************************************************************************ */
/* ************************************************************************
#ignore(performance)
#ignore(performance.timing)
************************************************************************* */
/**
* This is a cross browser wrapper for requestAnimationFrame. For further
* information about the feature, take a look at spec:
* http://www.w3.org/TR/animation-timing/
*
* This class offers two ways of using this feature. First, the plain
* API the spec describes.
*
* Here is a sample usage:
* <pre class='javascript'>var start = +(new Date());
* var clb = function(time) {
* if (time >= start + duration) {
* // ... do some last tasks
* } else {
* var timePassed = time - start;
* // ... calculate the current step and apply it
* qx.bom.AnimationFrame.request(clb, this);
* }
* };
* qx.bom.AnimationFrame.request(clb, this);
* </pre>
*
* Another way of using it is to use it as an instance emitting events.
*
* Here is a sample usage of that API:
* <pre class='javascript'>var frame = new qx.bom.AnimationFrame();
* frame.on("end", function() {
* // ... do some last tasks
* }, this);
* frame.on("frame", function(timePassed) {
* // ... calculate the current step and apply it
* }, this);
* frame.startSequence(duration);
* </pre>
*/
qx.Bootstrap.define("qx.bom.AnimationFrame", {
extend : qx.event.Emitter,
events : {
/** Fired as soon as the animation has ended. */
"end" : undefined,
/** Fired on every frame having the passed time as value. */
"frame" : "Number"
},
members : {
/**
* Method used to start a series of animation frames. The series will end as
* soon as the given duration is over.
*
* @param duration {Number} The duration the sequence should take.
*/
startSequence : function(duration){
var start = +(new Date());
var clb = function(){
var time = +(new Date());
// final call
if(time >= start + duration){
this.emit("end");
this.id = null;
} else {
var timePassed = time - start;
this.emit("frame", timePassed);
this.id = qx.bom.AnimationFrame.request(clb, this);
};
};
this.id = qx.bom.AnimationFrame.request(clb, this);
}
},
statics : {
/**
* The default time in ms the timeout fallback implementation uses.
*/
TIMEOUT : 30,
/**
* Calculation of the predefined timing functions. Approximation of the real
* bezier curves has ben used for easier calculation. This is good and close
* enough for the predefined functions like <code>ease</code> or
* <code>linear</code>.
*
* @param func {String} The defined timing function. One of the following values:
* <code>"ease-in"</code>, <code>"ease-out"</code>, <code>"linear"</code>,
* <code>"ease-in-out"</code>, <code>"ease"</code>.
* @param x {Integer} The percent value of the function.
* @return {Integer} The calculated value
*/
calculateTiming : function(func, x){
if(func == "ease-in"){
var a = [3.1223e-7, 0.0757, 1.2646, -0.167, -0.4387, 0.2654];
} else if(func == "ease-out"){
var a = [-7.0198e-8, 1.652, -0.551, -0.0458, 0.1255, -0.1807];
} else if(func == "linear"){
return x;
} else if(func == "ease-in-out"){
var a = [2.482e-7, -0.2289, 3.3466, -1.0857, -1.7354, 0.7034];
} else {
// default is 'ease'
var a = [-0.0021, 0.2472, 9.8054, -21.6869, 17.7611, -5.1226];
};;;
// A 6th grade polynomial has been used as approximation of the original
// bezier curves described in the transition spec
// http://www.w3.org/TR/css3-transitions/#transition-timing-function_tag
// (the same is used for animations as well)
var y = 0;
for(var i = 0;i < a.length;i++){
y += a[i] * Math.pow(x, i);
};
return y;
},
/**
* Request for an animation frame. If the native <code>requestAnimationFrame</code>
* method is supported, it will be used. Otherwise, we use timeouts with a
* 30ms delay.
* @param callback {Function} The callback function which will get the current
* time as argument.
* @param context {var} The context of the callback.
* @return {Number} The id of the request.
*/
request : function(callback, context){
var req = qx.core.Environment.get("css.animation.requestframe");
var clb = function(){
var time = +(new Date());
callback.call(context, time);
};
if(req){
return window[req](clb);
} else {
// make sure to use an indirection because setTimeout passes a
// number as first argument as well
return window.setTimeout(function(){
clb();
}, qx.bom.AnimationFrame.TIMEOUT);
};
}
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2009 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Fabian Jakobs (fjakobs)
* Christian Hagendorn (chris_schmidt)
************************************************************************ */
/**
* Abstract class to compute the position of an object on one axis.
*/
qx.Bootstrap.define("qx.util.placement.AbstractAxis", {
extend : Object,
statics : {
/**
* Computes the start of the object on the axis
*
* @param size {Integer} Size of the object to align
* @param target {Map} Location of the object to align the object to. This map
* should have the keys <code>start</code> and <code>end</code>.
* @param offsets {Map} Map with all offsets on each side.
* Comes with the keys <code>start</code> and <code>end</code>.
* @param areaSize {Integer} Size of the axis.
* @param position {String} Alignment of the object on the target. Valid values are
* <ul>
* <li><code>edge-start</code> The object is placed before the target</li>
* <li><code>edge-end</code> The object is placed after the target</li>
* <li><code>align-start</code>The start of the object is aligned with the start of the target</li>
* <li><code>align-center</code>The center of the object is aligned with the center of the target</li>
* <li><code>align-end</code>The end of the object is aligned with the end of the object</li>
* </ul>
* @return {Integer} The computed start position of the object.
* @abstract
*/
computeStart : function(size, target, offsets, areaSize, position){
throw new Error("abstract method call!");
},
/**
* Computes the start of the object by taking only the attachment and
* alignment into account. The object by be not fully visible.
*
* @param size {Integer} Size of the object to align
* @param target {Map} Location of the object to align the object to. This map
* should have the keys <code>start</code> and <code>end</code>.
* @param offsets {Map} Map with all offsets on each side.
* Comes with the keys <code>start</code> and <code>end</code>.
* @param position {String} Accepts the same values as the <code> position</code>
* argument of {@link #computeStart}.
* @return {Integer} The computed start position of the object.
*/
_moveToEdgeAndAlign : function(size, target, offsets, position){
switch(position){case "edge-start":
return target.start - offsets.end - size;case "edge-end":
return target.end + offsets.start;case "align-start":
return target.start + offsets.start;case "align-center":
return target.start + parseInt((target.end - target.start - size) / 2, 10) + offsets.start;case "align-end":
return target.end - offsets.end - size;};
},
/**
* Whether the object specified by <code>start</code> and <code>size</code>
* is completely inside of the axis' range..
*
* @param start {Integer} Computed start position of the object
* @param size {Integer} Size of the object
* @param areaSize {Integer} The size of the axis
* @return {Boolean} Whether the object is inside of the axis' range
*/
_isInRange : function(start, size, areaSize){
return start >= 0 && start + size <= areaSize;
}
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2009 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Fabian Jakobs (fjakobs)
* Christian Hagendorn (chris_schmidt)
************************************************************************ */
/**
* Places the object directly at the specified position. It is not moved if
* parts of the object are outside of the axis' range.
*/
qx.Bootstrap.define("qx.util.placement.DirectAxis", {
statics : {
/**
* Computes the start of the object by taking only the attachment and
* alignment into account. The object by be not fully visible.
*
* @param size {Integer} Size of the object to align
* @param target {Map} Location of the object to align the object to. This map
* should have the keys <code>start</code> and <code>end</code>.
* @param offsets {Map} Map with all offsets on each side.
* Comes with the keys <code>start</code> and <code>end</code>.
* @param position {String} Accepts the same values as the <code> position</code>
* argument of {@link #computeStart}.
* @return {Integer} The computed start position of the object.
*/
_moveToEdgeAndAlign : qx.util.placement.AbstractAxis._moveToEdgeAndAlign,
/**
* Computes the start of the object on the axis
*
* @param size {Integer} Size of the object to align
* @param target {Map} Location of the object to align the object to. This map
* should have the keys <code>start</code> and <code>end</code>.
* @param offsets {Map} Map with all offsets on each side.
* Comes with the keys <code>start</code> and <code>end</code>.
* @param areaSize {Integer} Size of the axis.
* @param position {String} Alignment of the object on the target. Valid values are
* <ul>
* <li><code>edge-start</code> The object is placed before the target</li>
* <li><code>edge-end</code> The object is placed after the target</li>
* <li><code>align-start</code>The start of the object is aligned with the start of the target</li>
* <li><code>align-center</code>The center of the object is aligned with the center of the target</li>
* <li><code>align-end</code>The end of the object is aligned with the end of the object</li>
* </ul>
* @return {Integer} The computed start position of the object.
*/
computeStart : function(size, target, offsets, areaSize, position){
return this._moveToEdgeAndAlign(size, target, offsets, position);
}
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2009 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Fabian Jakobs (fjakobs)
* Christian Hagendorn (chris_schmidt)
************************************************************************ */
/**
* Places the object to the target. If parts of the object are outside of the
* range this class places the object at the best "edge", "alignment"
* combination so that the overlap between object and range is maximized.
*/
qx.Bootstrap.define("qx.util.placement.KeepAlignAxis", {
statics : {
/**
* Computes the start of the object by taking only the attachment and
* alignment into account. The object by be not fully visible.
*
* @param size {Integer} Size of the object to align
* @param target {Map} Location of the object to align the object to. This map
* should have the keys <code>start</code> and <code>end</code>.
* @param offsets {Map} Map with all offsets on each side.
* Comes with the keys <code>start</code> and <code>end</code>.
* @param position {String} Accepts the same values as the <code> position</code>
* argument of {@link #computeStart}.
* @return {Integer} The computed start position of the object.
*/
_moveToEdgeAndAlign : qx.util.placement.AbstractAxis._moveToEdgeAndAlign,
/**
* Whether the object specified by <code>start</code> and <code>size</code>
* is completely inside of the axis' range..
*
* @param start {Integer} Computed start position of the object
* @param size {Integer} Size of the object
* @param areaSize {Integer} The size of the axis
* @return {Boolean} Whether the object is inside of the axis' range
*/
_isInRange : qx.util.placement.AbstractAxis._isInRange,
/**
* Computes the start of the object on the axis
*
* @param size {Integer} Size of the object to align
* @param target {Map} Location of the object to align the object to. This map
* should have the keys <code>start</code> and <code>end</code>.
* @param offsets {Map} Map with all offsets on each side.
* Comes with the keys <code>start</code> and <code>end</code>.
* @param areaSize {Integer} Size of the axis.
* @param position {String} Alignment of the object on the target. Valid values are
* <ul>
* <li><code>edge-start</code> The object is placed before the target</li>
* <li><code>edge-end</code> The object is placed after the target</li>
* <li><code>align-start</code>The start of the object is aligned with the start of the target</li>
* <li><code>align-center</code>The center of the object is aligned with the center of the target</li>
* <li><code>align-end</code>The end of the object is aligned with the end of the object</li>
* </ul>
* @return {Integer} The computed start position of the object.
*/
computeStart : function(size, target, offsets, areaSize, position){
var start = this._moveToEdgeAndAlign(size, target, offsets, position);
var range1End,range2Start;
if(this._isInRange(start, size, areaSize)){
return start;
};
if(position == "edge-start" || position == "edge-end"){
range1End = target.start - offsets.end;
range2Start = target.end + offsets.start;
} else {
range1End = target.end - offsets.end;
range2Start = target.start + offsets.start;
};
if(range1End > areaSize - range2Start){
start = range1End - size;
} else {
start = range2Start;
};
return start;
}
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2009 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Fabian Jakobs (fjakobs)
* Christian Hagendorn (chris_schmidt)
************************************************************************ */
/**
* Places the object according to the target. If parts of the object are outside
* of the axis' range the object's start is adjusted so that the overlap between
* the object and the axis is maximized.
*/
qx.Bootstrap.define("qx.util.placement.BestFitAxis", {
statics : {
/**
* Whether the object specified by <code>start</code> and <code>size</code>
* is completely inside of the axis' range..
*
* @param start {Integer} Computed start position of the object
* @param size {Integer} Size of the object
* @param areaSize {Integer} The size of the axis
* @return {Boolean} Whether the object is inside of the axis' range
*/
_isInRange : qx.util.placement.AbstractAxis._isInRange,
/**
* Computes the start of the object by taking only the attachment and
* alignment into account. The object by be not fully visible.
*
* @param size {Integer} Size of the object to align
* @param target {Map} Location of the object to align the object to. This map
* should have the keys <code>start</code> and <code>end</code>.
* @param offsets {Map} Map with all offsets on each side.
* Comes with the keys <code>start</code> and <code>end</code>.
* @param position {String} Accepts the same values as the <code> position</code>
* argument of {@link #computeStart}.
* @return {Integer} The computed start position of the object.
*/
_moveToEdgeAndAlign : qx.util.placement.AbstractAxis._moveToEdgeAndAlign,
/**
* Computes the start of the object on the axis
*
* @param size {Integer} Size of the object to align
* @param target {Map} Location of the object to align the object to. This map
* should have the keys <code>start</code> and <code>end</code>.
* @param offsets {Map} Map with all offsets on each side.
* Comes with the keys <code>start</code> and <code>end</code>.
* @param areaSize {Integer} Size of the axis.
* @param position {String} Alignment of the object on the target. Valid values are
* <ul>
* <li><code>edge-start</code> The object is placed before the target</li>
* <li><code>edge-end</code> The object is placed after the target</li>
* <li><code>align-start</code>The start of the object is aligned with the start of the target</li>
* <li><code>align-center</code>The center of the object is aligned with the center of the target</li>
* <li><code>align-end</code>The end of the object is aligned with the end of the object</li>
* </ul>
* @return {Integer} The computed start position of the object.
*/
computeStart : function(size, target, offsets, areaSize, position){
var start = this._moveToEdgeAndAlign(size, target, offsets, position);
if(this._isInRange(start, size, areaSize)){
return start;
};
if(start < 0){
start = Math.min(0, areaSize - size);
};
if(start + size > areaSize){
start = Math.max(0, areaSize - size);
};
return start;
}
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2012 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Daniel Wagner (danielwagner)
************************************************************************ */
/* ************************************************************************
#require(qx.util.placement.KeepAlignAxis#computeStart)
#require(qx.util.placement.BestFitAxis#computeStart)
#require(qx.util.placement.DirectAxis#computeStart)
************************************************************************ */
/**
* The Placement module provides a convenient way to align two elements relative
* to each other using various pre-defined algorithms.
*/
qxWeb.define("qx.module.Placement", {
statics : {
/**
* Moves the first element in the collection, aligning it with the given
* target.
*
* @attach{qxWeb}
* @param target {Element} Placement target
* @param position {String} Alignment of the object with the target, any of
* <code>"top-left"</code>, <code>"top-center"</code>, <code>"top-right"</code>,
* <code>"bottom-left"</code>, <code>"bottom-center"</code>, <code>"bottom-right"</code>,
* <code>"left-top"</code>, <code>"left-middle"</code>, <code>"left-bottom"</code>,
* <code>"right-top"</code>, <code>"right-middle"</code>, <code>"right-bottom"</code>
* @param offsets {Map?null} Map with the desired offsets between the two elements.
* Must contain the keys <code>left</code>, <code>top</code>,
* <code>right</code> and <code>bottom</code>
* @param modeX {String?"direct"} Horizontal placement mode. Valid values are:
* <ul>
* <li><code>direct</code>: place the element directly at the given
* location.</li>
* <li><code>keep-align</code>: if the element is partially outside of the
* visible area, it is moved to the best fitting 'edge' and 'alignment' of
* the target.
* It is guaranteed the the new position attaches the object to one of the
* target edges and that it is aligned with a target edge.</li>
* <li><code>best-fit</code>: If the element is partially outside of the visible
* area, it is moved into the view port, ignoring any offset and position
* values.</li>
* </ul>
* @param modeY {String?"direct"} Vertical placement mode. Accepts the same values as
* the 'modeX' argument.
* @return {qxWeb} The collection for chaining
*/
placeTo : function(target, position, offsets, modeX, modeY){
if(!this[0]){
return null;
};
var axes = {
x : qx.module.Placement._getAxis(modeX),
y : qx.module.Placement._getAxis(modeY)
};
var size = {
width : this.getWidth(),
height : this.getHeight()
};
var parent = this.getParents();
var area = {
width : parent.getWidth(),
height : parent.getHeight()
};
var target = qxWeb(target).getOffset();
var offsets = offsets || {
top : 0,
right : 0,
bottom : 0,
left : 0
};
var splitted = position.split("-");
var edge = splitted[0];
var align = splitted[1];
var position = {
x : qx.module.Placement._getPositionX(edge, align),
y : qx.module.Placement._getPositionY(edge, align)
};
var newLocation = qx.module.Placement._computePlacement(axes, size, area, target, offsets, position);
this.setStyles({
position : "absolute",
left : newLocation.left + "px",
top : newLocation.top + "px"
});
return this;
},
/**
* Returns the appropriate axis implementation for the given placement
* mode
*
* @param mode {String} Placement mode
* @return {Object} Placement axis class
*/
_getAxis : function(mode){
switch(mode){case "keep-align":
return qx.util.placement.KeepAlignAxis;case "best-fit":
return qx.util.placement.BestFitAxis;case "direct":default:
return qx.util.placement.DirectAxis;};
},
/**
* Returns the computed coordinates for the element to be placed
*
* @param axes {Map} Map with the keys <code>x</code> and <code>y</code>. Values
* are the axis implementations
* @param size {Map} Map with the keys <code>width</code> and <code>height</code>
* containing the size of the placement target
* @param area {Map} Map with the keys <code>width</code> and <code>height</code>
* containing the size of the two elements' common parent (available space for
* placement)
* @param target {qxWeb} Collection containing the placement target
* @param offsets {Map} Map of offsets (top, right, bottom, left)
* @param position {Map} Map with the keys <code>x</code> and <code>y</code>,
* containing the type of positioning for each axis
* @return {Map} Map with the keys <code>left</code> and <code>top</code>
* containing the computed coordinates to which the element should be moved
*/
_computePlacement : function(axes, size, area, target, offsets, position){
var left = axes.x.computeStart(size.width, {
start : target.left,
end : target.right
}, {
start : offsets.left,
end : offsets.right
}, area.width, position.x);
var top = axes.y.computeStart(size.height, {
start : target.top,
end : target.bottom
}, {
start : offsets.top,
end : offsets.bottom
}, area.height, position.y);
return {
left : left,
top : top
};
},
/**
* Returns the X axis positioning type for the given edge and alignment
* values
*
* @param edge {String} edge value
* @param align {String} align value
* @return {String} X positioning type
*/
_getPositionX : function(edge, align){
if(edge == "left"){
return "edge-start";
} else if(edge == "right"){
return "edge-end";
} else if(align == "left"){
return "align-start";
} else if(align == "right"){
return "align-end";
};;;
},
/**
* Returns the Y axis positioning type for the given edge and alignment
* values
*
* @param edge {String} edge value
* @param align {String} align value
* @return {String} Y positioning type
*/
_getPositionY : function(edge, align){
if(edge == "top"){
return "edge-start";
} else if(edge == "bottom"){
return "edge-end";
} else if(align == "top"){
return "align-start";
} else if(align == "bottom"){
return "align-end";
};;;
}
},
defer : function(statics){
qxWeb.$attach({
"placeTo" : statics.placeTo
});
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2012 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Daniel Wagner (danielwagner)
************************************************************************ */
/* ************************************************************************
#require(qx.module.Event)
************************************************************************ */
/**
* Creates a touch event handler that fires high-level events such as "swipe"
* based on low-level event sequences on the given element
*/
qx.Bootstrap.define("qx.module.event.TouchHandler", {
statics : {
/**
* List of events that require a touch handler
* @type {Array}
*/
TYPES : ["tap", "swipe"],
/**
* Creates a touch handler for the given element when a touch event listener
* is attached to it
*
* @param element {Element} DOM element
*/
register : function(element){
if(!element.__touchHandler){
if(!element.__emitter){
element.__emitter = new qx.event.Emitter();
};
element.__touchHandler = new qx.event.handler.TouchCore(element, element.__emitter);
};
},
/**
* Removes the touch event handler from the element if there are no more
* touch event listeners attached to it
* @param element {Element} DOM element
*/
unregister : function(element){
if(element.__touchHandler){
if(!element.__emitter){
element.__touchHandler = null;
} else {
var hasTouchListener = false;
var listeners = element.__emitter.getListeners();
qx.module.event.TouchHandler.TYPES.forEach(function(type){
if(type in listeners && listeners[type].length > 0){
hasTouchListener = true;
};
});
if(!hasTouchListener){
element.__touchHandler = null;
};
};
};
}
},
defer : function(statics){
qxWeb.$registerEventHook(statics.TYPES, statics.register, statics.unregister);
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2004-2012 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Martin Wittemann (martinwittemann)
* Tino Butz (tbtz)
* Christian Hagendorn (chris_schmidt)
* Daniel Wagner (danielwagner)
************************************************************************ */
/* ************************************************************************
#ignore(qx.event.type.Tap)
#ignore(qx.event.type.Swipe)
#ignore(qx.event.type)
#ignore(qx.event)
************************************************************************ */
/**
* Listens for native touch events and fires composite events like "tap" and
* "swipe"
*/
qx.Bootstrap.define("qx.event.handler.TouchCore", {
extend : Object,
statics : {
/** {Integer} The maximum distance of a tap. Only if the x or y distance of
* the performed tap is less or equal the value of this constant, a tap
* event is fired.
*/
TAP_MAX_DISTANCE : qx.core.Environment.get("os.name") != "android" ? 10 : 40,
/** {Map} The direction of a swipe relative to the axis */
SWIPE_DIRECTION : {
x : ["left", "right"],
y : ["up", "down"]
},
/** {Integer} The minimum distance of a swipe. Only if the x or y distance
* of the performed swipe is greater as or equal the value of this
* constant, a swipe event is fired.
*/
SWIPE_MIN_DISTANCE : qx.core.Environment.get("os.name") != "android" ? 11 : 41,
/** {Integer} The minimum velocity of a swipe. Only if the velocity of the
* performed swipe is greater as or equal the value of this constant, a
* swipe event is fired.
*/
SWIPE_MIN_VELOCITY : 0
},
/**
* Create a new instance
*
* @param target {Element} element on which to listen for native touch events
* @param emitter {qx.event.Emitter} Event emitter object
*/
construct : function(target, emitter){
this.__target = target;
this.__emitter = emitter;
this._initTouchObserver();
},
members : {
__target : null,
__emitter : null,
__onTouchEventWrapper : null,
__originalTarget : null,
__startPageX : null,
__startPageY : null,
__startTime : null,
__isSingleTouchGesture : null,
__onMove : null,
/*
---------------------------------------------------------------------------
OBSERVER INIT
---------------------------------------------------------------------------
*/
/**
* Initializes the native touch event listeners.
*/
_initTouchObserver : function(){
this.__onTouchEventWrapper = qx.lang.Function.listener(this._onTouchEvent, this);
var Event = qx.bom.Event;
Event.addNativeListener(this.__target, "touchstart", this.__onTouchEventWrapper);
Event.addNativeListener(this.__target, "touchmove", this.__onTouchEventWrapper);
Event.addNativeListener(this.__target, "touchend", this.__onTouchEventWrapper);
Event.addNativeListener(this.__target, "touchcancel", this.__onTouchEventWrapper);
if(qx.core.Environment.get("event.mspointer")){
Event.addNativeListener(this.__target, "MSPointerDown", this.__onTouchEventWrapper);
Event.addNativeListener(this.__target, "MSPointerMove", this.__onTouchEventWrapper);
Event.addNativeListener(this.__target, "MSPointerUp", this.__onTouchEventWrapper);
Event.addNativeListener(this.__target, "MSPointerCancel", this.__onTouchEventWrapper);
};
},
/*
---------------------------------------------------------------------------
OBSERVER STOP
---------------------------------------------------------------------------
*/
/**
* Disconnects the native touch event listeners.
*/
_stopTouchObserver : function(){
var Event = qx.bom.Event;
Event.removeNativeListener(this.__target, "touchstart", this.__onTouchEventWrapper);
Event.removeNativeListener(this.__target, "touchmove", this.__onTouchEventWrapper);
Event.removeNativeListener(this.__target, "touchend", this.__onTouchEventWrapper);
Event.removeNativeListener(this.__target, "touchcancel", this.__onTouchEventWrapper);
if(qx.core.Environment.get("event.mspointer")){
Event.removeNativeListener(this.__target, "MSPointerDown", this.__onTouchEventWrapper);
Event.removeNativeListener(this.__target, "MSPointerMove", this.__onTouchEventWrapper);
Event.removeNativeListener(this.__target, "MSPointerUp", this.__onTouchEventWrapper);
Event.removeNativeListener(this.__target, "MSPointerCancel", this.__onTouchEventWrapper);
};
},
/*
---------------------------------------------------------------------------
NATIVE EVENT OBSERVERS
---------------------------------------------------------------------------
*/
/**
* Handler for native touch events.
*
* @param domEvent {Event} The touch event from the browser.
*/
_onTouchEvent : function(domEvent){
this._commonTouchEventHandler(domEvent);
},
/**
* Called by an event handler.
*
* @param domEvent {Event} DOM event
* @param type {String ? null} type of the event
*/
_commonTouchEventHandler : function(domEvent, type){
var type = type || domEvent.type;
if(qx.core.Environment.get("event.mspointer")){
domEvent.changedTouches = [domEvent];
domEvent.targetTouches = [domEvent];
domEvent.touches = [domEvent];
if(type == "MSPointerDown"){
type = "touchstart";
} else if(type == "MSPointerUp"){
type = "touchend";
} else if(type == "MSPointerMove"){
if(this.__onMove == true){
type = "touchmove";
};
} else if(type == "MSPointerCancel"){
type = "touchcancel";
};;;
};
if(type == "touchstart"){
this.__originalTarget = this._getTarget(domEvent);
};
this._fireEvent(domEvent, type);
this.__checkAndFireGesture(domEvent, type);
},
/*
---------------------------------------------------------------------------
HELPERS
---------------------------------------------------------------------------
*/
/**
* Return the target of the event.
*
* @param domEvent {Event} DOM event
* @return {Element} Event target
*/
_getTarget : function(domEvent){
var target = qx.bom.Event.getTarget(domEvent);
// Text node. Fix Safari Bug, see http://www.quirksmode.org/js/events_properties.html
if(qx.core.Environment.get("engine.name") == "webkit"){
if(target && target.nodeType == 3){
target = target.parentNode;
};
} else if(qx.core.Environment.get("event.mspointer")){
// Fix for IE10 and pointer-events:none
var targetForIE = this.__evaluateTarget(domEvent);
if(targetForIE){
target = targetForIE;
};
};
return target;
},
/**
* This method fixes "pointer-events:none" for Internet Explorer 10.
* Checks which elements are placed to position x/y and traverses the array
* till one element has no "pointer-events:none" inside its style attribute.
* @param domEvent {Event} DOM event
* @return {Element | null} Event target
*/
__evaluateTarget : function(domEvent){
if(domEvent && domEvent.touches){
var clientX = domEvent.touches[0].clientX;
var clientY = domEvent.touches[0].clientY;
};
// Retrieve an array with elements on point X/Y.
var hitTargets = document.msElementsFromPoint(clientX, clientY);
if(hitTargets){
// Traverse this array for the elements which has no pointer-events:none inside.
for(var i = 0;i < hitTargets.length;i++){
var currentTarget = hitTargets[i];
var pointerEvents = qx.bom.element.Style.get(currentTarget, "pointer-events", 3);
if(pointerEvents != "none"){
return currentTarget;
};
};
};
return null;
},
/**
* Fire a touch event with the given parameters
*
* @param domEvent {Event} DOM event
* @param type {String ? null} type of the event
* @param target {Element ? null} event target
*/
_fireEvent : function(domEvent, type, target){
if(!target){
target = this._getTarget(domEvent);
};
var type = type || domEvent.type;
if(target && target.nodeType && this.__emitter){
this.__emitter.emit(type, domEvent);
};
},
/**
* Checks if a gesture was made and fires the gesture event.
*
* @param domEvent {Event} DOM event
* @param type {String ? null} type of the event
* @param target {Element ? null} event target
*/
__checkAndFireGesture : function(domEvent, type, target){
if(!target){
target = this._getTarget(domEvent);
};
var type = type || domEvent.type;
if(type == "touchstart"){
this.__gestureStart(domEvent, target);
} else if(type == "touchmove"){
this.__gestureChange(domEvent, target);
} else if(type == "touchend"){
this.__gestureEnd(domEvent, target);
};;
},
/**
* Helper method for gesture start.
*
* @param domEvent {Event} DOM event
* @param target {Element} event target
*/
__gestureStart : function(domEvent, target){
var touch = domEvent.changedTouches[0];
this.__onMove = true;
this.__startPageX = touch.screenX;
this.__startPageY = touch.screenY;
this.__startTime = new Date().getTime();
this.__isSingleTouchGesture = domEvent.changedTouches.length === 1;
},
/**
* Helper method for gesture change.
*
* @param domEvent {Event} DOM event
* @param target {Element} event target
*/
__gestureChange : function(domEvent, target){
// Abort a single touch gesture when another touch occurs.
if(this.__isSingleTouchGesture && domEvent.changedTouches.length > 1){
this.__isSingleTouchGesture = false;
};
},
/**
* Helper method for gesture end.
*
* @param domEvent {Event} DOM event
* @param target {Element} event target
*/
__gestureEnd : function(domEvent, target){
this.__onMove = false;
if(this.__isSingleTouchGesture){
var touch = domEvent.changedTouches[0];
var deltaCoordinates = {
x : touch.screenX - this.__startPageX,
y : touch.screenY - this.__startPageY
};
var clazz = qx.event.handler.TouchCore;
var eventType;
if(this.__originalTarget == target && Math.abs(deltaCoordinates.x) <= clazz.TAP_MAX_DISTANCE && Math.abs(deltaCoordinates.y) <= clazz.TAP_MAX_DISTANCE){
if(qx.event && qx.event.type && qx.event.type.Tap){
eventType = qx.event.type.Tap;
};
this._fireEvent(domEvent, "tap", target, eventType);
} else {
var swipe = this.__getSwipeGesture(domEvent, target, deltaCoordinates);
if(swipe){
if(qx.event && qx.event.type && qx.event.type.Swipe){
eventType = qx.event.type.Swipe;
};
domEvent.swipe = swipe;
this._fireEvent(domEvent, "swipe", target, eventType);
};
};
};
},
/**
* Returns the swipe gesture when the user performed a swipe.
*
* @param domEvent {Event} DOM event
* @param target {Element} event target
* @param deltaCoordinates {Map} delta x/y coordinates since the gesture started.
* @return {Map} returns the swipe data when the user performed a swipe, null if the gesture was no swipe.
*/
__getSwipeGesture : function(domEvent, target, deltaCoordinates){
var clazz = qx.event.handler.TouchCore;
var duration = new Date().getTime() - this.__startTime;
var axis = (Math.abs(deltaCoordinates.x) >= Math.abs(deltaCoordinates.y)) ? "x" : "y";
var distance = deltaCoordinates[axis];
var direction = clazz.SWIPE_DIRECTION[axis][distance < 0 ? 0 : 1];
var velocity = (duration !== 0) ? distance / duration : 0;
var swipe = null;
if(Math.abs(velocity) >= clazz.SWIPE_MIN_VELOCITY && Math.abs(distance) >= clazz.SWIPE_MIN_DISTANCE){
swipe = {
startTime : this.__startTime,
duration : duration,
axis : axis,
direction : direction,
distance : distance,
velocity : velocity
};
};
return swipe;
},
/**
* Dispose this object
*/
dispose : function(){
this._stopTouchObserver();
this.__originalTarget = this.__target = this.__emitter = null;
}
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2012 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Daniel Wagner (danielwagner)
************************************************************************ */
/* ************************************************************************
#require(qx.module.Event)
************************************************************************ */
/**
* Normalization for orientationchange events
* Example:
* <pre class="javascript">
* q(window).on("orientationchange", function(ev) {
* ev.getOrientation();
* ev.isLandscape();
* });
* </pre>
*/
qx.Bootstrap.define("qx.module.event.Orientation", {
statics : {
/**
* List of event types to be normalized
*/
TYPES : ["orientationchange"],
/**
* List of qx.module.event.Orientation methods to be attached to native
* event objects
* @internal
*/
BIND_METHODS : ["getOrientation", "isLandscape", "isPortrait"],
/**
* Returns the current orientation of the viewport in degrees.
*
* All possible values and their meaning:
*
* * <code>0</code>: "Portrait"
* * <code>-90</code>: "Landscape (right, screen turned clockwise)"
* * <code>90</code>: "Landscape (left, screen turned counterclockwise)"
* * <code>180</code>: "Portrait (upside-down portrait)"
*
* @return {Number} The current orientation in degrees
*/
getOrientation : function(){
return this._orientation;
},
/**
* Whether the viewport orientation is currently in landscape mode.
*
* @return {Boolean} <code>true</code> when the viewport orientation
* is currently in landscape mode.
*/
isLandscape : function(){
return this._mode == "landscape";
},
/**
* Whether the viewport orientation is currently in portrait mode.
*
* @return {Boolean} <code>true</code> when the viewport orientation
* is currently in portrait mode.
*/
isPortrait : function(){
return this._mode == "portrait";
},
/**
* Manipulates the native event object, adding methods if they're not
* already present
*
* @param event {Event} Native event object
* @param element {Element} DOM element the listener was attached to
* @param type {String} Event type
* @return {Event} Normalized event object
* @internal
*/
normalize : function(event, element, type){
if(!event){
return event;
};
event._type = type;
var bindMethods = qx.module.event.Orientation.BIND_METHODS;
for(var i = 0,l = bindMethods.length;i < l;i++){
if(typeof event[bindMethods[i]] != "function"){
event[bindMethods[i]] = qx.module.event.Orientation[bindMethods[i]].bind(event);
};
};
return event;
}
},
defer : function(statics){
qxWeb.$registerEventNormalization(statics.TYPES, statics.normalize);
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2012 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Martin Wittemann (wittemann)
************************************************************************ */
/* ************************************************************************
#require(qx.module.Attribute)
#require(qx.module.Css)
#require(qx.module.Environment)
#require(qx.module.Event)
#require(qx.module.Manipulating)
#require(qx.module.Polyfill)
#require(qx.module.Traversing)
************************************************************************ */
/**
* Placeholder class which simply defines and includes the core of qxWeb.
* The core modules are:
*
* * {@link qx.module.Attribute}
* * {@link qx.module.Css}
* * {@link qx.module.Environment}
* * {@link qx.module.Event}
* * {@link qx.module.Manipulating}
* * {@link qx.module.Polyfill}
* * {@link qx.module.Traversing}
*/
qx.Bootstrap.define("qx.module.Core", {
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2012 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Daniel Wagner (danielwagner)
************************************************************************ */
/* ************************************************************************
#require(qx.module.Event)
#require(qx.module.Environment)
************************************************************************ */
/**
* Normalization for native keyboard events
*/
qx.Bootstrap.define("qx.module.event.Keyboard", {
statics : {
/**
* List of event types to be normalized
*/
TYPES : ["keydown", "keypress", "keyup"],
/**
* List qx.module.event.Keyboard methods to be attached to native mouse event
* objects
* @internal
*/
BIND_METHODS : ["getKeyIdentifier"],
/**
* Identifier of the pressed key. This property is modeled after the <em>KeyboardEvent.keyIdentifier</em> property
* of the W3C DOM 3 event specification
* (http://www.w3.org/TR/2003/NOTE-DOM-Level-3-Events-20031107/events.html#Events-KeyboardEvent-keyIdentifier).
*
* Printable keys are represented by an unicode string, non-printable keys
* have one of the following values:
*
* <table>
* <tr><th>Backspace</th><td>The Backspace (Back) key.</td></tr>
* <tr><th>Tab</th><td>The Horizontal Tabulation (Tab) key.</td></tr>
* <tr><th>Space</th><td>The Space (Spacebar) key.</td></tr>
* <tr><th>Enter</th><td>The Enter key. Note: This key identifier is also used for the Return (Macintosh numpad) key.</td></tr>
* <tr><th>Shift</th><td>The Shift key.</td></tr>
* <tr><th>Control</th><td>The Control (Ctrl) key.</td></tr>
* <tr><th>Alt</th><td>The Alt (Menu) key.</td></tr>
* <tr><th>CapsLock</th><td>The CapsLock key</td></tr>
* <tr><th>Meta</th><td>The Meta key. (Apple Meta and Windows key)</td></tr>
* <tr><th>Escape</th><td>The Escape (Esc) key.</td></tr>
* <tr><th>Left</th><td>The Left Arrow key.</td></tr>
* <tr><th>Up</th><td>The Up Arrow key.</td></tr>
* <tr><th>Right</th><td>The Right Arrow key.</td></tr>
* <tr><th>Down</th><td>The Down Arrow key.</td></tr>
* <tr><th>PageUp</th><td>The Page Up key.</td></tr>
* <tr><th>PageDown</th><td>The Page Down (Next) key.</td></tr>
* <tr><th>End</th><td>The End key.</td></tr>
* <tr><th>Home</th><td>The Home key.</td></tr>
* <tr><th>Insert</th><td>The Insert (Ins) key. (Does not fire in Opera/Win)</td></tr>
* <tr><th>Delete</th><td>The Delete (Del) Key.</td></tr>
* <tr><th>F1</th><td>The F1 key.</td></tr>
* <tr><th>F2</th><td>The F2 key.</td></tr>
* <tr><th>F3</th><td>The F3 key.</td></tr>
* <tr><th>F4</th><td>The F4 key.</td></tr>
* <tr><th>F5</th><td>The F5 key.</td></tr>
* <tr><th>F6</th><td>The F6 key.</td></tr>
* <tr><th>F7</th><td>The F7 key.</td></tr>
* <tr><th>F8</th><td>The F8 key.</td></tr>
* <tr><th>F9</th><td>The F9 key.</td></tr>
* <tr><th>F10</th><td>The F10 key.</td></tr>
* <tr><th>F11</th><td>The F11 key.</td></tr>
* <tr><th>F12</th><td>The F12 key.</td></tr>
* <tr><th>NumLock</th><td>The Num Lock key.</td></tr>
* <tr><th>PrintScreen</th><td>The Print Screen (PrintScrn, SnapShot) key.</td></tr>
* <tr><th>Scroll</th><td>The scroll lock key</td></tr>
* <tr><th>Pause</th><td>The pause/break key</td></tr>
* <tr><th>Win</th><td>The Windows Logo key</td></tr>
* <tr><th>Apps</th><td>The Application key (Windows Context Menu)</td></tr>
* </table>
*
* @return {String} The key identifier
*/
getKeyIdentifier : function(){
if(this.type == "keypress" && (qxWeb.env.get("engine.name") != "gecko" || this.charCode !== 0)){
return qx.event.util.Keyboard.charCodeToIdentifier(this.charCode || this.keyCode);
};
return qx.event.util.Keyboard.keyCodeToIdentifier(this.keyCode);
},
/**
* Manipulates the native event object, adding methods if they're not
* already present
*
* @param event {Event} Native event object
* @param element {Element} DOM element the listener was attached to
* @return {Event} Normalized event object
* @internal
*/
normalize : function(event, element){
if(!event){
return event;
};
var bindMethods = qx.module.event.Keyboard.BIND_METHODS;
for(var i = 0,l = bindMethods.length;i < l;i++){
if(typeof event[bindMethods[i]] != "function"){
event[bindMethods[i]] = qx.module.event.Keyboard[bindMethods[i]].bind(event);
};
};
return event;
},
/**
* IE9 will not fire an "input" event on text input elements if the user changes
* the field's value by pressing the Backspace key. We fix this by listening
* for the "keyup" event and emitting the missing event if necessary
*
* @param element {Element} Target element
*/
registerInputFix : function(element){
if(element.type === "text" || element.type === "password" || element.type === "textarea"){
if(!element.__inputFix){
element.__inputFix = qxWeb(element).on("keyup", qx.module.event.Keyboard._inputFix);
};
};
},
/**
* Removes the IE9 input event fix
* @param element {Element} target element
*/
unregisterInputFix : function(element){
if(element.__inputFix && !qxWeb(element).hasListener("input")){
qxWeb(element).off("keyup", qx.module.event.Keyboard._inputFix);
element.__inputFix = null;
};
},
/**
* IE9 fix: Emits an "input" event if a text input element's value was changed
* using the Backspace key
* @param ev {Event} Keyup event
*/
_inputFix : function(ev){
if(ev.getKeyIdentifier() !== "Backspace"){
return;
};
var target = ev.getTarget();
var newValue = qxWeb(target).getValue();
if(!target.__oldInputValue || target.__oldInputValue !== newValue){
target.__oldInputValue = newValue;
ev.type = ev._type = "input";
target.__emitter.emit("input", ev);
};
}
},
defer : function(statics){
qxWeb.$registerEventNormalization(qx.module.event.Keyboard.TYPES, statics.normalize);
if(qxWeb.env.get("engine.name") === "mshtml" && qxWeb.env.get("browser.documentmode") === 9){
qxWeb.$registerEventHook("input", statics.registerInputFix, statics.unregisterInputFix);
};
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2004-2012 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Sebastian Werner (wpbasti)
* Andreas Ecker (ecker)
* Fabian Jakobs (fjakobs)
************************************************************************ */
/**
* Utilities for working with character codes and key identifiers
*/
qx.Bootstrap.define("qx.event.util.Keyboard", {
statics : {
/*
---------------------------------------------------------------------------
KEY MAPS
---------------------------------------------------------------------------
*/
/**
* {Map} maps the charcodes of special printable keys to key identifiers
*
* @lint ignoreReferenceField(specialCharCodeMap)
*/
specialCharCodeMap : {
'8' : "Backspace",
// The Backspace (Back) key.
'9' : "Tab",
// The Horizontal Tabulation (Tab) key.
// Note: This key identifier is also used for the
// Return (Macintosh numpad) key.
'13' : "Enter",
// The Enter key.
'27' : "Escape",
// The Escape (Esc) key.
'32' : "Space"
},
/**
* {Map} maps the keycodes of the numpad keys to the right charcodes
*
* @lint ignoreReferenceField(numpadToCharCode)
*/
numpadToCharCode : {
'96' : "0".charCodeAt(0),
'97' : "1".charCodeAt(0),
'98' : "2".charCodeAt(0),
'99' : "3".charCodeAt(0),
'100' : "4".charCodeAt(0),
'101' : "5".charCodeAt(0),
'102' : "6".charCodeAt(0),
'103' : "7".charCodeAt(0),
'104' : "8".charCodeAt(0),
'105' : "9".charCodeAt(0),
'106' : "*".charCodeAt(0),
'107' : "+".charCodeAt(0),
'109' : "-".charCodeAt(0),
'110' : ",".charCodeAt(0),
'111' : "/".charCodeAt(0)
},
/**
* {Map} maps the keycodes of non printable keys to key identifiers
*
* @lint ignoreReferenceField(keyCodeToIdentifierMap)
*/
keyCodeToIdentifierMap : {
'16' : "Shift",
// The Shift key.
'17' : "Control",
// The Control (Ctrl) key.
'18' : "Alt",
// The Alt (Menu) key.
'20' : "CapsLock",
// The CapsLock key
'224' : "Meta",
// The Meta key. (Apple Meta and Windows key)
'37' : "Left",
// The Left Arrow key.
'38' : "Up",
// The Up Arrow key.
'39' : "Right",
// The Right Arrow key.
'40' : "Down",
// The Down Arrow key.
'33' : "PageUp",
// The Page Up key.
'34' : "PageDown",
// The Page Down (Next) key.
'35' : "End",
// The End key.
'36' : "Home",
// The Home key.
'45' : "Insert",
// The Insert (Ins) key. (Does not fire in Opera/Win)
'46' : "Delete",
// The Delete (Del) Key.
'112' : "F1",
// The F1 key.
'113' : "F2",
// The F2 key.
'114' : "F3",
// The F3 key.
'115' : "F4",
// The F4 key.
'116' : "F5",
// The F5 key.
'117' : "F6",
// The F6 key.
'118' : "F7",
// The F7 key.
'119' : "F8",
// The F8 key.
'120' : "F9",
// The F9 key.
'121' : "F10",
// The F10 key.
'122' : "F11",
// The F11 key.
'123' : "F12",
// The F12 key.
'144' : "NumLock",
// The Num Lock key.
'44' : "PrintScreen",
// The Print Screen (PrintScrn, SnapShot) key.
'145' : "Scroll",
// The scroll lock key
'19' : "Pause",
// The pause/break key
// The left Windows Logo key or left cmd key
'91' : qx.core.Environment.get("os.name") == "osx" ? "cmd" : "Win",
'92' : "Win",
// The right Windows Logo key or left cmd key
// The Application key (Windows Context Menu) or right cmd key
'93' : qx.core.Environment.get("os.name") == "osx" ? "cmd" : "Apps"
},
/** char code for capital A */
charCodeA : "A".charCodeAt(0),
/** char code for capital Z */
charCodeZ : "Z".charCodeAt(0),
/** char code for 0 */
charCode0 : "0".charCodeAt(0),
/** char code for 9 */
charCode9 : "9".charCodeAt(0),
/**
* converts a keyboard code to the corresponding identifier
*
* @param keyCode {Integer} key code
* @return {String} key identifier
*/
keyCodeToIdentifier : function(keyCode){
if(this.isIdentifiableKeyCode(keyCode)){
var numPadKeyCode = this.numpadToCharCode[keyCode];
if(numPadKeyCode){
return String.fromCharCode(numPadKeyCode);
};
return (this.keyCodeToIdentifierMap[keyCode] || this.specialCharCodeMap[keyCode] || String.fromCharCode(keyCode));
} else {
return "Unidentified";
};
},
/**
* converts a character code to the corresponding identifier
*
* @param charCode {String} character code
* @return {String} key identifier
*/
charCodeToIdentifier : function(charCode){
return this.specialCharCodeMap[charCode] || String.fromCharCode(charCode).toUpperCase();
},
/**
* Check whether the keycode can be reliably detected in keyup/keydown events
*
* @param keyCode {String} key code to check.
* @return {Boolean} Whether the keycode can be reliably detected in keyup/keydown events.
*/
isIdentifiableKeyCode : function(keyCode){
// A-Z (TODO: is this lower or uppercase?)
if(keyCode >= this.charCodeA && keyCode <= this.charCodeZ){
return true;
};
// 0-9
if(keyCode >= this.charCode0 && keyCode <= this.charCode9){
return true;
};
// Enter, Space, Tab, Backspace
if(this.specialCharCodeMap[keyCode]){
return true;
};
// Numpad
if(this.numpadToCharCode[keyCode]){
return true;
};
// non printable keys
if(this.isNonPrintableKeyCode(keyCode)){
return true;
};
return false;
},
/**
* Checks whether the keyCode represents a non printable key
*
* @param keyCode {String} key code to check.
* @return {Boolean} Whether the keyCode represents a non printable key.
*/
isNonPrintableKeyCode : function(keyCode){
return this.keyCodeToIdentifierMap[keyCode] ? true : false;
},
/**
* Checks whether a given string is a valid keyIdentifier
*
* @param keyIdentifier {String} The key identifier.
* @return {Boolean} whether the given string is a valid keyIdentifier
*/
isValidKeyIdentifier : function(keyIdentifier){
if(this.identifierToKeyCodeMap[keyIdentifier]){
return true;
};
if(keyIdentifier.length != 1){
return false;
};
if(keyIdentifier >= "0" && keyIdentifier <= "9"){
return true;
};
if(keyIdentifier >= "A" && keyIdentifier <= "Z"){
return true;
};
switch(keyIdentifier){case "+":case "-":case "*":case "/":
return true;default:
return false;};
},
/**
* Checks whether a given string is a printable keyIdentifier.
*
* @param keyIdentifier {String} The key identifier.
* @return {Boolean} whether the given string is a printable keyIdentifier.
*/
isPrintableKeyIdentifier : function(keyIdentifier){
if(keyIdentifier === "Space"){
return true;
} else {
return this.identifierToKeyCodeMap[keyIdentifier] ? false : true;
};
}
},
defer : function(statics, members){
// construct inverse of keyCodeToIdentifierMap
if(!statics.identifierToKeyCodeMap){
statics.identifierToKeyCodeMap = {
};
for(var key in statics.keyCodeToIdentifierMap){
statics.identifierToKeyCodeMap[statics.keyCodeToIdentifierMap[key]] = parseInt(key, 10);
};
for(var key in statics.specialCharCodeMap){
statics.identifierToKeyCodeMap[statics.specialCharCodeMap[key]] = parseInt(key, 10);
};
};
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2004-2009 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Sebastian Werner (wpbasti)
* Andreas Ecker (ecker)
************************************************************************ */
/**
* A wrapper for Cookie handling.
*/
qx.Bootstrap.define("qx.bom.Cookie", {
/*
*****************************************************************************
STATICS
*****************************************************************************
*/
statics : {
/*
---------------------------------------------------------------------------
USER APPLICATION METHODS
---------------------------------------------------------------------------
*/
/**
* Returns the string value of a cookie.
*
* @param key {String} The key for the saved string value.
* @return {null | String} Returns the saved string value, if the cookie
* contains a value for the key, <code>null</code> otherwise.
*/
get : function(key){
var start = document.cookie.indexOf(key + "=");
var len = start + key.length + 1;
if((!start) && (key != document.cookie.substring(0, key.length))){
return null;
};
if(start == -1){
return null;
};
var end = document.cookie.indexOf(";", len);
if(end == -1){
end = document.cookie.length;
};
return unescape(document.cookie.substring(len, end));
},
/**
* Sets the string value of a cookie.
*
* @param key {String} The key for the string value.
* @param value {String} The string value.
* @param expires {Number?null} The expires in days starting from now,
* or <code>null</code> if the cookie should deleted after browser close.
* @param path {String?null} Path value.
* @param domain {String?null} Domain value.
* @param secure {Boolean?null} Secure flag.
*/
set : function(key, value, expires, path, domain, secure){
// Generate cookie
var cookie = [key, "=", escape(value)];
if(expires){
var today = new Date();
today.setTime(today.getTime());
cookie.push(";expires=", new Date(today.getTime() + (expires * 1000 * 60 * 60 * 24)).toGMTString());
};
if(path){
cookie.push(";path=", path);
};
if(domain){
cookie.push(";domain=", domain);
};
if(secure){
cookie.push(";secure");
};
// Store cookie
document.cookie = cookie.join("");
},
/**
* Deletes the string value of a cookie.
*
* @param key {String} The key for the string value.
* @param path {String?null} Path value.
* @param domain {String?null} Domain value.
*/
del : function(key, path, domain){
if(!qx.bom.Cookie.get(key)){
return;
};
// Generate cookie
var cookie = [key, "="];
if(path){
cookie.push(";path=", path);
};
if(domain){
cookie.push(";domain=", domain);
};
cookie.push(";expires=Thu, 01-Jan-1970 00:00:01 GMT");
// Store cookie
document.cookie = cookie.join("");
}
}
});
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2012 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Daniel Wagner (danielwagner)
************************************************************************ */
/**
* Cookie handling module
*/
qx.Bootstrap.define("qx.module.Cookie", {
statics : {
/**
* Returns the string value of a cookie.
*
* @attachStatic {qxWeb, cookie.get}
* @param key {String} The key for the saved string value.
* @return {String|null} Returns the saved string value if the cookie
* contains a value for the key, otherwise <code>null</code>
* @signature function(key)
*/
get : qx.bom.Cookie.get,
/**
* Sets the string value of a cookie.
*
* @attachStatic {qxWeb, cookie.set}
* @param key {String} The key for the string value.
* @param value {String} The string value.
* @param expires {Number?null} Expires directive value in days starting from now,
* or <code>null</code> if the cookie should be deleted when the browser
* is closed.
* @param path {String?null} Path value.
* @param domain {String?null} Domain value.
* @param secure {Boolean?null} Secure flag.
* @signature function(key, value, expires, path, domain, secure)
*/
set : qx.bom.Cookie.set,
/**
* Deletes the string value of a cookie.
*
* @attachStatic {qxWeb, cookie.del}
* @param key {String} The key for the string value.
* @param path {String?null} Path value.
* @param domain {String?null} Domain value.
* @signature function(key, path, domain)
*/
del : qx.bom.Cookie.del
},
defer : function(statics){
qxWeb.$attachStatic({
"cookie" : {
get : statics.get,
set : statics.set,
del : statics.del
}
});
}
});
var exp = envinfo["qx.export"];
if (exp) {
for (var name in exp) {
var c = exp[name].split(".");
var root = window;
for (var i=0; i < c.length; i++) {
root = root[c[i]];
};
window[name] = root;
}
}
window["qx"] = undefined;
try {
delete window.qx;
} catch(e) {}
})(); |
app/routes.js | mersocarlin/react-webpack-template | import React from 'react';
import { Route } from 'react-router';
import App from './containers/app';
import About from './containers/about';
import Home from './containers/home';
import NoMatch from './containers/no-match';
export default (
<Route component={App}>
<Route path="/" component={Home} />
<Route path="about" component={About} />
<Route path="about/:param1/test/:param2" component={About} />
<Route path="*" component={NoMatch}/>
</Route>
);
|
ajax/libs/yui/3.8.0/datatable-core/datatable-core-debug.js | potomak/cdnjs | YUI.add('datatable-core', function (Y, NAME) {
/**
The core implementation of the `DataTable` and `DataTable.Base` Widgets.
@module datatable
@submodule datatable-core
@since 3.5.0
**/
var INVALID = Y.Attribute.INVALID_VALUE,
Lang = Y.Lang,
isFunction = Lang.isFunction,
isObject = Lang.isObject,
isArray = Lang.isArray,
isString = Lang.isString,
isNumber = Lang.isNumber,
toArray = Y.Array,
keys = Y.Object.keys,
Table;
/**
_API docs for this extension are included in the DataTable class._
Class extension providing the core API and structure for the DataTable Widget.
Use this class extension with Widget or another Base-based superclass to create
the basic DataTable model API and composing class structure.
@class DataTable.Core
@for DataTable
@since 3.5.0
**/
Table = Y.namespace('DataTable').Core = function () {};
Table.ATTRS = {
/**
Columns to include in the rendered table.
If omitted, the attributes on the configured `recordType` or the first item
in the `data` collection will be used as a source.
This attribute takes an array of strings or objects (mixing the two is
fine). Each string or object is considered a column to be rendered.
Strings are converted to objects, so `columns: ['first', 'last']` becomes
`columns: [{ key: 'first' }, { key: 'last' }]`.
DataTable.Core only concerns itself with a few properties of columns.
These properties are:
* `key` - Used to identify the record field/attribute containing content for
this column. Also used to create a default Model if no `recordType` or
`data` are provided during construction. If `name` is not specified, this
is assigned to the `_id` property (with added incrementer if the key is
used by multiple columns).
* `children` - Traversed to initialize nested column objects
* `name` - Used in place of, or in addition to, the `key`. Useful for
columns that aren't bound to a field/attribute in the record data. This
is assigned to the `_id` property.
* `id` - For backward compatibility. Implementers can specify the id of
the header cell. This should be avoided, if possible, to avoid the
potential for creating DOM elements with duplicate IDs.
* `field` - For backward compatibility. Implementers should use `name`.
* `_id` - Assigned unique-within-this-instance id for a column. By order
of preference, assumes the value of `name`, `key`, `id`, or `_yuid`.
This is used by the rendering views as well as feature module
as a means to identify a specific column without ambiguity (such as
multiple columns using the same `key`.
* `_yuid` - Guid stamp assigned to the column object.
* `_parent` - Assigned to all child columns, referencing their parent
column.
@attribute columns
@type {Object[]|String[]}
@default (from `recordType` ATTRS or first item in the `data`)
@since 3.5.0
**/
columns: {
// TODO: change to setter to clone input array/objects
validator: isArray,
setter: '_setColumns',
getter: '_getColumns'
},
/**
Model subclass to use as the `model` for the ModelList stored in the `data`
attribute.
If not provided, it will try really hard to figure out what to use. The
following attempts will be made to set a default value:
1. If the `data` attribute is set with a ModelList instance and its `model`
property is set, that will be used.
2. If the `data` attribute is set with a ModelList instance, and its
`model` property is unset, but it is populated, the `ATTRS` of the
`constructor of the first item will be used.
3. If the `data` attribute is set with a non-empty array, a Model subclass
will be generated using the keys of the first item as its `ATTRS` (see
the `_createRecordClass` method).
4. If the `columns` attribute is set, a Model subclass will be generated
using the columns defined with a `key`. This is least desirable because
columns can be duplicated or nested in a way that's not parsable.
5. If neither `data` nor `columns` is set or populated, a change event
subscriber will listen for the first to be changed and try all over
again.
@attribute recordType
@type {Function}
@default (see description)
@since 3.5.0
**/
recordType: {
getter: '_getRecordType',
setter: '_setRecordType'
},
/**
The collection of data records to display. This attribute is a pass
through to a `data` property, which is a ModelList instance.
If this attribute is passed a ModelList or subclass, it will be assigned to
the property directly. If an array of objects is passed, a new ModelList
will be created using the configured `recordType` as its `model` property
and seeded with the array.
Retrieving this attribute will return the ModelList stored in the `data`
property.
@attribute data
@type {ModelList|Object[]}
@default `new ModelList()`
@since 3.5.0
**/
data: {
valueFn: '_initData',
setter : '_setData',
lazyAdd: false
},
/**
Content for the `<table summary="ATTRIBUTE VALUE HERE">`. Values assigned
to this attribute will be HTML escaped for security.
@attribute summary
@type {String}
@default '' (empty string)
@since 3.5.0
**/
//summary: {},
/**
HTML content of an optional `<caption>` element to appear above the table.
Leave this config unset or set to a falsy value to remove the caption.
@attribute caption
@type HTML
@default '' (empty string)
@since 3.5.0
**/
//caption: {},
/**
Deprecated as of 3.5.0. Passes through to the `data` attribute.
WARNING: `get('recordset')` will NOT return a Recordset instance as of
3.5.0. This is a break in backward compatibility.
@attribute recordset
@type {Object[]|Recordset}
@deprecated Use the `data` attribute
@since 3.5.0
**/
recordset: {
setter: '_setRecordset',
getter: '_getRecordset',
lazyAdd: false
},
/**
Deprecated as of 3.5.0. Passes through to the `columns` attribute.
WARNING: `get('columnset')` will NOT return a Columnset instance as of
3.5.0. This is a break in backward compatibility.
@attribute columnset
@type {Object[]}
@deprecated Use the `columns` attribute
@since 3.5.0
**/
columnset: {
setter: '_setColumnset',
getter: '_getColumnset',
lazyAdd: false
}
};
Y.mix(Table.prototype, {
// -- Instance properties -------------------------------------------------
/**
The ModelList that manages the table's data.
@property data
@type {ModelList}
@default undefined (initially unset)
@since 3.5.0
**/
//data: null,
// -- Public methods ------------------------------------------------------
/**
Gets the column configuration object for the given key, name, or index. For
nested columns, `name` can be an array of indexes, each identifying the index
of that column in the respective parent's "children" array.
If you pass a column object, it will be returned.
For columns with keys, you can also fetch the column with
`instance.get('columns.foo')`.
@method getColumn
@param {String|Number|Number[]} name Key, "name", index, or index array to
identify the column
@return {Object} the column configuration object
@since 3.5.0
**/
getColumn: function (name) {
var col, columns, i, len, cols;
if (isObject(name) && !isArray(name)) {
// TODO: support getting a column from a DOM node - this will cross
// the line into the View logic, so it should be relayed
// Assume an object passed in is already a column def
col = name;
} else {
col = this.get('columns.' + name);
}
if (col) {
return col;
}
columns = this.get('columns');
if (isNumber(name) || isArray(name)) {
name = toArray(name);
cols = columns;
for (i = 0, len = name.length - 1; cols && i < len; ++i) {
cols = cols[name[i]] && cols[name[i]].children;
}
return (cols && cols[name[i]]) || null;
}
return null;
},
/**
Returns the Model associated to the record `id`, `clientId`, or index (not
row index). If none of those yield a Model from the `data` ModelList, the
arguments will be passed to the `view` instance's `getRecord` method
if it has one.
If no Model can be found, `null` is returned.
@method getRecord
@param {Number|String|Node} seed Record `id`, `clientId`, index, Node, or
identifier for a row or child element
@return {Model}
@since 3.5.0
**/
getRecord: function (seed) {
var record = this.data.getById(seed) || this.data.getByClientId(seed);
if (!record) {
if (isNumber(seed)) {
record = this.data.item(seed);
}
// TODO: this should be split out to base somehow
if (!record && this.view && this.view.getRecord) {
record = this.view.getRecord.apply(this.view, arguments);
}
}
return record || null;
},
// -- Protected and private properties and methods ------------------------
/**
This tells `Y.Base` that it should create ad-hoc attributes for config
properties passed to DataTable's constructor. This is useful for setting
configurations on the DataTable that are intended for the rendering View(s).
@property _allowAdHocAttrs
@type Boolean
@default true
@protected
@since 3.6.0
**/
_allowAdHocAttrs: true,
/**
A map of column key to column configuration objects parsed from the
`columns` attribute.
@property _columnMap
@type {Object}
@default undefined (initially unset)
@protected
@since 3.5.0
**/
//_columnMap: null,
/**
The Node instance of the table containing the data rows. This is set when
the table is rendered. It may also be set by progressive enhancement,
though this extension does not provide the logic to parse from source.
@property _tableNode
@type {Node}
@default undefined (initially unset)
@protected
@since 3.5.0
**/
//_tableNode: null,
/**
Updates the `_columnMap` property in response to changes in the `columns`
attribute.
@method _afterColumnsChange
@param {EventFacade} e The `columnsChange` event object
@protected
@since 3.5.0
**/
_afterColumnsChange: function (e) {
this._setColumnMap(e.newVal);
},
/**
Updates the `modelList` attributes of the rendered views in response to the
`data` attribute being assigned a new ModelList.
@method _afterDataChange
@param {EventFacade} e the `dataChange` event
@protected
@since 3.5.0
**/
_afterDataChange: function (e) {
var modelList = e.newVal;
this.data = e.newVal;
if (!this.get('columns') && modelList.size()) {
// TODO: this will cause a re-render twice because the Views are
// subscribed to columnsChange
this._initColumns();
}
},
/**
Assigns to the new recordType as the model for the data ModelList
@method _afterRecordTypeChange
@param {EventFacade} e recordTypeChange event
@protected
@since 3.6.0
**/
_afterRecordTypeChange: function (e) {
var data = this.data.toJSON();
this.data.model = e.newVal;
this.data.reset(data);
if (!this.get('columns') && data) {
if (data.length) {
this._initColumns();
} else {
this.set('columns', keys(e.newVal.ATTRS));
}
}
},
/**
Creates a Model subclass from an array of attribute names or an object of
attribute definitions. This is used to generate a class suitable to
represent the data passed to the `data` attribute if no `recordType` is
set.
@method _createRecordClass
@param {String[]|Object} attrs Names assigned to the Model subclass's
`ATTRS` or its entire `ATTRS` definition object
@return {Model}
@protected
@since 3.5.0
**/
_createRecordClass: function (attrs) {
var ATTRS, i, len;
if (isArray(attrs)) {
ATTRS = {};
for (i = 0, len = attrs.length; i < len; ++i) {
ATTRS[attrs[i]] = {};
}
} else if (isObject(attrs)) {
ATTRS = attrs;
}
return Y.Base.create('record', Y.Model, [], null, { ATTRS: ATTRS });
},
/**
Tears down the instance.
@method destructor
@protected
@since 3.6.0
**/
destructor: function () {
new Y.EventHandle(Y.Object.values(this._eventHandles)).detach();
},
/**
The getter for the `columns` attribute. Returns the array of column
configuration objects if `instance.get('columns')` is called, or the
specific column object if `instance.get('columns.columnKey')` is called.
@method _getColumns
@param {Object[]} columns The full array of column objects
@param {String} name The attribute name requested
(e.g. 'columns' or 'columns.foo');
@protected
@since 3.5.0
**/
_getColumns: function (columns, name) {
// Workaround for an attribute oddity (ticket #2529254)
// getter is expected to return an object if get('columns.foo') is called.
// Note 'columns.' is 8 characters
return name.length > 8 ? this._columnMap : columns;
},
/**
Relays the `get()` request for the deprecated `columnset` attribute to the
`columns` attribute.
THIS BREAKS BACKWARD COMPATIBILITY. 3.4.1 and prior implementations will
expect a Columnset instance returned from `get('columnset')`.
@method _getColumnset
@param {Object} ignored The current value stored in the `columnset` state
@param {String} name The attribute name requested
(e.g. 'columnset' or 'columnset.foo');
@deprecated This will be removed with the `columnset` attribute in a future
version.
@protected
@since 3.5.0
**/
_getColumnset: function (_, name) {
return this.get(name.replace(/^columnset/, 'columns'));
},
/**
Returns the Model class of the instance's `data` attribute ModelList. If
not set, returns the explicitly configured value.
@method _getRecordType
@param {Model} val The currently configured value
@return {Model}
**/
_getRecordType: function (val) {
// Prefer the value stored in the attribute because the attribute
// change event defaultFn sets e.newVal = this.get('recordType')
// before notifying the after() subs. But if this getter returns
// this.data.model, then after() subs would get e.newVal === previous
// model before _afterRecordTypeChange can set
// this.data.model = e.newVal
return val || (this.data && this.data.model);
},
/**
Initializes the `_columnMap` property from the configured `columns`
attribute. If `columns` is not set, but there are records in the `data`
ModelList, use
`ATTRS` of that class.
@method _initColumns
@protected
@since 3.5.0
**/
_initColumns: function () {
var columns = this.get('columns') || [],
item;
// Default column definition from the configured recordType
if (!columns.length && this.data.size()) {
// TODO: merge superclass attributes up to Model?
item = this.data.item(0);
if (item.toJSON) {
item = item.toJSON();
}
this.set('columns', keys(item));
}
this._setColumnMap(columns);
},
/**
Sets up the change event subscriptions to maintain internal state.
@method _initCoreEvents
@protected
@since 3.6.0
**/
_initCoreEvents: function () {
this._eventHandles.coreAttrChanges = this.after({
columnsChange : Y.bind('_afterColumnsChange', this),
recordTypeChange: Y.bind('_afterRecordTypeChange', this),
dataChange : Y.bind('_afterDataChange', this)
});
},
/**
Defaults the `data` attribute to an empty ModelList if not set during
construction. Uses the configured `recordType` for the ModelList's `model`
proeprty if set.
@method _initData
@protected
@return {ModelList}
@since 3.6.0
**/
_initData: function () {
var recordType = this.get('recordType'),
// TODO: LazyModelList if recordType doesn't have complex ATTRS
modelList = new Y.ModelList();
if (recordType) {
modelList.model = recordType;
}
return modelList;
},
/**
Initializes the instance's `data` property from the value of the `data`
attribute. If the attribute value is a ModelList, it is assigned directly
to `this.data`. If it is an array, a ModelList is created, its `model`
property is set to the configured `recordType` class, and it is seeded with
the array data. This ModelList is then assigned to `this.data`.
@method _initDataProperty
@param {Array|ModelList|ArrayList} data Collection of data to populate the
DataTable
@protected
@since 3.6.0
**/
_initDataProperty: function (data) {
var recordType;
if (!this.data) {
recordType = this.get('recordType');
if (data && data.each && data.toJSON) {
this.data = data;
if (recordType) {
this.data.model = recordType;
}
} else {
// TODO: customize the ModelList or read the ModelList class
// from a configuration option?
this.data = new Y.ModelList();
if (recordType) {
this.data.model = recordType;
}
}
// TODO: Replace this with an event relay for specific events.
// Using bubbling causes subscription conflicts with the models'
// aggregated change event and 'change' events from DOM elements
// inside the table (via Widget UI event).
this.data.addTarget(this);
}
},
/**
Initializes the columns, `recordType` and data ModelList.
@method initializer
@param {Object} config Configuration object passed to constructor
@protected
@since 3.5.0
**/
initializer: function (config) {
var data = config.data,
columns = config.columns,
recordType;
// Referencing config.data to allow _setData to be more stringent
// about its behavior
this._initDataProperty(data);
// Default columns from recordType ATTRS if recordType is supplied at
// construction. If no recordType is supplied, but the data is
// supplied as a non-empty array, use the keys of the first item
// as the columns.
if (!columns) {
recordType = (config.recordType || config.data === this.data) &&
this.get('recordType');
if (recordType) {
columns = keys(recordType.ATTRS);
} else if (isArray(data) && data.length) {
columns = keys(data[0]);
}
if (columns) {
this.set('columns', columns);
}
}
this._initColumns();
this._eventHandles = {};
this._initCoreEvents();
},
/**
Iterates the array of column configurations to capture all columns with a
`key` property. An map is built with column keys as the property name and
the corresponding column object as the associated value. This map is then
assigned to the instance's `_columnMap` property.
@method _setColumnMap
@param {Object[]|String[]} columns The array of column config objects
@protected
@since 3.6.0
**/
_setColumnMap: function (columns) {
var map = {};
function process(cols) {
var i, len, col, key;
for (i = 0, len = cols.length; i < len; ++i) {
col = cols[i];
key = col.key;
// First in wins for multiple columns with the same key
// because the first call to genId (in _setColumns) will
// return the same key, which will then be overwritten by the
// subsequent same-keyed column. So table.getColumn(key) would
// return the last same-keyed column.
if (key && !map[key]) {
map[key] = col;
}
//TODO: named columns can conflict with keyed columns
map[col._id] = col;
if (col.children) {
process(col.children);
}
}
}
process(columns);
this._columnMap = map;
},
/**
Translates string columns into objects with that string as the value of its
`key` property.
All columns are assigned a `_yuid` stamp and `_id` property corresponding
to the column's configured `name` or `key` property with any spaces
replaced with dashes. If the same `name` or `key` appears in multiple
columns, subsequent appearances will have their `_id` appended with an
incrementing number (e.g. if column "foo" is included in the `columns`
attribute twice, the first will get `_id` of "foo", and the second an `_id`
of "foo1"). Columns that are children of other columns will have the
`_parent` property added, assigned the column object to which they belong.
@method _setColumns
@param {null|Object[]|String[]} val Array of config objects or strings
@return {null|Object[]}
@protected
**/
_setColumns: function (val) {
var keys = {},
known = [],
knownCopies = [],
arrayIndex = Y.Array.indexOf;
function copyObj(o) {
var copy = {},
key, val, i;
known.push(o);
knownCopies.push(copy);
for (key in o) {
if (o.hasOwnProperty(key)) {
val = o[key];
if (isArray(val)) {
copy[key] = val.slice();
} else if (isObject(val, true)) {
i = arrayIndex(val, known);
copy[key] = i === -1 ? copyObj(val) : knownCopies[i];
} else {
copy[key] = o[key];
}
}
}
return copy;
}
function genId(name) {
// Sanitize the name for use in generated CSS classes.
// TODO: is there more to do for other uses of _id?
name = name.replace(/\s+/, '-');
if (keys[name]) {
name += (keys[name]++);
} else {
keys[name] = 1;
}
return name;
}
function process(cols, parent) {
var columns = [],
i, len, col, yuid;
for (i = 0, len = cols.length; i < len; ++i) {
columns[i] = // chained assignment
col = isString(cols[i]) ? { key: cols[i] } : copyObj(cols[i]);
yuid = Y.stamp(col);
// For backward compatibility
if (!col.id) {
// Implementers can shoot themselves in the foot by setting
// this config property to a non-unique value
col.id = yuid;
}
if (col.field) {
// Field is now known as "name" to avoid confusion with data
// fields or schema.resultFields
col.name = col.field;
}
if (parent) {
col._parent = parent;
} else {
delete col._parent;
}
// Unique id based on the column's configured name or key,
// falling back to the yuid. Duplicates will have a counter
// added to the end.
col._id = genId(col.name || col.key || col.id);
if (isArray(col.children)) {
col.children = process(col.children, col);
}
}
return columns;
}
return val && process(val);
},
/**
Relays attribute assignments of the deprecated `columnset` attribute to the
`columns` attribute. If a Columnset is object is passed, its basic object
structure is mined.
@method _setColumnset
@param {Array|Columnset} val The columnset value to relay
@deprecated This will be removed with the deprecated `columnset` attribute
in a later version.
@protected
@since 3.5.0
**/
_setColumnset: function (val) {
this.set('columns', val);
return isArray(val) ? val : INVALID;
},
/**
Accepts an object with `each` and `getAttrs` (preferably a ModelList or
subclass) or an array of data objects. If an array is passes, it will
create a ModelList to wrap the data. In doing so, it will set the created
ModelList's `model` property to the class in the `recordType` attribute,
which will be defaulted if not yet set.
If the `data` property is already set with a ModelList, passing an array as
the value will call the ModelList's `reset()` method with that array rather
than replacing the stored ModelList wholesale.
Any non-ModelList-ish and non-array value is invalid.
@method _setData
@protected
@since 3.5.0
**/
_setData: function (val) {
if (val === null) {
val = [];
}
if (isArray(val)) {
this._initDataProperty();
// silent to prevent subscribers to both reset and dataChange
// from reacting to the change twice.
// TODO: would it be better to return INVALID to silence the
// dataChange event, or even allow both events?
this.data.reset(val, { silent: true });
// Return the instance ModelList to avoid storing unprocessed
// data in the state and their vivified Model representations in
// the instance's data property. Decreases memory consumption.
val = this.data;
} else if (!val || !val.each || !val.toJSON) {
// ModelList/ArrayList duck typing
val = INVALID;
}
return val;
},
/**
Relays the value assigned to the deprecated `recordset` attribute to the
`data` attribute. If a Recordset instance is passed, the raw object data
will be culled from it.
@method _setRecordset
@param {Object[]|Recordset} val The recordset value to relay
@deprecated This will be removed with the deprecated `recordset` attribute
in a later version.
@protected
@since 3.5.0
**/
_setRecordset: function (val) {
var data;
if (val && Y.Recordset && val instanceof Y.Recordset) {
data = [];
val.each(function (record) {
data.push(record.get('data'));
});
val = data;
}
this.set('data', val);
return val;
},
/**
Accepts a Base subclass (preferably a Model subclass). Alternately, it will
generate a custom Model subclass from an array of attribute names or an
object defining attributes and their respective configurations (it is
assigned as the `ATTRS` of the new class).
Any other value is invalid.
@method _setRecordType
@param {Function|String[]|Object} val The Model subclass, array of
attribute names, or the `ATTRS` definition for a custom model
subclass
@return {Function} A Base/Model subclass
@protected
@since 3.5.0
**/
_setRecordType: function (val) {
var modelClass;
// Duck type based on known/likely consumed APIs
if (isFunction(val) && val.prototype.toJSON && val.prototype.setAttrs) {
modelClass = val;
} else if (isObject(val)) {
modelClass = this._createRecordClass(val);
}
return modelClass || INVALID;
}
});
}, '@VERSION@', {"requires": ["escape", "model-list", "node-event-delegate"]});
|
client/fragments/quizzes/debris-result/index.js | yeoh-joer/synapse | /**
* External dependencies
*/
import React from 'react'
import PropTypes from 'prop-types'
import { connect } from 'react-redux'
import page from 'page'
import { Chart } from 'chart.js'
import { Doughnut, Line } from 'react-chartjs-2'
/**
* Internal dependencies
*/
import Button from 'client/components/button'
import Card from 'client/components/card'
import { fetchActivities } from 'client/state/activities/actions'
import './style.scss'
class DebrisResult extends React.Component {
static propType = {
quizId: PropTypes.string,
sectionId: PropTypes.string
}
componentWillMount() {
Chart.defaults.global.tooltips.enabled = false
Chart.defaults.global.defaultFontFamily = '"Roboto", sans-serif'
}
componentDidMount() {
const { dispatch, quizId, sectionId } = this.props
dispatch(fetchActivities(quizId, sectionId))
}
renderPrimary() {
const { item } = this.props
return (
<div className='result-graph__primary'>
<Doughnut data={{
labels: [
'Correct',
'Wrong'
],
datasets:[{
data: item && item.accuracy,
backgroundColor: [
'#FFC107',
'#FF9800'
],
hoverBackgroundColor: [
'#FFB300',
'#FB8C00'
]
}]
}}/>
</div>
)
}
renderSecondary() {
const { item } = this.props
return (
<div className='result-graph__secondary'>
<Line data={{
labels: ['1st', '2nd', '3rd', '4th', '5th', '6th', '7th', '8th', '9th', '10th'],
datasets: [{
label: 'Time Taken (s)',
fill: false,
lineTension: 0.1,
backgroundColor: '#FFC107',
borderColor: '#FFC107',
borderCapStyle: 'butt',
borderDash: [],
borderDashOffset: 0.0,
borderJoinStyle: 'miter',
pointBorderColor: '#FF9800',
pointBackgroundColor: '#FF9800',
pointBorderWidth: 1,
pointHoverRadius: 5,
pointHoverBackgroundColor: '#FB8C00',
pointHoverBorderColor: '#FB8C00',
pointHoverBorderWidth: 2,
pointRadius: 4,
pointStyle: 'circle',
pointHitRadius: 10,
data: item && item.time_taken
}]
}}/>
</div>
)
}
render() {
const { item, quizId } = this.props
return (
<div className='debris-result-wrapper'>
<Card className='debris-result-wrapper__primary'>
<section className='mdc-card__supporting-text'>
<h1 className='mdc-typography--title debris-result-wrapper__primary-title'>
Section completed! <span className='mdc-typography--caption'>+20%</span>
</h1>
<div className='result-graph'>
{ this.renderPrimary() }
{ this.renderSecondary() }
</div>
<h1 className='mdc-typography--title debris-result-wrapper__primary-completed cc-color-text--grey-500'>
Completed in { item && item.total } questions.
</h1>
<h1 className='mdc-typography--title debris-result-wrapper__primary-better cc-color-text--grey-700'>
You did better than <span className='cc-color-text--amber-500'>50%</span> of people at this section.
</h1>
</section>
<section className='mdc-card__actions mdc-card__actions--divider'>
<Button primary className='mdc-card__action' onClick={ () => page(`/quizzes/${quizId}`) }>
Next
</Button>
</section>
</Card>
</div>
)
}
}
const mapStateToProps = function (state) {
return {
item: state.activities.item
}
}
export default connect(mapStateToProps)(DebrisResult) |
src/js/components/gsbpm/details/subs-by-phase.js | UNECE/Model-Explorer | import React from 'react'
import { Link } from 'react-router'
import { sparqlConnect} from 'sparql-connect'
import { linkGSBPMSub } from '../routes'
/**
* Builds the query that retrives all the subprocesses for a GSBPM phase
*/
//TODO we retrieve twice the same information, see GSBPM description query.
//There might be a better option, but for now it's easier to use a global query
//to show the GSBPM explorer, and some dedicated queries to show all the
//subprocesses in a given GSBPM phase.
const queryBuilder = GSBPMPhase => `
SELECT ?subprocess ?label
WHERE {
<${GSBPMPhase}> skos:narrower ?subprocess .
?subprocess skos:prefLabel ?label
}
`
const connector = sparqlConnect(queryBuilder, {
queryName: 'subsByGSBPMPhase',
params: ['GSBPMPhase']
})
function SubsByGSBPMPhase({ subsByGSBPMPhase }) {
return(
<div className="list-group">
{ subsByGSBPMPhase.map(({ subprocess, label }) =>
<Link key={subprocess} to={linkGSBPMSub(subprocess)}
className="list-group-item" title={label}>
{ label }
</Link>)
}
</div>
)
}
export default connector(SubsByGSBPMPhase, {
loading: () => <span>loading subprocesses</span>
}) |
ajax/libs/babel-core/5.3.1/browser-polyfill.min.js | perfect-pixell/cdnjs | (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){(function(global){"use strict";require("core-js/shim");require("regenerator/runtime");if(global._babelPolyfill){throw new Error("only one instance of babel/polyfill is allowed")}global._babelPolyfill=true}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"core-js/shim":78,"regenerator/runtime":79}],2:[function(require,module,exports){"use strict";var $=require("./$");module.exports=function(IS_INCLUDES){return function(el){var O=$.toObject(this),length=$.toLength(O.length),index=$.toIndex(arguments[1],length),value;if(IS_INCLUDES&&el!=el)while(length>index){value=O[index++];if(value!=value)return true}else for(;length>index;index++)if(IS_INCLUDES||index in O){if(O[index]===el)return IS_INCLUDES||index}return!IS_INCLUDES&&-1}}},{"./$":21}],3:[function(require,module,exports){"use strict";var $=require("./$"),ctx=require("./$.ctx");module.exports=function(TYPE){var IS_MAP=TYPE==1,IS_FILTER=TYPE==2,IS_SOME=TYPE==3,IS_EVERY=TYPE==4,IS_FIND_INDEX=TYPE==6,NO_HOLES=TYPE==5||IS_FIND_INDEX;return function(callbackfn){var O=Object($.assertDefined(this)),self=$.ES5Object(O),f=ctx(callbackfn,arguments[1],3),length=$.toLength(self.length),index=0,result=IS_MAP?Array(length):IS_FILTER?[]:undefined,val,res;for(;length>index;index++)if(NO_HOLES||index in self){val=self[index];res=f(val,index,O);if(TYPE){if(IS_MAP)result[index]=res;else if(res)switch(TYPE){case 3:return true;case 5:return val;case 6:return index;case 2:result.push(val)}else if(IS_EVERY)return false}}return IS_FIND_INDEX?-1:IS_SOME||IS_EVERY?IS_EVERY:result}}},{"./$":21,"./$.ctx":11}],4:[function(require,module,exports){var $=require("./$");function assert(condition,msg1,msg2){if(!condition)throw TypeError(msg2?msg1+msg2:msg1)}assert.def=$.assertDefined;assert.fn=function(it){if(!$.isFunction(it))throw TypeError(it+" is not a function!");return it};assert.obj=function(it){if(!$.isObject(it))throw TypeError(it+" is not an object!");return it};assert.inst=function(it,Constructor,name){if(!(it instanceof Constructor))throw TypeError(name+": use the 'new' operator!");return it};module.exports=assert},{"./$":21}],5:[function(require,module,exports){var $=require("./$"),enumKeys=require("./$.enum-keys");module.exports=Object.assign||function assign(target,source){var T=Object($.assertDefined(target)),l=arguments.length,i=1;while(l>i){var S=$.ES5Object(arguments[i++]),keys=enumKeys(S),length=keys.length,j=0,key;while(length>j)T[key=keys[j++]]=S[key]}return T}},{"./$":21,"./$.enum-keys":13}],6:[function(require,module,exports){var $=require("./$"),TAG=require("./$.wks")("toStringTag"),toString={}.toString;function cof(it){return toString.call(it).slice(8,-1)}cof.classof=function(it){var O,T;return it==undefined?it===undefined?"Undefined":"Null":typeof(T=(O=Object(it))[TAG])=="string"?T:cof(O)};cof.set=function(it,tag,stat){if(it&&!$.has(it=stat?it:it.prototype,TAG))$.hide(it,TAG,tag)};module.exports=cof},{"./$":21,"./$.wks":32}],7:[function(require,module,exports){"use strict";var $=require("./$"),ctx=require("./$.ctx"),safe=require("./$.uid").safe,assert=require("./$.assert"),forOf=require("./$.for-of"),step=require("./$.iter").step,has=$.has,set=$.set,isObject=$.isObject,hide=$.hide,isFrozen=Object.isFrozen||$.core.Object.isFrozen,ID=safe("id"),O1=safe("O1"),LAST=safe("last"),FIRST=safe("first"),ITER=safe("iter"),SIZE=$.DESC?safe("size"):"size",id=0;function fastKey(it,create){if(!isObject(it))return(typeof it=="string"?"S":"P")+it;if(isFrozen(it))return"F";if(!has(it,ID)){if(!create)return"E";hide(it,ID,++id)}return"O"+it[ID]}function getEntry(that,key){var index=fastKey(key),entry;if(index!="F")return that[O1][index];for(entry=that[FIRST];entry;entry=entry.n){if(entry.k==key)return entry}}module.exports={getConstructor:function(NAME,IS_MAP,ADDER){function C(){var that=assert.inst(this,C,NAME),iterable=arguments[0];set(that,O1,$.create(null));set(that,SIZE,0);set(that,LAST,undefined);set(that,FIRST,undefined);if(iterable!=undefined)forOf(iterable,IS_MAP,that[ADDER],that)}$.mix(C.prototype,{clear:function clear(){for(var that=this,data=that[O1],entry=that[FIRST];entry;entry=entry.n){entry.r=true;if(entry.p)entry.p=entry.p.n=undefined;delete data[entry.i]}that[FIRST]=that[LAST]=undefined;that[SIZE]=0},"delete":function(key){var that=this,entry=getEntry(that,key);if(entry){var next=entry.n,prev=entry.p;delete that[O1][entry.i];entry.r=true;if(prev)prev.n=next;if(next)next.p=prev;if(that[FIRST]==entry)that[FIRST]=next;if(that[LAST]==entry)that[LAST]=prev;that[SIZE]--}return!!entry},forEach:function forEach(callbackfn){var f=ctx(callbackfn,arguments[1],3),entry;while(entry=entry?entry.n:this[FIRST]){f(entry.v,entry.k,this);while(entry&&entry.r)entry=entry.p}},has:function has(key){return!!getEntry(this,key)}});if($.DESC)$.setDesc(C.prototype,"size",{get:function(){return assert.def(this[SIZE])}});return C},def:function(that,key,value){var entry=getEntry(that,key),prev,index;if(entry){entry.v=value}else{that[LAST]=entry={i:index=fastKey(key,true),k:key,v:value,p:prev=that[LAST],n:undefined,r:false};if(!that[FIRST])that[FIRST]=entry;if(prev)prev.n=entry;that[SIZE]++;if(index!="F")that[O1][index]=entry}return that},getEntry:getEntry,setIter:function(C,NAME,IS_MAP){require("./$.iter-define")(C,NAME,function(iterated,kind){set(this,ITER,{o:iterated,k:kind})},function(){var iter=this[ITER],kind=iter.k,entry=iter.l;while(entry&&entry.r)entry=entry.p;if(!iter.o||!(iter.l=entry=entry?entry.n:iter.o[FIRST])){iter.o=undefined;return step(1)}if(kind=="keys")return step(0,entry.k);if(kind=="values")return step(0,entry.v);return step(0,[entry.k,entry.v])},IS_MAP?"entries":"values",!IS_MAP,true)}}},{"./$":21,"./$.assert":4,"./$.ctx":11,"./$.for-of":14,"./$.iter":20,"./$.iter-define":18,"./$.uid":30}],8:[function(require,module,exports){var $def=require("./$.def"),forOf=require("./$.for-of");module.exports=function(NAME){$def($def.P,NAME,{toJSON:function toJSON(){var arr=[];forOf(this,false,arr.push,arr);return arr}})}},{"./$.def":12,"./$.for-of":14}],9:[function(require,module,exports){"use strict";var $=require("./$"),safe=require("./$.uid").safe,assert=require("./$.assert"),forOf=require("./$.for-of"),_has=$.has,isObject=$.isObject,hide=$.hide,isFrozen=Object.isFrozen||$.core.Object.isFrozen,id=0,ID=safe("id"),WEAK=safe("weak"),LEAK=safe("leak"),method=require("./$.array-methods"),find=method(5),findIndex=method(6);function findFrozen(store,key){return find.call(store.array,function(it){return it[0]===key})}function leakStore(that){return that[LEAK]||hide(that,LEAK,{array:[],get:function(key){var entry=findFrozen(this,key);if(entry)return entry[1]},has:function(key){return!!findFrozen(this,key)},set:function(key,value){var entry=findFrozen(this,key);if(entry)entry[1]=value;else this.array.push([key,value])},"delete":function(key){var index=findIndex.call(this.array,function(it){return it[0]===key});if(~index)this.array.splice(index,1);return!!~index}})[LEAK]}module.exports={getConstructor:function(NAME,IS_MAP,ADDER){function C(){$.set(assert.inst(this,C,NAME),ID,id++);var iterable=arguments[0];if(iterable!=undefined)forOf(iterable,IS_MAP,this[ADDER],this)}$.mix(C.prototype,{"delete":function(key){if(!isObject(key))return false;if(isFrozen(key))return leakStore(this)["delete"](key);return _has(key,WEAK)&&_has(key[WEAK],this[ID])&&delete key[WEAK][this[ID]]},has:function has(key){if(!isObject(key))return false;if(isFrozen(key))return leakStore(this).has(key);return _has(key,WEAK)&&_has(key[WEAK],this[ID])}});return C},def:function(that,key,value){if(isFrozen(assert.obj(key))){leakStore(that).set(key,value)}else{_has(key,WEAK)||hide(key,WEAK,{});key[WEAK][that[ID]]=value}return that},leakStore:leakStore,WEAK:WEAK,ID:ID}},{"./$":21,"./$.array-methods":3,"./$.assert":4,"./$.for-of":14,"./$.uid":30}],10:[function(require,module,exports){"use strict";var $=require("./$"),$def=require("./$.def"),BUGGY=require("./$.iter").BUGGY,forOf=require("./$.for-of"),species=require("./$.species"),assertInstance=require("./$.assert").inst;module.exports=function(NAME,methods,common,IS_MAP,IS_WEAK){var Base=$.g[NAME],C=Base,ADDER=IS_MAP?"set":"add",proto=C&&C.prototype,O={};function fixMethod(KEY,CHAIN){var method=proto[KEY];if($.FW)proto[KEY]=function(a,b){var result=method.call(this,a===0?0:a,b);return CHAIN?this:result}}if(!$.isFunction(C)||!(IS_WEAK||!BUGGY&&proto.forEach&&proto.entries)){C=common.getConstructor(NAME,IS_MAP,ADDER);$.mix(C.prototype,methods)}else{var inst=new C,chain=inst[ADDER](IS_WEAK?{}:-0,1),buggyZero;if(!require("./$.iter-detect")(function(iter){new C(iter)})){C=function(){assertInstance(this,C,NAME);var that=new Base,iterable=arguments[0];if(iterable!=undefined)forOf(iterable,IS_MAP,that[ADDER],that);return that};C.prototype=proto;if($.FW)proto.constructor=C}IS_WEAK||inst.forEach(function(val,key){buggyZero=1/key===-Infinity});if(buggyZero){fixMethod("delete");fixMethod("has");IS_MAP&&fixMethod("get")}if(buggyZero||chain!==inst)fixMethod(ADDER,true)}require("./$.cof").set(C,NAME);O[NAME]=C;$def($def.G+$def.W+$def.F*(C!=Base),O);species(C);species($.core[NAME]);if(!IS_WEAK)common.setIter(C,NAME,IS_MAP);return C}},{"./$":21,"./$.assert":4,"./$.cof":6,"./$.def":12,"./$.for-of":14,"./$.iter":20,"./$.iter-detect":19,"./$.species":27}],11:[function(require,module,exports){var assertFunction=require("./$.assert").fn;module.exports=function(fn,that,length){assertFunction(fn);if(~length&&that===undefined)return fn;switch(length){case 1:return function(a){return fn.call(that,a)};case 2:return function(a,b){return fn.call(that,a,b)};case 3:return function(a,b,c){return fn.call(that,a,b,c)}}return function(){return fn.apply(that,arguments)}}},{"./$.assert":4}],12:[function(require,module,exports){var $=require("./$"),global=$.g,core=$.core,isFunction=$.isFunction;function ctx(fn,that){return function(){return fn.apply(that,arguments)}}global.core=core;$def.F=1;$def.G=2;$def.S=4;$def.P=8;$def.B=16;$def.W=32;function $def(type,name,source){var key,own,out,exp,isGlobal=type&$def.G,target=isGlobal?global:type&$def.S?global[name]:(global[name]||{}).prototype,exports=isGlobal?core:core[name]||(core[name]={});if(isGlobal)source=name;for(key in source){own=!(type&$def.F)&&target&&key in target;out=(own?target:source)[key];if(type&$def.B&&own)exp=ctx(out,global);else exp=type&$def.P&&isFunction(out)?ctx(Function.call,out):out;if(target&&!own){if(isGlobal)target[key]=out;else delete target[key]&&$.hide(target,key,out)}if(exports[key]!=out)$.hide(exports,key,exp)}}module.exports=$def},{"./$":21}],13:[function(require,module,exports){var $=require("./$");module.exports=function(it){var keys=$.getKeys(it),getDesc=$.getDesc,getSymbols=$.getSymbols;if(getSymbols)$.each.call(getSymbols(it),function(key){if(getDesc(it,key).enumerable)keys.push(key)});return keys}},{"./$":21}],14:[function(require,module,exports){var ctx=require("./$.ctx"),get=require("./$.iter").get,call=require("./$.iter-call");module.exports=function(iterable,entries,fn,that){var iterator=get(iterable),f=ctx(fn,that,entries?2:1),step;while(!(step=iterator.next()).done){if(call(iterator,f,step.value,entries)===false){return call.close(iterator)}}}},{"./$.ctx":11,"./$.iter":20,"./$.iter-call":17}],15:[function(require,module,exports){module.exports=function($){$.FW=true;$.path=$.g;return $}},{}],16:[function(require,module,exports){module.exports=function(fn,args,that){var un=that===undefined;switch(args.length){case 0:return un?fn():fn.call(that);case 1:return un?fn(args[0]):fn.call(that,args[0]);case 2:return un?fn(args[0],args[1]):fn.call(that,args[0],args[1]);case 3:return un?fn(args[0],args[1],args[2]):fn.call(that,args[0],args[1],args[2]);case 4:return un?fn(args[0],args[1],args[2],args[3]):fn.call(that,args[0],args[1],args[2],args[3]);case 5:return un?fn(args[0],args[1],args[2],args[3],args[4]):fn.call(that,args[0],args[1],args[2],args[3],args[4])}return fn.apply(that,args)}},{}],17:[function(require,module,exports){var assertObject=require("./$.assert").obj;function close(iterator){var ret=iterator["return"];if(ret!==undefined)assertObject(ret.call(iterator))}function call(iterator,fn,value,entries){try{return entries?fn(assertObject(value)[0],value[1]):fn(value)}catch(e){close(iterator);throw e}}call.close=close;module.exports=call},{"./$.assert":4}],18:[function(require,module,exports){var $def=require("./$.def"),$=require("./$"),cof=require("./$.cof"),$iter=require("./$.iter"),SYMBOL_ITERATOR=require("./$.wks")("iterator"),FF_ITERATOR="@@iterator",VALUES="values",Iterators=$iter.Iterators;module.exports=function(Base,NAME,Constructor,next,DEFAULT,IS_SET,FORCE){$iter.create(Constructor,NAME,next);function createMethod(kind){return function(){return new Constructor(this,kind)}}var TAG=NAME+" Iterator",proto=Base.prototype,_native=proto[SYMBOL_ITERATOR]||proto[FF_ITERATOR]||DEFAULT&&proto[DEFAULT],_default=_native||createMethod(DEFAULT),methods,key;if(_native){var IteratorPrototype=$.getProto(_default.call(new Base));cof.set(IteratorPrototype,TAG,true);if($.FW&&$.has(proto,FF_ITERATOR))$iter.set(IteratorPrototype,$.that)}if($.FW)$iter.set(proto,_default);Iterators[NAME]=_default;Iterators[TAG]=$.that;if(DEFAULT){methods={keys:IS_SET?_default:createMethod("keys"),values:DEFAULT==VALUES?_default:createMethod(VALUES),entries:DEFAULT!=VALUES?_default:createMethod("entries")};if(FORCE)for(key in methods){if(!(key in proto))$.hide(proto,key,methods[key])}else $def($def.P+$def.F*$iter.BUGGY,NAME,methods)}}},{"./$":21,"./$.cof":6,"./$.def":12,"./$.iter":20,"./$.wks":32}],19:[function(require,module,exports){var SYMBOL_ITERATOR=require("./$.wks")("iterator"),SAFE_CLOSING=false;try{var riter=[7][SYMBOL_ITERATOR]();riter["return"]=function(){SAFE_CLOSING=true};Array.from(riter,function(){throw 2})}catch(e){}module.exports=function(exec){if(!SAFE_CLOSING)return false;var safe=false;try{var arr=[7],iter=arr[SYMBOL_ITERATOR]();iter.next=function(){safe=true};arr[SYMBOL_ITERATOR]=function(){return iter};exec(arr)}catch(e){}return safe}},{"./$.wks":32}],20:[function(require,module,exports){"use strict";var $=require("./$"),cof=require("./$.cof"),assertObject=require("./$.assert").obj,SYMBOL_ITERATOR=require("./$.wks")("iterator"),FF_ITERATOR="@@iterator",Iterators={},IteratorPrototype={};setIterator(IteratorPrototype,$.that);function setIterator(O,value){$.hide(O,SYMBOL_ITERATOR,value);if(FF_ITERATOR in[])$.hide(O,FF_ITERATOR,value)}module.exports={BUGGY:"keys"in[]&&!("next"in[].keys()),Iterators:Iterators,step:function(done,value){return{value:value,done:!!done}},is:function(it){var O=Object(it),Symbol=$.g.Symbol,SYM=Symbol&&Symbol.iterator||FF_ITERATOR;return SYM in O||SYMBOL_ITERATOR in O||$.has(Iterators,cof.classof(O))},get:function(it){var Symbol=$.g.Symbol,ext=it[Symbol&&Symbol.iterator||FF_ITERATOR],getIter=ext||it[SYMBOL_ITERATOR]||Iterators[cof.classof(it)];return assertObject(getIter.call(it))},set:setIterator,create:function(Constructor,NAME,next,proto){Constructor.prototype=$.create(proto||IteratorPrototype,{next:$.desc(1,next)});cof.set(Constructor,NAME+" Iterator")}}},{"./$":21,"./$.assert":4,"./$.cof":6,"./$.wks":32}],21:[function(require,module,exports){"use strict";var global=typeof self!="undefined"?self:Function("return this")(),core={},defineProperty=Object.defineProperty,hasOwnProperty={}.hasOwnProperty,ceil=Math.ceil,floor=Math.floor,max=Math.max,min=Math.min;var DESC=!!function(){try{return defineProperty({},"a",{get:function(){return 2}}).a==2}catch(e){}}();var hide=createDefiner(1);function toInteger(it){return isNaN(it=+it)?0:(it>0?floor:ceil)(it)}function desc(bitmap,value){return{enumerable:!(bitmap&1),configurable:!(bitmap&2),writable:!(bitmap&4),value:value}}function simpleSet(object,key,value){object[key]=value;return object}function createDefiner(bitmap){return DESC?function(object,key,value){return $.setDesc(object,key,desc(bitmap,value))}:simpleSet}function isObject(it){return it!==null&&(typeof it=="object"||typeof it=="function")}function isFunction(it){return typeof it=="function"}function assertDefined(it){if(it==undefined)throw TypeError("Can't call method on "+it);return it}var $=module.exports=require("./$.fw")({g:global,core:core,html:global.document&&document.documentElement,isObject:isObject,isFunction:isFunction,it:function(it){return it},that:function(){return this},toInteger:toInteger,toLength:function(it){return it>0?min(toInteger(it),9007199254740991):0},toIndex:function(index,length){index=toInteger(index);return index<0?max(index+length,0):min(index,length)},has:function(it,key){return hasOwnProperty.call(it,key)},create:Object.create,getProto:Object.getPrototypeOf,DESC:DESC,desc:desc,getDesc:Object.getOwnPropertyDescriptor,setDesc:defineProperty,setDescs:Object.defineProperties,getKeys:Object.keys,getNames:Object.getOwnPropertyNames,getSymbols:Object.getOwnPropertySymbols,assertDefined:assertDefined,ES5Object:Object,toObject:function(it){return $.ES5Object(assertDefined(it))},hide:hide,def:createDefiner(0),set:global.Symbol?simpleSet:hide,mix:function(target,src){for(var key in src)hide(target,key,src[key]);return target},each:[].forEach});if(typeof __e!="undefined")__e=core;if(typeof __g!="undefined")__g=global},{"./$.fw":15}],22:[function(require,module,exports){var $=require("./$");module.exports=function(object,el){var O=$.toObject(object),keys=$.getKeys(O),length=keys.length,index=0,key;while(length>index)if(O[key=keys[index++]]===el)return key}},{"./$":21}],23:[function(require,module,exports){var $=require("./$"),assertObject=require("./$.assert").obj;module.exports=function ownKeys(it){assertObject(it);var keys=$.getNames(it),getSymbols=$.getSymbols;return getSymbols?keys.concat(getSymbols(it)):keys}},{"./$":21,"./$.assert":4}],24:[function(require,module,exports){"use strict";var $=require("./$"),invoke=require("./$.invoke"),assertFunction=require("./$.assert").fn;module.exports=function(){var fn=assertFunction(this),length=arguments.length,pargs=Array(length),i=0,_=$.path._,holder=false;while(length>i)if((pargs[i]=arguments[i++])===_)holder=true;return function(){var that=this,_length=arguments.length,j=0,k=0,args;if(!holder&&!_length)return invoke(fn,pargs,that);args=pargs.slice();if(holder)for(;length>j;j++)if(args[j]===_)args[j]=arguments[k++];while(_length>k)args.push(arguments[k++]);return invoke(fn,args,that)}}},{"./$":21,"./$.assert":4,"./$.invoke":16}],25:[function(require,module,exports){"use strict";module.exports=function(regExp,replace,isStatic){var replacer=replace===Object(replace)?function(part){return replace[part]}:replace;return function(it){return String(isStatic?it:this).replace(regExp,replacer)}}},{}],26:[function(require,module,exports){var $=require("./$"),assert=require("./$.assert");function check(O,proto){assert.obj(O);assert(proto===null||$.isObject(proto),proto,": can't set as prototype!")}module.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(buggy,set){try{set=require("./$.ctx")(Function.call,$.getDesc(Object.prototype,"__proto__").set,2);set({},[])}catch(e){buggy=true}return function setPrototypeOf(O,proto){check(O,proto);if(buggy)O.__proto__=proto;else set(O,proto);return O}}():undefined),check:check}},{"./$":21,"./$.assert":4,"./$.ctx":11}],27:[function(require,module,exports){var $=require("./$"),SPECIES=require("./$.wks")("species");module.exports=function(C){if($.DESC&&!(SPECIES in C))$.setDesc(C,SPECIES,{configurable:true,get:$.that})}},{"./$":21,"./$.wks":32}],28:[function(require,module,exports){"use strict";var $=require("./$");module.exports=function(TO_STRING){return function(pos){var s=String($.assertDefined(this)),i=$.toInteger(pos),l=s.length,a,b;if(i<0||i>=l)return TO_STRING?"":undefined;a=s.charCodeAt(i);return a<55296||a>56319||i+1===l||(b=s.charCodeAt(i+1))<56320||b>57343?TO_STRING?s.charAt(i):a:TO_STRING?s.slice(i,i+2):(a-55296<<10)+(b-56320)+65536}}},{"./$":21}],29:[function(require,module,exports){"use strict";var $=require("./$"),ctx=require("./$.ctx"),cof=require("./$.cof"),invoke=require("./$.invoke"),global=$.g,isFunction=$.isFunction,html=$.html,document=global.document,process=global.process,setTask=global.setImmediate,clearTask=global.clearImmediate,postMessage=global.postMessage,addEventListener=global.addEventListener,MessageChannel=global.MessageChannel,counter=0,queue={},ONREADYSTATECHANGE="onreadystatechange",defer,channel,port;function run(){var id=+this;if($.has(queue,id)){var fn=queue[id];delete queue[id];fn()}}function listner(event){run.call(event.data)}if(!isFunction(setTask)||!isFunction(clearTask)){setTask=function(fn){var args=[],i=1;while(arguments.length>i)args.push(arguments[i++]);queue[++counter]=function(){invoke(isFunction(fn)?fn:Function(fn),args)};defer(counter);return counter};clearTask=function(id){delete queue[id]};if(cof(process)=="process"){defer=function(id){process.nextTick(ctx(run,id,1))}}else if(addEventListener&&isFunction(postMessage)&&!global.importScripts){defer=function(id){postMessage(id,"*")};addEventListener("message",listner,false)}else if(isFunction(MessageChannel)){channel=new MessageChannel;port=channel.port2;channel.port1.onmessage=listner;defer=ctx(port.postMessage,port,1)}else if(document&&ONREADYSTATECHANGE in document.createElement("script")){defer=function(id){html.appendChild(document.createElement("script"))[ONREADYSTATECHANGE]=function(){html.removeChild(this);run.call(id)}}}else{defer=function(id){setTimeout(ctx(run,id,1),0)}}}module.exports={set:setTask,clear:clearTask}},{"./$":21,"./$.cof":6,"./$.ctx":11,"./$.invoke":16}],30:[function(require,module,exports){var sid=0;function uid(key){return"Symbol("+key+")_"+(++sid+Math.random()).toString(36)}uid.safe=require("./$").g.Symbol||uid;module.exports=uid},{"./$":21}],31:[function(require,module,exports){var $=require("./$"),UNSCOPABLES=require("./$.wks")("unscopables");if($.FW&&!(UNSCOPABLES in[]))$.hide(Array.prototype,UNSCOPABLES,{});module.exports=function(key){if($.FW)[][UNSCOPABLES][key]=true}},{"./$":21,"./$.wks":32}],32:[function(require,module,exports){var global=require("./$").g,store={};module.exports=function(name){return store[name]||(store[name]=global.Symbol&&global.Symbol[name]||require("./$.uid").safe("Symbol."+name))}},{"./$":21,"./$.uid":30}],33:[function(require,module,exports){var $=require("./$"),cof=require("./$.cof"),$def=require("./$.def"),invoke=require("./$.invoke"),arrayMethod=require("./$.array-methods"),IE_PROTO=require("./$.uid").safe("__proto__"),assert=require("./$.assert"),assertObject=assert.obj,ObjectProto=Object.prototype,A=[],slice=A.slice,indexOf=A.indexOf,classof=cof.classof,has=$.has,defineProperty=$.setDesc,getOwnDescriptor=$.getDesc,defineProperties=$.setDescs,isFunction=$.isFunction,toObject=$.toObject,toLength=$.toLength,IE8_DOM_DEFINE=false;if(!$.DESC){try{IE8_DOM_DEFINE=defineProperty(document.createElement("div"),"x",{get:function(){return 8}}).x==8}catch(e){}$.setDesc=function(O,P,Attributes){if(IE8_DOM_DEFINE)try{return defineProperty(O,P,Attributes)}catch(e){}if("get"in Attributes||"set"in Attributes)throw TypeError("Accessors not supported!");if("value"in Attributes)assertObject(O)[P]=Attributes.value;return O};$.getDesc=function(O,P){if(IE8_DOM_DEFINE)try{return getOwnDescriptor(O,P)}catch(e){}if(has(O,P))return $.desc(!ObjectProto.propertyIsEnumerable.call(O,P),O[P])};$.setDescs=defineProperties=function(O,Properties){assertObject(O);var keys=$.getKeys(Properties),length=keys.length,i=0,P;while(length>i)$.setDesc(O,P=keys[i++],Properties[P]);return O}}$def($def.S+$def.F*!$.DESC,"Object",{getOwnPropertyDescriptor:$.getDesc,defineProperty:$.setDesc,defineProperties:defineProperties});var keys1=("constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,"+"toLocaleString,toString,valueOf").split(","),keys2=keys1.concat("length","prototype"),keysLen1=keys1.length;var createDict=function(){var iframe=document.createElement("iframe"),i=keysLen1,gt=">",iframeDocument;iframe.style.display="none";$.html.appendChild(iframe);iframe.src="javascript:";iframeDocument=iframe.contentWindow.document;iframeDocument.open();iframeDocument.write("<script>document.F=Object</script"+gt);iframeDocument.close();createDict=iframeDocument.F;while(i--)delete createDict.prototype[keys1[i]];return createDict()};function createGetKeys(names,length){return function(object){var O=toObject(object),i=0,result=[],key;for(key in O)if(key!=IE_PROTO)has(O,key)&&result.push(key);while(length>i)if(has(O,key=names[i++])){~indexOf.call(result,key)||result.push(key)}return result}}function isPrimitive(it){return!$.isObject(it)}function Empty(){}$def($def.S,"Object",{getPrototypeOf:$.getProto=$.getProto||function(O){O=Object(assert.def(O));if(has(O,IE_PROTO))return O[IE_PROTO];if(isFunction(O.constructor)&&O instanceof O.constructor){return O.constructor.prototype}return O instanceof Object?ObjectProto:null},getOwnPropertyNames:$.getNames=$.getNames||createGetKeys(keys2,keys2.length,true),create:$.create=$.create||function(O,Properties){var result;if(O!==null){Empty.prototype=assertObject(O);result=new Empty;Empty.prototype=null;result[IE_PROTO]=O}else result=createDict();return Properties===undefined?result:defineProperties(result,Properties)},keys:$.getKeys=$.getKeys||createGetKeys(keys1,keysLen1,false),seal:$.it,freeze:$.it,preventExtensions:$.it,isSealed:isPrimitive,isFrozen:isPrimitive,isExtensible:$.isObject});$def($def.P,"Function",{bind:function(that){var fn=assert.fn(this),partArgs=slice.call(arguments,1);function bound(){var args=partArgs.concat(slice.call(arguments));return invoke(fn,args,this instanceof bound?$.create(fn.prototype):that)}if(fn.prototype)bound.prototype=fn.prototype;return bound}});function arrayMethodFix(fn){return function(){return fn.apply($.ES5Object(this),arguments)}}if(!(0 in Object("z")&&"z"[0]=="z")){$.ES5Object=function(it){return cof(it)=="String"?it.split(""):Object(it)}}$def($def.P+$def.F*($.ES5Object!=Object),"Array",{slice:arrayMethodFix(slice),join:arrayMethodFix(A.join)});$def($def.S,"Array",{isArray:function(arg){return cof(arg)=="Array"}});function createArrayReduce(isRight){return function(callbackfn,memo){assert.fn(callbackfn);var O=toObject(this),length=toLength(O.length),index=isRight?length-1:0,i=isRight?-1:1;if(arguments.length<2)for(;;){if(index in O){memo=O[index];index+=i;break}index+=i;assert(isRight?index>=0:length>index,"Reduce of empty array with no initial value")}for(;isRight?index>=0:length>index;index+=i)if(index in O){memo=callbackfn(memo,O[index],index,this)}return memo}}$def($def.P,"Array",{forEach:$.each=$.each||arrayMethod(0),map:arrayMethod(1),filter:arrayMethod(2),some:arrayMethod(3),every:arrayMethod(4),reduce:createArrayReduce(false),reduceRight:createArrayReduce(true),indexOf:indexOf=indexOf||require("./$.array-includes")(false),lastIndexOf:function(el,fromIndex){var O=toObject(this),length=toLength(O.length),index=length-1;if(arguments.length>1)index=Math.min(index,$.toInteger(fromIndex));if(index<0)index=toLength(length+index);for(;index>=0;index--)if(index in O)if(O[index]===el)return index;return-1}});$def($def.P,"String",{trim:require("./$.replacer")(/^\s*([\s\S]*\S)?\s*$/,"$1")});$def($def.S,"Date",{now:function(){return+new Date}});function lz(num){return num>9?num:"0"+num}var date=new Date(-5e13-1),brokenDate=!(date.toISOString&&date.toISOString()=="0385-07-25T07:06:39.999Z");$def($def.P+$def.F*brokenDate,"Date",{toISOString:function(){if(!isFinite(this))throw RangeError("Invalid time value");var d=this,y=d.getUTCFullYear(),m=d.getUTCMilliseconds(),s=y<0?"-":y>9999?"+":"";return s+("00000"+Math.abs(y)).slice(s?-6:-4)+"-"+lz(d.getUTCMonth()+1)+"-"+lz(d.getUTCDate())+"T"+lz(d.getUTCHours())+":"+lz(d.getUTCMinutes())+":"+lz(d.getUTCSeconds())+"."+(m>99?m:"0"+lz(m))+"Z"}});if(classof(function(){return arguments}())=="Object")cof.classof=function(it){var tag=classof(it);return tag=="Object"&&isFunction(it.callee)?"Arguments":tag}},{"./$":21,"./$.array-includes":2,"./$.array-methods":3,"./$.assert":4,"./$.cof":6,"./$.def":12,"./$.invoke":16,"./$.replacer":25,"./$.uid":30}],34:[function(require,module,exports){"use strict";var $=require("./$"),$def=require("./$.def"),toIndex=$.toIndex;$def($def.P,"Array",{copyWithin:function copyWithin(target,start){var O=Object($.assertDefined(this)),len=$.toLength(O.length),to=toIndex(target,len),from=toIndex(start,len),end=arguments[2],fin=end===undefined?len:toIndex(end,len),count=Math.min(fin-from,len-to),inc=1;if(from<to&&to<from+count){inc=-1;from=from+count-1;to=to+count-1}while(count-->0){if(from in O)O[to]=O[from];else delete O[to];to+=inc;from+=inc}return O}});require("./$.unscope")("copyWithin")},{"./$":21,"./$.def":12,"./$.unscope":31}],35:[function(require,module,exports){"use strict";var $=require("./$"),$def=require("./$.def"),toIndex=$.toIndex;$def($def.P,"Array",{fill:function fill(value){var O=Object($.assertDefined(this)),length=$.toLength(O.length),index=toIndex(arguments[1],length),end=arguments[2],endPos=end===undefined?length:toIndex(end,length);while(endPos>index)O[index++]=value;return O}});require("./$.unscope")("fill")},{"./$":21,"./$.def":12,"./$.unscope":31}],36:[function(require,module,exports){var $def=require("./$.def");$def($def.P,"Array",{findIndex:require("./$.array-methods")(6)});require("./$.unscope")("findIndex")},{"./$.array-methods":3,"./$.def":12,"./$.unscope":31}],37:[function(require,module,exports){var $def=require("./$.def");$def($def.P,"Array",{find:require("./$.array-methods")(5)});require("./$.unscope")("find")},{"./$.array-methods":3,"./$.def":12,"./$.unscope":31}],38:[function(require,module,exports){var $=require("./$"),ctx=require("./$.ctx"),$def=require("./$.def"),$iter=require("./$.iter"),call=require("./$.iter-call");$def($def.S+$def.F*!require("./$.iter-detect")(function(iter){Array.from(iter)}),"Array",{from:function from(arrayLike){var O=Object($.assertDefined(arrayLike)),mapfn=arguments[1],mapping=mapfn!==undefined,f=mapping?ctx(mapfn,arguments[2],2):undefined,index=0,length,result,step,iterator;if($iter.is(O)){iterator=$iter.get(O);result=new(typeof this=="function"?this:Array);for(;!(step=iterator.next()).done;index++){result[index]=mapping?call(iterator,f,[step.value,index],true):step.value}}else{result=new(typeof this=="function"?this:Array)(length=$.toLength(O.length));for(;length>index;index++){result[index]=mapping?f(O[index],index):O[index]}}result.length=index;return result}})},{"./$":21,"./$.ctx":11,"./$.def":12,"./$.iter":20,"./$.iter-call":17,"./$.iter-detect":19}],39:[function(require,module,exports){var $=require("./$"),setUnscope=require("./$.unscope"),ITER=require("./$.uid").safe("iter"),$iter=require("./$.iter"),step=$iter.step,Iterators=$iter.Iterators;require("./$.iter-define")(Array,"Array",function(iterated,kind){$.set(this,ITER,{o:$.toObject(iterated),i:0,k:kind})},function(){var iter=this[ITER],O=iter.o,kind=iter.k,index=iter.i++;if(!O||index>=O.length){iter.o=undefined;return step(1)}if(kind=="keys")return step(0,index);if(kind=="values")return step(0,O[index]);return step(0,[index,O[index]])},"values");Iterators.Arguments=Iterators.Array;setUnscope("keys");setUnscope("values");setUnscope("entries")},{"./$":21,"./$.iter":20,"./$.iter-define":18,"./$.uid":30,"./$.unscope":31}],40:[function(require,module,exports){var $def=require("./$.def");$def($def.S,"Array",{of:function of(){var index=0,length=arguments.length,result=new(typeof this=="function"?this:Array)(length);while(length>index)result[index]=arguments[index++];result.length=length;return result;
}})},{"./$.def":12}],41:[function(require,module,exports){require("./$.species")(Array)},{"./$.species":27}],42:[function(require,module,exports){"use strict";var $=require("./$"),NAME="name",setDesc=$.setDesc,FunctionProto=Function.prototype;NAME in FunctionProto||$.FW&&$.DESC&&setDesc(FunctionProto,NAME,{configurable:true,get:function(){var match=String(this).match(/^\s*function ([^ (]*)/),name=match?match[1]:"";$.has(this,NAME)||setDesc(this,NAME,$.desc(5,name));return name},set:function(value){$.has(this,NAME)||setDesc(this,NAME,$.desc(0,value))}})},{"./$":21}],43:[function(require,module,exports){"use strict";var strong=require("./$.collection-strong");require("./$.collection")("Map",{get:function get(key){var entry=strong.getEntry(this,key);return entry&&entry.v},set:function set(key,value){return strong.def(this,key===0?0:key,value)}},strong,true)},{"./$.collection":10,"./$.collection-strong":7}],44:[function(require,module,exports){var Infinity=1/0,$def=require("./$.def"),E=Math.E,pow=Math.pow,abs=Math.abs,exp=Math.exp,log=Math.log,sqrt=Math.sqrt,ceil=Math.ceil,floor=Math.floor,EPSILON=pow(2,-52),EPSILON32=pow(2,-23),MAX32=pow(2,127)*(2-EPSILON32),MIN32=pow(2,-126);function roundTiesToEven(n){return n+1/EPSILON-1/EPSILON}function sign(x){return(x=+x)==0||x!=x?x:x<0?-1:1}function asinh(x){return!isFinite(x=+x)||x==0?x:x<0?-asinh(-x):log(x+sqrt(x*x+1))}function expm1(x){return(x=+x)==0?x:x>-1e-6&&x<1e-6?x+x*x/2:exp(x)-1}$def($def.S,"Math",{acosh:function acosh(x){return(x=+x)<1?NaN:isFinite(x)?log(x/E+sqrt(x+1)*sqrt(x-1)/E)+1:x},asinh:asinh,atanh:function atanh(x){return(x=+x)==0?x:log((1+x)/(1-x))/2},cbrt:function cbrt(x){return sign(x=+x)*pow(abs(x),1/3)},clz32:function clz32(x){return(x>>>=0)?31-floor(log(x+.5)*Math.LOG2E):32},cosh:function cosh(x){return(exp(x=+x)+exp(-x))/2},expm1:expm1,fround:function fround(x){var $abs=abs(x),$sign=sign(x),a,result;if($abs<MIN32)return $sign*roundTiesToEven($abs/MIN32/EPSILON32)*MIN32*EPSILON32;a=(1+EPSILON32/EPSILON)*$abs;result=a-(a-$abs);if(result>MAX32||result!=result)return $sign*Infinity;return $sign*result},hypot:function hypot(value1,value2){var sum=0,len1=arguments.length,len2=len1,args=Array(len1),larg=-Infinity,arg;while(len1--){arg=args[len1]=+arguments[len1];if(arg==Infinity||arg==-Infinity)return Infinity;if(arg>larg)larg=arg}larg=arg||1;while(len2--)sum+=pow(args[len2]/larg,2);return larg*sqrt(sum)},imul:function imul(x,y){var UInt16=65535,xn=+x,yn=+y,xl=UInt16&xn,yl=UInt16&yn;return 0|xl*yl+((UInt16&xn>>>16)*yl+xl*(UInt16&yn>>>16)<<16>>>0)},log1p:function log1p(x){return(x=+x)>-1e-8&&x<1e-8?x-x*x/2:log(1+x)},log10:function log10(x){return log(x)/Math.LN10},log2:function log2(x){return log(x)/Math.LN2},sign:sign,sinh:function sinh(x){return abs(x=+x)<1?(expm1(x)-expm1(-x))/2:(exp(x-1)-exp(-x-1))*(E/2)},tanh:function tanh(x){var a=expm1(x=+x),b=expm1(-x);return a==Infinity?1:b==Infinity?-1:(a-b)/(exp(x)+exp(-x))},trunc:function trunc(it){return(it>0?floor:ceil)(it)}})},{"./$.def":12}],45:[function(require,module,exports){"use strict";var $=require("./$"),isObject=$.isObject,isFunction=$.isFunction,NUMBER="Number",Number=$.g[NUMBER],Base=Number,proto=Number.prototype;function toPrimitive(it){var fn,val;if(isFunction(fn=it.valueOf)&&!isObject(val=fn.call(it)))return val;if(isFunction(fn=it.toString)&&!isObject(val=fn.call(it)))return val;throw TypeError("Can't convert object to number")}function toNumber(it){if(isObject(it))it=toPrimitive(it);if(typeof it=="string"&&it.length>2&&it.charCodeAt(0)==48){var binary=false;switch(it.charCodeAt(1)){case 66:case 98:binary=true;case 79:case 111:return parseInt(it.slice(2),binary?2:8)}}return+it}if($.FW&&!(Number("0o1")&&Number("0b1"))){Number=function Number(it){return this instanceof Number?new Base(toNumber(it)):toNumber(it)};$.each.call($.DESC?$.getNames(Base):("MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,"+"EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,"+"MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger").split(","),function(key){if($.has(Base,key)&&!$.has(Number,key)){$.setDesc(Number,key,$.getDesc(Base,key))}});Number.prototype=proto;proto.constructor=Number;$.hide($.g,NUMBER,Number)}},{"./$":21}],46:[function(require,module,exports){var $=require("./$"),$def=require("./$.def"),abs=Math.abs,floor=Math.floor,_isFinite=$.g.isFinite,MAX_SAFE_INTEGER=9007199254740991;function isInteger(it){return!$.isObject(it)&&_isFinite(it)&&floor(it)===it}$def($def.S,"Number",{EPSILON:Math.pow(2,-52),isFinite:function isFinite(it){return typeof it=="number"&&_isFinite(it)},isInteger:isInteger,isNaN:function isNaN(number){return number!=number},isSafeInteger:function isSafeInteger(number){return isInteger(number)&&abs(number)<=MAX_SAFE_INTEGER},MAX_SAFE_INTEGER:MAX_SAFE_INTEGER,MIN_SAFE_INTEGER:-MAX_SAFE_INTEGER,parseFloat:parseFloat,parseInt:parseInt})},{"./$":21,"./$.def":12}],47:[function(require,module,exports){var $def=require("./$.def");$def($def.S,"Object",{assign:require("./$.assign")})},{"./$.assign":5,"./$.def":12}],48:[function(require,module,exports){var $def=require("./$.def");$def($def.S,"Object",{is:function is(x,y){return x===y?x!==0||1/x===1/y:x!=x&&y!=y}})},{"./$.def":12}],49:[function(require,module,exports){var $def=require("./$.def");$def($def.S,"Object",{setPrototypeOf:require("./$.set-proto").set})},{"./$.def":12,"./$.set-proto":26}],50:[function(require,module,exports){var $=require("./$"),$def=require("./$.def"),isObject=$.isObject,toObject=$.toObject;function wrapObjectMethod(METHOD,MODE){var fn=($.core.Object||{})[METHOD]||Object[METHOD],f=0,o={};o[METHOD]=MODE==1?function(it){return isObject(it)?fn(it):it}:MODE==2?function(it){return isObject(it)?fn(it):true}:MODE==3?function(it){return isObject(it)?fn(it):false}:MODE==4?function getOwnPropertyDescriptor(it,key){return fn(toObject(it),key)}:MODE==5?function getPrototypeOf(it){return fn(Object($.assertDefined(it)))}:function(it){return fn(toObject(it))};try{fn("z")}catch(e){f=1}$def($def.S+$def.F*f,"Object",o)}wrapObjectMethod("freeze",1);wrapObjectMethod("seal",1);wrapObjectMethod("preventExtensions",1);wrapObjectMethod("isFrozen",2);wrapObjectMethod("isSealed",2);wrapObjectMethod("isExtensible",3);wrapObjectMethod("getOwnPropertyDescriptor",4);wrapObjectMethod("getPrototypeOf",5);wrapObjectMethod("keys");wrapObjectMethod("getOwnPropertyNames")},{"./$":21,"./$.def":12}],51:[function(require,module,exports){"use strict";var $=require("./$"),cof=require("./$.cof"),tmp={};tmp[require("./$.wks")("toStringTag")]="z";if($.FW&&cof(tmp)!="z")$.hide(Object.prototype,"toString",function toString(){return"[object "+cof.classof(this)+"]"})},{"./$":21,"./$.cof":6,"./$.wks":32}],52:[function(require,module,exports){"use strict";var $=require("./$"),ctx=require("./$.ctx"),cof=require("./$.cof"),$def=require("./$.def"),assert=require("./$.assert"),forOf=require("./$.for-of"),setProto=require("./$.set-proto").set,species=require("./$.species"),SPECIES=require("./$.wks")("species"),RECORD=require("./$.uid").safe("record"),PROMISE="Promise",global=$.g,process=global.process,asap=process&&process.nextTick||require("./$.task").set,P=global[PROMISE],isFunction=$.isFunction,isObject=$.isObject,assertFunction=assert.fn,assertObject=assert.obj,test;var useNative=isFunction(P)&&isFunction(P.resolve)&&P.resolve(test=new P(function(){}))==test;function P2(x){var self=new P(x);setProto(self,P2.prototype);return self}if(useNative){try{setProto(P2,P);P2.prototype=$.create(P.prototype,{constructor:{value:P2}});if(!(P2.resolve(5).then(function(){})instanceof P2)){useNative=false}}catch(e){useNative=false}}function getConstructor(C){var S=assertObject(C)[SPECIES];return S!=undefined?S:C}function isThenable(it){var then;if(isObject(it))then=it.then;return isFunction(then)?then:false}function notify(record){var chain=record.c;if(chain.length)asap(function(){var value=record.v,ok=record.s==1,i=0;while(chain.length>i)!function(react){var cb=ok?react.ok:react.fail,ret,then;try{if(cb){if(!ok)record.h=true;ret=cb===true?value:cb(value);if(ret===react.P){react.rej(TypeError("Promise-chain cycle"))}else if(then=isThenable(ret)){then.call(ret,react.res,react.rej)}else react.res(ret)}else react.rej(value)}catch(err){react.rej(err)}}(chain[i++]);chain.length=0})}function isUnhandled(promise){var record=promise[RECORD],chain=record.a,i=0,react;if(record.h)return false;while(chain.length>i){react=chain[i++];if(react.fail||!isUnhandled(react.P))return false}return true}function $reject(value){var record=this,promise;if(record.d)return;record.d=true;record=record.r||record;record.v=value;record.s=2;asap(function(){setTimeout(function(){if(isUnhandled(promise=record.p)){if(cof(process)=="process"){process.emit("unhandledRejection",value,promise)}else if(global.console&&isFunction(console.error)){console.error("Unhandled promise rejection",value)}}},1)});notify(record)}function $resolve(value){var record=this,then,wrapper;if(record.d)return;record.d=true;record=record.r||record;try{if(then=isThenable(value)){wrapper={r:record,d:false};then.call(value,ctx($resolve,wrapper,1),ctx($reject,wrapper,1))}else{record.v=value;record.s=1;notify(record)}}catch(err){$reject.call(wrapper||{r:record,d:false},err)}}if(!useNative){P=function Promise(executor){assertFunction(executor);var record={p:assert.inst(this,P,PROMISE),c:[],a:[],s:0,d:false,v:undefined,h:false};$.hide(this,RECORD,record);try{executor(ctx($resolve,record,1),ctx($reject,record,1))}catch(err){$reject.call(record,err)}};$.mix(P.prototype,{then:function then(onFulfilled,onRejected){var S=assertObject(assertObject(this).constructor)[SPECIES];var react={ok:isFunction(onFulfilled)?onFulfilled:true,fail:isFunction(onRejected)?onRejected:false};var promise=react.P=new(S!=undefined?S:P)(function(res,rej){react.res=assertFunction(res);react.rej=assertFunction(rej)});var record=this[RECORD];record.a.push(react);record.c.push(react);record.s&¬ify(record);return promise},"catch":function(onRejected){return this.then(undefined,onRejected)}})}$def($def.G+$def.W+$def.F*!useNative,{Promise:P});cof.set(P,PROMISE);species(P);species($.core[PROMISE]);$def($def.S+$def.F*!useNative,PROMISE,{reject:function reject(r){return new(getConstructor(this))(function(res,rej){rej(r)})},resolve:function resolve(x){return isObject(x)&&RECORD in x&&$.getProto(x)===this.prototype?x:new(getConstructor(this))(function(res){res(x)})}});$def($def.S+$def.F*!(useNative&&require("./$.iter-detect")(function(iter){P.all(iter)["catch"](function(){})})),PROMISE,{all:function all(iterable){var C=getConstructor(this),values=[];return new C(function(res,rej){forOf(iterable,false,values.push,values);var remaining=values.length,results=Array(remaining);if(remaining)$.each.call(values,function(promise,index){C.resolve(promise).then(function(value){results[index]=value;--remaining||res(results)},rej)});else res(results)})},race:function race(iterable){var C=getConstructor(this);return new C(function(res,rej){forOf(iterable,false,function(promise){C.resolve(promise).then(res,rej)})})}})},{"./$":21,"./$.assert":4,"./$.cof":6,"./$.ctx":11,"./$.def":12,"./$.for-of":14,"./$.iter-detect":19,"./$.set-proto":26,"./$.species":27,"./$.task":29,"./$.uid":30,"./$.wks":32}],53:[function(require,module,exports){var $=require("./$"),$def=require("./$.def"),setProto=require("./$.set-proto"),$iter=require("./$.iter"),ITER=require("./$.uid").safe("iter"),step=$iter.step,assert=require("./$.assert"),isObject=$.isObject,getDesc=$.getDesc,setDesc=$.setDesc,getProto=$.getProto,apply=Function.apply,assertObject=assert.obj,_isExtensible=Object.isExtensible||$.it;function Enumerate(iterated){$.set(this,ITER,{o:iterated,k:undefined,i:0})}$iter.create(Enumerate,"Object",function(){var iter=this[ITER],keys=iter.k,key;if(keys==undefined){iter.k=keys=[];for(key in iter.o)keys.push(key)}do{if(iter.i>=keys.length)return step(1)}while(!((key=keys[iter.i++])in iter.o));return step(0,key)});function wrap(fn){return function(it){assertObject(it);try{fn.apply(undefined,arguments);return true}catch(e){return false}}}function get(target,propertyKey){var receiver=arguments.length<3?target:arguments[2],desc=getDesc(assertObject(target),propertyKey),proto;if(desc)return $.has(desc,"value")?desc.value:desc.get===undefined?undefined:desc.get.call(receiver);return isObject(proto=getProto(target))?get(proto,propertyKey,receiver):undefined}function set(target,propertyKey,V){var receiver=arguments.length<4?target:arguments[3],ownDesc=getDesc(assertObject(target),propertyKey),existingDescriptor,proto;if(!ownDesc){if(isObject(proto=getProto(target))){return set(proto,propertyKey,V,receiver)}ownDesc=$.desc(0)}if($.has(ownDesc,"value")){if(ownDesc.writable===false||!isObject(receiver))return false;existingDescriptor=getDesc(receiver,propertyKey)||$.desc(0);existingDescriptor.value=V;setDesc(receiver,propertyKey,existingDescriptor);return true}return ownDesc.set===undefined?false:(ownDesc.set.call(receiver,V),true)}var reflect={apply:require("./$.ctx")(Function.call,apply,3),construct:function construct(target,argumentsList){var proto=assert.fn(arguments.length<3?target:arguments[2]).prototype,instance=$.create(isObject(proto)?proto:Object.prototype),result=apply.call(target,instance,argumentsList);return isObject(result)?result:instance},defineProperty:wrap(setDesc),deleteProperty:function deleteProperty(target,propertyKey){var desc=getDesc(assertObject(target),propertyKey);return desc&&!desc.configurable?false:delete target[propertyKey]},enumerate:function enumerate(target){return new Enumerate(assertObject(target))},get:get,getOwnPropertyDescriptor:function getOwnPropertyDescriptor(target,propertyKey){return getDesc(assertObject(target),propertyKey)},getPrototypeOf:function getPrototypeOf(target){return getProto(assertObject(target))},has:function has(target,propertyKey){return propertyKey in target},isExtensible:function isExtensible(target){return!!_isExtensible(assertObject(target))},ownKeys:require("./$.own-keys"),preventExtensions:wrap(Object.preventExtensions||$.it),set:set};if(setProto)reflect.setPrototypeOf=function setPrototypeOf(target,proto){setProto.check(target,proto);try{setProto.set(target,proto);return true}catch(e){return false}};$def($def.G,{Reflect:{}});$def($def.S,"Reflect",reflect)},{"./$":21,"./$.assert":4,"./$.ctx":11,"./$.def":12,"./$.iter":20,"./$.own-keys":23,"./$.set-proto":26,"./$.uid":30}],54:[function(require,module,exports){var $=require("./$"),cof=require("./$.cof"),RegExp=$.g.RegExp,Base=RegExp,proto=RegExp.prototype;function regExpBroken(){try{var a=/a/g;if(a===new RegExp(a)){return true}return RegExp(/a/g,"i")!="/a/i"}catch(e){return true}}if($.FW&&$.DESC){if(regExpBroken()){RegExp=function RegExp(pattern,flags){return new Base(cof(pattern)=="RegExp"?pattern.source:pattern,flags===undefined?pattern.flags:flags)};$.each.call($.getNames(Base),function(key){key in RegExp||$.setDesc(RegExp,key,{configurable:true,get:function(){return Base[key]},set:function(it){Base[key]=it}})});proto.constructor=RegExp;RegExp.prototype=proto;$.hide($.g,"RegExp",RegExp)}if(/./g.flags!="g")$.setDesc(proto,"flags",{configurable:true,get:require("./$.replacer")(/^.*\/(\w*)$/,"$1")})}require("./$.species")(RegExp)},{"./$":21,"./$.cof":6,"./$.replacer":25,"./$.species":27}],55:[function(require,module,exports){"use strict";var strong=require("./$.collection-strong");require("./$.collection")("Set",{add:function add(value){return strong.def(this,value=value===0?0:value,value)}},strong)},{"./$.collection":10,"./$.collection-strong":7}],56:[function(require,module,exports){var $def=require("./$.def");$def($def.P,"String",{codePointAt:require("./$.string-at")(false)})},{"./$.def":12,"./$.string-at":28}],57:[function(require,module,exports){"use strict";var $=require("./$"),cof=require("./$.cof"),$def=require("./$.def"),toLength=$.toLength;$def($def.P,"String",{endsWith:function endsWith(searchString){if(cof(searchString)=="RegExp")throw TypeError();var that=String($.assertDefined(this)),endPosition=arguments[1],len=toLength(that.length),end=endPosition===undefined?len:Math.min(toLength(endPosition),len);searchString+="";return that.slice(end-searchString.length,end)===searchString}})},{"./$":21,"./$.cof":6,"./$.def":12}],58:[function(require,module,exports){var $def=require("./$.def"),toIndex=require("./$").toIndex,fromCharCode=String.fromCharCode;$def($def.S,"String",{fromCodePoint:function fromCodePoint(x){var res=[],len=arguments.length,i=0,code;while(len>i){code=+arguments[i++];if(toIndex(code,1114111)!==code)throw RangeError(code+" is not a valid code point");res.push(code<65536?fromCharCode(code):fromCharCode(((code-=65536)>>10)+55296,code%1024+56320))}return res.join("")}})},{"./$":21,"./$.def":12}],59:[function(require,module,exports){"use strict";var $=require("./$"),cof=require("./$.cof"),$def=require("./$.def");$def($def.P,"String",{includes:function includes(searchString){if(cof(searchString)=="RegExp")throw TypeError();return!!~String($.assertDefined(this)).indexOf(searchString,arguments[1])}})},{"./$":21,"./$.cof":6,"./$.def":12}],60:[function(require,module,exports){var set=require("./$").set,at=require("./$.string-at")(true),ITER=require("./$.uid").safe("iter"),$iter=require("./$.iter"),step=$iter.step;require("./$.iter-define")(String,"String",function(iterated){set(this,ITER,{o:String(iterated),i:0})},function(){var iter=this[ITER],O=iter.o,index=iter.i,point;if(index>=O.length)return step(1);point=at.call(O,index);iter.i+=point.length;return step(0,point)})},{"./$":21,"./$.iter":20,"./$.iter-define":18,"./$.string-at":28,"./$.uid":30}],61:[function(require,module,exports){var $=require("./$"),$def=require("./$.def");$def($def.S,"String",{raw:function raw(callSite){var tpl=$.toObject(callSite.raw),len=$.toLength(tpl.length),sln=arguments.length,res=[],i=0;while(len>i){res.push(String(tpl[i++]));if(i<sln)res.push(String(arguments[i]))}return res.join("")}})},{"./$":21,"./$.def":12}],62:[function(require,module,exports){"use strict";var $=require("./$"),$def=require("./$.def");$def($def.P,"String",{repeat:function repeat(count){var str=String($.assertDefined(this)),res="",n=$.toInteger(count);if(n<0||n==Infinity)throw RangeError("Count can't be negative");for(;n>0;(n>>>=1)&&(str+=str))if(n&1)res+=str;return res}})},{"./$":21,"./$.def":12}],63:[function(require,module,exports){"use strict";var $=require("./$"),cof=require("./$.cof"),$def=require("./$.def");$def($def.P,"String",{startsWith:function startsWith(searchString){if(cof(searchString)=="RegExp")throw TypeError();var that=String($.assertDefined(this)),index=$.toLength(Math.min(arguments[1],that.length));searchString+="";return that.slice(index,index+searchString.length)===searchString}})},{"./$":21,"./$.cof":6,"./$.def":12}],64:[function(require,module,exports){"use strict";var $=require("./$"),setTag=require("./$.cof").set,uid=require("./$.uid"),$def=require("./$.def"),keyOf=require("./$.keyof"),enumKeys=require("./$.enum-keys"),assertObject=require("./$.assert").obj,has=$.has,$create=$.create,getDesc=$.getDesc,setDesc=$.setDesc,desc=$.desc,getNames=$.getNames,toObject=$.toObject,Symbol=$.g.Symbol,setter=false,TAG=uid("tag"),HIDDEN=uid("hidden"),SymbolRegistry={},AllSymbols={},useNative=$.isFunction(Symbol);function wrap(tag){var sym=AllSymbols[tag]=$.set($create(Symbol.prototype),TAG,tag);$.DESC&&setter&&setDesc(Object.prototype,tag,{configurable:true,set:function(value){if(has(this,HIDDEN)&&has(this[HIDDEN],tag))this[HIDDEN][tag]=false;setDesc(this,tag,desc(1,value))}});return sym}function defineProperty(it,key,D){if(D&&has(AllSymbols,key)){if(!D.enumerable){if(!has(it,HIDDEN))setDesc(it,HIDDEN,desc(1,{}));it[HIDDEN][key]=true}else{if(has(it,HIDDEN)&&it[HIDDEN][key])it[HIDDEN][key]=false;D.enumerable=false}}return setDesc(it,key,D)}function defineProperties(it,P){assertObject(it);var keys=enumKeys(P=toObject(P)),i=0,l=keys.length,key;while(l>i)defineProperty(it,key=keys[i++],P[key]);return it}function create(it,P){return P===undefined?$create(it):defineProperties($create(it),P)}function getOwnPropertyDescriptor(it,key){var D=getDesc(it=toObject(it),key);if(D&&has(AllSymbols,key)&&!(has(it,HIDDEN)&&it[HIDDEN][key]))D.enumerable=true;return D}function getOwnPropertyNames(it){var names=getNames(toObject(it)),result=[],i=0,key;while(names.length>i)if(!has(AllSymbols,key=names[i++])&&key!=HIDDEN)result.push(key);return result}function getOwnPropertySymbols(it){var names=getNames(toObject(it)),result=[],i=0,key;while(names.length>i)if(has(AllSymbols,key=names[i++]))result.push(AllSymbols[key]);return result}if(!useNative){Symbol=function Symbol(description){if(this instanceof Symbol)throw TypeError("Symbol is not a constructor");return wrap(uid(description))};$.hide(Symbol.prototype,"toString",function(){return this[TAG]});$.create=create;$.setDesc=defineProperty;$.getDesc=getOwnPropertyDescriptor;$.setDescs=defineProperties;$.getNames=getOwnPropertyNames;$.getSymbols=getOwnPropertySymbols}var symbolStatics={"for":function(key){return has(SymbolRegistry,key+="")?SymbolRegistry[key]:SymbolRegistry[key]=Symbol(key)},keyFor:function keyFor(key){return keyOf(SymbolRegistry,key)},useSetter:function(){setter=true},useSimple:function(){setter=false}};$.each.call(("hasInstance,isConcatSpreadable,iterator,match,replace,search,"+"species,split,toPrimitive,toStringTag,unscopables").split(","),function(it){var sym=require("./$.wks")(it);symbolStatics[it]=useNative?sym:wrap(sym)});setter=true;$def($def.G+$def.W,{Symbol:Symbol});$def($def.S,"Symbol",symbolStatics);$def($def.S+$def.F*!useNative,"Object",{create:create,defineProperty:defineProperty,defineProperties:defineProperties,getOwnPropertyDescriptor:getOwnPropertyDescriptor,getOwnPropertyNames:getOwnPropertyNames,getOwnPropertySymbols:getOwnPropertySymbols});setTag(Symbol,"Symbol");setTag(Math,"Math",true);setTag($.g.JSON,"JSON",true)},{"./$":21,"./$.assert":4,"./$.cof":6,"./$.def":12,"./$.enum-keys":13,"./$.keyof":22,"./$.uid":30,"./$.wks":32}],65:[function(require,module,exports){"use strict";var $=require("./$"),weak=require("./$.collection-weak"),leakStore=weak.leakStore,ID=weak.ID,WEAK=weak.WEAK,has=$.has,isObject=$.isObject,isFrozen=Object.isFrozen||$.core.Object.isFrozen,tmp={};var WeakMap=require("./$.collection")("WeakMap",{get:function get(key){if(isObject(key)){if(isFrozen(key))return leakStore(this).get(key);if(has(key,WEAK))return key[WEAK][this[ID]]}},set:function set(key,value){return weak.def(this,key,value)}},weak,true,true);if($.FW&&(new WeakMap).set((Object.freeze||Object)(tmp),7).get(tmp)!=7){$.each.call(["delete","has","get","set"],function(key){var method=WeakMap.prototype[key];WeakMap.prototype[key]=function(a,b){if(isObject(a)&&isFrozen(a)){var result=leakStore(this)[key](a,b);return key=="set"?this:result}return method.call(this,a,b)}})}},{"./$":21,"./$.collection":10,"./$.collection-weak":9}],66:[function(require,module,exports){"use strict";var weak=require("./$.collection-weak");require("./$.collection")("WeakSet",{add:function add(value){return weak.def(this,value,true)}},weak,false,true)},{"./$.collection":10,"./$.collection-weak":9}],67:[function(require,module,exports){var $def=require("./$.def");$def($def.P,"Array",{includes:require("./$.array-includes")(true)});require("./$.unscope")("includes")},{"./$.array-includes":2,"./$.def":12,"./$.unscope":31}],68:[function(require,module,exports){require("./$.collection-to-json")("Map")},{"./$.collection-to-json":8}],69:[function(require,module,exports){var $=require("./$"),$def=require("./$.def"),ownKeys=require("./$.own-keys");$def($def.S,"Object",{getOwnPropertyDescriptors:function getOwnPropertyDescriptors(object){var O=$.toObject(object),result={};$.each.call(ownKeys(O),function(key){$.setDesc(result,key,$.desc(0,$.getDesc(O,key)))});return result}})},{"./$":21,"./$.def":12,"./$.own-keys":23}],70:[function(require,module,exports){var $=require("./$"),$def=require("./$.def");function createObjectToArray(isEntries){return function(object){var O=$.toObject(object),keys=$.getKeys(O),length=keys.length,i=0,result=Array(length),key;if(isEntries)while(length>i)result[i]=[key=keys[i++],O[key]];else while(length>i)result[i]=O[keys[i++]];return result}}$def($def.S,"Object",{values:createObjectToArray(false),entries:createObjectToArray(true)})},{"./$":21,"./$.def":12}],71:[function(require,module,exports){var $def=require("./$.def");$def($def.S,"RegExp",{escape:require("./$.replacer")(/([\\\-[\]{}()*+?.,^$|])/g,"\\$1",true)})},{"./$.def":12,"./$.replacer":25}],72:[function(require,module,exports){require("./$.collection-to-json")("Set")},{"./$.collection-to-json":8}],73:[function(require,module,exports){var $def=require("./$.def");$def($def.P,"String",{at:require("./$.string-at")(true)})},{"./$.def":12,"./$.string-at":28}],74:[function(require,module,exports){var $=require("./$"),$def=require("./$.def"),$Array=$.core.Array||Array,statics={};function setStatics(keys,length){$.each.call(keys.split(","),function(key){if(length==undefined&&key in $Array)statics[key]=$Array[key];else if(key in[])statics[key]=require("./$.ctx")(Function.call,[][key],length)})}setStatics("pop,reverse,shift,keys,values,entries",1);setStatics("indexOf,every,some,forEach,map,filter,find,findIndex,includes",3);setStatics("join,slice,concat,push,splice,unshift,sort,lastIndexOf,"+"reduce,reduceRight,copyWithin,fill,turn");$def($def.S,"Array",statics)},{"./$":21,"./$.ctx":11,"./$.def":12}],75:[function(require,module,exports){require("./es6.array.iterator");var $=require("./$"),Iterators=require("./$.iter").Iterators,ITERATOR=require("./$.wks")("iterator"),ArrayValues=Iterators.Array,NodeList=$.g.NodeList;if($.FW&&NodeList&&!(ITERATOR in NodeList.prototype)){$.hide(NodeList.prototype,ITERATOR,ArrayValues)}Iterators.NodeList=ArrayValues},{"./$":21,"./$.iter":20,"./$.wks":32,"./es6.array.iterator":39}],76:[function(require,module,exports){var $def=require("./$.def"),$task=require("./$.task");$def($def.G+$def.B,{setImmediate:$task.set,clearImmediate:$task.clear})},{"./$.def":12,"./$.task":29}],77:[function(require,module,exports){var $=require("./$"),$def=require("./$.def"),invoke=require("./$.invoke"),partial=require("./$.partial"),navigator=$.g.navigator,MSIE=!!navigator&&/MSIE .\./.test(navigator.userAgent);function wrap(set){return MSIE?function(fn,time){return set(invoke(partial,[].slice.call(arguments,2),$.isFunction(fn)?fn:Function(fn)),time)}:set}$def($def.G+$def.B+$def.F*MSIE,{setTimeout:wrap($.g.setTimeout),setInterval:wrap($.g.setInterval)})},{"./$":21,"./$.def":12,"./$.invoke":16,"./$.partial":24}],78:[function(require,module,exports){require("./modules/es5");require("./modules/es6.symbol");require("./modules/es6.object.assign");require("./modules/es6.object.is");require("./modules/es6.object.set-prototype-of");require("./modules/es6.object.to-string");require("./modules/es6.object.statics-accept-primitives");require("./modules/es6.function.name");require("./modules/es6.number.constructor");require("./modules/es6.number.statics");require("./modules/es6.math");require("./modules/es6.string.from-code-point");require("./modules/es6.string.raw");require("./modules/es6.string.iterator");require("./modules/es6.string.code-point-at");require("./modules/es6.string.ends-with");require("./modules/es6.string.includes");require("./modules/es6.string.repeat");require("./modules/es6.string.starts-with");require("./modules/es6.array.from");require("./modules/es6.array.of");require("./modules/es6.array.iterator");require("./modules/es6.array.species");require("./modules/es6.array.copy-within");require("./modules/es6.array.fill");require("./modules/es6.array.find");require("./modules/es6.array.find-index");require("./modules/es6.regexp");require("./modules/es6.promise");require("./modules/es6.map");require("./modules/es6.set");require("./modules/es6.weak-map");require("./modules/es6.weak-set");require("./modules/es6.reflect");require("./modules/es7.array.includes");require("./modules/es7.string.at");require("./modules/es7.regexp.escape");require("./modules/es7.object.get-own-property-descriptors");require("./modules/es7.object.to-array");require("./modules/es7.map.to-json");require("./modules/es7.set.to-json");require("./modules/js.array.statics");require("./modules/web.timers");require("./modules/web.immediate");require("./modules/web.dom.iterable");module.exports=require("./modules/$").core},{"./modules/$":21,"./modules/es5":33,"./modules/es6.array.copy-within":34,"./modules/es6.array.fill":35,"./modules/es6.array.find":37,"./modules/es6.array.find-index":36,"./modules/es6.array.from":38,"./modules/es6.array.iterator":39,"./modules/es6.array.of":40,"./modules/es6.array.species":41,"./modules/es6.function.name":42,"./modules/es6.map":43,"./modules/es6.math":44,"./modules/es6.number.constructor":45,"./modules/es6.number.statics":46,"./modules/es6.object.assign":47,"./modules/es6.object.is":48,"./modules/es6.object.set-prototype-of":49,"./modules/es6.object.statics-accept-primitives":50,"./modules/es6.object.to-string":51,"./modules/es6.promise":52,"./modules/es6.reflect":53,"./modules/es6.regexp":54,"./modules/es6.set":55,"./modules/es6.string.code-point-at":56,"./modules/es6.string.ends-with":57,"./modules/es6.string.from-code-point":58,"./modules/es6.string.includes":59,"./modules/es6.string.iterator":60,"./modules/es6.string.raw":61,"./modules/es6.string.repeat":62,"./modules/es6.string.starts-with":63,"./modules/es6.symbol":64,"./modules/es6.weak-map":65,"./modules/es6.weak-set":66,"./modules/es7.array.includes":67,"./modules/es7.map.to-json":68,"./modules/es7.object.get-own-property-descriptors":69,"./modules/es7.object.to-array":70,"./modules/es7.regexp.escape":71,"./modules/es7.set.to-json":72,"./modules/es7.string.at":73,"./modules/js.array.statics":74,"./modules/web.dom.iterable":75,"./modules/web.immediate":76,"./modules/web.timers":77}],79:[function(require,module,exports){(function(global){!function(global){"use strict";var hasOwn=Object.prototype.hasOwnProperty;var undefined;var iteratorSymbol=typeof Symbol==="function"&&Symbol.iterator||"@@iterator";var inModule=typeof module==="object";var runtime=global.regeneratorRuntime;if(runtime){if(inModule){module.exports=runtime}return}runtime=global.regeneratorRuntime=inModule?module.exports:{};function wrap(innerFn,outerFn,self,tryLocsList){var generator=Object.create((outerFn||Generator).prototype);generator._invoke=makeInvokeMethod(innerFn,self||null,new Context(tryLocsList||[]));return generator}runtime.wrap=wrap;function tryCatch(fn,obj,arg){try{return{type:"normal",arg:fn.call(obj,arg)}}catch(err){return{type:"throw",arg:err}}}var GenStateSuspendedStart="suspendedStart";var GenStateSuspendedYield="suspendedYield";var GenStateExecuting="executing";var GenStateCompleted="completed";var ContinueSentinel={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}var Gp=GeneratorFunctionPrototype.prototype=Generator.prototype;GeneratorFunction.prototype=Gp.constructor=GeneratorFunctionPrototype;GeneratorFunctionPrototype.constructor=GeneratorFunction;GeneratorFunction.displayName="GeneratorFunction";runtime.isGeneratorFunction=function(genFun){var ctor=typeof genFun==="function"&&genFun.constructor;return ctor?ctor===GeneratorFunction||(ctor.displayName||ctor.name)==="GeneratorFunction":false};runtime.mark=function(genFun){genFun.__proto__=GeneratorFunctionPrototype;genFun.prototype=Object.create(Gp);return genFun};runtime.async=function(innerFn,outerFn,self,tryLocsList){return new Promise(function(resolve,reject){var generator=wrap(innerFn,outerFn,self,tryLocsList);var callNext=step.bind(generator,"next");var callThrow=step.bind(generator,"throw");function step(method,arg){var record=tryCatch(generator[method],generator,arg);if(record.type==="throw"){reject(record.arg);return}var info=record.arg;if(info.done){resolve(info.value)}else{Promise.resolve(info.value).then(callNext,callThrow)}}callNext()})};function makeInvokeMethod(innerFn,self,context){
var state=GenStateSuspendedStart;return function invoke(method,arg){if(state===GenStateExecuting){throw new Error("Generator is already running")}if(state===GenStateCompleted){return doneResult()}while(true){var delegate=context.delegate;if(delegate){if(method==="return"||method==="throw"&&delegate.iterator[method]===undefined){context.delegate=null;var returnMethod=delegate.iterator["return"];if(returnMethod){var record=tryCatch(returnMethod,delegate.iterator,arg);if(record.type==="throw"){method="throw";arg=record.arg;continue}}if(method==="return"){continue}}var record=tryCatch(delegate.iterator[method],delegate.iterator,arg);if(record.type==="throw"){context.delegate=null;method="throw";arg=record.arg;continue}method="next";arg=undefined;var info=record.arg;if(info.done){context[delegate.resultName]=info.value;context.next=delegate.nextLoc}else{state=GenStateSuspendedYield;return info}context.delegate=null}if(method==="next"){if(state===GenStateSuspendedYield){context.sent=arg}else{delete context.sent}}else if(method==="throw"){if(state===GenStateSuspendedStart){state=GenStateCompleted;throw arg}if(context.dispatchException(arg)){method="next";arg=undefined}}else if(method==="return"){context.abrupt("return",arg)}state=GenStateExecuting;var record=tryCatch(innerFn,self,context);if(record.type==="normal"){state=context.done?GenStateCompleted:GenStateSuspendedYield;var info={value:record.arg,done:context.done};if(record.arg===ContinueSentinel){if(context.delegate&&method==="next"){arg=undefined}}else{return info}}else if(record.type==="throw"){state=GenStateCompleted;method="throw";arg=record.arg}}}}function defineGeneratorMethod(method){Gp[method]=function(arg){return this._invoke(method,arg)}}defineGeneratorMethod("next");defineGeneratorMethod("throw");defineGeneratorMethod("return");Gp[iteratorSymbol]=function(){return this};Gp.toString=function(){return"[object Generator]"};function pushTryEntry(locs){var entry={tryLoc:locs[0]};if(1 in locs){entry.catchLoc=locs[1]}if(2 in locs){entry.finallyLoc=locs[2];entry.afterLoc=locs[3]}this.tryEntries.push(entry)}function resetTryEntry(entry){var record=entry.completion||{};record.type="normal";delete record.arg;entry.completion=record}function Context(tryLocsList){this.tryEntries=[{tryLoc:"root"}];tryLocsList.forEach(pushTryEntry,this);this.reset()}runtime.keys=function(object){var keys=[];for(var key in object){keys.push(key)}keys.reverse();return function next(){while(keys.length){var key=keys.pop();if(key in object){next.value=key;next.done=false;return next}}next.done=true;return next}};function values(iterable){if(iterable){var iteratorMethod=iterable[iteratorSymbol];if(iteratorMethod){return iteratorMethod.call(iterable)}if(typeof iterable.next==="function"){return iterable}if(!isNaN(iterable.length)){var i=-1,next=function next(){while(++i<iterable.length){if(hasOwn.call(iterable,i)){next.value=iterable[i];next.done=false;return next}}next.value=undefined;next.done=true;return next};return next.next=next}}return{next:doneResult}}runtime.values=values;function doneResult(){return{value:undefined,done:true}}Context.prototype={constructor:Context,reset:function(){this.prev=0;this.next=0;this.sent=undefined;this.done=false;this.delegate=null;this.tryEntries.forEach(resetTryEntry);for(var tempIndex=0,tempName;hasOwn.call(this,tempName="t"+tempIndex)||tempIndex<20;++tempIndex){this[tempName]=null}},stop:function(){this.done=true;var rootEntry=this.tryEntries[0];var rootRecord=rootEntry.completion;if(rootRecord.type==="throw"){throw rootRecord.arg}return this.rval},dispatchException:function(exception){if(this.done){throw exception}var context=this;function handle(loc,caught){record.type="throw";record.arg=exception;context.next=loc;return!!caught}for(var i=this.tryEntries.length-1;i>=0;--i){var entry=this.tryEntries[i];var record=entry.completion;if(entry.tryLoc==="root"){return handle("end")}if(entry.tryLoc<=this.prev){var hasCatch=hasOwn.call(entry,"catchLoc");var hasFinally=hasOwn.call(entry,"finallyLoc");if(hasCatch&&hasFinally){if(this.prev<entry.catchLoc){return handle(entry.catchLoc,true)}else if(this.prev<entry.finallyLoc){return handle(entry.finallyLoc)}}else if(hasCatch){if(this.prev<entry.catchLoc){return handle(entry.catchLoc,true)}}else if(hasFinally){if(this.prev<entry.finallyLoc){return handle(entry.finallyLoc)}}else{throw new Error("try statement without catch or finally")}}}},abrupt:function(type,arg){for(var i=this.tryEntries.length-1;i>=0;--i){var entry=this.tryEntries[i];if(entry.tryLoc<=this.prev&&hasOwn.call(entry,"finallyLoc")&&this.prev<entry.finallyLoc){var finallyEntry=entry;break}}if(finallyEntry&&(type==="break"||type==="continue")&&finallyEntry.tryLoc<=arg&&arg<=finallyEntry.finallyLoc){finallyEntry=null}var record=finallyEntry?finallyEntry.completion:{};record.type=type;record.arg=arg;if(finallyEntry){this.next=finallyEntry.finallyLoc}else{this.complete(record)}return ContinueSentinel},complete:function(record,afterLoc){if(record.type==="throw"){throw record.arg}if(record.type==="break"||record.type==="continue"){this.next=record.arg}else if(record.type==="return"){this.rval=record.arg;this.next="end"}else if(record.type==="normal"&&afterLoc){this.next=afterLoc}return ContinueSentinel},finish:function(finallyLoc){for(var i=this.tryEntries.length-1;i>=0;--i){var entry=this.tryEntries[i];if(entry.finallyLoc===finallyLoc){return this.complete(entry.completion,entry.afterLoc)}}},"catch":function(tryLoc){for(var i=this.tryEntries.length-1;i>=0;--i){var entry=this.tryEntries[i];if(entry.tryLoc===tryLoc){var record=entry.completion;if(record.type==="throw"){var thrown=record.arg;resetTryEntry(entry)}return thrown}}throw new Error("illegal catch attempt")},delegateYield:function(iterable,resultName,nextLoc){this.delegate={iterator:values(iterable),resultName:resultName,nextLoc:nextLoc};return ContinueSentinel}}}(typeof global==="object"?global:typeof window==="object"?window:typeof self==="object"?self:this)}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}]},{},[1]); |
src/routes.js | TobiasBales/PlayuavOSDConfigurator | import React from 'react';
import { Route, IndexRoute } from 'react-router';
import App from './App';
import Config from './config/Config';
import Pixler from './pixler/Pixler';
export default (
<Route path="/" component={App}>
<IndexRoute component={Config} />
<Route path="pixler" component={Pixler} />
</Route>
);
|
src/routes/admin/index.js | Frenzzy/react-starter-kit | /**
* React Starter Kit (https://www.reactstarterkit.com/)
*
* Copyright © 2014-present Kriasoft, LLC. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE.txt file in the root directory of this source tree.
*/
import React from 'react';
import Layout from '../../components/Layout';
import Admin from './Admin';
const title = 'Admin Page';
const isAdmin = false;
function action() {
if (!isAdmin) {
return { redirect: '/login' };
}
return {
chunks: ['admin'],
title,
component: (
<Layout>
<Admin title={title} />
</Layout>
),
};
}
export default action;
|
examples/todomvc/containers/TodoApp.js | mikekidder/redux-devtools | import React, { Component } from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import Header from '../components/Header';
import MainSection from '../components/MainSection';
import * as TodoActions from '../actions/TodoActions';
class TodoApp extends Component {
render() {
const { todos, actions } = this.props;
return (
<div>
<Header addTodo={actions.addTodo} />
<MainSection todos={todos} actions={actions} />
</div>
);
}
}
function mapState(state) {
return {
todos: state.todos
};
}
function mapDispatch(dispatch) {
return {
actions: bindActionCreators(TodoActions, dispatch)
};
}
export default connect(mapState, mapDispatch)(TodoApp);
|
actor-apps/app-web/src/app/components/sidebar/HeaderSection.react.js | Johnnywang1221/actor-platform | import React from 'react';
import MyProfileActions from 'actions/MyProfileActions';
import LoginActionCreators from 'actions/LoginActionCreators';
import AvatarItem from 'components/common/AvatarItem.react';
import MyProfileModal from 'components/modals/MyProfile.react';
import ActorClient from 'utils/ActorClient';
import classNames from 'classnames';
var getStateFromStores = () => {
return {dialogInfo: null};
};
class HeaderSection extends React.Component {
componentWillMount() {
ActorClient.bindUser(ActorClient.getUid(), this.setUser);
}
constructor() {
super();
this.setUser = this.setUser.bind(this);
this.toggleHeaderMenu = this.toggleHeaderMenu.bind(this);
this.openMyProfile = this.openMyProfile.bind(this);
this.setLogout = this.setLogout.bind(this);
this.state = getStateFromStores();
}
setUser(user) {
this.setState({user: user});
}
toggleHeaderMenu() {
this.setState({isOpened: !this.state.isOpened});
}
setLogout() {
LoginActionCreators.setLoggedOut();
}
render() {
var user = this.state.user;
if (user) {
var headerClass = classNames('sidebar__header', 'sidebar__header--clickable', {
'sidebar__header--opened': this.state.isOpened
});
return (
<header className={headerClass}>
<div className="sidebar__header__user row" onClick={this.toggleHeaderMenu}>
<AvatarItem image={user.avatar}
placeholder={user.placeholder}
size="small"
title={user.name} />
<span className="sidebar__header__user__name col-xs">{user.name}</span>
<span className="sidebar__header__user__expand">
<i className="material-icons">keyboard_arrow_down</i>
</span>
</div>
<ul className="sidebar__header__menu">
<li className="sidebar__header__menu__item" onClick={this.openMyProfile}>
<i className="material-icons">person</i>
<span>Profile</span>
</li>
{/*
<li className="sidebar__header__menu__item" onClick={this.openCreateGroup}>
<i className="material-icons">group_add</i>
<span>Create group</span>
</li>
*/}
<li className="sidebar__header__menu__item hide">
<i className="material-icons">cached</i>
<span>Integrations</span>
</li>
<li className="sidebar__header__menu__item hide">
<i className="material-icons">settings</i>
<span>Settings</span>
</li>
<li className="sidebar__header__menu__item hide">
<i className="material-icons">help</i>
<span>Help</span>
</li>
<li className="sidebar__header__menu__item" onClick={this.setLogout}>
<i className="material-icons">power_settings_new</i>
<span>Log out</span>
</li>
</ul>
<MyProfileModal/>
</header>
);
} else {
return null;
}
}
openMyProfile() {
MyProfileActions.modalOpen();
this.setState({isOpened: false});
}
}
export default HeaderSection;
|
admin/client/App/shared/CreateForm.js | giovanniRodighiero/cms | /**
* The form that's visible when "Create <ItemName>" is clicked on either the
* List screen or the Item screen
*/
import React from 'react';
import assign from 'object-assign';
import vkey from 'vkey';
import AlertMessages from './AlertMessages';
import { Fields } from 'FieldTypes';
import InvalidFieldType from './InvalidFieldType';
import { Button, Form, Modal } from '../elemental';
const CreateForm = React.createClass({
displayName: 'CreateForm',
propTypes: {
err: React.PropTypes.object,
isOpen: React.PropTypes.bool,
list: React.PropTypes.object,
onCancel: React.PropTypes.func,
onCreate: React.PropTypes.func,
},
getDefaultProps () {
return {
err: null,
isOpen: false,
};
},
getInitialState () {
// Set the field values to their default values when first rendering the
// form. (If they have a default value, that is)
var values = {};
Object.keys(this.props.list.fields).forEach(key => {
var field = this.props.list.fields[key];
var FieldComponent = Fields[field.type];
values[field.path] = FieldComponent.getDefaultValue(field);
});
return {
values: values,
alerts: {},
};
},
componentDidMount () {
document.body.addEventListener('keyup', this.handleKeyPress, false);
},
componentWillUnmount () {
document.body.removeEventListener('keyup', this.handleKeyPress, false);
},
handleKeyPress (evt) {
if (vkey[evt.keyCode] === '<escape>') {
this.props.onCancel();
}
},
// Handle input change events
handleChange (event) {
var values = assign({}, this.state.values);
values[event.path] = event.value;
this.setState({
values: values,
});
},
// Set the props of a field
getFieldProps (field) {
var props = assign({}, field);
props.value = this.state.values[field.path];
props.values = this.state.values;
props.onChange = this.handleChange;
props.mode = 'create';
props.key = field.path;
return props;
},
// Create a new item when the form is submitted
submitForm (event) {
event.preventDefault();
const createForm = event.target;
const formData = new FormData(createForm);
this.props.list.createItem(formData, (err, data) => {
if (data) {
if (this.props.onCreate) {
this.props.onCreate(data);
} else {
// Clear form
this.setState({
values: {},
alerts: {
success: {
success: 'Item created',
},
},
});
}
} else {
if (!err) {
err = {
error: 'connection error',
};
}
// If we get a database error, show the database error message
// instead of only saying "Database error"
if (err.error === 'database error') {
err.error = err.detail.errmsg;
}
this.setState({
alerts: {
error: err,
},
});
}
});
},
// Render the form itself
renderForm () {
if (!this.props.isOpen) return;
var form = [];
var list = this.props.list;
var nameField = this.props.list.nameField;
var focusWasSet;
// If the name field is an initial one, we need to render a proper
// input for it
if (list.nameIsInitial) {
var nameFieldProps = this.getFieldProps(nameField);
nameFieldProps.autoFocus = focusWasSet = true;
if (nameField.type === 'text') {
nameFieldProps.className = 'item-name-field';
nameFieldProps.placeholder = nameField.label;
nameFieldProps.label = '';
}
form.push(React.createElement(Fields[nameField.type], nameFieldProps));
}
// Render inputs for all initial fields
Object.keys(list.initialFields).forEach(key => {
var field = list.fields[list.initialFields[key]];
// If there's something weird passed in as field type, render the
// invalid field type component
if (typeof Fields[field.type] !== 'function') {
form.push(React.createElement(InvalidFieldType, { type: field.type, path: field.path, key: field.path }));
return;
}
// Get the props for the input field
var fieldProps = this.getFieldProps(field);
// If there was no focusRef set previously, set the current field to
// be the one to be focussed. Generally the first input field, if
// there's an initial name field that takes precedence.
if (!focusWasSet) {
fieldProps.autoFocus = focusWasSet = true;
}
form.push(React.createElement(Fields[field.type], fieldProps));
});
return (
<Form layout="horizontal" onSubmit={this.submitForm}>
<Modal.Header
text={'Create a new ' + list.singular}
showCloseButton
/>
<Modal.Body>
<AlertMessages alerts={this.state.alerts} />
{form}
</Modal.Body>
<Modal.Footer>
<Button color="success" type="submit" data-button-type="submit">
Create
</Button>
<Button
variant="link"
color="cancel"
data-button-type="cancel"
onClick={this.props.onCancel}
>
Cancel
</Button>
</Modal.Footer>
</Form>
);
},
render () {
return (
<Modal.Dialog
isOpen={this.props.isOpen}
onClose={this.props.onCancel}
backdropClosesModal
>
{this.renderForm()}
</Modal.Dialog>
);
},
});
module.exports = CreateForm;
|
src/tags/Tag.js | Sekhmet/busy | import React from 'react';
import numeral from 'numeral';
import { Link } from 'react-router';
import FavoriteButton from '../favorites/FavoriteButton';
import Icon from '../widgets/Icon';
const Tag = ({
tag,
removeCategoryFavorite,
addCategoryFavorite,
isFavorited
}) =>
<div className="page">
<div className="my-5 text-center">
<h1>
<Link to={`/hot/${tag.name}`}># {tag.name}</Link>{' '}
<FavoriteButton
name={tag.name}
isFavorited={isFavorited}
onClick={isFavorited
? () => removeCategoryFavorite(tag.name)
: () => addCategoryFavorite(tag.name)
}
/>
</h1>
<h2>
<Icon name="library_books" lg /> {numeral(tag.comments).format('0,0')}{' '}
<Icon name="attach_money" lg /> {numeral(tag.total_payouts).format('$0,0')}
</h2>
</div>
</div>;
export default Tag;
|
src/TimePicker/Clock.js | rscnt/material-ui | import React from 'react';
import TimeDisplay from './TimeDisplay';
import ClockHours from './ClockHours';
import ClockMinutes from './ClockMinutes';
class Clock extends React.Component {
static propTypes = {
format: React.PropTypes.oneOf(['ampm', '24hr']),
initialTime: React.PropTypes.object,
isActive: React.PropTypes.bool,
mode: React.PropTypes.oneOf(['hour', 'minute']),
onChangeHours: React.PropTypes.func,
onChangeMinutes: React.PropTypes.func,
};
static defaultProps = {
initialTime: new Date(),
};
static contextTypes = {
muiTheme: React.PropTypes.object.isRequired,
};
state = {
selectedTime: this.props.initialTime || new Date(),
mode: 'hour',
};
componentWillReceiveProps(nextProps) {
this.setState({
selectedTime: nextProps.initialTime || new Date(),
});
}
setMode = (mode) => {
setTimeout(() => {
this.setState({
mode: mode,
});
}, 100);
};
handleSelectAffix = (affix) => {
if (affix === this.getAffix()) return;
const hours = this.state.selectedTime.getHours();
if (affix === 'am') {
this.handleChangeHours(hours - 12, affix);
return;
}
this.handleChangeHours(hours + 12, affix);
};
getAffix() {
if (this.props.format !== 'ampm') return '';
const hours = this.state.selectedTime.getHours();
if (hours < 12) {
return 'am';
}
return 'pm';
}
handleChangeHours = (hours, finished) => {
const time = new Date(this.state.selectedTime);
let affix;
if ( typeof finished === 'string' ) {
affix = finished;
finished = undefined;
}
if (!affix) {
affix = this.getAffix();
}
if (affix === 'pm' && hours < 12) {
hours += 12;
}
time.setHours(hours);
this.setState({
selectedTime: time,
});
const {onChangeHours} = this.props;
if (finished) {
setTimeout(() => {
this.setState({
mode: 'minute',
});
if (typeof (onChangeHours) === 'function') {
onChangeHours(time);
}
}, 100);
}
};
handleChangeMinutes = (minutes) => {
const time = new Date(this.state.selectedTime);
time.setMinutes(minutes);
this.setState({
selectedTime: time,
});
const {onChangeMinutes} = this.props;
if (typeof (onChangeMinutes) === 'function') {
setTimeout(() => {
onChangeMinutes(time);
}, 0);
}
};
getSelectedTime() {
return this.state.selectedTime;
}
render() {
let clock = null;
const {prepareStyles} = this.context.muiTheme;
const styles = {
root: {},
container: {
height: 280,
padding: 10,
position: 'relative',
},
circle: {
position: 'absolute',
top: 20,
width: 260,
height: 260,
borderRadius: '100%',
backgroundColor: this.context.muiTheme.timePicker.clockCircleColor,
},
};
if ( this.state.mode === 'hour') {
clock = (
<ClockHours key="hours"
format={this.props.format}
onChange={this.handleChangeHours}
initialHours={this.state.selectedTime.getHours()}
/>
);
} else {
clock = (
<ClockMinutes key="minutes"
onChange={this.handleChangeMinutes}
initialMinutes={this.state.selectedTime.getMinutes()}
/>
);
}
return (
<div style={prepareStyles(styles.root)}>
<TimeDisplay
selectedTime={this.state.selectedTime}
mode={this.state.mode}
format={this.props.format}
affix={this.getAffix()}
onSelectAffix={this.handleSelectAffix}
onSelectHour={this.setMode.bind(this, 'hour')}
onSelectMin={this.setMode.bind(this, 'minute')}
/>
<div style={prepareStyles(styles.container)} >
<div style={prepareStyles(styles.circle)} />
{clock}
</div>
</div>
);
}
}
export default Clock;
|
ajax/libs/reactive-coffee/0.0.4/reactive-coffee.min.js | mikesir87/cdnjs | !function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S={}.hasOwnProperty,T=function(a,b){function c(){this.constructor=a}for(var d in b)S.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},U=[].slice,V=this;"undefined"==typeof exports?this.rx=F={}:F=exports,y=0,x=function(){return y+=1},A=function(a,b){var c;if(!b in a)throw"object has no key "+b;return c=a[b],delete a[b],c},z=function(a,b,c){var d,e,f,g;for(d=f=0,g=a.length;g>f;d=++f)if(e=a[d],c(e)&&(b-=1)<0)return[e,d];return[null,-1]},u=function(a,b){return null!=b?a(b):b},s=function(a,b){return z(a,0,b)},v=function(){return Object.create(null)},k=F.Recorder=function(){function a(){this.stack=[]}return a.prototype.start=function(a){return this.stack.length>0&&_(this.stack).last().addNestedBind(a),this.stack.push(a)},a.prototype.stop=function(){return this.stack.pop()},a.prototype.sub=function(a){var b,c;return this.stack.length>0?(c=_(this.stack).last(),b=a(c),c.addSub(b)):void 0},a.prototype.warnMutate=function(){return this.stack.length>0?console.warn("Mutation to observable detected during a bind context"):void 0},a}(),E=new k,F.bind=o=function(a){var c;return c=new b(a),c.refresh(),c},F.lagBind=t=function(a,c){var d;return d=new b(c,a),d.refresh(),d},d=F.DepMgr=function(){function a(){this.uid2src={}}return a.prototype.sub=function(a,b){return this.uid2src[a]=b},a.prototype.unsub=function(a){return this.uid2src[a].unsub(a),A(this.uid2src,a)},a}(),p=new d,e=F.Ev=function(){function a(a){this.inits=a,this.subs=[]}return a.prototype.sub=function(a){var b,c,d,e,f;if(c=x(),null!=this.inits)for(f=this.inits(),d=0,e=f.length;e>d;d++)b=f[d],a(b);return this.subs[c]=a,p.sub(c,this),c},a.prototype.pub=function(a){var b,c,d,e;d=this.subs,e=[];for(c in d)b=d[c],e.push(b(a));return e},a.prototype.unsub=function(a){return A(this.subs,a)},a}(),h=F.ObsCell=function(){function a(a){var b,c=this;this.x=a,this.x=null!=(b=this.x)?b:null,this.onSet=new e(function(){return[[null,c.x]]})}return a.prototype.get=function(){var a=this;return E.sub(function(b){return a.onSet.sub(function(){return b.refresh()})}),this.x},a}(),m=F.SrcCell=function(a){function b(){return O=b.__super__.constructor.apply(this,arguments)}return T(b,a),b.prototype.set=function(a){var b;return E.warnMutate(),b=this.x,this.x=a,this.onSet.pub([b,a]),b},b}(h),b=F.DepCell=function(a){function b(a,c,d){this.body=a,b.__super__.constructor.call(this,null!=c?c:null),this.subs=[],this.refreshing=!1,this.lag=null!=d?d:!1,this.timeout=null,this.nestedBinds=[]}return T(b,a),b.prototype.refresh=function(){var a,b=this;return a=function(){var a;if(!b.refreshing){a=b.x,b.disconnect(),E.start(b),b.refreshing=!0;try{b.x=b.body()}finally{b.refreshing=!1,E.stop()}return b.onSet.pub([a,b.x])}},this.refreshing?void 0:this.lag?(null!=this.timeout&&clearTimeout(this.timeout),console.log("setting timeout"),this.timeout=setTimeout(a,500)):a()},b.prototype.disconnect=function(){var a,b,c,d,e,f,g,h;for(g=this.subs,c=0,e=g.length;e>c;c++)b=g[c],p.unsub(b);for(h=this.nestedBinds,d=0,f=h.length;f>d;d++)a=h[d],a.disconnect();return this.subs=[],this.nestedBinds=[]},b.prototype.addSub=function(a){return this.subs.push(a)},b.prototype.addNestedBind=function(a){return this.nestedBinds.push(a)},b}(h),g=F.ObsArray=function(){function a(a){var b,c=this;this.xs=a,this.xs=null!=(b=this.xs)?b:[],this.onChange=new e(function(){return[[0,[],c.xs]]})}return a.prototype.all=function(){var a=this;return E.sub(function(b){return a.onChange.sub(function(){return b.refresh()})}),this.xs},a.prototype.at=function(a){var b=this;return E.sub(function(c){return b.onChange.sub(function(b){var d,e,f;return e=b[0],f=b[1],d=b[2],e===a?c.refresh():void 0})}),this.xs[a]},a.prototype.length=function(){var a=this;return E.sub(function(b){return a.onChange.sub(function(a){var c,d,e;return d=a[0],e=a[1],c=a[2],e.length!==c.length?b.refresh():void 0})}),this.xs.length},a.prototype.map=function(a){var b;return b=new f,this.onChange.sub(function(c){var d,e,f;return e=c[0],f=c[1],d=c[2],b.realSplice(e,f.length,d.map(a))}),b},a.prototype.realSplice=function(a,b,c){var d;return d=this.xs.splice.apply(this.xs,[a,b].concat(c)),this.onChange.pub([a,d,c])},a}(),l=F.SrcArray=function(a){function b(){return P=b.__super__.constructor.apply(this,arguments)}return T(b,a),b.prototype.spliceArray=function(a,b,c){return E.warnMutate(),this.realSplice(a,b,c)},b.prototype.splice=function(){var a,b,c;return c=arguments[0],b=arguments[1],a=3<=arguments.length?U.call(arguments,2):[],this.spliceArray(c,b,a)},b.prototype.insert=function(a,b){return this.splice(b,0,a)},b.prototype.remove=function(a){return this.removeAt(_(this.all()).indexOf(a))},b.prototype.removeAt=function(a){return this.splice(a,1)},b.prototype.push=function(a){return this.splice(this.length(),0,a)},b.prototype.put=function(a,b){return this.splice(a,1,b)},b.prototype.replace=function(a){return this.spliceArray(0,this.length(),a)},b}(g),f=F.MappedDepArray=function(a){function b(){return Q=b.__super__.constructor.apply(this,arguments)}return T(b,a),b}(g),a=F.DepArray=function(a){function b(a){var c=this;this.f=a,b.__super__.constructor.call(this),o(function(){return c.f()}).onSet.sub(function(a){var b,d,e,f,g,h,i;return f=a[0],g=a[1],null!=f?(h=s(function(){i=[];for(var a=0,b=Math.min(f.length,g.length);b>=0?b>=a:a>=b;b>=0?a++:a--)i.push(a);return i}.apply(this),function(a){return f[a]!==g[a]}),e=h[0],e=h[1]):e=0,e>-1?(d=null!=f?f.length-e:0,b=g.slice(e),c.realSplice(e,d,b)):void 0})}return T(b,a),b}(g),i=F.ObsMap=function(){function a(a){this.x=null!=a?a:{},this.onAdd=new e(function(){var b,c,d;d=[];for(b in a)c=a[b],d.push([b,c]);return d}),this.onRemove=new e,this.onChange=new e}return a.prototype.get=function(a){var b=this;return E.sub(function(c){return b.onAdd.sub(function(b){var d,e;return d=b[0],e=b[1],a===d?c.refresh():void 0})}),E.sub(function(c){return b.onChange.sub(function(b){var d,e,f;return e=b[0],d=b[1],f=b[2],a===e?c.refresh():void 0})}),E.sub(function(c){return b.onRemove.sub(function(b){var d,e;return e=b[0],d=b[1],a===e?c.refresh():void 0})}),this.x[a]},a.prototype.all=function(){var a=this;return E.sub(function(b){return a.onAdd.sub(function(){return b.refresh()})}),E.sub(function(b){return a.onChange.sub(function(){return b.refresh()})}),E.sub(function(b){return a.onRemove.sub(function(){return b.refresh()})}),_.clone(this.x)},a.prototype.realPut=function(a,b){var c;return a in this.x?(c=this.x[a],this.x[a]=b,this.onChange.pub([a,c,b]),c):(this.x[a]=b,this.onAdd.pub([a,b]),void 0)},a.prototype.realRemove=function(a){var b;return b=A(this.x,a),this.onRemove.pub([a,b]),b},a}(),n=F.SrcMap=function(a){function b(){return R=b.__super__.constructor.apply(this,arguments)}return T(b,a),b.prototype.put=function(a,b){return E.warnMutate(),this.realPut(a,b)},b.prototype.remove=function(a){return E.warnMutate(),this.realRemove(a)},b}(i),c=F.DepMap=function(a){function c(a){this.f=a,c.__super__.constructor.call(this),new b(this.f).onSet.sub(function(a){var b,c,d,e,f;c=a[0],e=a[1];for(b in c)d=c[b],!b in e&&this.realRemove(b);f=[];for(b in e)d=e[b],this.x[b]!==d?f.push(this.realPut(b,d)):f.push(void 0);return f})}return T(c,a),c}(i),_.extend(F,{cell:function(a){return new m(a)},array:function(a){return new l(a)},map:function(a){return new n(a)}}),$.fn.rx=function(a){var b,c,d,e;return d=this.data("rx-map"),null==d&&this.data("rx-map",d=v()),a in d?d[a]:d[a]=function(){var d=this;switch(a){case"focused":return c=F.cell(this.is(":focus")),this.focus(function(){return c.set(!0)}),this.blur(function(){return c.set(!1)}),c;case"val":return e=F.cell(this.val()),this.change(function(){return e.set(d.val())}),this.on("input",function(){return e.set(d.val())}),e;case"checked":return b=F.cell(this.is(":checked")),this.change(function(){return b.set(d.is(":checked"))}),b;default:throw"Unknown reactive property type"}}.call(this)},"undefined"==typeof exports?this.rxt=G={}:G=exports,j=G.RawHtml=function(){function a(a){this.html=a}return a}(),r=["blur","change","click","dblclick","error","focus","focusin","focusout","hover","keydown","keypress","keyup","load","mousedown","mouseenter","mouseleave","mousemove","mouseout","mouseover","mouseup","ready","resize","scroll","select","submit","toggle","unload"],I=G.specialAttrs={init:function(a,b){return b.call(a)}},L=function(a){return I[a]=function(b,c){return b[a](function(a){return c.call(b,a)})}};for(M=0,N=r.length;N>M;M++)q=r[M],L(q);D=["async","autofocus","checked","location","multiple","readOnly","selected","selectedIndex","tagName","nodeName","nodeType","ownerDocument","defaultChecked","defaultSelected"],C=_.object(function(){var a,b,c;for(c=[],a=0,b=D.length;b>a;a++)B=D[a],c.push([B,null]);return c}()),H=function(a,b,c){return"value"===b?a.val(c):b in C?a.prop(b,c):a.attr(b,c)},G.mktag=w=function(a){return function(b,c){var d,e,f,i,k,l,m,n,o,p;o=null==b&&null==c?[{},null]:null!=c?[b,c]:_.isString(b)||b instanceof j||_.isArray(b)||b instanceof h||b instanceof g?[{},b]:[b,null],d=o[0],e=o[1],f=$("<"+a+"/>"),p=_.omit(d,_.keys(I));for(k in p)n=p[k],n instanceof h?function(a){return n.onSet.sub(function(b){var c,d;return c=b[0],d=b[1],H(f,a,d)})}(k):H(f,k,n);null!=e&&(l=function(a){var b,c,d,e,f;for(f=[],d=0,e=a.length;e>d;d++)if(b=a[d],_.isString(b))f.push(document.createTextNode(b));else if(b instanceof j){if(c=$(b.html),c.length)throw"Cannot insert RawHtml of multiple elements";f.push(c[0])}else{if(!(b instanceof $))throw"Unknown element type in array: "+b.constructor.name;f.push(b[0])}return f},m=function(a){if(f.html(""),_.isArray(a))return f.append(l(a));if(_.isString(a)||a instanceof j)return m([a]);throw"Unknown type for contents: "+a.constructor.name},e instanceof g?e.onChange.sub(function(a){var b,c,d,e;return c=a[0],d=a[1],b=a[2],f.contents().slice(c,c+d.length).remove(),e=l(b),c===f.contents().length?f.append(e):f.contents().eq(c).before(e)}):e instanceof h?e.onSet.sub(function(a){var b,c;return b=a[0],c=a[1],m(c)}):m(e));for(i in d)i in I&&I[i](f,d[i],d,e);return f}},K=["html","head","title","base","link","meta","style","script","noscript","body","body","section","nav","article","aside","h1","h2","h3","h4","h5","h6","h1","h6","header","footer","address","main","main","p","hr","pre","blockquote","ol","ul","li","dl","dt","dd","dd","figure","figcaption","div","a","em","strong","small","s","cite","q","dfn","abbr","data","time","code","var","samp","kbd","sub","sup","i","b","u","mark","ruby","rt","rp","bdi","bdo","span","br","wbr","ins","del","img","iframe","embed","object","param","object","video","audio","source","video","audio","track","video","audio","canvas","map","area","area","map","svg","math","table","caption","colgroup","col","tbody","thead","tfoot","tr","td","th","form","fieldset","legend","fieldset","label","input","button","select","datalist","optgroup","option","select","datalist","textarea","keygen","output","progress","meter","details","summary","details","menuitem","menu"],G.tags=_.object(function(){var a,b,c;for(c=[],a=0,b=K.length;b>a;a++)J=K[a],c.push([J,G.mktag(J)]);return c}()),G.rawHtml=function(a){return new j(a)},G.importTags=function(a){return _(null!=a?a:V).extend(G.tags)}}.call(this); |
__tests__/index.ios.js | mchlltt/mementoes-mobile | import 'react-native';
import React from 'react';
import Index from '../index.ios.js';
// Note: test renderer must be required after react-native.
import renderer from 'react-test-renderer';
it('renders correctly', () => {
const tree = renderer.create(
<Index />
);
});
|
jquery.min.js | swechaFSMI/swechafsmi.github.io | /*! jQuery v1.7.1 jquery.com | jquery.org/license */
(function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cv(a){if(!ck[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){cl||(cl=c.createElement("iframe"),cl.frameBorder=cl.width=cl.height=0),b.appendChild(cl);if(!cm||!cl.createElement)cm=(cl.contentWindow||cl.contentDocument).document,cm.write((c.compatMode==="CSS1Compat"?"<!doctype html>":"")+"<html><body>"),cm.close();d=cm.createElement(a),cm.body.appendChild(d),e=f.css(d,"display"),b.removeChild(cl)}ck[a]=e}return ck[a]}function cu(a,b){var c={};f.each(cq.concat.apply([],cq.slice(0,b)),function(){c[this]=a});return c}function ct(){cr=b}function cs(){setTimeout(ct,0);return cr=f.now()}function cj(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ci(){try{return new a.XMLHttpRequest}catch(b){}}function cc(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g<i;g++){if(g===1)for(h in a.converters)typeof h=="string"&&(e[h.toLowerCase()]=a.converters[h]);l=k,k=d[g];if(k==="*")k=l;else if(l!=="*"&&l!==k){m=l+" "+k,n=e[m]||e["* "+k];if(!n){p=b;for(o in e){j=o.split(" ");if(j[0]===l||j[0]==="*"){p=e[j[1]+" "+k];if(p){o=e[o],o===!0?n=p:p===!0&&(n=o);break}}}}!n&&!p&&f.error("No conversion from "+m.replace(" "," to ")),n!==!0&&(c=n?n(c):p(o(c)))}}return c}function cb(a,c,d){var e=a.contents,f=a.dataTypes,g=a.responseFields,h,i,j,k;for(i in g)i in d&&(c[g[i]]=d[i]);while(f[0]==="*")f.shift(),h===b&&(h=a.mimeType||c.getResponseHeader("content-type"));if(h)for(i in e)if(e[i]&&e[i].test(h)){f.unshift(i);break}if(f[0]in d)j=f[0];else{for(i in d){if(!f[0]||a.converters[i+" "+f[0]]){j=i;break}k||(k=i)}j=j||k}if(j){j!==f[0]&&f.unshift(j);return d[j]}}function ca(a,b,c,d){if(f.isArray(b))f.each(b,function(b,e){c||bE.test(a)?d(a,e):ca(a+"["+(typeof e=="object"||f.isArray(e)?b:"")+"]",e,c,d)});else if(!c&&b!=null&&typeof b=="object")for(var e in b)ca(a+"["+e+"]",b[e],c,d);else d(a,b)}function b_(a,c){var d,e,g=f.ajaxSettings.flatOptions||{};for(d in c)c[d]!==b&&((g[d]?a:e||(e={}))[d]=c[d]);e&&f.extend(!0,a,e)}function b$(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;var h=a[f],i=0,j=h?h.length:0,k=a===bT,l;for(;i<j&&(k||!l);i++)l=h[i](c,d,e),typeof l=="string"&&(!k||g[l]?l=b:(c.dataTypes.unshift(l),l=b$(a,c,d,e,l,g)));(k||!l)&&!g["*"]&&(l=b$(a,c,d,e,"*",g));return l}function bZ(a){return function(b,c){typeof b!="string"&&(c=b,b="*");if(f.isFunction(c)){var d=b.toLowerCase().split(bP),e=0,g=d.length,h,i,j;for(;e<g;e++)h=d[e],j=/^\+/.test(h),j&&(h=h.substr(1)||"*"),i=a[h]=a[h]||[],i[j?"unshift":"push"](c)}}}function bC(a,b,c){var d=b==="width"?a.offsetWidth:a.offsetHeight,e=b==="width"?bx:by,g=0,h=e.length;if(d>0){if(c!=="border")for(;g<h;g++)c||(d-=parseFloat(f.css(a,"padding"+e[g]))||0),c==="margin"?d+=parseFloat(f.css(a,c+e[g]))||0:d-=parseFloat(f.css(a,"border"+e[g]+"Width"))||0;return d+"px"}d=bz(a,b,b);if(d<0||d==null)d=a.style[b]||0;d=parseFloat(d)||0;if(c)for(;g<h;g++)d+=parseFloat(f.css(a,"padding"+e[g]))||0,c!=="padding"&&(d+=parseFloat(f.css(a,"border"+e[g]+"Width"))||0),c==="margin"&&(d+=parseFloat(f.css(a,c+e[g]))||0);return d+"px"}function bp(a,b){b.src?f.ajax({url:b.src,async:!1,dataType:"script"}):f.globalEval((b.text||b.textContent||b.innerHTML||"").replace(bf,"/*$0*/")),b.parentNode&&b.parentNode.removeChild(b)}function bo(a){var b=c.createElement("div");bh.appendChild(b),b.innerHTML=a.outerHTML;return b.firstChild}function bn(a){var b=(a.nodeName||"").toLowerCase();b==="input"?bm(a):b!=="script"&&typeof a.getElementsByTagName!="undefined"&&f.grep(a.getElementsByTagName("input"),bm)}function bm(a){if(a.type==="checkbox"||a.type==="radio")a.defaultChecked=a.checked}function bl(a){return typeof a.getElementsByTagName!="undefined"?a.getElementsByTagName("*"):typeof a.querySelectorAll!="undefined"?a.querySelectorAll("*"):[]}function bk(a,b){var c;if(b.nodeType===1){b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase();if(c==="object")b.outerHTML=a.outerHTML;else if(c!=="input"||a.type!=="checkbox"&&a.type!=="radio"){if(c==="option")b.selected=a.defaultSelected;else if(c==="input"||c==="textarea")b.defaultValue=a.defaultValue}else a.checked&&(b.defaultChecked=b.checked=a.checked),b.value!==a.value&&(b.value=a.value);b.removeAttribute(f.expando)}}function bj(a,b){if(b.nodeType===1&&!!f.hasData(a)){var c,d,e,g=f._data(a),h=f._data(b,g),i=g.events;if(i){delete h.handle,h.events={};for(c in i)for(d=0,e=i[c].length;d<e;d++)f.event.add(b,c+(i[c][d].namespace?".":"")+i[c][d].namespace,i[c][d],i[c][d].data)}h.data&&(h.data=f.extend({},h.data))}}function bi(a,b){return f.nodeName(a,"table")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function U(a){var b=V.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}function T(a,b,c){b=b||0;if(f.isFunction(b))return f.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return f.grep(a,function(a,d){return a===b===c});if(typeof b=="string"){var d=f.grep(a,function(a){return a.nodeType===1});if(O.test(b))return f.filter(b,d,!c);b=f.filter(b,d)}return f.grep(a,function(a,d){return f.inArray(a,b)>=0===c})}function S(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function K(){return!0}function J(){return!1}function n(a,b,c){var d=b+"defer",e=b+"queue",g=b+"mark",h=f._data(a,d);h&&(c==="queue"||!f._data(a,e))&&(c==="mark"||!f._data(a,g))&&setTimeout(function(){!f._data(a,e)&&!f._data(a,g)&&(f.removeData(a,d,!0),h.fire())},0)}function m(a){for(var b in a){if(b==="data"&&f.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function l(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(k,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNumeric(d)?parseFloat(d):j.test(d)?f.parseJSON(d):d}catch(g){}f.data(a,c,d)}else d=b}return d}function h(a){var b=g[a]={},c,d;a=a.split(/\s+/);for(c=0,d=a.length;c<d;c++)b[a[c]]=!0;return b}var c=a.document,d=a.navigator,e=a.location,f=function(){function J(){if(!e.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(J,1);return}e.ready()}}var e=function(a,b){return new e.fn.init(a,b,h)},f=a.jQuery,g=a.$,h,i=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=/-([a-z]|[0-9])/ig,w=/^-ms-/,x=function(a,b){return(b+"").toUpperCase()},y=d.userAgent,z,A,B,C=Object.prototype.toString,D=Object.prototype.hasOwnProperty,E=Array.prototype.push,F=Array.prototype.slice,G=String.prototype.trim,H=Array.prototype.indexOf,I={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=m.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.7.1",length:0,size:function(){return this.length},toArray:function(){return F.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?E.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),A.add(a);return this},eq:function(a){a=+a;return a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(F.apply(this,arguments),"slice",F.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:E,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j<k;j++)if((a=arguments[j])!=null)for(c in a){d=i[c],f=a[c];if(i===f)continue;l&&f&&(e.isPlainObject(f)||(g=e.isArray(f)))?(g?(g=!1,h=d&&e.isArray(d)?d:[]):h=d&&e.isPlainObject(d)?d:{},i[c]=e.extend(l,h,f)):f!==b&&(i[c]=f)}return i},e.extend({noConflict:function(b){a.$===e&&(a.$=g),b&&a.jQuery===e&&(a.jQuery=f);return e},isReady:!1,readyWait:1,holdReady:function(a){a?e.readyWait++:e.ready(!0)},ready:function(a){if(a===!0&&!--e.readyWait||a!==!0&&!e.isReady){if(!c.body)return setTimeout(e.ready,1);e.isReady=!0;if(a!==!0&&--e.readyWait>0)return;A.fireWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").off("ready")}},bindReady:function(){if(!A){A=e.Callbacks("once memory");if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",B,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",B),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&J()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):I[C.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!D.call(a,"constructor")&&!D.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||D.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw new Error(a)},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(c){var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(w,"ms-").replace(v,x)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g<h;)if(c.apply(a[g++],d)===!1)break}else if(i){for(f in a)if(c.call(a[f],f,a[f])===!1)break}else for(;g<h;)if(c.call(a[g],g,a[g++])===!1)break;return a},trim:G?function(a){return a==null?"":G.call(a)}:function(a){return a==null?"":(a+"").replace(k,"").replace(l,"")},makeArray:function(a,b){var c=b||[];if(a!=null){var d=e.type(a);a.length==null||d==="string"||d==="function"||d==="regexp"||e.isWindow(a)?E.call(c,a):e.merge(c,a)}return c},inArray:function(a,b,c){var d;if(b){if(H)return H.call(b,a,c);d=b.length,c=c?c<0?Math.max(0,d+c):c:0;for(;c<d;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,c){var d=a.length,e=0;if(typeof c.length=="number")for(var f=c.length;e<f;e++)a[d++]=c[e];else while(c[e]!==b)a[d++]=c[e++];a.length=d;return a},grep:function(a,b,c){var d=[],e;c=!!c;for(var f=0,g=a.length;f<g;f++)e=!!b(a[f],f),c!==e&&d.push(a[f]);return d},map:function(a,c,d){var f,g,h=[],i=0,j=a.length,k=a instanceof e||j!==b&&typeof j=="number"&&(j>0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i<j;i++)f=c(a[i],i,d),f!=null&&(h[h.length]=f);else for(g in a)f=c(a[g],g,d),f!=null&&(h[h.length]=f);return h.concat.apply([],h)},guid:1,proxy:function(a,c){if(typeof c=="string"){var d=a[c];c=a,a=d}if(!e.isFunction(a))return b;var f=F.call(arguments,2),g=function(){return a.apply(c,f.concat(F.call(arguments)))};g.guid=a.guid=a.guid||g.guid||e.guid++;return g},access:function(a,c,d,f,g,h){var i=a.length;if(typeof c=="object"){for(var j in c)e.access(a,j,c[j],f,g,d);return a}if(d!==b){f=!h&&f&&e.isFunction(d);for(var k=0;k<i;k++)g(a[k],c,f?d.call(a[k],k,g(a[k],c)):d,h);return a}return i?g(a[0],c):b},now:function(){return(new Date).getTime()},uaMatch:function(a){a=a.toLowerCase();var b=r.exec(a)||s.exec(a)||t.exec(a)||a.indexOf("compatible")<0&&u.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},sub:function(){function a(b,c){return new a.fn.init(b,c)}e.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.sub=this.sub,a.fn.init=function(d,f){f&&f instanceof e&&!(f instanceof a)&&(f=a(f));return e.fn.init.call(this,d,f,b)},a.fn.init.prototype=a.fn;var b=a(c);return a},browser:{}}),e.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){I["[object "+b+"]"]=b.toLowerCase()}),z=e.uaMatch(y),z.browser&&(e.browser[z.browser]=!0,e.browser.version=z.version),e.browser.webkit&&(e.browser.safari=!0),j.test(" ")&&(k=/^[\s\xA0]+/,l=/[\s\xA0]+$/),h=e(c),c.addEventListener?B=function(){c.removeEventListener("DOMContentLoaded",B,!1),e.ready()}:c.attachEvent&&(B=function(){c.readyState==="complete"&&(c.detachEvent("onreadystatechange",B),e.ready())});return e}(),g={};f.Callbacks=function(a){a=a?g[a]||h(a):{};var c=[],d=[],e,i,j,k,l,m=function(b){var d,e,g,h,i;for(d=0,e=b.length;d<e;d++)g=b[d],h=f.type(g),h==="array"?m(g):h==="function"&&(!a.unique||!o.has(g))&&c.push(g)},n=function(b,f){f=f||[],e=!a.memory||[b,f],i=!0,l=j||0,j=0,k=c.length;for(;c&&l<k;l++)if(c[l].apply(b,f)===!1&&a.stopOnFalse){e=!0;break}i=!1,c&&(a.once?e===!0?o.disable():c=[]:d&&d.length&&(e=d.shift(),o.fireWith(e[0],e[1])))},o={add:function(){if(c){var a=c.length;m(arguments),i?k=c.length:e&&e!==!0&&(j=a,n(e[0],e[1]))}return this},remove:function(){if(c){var b=arguments,d=0,e=b.length;for(;d<e;d++)for(var f=0;f<c.length;f++)if(b[d]===c[f]){i&&f<=k&&(k--,f<=l&&l--),c.splice(f--,1);if(a.unique)break}}return this},has:function(a){if(c){var b=0,d=c.length;for(;b<d;b++)if(a===c[b])return!0}return!1},empty:function(){c=[];return this},disable:function(){c=d=e=b;return this},disabled:function(){return!c},lock:function(){d=b,(!e||e===!0)&&o.disable();return this},locked:function(){return!d},fireWith:function(b,c){d&&(i?a.once||d.push([b,c]):(!a.once||!e)&&n(b,c));return this},fire:function(){o.fireWith(this,arguments);return this},fired:function(){return!!e}};return o};var i=[].slice;f.extend({Deferred:function(a){var b=f.Callbacks("once memory"),c=f.Callbacks("once memory"),d=f.Callbacks("memory"),e="pending",g={resolve:b,reject:c,notify:d},h={done:b.add,fail:c.add,progress:d.add,state:function(){return e},isResolved:b.fired,isRejected:c.fired,then:function(a,b,c){i.done(a).fail(b).progress(c);return this},always:function(){i.done.apply(i,arguments).fail.apply(i,arguments);return this},pipe:function(a,b,c){return f.Deferred(function(d){f.each({done:[a,"resolve"],fail:[b,"reject"],progress:[c,"notify"]},function(a,b){var c=b[0],e=b[1],g;f.isFunction(c)?i[a](function(){g=c.apply(this,arguments),g&&f.isFunction(g.promise)?g.promise().then(d.resolve,d.reject,d.notify):d[e+"With"](this===i?d:this,[g])}):i[a](d[e])})}).promise()},promise:function(a){if(a==null)a=h;else for(var b in h)a[b]=h[b];return a}},i=h.promise({}),j;for(j in g)i[j]=g[j].fire,i[j+"With"]=g[j].fireWith;i.done(function(){e="resolved"},c.disable,d.lock).fail(function(){e="rejected"},b.disable,d.lock),a&&a.call(i,i);return i},when:function(a){function m(a){return function(b){e[a]=arguments.length>1?i.call(arguments,0):b,j.notifyWith(k,e)}}function l(a){return function(c){b[a]=arguments.length>1?i.call(arguments,0):c,--g||j.resolveWith(j,b)}}var b=i.call(arguments,0),c=0,d=b.length,e=Array(d),g=d,h=d,j=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred(),k=j.promise();if(d>1){for(;c<d;c++)b[c]&&b[c].promise&&f.isFunction(b[c].promise)?b[c].promise().then(l(c),j.reject,m(c)):--g;g||j.resolveWith(j,b)}else j!==a&&j.resolveWith(j,d?[a]:[]);return k}}),f.support=function(){var b,d,e,g,h,i,j,k,l,m,n,o,p,q=c.createElement("div"),r=c.documentElement;q.setAttribute("className","t"),q.innerHTML=" <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>",d=q.getElementsByTagName("*"),e=q.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=q.getElementsByTagName("input")[0],b={leadingWhitespace:q.firstChild.nodeType===3,tbody:!q.getElementsByTagName("tbody").length,htmlSerialize:!!q.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:q.className!=="t",enctype:!!c.createElement("form").enctype,html5Clone:c.createElement("nav").cloneNode(!0).outerHTML!=="<:nav></:nav>",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},i.checked=!0,b.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,b.optDisabled=!h.disabled;try{delete q.test}catch(s){b.deleteExpando=!1}!q.addEventListener&&q.attachEvent&&q.fireEvent&&(q.attachEvent("onclick",function(){b.noCloneEvent=!1}),q.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),b.radioValue=i.value==="t",i.setAttribute("checked","checked"),q.appendChild(i),k=c.createDocumentFragment(),k.appendChild(q.lastChild),b.checkClone=k.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=i.checked,k.removeChild(i),k.appendChild(q),q.innerHTML="",a.getComputedStyle&&(j=c.createElement("div"),j.style.width="0",j.style.marginRight="0",q.style.width="2px",q.appendChild(j),b.reliableMarginRight=(parseInt((a.getComputedStyle(j,null)||{marginRight:0}).marginRight,10)||0)===0);if(q.attachEvent)for(o in{submit:1,change:1,focusin:1})n="on"+o,p=n in q,p||(q.setAttribute(n,"return;"),p=typeof q[n]=="function"),b[o+"Bubbles"]=p;k.removeChild(q),k=g=h=j=q=i=null,f(function(){var a,d,e,g,h,i,j,k,m,n,o,r=c.getElementsByTagName("body")[0];!r||(j=1,k="position:absolute;top:0;left:0;width:1px;height:1px;margin:0;",m="visibility:hidden;border:0;",n="style='"+k+"border:5px solid #000;padding:0;'",o="<div "+n+"><div></div></div>"+"<table "+n+" cellpadding='0' cellspacing='0'>"+"<tr><td></td></tr></table>",a=c.createElement("div"),a.style.cssText=m+"width:0;height:0;position:static;top:0;margin-top:"+j+"px",r.insertBefore(a,r.firstChild),q=c.createElement("div"),a.appendChild(q),q.innerHTML="<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>",l=q.getElementsByTagName("td"),p=l[0].offsetHeight===0,l[0].style.display="",l[1].style.display="none",b.reliableHiddenOffsets=p&&l[0].offsetHeight===0,q.innerHTML="",q.style.width=q.style.paddingLeft="1px",f.boxModel=b.boxModel=q.offsetWidth===2,typeof q.style.zoom!="undefined"&&(q.style.display="inline",q.style.zoom=1,b.inlineBlockNeedsLayout=q.offsetWidth===2,q.style.display="",q.innerHTML="<div style='width:4px;'></div>",b.shrinkWrapBlocks=q.offsetWidth!==2),q.style.cssText=k+m,q.innerHTML=o,d=q.firstChild,e=d.firstChild,h=d.nextSibling.firstChild.firstChild,i={doesNotAddBorder:e.offsetTop!==5,doesAddBorderForTableAndCells:h.offsetTop===5},e.style.position="fixed",e.style.top="20px",i.fixedPosition=e.offsetTop===20||e.offsetTop===15,e.style.position=e.style.top="",d.style.overflow="hidden",d.style.position="relative",i.subtractsBorderForOverflowNotVisible=e.offsetTop===-5,i.doesNotIncludeMarginInBodyOffset=r.offsetTop!==j,r.removeChild(a),q=a=null,f.extend(b,i))});return b}();var j=/^(?:\{.*\}|\[.*\])$/,k=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!m(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i,j=f.expando,k=typeof c=="string",l=a.nodeType,m=l?f.cache:a,n=l?a[j]:a[j]&&j,o=c==="events";if((!n||!m[n]||!o&&!e&&!m[n].data)&&k&&d===b)return;n||(l?a[j]=n=++f.uuid:n=j),m[n]||(m[n]={},l||(m[n].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?m[n]=f.extend(m[n],c):m[n].data=f.extend(m[n].data,c);g=h=m[n],e||(h.data||(h.data={}),h=h.data),d!==b&&(h[f.camelCase(c)]=d);if(o&&!h[c])return g.events;k?(i=h[c],i==null&&(i=h[f.camelCase(c)])):i=h;return i}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e,g,h=f.expando,i=a.nodeType,j=i?f.cache:a,k=i?a[h]:h;if(!j[k])return;if(b){d=c?j[k]:j[k].data;if(d){f.isArray(b)||(b in d?b=[b]:(b=f.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,g=b.length;e<g;e++)delete d[b[e]];if(!(c?m:f.isEmptyObject)(d))return}}if(!c){delete j[k].data;if(!m(j[k]))return}f.support.deleteExpando||!j.setInterval?delete j[k]:j[k]=null,i&&(f.support.deleteExpando?delete a[h]:a.removeAttribute?a.removeAttribute(h):a[h]=null)}},_data:function(a,b,c){return f.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=f.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),f.fn.extend({data:function(a,c){var d,e,g,h=null;if(typeof a=="undefined"){if(this.length){h=f.data(this[0]);if(this[0].nodeType===1&&!f._data(this[0],"parsedAttrs")){e=this[0].attributes;for(var i=0,j=e.length;i<j;i++)g=e[i].name,g.indexOf("data-")===0&&(g=f.camelCase(g.substring(5)),l(this[0],g,h[g]));f._data(this[0],"parsedAttrs",!0)}}return h}if(typeof a=="object")return this.each(function(){f.data(this,a)});d=a.split("."),d[1]=d[1]?"."+d[1]:"";if(c===b){h=this.triggerHandler("getData"+d[1]+"!",[d[0]]),h===b&&this.length&&(h=f.data(this[0],a),h=l(this[0],a,h));return h===b&&d[1]?this.data(d[0]):h}return this.each(function(){var b=f(this),e=[d[0],c];b.triggerHandler("setData"+d[1]+"!",e),f.data(this,a,c),b.triggerHandler("changeData"+d[1]+"!",e)})},removeData:function(a){return this.each(function(){f.removeData(this,a)})}}),f.extend({_mark:function(a,b){a&&(b=(b||"fx")+"mark",f._data(a,b,(f._data(a,b)||0)+1))},_unmark:function(a,b,c){a!==!0&&(c=b,b=a,a=!1);if(b){c=c||"fx";var d=c+"mark",e=a?0:(f._data(b,d)||1)-1;e?f._data(b,d,e):(f.removeData(b,d,!0),n(b,c,"mark"))}},queue:function(a,b,c){var d;if(a){b=(b||"fx")+"queue",d=f._data(a,b),c&&(!d||f.isArray(c)?d=f._data(a,b,f.makeArray(c)):d.push(c));return d||[]}},dequeue:function(a,b){b=b||"fx";var c=f.queue(a,b),d=c.shift(),e={};d==="inprogress"&&(d=c.shift()),d&&(b==="fx"&&c.unshift("inprogress"),f._data(a,b+".run",e),d.call(a,function(){f.dequeue(a,b)},e)),c.length||(f.removeData(a,b+"queue "+b+".run",!0),n(a,b,"queue"))}}),f.fn.extend({queue:function(a,c){typeof a!="string"&&(c=a,a="fx");if(c===b)return f.queue(this[0],a);return this.each(function(){var b=f.queue(this,a,c);a==="fx"&&b[0]!=="inprogress"&&f.dequeue(this,a)})},dequeue:function(a){return this.each(function(){f.dequeue(this,a)})},delay:function(a,b){a=f.fx?f.fx.speeds[a]||a:a,b=b||"fx";return this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,c){function m(){--h||d.resolveWith(e,[e])}typeof a!="string"&&(c=a,a=b),a=a||"fx";var d=f.Deferred(),e=this,g=e.length,h=1,i=a+"defer",j=a+"queue",k=a+"mark",l;while(g--)if(l=f.data(e[g],i,b,!0)||(f.data(e[g],j,b,!0)||f.data(e[g],k,b,!0))&&f.data(e[g],i,f.Callbacks("once memory"),!0))h++,l.add(m);m();return d.promise()}});var o=/[\n\t\r]/g,p=/\s+/,q=/\r/g,r=/^(?:button|input)$/i,s=/^(?:button|input|object|select|textarea)$/i,t=/^a(?:rea)?$/i,u=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,v=f.support.getSetAttribute,w,x,y;f.fn.extend({attr:function(a,b){return f.access(this,a,b,!0,f.attr)},removeAttr:function(a){return this.each(function(){f.removeAttr(this,a)})},prop:function(a,b){return f.access(this,a,b,!0,f.prop)},removeProp:function(a){a=f.propFix[a]||a;return this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,g,h,i;if(f.isFunction(a))return this.each(function(b){f(this).addClass(a.call(this,b,this.className))});if(a&&typeof a=="string"){b=a.split(p);for(c=0,d=this.length;c<d;c++){e=this[c];if(e.nodeType===1)if(!e.className&&b.length===1)e.className=a;else{g=" "+e.className+" ";for(h=0,i=b.length;h<i;h++)~g.indexOf(" "+b[h]+" ")||(g+=b[h]+" ");e.className=f.trim(g)}}}return this},removeClass:function(a){var c,d,e,g,h,i,j;if(f.isFunction(a))return this.each(function(b){f(this).removeClass(a.call(this,b,this.className))});if(a&&typeof a=="string"||a===b){c=(a||"").split(p);for(d=0,e=this.length;d<e;d++){g=this[d];if(g.nodeType===1&&g.className)if(a){h=(" "+g.className+" ").replace(o," ");for(i=0,j=c.length;i<j;i++)h=h.replace(" "+c[i]+" "," ");g.className=f.trim(h)}else g.className=""}}return this},toggleClass:function(a,b){var c=typeof a,d=typeof b=="boolean";if(f.isFunction(a))return this.each(function(c){f(this).toggleClass(a.call(this,c,this.className,b),b)});return this.each(function(){if(c==="string"){var e,g=0,h=f(this),i=b,j=a.split(p);while(e=j[g++])i=d?i:!h.hasClass(e),h[i?"addClass":"removeClass"](e)}else if(c==="undefined"||c==="boolean")this.className&&f._data(this,"__className__",this.className),this.className=this.className||a===!1?"":f._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ",c=0,d=this.length;for(;c<d;c++)if(this[c].nodeType===1&&(" "+this[c].className+" ").replace(o," ").indexOf(b)>-1)return!0;return!1},val:function(a){var c,d,e,g=this[0];{if(!!arguments.length){e=f.isFunction(a);return this.each(function(d){var g=f(this),h;if(this.nodeType===1){e?h=a.call(this,d,g.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}if(g){c=f.valHooks[g.nodeName.toLowerCase()]||f.valHooks[g.type];if(c&&"get"in c&&(d=c.get(g,"value"))!==b)return d;d=g.value;return typeof d=="string"?d.replace(q,""):d==null?"":d}}}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,g=a.selectedIndex,h=[],i=a.options,j=a.type==="select-one";if(g<0)return null;c=j?g:0,d=j?g+1:i.length;for(;c<d;c++){e=i[c];if(e.selected&&(f.support.optDisabled?!e.disabled:e.getAttribute("disabled")===null)&&(!e.parentNode.disabled||!f.nodeName(e.parentNode,"optgroup"))){b=f(e).val();if(j)return b;h.push(b)}}if(j&&!h.length&&i.length)return f(i[g]).val();return h},set:function(a,b){var c=f.makeArray(b);f(a).find("option").each(function(){this.selected=f.inArray(f(this).val(),c)>=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,d,e){var g,h,i,j=a.nodeType;if(!!a&&j!==3&&j!==8&&j!==2){if(e&&c in f.attrFn)return f(a)[c](d);if(typeof a.getAttribute=="undefined")return f.prop(a,c,d);i=j!==1||!f.isXMLDoc(a),i&&(c=c.toLowerCase(),h=f.attrHooks[c]||(u.test(c)?x:w));if(d!==b){if(d===null){f.removeAttr(a,c);return}if(h&&"set"in h&&i&&(g=h.set(a,d,c))!==b)return g;a.setAttribute(c,""+d);return d}if(h&&"get"in h&&i&&(g=h.get(a,c))!==null)return g;g=a.getAttribute(c);return g===null?b:g}},removeAttr:function(a,b){var c,d,e,g,h=0;if(b&&a.nodeType===1){d=b.toLowerCase().split(p),g=d.length;for(;h<g;h++)e=d[h],e&&(c=f.propFix[e]||e,f.attr(a,e,""),a.removeAttribute(v?e:c),u.test(e)&&c in a&&(a[c]=!1))}},attrHooks:{type:{set:function(a,b){if(r.test(a.nodeName)&&a.parentNode)f.error("type property can't be changed");else if(!f.support.radioValue&&b==="radio"&&f.nodeName(a,"input")){var c=a.value;a.setAttribute("type",b),c&&(a.value=c);return b}}},value:{get:function(a,b){if(w&&f.nodeName(a,"button"))return w.get(a,b);return b in a?a.value:null},set:function(a,b,c){if(w&&f.nodeName(a,"button"))return w.set(a,b,c);a.value=b}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(a,c,d){var e,g,h,i=a.nodeType;if(!!a&&i!==3&&i!==8&&i!==2){h=i!==1||!f.isXMLDoc(a),h&&(c=f.propFix[c]||c,g=f.propHooks[c]);return d!==b?g&&"set"in g&&(e=g.set(a,d,c))!==b?e:a[c]=d:g&&"get"in g&&(e=g.get(a,c))!==null?e:a[c]}},propHooks:{tabIndex:{get:function(a){var c=a.getAttributeNode("tabindex");return c&&c.specified?parseInt(c.value,10):s.test(a.nodeName)||t.test(a.nodeName)&&a.href?0:b}}}}),f.attrHooks.tabindex=f.propHooks.tabIndex,x={get:function(a,c){var d,e=f.prop(a,c);return e===!0||typeof e!="boolean"&&(d=a.getAttributeNode(c))&&d.nodeValue!==!1?c.toLowerCase():b},set:function(a,b,c){var d;b===!1?f.removeAttr(a,c):(d=f.propFix[c]||c,d in a&&(a[d]=!0),a.setAttribute(c,c.toLowerCase()));return c}},v||(y={name:!0,id:!0},w=f.valHooks.button={get:function(a,c){var d;d=a.getAttributeNode(c);return d&&(y[c]?d.nodeValue!=="":d.specified)?d.nodeValue:b},set:function(a,b,d){var e=a.getAttributeNode(d);e||(e=c.createAttribute(d),a.setAttributeNode(e));return e.nodeValue=b+""}},f.attrHooks.tabindex.set=w.set,f.each(["width","height"],function(a,b){f.attrHooks[b]=f.extend(f.attrHooks[b],{set:function(a,c){if(c===""){a.setAttribute(b,"auto");return c}}})}),f.attrHooks.contenteditable={get:w.get,set:function(a,b,c){b===""&&(b="false"),w.set(a,b,c)}}),f.support.hrefNormalized||f.each(["href","src","width","height"],function(a,c){f.attrHooks[c]=f.extend(f.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),f.support.style||(f.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=""+b}}),f.support.optSelected||(f.propHooks.selected=f.extend(f.propHooks.selected,{get:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex);return null}})),f.support.enctype||(f.propFix.enctype="encoding"),f.support.checkOn||f.each(["radio","checkbox"],function(){f.valHooks[this]={get:function(a){return a.getAttribute("value")===null?"on":a.value}}}),f.each(["radio","checkbox"],function(){f.valHooks[this]=f.extend(f.valHooks[this],{set:function(a,b){if(f.isArray(b))return a.checked=f.inArray(f(a).val(),b)>=0}})});var z=/^(?:textarea|input|select)$/i,A=/^([^\.]*)?(?:\.(.+))?$/,B=/\bhover(\.\S+)?\b/,C=/^key/,D=/^(?:mouse|contextmenu)|click/,E=/^(?:focusinfocus|focusoutblur)$/,F=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,G=function(a){var b=F.exec(a);b&&(b[1]=(b[1]||"").toLowerCase(),b[3]=b[3]&&new RegExp("(?:^|\\s)"+b[3]+"(?:\\s|$)"));return b},H=function(a,b){var c=a.attributes||{};return(!b[1]||a.nodeName.toLowerCase()===b[1])&&(!b[2]||(c.id||{}).value===b[2])&&(!b[3]||b[3].test((c["class"]||{}).value))},I=function(a){return f.event.special.hover?a:a.replace(B,"mouseenter$1 mouseleave$1")};
f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3||a.nodeType===8||!c||!d||!(h=f._data(a)))){d.handler&&(p=d,d=p.handler),d.guid||(d.guid=f.guid++),j=h.events,j||(h.events=j={}),i=h.handle,i||(h.handle=i=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.dispatch.apply(i.elem,arguments):b},i.elem=a),c=f.trim(I(c)).split(" ");for(k=0;k<c.length;k++){l=A.exec(c[k])||[],m=l[1],n=(l[2]||"").split(".").sort(),s=f.event.special[m]||{},m=(g?s.delegateType:s.bindType)||m,s=f.event.special[m]||{},o=f.extend({type:m,origType:l[1],data:e,handler:d,guid:d.guid,selector:g,quick:G(g),namespace:n.join(".")},p),r=j[m];if(!r){r=j[m]=[],r.delegateCount=0;if(!s.setup||s.setup.call(a,e,n,i)===!1)a.addEventListener?a.addEventListener(m,i,!1):a.attachEvent&&a.attachEvent("on"+m,i)}s.add&&(s.add.call(a,o),o.handler.guid||(o.handler.guid=d.guid)),g?r.splice(r.delegateCount++,0,o):r.push(o),f.event.global[m]=!0}a=null}},global:{},remove:function(a,b,c,d,e){var g=f.hasData(a)&&f._data(a),h,i,j,k,l,m,n,o,p,q,r,s;if(!!g&&!!(o=g.events)){b=f.trim(I(b||"")).split(" ");for(h=0;h<b.length;h++){i=A.exec(b[h])||[],j=k=i[1],l=i[2];if(!j){for(j in o)f.event.remove(a,j+b[h],c,d,!0);continue}p=f.event.special[j]||{},j=(d?p.delegateType:p.bindType)||j,r=o[j]||[],m=r.length,l=l?new RegExp("(^|\\.)"+l.split(".").sort().join("\\.(?:.*\\.)?")+"(\\.|$)"):null;for(n=0;n<r.length;n++)s=r[n],(e||k===s.origType)&&(!c||c.guid===s.guid)&&(!l||l.test(s.namespace))&&(!d||d===s.selector||d==="**"&&s.selector)&&(r.splice(n--,1),s.selector&&r.delegateCount--,p.remove&&p.remove.call(a,s));r.length===0&&m!==r.length&&((!p.teardown||p.teardown.call(a,l)===!1)&&f.removeEvent(a,j,g.handle),delete o[j])}f.isEmptyObject(o)&&(q=g.handle,q&&(q.elem=null),f.removeData(a,["events","handle"],!0))}},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(c,d,e,g){if(!e||e.nodeType!==3&&e.nodeType!==8){var h=c.type||c,i=[],j,k,l,m,n,o,p,q,r,s;if(E.test(h+f.event.triggered))return;h.indexOf("!")>=0&&(h=h.slice(0,-1),k=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if((!e||f.event.customEvent[h])&&!f.event.global[h])return;c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.isTrigger=!0,c.exclusive=k,c.namespace=i.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,o=h.indexOf(":")<0?"on"+h:"";if(!e){j=f.cache;for(l in j)j[l].events&&j[l].events[h]&&f.event.trigger(c,d,j[l].handle.elem,!0);return}c.result=b,c.target||(c.target=e),d=d!=null?f.makeArray(d):[],d.unshift(c),p=f.event.special[h]||{};if(p.trigger&&p.trigger.apply(e,d)===!1)return;r=[[e,p.bindType||h]];if(!g&&!p.noBubble&&!f.isWindow(e)){s=p.delegateType||h,m=E.test(s+h)?e:e.parentNode,n=null;for(;m;m=m.parentNode)r.push([m,s]),n=m;n&&n===e.ownerDocument&&r.push([n.defaultView||n.parentWindow||a,s])}for(l=0;l<r.length&&!c.isPropagationStopped();l++)m=r[l][0],c.type=r[l][1],q=(f._data(m,"events")||{})[c.type]&&f._data(m,"handle"),q&&q.apply(m,d),q=o&&m[o],q&&f.acceptData(m)&&q.apply(m,d)===!1&&c.preventDefault();c.type=h,!g&&!c.isDefaultPrevented()&&(!p._default||p._default.apply(e.ownerDocument,d)===!1)&&(h!=="click"||!f.nodeName(e,"a"))&&f.acceptData(e)&&o&&e[h]&&(h!=="focus"&&h!=="blur"||c.target.offsetWidth!==0)&&!f.isWindow(e)&&(n=e[o],n&&(e[o]=null),f.event.triggered=h,e[h](),f.event.triggered=b,n&&(e[o]=n));return c.result}},dispatch:function(c){c=f.event.fix(c||a.event);var d=(f._data(this,"events")||{})[c.type]||[],e=d.delegateCount,g=[].slice.call(arguments,0),h=!c.exclusive&&!c.namespace,i=[],j,k,l,m,n,o,p,q,r,s,t;g[0]=c,c.delegateTarget=this;if(e&&!c.target.disabled&&(!c.button||c.type!=="click")){m=f(this),m.context=this.ownerDocument||this;for(l=c.target;l!=this;l=l.parentNode||this){o={},q=[],m[0]=l;for(j=0;j<e;j++)r=d[j],s=r.selector,o[s]===b&&(o[s]=r.quick?H(l,r.quick):m.is(s)),o[s]&&q.push(r);q.length&&i.push({elem:l,matches:q})}}d.length>e&&i.push({elem:this,matches:d.slice(e)});for(j=0;j<i.length&&!c.isPropagationStopped();j++){p=i[j],c.currentTarget=p.elem;for(k=0;k<p.matches.length&&!c.isImmediatePropagationStopped();k++){r=p.matches[k];if(h||!c.namespace&&!r.namespace||c.namespace_re&&c.namespace_re.test(r.namespace))c.data=r.data,c.handleObj=r,n=((f.event.special[r.origType]||{}).handle||r.handler).apply(p.elem,g),n!==b&&(c.result=n,n===!1&&(c.preventDefault(),c.stopPropagation()))}}return c.result},props:"attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){a.which==null&&(a.which=b.charCode!=null?b.charCode:b.keyCode);return a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,d){var e,f,g,h=d.button,i=d.fromElement;a.pageX==null&&d.clientX!=null&&(e=a.target.ownerDocument||c,f=e.documentElement,g=e.body,a.pageX=d.clientX+(f&&f.scrollLeft||g&&g.scrollLeft||0)-(f&&f.clientLeft||g&&g.clientLeft||0),a.pageY=d.clientY+(f&&f.scrollTop||g&&g.scrollTop||0)-(f&&f.clientTop||g&&g.clientTop||0)),!a.relatedTarget&&i&&(a.relatedTarget=i===a.target?d.toElement:i),!a.which&&h!==b&&(a.which=h&1?1:h&2?3:h&4?2:0);return a}},fix:function(a){if(a[f.expando])return a;var d,e,g=a,h=f.event.fixHooks[a.type]||{},i=h.props?this.props.concat(h.props):this.props;a=f.Event(g);for(d=i.length;d;)e=i[--d],a[e]=g[e];a.target||(a.target=g.srcElement||c),a.target.nodeType===3&&(a.target=a.target.parentNode),a.metaKey===b&&(a.metaKey=a.ctrlKey);return h.filter?h.filter(a,g):a},special:{ready:{setup:f.bindReady},load:{noBubble:!0},focus:{delegateType:"focusin"},blur:{delegateType:"focusout"},beforeunload:{setup:function(a,b,c){f.isWindow(this)&&(this.onbeforeunload=c)},teardown:function(a,b){this.onbeforeunload===b&&(this.onbeforeunload=null)}}},simulate:function(a,b,c,d){var e=f.extend(new f.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?f.event.trigger(e,null,b):f.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},f.event.handle=f.event.dispatch,f.removeEvent=c.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){a.detachEvent&&a.detachEvent("on"+b,c)},f.Event=function(a,b){if(!(this instanceof f.Event))return new f.Event(a,b);a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?K:J):this.type=a,b&&f.extend(this,b),this.timeStamp=a&&a.timeStamp||f.now(),this[f.expando]=!0},f.Event.prototype={preventDefault:function(){this.isDefaultPrevented=K;var a=this.originalEvent;!a||(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){this.isPropagationStopped=K;var a=this.originalEvent;!a||(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=K,this.stopPropagation()},isDefaultPrevented:J,isPropagationStopped:J,isImmediatePropagationStopped:J},f.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){f.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c=this,d=a.relatedTarget,e=a.handleObj,g=e.selector,h;if(!d||d!==c&&!f.contains(c,d))a.type=e.origType,h=e.handler.apply(this,arguments),a.type=b;return h}}}),f.support.submitBubbles||(f.event.special.submit={setup:function(){if(f.nodeName(this,"form"))return!1;f.event.add(this,"click._submit keypress._submit",function(a){var c=a.target,d=f.nodeName(c,"input")||f.nodeName(c,"button")?c.form:b;d&&!d._submit_attached&&(f.event.add(d,"submit._submit",function(a){this.parentNode&&!a.isTrigger&&f.event.simulate("submit",this.parentNode,a,!0)}),d._submit_attached=!0)})},teardown:function(){if(f.nodeName(this,"form"))return!1;f.event.remove(this,"._submit")}}),f.support.changeBubbles||(f.event.special.change={setup:function(){if(z.test(this.nodeName)){if(this.type==="checkbox"||this.type==="radio")f.event.add(this,"propertychange._change",function(a){a.originalEvent.propertyName==="checked"&&(this._just_changed=!0)}),f.event.add(this,"click._change",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1,f.event.simulate("change",this,a,!0))});return!1}f.event.add(this,"beforeactivate._change",function(a){var b=a.target;z.test(b.nodeName)&&!b._change_attached&&(f.event.add(b,"change._change",function(a){this.parentNode&&!a.isSimulated&&!a.isTrigger&&f.event.simulate("change",this.parentNode,a,!0)}),b._change_attached=!0)})},handle:function(a){var b=a.target;if(this!==b||a.isSimulated||a.isTrigger||b.type!=="radio"&&b.type!=="checkbox")return a.handleObj.handler.apply(this,arguments)},teardown:function(){f.event.remove(this,"._change");return z.test(this.nodeName)}}),f.support.focusinBubbles||f.each({focus:"focusin",blur:"focusout"},function(a,b){var d=0,e=function(a){f.event.simulate(b,a.target,f.event.fix(a),!0)};f.event.special[b]={setup:function(){d++===0&&c.addEventListener(a,e,!0)},teardown:function(){--d===0&&c.removeEventListener(a,e,!0)}}}),f.fn.extend({on:function(a,c,d,e,g){var h,i;if(typeof a=="object"){typeof c!="string"&&(d=c,c=b);for(i in a)this.on(i,c,d,a[i],g);return this}d==null&&e==null?(e=c,d=c=b):e==null&&(typeof c=="string"?(e=d,d=b):(e=d,d=c,c=b));if(e===!1)e=J;else if(!e)return this;g===1&&(h=e,e=function(a){f().off(a);return h.apply(this,arguments)},e.guid=h.guid||(h.guid=f.guid++));return this.each(function(){f.event.add(this,a,e,d,c)})},one:function(a,b,c,d){return this.on.call(this,a,b,c,d,1)},off:function(a,c,d){if(a&&a.preventDefault&&a.handleObj){var e=a.handleObj;f(a.delegateTarget).off(e.namespace?e.type+"."+e.namespace:e.type,e.selector,e.handler);return this}if(typeof a=="object"){for(var g in a)this.off(g,c,a[g]);return this}if(c===!1||typeof c=="function")d=c,c=b;d===!1&&(d=J);return this.each(function(){f.event.remove(this,a,d,c)})},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},live:function(a,b,c){f(this.context).on(a,this.selector,b,c);return this},die:function(a,b){f(this.context).off(a,this.selector||"**",b);return this},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return arguments.length==1?this.off(a,"**"):this.off(b,a,c)},trigger:function(a,b){return this.each(function(){f.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0])return f.event.trigger(a,b,this[0],!0)},toggle:function(a){var b=arguments,c=a.guid||f.guid++,d=0,e=function(c){var e=(f._data(this,"lastToggle"+a.guid)||0)%d;f._data(this,"lastToggle"+a.guid,e+1),c.preventDefault();return b[e].apply(this,arguments)||!1};e.guid=c;while(d<b.length)b[d++].guid=c;return this.click(e)},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),f.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){f.fn[b]=function(a,c){c==null&&(c=a,a=null);return arguments.length>0?this.on(b,null,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0),C.test(b)&&(f.event.fixHooks[b]=f.event.keyHooks),D.test(b)&&(f.event.fixHooks[b]=f.event.mouseHooks)}),function(){function x(a,b,c,e,f,g){for(var h=0,i=e.length;h<i;h++){var j=e[h];if(j){var k=!1;j=j[a];while(j){if(j[d]===c){k=e[j.sizset];break}if(j.nodeType===1){g||(j[d]=c,j.sizset=h);if(typeof b!="string"){if(j===b){k=!0;break}}else if(m.filter(b,[j]).length>0){k=j;break}}j=j[a]}e[h]=k}}}function w(a,b,c,e,f,g){for(var h=0,i=e.length;h<i;h++){var j=e[h];if(j){var k=!1;j=j[a];while(j){if(j[d]===c){k=e[j.sizset];break}j.nodeType===1&&!g&&(j[d]=c,j.sizset=h);if(j.nodeName.toLowerCase()===b){k=j;break}j=j[a]}e[h]=k}}}var a=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d="sizcache"+(Math.random()+"").replace(".",""),e=0,g=Object.prototype.toString,h=!1,i=!0,j=/\\/g,k=/\r\n/g,l=/\W/;[0,0].sort(function(){i=!1;return 0});var m=function(b,d,e,f){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return e;var i,j,k,l,n,q,r,t,u=!0,v=m.isXML(d),w=[],x=b;do{a.exec(""),i=a.exec(x);if(i){x=i[3],w.push(i[1]);if(i[2]){l=i[3];break}}}while(i);if(w.length>1&&p.exec(b))if(w.length===2&&o.relative[w[0]])j=y(w[0]+w[1],d,f);else{j=o.relative[w[0]]?[d]:m(w.shift(),d);while(w.length)b=w.shift(),o.relative[b]&&(b+=w.shift()),j=y(b,j,f)}else{!f&&w.length>1&&d.nodeType===9&&!v&&o.match.ID.test(w[0])&&!o.match.ID.test(w[w.length-1])&&(n=m.find(w.shift(),d,v),d=n.expr?m.filter(n.expr,n.set)[0]:n.set[0]);if(d){n=f?{expr:w.pop(),set:s(f)}:m.find(w.pop(),w.length===1&&(w[0]==="~"||w[0]==="+")&&d.parentNode?d.parentNode:d,v),j=n.expr?m.filter(n.expr,n.set):n.set,w.length>0?k=s(j):u=!1;while(w.length)q=w.pop(),r=q,o.relative[q]?r=w.pop():q="",r==null&&(r=d),o.relative[q](k,r,v)}else k=w=[]}k||(k=j),k||m.error(q||b);if(g.call(k)==="[object Array]")if(!u)e.push.apply(e,k);else if(d&&d.nodeType===1)for(t=0;k[t]!=null;t++)k[t]&&(k[t]===!0||k[t].nodeType===1&&m.contains(d,k[t]))&&e.push(j[t]);else for(t=0;k[t]!=null;t++)k[t]&&k[t].nodeType===1&&e.push(j[t]);else s(k,e);l&&(m(l,h,e,f),m.uniqueSort(e));return e};m.uniqueSort=function(a){if(u){h=i,a.sort(u);if(h)for(var b=1;b<a.length;b++)a[b]===a[b-1]&&a.splice(b--,1)}return a},m.matches=function(a,b){return m(a,null,null,b)},m.matchesSelector=function(a,b){return m(b,null,null,[a]).length>0},m.find=function(a,b,c){var d,e,f,g,h,i;if(!a)return[];for(e=0,f=o.order.length;e<f;e++){h=o.order[e];if(g=o.leftMatch[h].exec(a)){i=g[1],g.splice(1,1);if(i.substr(i.length-1)!=="\\"){g[1]=(g[1]||"").replace(j,""),d=o.find[h](g,b,c);if(d!=null){a=a.replace(o.match[h],"");break}}}}d||(d=typeof b.getElementsByTagName!="undefined"?b.getElementsByTagName("*"):[]);return{set:d,expr:a}},m.filter=function(a,c,d,e){var f,g,h,i,j,k,l,n,p,q=a,r=[],s=c,t=c&&c[0]&&m.isXML(c[0]);while(a&&c.length){for(h in o.filter)if((f=o.leftMatch[h].exec(a))!=null&&f[2]){k=o.filter[h],l=f[1],g=!1,f.splice(1,1);if(l.substr(l.length-1)==="\\")continue;s===r&&(r=[]);if(o.preFilter[h]){f=o.preFilter[h](f,s,d,r,e,t);if(!f)g=i=!0;else if(f===!0)continue}if(f)for(n=0;(j=s[n])!=null;n++)j&&(i=k(j,f,n,s),p=e^i,d&&i!=null?p?g=!0:s[n]=!1:p&&(r.push(j),g=!0));if(i!==b){d||(s=r),a=a.replace(o.match[h],"");if(!g)return[];break}}if(a===q)if(g==null)m.error(a);else break;q=a}return s},m.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)};var n=m.getText=function(a){var b,c,d=a.nodeType,e="";if(d){if(d===1||d===9){if(typeof a.textContent=="string")return a.textContent;if(typeof a.innerText=="string")return a.innerText.replace(k,"");for(a=a.firstChild;a;a=a.nextSibling)e+=n(a)}else if(d===3||d===4)return a.nodeValue}else for(b=0;c=a[b];b++)c.nodeType!==8&&(e+=n(c));return e},o=m.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(a){return a.getAttribute("href")},type:function(a){return a.getAttribute("type")}},relative:{"+":function(a,b){var c=typeof b=="string",d=c&&!l.test(b),e=c&&!d;d&&(b=b.toLowerCase());for(var f=0,g=a.length,h;f<g;f++)if(h=a[f]){while((h=h.previousSibling)&&h.nodeType!==1);a[f]=e||h&&h.nodeName.toLowerCase()===b?h||!1:h===b}e&&m.filter(b,a,!0)},">":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!l.test(b)){b=b.toLowerCase();for(;e<f;e++){c=a[e];if(c){var g=c.parentNode;a[e]=g.nodeName.toLowerCase()===b?g:!1}}}else{for(;e<f;e++)c=a[e],c&&(a[e]=d?c.parentNode:c.parentNode===b);d&&m.filter(b,a,!0)}},"":function(a,b,c){var d,f=e++,g=x;typeof b=="string"&&!l.test(b)&&(b=b.toLowerCase(),d=b,g=w),g("parentNode",b,f,a,d,c)},"~":function(a,b,c){var d,f=e++,g=x;typeof b=="string"&&!l.test(b)&&(b=b.toLowerCase(),d=b,g=w),g("previousSibling",b,f,a,d,c)}},find:{ID:function(a,b,c){if(typeof b.getElementById!="undefined"&&!c){var d=b.getElementById(a[1]);return d&&d.parentNode?[d]:[]}},NAME:function(a,b){if(typeof b.getElementsByName!="undefined"){var c=[],d=b.getElementsByName(a[1]);for(var e=0,f=d.length;e<f;e++)d[e].getAttribute("name")===a[1]&&c.push(d[e]);return c.length===0?null:c}},TAG:function(a,b){if(typeof b.getElementsByTagName!="undefined")return b.getElementsByTagName(a[1])}},preFilter:{CLASS:function(a,b,c,d,e,f){a=" "+a[1].replace(j,"")+" ";if(f)return a;for(var g=0,h;(h=b[g])!=null;g++)h&&(e^(h.className&&(" "+h.className+" ").replace(/[\t\n\r]/g," ").indexOf(a)>=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(j,"")},TAG:function(a,b){return a[1].replace(j,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||m.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&m.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(j,"");!f&&o.attrMap[g]&&(a[1]=o.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(j,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=m(b[3],null,null,c);else{var g=m.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(o.match.POS.test(b[0])||o.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!m(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return b<c[3]-0},gt:function(a,b,c){return b>c[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=o.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||n([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h<i;h++)if(g[h]===a)return!1;return!0}m.error(e)},CHILD:function(a,b){var c,e,f,g,h,i,j,k=b[1],l=a;switch(k){case"only":case"first":while(l=l.previousSibling)if(l.nodeType===1)return!1;if(k==="first")return!0;l=a;case"last":while(l=l.nextSibling)if(l.nodeType===1)return!1;return!0;case"nth":c=b[2],e=b[3];if(c===1&&e===0)return!0;f=b[0],g=a.parentNode;if(g&&(g[d]!==f||!a.nodeIndex)){i=0;for(l=g.firstChild;l;l=l.nextSibling)l.nodeType===1&&(l.nodeIndex=++i);g[d]=f}j=a.nodeIndex-e;return c===0?j===0:j%c===0&&j/c>=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||!!a.nodeName&&a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=m.attr?m.attr(a,c):o.attrHandle[c]?o.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":!f&&m.attr?d!=null:f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=o.setFilters[e];if(f)return f(a,c,b,d)}}},p=o.match.POS,q=function(a,b){return"\\"+(b-0+1)};for(var r in o.match)o.match[r]=new RegExp(o.match[r].source+/(?![^\[]*\])(?![^\(]*\))/.source),o.leftMatch[r]=new RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[r].source.replace(/\\(\d+)/g,q));var s=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(t){s=function(a,b){var c=0,d=b||[];if(g.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var e=a.length;c<e;c++)d.push(a[c]);else for(;a[c];c++)d.push(a[c]);return d}}var u,v;c.documentElement.compareDocumentPosition?u=function(a,b){if(a===b){h=!0;return 0}if(!a.compareDocumentPosition||!b.compareDocumentPosition)return a.compareDocumentPosition?-1:1;return a.compareDocumentPosition(b)&4?-1:1}:(u=function(a,b){if(a===b){h=!0;return 0}if(a.sourceIndex&&b.sourceIndex)return a.sourceIndex-b.sourceIndex;var c,d,e=[],f=[],g=a.parentNode,i=b.parentNode,j=g;if(g===i)return v(a,b);if(!g)return-1;if(!i)return 1;while(j)e.unshift(j),j=j.parentNode;j=i;while(j)f.unshift(j),j=j.parentNode;c=e.length,d=f.length;for(var k=0;k<c&&k<d;k++)if(e[k]!==f[k])return v(e[k],f[k]);return k===c?v(a,f[k],-1):v(e[k],b,1)},v=function(a,b,c){if(a===b)return c;var d=a.nextSibling;while(d){if(d===b)return-1;d=d.nextSibling}return 1}),function(){var a=c.createElement("div"),d="script"+(new Date).getTime(),e=c.documentElement;a.innerHTML="<a name='"+d+"'/>",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(o.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},o.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(o.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="<a href='#'></a>",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(o.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=m,b=c.createElement("div"),d="__sizzle__";b.innerHTML="<p class='TEST'></p>";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){m=function(b,e,f,g){e=e||c;if(!g&&!m.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return s(e.getElementsByTagName(b),f);if(h[2]&&o.find.CLASS&&e.getElementsByClassName)return s(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return s([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return s([],f);if(i.id===h[3])return s([i],f)}try{return s(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var k=e,l=e.getAttribute("id"),n=l||d,p=e.parentNode,q=/^\s*[+~]/.test(b);l?n=n.replace(/'/g,"\\$&"):e.setAttribute("id",n),q&&p&&(e=e.parentNode);try{if(!q||p)return s(e.querySelectorAll("[id='"+n+"'] "+b),f)}catch(r){}finally{l||k.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)m[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}m.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!m.isXML(a))try{if(e||!o.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return m(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="<div class='test e'></div><div class='test'></div>";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;o.order.splice(1,0,"CLASS"),o.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?m.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?m.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:m.contains=function(){return!1},m.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var y=function(a,b,c){var d,e=[],f="",g=b.nodeType?[b]:b;while(d=o.match.PSEUDO.exec(a))f+=d[0],a=a.replace(o.match.PSEUDO,"");a=o.relative[a]?a+"*":a;for(var h=0,i=g.length;h<i;h++)m(a,g[h],e,c);return m.filter(f,e)};m.attr=f.attr,m.selectors.attrMap={},f.find=m,f.expr=m.selectors,f.expr[":"]=f.expr.filters,f.unique=m.uniqueSort,f.text=m.getText,f.isXMLDoc=m.isXML,f.contains=m.contains}();var L=/Until$/,M=/^(?:parents|prevUntil|prevAll)/,N=/,/,O=/^.[^:#\[\.,]*$/,P=Array.prototype.slice,Q=f.expr.match.POS,R={children:!0,contents:!0,next:!0,prev:!0};f.fn.extend({find:function(a){var b=this,c,d;if(typeof a!="string")return f(a).filter(function(){for(c=0,d=b.length;c<d;c++)if(f.contains(b[c],this))return!0});var e=this.pushStack("","find",a),g,h,i;for(c=0,d=this.length;c<d;c++){g=e.length,f.find(a,this[c],e);if(c>0)for(h=g;h<e.length;h++)for(i=0;i<g;i++)if(e[i]===e[h]){e.splice(h--,1);break}}return e},has:function(a){var b=f(a);return this.filter(function(){for(var a=0,c=b.length;a<c;a++)if(f.contains(this,b[a]))return!0})},not:function(a){return this.pushStack(T(this,a,!1),"not",a)},filter:function(a){return this.pushStack(T(this,a,!0),"filter",a)},is:function(a){return!!a&&(typeof a=="string"?Q.test(a)?f(a,this.context).index(this[0])>=0:f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h=1;while(g&&g.ownerDocument&&g!==b){for(d=0;d<a.length;d++)f(g).is(a[d])&&c.push({selector:a[d],elem:g,level:h});g=g.parentNode,h++}return c}var i=Q.test(a)||typeof a!="string"?f(a,b||this.context):0;for(d=0,e=this.length;d<e;d++){g=this[d];while(g){if(i?i.index(g)>-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=="string")return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(S(c[0])||S(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling(a.parentNode.firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c);L.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!R[a]?f.unique(e):e,(this.length>1||N.test(d))&&M.test(a)&&(e=e.reverse());return this.pushStack(e,a,P.call(arguments).join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var V="abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",W=/ jQuery\d+="(?:\d+|null)"/g,X=/^\s+/,Y=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Z=/<([\w:]+)/,$=/<tbody/i,_=/<|&#?\w+;/,ba=/<(?:script|style)/i,bb=/<(?:script|object|embed|option|style)/i,bc=new RegExp("<(?:"+V+")","i"),bd=/checked\s*(?:[^=]|=\s*.checked.)/i,be=/\/(java|ecma)script/i,bf=/^\s*<!(?:\[CDATA\[|\-\-)/,bg={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]},bh=U(c);bg.optgroup=bg.option,bg.tbody=bg.tfoot=bg.colgroup=bg.caption=bg.thead,bg.th=bg.td,f.support.htmlSerialize||(bg._default=[1,"div<div>","</div>"]),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()))});if(typeof a!="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=f.isFunction(a);return this.each(function(c){f(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f.clean(arguments);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f.clean(arguments));return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function()
{for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(W,""):null;if(typeof a=="string"&&!ba.test(a)&&(f.support.leadingWhitespace||!X.test(a))&&!bg[(Z.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Y,"<$1></$2>");try{for(var c=0,d=this.length;c<d;c++)this[c].nodeType===1&&(f.cleanData(this[c].getElementsByTagName("*")),this[c].innerHTML=a)}catch(e){this.empty().append(a)}}else f.isFunction(a)?this.each(function(b){var c=f(this);c.html(a.call(this,b,c.html()))}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(f.isFunction(a))return this.each(function(b){var c=f(this),d=c.html();c.replaceWith(a.call(this,b,d))});typeof a!="string"&&(a=f(a).detach());return this.each(function(){var b=this.nextSibling,c=this.parentNode;f(this).remove(),b?f(b).before(a):f(c).append(a)})}return this.length?this.pushStack(f(f.isFunction(a)?a():a),"replaceWith",a):this},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,d){var e,g,h,i,j=a[0],k=[];if(!f.support.checkClone&&arguments.length===3&&typeof j=="string"&&bd.test(j))return this.each(function(){f(this).domManip(a,c,d,!0)});if(f.isFunction(j))return this.each(function(e){var g=f(this);a[0]=j.call(this,e,c?g.html():b),g.domManip(a,c,d)});if(this[0]){i=j&&j.parentNode,f.support.parentNode&&i&&i.nodeType===11&&i.childNodes.length===this.length?e={fragment:i}:e=f.buildFragment(a,this,k),h=e.fragment,h.childNodes.length===1?g=h=h.firstChild:g=h.firstChild;if(g){c=c&&f.nodeName(g,"tr");for(var l=0,m=this.length,n=m-1;l<m;l++)d.call(c?bi(this[l],g):this[l],e.cacheable||m>1&&l<n?f.clone(h,!0,!0):h)}k.length&&f.each(k,bp)}return this}}),f.buildFragment=function(a,b,d){var e,g,h,i,j=a[0];b&&b[0]&&(i=b[0].ownerDocument||b[0]),i.createDocumentFragment||(i=c),a.length===1&&typeof j=="string"&&j.length<512&&i===c&&j.charAt(0)==="<"&&!bb.test(j)&&(f.support.checkClone||!bd.test(j))&&(f.support.html5Clone||!bc.test(j))&&(g=!0,h=f.fragments[j],h&&h!==1&&(e=h)),e||(e=i.createDocumentFragment(),f.clean(a,i,e,d)),g&&(f.fragments[j]=h?e:1);return{fragment:e,cacheable:g}},f.fragments={},f.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){f.fn[a]=function(c){var d=[],e=f(c),g=this.length===1&&this[0].parentNode;if(g&&g.nodeType===11&&g.childNodes.length===1&&e.length===1){e[b](this[0]);return this}for(var h=0,i=e.length;h<i;h++){var j=(h>0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d,e,g,h=f.support.html5Clone||!bc.test("<"+a.nodeName)?a.cloneNode(!0):bo(a);if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bk(a,h),d=bl(a),e=bl(h);for(g=0;d[g];++g)e[g]&&bk(d[g],e[g])}if(b){bj(a,h);if(c){d=bl(a),e=bl(h);for(g=0;d[g];++g)bj(d[g],e[g])}}d=e=null;return h},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var h=[],i;for(var j=0,k;(k=a[j])!=null;j++){typeof k=="number"&&(k+="");if(!k)continue;if(typeof k=="string")if(!_.test(k))k=b.createTextNode(k);else{k=k.replace(Y,"<$1></$2>");var l=(Z.exec(k)||["",""])[1].toLowerCase(),m=bg[l]||bg._default,n=m[0],o=b.createElement("div");b===c?bh.appendChild(o):U(b).appendChild(o),o.innerHTML=m[1]+k+m[2];while(n--)o=o.lastChild;if(!f.support.tbody){var p=$.test(k),q=l==="table"&&!p?o.firstChild&&o.firstChild.childNodes:m[1]==="<table>"&&!p?o.childNodes:[];for(i=q.length-1;i>=0;--i)f.nodeName(q[i],"tbody")&&!q[i].childNodes.length&&q[i].parentNode.removeChild(q[i])}!f.support.leadingWhitespace&&X.test(k)&&o.insertBefore(b.createTextNode(X.exec(k)[0]),o.firstChild),k=o.childNodes}var r;if(!f.support.appendChecked)if(k[0]&&typeof (r=k.length)=="number")for(i=0;i<r;i++)bn(k[i]);else bn(k);k.nodeType?h.push(k):h=f.merge(h,k)}if(d){g=function(a){return!a.type||be.test(a.type)};for(j=0;h[j];j++)if(e&&f.nodeName(h[j],"script")&&(!h[j].type||h[j].type.toLowerCase()==="text/javascript"))e.push(h[j].parentNode?h[j].parentNode.removeChild(h[j]):h[j]);else{if(h[j].nodeType===1){var s=f.grep(h[j].getElementsByTagName("script"),g);h.splice.apply(h,[j+1,0].concat(s))}d.appendChild(h[j])}}return h},cleanData:function(a){var b,c,d=f.cache,e=f.event.special,g=f.support.deleteExpando;for(var h=0,i;(i=a[h])!=null;h++){if(i.nodeName&&f.noData[i.nodeName.toLowerCase()])continue;c=i[f.expando];if(c){b=d[c];if(b&&b.events){for(var j in b.events)e[j]?f.event.remove(i,j):f.removeEvent(i,j,b.handle);b.handle&&(b.handle.elem=null)}g?delete i[f.expando]:i.removeAttribute&&i.removeAttribute(f.expando),delete d[c]}}}});var bq=/alpha\([^)]*\)/i,br=/opacity=([^)]*)/,bs=/([A-Z]|^ms)/g,bt=/^-?\d+(?:px)?$/i,bu=/^-?\d/,bv=/^([\-+])=([\-+.\de]+)/,bw={position:"absolute",visibility:"hidden",display:"block"},bx=["Left","Right"],by=["Top","Bottom"],bz,bA,bB;f.fn.css=function(a,c){if(arguments.length===2&&c===b)return this;return f.access(this,a,c,!0,function(a,c,d){return d!==b?f.style(a,c,d):f.css(a,c)})},f.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=bz(a,"opacity","opacity");return c===""?"1":c}return a.style.opacity}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":f.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!!a&&a.nodeType!==3&&a.nodeType!==8&&!!a.style){var g,h,i=f.camelCase(c),j=a.style,k=f.cssHooks[i];c=f.cssProps[i]||i;if(d===b){if(k&&"get"in k&&(g=k.get(a,!1,e))!==b)return g;return j[c]}h=typeof d,h==="string"&&(g=bv.exec(d))&&(d=+(g[1]+1)*+g[2]+parseFloat(f.css(a,c)),h="number");if(d==null||h==="number"&&isNaN(d))return;h==="number"&&!f.cssNumber[i]&&(d+="px");if(!k||!("set"in k)||(d=k.set(a,d))!==b)try{j[c]=d}catch(l){}}},css:function(a,c,d){var e,g;c=f.camelCase(c),g=f.cssHooks[c],c=f.cssProps[c]||c,c==="cssFloat"&&(c="float");if(g&&"get"in g&&(e=g.get(a,!0,d))!==b)return e;if(bz)return bz(a,c)},swap:function(a,b,c){var d={};for(var e in b)d[e]=a.style[e],a.style[e]=b[e];c.call(a);for(e in b)a.style[e]=d[e]}}),f.curCSS=f.css,f.each(["height","width"],function(a,b){f.cssHooks[b]={get:function(a,c,d){var e;if(c){if(a.offsetWidth!==0)return bC(a,b,d);f.swap(a,bw,function(){e=bC(a,b,d)});return e}},set:function(a,b){if(!bt.test(b))return b;b=parseFloat(b);if(b>=0)return b+"px"}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return br.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNumeric(b)?"alpha(opacity="+b*100+")":"",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bq,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bq.test(g)?g.replace(bq,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bz(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(bA=function(a,b){var c,d,e;b=b.replace(bs,"-$1").toLowerCase(),(d=a.ownerDocument.defaultView)&&(e=d.getComputedStyle(a,null))&&(c=e.getPropertyValue(b),c===""&&!f.contains(a.ownerDocument.documentElement,a)&&(c=f.style(a,b)));return c}),c.documentElement.currentStyle&&(bB=function(a,b){var c,d,e,f=a.currentStyle&&a.currentStyle[b],g=a.style;f===null&&g&&(e=g[b])&&(f=e),!bt.test(f)&&bu.test(f)&&(c=g.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),g.left=b==="fontSize"?"1em":f||0,f=g.pixelLeft+"px",g.left=c,d&&(a.runtimeStyle.left=d));return f===""?"auto":f}),bz=bA||bB,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style&&a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)});var bD=/%20/g,bE=/\[\]$/,bF=/\r?\n/g,bG=/#.*$/,bH=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bI=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bJ=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bK=/^(?:GET|HEAD)$/,bL=/^\/\//,bM=/\?/,bN=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,bO=/^(?:select|textarea)/i,bP=/\s+/,bQ=/([?&])_=[^&]*/,bR=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bS=f.fn.load,bT={},bU={},bV,bW,bX=["*/"]+["*"];try{bV=e.href}catch(bY){bV=c.createElement("a"),bV.href="",bV=bV.href}bW=bR.exec(bV.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bS)return bS.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("<div>").append(c.replace(bN,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bO.test(this.nodeName)||bI.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bF,"\r\n")}}):{name:b.name,value:c.replace(bF,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.on(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?b_(a,f.ajaxSettings):(b=a,a=f.ajaxSettings),b_(a,b);return a},ajaxSettings:{url:bV,isLocal:bJ.test(bW[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":bX},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:bZ(bT),ajaxTransport:bZ(bU),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a>0?4:0;var o,r,u,w=c,x=l?cb(d,v,l):b,y,z;if(a>=200&&a<300||a===304){if(d.ifModified){if(y=v.getResponseHeader("Last-Modified"))f.lastModified[k]=y;if(z=v.getResponseHeader("Etag"))f.etag[k]=z}if(a===304)w="notmodified",o=!0;else try{r=cc(d,x),w="success",o=!0}catch(A){w="parsererror",u=A}}else{u=w;if(!w||a)w="error",a<0&&(a=0)}v.status=a,v.statusText=""+(c||w),o?h.resolveWith(e,[r,w,v]):h.rejectWith(e,[v,w,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.fireWith(e,[v,w]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f.Callbacks("once memory"),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bH.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.add,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bG,"").replace(bL,bW[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bP),d.crossDomain==null&&(r=bR.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bW[1]&&r[2]==bW[2]&&(r[3]||(r[1]==="http:"?80:443))==(bW[3]||(bW[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),b$(bT,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bK.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bM.test(d.url)?"&":"?")+d.data,delete d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bQ,"$1_="+x);d.url=y+(y===d.url?(bM.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", "+bX+"; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=b$(bU,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){if(s<2)w(-1,z);else throw z}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)ca(g,a[g],c,e);return d.join("&").replace(bD,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var cd=f.now(),ce=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+cd++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=b.contentType==="application/x-www-form-urlencoded"&&typeof b.data=="string";if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(ce.test(b.url)||e&&ce.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(ce,l),b.url===j&&(e&&(k=k.replace(ce,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var cf=a.ActiveXObject?function(){for(var a in ch)ch[a](0,1)}:!1,cg=0,ch;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ci()||cj()}:ci,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,cf&&delete ch[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n),m.text=h.responseText;try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cg,cf&&(ch||(ch={},f(a).unload(cf)),ch[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var ck={},cl,cm,cn=/^(?:toggle|show|hide)$/,co=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,cp,cq=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cr;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(cu("show",3),a,b,c);for(var g=0,h=this.length;g<h;g++)d=this[g],d.style&&(e=d.style.display,!f._data(d,"olddisplay")&&e==="none"&&(e=d.style.display=""),e===""&&f.css(d,"display")==="none"&&f._data(d,"olddisplay",cv(d.nodeName)));for(g=0;g<h;g++){d=this[g];if(d.style){e=d.style.display;if(e===""||e==="none")d.style.display=f._data(d,"olddisplay")||""}}return this},hide:function(a,b,c){if(a||a===0)return this.animate(cu("hide",3),a,b,c);var d,e,g=0,h=this.length;for(;g<h;g++)d=this[g],d.style&&(e=f.css(d,"display"),e!=="none"&&!f._data(d,"olddisplay")&&f._data(d,"olddisplay",e));for(g=0;g<h;g++)this[g].style&&(this[g].style.display="none");return this},_toggle:f.fn.toggle,toggle:function(a,b,c){var d=typeof a=="boolean";f.isFunction(a)&&f.isFunction(b)?this._toggle.apply(this,arguments):a==null||d?this.each(function(){var b=d?a:f(this).is(":hidden");f(this)[b?"show":"hide"]()}):this.animate(cu("toggle",3),a,b,c);return this},fadeTo:function(a,b,c,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){function g(){e.queue===!1&&f._mark(this);var b=f.extend({},e),c=this.nodeType===1,d=c&&f(this).is(":hidden"),g,h,i,j,k,l,m,n,o;b.animatedProperties={};for(i in a){g=f.camelCase(i),i!==g&&(a[g]=a[i],delete a[i]),h=a[g],f.isArray(h)?(b.animatedProperties[g]=h[1],h=a[g]=h[0]):b.animatedProperties[g]=b.specialEasing&&b.specialEasing[g]||b.easing||"swing";if(h==="hide"&&d||h==="show"&&!d)return b.complete.call(this);c&&(g==="height"||g==="width")&&(b.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY],f.css(this,"display")==="inline"&&f.css(this,"float")==="none"&&(!f.support.inlineBlockNeedsLayout||cv(this.nodeName)==="inline"?this.style.display="inline-block":this.style.zoom=1))}b.overflow!=null&&(this.style.overflow="hidden");for(i in a)j=new f.fx(this,b,i),h=a[i],cn.test(h)?(o=f._data(this,"toggle"+i)||(h==="toggle"?d?"show":"hide":0),o?(f._data(this,"toggle"+i,o==="show"?"hide":"show"),j[o]()):j[h]()):(k=co.exec(h),l=j.cur(),k?(m=parseFloat(k[2]),n=k[3]||(f.cssNumber[i]?"":"px"),n!=="px"&&(f.style(this,i,(m||1)+n),l=(m||1)/j.cur()*l,f.style(this,i,l+n)),k[1]&&(m=(k[1]==="-="?-1:1)*m+l),j.custom(l,m,n)):j.custom(l,h,""));return!0}var e=f.speed(b,c,d);if(f.isEmptyObject(a))return this.each(e.complete,[!1]);a=f.extend({},a);return e.queue===!1?this.each(g):this.queue(e.queue,g)},stop:function(a,c,d){typeof a!="string"&&(d=c,c=a,a=b),c&&a!==!1&&this.queue(a||"fx",[]);return this.each(function(){function h(a,b,c){var e=b[c];f.removeData(a,c,!0),e.stop(d)}var b,c=!1,e=f.timers,g=f._data(this);d||f._unmark(!0,this);if(a==null)for(b in g)g[b]&&g[b].stop&&b.indexOf(".run")===b.length-4&&h(this,g,b);else g[b=a+".run"]&&g[b].stop&&h(this,g,b);for(b=e.length;b--;)e[b].elem===this&&(a==null||e[b].queue===a)&&(d?e[b](!0):e[b].saveState(),c=!0,e.splice(b,1));(!d||!c)&&f.dequeue(this,a)})}}),f.each({slideDown:cu("show",1),slideUp:cu("hide",1),slideToggle:cu("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){f.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),f.extend({speed:function(a,b,c){var d=a&&typeof a=="object"?f.extend({},a):{complete:c||!c&&b||f.isFunction(a)&&a,duration:a,easing:c&&b||b&&!f.isFunction(b)&&b};d.duration=f.fx.off?0:typeof d.duration=="number"?d.duration:d.duration in f.fx.speeds?f.fx.speeds[d.duration]:f.fx.speeds._default;if(d.queue==null||d.queue===!0)d.queue="fx";d.old=d.complete,d.complete=function(a){f.isFunction(d.old)&&d.old.call(this),d.queue?f.dequeue(this,d.queue):a!==!1&&f._unmark(this)};return d},easing:{linear:function(a,b,c,d){return c+d*a},swing:function(a,b,c,d){return(-Math.cos(a*Math.PI)/2+.5)*d+c}},timers:[],fx:function(a,b,c){this.options=b,this.elem=a,this.prop=c,b.orig=b.orig||{}}}),f.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this),(f.fx.step[this.prop]||f.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a,b=f.css(this.elem,this.prop);return isNaN(a=parseFloat(b))?!b||b==="auto"?0:b:a},custom:function(a,c,d){function h(a){return e.step(a)}var e=this,g=f.fx;this.startTime=cr||cs(),this.end=c,this.now=this.start=a,this.pos=this.state=0,this.unit=d||this.unit||(f.cssNumber[this.prop]?"":"px"),h.queue=this.options.queue,h.elem=this.elem,h.saveState=function(){e.options.hide&&f._data(e.elem,"fxshow"+e.prop)===b&&f._data(e.elem,"fxshow"+e.prop,e.start)},h()&&f.timers.push(h)&&!cp&&(cp=setInterval(g.tick,g.interval))},show:function(){var a=f._data(this.elem,"fxshow"+this.prop);this.options.orig[this.prop]=a||f.style(this.elem,this.prop),this.options.show=!0,a!==b?this.custom(this.cur(),a):this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur()),f(this.elem).show()},hide:function(){this.options.orig[this.prop]=f._data(this.elem,"fxshow"+this.prop)||f.style(this.elem,this.prop),this.options.hide=!0,this.custom(this.cur(),0)},step:function(a){var b,c,d,e=cr||cs(),g=!0,h=this.elem,i=this.options;if(a||e>=i.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),i.animatedProperties[this.prop]=!0;for(b in i.animatedProperties)i.animatedProperties[b]!==!0&&(g=!1);if(g){i.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){h.style["overflow"+b]=i.overflow[a]}),i.hide&&f(h).hide();if(i.hide||i.show)for(b in i.animatedProperties)f.style(h,b,i.orig[b]),f.removeData(h,"fxshow"+b,!0),f.removeData(h,"toggle"+b,!0);d=i.complete,d&&(i.complete=!1,d.call(h))}return!1}i.duration==Infinity?this.now=e:(c=e-this.startTime,this.state=c/i.duration,this.pos=f.easing[i.animatedProperties[this.prop]](this.state,c,0,1,i.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){var a,b=f.timers,c=0;for(;c<b.length;c++)a=b[c],!a()&&b[c]===a&&b.splice(c--,1);b.length||f.fx.stop()},interval:13,stop:function(){clearInterval(cp),cp=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){f.style(a.elem,"opacity",a.now)},_default:function(a){a.elem.style&&a.elem.style[a.prop]!=null?a.elem.style[a.prop]=a.now+a.unit:a.elem[a.prop]=a.now}}}),f.each(["width","height"],function(a,b){f.fx.step[b]=function(a){f.style(a.elem,b,Math.max(0,a.now)+a.unit)}}),f.expr&&f.expr.filters&&(f.expr.filters.animated=function(a){return f.grep(f.timers,function(b){return a===b.elem}).length});var cw=/^t(?:able|d|h)$/i,cx=/^(?:body|html)$/i;"getBoundingClientRect"in c.documentElement?f.fn.offset=function(a){var b=this[0],c;if(a)return this.each(function(b){f.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return f.offset.bodyOffset(b);try{c=b.getBoundingClientRect()}catch(d){}var e=b.ownerDocument,g=e.documentElement;if(!c||!f.contains(g,b))return c?{top:c.top,left:c.left}:{top:0,left:0};var h=e.body,i=cy(e),j=g.clientTop||h.clientTop||0,k=g.clientLeft||h.clientLeft||0,l=i.pageYOffset||f.support.boxModel&&g.scrollTop||h.scrollTop,m=i.pageXOffset||f.support.boxModel&&g.scrollLeft||h.scrollLeft,n=c.top+l-j,o=c.left+m-k;return{top:n,left:o}}:f.fn.offset=function(a){var b=this[0];if(a)return this.each(function(b){f.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return f.offset.bodyOffset(b);var c,d=b.offsetParent,e=b,g=b.ownerDocument,h=g.documentElement,i=g.body,j=g.defaultView,k=j?j.getComputedStyle(b,null):b.currentStyle,l=b.offsetTop,m=b.offsetLeft;while((b=b.parentNode)&&b!==i&&b!==h){if(f.support.fixedPosition&&k.position==="fixed")break;c=j?j.getComputedStyle(b,null):b.currentStyle,l-=b.scrollTop,m-=b.scrollLeft,b===d&&(l+=b.offsetTop,m+=b.offsetLeft,f.support.doesNotAddBorder&&(!f.support.doesAddBorderForTableAndCells||!cw.test(b.nodeName))&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),e=d,d=b.offsetParent),f.support.subtractsBorderForOverflowNotVisible&&c.overflow!=="visible"&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),k=c}if(k.position==="relative"||k.position==="static")l+=i.offsetTop,m+=i.offsetLeft;f.support.fixedPosition&&k.position==="fixed"&&(l+=Math.max(h.scrollTop,i.scrollTop),m+=Math.max(h.scrollLeft,i.scrollLeft));return{top:l,left:m}},f.offset={bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;f.support.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(f.css(a,"marginTop"))||0,c+=parseFloat(f.css(a,"marginLeft"))||0);return{top:b,left:c}},setOffset:function(a,b,c){var d=f.css(a,"position");d==="static"&&(a.style.position="relative");var e=f(a),g=e.offset(),h=f.css(a,"top"),i=f.css(a,"left"),j=(d==="absolute"||d==="fixed")&&f.inArray("auto",[h,i])>-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cx.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cx.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each(["Left","Top"],function(a,c){var d="scroll"+c;f.fn[d]=function(c){var e,g;if(c===b){e=this[0];if(!e)return null;g=cy(e);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:f.support.boxModel&&g.document.documentElement[d]||g.document.body[d]:e[d]}return this.each(function(){g=cy(this),g?g.scrollTo(a?f(g).scrollLeft():c,a?c:f(g).scrollTop()):this[d]=c})}}),f.each(["Height","Width"],function(a,c){var d=c.toLowerCase();f.fn["inner"+c]=function(){var a=this[0];return a?a.style?parseFloat(f.css(a,d,"padding")):this[d]():null},f.fn["outer"+c]=function(a){var b=this[0];return b?b.style?parseFloat(f.css(b,d,a?"margin":"border")):this[d]():null},f.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(f.isFunction(a))return this.each(function(b){var c=f(this);c[d](a.call(this,b,c[d]()))});if(f.isWindow(e)){var g=e.document.documentElement["client"+c],h=e.document.body;return e.document.compatMode==="CSS1Compat"&&g||h&&h["client"+c]||g}if(e.nodeType===9)return Math.max(e.documentElement["client"+c],e.body["scroll"+c],e.documentElement["scroll"+c],e.body["offset"+c],e.documentElement["offset"+c]);if(a===b){var i=f.css(e,d),j=parseFloat(i);return f.isNumeric(j)?j:i}return this.css(d,typeof a=="string"?a:a+"px")}}),a.jQuery=a.$=f,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return f})})(window); |
src/client.js | AnthonyWhitaker/react-redux-universal-hot-example | /**
* THIS IS THE ENTRY POINT FOR THE CLIENT, JUST LIKE server.js IS THE ENTRY POINT FOR THE SERVER.
*/
import 'babel-core/polyfill';
import React from 'react';
import ReactDOM from 'react-dom';
import createHistory from 'history/lib/createBrowserHistory';
import createStore from './redux/create';
import ApiClient from './helpers/ApiClient';
import io from 'socket.io-client';
import {Provider} from 'react-redux';
import {reduxReactRouter, ReduxRouter} from 'redux-router';
import getRoutes from './routes';
import makeRouteHooksSafe from './helpers/makeRouteHooksSafe';
const client = new ApiClient();
const dest = document.getElementById('content');
const store = createStore(reduxReactRouter, makeRouteHooksSafe(getRoutes), createHistory, client, window.__data);
function initSocket() {
const socket = io('', {path: '/api/ws', transports: ['polling']});
socket.on('news', (data) => {
console.log(data);
socket.emit('my other event', { my: 'data from client' });
});
socket.on('msg', (data) => {
console.log(data);
});
return socket;
}
global.socket = initSocket();
const component = (
<ReduxRouter routes={getRoutes(store)} />
);
ReactDOM.render(
<Provider store={store} key="provider">
{component}
</Provider>,
dest
);
if (process.env.NODE_ENV !== 'production') {
window.React = React; // enable debugger
if (!dest || !dest.firstChild || !dest.firstChild.attributes || !dest.firstChild.attributes['data-react-checksum']) {
console.error('Server-side React render was discarded. Make sure that your initial render does not contain any client-side code.');
}
}
if (__DEVTOOLS__) {
const DevTools = require('./containers/DevTools/DevTools');
ReactDOM.render(
<Provider store={store} key="provider">
<div>
{component}
<DevTools />
</div>
</Provider>,
dest
);
}
|
fields/types/cloudinaryimage/CloudinaryImageField.js | davibe/keystone | import _ from 'underscore';
import $ from 'jquery';
import React from 'react';
import Field from '../Field';
import Select from 'react-select';
import { Button, FormField, FormInput, FormNote } from 'elemental';
import Lightbox from '../../../admin/src/components/Lightbox';
/**
* TODO:
* - Remove dependency on jQuery
* - Remove dependency on underscore
*/
const SUPPORTED_TYPES = ['image/gif', 'image/png', 'image/jpeg', 'image/bmp', 'image/x-icon', 'application/pdf', 'image/x-tiff', 'image/x-tiff', 'application/postscript', 'image/vnd.adobe.photoshop', 'image/svg+xml'];
module.exports = Field.create({
displayName: 'CloudinaryImageField',
openLightbox (index) {
event.preventDefault();
this.setState({
lightboxIsVisible: true,
lightboxImageIndex: index,
});
},
closeLightbox () {
this.setState({
lightboxIsVisible: false,
lightboxImageIndex: null,
});
},
renderLightbox () {
let { value } = this.props;
if (!value || !Object.keys(value).length) return;
let images = [value.url];
return (
<Lightbox
images={images}
initialImage={this.state.lightboxImageIndex}
isOpen={this.state.lightboxIsVisible}
onCancel={this.closeLightbox}
/>
);
},
fileFieldNode () {
return this.refs.fileField.getDOMNode();
},
changeImage () {
this.refs.fileField.getDOMNode().click();
},
getImageSource () {
if (this.hasLocal()) {
return this.state.localSource;
} else if (this.hasExisting()) {
return this.props.value.url;
} else {
return null;
}
},
getImageURL () {
if (!this.hasLocal() && this.hasExisting()) {
return this.props.value.url;
}
},
/**
* Reset origin and removal.
*/
undoRemove () {
this.fileFieldNode().value = '';
this.setState({
removeExisting: false,
localSource: null,
origin: false,
action: null
});
},
/**
* Check support for input files on input change.
*/
fileChanged (event) {
var self = this;
if (window.FileReader) {
var files = event.target.files;
_.each(files, function (f) {
if (!_.contains(SUPPORTED_TYPES, f.type)) {
self.removeImage();
alert('Unsupported file type. Supported formats are: GIF, PNG, JPG, BMP, ICO, PDF, TIFF, EPS, PSD, SVG');
return false;
}
var fileReader = new FileReader();
fileReader.onload = function (e) {
if (!self.isMounted()) return;
self.setState({
localSource: e.target.result,
origin: 'local'
});
};
fileReader.readAsDataURL(f);
});
} else {
this.setState({
origin: 'local'
});
}
},
/**
* If we have a local file added then remove it and reset the file field.
*/
removeImage (e) {
var state = {
localSource: null,
origin: false
};
if (this.hasLocal()) {
this.fileFieldNode().value = '';
} else if (this.hasExisting()) {
state.removeExisting = true;
if (this.props.autoCleanup) {
if (e.altKey) {
state.action = 'reset';
} else {
state.action = 'delete';
}
} else {
if (e.altKey) {
state.action = 'delete';
} else {
state.action = 'reset';
}
}
}
this.setState(state);
},
/**
* Is the currently active image uploaded in this session?
*/
hasLocal () {
return this.state.origin === 'local';
},
/**
* Do we have an image preview to display?
*/
hasImage () {
return this.hasExisting() || this.hasLocal();
},
/**
* Do we have an existing file?
*/
hasExisting () {
return !!this.props.value.url;
},
/**
* Render an image preview
*/
renderImagePreview () {
var iconClassName;
var className = 'image-preview';
if (this.hasLocal()) {
iconClassName = 'upload-pending mega-octicon octicon-cloud-upload';
} else if (this.state.removeExisting) {
className += ' removed';
iconClassName = 'delete-pending mega-octicon octicon-x';
}
var body = [this.renderImagePreviewThumbnail()];
if (iconClassName) body.push(<div key={this.props.path + '_preview_icon'} className={iconClassName} />);
var url = this.getImageURL();
if (url) {
body = <a className="img-thumbnail" href={this.getImageURL()} onClick={this.openLightbox.bind(this, 0)} target="__blank">{body}</a>;
} else {
body = <div className="img-thumbnail">{body}</div>;
}
return <div key={this.props.path + '_preview'} className={className}>{body}</div>;
},
renderImagePreviewThumbnail () {
return <img key={this.props.path + '_preview_thumbnail'} className="img-load" style={ { height: '90' } } src={this.getImageSource()} />;
},
/**
* Render image details - leave these out if we're uploading a local file or
* the existing file is to be removed.
*/
renderImageDetails (add) {
var values = null;
if (!this.hasLocal() && !this.state.removeExisting) {
values = (
<div className="image-values">
<FormInput noedit>{this.props.value.url}</FormInput>
{/*
TODO: move this somewhere better when appropriate
this.renderImageDimensions()
*/}
</div>
);
}
return (
<div key={this.props.path + '_details'} className="image-details">
{values}
{add}
</div>
);
},
renderImageDimensions () {
return <FormInput noedit>{this.props.value.width} x {this.props.value.height}</FormInput>;
},
/**
* Render an alert.
*
* - On a local file, output a "to be uploaded" message.
* - On a cloudinary file, output a "from cloudinary" message.
* - On removal of existing file, output a "save to remove" message.
*/
renderAlert () {
if (this.hasLocal()) {
return (
<FormInput noedit>Image selected - save to upload</FormInput>
);
} else if (this.state.origin === 'cloudinary') {
return (
<FormInput noedit>Image selected from Cloudinary</FormInput>
);
} else if (this.state.removeExisting) {
return (
<FormInput noedit>Image {this.props.autoCleanup ? 'deleted' : 'removed'} - save to confirm</FormInput>
);
} else {
return null;
}
},
/**
* Output clear/delete/remove button.
*
* - On removal of existing image, output "undo remove" button.
* - Otherwise output Cancel/Delete image button.
*/
renderClearButton () {
if (this.state.removeExisting) {
return (
<Button type="link" onClick={this.undoRemove}>
Undo Remove
</Button>
);
} else {
var clearText;
if (this.hasLocal()) {
clearText = 'Cancel';
} else {
clearText = (this.props.autoCleanup ? 'Delete Image' : 'Remove Image');
}
return (
<Button type="link-cancel" onClick={this.removeImage}>
{clearText}
</Button>
);
}
},
renderFileField () {
return <input ref="fileField" type="file" name={this.props.paths.upload} className="field-upload" onChange={this.fileChanged} tabIndex="-1" />;
},
renderFileAction () {
return <input type="hidden" name={this.props.paths.action} className="field-action" value={this.state.action} />;
},
renderImageToolbar () {
return (
<div key={this.props.path + '_toolbar'} className="image-toolbar">
<div className="u-float-left">
<Button onClick={this.changeImage}>
{this.hasImage() ? 'Change' : 'Upload'} Image
</Button>
{this.hasImage() && this.renderClearButton()}
</div>
{this.props.select && this.renderImageSelect()}
</div>
);
},
renderImageSelect () {
var selectPrefix = this.props.selectPrefix;
var getOptions = function(input, callback) {
$.get('/keystone/api/cloudinary/autocomplete', {
dataType: 'json',
data: {
q: input
},
prefix: selectPrefix
}, function (data) {
var options = [];
_.each(data.items, function (item) {
options.push({
value: item.public_id,
label: item.public_id
});
});
callback(null, {
options: options,
complete: true
});
});
};
return (
<div className="image-select">
<Select
placeholder="Search for an image from Cloudinary ..."
className="ui-select2-cloudinary"
name={this.props.paths.select}
id={'field_' + this.props.paths.select}
asyncOptions={getOptions}
/>
</div>
);
},
renderNote () {
if (!this.props.note) return null;
return <FormNote note={this.props.note} />;
},
renderUI () {
var container = [];
var body = [];
var hasImage = this.hasImage();
if (this.shouldRenderField()) {
if (hasImage) {
container.push(this.renderImagePreview());
container.push(this.renderImageDetails(this.renderAlert()));
}
body.push(this.renderImageToolbar());
} else {
if (hasImage) {
container.push(this.renderImagePreview());
container.push(this.renderImageDetails());
} else {
container.push(<div className="help-block">no image</div>);
}
}
return (
<FormField label={this.props.label} className="field-type-cloudinaryimage">
{this.renderFileField()}
{this.renderFileAction()}
<div className="image-container">{container}</div>
{body}
{this.renderNote()}
{this.renderLightbox()}
</FormField>
);
}
});
|
examples/navigation/epics/adminAccess.js | jesinity/redux-observable | import { Observable } from 'rxjs/Observable';
import { push } from 'react-router-redux';
import * as ActionTypes from '../ActionTypes';
import { accessDenied } from '../actions';
export default function adminAccess(action$) {
return action$.ofType(ActionTypes.CHECKED_ADMIN_ACCESS)
// If you wanted to do an actual access check you
// could do so here then filter by failed checks.
.delay(2000)
.mergeMap(() => Observable.merge(
Observable.of(accessDenied()),
Observable.timer(2000)
.map(() => push('/'))
));
}
|
docs/public/static/examples/v36.0.0/tutorial/sharing-web-workaround.js | exponent/exponent | import React from 'react';
import { Image, Platform, StyleSheet, Text, TouchableOpacity, View } from 'react-native';
import * as ImagePicker from 'expo-image-picker';
import * as Sharing from 'expo-sharing';
import uploadToAnonymousFilesAsync from 'anonymous-files';
export default function App() {
let [selectedImage, setSelectedImage] = React.useState(null);
let openImagePickerAsync = async () => {
let permissionResult = await ImagePicker.requestCameraRollPermissionsAsync();
if (permissionResult.granted === false) {
alert('Permission to access camera roll is required!');
return;
}
let pickerResult = await ImagePicker.launchImageLibraryAsync();
if (pickerResult.cancelled === true) {
return;
}
if (Platform.OS === 'web') {
let remoteUri = await uploadToAnonymousFilesAsync(pickerResult.uri);
setSelectedImage({ localUri: pickerResult.uri, remoteUri });
} else {
setSelectedImage({ localUri: pickerResult.uri, remoteUri: null });
}
};
let openShareDialogAsync = async () => {
if (!(await Sharing.isAvailableAsync())) {
alert(`The image is available for sharing at: ${selectedImage.remoteUri}`);
return;
}
Sharing.shareAsync(selectedImage.remoteUri || selectedImage.localUri);
};
if (selectedImage !== null) {
return (
<View style={styles.container}>
<Image source={{ uri: selectedImage.localUri }} style={styles.thumbnail} />
<TouchableOpacity onPress={openShareDialogAsync} style={styles.button}>
<Text style={styles.buttonText}>Share this photo</Text>
</TouchableOpacity>
</View>
);
}
return (
<View style={styles.container}>
<Image source={{ uri: 'https://i.imgur.com/TkIrScD.png' }} style={styles.logo} />
<Text style={styles.instructions}>
To share a photo from your phone with a friend, just press the button below!
</Text>
<TouchableOpacity onPress={openImagePickerAsync} style={styles.button}>
<Text style={styles.buttonText}>Pick a photo</Text>
</TouchableOpacity>
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
logo: {
width: 305,
height: 159,
marginBottom: 20,
},
instructions: {
color: '#888',
fontSize: 18,
marginHorizontal: 15,
marginBottom: 10,
},
button: {
backgroundColor: 'blue',
padding: 20,
borderRadius: 5,
},
buttonText: {
fontSize: 20,
color: '#fff',
},
thumbnail: {
width: 300,
height: 300,
resizeMode: 'contain',
},
});
|
client/src/components/template/footer.js | joshuaslate/mern-starter | import React, { Component } from 'react';
import { connect } from 'react-redux';
import { Link } from 'react-router';
class FooterTemplate extends Component {
renderLinks() {
if (this.props.authenticated) {
return [
<li key={1}>
<Link to="/">Home</Link>
</li>,
<li key={2}>
<Link to="dashboard">Dashboard</Link>
</li>,
<li key={3}>
<Link to="logout">Logout</Link>
</li>,
];
} else {
return [
// Unauthenticated navigation
<li key={1}>
<Link to="/">Home</Link>
</li>,
<li key={2}>
<Link to="login">Login</Link>
</li>,
<li key={3}>
<Link to="register">Register</Link>
</li>,
];
}
}
render() {
const d = new Date();
const year = d.getFullYear();
return (
<footer>
<div className="container">
<div className="row">
<div className="col-lg-12">
<nav>
<ul className="footer-nav">
{this.renderLinks()}
</ul>
</nav>
<p className="copyright">© {year}, Your Site. All Rights Reserved.</p>
</div>
</div>
</div>
</footer>
);
}
}
function mapStateToProps(state) {
return {
authenticated: state.auth.authenticated,
};
}
export default connect(mapStateToProps, null)(FooterTemplate);
|
ajax/libs/react/0.11.0/react-with-addons.js | sparkgeo/cdnjs | /**
* React (with addons) v0.11.0
*/
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.React=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule AutoFocusMixin
* @typechecks static-only
*/
"use strict";
var focusNode = _dereq_("./focusNode");
var AutoFocusMixin = {
componentDidMount: function() {
if (this.props.autoFocus) {
focusNode(this.getDOMNode());
}
}
};
module.exports = AutoFocusMixin;
},{"./focusNode":120}],2:[function(_dereq_,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule BeforeInputEventPlugin
* @typechecks static-only
*/
"use strict";
var EventConstants = _dereq_("./EventConstants");
var EventPropagators = _dereq_("./EventPropagators");
var ExecutionEnvironment = _dereq_("./ExecutionEnvironment");
var SyntheticInputEvent = _dereq_("./SyntheticInputEvent");
var keyOf = _dereq_("./keyOf");
var canUseTextInputEvent = (
ExecutionEnvironment.canUseDOM &&
'TextEvent' in window &&
!('documentMode' in document || isPresto())
);
/**
* Opera <= 12 includes TextEvent in window, but does not fire
* text input events. Rely on keypress instead.
*/
function isPresto() {
var opera = window.opera;
return (
typeof opera === 'object' &&
typeof opera.version === 'function' &&
parseInt(opera.version(), 10) <= 12
);
}
var SPACEBAR_CODE = 32;
var SPACEBAR_CHAR = String.fromCharCode(SPACEBAR_CODE);
var topLevelTypes = EventConstants.topLevelTypes;
// Events and their corresponding property names.
var eventTypes = {
beforeInput: {
phasedRegistrationNames: {
bubbled: keyOf({onBeforeInput: null}),
captured: keyOf({onBeforeInputCapture: null})
},
dependencies: [
topLevelTypes.topCompositionEnd,
topLevelTypes.topKeyPress,
topLevelTypes.topTextInput,
topLevelTypes.topPaste
]
}
};
// Track characters inserted via keypress and composition events.
var fallbackChars = null;
/**
* Return whether a native keypress event is assumed to be a command.
* This is required because Firefox fires `keypress` events for key commands
* (cut, copy, select-all, etc.) even though no character is inserted.
*/
function isKeypressCommand(nativeEvent) {
return (
(nativeEvent.ctrlKey || nativeEvent.altKey || nativeEvent.metaKey) &&
// ctrlKey && altKey is equivalent to AltGr, and is not a command.
!(nativeEvent.ctrlKey && nativeEvent.altKey)
);
}
/**
* Create an `onBeforeInput` event to match
* http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105/#events-inputevents.
*
* This event plugin is based on the native `textInput` event
* available in Chrome, Safari, Opera, and IE. This event fires after
* `onKeyPress` and `onCompositionEnd`, but before `onInput`.
*
* `beforeInput` is spec'd but not implemented in any browsers, and
* the `input` event does not provide any useful information about what has
* actually been added, contrary to the spec. Thus, `textInput` is the best
* available event to identify the characters that have actually been inserted
* into the target node.
*/
var BeforeInputEventPlugin = {
eventTypes: eventTypes,
/**
* @param {string} topLevelType Record from `EventConstants`.
* @param {DOMEventTarget} topLevelTarget The listening component root node.
* @param {string} topLevelTargetID ID of `topLevelTarget`.
* @param {object} nativeEvent Native browser event.
* @return {*} An accumulation of synthetic events.
* @see {EventPluginHub.extractEvents}
*/
extractEvents: function(
topLevelType,
topLevelTarget,
topLevelTargetID,
nativeEvent) {
var chars;
if (canUseTextInputEvent) {
switch (topLevelType) {
case topLevelTypes.topKeyPress:
/**
* If native `textInput` events are available, our goal is to make
* use of them. However, there is a special case: the spacebar key.
* In Webkit, preventing default on a spacebar `textInput` event
* cancels character insertion, but it *also* causes the browser
* to fall back to its default spacebar behavior of scrolling the
* page.
*
* Tracking at:
* https://code.google.com/p/chromium/issues/detail?id=355103
*
* To avoid this issue, use the keypress event as if no `textInput`
* event is available.
*/
var which = nativeEvent.which;
if (which !== SPACEBAR_CODE) {
return;
}
chars = String.fromCharCode(which);
break;
case topLevelTypes.topTextInput:
// Record the characters to be added to the DOM.
chars = nativeEvent.data;
// If it's a spacebar character, assume that we have already handled
// it at the keypress level and bail immediately.
if (chars === SPACEBAR_CHAR) {
return;
}
// Otherwise, carry on.
break;
default:
// For other native event types, do nothing.
return;
}
} else {
switch (topLevelType) {
case topLevelTypes.topPaste:
// If a paste event occurs after a keypress, throw out the input
// chars. Paste events should not lead to BeforeInput events.
fallbackChars = null;
break;
case topLevelTypes.topKeyPress:
/**
* As of v27, Firefox may fire keypress events even when no character
* will be inserted. A few possibilities:
*
* - `which` is `0`. Arrow keys, Esc key, etc.
*
* - `which` is the pressed key code, but no char is available.
* Ex: 'AltGr + d` in Polish. There is no modified character for
* this key combination and no character is inserted into the
* document, but FF fires the keypress for char code `100` anyway.
* No `input` event will occur.
*
* - `which` is the pressed key code, but a command combination is
* being used. Ex: `Cmd+C`. No character is inserted, and no
* `input` event will occur.
*/
if (nativeEvent.which && !isKeypressCommand(nativeEvent)) {
fallbackChars = String.fromCharCode(nativeEvent.which);
}
break;
case topLevelTypes.topCompositionEnd:
fallbackChars = nativeEvent.data;
break;
}
// If no changes have occurred to the fallback string, no relevant
// event has fired and we're done.
if (fallbackChars === null) {
return;
}
chars = fallbackChars;
}
// If no characters are being inserted, no BeforeInput event should
// be fired.
if (!chars) {
return;
}
var event = SyntheticInputEvent.getPooled(
eventTypes.beforeInput,
topLevelTargetID,
nativeEvent
);
event.data = chars;
fallbackChars = null;
EventPropagators.accumulateTwoPhaseDispatches(event);
return event;
}
};
module.exports = BeforeInputEventPlugin;
},{"./EventConstants":16,"./EventPropagators":21,"./ExecutionEnvironment":22,"./SyntheticInputEvent":98,"./keyOf":141}],3:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule CSSCore
* @typechecks
*/
var invariant = _dereq_("./invariant");
/**
* The CSSCore module specifies the API (and implements most of the methods)
* that should be used when dealing with the display of elements (via their
* CSS classes and visibility on screen. It is an API focused on mutating the
* display and not reading it as no logical state should be encoded in the
* display of elements.
*/
var CSSCore = {
/**
* Adds the class passed in to the element if it doesn't already have it.
*
* @param {DOMElement} element the element to set the class on
* @param {string} className the CSS className
* @return {DOMElement} the element passed in
*/
addClass: function(element, className) {
("production" !== "development" ? invariant(
!/\s/.test(className),
'CSSCore.addClass takes only a single class name. "%s" contains ' +
'multiple classes.', className
) : invariant(!/\s/.test(className)));
if (className) {
if (element.classList) {
element.classList.add(className);
} else if (!CSSCore.hasClass(element, className)) {
element.className = element.className + ' ' + className;
}
}
return element;
},
/**
* Removes the class passed in from the element
*
* @param {DOMElement} element the element to set the class on
* @param {string} className the CSS className
* @return {DOMElement} the element passed in
*/
removeClass: function(element, className) {
("production" !== "development" ? invariant(
!/\s/.test(className),
'CSSCore.removeClass takes only a single class name. "%s" contains ' +
'multiple classes.', className
) : invariant(!/\s/.test(className)));
if (className) {
if (element.classList) {
element.classList.remove(className);
} else if (CSSCore.hasClass(element, className)) {
element.className = element.className
.replace(new RegExp('(^|\\s)' + className + '(?:\\s|$)', 'g'), '$1')
.replace(/\s+/g, ' ') // multiple spaces to one
.replace(/^\s*|\s*$/g, ''); // trim the ends
}
}
return element;
},
/**
* Helper to add or remove a class from an element based on a condition.
*
* @param {DOMElement} element the element to set the class on
* @param {string} className the CSS className
* @param {*} bool condition to whether to add or remove the class
* @return {DOMElement} the element passed in
*/
conditionClass: function(element, className, bool) {
return (bool ? CSSCore.addClass : CSSCore.removeClass)(element, className);
},
/**
* Tests whether the element has the class specified.
*
* @param {DOMNode|DOMWindow} element the element to set the class on
* @param {string} className the CSS className
* @returns {boolean} true if the element has the class, false if not
*/
hasClass: function(element, className) {
("production" !== "development" ? invariant(
!/\s/.test(className),
'CSS.hasClass takes only a single class name.'
) : invariant(!/\s/.test(className)));
if (element.classList) {
return !!className && element.classList.contains(className);
}
return (' ' + element.className + ' ').indexOf(' ' + className + ' ') > -1;
}
};
module.exports = CSSCore;
},{"./invariant":134}],4:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule CSSProperty
*/
"use strict";
/**
* CSS properties which accept numbers but are not in units of "px".
*/
var isUnitlessNumber = {
columnCount: true,
fillOpacity: true,
flex: true,
flexGrow: true,
flexShrink: true,
fontWeight: true,
lineClamp: true,
lineHeight: true,
opacity: true,
order: true,
orphans: true,
widows: true,
zIndex: true,
zoom: true
};
/**
* @param {string} prefix vendor-specific prefix, eg: Webkit
* @param {string} key style name, eg: transitionDuration
* @return {string} style name prefixed with `prefix`, properly camelCased, eg:
* WebkitTransitionDuration
*/
function prefixKey(prefix, key) {
return prefix + key.charAt(0).toUpperCase() + key.substring(1);
}
/**
* Support style names that may come passed in prefixed by adding permutations
* of vendor prefixes.
*/
var prefixes = ['Webkit', 'ms', 'Moz', 'O'];
// Using Object.keys here, or else the vanilla for-in loop makes IE8 go into an
// infinite loop, because it iterates over the newly added props too.
Object.keys(isUnitlessNumber).forEach(function(prop) {
prefixes.forEach(function(prefix) {
isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop];
});
});
/**
* Most style properties can be unset by doing .style[prop] = '' but IE8
* doesn't like doing that with shorthand properties so for the properties that
* IE8 breaks on, which are listed here, we instead unset each of the
* individual properties. See http://bugs.jquery.com/ticket/12385.
* The 4-value 'clock' properties like margin, padding, border-width seem to
* behave without any problems. Curiously, list-style works too without any
* special prodding.
*/
var shorthandPropertyExpansions = {
background: {
backgroundImage: true,
backgroundPosition: true,
backgroundRepeat: true,
backgroundColor: true
},
border: {
borderWidth: true,
borderStyle: true,
borderColor: true
},
borderBottom: {
borderBottomWidth: true,
borderBottomStyle: true,
borderBottomColor: true
},
borderLeft: {
borderLeftWidth: true,
borderLeftStyle: true,
borderLeftColor: true
},
borderRight: {
borderRightWidth: true,
borderRightStyle: true,
borderRightColor: true
},
borderTop: {
borderTopWidth: true,
borderTopStyle: true,
borderTopColor: true
},
font: {
fontStyle: true,
fontVariant: true,
fontWeight: true,
fontSize: true,
lineHeight: true,
fontFamily: true
}
};
var CSSProperty = {
isUnitlessNumber: isUnitlessNumber,
shorthandPropertyExpansions: shorthandPropertyExpansions
};
module.exports = CSSProperty;
},{}],5:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule CSSPropertyOperations
* @typechecks static-only
*/
"use strict";
var CSSProperty = _dereq_("./CSSProperty");
var dangerousStyleValue = _dereq_("./dangerousStyleValue");
var hyphenateStyleName = _dereq_("./hyphenateStyleName");
var memoizeStringOnly = _dereq_("./memoizeStringOnly");
var processStyleName = memoizeStringOnly(function(styleName) {
return hyphenateStyleName(styleName);
});
/**
* Operations for dealing with CSS properties.
*/
var CSSPropertyOperations = {
/**
* Serializes a mapping of style properties for use as inline styles:
*
* > createMarkupForStyles({width: '200px', height: 0})
* "width:200px;height:0;"
*
* Undefined values are ignored so that declarative programming is easier.
* The result should be HTML-escaped before insertion into the DOM.
*
* @param {object} styles
* @return {?string}
*/
createMarkupForStyles: function(styles) {
var serialized = '';
for (var styleName in styles) {
if (!styles.hasOwnProperty(styleName)) {
continue;
}
var styleValue = styles[styleName];
if (styleValue != null) {
serialized += processStyleName(styleName) + ':';
serialized += dangerousStyleValue(styleName, styleValue) + ';';
}
}
return serialized || null;
},
/**
* Sets the value for multiple styles on a node. If a value is specified as
* '' (empty string), the corresponding style property will be unset.
*
* @param {DOMElement} node
* @param {object} styles
*/
setValueForStyles: function(node, styles) {
var style = node.style;
for (var styleName in styles) {
if (!styles.hasOwnProperty(styleName)) {
continue;
}
var styleValue = dangerousStyleValue(styleName, styles[styleName]);
if (styleValue) {
style[styleName] = styleValue;
} else {
var expansion = CSSProperty.shorthandPropertyExpansions[styleName];
if (expansion) {
// Shorthand property that IE8 won't like unsetting, so unset each
// component to placate it
for (var individualStyleName in expansion) {
style[individualStyleName] = '';
}
} else {
style[styleName] = '';
}
}
}
}
};
module.exports = CSSPropertyOperations;
},{"./CSSProperty":4,"./dangerousStyleValue":115,"./hyphenateStyleName":132,"./memoizeStringOnly":143}],6:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule CallbackQueue
*/
"use strict";
var PooledClass = _dereq_("./PooledClass");
var invariant = _dereq_("./invariant");
var mixInto = _dereq_("./mixInto");
/**
* A specialized pseudo-event module to help keep track of components waiting to
* be notified when their DOM representations are available for use.
*
* This implements `PooledClass`, so you should never need to instantiate this.
* Instead, use `CallbackQueue.getPooled()`.
*
* @class ReactMountReady
* @implements PooledClass
* @internal
*/
function CallbackQueue() {
this._callbacks = null;
this._contexts = null;
}
mixInto(CallbackQueue, {
/**
* Enqueues a callback to be invoked when `notifyAll` is invoked.
*
* @param {function} callback Invoked when `notifyAll` is invoked.
* @param {?object} context Context to call `callback` with.
* @internal
*/
enqueue: function(callback, context) {
this._callbacks = this._callbacks || [];
this._contexts = this._contexts || [];
this._callbacks.push(callback);
this._contexts.push(context);
},
/**
* Invokes all enqueued callbacks and clears the queue. This is invoked after
* the DOM representation of a component has been created or updated.
*
* @internal
*/
notifyAll: function() {
var callbacks = this._callbacks;
var contexts = this._contexts;
if (callbacks) {
("production" !== "development" ? invariant(
callbacks.length === contexts.length,
"Mismatched list of contexts in callback queue"
) : invariant(callbacks.length === contexts.length));
this._callbacks = null;
this._contexts = null;
for (var i = 0, l = callbacks.length; i < l; i++) {
callbacks[i].call(contexts[i]);
}
callbacks.length = 0;
contexts.length = 0;
}
},
/**
* Resets the internal queue.
*
* @internal
*/
reset: function() {
this._callbacks = null;
this._contexts = null;
},
/**
* `PooledClass` looks for this.
*/
destructor: function() {
this.reset();
}
});
PooledClass.addPoolingTo(CallbackQueue);
module.exports = CallbackQueue;
},{"./PooledClass":28,"./invariant":134,"./mixInto":147}],7:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ChangeEventPlugin
*/
"use strict";
var EventConstants = _dereq_("./EventConstants");
var EventPluginHub = _dereq_("./EventPluginHub");
var EventPropagators = _dereq_("./EventPropagators");
var ExecutionEnvironment = _dereq_("./ExecutionEnvironment");
var ReactUpdates = _dereq_("./ReactUpdates");
var SyntheticEvent = _dereq_("./SyntheticEvent");
var isEventSupported = _dereq_("./isEventSupported");
var isTextInputElement = _dereq_("./isTextInputElement");
var keyOf = _dereq_("./keyOf");
var topLevelTypes = EventConstants.topLevelTypes;
var eventTypes = {
change: {
phasedRegistrationNames: {
bubbled: keyOf({onChange: null}),
captured: keyOf({onChangeCapture: null})
},
dependencies: [
topLevelTypes.topBlur,
topLevelTypes.topChange,
topLevelTypes.topClick,
topLevelTypes.topFocus,
topLevelTypes.topInput,
topLevelTypes.topKeyDown,
topLevelTypes.topKeyUp,
topLevelTypes.topSelectionChange
]
}
};
/**
* For IE shims
*/
var activeElement = null;
var activeElementID = null;
var activeElementValue = null;
var activeElementValueProp = null;
/**
* SECTION: handle `change` event
*/
function shouldUseChangeEvent(elem) {
return (
elem.nodeName === 'SELECT' ||
(elem.nodeName === 'INPUT' && elem.type === 'file')
);
}
var doesChangeEventBubble = false;
if (ExecutionEnvironment.canUseDOM) {
// See `handleChange` comment below
doesChangeEventBubble = isEventSupported('change') && (
!('documentMode' in document) || document.documentMode > 8
);
}
function manualDispatchChangeEvent(nativeEvent) {
var event = SyntheticEvent.getPooled(
eventTypes.change,
activeElementID,
nativeEvent
);
EventPropagators.accumulateTwoPhaseDispatches(event);
// If change and propertychange bubbled, we'd just bind to it like all the
// other events and have it go through ReactBrowserEventEmitter. Since it
// doesn't, we manually listen for the events and so we have to enqueue and
// process the abstract event manually.
//
// Batching is necessary here in order to ensure that all event handlers run
// before the next rerender (including event handlers attached to ancestor
// elements instead of directly on the input). Without this, controlled
// components don't work properly in conjunction with event bubbling because
// the component is rerendered and the value reverted before all the event
// handlers can run. See https://github.com/facebook/react/issues/708.
ReactUpdates.batchedUpdates(runEventInBatch, event);
}
function runEventInBatch(event) {
EventPluginHub.enqueueEvents(event);
EventPluginHub.processEventQueue();
}
function startWatchingForChangeEventIE8(target, targetID) {
activeElement = target;
activeElementID = targetID;
activeElement.attachEvent('onchange', manualDispatchChangeEvent);
}
function stopWatchingForChangeEventIE8() {
if (!activeElement) {
return;
}
activeElement.detachEvent('onchange', manualDispatchChangeEvent);
activeElement = null;
activeElementID = null;
}
function getTargetIDForChangeEvent(
topLevelType,
topLevelTarget,
topLevelTargetID) {
if (topLevelType === topLevelTypes.topChange) {
return topLevelTargetID;
}
}
function handleEventsForChangeEventIE8(
topLevelType,
topLevelTarget,
topLevelTargetID) {
if (topLevelType === topLevelTypes.topFocus) {
// stopWatching() should be a noop here but we call it just in case we
// missed a blur event somehow.
stopWatchingForChangeEventIE8();
startWatchingForChangeEventIE8(topLevelTarget, topLevelTargetID);
} else if (topLevelType === topLevelTypes.topBlur) {
stopWatchingForChangeEventIE8();
}
}
/**
* SECTION: handle `input` event
*/
var isInputEventSupported = false;
if (ExecutionEnvironment.canUseDOM) {
// IE9 claims to support the input event but fails to trigger it when
// deleting text, so we ignore its input events
isInputEventSupported = isEventSupported('input') && (
!('documentMode' in document) || document.documentMode > 9
);
}
/**
* (For old IE.) Replacement getter/setter for the `value` property that gets
* set on the active element.
*/
var newValueProp = {
get: function() {
return activeElementValueProp.get.call(this);
},
set: function(val) {
// Cast to a string so we can do equality checks.
activeElementValue = '' + val;
activeElementValueProp.set.call(this, val);
}
};
/**
* (For old IE.) Starts tracking propertychange events on the passed-in element
* and override the value property so that we can distinguish user events from
* value changes in JS.
*/
function startWatchingForValueChange(target, targetID) {
activeElement = target;
activeElementID = targetID;
activeElementValue = target.value;
activeElementValueProp = Object.getOwnPropertyDescriptor(
target.constructor.prototype,
'value'
);
Object.defineProperty(activeElement, 'value', newValueProp);
activeElement.attachEvent('onpropertychange', handlePropertyChange);
}
/**
* (For old IE.) Removes the event listeners from the currently-tracked element,
* if any exists.
*/
function stopWatchingForValueChange() {
if (!activeElement) {
return;
}
// delete restores the original property definition
delete activeElement.value;
activeElement.detachEvent('onpropertychange', handlePropertyChange);
activeElement = null;
activeElementID = null;
activeElementValue = null;
activeElementValueProp = null;
}
/**
* (For old IE.) Handles a propertychange event, sending a `change` event if
* the value of the active element has changed.
*/
function handlePropertyChange(nativeEvent) {
if (nativeEvent.propertyName !== 'value') {
return;
}
var value = nativeEvent.srcElement.value;
if (value === activeElementValue) {
return;
}
activeElementValue = value;
manualDispatchChangeEvent(nativeEvent);
}
/**
* If a `change` event should be fired, returns the target's ID.
*/
function getTargetIDForInputEvent(
topLevelType,
topLevelTarget,
topLevelTargetID) {
if (topLevelType === topLevelTypes.topInput) {
// In modern browsers (i.e., not IE8 or IE9), the input event is exactly
// what we want so fall through here and trigger an abstract event
return topLevelTargetID;
}
}
// For IE8 and IE9.
function handleEventsForInputEventIE(
topLevelType,
topLevelTarget,
topLevelTargetID) {
if (topLevelType === topLevelTypes.topFocus) {
// In IE8, we can capture almost all .value changes by adding a
// propertychange handler and looking for events with propertyName
// equal to 'value'
// In IE9, propertychange fires for most input events but is buggy and
// doesn't fire when text is deleted, but conveniently, selectionchange
// appears to fire in all of the remaining cases so we catch those and
// forward the event if the value has changed
// In either case, we don't want to call the event handler if the value
// is changed from JS so we redefine a setter for `.value` that updates
// our activeElementValue variable, allowing us to ignore those changes
//
// stopWatching() should be a noop here but we call it just in case we
// missed a blur event somehow.
stopWatchingForValueChange();
startWatchingForValueChange(topLevelTarget, topLevelTargetID);
} else if (topLevelType === topLevelTypes.topBlur) {
stopWatchingForValueChange();
}
}
// For IE8 and IE9.
function getTargetIDForInputEventIE(
topLevelType,
topLevelTarget,
topLevelTargetID) {
if (topLevelType === topLevelTypes.topSelectionChange ||
topLevelType === topLevelTypes.topKeyUp ||
topLevelType === topLevelTypes.topKeyDown) {
// On the selectionchange event, the target is just document which isn't
// helpful for us so just check activeElement instead.
//
// 99% of the time, keydown and keyup aren't necessary. IE8 fails to fire
// propertychange on the first input event after setting `value` from a
// script and fires only keydown, keypress, keyup. Catching keyup usually
// gets it and catching keydown lets us fire an event for the first
// keystroke if user does a key repeat (it'll be a little delayed: right
// before the second keystroke). Other input methods (e.g., paste) seem to
// fire selectionchange normally.
if (activeElement && activeElement.value !== activeElementValue) {
activeElementValue = activeElement.value;
return activeElementID;
}
}
}
/**
* SECTION: handle `click` event
*/
function shouldUseClickEvent(elem) {
// Use the `click` event to detect changes to checkbox and radio inputs.
// This approach works across all browsers, whereas `change` does not fire
// until `blur` in IE8.
return (
elem.nodeName === 'INPUT' &&
(elem.type === 'checkbox' || elem.type === 'radio')
);
}
function getTargetIDForClickEvent(
topLevelType,
topLevelTarget,
topLevelTargetID) {
if (topLevelType === topLevelTypes.topClick) {
return topLevelTargetID;
}
}
/**
* This plugin creates an `onChange` event that normalizes change events
* across form elements. This event fires at a time when it's possible to
* change the element's value without seeing a flicker.
*
* Supported elements are:
* - input (see `isTextInputElement`)
* - textarea
* - select
*/
var ChangeEventPlugin = {
eventTypes: eventTypes,
/**
* @param {string} topLevelType Record from `EventConstants`.
* @param {DOMEventTarget} topLevelTarget The listening component root node.
* @param {string} topLevelTargetID ID of `topLevelTarget`.
* @param {object} nativeEvent Native browser event.
* @return {*} An accumulation of synthetic events.
* @see {EventPluginHub.extractEvents}
*/
extractEvents: function(
topLevelType,
topLevelTarget,
topLevelTargetID,
nativeEvent) {
var getTargetIDFunc, handleEventFunc;
if (shouldUseChangeEvent(topLevelTarget)) {
if (doesChangeEventBubble) {
getTargetIDFunc = getTargetIDForChangeEvent;
} else {
handleEventFunc = handleEventsForChangeEventIE8;
}
} else if (isTextInputElement(topLevelTarget)) {
if (isInputEventSupported) {
getTargetIDFunc = getTargetIDForInputEvent;
} else {
getTargetIDFunc = getTargetIDForInputEventIE;
handleEventFunc = handleEventsForInputEventIE;
}
} else if (shouldUseClickEvent(topLevelTarget)) {
getTargetIDFunc = getTargetIDForClickEvent;
}
if (getTargetIDFunc) {
var targetID = getTargetIDFunc(
topLevelType,
topLevelTarget,
topLevelTargetID
);
if (targetID) {
var event = SyntheticEvent.getPooled(
eventTypes.change,
targetID,
nativeEvent
);
EventPropagators.accumulateTwoPhaseDispatches(event);
return event;
}
}
if (handleEventFunc) {
handleEventFunc(
topLevelType,
topLevelTarget,
topLevelTargetID
);
}
}
};
module.exports = ChangeEventPlugin;
},{"./EventConstants":16,"./EventPluginHub":18,"./EventPropagators":21,"./ExecutionEnvironment":22,"./ReactUpdates":87,"./SyntheticEvent":96,"./isEventSupported":135,"./isTextInputElement":137,"./keyOf":141}],8:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ClientReactRootIndex
* @typechecks
*/
"use strict";
var nextReactRootIndex = 0;
var ClientReactRootIndex = {
createReactRootIndex: function() {
return nextReactRootIndex++;
}
};
module.exports = ClientReactRootIndex;
},{}],9:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule CompositionEventPlugin
* @typechecks static-only
*/
"use strict";
var EventConstants = _dereq_("./EventConstants");
var EventPropagators = _dereq_("./EventPropagators");
var ExecutionEnvironment = _dereq_("./ExecutionEnvironment");
var ReactInputSelection = _dereq_("./ReactInputSelection");
var SyntheticCompositionEvent = _dereq_("./SyntheticCompositionEvent");
var getTextContentAccessor = _dereq_("./getTextContentAccessor");
var keyOf = _dereq_("./keyOf");
var END_KEYCODES = [9, 13, 27, 32]; // Tab, Return, Esc, Space
var START_KEYCODE = 229;
var useCompositionEvent = (
ExecutionEnvironment.canUseDOM &&
'CompositionEvent' in window
);
// In IE9+, we have access to composition events, but the data supplied
// by the native compositionend event may be incorrect. In Korean, for example,
// the compositionend event contains only one character regardless of
// how many characters have been composed since compositionstart.
// We therefore use the fallback data while still using the native
// events as triggers.
var useFallbackData = (
!useCompositionEvent ||
(
'documentMode' in document &&
document.documentMode > 8 &&
document.documentMode <= 11
)
);
var topLevelTypes = EventConstants.topLevelTypes;
var currentComposition = null;
// Events and their corresponding property names.
var eventTypes = {
compositionEnd: {
phasedRegistrationNames: {
bubbled: keyOf({onCompositionEnd: null}),
captured: keyOf({onCompositionEndCapture: null})
},
dependencies: [
topLevelTypes.topBlur,
topLevelTypes.topCompositionEnd,
topLevelTypes.topKeyDown,
topLevelTypes.topKeyPress,
topLevelTypes.topKeyUp,
topLevelTypes.topMouseDown
]
},
compositionStart: {
phasedRegistrationNames: {
bubbled: keyOf({onCompositionStart: null}),
captured: keyOf({onCompositionStartCapture: null})
},
dependencies: [
topLevelTypes.topBlur,
topLevelTypes.topCompositionStart,
topLevelTypes.topKeyDown,
topLevelTypes.topKeyPress,
topLevelTypes.topKeyUp,
topLevelTypes.topMouseDown
]
},
compositionUpdate: {
phasedRegistrationNames: {
bubbled: keyOf({onCompositionUpdate: null}),
captured: keyOf({onCompositionUpdateCapture: null})
},
dependencies: [
topLevelTypes.topBlur,
topLevelTypes.topCompositionUpdate,
topLevelTypes.topKeyDown,
topLevelTypes.topKeyPress,
topLevelTypes.topKeyUp,
topLevelTypes.topMouseDown
]
}
};
/**
* Translate native top level events into event types.
*
* @param {string} topLevelType
* @return {object}
*/
function getCompositionEventType(topLevelType) {
switch (topLevelType) {
case topLevelTypes.topCompositionStart:
return eventTypes.compositionStart;
case topLevelTypes.topCompositionEnd:
return eventTypes.compositionEnd;
case topLevelTypes.topCompositionUpdate:
return eventTypes.compositionUpdate;
}
}
/**
* Does our fallback best-guess model think this event signifies that
* composition has begun?
*
* @param {string} topLevelType
* @param {object} nativeEvent
* @return {boolean}
*/
function isFallbackStart(topLevelType, nativeEvent) {
return (
topLevelType === topLevelTypes.topKeyDown &&
nativeEvent.keyCode === START_KEYCODE
);
}
/**
* Does our fallback mode think that this event is the end of composition?
*
* @param {string} topLevelType
* @param {object} nativeEvent
* @return {boolean}
*/
function isFallbackEnd(topLevelType, nativeEvent) {
switch (topLevelType) {
case topLevelTypes.topKeyUp:
// Command keys insert or clear IME input.
return (END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1);
case topLevelTypes.topKeyDown:
// Expect IME keyCode on each keydown. If we get any other
// code we must have exited earlier.
return (nativeEvent.keyCode !== START_KEYCODE);
case topLevelTypes.topKeyPress:
case topLevelTypes.topMouseDown:
case topLevelTypes.topBlur:
// Events are not possible without cancelling IME.
return true;
default:
return false;
}
}
/**
* Helper class stores information about selection and document state
* so we can figure out what changed at a later date.
*
* @param {DOMEventTarget} root
*/
function FallbackCompositionState(root) {
this.root = root;
this.startSelection = ReactInputSelection.getSelection(root);
this.startValue = this.getText();
}
/**
* Get current text of input.
*
* @return {string}
*/
FallbackCompositionState.prototype.getText = function() {
return this.root.value || this.root[getTextContentAccessor()];
};
/**
* Text that has changed since the start of composition.
*
* @return {string}
*/
FallbackCompositionState.prototype.getData = function() {
var endValue = this.getText();
var prefixLength = this.startSelection.start;
var suffixLength = this.startValue.length - this.startSelection.end;
return endValue.substr(
prefixLength,
endValue.length - suffixLength - prefixLength
);
};
/**
* This plugin creates `onCompositionStart`, `onCompositionUpdate` and
* `onCompositionEnd` events on inputs, textareas and contentEditable
* nodes.
*/
var CompositionEventPlugin = {
eventTypes: eventTypes,
/**
* @param {string} topLevelType Record from `EventConstants`.
* @param {DOMEventTarget} topLevelTarget The listening component root node.
* @param {string} topLevelTargetID ID of `topLevelTarget`.
* @param {object} nativeEvent Native browser event.
* @return {*} An accumulation of synthetic events.
* @see {EventPluginHub.extractEvents}
*/
extractEvents: function(
topLevelType,
topLevelTarget,
topLevelTargetID,
nativeEvent) {
var eventType;
var data;
if (useCompositionEvent) {
eventType = getCompositionEventType(topLevelType);
} else if (!currentComposition) {
if (isFallbackStart(topLevelType, nativeEvent)) {
eventType = eventTypes.compositionStart;
}
} else if (isFallbackEnd(topLevelType, nativeEvent)) {
eventType = eventTypes.compositionEnd;
}
if (useFallbackData) {
// The current composition is stored statically and must not be
// overwritten while composition continues.
if (!currentComposition && eventType === eventTypes.compositionStart) {
currentComposition = new FallbackCompositionState(topLevelTarget);
} else if (eventType === eventTypes.compositionEnd) {
if (currentComposition) {
data = currentComposition.getData();
currentComposition = null;
}
}
}
if (eventType) {
var event = SyntheticCompositionEvent.getPooled(
eventType,
topLevelTargetID,
nativeEvent
);
if (data) {
// Inject data generated from fallback path into the synthetic event.
// This matches the property of native CompositionEventInterface.
event.data = data;
}
EventPropagators.accumulateTwoPhaseDispatches(event);
return event;
}
}
};
module.exports = CompositionEventPlugin;
},{"./EventConstants":16,"./EventPropagators":21,"./ExecutionEnvironment":22,"./ReactInputSelection":63,"./SyntheticCompositionEvent":94,"./getTextContentAccessor":129,"./keyOf":141}],10:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule DOMChildrenOperations
* @typechecks static-only
*/
"use strict";
var Danger = _dereq_("./Danger");
var ReactMultiChildUpdateTypes = _dereq_("./ReactMultiChildUpdateTypes");
var getTextContentAccessor = _dereq_("./getTextContentAccessor");
var invariant = _dereq_("./invariant");
/**
* The DOM property to use when setting text content.
*
* @type {string}
* @private
*/
var textContentAccessor = getTextContentAccessor();
/**
* Inserts `childNode` as a child of `parentNode` at the `index`.
*
* @param {DOMElement} parentNode Parent node in which to insert.
* @param {DOMElement} childNode Child node to insert.
* @param {number} index Index at which to insert the child.
* @internal
*/
function insertChildAt(parentNode, childNode, index) {
// By exploiting arrays returning `undefined` for an undefined index, we can
// rely exclusively on `insertBefore(node, null)` instead of also using
// `appendChild(node)`. However, using `undefined` is not allowed by all
// browsers so we must replace it with `null`.
parentNode.insertBefore(
childNode,
parentNode.childNodes[index] || null
);
}
var updateTextContent;
if (textContentAccessor === 'textContent') {
/**
* Sets the text content of `node` to `text`.
*
* @param {DOMElement} node Node to change
* @param {string} text New text content
*/
updateTextContent = function(node, text) {
node.textContent = text;
};
} else {
/**
* Sets the text content of `node` to `text`.
*
* @param {DOMElement} node Node to change
* @param {string} text New text content
*/
updateTextContent = function(node, text) {
// In order to preserve newlines correctly, we can't use .innerText to set
// the contents (see #1080), so we empty the element then append a text node
while (node.firstChild) {
node.removeChild(node.firstChild);
}
if (text) {
var doc = node.ownerDocument || document;
node.appendChild(doc.createTextNode(text));
}
};
}
/**
* Operations for updating with DOM children.
*/
var DOMChildrenOperations = {
dangerouslyReplaceNodeWithMarkup: Danger.dangerouslyReplaceNodeWithMarkup,
updateTextContent: updateTextContent,
/**
* Updates a component's children by processing a series of updates. The
* update configurations are each expected to have a `parentNode` property.
*
* @param {array<object>} updates List of update configurations.
* @param {array<string>} markupList List of markup strings.
* @internal
*/
processUpdates: function(updates, markupList) {
var update;
// Mapping from parent IDs to initial child orderings.
var initialChildren = null;
// List of children that will be moved or removed.
var updatedChildren = null;
for (var i = 0; update = updates[i]; i++) {
if (update.type === ReactMultiChildUpdateTypes.MOVE_EXISTING ||
update.type === ReactMultiChildUpdateTypes.REMOVE_NODE) {
var updatedIndex = update.fromIndex;
var updatedChild = update.parentNode.childNodes[updatedIndex];
var parentID = update.parentID;
("production" !== "development" ? invariant(
updatedChild,
'processUpdates(): Unable to find child %s of element. This ' +
'probably means the DOM was unexpectedly mutated (e.g., by the ' +
'browser), usually due to forgetting a <tbody> when using tables, ' +
'nesting <p> or <a> tags, or using non-SVG elements in an <svg> '+
'parent. Try inspecting the child nodes of the element with React ' +
'ID `%s`.',
updatedIndex,
parentID
) : invariant(updatedChild));
initialChildren = initialChildren || {};
initialChildren[parentID] = initialChildren[parentID] || [];
initialChildren[parentID][updatedIndex] = updatedChild;
updatedChildren = updatedChildren || [];
updatedChildren.push(updatedChild);
}
}
var renderedMarkup = Danger.dangerouslyRenderMarkup(markupList);
// Remove updated children first so that `toIndex` is consistent.
if (updatedChildren) {
for (var j = 0; j < updatedChildren.length; j++) {
updatedChildren[j].parentNode.removeChild(updatedChildren[j]);
}
}
for (var k = 0; update = updates[k]; k++) {
switch (update.type) {
case ReactMultiChildUpdateTypes.INSERT_MARKUP:
insertChildAt(
update.parentNode,
renderedMarkup[update.markupIndex],
update.toIndex
);
break;
case ReactMultiChildUpdateTypes.MOVE_EXISTING:
insertChildAt(
update.parentNode,
initialChildren[update.parentID][update.fromIndex],
update.toIndex
);
break;
case ReactMultiChildUpdateTypes.TEXT_CONTENT:
updateTextContent(
update.parentNode,
update.textContent
);
break;
case ReactMultiChildUpdateTypes.REMOVE_NODE:
// Already removed by the for-loop above.
break;
}
}
}
};
module.exports = DOMChildrenOperations;
},{"./Danger":13,"./ReactMultiChildUpdateTypes":69,"./getTextContentAccessor":129,"./invariant":134}],11:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule DOMProperty
* @typechecks static-only
*/
/*jslint bitwise: true */
"use strict";
var invariant = _dereq_("./invariant");
var DOMPropertyInjection = {
/**
* Mapping from normalized, camelcased property names to a configuration that
* specifies how the associated DOM property should be accessed or rendered.
*/
MUST_USE_ATTRIBUTE: 0x1,
MUST_USE_PROPERTY: 0x2,
HAS_SIDE_EFFECTS: 0x4,
HAS_BOOLEAN_VALUE: 0x8,
HAS_NUMERIC_VALUE: 0x10,
HAS_POSITIVE_NUMERIC_VALUE: 0x20 | 0x10,
HAS_OVERLOADED_BOOLEAN_VALUE: 0x40,
/**
* Inject some specialized knowledge about the DOM. This takes a config object
* with the following properties:
*
* isCustomAttribute: function that given an attribute name will return true
* if it can be inserted into the DOM verbatim. Useful for data-* or aria-*
* attributes where it's impossible to enumerate all of the possible
* attribute names,
*
* Properties: object mapping DOM property name to one of the
* DOMPropertyInjection constants or null. If your attribute isn't in here,
* it won't get written to the DOM.
*
* DOMAttributeNames: object mapping React attribute name to the DOM
* attribute name. Attribute names not specified use the **lowercase**
* normalized name.
*
* DOMPropertyNames: similar to DOMAttributeNames but for DOM properties.
* Property names not specified use the normalized name.
*
* DOMMutationMethods: Properties that require special mutation methods. If
* `value` is undefined, the mutation method should unset the property.
*
* @param {object} domPropertyConfig the config as described above.
*/
injectDOMPropertyConfig: function(domPropertyConfig) {
var Properties = domPropertyConfig.Properties || {};
var DOMAttributeNames = domPropertyConfig.DOMAttributeNames || {};
var DOMPropertyNames = domPropertyConfig.DOMPropertyNames || {};
var DOMMutationMethods = domPropertyConfig.DOMMutationMethods || {};
if (domPropertyConfig.isCustomAttribute) {
DOMProperty._isCustomAttributeFunctions.push(
domPropertyConfig.isCustomAttribute
);
}
for (var propName in Properties) {
("production" !== "development" ? invariant(
!DOMProperty.isStandardName.hasOwnProperty(propName),
'injectDOMPropertyConfig(...): You\'re trying to inject DOM property ' +
'\'%s\' which has already been injected. You may be accidentally ' +
'injecting the same DOM property config twice, or you may be ' +
'injecting two configs that have conflicting property names.',
propName
) : invariant(!DOMProperty.isStandardName.hasOwnProperty(propName)));
DOMProperty.isStandardName[propName] = true;
var lowerCased = propName.toLowerCase();
DOMProperty.getPossibleStandardName[lowerCased] = propName;
if (DOMAttributeNames.hasOwnProperty(propName)) {
var attributeName = DOMAttributeNames[propName];
DOMProperty.getPossibleStandardName[attributeName] = propName;
DOMProperty.getAttributeName[propName] = attributeName;
} else {
DOMProperty.getAttributeName[propName] = lowerCased;
}
DOMProperty.getPropertyName[propName] =
DOMPropertyNames.hasOwnProperty(propName) ?
DOMPropertyNames[propName] :
propName;
if (DOMMutationMethods.hasOwnProperty(propName)) {
DOMProperty.getMutationMethod[propName] = DOMMutationMethods[propName];
} else {
DOMProperty.getMutationMethod[propName] = null;
}
var propConfig = Properties[propName];
DOMProperty.mustUseAttribute[propName] =
propConfig & DOMPropertyInjection.MUST_USE_ATTRIBUTE;
DOMProperty.mustUseProperty[propName] =
propConfig & DOMPropertyInjection.MUST_USE_PROPERTY;
DOMProperty.hasSideEffects[propName] =
propConfig & DOMPropertyInjection.HAS_SIDE_EFFECTS;
DOMProperty.hasBooleanValue[propName] =
propConfig & DOMPropertyInjection.HAS_BOOLEAN_VALUE;
DOMProperty.hasNumericValue[propName] =
propConfig & DOMPropertyInjection.HAS_NUMERIC_VALUE;
DOMProperty.hasPositiveNumericValue[propName] =
propConfig & DOMPropertyInjection.HAS_POSITIVE_NUMERIC_VALUE;
DOMProperty.hasOverloadedBooleanValue[propName] =
propConfig & DOMPropertyInjection.HAS_OVERLOADED_BOOLEAN_VALUE;
("production" !== "development" ? invariant(
!DOMProperty.mustUseAttribute[propName] ||
!DOMProperty.mustUseProperty[propName],
'DOMProperty: Cannot require using both attribute and property: %s',
propName
) : invariant(!DOMProperty.mustUseAttribute[propName] ||
!DOMProperty.mustUseProperty[propName]));
("production" !== "development" ? invariant(
DOMProperty.mustUseProperty[propName] ||
!DOMProperty.hasSideEffects[propName],
'DOMProperty: Properties that have side effects must use property: %s',
propName
) : invariant(DOMProperty.mustUseProperty[propName] ||
!DOMProperty.hasSideEffects[propName]));
("production" !== "development" ? invariant(
!!DOMProperty.hasBooleanValue[propName] +
!!DOMProperty.hasNumericValue[propName] +
!!DOMProperty.hasOverloadedBooleanValue[propName] <= 1,
'DOMProperty: Value can be one of boolean, overloaded boolean, or ' +
'numeric value, but not a combination: %s',
propName
) : invariant(!!DOMProperty.hasBooleanValue[propName] +
!!DOMProperty.hasNumericValue[propName] +
!!DOMProperty.hasOverloadedBooleanValue[propName] <= 1));
}
}
};
var defaultValueCache = {};
/**
* DOMProperty exports lookup objects that can be used like functions:
*
* > DOMProperty.isValid['id']
* true
* > DOMProperty.isValid['foobar']
* undefined
*
* Although this may be confusing, it performs better in general.
*
* @see http://jsperf.com/key-exists
* @see http://jsperf.com/key-missing
*/
var DOMProperty = {
ID_ATTRIBUTE_NAME: 'data-reactid',
/**
* Checks whether a property name is a standard property.
* @type {Object}
*/
isStandardName: {},
/**
* Mapping from lowercase property names to the properly cased version, used
* to warn in the case of missing properties.
* @type {Object}
*/
getPossibleStandardName: {},
/**
* Mapping from normalized names to attribute names that differ. Attribute
* names are used when rendering markup or with `*Attribute()`.
* @type {Object}
*/
getAttributeName: {},
/**
* Mapping from normalized names to properties on DOM node instances.
* (This includes properties that mutate due to external factors.)
* @type {Object}
*/
getPropertyName: {},
/**
* Mapping from normalized names to mutation methods. This will only exist if
* mutation cannot be set simply by the property or `setAttribute()`.
* @type {Object}
*/
getMutationMethod: {},
/**
* Whether the property must be accessed and mutated as an object property.
* @type {Object}
*/
mustUseAttribute: {},
/**
* Whether the property must be accessed and mutated using `*Attribute()`.
* (This includes anything that fails `<propName> in <element>`.)
* @type {Object}
*/
mustUseProperty: {},
/**
* Whether or not setting a value causes side effects such as triggering
* resources to be loaded or text selection changes. We must ensure that
* the value is only set if it has changed.
* @type {Object}
*/
hasSideEffects: {},
/**
* Whether the property should be removed when set to a falsey value.
* @type {Object}
*/
hasBooleanValue: {},
/**
* Whether the property must be numeric or parse as a
* numeric and should be removed when set to a falsey value.
* @type {Object}
*/
hasNumericValue: {},
/**
* Whether the property must be positive numeric or parse as a positive
* numeric and should be removed when set to a falsey value.
* @type {Object}
*/
hasPositiveNumericValue: {},
/**
* Whether the property can be used as a flag as well as with a value. Removed
* when strictly equal to false; present without a value when strictly equal
* to true; present with a value otherwise.
* @type {Object}
*/
hasOverloadedBooleanValue: {},
/**
* All of the isCustomAttribute() functions that have been injected.
*/
_isCustomAttributeFunctions: [],
/**
* Checks whether a property name is a custom attribute.
* @method
*/
isCustomAttribute: function(attributeName) {
for (var i = 0; i < DOMProperty._isCustomAttributeFunctions.length; i++) {
var isCustomAttributeFn = DOMProperty._isCustomAttributeFunctions[i];
if (isCustomAttributeFn(attributeName)) {
return true;
}
}
return false;
},
/**
* Returns the default property value for a DOM property (i.e., not an
* attribute). Most default values are '' or false, but not all. Worse yet,
* some (in particular, `type`) vary depending on the type of element.
*
* TODO: Is it better to grab all the possible properties when creating an
* element to avoid having to create the same element twice?
*/
getDefaultValueForProperty: function(nodeName, prop) {
var nodeDefaults = defaultValueCache[nodeName];
var testElement;
if (!nodeDefaults) {
defaultValueCache[nodeName] = nodeDefaults = {};
}
if (!(prop in nodeDefaults)) {
testElement = document.createElement(nodeName);
nodeDefaults[prop] = testElement[prop];
}
return nodeDefaults[prop];
},
injection: DOMPropertyInjection
};
module.exports = DOMProperty;
},{"./invariant":134}],12:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule DOMPropertyOperations
* @typechecks static-only
*/
"use strict";
var DOMProperty = _dereq_("./DOMProperty");
var escapeTextForBrowser = _dereq_("./escapeTextForBrowser");
var memoizeStringOnly = _dereq_("./memoizeStringOnly");
var warning = _dereq_("./warning");
function shouldIgnoreValue(name, value) {
return value == null ||
(DOMProperty.hasBooleanValue[name] && !value) ||
(DOMProperty.hasNumericValue[name] && isNaN(value)) ||
(DOMProperty.hasPositiveNumericValue[name] && (value < 1)) ||
(DOMProperty.hasOverloadedBooleanValue[name] && value === false);
}
var processAttributeNameAndPrefix = memoizeStringOnly(function(name) {
return escapeTextForBrowser(name) + '="';
});
if ("production" !== "development") {
var reactProps = {
children: true,
dangerouslySetInnerHTML: true,
key: true,
ref: true
};
var warnedProperties = {};
var warnUnknownProperty = function(name) {
if (reactProps.hasOwnProperty(name) && reactProps[name] ||
warnedProperties.hasOwnProperty(name) && warnedProperties[name]) {
return;
}
warnedProperties[name] = true;
var lowerCasedName = name.toLowerCase();
// data-* attributes should be lowercase; suggest the lowercase version
var standardName = (
DOMProperty.isCustomAttribute(lowerCasedName) ?
lowerCasedName :
DOMProperty.getPossibleStandardName.hasOwnProperty(lowerCasedName) ?
DOMProperty.getPossibleStandardName[lowerCasedName] :
null
);
// For now, only warn when we have a suggested correction. This prevents
// logging too much when using transferPropsTo.
("production" !== "development" ? warning(
standardName == null,
'Unknown DOM property ' + name + '. Did you mean ' + standardName + '?'
) : null);
};
}
/**
* Operations for dealing with DOM properties.
*/
var DOMPropertyOperations = {
/**
* Creates markup for the ID property.
*
* @param {string} id Unescaped ID.
* @return {string} Markup string.
*/
createMarkupForID: function(id) {
return processAttributeNameAndPrefix(DOMProperty.ID_ATTRIBUTE_NAME) +
escapeTextForBrowser(id) + '"';
},
/**
* Creates markup for a property.
*
* @param {string} name
* @param {*} value
* @return {?string} Markup string, or null if the property was invalid.
*/
createMarkupForProperty: function(name, value) {
if (DOMProperty.isStandardName.hasOwnProperty(name) &&
DOMProperty.isStandardName[name]) {
if (shouldIgnoreValue(name, value)) {
return '';
}
var attributeName = DOMProperty.getAttributeName[name];
if (DOMProperty.hasBooleanValue[name] ||
(DOMProperty.hasOverloadedBooleanValue[name] && value === true)) {
return escapeTextForBrowser(attributeName);
}
return processAttributeNameAndPrefix(attributeName) +
escapeTextForBrowser(value) + '"';
} else if (DOMProperty.isCustomAttribute(name)) {
if (value == null) {
return '';
}
return processAttributeNameAndPrefix(name) +
escapeTextForBrowser(value) + '"';
} else if ("production" !== "development") {
warnUnknownProperty(name);
}
return null;
},
/**
* Sets the value for a property on a node.
*
* @param {DOMElement} node
* @param {string} name
* @param {*} value
*/
setValueForProperty: function(node, name, value) {
if (DOMProperty.isStandardName.hasOwnProperty(name) &&
DOMProperty.isStandardName[name]) {
var mutationMethod = DOMProperty.getMutationMethod[name];
if (mutationMethod) {
mutationMethod(node, value);
} else if (shouldIgnoreValue(name, value)) {
this.deleteValueForProperty(node, name);
} else if (DOMProperty.mustUseAttribute[name]) {
node.setAttribute(DOMProperty.getAttributeName[name], '' + value);
} else {
var propName = DOMProperty.getPropertyName[name];
if (!DOMProperty.hasSideEffects[name] || node[propName] !== value) {
node[propName] = value;
}
}
} else if (DOMProperty.isCustomAttribute(name)) {
if (value == null) {
node.removeAttribute(name);
} else {
node.setAttribute(name, '' + value);
}
} else if ("production" !== "development") {
warnUnknownProperty(name);
}
},
/**
* Deletes the value for a property on a node.
*
* @param {DOMElement} node
* @param {string} name
*/
deleteValueForProperty: function(node, name) {
if (DOMProperty.isStandardName.hasOwnProperty(name) &&
DOMProperty.isStandardName[name]) {
var mutationMethod = DOMProperty.getMutationMethod[name];
if (mutationMethod) {
mutationMethod(node, undefined);
} else if (DOMProperty.mustUseAttribute[name]) {
node.removeAttribute(DOMProperty.getAttributeName[name]);
} else {
var propName = DOMProperty.getPropertyName[name];
var defaultValue = DOMProperty.getDefaultValueForProperty(
node.nodeName,
propName
);
if (!DOMProperty.hasSideEffects[name] ||
node[propName] !== defaultValue) {
node[propName] = defaultValue;
}
}
} else if (DOMProperty.isCustomAttribute(name)) {
node.removeAttribute(name);
} else if ("production" !== "development") {
warnUnknownProperty(name);
}
}
};
module.exports = DOMPropertyOperations;
},{"./DOMProperty":11,"./escapeTextForBrowser":118,"./memoizeStringOnly":143,"./warning":158}],13:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule Danger
* @typechecks static-only
*/
/*jslint evil: true, sub: true */
"use strict";
var ExecutionEnvironment = _dereq_("./ExecutionEnvironment");
var createNodesFromMarkup = _dereq_("./createNodesFromMarkup");
var emptyFunction = _dereq_("./emptyFunction");
var getMarkupWrap = _dereq_("./getMarkupWrap");
var invariant = _dereq_("./invariant");
var OPEN_TAG_NAME_EXP = /^(<[^ \/>]+)/;
var RESULT_INDEX_ATTR = 'data-danger-index';
/**
* Extracts the `nodeName` from a string of markup.
*
* NOTE: Extracting the `nodeName` does not require a regular expression match
* because we make assumptions about React-generated markup (i.e. there are no
* spaces surrounding the opening tag and there is at least one attribute).
*
* @param {string} markup String of markup.
* @return {string} Node name of the supplied markup.
* @see http://jsperf.com/extract-nodename
*/
function getNodeName(markup) {
return markup.substring(1, markup.indexOf(' '));
}
var Danger = {
/**
* Renders markup into an array of nodes. The markup is expected to render
* into a list of root nodes. Also, the length of `resultList` and
* `markupList` should be the same.
*
* @param {array<string>} markupList List of markup strings to render.
* @return {array<DOMElement>} List of rendered nodes.
* @internal
*/
dangerouslyRenderMarkup: function(markupList) {
("production" !== "development" ? invariant(
ExecutionEnvironment.canUseDOM,
'dangerouslyRenderMarkup(...): Cannot render markup in a Worker ' +
'thread. This is likely a bug in the framework. Please report ' +
'immediately.'
) : invariant(ExecutionEnvironment.canUseDOM));
var nodeName;
var markupByNodeName = {};
// Group markup by `nodeName` if a wrap is necessary, else by '*'.
for (var i = 0; i < markupList.length; i++) {
("production" !== "development" ? invariant(
markupList[i],
'dangerouslyRenderMarkup(...): Missing markup.'
) : invariant(markupList[i]));
nodeName = getNodeName(markupList[i]);
nodeName = getMarkupWrap(nodeName) ? nodeName : '*';
markupByNodeName[nodeName] = markupByNodeName[nodeName] || [];
markupByNodeName[nodeName][i] = markupList[i];
}
var resultList = [];
var resultListAssignmentCount = 0;
for (nodeName in markupByNodeName) {
if (!markupByNodeName.hasOwnProperty(nodeName)) {
continue;
}
var markupListByNodeName = markupByNodeName[nodeName];
// This for-in loop skips the holes of the sparse array. The order of
// iteration should follow the order of assignment, which happens to match
// numerical index order, but we don't rely on that.
for (var resultIndex in markupListByNodeName) {
if (markupListByNodeName.hasOwnProperty(resultIndex)) {
var markup = markupListByNodeName[resultIndex];
// Push the requested markup with an additional RESULT_INDEX_ATTR
// attribute. If the markup does not start with a < character, it
// will be discarded below (with an appropriate console.error).
markupListByNodeName[resultIndex] = markup.replace(
OPEN_TAG_NAME_EXP,
// This index will be parsed back out below.
'$1 ' + RESULT_INDEX_ATTR + '="' + resultIndex + '" '
);
}
}
// Render each group of markup with similar wrapping `nodeName`.
var renderNodes = createNodesFromMarkup(
markupListByNodeName.join(''),
emptyFunction // Do nothing special with <script> tags.
);
for (i = 0; i < renderNodes.length; ++i) {
var renderNode = renderNodes[i];
if (renderNode.hasAttribute &&
renderNode.hasAttribute(RESULT_INDEX_ATTR)) {
resultIndex = +renderNode.getAttribute(RESULT_INDEX_ATTR);
renderNode.removeAttribute(RESULT_INDEX_ATTR);
("production" !== "development" ? invariant(
!resultList.hasOwnProperty(resultIndex),
'Danger: Assigning to an already-occupied result index.'
) : invariant(!resultList.hasOwnProperty(resultIndex)));
resultList[resultIndex] = renderNode;
// This should match resultList.length and markupList.length when
// we're done.
resultListAssignmentCount += 1;
} else if ("production" !== "development") {
console.error(
"Danger: Discarding unexpected node:",
renderNode
);
}
}
}
// Although resultList was populated out of order, it should now be a dense
// array.
("production" !== "development" ? invariant(
resultListAssignmentCount === resultList.length,
'Danger: Did not assign to every index of resultList.'
) : invariant(resultListAssignmentCount === resultList.length));
("production" !== "development" ? invariant(
resultList.length === markupList.length,
'Danger: Expected markup to render %s nodes, but rendered %s.',
markupList.length,
resultList.length
) : invariant(resultList.length === markupList.length));
return resultList;
},
/**
* Replaces a node with a string of markup at its current position within its
* parent. The markup must render into a single root node.
*
* @param {DOMElement} oldChild Child node to replace.
* @param {string} markup Markup to render in place of the child node.
* @internal
*/
dangerouslyReplaceNodeWithMarkup: function(oldChild, markup) {
("production" !== "development" ? invariant(
ExecutionEnvironment.canUseDOM,
'dangerouslyReplaceNodeWithMarkup(...): Cannot render markup in a ' +
'worker thread. This is likely a bug in the framework. Please report ' +
'immediately.'
) : invariant(ExecutionEnvironment.canUseDOM));
("production" !== "development" ? invariant(markup, 'dangerouslyReplaceNodeWithMarkup(...): Missing markup.') : invariant(markup));
("production" !== "development" ? invariant(
oldChild.tagName.toLowerCase() !== 'html',
'dangerouslyReplaceNodeWithMarkup(...): Cannot replace markup of the ' +
'<html> node. This is because browser quirks make this unreliable ' +
'and/or slow. If you want to render to the root you must use ' +
'server rendering. See renderComponentToString().'
) : invariant(oldChild.tagName.toLowerCase() !== 'html'));
var newChild = createNodesFromMarkup(markup, emptyFunction)[0];
oldChild.parentNode.replaceChild(newChild, oldChild);
}
};
module.exports = Danger;
},{"./ExecutionEnvironment":22,"./createNodesFromMarkup":113,"./emptyFunction":116,"./getMarkupWrap":126,"./invariant":134}],14:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule DefaultEventPluginOrder
*/
"use strict";
var keyOf = _dereq_("./keyOf");
/**
* Module that is injectable into `EventPluginHub`, that specifies a
* deterministic ordering of `EventPlugin`s. A convenient way to reason about
* plugins, without having to package every one of them. This is better than
* having plugins be ordered in the same order that they are injected because
* that ordering would be influenced by the packaging order.
* `ResponderEventPlugin` must occur before `SimpleEventPlugin` so that
* preventing default on events is convenient in `SimpleEventPlugin` handlers.
*/
var DefaultEventPluginOrder = [
keyOf({ResponderEventPlugin: null}),
keyOf({SimpleEventPlugin: null}),
keyOf({TapEventPlugin: null}),
keyOf({EnterLeaveEventPlugin: null}),
keyOf({ChangeEventPlugin: null}),
keyOf({SelectEventPlugin: null}),
keyOf({CompositionEventPlugin: null}),
keyOf({BeforeInputEventPlugin: null}),
keyOf({AnalyticsEventPlugin: null}),
keyOf({MobileSafariClickEventPlugin: null})
];
module.exports = DefaultEventPluginOrder;
},{"./keyOf":141}],15:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule EnterLeaveEventPlugin
* @typechecks static-only
*/
"use strict";
var EventConstants = _dereq_("./EventConstants");
var EventPropagators = _dereq_("./EventPropagators");
var SyntheticMouseEvent = _dereq_("./SyntheticMouseEvent");
var ReactMount = _dereq_("./ReactMount");
var keyOf = _dereq_("./keyOf");
var topLevelTypes = EventConstants.topLevelTypes;
var getFirstReactDOM = ReactMount.getFirstReactDOM;
var eventTypes = {
mouseEnter: {
registrationName: keyOf({onMouseEnter: null}),
dependencies: [
topLevelTypes.topMouseOut,
topLevelTypes.topMouseOver
]
},
mouseLeave: {
registrationName: keyOf({onMouseLeave: null}),
dependencies: [
topLevelTypes.topMouseOut,
topLevelTypes.topMouseOver
]
}
};
var extractedEvents = [null, null];
var EnterLeaveEventPlugin = {
eventTypes: eventTypes,
/**
* For almost every interaction we care about, there will be both a top-level
* `mouseover` and `mouseout` event that occurs. Only use `mouseout` so that
* we do not extract duplicate events. However, moving the mouse into the
* browser from outside will not fire a `mouseout` event. In this case, we use
* the `mouseover` top-level event.
*
* @param {string} topLevelType Record from `EventConstants`.
* @param {DOMEventTarget} topLevelTarget The listening component root node.
* @param {string} topLevelTargetID ID of `topLevelTarget`.
* @param {object} nativeEvent Native browser event.
* @return {*} An accumulation of synthetic events.
* @see {EventPluginHub.extractEvents}
*/
extractEvents: function(
topLevelType,
topLevelTarget,
topLevelTargetID,
nativeEvent) {
if (topLevelType === topLevelTypes.topMouseOver &&
(nativeEvent.relatedTarget || nativeEvent.fromElement)) {
return null;
}
if (topLevelType !== topLevelTypes.topMouseOut &&
topLevelType !== topLevelTypes.topMouseOver) {
// Must not be a mouse in or mouse out - ignoring.
return null;
}
var win;
if (topLevelTarget.window === topLevelTarget) {
// `topLevelTarget` is probably a window object.
win = topLevelTarget;
} else {
// TODO: Figure out why `ownerDocument` is sometimes undefined in IE8.
var doc = topLevelTarget.ownerDocument;
if (doc) {
win = doc.defaultView || doc.parentWindow;
} else {
win = window;
}
}
var from, to;
if (topLevelType === topLevelTypes.topMouseOut) {
from = topLevelTarget;
to =
getFirstReactDOM(nativeEvent.relatedTarget || nativeEvent.toElement) ||
win;
} else {
from = win;
to = topLevelTarget;
}
if (from === to) {
// Nothing pertains to our managed components.
return null;
}
var fromID = from ? ReactMount.getID(from) : '';
var toID = to ? ReactMount.getID(to) : '';
var leave = SyntheticMouseEvent.getPooled(
eventTypes.mouseLeave,
fromID,
nativeEvent
);
leave.type = 'mouseleave';
leave.target = from;
leave.relatedTarget = to;
var enter = SyntheticMouseEvent.getPooled(
eventTypes.mouseEnter,
toID,
nativeEvent
);
enter.type = 'mouseenter';
enter.target = to;
enter.relatedTarget = from;
EventPropagators.accumulateEnterLeaveDispatches(leave, enter, fromID, toID);
extractedEvents[0] = leave;
extractedEvents[1] = enter;
return extractedEvents;
}
};
module.exports = EnterLeaveEventPlugin;
},{"./EventConstants":16,"./EventPropagators":21,"./ReactMount":67,"./SyntheticMouseEvent":100,"./keyOf":141}],16:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule EventConstants
*/
"use strict";
var keyMirror = _dereq_("./keyMirror");
var PropagationPhases = keyMirror({bubbled: null, captured: null});
/**
* Types of raw signals from the browser caught at the top level.
*/
var topLevelTypes = keyMirror({
topBlur: null,
topChange: null,
topClick: null,
topCompositionEnd: null,
topCompositionStart: null,
topCompositionUpdate: null,
topContextMenu: null,
topCopy: null,
topCut: null,
topDoubleClick: null,
topDrag: null,
topDragEnd: null,
topDragEnter: null,
topDragExit: null,
topDragLeave: null,
topDragOver: null,
topDragStart: null,
topDrop: null,
topError: null,
topFocus: null,
topInput: null,
topKeyDown: null,
topKeyPress: null,
topKeyUp: null,
topLoad: null,
topMouseDown: null,
topMouseMove: null,
topMouseOut: null,
topMouseOver: null,
topMouseUp: null,
topPaste: null,
topReset: null,
topScroll: null,
topSelectionChange: null,
topSubmit: null,
topTextInput: null,
topTouchCancel: null,
topTouchEnd: null,
topTouchMove: null,
topTouchStart: null,
topWheel: null
});
var EventConstants = {
topLevelTypes: topLevelTypes,
PropagationPhases: PropagationPhases
};
module.exports = EventConstants;
},{"./keyMirror":140}],17:[function(_dereq_,module,exports){
/**
* @providesModule EventListener
* @typechecks
*/
var emptyFunction = _dereq_("./emptyFunction");
/**
* Upstream version of event listener. Does not take into account specific
* nature of platform.
*/
var EventListener = {
/**
* Listen to DOM events during the bubble phase.
*
* @param {DOMEventTarget} target DOM element to register listener on.
* @param {string} eventType Event type, e.g. 'click' or 'mouseover'.
* @param {function} callback Callback function.
* @return {object} Object with a `remove` method.
*/
listen: function(target, eventType, callback) {
if (target.addEventListener) {
target.addEventListener(eventType, callback, false);
return {
remove: function() {
target.removeEventListener(eventType, callback, false);
}
};
} else if (target.attachEvent) {
target.attachEvent('on' + eventType, callback);
return {
remove: function() {
target.detachEvent('on' + eventType, callback);
}
};
}
},
/**
* Listen to DOM events during the capture phase.
*
* @param {DOMEventTarget} target DOM element to register listener on.
* @param {string} eventType Event type, e.g. 'click' or 'mouseover'.
* @param {function} callback Callback function.
* @return {object} Object with a `remove` method.
*/
capture: function(target, eventType, callback) {
if (!target.addEventListener) {
if ("production" !== "development") {
console.error(
'Attempted to listen to events during the capture phase on a ' +
'browser that does not support the capture phase. Your application ' +
'will not receive some events.'
);
}
return {
remove: emptyFunction
};
} else {
target.addEventListener(eventType, callback, true);
return {
remove: function() {
target.removeEventListener(eventType, callback, true);
}
};
}
},
registerDefault: function() {}
};
module.exports = EventListener;
},{"./emptyFunction":116}],18:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule EventPluginHub
*/
"use strict";
var EventPluginRegistry = _dereq_("./EventPluginRegistry");
var EventPluginUtils = _dereq_("./EventPluginUtils");
var accumulate = _dereq_("./accumulate");
var forEachAccumulated = _dereq_("./forEachAccumulated");
var invariant = _dereq_("./invariant");
var isEventSupported = _dereq_("./isEventSupported");
var monitorCodeUse = _dereq_("./monitorCodeUse");
/**
* Internal store for event listeners
*/
var listenerBank = {};
/**
* Internal queue of events that have accumulated their dispatches and are
* waiting to have their dispatches executed.
*/
var eventQueue = null;
/**
* Dispatches an event and releases it back into the pool, unless persistent.
*
* @param {?object} event Synthetic event to be dispatched.
* @private
*/
var executeDispatchesAndRelease = function(event) {
if (event) {
var executeDispatch = EventPluginUtils.executeDispatch;
// Plugins can provide custom behavior when dispatching events.
var PluginModule = EventPluginRegistry.getPluginModuleForEvent(event);
if (PluginModule && PluginModule.executeDispatch) {
executeDispatch = PluginModule.executeDispatch;
}
EventPluginUtils.executeDispatchesInOrder(event, executeDispatch);
if (!event.isPersistent()) {
event.constructor.release(event);
}
}
};
/**
* - `InstanceHandle`: [required] Module that performs logical traversals of DOM
* hierarchy given ids of the logical DOM elements involved.
*/
var InstanceHandle = null;
function validateInstanceHandle() {
var invalid = !InstanceHandle||
!InstanceHandle.traverseTwoPhase ||
!InstanceHandle.traverseEnterLeave;
if (invalid) {
throw new Error('InstanceHandle not injected before use!');
}
}
/**
* This is a unified interface for event plugins to be installed and configured.
*
* Event plugins can implement the following properties:
*
* `extractEvents` {function(string, DOMEventTarget, string, object): *}
* Required. When a top-level event is fired, this method is expected to
* extract synthetic events that will in turn be queued and dispatched.
*
* `eventTypes` {object}
* Optional, plugins that fire events must publish a mapping of registration
* names that are used to register listeners. Values of this mapping must
* be objects that contain `registrationName` or `phasedRegistrationNames`.
*
* `executeDispatch` {function(object, function, string)}
* Optional, allows plugins to override how an event gets dispatched. By
* default, the listener is simply invoked.
*
* Each plugin that is injected into `EventsPluginHub` is immediately operable.
*
* @public
*/
var EventPluginHub = {
/**
* Methods for injecting dependencies.
*/
injection: {
/**
* @param {object} InjectedMount
* @public
*/
injectMount: EventPluginUtils.injection.injectMount,
/**
* @param {object} InjectedInstanceHandle
* @public
*/
injectInstanceHandle: function(InjectedInstanceHandle) {
InstanceHandle = InjectedInstanceHandle;
if ("production" !== "development") {
validateInstanceHandle();
}
},
getInstanceHandle: function() {
if ("production" !== "development") {
validateInstanceHandle();
}
return InstanceHandle;
},
/**
* @param {array} InjectedEventPluginOrder
* @public
*/
injectEventPluginOrder: EventPluginRegistry.injectEventPluginOrder,
/**
* @param {object} injectedNamesToPlugins Map from names to plugin modules.
*/
injectEventPluginsByName: EventPluginRegistry.injectEventPluginsByName
},
eventNameDispatchConfigs: EventPluginRegistry.eventNameDispatchConfigs,
registrationNameModules: EventPluginRegistry.registrationNameModules,
/**
* Stores `listener` at `listenerBank[registrationName][id]`. Is idempotent.
*
* @param {string} id ID of the DOM element.
* @param {string} registrationName Name of listener (e.g. `onClick`).
* @param {?function} listener The callback to store.
*/
putListener: function(id, registrationName, listener) {
("production" !== "development" ? invariant(
!listener || typeof listener === 'function',
'Expected %s listener to be a function, instead got type %s',
registrationName, typeof listener
) : invariant(!listener || typeof listener === 'function'));
if ("production" !== "development") {
// IE8 has no API for event capturing and the `onScroll` event doesn't
// bubble.
if (registrationName === 'onScroll' &&
!isEventSupported('scroll', true)) {
monitorCodeUse('react_no_scroll_event');
console.warn('This browser doesn\'t support the `onScroll` event');
}
}
var bankForRegistrationName =
listenerBank[registrationName] || (listenerBank[registrationName] = {});
bankForRegistrationName[id] = listener;
},
/**
* @param {string} id ID of the DOM element.
* @param {string} registrationName Name of listener (e.g. `onClick`).
* @return {?function} The stored callback.
*/
getListener: function(id, registrationName) {
var bankForRegistrationName = listenerBank[registrationName];
return bankForRegistrationName && bankForRegistrationName[id];
},
/**
* Deletes a listener from the registration bank.
*
* @param {string} id ID of the DOM element.
* @param {string} registrationName Name of listener (e.g. `onClick`).
*/
deleteListener: function(id, registrationName) {
var bankForRegistrationName = listenerBank[registrationName];
if (bankForRegistrationName) {
delete bankForRegistrationName[id];
}
},
/**
* Deletes all listeners for the DOM element with the supplied ID.
*
* @param {string} id ID of the DOM element.
*/
deleteAllListeners: function(id) {
for (var registrationName in listenerBank) {
delete listenerBank[registrationName][id];
}
},
/**
* Allows registered plugins an opportunity to extract events from top-level
* native browser events.
*
* @param {string} topLevelType Record from `EventConstants`.
* @param {DOMEventTarget} topLevelTarget The listening component root node.
* @param {string} topLevelTargetID ID of `topLevelTarget`.
* @param {object} nativeEvent Native browser event.
* @return {*} An accumulation of synthetic events.
* @internal
*/
extractEvents: function(
topLevelType,
topLevelTarget,
topLevelTargetID,
nativeEvent) {
var events;
var plugins = EventPluginRegistry.plugins;
for (var i = 0, l = plugins.length; i < l; i++) {
// Not every plugin in the ordering may be loaded at runtime.
var possiblePlugin = plugins[i];
if (possiblePlugin) {
var extractedEvents = possiblePlugin.extractEvents(
topLevelType,
topLevelTarget,
topLevelTargetID,
nativeEvent
);
if (extractedEvents) {
events = accumulate(events, extractedEvents);
}
}
}
return events;
},
/**
* Enqueues a synthetic event that should be dispatched when
* `processEventQueue` is invoked.
*
* @param {*} events An accumulation of synthetic events.
* @internal
*/
enqueueEvents: function(events) {
if (events) {
eventQueue = accumulate(eventQueue, events);
}
},
/**
* Dispatches all synthetic events on the event queue.
*
* @internal
*/
processEventQueue: function() {
// Set `eventQueue` to null before processing it so that we can tell if more
// events get enqueued while processing.
var processingEventQueue = eventQueue;
eventQueue = null;
forEachAccumulated(processingEventQueue, executeDispatchesAndRelease);
("production" !== "development" ? invariant(
!eventQueue,
'processEventQueue(): Additional events were enqueued while processing ' +
'an event queue. Support for this has not yet been implemented.'
) : invariant(!eventQueue));
},
/**
* These are needed for tests only. Do not use!
*/
__purge: function() {
listenerBank = {};
},
__getListenerBank: function() {
return listenerBank;
}
};
module.exports = EventPluginHub;
},{"./EventPluginRegistry":19,"./EventPluginUtils":20,"./accumulate":106,"./forEachAccumulated":121,"./invariant":134,"./isEventSupported":135,"./monitorCodeUse":148}],19:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule EventPluginRegistry
* @typechecks static-only
*/
"use strict";
var invariant = _dereq_("./invariant");
/**
* Injectable ordering of event plugins.
*/
var EventPluginOrder = null;
/**
* Injectable mapping from names to event plugin modules.
*/
var namesToPlugins = {};
/**
* Recomputes the plugin list using the injected plugins and plugin ordering.
*
* @private
*/
function recomputePluginOrdering() {
if (!EventPluginOrder) {
// Wait until an `EventPluginOrder` is injected.
return;
}
for (var pluginName in namesToPlugins) {
var PluginModule = namesToPlugins[pluginName];
var pluginIndex = EventPluginOrder.indexOf(pluginName);
("production" !== "development" ? invariant(
pluginIndex > -1,
'EventPluginRegistry: Cannot inject event plugins that do not exist in ' +
'the plugin ordering, `%s`.',
pluginName
) : invariant(pluginIndex > -1));
if (EventPluginRegistry.plugins[pluginIndex]) {
continue;
}
("production" !== "development" ? invariant(
PluginModule.extractEvents,
'EventPluginRegistry: Event plugins must implement an `extractEvents` ' +
'method, but `%s` does not.',
pluginName
) : invariant(PluginModule.extractEvents));
EventPluginRegistry.plugins[pluginIndex] = PluginModule;
var publishedEvents = PluginModule.eventTypes;
for (var eventName in publishedEvents) {
("production" !== "development" ? invariant(
publishEventForPlugin(
publishedEvents[eventName],
PluginModule,
eventName
),
'EventPluginRegistry: Failed to publish event `%s` for plugin `%s`.',
eventName,
pluginName
) : invariant(publishEventForPlugin(
publishedEvents[eventName],
PluginModule,
eventName
)));
}
}
}
/**
* Publishes an event so that it can be dispatched by the supplied plugin.
*
* @param {object} dispatchConfig Dispatch configuration for the event.
* @param {object} PluginModule Plugin publishing the event.
* @return {boolean} True if the event was successfully published.
* @private
*/
function publishEventForPlugin(dispatchConfig, PluginModule, eventName) {
("production" !== "development" ? invariant(
!EventPluginRegistry.eventNameDispatchConfigs.hasOwnProperty(eventName),
'EventPluginHub: More than one plugin attempted to publish the same ' +
'event name, `%s`.',
eventName
) : invariant(!EventPluginRegistry.eventNameDispatchConfigs.hasOwnProperty(eventName)));
EventPluginRegistry.eventNameDispatchConfigs[eventName] = dispatchConfig;
var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames;
if (phasedRegistrationNames) {
for (var phaseName in phasedRegistrationNames) {
if (phasedRegistrationNames.hasOwnProperty(phaseName)) {
var phasedRegistrationName = phasedRegistrationNames[phaseName];
publishRegistrationName(
phasedRegistrationName,
PluginModule,
eventName
);
}
}
return true;
} else if (dispatchConfig.registrationName) {
publishRegistrationName(
dispatchConfig.registrationName,
PluginModule,
eventName
);
return true;
}
return false;
}
/**
* Publishes a registration name that is used to identify dispatched events and
* can be used with `EventPluginHub.putListener` to register listeners.
*
* @param {string} registrationName Registration name to add.
* @param {object} PluginModule Plugin publishing the event.
* @private
*/
function publishRegistrationName(registrationName, PluginModule, eventName) {
("production" !== "development" ? invariant(
!EventPluginRegistry.registrationNameModules[registrationName],
'EventPluginHub: More than one plugin attempted to publish the same ' +
'registration name, `%s`.',
registrationName
) : invariant(!EventPluginRegistry.registrationNameModules[registrationName]));
EventPluginRegistry.registrationNameModules[registrationName] = PluginModule;
EventPluginRegistry.registrationNameDependencies[registrationName] =
PluginModule.eventTypes[eventName].dependencies;
}
/**
* Registers plugins so that they can extract and dispatch events.
*
* @see {EventPluginHub}
*/
var EventPluginRegistry = {
/**
* Ordered list of injected plugins.
*/
plugins: [],
/**
* Mapping from event name to dispatch config
*/
eventNameDispatchConfigs: {},
/**
* Mapping from registration name to plugin module
*/
registrationNameModules: {},
/**
* Mapping from registration name to event name
*/
registrationNameDependencies: {},
/**
* Injects an ordering of plugins (by plugin name). This allows the ordering
* to be decoupled from injection of the actual plugins so that ordering is
* always deterministic regardless of packaging, on-the-fly injection, etc.
*
* @param {array} InjectedEventPluginOrder
* @internal
* @see {EventPluginHub.injection.injectEventPluginOrder}
*/
injectEventPluginOrder: function(InjectedEventPluginOrder) {
("production" !== "development" ? invariant(
!EventPluginOrder,
'EventPluginRegistry: Cannot inject event plugin ordering more than ' +
'once. You are likely trying to load more than one copy of React.'
) : invariant(!EventPluginOrder));
// Clone the ordering so it cannot be dynamically mutated.
EventPluginOrder = Array.prototype.slice.call(InjectedEventPluginOrder);
recomputePluginOrdering();
},
/**
* Injects plugins to be used by `EventPluginHub`. The plugin names must be
* in the ordering injected by `injectEventPluginOrder`.
*
* Plugins can be injected as part of page initialization or on-the-fly.
*
* @param {object} injectedNamesToPlugins Map from names to plugin modules.
* @internal
* @see {EventPluginHub.injection.injectEventPluginsByName}
*/
injectEventPluginsByName: function(injectedNamesToPlugins) {
var isOrderingDirty = false;
for (var pluginName in injectedNamesToPlugins) {
if (!injectedNamesToPlugins.hasOwnProperty(pluginName)) {
continue;
}
var PluginModule = injectedNamesToPlugins[pluginName];
if (!namesToPlugins.hasOwnProperty(pluginName) ||
namesToPlugins[pluginName] !== PluginModule) {
("production" !== "development" ? invariant(
!namesToPlugins[pluginName],
'EventPluginRegistry: Cannot inject two different event plugins ' +
'using the same name, `%s`.',
pluginName
) : invariant(!namesToPlugins[pluginName]));
namesToPlugins[pluginName] = PluginModule;
isOrderingDirty = true;
}
}
if (isOrderingDirty) {
recomputePluginOrdering();
}
},
/**
* Looks up the plugin for the supplied event.
*
* @param {object} event A synthetic event.
* @return {?object} The plugin that created the supplied event.
* @internal
*/
getPluginModuleForEvent: function(event) {
var dispatchConfig = event.dispatchConfig;
if (dispatchConfig.registrationName) {
return EventPluginRegistry.registrationNameModules[
dispatchConfig.registrationName
] || null;
}
for (var phase in dispatchConfig.phasedRegistrationNames) {
if (!dispatchConfig.phasedRegistrationNames.hasOwnProperty(phase)) {
continue;
}
var PluginModule = EventPluginRegistry.registrationNameModules[
dispatchConfig.phasedRegistrationNames[phase]
];
if (PluginModule) {
return PluginModule;
}
}
return null;
},
/**
* Exposed for unit testing.
* @private
*/
_resetEventPlugins: function() {
EventPluginOrder = null;
for (var pluginName in namesToPlugins) {
if (namesToPlugins.hasOwnProperty(pluginName)) {
delete namesToPlugins[pluginName];
}
}
EventPluginRegistry.plugins.length = 0;
var eventNameDispatchConfigs = EventPluginRegistry.eventNameDispatchConfigs;
for (var eventName in eventNameDispatchConfigs) {
if (eventNameDispatchConfigs.hasOwnProperty(eventName)) {
delete eventNameDispatchConfigs[eventName];
}
}
var registrationNameModules = EventPluginRegistry.registrationNameModules;
for (var registrationName in registrationNameModules) {
if (registrationNameModules.hasOwnProperty(registrationName)) {
delete registrationNameModules[registrationName];
}
}
}
};
module.exports = EventPluginRegistry;
},{"./invariant":134}],20:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule EventPluginUtils
*/
"use strict";
var EventConstants = _dereq_("./EventConstants");
var invariant = _dereq_("./invariant");
/**
* Injected dependencies:
*/
/**
* - `Mount`: [required] Module that can convert between React dom IDs and
* actual node references.
*/
var injection = {
Mount: null,
injectMount: function(InjectedMount) {
injection.Mount = InjectedMount;
if ("production" !== "development") {
("production" !== "development" ? invariant(
InjectedMount && InjectedMount.getNode,
'EventPluginUtils.injection.injectMount(...): Injected Mount module ' +
'is missing getNode.'
) : invariant(InjectedMount && InjectedMount.getNode));
}
}
};
var topLevelTypes = EventConstants.topLevelTypes;
function isEndish(topLevelType) {
return topLevelType === topLevelTypes.topMouseUp ||
topLevelType === topLevelTypes.topTouchEnd ||
topLevelType === topLevelTypes.topTouchCancel;
}
function isMoveish(topLevelType) {
return topLevelType === topLevelTypes.topMouseMove ||
topLevelType === topLevelTypes.topTouchMove;
}
function isStartish(topLevelType) {
return topLevelType === topLevelTypes.topMouseDown ||
topLevelType === topLevelTypes.topTouchStart;
}
var validateEventDispatches;
if ("production" !== "development") {
validateEventDispatches = function(event) {
var dispatchListeners = event._dispatchListeners;
var dispatchIDs = event._dispatchIDs;
var listenersIsArr = Array.isArray(dispatchListeners);
var idsIsArr = Array.isArray(dispatchIDs);
var IDsLen = idsIsArr ? dispatchIDs.length : dispatchIDs ? 1 : 0;
var listenersLen = listenersIsArr ?
dispatchListeners.length :
dispatchListeners ? 1 : 0;
("production" !== "development" ? invariant(
idsIsArr === listenersIsArr && IDsLen === listenersLen,
'EventPluginUtils: Invalid `event`.'
) : invariant(idsIsArr === listenersIsArr && IDsLen === listenersLen));
};
}
/**
* Invokes `cb(event, listener, id)`. Avoids using call if no scope is
* provided. The `(listener,id)` pair effectively forms the "dispatch" but are
* kept separate to conserve memory.
*/
function forEachEventDispatch(event, cb) {
var dispatchListeners = event._dispatchListeners;
var dispatchIDs = event._dispatchIDs;
if ("production" !== "development") {
validateEventDispatches(event);
}
if (Array.isArray(dispatchListeners)) {
for (var i = 0; i < dispatchListeners.length; i++) {
if (event.isPropagationStopped()) {
break;
}
// Listeners and IDs are two parallel arrays that are always in sync.
cb(event, dispatchListeners[i], dispatchIDs[i]);
}
} else if (dispatchListeners) {
cb(event, dispatchListeners, dispatchIDs);
}
}
/**
* Default implementation of PluginModule.executeDispatch().
* @param {SyntheticEvent} SyntheticEvent to handle
* @param {function} Application-level callback
* @param {string} domID DOM id to pass to the callback.
*/
function executeDispatch(event, listener, domID) {
event.currentTarget = injection.Mount.getNode(domID);
var returnValue = listener(event, domID);
event.currentTarget = null;
return returnValue;
}
/**
* Standard/simple iteration through an event's collected dispatches.
*/
function executeDispatchesInOrder(event, executeDispatch) {
forEachEventDispatch(event, executeDispatch);
event._dispatchListeners = null;
event._dispatchIDs = null;
}
/**
* Standard/simple iteration through an event's collected dispatches, but stops
* at the first dispatch execution returning true, and returns that id.
*
* @return id of the first dispatch execution who's listener returns true, or
* null if no listener returned true.
*/
function executeDispatchesInOrderStopAtTrueImpl(event) {
var dispatchListeners = event._dispatchListeners;
var dispatchIDs = event._dispatchIDs;
if ("production" !== "development") {
validateEventDispatches(event);
}
if (Array.isArray(dispatchListeners)) {
for (var i = 0; i < dispatchListeners.length; i++) {
if (event.isPropagationStopped()) {
break;
}
// Listeners and IDs are two parallel arrays that are always in sync.
if (dispatchListeners[i](event, dispatchIDs[i])) {
return dispatchIDs[i];
}
}
} else if (dispatchListeners) {
if (dispatchListeners(event, dispatchIDs)) {
return dispatchIDs;
}
}
return null;
}
/**
* @see executeDispatchesInOrderStopAtTrueImpl
*/
function executeDispatchesInOrderStopAtTrue(event) {
var ret = executeDispatchesInOrderStopAtTrueImpl(event);
event._dispatchIDs = null;
event._dispatchListeners = null;
return ret;
}
/**
* Execution of a "direct" dispatch - there must be at most one dispatch
* accumulated on the event or it is considered an error. It doesn't really make
* sense for an event with multiple dispatches (bubbled) to keep track of the
* return values at each dispatch execution, but it does tend to make sense when
* dealing with "direct" dispatches.
*
* @return The return value of executing the single dispatch.
*/
function executeDirectDispatch(event) {
if ("production" !== "development") {
validateEventDispatches(event);
}
var dispatchListener = event._dispatchListeners;
var dispatchID = event._dispatchIDs;
("production" !== "development" ? invariant(
!Array.isArray(dispatchListener),
'executeDirectDispatch(...): Invalid `event`.'
) : invariant(!Array.isArray(dispatchListener)));
var res = dispatchListener ?
dispatchListener(event, dispatchID) :
null;
event._dispatchListeners = null;
event._dispatchIDs = null;
return res;
}
/**
* @param {SyntheticEvent} event
* @return {bool} True iff number of dispatches accumulated is greater than 0.
*/
function hasDispatches(event) {
return !!event._dispatchListeners;
}
/**
* General utilities that are useful in creating custom Event Plugins.
*/
var EventPluginUtils = {
isEndish: isEndish,
isMoveish: isMoveish,
isStartish: isStartish,
executeDirectDispatch: executeDirectDispatch,
executeDispatch: executeDispatch,
executeDispatchesInOrder: executeDispatchesInOrder,
executeDispatchesInOrderStopAtTrue: executeDispatchesInOrderStopAtTrue,
hasDispatches: hasDispatches,
injection: injection,
useTouchEvents: false
};
module.exports = EventPluginUtils;
},{"./EventConstants":16,"./invariant":134}],21:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule EventPropagators
*/
"use strict";
var EventConstants = _dereq_("./EventConstants");
var EventPluginHub = _dereq_("./EventPluginHub");
var accumulate = _dereq_("./accumulate");
var forEachAccumulated = _dereq_("./forEachAccumulated");
var PropagationPhases = EventConstants.PropagationPhases;
var getListener = EventPluginHub.getListener;
/**
* Some event types have a notion of different registration names for different
* "phases" of propagation. This finds listeners by a given phase.
*/
function listenerAtPhase(id, event, propagationPhase) {
var registrationName =
event.dispatchConfig.phasedRegistrationNames[propagationPhase];
return getListener(id, registrationName);
}
/**
* Tags a `SyntheticEvent` with dispatched listeners. Creating this function
* here, allows us to not have to bind or create functions for each event.
* Mutating the event's members allows us to not have to create a wrapping
* "dispatch" object that pairs the event with the listener.
*/
function accumulateDirectionalDispatches(domID, upwards, event) {
if ("production" !== "development") {
if (!domID) {
throw new Error('Dispatching id must not be null');
}
}
var phase = upwards ? PropagationPhases.bubbled : PropagationPhases.captured;
var listener = listenerAtPhase(domID, event, phase);
if (listener) {
event._dispatchListeners = accumulate(event._dispatchListeners, listener);
event._dispatchIDs = accumulate(event._dispatchIDs, domID);
}
}
/**
* Collect dispatches (must be entirely collected before dispatching - see unit
* tests). Lazily allocate the array to conserve memory. We must loop through
* each event and perform the traversal for each one. We can not perform a
* single traversal for the entire collection of events because each event may
* have a different target.
*/
function accumulateTwoPhaseDispatchesSingle(event) {
if (event && event.dispatchConfig.phasedRegistrationNames) {
EventPluginHub.injection.getInstanceHandle().traverseTwoPhase(
event.dispatchMarker,
accumulateDirectionalDispatches,
event
);
}
}
/**
* Accumulates without regard to direction, does not look for phased
* registration names. Same as `accumulateDirectDispatchesSingle` but without
* requiring that the `dispatchMarker` be the same as the dispatched ID.
*/
function accumulateDispatches(id, ignoredDirection, event) {
if (event && event.dispatchConfig.registrationName) {
var registrationName = event.dispatchConfig.registrationName;
var listener = getListener(id, registrationName);
if (listener) {
event._dispatchListeners = accumulate(event._dispatchListeners, listener);
event._dispatchIDs = accumulate(event._dispatchIDs, id);
}
}
}
/**
* Accumulates dispatches on an `SyntheticEvent`, but only for the
* `dispatchMarker`.
* @param {SyntheticEvent} event
*/
function accumulateDirectDispatchesSingle(event) {
if (event && event.dispatchConfig.registrationName) {
accumulateDispatches(event.dispatchMarker, null, event);
}
}
function accumulateTwoPhaseDispatches(events) {
forEachAccumulated(events, accumulateTwoPhaseDispatchesSingle);
}
function accumulateEnterLeaveDispatches(leave, enter, fromID, toID) {
EventPluginHub.injection.getInstanceHandle().traverseEnterLeave(
fromID,
toID,
accumulateDispatches,
leave,
enter
);
}
function accumulateDirectDispatches(events) {
forEachAccumulated(events, accumulateDirectDispatchesSingle);
}
/**
* A small set of propagation patterns, each of which will accept a small amount
* of information, and generate a set of "dispatch ready event objects" - which
* are sets of events that have already been annotated with a set of dispatched
* listener functions/ids. The API is designed this way to discourage these
* propagation strategies from actually executing the dispatches, since we
* always want to collect the entire set of dispatches before executing event a
* single one.
*
* @constructor EventPropagators
*/
var EventPropagators = {
accumulateTwoPhaseDispatches: accumulateTwoPhaseDispatches,
accumulateDirectDispatches: accumulateDirectDispatches,
accumulateEnterLeaveDispatches: accumulateEnterLeaveDispatches
};
module.exports = EventPropagators;
},{"./EventConstants":16,"./EventPluginHub":18,"./accumulate":106,"./forEachAccumulated":121}],22:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ExecutionEnvironment
*/
/*jslint evil: true */
"use strict";
var canUseDOM = !!(
typeof window !== 'undefined' &&
window.document &&
window.document.createElement
);
/**
* Simple, lightweight module assisting with the detection and context of
* Worker. Helps avoid circular dependencies and allows code to reason about
* whether or not they are in a Worker, even if they never include the main
* `ReactWorker` dependency.
*/
var ExecutionEnvironment = {
canUseDOM: canUseDOM,
canUseWorkers: typeof Worker !== 'undefined',
canUseEventListeners:
canUseDOM && !!(window.addEventListener || window.attachEvent),
canUseViewport: canUseDOM && !!window.screen,
isInWorker: !canUseDOM // For now, this is true - might change in the future.
};
module.exports = ExecutionEnvironment;
},{}],23:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule HTMLDOMPropertyConfig
*/
/*jslint bitwise: true*/
"use strict";
var DOMProperty = _dereq_("./DOMProperty");
var ExecutionEnvironment = _dereq_("./ExecutionEnvironment");
var MUST_USE_ATTRIBUTE = DOMProperty.injection.MUST_USE_ATTRIBUTE;
var MUST_USE_PROPERTY = DOMProperty.injection.MUST_USE_PROPERTY;
var HAS_BOOLEAN_VALUE = DOMProperty.injection.HAS_BOOLEAN_VALUE;
var HAS_SIDE_EFFECTS = DOMProperty.injection.HAS_SIDE_EFFECTS;
var HAS_NUMERIC_VALUE = DOMProperty.injection.HAS_NUMERIC_VALUE;
var HAS_POSITIVE_NUMERIC_VALUE =
DOMProperty.injection.HAS_POSITIVE_NUMERIC_VALUE;
var HAS_OVERLOADED_BOOLEAN_VALUE =
DOMProperty.injection.HAS_OVERLOADED_BOOLEAN_VALUE;
var hasSVG;
if (ExecutionEnvironment.canUseDOM) {
var implementation = document.implementation;
hasSVG = (
implementation &&
implementation.hasFeature &&
implementation.hasFeature(
'http://www.w3.org/TR/SVG11/feature#BasicStructure',
'1.1'
)
);
}
var HTMLDOMPropertyConfig = {
isCustomAttribute: RegExp.prototype.test.bind(
/^(data|aria)-[a-z_][a-z\d_.\-]*$/
),
Properties: {
/**
* Standard Properties
*/
accept: null,
accessKey: null,
action: null,
allowFullScreen: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
allowTransparency: MUST_USE_ATTRIBUTE,
alt: null,
async: HAS_BOOLEAN_VALUE,
autoComplete: null,
// autoFocus is polyfilled/normalized by AutoFocusMixin
// autoFocus: HAS_BOOLEAN_VALUE,
autoPlay: HAS_BOOLEAN_VALUE,
cellPadding: null,
cellSpacing: null,
charSet: MUST_USE_ATTRIBUTE,
checked: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
// To set className on SVG elements, it's necessary to use .setAttribute;
// this works on HTML elements too in all browsers except IE8. Conveniently,
// IE8 doesn't support SVG and so we can simply use the attribute in
// browsers that support SVG and the property in browsers that don't,
// regardless of whether the element is HTML or SVG.
className: hasSVG ? MUST_USE_ATTRIBUTE : MUST_USE_PROPERTY,
cols: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE,
colSpan: null,
content: null,
contentEditable: null,
contextMenu: MUST_USE_ATTRIBUTE,
controls: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
coords: null,
crossOrigin: null,
data: null, // For `<object />` acts as `src`.
dateTime: MUST_USE_ATTRIBUTE,
defer: HAS_BOOLEAN_VALUE,
dir: null,
disabled: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
download: HAS_OVERLOADED_BOOLEAN_VALUE,
draggable: null,
encType: null,
form: MUST_USE_ATTRIBUTE,
formNoValidate: HAS_BOOLEAN_VALUE,
frameBorder: MUST_USE_ATTRIBUTE,
height: MUST_USE_ATTRIBUTE,
hidden: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
href: null,
hrefLang: null,
htmlFor: null,
httpEquiv: null,
icon: null,
id: MUST_USE_PROPERTY,
label: null,
lang: null,
list: null,
loop: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
max: null,
maxLength: MUST_USE_ATTRIBUTE,
mediaGroup: null,
method: null,
min: null,
multiple: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
muted: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
name: null,
noValidate: HAS_BOOLEAN_VALUE,
pattern: null,
placeholder: null,
poster: null,
preload: null,
radioGroup: null,
readOnly: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
rel: null,
required: HAS_BOOLEAN_VALUE,
role: MUST_USE_ATTRIBUTE,
rows: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE,
rowSpan: null,
sandbox: null,
scope: null,
scrollLeft: MUST_USE_PROPERTY,
scrolling: null,
scrollTop: MUST_USE_PROPERTY,
seamless: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
selected: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
shape: null,
size: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE,
span: HAS_POSITIVE_NUMERIC_VALUE,
spellCheck: null,
src: null,
srcDoc: MUST_USE_PROPERTY,
srcSet: null,
start: HAS_NUMERIC_VALUE,
step: null,
style: null,
tabIndex: null,
target: null,
title: null,
type: null,
useMap: null,
value: MUST_USE_PROPERTY | HAS_SIDE_EFFECTS,
width: MUST_USE_ATTRIBUTE,
wmode: MUST_USE_ATTRIBUTE,
/**
* Non-standard Properties
*/
autoCapitalize: null, // Supported in Mobile Safari for keyboard hints
autoCorrect: null, // Supported in Mobile Safari for keyboard hints
itemProp: MUST_USE_ATTRIBUTE, // Microdata: http://schema.org/docs/gs.html
itemScope: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE, // Microdata: http://schema.org/docs/gs.html
itemType: MUST_USE_ATTRIBUTE, // Microdata: http://schema.org/docs/gs.html
property: null // Supports OG in meta tags
},
DOMAttributeNames: {
className: 'class',
htmlFor: 'for',
httpEquiv: 'http-equiv'
},
DOMPropertyNames: {
autoCapitalize: 'autocapitalize',
autoComplete: 'autocomplete',
autoCorrect: 'autocorrect',
autoFocus: 'autofocus',
autoPlay: 'autoplay',
encType: 'enctype',
hrefLang: 'hreflang',
radioGroup: 'radiogroup',
spellCheck: 'spellcheck',
srcDoc: 'srcdoc',
srcSet: 'srcset'
}
};
module.exports = HTMLDOMPropertyConfig;
},{"./DOMProperty":11,"./ExecutionEnvironment":22}],24:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule LinkedStateMixin
* @typechecks static-only
*/
"use strict";
var ReactLink = _dereq_("./ReactLink");
var ReactStateSetters = _dereq_("./ReactStateSetters");
/**
* A simple mixin around ReactLink.forState().
*/
var LinkedStateMixin = {
/**
* Create a ReactLink that's linked to part of this component's state. The
* ReactLink will have the current value of this.state[key] and will call
* setState() when a change is requested.
*
* @param {string} key state key to update. Note: you may want to use keyOf()
* if you're using Google Closure Compiler advanced mode.
* @return {ReactLink} ReactLink instance linking to the state.
*/
linkState: function(key) {
return new ReactLink(
this.state[key],
ReactStateSetters.createStateKeySetter(this, key)
);
}
};
module.exports = LinkedStateMixin;
},{"./ReactLink":65,"./ReactStateSetters":81}],25:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule LinkedValueUtils
* @typechecks static-only
*/
"use strict";
var ReactPropTypes = _dereq_("./ReactPropTypes");
var invariant = _dereq_("./invariant");
var hasReadOnlyValue = {
'button': true,
'checkbox': true,
'image': true,
'hidden': true,
'radio': true,
'reset': true,
'submit': true
};
function _assertSingleLink(input) {
("production" !== "development" ? invariant(
input.props.checkedLink == null || input.props.valueLink == null,
'Cannot provide a checkedLink and a valueLink. If you want to use ' +
'checkedLink, you probably don\'t want to use valueLink and vice versa.'
) : invariant(input.props.checkedLink == null || input.props.valueLink == null));
}
function _assertValueLink(input) {
_assertSingleLink(input);
("production" !== "development" ? invariant(
input.props.value == null && input.props.onChange == null,
'Cannot provide a valueLink and a value or onChange event. If you want ' +
'to use value or onChange, you probably don\'t want to use valueLink.'
) : invariant(input.props.value == null && input.props.onChange == null));
}
function _assertCheckedLink(input) {
_assertSingleLink(input);
("production" !== "development" ? invariant(
input.props.checked == null && input.props.onChange == null,
'Cannot provide a checkedLink and a checked property or onChange event. ' +
'If you want to use checked or onChange, you probably don\'t want to ' +
'use checkedLink'
) : invariant(input.props.checked == null && input.props.onChange == null));
}
/**
* @param {SyntheticEvent} e change event to handle
*/
function _handleLinkedValueChange(e) {
/*jshint validthis:true */
this.props.valueLink.requestChange(e.target.value);
}
/**
* @param {SyntheticEvent} e change event to handle
*/
function _handleLinkedCheckChange(e) {
/*jshint validthis:true */
this.props.checkedLink.requestChange(e.target.checked);
}
/**
* Provide a linked `value` attribute for controlled forms. You should not use
* this outside of the ReactDOM controlled form components.
*/
var LinkedValueUtils = {
Mixin: {
propTypes: {
value: function(props, propName, componentName) {
if (!props[propName] ||
hasReadOnlyValue[props.type] ||
props.onChange ||
props.readOnly ||
props.disabled) {
return;
}
return new Error(
'You provided a `value` prop to a form field without an ' +
'`onChange` handler. This will render a read-only field. If ' +
'the field should be mutable use `defaultValue`. Otherwise, ' +
'set either `onChange` or `readOnly`.'
);
},
checked: function(props, propName, componentName) {
if (!props[propName] ||
props.onChange ||
props.readOnly ||
props.disabled) {
return;
}
return new Error(
'You provided a `checked` prop to a form field without an ' +
'`onChange` handler. This will render a read-only field. If ' +
'the field should be mutable use `defaultChecked`. Otherwise, ' +
'set either `onChange` or `readOnly`.'
);
},
onChange: ReactPropTypes.func
}
},
/**
* @param {ReactComponent} input Form component
* @return {*} current value of the input either from value prop or link.
*/
getValue: function(input) {
if (input.props.valueLink) {
_assertValueLink(input);
return input.props.valueLink.value;
}
return input.props.value;
},
/**
* @param {ReactComponent} input Form component
* @return {*} current checked status of the input either from checked prop
* or link.
*/
getChecked: function(input) {
if (input.props.checkedLink) {
_assertCheckedLink(input);
return input.props.checkedLink.value;
}
return input.props.checked;
},
/**
* @param {ReactComponent} input Form component
* @return {function} change callback either from onChange prop or link.
*/
getOnChange: function(input) {
if (input.props.valueLink) {
_assertValueLink(input);
return _handleLinkedValueChange;
} else if (input.props.checkedLink) {
_assertCheckedLink(input);
return _handleLinkedCheckChange;
}
return input.props.onChange;
}
};
module.exports = LinkedValueUtils;
},{"./ReactPropTypes":75,"./invariant":134}],26:[function(_dereq_,module,exports){
/**
* Copyright 2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule LocalEventTrapMixin
*/
"use strict";
var ReactBrowserEventEmitter = _dereq_("./ReactBrowserEventEmitter");
var accumulate = _dereq_("./accumulate");
var forEachAccumulated = _dereq_("./forEachAccumulated");
var invariant = _dereq_("./invariant");
function remove(event) {
event.remove();
}
var LocalEventTrapMixin = {
trapBubbledEvent:function(topLevelType, handlerBaseName) {
("production" !== "development" ? invariant(this.isMounted(), 'Must be mounted to trap events') : invariant(this.isMounted()));
var listener = ReactBrowserEventEmitter.trapBubbledEvent(
topLevelType,
handlerBaseName,
this.getDOMNode()
);
this._localEventListeners = accumulate(this._localEventListeners, listener);
},
// trapCapturedEvent would look nearly identical. We don't implement that
// method because it isn't currently needed.
componentWillUnmount:function() {
if (this._localEventListeners) {
forEachAccumulated(this._localEventListeners, remove);
}
}
};
module.exports = LocalEventTrapMixin;
},{"./ReactBrowserEventEmitter":31,"./accumulate":106,"./forEachAccumulated":121,"./invariant":134}],27:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule MobileSafariClickEventPlugin
* @typechecks static-only
*/
"use strict";
var EventConstants = _dereq_("./EventConstants");
var emptyFunction = _dereq_("./emptyFunction");
var topLevelTypes = EventConstants.topLevelTypes;
/**
* Mobile Safari does not fire properly bubble click events on non-interactive
* elements, which means delegated click listeners do not fire. The workaround
* for this bug involves attaching an empty click listener on the target node.
*
* This particular plugin works around the bug by attaching an empty click
* listener on `touchstart` (which does fire on every element).
*/
var MobileSafariClickEventPlugin = {
eventTypes: null,
/**
* @param {string} topLevelType Record from `EventConstants`.
* @param {DOMEventTarget} topLevelTarget The listening component root node.
* @param {string} topLevelTargetID ID of `topLevelTarget`.
* @param {object} nativeEvent Native browser event.
* @return {*} An accumulation of synthetic events.
* @see {EventPluginHub.extractEvents}
*/
extractEvents: function(
topLevelType,
topLevelTarget,
topLevelTargetID,
nativeEvent) {
if (topLevelType === topLevelTypes.topTouchStart) {
var target = nativeEvent.target;
if (target && !target.onclick) {
target.onclick = emptyFunction;
}
}
}
};
module.exports = MobileSafariClickEventPlugin;
},{"./EventConstants":16,"./emptyFunction":116}],28:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule PooledClass
*/
"use strict";
var invariant = _dereq_("./invariant");
/**
* Static poolers. Several custom versions for each potential number of
* arguments. A completely generic pooler is easy to implement, but would
* require accessing the `arguments` object. In each of these, `this` refers to
* the Class itself, not an instance. If any others are needed, simply add them
* here, or in their own files.
*/
var oneArgumentPooler = function(copyFieldsFrom) {
var Klass = this;
if (Klass.instancePool.length) {
var instance = Klass.instancePool.pop();
Klass.call(instance, copyFieldsFrom);
return instance;
} else {
return new Klass(copyFieldsFrom);
}
};
var twoArgumentPooler = function(a1, a2) {
var Klass = this;
if (Klass.instancePool.length) {
var instance = Klass.instancePool.pop();
Klass.call(instance, a1, a2);
return instance;
} else {
return new Klass(a1, a2);
}
};
var threeArgumentPooler = function(a1, a2, a3) {
var Klass = this;
if (Klass.instancePool.length) {
var instance = Klass.instancePool.pop();
Klass.call(instance, a1, a2, a3);
return instance;
} else {
return new Klass(a1, a2, a3);
}
};
var fiveArgumentPooler = function(a1, a2, a3, a4, a5) {
var Klass = this;
if (Klass.instancePool.length) {
var instance = Klass.instancePool.pop();
Klass.call(instance, a1, a2, a3, a4, a5);
return instance;
} else {
return new Klass(a1, a2, a3, a4, a5);
}
};
var standardReleaser = function(instance) {
var Klass = this;
("production" !== "development" ? invariant(
instance instanceof Klass,
'Trying to release an instance into a pool of a different type.'
) : invariant(instance instanceof Klass));
if (instance.destructor) {
instance.destructor();
}
if (Klass.instancePool.length < Klass.poolSize) {
Klass.instancePool.push(instance);
}
};
var DEFAULT_POOL_SIZE = 10;
var DEFAULT_POOLER = oneArgumentPooler;
/**
* Augments `CopyConstructor` to be a poolable class, augmenting only the class
* itself (statically) not adding any prototypical fields. Any CopyConstructor
* you give this may have a `poolSize` property, and will look for a
* prototypical `destructor` on instances (optional).
*
* @param {Function} CopyConstructor Constructor that can be used to reset.
* @param {Function} pooler Customizable pooler.
*/
var addPoolingTo = function(CopyConstructor, pooler) {
var NewKlass = CopyConstructor;
NewKlass.instancePool = [];
NewKlass.getPooled = pooler || DEFAULT_POOLER;
if (!NewKlass.poolSize) {
NewKlass.poolSize = DEFAULT_POOL_SIZE;
}
NewKlass.release = standardReleaser;
return NewKlass;
};
var PooledClass = {
addPoolingTo: addPoolingTo,
oneArgumentPooler: oneArgumentPooler,
twoArgumentPooler: twoArgumentPooler,
threeArgumentPooler: threeArgumentPooler,
fiveArgumentPooler: fiveArgumentPooler
};
module.exports = PooledClass;
},{"./invariant":134}],29:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule React
*/
"use strict";
var DOMPropertyOperations = _dereq_("./DOMPropertyOperations");
var EventPluginUtils = _dereq_("./EventPluginUtils");
var ReactChildren = _dereq_("./ReactChildren");
var ReactComponent = _dereq_("./ReactComponent");
var ReactCompositeComponent = _dereq_("./ReactCompositeComponent");
var ReactContext = _dereq_("./ReactContext");
var ReactCurrentOwner = _dereq_("./ReactCurrentOwner");
var ReactDescriptor = _dereq_("./ReactDescriptor");
var ReactDOM = _dereq_("./ReactDOM");
var ReactDOMComponent = _dereq_("./ReactDOMComponent");
var ReactDefaultInjection = _dereq_("./ReactDefaultInjection");
var ReactInstanceHandles = _dereq_("./ReactInstanceHandles");
var ReactMount = _dereq_("./ReactMount");
var ReactMultiChild = _dereq_("./ReactMultiChild");
var ReactPerf = _dereq_("./ReactPerf");
var ReactPropTypes = _dereq_("./ReactPropTypes");
var ReactServerRendering = _dereq_("./ReactServerRendering");
var ReactTextComponent = _dereq_("./ReactTextComponent");
var onlyChild = _dereq_("./onlyChild");
ReactDefaultInjection.inject();
var React = {
Children: {
map: ReactChildren.map,
forEach: ReactChildren.forEach,
count: ReactChildren.count,
only: onlyChild
},
DOM: ReactDOM,
PropTypes: ReactPropTypes,
initializeTouchEvents: function(shouldUseTouch) {
EventPluginUtils.useTouchEvents = shouldUseTouch;
},
createClass: ReactCompositeComponent.createClass,
createDescriptor: function(type, props, children) {
var args = Array.prototype.slice.call(arguments, 1);
return type.apply(null, args);
},
constructAndRenderComponent: ReactMount.constructAndRenderComponent,
constructAndRenderComponentByID: ReactMount.constructAndRenderComponentByID,
renderComponent: ReactPerf.measure(
'React',
'renderComponent',
ReactMount.renderComponent
),
renderComponentToString: ReactServerRendering.renderComponentToString,
renderComponentToStaticMarkup:
ReactServerRendering.renderComponentToStaticMarkup,
unmountComponentAtNode: ReactMount.unmountComponentAtNode,
isValidClass: ReactDescriptor.isValidFactory,
isValidComponent: ReactDescriptor.isValidDescriptor,
withContext: ReactContext.withContext,
__internals: {
Component: ReactComponent,
CurrentOwner: ReactCurrentOwner,
DOMComponent: ReactDOMComponent,
DOMPropertyOperations: DOMPropertyOperations,
InstanceHandles: ReactInstanceHandles,
Mount: ReactMount,
MultiChild: ReactMultiChild,
TextComponent: ReactTextComponent
}
};
if ("production" !== "development") {
var ExecutionEnvironment = _dereq_("./ExecutionEnvironment");
if (ExecutionEnvironment.canUseDOM &&
window.top === window.self &&
navigator.userAgent.indexOf('Chrome') > -1) {
console.debug(
'Download the React DevTools for a better development experience: ' +
'http://fb.me/react-devtools'
);
var expectedFeatures = [
// shims
Array.isArray,
Array.prototype.every,
Array.prototype.forEach,
Array.prototype.indexOf,
Array.prototype.map,
Date.now,
Function.prototype.bind,
Object.keys,
String.prototype.split,
String.prototype.trim,
// shams
Object.create,
Object.freeze
];
for (var i in expectedFeatures) {
if (!expectedFeatures[i]) {
console.error(
'One or more ES5 shim/shams expected by React are not available: ' +
'http://fb.me/react-warning-polyfills'
);
break;
}
}
}
}
// Version exists only in the open-source version of React, not in Facebook's
// internal version.
React.version = '0.11.0';
module.exports = React;
},{"./DOMPropertyOperations":12,"./EventPluginUtils":20,"./ExecutionEnvironment":22,"./ReactChildren":34,"./ReactComponent":35,"./ReactCompositeComponent":38,"./ReactContext":39,"./ReactCurrentOwner":40,"./ReactDOM":41,"./ReactDOMComponent":43,"./ReactDefaultInjection":53,"./ReactDescriptor":56,"./ReactInstanceHandles":64,"./ReactMount":67,"./ReactMultiChild":68,"./ReactPerf":71,"./ReactPropTypes":75,"./ReactServerRendering":79,"./ReactTextComponent":83,"./onlyChild":149}],30:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactBrowserComponentMixin
*/
"use strict";
var ReactEmptyComponent = _dereq_("./ReactEmptyComponent");
var ReactMount = _dereq_("./ReactMount");
var invariant = _dereq_("./invariant");
var ReactBrowserComponentMixin = {
/**
* Returns the DOM node rendered by this component.
*
* @return {DOMElement} The root node of this component.
* @final
* @protected
*/
getDOMNode: function() {
("production" !== "development" ? invariant(
this.isMounted(),
'getDOMNode(): A component must be mounted to have a DOM node.'
) : invariant(this.isMounted()));
if (ReactEmptyComponent.isNullComponentID(this._rootNodeID)) {
return null;
}
return ReactMount.getNode(this._rootNodeID);
}
};
module.exports = ReactBrowserComponentMixin;
},{"./ReactEmptyComponent":58,"./ReactMount":67,"./invariant":134}],31:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactBrowserEventEmitter
* @typechecks static-only
*/
"use strict";
var EventConstants = _dereq_("./EventConstants");
var EventPluginHub = _dereq_("./EventPluginHub");
var EventPluginRegistry = _dereq_("./EventPluginRegistry");
var ReactEventEmitterMixin = _dereq_("./ReactEventEmitterMixin");
var ViewportMetrics = _dereq_("./ViewportMetrics");
var isEventSupported = _dereq_("./isEventSupported");
var merge = _dereq_("./merge");
/**
* Summary of `ReactBrowserEventEmitter` event handling:
*
* - Top-level delegation is used to trap most native browser events. This
* may only occur in the main thread and is the responsibility of
* ReactEventListener, which is injected and can therefore support pluggable
* event sources. This is the only work that occurs in the main thread.
*
* - We normalize and de-duplicate events to account for browser quirks. This
* may be done in the worker thread.
*
* - Forward these native events (with the associated top-level type used to
* trap it) to `EventPluginHub`, which in turn will ask plugins if they want
* to extract any synthetic events.
*
* - The `EventPluginHub` will then process each event by annotating them with
* "dispatches", a sequence of listeners and IDs that care about that event.
*
* - The `EventPluginHub` then dispatches the events.
*
* Overview of React and the event system:
*
* +------------+ .
* | DOM | .
* +------------+ .
* | .
* v .
* +------------+ .
* | ReactEvent | .
* | Listener | .
* +------------+ . +-----------+
* | . +--------+|SimpleEvent|
* | . | |Plugin |
* +-----|------+ . v +-----------+
* | | | . +--------------+ +------------+
* | +-----------.--->|EventPluginHub| | Event |
* | | . | | +-----------+ | Propagators|
* | ReactEvent | . | | |TapEvent | |------------|
* | Emitter | . | |<---+|Plugin | |other plugin|
* | | . | | +-----------+ | utilities |
* | +-----------.--->| | +------------+
* | | | . +--------------+
* +-----|------+ . ^ +-----------+
* | . | |Enter/Leave|
* + . +-------+|Plugin |
* +-------------+ . +-----------+
* | application | .
* |-------------| .
* | | .
* | | .
* +-------------+ .
* .
* React Core . General Purpose Event Plugin System
*/
var alreadyListeningTo = {};
var isMonitoringScrollValue = false;
var reactTopListenersCounter = 0;
// For events like 'submit' which don't consistently bubble (which we trap at a
// lower node than `document`), binding at `document` would cause duplicate
// events so we don't include them here
var topEventMapping = {
topBlur: 'blur',
topChange: 'change',
topClick: 'click',
topCompositionEnd: 'compositionend',
topCompositionStart: 'compositionstart',
topCompositionUpdate: 'compositionupdate',
topContextMenu: 'contextmenu',
topCopy: 'copy',
topCut: 'cut',
topDoubleClick: 'dblclick',
topDrag: 'drag',
topDragEnd: 'dragend',
topDragEnter: 'dragenter',
topDragExit: 'dragexit',
topDragLeave: 'dragleave',
topDragOver: 'dragover',
topDragStart: 'dragstart',
topDrop: 'drop',
topFocus: 'focus',
topInput: 'input',
topKeyDown: 'keydown',
topKeyPress: 'keypress',
topKeyUp: 'keyup',
topMouseDown: 'mousedown',
topMouseMove: 'mousemove',
topMouseOut: 'mouseout',
topMouseOver: 'mouseover',
topMouseUp: 'mouseup',
topPaste: 'paste',
topScroll: 'scroll',
topSelectionChange: 'selectionchange',
topTextInput: 'textInput',
topTouchCancel: 'touchcancel',
topTouchEnd: 'touchend',
topTouchMove: 'touchmove',
topTouchStart: 'touchstart',
topWheel: 'wheel'
};
/**
* To ensure no conflicts with other potential React instances on the page
*/
var topListenersIDKey = "_reactListenersID" + String(Math.random()).slice(2);
function getListeningForDocument(mountAt) {
// In IE8, `mountAt` is a host object and doesn't have `hasOwnProperty`
// directly.
if (!Object.prototype.hasOwnProperty.call(mountAt, topListenersIDKey)) {
mountAt[topListenersIDKey] = reactTopListenersCounter++;
alreadyListeningTo[mountAt[topListenersIDKey]] = {};
}
return alreadyListeningTo[mountAt[topListenersIDKey]];
}
/**
* `ReactBrowserEventEmitter` is used to attach top-level event listeners. For
* example:
*
* ReactBrowserEventEmitter.putListener('myID', 'onClick', myFunction);
*
* This would allocate a "registration" of `('onClick', myFunction)` on 'myID'.
*
* @internal
*/
var ReactBrowserEventEmitter = merge(ReactEventEmitterMixin, {
/**
* Injectable event backend
*/
ReactEventListener: null,
injection: {
/**
* @param {object} ReactEventListener
*/
injectReactEventListener: function(ReactEventListener) {
ReactEventListener.setHandleTopLevel(
ReactBrowserEventEmitter.handleTopLevel
);
ReactBrowserEventEmitter.ReactEventListener = ReactEventListener;
}
},
/**
* Sets whether or not any created callbacks should be enabled.
*
* @param {boolean} enabled True if callbacks should be enabled.
*/
setEnabled: function(enabled) {
if (ReactBrowserEventEmitter.ReactEventListener) {
ReactBrowserEventEmitter.ReactEventListener.setEnabled(enabled);
}
},
/**
* @return {boolean} True if callbacks are enabled.
*/
isEnabled: function() {
return !!(
ReactBrowserEventEmitter.ReactEventListener &&
ReactBrowserEventEmitter.ReactEventListener.isEnabled()
);
},
/**
* We listen for bubbled touch events on the document object.
*
* Firefox v8.01 (and possibly others) exhibited strange behavior when
* mounting `onmousemove` events at some node that was not the document
* element. The symptoms were that if your mouse is not moving over something
* contained within that mount point (for example on the background) the
* top-level listeners for `onmousemove` won't be called. However, if you
* register the `mousemove` on the document object, then it will of course
* catch all `mousemove`s. This along with iOS quirks, justifies restricting
* top-level listeners to the document object only, at least for these
* movement types of events and possibly all events.
*
* @see http://www.quirksmode.org/blog/archives/2010/09/click_event_del.html
*
* Also, `keyup`/`keypress`/`keydown` do not bubble to the window on IE, but
* they bubble to document.
*
* @param {string} registrationName Name of listener (e.g. `onClick`).
* @param {object} contentDocumentHandle Document which owns the container
*/
listenTo: function(registrationName, contentDocumentHandle) {
var mountAt = contentDocumentHandle;
var isListening = getListeningForDocument(mountAt);
var dependencies = EventPluginRegistry.
registrationNameDependencies[registrationName];
var topLevelTypes = EventConstants.topLevelTypes;
for (var i = 0, l = dependencies.length; i < l; i++) {
var dependency = dependencies[i];
if (!(
isListening.hasOwnProperty(dependency) &&
isListening[dependency]
)) {
if (dependency === topLevelTypes.topWheel) {
if (isEventSupported('wheel')) {
ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
topLevelTypes.topWheel,
'wheel',
mountAt
);
} else if (isEventSupported('mousewheel')) {
ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
topLevelTypes.topWheel,
'mousewheel',
mountAt
);
} else {
// Firefox needs to capture a different mouse scroll event.
// @see http://www.quirksmode.org/dom/events/tests/scroll.html
ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
topLevelTypes.topWheel,
'DOMMouseScroll',
mountAt
);
}
} else if (dependency === topLevelTypes.topScroll) {
if (isEventSupported('scroll', true)) {
ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(
topLevelTypes.topScroll,
'scroll',
mountAt
);
} else {
ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
topLevelTypes.topScroll,
'scroll',
ReactBrowserEventEmitter.ReactEventListener.WINDOW_HANDLE
);
}
} else if (dependency === topLevelTypes.topFocus ||
dependency === topLevelTypes.topBlur) {
if (isEventSupported('focus', true)) {
ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(
topLevelTypes.topFocus,
'focus',
mountAt
);
ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(
topLevelTypes.topBlur,
'blur',
mountAt
);
} else if (isEventSupported('focusin')) {
// IE has `focusin` and `focusout` events which bubble.
// @see http://www.quirksmode.org/blog/archives/2008/04/delegating_the.html
ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
topLevelTypes.topFocus,
'focusin',
mountAt
);
ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
topLevelTypes.topBlur,
'focusout',
mountAt
);
}
// to make sure blur and focus event listeners are only attached once
isListening[topLevelTypes.topBlur] = true;
isListening[topLevelTypes.topFocus] = true;
} else if (topEventMapping.hasOwnProperty(dependency)) {
ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
dependency,
topEventMapping[dependency],
mountAt
);
}
isListening[dependency] = true;
}
}
},
trapBubbledEvent: function(topLevelType, handlerBaseName, handle) {
return ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
topLevelType,
handlerBaseName,
handle
);
},
trapCapturedEvent: function(topLevelType, handlerBaseName, handle) {
return ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(
topLevelType,
handlerBaseName,
handle
);
},
/**
* Listens to window scroll and resize events. We cache scroll values so that
* application code can access them without triggering reflows.
*
* NOTE: Scroll events do not bubble.
*
* @see http://www.quirksmode.org/dom/events/scroll.html
*/
ensureScrollValueMonitoring: function(){
if (!isMonitoringScrollValue) {
var refresh = ViewportMetrics.refreshScrollValues;
ReactBrowserEventEmitter.ReactEventListener.monitorScrollValue(refresh);
isMonitoringScrollValue = true;
}
},
eventNameDispatchConfigs: EventPluginHub.eventNameDispatchConfigs,
registrationNameModules: EventPluginHub.registrationNameModules,
putListener: EventPluginHub.putListener,
getListener: EventPluginHub.getListener,
deleteListener: EventPluginHub.deleteListener,
deleteAllListeners: EventPluginHub.deleteAllListeners
});
module.exports = ReactBrowserEventEmitter;
},{"./EventConstants":16,"./EventPluginHub":18,"./EventPluginRegistry":19,"./ReactEventEmitterMixin":60,"./ViewportMetrics":105,"./isEventSupported":135,"./merge":144}],32:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @typechecks
* @providesModule ReactCSSTransitionGroup
*/
"use strict";
var React = _dereq_("./React");
var ReactTransitionGroup = _dereq_("./ReactTransitionGroup");
var ReactCSSTransitionGroupChild = _dereq_("./ReactCSSTransitionGroupChild");
var ReactCSSTransitionGroup = React.createClass({
displayName: 'ReactCSSTransitionGroup',
propTypes: {
transitionName: React.PropTypes.string.isRequired,
transitionEnter: React.PropTypes.bool,
transitionLeave: React.PropTypes.bool
},
getDefaultProps: function() {
return {
transitionEnter: true,
transitionLeave: true
};
},
_wrapChild: function(child) {
// We need to provide this childFactory so that
// ReactCSSTransitionGroupChild can receive updates to name, enter, and
// leave while it is leaving.
return ReactCSSTransitionGroupChild(
{
name: this.props.transitionName,
enter: this.props.transitionEnter,
leave: this.props.transitionLeave
},
child
);
},
render: function() {
return this.transferPropsTo(
ReactTransitionGroup(
{childFactory: this._wrapChild},
this.props.children
)
);
}
});
module.exports = ReactCSSTransitionGroup;
},{"./React":29,"./ReactCSSTransitionGroupChild":33,"./ReactTransitionGroup":86}],33:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @typechecks
* @providesModule ReactCSSTransitionGroupChild
*/
"use strict";
var React = _dereq_("./React");
var CSSCore = _dereq_("./CSSCore");
var ReactTransitionEvents = _dereq_("./ReactTransitionEvents");
var onlyChild = _dereq_("./onlyChild");
// We don't remove the element from the DOM until we receive an animationend or
// transitionend event. If the user screws up and forgets to add an animation
// their node will be stuck in the DOM forever, so we detect if an animation
// does not start and if it doesn't, we just call the end listener immediately.
var TICK = 17;
var NO_EVENT_TIMEOUT = 5000;
var noEventListener = null;
if ("production" !== "development") {
noEventListener = function() {
console.warn(
'transition(): tried to perform an animation without ' +
'an animationend or transitionend event after timeout (' +
NO_EVENT_TIMEOUT + 'ms). You should either disable this ' +
'transition in JS or add a CSS animation/transition.'
);
};
}
var ReactCSSTransitionGroupChild = React.createClass({
displayName: 'ReactCSSTransitionGroupChild',
transition: function(animationType, finishCallback) {
var node = this.getDOMNode();
var className = this.props.name + '-' + animationType;
var activeClassName = className + '-active';
var noEventTimeout = null;
var endListener = function() {
if ("production" !== "development") {
clearTimeout(noEventTimeout);
}
CSSCore.removeClass(node, className);
CSSCore.removeClass(node, activeClassName);
ReactTransitionEvents.removeEndEventListener(node, endListener);
// Usually this optional callback is used for informing an owner of
// a leave animation and telling it to remove the child.
finishCallback && finishCallback();
};
ReactTransitionEvents.addEndEventListener(node, endListener);
CSSCore.addClass(node, className);
// Need to do this to actually trigger a transition.
this.queueClass(activeClassName);
if ("production" !== "development") {
noEventTimeout = setTimeout(noEventListener, NO_EVENT_TIMEOUT);
}
},
queueClass: function(className) {
this.classNameQueue.push(className);
if (!this.timeout) {
this.timeout = setTimeout(this.flushClassNameQueue, TICK);
}
},
flushClassNameQueue: function() {
if (this.isMounted()) {
this.classNameQueue.forEach(
CSSCore.addClass.bind(CSSCore, this.getDOMNode())
);
}
this.classNameQueue.length = 0;
this.timeout = null;
},
componentWillMount: function() {
this.classNameQueue = [];
},
componentWillUnmount: function() {
if (this.timeout) {
clearTimeout(this.timeout);
}
},
componentWillEnter: function(done) {
if (this.props.enter) {
this.transition('enter', done);
} else {
done();
}
},
componentWillLeave: function(done) {
if (this.props.leave) {
this.transition('leave', done);
} else {
done();
}
},
render: function() {
return onlyChild(this.props.children);
}
});
module.exports = ReactCSSTransitionGroupChild;
},{"./CSSCore":3,"./React":29,"./ReactTransitionEvents":85,"./onlyChild":149}],34:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactChildren
*/
"use strict";
var PooledClass = _dereq_("./PooledClass");
var traverseAllChildren = _dereq_("./traverseAllChildren");
var warning = _dereq_("./warning");
var twoArgumentPooler = PooledClass.twoArgumentPooler;
var threeArgumentPooler = PooledClass.threeArgumentPooler;
/**
* PooledClass representing the bookkeeping associated with performing a child
* traversal. Allows avoiding binding callbacks.
*
* @constructor ForEachBookKeeping
* @param {!function} forEachFunction Function to perform traversal with.
* @param {?*} forEachContext Context to perform context with.
*/
function ForEachBookKeeping(forEachFunction, forEachContext) {
this.forEachFunction = forEachFunction;
this.forEachContext = forEachContext;
}
PooledClass.addPoolingTo(ForEachBookKeeping, twoArgumentPooler);
function forEachSingleChild(traverseContext, child, name, i) {
var forEachBookKeeping = traverseContext;
forEachBookKeeping.forEachFunction.call(
forEachBookKeeping.forEachContext, child, i);
}
/**
* Iterates through children that are typically specified as `props.children`.
*
* The provided forEachFunc(child, index) will be called for each
* leaf child.
*
* @param {?*} children Children tree container.
* @param {function(*, int)} forEachFunc.
* @param {*} forEachContext Context for forEachContext.
*/
function forEachChildren(children, forEachFunc, forEachContext) {
if (children == null) {
return children;
}
var traverseContext =
ForEachBookKeeping.getPooled(forEachFunc, forEachContext);
traverseAllChildren(children, forEachSingleChild, traverseContext);
ForEachBookKeeping.release(traverseContext);
}
/**
* PooledClass representing the bookkeeping associated with performing a child
* mapping. Allows avoiding binding callbacks.
*
* @constructor MapBookKeeping
* @param {!*} mapResult Object containing the ordered map of results.
* @param {!function} mapFunction Function to perform mapping with.
* @param {?*} mapContext Context to perform mapping with.
*/
function MapBookKeeping(mapResult, mapFunction, mapContext) {
this.mapResult = mapResult;
this.mapFunction = mapFunction;
this.mapContext = mapContext;
}
PooledClass.addPoolingTo(MapBookKeeping, threeArgumentPooler);
function mapSingleChildIntoContext(traverseContext, child, name, i) {
var mapBookKeeping = traverseContext;
var mapResult = mapBookKeeping.mapResult;
var keyUnique = !mapResult.hasOwnProperty(name);
("production" !== "development" ? warning(
keyUnique,
'ReactChildren.map(...): Encountered two children with the same key, ' +
'`%s`. Child keys must be unique; when two children share a key, only ' +
'the first child will be used.',
name
) : null);
if (keyUnique) {
var mappedChild =
mapBookKeeping.mapFunction.call(mapBookKeeping.mapContext, child, i);
mapResult[name] = mappedChild;
}
}
/**
* Maps children that are typically specified as `props.children`.
*
* The provided mapFunction(child, key, index) will be called for each
* leaf child.
*
* TODO: This may likely break any calls to `ReactChildren.map` that were
* previously relying on the fact that we guarded against null children.
*
* @param {?*} children Children tree container.
* @param {function(*, int)} mapFunction.
* @param {*} mapContext Context for mapFunction.
* @return {object} Object containing the ordered map of results.
*/
function mapChildren(children, func, context) {
if (children == null) {
return children;
}
var mapResult = {};
var traverseContext = MapBookKeeping.getPooled(mapResult, func, context);
traverseAllChildren(children, mapSingleChildIntoContext, traverseContext);
MapBookKeeping.release(traverseContext);
return mapResult;
}
function forEachSingleChildDummy(traverseContext, child, name, i) {
return null;
}
/**
* Count the number of children that are typically specified as
* `props.children`.
*
* @param {?*} children Children tree container.
* @return {number} The number of children.
*/
function countChildren(children, context) {
return traverseAllChildren(children, forEachSingleChildDummy, null);
}
var ReactChildren = {
forEach: forEachChildren,
map: mapChildren,
count: countChildren
};
module.exports = ReactChildren;
},{"./PooledClass":28,"./traverseAllChildren":156,"./warning":158}],35:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactComponent
*/
"use strict";
var ReactDescriptor = _dereq_("./ReactDescriptor");
var ReactOwner = _dereq_("./ReactOwner");
var ReactUpdates = _dereq_("./ReactUpdates");
var invariant = _dereq_("./invariant");
var keyMirror = _dereq_("./keyMirror");
var merge = _dereq_("./merge");
/**
* Every React component is in one of these life cycles.
*/
var ComponentLifeCycle = keyMirror({
/**
* Mounted components have a DOM node representation and are capable of
* receiving new props.
*/
MOUNTED: null,
/**
* Unmounted components are inactive and cannot receive new props.
*/
UNMOUNTED: null
});
var injected = false;
/**
* Optionally injectable environment dependent cleanup hook. (server vs.
* browser etc). Example: A browser system caches DOM nodes based on component
* ID and must remove that cache entry when this instance is unmounted.
*
* @private
*/
var unmountIDFromEnvironment = null;
/**
* The "image" of a component tree, is the platform specific (typically
* serialized) data that represents a tree of lower level UI building blocks.
* On the web, this "image" is HTML markup which describes a construction of
* low level `div` and `span` nodes. Other platforms may have different
* encoding of this "image". This must be injected.
*
* @private
*/
var mountImageIntoNode = null;
/**
* Components are the basic units of composition in React.
*
* Every component accepts a set of keyed input parameters known as "props" that
* are initialized by the constructor. Once a component is mounted, the props
* can be mutated using `setProps` or `replaceProps`.
*
* Every component is capable of the following operations:
*
* `mountComponent`
* Initializes the component, renders markup, and registers event listeners.
*
* `receiveComponent`
* Updates the rendered DOM nodes to match the given component.
*
* `unmountComponent`
* Releases any resources allocated by this component.
*
* Components can also be "owned" by other components. Being owned by another
* component means being constructed by that component. This is different from
* being the child of a component, which means having a DOM representation that
* is a child of the DOM representation of that component.
*
* @class ReactComponent
*/
var ReactComponent = {
injection: {
injectEnvironment: function(ReactComponentEnvironment) {
("production" !== "development" ? invariant(
!injected,
'ReactComponent: injectEnvironment() can only be called once.'
) : invariant(!injected));
mountImageIntoNode = ReactComponentEnvironment.mountImageIntoNode;
unmountIDFromEnvironment =
ReactComponentEnvironment.unmountIDFromEnvironment;
ReactComponent.BackendIDOperations =
ReactComponentEnvironment.BackendIDOperations;
injected = true;
}
},
/**
* @internal
*/
LifeCycle: ComponentLifeCycle,
/**
* Injected module that provides ability to mutate individual properties.
* Injected into the base class because many different subclasses need access
* to this.
*
* @internal
*/
BackendIDOperations: null,
/**
* Base functionality for every ReactComponent constructor. Mixed into the
* `ReactComponent` prototype, but exposed statically for easy access.
*
* @lends {ReactComponent.prototype}
*/
Mixin: {
/**
* Checks whether or not this component is mounted.
*
* @return {boolean} True if mounted, false otherwise.
* @final
* @protected
*/
isMounted: function() {
return this._lifeCycleState === ComponentLifeCycle.MOUNTED;
},
/**
* Sets a subset of the props.
*
* @param {object} partialProps Subset of the next props.
* @param {?function} callback Called after props are updated.
* @final
* @public
*/
setProps: function(partialProps, callback) {
// Merge with the pending descriptor if it exists, otherwise with existing
// descriptor props.
var descriptor = this._pendingDescriptor || this._descriptor;
this.replaceProps(
merge(descriptor.props, partialProps),
callback
);
},
/**
* Replaces all of the props.
*
* @param {object} props New props.
* @param {?function} callback Called after props are updated.
* @final
* @public
*/
replaceProps: function(props, callback) {
("production" !== "development" ? invariant(
this.isMounted(),
'replaceProps(...): Can only update a mounted component.'
) : invariant(this.isMounted()));
("production" !== "development" ? invariant(
this._mountDepth === 0,
'replaceProps(...): You called `setProps` or `replaceProps` on a ' +
'component with a parent. This is an anti-pattern since props will ' +
'get reactively updated when rendered. Instead, change the owner\'s ' +
'`render` method to pass the correct value as props to the component ' +
'where it is created.'
) : invariant(this._mountDepth === 0));
// This is a deoptimized path. We optimize for always having a descriptor.
// This creates an extra internal descriptor.
this._pendingDescriptor = ReactDescriptor.cloneAndReplaceProps(
this._pendingDescriptor || this._descriptor,
props
);
ReactUpdates.enqueueUpdate(this, callback);
},
/**
* Schedule a partial update to the props. Only used for internal testing.
*
* @param {object} partialProps Subset of the next props.
* @param {?function} callback Called after props are updated.
* @final
* @internal
*/
_setPropsInternal: function(partialProps, callback) {
// This is a deoptimized path. We optimize for always having a descriptor.
// This creates an extra internal descriptor.
var descriptor = this._pendingDescriptor || this._descriptor;
this._pendingDescriptor = ReactDescriptor.cloneAndReplaceProps(
descriptor,
merge(descriptor.props, partialProps)
);
ReactUpdates.enqueueUpdate(this, callback);
},
/**
* Base constructor for all React components.
*
* Subclasses that override this method should make sure to invoke
* `ReactComponent.Mixin.construct.call(this, ...)`.
*
* @param {ReactDescriptor} descriptor
* @internal
*/
construct: function(descriptor) {
// This is the public exposed props object after it has been processed
// with default props. The descriptor's props represents the true internal
// state of the props.
this.props = descriptor.props;
// Record the component responsible for creating this component.
// This is accessible through the descriptor but we maintain an extra
// field for compatibility with devtools and as a way to make an
// incremental update. TODO: Consider deprecating this field.
this._owner = descriptor._owner;
// All components start unmounted.
this._lifeCycleState = ComponentLifeCycle.UNMOUNTED;
// See ReactUpdates.
this._pendingCallbacks = null;
// We keep the old descriptor and a reference to the pending descriptor
// to track updates.
this._descriptor = descriptor;
this._pendingDescriptor = null;
},
/**
* Initializes the component, renders markup, and registers event listeners.
*
* NOTE: This does not insert any nodes into the DOM.
*
* Subclasses that override this method should make sure to invoke
* `ReactComponent.Mixin.mountComponent.call(this, ...)`.
*
* @param {string} rootID DOM ID of the root node.
* @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
* @param {number} mountDepth number of components in the owner hierarchy.
* @return {?string} Rendered markup to be inserted into the DOM.
* @internal
*/
mountComponent: function(rootID, transaction, mountDepth) {
("production" !== "development" ? invariant(
!this.isMounted(),
'mountComponent(%s, ...): Can only mount an unmounted component. ' +
'Make sure to avoid storing components between renders or reusing a ' +
'single component instance in multiple places.',
rootID
) : invariant(!this.isMounted()));
var props = this._descriptor.props;
if (props.ref != null) {
var owner = this._descriptor._owner;
ReactOwner.addComponentAsRefTo(this, props.ref, owner);
}
this._rootNodeID = rootID;
this._lifeCycleState = ComponentLifeCycle.MOUNTED;
this._mountDepth = mountDepth;
// Effectively: return '';
},
/**
* Releases any resources allocated by `mountComponent`.
*
* NOTE: This does not remove any nodes from the DOM.
*
* Subclasses that override this method should make sure to invoke
* `ReactComponent.Mixin.unmountComponent.call(this)`.
*
* @internal
*/
unmountComponent: function() {
("production" !== "development" ? invariant(
this.isMounted(),
'unmountComponent(): Can only unmount a mounted component.'
) : invariant(this.isMounted()));
var props = this.props;
if (props.ref != null) {
ReactOwner.removeComponentAsRefFrom(this, props.ref, this._owner);
}
unmountIDFromEnvironment(this._rootNodeID);
this._rootNodeID = null;
this._lifeCycleState = ComponentLifeCycle.UNMOUNTED;
},
/**
* Given a new instance of this component, updates the rendered DOM nodes
* as if that instance was rendered instead.
*
* Subclasses that override this method should make sure to invoke
* `ReactComponent.Mixin.receiveComponent.call(this, ...)`.
*
* @param {object} nextComponent Next set of properties.
* @param {ReactReconcileTransaction} transaction
* @internal
*/
receiveComponent: function(nextDescriptor, transaction) {
("production" !== "development" ? invariant(
this.isMounted(),
'receiveComponent(...): Can only update a mounted component.'
) : invariant(this.isMounted()));
this._pendingDescriptor = nextDescriptor;
this.performUpdateIfNecessary(transaction);
},
/**
* If `_pendingDescriptor` is set, update the component.
*
* @param {ReactReconcileTransaction} transaction
* @internal
*/
performUpdateIfNecessary: function(transaction) {
if (this._pendingDescriptor == null) {
return;
}
var prevDescriptor = this._descriptor;
var nextDescriptor = this._pendingDescriptor;
this._descriptor = nextDescriptor;
this.props = nextDescriptor.props;
this._owner = nextDescriptor._owner;
this._pendingDescriptor = null;
this.updateComponent(transaction, prevDescriptor);
},
/**
* Updates the component's currently mounted representation.
*
* @param {ReactReconcileTransaction} transaction
* @param {object} prevDescriptor
* @internal
*/
updateComponent: function(transaction, prevDescriptor) {
var nextDescriptor = this._descriptor;
// If either the owner or a `ref` has changed, make sure the newest owner
// has stored a reference to `this`, and the previous owner (if different)
// has forgotten the reference to `this`. We use the descriptor instead
// of the public this.props because the post processing cannot determine
// a ref. The ref conceptually lives on the descriptor.
// TODO: Should this even be possible? The owner cannot change because
// it's forbidden by shouldUpdateReactComponent. The ref can change
// if you swap the keys of but not the refs. Reconsider where this check
// is made. It probably belongs where the key checking and
// instantiateReactComponent is done.
if (nextDescriptor._owner !== prevDescriptor._owner ||
nextDescriptor.props.ref !== prevDescriptor.props.ref) {
if (prevDescriptor.props.ref != null) {
ReactOwner.removeComponentAsRefFrom(
this, prevDescriptor.props.ref, prevDescriptor._owner
);
}
// Correct, even if the owner is the same, and only the ref has changed.
if (nextDescriptor.props.ref != null) {
ReactOwner.addComponentAsRefTo(
this,
nextDescriptor.props.ref,
nextDescriptor._owner
);
}
}
},
/**
* Mounts this component and inserts it into the DOM.
*
* @param {string} rootID DOM ID of the root node.
* @param {DOMElement} container DOM element to mount into.
* @param {boolean} shouldReuseMarkup If true, do not insert markup
* @final
* @internal
* @see {ReactMount.renderComponent}
*/
mountComponentIntoNode: function(rootID, container, shouldReuseMarkup) {
var transaction = ReactUpdates.ReactReconcileTransaction.getPooled();
transaction.perform(
this._mountComponentIntoNode,
this,
rootID,
container,
transaction,
shouldReuseMarkup
);
ReactUpdates.ReactReconcileTransaction.release(transaction);
},
/**
* @param {string} rootID DOM ID of the root node.
* @param {DOMElement} container DOM element to mount into.
* @param {ReactReconcileTransaction} transaction
* @param {boolean} shouldReuseMarkup If true, do not insert markup
* @final
* @private
*/
_mountComponentIntoNode: function(
rootID,
container,
transaction,
shouldReuseMarkup) {
var markup = this.mountComponent(rootID, transaction, 0);
mountImageIntoNode(markup, container, shouldReuseMarkup);
},
/**
* Checks if this component is owned by the supplied `owner` component.
*
* @param {ReactComponent} owner Component to check.
* @return {boolean} True if `owners` owns this component.
* @final
* @internal
*/
isOwnedBy: function(owner) {
return this._owner === owner;
},
/**
* Gets another component, that shares the same owner as this one, by ref.
*
* @param {string} ref of a sibling Component.
* @return {?ReactComponent} the actual sibling Component.
* @final
* @internal
*/
getSiblingByRef: function(ref) {
var owner = this._owner;
if (!owner || !owner.refs) {
return null;
}
return owner.refs[ref];
}
}
};
module.exports = ReactComponent;
},{"./ReactDescriptor":56,"./ReactOwner":70,"./ReactUpdates":87,"./invariant":134,"./keyMirror":140,"./merge":144}],36:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactComponentBrowserEnvironment
*/
/*jslint evil: true */
"use strict";
var ReactDOMIDOperations = _dereq_("./ReactDOMIDOperations");
var ReactMarkupChecksum = _dereq_("./ReactMarkupChecksum");
var ReactMount = _dereq_("./ReactMount");
var ReactPerf = _dereq_("./ReactPerf");
var ReactReconcileTransaction = _dereq_("./ReactReconcileTransaction");
var getReactRootElementInContainer = _dereq_("./getReactRootElementInContainer");
var invariant = _dereq_("./invariant");
var setInnerHTML = _dereq_("./setInnerHTML");
var ELEMENT_NODE_TYPE = 1;
var DOC_NODE_TYPE = 9;
/**
* Abstracts away all functionality of `ReactComponent` requires knowledge of
* the browser context.
*/
var ReactComponentBrowserEnvironment = {
ReactReconcileTransaction: ReactReconcileTransaction,
BackendIDOperations: ReactDOMIDOperations,
/**
* If a particular environment requires that some resources be cleaned up,
* specify this in the injected Mixin. In the DOM, we would likely want to
* purge any cached node ID lookups.
*
* @private
*/
unmountIDFromEnvironment: function(rootNodeID) {
ReactMount.purgeID(rootNodeID);
},
/**
* @param {string} markup Markup string to place into the DOM Element.
* @param {DOMElement} container DOM Element to insert markup into.
* @param {boolean} shouldReuseMarkup Should reuse the existing markup in the
* container if possible.
*/
mountImageIntoNode: ReactPerf.measure(
'ReactComponentBrowserEnvironment',
'mountImageIntoNode',
function(markup, container, shouldReuseMarkup) {
("production" !== "development" ? invariant(
container && (
container.nodeType === ELEMENT_NODE_TYPE ||
container.nodeType === DOC_NODE_TYPE
),
'mountComponentIntoNode(...): Target container is not valid.'
) : invariant(container && (
container.nodeType === ELEMENT_NODE_TYPE ||
container.nodeType === DOC_NODE_TYPE
)));
if (shouldReuseMarkup) {
if (ReactMarkupChecksum.canReuseMarkup(
markup,
getReactRootElementInContainer(container))) {
return;
} else {
("production" !== "development" ? invariant(
container.nodeType !== DOC_NODE_TYPE,
'You\'re trying to render a component to the document using ' +
'server rendering but the checksum was invalid. This usually ' +
'means you rendered a different component type or props on ' +
'the client from the one on the server, or your render() ' +
'methods are impure. React cannot handle this case due to ' +
'cross-browser quirks by rendering at the document root. You ' +
'should look for environment dependent code in your components ' +
'and ensure the props are the same client and server side.'
) : invariant(container.nodeType !== DOC_NODE_TYPE));
if ("production" !== "development") {
console.warn(
'React attempted to use reuse markup in a container but the ' +
'checksum was invalid. This generally means that you are ' +
'using server rendering and the markup generated on the ' +
'server was not what the client was expecting. React injected ' +
'new markup to compensate which works but you have lost many ' +
'of the benefits of server rendering. Instead, figure out ' +
'why the markup being generated is different on the client ' +
'or server.'
);
}
}
}
("production" !== "development" ? invariant(
container.nodeType !== DOC_NODE_TYPE,
'You\'re trying to render a component to the document but ' +
'you didn\'t use server rendering. We can\'t do this ' +
'without using server rendering due to cross-browser quirks. ' +
'See renderComponentToString() for server rendering.'
) : invariant(container.nodeType !== DOC_NODE_TYPE));
setInnerHTML(container, markup);
}
)
};
module.exports = ReactComponentBrowserEnvironment;
},{"./ReactDOMIDOperations":45,"./ReactMarkupChecksum":66,"./ReactMount":67,"./ReactPerf":71,"./ReactReconcileTransaction":77,"./getReactRootElementInContainer":128,"./invariant":134,"./setInnerHTML":152}],37:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactComponentWithPureRenderMixin
*/
"use strict";
var shallowEqual = _dereq_("./shallowEqual");
/**
* If your React component's render function is "pure", e.g. it will render the
* same result given the same props and state, provide this Mixin for a
* considerable performance boost.
*
* Most React components have pure render functions.
*
* Example:
*
* var ReactComponentWithPureRenderMixin =
* require('ReactComponentWithPureRenderMixin');
* React.createClass({
* mixins: [ReactComponentWithPureRenderMixin],
*
* render: function() {
* return <div className={this.props.className}>foo</div>;
* }
* });
*
* Note: This only checks shallow equality for props and state. If these contain
* complex data structures this mixin may have false-negatives for deeper
* differences. Only mixin to components which have simple props and state, or
* use `forceUpdate()` when you know deep data structures have changed.
*/
var ReactComponentWithPureRenderMixin = {
shouldComponentUpdate: function(nextProps, nextState) {
return !shallowEqual(this.props, nextProps) ||
!shallowEqual(this.state, nextState);
}
};
module.exports = ReactComponentWithPureRenderMixin;
},{"./shallowEqual":153}],38:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactCompositeComponent
*/
"use strict";
var ReactComponent = _dereq_("./ReactComponent");
var ReactContext = _dereq_("./ReactContext");
var ReactCurrentOwner = _dereq_("./ReactCurrentOwner");
var ReactDescriptor = _dereq_("./ReactDescriptor");
var ReactDescriptorValidator = _dereq_("./ReactDescriptorValidator");
var ReactEmptyComponent = _dereq_("./ReactEmptyComponent");
var ReactErrorUtils = _dereq_("./ReactErrorUtils");
var ReactOwner = _dereq_("./ReactOwner");
var ReactPerf = _dereq_("./ReactPerf");
var ReactPropTransferer = _dereq_("./ReactPropTransferer");
var ReactPropTypeLocations = _dereq_("./ReactPropTypeLocations");
var ReactPropTypeLocationNames = _dereq_("./ReactPropTypeLocationNames");
var ReactUpdates = _dereq_("./ReactUpdates");
var instantiateReactComponent = _dereq_("./instantiateReactComponent");
var invariant = _dereq_("./invariant");
var keyMirror = _dereq_("./keyMirror");
var merge = _dereq_("./merge");
var mixInto = _dereq_("./mixInto");
var monitorCodeUse = _dereq_("./monitorCodeUse");
var mapObject = _dereq_("./mapObject");
var shouldUpdateReactComponent = _dereq_("./shouldUpdateReactComponent");
var warning = _dereq_("./warning");
/**
* Policies that describe methods in `ReactCompositeComponentInterface`.
*/
var SpecPolicy = keyMirror({
/**
* These methods may be defined only once by the class specification or mixin.
*/
DEFINE_ONCE: null,
/**
* These methods may be defined by both the class specification and mixins.
* Subsequent definitions will be chained. These methods must return void.
*/
DEFINE_MANY: null,
/**
* These methods are overriding the base ReactCompositeComponent class.
*/
OVERRIDE_BASE: null,
/**
* These methods are similar to DEFINE_MANY, except we assume they return
* objects. We try to merge the keys of the return values of all the mixed in
* functions. If there is a key conflict we throw.
*/
DEFINE_MANY_MERGED: null
});
var injectedMixins = [];
/**
* Composite components are higher-level components that compose other composite
* or native components.
*
* To create a new type of `ReactCompositeComponent`, pass a specification of
* your new class to `React.createClass`. The only requirement of your class
* specification is that you implement a `render` method.
*
* var MyComponent = React.createClass({
* render: function() {
* return <div>Hello World</div>;
* }
* });
*
* The class specification supports a specific protocol of methods that have
* special meaning (e.g. `render`). See `ReactCompositeComponentInterface` for
* more the comprehensive protocol. Any other properties and methods in the
* class specification will available on the prototype.
*
* @interface ReactCompositeComponentInterface
* @internal
*/
var ReactCompositeComponentInterface = {
/**
* An array of Mixin objects to include when defining your component.
*
* @type {array}
* @optional
*/
mixins: SpecPolicy.DEFINE_MANY,
/**
* An object containing properties and methods that should be defined on
* the component's constructor instead of its prototype (static methods).
*
* @type {object}
* @optional
*/
statics: SpecPolicy.DEFINE_MANY,
/**
* Definition of prop types for this component.
*
* @type {object}
* @optional
*/
propTypes: SpecPolicy.DEFINE_MANY,
/**
* Definition of context types for this component.
*
* @type {object}
* @optional
*/
contextTypes: SpecPolicy.DEFINE_MANY,
/**
* Definition of context types this component sets for its children.
*
* @type {object}
* @optional
*/
childContextTypes: SpecPolicy.DEFINE_MANY,
// ==== Definition methods ====
/**
* Invoked when the component is mounted. Values in the mapping will be set on
* `this.props` if that prop is not specified (i.e. using an `in` check).
*
* This method is invoked before `getInitialState` and therefore cannot rely
* on `this.state` or use `this.setState`.
*
* @return {object}
* @optional
*/
getDefaultProps: SpecPolicy.DEFINE_MANY_MERGED,
/**
* Invoked once before the component is mounted. The return value will be used
* as the initial value of `this.state`.
*
* getInitialState: function() {
* return {
* isOn: false,
* fooBaz: new BazFoo()
* }
* }
*
* @return {object}
* @optional
*/
getInitialState: SpecPolicy.DEFINE_MANY_MERGED,
/**
* @return {object}
* @optional
*/
getChildContext: SpecPolicy.DEFINE_MANY_MERGED,
/**
* Uses props from `this.props` and state from `this.state` to render the
* structure of the component.
*
* No guarantees are made about when or how often this method is invoked, so
* it must not have side effects.
*
* render: function() {
* var name = this.props.name;
* return <div>Hello, {name}!</div>;
* }
*
* @return {ReactComponent}
* @nosideeffects
* @required
*/
render: SpecPolicy.DEFINE_ONCE,
// ==== Delegate methods ====
/**
* Invoked when the component is initially created and about to be mounted.
* This may have side effects, but any external subscriptions or data created
* by this method must be cleaned up in `componentWillUnmount`.
*
* @optional
*/
componentWillMount: SpecPolicy.DEFINE_MANY,
/**
* Invoked when the component has been mounted and has a DOM representation.
* However, there is no guarantee that the DOM node is in the document.
*
* Use this as an opportunity to operate on the DOM when the component has
* been mounted (initialized and rendered) for the first time.
*
* @param {DOMElement} rootNode DOM element representing the component.
* @optional
*/
componentDidMount: SpecPolicy.DEFINE_MANY,
/**
* Invoked before the component receives new props.
*
* Use this as an opportunity to react to a prop transition by updating the
* state using `this.setState`. Current props are accessed via `this.props`.
*
* componentWillReceiveProps: function(nextProps, nextContext) {
* this.setState({
* likesIncreasing: nextProps.likeCount > this.props.likeCount
* });
* }
*
* NOTE: There is no equivalent `componentWillReceiveState`. An incoming prop
* transition may cause a state change, but the opposite is not true. If you
* need it, you are probably looking for `componentWillUpdate`.
*
* @param {object} nextProps
* @optional
*/
componentWillReceiveProps: SpecPolicy.DEFINE_MANY,
/**
* Invoked while deciding if the component should be updated as a result of
* receiving new props, state and/or context.
*
* Use this as an opportunity to `return false` when you're certain that the
* transition to the new props/state/context will not require a component
* update.
*
* shouldComponentUpdate: function(nextProps, nextState, nextContext) {
* return !equal(nextProps, this.props) ||
* !equal(nextState, this.state) ||
* !equal(nextContext, this.context);
* }
*
* @param {object} nextProps
* @param {?object} nextState
* @param {?object} nextContext
* @return {boolean} True if the component should update.
* @optional
*/
shouldComponentUpdate: SpecPolicy.DEFINE_ONCE,
/**
* Invoked when the component is about to update due to a transition from
* `this.props`, `this.state` and `this.context` to `nextProps`, `nextState`
* and `nextContext`.
*
* Use this as an opportunity to perform preparation before an update occurs.
*
* NOTE: You **cannot** use `this.setState()` in this method.
*
* @param {object} nextProps
* @param {?object} nextState
* @param {?object} nextContext
* @param {ReactReconcileTransaction} transaction
* @optional
*/
componentWillUpdate: SpecPolicy.DEFINE_MANY,
/**
* Invoked when the component's DOM representation has been updated.
*
* Use this as an opportunity to operate on the DOM when the component has
* been updated.
*
* @param {object} prevProps
* @param {?object} prevState
* @param {?object} prevContext
* @param {DOMElement} rootNode DOM element representing the component.
* @optional
*/
componentDidUpdate: SpecPolicy.DEFINE_MANY,
/**
* Invoked when the component is about to be removed from its parent and have
* its DOM representation destroyed.
*
* Use this as an opportunity to deallocate any external resources.
*
* NOTE: There is no `componentDidUnmount` since your component will have been
* destroyed by that point.
*
* @optional
*/
componentWillUnmount: SpecPolicy.DEFINE_MANY,
// ==== Advanced methods ====
/**
* Updates the component's currently mounted DOM representation.
*
* By default, this implements React's rendering and reconciliation algorithm.
* Sophisticated clients may wish to override this.
*
* @param {ReactReconcileTransaction} transaction
* @internal
* @overridable
*/
updateComponent: SpecPolicy.OVERRIDE_BASE
};
/**
* Mapping from class specification keys to special processing functions.
*
* Although these are declared like instance properties in the specification
* when defining classes using `React.createClass`, they are actually static
* and are accessible on the constructor instead of the prototype. Despite
* being static, they must be defined outside of the "statics" key under
* which all other static methods are defined.
*/
var RESERVED_SPEC_KEYS = {
displayName: function(Constructor, displayName) {
Constructor.displayName = displayName;
},
mixins: function(Constructor, mixins) {
if (mixins) {
for (var i = 0; i < mixins.length; i++) {
mixSpecIntoComponent(Constructor, mixins[i]);
}
}
},
childContextTypes: function(Constructor, childContextTypes) {
validateTypeDef(
Constructor,
childContextTypes,
ReactPropTypeLocations.childContext
);
Constructor.childContextTypes = merge(
Constructor.childContextTypes,
childContextTypes
);
},
contextTypes: function(Constructor, contextTypes) {
validateTypeDef(
Constructor,
contextTypes,
ReactPropTypeLocations.context
);
Constructor.contextTypes = merge(Constructor.contextTypes, contextTypes);
},
/**
* Special case getDefaultProps which should move into statics but requires
* automatic merging.
*/
getDefaultProps: function(Constructor, getDefaultProps) {
if (Constructor.getDefaultProps) {
Constructor.getDefaultProps = createMergedResultFunction(
Constructor.getDefaultProps,
getDefaultProps
);
} else {
Constructor.getDefaultProps = getDefaultProps;
}
},
propTypes: function(Constructor, propTypes) {
validateTypeDef(
Constructor,
propTypes,
ReactPropTypeLocations.prop
);
Constructor.propTypes = merge(Constructor.propTypes, propTypes);
},
statics: function(Constructor, statics) {
mixStaticSpecIntoComponent(Constructor, statics);
}
};
function getDeclarationErrorAddendum(component) {
var owner = component._owner || null;
if (owner && owner.constructor && owner.constructor.displayName) {
return ' Check the render method of `' + owner.constructor.displayName +
'`.';
}
return '';
}
function validateTypeDef(Constructor, typeDef, location) {
for (var propName in typeDef) {
if (typeDef.hasOwnProperty(propName)) {
("production" !== "development" ? invariant(
typeof typeDef[propName] == 'function',
'%s: %s type `%s` is invalid; it must be a function, usually from ' +
'React.PropTypes.',
Constructor.displayName || 'ReactCompositeComponent',
ReactPropTypeLocationNames[location],
propName
) : invariant(typeof typeDef[propName] == 'function'));
}
}
}
function validateMethodOverride(proto, name) {
var specPolicy = ReactCompositeComponentInterface.hasOwnProperty(name) ?
ReactCompositeComponentInterface[name] :
null;
// Disallow overriding of base class methods unless explicitly allowed.
if (ReactCompositeComponentMixin.hasOwnProperty(name)) {
("production" !== "development" ? invariant(
specPolicy === SpecPolicy.OVERRIDE_BASE,
'ReactCompositeComponentInterface: You are attempting to override ' +
'`%s` from your class specification. Ensure that your method names ' +
'do not overlap with React methods.',
name
) : invariant(specPolicy === SpecPolicy.OVERRIDE_BASE));
}
// Disallow defining methods more than once unless explicitly allowed.
if (proto.hasOwnProperty(name)) {
("production" !== "development" ? invariant(
specPolicy === SpecPolicy.DEFINE_MANY ||
specPolicy === SpecPolicy.DEFINE_MANY_MERGED,
'ReactCompositeComponentInterface: You are attempting to define ' +
'`%s` on your component more than once. This conflict may be due ' +
'to a mixin.',
name
) : invariant(specPolicy === SpecPolicy.DEFINE_MANY ||
specPolicy === SpecPolicy.DEFINE_MANY_MERGED));
}
}
function validateLifeCycleOnReplaceState(instance) {
var compositeLifeCycleState = instance._compositeLifeCycleState;
("production" !== "development" ? invariant(
instance.isMounted() ||
compositeLifeCycleState === CompositeLifeCycle.MOUNTING,
'replaceState(...): Can only update a mounted or mounting component.'
) : invariant(instance.isMounted() ||
compositeLifeCycleState === CompositeLifeCycle.MOUNTING));
("production" !== "development" ? invariant(compositeLifeCycleState !== CompositeLifeCycle.RECEIVING_STATE,
'replaceState(...): Cannot update during an existing state transition ' +
'(such as within `render`). This could potentially cause an infinite ' +
'loop so it is forbidden.'
) : invariant(compositeLifeCycleState !== CompositeLifeCycle.RECEIVING_STATE));
("production" !== "development" ? invariant(compositeLifeCycleState !== CompositeLifeCycle.UNMOUNTING,
'replaceState(...): Cannot update while unmounting component. This ' +
'usually means you called setState() on an unmounted component.'
) : invariant(compositeLifeCycleState !== CompositeLifeCycle.UNMOUNTING));
}
/**
* Custom version of `mixInto` which handles policy validation and reserved
* specification keys when building `ReactCompositeComponent` classses.
*/
function mixSpecIntoComponent(Constructor, spec) {
("production" !== "development" ? invariant(
!ReactDescriptor.isValidFactory(spec),
'ReactCompositeComponent: You\'re attempting to ' +
'use a component class as a mixin. Instead, just use a regular object.'
) : invariant(!ReactDescriptor.isValidFactory(spec)));
("production" !== "development" ? invariant(
!ReactDescriptor.isValidDescriptor(spec),
'ReactCompositeComponent: You\'re attempting to ' +
'use a component as a mixin. Instead, just use a regular object.'
) : invariant(!ReactDescriptor.isValidDescriptor(spec)));
var proto = Constructor.prototype;
for (var name in spec) {
var property = spec[name];
if (!spec.hasOwnProperty(name)) {
continue;
}
validateMethodOverride(proto, name);
if (RESERVED_SPEC_KEYS.hasOwnProperty(name)) {
RESERVED_SPEC_KEYS[name](Constructor, property);
} else {
// Setup methods on prototype:
// The following member methods should not be automatically bound:
// 1. Expected ReactCompositeComponent methods (in the "interface").
// 2. Overridden methods (that were mixed in).
var isCompositeComponentMethod =
ReactCompositeComponentInterface.hasOwnProperty(name);
var isAlreadyDefined = proto.hasOwnProperty(name);
var markedDontBind = property && property.__reactDontBind;
var isFunction = typeof property === 'function';
var shouldAutoBind =
isFunction &&
!isCompositeComponentMethod &&
!isAlreadyDefined &&
!markedDontBind;
if (shouldAutoBind) {
if (!proto.__reactAutoBindMap) {
proto.__reactAutoBindMap = {};
}
proto.__reactAutoBindMap[name] = property;
proto[name] = property;
} else {
if (isAlreadyDefined) {
var specPolicy = ReactCompositeComponentInterface[name];
// These cases should already be caught by validateMethodOverride
("production" !== "development" ? invariant(
isCompositeComponentMethod && (
specPolicy === SpecPolicy.DEFINE_MANY_MERGED ||
specPolicy === SpecPolicy.DEFINE_MANY
),
'ReactCompositeComponent: Unexpected spec policy %s for key %s ' +
'when mixing in component specs.',
specPolicy,
name
) : invariant(isCompositeComponentMethod && (
specPolicy === SpecPolicy.DEFINE_MANY_MERGED ||
specPolicy === SpecPolicy.DEFINE_MANY
)));
// For methods which are defined more than once, call the existing
// methods before calling the new property, merging if appropriate.
if (specPolicy === SpecPolicy.DEFINE_MANY_MERGED) {
proto[name] = createMergedResultFunction(proto[name], property);
} else if (specPolicy === SpecPolicy.DEFINE_MANY) {
proto[name] = createChainedFunction(proto[name], property);
}
} else {
proto[name] = property;
if ("production" !== "development") {
// Add verbose displayName to the function, which helps when looking
// at profiling tools.
if (typeof property === 'function' && spec.displayName) {
proto[name].displayName = spec.displayName + '_' + name;
}
}
}
}
}
}
}
function mixStaticSpecIntoComponent(Constructor, statics) {
if (!statics) {
return;
}
for (var name in statics) {
var property = statics[name];
if (!statics.hasOwnProperty(name)) {
continue;
}
var isInherited = name in Constructor;
var result = property;
if (isInherited) {
var existingProperty = Constructor[name];
var existingType = typeof existingProperty;
var propertyType = typeof property;
("production" !== "development" ? invariant(
existingType === 'function' && propertyType === 'function',
'ReactCompositeComponent: You are attempting to define ' +
'`%s` on your component more than once, but that is only supported ' +
'for functions, which are chained together. This conflict may be ' +
'due to a mixin.',
name
) : invariant(existingType === 'function' && propertyType === 'function'));
result = createChainedFunction(existingProperty, property);
}
Constructor[name] = result;
}
}
/**
* Merge two objects, but throw if both contain the same key.
*
* @param {object} one The first object, which is mutated.
* @param {object} two The second object
* @return {object} one after it has been mutated to contain everything in two.
*/
function mergeObjectsWithNoDuplicateKeys(one, two) {
("production" !== "development" ? invariant(
one && two && typeof one === 'object' && typeof two === 'object',
'mergeObjectsWithNoDuplicateKeys(): Cannot merge non-objects'
) : invariant(one && two && typeof one === 'object' && typeof two === 'object'));
mapObject(two, function(value, key) {
("production" !== "development" ? invariant(
one[key] === undefined,
'mergeObjectsWithNoDuplicateKeys(): ' +
'Tried to merge two objects with the same key: %s',
key
) : invariant(one[key] === undefined));
one[key] = value;
});
return one;
}
/**
* Creates a function that invokes two functions and merges their return values.
*
* @param {function} one Function to invoke first.
* @param {function} two Function to invoke second.
* @return {function} Function that invokes the two argument functions.
* @private
*/
function createMergedResultFunction(one, two) {
return function mergedResult() {
var a = one.apply(this, arguments);
var b = two.apply(this, arguments);
if (a == null) {
return b;
} else if (b == null) {
return a;
}
return mergeObjectsWithNoDuplicateKeys(a, b);
};
}
/**
* Creates a function that invokes two functions and ignores their return vales.
*
* @param {function} one Function to invoke first.
* @param {function} two Function to invoke second.
* @return {function} Function that invokes the two argument functions.
* @private
*/
function createChainedFunction(one, two) {
return function chainedFunction() {
one.apply(this, arguments);
two.apply(this, arguments);
};
}
/**
* `ReactCompositeComponent` maintains an auxiliary life cycle state in
* `this._compositeLifeCycleState` (which can be null).
*
* This is different from the life cycle state maintained by `ReactComponent` in
* `this._lifeCycleState`. The following diagram shows how the states overlap in
* time. There are times when the CompositeLifeCycle is null - at those times it
* is only meaningful to look at ComponentLifeCycle alone.
*
* Top Row: ReactComponent.ComponentLifeCycle
* Low Row: ReactComponent.CompositeLifeCycle
*
* +-------+------------------------------------------------------+--------+
* | UN | MOUNTED | UN |
* |MOUNTED| | MOUNTED|
* +-------+------------------------------------------------------+--------+
* | ^--------+ +------+ +------+ +------+ +--------^ |
* | | | | | | | | | | | |
* | 0--|MOUNTING|-0-|RECEIV|-0-|RECEIV|-0-|RECEIV|-0-| UN |--->0 |
* | | | |PROPS | | PROPS| | STATE| |MOUNTING| |
* | | | | | | | | | | | |
* | | | | | | | | | | | |
* | +--------+ +------+ +------+ +------+ +--------+ |
* | | | |
* +-------+------------------------------------------------------+--------+
*/
var CompositeLifeCycle = keyMirror({
/**
* Components in the process of being mounted respond to state changes
* differently.
*/
MOUNTING: null,
/**
* Components in the process of being unmounted are guarded against state
* changes.
*/
UNMOUNTING: null,
/**
* Components that are mounted and receiving new props respond to state
* changes differently.
*/
RECEIVING_PROPS: null,
/**
* Components that are mounted and receiving new state are guarded against
* additional state changes.
*/
RECEIVING_STATE: null
});
/**
* @lends {ReactCompositeComponent.prototype}
*/
var ReactCompositeComponentMixin = {
/**
* Base constructor for all composite component.
*
* @param {ReactDescriptor} descriptor
* @final
* @internal
*/
construct: function(descriptor) {
// Children can be either an array or more than one argument
ReactComponent.Mixin.construct.apply(this, arguments);
ReactOwner.Mixin.construct.apply(this, arguments);
this.state = null;
this._pendingState = null;
// This is the public post-processed context. The real context and pending
// context lives on the descriptor.
this.context = null;
this._compositeLifeCycleState = null;
},
/**
* Checks whether or not this composite component is mounted.
* @return {boolean} True if mounted, false otherwise.
* @protected
* @final
*/
isMounted: function() {
return ReactComponent.Mixin.isMounted.call(this) &&
this._compositeLifeCycleState !== CompositeLifeCycle.MOUNTING;
},
/**
* Initializes the component, renders markup, and registers event listeners.
*
* @param {string} rootID DOM ID of the root node.
* @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
* @param {number} mountDepth number of components in the owner hierarchy
* @return {?string} Rendered markup to be inserted into the DOM.
* @final
* @internal
*/
mountComponent: ReactPerf.measure(
'ReactCompositeComponent',
'mountComponent',
function(rootID, transaction, mountDepth) {
ReactComponent.Mixin.mountComponent.call(
this,
rootID,
transaction,
mountDepth
);
this._compositeLifeCycleState = CompositeLifeCycle.MOUNTING;
if (this.__reactAutoBindMap) {
this._bindAutoBindMethods();
}
this.context = this._processContext(this._descriptor._context);
this.props = this._processProps(this.props);
this.state = this.getInitialState ? this.getInitialState() : null;
("production" !== "development" ? invariant(
typeof this.state === 'object' && !Array.isArray(this.state),
'%s.getInitialState(): must return an object or null',
this.constructor.displayName || 'ReactCompositeComponent'
) : invariant(typeof this.state === 'object' && !Array.isArray(this.state)));
this._pendingState = null;
this._pendingForceUpdate = false;
if (this.componentWillMount) {
this.componentWillMount();
// When mounting, calls to `setState` by `componentWillMount` will set
// `this._pendingState` without triggering a re-render.
if (this._pendingState) {
this.state = this._pendingState;
this._pendingState = null;
}
}
this._renderedComponent = instantiateReactComponent(
this._renderValidatedComponent()
);
// Done with mounting, `setState` will now trigger UI changes.
this._compositeLifeCycleState = null;
var markup = this._renderedComponent.mountComponent(
rootID,
transaction,
mountDepth + 1
);
if (this.componentDidMount) {
transaction.getReactMountReady().enqueue(this.componentDidMount, this);
}
return markup;
}
),
/**
* Releases any resources allocated by `mountComponent`.
*
* @final
* @internal
*/
unmountComponent: function() {
this._compositeLifeCycleState = CompositeLifeCycle.UNMOUNTING;
if (this.componentWillUnmount) {
this.componentWillUnmount();
}
this._compositeLifeCycleState = null;
this._renderedComponent.unmountComponent();
this._renderedComponent = null;
ReactComponent.Mixin.unmountComponent.call(this);
// Some existing components rely on this.props even after they've been
// destroyed (in event handlers).
// TODO: this.props = null;
// TODO: this.state = null;
},
/**
* Sets a subset of the state. Always use this or `replaceState` to mutate
* state. You should treat `this.state` as immutable.
*
* There is no guarantee that `this.state` will be immediately updated, so
* accessing `this.state` after calling this method may return the old value.
*
* There is no guarantee that calls to `setState` will run synchronously,
* as they may eventually be batched together. You can provide an optional
* callback that will be executed when the call to setState is actually
* completed.
*
* @param {object} partialState Next partial state to be merged with state.
* @param {?function} callback Called after state is updated.
* @final
* @protected
*/
setState: function(partialState, callback) {
("production" !== "development" ? invariant(
typeof partialState === 'object' || partialState == null,
'setState(...): takes an object of state variables to update.'
) : invariant(typeof partialState === 'object' || partialState == null));
if ("production" !== "development"){
("production" !== "development" ? warning(
partialState != null,
'setState(...): You passed an undefined or null state object; ' +
'instead, use forceUpdate().'
) : null);
}
// Merge with `_pendingState` if it exists, otherwise with existing state.
this.replaceState(
merge(this._pendingState || this.state, partialState),
callback
);
},
/**
* Replaces all of the state. Always use this or `setState` to mutate state.
* You should treat `this.state` as immutable.
*
* There is no guarantee that `this.state` will be immediately updated, so
* accessing `this.state` after calling this method may return the old value.
*
* @param {object} completeState Next state.
* @param {?function} callback Called after state is updated.
* @final
* @protected
*/
replaceState: function(completeState, callback) {
validateLifeCycleOnReplaceState(this);
this._pendingState = completeState;
ReactUpdates.enqueueUpdate(this, callback);
},
/**
* Filters the context object to only contain keys specified in
* `contextTypes`, and asserts that they are valid.
*
* @param {object} context
* @return {?object}
* @private
*/
_processContext: function(context) {
var maskedContext = null;
var contextTypes = this.constructor.contextTypes;
if (contextTypes) {
maskedContext = {};
for (var contextName in contextTypes) {
maskedContext[contextName] = context[contextName];
}
if ("production" !== "development") {
this._checkPropTypes(
contextTypes,
maskedContext,
ReactPropTypeLocations.context
);
}
}
return maskedContext;
},
/**
* @param {object} currentContext
* @return {object}
* @private
*/
_processChildContext: function(currentContext) {
var childContext = this.getChildContext && this.getChildContext();
var displayName = this.constructor.displayName || 'ReactCompositeComponent';
if (childContext) {
("production" !== "development" ? invariant(
typeof this.constructor.childContextTypes === 'object',
'%s.getChildContext(): childContextTypes must be defined in order to ' +
'use getChildContext().',
displayName
) : invariant(typeof this.constructor.childContextTypes === 'object'));
if ("production" !== "development") {
this._checkPropTypes(
this.constructor.childContextTypes,
childContext,
ReactPropTypeLocations.childContext
);
}
for (var name in childContext) {
("production" !== "development" ? invariant(
name in this.constructor.childContextTypes,
'%s.getChildContext(): key "%s" is not defined in childContextTypes.',
displayName,
name
) : invariant(name in this.constructor.childContextTypes));
}
return merge(currentContext, childContext);
}
return currentContext;
},
/**
* Processes props by setting default values for unspecified props and
* asserting that the props are valid. Does not mutate its argument; returns
* a new props object with defaults merged in.
*
* @param {object} newProps
* @return {object}
* @private
*/
_processProps: function(newProps) {
var defaultProps = this.constructor.defaultProps;
var props;
if (defaultProps) {
props = merge(newProps);
for (var propName in defaultProps) {
if (typeof props[propName] === 'undefined') {
props[propName] = defaultProps[propName];
}
}
} else {
props = newProps;
}
if ("production" !== "development") {
var propTypes = this.constructor.propTypes;
if (propTypes) {
this._checkPropTypes(propTypes, props, ReactPropTypeLocations.prop);
}
}
return props;
},
/**
* Assert that the props are valid
*
* @param {object} propTypes Map of prop name to a ReactPropType
* @param {object} props
* @param {string} location e.g. "prop", "context", "child context"
* @private
*/
_checkPropTypes: function(propTypes, props, location) {
// TODO: Stop validating prop types here and only use the descriptor
// validation.
var componentName = this.constructor.displayName;
for (var propName in propTypes) {
if (propTypes.hasOwnProperty(propName)) {
var error =
propTypes[propName](props, propName, componentName, location);
if (error instanceof Error) {
// We may want to extend this logic for similar errors in
// renderComponent calls, so I'm abstracting it away into
// a function to minimize refactoring in the future
var addendum = getDeclarationErrorAddendum(this);
("production" !== "development" ? warning(false, error.message + addendum) : null);
}
}
}
},
/**
* If any of `_pendingDescriptor`, `_pendingState`, or `_pendingForceUpdate`
* is set, update the component.
*
* @param {ReactReconcileTransaction} transaction
* @internal
*/
performUpdateIfNecessary: function(transaction) {
var compositeLifeCycleState = this._compositeLifeCycleState;
// Do not trigger a state transition if we are in the middle of mounting or
// receiving props because both of those will already be doing this.
if (compositeLifeCycleState === CompositeLifeCycle.MOUNTING ||
compositeLifeCycleState === CompositeLifeCycle.RECEIVING_PROPS) {
return;
}
if (this._pendingDescriptor == null &&
this._pendingState == null &&
!this._pendingForceUpdate) {
return;
}
var nextContext = this.context;
var nextProps = this.props;
var nextDescriptor = this._descriptor;
if (this._pendingDescriptor != null) {
nextDescriptor = this._pendingDescriptor;
nextContext = this._processContext(nextDescriptor._context);
nextProps = this._processProps(nextDescriptor.props);
this._pendingDescriptor = null;
this._compositeLifeCycleState = CompositeLifeCycle.RECEIVING_PROPS;
if (this.componentWillReceiveProps) {
this.componentWillReceiveProps(nextProps, nextContext);
}
}
this._compositeLifeCycleState = CompositeLifeCycle.RECEIVING_STATE;
var nextState = this._pendingState || this.state;
this._pendingState = null;
try {
var shouldUpdate =
this._pendingForceUpdate ||
!this.shouldComponentUpdate ||
this.shouldComponentUpdate(nextProps, nextState, nextContext);
if ("production" !== "development") {
if (typeof shouldUpdate === "undefined") {
console.warn(
(this.constructor.displayName || 'ReactCompositeComponent') +
'.shouldComponentUpdate(): Returned undefined instead of a ' +
'boolean value. Make sure to return true or false.'
);
}
}
if (shouldUpdate) {
this._pendingForceUpdate = false;
// Will set `this.props`, `this.state` and `this.context`.
this._performComponentUpdate(
nextDescriptor,
nextProps,
nextState,
nextContext,
transaction
);
} else {
// If it's determined that a component should not update, we still want
// to set props and state.
this._descriptor = nextDescriptor;
this.props = nextProps;
this.state = nextState;
this.context = nextContext;
// Owner cannot change because shouldUpdateReactComponent doesn't allow
// it. TODO: Remove this._owner completely.
this._owner = nextDescriptor._owner;
}
} finally {
this._compositeLifeCycleState = null;
}
},
/**
* Merges new props and state, notifies delegate methods of update and
* performs update.
*
* @param {ReactDescriptor} nextDescriptor Next descriptor
* @param {object} nextProps Next public object to set as properties.
* @param {?object} nextState Next object to set as state.
* @param {?object} nextContext Next public object to set as context.
* @param {ReactReconcileTransaction} transaction
* @private
*/
_performComponentUpdate: function(
nextDescriptor,
nextProps,
nextState,
nextContext,
transaction
) {
var prevDescriptor = this._descriptor;
var prevProps = this.props;
var prevState = this.state;
var prevContext = this.context;
if (this.componentWillUpdate) {
this.componentWillUpdate(nextProps, nextState, nextContext);
}
this._descriptor = nextDescriptor;
this.props = nextProps;
this.state = nextState;
this.context = nextContext;
// Owner cannot change because shouldUpdateReactComponent doesn't allow
// it. TODO: Remove this._owner completely.
this._owner = nextDescriptor._owner;
this.updateComponent(
transaction,
prevDescriptor
);
if (this.componentDidUpdate) {
transaction.getReactMountReady().enqueue(
this.componentDidUpdate.bind(this, prevProps, prevState, prevContext),
this
);
}
},
receiveComponent: function(nextDescriptor, transaction) {
if (nextDescriptor === this._descriptor &&
nextDescriptor._owner != null) {
// Since descriptors are immutable after the owner is rendered,
// we can do a cheap identity compare here to determine if this is a
// superfluous reconcile. It's possible for state to be mutable but such
// change should trigger an update of the owner which would recreate
// the descriptor. We explicitly check for the existence of an owner since
// it's possible for a descriptor created outside a composite to be
// deeply mutated and reused.
return;
}
ReactComponent.Mixin.receiveComponent.call(
this,
nextDescriptor,
transaction
);
},
/**
* Updates the component's currently mounted DOM representation.
*
* By default, this implements React's rendering and reconciliation algorithm.
* Sophisticated clients may wish to override this.
*
* @param {ReactReconcileTransaction} transaction
* @param {ReactDescriptor} prevDescriptor
* @internal
* @overridable
*/
updateComponent: ReactPerf.measure(
'ReactCompositeComponent',
'updateComponent',
function(transaction, prevParentDescriptor) {
ReactComponent.Mixin.updateComponent.call(
this,
transaction,
prevParentDescriptor
);
var prevComponentInstance = this._renderedComponent;
var prevDescriptor = prevComponentInstance._descriptor;
var nextDescriptor = this._renderValidatedComponent();
if (shouldUpdateReactComponent(prevDescriptor, nextDescriptor)) {
prevComponentInstance.receiveComponent(nextDescriptor, transaction);
} else {
// These two IDs are actually the same! But nothing should rely on that.
var thisID = this._rootNodeID;
var prevComponentID = prevComponentInstance._rootNodeID;
prevComponentInstance.unmountComponent();
this._renderedComponent = instantiateReactComponent(nextDescriptor);
var nextMarkup = this._renderedComponent.mountComponent(
thisID,
transaction,
this._mountDepth + 1
);
ReactComponent.BackendIDOperations.dangerouslyReplaceNodeWithMarkupByID(
prevComponentID,
nextMarkup
);
}
}
),
/**
* Forces an update. This should only be invoked when it is known with
* certainty that we are **not** in a DOM transaction.
*
* You may want to call this when you know that some deeper aspect of the
* component's state has changed but `setState` was not called.
*
* This will not invoke `shouldUpdateComponent`, but it will invoke
* `componentWillUpdate` and `componentDidUpdate`.
*
* @param {?function} callback Called after update is complete.
* @final
* @protected
*/
forceUpdate: function(callback) {
var compositeLifeCycleState = this._compositeLifeCycleState;
("production" !== "development" ? invariant(
this.isMounted() ||
compositeLifeCycleState === CompositeLifeCycle.MOUNTING,
'forceUpdate(...): Can only force an update on mounted or mounting ' +
'components.'
) : invariant(this.isMounted() ||
compositeLifeCycleState === CompositeLifeCycle.MOUNTING));
("production" !== "development" ? invariant(
compositeLifeCycleState !== CompositeLifeCycle.RECEIVING_STATE &&
compositeLifeCycleState !== CompositeLifeCycle.UNMOUNTING,
'forceUpdate(...): Cannot force an update while unmounting component ' +
'or during an existing state transition (such as within `render`).'
) : invariant(compositeLifeCycleState !== CompositeLifeCycle.RECEIVING_STATE &&
compositeLifeCycleState !== CompositeLifeCycle.UNMOUNTING));
this._pendingForceUpdate = true;
ReactUpdates.enqueueUpdate(this, callback);
},
/**
* @private
*/
_renderValidatedComponent: ReactPerf.measure(
'ReactCompositeComponent',
'_renderValidatedComponent',
function() {
var renderedComponent;
var previousContext = ReactContext.current;
ReactContext.current = this._processChildContext(
this._descriptor._context
);
ReactCurrentOwner.current = this;
try {
renderedComponent = this.render();
if (renderedComponent === null || renderedComponent === false) {
renderedComponent = ReactEmptyComponent.getEmptyComponent();
ReactEmptyComponent.registerNullComponentID(this._rootNodeID);
} else {
ReactEmptyComponent.deregisterNullComponentID(this._rootNodeID);
}
} finally {
ReactContext.current = previousContext;
ReactCurrentOwner.current = null;
}
("production" !== "development" ? invariant(
ReactDescriptor.isValidDescriptor(renderedComponent),
'%s.render(): A valid ReactComponent must be returned. You may have ' +
'returned undefined, an array or some other invalid object.',
this.constructor.displayName || 'ReactCompositeComponent'
) : invariant(ReactDescriptor.isValidDescriptor(renderedComponent)));
return renderedComponent;
}
),
/**
* @private
*/
_bindAutoBindMethods: function() {
for (var autoBindKey in this.__reactAutoBindMap) {
if (!this.__reactAutoBindMap.hasOwnProperty(autoBindKey)) {
continue;
}
var method = this.__reactAutoBindMap[autoBindKey];
this[autoBindKey] = this._bindAutoBindMethod(ReactErrorUtils.guard(
method,
this.constructor.displayName + '.' + autoBindKey
));
}
},
/**
* Binds a method to the component.
*
* @param {function} method Method to be bound.
* @private
*/
_bindAutoBindMethod: function(method) {
var component = this;
var boundMethod = function() {
return method.apply(component, arguments);
};
if ("production" !== "development") {
boundMethod.__reactBoundContext = component;
boundMethod.__reactBoundMethod = method;
boundMethod.__reactBoundArguments = null;
var componentName = component.constructor.displayName;
var _bind = boundMethod.bind;
boundMethod.bind = function(newThis ) {var args=Array.prototype.slice.call(arguments,1);
// User is trying to bind() an autobound method; we effectively will
// ignore the value of "this" that the user is trying to use, so
// let's warn.
if (newThis !== component && newThis !== null) {
monitorCodeUse('react_bind_warning', { component: componentName });
console.warn(
'bind(): React component methods may only be bound to the ' +
'component instance. See ' + componentName
);
} else if (!args.length) {
monitorCodeUse('react_bind_warning', { component: componentName });
console.warn(
'bind(): You are binding a component method to the component. ' +
'React does this for you automatically in a high-performance ' +
'way, so you can safely remove this call. See ' + componentName
);
return boundMethod;
}
var reboundMethod = _bind.apply(boundMethod, arguments);
reboundMethod.__reactBoundContext = component;
reboundMethod.__reactBoundMethod = method;
reboundMethod.__reactBoundArguments = args;
return reboundMethod;
};
}
return boundMethod;
}
};
var ReactCompositeComponentBase = function() {};
mixInto(ReactCompositeComponentBase, ReactComponent.Mixin);
mixInto(ReactCompositeComponentBase, ReactOwner.Mixin);
mixInto(ReactCompositeComponentBase, ReactPropTransferer.Mixin);
mixInto(ReactCompositeComponentBase, ReactCompositeComponentMixin);
/**
* Module for creating composite components.
*
* @class ReactCompositeComponent
* @extends ReactComponent
* @extends ReactOwner
* @extends ReactPropTransferer
*/
var ReactCompositeComponent = {
LifeCycle: CompositeLifeCycle,
Base: ReactCompositeComponentBase,
/**
* Creates a composite component class given a class specification.
*
* @param {object} spec Class specification (which must define `render`).
* @return {function} Component constructor function.
* @public
*/
createClass: function(spec) {
var Constructor = function(props, owner) {
this.construct(props, owner);
};
Constructor.prototype = new ReactCompositeComponentBase();
Constructor.prototype.constructor = Constructor;
injectedMixins.forEach(
mixSpecIntoComponent.bind(null, Constructor)
);
mixSpecIntoComponent(Constructor, spec);
// Initialize the defaultProps property after all mixins have been merged
if (Constructor.getDefaultProps) {
Constructor.defaultProps = Constructor.getDefaultProps();
}
("production" !== "development" ? invariant(
Constructor.prototype.render,
'createClass(...): Class specification must implement a `render` method.'
) : invariant(Constructor.prototype.render));
if ("production" !== "development") {
if (Constructor.prototype.componentShouldUpdate) {
monitorCodeUse(
'react_component_should_update_warning',
{ component: spec.displayName }
);
console.warn(
(spec.displayName || 'A component') + ' has a method called ' +
'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' +
'The name is phrased as a question because the function is ' +
'expected to return a value.'
);
}
}
// Reduce time spent doing lookups by setting these on the prototype.
for (var methodName in ReactCompositeComponentInterface) {
if (!Constructor.prototype[methodName]) {
Constructor.prototype[methodName] = null;
}
}
var descriptorFactory = ReactDescriptor.createFactory(Constructor);
if ("production" !== "development") {
return ReactDescriptorValidator.createFactory(
descriptorFactory,
Constructor.propTypes,
Constructor.contextTypes
);
}
return descriptorFactory;
},
injection: {
injectMixin: function(mixin) {
injectedMixins.push(mixin);
}
}
};
module.exports = ReactCompositeComponent;
},{"./ReactComponent":35,"./ReactContext":39,"./ReactCurrentOwner":40,"./ReactDescriptor":56,"./ReactDescriptorValidator":57,"./ReactEmptyComponent":58,"./ReactErrorUtils":59,"./ReactOwner":70,"./ReactPerf":71,"./ReactPropTransferer":72,"./ReactPropTypeLocationNames":73,"./ReactPropTypeLocations":74,"./ReactUpdates":87,"./instantiateReactComponent":133,"./invariant":134,"./keyMirror":140,"./mapObject":142,"./merge":144,"./mixInto":147,"./monitorCodeUse":148,"./shouldUpdateReactComponent":154,"./warning":158}],39:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactContext
*/
"use strict";
var merge = _dereq_("./merge");
/**
* Keeps track of the current context.
*
* The context is automatically passed down the component ownership hierarchy
* and is accessible via `this.context` on ReactCompositeComponents.
*/
var ReactContext = {
/**
* @internal
* @type {object}
*/
current: {},
/**
* Temporarily extends the current context while executing scopedCallback.
*
* A typical use case might look like
*
* render: function() {
* var children = ReactContext.withContext({foo: 'foo'} () => (
*
* ));
* return <div>{children}</div>;
* }
*
* @param {object} newContext New context to merge into the existing context
* @param {function} scopedCallback Callback to run with the new context
* @return {ReactComponent|array<ReactComponent>}
*/
withContext: function(newContext, scopedCallback) {
var result;
var previousContext = ReactContext.current;
ReactContext.current = merge(previousContext, newContext);
try {
result = scopedCallback();
} finally {
ReactContext.current = previousContext;
}
return result;
}
};
module.exports = ReactContext;
},{"./merge":144}],40:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactCurrentOwner
*/
"use strict";
/**
* Keeps track of the current owner.
*
* The current owner is the component who should own any components that are
* currently being constructed.
*
* The depth indicate how many composite components are above this render level.
*/
var ReactCurrentOwner = {
/**
* @internal
* @type {ReactComponent}
*/
current: null
};
module.exports = ReactCurrentOwner;
},{}],41:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactDOM
* @typechecks static-only
*/
"use strict";
var ReactDescriptor = _dereq_("./ReactDescriptor");
var ReactDescriptorValidator = _dereq_("./ReactDescriptorValidator");
var ReactDOMComponent = _dereq_("./ReactDOMComponent");
var mergeInto = _dereq_("./mergeInto");
var mapObject = _dereq_("./mapObject");
/**
* Creates a new React class that is idempotent and capable of containing other
* React components. It accepts event listeners and DOM properties that are
* valid according to `DOMProperty`.
*
* - Event listeners: `onClick`, `onMouseDown`, etc.
* - DOM properties: `className`, `name`, `title`, etc.
*
* The `style` property functions differently from the DOM API. It accepts an
* object mapping of style properties to values.
*
* @param {boolean} omitClose True if the close tag should be omitted.
* @param {string} tag Tag name (e.g. `div`).
* @private
*/
function createDOMComponentClass(omitClose, tag) {
var Constructor = function(descriptor) {
this.construct(descriptor);
};
Constructor.prototype = new ReactDOMComponent(tag, omitClose);
Constructor.prototype.constructor = Constructor;
Constructor.displayName = tag;
var ConvenienceConstructor = ReactDescriptor.createFactory(Constructor);
if ("production" !== "development") {
return ReactDescriptorValidator.createFactory(
ConvenienceConstructor
);
}
return ConvenienceConstructor;
}
/**
* Creates a mapping from supported HTML tags to `ReactDOMComponent` classes.
* This is also accessible via `React.DOM`.
*
* @public
*/
var ReactDOM = mapObject({
a: false,
abbr: false,
address: false,
area: true,
article: false,
aside: false,
audio: false,
b: false,
base: true,
bdi: false,
bdo: false,
big: false,
blockquote: false,
body: false,
br: true,
button: false,
canvas: false,
caption: false,
cite: false,
code: false,
col: true,
colgroup: false,
data: false,
datalist: false,
dd: false,
del: false,
details: false,
dfn: false,
div: false,
dl: false,
dt: false,
em: false,
embed: true,
fieldset: false,
figcaption: false,
figure: false,
footer: false,
form: false, // NOTE: Injected, see `ReactDOMForm`.
h1: false,
h2: false,
h3: false,
h4: false,
h5: false,
h6: false,
head: false,
header: false,
hr: true,
html: false,
i: false,
iframe: false,
img: true,
input: true,
ins: false,
kbd: false,
keygen: true,
label: false,
legend: false,
li: false,
link: true,
main: false,
map: false,
mark: false,
menu: false,
menuitem: false, // NOTE: Close tag should be omitted, but causes problems.
meta: true,
meter: false,
nav: false,
noscript: false,
object: false,
ol: false,
optgroup: false,
option: false,
output: false,
p: false,
param: true,
pre: false,
progress: false,
q: false,
rp: false,
rt: false,
ruby: false,
s: false,
samp: false,
script: false,
section: false,
select: false,
small: false,
source: true,
span: false,
strong: false,
style: false,
sub: false,
summary: false,
sup: false,
table: false,
tbody: false,
td: false,
textarea: false, // NOTE: Injected, see `ReactDOMTextarea`.
tfoot: false,
th: false,
thead: false,
time: false,
title: false,
tr: false,
track: true,
u: false,
ul: false,
'var': false,
video: false,
wbr: true,
// SVG
circle: false,
defs: false,
ellipse: false,
g: false,
line: false,
linearGradient: false,
mask: false,
path: false,
pattern: false,
polygon: false,
polyline: false,
radialGradient: false,
rect: false,
stop: false,
svg: false,
text: false,
tspan: false
}, createDOMComponentClass);
var injection = {
injectComponentClasses: function(componentClasses) {
mergeInto(ReactDOM, componentClasses);
}
};
ReactDOM.injection = injection;
module.exports = ReactDOM;
},{"./ReactDOMComponent":43,"./ReactDescriptor":56,"./ReactDescriptorValidator":57,"./mapObject":142,"./mergeInto":146}],42:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactDOMButton
*/
"use strict";
var AutoFocusMixin = _dereq_("./AutoFocusMixin");
var ReactBrowserComponentMixin = _dereq_("./ReactBrowserComponentMixin");
var ReactCompositeComponent = _dereq_("./ReactCompositeComponent");
var ReactDOM = _dereq_("./ReactDOM");
var keyMirror = _dereq_("./keyMirror");
// Store a reference to the <button> `ReactDOMComponent`.
var button = ReactDOM.button;
var mouseListenerNames = keyMirror({
onClick: true,
onDoubleClick: true,
onMouseDown: true,
onMouseMove: true,
onMouseUp: true,
onClickCapture: true,
onDoubleClickCapture: true,
onMouseDownCapture: true,
onMouseMoveCapture: true,
onMouseUpCapture: true
});
/**
* Implements a <button> native component that does not receive mouse events
* when `disabled` is set.
*/
var ReactDOMButton = ReactCompositeComponent.createClass({
displayName: 'ReactDOMButton',
mixins: [AutoFocusMixin, ReactBrowserComponentMixin],
render: function() {
var props = {};
// Copy the props; except the mouse listeners if we're disabled
for (var key in this.props) {
if (this.props.hasOwnProperty(key) &&
(!this.props.disabled || !mouseListenerNames[key])) {
props[key] = this.props[key];
}
}
return button(props, this.props.children);
}
});
module.exports = ReactDOMButton;
},{"./AutoFocusMixin":1,"./ReactBrowserComponentMixin":30,"./ReactCompositeComponent":38,"./ReactDOM":41,"./keyMirror":140}],43:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactDOMComponent
* @typechecks static-only
*/
"use strict";
var CSSPropertyOperations = _dereq_("./CSSPropertyOperations");
var DOMProperty = _dereq_("./DOMProperty");
var DOMPropertyOperations = _dereq_("./DOMPropertyOperations");
var ReactBrowserComponentMixin = _dereq_("./ReactBrowserComponentMixin");
var ReactComponent = _dereq_("./ReactComponent");
var ReactBrowserEventEmitter = _dereq_("./ReactBrowserEventEmitter");
var ReactMount = _dereq_("./ReactMount");
var ReactMultiChild = _dereq_("./ReactMultiChild");
var ReactPerf = _dereq_("./ReactPerf");
var escapeTextForBrowser = _dereq_("./escapeTextForBrowser");
var invariant = _dereq_("./invariant");
var keyOf = _dereq_("./keyOf");
var merge = _dereq_("./merge");
var mixInto = _dereq_("./mixInto");
var deleteListener = ReactBrowserEventEmitter.deleteListener;
var listenTo = ReactBrowserEventEmitter.listenTo;
var registrationNameModules = ReactBrowserEventEmitter.registrationNameModules;
// For quickly matching children type, to test if can be treated as content.
var CONTENT_TYPES = {'string': true, 'number': true};
var STYLE = keyOf({style: null});
var ELEMENT_NODE_TYPE = 1;
/**
* @param {?object} props
*/
function assertValidProps(props) {
if (!props) {
return;
}
// Note the use of `==` which checks for null or undefined.
("production" !== "development" ? invariant(
props.children == null || props.dangerouslySetInnerHTML == null,
'Can only set one of `children` or `props.dangerouslySetInnerHTML`.'
) : invariant(props.children == null || props.dangerouslySetInnerHTML == null));
("production" !== "development" ? invariant(
props.style == null || typeof props.style === 'object',
'The `style` prop expects a mapping from style properties to values, ' +
'not a string.'
) : invariant(props.style == null || typeof props.style === 'object'));
}
function putListener(id, registrationName, listener, transaction) {
var container = ReactMount.findReactContainerForID(id);
if (container) {
var doc = container.nodeType === ELEMENT_NODE_TYPE ?
container.ownerDocument :
container;
listenTo(registrationName, doc);
}
transaction.getPutListenerQueue().enqueuePutListener(
id,
registrationName,
listener
);
}
/**
* @constructor ReactDOMComponent
* @extends ReactComponent
* @extends ReactMultiChild
*/
function ReactDOMComponent(tag, omitClose) {
this._tagOpen = '<' + tag;
this._tagClose = omitClose ? '' : '</' + tag + '>';
this.tagName = tag.toUpperCase();
}
ReactDOMComponent.Mixin = {
/**
* Generates root tag markup then recurses. This method has side effects and
* is not idempotent.
*
* @internal
* @param {string} rootID The root DOM ID for this node.
* @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
* @param {number} mountDepth number of components in the owner hierarchy
* @return {string} The computed markup.
*/
mountComponent: ReactPerf.measure(
'ReactDOMComponent',
'mountComponent',
function(rootID, transaction, mountDepth) {
ReactComponent.Mixin.mountComponent.call(
this,
rootID,
transaction,
mountDepth
);
assertValidProps(this.props);
return (
this._createOpenTagMarkupAndPutListeners(transaction) +
this._createContentMarkup(transaction) +
this._tagClose
);
}
),
/**
* Creates markup for the open tag and all attributes.
*
* This method has side effects because events get registered.
*
* Iterating over object properties is faster than iterating over arrays.
* @see http://jsperf.com/obj-vs-arr-iteration
*
* @private
* @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
* @return {string} Markup of opening tag.
*/
_createOpenTagMarkupAndPutListeners: function(transaction) {
var props = this.props;
var ret = this._tagOpen;
for (var propKey in props) {
if (!props.hasOwnProperty(propKey)) {
continue;
}
var propValue = props[propKey];
if (propValue == null) {
continue;
}
if (registrationNameModules.hasOwnProperty(propKey)) {
putListener(this._rootNodeID, propKey, propValue, transaction);
} else {
if (propKey === STYLE) {
if (propValue) {
propValue = props.style = merge(props.style);
}
propValue = CSSPropertyOperations.createMarkupForStyles(propValue);
}
var markup =
DOMPropertyOperations.createMarkupForProperty(propKey, propValue);
if (markup) {
ret += ' ' + markup;
}
}
}
// For static pages, no need to put React ID and checksum. Saves lots of
// bytes.
if (transaction.renderToStaticMarkup) {
return ret + '>';
}
var markupForID = DOMPropertyOperations.createMarkupForID(this._rootNodeID);
return ret + ' ' + markupForID + '>';
},
/**
* Creates markup for the content between the tags.
*
* @private
* @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
* @return {string} Content markup.
*/
_createContentMarkup: function(transaction) {
// Intentional use of != to avoid catching zero/false.
var innerHTML = this.props.dangerouslySetInnerHTML;
if (innerHTML != null) {
if (innerHTML.__html != null) {
return innerHTML.__html;
}
} else {
var contentToUse =
CONTENT_TYPES[typeof this.props.children] ? this.props.children : null;
var childrenToUse = contentToUse != null ? null : this.props.children;
if (contentToUse != null) {
return escapeTextForBrowser(contentToUse);
} else if (childrenToUse != null) {
var mountImages = this.mountChildren(
childrenToUse,
transaction
);
return mountImages.join('');
}
}
return '';
},
receiveComponent: function(nextDescriptor, transaction) {
if (nextDescriptor === this._descriptor &&
nextDescriptor._owner != null) {
// Since descriptors are immutable after the owner is rendered,
// we can do a cheap identity compare here to determine if this is a
// superfluous reconcile. It's possible for state to be mutable but such
// change should trigger an update of the owner which would recreate
// the descriptor. We explicitly check for the existence of an owner since
// it's possible for a descriptor created outside a composite to be
// deeply mutated and reused.
return;
}
ReactComponent.Mixin.receiveComponent.call(
this,
nextDescriptor,
transaction
);
},
/**
* Updates a native DOM component after it has already been allocated and
* attached to the DOM. Reconciles the root DOM node, then recurses.
*
* @param {ReactReconcileTransaction} transaction
* @param {ReactDescriptor} prevDescriptor
* @internal
* @overridable
*/
updateComponent: ReactPerf.measure(
'ReactDOMComponent',
'updateComponent',
function(transaction, prevDescriptor) {
assertValidProps(this._descriptor.props);
ReactComponent.Mixin.updateComponent.call(
this,
transaction,
prevDescriptor
);
this._updateDOMProperties(prevDescriptor.props, transaction);
this._updateDOMChildren(prevDescriptor.props, transaction);
}
),
/**
* Reconciles the properties by detecting differences in property values and
* updating the DOM as necessary. This function is probably the single most
* critical path for performance optimization.
*
* TODO: Benchmark whether checking for changed values in memory actually
* improves performance (especially statically positioned elements).
* TODO: Benchmark the effects of putting this at the top since 99% of props
* do not change for a given reconciliation.
* TODO: Benchmark areas that can be improved with caching.
*
* @private
* @param {object} lastProps
* @param {ReactReconcileTransaction} transaction
*/
_updateDOMProperties: function(lastProps, transaction) {
var nextProps = this.props;
var propKey;
var styleName;
var styleUpdates;
for (propKey in lastProps) {
if (nextProps.hasOwnProperty(propKey) ||
!lastProps.hasOwnProperty(propKey)) {
continue;
}
if (propKey === STYLE) {
var lastStyle = lastProps[propKey];
for (styleName in lastStyle) {
if (lastStyle.hasOwnProperty(styleName)) {
styleUpdates = styleUpdates || {};
styleUpdates[styleName] = '';
}
}
} else if (registrationNameModules.hasOwnProperty(propKey)) {
deleteListener(this._rootNodeID, propKey);
} else if (
DOMProperty.isStandardName[propKey] ||
DOMProperty.isCustomAttribute(propKey)) {
ReactComponent.BackendIDOperations.deletePropertyByID(
this._rootNodeID,
propKey
);
}
}
for (propKey in nextProps) {
var nextProp = nextProps[propKey];
var lastProp = lastProps[propKey];
if (!nextProps.hasOwnProperty(propKey) || nextProp === lastProp) {
continue;
}
if (propKey === STYLE) {
if (nextProp) {
nextProp = nextProps.style = merge(nextProp);
}
if (lastProp) {
// Unset styles on `lastProp` but not on `nextProp`.
for (styleName in lastProp) {
if (lastProp.hasOwnProperty(styleName) &&
(!nextProp || !nextProp.hasOwnProperty(styleName))) {
styleUpdates = styleUpdates || {};
styleUpdates[styleName] = '';
}
}
// Update styles that changed since `lastProp`.
for (styleName in nextProp) {
if (nextProp.hasOwnProperty(styleName) &&
lastProp[styleName] !== nextProp[styleName]) {
styleUpdates = styleUpdates || {};
styleUpdates[styleName] = nextProp[styleName];
}
}
} else {
// Relies on `updateStylesByID` not mutating `styleUpdates`.
styleUpdates = nextProp;
}
} else if (registrationNameModules.hasOwnProperty(propKey)) {
putListener(this._rootNodeID, propKey, nextProp, transaction);
} else if (
DOMProperty.isStandardName[propKey] ||
DOMProperty.isCustomAttribute(propKey)) {
ReactComponent.BackendIDOperations.updatePropertyByID(
this._rootNodeID,
propKey,
nextProp
);
}
}
if (styleUpdates) {
ReactComponent.BackendIDOperations.updateStylesByID(
this._rootNodeID,
styleUpdates
);
}
},
/**
* Reconciles the children with the various properties that affect the
* children content.
*
* @param {object} lastProps
* @param {ReactReconcileTransaction} transaction
*/
_updateDOMChildren: function(lastProps, transaction) {
var nextProps = this.props;
var lastContent =
CONTENT_TYPES[typeof lastProps.children] ? lastProps.children : null;
var nextContent =
CONTENT_TYPES[typeof nextProps.children] ? nextProps.children : null;
var lastHtml =
lastProps.dangerouslySetInnerHTML &&
lastProps.dangerouslySetInnerHTML.__html;
var nextHtml =
nextProps.dangerouslySetInnerHTML &&
nextProps.dangerouslySetInnerHTML.__html;
// Note the use of `!=` which checks for null or undefined.
var lastChildren = lastContent != null ? null : lastProps.children;
var nextChildren = nextContent != null ? null : nextProps.children;
// If we're switching from children to content/html or vice versa, remove
// the old content
var lastHasContentOrHtml = lastContent != null || lastHtml != null;
var nextHasContentOrHtml = nextContent != null || nextHtml != null;
if (lastChildren != null && nextChildren == null) {
this.updateChildren(null, transaction);
} else if (lastHasContentOrHtml && !nextHasContentOrHtml) {
this.updateTextContent('');
}
if (nextContent != null) {
if (lastContent !== nextContent) {
this.updateTextContent('' + nextContent);
}
} else if (nextHtml != null) {
if (lastHtml !== nextHtml) {
ReactComponent.BackendIDOperations.updateInnerHTMLByID(
this._rootNodeID,
nextHtml
);
}
} else if (nextChildren != null) {
this.updateChildren(nextChildren, transaction);
}
},
/**
* Destroys all event registrations for this instance. Does not remove from
* the DOM. That must be done by the parent.
*
* @internal
*/
unmountComponent: function() {
this.unmountChildren();
ReactBrowserEventEmitter.deleteAllListeners(this._rootNodeID);
ReactComponent.Mixin.unmountComponent.call(this);
}
};
mixInto(ReactDOMComponent, ReactComponent.Mixin);
mixInto(ReactDOMComponent, ReactDOMComponent.Mixin);
mixInto(ReactDOMComponent, ReactMultiChild.Mixin);
mixInto(ReactDOMComponent, ReactBrowserComponentMixin);
module.exports = ReactDOMComponent;
},{"./CSSPropertyOperations":5,"./DOMProperty":11,"./DOMPropertyOperations":12,"./ReactBrowserComponentMixin":30,"./ReactBrowserEventEmitter":31,"./ReactComponent":35,"./ReactMount":67,"./ReactMultiChild":68,"./ReactPerf":71,"./escapeTextForBrowser":118,"./invariant":134,"./keyOf":141,"./merge":144,"./mixInto":147}],44:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactDOMForm
*/
"use strict";
var EventConstants = _dereq_("./EventConstants");
var LocalEventTrapMixin = _dereq_("./LocalEventTrapMixin");
var ReactBrowserComponentMixin = _dereq_("./ReactBrowserComponentMixin");
var ReactCompositeComponent = _dereq_("./ReactCompositeComponent");
var ReactDOM = _dereq_("./ReactDOM");
// Store a reference to the <form> `ReactDOMComponent`.
var form = ReactDOM.form;
/**
* Since onSubmit doesn't bubble OR capture on the top level in IE8, we need
* to capture it on the <form> element itself. There are lots of hacks we could
* do to accomplish this, but the most reliable is to make <form> a
* composite component and use `componentDidMount` to attach the event handlers.
*/
var ReactDOMForm = ReactCompositeComponent.createClass({
displayName: 'ReactDOMForm',
mixins: [ReactBrowserComponentMixin, LocalEventTrapMixin],
render: function() {
// TODO: Instead of using `ReactDOM` directly, we should use JSX. However,
// `jshint` fails to parse JSX so in order for linting to work in the open
// source repo, we need to just use `ReactDOM.form`.
return this.transferPropsTo(form(null, this.props.children));
},
componentDidMount: function() {
this.trapBubbledEvent(EventConstants.topLevelTypes.topReset, 'reset');
this.trapBubbledEvent(EventConstants.topLevelTypes.topSubmit, 'submit');
}
});
module.exports = ReactDOMForm;
},{"./EventConstants":16,"./LocalEventTrapMixin":26,"./ReactBrowserComponentMixin":30,"./ReactCompositeComponent":38,"./ReactDOM":41}],45:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactDOMIDOperations
* @typechecks static-only
*/
/*jslint evil: true */
"use strict";
var CSSPropertyOperations = _dereq_("./CSSPropertyOperations");
var DOMChildrenOperations = _dereq_("./DOMChildrenOperations");
var DOMPropertyOperations = _dereq_("./DOMPropertyOperations");
var ReactMount = _dereq_("./ReactMount");
var ReactPerf = _dereq_("./ReactPerf");
var invariant = _dereq_("./invariant");
var setInnerHTML = _dereq_("./setInnerHTML");
/**
* Errors for properties that should not be updated with `updatePropertyById()`.
*
* @type {object}
* @private
*/
var INVALID_PROPERTY_ERRORS = {
dangerouslySetInnerHTML:
'`dangerouslySetInnerHTML` must be set using `updateInnerHTMLByID()`.',
style: '`style` must be set using `updateStylesByID()`.'
};
/**
* Operations used to process updates to DOM nodes. This is made injectable via
* `ReactComponent.BackendIDOperations`.
*/
var ReactDOMIDOperations = {
/**
* Updates a DOM node with new property values. This should only be used to
* update DOM properties in `DOMProperty`.
*
* @param {string} id ID of the node to update.
* @param {string} name A valid property name, see `DOMProperty`.
* @param {*} value New value of the property.
* @internal
*/
updatePropertyByID: ReactPerf.measure(
'ReactDOMIDOperations',
'updatePropertyByID',
function(id, name, value) {
var node = ReactMount.getNode(id);
("production" !== "development" ? invariant(
!INVALID_PROPERTY_ERRORS.hasOwnProperty(name),
'updatePropertyByID(...): %s',
INVALID_PROPERTY_ERRORS[name]
) : invariant(!INVALID_PROPERTY_ERRORS.hasOwnProperty(name)));
// If we're updating to null or undefined, we should remove the property
// from the DOM node instead of inadvertantly setting to a string. This
// brings us in line with the same behavior we have on initial render.
if (value != null) {
DOMPropertyOperations.setValueForProperty(node, name, value);
} else {
DOMPropertyOperations.deleteValueForProperty(node, name);
}
}
),
/**
* Updates a DOM node to remove a property. This should only be used to remove
* DOM properties in `DOMProperty`.
*
* @param {string} id ID of the node to update.
* @param {string} name A property name to remove, see `DOMProperty`.
* @internal
*/
deletePropertyByID: ReactPerf.measure(
'ReactDOMIDOperations',
'deletePropertyByID',
function(id, name, value) {
var node = ReactMount.getNode(id);
("production" !== "development" ? invariant(
!INVALID_PROPERTY_ERRORS.hasOwnProperty(name),
'updatePropertyByID(...): %s',
INVALID_PROPERTY_ERRORS[name]
) : invariant(!INVALID_PROPERTY_ERRORS.hasOwnProperty(name)));
DOMPropertyOperations.deleteValueForProperty(node, name, value);
}
),
/**
* Updates a DOM node with new style values. If a value is specified as '',
* the corresponding style property will be unset.
*
* @param {string} id ID of the node to update.
* @param {object} styles Mapping from styles to values.
* @internal
*/
updateStylesByID: ReactPerf.measure(
'ReactDOMIDOperations',
'updateStylesByID',
function(id, styles) {
var node = ReactMount.getNode(id);
CSSPropertyOperations.setValueForStyles(node, styles);
}
),
/**
* Updates a DOM node's innerHTML.
*
* @param {string} id ID of the node to update.
* @param {string} html An HTML string.
* @internal
*/
updateInnerHTMLByID: ReactPerf.measure(
'ReactDOMIDOperations',
'updateInnerHTMLByID',
function(id, html) {
var node = ReactMount.getNode(id);
setInnerHTML(node, html);
}
),
/**
* Updates a DOM node's text content set by `props.content`.
*
* @param {string} id ID of the node to update.
* @param {string} content Text content.
* @internal
*/
updateTextContentByID: ReactPerf.measure(
'ReactDOMIDOperations',
'updateTextContentByID',
function(id, content) {
var node = ReactMount.getNode(id);
DOMChildrenOperations.updateTextContent(node, content);
}
),
/**
* Replaces a DOM node that exists in the document with markup.
*
* @param {string} id ID of child to be replaced.
* @param {string} markup Dangerous markup to inject in place of child.
* @internal
* @see {Danger.dangerouslyReplaceNodeWithMarkup}
*/
dangerouslyReplaceNodeWithMarkupByID: ReactPerf.measure(
'ReactDOMIDOperations',
'dangerouslyReplaceNodeWithMarkupByID',
function(id, markup) {
var node = ReactMount.getNode(id);
DOMChildrenOperations.dangerouslyReplaceNodeWithMarkup(node, markup);
}
),
/**
* Updates a component's children by processing a series of updates.
*
* @param {array<object>} updates List of update configurations.
* @param {array<string>} markup List of markup strings.
* @internal
*/
dangerouslyProcessChildrenUpdates: ReactPerf.measure(
'ReactDOMIDOperations',
'dangerouslyProcessChildrenUpdates',
function(updates, markup) {
for (var i = 0; i < updates.length; i++) {
updates[i].parentNode = ReactMount.getNode(updates[i].parentID);
}
DOMChildrenOperations.processUpdates(updates, markup);
}
)
};
module.exports = ReactDOMIDOperations;
},{"./CSSPropertyOperations":5,"./DOMChildrenOperations":10,"./DOMPropertyOperations":12,"./ReactMount":67,"./ReactPerf":71,"./invariant":134,"./setInnerHTML":152}],46:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactDOMImg
*/
"use strict";
var EventConstants = _dereq_("./EventConstants");
var LocalEventTrapMixin = _dereq_("./LocalEventTrapMixin");
var ReactBrowserComponentMixin = _dereq_("./ReactBrowserComponentMixin");
var ReactCompositeComponent = _dereq_("./ReactCompositeComponent");
var ReactDOM = _dereq_("./ReactDOM");
// Store a reference to the <img> `ReactDOMComponent`.
var img = ReactDOM.img;
/**
* Since onLoad doesn't bubble OR capture on the top level in IE8, we need to
* capture it on the <img> element itself. There are lots of hacks we could do
* to accomplish this, but the most reliable is to make <img> a composite
* component and use `componentDidMount` to attach the event handlers.
*/
var ReactDOMImg = ReactCompositeComponent.createClass({
displayName: 'ReactDOMImg',
tagName: 'IMG',
mixins: [ReactBrowserComponentMixin, LocalEventTrapMixin],
render: function() {
return img(this.props);
},
componentDidMount: function() {
this.trapBubbledEvent(EventConstants.topLevelTypes.topLoad, 'load');
this.trapBubbledEvent(EventConstants.topLevelTypes.topError, 'error');
}
});
module.exports = ReactDOMImg;
},{"./EventConstants":16,"./LocalEventTrapMixin":26,"./ReactBrowserComponentMixin":30,"./ReactCompositeComponent":38,"./ReactDOM":41}],47:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactDOMInput
*/
"use strict";
var AutoFocusMixin = _dereq_("./AutoFocusMixin");
var DOMPropertyOperations = _dereq_("./DOMPropertyOperations");
var LinkedValueUtils = _dereq_("./LinkedValueUtils");
var ReactBrowserComponentMixin = _dereq_("./ReactBrowserComponentMixin");
var ReactCompositeComponent = _dereq_("./ReactCompositeComponent");
var ReactDOM = _dereq_("./ReactDOM");
var ReactMount = _dereq_("./ReactMount");
var invariant = _dereq_("./invariant");
var merge = _dereq_("./merge");
// Store a reference to the <input> `ReactDOMComponent`.
var input = ReactDOM.input;
var instancesByReactID = {};
/**
* Implements an <input> native component that allows setting these optional
* props: `checked`, `value`, `defaultChecked`, and `defaultValue`.
*
* If `checked` or `value` are not supplied (or null/undefined), user actions
* that affect the checked state or value will trigger updates to the element.
*
* If they are supplied (and not null/undefined), the rendered element will not
* trigger updates to the element. Instead, the props must change in order for
* the rendered element to be updated.
*
* The rendered element will be initialized as unchecked (or `defaultChecked`)
* with an empty value (or `defaultValue`).
*
* @see http://www.w3.org/TR/2012/WD-html5-20121025/the-input-element.html
*/
var ReactDOMInput = ReactCompositeComponent.createClass({
displayName: 'ReactDOMInput',
mixins: [AutoFocusMixin, LinkedValueUtils.Mixin, ReactBrowserComponentMixin],
getInitialState: function() {
var defaultValue = this.props.defaultValue;
return {
checked: this.props.defaultChecked || false,
value: defaultValue != null ? defaultValue : null
};
},
shouldComponentUpdate: function() {
// Defer any updates to this component during the `onChange` handler.
return !this._isChanging;
},
render: function() {
// Clone `this.props` so we don't mutate the input.
var props = merge(this.props);
props.defaultChecked = null;
props.defaultValue = null;
var value = LinkedValueUtils.getValue(this);
props.value = value != null ? value : this.state.value;
var checked = LinkedValueUtils.getChecked(this);
props.checked = checked != null ? checked : this.state.checked;
props.onChange = this._handleChange;
return input(props, this.props.children);
},
componentDidMount: function() {
var id = ReactMount.getID(this.getDOMNode());
instancesByReactID[id] = this;
},
componentWillUnmount: function() {
var rootNode = this.getDOMNode();
var id = ReactMount.getID(rootNode);
delete instancesByReactID[id];
},
componentDidUpdate: function(prevProps, prevState, prevContext) {
var rootNode = this.getDOMNode();
if (this.props.checked != null) {
DOMPropertyOperations.setValueForProperty(
rootNode,
'checked',
this.props.checked || false
);
}
var value = LinkedValueUtils.getValue(this);
if (value != null) {
// Cast `value` to a string to ensure the value is set correctly. While
// browsers typically do this as necessary, jsdom doesn't.
DOMPropertyOperations.setValueForProperty(rootNode, 'value', '' + value);
}
},
_handleChange: function(event) {
var returnValue;
var onChange = LinkedValueUtils.getOnChange(this);
if (onChange) {
this._isChanging = true;
returnValue = onChange.call(this, event);
this._isChanging = false;
}
this.setState({
checked: event.target.checked,
value: event.target.value
});
var name = this.props.name;
if (this.props.type === 'radio' && name != null) {
var rootNode = this.getDOMNode();
var queryRoot = rootNode;
while (queryRoot.parentNode) {
queryRoot = queryRoot.parentNode;
}
// If `rootNode.form` was non-null, then we could try `form.elements`,
// but that sometimes behaves strangely in IE8. We could also try using
// `form.getElementsByName`, but that will only return direct children
// and won't include inputs that use the HTML5 `form=` attribute. Since
// the input might not even be in a form, let's just use the global
// `querySelectorAll` to ensure we don't miss anything.
var group = queryRoot.querySelectorAll(
'input[name=' + JSON.stringify('' + name) + '][type="radio"]');
for (var i = 0, groupLen = group.length; i < groupLen; i++) {
var otherNode = group[i];
if (otherNode === rootNode ||
otherNode.form !== rootNode.form) {
continue;
}
var otherID = ReactMount.getID(otherNode);
("production" !== "development" ? invariant(
otherID,
'ReactDOMInput: Mixing React and non-React radio inputs with the ' +
'same `name` is not supported.'
) : invariant(otherID));
var otherInstance = instancesByReactID[otherID];
("production" !== "development" ? invariant(
otherInstance,
'ReactDOMInput: Unknown radio button ID %s.',
otherID
) : invariant(otherInstance));
// In some cases, this will actually change the `checked` state value.
// In other cases, there's no change but this forces a reconcile upon
// which componentDidUpdate will reset the DOM property to whatever it
// should be.
otherInstance.setState({
checked: false
});
}
}
return returnValue;
}
});
module.exports = ReactDOMInput;
},{"./AutoFocusMixin":1,"./DOMPropertyOperations":12,"./LinkedValueUtils":25,"./ReactBrowserComponentMixin":30,"./ReactCompositeComponent":38,"./ReactDOM":41,"./ReactMount":67,"./invariant":134,"./merge":144}],48:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactDOMOption
*/
"use strict";
var ReactBrowserComponentMixin = _dereq_("./ReactBrowserComponentMixin");
var ReactCompositeComponent = _dereq_("./ReactCompositeComponent");
var ReactDOM = _dereq_("./ReactDOM");
var warning = _dereq_("./warning");
// Store a reference to the <option> `ReactDOMComponent`.
var option = ReactDOM.option;
/**
* Implements an <option> native component that warns when `selected` is set.
*/
var ReactDOMOption = ReactCompositeComponent.createClass({
displayName: 'ReactDOMOption',
mixins: [ReactBrowserComponentMixin],
componentWillMount: function() {
// TODO (yungsters): Remove support for `selected` in <option>.
if ("production" !== "development") {
("production" !== "development" ? warning(
this.props.selected == null,
'Use the `defaultValue` or `value` props on <select> instead of ' +
'setting `selected` on <option>.'
) : null);
}
},
render: function() {
return option(this.props, this.props.children);
}
});
module.exports = ReactDOMOption;
},{"./ReactBrowserComponentMixin":30,"./ReactCompositeComponent":38,"./ReactDOM":41,"./warning":158}],49:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactDOMSelect
*/
"use strict";
var AutoFocusMixin = _dereq_("./AutoFocusMixin");
var LinkedValueUtils = _dereq_("./LinkedValueUtils");
var ReactBrowserComponentMixin = _dereq_("./ReactBrowserComponentMixin");
var ReactCompositeComponent = _dereq_("./ReactCompositeComponent");
var ReactDOM = _dereq_("./ReactDOM");
var merge = _dereq_("./merge");
// Store a reference to the <select> `ReactDOMComponent`.
var select = ReactDOM.select;
/**
* Validation function for `value` and `defaultValue`.
* @private
*/
function selectValueType(props, propName, componentName) {
if (props[propName] == null) {
return;
}
if (props.multiple) {
if (!Array.isArray(props[propName])) {
return new Error(
("The `" + propName + "` prop supplied to <select> must be an array if ") +
("`multiple` is true.")
);
}
} else {
if (Array.isArray(props[propName])) {
return new Error(
("The `" + propName + "` prop supplied to <select> must be a scalar ") +
("value if `multiple` is false.")
);
}
}
}
/**
* If `value` is supplied, updates <option> elements on mount and update.
* @param {ReactComponent} component Instance of ReactDOMSelect
* @param {?*} propValue For uncontrolled components, null/undefined. For
* controlled components, a string (or with `multiple`, a list of strings).
* @private
*/
function updateOptions(component, propValue) {
var multiple = component.props.multiple;
var value = propValue != null ? propValue : component.state.value;
var options = component.getDOMNode().options;
var selectedValue, i, l;
if (multiple) {
selectedValue = {};
for (i = 0, l = value.length; i < l; ++i) {
selectedValue['' + value[i]] = true;
}
} else {
selectedValue = '' + value;
}
for (i = 0, l = options.length; i < l; i++) {
var selected = multiple ?
selectedValue.hasOwnProperty(options[i].value) :
options[i].value === selectedValue;
if (selected !== options[i].selected) {
options[i].selected = selected;
}
}
}
/**
* Implements a <select> native component that allows optionally setting the
* props `value` and `defaultValue`. If `multiple` is false, the prop must be a
* string. If `multiple` is true, the prop must be an array of strings.
*
* If `value` is not supplied (or null/undefined), user actions that change the
* selected option will trigger updates to the rendered options.
*
* If it is supplied (and not null/undefined), the rendered options will not
* update in response to user actions. Instead, the `value` prop must change in
* order for the rendered options to update.
*
* If `defaultValue` is provided, any options with the supplied values will be
* selected.
*/
var ReactDOMSelect = ReactCompositeComponent.createClass({
displayName: 'ReactDOMSelect',
mixins: [AutoFocusMixin, LinkedValueUtils.Mixin, ReactBrowserComponentMixin],
propTypes: {
defaultValue: selectValueType,
value: selectValueType
},
getInitialState: function() {
return {value: this.props.defaultValue || (this.props.multiple ? [] : '')};
},
componentWillReceiveProps: function(nextProps) {
if (!this.props.multiple && nextProps.multiple) {
this.setState({value: [this.state.value]});
} else if (this.props.multiple && !nextProps.multiple) {
this.setState({value: this.state.value[0]});
}
},
shouldComponentUpdate: function() {
// Defer any updates to this component during the `onChange` handler.
return !this._isChanging;
},
render: function() {
// Clone `this.props` so we don't mutate the input.
var props = merge(this.props);
props.onChange = this._handleChange;
props.value = null;
return select(props, this.props.children);
},
componentDidMount: function() {
updateOptions(this, LinkedValueUtils.getValue(this));
},
componentDidUpdate: function(prevProps) {
var value = LinkedValueUtils.getValue(this);
var prevMultiple = !!prevProps.multiple;
var multiple = !!this.props.multiple;
if (value != null || prevMultiple !== multiple) {
updateOptions(this, value);
}
},
_handleChange: function(event) {
var returnValue;
var onChange = LinkedValueUtils.getOnChange(this);
if (onChange) {
this._isChanging = true;
returnValue = onChange.call(this, event);
this._isChanging = false;
}
var selectedValue;
if (this.props.multiple) {
selectedValue = [];
var options = event.target.options;
for (var i = 0, l = options.length; i < l; i++) {
if (options[i].selected) {
selectedValue.push(options[i].value);
}
}
} else {
selectedValue = event.target.value;
}
this.setState({value: selectedValue});
return returnValue;
}
});
module.exports = ReactDOMSelect;
},{"./AutoFocusMixin":1,"./LinkedValueUtils":25,"./ReactBrowserComponentMixin":30,"./ReactCompositeComponent":38,"./ReactDOM":41,"./merge":144}],50:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactDOMSelection
*/
"use strict";
var ExecutionEnvironment = _dereq_("./ExecutionEnvironment");
var getNodeForCharacterOffset = _dereq_("./getNodeForCharacterOffset");
var getTextContentAccessor = _dereq_("./getTextContentAccessor");
/**
* While `isCollapsed` is available on the Selection object and `collapsed`
* is available on the Range object, IE11 sometimes gets them wrong.
* If the anchor/focus nodes and offsets are the same, the range is collapsed.
*/
function isCollapsed(anchorNode, anchorOffset, focusNode, focusOffset) {
return anchorNode === focusNode && anchorOffset === focusOffset;
}
/**
* Get the appropriate anchor and focus node/offset pairs for IE.
*
* The catch here is that IE's selection API doesn't provide information
* about whether the selection is forward or backward, so we have to
* behave as though it's always forward.
*
* IE text differs from modern selection in that it behaves as though
* block elements end with a new line. This means character offsets will
* differ between the two APIs.
*
* @param {DOMElement} node
* @return {object}
*/
function getIEOffsets(node) {
var selection = document.selection;
var selectedRange = selection.createRange();
var selectedLength = selectedRange.text.length;
// Duplicate selection so we can move range without breaking user selection.
var fromStart = selectedRange.duplicate();
fromStart.moveToElementText(node);
fromStart.setEndPoint('EndToStart', selectedRange);
var startOffset = fromStart.text.length;
var endOffset = startOffset + selectedLength;
return {
start: startOffset,
end: endOffset
};
}
/**
* @param {DOMElement} node
* @return {?object}
*/
function getModernOffsets(node) {
var selection = window.getSelection();
if (selection.rangeCount === 0) {
return null;
}
var anchorNode = selection.anchorNode;
var anchorOffset = selection.anchorOffset;
var focusNode = selection.focusNode;
var focusOffset = selection.focusOffset;
var currentRange = selection.getRangeAt(0);
// If the node and offset values are the same, the selection is collapsed.
// `Selection.isCollapsed` is available natively, but IE sometimes gets
// this value wrong.
var isSelectionCollapsed = isCollapsed(
selection.anchorNode,
selection.anchorOffset,
selection.focusNode,
selection.focusOffset
);
var rangeLength = isSelectionCollapsed ? 0 : currentRange.toString().length;
var tempRange = currentRange.cloneRange();
tempRange.selectNodeContents(node);
tempRange.setEnd(currentRange.startContainer, currentRange.startOffset);
var isTempRangeCollapsed = isCollapsed(
tempRange.startContainer,
tempRange.startOffset,
tempRange.endContainer,
tempRange.endOffset
);
var start = isTempRangeCollapsed ? 0 : tempRange.toString().length;
var end = start + rangeLength;
// Detect whether the selection is backward.
var detectionRange = document.createRange();
detectionRange.setStart(anchorNode, anchorOffset);
detectionRange.setEnd(focusNode, focusOffset);
var isBackward = detectionRange.collapsed;
detectionRange.detach();
return {
start: isBackward ? end : start,
end: isBackward ? start : end
};
}
/**
* @param {DOMElement|DOMTextNode} node
* @param {object} offsets
*/
function setIEOffsets(node, offsets) {
var range = document.selection.createRange().duplicate();
var start, end;
if (typeof offsets.end === 'undefined') {
start = offsets.start;
end = start;
} else if (offsets.start > offsets.end) {
start = offsets.end;
end = offsets.start;
} else {
start = offsets.start;
end = offsets.end;
}
range.moveToElementText(node);
range.moveStart('character', start);
range.setEndPoint('EndToStart', range);
range.moveEnd('character', end - start);
range.select();
}
/**
* In modern non-IE browsers, we can support both forward and backward
* selections.
*
* Note: IE10+ supports the Selection object, but it does not support
* the `extend` method, which means that even in modern IE, it's not possible
* to programatically create a backward selection. Thus, for all IE
* versions, we use the old IE API to create our selections.
*
* @param {DOMElement|DOMTextNode} node
* @param {object} offsets
*/
function setModernOffsets(node, offsets) {
var selection = window.getSelection();
var length = node[getTextContentAccessor()].length;
var start = Math.min(offsets.start, length);
var end = typeof offsets.end === 'undefined' ?
start : Math.min(offsets.end, length);
// IE 11 uses modern selection, but doesn't support the extend method.
// Flip backward selections, so we can set with a single range.
if (!selection.extend && start > end) {
var temp = end;
end = start;
start = temp;
}
var startMarker = getNodeForCharacterOffset(node, start);
var endMarker = getNodeForCharacterOffset(node, end);
if (startMarker && endMarker) {
var range = document.createRange();
range.setStart(startMarker.node, startMarker.offset);
selection.removeAllRanges();
if (start > end) {
selection.addRange(range);
selection.extend(endMarker.node, endMarker.offset);
} else {
range.setEnd(endMarker.node, endMarker.offset);
selection.addRange(range);
}
range.detach();
}
}
var useIEOffsets = ExecutionEnvironment.canUseDOM && document.selection;
var ReactDOMSelection = {
/**
* @param {DOMElement} node
*/
getOffsets: useIEOffsets ? getIEOffsets : getModernOffsets,
/**
* @param {DOMElement|DOMTextNode} node
* @param {object} offsets
*/
setOffsets: useIEOffsets ? setIEOffsets : setModernOffsets
};
module.exports = ReactDOMSelection;
},{"./ExecutionEnvironment":22,"./getNodeForCharacterOffset":127,"./getTextContentAccessor":129}],51:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactDOMTextarea
*/
"use strict";
var AutoFocusMixin = _dereq_("./AutoFocusMixin");
var DOMPropertyOperations = _dereq_("./DOMPropertyOperations");
var LinkedValueUtils = _dereq_("./LinkedValueUtils");
var ReactBrowserComponentMixin = _dereq_("./ReactBrowserComponentMixin");
var ReactCompositeComponent = _dereq_("./ReactCompositeComponent");
var ReactDOM = _dereq_("./ReactDOM");
var invariant = _dereq_("./invariant");
var merge = _dereq_("./merge");
var warning = _dereq_("./warning");
// Store a reference to the <textarea> `ReactDOMComponent`.
var textarea = ReactDOM.textarea;
/**
* Implements a <textarea> native component that allows setting `value`, and
* `defaultValue`. This differs from the traditional DOM API because value is
* usually set as PCDATA children.
*
* If `value` is not supplied (or null/undefined), user actions that affect the
* value will trigger updates to the element.
*
* If `value` is supplied (and not null/undefined), the rendered element will
* not trigger updates to the element. Instead, the `value` prop must change in
* order for the rendered element to be updated.
*
* The rendered element will be initialized with an empty value, the prop
* `defaultValue` if specified, or the children content (deprecated).
*/
var ReactDOMTextarea = ReactCompositeComponent.createClass({
displayName: 'ReactDOMTextarea',
mixins: [AutoFocusMixin, LinkedValueUtils.Mixin, ReactBrowserComponentMixin],
getInitialState: function() {
var defaultValue = this.props.defaultValue;
// TODO (yungsters): Remove support for children content in <textarea>.
var children = this.props.children;
if (children != null) {
if ("production" !== "development") {
("production" !== "development" ? warning(
false,
'Use the `defaultValue` or `value` props instead of setting ' +
'children on <textarea>.'
) : null);
}
("production" !== "development" ? invariant(
defaultValue == null,
'If you supply `defaultValue` on a <textarea>, do not pass children.'
) : invariant(defaultValue == null));
if (Array.isArray(children)) {
("production" !== "development" ? invariant(
children.length <= 1,
'<textarea> can only have at most one child.'
) : invariant(children.length <= 1));
children = children[0];
}
defaultValue = '' + children;
}
if (defaultValue == null) {
defaultValue = '';
}
var value = LinkedValueUtils.getValue(this);
return {
// We save the initial value so that `ReactDOMComponent` doesn't update
// `textContent` (unnecessary since we update value).
// The initial value can be a boolean or object so that's why it's
// forced to be a string.
initialValue: '' + (value != null ? value : defaultValue)
};
},
shouldComponentUpdate: function() {
// Defer any updates to this component during the `onChange` handler.
return !this._isChanging;
},
render: function() {
// Clone `this.props` so we don't mutate the input.
var props = merge(this.props);
("production" !== "development" ? invariant(
props.dangerouslySetInnerHTML == null,
'`dangerouslySetInnerHTML` does not make sense on <textarea>.'
) : invariant(props.dangerouslySetInnerHTML == null));
props.defaultValue = null;
props.value = null;
props.onChange = this._handleChange;
// Always set children to the same thing. In IE9, the selection range will
// get reset if `textContent` is mutated.
return textarea(props, this.state.initialValue);
},
componentDidUpdate: function(prevProps, prevState, prevContext) {
var value = LinkedValueUtils.getValue(this);
if (value != null) {
var rootNode = this.getDOMNode();
// Cast `value` to a string to ensure the value is set correctly. While
// browsers typically do this as necessary, jsdom doesn't.
DOMPropertyOperations.setValueForProperty(rootNode, 'value', '' + value);
}
},
_handleChange: function(event) {
var returnValue;
var onChange = LinkedValueUtils.getOnChange(this);
if (onChange) {
this._isChanging = true;
returnValue = onChange.call(this, event);
this._isChanging = false;
}
this.setState({value: event.target.value});
return returnValue;
}
});
module.exports = ReactDOMTextarea;
},{"./AutoFocusMixin":1,"./DOMPropertyOperations":12,"./LinkedValueUtils":25,"./ReactBrowserComponentMixin":30,"./ReactCompositeComponent":38,"./ReactDOM":41,"./invariant":134,"./merge":144,"./warning":158}],52:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactDefaultBatchingStrategy
*/
"use strict";
var ReactUpdates = _dereq_("./ReactUpdates");
var Transaction = _dereq_("./Transaction");
var emptyFunction = _dereq_("./emptyFunction");
var mixInto = _dereq_("./mixInto");
var RESET_BATCHED_UPDATES = {
initialize: emptyFunction,
close: function() {
ReactDefaultBatchingStrategy.isBatchingUpdates = false;
}
};
var FLUSH_BATCHED_UPDATES = {
initialize: emptyFunction,
close: ReactUpdates.flushBatchedUpdates.bind(ReactUpdates)
};
var TRANSACTION_WRAPPERS = [FLUSH_BATCHED_UPDATES, RESET_BATCHED_UPDATES];
function ReactDefaultBatchingStrategyTransaction() {
this.reinitializeTransaction();
}
mixInto(ReactDefaultBatchingStrategyTransaction, Transaction.Mixin);
mixInto(ReactDefaultBatchingStrategyTransaction, {
getTransactionWrappers: function() {
return TRANSACTION_WRAPPERS;
}
});
var transaction = new ReactDefaultBatchingStrategyTransaction();
var ReactDefaultBatchingStrategy = {
isBatchingUpdates: false,
/**
* Call the provided function in a context within which calls to `setState`
* and friends are batched such that components aren't updated unnecessarily.
*/
batchedUpdates: function(callback, a, b) {
var alreadyBatchingUpdates = ReactDefaultBatchingStrategy.isBatchingUpdates;
ReactDefaultBatchingStrategy.isBatchingUpdates = true;
// The code is written this way to avoid extra allocations
if (alreadyBatchingUpdates) {
callback(a, b);
} else {
transaction.perform(callback, null, a, b);
}
}
};
module.exports = ReactDefaultBatchingStrategy;
},{"./ReactUpdates":87,"./Transaction":104,"./emptyFunction":116,"./mixInto":147}],53:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactDefaultInjection
*/
"use strict";
var BeforeInputEventPlugin = _dereq_("./BeforeInputEventPlugin");
var ChangeEventPlugin = _dereq_("./ChangeEventPlugin");
var ClientReactRootIndex = _dereq_("./ClientReactRootIndex");
var CompositionEventPlugin = _dereq_("./CompositionEventPlugin");
var DefaultEventPluginOrder = _dereq_("./DefaultEventPluginOrder");
var EnterLeaveEventPlugin = _dereq_("./EnterLeaveEventPlugin");
var ExecutionEnvironment = _dereq_("./ExecutionEnvironment");
var HTMLDOMPropertyConfig = _dereq_("./HTMLDOMPropertyConfig");
var MobileSafariClickEventPlugin = _dereq_("./MobileSafariClickEventPlugin");
var ReactBrowserComponentMixin = _dereq_("./ReactBrowserComponentMixin");
var ReactComponentBrowserEnvironment =
_dereq_("./ReactComponentBrowserEnvironment");
var ReactDefaultBatchingStrategy = _dereq_("./ReactDefaultBatchingStrategy");
var ReactDOM = _dereq_("./ReactDOM");
var ReactDOMButton = _dereq_("./ReactDOMButton");
var ReactDOMForm = _dereq_("./ReactDOMForm");
var ReactDOMImg = _dereq_("./ReactDOMImg");
var ReactDOMInput = _dereq_("./ReactDOMInput");
var ReactDOMOption = _dereq_("./ReactDOMOption");
var ReactDOMSelect = _dereq_("./ReactDOMSelect");
var ReactDOMTextarea = _dereq_("./ReactDOMTextarea");
var ReactEventListener = _dereq_("./ReactEventListener");
var ReactInjection = _dereq_("./ReactInjection");
var ReactInstanceHandles = _dereq_("./ReactInstanceHandles");
var ReactMount = _dereq_("./ReactMount");
var SelectEventPlugin = _dereq_("./SelectEventPlugin");
var ServerReactRootIndex = _dereq_("./ServerReactRootIndex");
var SimpleEventPlugin = _dereq_("./SimpleEventPlugin");
var SVGDOMPropertyConfig = _dereq_("./SVGDOMPropertyConfig");
var createFullPageComponent = _dereq_("./createFullPageComponent");
function inject() {
ReactInjection.EventEmitter.injectReactEventListener(
ReactEventListener
);
/**
* Inject modules for resolving DOM hierarchy and plugin ordering.
*/
ReactInjection.EventPluginHub.injectEventPluginOrder(DefaultEventPluginOrder);
ReactInjection.EventPluginHub.injectInstanceHandle(ReactInstanceHandles);
ReactInjection.EventPluginHub.injectMount(ReactMount);
/**
* Some important event plugins included by default (without having to require
* them).
*/
ReactInjection.EventPluginHub.injectEventPluginsByName({
SimpleEventPlugin: SimpleEventPlugin,
EnterLeaveEventPlugin: EnterLeaveEventPlugin,
ChangeEventPlugin: ChangeEventPlugin,
CompositionEventPlugin: CompositionEventPlugin,
MobileSafariClickEventPlugin: MobileSafariClickEventPlugin,
SelectEventPlugin: SelectEventPlugin,
BeforeInputEventPlugin: BeforeInputEventPlugin
});
ReactInjection.DOM.injectComponentClasses({
button: ReactDOMButton,
form: ReactDOMForm,
img: ReactDOMImg,
input: ReactDOMInput,
option: ReactDOMOption,
select: ReactDOMSelect,
textarea: ReactDOMTextarea,
html: createFullPageComponent(ReactDOM.html),
head: createFullPageComponent(ReactDOM.head),
body: createFullPageComponent(ReactDOM.body)
});
// This needs to happen after createFullPageComponent() otherwise the mixin
// gets double injected.
ReactInjection.CompositeComponent.injectMixin(ReactBrowserComponentMixin);
ReactInjection.DOMProperty.injectDOMPropertyConfig(HTMLDOMPropertyConfig);
ReactInjection.DOMProperty.injectDOMPropertyConfig(SVGDOMPropertyConfig);
ReactInjection.EmptyComponent.injectEmptyComponent(ReactDOM.noscript);
ReactInjection.Updates.injectReconcileTransaction(
ReactComponentBrowserEnvironment.ReactReconcileTransaction
);
ReactInjection.Updates.injectBatchingStrategy(
ReactDefaultBatchingStrategy
);
ReactInjection.RootIndex.injectCreateReactRootIndex(
ExecutionEnvironment.canUseDOM ?
ClientReactRootIndex.createReactRootIndex :
ServerReactRootIndex.createReactRootIndex
);
ReactInjection.Component.injectEnvironment(ReactComponentBrowserEnvironment);
if ("production" !== "development") {
var url = (ExecutionEnvironment.canUseDOM && window.location.href) || '';
if ((/[?&]react_perf\b/).test(url)) {
var ReactDefaultPerf = _dereq_("./ReactDefaultPerf");
ReactDefaultPerf.start();
}
}
}
module.exports = {
inject: inject
};
},{"./BeforeInputEventPlugin":2,"./ChangeEventPlugin":7,"./ClientReactRootIndex":8,"./CompositionEventPlugin":9,"./DefaultEventPluginOrder":14,"./EnterLeaveEventPlugin":15,"./ExecutionEnvironment":22,"./HTMLDOMPropertyConfig":23,"./MobileSafariClickEventPlugin":27,"./ReactBrowserComponentMixin":30,"./ReactComponentBrowserEnvironment":36,"./ReactDOM":41,"./ReactDOMButton":42,"./ReactDOMForm":44,"./ReactDOMImg":46,"./ReactDOMInput":47,"./ReactDOMOption":48,"./ReactDOMSelect":49,"./ReactDOMTextarea":51,"./ReactDefaultBatchingStrategy":52,"./ReactDefaultPerf":54,"./ReactEventListener":61,"./ReactInjection":62,"./ReactInstanceHandles":64,"./ReactMount":67,"./SVGDOMPropertyConfig":89,"./SelectEventPlugin":90,"./ServerReactRootIndex":91,"./SimpleEventPlugin":92,"./createFullPageComponent":112}],54:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactDefaultPerf
* @typechecks static-only
*/
"use strict";
var DOMProperty = _dereq_("./DOMProperty");
var ReactDefaultPerfAnalysis = _dereq_("./ReactDefaultPerfAnalysis");
var ReactMount = _dereq_("./ReactMount");
var ReactPerf = _dereq_("./ReactPerf");
var performanceNow = _dereq_("./performanceNow");
function roundFloat(val) {
return Math.floor(val * 100) / 100;
}
function addValue(obj, key, val) {
obj[key] = (obj[key] || 0) + val;
}
var ReactDefaultPerf = {
_allMeasurements: [], // last item in the list is the current one
_mountStack: [0],
_injected: false,
start: function() {
if (!ReactDefaultPerf._injected) {
ReactPerf.injection.injectMeasure(ReactDefaultPerf.measure);
}
ReactDefaultPerf._allMeasurements.length = 0;
ReactPerf.enableMeasure = true;
},
stop: function() {
ReactPerf.enableMeasure = false;
},
getLastMeasurements: function() {
return ReactDefaultPerf._allMeasurements;
},
printExclusive: function(measurements) {
measurements = measurements || ReactDefaultPerf._allMeasurements;
var summary = ReactDefaultPerfAnalysis.getExclusiveSummary(measurements);
console.table(summary.map(function(item) {
return {
'Component class name': item.componentName,
'Total inclusive time (ms)': roundFloat(item.inclusive),
'Exclusive mount time (ms)': roundFloat(item.exclusive),
'Exclusive render time (ms)': roundFloat(item.render),
'Mount time per instance (ms)': roundFloat(item.exclusive / item.count),
'Render time per instance (ms)': roundFloat(item.render / item.count),
'Instances': item.count
};
}));
// TODO: ReactDefaultPerfAnalysis.getTotalTime() does not return the correct
// number.
},
printInclusive: function(measurements) {
measurements = measurements || ReactDefaultPerf._allMeasurements;
var summary = ReactDefaultPerfAnalysis.getInclusiveSummary(measurements);
console.table(summary.map(function(item) {
return {
'Owner > component': item.componentName,
'Inclusive time (ms)': roundFloat(item.time),
'Instances': item.count
};
}));
console.log(
'Total time:',
ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms'
);
},
printWasted: function(measurements) {
measurements = measurements || ReactDefaultPerf._allMeasurements;
var summary = ReactDefaultPerfAnalysis.getInclusiveSummary(
measurements,
true
);
console.table(summary.map(function(item) {
return {
'Owner > component': item.componentName,
'Wasted time (ms)': item.time,
'Instances': item.count
};
}));
console.log(
'Total time:',
ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms'
);
},
printDOM: function(measurements) {
measurements = measurements || ReactDefaultPerf._allMeasurements;
var summary = ReactDefaultPerfAnalysis.getDOMSummary(measurements);
console.table(summary.map(function(item) {
var result = {};
result[DOMProperty.ID_ATTRIBUTE_NAME] = item.id;
result['type'] = item.type;
result['args'] = JSON.stringify(item.args);
return result;
}));
console.log(
'Total time:',
ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms'
);
},
_recordWrite: function(id, fnName, totalTime, args) {
// TODO: totalTime isn't that useful since it doesn't count paints/reflows
var writes =
ReactDefaultPerf
._allMeasurements[ReactDefaultPerf._allMeasurements.length - 1]
.writes;
writes[id] = writes[id] || [];
writes[id].push({
type: fnName,
time: totalTime,
args: args
});
},
measure: function(moduleName, fnName, func) {
return function() {var args=Array.prototype.slice.call(arguments,0);
var totalTime;
var rv;
var start;
if (fnName === '_renderNewRootComponent' ||
fnName === 'flushBatchedUpdates') {
// A "measurement" is a set of metrics recorded for each flush. We want
// to group the metrics for a given flush together so we can look at the
// components that rendered and the DOM operations that actually
// happened to determine the amount of "wasted work" performed.
ReactDefaultPerf._allMeasurements.push({
exclusive: {},
inclusive: {},
render: {},
counts: {},
writes: {},
displayNames: {},
totalTime: 0
});
start = performanceNow();
rv = func.apply(this, args);
ReactDefaultPerf._allMeasurements[
ReactDefaultPerf._allMeasurements.length - 1
].totalTime = performanceNow() - start;
return rv;
} else if (moduleName === 'ReactDOMIDOperations' ||
moduleName === 'ReactComponentBrowserEnvironment') {
start = performanceNow();
rv = func.apply(this, args);
totalTime = performanceNow() - start;
if (fnName === 'mountImageIntoNode') {
var mountID = ReactMount.getID(args[1]);
ReactDefaultPerf._recordWrite(mountID, fnName, totalTime, args[0]);
} else if (fnName === 'dangerouslyProcessChildrenUpdates') {
// special format
args[0].forEach(function(update) {
var writeArgs = {};
if (update.fromIndex !== null) {
writeArgs.fromIndex = update.fromIndex;
}
if (update.toIndex !== null) {
writeArgs.toIndex = update.toIndex;
}
if (update.textContent !== null) {
writeArgs.textContent = update.textContent;
}
if (update.markupIndex !== null) {
writeArgs.markup = args[1][update.markupIndex];
}
ReactDefaultPerf._recordWrite(
update.parentID,
update.type,
totalTime,
writeArgs
);
});
} else {
// basic format
ReactDefaultPerf._recordWrite(
args[0],
fnName,
totalTime,
Array.prototype.slice.call(args, 1)
);
}
return rv;
} else if (moduleName === 'ReactCompositeComponent' && (
fnName === 'mountComponent' ||
fnName === 'updateComponent' || // TODO: receiveComponent()?
fnName === '_renderValidatedComponent')) {
var rootNodeID = fnName === 'mountComponent' ?
args[0] :
this._rootNodeID;
var isRender = fnName === '_renderValidatedComponent';
var isMount = fnName === 'mountComponent';
var mountStack = ReactDefaultPerf._mountStack;
var entry = ReactDefaultPerf._allMeasurements[
ReactDefaultPerf._allMeasurements.length - 1
];
if (isRender) {
addValue(entry.counts, rootNodeID, 1);
} else if (isMount) {
mountStack.push(0);
}
start = performanceNow();
rv = func.apply(this, args);
totalTime = performanceNow() - start;
if (isRender) {
addValue(entry.render, rootNodeID, totalTime);
} else if (isMount) {
var subMountTime = mountStack.pop();
mountStack[mountStack.length - 1] += totalTime;
addValue(entry.exclusive, rootNodeID, totalTime - subMountTime);
addValue(entry.inclusive, rootNodeID, totalTime);
} else {
addValue(entry.inclusive, rootNodeID, totalTime);
}
entry.displayNames[rootNodeID] = {
current: this.constructor.displayName,
owner: this._owner ? this._owner.constructor.displayName : '<root>'
};
return rv;
} else {
return func.apply(this, args);
}
};
}
};
module.exports = ReactDefaultPerf;
},{"./DOMProperty":11,"./ReactDefaultPerfAnalysis":55,"./ReactMount":67,"./ReactPerf":71,"./performanceNow":151}],55:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactDefaultPerfAnalysis
*/
var merge = _dereq_("./merge");
// Don't try to save users less than 1.2ms (a number I made up)
var DONT_CARE_THRESHOLD = 1.2;
var DOM_OPERATION_TYPES = {
'mountImageIntoNode': 'set innerHTML',
INSERT_MARKUP: 'set innerHTML',
MOVE_EXISTING: 'move',
REMOVE_NODE: 'remove',
TEXT_CONTENT: 'set textContent',
'updatePropertyByID': 'update attribute',
'deletePropertyByID': 'delete attribute',
'updateStylesByID': 'update styles',
'updateInnerHTMLByID': 'set innerHTML',
'dangerouslyReplaceNodeWithMarkupByID': 'replace'
};
function getTotalTime(measurements) {
// TODO: return number of DOM ops? could be misleading.
// TODO: measure dropped frames after reconcile?
// TODO: log total time of each reconcile and the top-level component
// class that triggered it.
var totalTime = 0;
for (var i = 0; i < measurements.length; i++) {
var measurement = measurements[i];
totalTime += measurement.totalTime;
}
return totalTime;
}
function getDOMSummary(measurements) {
var items = [];
for (var i = 0; i < measurements.length; i++) {
var measurement = measurements[i];
var id;
for (id in measurement.writes) {
measurement.writes[id].forEach(function(write) {
items.push({
id: id,
type: DOM_OPERATION_TYPES[write.type] || write.type,
args: write.args
});
});
}
}
return items;
}
function getExclusiveSummary(measurements) {
var candidates = {};
var displayName;
for (var i = 0; i < measurements.length; i++) {
var measurement = measurements[i];
var allIDs = merge(measurement.exclusive, measurement.inclusive);
for (var id in allIDs) {
displayName = measurement.displayNames[id].current;
candidates[displayName] = candidates[displayName] || {
componentName: displayName,
inclusive: 0,
exclusive: 0,
render: 0,
count: 0
};
if (measurement.render[id]) {
candidates[displayName].render += measurement.render[id];
}
if (measurement.exclusive[id]) {
candidates[displayName].exclusive += measurement.exclusive[id];
}
if (measurement.inclusive[id]) {
candidates[displayName].inclusive += measurement.inclusive[id];
}
if (measurement.counts[id]) {
candidates[displayName].count += measurement.counts[id];
}
}
}
// Now make a sorted array with the results.
var arr = [];
for (displayName in candidates) {
if (candidates[displayName].exclusive >= DONT_CARE_THRESHOLD) {
arr.push(candidates[displayName]);
}
}
arr.sort(function(a, b) {
return b.exclusive - a.exclusive;
});
return arr;
}
function getInclusiveSummary(measurements, onlyClean) {
var candidates = {};
var inclusiveKey;
for (var i = 0; i < measurements.length; i++) {
var measurement = measurements[i];
var allIDs = merge(measurement.exclusive, measurement.inclusive);
var cleanComponents;
if (onlyClean) {
cleanComponents = getUnchangedComponents(measurement);
}
for (var id in allIDs) {
if (onlyClean && !cleanComponents[id]) {
continue;
}
var displayName = measurement.displayNames[id];
// Inclusive time is not useful for many components without knowing where
// they are instantiated. So we aggregate inclusive time with both the
// owner and current displayName as the key.
inclusiveKey = displayName.owner + ' > ' + displayName.current;
candidates[inclusiveKey] = candidates[inclusiveKey] || {
componentName: inclusiveKey,
time: 0,
count: 0
};
if (measurement.inclusive[id]) {
candidates[inclusiveKey].time += measurement.inclusive[id];
}
if (measurement.counts[id]) {
candidates[inclusiveKey].count += measurement.counts[id];
}
}
}
// Now make a sorted array with the results.
var arr = [];
for (inclusiveKey in candidates) {
if (candidates[inclusiveKey].time >= DONT_CARE_THRESHOLD) {
arr.push(candidates[inclusiveKey]);
}
}
arr.sort(function(a, b) {
return b.time - a.time;
});
return arr;
}
function getUnchangedComponents(measurement) {
// For a given reconcile, look at which components did not actually
// render anything to the DOM and return a mapping of their ID to
// the amount of time it took to render the entire subtree.
var cleanComponents = {};
var dirtyLeafIDs = Object.keys(measurement.writes);
var allIDs = merge(measurement.exclusive, measurement.inclusive);
for (var id in allIDs) {
var isDirty = false;
// For each component that rendered, see if a component that triggerd
// a DOM op is in its subtree.
for (var i = 0; i < dirtyLeafIDs.length; i++) {
if (dirtyLeafIDs[i].indexOf(id) === 0) {
isDirty = true;
break;
}
}
if (!isDirty && measurement.counts[id] > 0) {
cleanComponents[id] = true;
}
}
return cleanComponents;
}
var ReactDefaultPerfAnalysis = {
getExclusiveSummary: getExclusiveSummary,
getInclusiveSummary: getInclusiveSummary,
getDOMSummary: getDOMSummary,
getTotalTime: getTotalTime
};
module.exports = ReactDefaultPerfAnalysis;
},{"./merge":144}],56:[function(_dereq_,module,exports){
/**
* Copyright 2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactDescriptor
*/
"use strict";
var ReactContext = _dereq_("./ReactContext");
var ReactCurrentOwner = _dereq_("./ReactCurrentOwner");
var merge = _dereq_("./merge");
var warning = _dereq_("./warning");
/**
* Warn for mutations.
*
* @internal
* @param {object} object
* @param {string} key
*/
function defineWarningProperty(object, key) {
Object.defineProperty(object, key, {
configurable: false,
enumerable: true,
get: function() {
if (!this._store) {
return null;
}
return this._store[key];
},
set: function(value) {
("production" !== "development" ? warning(
false,
'Don\'t set the ' + key + ' property of the component. ' +
'Mutate the existing props object instead.'
) : null);
this._store[key] = value;
}
});
}
/**
* This is updated to true if the membrane is successfully created.
*/
var useMutationMembrane = false;
/**
* Warn for mutations.
*
* @internal
* @param {object} descriptor
*/
function defineMutationMembrane(prototype) {
try {
var pseudoFrozenProperties = {
props: true
};
for (var key in pseudoFrozenProperties) {
defineWarningProperty(prototype, key);
}
useMutationMembrane = true;
} catch (x) {
// IE will fail on defineProperty
}
}
/**
* Transfer static properties from the source to the target. Functions are
* rebound to have this reflect the original source.
*/
function proxyStaticMethods(target, source) {
if (typeof source !== 'function') {
return;
}
for (var key in source) {
if (source.hasOwnProperty(key)) {
var value = source[key];
if (typeof value === 'function') {
var bound = value.bind(source);
// Copy any properties defined on the function, such as `isRequired` on
// a PropTypes validator. (mergeInto refuses to work on functions.)
for (var k in value) {
if (value.hasOwnProperty(k)) {
bound[k] = value[k];
}
}
target[key] = bound;
} else {
target[key] = value;
}
}
}
}
/**
* Base constructor for all React descriptors. This is only used to make this
* work with a dynamic instanceof check. Nothing should live on this prototype.
*
* @param {*} type
* @internal
*/
var ReactDescriptor = function() {};
if ("production" !== "development") {
defineMutationMembrane(ReactDescriptor.prototype);
}
ReactDescriptor.createFactory = function(type) {
var descriptorPrototype = Object.create(ReactDescriptor.prototype);
var factory = function(props, children) {
// For consistency we currently allocate a new object for every descriptor.
// This protects the descriptor from being mutated by the original props
// object being mutated. It also protects the original props object from
// being mutated by children arguments and default props. This behavior
// comes with a performance cost and could be deprecated in the future.
// It could also be optimized with a smarter JSX transform.
if (props == null) {
props = {};
} else if (typeof props === 'object') {
props = merge(props);
}
// Children can be more than one argument, and those are transferred onto
// the newly allocated props object.
var childrenLength = arguments.length - 1;
if (childrenLength === 1) {
props.children = children;
} else if (childrenLength > 1) {
var childArray = Array(childrenLength);
for (var i = 0; i < childrenLength; i++) {
childArray[i] = arguments[i + 1];
}
props.children = childArray;
}
// Initialize the descriptor object
var descriptor = Object.create(descriptorPrototype);
// Record the component responsible for creating this descriptor.
descriptor._owner = ReactCurrentOwner.current;
// TODO: Deprecate withContext, and then the context becomes accessible
// through the owner.
descriptor._context = ReactContext.current;
if ("production" !== "development") {
// The validation flag and props are currently mutative. We put them on
// an external backing store so that we can freeze the whole object.
// This can be replaced with a WeakMap once they are implemented in
// commonly used development environments.
descriptor._store = { validated: false, props: props };
// We're not allowed to set props directly on the object so we early
// return and rely on the prototype membrane to forward to the backing
// store.
if (useMutationMembrane) {
Object.freeze(descriptor);
return descriptor;
}
}
descriptor.props = props;
return descriptor;
};
// Currently we expose the prototype of the descriptor so that
// <Foo /> instanceof Foo works. This is controversial pattern.
factory.prototype = descriptorPrototype;
// Expose the type on the factory and the prototype so that it can be
// easily accessed on descriptors. E.g. <Foo />.type === Foo.type and for
// static methods like <Foo />.type.staticMethod();
// This should not be named constructor since this may not be the function
// that created the descriptor, and it may not even be a constructor.
factory.type = type;
descriptorPrototype.type = type;
proxyStaticMethods(factory, type);
// Expose a unique constructor on the prototype is that this works with type
// systems that compare constructor properties: <Foo />.constructor === Foo
// This may be controversial since it requires a known factory function.
descriptorPrototype.constructor = factory;
return factory;
};
ReactDescriptor.cloneAndReplaceProps = function(oldDescriptor, newProps) {
var newDescriptor = Object.create(oldDescriptor.constructor.prototype);
// It's important that this property order matches the hidden class of the
// original descriptor to maintain perf.
newDescriptor._owner = oldDescriptor._owner;
newDescriptor._context = oldDescriptor._context;
if ("production" !== "development") {
newDescriptor._store = {
validated: oldDescriptor._store.validated,
props: newProps
};
if (useMutationMembrane) {
Object.freeze(newDescriptor);
return newDescriptor;
}
}
newDescriptor.props = newProps;
return newDescriptor;
};
/**
* Checks if a value is a valid descriptor constructor.
*
* @param {*}
* @return {boolean}
* @public
*/
ReactDescriptor.isValidFactory = function(factory) {
return typeof factory === 'function' &&
factory.prototype instanceof ReactDescriptor;
};
/**
* @param {?object} object
* @return {boolean} True if `object` is a valid component.
* @final
*/
ReactDescriptor.isValidDescriptor = function(object) {
return object instanceof ReactDescriptor;
};
module.exports = ReactDescriptor;
},{"./ReactContext":39,"./ReactCurrentOwner":40,"./merge":144,"./warning":158}],57:[function(_dereq_,module,exports){
/**
* Copyright 2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactDescriptorValidator
*/
/**
* ReactDescriptorValidator provides a wrapper around a descriptor factory
* which validates the props passed to the descriptor. This is intended to be
* used only in DEV and could be replaced by a static type checker for languages
* that support it.
*/
"use strict";
var ReactDescriptor = _dereq_("./ReactDescriptor");
var ReactPropTypeLocations = _dereq_("./ReactPropTypeLocations");
var ReactCurrentOwner = _dereq_("./ReactCurrentOwner");
var monitorCodeUse = _dereq_("./monitorCodeUse");
/**
* Warn if there's no key explicitly set on dynamic arrays of children or
* object keys are not valid. This allows us to keep track of children between
* updates.
*/
var ownerHasKeyUseWarning = {
'react_key_warning': {},
'react_numeric_key_warning': {}
};
var ownerHasMonitoredObjectMap = {};
var loggedTypeFailures = {};
var NUMERIC_PROPERTY_REGEX = /^\d+$/;
/**
* Gets the current owner's displayName for use in warnings.
*
* @internal
* @return {?string} Display name or undefined
*/
function getCurrentOwnerDisplayName() {
var current = ReactCurrentOwner.current;
return current && current.constructor.displayName || undefined;
}
/**
* Warn if the component doesn't have an explicit key assigned to it.
* This component is in an array. The array could grow and shrink or be
* reordered. All children that haven't already been validated are required to
* have a "key" property assigned to it.
*
* @internal
* @param {ReactComponent} component Component that requires a key.
* @param {*} parentType component's parent's type.
*/
function validateExplicitKey(component, parentType) {
if (component._store.validated || component.props.key != null) {
return;
}
component._store.validated = true;
warnAndMonitorForKeyUse(
'react_key_warning',
'Each child in an array should have a unique "key" prop.',
component,
parentType
);
}
/**
* Warn if the key is being defined as an object property but has an incorrect
* value.
*
* @internal
* @param {string} name Property name of the key.
* @param {ReactComponent} component Component that requires a key.
* @param {*} parentType component's parent's type.
*/
function validatePropertyKey(name, component, parentType) {
if (!NUMERIC_PROPERTY_REGEX.test(name)) {
return;
}
warnAndMonitorForKeyUse(
'react_numeric_key_warning',
'Child objects should have non-numeric keys so ordering is preserved.',
component,
parentType
);
}
/**
* Shared warning and monitoring code for the key warnings.
*
* @internal
* @param {string} warningID The id used when logging.
* @param {string} message The base warning that gets output.
* @param {ReactComponent} component Component that requires a key.
* @param {*} parentType component's parent's type.
*/
function warnAndMonitorForKeyUse(warningID, message, component, parentType) {
var ownerName = getCurrentOwnerDisplayName();
var parentName = parentType.displayName;
var useName = ownerName || parentName;
var memoizer = ownerHasKeyUseWarning[warningID];
if (memoizer.hasOwnProperty(useName)) {
return;
}
memoizer[useName] = true;
message += ownerName ?
(" Check the render method of " + ownerName + ".") :
(" Check the renderComponent call using <" + parentName + ">.");
// Usually the current owner is the offender, but if it accepts children as a
// property, it may be the creator of the child that's responsible for
// assigning it a key.
var childOwnerName = null;
if (component._owner && component._owner !== ReactCurrentOwner.current) {
// Name of the component that originally created this child.
childOwnerName = component._owner.constructor.displayName;
message += (" It was passed a child from " + childOwnerName + ".");
}
message += ' See http://fb.me/react-warning-keys for more information.';
monitorCodeUse(warningID, {
component: useName,
componentOwner: childOwnerName
});
console.warn(message);
}
/**
* Log that we're using an object map. We're considering deprecating this
* feature and replace it with proper Map and ImmutableMap data structures.
*
* @internal
*/
function monitorUseOfObjectMap() {
var currentName = getCurrentOwnerDisplayName() || '';
if (ownerHasMonitoredObjectMap.hasOwnProperty(currentName)) {
return;
}
ownerHasMonitoredObjectMap[currentName] = true;
monitorCodeUse('react_object_map_children');
}
/**
* Ensure that every component either is passed in a static location, in an
* array with an explicit keys property defined, or in an object literal
* with valid key property.
*
* @internal
* @param {*} component Statically passed child of any type.
* @param {*} parentType component's parent's type.
* @return {boolean}
*/
function validateChildKeys(component, parentType) {
if (Array.isArray(component)) {
for (var i = 0; i < component.length; i++) {
var child = component[i];
if (ReactDescriptor.isValidDescriptor(child)) {
validateExplicitKey(child, parentType);
}
}
} else if (ReactDescriptor.isValidDescriptor(component)) {
// This component was passed in a valid location.
component._store.validated = true;
} else if (component && typeof component === 'object') {
monitorUseOfObjectMap();
for (var name in component) {
validatePropertyKey(name, component[name], parentType);
}
}
}
/**
* Assert that the props are valid
*
* @param {string} componentName Name of the component for error messages.
* @param {object} propTypes Map of prop name to a ReactPropType
* @param {object} props
* @param {string} location e.g. "prop", "context", "child context"
* @private
*/
function checkPropTypes(componentName, propTypes, props, location) {
for (var propName in propTypes) {
if (propTypes.hasOwnProperty(propName)) {
var error;
// Prop type validation may throw. In case they do, we don't want to
// fail the render phase where it didn't fail before. So we log it.
// After these have been cleaned up, we'll let them throw.
try {
error = propTypes[propName](props, propName, componentName, location);
} catch (ex) {
error = ex;
}
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
// Only monitor this failure once because there tends to be a lot of the
// same error.
loggedTypeFailures[error.message] = true;
// This will soon use the warning module
monitorCodeUse(
'react_failed_descriptor_type_check',
{ message: error.message }
);
}
}
}
}
var ReactDescriptorValidator = {
/**
* Wraps a descriptor factory function in another function which validates
* the props and context of the descriptor and warns about any failed type
* checks.
*
* @param {function} factory The original descriptor factory
* @param {object?} propTypes A prop type definition set
* @param {object?} contextTypes A context type definition set
* @return {object} The component descriptor, which may be invalid.
* @private
*/
createFactory: function(factory, propTypes, contextTypes) {
var validatedFactory = function(props, children) {
var descriptor = factory.apply(this, arguments);
for (var i = 1; i < arguments.length; i++) {
validateChildKeys(arguments[i], descriptor.type);
}
var name = descriptor.type.displayName;
if (propTypes) {
checkPropTypes(
name,
propTypes,
descriptor.props,
ReactPropTypeLocations.prop
);
}
if (contextTypes) {
checkPropTypes(
name,
contextTypes,
descriptor._context,
ReactPropTypeLocations.context
);
}
return descriptor;
};
validatedFactory.prototype = factory.prototype;
validatedFactory.type = factory.type;
// Copy static properties
for (var key in factory) {
if (factory.hasOwnProperty(key)) {
validatedFactory[key] = factory[key];
}
}
return validatedFactory;
}
};
module.exports = ReactDescriptorValidator;
},{"./ReactCurrentOwner":40,"./ReactDescriptor":56,"./ReactPropTypeLocations":74,"./monitorCodeUse":148}],58:[function(_dereq_,module,exports){
/**
* Copyright 2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactEmptyComponent
*/
"use strict";
var invariant = _dereq_("./invariant");
var component;
// This registry keeps track of the React IDs of the components that rendered to
// `null` (in reality a placeholder such as `noscript`)
var nullComponentIdsRegistry = {};
var ReactEmptyComponentInjection = {
injectEmptyComponent: function(emptyComponent) {
component = emptyComponent;
}
};
/**
* @return {ReactComponent} component The injected empty component.
*/
function getEmptyComponent() {
("production" !== "development" ? invariant(
component,
'Trying to return null from a render, but no null placeholder component ' +
'was injected.'
) : invariant(component));
return component();
}
/**
* Mark the component as having rendered to null.
* @param {string} id Component's `_rootNodeID`.
*/
function registerNullComponentID(id) {
nullComponentIdsRegistry[id] = true;
}
/**
* Unmark the component as having rendered to null: it renders to something now.
* @param {string} id Component's `_rootNodeID`.
*/
function deregisterNullComponentID(id) {
delete nullComponentIdsRegistry[id];
}
/**
* @param {string} id Component's `_rootNodeID`.
* @return {boolean} True if the component is rendered to null.
*/
function isNullComponentID(id) {
return nullComponentIdsRegistry[id];
}
var ReactEmptyComponent = {
deregisterNullComponentID: deregisterNullComponentID,
getEmptyComponent: getEmptyComponent,
injection: ReactEmptyComponentInjection,
isNullComponentID: isNullComponentID,
registerNullComponentID: registerNullComponentID
};
module.exports = ReactEmptyComponent;
},{"./invariant":134}],59:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactErrorUtils
* @typechecks
*/
"use strict";
var ReactErrorUtils = {
/**
* Creates a guarded version of a function. This is supposed to make debugging
* of event handlers easier. To aid debugging with the browser's debugger,
* this currently simply returns the original function.
*
* @param {function} func Function to be executed
* @param {string} name The name of the guard
* @return {function}
*/
guard: function(func, name) {
return func;
}
};
module.exports = ReactErrorUtils;
},{}],60:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactEventEmitterMixin
*/
"use strict";
var EventPluginHub = _dereq_("./EventPluginHub");
function runEventQueueInBatch(events) {
EventPluginHub.enqueueEvents(events);
EventPluginHub.processEventQueue();
}
var ReactEventEmitterMixin = {
/**
* Streams a fired top-level event to `EventPluginHub` where plugins have the
* opportunity to create `ReactEvent`s to be dispatched.
*
* @param {string} topLevelType Record from `EventConstants`.
* @param {object} topLevelTarget The listening component root node.
* @param {string} topLevelTargetID ID of `topLevelTarget`.
* @param {object} nativeEvent Native environment event.
*/
handleTopLevel: function(
topLevelType,
topLevelTarget,
topLevelTargetID,
nativeEvent) {
var events = EventPluginHub.extractEvents(
topLevelType,
topLevelTarget,
topLevelTargetID,
nativeEvent
);
runEventQueueInBatch(events);
}
};
module.exports = ReactEventEmitterMixin;
},{"./EventPluginHub":18}],61:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactEventListener
* @typechecks static-only
*/
"use strict";
var EventListener = _dereq_("./EventListener");
var ExecutionEnvironment = _dereq_("./ExecutionEnvironment");
var PooledClass = _dereq_("./PooledClass");
var ReactInstanceHandles = _dereq_("./ReactInstanceHandles");
var ReactMount = _dereq_("./ReactMount");
var ReactUpdates = _dereq_("./ReactUpdates");
var getEventTarget = _dereq_("./getEventTarget");
var getUnboundedScrollPosition = _dereq_("./getUnboundedScrollPosition");
var mixInto = _dereq_("./mixInto");
/**
* Finds the parent React component of `node`.
*
* @param {*} node
* @return {?DOMEventTarget} Parent container, or `null` if the specified node
* is not nested.
*/
function findParent(node) {
// TODO: It may be a good idea to cache this to prevent unnecessary DOM
// traversal, but caching is difficult to do correctly without using a
// mutation observer to listen for all DOM changes.
var nodeID = ReactMount.getID(node);
var rootID = ReactInstanceHandles.getReactRootIDFromNodeID(nodeID);
var container = ReactMount.findReactContainerForID(rootID);
var parent = ReactMount.getFirstReactDOM(container);
return parent;
}
// Used to store ancestor hierarchy in top level callback
function TopLevelCallbackBookKeeping(topLevelType, nativeEvent) {
this.topLevelType = topLevelType;
this.nativeEvent = nativeEvent;
this.ancestors = [];
}
mixInto(TopLevelCallbackBookKeeping, {
destructor: function() {
this.topLevelType = null;
this.nativeEvent = null;
this.ancestors.length = 0;
}
});
PooledClass.addPoolingTo(
TopLevelCallbackBookKeeping,
PooledClass.twoArgumentPooler
);
function handleTopLevelImpl(bookKeeping) {
var topLevelTarget = ReactMount.getFirstReactDOM(
getEventTarget(bookKeeping.nativeEvent)
) || window;
// Loop through the hierarchy, in case there's any nested components.
// It's important that we build the array of ancestors before calling any
// event handlers, because event handlers can modify the DOM, leading to
// inconsistencies with ReactMount's node cache. See #1105.
var ancestor = topLevelTarget;
while (ancestor) {
bookKeeping.ancestors.push(ancestor);
ancestor = findParent(ancestor);
}
for (var i = 0, l = bookKeeping.ancestors.length; i < l; i++) {
topLevelTarget = bookKeeping.ancestors[i];
var topLevelTargetID = ReactMount.getID(topLevelTarget) || '';
ReactEventListener._handleTopLevel(
bookKeeping.topLevelType,
topLevelTarget,
topLevelTargetID,
bookKeeping.nativeEvent
);
}
}
function scrollValueMonitor(cb) {
var scrollPosition = getUnboundedScrollPosition(window);
cb(scrollPosition);
}
var ReactEventListener = {
_enabled: true,
_handleTopLevel: null,
WINDOW_HANDLE: ExecutionEnvironment.canUseDOM ? window : null,
setHandleTopLevel: function(handleTopLevel) {
ReactEventListener._handleTopLevel = handleTopLevel;
},
setEnabled: function(enabled) {
ReactEventListener._enabled = !!enabled;
},
isEnabled: function() {
return ReactEventListener._enabled;
},
/**
* Traps top-level events by using event bubbling.
*
* @param {string} topLevelType Record from `EventConstants`.
* @param {string} handlerBaseName Event name (e.g. "click").
* @param {object} handle Element on which to attach listener.
* @return {object} An object with a remove function which will forcefully
* remove the listener.
* @internal
*/
trapBubbledEvent: function(topLevelType, handlerBaseName, handle) {
var element = handle;
if (!element) {
return;
}
return EventListener.listen(
element,
handlerBaseName,
ReactEventListener.dispatchEvent.bind(null, topLevelType)
);
},
/**
* Traps a top-level event by using event capturing.
*
* @param {string} topLevelType Record from `EventConstants`.
* @param {string} handlerBaseName Event name (e.g. "click").
* @param {object} handle Element on which to attach listener.
* @return {object} An object with a remove function which will forcefully
* remove the listener.
* @internal
*/
trapCapturedEvent: function(topLevelType, handlerBaseName, handle) {
var element = handle;
if (!element) {
return;
}
return EventListener.capture(
element,
handlerBaseName,
ReactEventListener.dispatchEvent.bind(null, topLevelType)
);
},
monitorScrollValue: function(refresh) {
var callback = scrollValueMonitor.bind(null, refresh);
EventListener.listen(window, 'scroll', callback);
EventListener.listen(window, 'resize', callback);
},
dispatchEvent: function(topLevelType, nativeEvent) {
if (!ReactEventListener._enabled) {
return;
}
var bookKeeping = TopLevelCallbackBookKeeping.getPooled(
topLevelType,
nativeEvent
);
try {
// Event queue being processed in the same cycle allows
// `preventDefault`.
ReactUpdates.batchedUpdates(handleTopLevelImpl, bookKeeping);
} finally {
TopLevelCallbackBookKeeping.release(bookKeeping);
}
}
};
module.exports = ReactEventListener;
},{"./EventListener":17,"./ExecutionEnvironment":22,"./PooledClass":28,"./ReactInstanceHandles":64,"./ReactMount":67,"./ReactUpdates":87,"./getEventTarget":125,"./getUnboundedScrollPosition":130,"./mixInto":147}],62:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactInjection
*/
"use strict";
var DOMProperty = _dereq_("./DOMProperty");
var EventPluginHub = _dereq_("./EventPluginHub");
var ReactComponent = _dereq_("./ReactComponent");
var ReactCompositeComponent = _dereq_("./ReactCompositeComponent");
var ReactDOM = _dereq_("./ReactDOM");
var ReactEmptyComponent = _dereq_("./ReactEmptyComponent");
var ReactBrowserEventEmitter = _dereq_("./ReactBrowserEventEmitter");
var ReactPerf = _dereq_("./ReactPerf");
var ReactRootIndex = _dereq_("./ReactRootIndex");
var ReactUpdates = _dereq_("./ReactUpdates");
var ReactInjection = {
Component: ReactComponent.injection,
CompositeComponent: ReactCompositeComponent.injection,
DOMProperty: DOMProperty.injection,
EmptyComponent: ReactEmptyComponent.injection,
EventPluginHub: EventPluginHub.injection,
DOM: ReactDOM.injection,
EventEmitter: ReactBrowserEventEmitter.injection,
Perf: ReactPerf.injection,
RootIndex: ReactRootIndex.injection,
Updates: ReactUpdates.injection
};
module.exports = ReactInjection;
},{"./DOMProperty":11,"./EventPluginHub":18,"./ReactBrowserEventEmitter":31,"./ReactComponent":35,"./ReactCompositeComponent":38,"./ReactDOM":41,"./ReactEmptyComponent":58,"./ReactPerf":71,"./ReactRootIndex":78,"./ReactUpdates":87}],63:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactInputSelection
*/
"use strict";
var ReactDOMSelection = _dereq_("./ReactDOMSelection");
var containsNode = _dereq_("./containsNode");
var focusNode = _dereq_("./focusNode");
var getActiveElement = _dereq_("./getActiveElement");
function isInDocument(node) {
return containsNode(document.documentElement, node);
}
/**
* @ReactInputSelection: React input selection module. Based on Selection.js,
* but modified to be suitable for react and has a couple of bug fixes (doesn't
* assume buttons have range selections allowed).
* Input selection module for React.
*/
var ReactInputSelection = {
hasSelectionCapabilities: function(elem) {
return elem && (
(elem.nodeName === 'INPUT' && elem.type === 'text') ||
elem.nodeName === 'TEXTAREA' ||
elem.contentEditable === 'true'
);
},
getSelectionInformation: function() {
var focusedElem = getActiveElement();
return {
focusedElem: focusedElem,
selectionRange:
ReactInputSelection.hasSelectionCapabilities(focusedElem) ?
ReactInputSelection.getSelection(focusedElem) :
null
};
},
/**
* @restoreSelection: If any selection information was potentially lost,
* restore it. This is useful when performing operations that could remove dom
* nodes and place them back in, resulting in focus being lost.
*/
restoreSelection: function(priorSelectionInformation) {
var curFocusedElem = getActiveElement();
var priorFocusedElem = priorSelectionInformation.focusedElem;
var priorSelectionRange = priorSelectionInformation.selectionRange;
if (curFocusedElem !== priorFocusedElem &&
isInDocument(priorFocusedElem)) {
if (ReactInputSelection.hasSelectionCapabilities(priorFocusedElem)) {
ReactInputSelection.setSelection(
priorFocusedElem,
priorSelectionRange
);
}
focusNode(priorFocusedElem);
}
},
/**
* @getSelection: Gets the selection bounds of a focused textarea, input or
* contentEditable node.
* -@input: Look up selection bounds of this input
* -@return {start: selectionStart, end: selectionEnd}
*/
getSelection: function(input) {
var selection;
if ('selectionStart' in input) {
// Modern browser with input or textarea.
selection = {
start: input.selectionStart,
end: input.selectionEnd
};
} else if (document.selection && input.nodeName === 'INPUT') {
// IE8 input.
var range = document.selection.createRange();
// There can only be one selection per document in IE, so it must
// be in our element.
if (range.parentElement() === input) {
selection = {
start: -range.moveStart('character', -input.value.length),
end: -range.moveEnd('character', -input.value.length)
};
}
} else {
// Content editable or old IE textarea.
selection = ReactDOMSelection.getOffsets(input);
}
return selection || {start: 0, end: 0};
},
/**
* @setSelection: Sets the selection bounds of a textarea or input and focuses
* the input.
* -@input Set selection bounds of this input or textarea
* -@offsets Object of same form that is returned from get*
*/
setSelection: function(input, offsets) {
var start = offsets.start;
var end = offsets.end;
if (typeof end === 'undefined') {
end = start;
}
if ('selectionStart' in input) {
input.selectionStart = start;
input.selectionEnd = Math.min(end, input.value.length);
} else if (document.selection && input.nodeName === 'INPUT') {
var range = input.createTextRange();
range.collapse(true);
range.moveStart('character', start);
range.moveEnd('character', end - start);
range.select();
} else {
ReactDOMSelection.setOffsets(input, offsets);
}
}
};
module.exports = ReactInputSelection;
},{"./ReactDOMSelection":50,"./containsNode":109,"./focusNode":120,"./getActiveElement":122}],64:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactInstanceHandles
* @typechecks static-only
*/
"use strict";
var ReactRootIndex = _dereq_("./ReactRootIndex");
var invariant = _dereq_("./invariant");
var SEPARATOR = '.';
var SEPARATOR_LENGTH = SEPARATOR.length;
/**
* Maximum depth of traversals before we consider the possibility of a bad ID.
*/
var MAX_TREE_DEPTH = 100;
/**
* Creates a DOM ID prefix to use when mounting React components.
*
* @param {number} index A unique integer
* @return {string} React root ID.
* @internal
*/
function getReactRootIDString(index) {
return SEPARATOR + index.toString(36);
}
/**
* Checks if a character in the supplied ID is a separator or the end.
*
* @param {string} id A React DOM ID.
* @param {number} index Index of the character to check.
* @return {boolean} True if the character is a separator or end of the ID.
* @private
*/
function isBoundary(id, index) {
return id.charAt(index) === SEPARATOR || index === id.length;
}
/**
* Checks if the supplied string is a valid React DOM ID.
*
* @param {string} id A React DOM ID, maybe.
* @return {boolean} True if the string is a valid React DOM ID.
* @private
*/
function isValidID(id) {
return id === '' || (
id.charAt(0) === SEPARATOR && id.charAt(id.length - 1) !== SEPARATOR
);
}
/**
* Checks if the first ID is an ancestor of or equal to the second ID.
*
* @param {string} ancestorID
* @param {string} descendantID
* @return {boolean} True if `ancestorID` is an ancestor of `descendantID`.
* @internal
*/
function isAncestorIDOf(ancestorID, descendantID) {
return (
descendantID.indexOf(ancestorID) === 0 &&
isBoundary(descendantID, ancestorID.length)
);
}
/**
* Gets the parent ID of the supplied React DOM ID, `id`.
*
* @param {string} id ID of a component.
* @return {string} ID of the parent, or an empty string.
* @private
*/
function getParentID(id) {
return id ? id.substr(0, id.lastIndexOf(SEPARATOR)) : '';
}
/**
* Gets the next DOM ID on the tree path from the supplied `ancestorID` to the
* supplied `destinationID`. If they are equal, the ID is returned.
*
* @param {string} ancestorID ID of an ancestor node of `destinationID`.
* @param {string} destinationID ID of the destination node.
* @return {string} Next ID on the path from `ancestorID` to `destinationID`.
* @private
*/
function getNextDescendantID(ancestorID, destinationID) {
("production" !== "development" ? invariant(
isValidID(ancestorID) && isValidID(destinationID),
'getNextDescendantID(%s, %s): Received an invalid React DOM ID.',
ancestorID,
destinationID
) : invariant(isValidID(ancestorID) && isValidID(destinationID)));
("production" !== "development" ? invariant(
isAncestorIDOf(ancestorID, destinationID),
'getNextDescendantID(...): React has made an invalid assumption about ' +
'the DOM hierarchy. Expected `%s` to be an ancestor of `%s`.',
ancestorID,
destinationID
) : invariant(isAncestorIDOf(ancestorID, destinationID)));
if (ancestorID === destinationID) {
return ancestorID;
}
// Skip over the ancestor and the immediate separator. Traverse until we hit
// another separator or we reach the end of `destinationID`.
var start = ancestorID.length + SEPARATOR_LENGTH;
for (var i = start; i < destinationID.length; i++) {
if (isBoundary(destinationID, i)) {
break;
}
}
return destinationID.substr(0, i);
}
/**
* Gets the nearest common ancestor ID of two IDs.
*
* Using this ID scheme, the nearest common ancestor ID is the longest common
* prefix of the two IDs that immediately preceded a "marker" in both strings.
*
* @param {string} oneID
* @param {string} twoID
* @return {string} Nearest common ancestor ID, or the empty string if none.
* @private
*/
function getFirstCommonAncestorID(oneID, twoID) {
var minLength = Math.min(oneID.length, twoID.length);
if (minLength === 0) {
return '';
}
var lastCommonMarkerIndex = 0;
// Use `<=` to traverse until the "EOL" of the shorter string.
for (var i = 0; i <= minLength; i++) {
if (isBoundary(oneID, i) && isBoundary(twoID, i)) {
lastCommonMarkerIndex = i;
} else if (oneID.charAt(i) !== twoID.charAt(i)) {
break;
}
}
var longestCommonID = oneID.substr(0, lastCommonMarkerIndex);
("production" !== "development" ? invariant(
isValidID(longestCommonID),
'getFirstCommonAncestorID(%s, %s): Expected a valid React DOM ID: %s',
oneID,
twoID,
longestCommonID
) : invariant(isValidID(longestCommonID)));
return longestCommonID;
}
/**
* Traverses the parent path between two IDs (either up or down). The IDs must
* not be the same, and there must exist a parent path between them. If the
* callback returns `false`, traversal is stopped.
*
* @param {?string} start ID at which to start traversal.
* @param {?string} stop ID at which to end traversal.
* @param {function} cb Callback to invoke each ID with.
* @param {?boolean} skipFirst Whether or not to skip the first node.
* @param {?boolean} skipLast Whether or not to skip the last node.
* @private
*/
function traverseParentPath(start, stop, cb, arg, skipFirst, skipLast) {
start = start || '';
stop = stop || '';
("production" !== "development" ? invariant(
start !== stop,
'traverseParentPath(...): Cannot traverse from and to the same ID, `%s`.',
start
) : invariant(start !== stop));
var traverseUp = isAncestorIDOf(stop, start);
("production" !== "development" ? invariant(
traverseUp || isAncestorIDOf(start, stop),
'traverseParentPath(%s, %s, ...): Cannot traverse from two IDs that do ' +
'not have a parent path.',
start,
stop
) : invariant(traverseUp || isAncestorIDOf(start, stop)));
// Traverse from `start` to `stop` one depth at a time.
var depth = 0;
var traverse = traverseUp ? getParentID : getNextDescendantID;
for (var id = start; /* until break */; id = traverse(id, stop)) {
var ret;
if ((!skipFirst || id !== start) && (!skipLast || id !== stop)) {
ret = cb(id, traverseUp, arg);
}
if (ret === false || id === stop) {
// Only break //after// visiting `stop`.
break;
}
("production" !== "development" ? invariant(
depth++ < MAX_TREE_DEPTH,
'traverseParentPath(%s, %s, ...): Detected an infinite loop while ' +
'traversing the React DOM ID tree. This may be due to malformed IDs: %s',
start, stop
) : invariant(depth++ < MAX_TREE_DEPTH));
}
}
/**
* Manages the IDs assigned to DOM representations of React components. This
* uses a specific scheme in order to traverse the DOM efficiently (e.g. in
* order to simulate events).
*
* @internal
*/
var ReactInstanceHandles = {
/**
* Constructs a React root ID
* @return {string} A React root ID.
*/
createReactRootID: function() {
return getReactRootIDString(ReactRootIndex.createReactRootIndex());
},
/**
* Constructs a React ID by joining a root ID with a name.
*
* @param {string} rootID Root ID of a parent component.
* @param {string} name A component's name (as flattened children).
* @return {string} A React ID.
* @internal
*/
createReactID: function(rootID, name) {
return rootID + name;
},
/**
* Gets the DOM ID of the React component that is the root of the tree that
* contains the React component with the supplied DOM ID.
*
* @param {string} id DOM ID of a React component.
* @return {?string} DOM ID of the React component that is the root.
* @internal
*/
getReactRootIDFromNodeID: function(id) {
if (id && id.charAt(0) === SEPARATOR && id.length > 1) {
var index = id.indexOf(SEPARATOR, 1);
return index > -1 ? id.substr(0, index) : id;
}
return null;
},
/**
* Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that
* should would receive a `mouseEnter` or `mouseLeave` event.
*
* NOTE: Does not invoke the callback on the nearest common ancestor because
* nothing "entered" or "left" that element.
*
* @param {string} leaveID ID being left.
* @param {string} enterID ID being entered.
* @param {function} cb Callback to invoke on each entered/left ID.
* @param {*} upArg Argument to invoke the callback with on left IDs.
* @param {*} downArg Argument to invoke the callback with on entered IDs.
* @internal
*/
traverseEnterLeave: function(leaveID, enterID, cb, upArg, downArg) {
var ancestorID = getFirstCommonAncestorID(leaveID, enterID);
if (ancestorID !== leaveID) {
traverseParentPath(leaveID, ancestorID, cb, upArg, false, true);
}
if (ancestorID !== enterID) {
traverseParentPath(ancestorID, enterID, cb, downArg, true, false);
}
},
/**
* Simulates the traversal of a two-phase, capture/bubble event dispatch.
*
* NOTE: This traversal happens on IDs without touching the DOM.
*
* @param {string} targetID ID of the target node.
* @param {function} cb Callback to invoke.
* @param {*} arg Argument to invoke the callback with.
* @internal
*/
traverseTwoPhase: function(targetID, cb, arg) {
if (targetID) {
traverseParentPath('', targetID, cb, arg, true, false);
traverseParentPath(targetID, '', cb, arg, false, true);
}
},
/**
* Traverse a node ID, calling the supplied `cb` for each ancestor ID. For
* example, passing `.0.$row-0.1` would result in `cb` getting called
* with `.0`, `.0.$row-0`, and `.0.$row-0.1`.
*
* NOTE: This traversal happens on IDs without touching the DOM.
*
* @param {string} targetID ID of the target node.
* @param {function} cb Callback to invoke.
* @param {*} arg Argument to invoke the callback with.
* @internal
*/
traverseAncestors: function(targetID, cb, arg) {
traverseParentPath('', targetID, cb, arg, true, false);
},
/**
* Exposed for unit testing.
* @private
*/
_getFirstCommonAncestorID: getFirstCommonAncestorID,
/**
* Exposed for unit testing.
* @private
*/
_getNextDescendantID: getNextDescendantID,
isAncestorIDOf: isAncestorIDOf,
SEPARATOR: SEPARATOR
};
module.exports = ReactInstanceHandles;
},{"./ReactRootIndex":78,"./invariant":134}],65:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactLink
* @typechecks static-only
*/
"use strict";
/**
* ReactLink encapsulates a common pattern in which a component wants to modify
* a prop received from its parent. ReactLink allows the parent to pass down a
* value coupled with a callback that, when invoked, expresses an intent to
* modify that value. For example:
*
* React.createClass({
* getInitialState: function() {
* return {value: ''};
* },
* render: function() {
* var valueLink = new ReactLink(this.state.value, this._handleValueChange);
* return <input valueLink={valueLink} />;
* },
* this._handleValueChange: function(newValue) {
* this.setState({value: newValue});
* }
* });
*
* We have provided some sugary mixins to make the creation and
* consumption of ReactLink easier; see LinkedValueUtils and LinkedStateMixin.
*/
var React = _dereq_("./React");
/**
* @param {*} value current value of the link
* @param {function} requestChange callback to request a change
*/
function ReactLink(value, requestChange) {
this.value = value;
this.requestChange = requestChange;
}
/**
* Creates a PropType that enforces the ReactLink API and optionally checks the
* type of the value being passed inside the link. Example:
*
* MyComponent.propTypes = {
* tabIndexLink: ReactLink.PropTypes.link(React.PropTypes.number)
* }
*/
function createLinkTypeChecker(linkType) {
var shapes = {
value: typeof linkType === 'undefined' ?
React.PropTypes.any.isRequired :
linkType.isRequired,
requestChange: React.PropTypes.func.isRequired
};
return React.PropTypes.shape(shapes);
}
ReactLink.PropTypes = {
link: createLinkTypeChecker
};
module.exports = ReactLink;
},{"./React":29}],66:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactMarkupChecksum
*/
"use strict";
var adler32 = _dereq_("./adler32");
var ReactMarkupChecksum = {
CHECKSUM_ATTR_NAME: 'data-react-checksum',
/**
* @param {string} markup Markup string
* @return {string} Markup string with checksum attribute attached
*/
addChecksumToMarkup: function(markup) {
var checksum = adler32(markup);
return markup.replace(
'>',
' ' + ReactMarkupChecksum.CHECKSUM_ATTR_NAME + '="' + checksum + '">'
);
},
/**
* @param {string} markup to use
* @param {DOMElement} element root React element
* @returns {boolean} whether or not the markup is the same
*/
canReuseMarkup: function(markup, element) {
var existingChecksum = element.getAttribute(
ReactMarkupChecksum.CHECKSUM_ATTR_NAME
);
existingChecksum = existingChecksum && parseInt(existingChecksum, 10);
var markupChecksum = adler32(markup);
return markupChecksum === existingChecksum;
}
};
module.exports = ReactMarkupChecksum;
},{"./adler32":107}],67:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactMount
*/
"use strict";
var DOMProperty = _dereq_("./DOMProperty");
var ReactBrowserEventEmitter = _dereq_("./ReactBrowserEventEmitter");
var ReactCurrentOwner = _dereq_("./ReactCurrentOwner");
var ReactDescriptor = _dereq_("./ReactDescriptor");
var ReactInstanceHandles = _dereq_("./ReactInstanceHandles");
var ReactPerf = _dereq_("./ReactPerf");
var containsNode = _dereq_("./containsNode");
var getReactRootElementInContainer = _dereq_("./getReactRootElementInContainer");
var instantiateReactComponent = _dereq_("./instantiateReactComponent");
var invariant = _dereq_("./invariant");
var shouldUpdateReactComponent = _dereq_("./shouldUpdateReactComponent");
var warning = _dereq_("./warning");
var SEPARATOR = ReactInstanceHandles.SEPARATOR;
var ATTR_NAME = DOMProperty.ID_ATTRIBUTE_NAME;
var nodeCache = {};
var ELEMENT_NODE_TYPE = 1;
var DOC_NODE_TYPE = 9;
/** Mapping from reactRootID to React component instance. */
var instancesByReactRootID = {};
/** Mapping from reactRootID to `container` nodes. */
var containersByReactRootID = {};
if ("production" !== "development") {
/** __DEV__-only mapping from reactRootID to root elements. */
var rootElementsByReactRootID = {};
}
// Used to store breadth-first search state in findComponentRoot.
var findComponentRootReusableArray = [];
/**
* @param {DOMElement} container DOM element that may contain a React component.
* @return {?string} A "reactRoot" ID, if a React component is rendered.
*/
function getReactRootID(container) {
var rootElement = getReactRootElementInContainer(container);
return rootElement && ReactMount.getID(rootElement);
}
/**
* Accessing node[ATTR_NAME] or calling getAttribute(ATTR_NAME) on a form
* element can return its control whose name or ID equals ATTR_NAME. All
* DOM nodes support `getAttributeNode` but this can also get called on
* other objects so just return '' if we're given something other than a
* DOM node (such as window).
*
* @param {?DOMElement|DOMWindow|DOMDocument|DOMTextNode} node DOM node.
* @return {string} ID of the supplied `domNode`.
*/
function getID(node) {
var id = internalGetID(node);
if (id) {
if (nodeCache.hasOwnProperty(id)) {
var cached = nodeCache[id];
if (cached !== node) {
("production" !== "development" ? invariant(
!isValid(cached, id),
'ReactMount: Two valid but unequal nodes with the same `%s`: %s',
ATTR_NAME, id
) : invariant(!isValid(cached, id)));
nodeCache[id] = node;
}
} else {
nodeCache[id] = node;
}
}
return id;
}
function internalGetID(node) {
// If node is something like a window, document, or text node, none of
// which support attributes or a .getAttribute method, gracefully return
// the empty string, as if the attribute were missing.
return node && node.getAttribute && node.getAttribute(ATTR_NAME) || '';
}
/**
* Sets the React-specific ID of the given node.
*
* @param {DOMElement} node The DOM node whose ID will be set.
* @param {string} id The value of the ID attribute.
*/
function setID(node, id) {
var oldID = internalGetID(node);
if (oldID !== id) {
delete nodeCache[oldID];
}
node.setAttribute(ATTR_NAME, id);
nodeCache[id] = node;
}
/**
* Finds the node with the supplied React-generated DOM ID.
*
* @param {string} id A React-generated DOM ID.
* @return {DOMElement} DOM node with the suppled `id`.
* @internal
*/
function getNode(id) {
if (!nodeCache.hasOwnProperty(id) || !isValid(nodeCache[id], id)) {
nodeCache[id] = ReactMount.findReactNodeByID(id);
}
return nodeCache[id];
}
/**
* A node is "valid" if it is contained by a currently mounted container.
*
* This means that the node does not have to be contained by a document in
* order to be considered valid.
*
* @param {?DOMElement} node The candidate DOM node.
* @param {string} id The expected ID of the node.
* @return {boolean} Whether the node is contained by a mounted container.
*/
function isValid(node, id) {
if (node) {
("production" !== "development" ? invariant(
internalGetID(node) === id,
'ReactMount: Unexpected modification of `%s`',
ATTR_NAME
) : invariant(internalGetID(node) === id));
var container = ReactMount.findReactContainerForID(id);
if (container && containsNode(container, node)) {
return true;
}
}
return false;
}
/**
* Causes the cache to forget about one React-specific ID.
*
* @param {string} id The ID to forget.
*/
function purgeID(id) {
delete nodeCache[id];
}
var deepestNodeSoFar = null;
function findDeepestCachedAncestorImpl(ancestorID) {
var ancestor = nodeCache[ancestorID];
if (ancestor && isValid(ancestor, ancestorID)) {
deepestNodeSoFar = ancestor;
} else {
// This node isn't populated in the cache, so presumably none of its
// descendants are. Break out of the loop.
return false;
}
}
/**
* Return the deepest cached node whose ID is a prefix of `targetID`.
*/
function findDeepestCachedAncestor(targetID) {
deepestNodeSoFar = null;
ReactInstanceHandles.traverseAncestors(
targetID,
findDeepestCachedAncestorImpl
);
var foundNode = deepestNodeSoFar;
deepestNodeSoFar = null;
return foundNode;
}
/**
* Mounting is the process of initializing a React component by creatings its
* representative DOM elements and inserting them into a supplied `container`.
* Any prior content inside `container` is destroyed in the process.
*
* ReactMount.renderComponent(
* component,
* document.getElementById('container')
* );
*
* <div id="container"> <-- Supplied `container`.
* <div data-reactid=".3"> <-- Rendered reactRoot of React
* // ... component.
* </div>
* </div>
*
* Inside of `container`, the first element rendered is the "reactRoot".
*/
var ReactMount = {
/** Exposed for debugging purposes **/
_instancesByReactRootID: instancesByReactRootID,
/**
* This is a hook provided to support rendering React components while
* ensuring that the apparent scroll position of its `container` does not
* change.
*
* @param {DOMElement} container The `container` being rendered into.
* @param {function} renderCallback This must be called once to do the render.
*/
scrollMonitor: function(container, renderCallback) {
renderCallback();
},
/**
* Take a component that's already mounted into the DOM and replace its props
* @param {ReactComponent} prevComponent component instance already in the DOM
* @param {ReactComponent} nextComponent component instance to render
* @param {DOMElement} container container to render into
* @param {?function} callback function triggered on completion
*/
_updateRootComponent: function(
prevComponent,
nextComponent,
container,
callback) {
var nextProps = nextComponent.props;
ReactMount.scrollMonitor(container, function() {
prevComponent.replaceProps(nextProps, callback);
});
if ("production" !== "development") {
// Record the root element in case it later gets transplanted.
rootElementsByReactRootID[getReactRootID(container)] =
getReactRootElementInContainer(container);
}
return prevComponent;
},
/**
* Register a component into the instance map and starts scroll value
* monitoring
* @param {ReactComponent} nextComponent component instance to render
* @param {DOMElement} container container to render into
* @return {string} reactRoot ID prefix
*/
_registerComponent: function(nextComponent, container) {
("production" !== "development" ? invariant(
container && (
container.nodeType === ELEMENT_NODE_TYPE ||
container.nodeType === DOC_NODE_TYPE
),
'_registerComponent(...): Target container is not a DOM element.'
) : invariant(container && (
container.nodeType === ELEMENT_NODE_TYPE ||
container.nodeType === DOC_NODE_TYPE
)));
ReactBrowserEventEmitter.ensureScrollValueMonitoring();
var reactRootID = ReactMount.registerContainer(container);
instancesByReactRootID[reactRootID] = nextComponent;
return reactRootID;
},
/**
* Render a new component into the DOM.
* @param {ReactComponent} nextComponent component instance to render
* @param {DOMElement} container container to render into
* @param {boolean} shouldReuseMarkup if we should skip the markup insertion
* @return {ReactComponent} nextComponent
*/
_renderNewRootComponent: ReactPerf.measure(
'ReactMount',
'_renderNewRootComponent',
function(
nextComponent,
container,
shouldReuseMarkup) {
// Various parts of our code (such as ReactCompositeComponent's
// _renderValidatedComponent) assume that calls to render aren't nested;
// verify that that's the case.
("production" !== "development" ? warning(
ReactCurrentOwner.current == null,
'_renderNewRootComponent(): Render methods should be a pure function ' +
'of props and state; triggering nested component updates from ' +
'render is not allowed. If necessary, trigger nested updates in ' +
'componentDidUpdate.'
) : null);
var componentInstance = instantiateReactComponent(nextComponent);
var reactRootID = ReactMount._registerComponent(
componentInstance,
container
);
componentInstance.mountComponentIntoNode(
reactRootID,
container,
shouldReuseMarkup
);
if ("production" !== "development") {
// Record the root element in case it later gets transplanted.
rootElementsByReactRootID[reactRootID] =
getReactRootElementInContainer(container);
}
return componentInstance;
}
),
/**
* Renders a React component into the DOM in the supplied `container`.
*
* If the React component was previously rendered into `container`, this will
* perform an update on it and only mutate the DOM as necessary to reflect the
* latest React component.
*
* @param {ReactDescriptor} nextDescriptor Component descriptor to render.
* @param {DOMElement} container DOM element to render into.
* @param {?function} callback function triggered on completion
* @return {ReactComponent} Component instance rendered in `container`.
*/
renderComponent: function(nextDescriptor, container, callback) {
("production" !== "development" ? invariant(
ReactDescriptor.isValidDescriptor(nextDescriptor),
'renderComponent(): Invalid component descriptor.%s',
(
ReactDescriptor.isValidFactory(nextDescriptor) ?
' Instead of passing a component class, make sure to instantiate ' +
'it first by calling it with props.' :
// Check if it quacks like a descriptor
typeof nextDescriptor.props !== "undefined" ?
' This may be caused by unintentionally loading two independent ' +
'copies of React.' :
''
)
) : invariant(ReactDescriptor.isValidDescriptor(nextDescriptor)));
var prevComponent = instancesByReactRootID[getReactRootID(container)];
if (prevComponent) {
var prevDescriptor = prevComponent._descriptor;
if (shouldUpdateReactComponent(prevDescriptor, nextDescriptor)) {
return ReactMount._updateRootComponent(
prevComponent,
nextDescriptor,
container,
callback
);
} else {
ReactMount.unmountComponentAtNode(container);
}
}
var reactRootElement = getReactRootElementInContainer(container);
var containerHasReactMarkup =
reactRootElement && ReactMount.isRenderedByReact(reactRootElement);
var shouldReuseMarkup = containerHasReactMarkup && !prevComponent;
var component = ReactMount._renderNewRootComponent(
nextDescriptor,
container,
shouldReuseMarkup
);
callback && callback.call(component);
return component;
},
/**
* Constructs a component instance of `constructor` with `initialProps` and
* renders it into the supplied `container`.
*
* @param {function} constructor React component constructor.
* @param {?object} props Initial props of the component instance.
* @param {DOMElement} container DOM element to render into.
* @return {ReactComponent} Component instance rendered in `container`.
*/
constructAndRenderComponent: function(constructor, props, container) {
return ReactMount.renderComponent(constructor(props), container);
},
/**
* Constructs a component instance of `constructor` with `initialProps` and
* renders it into a container node identified by supplied `id`.
*
* @param {function} componentConstructor React component constructor
* @param {?object} props Initial props of the component instance.
* @param {string} id ID of the DOM element to render into.
* @return {ReactComponent} Component instance rendered in the container node.
*/
constructAndRenderComponentByID: function(constructor, props, id) {
var domNode = document.getElementById(id);
("production" !== "development" ? invariant(
domNode,
'Tried to get element with id of "%s" but it is not present on the page.',
id
) : invariant(domNode));
return ReactMount.constructAndRenderComponent(constructor, props, domNode);
},
/**
* Registers a container node into which React components will be rendered.
* This also creates the "reactRoot" ID that will be assigned to the element
* rendered within.
*
* @param {DOMElement} container DOM element to register as a container.
* @return {string} The "reactRoot" ID of elements rendered within.
*/
registerContainer: function(container) {
var reactRootID = getReactRootID(container);
if (reactRootID) {
// If one exists, make sure it is a valid "reactRoot" ID.
reactRootID = ReactInstanceHandles.getReactRootIDFromNodeID(reactRootID);
}
if (!reactRootID) {
// No valid "reactRoot" ID found, create one.
reactRootID = ReactInstanceHandles.createReactRootID();
}
containersByReactRootID[reactRootID] = container;
return reactRootID;
},
/**
* Unmounts and destroys the React component rendered in the `container`.
*
* @param {DOMElement} container DOM element containing a React component.
* @return {boolean} True if a component was found in and unmounted from
* `container`
*/
unmountComponentAtNode: function(container) {
// Various parts of our code (such as ReactCompositeComponent's
// _renderValidatedComponent) assume that calls to render aren't nested;
// verify that that's the case. (Strictly speaking, unmounting won't cause a
// render but we still don't expect to be in a render call here.)
("production" !== "development" ? warning(
ReactCurrentOwner.current == null,
'unmountComponentAtNode(): Render methods should be a pure function of ' +
'props and state; triggering nested component updates from render is ' +
'not allowed. If necessary, trigger nested updates in ' +
'componentDidUpdate.'
) : null);
var reactRootID = getReactRootID(container);
var component = instancesByReactRootID[reactRootID];
if (!component) {
return false;
}
ReactMount.unmountComponentFromNode(component, container);
delete instancesByReactRootID[reactRootID];
delete containersByReactRootID[reactRootID];
if ("production" !== "development") {
delete rootElementsByReactRootID[reactRootID];
}
return true;
},
/**
* Unmounts a component and removes it from the DOM.
*
* @param {ReactComponent} instance React component instance.
* @param {DOMElement} container DOM element to unmount from.
* @final
* @internal
* @see {ReactMount.unmountComponentAtNode}
*/
unmountComponentFromNode: function(instance, container) {
instance.unmountComponent();
if (container.nodeType === DOC_NODE_TYPE) {
container = container.documentElement;
}
// http://jsperf.com/emptying-a-node
while (container.lastChild) {
container.removeChild(container.lastChild);
}
},
/**
* Finds the container DOM element that contains React component to which the
* supplied DOM `id` belongs.
*
* @param {string} id The ID of an element rendered by a React component.
* @return {?DOMElement} DOM element that contains the `id`.
*/
findReactContainerForID: function(id) {
var reactRootID = ReactInstanceHandles.getReactRootIDFromNodeID(id);
var container = containersByReactRootID[reactRootID];
if ("production" !== "development") {
var rootElement = rootElementsByReactRootID[reactRootID];
if (rootElement && rootElement.parentNode !== container) {
("production" !== "development" ? invariant(
// Call internalGetID here because getID calls isValid which calls
// findReactContainerForID (this function).
internalGetID(rootElement) === reactRootID,
'ReactMount: Root element ID differed from reactRootID.'
) : invariant(// Call internalGetID here because getID calls isValid which calls
// findReactContainerForID (this function).
internalGetID(rootElement) === reactRootID));
var containerChild = container.firstChild;
if (containerChild &&
reactRootID === internalGetID(containerChild)) {
// If the container has a new child with the same ID as the old
// root element, then rootElementsByReactRootID[reactRootID] is
// just stale and needs to be updated. The case that deserves a
// warning is when the container is empty.
rootElementsByReactRootID[reactRootID] = containerChild;
} else {
console.warn(
'ReactMount: Root element has been removed from its original ' +
'container. New container:', rootElement.parentNode
);
}
}
}
return container;
},
/**
* Finds an element rendered by React with the supplied ID.
*
* @param {string} id ID of a DOM node in the React component.
* @return {DOMElement} Root DOM node of the React component.
*/
findReactNodeByID: function(id) {
var reactRoot = ReactMount.findReactContainerForID(id);
return ReactMount.findComponentRoot(reactRoot, id);
},
/**
* True if the supplied `node` is rendered by React.
*
* @param {*} node DOM Element to check.
* @return {boolean} True if the DOM Element appears to be rendered by React.
* @internal
*/
isRenderedByReact: function(node) {
if (node.nodeType !== 1) {
// Not a DOMElement, therefore not a React component
return false;
}
var id = ReactMount.getID(node);
return id ? id.charAt(0) === SEPARATOR : false;
},
/**
* Traverses up the ancestors of the supplied node to find a node that is a
* DOM representation of a React component.
*
* @param {*} node
* @return {?DOMEventTarget}
* @internal
*/
getFirstReactDOM: function(node) {
var current = node;
while (current && current.parentNode !== current) {
if (ReactMount.isRenderedByReact(current)) {
return current;
}
current = current.parentNode;
}
return null;
},
/**
* Finds a node with the supplied `targetID` inside of the supplied
* `ancestorNode`. Exploits the ID naming scheme to perform the search
* quickly.
*
* @param {DOMEventTarget} ancestorNode Search from this root.
* @pararm {string} targetID ID of the DOM representation of the component.
* @return {DOMEventTarget} DOM node with the supplied `targetID`.
* @internal
*/
findComponentRoot: function(ancestorNode, targetID) {
var firstChildren = findComponentRootReusableArray;
var childIndex = 0;
var deepestAncestor = findDeepestCachedAncestor(targetID) || ancestorNode;
firstChildren[0] = deepestAncestor.firstChild;
firstChildren.length = 1;
while (childIndex < firstChildren.length) {
var child = firstChildren[childIndex++];
var targetChild;
while (child) {
var childID = ReactMount.getID(child);
if (childID) {
// Even if we find the node we're looking for, we finish looping
// through its siblings to ensure they're cached so that we don't have
// to revisit this node again. Otherwise, we make n^2 calls to getID
// when visiting the many children of a single node in order.
if (targetID === childID) {
targetChild = child;
} else if (ReactInstanceHandles.isAncestorIDOf(childID, targetID)) {
// If we find a child whose ID is an ancestor of the given ID,
// then we can be sure that we only want to search the subtree
// rooted at this child, so we can throw out the rest of the
// search state.
firstChildren.length = childIndex = 0;
firstChildren.push(child.firstChild);
}
} else {
// If this child had no ID, then there's a chance that it was
// injected automatically by the browser, as when a `<table>`
// element sprouts an extra `<tbody>` child as a side effect of
// `.innerHTML` parsing. Optimistically continue down this
// branch, but not before examining the other siblings.
firstChildren.push(child.firstChild);
}
child = child.nextSibling;
}
if (targetChild) {
// Emptying firstChildren/findComponentRootReusableArray is
// not necessary for correctness, but it helps the GC reclaim
// any nodes that were left at the end of the search.
firstChildren.length = 0;
return targetChild;
}
}
firstChildren.length = 0;
("production" !== "development" ? invariant(
false,
'findComponentRoot(..., %s): Unable to find element. This probably ' +
'means the DOM was unexpectedly mutated (e.g., by the browser), ' +
'usually due to forgetting a <tbody> when using tables, nesting <p> ' +
'or <a> tags, or using non-SVG elements in an <svg> parent. Try ' +
'inspecting the child nodes of the element with React ID `%s`.',
targetID,
ReactMount.getID(ancestorNode)
) : invariant(false));
},
/**
* React ID utilities.
*/
getReactRootID: getReactRootID,
getID: getID,
setID: setID,
getNode: getNode,
purgeID: purgeID
};
module.exports = ReactMount;
},{"./DOMProperty":11,"./ReactBrowserEventEmitter":31,"./ReactCurrentOwner":40,"./ReactDescriptor":56,"./ReactInstanceHandles":64,"./ReactPerf":71,"./containsNode":109,"./getReactRootElementInContainer":128,"./instantiateReactComponent":133,"./invariant":134,"./shouldUpdateReactComponent":154,"./warning":158}],68:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactMultiChild
* @typechecks static-only
*/
"use strict";
var ReactComponent = _dereq_("./ReactComponent");
var ReactMultiChildUpdateTypes = _dereq_("./ReactMultiChildUpdateTypes");
var flattenChildren = _dereq_("./flattenChildren");
var instantiateReactComponent = _dereq_("./instantiateReactComponent");
var shouldUpdateReactComponent = _dereq_("./shouldUpdateReactComponent");
/**
* Updating children of a component may trigger recursive updates. The depth is
* used to batch recursive updates to render markup more efficiently.
*
* @type {number}
* @private
*/
var updateDepth = 0;
/**
* Queue of update configuration objects.
*
* Each object has a `type` property that is in `ReactMultiChildUpdateTypes`.
*
* @type {array<object>}
* @private
*/
var updateQueue = [];
/**
* Queue of markup to be rendered.
*
* @type {array<string>}
* @private
*/
var markupQueue = [];
/**
* Enqueues markup to be rendered and inserted at a supplied index.
*
* @param {string} parentID ID of the parent component.
* @param {string} markup Markup that renders into an element.
* @param {number} toIndex Destination index.
* @private
*/
function enqueueMarkup(parentID, markup, toIndex) {
// NOTE: Null values reduce hidden classes.
updateQueue.push({
parentID: parentID,
parentNode: null,
type: ReactMultiChildUpdateTypes.INSERT_MARKUP,
markupIndex: markupQueue.push(markup) - 1,
textContent: null,
fromIndex: null,
toIndex: toIndex
});
}
/**
* Enqueues moving an existing element to another index.
*
* @param {string} parentID ID of the parent component.
* @param {number} fromIndex Source index of the existing element.
* @param {number} toIndex Destination index of the element.
* @private
*/
function enqueueMove(parentID, fromIndex, toIndex) {
// NOTE: Null values reduce hidden classes.
updateQueue.push({
parentID: parentID,
parentNode: null,
type: ReactMultiChildUpdateTypes.MOVE_EXISTING,
markupIndex: null,
textContent: null,
fromIndex: fromIndex,
toIndex: toIndex
});
}
/**
* Enqueues removing an element at an index.
*
* @param {string} parentID ID of the parent component.
* @param {number} fromIndex Index of the element to remove.
* @private
*/
function enqueueRemove(parentID, fromIndex) {
// NOTE: Null values reduce hidden classes.
updateQueue.push({
parentID: parentID,
parentNode: null,
type: ReactMultiChildUpdateTypes.REMOVE_NODE,
markupIndex: null,
textContent: null,
fromIndex: fromIndex,
toIndex: null
});
}
/**
* Enqueues setting the text content.
*
* @param {string} parentID ID of the parent component.
* @param {string} textContent Text content to set.
* @private
*/
function enqueueTextContent(parentID, textContent) {
// NOTE: Null values reduce hidden classes.
updateQueue.push({
parentID: parentID,
parentNode: null,
type: ReactMultiChildUpdateTypes.TEXT_CONTENT,
markupIndex: null,
textContent: textContent,
fromIndex: null,
toIndex: null
});
}
/**
* Processes any enqueued updates.
*
* @private
*/
function processQueue() {
if (updateQueue.length) {
ReactComponent.BackendIDOperations.dangerouslyProcessChildrenUpdates(
updateQueue,
markupQueue
);
clearQueue();
}
}
/**
* Clears any enqueued updates.
*
* @private
*/
function clearQueue() {
updateQueue.length = 0;
markupQueue.length = 0;
}
/**
* ReactMultiChild are capable of reconciling multiple children.
*
* @class ReactMultiChild
* @internal
*/
var ReactMultiChild = {
/**
* Provides common functionality for components that must reconcile multiple
* children. This is used by `ReactDOMComponent` to mount, update, and
* unmount child components.
*
* @lends {ReactMultiChild.prototype}
*/
Mixin: {
/**
* Generates a "mount image" for each of the supplied children. In the case
* of `ReactDOMComponent`, a mount image is a string of markup.
*
* @param {?object} nestedChildren Nested child maps.
* @return {array} An array of mounted representations.
* @internal
*/
mountChildren: function(nestedChildren, transaction) {
var children = flattenChildren(nestedChildren);
var mountImages = [];
var index = 0;
this._renderedChildren = children;
for (var name in children) {
var child = children[name];
if (children.hasOwnProperty(name)) {
// The rendered children must be turned into instances as they're
// mounted.
var childInstance = instantiateReactComponent(child);
children[name] = childInstance;
// Inlined for performance, see `ReactInstanceHandles.createReactID`.
var rootID = this._rootNodeID + name;
var mountImage = childInstance.mountComponent(
rootID,
transaction,
this._mountDepth + 1
);
childInstance._mountIndex = index;
mountImages.push(mountImage);
index++;
}
}
return mountImages;
},
/**
* Replaces any rendered children with a text content string.
*
* @param {string} nextContent String of content.
* @internal
*/
updateTextContent: function(nextContent) {
updateDepth++;
var errorThrown = true;
try {
var prevChildren = this._renderedChildren;
// Remove any rendered children.
for (var name in prevChildren) {
if (prevChildren.hasOwnProperty(name)) {
this._unmountChildByName(prevChildren[name], name);
}
}
// Set new text content.
this.setTextContent(nextContent);
errorThrown = false;
} finally {
updateDepth--;
if (!updateDepth) {
errorThrown ? clearQueue() : processQueue();
}
}
},
/**
* Updates the rendered children with new children.
*
* @param {?object} nextNestedChildren Nested child maps.
* @param {ReactReconcileTransaction} transaction
* @internal
*/
updateChildren: function(nextNestedChildren, transaction) {
updateDepth++;
var errorThrown = true;
try {
this._updateChildren(nextNestedChildren, transaction);
errorThrown = false;
} finally {
updateDepth--;
if (!updateDepth) {
errorThrown ? clearQueue() : processQueue();
}
}
},
/**
* Improve performance by isolating this hot code path from the try/catch
* block in `updateChildren`.
*
* @param {?object} nextNestedChildren Nested child maps.
* @param {ReactReconcileTransaction} transaction
* @final
* @protected
*/
_updateChildren: function(nextNestedChildren, transaction) {
var nextChildren = flattenChildren(nextNestedChildren);
var prevChildren = this._renderedChildren;
if (!nextChildren && !prevChildren) {
return;
}
var name;
// `nextIndex` will increment for each child in `nextChildren`, but
// `lastIndex` will be the last index visited in `prevChildren`.
var lastIndex = 0;
var nextIndex = 0;
for (name in nextChildren) {
if (!nextChildren.hasOwnProperty(name)) {
continue;
}
var prevChild = prevChildren && prevChildren[name];
var prevDescriptor = prevChild && prevChild._descriptor;
var nextDescriptor = nextChildren[name];
if (shouldUpdateReactComponent(prevDescriptor, nextDescriptor)) {
this.moveChild(prevChild, nextIndex, lastIndex);
lastIndex = Math.max(prevChild._mountIndex, lastIndex);
prevChild.receiveComponent(nextDescriptor, transaction);
prevChild._mountIndex = nextIndex;
} else {
if (prevChild) {
// Update `lastIndex` before `_mountIndex` gets unset by unmounting.
lastIndex = Math.max(prevChild._mountIndex, lastIndex);
this._unmountChildByName(prevChild, name);
}
// The child must be instantiated before it's mounted.
var nextChildInstance = instantiateReactComponent(nextDescriptor);
this._mountChildByNameAtIndex(
nextChildInstance, name, nextIndex, transaction
);
}
nextIndex++;
}
// Remove children that are no longer present.
for (name in prevChildren) {
if (prevChildren.hasOwnProperty(name) &&
!(nextChildren && nextChildren[name])) {
this._unmountChildByName(prevChildren[name], name);
}
}
},
/**
* Unmounts all rendered children. This should be used to clean up children
* when this component is unmounted.
*
* @internal
*/
unmountChildren: function() {
var renderedChildren = this._renderedChildren;
for (var name in renderedChildren) {
var renderedChild = renderedChildren[name];
// TODO: When is this not true?
if (renderedChild.unmountComponent) {
renderedChild.unmountComponent();
}
}
this._renderedChildren = null;
},
/**
* Moves a child component to the supplied index.
*
* @param {ReactComponent} child Component to move.
* @param {number} toIndex Destination index of the element.
* @param {number} lastIndex Last index visited of the siblings of `child`.
* @protected
*/
moveChild: function(child, toIndex, lastIndex) {
// If the index of `child` is less than `lastIndex`, then it needs to
// be moved. Otherwise, we do not need to move it because a child will be
// inserted or moved before `child`.
if (child._mountIndex < lastIndex) {
enqueueMove(this._rootNodeID, child._mountIndex, toIndex);
}
},
/**
* Creates a child component.
*
* @param {ReactComponent} child Component to create.
* @param {string} mountImage Markup to insert.
* @protected
*/
createChild: function(child, mountImage) {
enqueueMarkup(this._rootNodeID, mountImage, child._mountIndex);
},
/**
* Removes a child component.
*
* @param {ReactComponent} child Child to remove.
* @protected
*/
removeChild: function(child) {
enqueueRemove(this._rootNodeID, child._mountIndex);
},
/**
* Sets this text content string.
*
* @param {string} textContent Text content to set.
* @protected
*/
setTextContent: function(textContent) {
enqueueTextContent(this._rootNodeID, textContent);
},
/**
* Mounts a child with the supplied name.
*
* NOTE: This is part of `updateChildren` and is here for readability.
*
* @param {ReactComponent} child Component to mount.
* @param {string} name Name of the child.
* @param {number} index Index at which to insert the child.
* @param {ReactReconcileTransaction} transaction
* @private
*/
_mountChildByNameAtIndex: function(child, name, index, transaction) {
// Inlined for performance, see `ReactInstanceHandles.createReactID`.
var rootID = this._rootNodeID + name;
var mountImage = child.mountComponent(
rootID,
transaction,
this._mountDepth + 1
);
child._mountIndex = index;
this.createChild(child, mountImage);
this._renderedChildren = this._renderedChildren || {};
this._renderedChildren[name] = child;
},
/**
* Unmounts a rendered child by name.
*
* NOTE: This is part of `updateChildren` and is here for readability.
*
* @param {ReactComponent} child Component to unmount.
* @param {string} name Name of the child in `this._renderedChildren`.
* @private
*/
_unmountChildByName: function(child, name) {
this.removeChild(child);
child._mountIndex = null;
child.unmountComponent();
delete this._renderedChildren[name];
}
}
};
module.exports = ReactMultiChild;
},{"./ReactComponent":35,"./ReactMultiChildUpdateTypes":69,"./flattenChildren":119,"./instantiateReactComponent":133,"./shouldUpdateReactComponent":154}],69:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactMultiChildUpdateTypes
*/
"use strict";
var keyMirror = _dereq_("./keyMirror");
/**
* When a component's children are updated, a series of update configuration
* objects are created in order to batch and serialize the required changes.
*
* Enumerates all the possible types of update configurations.
*
* @internal
*/
var ReactMultiChildUpdateTypes = keyMirror({
INSERT_MARKUP: null,
MOVE_EXISTING: null,
REMOVE_NODE: null,
TEXT_CONTENT: null
});
module.exports = ReactMultiChildUpdateTypes;
},{"./keyMirror":140}],70:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactOwner
*/
"use strict";
var emptyObject = _dereq_("./emptyObject");
var invariant = _dereq_("./invariant");
/**
* ReactOwners are capable of storing references to owned components.
*
* All components are capable of //being// referenced by owner components, but
* only ReactOwner components are capable of //referencing// owned components.
* The named reference is known as a "ref".
*
* Refs are available when mounted and updated during reconciliation.
*
* var MyComponent = React.createClass({
* render: function() {
* return (
* <div onClick={this.handleClick}>
* <CustomComponent ref="custom" />
* </div>
* );
* },
* handleClick: function() {
* this.refs.custom.handleClick();
* },
* componentDidMount: function() {
* this.refs.custom.initialize();
* }
* });
*
* Refs should rarely be used. When refs are used, they should only be done to
* control data that is not handled by React's data flow.
*
* @class ReactOwner
*/
var ReactOwner = {
/**
* @param {?object} object
* @return {boolean} True if `object` is a valid owner.
* @final
*/
isValidOwner: function(object) {
return !!(
object &&
typeof object.attachRef === 'function' &&
typeof object.detachRef === 'function'
);
},
/**
* Adds a component by ref to an owner component.
*
* @param {ReactComponent} component Component to reference.
* @param {string} ref Name by which to refer to the component.
* @param {ReactOwner} owner Component on which to record the ref.
* @final
* @internal
*/
addComponentAsRefTo: function(component, ref, owner) {
("production" !== "development" ? invariant(
ReactOwner.isValidOwner(owner),
'addComponentAsRefTo(...): Only a ReactOwner can have refs. This ' +
'usually means that you\'re trying to add a ref to a component that ' +
'doesn\'t have an owner (that is, was not created inside of another ' +
'component\'s `render` method). Try rendering this component inside of ' +
'a new top-level component which will hold the ref.'
) : invariant(ReactOwner.isValidOwner(owner)));
owner.attachRef(ref, component);
},
/**
* Removes a component by ref from an owner component.
*
* @param {ReactComponent} component Component to dereference.
* @param {string} ref Name of the ref to remove.
* @param {ReactOwner} owner Component on which the ref is recorded.
* @final
* @internal
*/
removeComponentAsRefFrom: function(component, ref, owner) {
("production" !== "development" ? invariant(
ReactOwner.isValidOwner(owner),
'removeComponentAsRefFrom(...): Only a ReactOwner can have refs. This ' +
'usually means that you\'re trying to remove a ref to a component that ' +
'doesn\'t have an owner (that is, was not created inside of another ' +
'component\'s `render` method). Try rendering this component inside of ' +
'a new top-level component which will hold the ref.'
) : invariant(ReactOwner.isValidOwner(owner)));
// Check that `component` is still the current ref because we do not want to
// detach the ref if another component stole it.
if (owner.refs[ref] === component) {
owner.detachRef(ref);
}
},
/**
* A ReactComponent must mix this in to have refs.
*
* @lends {ReactOwner.prototype}
*/
Mixin: {
construct: function() {
this.refs = emptyObject;
},
/**
* Lazily allocates the refs object and stores `component` as `ref`.
*
* @param {string} ref Reference name.
* @param {component} component Component to store as `ref`.
* @final
* @private
*/
attachRef: function(ref, component) {
("production" !== "development" ? invariant(
component.isOwnedBy(this),
'attachRef(%s, ...): Only a component\'s owner can store a ref to it.',
ref
) : invariant(component.isOwnedBy(this)));
var refs = this.refs === emptyObject ? (this.refs = {}) : this.refs;
refs[ref] = component;
},
/**
* Detaches a reference name.
*
* @param {string} ref Name to dereference.
* @final
* @private
*/
detachRef: function(ref) {
delete this.refs[ref];
}
}
};
module.exports = ReactOwner;
},{"./emptyObject":117,"./invariant":134}],71:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactPerf
* @typechecks static-only
*/
"use strict";
/**
* ReactPerf is a general AOP system designed to measure performance. This
* module only has the hooks: see ReactDefaultPerf for the analysis tool.
*/
var ReactPerf = {
/**
* Boolean to enable/disable measurement. Set to false by default to prevent
* accidental logging and perf loss.
*/
enableMeasure: false,
/**
* Holds onto the measure function in use. By default, don't measure
* anything, but we'll override this if we inject a measure function.
*/
storedMeasure: _noMeasure,
/**
* Use this to wrap methods you want to measure. Zero overhead in production.
*
* @param {string} objName
* @param {string} fnName
* @param {function} func
* @return {function}
*/
measure: function(objName, fnName, func) {
if ("production" !== "development") {
var measuredFunc = null;
return function() {
if (ReactPerf.enableMeasure) {
if (!measuredFunc) {
measuredFunc = ReactPerf.storedMeasure(objName, fnName, func);
}
return measuredFunc.apply(this, arguments);
}
return func.apply(this, arguments);
};
}
return func;
},
injection: {
/**
* @param {function} measure
*/
injectMeasure: function(measure) {
ReactPerf.storedMeasure = measure;
}
}
};
/**
* Simply passes through the measured function, without measuring it.
*
* @param {string} objName
* @param {string} fnName
* @param {function} func
* @return {function}
*/
function _noMeasure(objName, fnName, func) {
return func;
}
module.exports = ReactPerf;
},{}],72:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactPropTransferer
*/
"use strict";
var emptyFunction = _dereq_("./emptyFunction");
var invariant = _dereq_("./invariant");
var joinClasses = _dereq_("./joinClasses");
var merge = _dereq_("./merge");
/**
* Creates a transfer strategy that will merge prop values using the supplied
* `mergeStrategy`. If a prop was previously unset, this just sets it.
*
* @param {function} mergeStrategy
* @return {function}
*/
function createTransferStrategy(mergeStrategy) {
return function(props, key, value) {
if (!props.hasOwnProperty(key)) {
props[key] = value;
} else {
props[key] = mergeStrategy(props[key], value);
}
};
}
var transferStrategyMerge = createTransferStrategy(function(a, b) {
// `merge` overrides the first object's (`props[key]` above) keys using the
// second object's (`value`) keys. An object's style's existing `propA` would
// get overridden. Flip the order here.
return merge(b, a);
});
/**
* Transfer strategies dictate how props are transferred by `transferPropsTo`.
* NOTE: if you add any more exceptions to this list you should be sure to
* update `cloneWithProps()` accordingly.
*/
var TransferStrategies = {
/**
* Never transfer `children`.
*/
children: emptyFunction,
/**
* Transfer the `className` prop by merging them.
*/
className: createTransferStrategy(joinClasses),
/**
* Never transfer the `key` prop.
*/
key: emptyFunction,
/**
* Never transfer the `ref` prop.
*/
ref: emptyFunction,
/**
* Transfer the `style` prop (which is an object) by merging them.
*/
style: transferStrategyMerge
};
/**
* Mutates the first argument by transferring the properties from the second
* argument.
*
* @param {object} props
* @param {object} newProps
* @return {object}
*/
function transferInto(props, newProps) {
for (var thisKey in newProps) {
if (!newProps.hasOwnProperty(thisKey)) {
continue;
}
var transferStrategy = TransferStrategies[thisKey];
if (transferStrategy && TransferStrategies.hasOwnProperty(thisKey)) {
transferStrategy(props, thisKey, newProps[thisKey]);
} else if (!props.hasOwnProperty(thisKey)) {
props[thisKey] = newProps[thisKey];
}
}
return props;
}
/**
* ReactPropTransferer are capable of transferring props to another component
* using a `transferPropsTo` method.
*
* @class ReactPropTransferer
*/
var ReactPropTransferer = {
TransferStrategies: TransferStrategies,
/**
* Merge two props objects using TransferStrategies.
*
* @param {object} oldProps original props (they take precedence)
* @param {object} newProps new props to merge in
* @return {object} a new object containing both sets of props merged.
*/
mergeProps: function(oldProps, newProps) {
return transferInto(merge(oldProps), newProps);
},
/**
* @lends {ReactPropTransferer.prototype}
*/
Mixin: {
/**
* Transfer props from this component to a target component.
*
* Props that do not have an explicit transfer strategy will be transferred
* only if the target component does not already have the prop set.
*
* This is usually used to pass down props to a returned root component.
*
* @param {ReactDescriptor} descriptor Component receiving the properties.
* @return {ReactDescriptor} The supplied `component`.
* @final
* @protected
*/
transferPropsTo: function(descriptor) {
("production" !== "development" ? invariant(
descriptor._owner === this,
'%s: You can\'t call transferPropsTo() on a component that you ' +
'don\'t own, %s. This usually means you are calling ' +
'transferPropsTo() on a component passed in as props or children.',
this.constructor.displayName,
descriptor.type.displayName
) : invariant(descriptor._owner === this));
// Because descriptors are immutable we have to merge into the existing
// props object rather than clone it.
transferInto(descriptor.props, this.props);
return descriptor;
}
}
};
module.exports = ReactPropTransferer;
},{"./emptyFunction":116,"./invariant":134,"./joinClasses":139,"./merge":144}],73:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactPropTypeLocationNames
*/
"use strict";
var ReactPropTypeLocationNames = {};
if ("production" !== "development") {
ReactPropTypeLocationNames = {
prop: 'prop',
context: 'context',
childContext: 'child context'
};
}
module.exports = ReactPropTypeLocationNames;
},{}],74:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactPropTypeLocations
*/
"use strict";
var keyMirror = _dereq_("./keyMirror");
var ReactPropTypeLocations = keyMirror({
prop: null,
context: null,
childContext: null
});
module.exports = ReactPropTypeLocations;
},{"./keyMirror":140}],75:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactPropTypes
*/
"use strict";
var ReactDescriptor = _dereq_("./ReactDescriptor");
var ReactPropTypeLocationNames = _dereq_("./ReactPropTypeLocationNames");
var emptyFunction = _dereq_("./emptyFunction");
/**
* Collection of methods that allow declaration and validation of props that are
* supplied to React components. Example usage:
*
* var Props = require('ReactPropTypes');
* var MyArticle = React.createClass({
* propTypes: {
* // An optional string prop named "description".
* description: Props.string,
*
* // A required enum prop named "category".
* category: Props.oneOf(['News','Photos']).isRequired,
*
* // A prop named "dialog" that requires an instance of Dialog.
* dialog: Props.instanceOf(Dialog).isRequired
* },
* render: function() { ... }
* });
*
* A more formal specification of how these methods are used:
*
* type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
* decl := ReactPropTypes.{type}(.isRequired)?
*
* Each and every declaration produces a function with the same signature. This
* allows the creation of custom validation functions. For example:
*
* var MyLink = React.createClass({
* propTypes: {
* // An optional string or URI prop named "href".
* href: function(props, propName, componentName) {
* var propValue = props[propName];
* if (propValue != null && typeof propValue !== 'string' &&
* !(propValue instanceof URI)) {
* return new Error(
* 'Expected a string or an URI for ' + propName + ' in ' +
* componentName
* );
* }
* }
* },
* render: function() {...}
* });
*
* @internal
*/
var ANONYMOUS = '<<anonymous>>';
var ReactPropTypes = {
array: createPrimitiveTypeChecker('array'),
bool: createPrimitiveTypeChecker('boolean'),
func: createPrimitiveTypeChecker('function'),
number: createPrimitiveTypeChecker('number'),
object: createPrimitiveTypeChecker('object'),
string: createPrimitiveTypeChecker('string'),
any: createAnyTypeChecker(),
arrayOf: createArrayOfTypeChecker,
component: createComponentTypeChecker(),
instanceOf: createInstanceTypeChecker,
objectOf: createObjectOfTypeChecker,
oneOf: createEnumTypeChecker,
oneOfType: createUnionTypeChecker,
renderable: createRenderableTypeChecker(),
shape: createShapeTypeChecker
};
function createChainableTypeChecker(validate) {
function checkType(isRequired, props, propName, componentName, location) {
componentName = componentName || ANONYMOUS;
if (props[propName] == null) {
var locationName = ReactPropTypeLocationNames[location];
if (isRequired) {
return new Error(
("Required " + locationName + " `" + propName + "` was not specified in ")+
("`" + componentName + "`.")
);
}
} else {
return validate(props, propName, componentName, location);
}
}
var chainedCheckType = checkType.bind(null, false);
chainedCheckType.isRequired = checkType.bind(null, true);
return chainedCheckType;
}
function createPrimitiveTypeChecker(expectedType) {
function validate(props, propName, componentName, location) {
var propValue = props[propName];
var propType = getPropType(propValue);
if (propType !== expectedType) {
var locationName = ReactPropTypeLocationNames[location];
// `propValue` being instance of, say, date/regexp, pass the 'object'
// check, but we can offer a more precise error message here rather than
// 'of type `object`'.
var preciseType = getPreciseType(propValue);
return new Error(
("Invalid " + locationName + " `" + propName + "` of type `" + preciseType + "` ") +
("supplied to `" + componentName + "`, expected `" + expectedType + "`.")
);
}
}
return createChainableTypeChecker(validate);
}
function createAnyTypeChecker() {
return createChainableTypeChecker(emptyFunction.thatReturns());
}
function createArrayOfTypeChecker(typeChecker) {
function validate(props, propName, componentName, location) {
var propValue = props[propName];
if (!Array.isArray(propValue)) {
var locationName = ReactPropTypeLocationNames[location];
var propType = getPropType(propValue);
return new Error(
("Invalid " + locationName + " `" + propName + "` of type ") +
("`" + propType + "` supplied to `" + componentName + "`, expected an array.")
);
}
for (var i = 0; i < propValue.length; i++) {
var error = typeChecker(propValue, i, componentName, location);
if (error instanceof Error) {
return error;
}
}
}
return createChainableTypeChecker(validate);
}
function createComponentTypeChecker() {
function validate(props, propName, componentName, location) {
if (!ReactDescriptor.isValidDescriptor(props[propName])) {
var locationName = ReactPropTypeLocationNames[location];
return new Error(
("Invalid " + locationName + " `" + propName + "` supplied to ") +
("`" + componentName + "`, expected a React component.")
);
}
}
return createChainableTypeChecker(validate);
}
function createInstanceTypeChecker(expectedClass) {
function validate(props, propName, componentName, location) {
if (!(props[propName] instanceof expectedClass)) {
var locationName = ReactPropTypeLocationNames[location];
var expectedClassName = expectedClass.name || ANONYMOUS;
return new Error(
("Invalid " + locationName + " `" + propName + "` supplied to ") +
("`" + componentName + "`, expected instance of `" + expectedClassName + "`.")
);
}
}
return createChainableTypeChecker(validate);
}
function createEnumTypeChecker(expectedValues) {
function validate(props, propName, componentName, location) {
var propValue = props[propName];
for (var i = 0; i < expectedValues.length; i++) {
if (propValue === expectedValues[i]) {
return;
}
}
var locationName = ReactPropTypeLocationNames[location];
var valuesString = JSON.stringify(expectedValues);
return new Error(
("Invalid " + locationName + " `" + propName + "` of value `" + propValue + "` ") +
("supplied to `" + componentName + "`, expected one of " + valuesString + ".")
);
}
return createChainableTypeChecker(validate);
}
function createObjectOfTypeChecker(typeChecker) {
function validate(props, propName, componentName, location) {
var propValue = props[propName];
var propType = getPropType(propValue);
if (propType !== 'object') {
var locationName = ReactPropTypeLocationNames[location];
return new Error(
("Invalid " + locationName + " `" + propName + "` of type ") +
("`" + propType + "` supplied to `" + componentName + "`, expected an object.")
);
}
for (var key in propValue) {
if (propValue.hasOwnProperty(key)) {
var error = typeChecker(propValue, key, componentName, location);
if (error instanceof Error) {
return error;
}
}
}
}
return createChainableTypeChecker(validate);
}
function createUnionTypeChecker(arrayOfTypeCheckers) {
function validate(props, propName, componentName, location) {
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
var checker = arrayOfTypeCheckers[i];
if (checker(props, propName, componentName, location) == null) {
return;
}
}
var locationName = ReactPropTypeLocationNames[location];
return new Error(
("Invalid " + locationName + " `" + propName + "` supplied to ") +
("`" + componentName + "`.")
);
}
return createChainableTypeChecker(validate);
}
function createRenderableTypeChecker() {
function validate(props, propName, componentName, location) {
if (!isRenderable(props[propName])) {
var locationName = ReactPropTypeLocationNames[location];
return new Error(
("Invalid " + locationName + " `" + propName + "` supplied to ") +
("`" + componentName + "`, expected a renderable prop.")
);
}
}
return createChainableTypeChecker(validate);
}
function createShapeTypeChecker(shapeTypes) {
function validate(props, propName, componentName, location) {
var propValue = props[propName];
var propType = getPropType(propValue);
if (propType !== 'object') {
var locationName = ReactPropTypeLocationNames[location];
return new Error(
("Invalid " + locationName + " `" + propName + "` of type `" + propType + "` ") +
("supplied to `" + componentName + "`, expected `object`.")
);
}
for (var key in shapeTypes) {
var checker = shapeTypes[key];
if (!checker) {
continue;
}
var error = checker(propValue, key, componentName, location);
if (error) {
return error;
}
}
}
return createChainableTypeChecker(validate, 'expected `object`');
}
function isRenderable(propValue) {
switch(typeof propValue) {
// TODO: this was probably written with the assumption that we're not
// returning `this.props.component` directly from `render`. This is
// currently not supported but we should, to make it consistent.
case 'number':
case 'string':
return true;
case 'boolean':
return !propValue;
case 'object':
if (Array.isArray(propValue)) {
return propValue.every(isRenderable);
}
if (ReactDescriptor.isValidDescriptor(propValue)) {
return true;
}
for (var k in propValue) {
if (!isRenderable(propValue[k])) {
return false;
}
}
return true;
default:
return false;
}
}
// Equivalent of `typeof` but with special handling for array and regexp.
function getPropType(propValue) {
var propType = typeof propValue;
if (Array.isArray(propValue)) {
return 'array';
}
if (propValue instanceof RegExp) {
// Old webkits (at least until Android 4.0) return 'function' rather than
// 'object' for typeof a RegExp. We'll normalize this here so that /bla/
// passes PropTypes.object.
return 'object';
}
return propType;
}
// This handles more types than `getPropType`. Only used for error messages.
// See `createPrimitiveTypeChecker`.
function getPreciseType(propValue) {
var propType = getPropType(propValue);
if (propType === 'object') {
if (propValue instanceof Date) {
return 'date';
} else if (propValue instanceof RegExp) {
return 'regexp';
}
}
return propType;
}
module.exports = ReactPropTypes;
},{"./ReactDescriptor":56,"./ReactPropTypeLocationNames":73,"./emptyFunction":116}],76:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactPutListenerQueue
*/
"use strict";
var PooledClass = _dereq_("./PooledClass");
var ReactBrowserEventEmitter = _dereq_("./ReactBrowserEventEmitter");
var mixInto = _dereq_("./mixInto");
function ReactPutListenerQueue() {
this.listenersToPut = [];
}
mixInto(ReactPutListenerQueue, {
enqueuePutListener: function(rootNodeID, propKey, propValue) {
this.listenersToPut.push({
rootNodeID: rootNodeID,
propKey: propKey,
propValue: propValue
});
},
putListeners: function() {
for (var i = 0; i < this.listenersToPut.length; i++) {
var listenerToPut = this.listenersToPut[i];
ReactBrowserEventEmitter.putListener(
listenerToPut.rootNodeID,
listenerToPut.propKey,
listenerToPut.propValue
);
}
},
reset: function() {
this.listenersToPut.length = 0;
},
destructor: function() {
this.reset();
}
});
PooledClass.addPoolingTo(ReactPutListenerQueue);
module.exports = ReactPutListenerQueue;
},{"./PooledClass":28,"./ReactBrowserEventEmitter":31,"./mixInto":147}],77:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactReconcileTransaction
* @typechecks static-only
*/
"use strict";
var CallbackQueue = _dereq_("./CallbackQueue");
var PooledClass = _dereq_("./PooledClass");
var ReactBrowserEventEmitter = _dereq_("./ReactBrowserEventEmitter");
var ReactInputSelection = _dereq_("./ReactInputSelection");
var ReactPutListenerQueue = _dereq_("./ReactPutListenerQueue");
var Transaction = _dereq_("./Transaction");
var mixInto = _dereq_("./mixInto");
/**
* Ensures that, when possible, the selection range (currently selected text
* input) is not disturbed by performing the transaction.
*/
var SELECTION_RESTORATION = {
/**
* @return {Selection} Selection information.
*/
initialize: ReactInputSelection.getSelectionInformation,
/**
* @param {Selection} sel Selection information returned from `initialize`.
*/
close: ReactInputSelection.restoreSelection
};
/**
* Suppresses events (blur/focus) that could be inadvertently dispatched due to
* high level DOM manipulations (like temporarily removing a text input from the
* DOM).
*/
var EVENT_SUPPRESSION = {
/**
* @return {boolean} The enabled status of `ReactBrowserEventEmitter` before
* the reconciliation.
*/
initialize: function() {
var currentlyEnabled = ReactBrowserEventEmitter.isEnabled();
ReactBrowserEventEmitter.setEnabled(false);
return currentlyEnabled;
},
/**
* @param {boolean} previouslyEnabled Enabled status of
* `ReactBrowserEventEmitter` before the reconciliation occured. `close`
* restores the previous value.
*/
close: function(previouslyEnabled) {
ReactBrowserEventEmitter.setEnabled(previouslyEnabled);
}
};
/**
* Provides a queue for collecting `componentDidMount` and
* `componentDidUpdate` callbacks during the the transaction.
*/
var ON_DOM_READY_QUEUEING = {
/**
* Initializes the internal `onDOMReady` queue.
*/
initialize: function() {
this.reactMountReady.reset();
},
/**
* After DOM is flushed, invoke all registered `onDOMReady` callbacks.
*/
close: function() {
this.reactMountReady.notifyAll();
}
};
var PUT_LISTENER_QUEUEING = {
initialize: function() {
this.putListenerQueue.reset();
},
close: function() {
this.putListenerQueue.putListeners();
}
};
/**
* Executed within the scope of the `Transaction` instance. Consider these as
* being member methods, but with an implied ordering while being isolated from
* each other.
*/
var TRANSACTION_WRAPPERS = [
PUT_LISTENER_QUEUEING,
SELECTION_RESTORATION,
EVENT_SUPPRESSION,
ON_DOM_READY_QUEUEING
];
/**
* Currently:
* - The order that these are listed in the transaction is critical:
* - Suppresses events.
* - Restores selection range.
*
* Future:
* - Restore document/overflow scroll positions that were unintentionally
* modified via DOM insertions above the top viewport boundary.
* - Implement/integrate with customized constraint based layout system and keep
* track of which dimensions must be remeasured.
*
* @class ReactReconcileTransaction
*/
function ReactReconcileTransaction() {
this.reinitializeTransaction();
// Only server-side rendering really needs this option (see
// `ReactServerRendering`), but server-side uses
// `ReactServerRenderingTransaction` instead. This option is here so that it's
// accessible and defaults to false when `ReactDOMComponent` and
// `ReactTextComponent` checks it in `mountComponent`.`
this.renderToStaticMarkup = false;
this.reactMountReady = CallbackQueue.getPooled(null);
this.putListenerQueue = ReactPutListenerQueue.getPooled();
}
var Mixin = {
/**
* @see Transaction
* @abstract
* @final
* @return {array<object>} List of operation wrap proceedures.
* TODO: convert to array<TransactionWrapper>
*/
getTransactionWrappers: function() {
return TRANSACTION_WRAPPERS;
},
/**
* @return {object} The queue to collect `onDOMReady` callbacks with.
*/
getReactMountReady: function() {
return this.reactMountReady;
},
getPutListenerQueue: function() {
return this.putListenerQueue;
},
/**
* `PooledClass` looks for this, and will invoke this before allowing this
* instance to be resused.
*/
destructor: function() {
CallbackQueue.release(this.reactMountReady);
this.reactMountReady = null;
ReactPutListenerQueue.release(this.putListenerQueue);
this.putListenerQueue = null;
}
};
mixInto(ReactReconcileTransaction, Transaction.Mixin);
mixInto(ReactReconcileTransaction, Mixin);
PooledClass.addPoolingTo(ReactReconcileTransaction);
module.exports = ReactReconcileTransaction;
},{"./CallbackQueue":6,"./PooledClass":28,"./ReactBrowserEventEmitter":31,"./ReactInputSelection":63,"./ReactPutListenerQueue":76,"./Transaction":104,"./mixInto":147}],78:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactRootIndex
* @typechecks
*/
"use strict";
var ReactRootIndexInjection = {
/**
* @param {function} _createReactRootIndex
*/
injectCreateReactRootIndex: function(_createReactRootIndex) {
ReactRootIndex.createReactRootIndex = _createReactRootIndex;
}
};
var ReactRootIndex = {
createReactRootIndex: null,
injection: ReactRootIndexInjection
};
module.exports = ReactRootIndex;
},{}],79:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @typechecks static-only
* @providesModule ReactServerRendering
*/
"use strict";
var ReactDescriptor = _dereq_("./ReactDescriptor");
var ReactInstanceHandles = _dereq_("./ReactInstanceHandles");
var ReactMarkupChecksum = _dereq_("./ReactMarkupChecksum");
var ReactServerRenderingTransaction =
_dereq_("./ReactServerRenderingTransaction");
var instantiateReactComponent = _dereq_("./instantiateReactComponent");
var invariant = _dereq_("./invariant");
/**
* @param {ReactComponent} component
* @return {string} the HTML markup
*/
function renderComponentToString(component) {
("production" !== "development" ? invariant(
ReactDescriptor.isValidDescriptor(component),
'renderComponentToString(): You must pass a valid ReactComponent.'
) : invariant(ReactDescriptor.isValidDescriptor(component)));
("production" !== "development" ? invariant(
!(arguments.length === 2 && typeof arguments[1] === 'function'),
'renderComponentToString(): This function became synchronous and now ' +
'returns the generated markup. Please remove the second parameter.'
) : invariant(!(arguments.length === 2 && typeof arguments[1] === 'function')));
var transaction;
try {
var id = ReactInstanceHandles.createReactRootID();
transaction = ReactServerRenderingTransaction.getPooled(false);
return transaction.perform(function() {
var componentInstance = instantiateReactComponent(component);
var markup = componentInstance.mountComponent(id, transaction, 0);
return ReactMarkupChecksum.addChecksumToMarkup(markup);
}, null);
} finally {
ReactServerRenderingTransaction.release(transaction);
}
}
/**
* @param {ReactComponent} component
* @return {string} the HTML markup, without the extra React ID and checksum
* (for generating static pages)
*/
function renderComponentToStaticMarkup(component) {
("production" !== "development" ? invariant(
ReactDescriptor.isValidDescriptor(component),
'renderComponentToStaticMarkup(): You must pass a valid ReactComponent.'
) : invariant(ReactDescriptor.isValidDescriptor(component)));
var transaction;
try {
var id = ReactInstanceHandles.createReactRootID();
transaction = ReactServerRenderingTransaction.getPooled(true);
return transaction.perform(function() {
var componentInstance = instantiateReactComponent(component);
return componentInstance.mountComponent(id, transaction, 0);
}, null);
} finally {
ReactServerRenderingTransaction.release(transaction);
}
}
module.exports = {
renderComponentToString: renderComponentToString,
renderComponentToStaticMarkup: renderComponentToStaticMarkup
};
},{"./ReactDescriptor":56,"./ReactInstanceHandles":64,"./ReactMarkupChecksum":66,"./ReactServerRenderingTransaction":80,"./instantiateReactComponent":133,"./invariant":134}],80:[function(_dereq_,module,exports){
/**
* Copyright 2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactServerRenderingTransaction
* @typechecks
*/
"use strict";
var PooledClass = _dereq_("./PooledClass");
var CallbackQueue = _dereq_("./CallbackQueue");
var ReactPutListenerQueue = _dereq_("./ReactPutListenerQueue");
var Transaction = _dereq_("./Transaction");
var emptyFunction = _dereq_("./emptyFunction");
var mixInto = _dereq_("./mixInto");
/**
* Provides a `CallbackQueue` queue for collecting `onDOMReady` callbacks
* during the performing of the transaction.
*/
var ON_DOM_READY_QUEUEING = {
/**
* Initializes the internal `onDOMReady` queue.
*/
initialize: function() {
this.reactMountReady.reset();
},
close: emptyFunction
};
var PUT_LISTENER_QUEUEING = {
initialize: function() {
this.putListenerQueue.reset();
},
close: emptyFunction
};
/**
* Executed within the scope of the `Transaction` instance. Consider these as
* being member methods, but with an implied ordering while being isolated from
* each other.
*/
var TRANSACTION_WRAPPERS = [
PUT_LISTENER_QUEUEING,
ON_DOM_READY_QUEUEING
];
/**
* @class ReactServerRenderingTransaction
* @param {boolean} renderToStaticMarkup
*/
function ReactServerRenderingTransaction(renderToStaticMarkup) {
this.reinitializeTransaction();
this.renderToStaticMarkup = renderToStaticMarkup;
this.reactMountReady = CallbackQueue.getPooled(null);
this.putListenerQueue = ReactPutListenerQueue.getPooled();
}
var Mixin = {
/**
* @see Transaction
* @abstract
* @final
* @return {array} Empty list of operation wrap proceedures.
*/
getTransactionWrappers: function() {
return TRANSACTION_WRAPPERS;
},
/**
* @return {object} The queue to collect `onDOMReady` callbacks with.
*/
getReactMountReady: function() {
return this.reactMountReady;
},
getPutListenerQueue: function() {
return this.putListenerQueue;
},
/**
* `PooledClass` looks for this, and will invoke this before allowing this
* instance to be resused.
*/
destructor: function() {
CallbackQueue.release(this.reactMountReady);
this.reactMountReady = null;
ReactPutListenerQueue.release(this.putListenerQueue);
this.putListenerQueue = null;
}
};
mixInto(ReactServerRenderingTransaction, Transaction.Mixin);
mixInto(ReactServerRenderingTransaction, Mixin);
PooledClass.addPoolingTo(ReactServerRenderingTransaction);
module.exports = ReactServerRenderingTransaction;
},{"./CallbackQueue":6,"./PooledClass":28,"./ReactPutListenerQueue":76,"./Transaction":104,"./emptyFunction":116,"./mixInto":147}],81:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactStateSetters
*/
"use strict";
var ReactStateSetters = {
/**
* Returns a function that calls the provided function, and uses the result
* of that to set the component's state.
*
* @param {ReactCompositeComponent} component
* @param {function} funcReturningState Returned callback uses this to
* determine how to update state.
* @return {function} callback that when invoked uses funcReturningState to
* determined the object literal to setState.
*/
createStateSetter: function(component, funcReturningState) {
return function(a, b, c, d, e, f) {
var partialState = funcReturningState.call(component, a, b, c, d, e, f);
if (partialState) {
component.setState(partialState);
}
};
},
/**
* Returns a single-argument callback that can be used to update a single
* key in the component's state.
*
* Note: this is memoized function, which makes it inexpensive to call.
*
* @param {ReactCompositeComponent} component
* @param {string} key The key in the state that you should update.
* @return {function} callback of 1 argument which calls setState() with
* the provided keyName and callback argument.
*/
createStateKeySetter: function(component, key) {
// Memoize the setters.
var cache = component.__keySetters || (component.__keySetters = {});
return cache[key] || (cache[key] = createStateKeySetter(component, key));
}
};
function createStateKeySetter(component, key) {
// Partial state is allocated outside of the function closure so it can be
// reused with every call, avoiding memory allocation when this function
// is called.
var partialState = {};
return function stateKeySetter(value) {
partialState[key] = value;
component.setState(partialState);
};
}
ReactStateSetters.Mixin = {
/**
* Returns a function that calls the provided function, and uses the result
* of that to set the component's state.
*
* For example, these statements are equivalent:
*
* this.setState({x: 1});
* this.createStateSetter(function(xValue) {
* return {x: xValue};
* })(1);
*
* @param {function} funcReturningState Returned callback uses this to
* determine how to update state.
* @return {function} callback that when invoked uses funcReturningState to
* determined the object literal to setState.
*/
createStateSetter: function(funcReturningState) {
return ReactStateSetters.createStateSetter(this, funcReturningState);
},
/**
* Returns a single-argument callback that can be used to update a single
* key in the component's state.
*
* For example, these statements are equivalent:
*
* this.setState({x: 1});
* this.createStateKeySetter('x')(1);
*
* Note: this is memoized function, which makes it inexpensive to call.
*
* @param {string} key The key in the state that you should update.
* @return {function} callback of 1 argument which calls setState() with
* the provided keyName and callback argument.
*/
createStateKeySetter: function(key) {
return ReactStateSetters.createStateKeySetter(this, key);
}
};
module.exports = ReactStateSetters;
},{}],82:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactTestUtils
*/
"use strict";
var EventConstants = _dereq_("./EventConstants");
var EventPluginHub = _dereq_("./EventPluginHub");
var EventPropagators = _dereq_("./EventPropagators");
var React = _dereq_("./React");
var ReactDescriptor = _dereq_("./ReactDescriptor");
var ReactDOM = _dereq_("./ReactDOM");
var ReactBrowserEventEmitter = _dereq_("./ReactBrowserEventEmitter");
var ReactMount = _dereq_("./ReactMount");
var ReactTextComponent = _dereq_("./ReactTextComponent");
var ReactUpdates = _dereq_("./ReactUpdates");
var SyntheticEvent = _dereq_("./SyntheticEvent");
var mergeInto = _dereq_("./mergeInto");
var copyProperties = _dereq_("./copyProperties");
var topLevelTypes = EventConstants.topLevelTypes;
function Event(suffix) {}
/**
* @class ReactTestUtils
*/
/**
* Todo: Support the entire DOM.scry query syntax. For now, these simple
* utilities will suffice for testing purposes.
* @lends ReactTestUtils
*/
var ReactTestUtils = {
renderIntoDocument: function(instance) {
var div = document.createElement('div');
// None of our tests actually require attaching the container to the
// DOM, and doing so creates a mess that we rely on test isolation to
// clean up, so we're going to stop honoring the name of this method
// (and probably rename it eventually) if no problems arise.
// document.documentElement.appendChild(div);
return React.renderComponent(instance, div);
},
isDescriptor: function(descriptor) {
return ReactDescriptor.isValidDescriptor(descriptor);
},
isDescriptorOfType: function(inst, convenienceConstructor) {
return (
ReactDescriptor.isValidDescriptor(inst) &&
inst.type === convenienceConstructor.type
);
},
isDOMComponent: function(inst) {
return !!(inst && inst.mountComponent && inst.tagName);
},
isDOMComponentDescriptor: function(inst) {
return !!(inst &&
ReactDescriptor.isValidDescriptor(inst) &&
!!inst.tagName);
},
isCompositeComponent: function(inst) {
return typeof inst.render === 'function' &&
typeof inst.setState === 'function';
},
isCompositeComponentWithType: function(inst, type) {
return !!(ReactTestUtils.isCompositeComponent(inst) &&
(inst.constructor === type.type));
},
isCompositeComponentDescriptor: function(inst) {
if (!ReactDescriptor.isValidDescriptor(inst)) {
return false;
}
// We check the prototype of the type that will get mounted, not the
// instance itself. This is a future proof way of duck typing.
var prototype = inst.type.prototype;
return (
typeof prototype.render === 'function' &&
typeof prototype.setState === 'function'
);
},
isCompositeComponentDescriptorWithType: function(inst, type) {
return !!(ReactTestUtils.isCompositeComponentDescriptor(inst) &&
(inst.constructor === type));
},
isTextComponent: function(inst) {
return inst instanceof ReactTextComponent.type;
},
findAllInRenderedTree: function(inst, test) {
if (!inst) {
return [];
}
var ret = test(inst) ? [inst] : [];
if (ReactTestUtils.isDOMComponent(inst)) {
var renderedChildren = inst._renderedChildren;
var key;
for (key in renderedChildren) {
if (!renderedChildren.hasOwnProperty(key)) {
continue;
}
ret = ret.concat(
ReactTestUtils.findAllInRenderedTree(renderedChildren[key], test)
);
}
} else if (ReactTestUtils.isCompositeComponent(inst)) {
ret = ret.concat(
ReactTestUtils.findAllInRenderedTree(inst._renderedComponent, test)
);
}
return ret;
},
/**
* Finds all instance of components in the rendered tree that are DOM
* components with the class name matching `className`.
* @return an array of all the matches.
*/
scryRenderedDOMComponentsWithClass: function(root, className) {
return ReactTestUtils.findAllInRenderedTree(root, function(inst) {
var instClassName = inst.props.className;
return ReactTestUtils.isDOMComponent(inst) && (
instClassName &&
(' ' + instClassName + ' ').indexOf(' ' + className + ' ') !== -1
);
});
},
/**
* Like scryRenderedDOMComponentsWithClass but expects there to be one result,
* and returns that one result, or throws exception if there is any other
* number of matches besides one.
* @return {!ReactDOMComponent} The one match.
*/
findRenderedDOMComponentWithClass: function(root, className) {
var all =
ReactTestUtils.scryRenderedDOMComponentsWithClass(root, className);
if (all.length !== 1) {
throw new Error('Did not find exactly one match for class:' + className);
}
return all[0];
},
/**
* Finds all instance of components in the rendered tree that are DOM
* components with the tag name matching `tagName`.
* @return an array of all the matches.
*/
scryRenderedDOMComponentsWithTag: function(root, tagName) {
return ReactTestUtils.findAllInRenderedTree(root, function(inst) {
return ReactTestUtils.isDOMComponent(inst) &&
inst.tagName === tagName.toUpperCase();
});
},
/**
* Like scryRenderedDOMComponentsWithTag but expects there to be one result,
* and returns that one result, or throws exception if there is any other
* number of matches besides one.
* @return {!ReactDOMComponent} The one match.
*/
findRenderedDOMComponentWithTag: function(root, tagName) {
var all = ReactTestUtils.scryRenderedDOMComponentsWithTag(root, tagName);
if (all.length !== 1) {
throw new Error('Did not find exactly one match for tag:' + tagName);
}
return all[0];
},
/**
* Finds all instances of components with type equal to `componentType`.
* @return an array of all the matches.
*/
scryRenderedComponentsWithType: function(root, componentType) {
return ReactTestUtils.findAllInRenderedTree(root, function(inst) {
return ReactTestUtils.isCompositeComponentWithType(
inst,
componentType
);
});
},
/**
* Same as `scryRenderedComponentsWithType` but expects there to be one result
* and returns that one result, or throws exception if there is any other
* number of matches besides one.
* @return {!ReactComponent} The one match.
*/
findRenderedComponentWithType: function(root, componentType) {
var all = ReactTestUtils.scryRenderedComponentsWithType(
root,
componentType
);
if (all.length !== 1) {
throw new Error(
'Did not find exactly one match for componentType:' + componentType
);
}
return all[0];
},
/**
* Pass a mocked component module to this method to augment it with
* useful methods that allow it to be used as a dummy React component.
* Instead of rendering as usual, the component will become a simple
* <div> containing any provided children.
*
* @param {object} module the mock function object exported from a
* module that defines the component to be mocked
* @param {?string} mockTagName optional dummy root tag name to return
* from render method (overrides
* module.mockTagName if provided)
* @return {object} the ReactTestUtils object (for chaining)
*/
mockComponent: function(module, mockTagName) {
var ConvenienceConstructor = React.createClass({
render: function() {
var mockTagName = mockTagName || module.mockTagName || "div";
return ReactDOM[mockTagName](null, this.props.children);
}
});
copyProperties(module, ConvenienceConstructor);
module.mockImplementation(ConvenienceConstructor);
return this;
},
/**
* Simulates a top level event being dispatched from a raw event that occured
* on an `Element` node.
* @param topLevelType {Object} A type from `EventConstants.topLevelTypes`
* @param {!Element} node The dom to simulate an event occurring on.
* @param {?Event} fakeNativeEvent Fake native event to use in SyntheticEvent.
*/
simulateNativeEventOnNode: function(topLevelType, node, fakeNativeEvent) {
fakeNativeEvent.target = node;
ReactBrowserEventEmitter.ReactEventListener.dispatchEvent(
topLevelType,
fakeNativeEvent
);
},
/**
* Simulates a top level event being dispatched from a raw event that occured
* on the `ReactDOMComponent` `comp`.
* @param topLevelType {Object} A type from `EventConstants.topLevelTypes`.
* @param comp {!ReactDOMComponent}
* @param {?Event} fakeNativeEvent Fake native event to use in SyntheticEvent.
*/
simulateNativeEventOnDOMComponent: function(
topLevelType,
comp,
fakeNativeEvent) {
ReactTestUtils.simulateNativeEventOnNode(
topLevelType,
comp.getDOMNode(),
fakeNativeEvent
);
},
nativeTouchData: function(x, y) {
return {
touches: [
{pageX: x, pageY: y}
]
};
},
Simulate: null,
SimulateNative: {}
};
/**
* Exports:
*
* - `ReactTestUtils.Simulate.click(Element/ReactDOMComponent)`
* - `ReactTestUtils.Simulate.mouseMove(Element/ReactDOMComponent)`
* - `ReactTestUtils.Simulate.change(Element/ReactDOMComponent)`
* - ... (All keys from event plugin `eventTypes` objects)
*/
function makeSimulator(eventType) {
return function(domComponentOrNode, eventData) {
var node;
if (ReactTestUtils.isDOMComponent(domComponentOrNode)) {
node = domComponentOrNode.getDOMNode();
} else if (domComponentOrNode.tagName) {
node = domComponentOrNode;
}
var fakeNativeEvent = new Event();
fakeNativeEvent.target = node;
// We don't use SyntheticEvent.getPooled in order to not have to worry about
// properly destroying any properties assigned from `eventData` upon release
var event = new SyntheticEvent(
ReactBrowserEventEmitter.eventNameDispatchConfigs[eventType],
ReactMount.getID(node),
fakeNativeEvent
);
mergeInto(event, eventData);
EventPropagators.accumulateTwoPhaseDispatches(event);
ReactUpdates.batchedUpdates(function() {
EventPluginHub.enqueueEvents(event);
EventPluginHub.processEventQueue();
});
};
}
function buildSimulators() {
ReactTestUtils.Simulate = {};
var eventType;
for (eventType in ReactBrowserEventEmitter.eventNameDispatchConfigs) {
/**
* @param {!Element || ReactDOMComponent} domComponentOrNode
* @param {?object} eventData Fake event data to use in SyntheticEvent.
*/
ReactTestUtils.Simulate[eventType] = makeSimulator(eventType);
}
}
// Rebuild ReactTestUtils.Simulate whenever event plugins are injected
var oldInjectEventPluginOrder = EventPluginHub.injection.injectEventPluginOrder;
EventPluginHub.injection.injectEventPluginOrder = function() {
oldInjectEventPluginOrder.apply(this, arguments);
buildSimulators();
};
var oldInjectEventPlugins = EventPluginHub.injection.injectEventPluginsByName;
EventPluginHub.injection.injectEventPluginsByName = function() {
oldInjectEventPlugins.apply(this, arguments);
buildSimulators();
};
buildSimulators();
/**
* Exports:
*
* - `ReactTestUtils.SimulateNative.click(Element/ReactDOMComponent)`
* - `ReactTestUtils.SimulateNative.mouseMove(Element/ReactDOMComponent)`
* - `ReactTestUtils.SimulateNative.mouseIn/ReactDOMComponent)`
* - `ReactTestUtils.SimulateNative.mouseOut(Element/ReactDOMComponent)`
* - ... (All keys from `EventConstants.topLevelTypes`)
*
* Note: Top level event types are a subset of the entire set of handler types
* (which include a broader set of "synthetic" events). For example, onDragDone
* is a synthetic event. Except when testing an event plugin or React's event
* handling code specifically, you probably want to use ReactTestUtils.Simulate
* to dispatch synthetic events.
*/
function makeNativeSimulator(eventType) {
return function(domComponentOrNode, nativeEventData) {
var fakeNativeEvent = new Event(eventType);
mergeInto(fakeNativeEvent, nativeEventData);
if (ReactTestUtils.isDOMComponent(domComponentOrNode)) {
ReactTestUtils.simulateNativeEventOnDOMComponent(
eventType,
domComponentOrNode,
fakeNativeEvent
);
} else if (!!domComponentOrNode.tagName) {
// Will allow on actual dom nodes.
ReactTestUtils.simulateNativeEventOnNode(
eventType,
domComponentOrNode,
fakeNativeEvent
);
}
};
}
var eventType;
for (eventType in topLevelTypes) {
// Event type is stored as 'topClick' - we transform that to 'click'
var convenienceName = eventType.indexOf('top') === 0 ?
eventType.charAt(3).toLowerCase() + eventType.substr(4) : eventType;
/**
* @param {!Element || ReactDOMComponent} domComponentOrNode
* @param {?Event} nativeEventData Fake native event to use in SyntheticEvent.
*/
ReactTestUtils.SimulateNative[convenienceName] =
makeNativeSimulator(eventType);
}
module.exports = ReactTestUtils;
},{"./EventConstants":16,"./EventPluginHub":18,"./EventPropagators":21,"./React":29,"./ReactBrowserEventEmitter":31,"./ReactDOM":41,"./ReactDescriptor":56,"./ReactMount":67,"./ReactTextComponent":83,"./ReactUpdates":87,"./SyntheticEvent":96,"./copyProperties":110,"./mergeInto":146}],83:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactTextComponent
* @typechecks static-only
*/
"use strict";
var DOMPropertyOperations = _dereq_("./DOMPropertyOperations");
var ReactBrowserComponentMixin = _dereq_("./ReactBrowserComponentMixin");
var ReactComponent = _dereq_("./ReactComponent");
var ReactDescriptor = _dereq_("./ReactDescriptor");
var escapeTextForBrowser = _dereq_("./escapeTextForBrowser");
var mixInto = _dereq_("./mixInto");
/**
* Text nodes violate a couple assumptions that React makes about components:
*
* - When mounting text into the DOM, adjacent text nodes are merged.
* - Text nodes cannot be assigned a React root ID.
*
* This component is used to wrap strings in elements so that they can undergo
* the same reconciliation that is applied to elements.
*
* TODO: Investigate representing React components in the DOM with text nodes.
*
* @class ReactTextComponent
* @extends ReactComponent
* @internal
*/
var ReactTextComponent = function(descriptor) {
this.construct(descriptor);
};
mixInto(ReactTextComponent, ReactComponent.Mixin);
mixInto(ReactTextComponent, ReactBrowserComponentMixin);
mixInto(ReactTextComponent, {
/**
* Creates the markup for this text node. This node is not intended to have
* any features besides containing text content.
*
* @param {string} rootID DOM ID of the root node.
* @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
* @param {number} mountDepth number of components in the owner hierarchy
* @return {string} Markup for this text node.
* @internal
*/
mountComponent: function(rootID, transaction, mountDepth) {
ReactComponent.Mixin.mountComponent.call(
this,
rootID,
transaction,
mountDepth
);
var escapedText = escapeTextForBrowser(this.props);
if (transaction.renderToStaticMarkup) {
// Normally we'd wrap this in a `span` for the reasons stated above, but
// since this is a situation where React won't take over (static pages),
// we can simply return the text as it is.
return escapedText;
}
return (
'<span ' + DOMPropertyOperations.createMarkupForID(rootID) + '>' +
escapedText +
'</span>'
);
},
/**
* Updates this component by updating the text content.
*
* @param {object} nextComponent Contains the next text content.
* @param {ReactReconcileTransaction} transaction
* @internal
*/
receiveComponent: function(nextComponent, transaction) {
var nextProps = nextComponent.props;
if (nextProps !== this.props) {
this.props = nextProps;
ReactComponent.BackendIDOperations.updateTextContentByID(
this._rootNodeID,
nextProps
);
}
}
});
module.exports = ReactDescriptor.createFactory(ReactTextComponent);
},{"./DOMPropertyOperations":12,"./ReactBrowserComponentMixin":30,"./ReactComponent":35,"./ReactDescriptor":56,"./escapeTextForBrowser":118,"./mixInto":147}],84:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @typechecks static-only
* @providesModule ReactTransitionChildMapping
*/
"use strict";
var ReactChildren = _dereq_("./ReactChildren");
var ReactTransitionChildMapping = {
/**
* Given `this.props.children`, return an object mapping key to child. Just
* simple syntactic sugar around ReactChildren.map().
*
* @param {*} children `this.props.children`
* @return {object} Mapping of key to child
*/
getChildMapping: function(children) {
return ReactChildren.map(children, function(child) {
return child;
});
},
/**
* When you're adding or removing children some may be added or removed in the
* same render pass. We want ot show *both* since we want to simultaneously
* animate elements in and out. This function takes a previous set of keys
* and a new set of keys and merges them with its best guess of the correct
* ordering. In the future we may expose some of the utilities in
* ReactMultiChild to make this easy, but for now React itself does not
* directly have this concept of the union of prevChildren and nextChildren
* so we implement it here.
*
* @param {object} prev prev children as returned from
* `ReactTransitionChildMapping.getChildMapping()`.
* @param {object} next next children as returned from
* `ReactTransitionChildMapping.getChildMapping()`.
* @return {object} a key set that contains all keys in `prev` and all keys
* in `next` in a reasonable order.
*/
mergeChildMappings: function(prev, next) {
prev = prev || {};
next = next || {};
function getValueForKey(key) {
if (next.hasOwnProperty(key)) {
return next[key];
} else {
return prev[key];
}
}
// For each key of `next`, the list of keys to insert before that key in
// the combined list
var nextKeysPending = {};
var pendingKeys = [];
for (var prevKey in prev) {
if (next.hasOwnProperty(prevKey)) {
if (pendingKeys.length) {
nextKeysPending[prevKey] = pendingKeys;
pendingKeys = [];
}
} else {
pendingKeys.push(prevKey);
}
}
var i;
var childMapping = {};
for (var nextKey in next) {
if (nextKeysPending.hasOwnProperty(nextKey)) {
for (i = 0; i < nextKeysPending[nextKey].length; i++) {
var pendingNextKey = nextKeysPending[nextKey][i];
childMapping[nextKeysPending[nextKey][i]] = getValueForKey(
pendingNextKey
);
}
}
childMapping[nextKey] = getValueForKey(nextKey);
}
// Finally, add the keys which didn't appear before any key in `next`
for (i = 0; i < pendingKeys.length; i++) {
childMapping[pendingKeys[i]] = getValueForKey(pendingKeys[i]);
}
return childMapping;
}
};
module.exports = ReactTransitionChildMapping;
},{"./ReactChildren":34}],85:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactTransitionEvents
*/
"use strict";
var ExecutionEnvironment = _dereq_("./ExecutionEnvironment");
/**
* EVENT_NAME_MAP is used to determine which event fired when a
* transition/animation ends, based on the style property used to
* define that event.
*/
var EVENT_NAME_MAP = {
transitionend: {
'transition': 'transitionend',
'WebkitTransition': 'webkitTransitionEnd',
'MozTransition': 'mozTransitionEnd',
'OTransition': 'oTransitionEnd',
'msTransition': 'MSTransitionEnd'
},
animationend: {
'animation': 'animationend',
'WebkitAnimation': 'webkitAnimationEnd',
'MozAnimation': 'mozAnimationEnd',
'OAnimation': 'oAnimationEnd',
'msAnimation': 'MSAnimationEnd'
}
};
var endEvents = [];
function detectEvents() {
var testEl = document.createElement('div');
var style = testEl.style;
// On some platforms, in particular some releases of Android 4.x,
// the un-prefixed "animation" and "transition" properties are defined on the
// style object but the events that fire will still be prefixed, so we need
// to check if the un-prefixed events are useable, and if not remove them
// from the map
if (!('AnimationEvent' in window)) {
delete EVENT_NAME_MAP.animationend.animation;
}
if (!('TransitionEvent' in window)) {
delete EVENT_NAME_MAP.transitionend.transition;
}
for (var baseEventName in EVENT_NAME_MAP) {
var baseEvents = EVENT_NAME_MAP[baseEventName];
for (var styleName in baseEvents) {
if (styleName in style) {
endEvents.push(baseEvents[styleName]);
break;
}
}
}
}
if (ExecutionEnvironment.canUseDOM) {
detectEvents();
}
// We use the raw {add|remove}EventListener() call because EventListener
// does not know how to remove event listeners and we really should
// clean up. Also, these events are not triggered in older browsers
// so we should be A-OK here.
function addEventListener(node, eventName, eventListener) {
node.addEventListener(eventName, eventListener, false);
}
function removeEventListener(node, eventName, eventListener) {
node.removeEventListener(eventName, eventListener, false);
}
var ReactTransitionEvents = {
addEndEventListener: function(node, eventListener) {
if (endEvents.length === 0) {
// If CSS transitions are not supported, trigger an "end animation"
// event immediately.
window.setTimeout(eventListener, 0);
return;
}
endEvents.forEach(function(endEvent) {
addEventListener(node, endEvent, eventListener);
});
},
removeEndEventListener: function(node, eventListener) {
if (endEvents.length === 0) {
return;
}
endEvents.forEach(function(endEvent) {
removeEventListener(node, endEvent, eventListener);
});
}
};
module.exports = ReactTransitionEvents;
},{"./ExecutionEnvironment":22}],86:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactTransitionGroup
*/
"use strict";
var React = _dereq_("./React");
var ReactTransitionChildMapping = _dereq_("./ReactTransitionChildMapping");
var cloneWithProps = _dereq_("./cloneWithProps");
var emptyFunction = _dereq_("./emptyFunction");
var merge = _dereq_("./merge");
var ReactTransitionGroup = React.createClass({
displayName: 'ReactTransitionGroup',
propTypes: {
component: React.PropTypes.func,
childFactory: React.PropTypes.func
},
getDefaultProps: function() {
return {
component: React.DOM.span,
childFactory: emptyFunction.thatReturnsArgument
};
},
getInitialState: function() {
return {
children: ReactTransitionChildMapping.getChildMapping(this.props.children)
};
},
componentWillReceiveProps: function(nextProps) {
var nextChildMapping = ReactTransitionChildMapping.getChildMapping(
nextProps.children
);
var prevChildMapping = this.state.children;
this.setState({
children: ReactTransitionChildMapping.mergeChildMappings(
prevChildMapping,
nextChildMapping
)
});
var key;
for (key in nextChildMapping) {
var hasPrev = prevChildMapping && prevChildMapping.hasOwnProperty(key);
if (nextChildMapping[key] && !hasPrev &&
!this.currentlyTransitioningKeys[key]) {
this.keysToEnter.push(key);
}
}
for (key in prevChildMapping) {
var hasNext = nextChildMapping && nextChildMapping.hasOwnProperty(key);
if (prevChildMapping[key] && !hasNext &&
!this.currentlyTransitioningKeys[key]) {
this.keysToLeave.push(key);
}
}
// If we want to someday check for reordering, we could do it here.
},
componentWillMount: function() {
this.currentlyTransitioningKeys = {};
this.keysToEnter = [];
this.keysToLeave = [];
},
componentDidUpdate: function() {
var keysToEnter = this.keysToEnter;
this.keysToEnter = [];
keysToEnter.forEach(this.performEnter);
var keysToLeave = this.keysToLeave;
this.keysToLeave = [];
keysToLeave.forEach(this.performLeave);
},
performEnter: function(key) {
this.currentlyTransitioningKeys[key] = true;
var component = this.refs[key];
if (component.componentWillEnter) {
component.componentWillEnter(
this._handleDoneEntering.bind(this, key)
);
} else {
this._handleDoneEntering(key);
}
},
_handleDoneEntering: function(key) {
var component = this.refs[key];
if (component.componentDidEnter) {
component.componentDidEnter();
}
delete this.currentlyTransitioningKeys[key];
var currentChildMapping = ReactTransitionChildMapping.getChildMapping(
this.props.children
);
if (!currentChildMapping || !currentChildMapping.hasOwnProperty(key)) {
// This was removed before it had fully entered. Remove it.
this.performLeave(key);
}
},
performLeave: function(key) {
this.currentlyTransitioningKeys[key] = true;
var component = this.refs[key];
if (component.componentWillLeave) {
component.componentWillLeave(this._handleDoneLeaving.bind(this, key));
} else {
// Note that this is somewhat dangerous b/c it calls setState()
// again, effectively mutating the component before all the work
// is done.
this._handleDoneLeaving(key);
}
},
_handleDoneLeaving: function(key) {
var component = this.refs[key];
if (component.componentDidLeave) {
component.componentDidLeave();
}
delete this.currentlyTransitioningKeys[key];
var currentChildMapping = ReactTransitionChildMapping.getChildMapping(
this.props.children
);
if (currentChildMapping && currentChildMapping.hasOwnProperty(key)) {
// This entered again before it fully left. Add it again.
this.performEnter(key);
} else {
var newChildren = merge(this.state.children);
delete newChildren[key];
this.setState({children: newChildren});
}
},
render: function() {
// TODO: we could get rid of the need for the wrapper node
// by cloning a single child
var childrenToRender = {};
for (var key in this.state.children) {
var child = this.state.children[key];
if (child) {
// You may need to apply reactive updates to a child as it is leaving.
// The normal React way to do it won't work since the child will have
// already been removed. In case you need this behavior you can provide
// a childFactory function to wrap every child, even the ones that are
// leaving.
childrenToRender[key] = cloneWithProps(
this.props.childFactory(child),
{ref: key}
);
}
}
return this.transferPropsTo(this.props.component(null, childrenToRender));
}
});
module.exports = ReactTransitionGroup;
},{"./React":29,"./ReactTransitionChildMapping":84,"./cloneWithProps":108,"./emptyFunction":116,"./merge":144}],87:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactUpdates
*/
"use strict";
var CallbackQueue = _dereq_("./CallbackQueue");
var PooledClass = _dereq_("./PooledClass");
var ReactCurrentOwner = _dereq_("./ReactCurrentOwner");
var ReactPerf = _dereq_("./ReactPerf");
var Transaction = _dereq_("./Transaction");
var invariant = _dereq_("./invariant");
var mixInto = _dereq_("./mixInto");
var warning = _dereq_("./warning");
var dirtyComponents = [];
var batchingStrategy = null;
function ensureInjected() {
("production" !== "development" ? invariant(
ReactUpdates.ReactReconcileTransaction && batchingStrategy,
'ReactUpdates: must inject a reconcile transaction class and batching ' +
'strategy'
) : invariant(ReactUpdates.ReactReconcileTransaction && batchingStrategy));
}
var NESTED_UPDATES = {
initialize: function() {
this.dirtyComponentsLength = dirtyComponents.length;
},
close: function() {
if (this.dirtyComponentsLength !== dirtyComponents.length) {
// Additional updates were enqueued by componentDidUpdate handlers or
// similar; before our own UPDATE_QUEUEING wrapper closes, we want to run
// these new updates so that if A's componentDidUpdate calls setState on
// B, B will update before the callback A's updater provided when calling
// setState.
dirtyComponents.splice(0, this.dirtyComponentsLength);
flushBatchedUpdates();
} else {
dirtyComponents.length = 0;
}
}
};
var UPDATE_QUEUEING = {
initialize: function() {
this.callbackQueue.reset();
},
close: function() {
this.callbackQueue.notifyAll();
}
};
var TRANSACTION_WRAPPERS = [NESTED_UPDATES, UPDATE_QUEUEING];
function ReactUpdatesFlushTransaction() {
this.reinitializeTransaction();
this.dirtyComponentsLength = null;
this.callbackQueue = CallbackQueue.getPooled(null);
this.reconcileTransaction =
ReactUpdates.ReactReconcileTransaction.getPooled();
}
mixInto(ReactUpdatesFlushTransaction, Transaction.Mixin);
mixInto(ReactUpdatesFlushTransaction, {
getTransactionWrappers: function() {
return TRANSACTION_WRAPPERS;
},
destructor: function() {
this.dirtyComponentsLength = null;
CallbackQueue.release(this.callbackQueue);
this.callbackQueue = null;
ReactUpdates.ReactReconcileTransaction.release(this.reconcileTransaction);
this.reconcileTransaction = null;
},
perform: function(method, scope, a) {
// Essentially calls `this.reconcileTransaction.perform(method, scope, a)`
// with this transaction's wrappers around it.
return Transaction.Mixin.perform.call(
this,
this.reconcileTransaction.perform,
this.reconcileTransaction,
method,
scope,
a
);
}
});
PooledClass.addPoolingTo(ReactUpdatesFlushTransaction);
function batchedUpdates(callback, a, b) {
ensureInjected();
batchingStrategy.batchedUpdates(callback, a, b);
}
/**
* Array comparator for ReactComponents by owner depth
*
* @param {ReactComponent} c1 first component you're comparing
* @param {ReactComponent} c2 second component you're comparing
* @return {number} Return value usable by Array.prototype.sort().
*/
function mountDepthComparator(c1, c2) {
return c1._mountDepth - c2._mountDepth;
}
function runBatchedUpdates(transaction) {
var len = transaction.dirtyComponentsLength;
("production" !== "development" ? invariant(
len === dirtyComponents.length,
'Expected flush transaction\'s stored dirty-components length (%s) to ' +
'match dirty-components array length (%s).',
len,
dirtyComponents.length
) : invariant(len === dirtyComponents.length));
// Since reconciling a component higher in the owner hierarchy usually (not
// always -- see shouldComponentUpdate()) will reconcile children, reconcile
// them before their children by sorting the array.
dirtyComponents.sort(mountDepthComparator);
for (var i = 0; i < len; i++) {
// If a component is unmounted before pending changes apply, ignore them
// TODO: Queue unmounts in the same list to avoid this happening at all
var component = dirtyComponents[i];
if (component.isMounted()) {
// If performUpdateIfNecessary happens to enqueue any new updates, we
// shouldn't execute the callbacks until the next render happens, so
// stash the callbacks first
var callbacks = component._pendingCallbacks;
component._pendingCallbacks = null;
component.performUpdateIfNecessary(transaction.reconcileTransaction);
if (callbacks) {
for (var j = 0; j < callbacks.length; j++) {
transaction.callbackQueue.enqueue(
callbacks[j],
component
);
}
}
}
}
}
var flushBatchedUpdates = ReactPerf.measure(
'ReactUpdates',
'flushBatchedUpdates',
function() {
// ReactUpdatesFlushTransaction's wrappers will clear the dirtyComponents
// array and perform any updates enqueued by mount-ready handlers (i.e.,
// componentDidUpdate) but we need to check here too in order to catch
// updates enqueued by setState callbacks.
while (dirtyComponents.length) {
var transaction = ReactUpdatesFlushTransaction.getPooled();
transaction.perform(runBatchedUpdates, null, transaction);
ReactUpdatesFlushTransaction.release(transaction);
}
}
);
/**
* Mark a component as needing a rerender, adding an optional callback to a
* list of functions which will be executed once the rerender occurs.
*/
function enqueueUpdate(component, callback) {
("production" !== "development" ? invariant(
!callback || typeof callback === "function",
'enqueueUpdate(...): You called `setProps`, `replaceProps`, ' +
'`setState`, `replaceState`, or `forceUpdate` with a callback that ' +
'isn\'t callable.'
) : invariant(!callback || typeof callback === "function"));
ensureInjected();
// Various parts of our code (such as ReactCompositeComponent's
// _renderValidatedComponent) assume that calls to render aren't nested;
// verify that that's the case. (This is called by each top-level update
// function, like setProps, setState, forceUpdate, etc.; creation and
// destruction of top-level components is guarded in ReactMount.)
("production" !== "development" ? warning(
ReactCurrentOwner.current == null,
'enqueueUpdate(): Render methods should be a pure function of props ' +
'and state; triggering nested component updates from render is not ' +
'allowed. If necessary, trigger nested updates in ' +
'componentDidUpdate.'
) : null);
if (!batchingStrategy.isBatchingUpdates) {
batchingStrategy.batchedUpdates(enqueueUpdate, component, callback);
return;
}
dirtyComponents.push(component);
if (callback) {
if (component._pendingCallbacks) {
component._pendingCallbacks.push(callback);
} else {
component._pendingCallbacks = [callback];
}
}
}
var ReactUpdatesInjection = {
injectReconcileTransaction: function(ReconcileTransaction) {
("production" !== "development" ? invariant(
ReconcileTransaction,
'ReactUpdates: must provide a reconcile transaction class'
) : invariant(ReconcileTransaction));
ReactUpdates.ReactReconcileTransaction = ReconcileTransaction;
},
injectBatchingStrategy: function(_batchingStrategy) {
("production" !== "development" ? invariant(
_batchingStrategy,
'ReactUpdates: must provide a batching strategy'
) : invariant(_batchingStrategy));
("production" !== "development" ? invariant(
typeof _batchingStrategy.batchedUpdates === 'function',
'ReactUpdates: must provide a batchedUpdates() function'
) : invariant(typeof _batchingStrategy.batchedUpdates === 'function'));
("production" !== "development" ? invariant(
typeof _batchingStrategy.isBatchingUpdates === 'boolean',
'ReactUpdates: must provide an isBatchingUpdates boolean attribute'
) : invariant(typeof _batchingStrategy.isBatchingUpdates === 'boolean'));
batchingStrategy = _batchingStrategy;
}
};
var ReactUpdates = {
/**
* React references `ReactReconcileTransaction` using this property in order
* to allow dependency injection.
*
* @internal
*/
ReactReconcileTransaction: null,
batchedUpdates: batchedUpdates,
enqueueUpdate: enqueueUpdate,
flushBatchedUpdates: flushBatchedUpdates,
injection: ReactUpdatesInjection
};
module.exports = ReactUpdates;
},{"./CallbackQueue":6,"./PooledClass":28,"./ReactCurrentOwner":40,"./ReactPerf":71,"./Transaction":104,"./invariant":134,"./mixInto":147,"./warning":158}],88:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ReactWithAddons
*/
/**
* This module exists purely in the open source project, and is meant as a way
* to create a separate standalone build of React. This build has "addons", or
* functionality we've built and think might be useful but doesn't have a good
* place to live inside React core.
*/
"use strict";
var LinkedStateMixin = _dereq_("./LinkedStateMixin");
var React = _dereq_("./React");
var ReactComponentWithPureRenderMixin =
_dereq_("./ReactComponentWithPureRenderMixin");
var ReactCSSTransitionGroup = _dereq_("./ReactCSSTransitionGroup");
var ReactTransitionGroup = _dereq_("./ReactTransitionGroup");
var cx = _dereq_("./cx");
var cloneWithProps = _dereq_("./cloneWithProps");
var update = _dereq_("./update");
React.addons = {
CSSTransitionGroup: ReactCSSTransitionGroup,
LinkedStateMixin: LinkedStateMixin,
PureRenderMixin: ReactComponentWithPureRenderMixin,
TransitionGroup: ReactTransitionGroup,
classSet: cx,
cloneWithProps: cloneWithProps,
update: update
};
if ("production" !== "development") {
React.addons.Perf = _dereq_("./ReactDefaultPerf");
React.addons.TestUtils = _dereq_("./ReactTestUtils");
}
module.exports = React;
},{"./LinkedStateMixin":24,"./React":29,"./ReactCSSTransitionGroup":32,"./ReactComponentWithPureRenderMixin":37,"./ReactDefaultPerf":54,"./ReactTestUtils":82,"./ReactTransitionGroup":86,"./cloneWithProps":108,"./cx":114,"./update":157}],89:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule SVGDOMPropertyConfig
*/
/*jslint bitwise: true*/
"use strict";
var DOMProperty = _dereq_("./DOMProperty");
var MUST_USE_ATTRIBUTE = DOMProperty.injection.MUST_USE_ATTRIBUTE;
var SVGDOMPropertyConfig = {
Properties: {
cx: MUST_USE_ATTRIBUTE,
cy: MUST_USE_ATTRIBUTE,
d: MUST_USE_ATTRIBUTE,
dx: MUST_USE_ATTRIBUTE,
dy: MUST_USE_ATTRIBUTE,
fill: MUST_USE_ATTRIBUTE,
fillOpacity: MUST_USE_ATTRIBUTE,
fontFamily: MUST_USE_ATTRIBUTE,
fontSize: MUST_USE_ATTRIBUTE,
fx: MUST_USE_ATTRIBUTE,
fy: MUST_USE_ATTRIBUTE,
gradientTransform: MUST_USE_ATTRIBUTE,
gradientUnits: MUST_USE_ATTRIBUTE,
markerEnd: MUST_USE_ATTRIBUTE,
markerMid: MUST_USE_ATTRIBUTE,
markerStart: MUST_USE_ATTRIBUTE,
offset: MUST_USE_ATTRIBUTE,
opacity: MUST_USE_ATTRIBUTE,
patternContentUnits: MUST_USE_ATTRIBUTE,
patternUnits: MUST_USE_ATTRIBUTE,
points: MUST_USE_ATTRIBUTE,
preserveAspectRatio: MUST_USE_ATTRIBUTE,
r: MUST_USE_ATTRIBUTE,
rx: MUST_USE_ATTRIBUTE,
ry: MUST_USE_ATTRIBUTE,
spreadMethod: MUST_USE_ATTRIBUTE,
stopColor: MUST_USE_ATTRIBUTE,
stopOpacity: MUST_USE_ATTRIBUTE,
stroke: MUST_USE_ATTRIBUTE,
strokeDasharray: MUST_USE_ATTRIBUTE,
strokeLinecap: MUST_USE_ATTRIBUTE,
strokeOpacity: MUST_USE_ATTRIBUTE,
strokeWidth: MUST_USE_ATTRIBUTE,
textAnchor: MUST_USE_ATTRIBUTE,
transform: MUST_USE_ATTRIBUTE,
version: MUST_USE_ATTRIBUTE,
viewBox: MUST_USE_ATTRIBUTE,
x1: MUST_USE_ATTRIBUTE,
x2: MUST_USE_ATTRIBUTE,
x: MUST_USE_ATTRIBUTE,
y1: MUST_USE_ATTRIBUTE,
y2: MUST_USE_ATTRIBUTE,
y: MUST_USE_ATTRIBUTE
},
DOMAttributeNames: {
fillOpacity: 'fill-opacity',
fontFamily: 'font-family',
fontSize: 'font-size',
gradientTransform: 'gradientTransform',
gradientUnits: 'gradientUnits',
markerEnd: 'marker-end',
markerMid: 'marker-mid',
markerStart: 'marker-start',
patternContentUnits: 'patternContentUnits',
patternUnits: 'patternUnits',
preserveAspectRatio: 'preserveAspectRatio',
spreadMethod: 'spreadMethod',
stopColor: 'stop-color',
stopOpacity: 'stop-opacity',
strokeDasharray: 'stroke-dasharray',
strokeLinecap: 'stroke-linecap',
strokeOpacity: 'stroke-opacity',
strokeWidth: 'stroke-width',
textAnchor: 'text-anchor',
viewBox: 'viewBox'
}
};
module.exports = SVGDOMPropertyConfig;
},{"./DOMProperty":11}],90:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule SelectEventPlugin
*/
"use strict";
var EventConstants = _dereq_("./EventConstants");
var EventPropagators = _dereq_("./EventPropagators");
var ReactInputSelection = _dereq_("./ReactInputSelection");
var SyntheticEvent = _dereq_("./SyntheticEvent");
var getActiveElement = _dereq_("./getActiveElement");
var isTextInputElement = _dereq_("./isTextInputElement");
var keyOf = _dereq_("./keyOf");
var shallowEqual = _dereq_("./shallowEqual");
var topLevelTypes = EventConstants.topLevelTypes;
var eventTypes = {
select: {
phasedRegistrationNames: {
bubbled: keyOf({onSelect: null}),
captured: keyOf({onSelectCapture: null})
},
dependencies: [
topLevelTypes.topBlur,
topLevelTypes.topContextMenu,
topLevelTypes.topFocus,
topLevelTypes.topKeyDown,
topLevelTypes.topMouseDown,
topLevelTypes.topMouseUp,
topLevelTypes.topSelectionChange
]
}
};
var activeElement = null;
var activeElementID = null;
var lastSelection = null;
var mouseDown = false;
/**
* Get an object which is a unique representation of the current selection.
*
* The return value will not be consistent across nodes or browsers, but
* two identical selections on the same node will return identical objects.
*
* @param {DOMElement} node
* @param {object}
*/
function getSelection(node) {
if ('selectionStart' in node &&
ReactInputSelection.hasSelectionCapabilities(node)) {
return {
start: node.selectionStart,
end: node.selectionEnd
};
} else if (document.selection) {
var range = document.selection.createRange();
return {
parentElement: range.parentElement(),
text: range.text,
top: range.boundingTop,
left: range.boundingLeft
};
} else {
var selection = window.getSelection();
return {
anchorNode: selection.anchorNode,
anchorOffset: selection.anchorOffset,
focusNode: selection.focusNode,
focusOffset: selection.focusOffset
};
}
}
/**
* Poll selection to see whether it's changed.
*
* @param {object} nativeEvent
* @return {?SyntheticEvent}
*/
function constructSelectEvent(nativeEvent) {
// Ensure we have the right element, and that the user is not dragging a
// selection (this matches native `select` event behavior). In HTML5, select
// fires only on input and textarea thus if there's no focused element we
// won't dispatch.
if (mouseDown ||
activeElement == null ||
activeElement != getActiveElement()) {
return;
}
// Only fire when selection has actually changed.
var currentSelection = getSelection(activeElement);
if (!lastSelection || !shallowEqual(lastSelection, currentSelection)) {
lastSelection = currentSelection;
var syntheticEvent = SyntheticEvent.getPooled(
eventTypes.select,
activeElementID,
nativeEvent
);
syntheticEvent.type = 'select';
syntheticEvent.target = activeElement;
EventPropagators.accumulateTwoPhaseDispatches(syntheticEvent);
return syntheticEvent;
}
}
/**
* This plugin creates an `onSelect` event that normalizes select events
* across form elements.
*
* Supported elements are:
* - input (see `isTextInputElement`)
* - textarea
* - contentEditable
*
* This differs from native browser implementations in the following ways:
* - Fires on contentEditable fields as well as inputs.
* - Fires for collapsed selection.
* - Fires after user input.
*/
var SelectEventPlugin = {
eventTypes: eventTypes,
/**
* @param {string} topLevelType Record from `EventConstants`.
* @param {DOMEventTarget} topLevelTarget The listening component root node.
* @param {string} topLevelTargetID ID of `topLevelTarget`.
* @param {object} nativeEvent Native browser event.
* @return {*} An accumulation of synthetic events.
* @see {EventPluginHub.extractEvents}
*/
extractEvents: function(
topLevelType,
topLevelTarget,
topLevelTargetID,
nativeEvent) {
switch (topLevelType) {
// Track the input node that has focus.
case topLevelTypes.topFocus:
if (isTextInputElement(topLevelTarget) ||
topLevelTarget.contentEditable === 'true') {
activeElement = topLevelTarget;
activeElementID = topLevelTargetID;
lastSelection = null;
}
break;
case topLevelTypes.topBlur:
activeElement = null;
activeElementID = null;
lastSelection = null;
break;
// Don't fire the event while the user is dragging. This matches the
// semantics of the native select event.
case topLevelTypes.topMouseDown:
mouseDown = true;
break;
case topLevelTypes.topContextMenu:
case topLevelTypes.topMouseUp:
mouseDown = false;
return constructSelectEvent(nativeEvent);
// Chrome and IE fire non-standard event when selection is changed (and
// sometimes when it hasn't).
// Firefox doesn't support selectionchange, so check selection status
// after each key entry. The selection changes after keydown and before
// keyup, but we check on keydown as well in the case of holding down a
// key, when multiple keydown events are fired but only one keyup is.
case topLevelTypes.topSelectionChange:
case topLevelTypes.topKeyDown:
case topLevelTypes.topKeyUp:
return constructSelectEvent(nativeEvent);
}
}
};
module.exports = SelectEventPlugin;
},{"./EventConstants":16,"./EventPropagators":21,"./ReactInputSelection":63,"./SyntheticEvent":96,"./getActiveElement":122,"./isTextInputElement":137,"./keyOf":141,"./shallowEqual":153}],91:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ServerReactRootIndex
* @typechecks
*/
"use strict";
/**
* Size of the reactRoot ID space. We generate random numbers for React root
* IDs and if there's a collision the events and DOM update system will
* get confused. In the future we need a way to generate GUIDs but for
* now this will work on a smaller scale.
*/
var GLOBAL_MOUNT_POINT_MAX = Math.pow(2, 53);
var ServerReactRootIndex = {
createReactRootIndex: function() {
return Math.ceil(Math.random() * GLOBAL_MOUNT_POINT_MAX);
}
};
module.exports = ServerReactRootIndex;
},{}],92:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule SimpleEventPlugin
*/
"use strict";
var EventConstants = _dereq_("./EventConstants");
var EventPluginUtils = _dereq_("./EventPluginUtils");
var EventPropagators = _dereq_("./EventPropagators");
var SyntheticClipboardEvent = _dereq_("./SyntheticClipboardEvent");
var SyntheticEvent = _dereq_("./SyntheticEvent");
var SyntheticFocusEvent = _dereq_("./SyntheticFocusEvent");
var SyntheticKeyboardEvent = _dereq_("./SyntheticKeyboardEvent");
var SyntheticMouseEvent = _dereq_("./SyntheticMouseEvent");
var SyntheticDragEvent = _dereq_("./SyntheticDragEvent");
var SyntheticTouchEvent = _dereq_("./SyntheticTouchEvent");
var SyntheticUIEvent = _dereq_("./SyntheticUIEvent");
var SyntheticWheelEvent = _dereq_("./SyntheticWheelEvent");
var invariant = _dereq_("./invariant");
var keyOf = _dereq_("./keyOf");
var topLevelTypes = EventConstants.topLevelTypes;
var eventTypes = {
blur: {
phasedRegistrationNames: {
bubbled: keyOf({onBlur: true}),
captured: keyOf({onBlurCapture: true})
}
},
click: {
phasedRegistrationNames: {
bubbled: keyOf({onClick: true}),
captured: keyOf({onClickCapture: true})
}
},
contextMenu: {
phasedRegistrationNames: {
bubbled: keyOf({onContextMenu: true}),
captured: keyOf({onContextMenuCapture: true})
}
},
copy: {
phasedRegistrationNames: {
bubbled: keyOf({onCopy: true}),
captured: keyOf({onCopyCapture: true})
}
},
cut: {
phasedRegistrationNames: {
bubbled: keyOf({onCut: true}),
captured: keyOf({onCutCapture: true})
}
},
doubleClick: {
phasedRegistrationNames: {
bubbled: keyOf({onDoubleClick: true}),
captured: keyOf({onDoubleClickCapture: true})
}
},
drag: {
phasedRegistrationNames: {
bubbled: keyOf({onDrag: true}),
captured: keyOf({onDragCapture: true})
}
},
dragEnd: {
phasedRegistrationNames: {
bubbled: keyOf({onDragEnd: true}),
captured: keyOf({onDragEndCapture: true})
}
},
dragEnter: {
phasedRegistrationNames: {
bubbled: keyOf({onDragEnter: true}),
captured: keyOf({onDragEnterCapture: true})
}
},
dragExit: {
phasedRegistrationNames: {
bubbled: keyOf({onDragExit: true}),
captured: keyOf({onDragExitCapture: true})
}
},
dragLeave: {
phasedRegistrationNames: {
bubbled: keyOf({onDragLeave: true}),
captured: keyOf({onDragLeaveCapture: true})
}
},
dragOver: {
phasedRegistrationNames: {
bubbled: keyOf({onDragOver: true}),
captured: keyOf({onDragOverCapture: true})
}
},
dragStart: {
phasedRegistrationNames: {
bubbled: keyOf({onDragStart: true}),
captured: keyOf({onDragStartCapture: true})
}
},
drop: {
phasedRegistrationNames: {
bubbled: keyOf({onDrop: true}),
captured: keyOf({onDropCapture: true})
}
},
focus: {
phasedRegistrationNames: {
bubbled: keyOf({onFocus: true}),
captured: keyOf({onFocusCapture: true})
}
},
input: {
phasedRegistrationNames: {
bubbled: keyOf({onInput: true}),
captured: keyOf({onInputCapture: true})
}
},
keyDown: {
phasedRegistrationNames: {
bubbled: keyOf({onKeyDown: true}),
captured: keyOf({onKeyDownCapture: true})
}
},
keyPress: {
phasedRegistrationNames: {
bubbled: keyOf({onKeyPress: true}),
captured: keyOf({onKeyPressCapture: true})
}
},
keyUp: {
phasedRegistrationNames: {
bubbled: keyOf({onKeyUp: true}),
captured: keyOf({onKeyUpCapture: true})
}
},
load: {
phasedRegistrationNames: {
bubbled: keyOf({onLoad: true}),
captured: keyOf({onLoadCapture: true})
}
},
error: {
phasedRegistrationNames: {
bubbled: keyOf({onError: true}),
captured: keyOf({onErrorCapture: true})
}
},
// Note: We do not allow listening to mouseOver events. Instead, use the
// onMouseEnter/onMouseLeave created by `EnterLeaveEventPlugin`.
mouseDown: {
phasedRegistrationNames: {
bubbled: keyOf({onMouseDown: true}),
captured: keyOf({onMouseDownCapture: true})
}
},
mouseMove: {
phasedRegistrationNames: {
bubbled: keyOf({onMouseMove: true}),
captured: keyOf({onMouseMoveCapture: true})
}
},
mouseOut: {
phasedRegistrationNames: {
bubbled: keyOf({onMouseOut: true}),
captured: keyOf({onMouseOutCapture: true})
}
},
mouseOver: {
phasedRegistrationNames: {
bubbled: keyOf({onMouseOver: true}),
captured: keyOf({onMouseOverCapture: true})
}
},
mouseUp: {
phasedRegistrationNames: {
bubbled: keyOf({onMouseUp: true}),
captured: keyOf({onMouseUpCapture: true})
}
},
paste: {
phasedRegistrationNames: {
bubbled: keyOf({onPaste: true}),
captured: keyOf({onPasteCapture: true})
}
},
reset: {
phasedRegistrationNames: {
bubbled: keyOf({onReset: true}),
captured: keyOf({onResetCapture: true})
}
},
scroll: {
phasedRegistrationNames: {
bubbled: keyOf({onScroll: true}),
captured: keyOf({onScrollCapture: true})
}
},
submit: {
phasedRegistrationNames: {
bubbled: keyOf({onSubmit: true}),
captured: keyOf({onSubmitCapture: true})
}
},
touchCancel: {
phasedRegistrationNames: {
bubbled: keyOf({onTouchCancel: true}),
captured: keyOf({onTouchCancelCapture: true})
}
},
touchEnd: {
phasedRegistrationNames: {
bubbled: keyOf({onTouchEnd: true}),
captured: keyOf({onTouchEndCapture: true})
}
},
touchMove: {
phasedRegistrationNames: {
bubbled: keyOf({onTouchMove: true}),
captured: keyOf({onTouchMoveCapture: true})
}
},
touchStart: {
phasedRegistrationNames: {
bubbled: keyOf({onTouchStart: true}),
captured: keyOf({onTouchStartCapture: true})
}
},
wheel: {
phasedRegistrationNames: {
bubbled: keyOf({onWheel: true}),
captured: keyOf({onWheelCapture: true})
}
}
};
var topLevelEventsToDispatchConfig = {
topBlur: eventTypes.blur,
topClick: eventTypes.click,
topContextMenu: eventTypes.contextMenu,
topCopy: eventTypes.copy,
topCut: eventTypes.cut,
topDoubleClick: eventTypes.doubleClick,
topDrag: eventTypes.drag,
topDragEnd: eventTypes.dragEnd,
topDragEnter: eventTypes.dragEnter,
topDragExit: eventTypes.dragExit,
topDragLeave: eventTypes.dragLeave,
topDragOver: eventTypes.dragOver,
topDragStart: eventTypes.dragStart,
topDrop: eventTypes.drop,
topError: eventTypes.error,
topFocus: eventTypes.focus,
topInput: eventTypes.input,
topKeyDown: eventTypes.keyDown,
topKeyPress: eventTypes.keyPress,
topKeyUp: eventTypes.keyUp,
topLoad: eventTypes.load,
topMouseDown: eventTypes.mouseDown,
topMouseMove: eventTypes.mouseMove,
topMouseOut: eventTypes.mouseOut,
topMouseOver: eventTypes.mouseOver,
topMouseUp: eventTypes.mouseUp,
topPaste: eventTypes.paste,
topReset: eventTypes.reset,
topScroll: eventTypes.scroll,
topSubmit: eventTypes.submit,
topTouchCancel: eventTypes.touchCancel,
topTouchEnd: eventTypes.touchEnd,
topTouchMove: eventTypes.touchMove,
topTouchStart: eventTypes.touchStart,
topWheel: eventTypes.wheel
};
for (var topLevelType in topLevelEventsToDispatchConfig) {
topLevelEventsToDispatchConfig[topLevelType].dependencies = [topLevelType];
}
var SimpleEventPlugin = {
eventTypes: eventTypes,
/**
* Same as the default implementation, except cancels the event when return
* value is false.
*
* @param {object} Event to be dispatched.
* @param {function} Application-level callback.
* @param {string} domID DOM ID to pass to the callback.
*/
executeDispatch: function(event, listener, domID) {
var returnValue = EventPluginUtils.executeDispatch(event, listener, domID);
if (returnValue === false) {
event.stopPropagation();
event.preventDefault();
}
},
/**
* @param {string} topLevelType Record from `EventConstants`.
* @param {DOMEventTarget} topLevelTarget The listening component root node.
* @param {string} topLevelTargetID ID of `topLevelTarget`.
* @param {object} nativeEvent Native browser event.
* @return {*} An accumulation of synthetic events.
* @see {EventPluginHub.extractEvents}
*/
extractEvents: function(
topLevelType,
topLevelTarget,
topLevelTargetID,
nativeEvent) {
var dispatchConfig = topLevelEventsToDispatchConfig[topLevelType];
if (!dispatchConfig) {
return null;
}
var EventConstructor;
switch (topLevelType) {
case topLevelTypes.topInput:
case topLevelTypes.topLoad:
case topLevelTypes.topError:
case topLevelTypes.topReset:
case topLevelTypes.topSubmit:
// HTML Events
// @see http://www.w3.org/TR/html5/index.html#events-0
EventConstructor = SyntheticEvent;
break;
case topLevelTypes.topKeyPress:
// FireFox creates a keypress event for function keys too. This removes
// the unwanted keypress events.
if (nativeEvent.charCode === 0) {
return null;
}
/* falls through */
case topLevelTypes.topKeyDown:
case topLevelTypes.topKeyUp:
EventConstructor = SyntheticKeyboardEvent;
break;
case topLevelTypes.topBlur:
case topLevelTypes.topFocus:
EventConstructor = SyntheticFocusEvent;
break;
case topLevelTypes.topClick:
// Firefox creates a click event on right mouse clicks. This removes the
// unwanted click events.
if (nativeEvent.button === 2) {
return null;
}
/* falls through */
case topLevelTypes.topContextMenu:
case topLevelTypes.topDoubleClick:
case topLevelTypes.topMouseDown:
case topLevelTypes.topMouseMove:
case topLevelTypes.topMouseOut:
case topLevelTypes.topMouseOver:
case topLevelTypes.topMouseUp:
EventConstructor = SyntheticMouseEvent;
break;
case topLevelTypes.topDrag:
case topLevelTypes.topDragEnd:
case topLevelTypes.topDragEnter:
case topLevelTypes.topDragExit:
case topLevelTypes.topDragLeave:
case topLevelTypes.topDragOver:
case topLevelTypes.topDragStart:
case topLevelTypes.topDrop:
EventConstructor = SyntheticDragEvent;
break;
case topLevelTypes.topTouchCancel:
case topLevelTypes.topTouchEnd:
case topLevelTypes.topTouchMove:
case topLevelTypes.topTouchStart:
EventConstructor = SyntheticTouchEvent;
break;
case topLevelTypes.topScroll:
EventConstructor = SyntheticUIEvent;
break;
case topLevelTypes.topWheel:
EventConstructor = SyntheticWheelEvent;
break;
case topLevelTypes.topCopy:
case topLevelTypes.topCut:
case topLevelTypes.topPaste:
EventConstructor = SyntheticClipboardEvent;
break;
}
("production" !== "development" ? invariant(
EventConstructor,
'SimpleEventPlugin: Unhandled event type, `%s`.',
topLevelType
) : invariant(EventConstructor));
var event = EventConstructor.getPooled(
dispatchConfig,
topLevelTargetID,
nativeEvent
);
EventPropagators.accumulateTwoPhaseDispatches(event);
return event;
}
};
module.exports = SimpleEventPlugin;
},{"./EventConstants":16,"./EventPluginUtils":20,"./EventPropagators":21,"./SyntheticClipboardEvent":93,"./SyntheticDragEvent":95,"./SyntheticEvent":96,"./SyntheticFocusEvent":97,"./SyntheticKeyboardEvent":99,"./SyntheticMouseEvent":100,"./SyntheticTouchEvent":101,"./SyntheticUIEvent":102,"./SyntheticWheelEvent":103,"./invariant":134,"./keyOf":141}],93:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule SyntheticClipboardEvent
* @typechecks static-only
*/
"use strict";
var SyntheticEvent = _dereq_("./SyntheticEvent");
/**
* @interface Event
* @see http://www.w3.org/TR/clipboard-apis/
*/
var ClipboardEventInterface = {
clipboardData: function(event) {
return (
'clipboardData' in event ?
event.clipboardData :
window.clipboardData
);
}
};
/**
* @param {object} dispatchConfig Configuration used to dispatch this event.
* @param {string} dispatchMarker Marker identifying the event target.
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticUIEvent}
*/
function SyntheticClipboardEvent(dispatchConfig, dispatchMarker, nativeEvent) {
SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
}
SyntheticEvent.augmentClass(SyntheticClipboardEvent, ClipboardEventInterface);
module.exports = SyntheticClipboardEvent;
},{"./SyntheticEvent":96}],94:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule SyntheticCompositionEvent
* @typechecks static-only
*/
"use strict";
var SyntheticEvent = _dereq_("./SyntheticEvent");
/**
* @interface Event
* @see http://www.w3.org/TR/DOM-Level-3-Events/#events-compositionevents
*/
var CompositionEventInterface = {
data: null
};
/**
* @param {object} dispatchConfig Configuration used to dispatch this event.
* @param {string} dispatchMarker Marker identifying the event target.
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticUIEvent}
*/
function SyntheticCompositionEvent(
dispatchConfig,
dispatchMarker,
nativeEvent) {
SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
}
SyntheticEvent.augmentClass(
SyntheticCompositionEvent,
CompositionEventInterface
);
module.exports = SyntheticCompositionEvent;
},{"./SyntheticEvent":96}],95:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule SyntheticDragEvent
* @typechecks static-only
*/
"use strict";
var SyntheticMouseEvent = _dereq_("./SyntheticMouseEvent");
/**
* @interface DragEvent
* @see http://www.w3.org/TR/DOM-Level-3-Events/
*/
var DragEventInterface = {
dataTransfer: null
};
/**
* @param {object} dispatchConfig Configuration used to dispatch this event.
* @param {string} dispatchMarker Marker identifying the event target.
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticUIEvent}
*/
function SyntheticDragEvent(dispatchConfig, dispatchMarker, nativeEvent) {
SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
}
SyntheticMouseEvent.augmentClass(SyntheticDragEvent, DragEventInterface);
module.exports = SyntheticDragEvent;
},{"./SyntheticMouseEvent":100}],96:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule SyntheticEvent
* @typechecks static-only
*/
"use strict";
var PooledClass = _dereq_("./PooledClass");
var emptyFunction = _dereq_("./emptyFunction");
var getEventTarget = _dereq_("./getEventTarget");
var merge = _dereq_("./merge");
var mergeInto = _dereq_("./mergeInto");
/**
* @interface Event
* @see http://www.w3.org/TR/DOM-Level-3-Events/
*/
var EventInterface = {
type: null,
target: getEventTarget,
// currentTarget is set when dispatching; no use in copying it here
currentTarget: emptyFunction.thatReturnsNull,
eventPhase: null,
bubbles: null,
cancelable: null,
timeStamp: function(event) {
return event.timeStamp || Date.now();
},
defaultPrevented: null,
isTrusted: null
};
/**
* Synthetic events are dispatched by event plugins, typically in response to a
* top-level event delegation handler.
*
* These systems should generally use pooling to reduce the frequency of garbage
* collection. The system should check `isPersistent` to determine whether the
* event should be released into the pool after being dispatched. Users that
* need a persisted event should invoke `persist`.
*
* Synthetic events (and subclasses) implement the DOM Level 3 Events API by
* normalizing browser quirks. Subclasses do not necessarily have to implement a
* DOM interface; custom application-specific events can also subclass this.
*
* @param {object} dispatchConfig Configuration used to dispatch this event.
* @param {string} dispatchMarker Marker identifying the event target.
* @param {object} nativeEvent Native browser event.
*/
function SyntheticEvent(dispatchConfig, dispatchMarker, nativeEvent) {
this.dispatchConfig = dispatchConfig;
this.dispatchMarker = dispatchMarker;
this.nativeEvent = nativeEvent;
var Interface = this.constructor.Interface;
for (var propName in Interface) {
if (!Interface.hasOwnProperty(propName)) {
continue;
}
var normalize = Interface[propName];
if (normalize) {
this[propName] = normalize(nativeEvent);
} else {
this[propName] = nativeEvent[propName];
}
}
var defaultPrevented = nativeEvent.defaultPrevented != null ?
nativeEvent.defaultPrevented :
nativeEvent.returnValue === false;
if (defaultPrevented) {
this.isDefaultPrevented = emptyFunction.thatReturnsTrue;
} else {
this.isDefaultPrevented = emptyFunction.thatReturnsFalse;
}
this.isPropagationStopped = emptyFunction.thatReturnsFalse;
}
mergeInto(SyntheticEvent.prototype, {
preventDefault: function() {
this.defaultPrevented = true;
var event = this.nativeEvent;
event.preventDefault ? event.preventDefault() : event.returnValue = false;
this.isDefaultPrevented = emptyFunction.thatReturnsTrue;
},
stopPropagation: function() {
var event = this.nativeEvent;
event.stopPropagation ? event.stopPropagation() : event.cancelBubble = true;
this.isPropagationStopped = emptyFunction.thatReturnsTrue;
},
/**
* We release all dispatched `SyntheticEvent`s after each event loop, adding
* them back into the pool. This allows a way to hold onto a reference that
* won't be added back into the pool.
*/
persist: function() {
this.isPersistent = emptyFunction.thatReturnsTrue;
},
/**
* Checks if this event should be released back into the pool.
*
* @return {boolean} True if this should not be released, false otherwise.
*/
isPersistent: emptyFunction.thatReturnsFalse,
/**
* `PooledClass` looks for `destructor` on each instance it releases.
*/
destructor: function() {
var Interface = this.constructor.Interface;
for (var propName in Interface) {
this[propName] = null;
}
this.dispatchConfig = null;
this.dispatchMarker = null;
this.nativeEvent = null;
}
});
SyntheticEvent.Interface = EventInterface;
/**
* Helper to reduce boilerplate when creating subclasses.
*
* @param {function} Class
* @param {?object} Interface
*/
SyntheticEvent.augmentClass = function(Class, Interface) {
var Super = this;
var prototype = Object.create(Super.prototype);
mergeInto(prototype, Class.prototype);
Class.prototype = prototype;
Class.prototype.constructor = Class;
Class.Interface = merge(Super.Interface, Interface);
Class.augmentClass = Super.augmentClass;
PooledClass.addPoolingTo(Class, PooledClass.threeArgumentPooler);
};
PooledClass.addPoolingTo(SyntheticEvent, PooledClass.threeArgumentPooler);
module.exports = SyntheticEvent;
},{"./PooledClass":28,"./emptyFunction":116,"./getEventTarget":125,"./merge":144,"./mergeInto":146}],97:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule SyntheticFocusEvent
* @typechecks static-only
*/
"use strict";
var SyntheticUIEvent = _dereq_("./SyntheticUIEvent");
/**
* @interface FocusEvent
* @see http://www.w3.org/TR/DOM-Level-3-Events/
*/
var FocusEventInterface = {
relatedTarget: null
};
/**
* @param {object} dispatchConfig Configuration used to dispatch this event.
* @param {string} dispatchMarker Marker identifying the event target.
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticUIEvent}
*/
function SyntheticFocusEvent(dispatchConfig, dispatchMarker, nativeEvent) {
SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
}
SyntheticUIEvent.augmentClass(SyntheticFocusEvent, FocusEventInterface);
module.exports = SyntheticFocusEvent;
},{"./SyntheticUIEvent":102}],98:[function(_dereq_,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule SyntheticInputEvent
* @typechecks static-only
*/
"use strict";
var SyntheticEvent = _dereq_("./SyntheticEvent");
/**
* @interface Event
* @see http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105
* /#events-inputevents
*/
var InputEventInterface = {
data: null
};
/**
* @param {object} dispatchConfig Configuration used to dispatch this event.
* @param {string} dispatchMarker Marker identifying the event target.
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticUIEvent}
*/
function SyntheticInputEvent(
dispatchConfig,
dispatchMarker,
nativeEvent) {
SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
}
SyntheticEvent.augmentClass(
SyntheticInputEvent,
InputEventInterface
);
module.exports = SyntheticInputEvent;
},{"./SyntheticEvent":96}],99:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule SyntheticKeyboardEvent
* @typechecks static-only
*/
"use strict";
var SyntheticUIEvent = _dereq_("./SyntheticUIEvent");
var getEventKey = _dereq_("./getEventKey");
var getEventModifierState = _dereq_("./getEventModifierState");
/**
* @interface KeyboardEvent
* @see http://www.w3.org/TR/DOM-Level-3-Events/
*/
var KeyboardEventInterface = {
key: getEventKey,
location: null,
ctrlKey: null,
shiftKey: null,
altKey: null,
metaKey: null,
repeat: null,
locale: null,
getModifierState: getEventModifierState,
// Legacy Interface
charCode: function(event) {
// `charCode` is the result of a KeyPress event and represents the value of
// the actual printable character.
// KeyPress is deprecated but its replacement is not yet final and not
// implemented in any major browser.
if (event.type === 'keypress') {
// IE8 does not implement "charCode", but "keyCode" has the correct value.
return 'charCode' in event ? event.charCode : event.keyCode;
}
return 0;
},
keyCode: function(event) {
// `keyCode` is the result of a KeyDown/Up event and represents the value of
// physical keyboard key.
// The actual meaning of the value depends on the users' keyboard layout
// which cannot be detected. Assuming that it is a US keyboard layout
// provides a surprisingly accurate mapping for US and European users.
// Due to this, it is left to the user to implement at this time.
if (event.type === 'keydown' || event.type === 'keyup') {
return event.keyCode;
}
return 0;
},
which: function(event) {
// `which` is an alias for either `keyCode` or `charCode` depending on the
// type of the event. There is no need to determine the type of the event
// as `keyCode` and `charCode` are either aliased or default to zero.
return event.keyCode || event.charCode;
}
};
/**
* @param {object} dispatchConfig Configuration used to dispatch this event.
* @param {string} dispatchMarker Marker identifying the event target.
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticUIEvent}
*/
function SyntheticKeyboardEvent(dispatchConfig, dispatchMarker, nativeEvent) {
SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
}
SyntheticUIEvent.augmentClass(SyntheticKeyboardEvent, KeyboardEventInterface);
module.exports = SyntheticKeyboardEvent;
},{"./SyntheticUIEvent":102,"./getEventKey":123,"./getEventModifierState":124}],100:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule SyntheticMouseEvent
* @typechecks static-only
*/
"use strict";
var SyntheticUIEvent = _dereq_("./SyntheticUIEvent");
var ViewportMetrics = _dereq_("./ViewportMetrics");
var getEventModifierState = _dereq_("./getEventModifierState");
/**
* @interface MouseEvent
* @see http://www.w3.org/TR/DOM-Level-3-Events/
*/
var MouseEventInterface = {
screenX: null,
screenY: null,
clientX: null,
clientY: null,
ctrlKey: null,
shiftKey: null,
altKey: null,
metaKey: null,
getEventModifierState: getEventModifierState,
button: function(event) {
// Webkit, Firefox, IE9+
// which: 1 2 3
// button: 0 1 2 (standard)
var button = event.button;
if ('which' in event) {
return button;
}
// IE<9
// which: undefined
// button: 0 0 0
// button: 1 4 2 (onmouseup)
return button === 2 ? 2 : button === 4 ? 1 : 0;
},
buttons: null,
relatedTarget: function(event) {
return event.relatedTarget || (
event.fromElement === event.srcElement ?
event.toElement :
event.fromElement
);
},
// "Proprietary" Interface.
pageX: function(event) {
return 'pageX' in event ?
event.pageX :
event.clientX + ViewportMetrics.currentScrollLeft;
},
pageY: function(event) {
return 'pageY' in event ?
event.pageY :
event.clientY + ViewportMetrics.currentScrollTop;
}
};
/**
* @param {object} dispatchConfig Configuration used to dispatch this event.
* @param {string} dispatchMarker Marker identifying the event target.
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticUIEvent}
*/
function SyntheticMouseEvent(dispatchConfig, dispatchMarker, nativeEvent) {
SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
}
SyntheticUIEvent.augmentClass(SyntheticMouseEvent, MouseEventInterface);
module.exports = SyntheticMouseEvent;
},{"./SyntheticUIEvent":102,"./ViewportMetrics":105,"./getEventModifierState":124}],101:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule SyntheticTouchEvent
* @typechecks static-only
*/
"use strict";
var SyntheticUIEvent = _dereq_("./SyntheticUIEvent");
var getEventModifierState = _dereq_("./getEventModifierState");
/**
* @interface TouchEvent
* @see http://www.w3.org/TR/touch-events/
*/
var TouchEventInterface = {
touches: null,
targetTouches: null,
changedTouches: null,
altKey: null,
metaKey: null,
ctrlKey: null,
shiftKey: null,
getModifierState: getEventModifierState
};
/**
* @param {object} dispatchConfig Configuration used to dispatch this event.
* @param {string} dispatchMarker Marker identifying the event target.
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticUIEvent}
*/
function SyntheticTouchEvent(dispatchConfig, dispatchMarker, nativeEvent) {
SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
}
SyntheticUIEvent.augmentClass(SyntheticTouchEvent, TouchEventInterface);
module.exports = SyntheticTouchEvent;
},{"./SyntheticUIEvent":102,"./getEventModifierState":124}],102:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule SyntheticUIEvent
* @typechecks static-only
*/
"use strict";
var SyntheticEvent = _dereq_("./SyntheticEvent");
var getEventTarget = _dereq_("./getEventTarget");
/**
* @interface UIEvent
* @see http://www.w3.org/TR/DOM-Level-3-Events/
*/
var UIEventInterface = {
view: function(event) {
if (event.view) {
return event.view;
}
var target = getEventTarget(event);
if (target != null && target.window === target) {
// target is a window object
return target;
}
var doc = target.ownerDocument;
// TODO: Figure out why `ownerDocument` is sometimes undefined in IE8.
if (doc) {
return doc.defaultView || doc.parentWindow;
} else {
return window;
}
},
detail: function(event) {
return event.detail || 0;
}
};
/**
* @param {object} dispatchConfig Configuration used to dispatch this event.
* @param {string} dispatchMarker Marker identifying the event target.
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticEvent}
*/
function SyntheticUIEvent(dispatchConfig, dispatchMarker, nativeEvent) {
SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
}
SyntheticEvent.augmentClass(SyntheticUIEvent, UIEventInterface);
module.exports = SyntheticUIEvent;
},{"./SyntheticEvent":96,"./getEventTarget":125}],103:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule SyntheticWheelEvent
* @typechecks static-only
*/
"use strict";
var SyntheticMouseEvent = _dereq_("./SyntheticMouseEvent");
/**
* @interface WheelEvent
* @see http://www.w3.org/TR/DOM-Level-3-Events/
*/
var WheelEventInterface = {
deltaX: function(event) {
return (
'deltaX' in event ? event.deltaX :
// Fallback to `wheelDeltaX` for Webkit and normalize (right is positive).
'wheelDeltaX' in event ? -event.wheelDeltaX : 0
);
},
deltaY: function(event) {
return (
'deltaY' in event ? event.deltaY :
// Fallback to `wheelDeltaY` for Webkit and normalize (down is positive).
'wheelDeltaY' in event ? -event.wheelDeltaY :
// Fallback to `wheelDelta` for IE<9 and normalize (down is positive).
'wheelDelta' in event ? -event.wheelDelta : 0
);
},
deltaZ: null,
// Browsers without "deltaMode" is reporting in raw wheel delta where one
// notch on the scroll is always +/- 120, roughly equivalent to pixels.
// A good approximation of DOM_DELTA_LINE (1) is 5% of viewport size or
// ~40 pixels, for DOM_DELTA_SCREEN (2) it is 87.5% of viewport size.
deltaMode: null
};
/**
* @param {object} dispatchConfig Configuration used to dispatch this event.
* @param {string} dispatchMarker Marker identifying the event target.
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticMouseEvent}
*/
function SyntheticWheelEvent(dispatchConfig, dispatchMarker, nativeEvent) {
SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
}
SyntheticMouseEvent.augmentClass(SyntheticWheelEvent, WheelEventInterface);
module.exports = SyntheticWheelEvent;
},{"./SyntheticMouseEvent":100}],104:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule Transaction
*/
"use strict";
var invariant = _dereq_("./invariant");
/**
* `Transaction` creates a black box that is able to wrap any method such that
* certain invariants are maintained before and after the method is invoked
* (Even if an exception is thrown while invoking the wrapped method). Whoever
* instantiates a transaction can provide enforcers of the invariants at
* creation time. The `Transaction` class itself will supply one additional
* automatic invariant for you - the invariant that any transaction instance
* should not be run while it is already being run. You would typically create a
* single instance of a `Transaction` for reuse multiple times, that potentially
* is used to wrap several different methods. Wrappers are extremely simple -
* they only require implementing two methods.
*
* <pre>
* wrappers (injected at creation time)
* + +
* | |
* +-----------------|--------|--------------+
* | v | |
* | +---------------+ | |
* | +--| wrapper1 |---|----+ |
* | | +---------------+ v | |
* | | +-------------+ | |
* | | +----| wrapper2 |--------+ |
* | | | +-------------+ | | |
* | | | | | |
* | v v v v | wrapper
* | +---+ +---+ +---------+ +---+ +---+ | invariants
* perform(anyMethod) | | | | | | | | | | | | maintained
* +----------------->|-|---|-|---|-->|anyMethod|---|---|-|---|-|-------->
* | | | | | | | | | | | |
* | | | | | | | | | | | |
* | | | | | | | | | | | |
* | +---+ +---+ +---------+ +---+ +---+ |
* | initialize close |
* +-----------------------------------------+
* </pre>
*
* Use cases:
* - Preserving the input selection ranges before/after reconciliation.
* Restoring selection even in the event of an unexpected error.
* - Deactivating events while rearranging the DOM, preventing blurs/focuses,
* while guaranteeing that afterwards, the event system is reactivated.
* - Flushing a queue of collected DOM mutations to the main UI thread after a
* reconciliation takes place in a worker thread.
* - Invoking any collected `componentDidUpdate` callbacks after rendering new
* content.
* - (Future use case): Wrapping particular flushes of the `ReactWorker` queue
* to preserve the `scrollTop` (an automatic scroll aware DOM).
* - (Future use case): Layout calculations before and after DOM upates.
*
* Transactional plugin API:
* - A module that has an `initialize` method that returns any precomputation.
* - and a `close` method that accepts the precomputation. `close` is invoked
* when the wrapped process is completed, or has failed.
*
* @param {Array<TransactionalWrapper>} transactionWrapper Wrapper modules
* that implement `initialize` and `close`.
* @return {Transaction} Single transaction for reuse in thread.
*
* @class Transaction
*/
var Mixin = {
/**
* Sets up this instance so that it is prepared for collecting metrics. Does
* so such that this setup method may be used on an instance that is already
* initialized, in a way that does not consume additional memory upon reuse.
* That can be useful if you decide to make your subclass of this mixin a
* "PooledClass".
*/
reinitializeTransaction: function() {
this.transactionWrappers = this.getTransactionWrappers();
if (!this.wrapperInitData) {
this.wrapperInitData = [];
} else {
this.wrapperInitData.length = 0;
}
this._isInTransaction = false;
},
_isInTransaction: false,
/**
* @abstract
* @return {Array<TransactionWrapper>} Array of transaction wrappers.
*/
getTransactionWrappers: null,
isInTransaction: function() {
return !!this._isInTransaction;
},
/**
* Executes the function within a safety window. Use this for the top level
* methods that result in large amounts of computation/mutations that would
* need to be safety checked.
*
* @param {function} method Member of scope to call.
* @param {Object} scope Scope to invoke from.
* @param {Object?=} args... Arguments to pass to the method (optional).
* Helps prevent need to bind in many cases.
* @return Return value from `method`.
*/
perform: function(method, scope, a, b, c, d, e, f) {
("production" !== "development" ? invariant(
!this.isInTransaction(),
'Transaction.perform(...): Cannot initialize a transaction when there ' +
'is already an outstanding transaction.'
) : invariant(!this.isInTransaction()));
var errorThrown;
var ret;
try {
this._isInTransaction = true;
// Catching errors makes debugging more difficult, so we start with
// errorThrown set to true before setting it to false after calling
// close -- if it's still set to true in the finally block, it means
// one of these calls threw.
errorThrown = true;
this.initializeAll(0);
ret = method.call(scope, a, b, c, d, e, f);
errorThrown = false;
} finally {
try {
if (errorThrown) {
// If `method` throws, prefer to show that stack trace over any thrown
// by invoking `closeAll`.
try {
this.closeAll(0);
} catch (err) {
}
} else {
// Since `method` didn't throw, we don't want to silence the exception
// here.
this.closeAll(0);
}
} finally {
this._isInTransaction = false;
}
}
return ret;
},
initializeAll: function(startIndex) {
var transactionWrappers = this.transactionWrappers;
for (var i = startIndex; i < transactionWrappers.length; i++) {
var wrapper = transactionWrappers[i];
try {
// Catching errors makes debugging more difficult, so we start with the
// OBSERVED_ERROR state before overwriting it with the real return value
// of initialize -- if it's still set to OBSERVED_ERROR in the finally
// block, it means wrapper.initialize threw.
this.wrapperInitData[i] = Transaction.OBSERVED_ERROR;
this.wrapperInitData[i] = wrapper.initialize ?
wrapper.initialize.call(this) :
null;
} finally {
if (this.wrapperInitData[i] === Transaction.OBSERVED_ERROR) {
// The initializer for wrapper i threw an error; initialize the
// remaining wrappers but silence any exceptions from them to ensure
// that the first error is the one to bubble up.
try {
this.initializeAll(i + 1);
} catch (err) {
}
}
}
}
},
/**
* Invokes each of `this.transactionWrappers.close[i]` functions, passing into
* them the respective return values of `this.transactionWrappers.init[i]`
* (`close`rs that correspond to initializers that failed will not be
* invoked).
*/
closeAll: function(startIndex) {
("production" !== "development" ? invariant(
this.isInTransaction(),
'Transaction.closeAll(): Cannot close transaction when none are open.'
) : invariant(this.isInTransaction()));
var transactionWrappers = this.transactionWrappers;
for (var i = startIndex; i < transactionWrappers.length; i++) {
var wrapper = transactionWrappers[i];
var initData = this.wrapperInitData[i];
var errorThrown;
try {
// Catching errors makes debugging more difficult, so we start with
// errorThrown set to true before setting it to false after calling
// close -- if it's still set to true in the finally block, it means
// wrapper.close threw.
errorThrown = true;
if (initData !== Transaction.OBSERVED_ERROR) {
wrapper.close && wrapper.close.call(this, initData);
}
errorThrown = false;
} finally {
if (errorThrown) {
// The closer for wrapper i threw an error; close the remaining
// wrappers but silence any exceptions from them to ensure that the
// first error is the one to bubble up.
try {
this.closeAll(i + 1);
} catch (e) {
}
}
}
}
this.wrapperInitData.length = 0;
}
};
var Transaction = {
Mixin: Mixin,
/**
* Token to look for to determine if an error occured.
*/
OBSERVED_ERROR: {}
};
module.exports = Transaction;
},{"./invariant":134}],105:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule ViewportMetrics
*/
"use strict";
var getUnboundedScrollPosition = _dereq_("./getUnboundedScrollPosition");
var ViewportMetrics = {
currentScrollLeft: 0,
currentScrollTop: 0,
refreshScrollValues: function() {
var scrollPosition = getUnboundedScrollPosition(window);
ViewportMetrics.currentScrollLeft = scrollPosition.x;
ViewportMetrics.currentScrollTop = scrollPosition.y;
}
};
module.exports = ViewportMetrics;
},{"./getUnboundedScrollPosition":130}],106:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule accumulate
*/
"use strict";
var invariant = _dereq_("./invariant");
/**
* Accumulates items that must not be null or undefined.
*
* This is used to conserve memory by avoiding array allocations.
*
* @return {*|array<*>} An accumulation of items.
*/
function accumulate(current, next) {
("production" !== "development" ? invariant(
next != null,
'accumulate(...): Accumulated items must be not be null or undefined.'
) : invariant(next != null));
if (current == null) {
return next;
} else {
// Both are not empty. Warning: Never call x.concat(y) when you are not
// certain that x is an Array (x could be a string with concat method).
var currentIsArray = Array.isArray(current);
var nextIsArray = Array.isArray(next);
if (currentIsArray) {
return current.concat(next);
} else {
if (nextIsArray) {
return [current].concat(next);
} else {
return [current, next];
}
}
}
}
module.exports = accumulate;
},{"./invariant":134}],107:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule adler32
*/
/* jslint bitwise:true */
"use strict";
var MOD = 65521;
// This is a clean-room implementation of adler32 designed for detecting
// if markup is not what we expect it to be. It does not need to be
// cryptographically strong, only reasonable good at detecting if markup
// generated on the server is different than that on the client.
function adler32(data) {
var a = 1;
var b = 0;
for (var i = 0; i < data.length; i++) {
a = (a + data.charCodeAt(i)) % MOD;
b = (b + a) % MOD;
}
return a | (b << 16);
}
module.exports = adler32;
},{}],108:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @typechecks
* @providesModule cloneWithProps
*/
"use strict";
var ReactPropTransferer = _dereq_("./ReactPropTransferer");
var keyOf = _dereq_("./keyOf");
var warning = _dereq_("./warning");
var CHILDREN_PROP = keyOf({children: null});
/**
* Sometimes you want to change the props of a child passed to you. Usually
* this is to add a CSS class.
*
* @param {object} child child component you'd like to clone
* @param {object} props props you'd like to modify. They will be merged
* as if you used `transferPropsTo()`.
* @return {object} a clone of child with props merged in.
*/
function cloneWithProps(child, props) {
if ("production" !== "development") {
("production" !== "development" ? warning(
!child.props.ref,
'You are calling cloneWithProps() on a child with a ref. This is ' +
'dangerous because you\'re creating a new child which will not be ' +
'added as a ref to its parent.'
) : null);
}
var newProps = ReactPropTransferer.mergeProps(props, child.props);
// Use `child.props.children` if it is provided.
if (!newProps.hasOwnProperty(CHILDREN_PROP) &&
child.props.hasOwnProperty(CHILDREN_PROP)) {
newProps.children = child.props.children;
}
// The current API doesn't retain _owner and _context, which is why this
// doesn't use ReactDescriptor.cloneAndReplaceProps.
return child.constructor(newProps);
}
module.exports = cloneWithProps;
},{"./ReactPropTransferer":72,"./keyOf":141,"./warning":158}],109:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule containsNode
* @typechecks
*/
var isTextNode = _dereq_("./isTextNode");
/*jslint bitwise:true */
/**
* Checks if a given DOM node contains or is another DOM node.
*
* @param {?DOMNode} outerNode Outer DOM node.
* @param {?DOMNode} innerNode Inner DOM node.
* @return {boolean} True if `outerNode` contains or is `innerNode`.
*/
function containsNode(outerNode, innerNode) {
if (!outerNode || !innerNode) {
return false;
} else if (outerNode === innerNode) {
return true;
} else if (isTextNode(outerNode)) {
return false;
} else if (isTextNode(innerNode)) {
return containsNode(outerNode, innerNode.parentNode);
} else if (outerNode.contains) {
return outerNode.contains(innerNode);
} else if (outerNode.compareDocumentPosition) {
return !!(outerNode.compareDocumentPosition(innerNode) & 16);
} else {
return false;
}
}
module.exports = containsNode;
},{"./isTextNode":138}],110:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule copyProperties
*/
/**
* Copy properties from one or more objects (up to 5) into the first object.
* This is a shallow copy. It mutates the first object and also returns it.
*
* NOTE: `arguments` has a very significant performance penalty, which is why
* we don't support unlimited arguments.
*/
function copyProperties(obj, a, b, c, d, e, f) {
obj = obj || {};
if ("production" !== "development") {
if (f) {
throw new Error('Too many arguments passed to copyProperties');
}
}
var args = [a, b, c, d, e];
var ii = 0, v;
while (args[ii]) {
v = args[ii++];
for (var k in v) {
obj[k] = v[k];
}
// IE ignores toString in object iteration.. See:
// webreflection.blogspot.com/2007/07/quick-fix-internet-explorer-and.html
if (v.hasOwnProperty && v.hasOwnProperty('toString') &&
(typeof v.toString != 'undefined') && (obj.toString !== v.toString)) {
obj.toString = v.toString;
}
}
return obj;
}
module.exports = copyProperties;
},{}],111:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule createArrayFrom
* @typechecks
*/
var toArray = _dereq_("./toArray");
/**
* Perform a heuristic test to determine if an object is "array-like".
*
* A monk asked Joshu, a Zen master, "Has a dog Buddha nature?"
* Joshu replied: "Mu."
*
* This function determines if its argument has "array nature": it returns
* true if the argument is an actual array, an `arguments' object, or an
* HTMLCollection (e.g. node.childNodes or node.getElementsByTagName()).
*
* It will return false for other array-like objects like Filelist.
*
* @param {*} obj
* @return {boolean}
*/
function hasArrayNature(obj) {
return (
// not null/false
!!obj &&
// arrays are objects, NodeLists are functions in Safari
(typeof obj == 'object' || typeof obj == 'function') &&
// quacks like an array
('length' in obj) &&
// not window
!('setInterval' in obj) &&
// no DOM node should be considered an array-like
// a 'select' element has 'length' and 'item' properties on IE8
(typeof obj.nodeType != 'number') &&
(
// a real array
(// HTMLCollection/NodeList
(Array.isArray(obj) ||
// arguments
('callee' in obj) || 'item' in obj))
)
);
}
/**
* Ensure that the argument is an array by wrapping it in an array if it is not.
* Creates a copy of the argument if it is already an array.
*
* This is mostly useful idiomatically:
*
* var createArrayFrom = require('createArrayFrom');
*
* function takesOneOrMoreThings(things) {
* things = createArrayFrom(things);
* ...
* }
*
* This allows you to treat `things' as an array, but accept scalars in the API.
*
* If you need to convert an array-like object, like `arguments`, into an array
* use toArray instead.
*
* @param {*} obj
* @return {array}
*/
function createArrayFrom(obj) {
if (!hasArrayNature(obj)) {
return [obj];
} else if (Array.isArray(obj)) {
return obj.slice();
} else {
return toArray(obj);
}
}
module.exports = createArrayFrom;
},{"./toArray":155}],112:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule createFullPageComponent
* @typechecks
*/
"use strict";
// Defeat circular references by requiring this directly.
var ReactCompositeComponent = _dereq_("./ReactCompositeComponent");
var invariant = _dereq_("./invariant");
/**
* Create a component that will throw an exception when unmounted.
*
* Components like <html> <head> and <body> can't be removed or added
* easily in a cross-browser way, however it's valuable to be able to
* take advantage of React's reconciliation for styling and <title>
* management. So we just document it and throw in dangerous cases.
*
* @param {function} componentClass convenience constructor to wrap
* @return {function} convenience constructor of new component
*/
function createFullPageComponent(componentClass) {
var FullPageComponent = ReactCompositeComponent.createClass({
displayName: 'ReactFullPageComponent' + (
componentClass.type.displayName || ''
),
componentWillUnmount: function() {
("production" !== "development" ? invariant(
false,
'%s tried to unmount. Because of cross-browser quirks it is ' +
'impossible to unmount some top-level components (eg <html>, <head>, ' +
'and <body>) reliably and efficiently. To fix this, have a single ' +
'top-level component that never unmounts render these elements.',
this.constructor.displayName
) : invariant(false));
},
render: function() {
return this.transferPropsTo(componentClass(null, this.props.children));
}
});
return FullPageComponent;
}
module.exports = createFullPageComponent;
},{"./ReactCompositeComponent":38,"./invariant":134}],113:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule createNodesFromMarkup
* @typechecks
*/
/*jslint evil: true, sub: true */
var ExecutionEnvironment = _dereq_("./ExecutionEnvironment");
var createArrayFrom = _dereq_("./createArrayFrom");
var getMarkupWrap = _dereq_("./getMarkupWrap");
var invariant = _dereq_("./invariant");
/**
* Dummy container used to render all markup.
*/
var dummyNode =
ExecutionEnvironment.canUseDOM ? document.createElement('div') : null;
/**
* Pattern used by `getNodeName`.
*/
var nodeNamePattern = /^\s*<(\w+)/;
/**
* Extracts the `nodeName` of the first element in a string of markup.
*
* @param {string} markup String of markup.
* @return {?string} Node name of the supplied markup.
*/
function getNodeName(markup) {
var nodeNameMatch = markup.match(nodeNamePattern);
return nodeNameMatch && nodeNameMatch[1].toLowerCase();
}
/**
* Creates an array containing the nodes rendered from the supplied markup. The
* optionally supplied `handleScript` function will be invoked once for each
* <script> element that is rendered. If no `handleScript` function is supplied,
* an exception is thrown if any <script> elements are rendered.
*
* @param {string} markup A string of valid HTML markup.
* @param {?function} handleScript Invoked once for each rendered <script>.
* @return {array<DOMElement|DOMTextNode>} An array of rendered nodes.
*/
function createNodesFromMarkup(markup, handleScript) {
var node = dummyNode;
("production" !== "development" ? invariant(!!dummyNode, 'createNodesFromMarkup dummy not initialized') : invariant(!!dummyNode));
var nodeName = getNodeName(markup);
var wrap = nodeName && getMarkupWrap(nodeName);
if (wrap) {
node.innerHTML = wrap[1] + markup + wrap[2];
var wrapDepth = wrap[0];
while (wrapDepth--) {
node = node.lastChild;
}
} else {
node.innerHTML = markup;
}
var scripts = node.getElementsByTagName('script');
if (scripts.length) {
("production" !== "development" ? invariant(
handleScript,
'createNodesFromMarkup(...): Unexpected <script> element rendered.'
) : invariant(handleScript));
createArrayFrom(scripts).forEach(handleScript);
}
var nodes = createArrayFrom(node.childNodes);
while (node.lastChild) {
node.removeChild(node.lastChild);
}
return nodes;
}
module.exports = createNodesFromMarkup;
},{"./ExecutionEnvironment":22,"./createArrayFrom":111,"./getMarkupWrap":126,"./invariant":134}],114:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule cx
*/
/**
* This function is used to mark string literals representing CSS class names
* so that they can be transformed statically. This allows for modularization
* and minification of CSS class names.
*
* In static_upstream, this function is actually implemented, but it should
* eventually be replaced with something more descriptive, and the transform
* that is used in the main stack should be ported for use elsewhere.
*
* @param string|object className to modularize, or an object of key/values.
* In the object case, the values are conditions that
* determine if the className keys should be included.
* @param [string ...] Variable list of classNames in the string case.
* @return string Renderable space-separated CSS className.
*/
function cx(classNames) {
if (typeof classNames == 'object') {
return Object.keys(classNames).filter(function(className) {
return classNames[className];
}).join(' ');
} else {
return Array.prototype.join.call(arguments, ' ');
}
}
module.exports = cx;
},{}],115:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule dangerousStyleValue
* @typechecks static-only
*/
"use strict";
var CSSProperty = _dereq_("./CSSProperty");
var isUnitlessNumber = CSSProperty.isUnitlessNumber;
/**
* Convert a value into the proper css writable value. The style name `name`
* should be logical (no hyphens), as specified
* in `CSSProperty.isUnitlessNumber`.
*
* @param {string} name CSS property name such as `topMargin`.
* @param {*} value CSS property value such as `10px`.
* @return {string} Normalized style value with dimensions applied.
*/
function dangerousStyleValue(name, value) {
// Note that we've removed escapeTextForBrowser() calls here since the
// whole string will be escaped when the attribute is injected into
// the markup. If you provide unsafe user data here they can inject
// arbitrary CSS which may be problematic (I couldn't repro this):
// https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet
// http://www.thespanner.co.uk/2007/11/26/ultimate-xss-css-injection/
// This is not an XSS hole but instead a potential CSS injection issue
// which has lead to a greater discussion about how we're going to
// trust URLs moving forward. See #2115901
var isEmpty = value == null || typeof value === 'boolean' || value === '';
if (isEmpty) {
return '';
}
var isNonNumeric = isNaN(value);
if (isNonNumeric || value === 0 ||
isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name]) {
return '' + value; // cast to string
}
if (typeof value === 'string') {
value = value.trim();
}
return value + 'px';
}
module.exports = dangerousStyleValue;
},{"./CSSProperty":4}],116:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule emptyFunction
*/
var copyProperties = _dereq_("./copyProperties");
function makeEmptyFunction(arg) {
return function() {
return arg;
};
}
/**
* This function accepts and discards inputs; it has no side effects. This is
* primarily useful idiomatically for overridable function endpoints which
* always need to be callable, since JS lacks a null-call idiom ala Cocoa.
*/
function emptyFunction() {}
copyProperties(emptyFunction, {
thatReturns: makeEmptyFunction,
thatReturnsFalse: makeEmptyFunction(false),
thatReturnsTrue: makeEmptyFunction(true),
thatReturnsNull: makeEmptyFunction(null),
thatReturnsThis: function() { return this; },
thatReturnsArgument: function(arg) { return arg; }
});
module.exports = emptyFunction;
},{"./copyProperties":110}],117:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule emptyObject
*/
"use strict";
var emptyObject = {};
if ("production" !== "development") {
Object.freeze(emptyObject);
}
module.exports = emptyObject;
},{}],118:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule escapeTextForBrowser
* @typechecks static-only
*/
"use strict";
var ESCAPE_LOOKUP = {
"&": "&",
">": ">",
"<": "<",
"\"": """,
"'": "'"
};
var ESCAPE_REGEX = /[&><"']/g;
function escaper(match) {
return ESCAPE_LOOKUP[match];
}
/**
* Escapes text to prevent scripting attacks.
*
* @param {*} text Text value to escape.
* @return {string} An escaped string.
*/
function escapeTextForBrowser(text) {
return ('' + text).replace(ESCAPE_REGEX, escaper);
}
module.exports = escapeTextForBrowser;
},{}],119:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule flattenChildren
*/
"use strict";
var traverseAllChildren = _dereq_("./traverseAllChildren");
var warning = _dereq_("./warning");
/**
* @param {function} traverseContext Context passed through traversal.
* @param {?ReactComponent} child React child component.
* @param {!string} name String name of key path to child.
*/
function flattenSingleChildIntoContext(traverseContext, child, name) {
// We found a component instance.
var result = traverseContext;
var keyUnique = !result.hasOwnProperty(name);
("production" !== "development" ? warning(
keyUnique,
'flattenChildren(...): Encountered two children with the same key, ' +
'`%s`. Child keys must be unique; when two children share a key, only ' +
'the first child will be used.',
name
) : null);
if (keyUnique && child != null) {
result[name] = child;
}
}
/**
* Flattens children that are typically specified as `props.children`. Any null
* children will not be included in the resulting object.
* @return {!object} flattened children keyed by name.
*/
function flattenChildren(children) {
if (children == null) {
return children;
}
var result = {};
traverseAllChildren(children, flattenSingleChildIntoContext, result);
return result;
}
module.exports = flattenChildren;
},{"./traverseAllChildren":156,"./warning":158}],120:[function(_dereq_,module,exports){
/**
* Copyright 2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule focusNode
*/
"use strict";
/**
* IE8 throws if an input/textarea is disabled and we try to focus it.
* Focus only when necessary.
*
* @param {DOMElement} node input/textarea to focus
*/
function focusNode(node) {
if (!node.disabled) {
node.focus();
}
}
module.exports = focusNode;
},{}],121:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule forEachAccumulated
*/
"use strict";
/**
* @param {array} an "accumulation" of items which is either an Array or
* a single item. Useful when paired with the `accumulate` module. This is a
* simple utility that allows us to reason about a collection of items, but
* handling the case when there is exactly one item (and we do not need to
* allocate an array).
*/
var forEachAccumulated = function(arr, cb, scope) {
if (Array.isArray(arr)) {
arr.forEach(cb, scope);
} else if (arr) {
cb.call(scope, arr);
}
};
module.exports = forEachAccumulated;
},{}],122:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule getActiveElement
* @typechecks
*/
/**
* Same as document.activeElement but wraps in a try-catch block. In IE it is
* not safe to call document.activeElement if there is nothing focused.
*
* The activeElement will be null only if the document body is not yet defined.
*/
function getActiveElement() /*?DOMElement*/ {
try {
return document.activeElement || document.body;
} catch (e) {
return document.body;
}
}
module.exports = getActiveElement;
},{}],123:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule getEventKey
* @typechecks static-only
*/
"use strict";
var invariant = _dereq_("./invariant");
/**
* Normalization of deprecated HTML5 `key` values
* @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names
*/
var normalizeKey = {
'Esc': 'Escape',
'Spacebar': ' ',
'Left': 'ArrowLeft',
'Up': 'ArrowUp',
'Right': 'ArrowRight',
'Down': 'ArrowDown',
'Del': 'Delete',
'Win': 'OS',
'Menu': 'ContextMenu',
'Apps': 'ContextMenu',
'Scroll': 'ScrollLock',
'MozPrintableKey': 'Unidentified'
};
/**
* Translation from legacy `which`/`keyCode` to HTML5 `key`
* Only special keys supported, all others depend on keyboard layout or browser
* @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names
*/
var translateToKey = {
8: 'Backspace',
9: 'Tab',
12: 'Clear',
13: 'Enter',
16: 'Shift',
17: 'Control',
18: 'Alt',
19: 'Pause',
20: 'CapsLock',
27: 'Escape',
32: ' ',
33: 'PageUp',
34: 'PageDown',
35: 'End',
36: 'Home',
37: 'ArrowLeft',
38: 'ArrowUp',
39: 'ArrowRight',
40: 'ArrowDown',
45: 'Insert',
46: 'Delete',
112: 'F1', 113: 'F2', 114: 'F3', 115: 'F4', 116: 'F5', 117: 'F6',
118: 'F7', 119: 'F8', 120: 'F9', 121: 'F10', 122: 'F11', 123: 'F12',
144: 'NumLock',
145: 'ScrollLock',
224: 'Meta'
};
/**
* @param {object} nativeEvent Native browser event.
* @return {string} Normalized `key` property.
*/
function getEventKey(nativeEvent) {
if (nativeEvent.key) {
// Normalize inconsistent values reported by browsers due to
// implementations of a working draft specification.
// FireFox implements `key` but returns `MozPrintableKey` for all
// printable characters (normalized to `Unidentified`), ignore it.
var key = normalizeKey[nativeEvent.key] || nativeEvent.key;
if (key !== 'Unidentified') {
return key;
}
}
// Browser does not implement `key`, polyfill as much of it as we can.
if (nativeEvent.type === 'keypress') {
// Create the character from the `charCode` ourselves and use as an almost
// perfect replacement.
var charCode = 'charCode' in nativeEvent ?
nativeEvent.charCode :
nativeEvent.keyCode;
// The enter-key is technically both printable and non-printable and can
// thus be captured by `keypress`, no other non-printable key should.
return charCode === 13 ? 'Enter' : String.fromCharCode(charCode);
}
if (nativeEvent.type === 'keydown' || nativeEvent.type === 'keyup') {
// While user keyboard layout determines the actual meaning of each
// `keyCode` value, almost all function keys have a universal value.
return translateToKey[nativeEvent.keyCode] || 'Unidentified';
}
("production" !== "development" ? invariant(false, "Unexpected keyboard event type: %s", nativeEvent.type) : invariant(false));
}
module.exports = getEventKey;
},{"./invariant":134}],124:[function(_dereq_,module,exports){
/**
* Copyright 2013 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule getEventModifierState
* @typechecks static-only
*/
"use strict";
/**
* Translation from modifier key to the associated property in the event.
* @see http://www.w3.org/TR/DOM-Level-3-Events/#keys-Modifiers
*/
var modifierKeyToProp = {
'alt': 'altKey',
'control': 'ctrlKey',
'meta': 'metaKey',
'shift': 'shiftKey'
};
// IE8 does not implement getModifierState so we simply map it to the only
// modifier keys exposed by the event itself, does not support Lock-keys.
// Currently, all major browsers except Chrome seems to support Lock-keys.
function modifierStateGetter(keyArg) {
/*jshint validthis:true */
var syntheticEvent = this;
var nativeEvent = syntheticEvent.nativeEvent;
if (nativeEvent.getModifierState) {
return nativeEvent.getModifierState(keyArg);
}
var keyProp = modifierKeyToProp[keyArg.toLowerCase()];
return keyProp && nativeEvent[keyProp];
}
function getEventModifierState(nativeEvent) {
return modifierStateGetter;
}
module.exports = getEventModifierState;
},{}],125:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule getEventTarget
* @typechecks static-only
*/
"use strict";
/**
* Gets the target node from a native browser event by accounting for
* inconsistencies in browser DOM APIs.
*
* @param {object} nativeEvent Native browser event.
* @return {DOMEventTarget} Target node.
*/
function getEventTarget(nativeEvent) {
var target = nativeEvent.target || nativeEvent.srcElement || window;
// Safari may fire events on text nodes (Node.TEXT_NODE is 3).
// @see http://www.quirksmode.org/js/events_properties.html
return target.nodeType === 3 ? target.parentNode : target;
}
module.exports = getEventTarget;
},{}],126:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule getMarkupWrap
*/
var ExecutionEnvironment = _dereq_("./ExecutionEnvironment");
var invariant = _dereq_("./invariant");
/**
* Dummy container used to detect which wraps are necessary.
*/
var dummyNode =
ExecutionEnvironment.canUseDOM ? document.createElement('div') : null;
/**
* Some browsers cannot use `innerHTML` to render certain elements standalone,
* so we wrap them, render the wrapped nodes, then extract the desired node.
*
* In IE8, certain elements cannot render alone, so wrap all elements ('*').
*/
var shouldWrap = {
// Force wrapping for SVG elements because if they get created inside a <div>,
// they will be initialized in the wrong namespace (and will not display).
'circle': true,
'defs': true,
'ellipse': true,
'g': true,
'line': true,
'linearGradient': true,
'path': true,
'polygon': true,
'polyline': true,
'radialGradient': true,
'rect': true,
'stop': true,
'text': true
};
var selectWrap = [1, '<select multiple="true">', '</select>'];
var tableWrap = [1, '<table>', '</table>'];
var trWrap = [3, '<table><tbody><tr>', '</tr></tbody></table>'];
var svgWrap = [1, '<svg>', '</svg>'];
var markupWrap = {
'*': [1, '?<div>', '</div>'],
'area': [1, '<map>', '</map>'],
'col': [2, '<table><tbody></tbody><colgroup>', '</colgroup></table>'],
'legend': [1, '<fieldset>', '</fieldset>'],
'param': [1, '<object>', '</object>'],
'tr': [2, '<table><tbody>', '</tbody></table>'],
'optgroup': selectWrap,
'option': selectWrap,
'caption': tableWrap,
'colgroup': tableWrap,
'tbody': tableWrap,
'tfoot': tableWrap,
'thead': tableWrap,
'td': trWrap,
'th': trWrap,
'circle': svgWrap,
'defs': svgWrap,
'ellipse': svgWrap,
'g': svgWrap,
'line': svgWrap,
'linearGradient': svgWrap,
'path': svgWrap,
'polygon': svgWrap,
'polyline': svgWrap,
'radialGradient': svgWrap,
'rect': svgWrap,
'stop': svgWrap,
'text': svgWrap
};
/**
* Gets the markup wrap configuration for the supplied `nodeName`.
*
* NOTE: This lazily detects which wraps are necessary for the current browser.
*
* @param {string} nodeName Lowercase `nodeName`.
* @return {?array} Markup wrap configuration, if applicable.
*/
function getMarkupWrap(nodeName) {
("production" !== "development" ? invariant(!!dummyNode, 'Markup wrapping node not initialized') : invariant(!!dummyNode));
if (!markupWrap.hasOwnProperty(nodeName)) {
nodeName = '*';
}
if (!shouldWrap.hasOwnProperty(nodeName)) {
if (nodeName === '*') {
dummyNode.innerHTML = '<link />';
} else {
dummyNode.innerHTML = '<' + nodeName + '></' + nodeName + '>';
}
shouldWrap[nodeName] = !dummyNode.firstChild;
}
return shouldWrap[nodeName] ? markupWrap[nodeName] : null;
}
module.exports = getMarkupWrap;
},{"./ExecutionEnvironment":22,"./invariant":134}],127:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule getNodeForCharacterOffset
*/
"use strict";
/**
* Given any node return the first leaf node without children.
*
* @param {DOMElement|DOMTextNode} node
* @return {DOMElement|DOMTextNode}
*/
function getLeafNode(node) {
while (node && node.firstChild) {
node = node.firstChild;
}
return node;
}
/**
* Get the next sibling within a container. This will walk up the
* DOM if a node's siblings have been exhausted.
*
* @param {DOMElement|DOMTextNode} node
* @return {?DOMElement|DOMTextNode}
*/
function getSiblingNode(node) {
while (node) {
if (node.nextSibling) {
return node.nextSibling;
}
node = node.parentNode;
}
}
/**
* Get object describing the nodes which contain characters at offset.
*
* @param {DOMElement|DOMTextNode} root
* @param {number} offset
* @return {?object}
*/
function getNodeForCharacterOffset(root, offset) {
var node = getLeafNode(root);
var nodeStart = 0;
var nodeEnd = 0;
while (node) {
if (node.nodeType == 3) {
nodeEnd = nodeStart + node.textContent.length;
if (nodeStart <= offset && nodeEnd >= offset) {
return {
node: node,
offset: offset - nodeStart
};
}
nodeStart = nodeEnd;
}
node = getLeafNode(getSiblingNode(node));
}
}
module.exports = getNodeForCharacterOffset;
},{}],128:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule getReactRootElementInContainer
*/
"use strict";
var DOC_NODE_TYPE = 9;
/**
* @param {DOMElement|DOMDocument} container DOM element that may contain
* a React component
* @return {?*} DOM element that may have the reactRoot ID, or null.
*/
function getReactRootElementInContainer(container) {
if (!container) {
return null;
}
if (container.nodeType === DOC_NODE_TYPE) {
return container.documentElement;
} else {
return container.firstChild;
}
}
module.exports = getReactRootElementInContainer;
},{}],129:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule getTextContentAccessor
*/
"use strict";
var ExecutionEnvironment = _dereq_("./ExecutionEnvironment");
var contentKey = null;
/**
* Gets the key used to access text content on a DOM node.
*
* @return {?string} Key used to access text content.
* @internal
*/
function getTextContentAccessor() {
if (!contentKey && ExecutionEnvironment.canUseDOM) {
// Prefer textContent to innerText because many browsers support both but
// SVG <text> elements don't support innerText even when <div> does.
contentKey = 'textContent' in document.documentElement ?
'textContent' :
'innerText';
}
return contentKey;
}
module.exports = getTextContentAccessor;
},{"./ExecutionEnvironment":22}],130:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule getUnboundedScrollPosition
* @typechecks
*/
"use strict";
/**
* Gets the scroll position of the supplied element or window.
*
* The return values are unbounded, unlike `getScrollPosition`. This means they
* may be negative or exceed the element boundaries (which is possible using
* inertial scrolling).
*
* @param {DOMWindow|DOMElement} scrollable
* @return {object} Map with `x` and `y` keys.
*/
function getUnboundedScrollPosition(scrollable) {
if (scrollable === window) {
return {
x: window.pageXOffset || document.documentElement.scrollLeft,
y: window.pageYOffset || document.documentElement.scrollTop
};
}
return {
x: scrollable.scrollLeft,
y: scrollable.scrollTop
};
}
module.exports = getUnboundedScrollPosition;
},{}],131:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule hyphenate
* @typechecks
*/
var _uppercasePattern = /([A-Z])/g;
/**
* Hyphenates a camelcased string, for example:
*
* > hyphenate('backgroundColor')
* < "background-color"
*
* For CSS style names, use `hyphenateStyleName` instead which works properly
* with all vendor prefixes, including `ms`.
*
* @param {string} string
* @return {string}
*/
function hyphenate(string) {
return string.replace(_uppercasePattern, '-$1').toLowerCase();
}
module.exports = hyphenate;
},{}],132:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule hyphenateStyleName
* @typechecks
*/
"use strict";
var hyphenate = _dereq_("./hyphenate");
var msPattern = /^ms-/;
/**
* Hyphenates a camelcased CSS property name, for example:
*
* > hyphenate('backgroundColor')
* < "background-color"
* > hyphenate('MozTransition')
* < "-moz-transition"
* > hyphenate('msTransition')
* < "-ms-transition"
*
* As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix
* is converted to `-ms-`.
*
* @param {string} string
* @return {string}
*/
function hyphenateStyleName(string) {
return hyphenate(string).replace(msPattern, '-ms-');
}
module.exports = hyphenateStyleName;
},{"./hyphenate":131}],133:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule instantiateReactComponent
* @typechecks static-only
*/
"use strict";
var invariant = _dereq_("./invariant");
/**
* Validate a `componentDescriptor`. This should be exposed publicly in a follow
* up diff.
*
* @param {object} descriptor
* @return {boolean} Returns true if this is a valid descriptor of a Component.
*/
function isValidComponentDescriptor(descriptor) {
return (
descriptor &&
typeof descriptor.type === 'function' &&
typeof descriptor.type.prototype.mountComponent === 'function' &&
typeof descriptor.type.prototype.receiveComponent === 'function'
);
}
/**
* Given a `componentDescriptor` create an instance that will actually be
* mounted. Currently it just extracts an existing clone from composite
* components but this is an implementation detail which will change.
*
* @param {object} descriptor
* @return {object} A new instance of componentDescriptor's constructor.
* @protected
*/
function instantiateReactComponent(descriptor) {
// TODO: Make warning
// if (__DEV__) {
("production" !== "development" ? invariant(
isValidComponentDescriptor(descriptor),
'Only React Components are valid for mounting.'
) : invariant(isValidComponentDescriptor(descriptor)));
// }
return new descriptor.type(descriptor);
}
module.exports = instantiateReactComponent;
},{"./invariant":134}],134:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule invariant
*/
"use strict";
/**
* Use invariant() to assert state which your program assumes to be true.
*
* Provide sprintf-style format (only %s is supported) and arguments
* to provide information about what broke and what you were
* expecting.
*
* The invariant message will be stripped in production, but the invariant
* will remain to ensure logic does not differ in production.
*/
var invariant = function(condition, format, a, b, c, d, e, f) {
if ("production" !== "development") {
if (format === undefined) {
throw new Error('invariant requires an error message argument');
}
}
if (!condition) {
var error;
if (format === undefined) {
error = new Error(
'Minified exception occurred; use the non-minified dev environment ' +
'for the full error message and additional helpful warnings.'
);
} else {
var args = [a, b, c, d, e, f];
var argIndex = 0;
error = new Error(
'Invariant Violation: ' +
format.replace(/%s/g, function() { return args[argIndex++]; })
);
}
error.framesToPop = 1; // we don't care about invariant's own frame
throw error;
}
};
module.exports = invariant;
},{}],135:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule isEventSupported
*/
"use strict";
var ExecutionEnvironment = _dereq_("./ExecutionEnvironment");
var useHasFeature;
if (ExecutionEnvironment.canUseDOM) {
useHasFeature =
document.implementation &&
document.implementation.hasFeature &&
// always returns true in newer browsers as per the standard.
// @see http://dom.spec.whatwg.org/#dom-domimplementation-hasfeature
document.implementation.hasFeature('', '') !== true;
}
/**
* Checks if an event is supported in the current execution environment.
*
* NOTE: This will not work correctly for non-generic events such as `change`,
* `reset`, `load`, `error`, and `select`.
*
* Borrows from Modernizr.
*
* @param {string} eventNameSuffix Event name, e.g. "click".
* @param {?boolean} capture Check if the capture phase is supported.
* @return {boolean} True if the event is supported.
* @internal
* @license Modernizr 3.0.0pre (Custom Build) | MIT
*/
function isEventSupported(eventNameSuffix, capture) {
if (!ExecutionEnvironment.canUseDOM ||
capture && !('addEventListener' in document)) {
return false;
}
var eventName = 'on' + eventNameSuffix;
var isSupported = eventName in document;
if (!isSupported) {
var element = document.createElement('div');
element.setAttribute(eventName, 'return;');
isSupported = typeof element[eventName] === 'function';
}
if (!isSupported && useHasFeature && eventNameSuffix === 'wheel') {
// This is the only way to test support for the `wheel` event in IE9+.
isSupported = document.implementation.hasFeature('Events.wheel', '3.0');
}
return isSupported;
}
module.exports = isEventSupported;
},{"./ExecutionEnvironment":22}],136:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule isNode
* @typechecks
*/
/**
* @param {*} object The object to check.
* @return {boolean} Whether or not the object is a DOM node.
*/
function isNode(object) {
return !!(object && (
typeof Node === 'function' ? object instanceof Node :
typeof object === 'object' &&
typeof object.nodeType === 'number' &&
typeof object.nodeName === 'string'
));
}
module.exports = isNode;
},{}],137:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule isTextInputElement
*/
"use strict";
/**
* @see http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary
*/
var supportedInputTypes = {
'color': true,
'date': true,
'datetime': true,
'datetime-local': true,
'email': true,
'month': true,
'number': true,
'password': true,
'range': true,
'search': true,
'tel': true,
'text': true,
'time': true,
'url': true,
'week': true
};
function isTextInputElement(elem) {
return elem && (
(elem.nodeName === 'INPUT' && supportedInputTypes[elem.type]) ||
elem.nodeName === 'TEXTAREA'
);
}
module.exports = isTextInputElement;
},{}],138:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule isTextNode
* @typechecks
*/
var isNode = _dereq_("./isNode");
/**
* @param {*} object The object to check.
* @return {boolean} Whether or not the object is a DOM text node.
*/
function isTextNode(object) {
return isNode(object) && object.nodeType == 3;
}
module.exports = isTextNode;
},{"./isNode":136}],139:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule joinClasses
* @typechecks static-only
*/
"use strict";
/**
* Combines multiple className strings into one.
* http://jsperf.com/joinclasses-args-vs-array
*
* @param {...?string} classes
* @return {string}
*/
function joinClasses(className/*, ... */) {
if (!className) {
className = '';
}
var nextClass;
var argLength = arguments.length;
if (argLength > 1) {
for (var ii = 1; ii < argLength; ii++) {
nextClass = arguments[ii];
nextClass && (className += ' ' + nextClass);
}
}
return className;
}
module.exports = joinClasses;
},{}],140:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule keyMirror
* @typechecks static-only
*/
"use strict";
var invariant = _dereq_("./invariant");
/**
* Constructs an enumeration with keys equal to their value.
*
* For example:
*
* var COLORS = keyMirror({blue: null, red: null});
* var myColor = COLORS.blue;
* var isColorValid = !!COLORS[myColor];
*
* The last line could not be performed if the values of the generated enum were
* not equal to their keys.
*
* Input: {key1: val1, key2: val2}
* Output: {key1: key1, key2: key2}
*
* @param {object} obj
* @return {object}
*/
var keyMirror = function(obj) {
var ret = {};
var key;
("production" !== "development" ? invariant(
obj instanceof Object && !Array.isArray(obj),
'keyMirror(...): Argument must be an object.'
) : invariant(obj instanceof Object && !Array.isArray(obj)));
for (key in obj) {
if (!obj.hasOwnProperty(key)) {
continue;
}
ret[key] = key;
}
return ret;
};
module.exports = keyMirror;
},{"./invariant":134}],141:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule keyOf
*/
/**
* Allows extraction of a minified key. Let's the build system minify keys
* without loosing the ability to dynamically use key strings as values
* themselves. Pass in an object with a single key/val pair and it will return
* you the string key of that single record. Suppose you want to grab the
* value for a key 'className' inside of an object. Key/val minification may
* have aliased that key to be 'xa12'. keyOf({className: null}) will return
* 'xa12' in that case. Resolve keys you want to use once at startup time, then
* reuse those resolutions.
*/
var keyOf = function(oneKeyObj) {
var key;
for (key in oneKeyObj) {
if (!oneKeyObj.hasOwnProperty(key)) {
continue;
}
return key;
}
return null;
};
module.exports = keyOf;
},{}],142:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule mapObject
*/
"use strict";
/**
* For each key/value pair, invokes callback func and constructs a resulting
* object which contains, for every key in obj, values that are the result of
* of invoking the function:
*
* func(value, key, iteration)
*
* Grepable names:
*
* function objectMap()
* function objMap()
*
* @param {?object} obj Object to map keys over
* @param {function} func Invoked for each key/val pair.
* @param {?*} context
* @return {?object} Result of mapping or null if obj is falsey
*/
function mapObject(obj, func, context) {
if (!obj) {
return null;
}
var i = 0;
var ret = {};
for (var key in obj) {
if (obj.hasOwnProperty(key)) {
ret[key] = func.call(context, obj[key], key, i++);
}
}
return ret;
}
module.exports = mapObject;
},{}],143:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule memoizeStringOnly
* @typechecks static-only
*/
"use strict";
/**
* Memoizes the return value of a function that accepts one string argument.
*
* @param {function} callback
* @return {function}
*/
function memoizeStringOnly(callback) {
var cache = {};
return function(string) {
if (cache.hasOwnProperty(string)) {
return cache[string];
} else {
return cache[string] = callback.call(this, string);
}
};
}
module.exports = memoizeStringOnly;
},{}],144:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule merge
*/
"use strict";
var mergeInto = _dereq_("./mergeInto");
/**
* Shallow merges two structures into a return value, without mutating either.
*
* @param {?object} one Optional object with properties to merge from.
* @param {?object} two Optional object with properties to merge from.
* @return {object} The shallow extension of one by two.
*/
var merge = function(one, two) {
var result = {};
mergeInto(result, one);
mergeInto(result, two);
return result;
};
module.exports = merge;
},{"./mergeInto":146}],145:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule mergeHelpers
*
* requiresPolyfills: Array.isArray
*/
"use strict";
var invariant = _dereq_("./invariant");
var keyMirror = _dereq_("./keyMirror");
/**
* Maximum number of levels to traverse. Will catch circular structures.
* @const
*/
var MAX_MERGE_DEPTH = 36;
/**
* We won't worry about edge cases like new String('x') or new Boolean(true).
* Functions are considered terminals, and arrays are not.
* @param {*} o The item/object/value to test.
* @return {boolean} true iff the argument is a terminal.
*/
var isTerminal = function(o) {
return typeof o !== 'object' || o === null;
};
var mergeHelpers = {
MAX_MERGE_DEPTH: MAX_MERGE_DEPTH,
isTerminal: isTerminal,
/**
* Converts null/undefined values into empty object.
*
* @param {?Object=} arg Argument to be normalized (nullable optional)
* @return {!Object}
*/
normalizeMergeArg: function(arg) {
return arg === undefined || arg === null ? {} : arg;
},
/**
* If merging Arrays, a merge strategy *must* be supplied. If not, it is
* likely the caller's fault. If this function is ever called with anything
* but `one` and `two` being `Array`s, it is the fault of the merge utilities.
*
* @param {*} one Array to merge into.
* @param {*} two Array to merge from.
*/
checkMergeArrayArgs: function(one, two) {
("production" !== "development" ? invariant(
Array.isArray(one) && Array.isArray(two),
'Tried to merge arrays, instead got %s and %s.',
one,
two
) : invariant(Array.isArray(one) && Array.isArray(two)));
},
/**
* @param {*} one Object to merge into.
* @param {*} two Object to merge from.
*/
checkMergeObjectArgs: function(one, two) {
mergeHelpers.checkMergeObjectArg(one);
mergeHelpers.checkMergeObjectArg(two);
},
/**
* @param {*} arg
*/
checkMergeObjectArg: function(arg) {
("production" !== "development" ? invariant(
!isTerminal(arg) && !Array.isArray(arg),
'Tried to merge an object, instead got %s.',
arg
) : invariant(!isTerminal(arg) && !Array.isArray(arg)));
},
/**
* @param {*} arg
*/
checkMergeIntoObjectArg: function(arg) {
("production" !== "development" ? invariant(
(!isTerminal(arg) || typeof arg === 'function') && !Array.isArray(arg),
'Tried to merge into an object, instead got %s.',
arg
) : invariant((!isTerminal(arg) || typeof arg === 'function') && !Array.isArray(arg)));
},
/**
* Checks that a merge was not given a circular object or an object that had
* too great of depth.
*
* @param {number} Level of recursion to validate against maximum.
*/
checkMergeLevel: function(level) {
("production" !== "development" ? invariant(
level < MAX_MERGE_DEPTH,
'Maximum deep merge depth exceeded. You may be attempting to merge ' +
'circular structures in an unsupported way.'
) : invariant(level < MAX_MERGE_DEPTH));
},
/**
* Checks that the supplied merge strategy is valid.
*
* @param {string} Array merge strategy.
*/
checkArrayStrategy: function(strategy) {
("production" !== "development" ? invariant(
strategy === undefined || strategy in mergeHelpers.ArrayStrategies,
'You must provide an array strategy to deep merge functions to ' +
'instruct the deep merge how to resolve merging two arrays.'
) : invariant(strategy === undefined || strategy in mergeHelpers.ArrayStrategies));
},
/**
* Set of possible behaviors of merge algorithms when encountering two Arrays
* that must be merged together.
* - `clobber`: The left `Array` is ignored.
* - `indexByIndex`: The result is achieved by recursively deep merging at
* each index. (not yet supported.)
*/
ArrayStrategies: keyMirror({
Clobber: true,
IndexByIndex: true
})
};
module.exports = mergeHelpers;
},{"./invariant":134,"./keyMirror":140}],146:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule mergeInto
* @typechecks static-only
*/
"use strict";
var mergeHelpers = _dereq_("./mergeHelpers");
var checkMergeObjectArg = mergeHelpers.checkMergeObjectArg;
var checkMergeIntoObjectArg = mergeHelpers.checkMergeIntoObjectArg;
/**
* Shallow merges two structures by mutating the first parameter.
*
* @param {object|function} one Object to be merged into.
* @param {?object} two Optional object with properties to merge from.
*/
function mergeInto(one, two) {
checkMergeIntoObjectArg(one);
if (two != null) {
checkMergeObjectArg(two);
for (var key in two) {
if (!two.hasOwnProperty(key)) {
continue;
}
one[key] = two[key];
}
}
}
module.exports = mergeInto;
},{"./mergeHelpers":145}],147:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule mixInto
*/
"use strict";
/**
* Simply copies properties to the prototype.
*/
var mixInto = function(constructor, methodBag) {
var methodName;
for (methodName in methodBag) {
if (!methodBag.hasOwnProperty(methodName)) {
continue;
}
constructor.prototype[methodName] = methodBag[methodName];
}
};
module.exports = mixInto;
},{}],148:[function(_dereq_,module,exports){
/**
* Copyright 2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule monitorCodeUse
*/
"use strict";
var invariant = _dereq_("./invariant");
/**
* Provides open-source compatible instrumentation for monitoring certain API
* uses before we're ready to issue a warning or refactor. It accepts an event
* name which may only contain the characters [a-z0-9_] and an optional data
* object with further information.
*/
function monitorCodeUse(eventName, data) {
("production" !== "development" ? invariant(
eventName && !/[^a-z0-9_]/.test(eventName),
'You must provide an eventName using only the characters [a-z0-9_]'
) : invariant(eventName && !/[^a-z0-9_]/.test(eventName)));
}
module.exports = monitorCodeUse;
},{"./invariant":134}],149:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule onlyChild
*/
"use strict";
var ReactDescriptor = _dereq_("./ReactDescriptor");
var invariant = _dereq_("./invariant");
/**
* Returns the first child in a collection of children and verifies that there
* is only one child in the collection. The current implementation of this
* function assumes that a single child gets passed without a wrapper, but the
* purpose of this helper function is to abstract away the particular structure
* of children.
*
* @param {?object} children Child collection structure.
* @return {ReactComponent} The first and only `ReactComponent` contained in the
* structure.
*/
function onlyChild(children) {
("production" !== "development" ? invariant(
ReactDescriptor.isValidDescriptor(children),
'onlyChild must be passed a children with exactly one child.'
) : invariant(ReactDescriptor.isValidDescriptor(children)));
return children;
}
module.exports = onlyChild;
},{"./ReactDescriptor":56,"./invariant":134}],150:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule performance
* @typechecks
*/
"use strict";
var ExecutionEnvironment = _dereq_("./ExecutionEnvironment");
var performance;
if (ExecutionEnvironment.canUseDOM) {
performance =
window.performance ||
window.msPerformance ||
window.webkitPerformance;
}
module.exports = performance || {};
},{"./ExecutionEnvironment":22}],151:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule performanceNow
* @typechecks
*/
var performance = _dereq_("./performance");
/**
* Detect if we can use `window.performance.now()` and gracefully fallback to
* `Date.now()` if it doesn't exist. We need to support Firefox < 15 for now
* because of Facebook's testing infrastructure.
*/
if (!performance || !performance.now) {
performance = Date;
}
var performanceNow = performance.now.bind(performance);
module.exports = performanceNow;
},{"./performance":150}],152:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule setInnerHTML
*/
"use strict";
var ExecutionEnvironment = _dereq_("./ExecutionEnvironment");
/**
* Set the innerHTML property of a node, ensuring that whitespace is preserved
* even in IE8.
*
* @param {DOMElement} node
* @param {string} html
* @internal
*/
var setInnerHTML = function(node, html) {
node.innerHTML = html;
};
if (ExecutionEnvironment.canUseDOM) {
// IE8: When updating a just created node with innerHTML only leading
// whitespace is removed. When updating an existing node with innerHTML
// whitespace in root TextNodes is also collapsed.
// @see quirksmode.org/bugreports/archives/2004/11/innerhtml_and_t.html
// Feature detection; only IE8 is known to behave improperly like this.
var testElement = document.createElement('div');
testElement.innerHTML = ' ';
if (testElement.innerHTML === '') {
setInnerHTML = function(node, html) {
// Magic theory: IE8 supposedly differentiates between added and updated
// nodes when processing innerHTML, innerHTML on updated nodes suffers
// from worse whitespace behavior. Re-adding a node like this triggers
// the initial and more favorable whitespace behavior.
// TODO: What to do on a detached node?
if (node.parentNode) {
node.parentNode.replaceChild(node, node);
}
// We also implement a workaround for non-visible tags disappearing into
// thin air on IE8, this only happens if there is no visible text
// in-front of the non-visible tags. Piggyback on the whitespace fix
// and simply check if any non-visible tags appear in the source.
if (html.match(/^[ \r\n\t\f]/) ||
html[0] === '<' && (
html.indexOf('<noscript') !== -1 ||
html.indexOf('<script') !== -1 ||
html.indexOf('<style') !== -1 ||
html.indexOf('<meta') !== -1 ||
html.indexOf('<link') !== -1)) {
// Recover leading whitespace by temporarily prepending any character.
// \uFEFF has the potential advantage of being zero-width/invisible.
node.innerHTML = '\uFEFF' + html;
node.firstChild.deleteData(0, 1);
} else {
node.innerHTML = html;
}
};
}
}
module.exports = setInnerHTML;
},{"./ExecutionEnvironment":22}],153:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule shallowEqual
*/
"use strict";
/**
* Performs equality by iterating through keys on an object and returning
* false when any key has values which are not strictly equal between
* objA and objB. Returns true when the values of all keys are strictly equal.
*
* @return {boolean}
*/
function shallowEqual(objA, objB) {
if (objA === objB) {
return true;
}
var key;
// Test for A's keys different from B.
for (key in objA) {
if (objA.hasOwnProperty(key) &&
(!objB.hasOwnProperty(key) || objA[key] !== objB[key])) {
return false;
}
}
// Test for B'a keys missing from A.
for (key in objB) {
if (objB.hasOwnProperty(key) && !objA.hasOwnProperty(key)) {
return false;
}
}
return true;
}
module.exports = shallowEqual;
},{}],154:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule shouldUpdateReactComponent
* @typechecks static-only
*/
"use strict";
/**
* Given a `prevDescriptor` and `nextDescriptor`, determines if the existing
* instance should be updated as opposed to being destroyed or replaced by a new
* instance. Both arguments are descriptors. This ensures that this logic can
* operate on stateless trees without any backing instance.
*
* @param {?object} prevDescriptor
* @param {?object} nextDescriptor
* @return {boolean} True if the existing instance should be updated.
* @protected
*/
function shouldUpdateReactComponent(prevDescriptor, nextDescriptor) {
if (prevDescriptor && nextDescriptor &&
prevDescriptor.type === nextDescriptor.type && (
(prevDescriptor.props && prevDescriptor.props.key) ===
(nextDescriptor.props && nextDescriptor.props.key)
) && prevDescriptor._owner === nextDescriptor._owner) {
return true;
}
return false;
}
module.exports = shouldUpdateReactComponent;
},{}],155:[function(_dereq_,module,exports){
/**
* Copyright 2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule toArray
* @typechecks
*/
var invariant = _dereq_("./invariant");
/**
* Convert array-like objects to arrays.
*
* This API assumes the caller knows the contents of the data type. For less
* well defined inputs use createArrayFrom.
*
* @param {object|function|filelist} obj
* @return {array}
*/
function toArray(obj) {
var length = obj.length;
// Some browse builtin objects can report typeof 'function' (e.g. NodeList in
// old versions of Safari).
("production" !== "development" ? invariant(
!Array.isArray(obj) &&
(typeof obj === 'object' || typeof obj === 'function'),
'toArray: Array-like object expected'
) : invariant(!Array.isArray(obj) &&
(typeof obj === 'object' || typeof obj === 'function')));
("production" !== "development" ? invariant(
typeof length === 'number',
'toArray: Object needs a length property'
) : invariant(typeof length === 'number'));
("production" !== "development" ? invariant(
length === 0 ||
(length - 1) in obj,
'toArray: Object should have keys for indices'
) : invariant(length === 0 ||
(length - 1) in obj));
// Old IE doesn't give collections access to hasOwnProperty. Assume inputs
// without method will throw during the slice call and skip straight to the
// fallback.
if (obj.hasOwnProperty) {
try {
return Array.prototype.slice.call(obj);
} catch (e) {
// IE < 9 does not support Array#slice on collections objects
}
}
// Fall back to copying key by key. This assumes all keys have a value,
// so will not preserve sparsely populated inputs.
var ret = Array(length);
for (var ii = 0; ii < length; ii++) {
ret[ii] = obj[ii];
}
return ret;
}
module.exports = toArray;
},{"./invariant":134}],156:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule traverseAllChildren
*/
"use strict";
var ReactInstanceHandles = _dereq_("./ReactInstanceHandles");
var ReactTextComponent = _dereq_("./ReactTextComponent");
var invariant = _dereq_("./invariant");
var SEPARATOR = ReactInstanceHandles.SEPARATOR;
var SUBSEPARATOR = ':';
/**
* TODO: Test that:
* 1. `mapChildren` transforms strings and numbers into `ReactTextComponent`.
* 2. it('should fail when supplied duplicate key', function() {
* 3. That a single child and an array with one item have the same key pattern.
* });
*/
var userProvidedKeyEscaperLookup = {
'=': '=0',
'.': '=1',
':': '=2'
};
var userProvidedKeyEscapeRegex = /[=.:]/g;
function userProvidedKeyEscaper(match) {
return userProvidedKeyEscaperLookup[match];
}
/**
* Generate a key string that identifies a component within a set.
*
* @param {*} component A component that could contain a manual key.
* @param {number} index Index that is used if a manual key is not provided.
* @return {string}
*/
function getComponentKey(component, index) {
if (component && component.props && component.props.key != null) {
// Explicit key
return wrapUserProvidedKey(component.props.key);
}
// Implicit key determined by the index in the set
return index.toString(36);
}
/**
* Escape a component key so that it is safe to use in a reactid.
*
* @param {*} key Component key to be escaped.
* @return {string} An escaped string.
*/
function escapeUserProvidedKey(text) {
return ('' + text).replace(
userProvidedKeyEscapeRegex,
userProvidedKeyEscaper
);
}
/**
* Wrap a `key` value explicitly provided by the user to distinguish it from
* implicitly-generated keys generated by a component's index in its parent.
*
* @param {string} key Value of a user-provided `key` attribute
* @return {string}
*/
function wrapUserProvidedKey(key) {
return '$' + escapeUserProvidedKey(key);
}
/**
* @param {?*} children Children tree container.
* @param {!string} nameSoFar Name of the key path so far.
* @param {!number} indexSoFar Number of children encountered until this point.
* @param {!function} callback Callback to invoke with each child found.
* @param {?*} traverseContext Used to pass information throughout the traversal
* process.
* @return {!number} The number of children in this subtree.
*/
var traverseAllChildrenImpl =
function(children, nameSoFar, indexSoFar, callback, traverseContext) {
var subtreeCount = 0; // Count of children found in the current subtree.
if (Array.isArray(children)) {
for (var i = 0; i < children.length; i++) {
var child = children[i];
var nextName = (
nameSoFar +
(nameSoFar ? SUBSEPARATOR : SEPARATOR) +
getComponentKey(child, i)
);
var nextIndex = indexSoFar + subtreeCount;
subtreeCount += traverseAllChildrenImpl(
child,
nextName,
nextIndex,
callback,
traverseContext
);
}
} else {
var type = typeof children;
var isOnlyChild = nameSoFar === '';
// If it's the only child, treat the name as if it was wrapped in an array
// so that it's consistent if the number of children grows
var storageName =
isOnlyChild ? SEPARATOR + getComponentKey(children, 0) : nameSoFar;
if (children == null || type === 'boolean') {
// All of the above are perceived as null.
callback(traverseContext, null, storageName, indexSoFar);
subtreeCount = 1;
} else if (children.type && children.type.prototype &&
children.type.prototype.mountComponentIntoNode) {
callback(traverseContext, children, storageName, indexSoFar);
subtreeCount = 1;
} else {
if (type === 'object') {
("production" !== "development" ? invariant(
!children || children.nodeType !== 1,
'traverseAllChildren(...): Encountered an invalid child; DOM ' +
'elements are not valid children of React components.'
) : invariant(!children || children.nodeType !== 1));
for (var key in children) {
if (children.hasOwnProperty(key)) {
subtreeCount += traverseAllChildrenImpl(
children[key],
(
nameSoFar + (nameSoFar ? SUBSEPARATOR : SEPARATOR) +
wrapUserProvidedKey(key) + SUBSEPARATOR +
getComponentKey(children[key], 0)
),
indexSoFar + subtreeCount,
callback,
traverseContext
);
}
}
} else if (type === 'string') {
var normalizedText = ReactTextComponent(children);
callback(traverseContext, normalizedText, storageName, indexSoFar);
subtreeCount += 1;
} else if (type === 'number') {
var normalizedNumber = ReactTextComponent('' + children);
callback(traverseContext, normalizedNumber, storageName, indexSoFar);
subtreeCount += 1;
}
}
}
return subtreeCount;
};
/**
* Traverses children that are typically specified as `props.children`, but
* might also be specified through attributes:
*
* - `traverseAllChildren(this.props.children, ...)`
* - `traverseAllChildren(this.props.leftPanelChildren, ...)`
*
* The `traverseContext` is an optional argument that is passed through the
* entire traversal. It can be used to store accumulations or anything else that
* the callback might find relevant.
*
* @param {?*} children Children tree object.
* @param {!function} callback To invoke upon traversing each child.
* @param {?*} traverseContext Context for traversal.
* @return {!number} The number of children in this subtree.
*/
function traverseAllChildren(children, callback, traverseContext) {
if (children == null) {
return 0;
}
return traverseAllChildrenImpl(children, '', 0, callback, traverseContext);
}
module.exports = traverseAllChildren;
},{"./ReactInstanceHandles":64,"./ReactTextComponent":83,"./invariant":134}],157:[function(_dereq_,module,exports){
/**
* Copyright 2013-2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule update
*/
"use strict";
var copyProperties = _dereq_("./copyProperties");
var keyOf = _dereq_("./keyOf");
var invariant = _dereq_("./invariant");
function shallowCopy(x) {
if (Array.isArray(x)) {
return x.concat();
} else if (x && typeof x === 'object') {
return copyProperties(new x.constructor(), x);
} else {
return x;
}
}
var COMMAND_PUSH = keyOf({$push: null});
var COMMAND_UNSHIFT = keyOf({$unshift: null});
var COMMAND_SPLICE = keyOf({$splice: null});
var COMMAND_SET = keyOf({$set: null});
var COMMAND_MERGE = keyOf({$merge: null});
var COMMAND_APPLY = keyOf({$apply: null});
var ALL_COMMANDS_LIST = [
COMMAND_PUSH,
COMMAND_UNSHIFT,
COMMAND_SPLICE,
COMMAND_SET,
COMMAND_MERGE,
COMMAND_APPLY
];
var ALL_COMMANDS_SET = {};
ALL_COMMANDS_LIST.forEach(function(command) {
ALL_COMMANDS_SET[command] = true;
});
function invariantArrayCase(value, spec, command) {
("production" !== "development" ? invariant(
Array.isArray(value),
'update(): expected target of %s to be an array; got %s.',
command,
value
) : invariant(Array.isArray(value)));
var specValue = spec[command];
("production" !== "development" ? invariant(
Array.isArray(specValue),
'update(): expected spec of %s to be an array; got %s. ' +
'Did you forget to wrap your parameter in an array?',
command,
specValue
) : invariant(Array.isArray(specValue)));
}
function update(value, spec) {
("production" !== "development" ? invariant(
typeof spec === 'object',
'update(): You provided a key path to update() that did not contain one ' +
'of %s. Did you forget to include {%s: ...}?',
ALL_COMMANDS_LIST.join(', '),
COMMAND_SET
) : invariant(typeof spec === 'object'));
if (spec.hasOwnProperty(COMMAND_SET)) {
("production" !== "development" ? invariant(
Object.keys(spec).length === 1,
'Cannot have more than one key in an object with %s',
COMMAND_SET
) : invariant(Object.keys(spec).length === 1));
return spec[COMMAND_SET];
}
var nextValue = shallowCopy(value);
if (spec.hasOwnProperty(COMMAND_MERGE)) {
var mergeObj = spec[COMMAND_MERGE];
("production" !== "development" ? invariant(
mergeObj && typeof mergeObj === 'object',
'update(): %s expects a spec of type \'object\'; got %s',
COMMAND_MERGE,
mergeObj
) : invariant(mergeObj && typeof mergeObj === 'object'));
("production" !== "development" ? invariant(
nextValue && typeof nextValue === 'object',
'update(): %s expects a target of type \'object\'; got %s',
COMMAND_MERGE,
nextValue
) : invariant(nextValue && typeof nextValue === 'object'));
copyProperties(nextValue, spec[COMMAND_MERGE]);
}
if (spec.hasOwnProperty(COMMAND_PUSH)) {
invariantArrayCase(value, spec, COMMAND_PUSH);
spec[COMMAND_PUSH].forEach(function(item) {
nextValue.push(item);
});
}
if (spec.hasOwnProperty(COMMAND_UNSHIFT)) {
invariantArrayCase(value, spec, COMMAND_UNSHIFT);
spec[COMMAND_UNSHIFT].forEach(function(item) {
nextValue.unshift(item);
});
}
if (spec.hasOwnProperty(COMMAND_SPLICE)) {
("production" !== "development" ? invariant(
Array.isArray(value),
'Expected %s target to be an array; got %s',
COMMAND_SPLICE,
value
) : invariant(Array.isArray(value)));
("production" !== "development" ? invariant(
Array.isArray(spec[COMMAND_SPLICE]),
'update(): expected spec of %s to be an array of arrays; got %s. ' +
'Did you forget to wrap your parameters in an array?',
COMMAND_SPLICE,
spec[COMMAND_SPLICE]
) : invariant(Array.isArray(spec[COMMAND_SPLICE])));
spec[COMMAND_SPLICE].forEach(function(args) {
("production" !== "development" ? invariant(
Array.isArray(args),
'update(): expected spec of %s to be an array of arrays; got %s. ' +
'Did you forget to wrap your parameters in an array?',
COMMAND_SPLICE,
spec[COMMAND_SPLICE]
) : invariant(Array.isArray(args)));
nextValue.splice.apply(nextValue, args);
});
}
if (spec.hasOwnProperty(COMMAND_APPLY)) {
("production" !== "development" ? invariant(
typeof spec[COMMAND_APPLY] === 'function',
'update(): expected spec of %s to be a function; got %s.',
COMMAND_APPLY,
spec[COMMAND_APPLY]
) : invariant(typeof spec[COMMAND_APPLY] === 'function'));
nextValue = spec[COMMAND_APPLY](nextValue);
}
for (var k in spec) {
if (!(ALL_COMMANDS_SET.hasOwnProperty(k) && ALL_COMMANDS_SET[k])) {
nextValue[k] = update(value[k], spec[k]);
}
}
return nextValue;
}
module.exports = update;
},{"./copyProperties":110,"./invariant":134,"./keyOf":141}],158:[function(_dereq_,module,exports){
/**
* Copyright 2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @providesModule warning
*/
"use strict";
var emptyFunction = _dereq_("./emptyFunction");
/**
* Similar to invariant but only logs a warning if the condition is not met.
* This can be used to log issues in development environments in critical
* paths. Removing the logging code for production environments will keep the
* same logic and follow the same code paths.
*/
var warning = emptyFunction;
if ("production" !== "development") {
warning = function(condition, format ) {var args=Array.prototype.slice.call(arguments,2);
if (format === undefined) {
throw new Error(
'`warning(condition, format, ...args)` requires a warning ' +
'message argument'
);
}
if (!condition) {
var argIndex = 0;
console.warn('Warning: ' + format.replace(/%s/g, function() {return args[argIndex++];}));
}
};
}
module.exports = warning;
},{"./emptyFunction":116}]},{},[88])
(88)
}); |
src/components/FuelSavingsForm.js | shiftunion/dinnerpanic-ui | import React, {PropTypes} from 'react';
import FuelSavingsResults from './FuelSavingsResults';
import FuelSavingsTextInput from './FuelSavingsTextInput';
// Destrucuring props for brevity below.
const FuelSavingsForm = ({saveFuelSavings, calculateFuelSavings, appState}) => {
const onTimeframeChange = function (e) {
calculateFuelSavings(appState, 'milesDrivenTimeframe', e.target.value);
};
const fuelSavingsKeypress = function (name, value) {
calculateFuelSavings(appState, name, value);
};
return (
<div>
<h2>Fuel Savings Analysis</h2>
<table>
<tbody>
<tr>
<td><label htmlFor="newMpg">New Vehicle MPG</label></td>
<td><FuelSavingsTextInput onChange={fuelSavingsKeypress} name="newMpg" value={appState.newMpg}/></td>
</tr>
<tr>
<td><label htmlFor="tradeMpg">Trade-in MPG</label></td>
<td><FuelSavingsTextInput onChange={fuelSavingsKeypress} name="tradeMpg" value={appState.tradeMpg}/></td>
</tr>
<tr>
<td><label htmlFor="newPpg">New Vehicle price per gallon</label></td>
<td><FuelSavingsTextInput onChange={fuelSavingsKeypress} name="newPpg" value={appState.newPpg}/></td>
</tr>
<tr>
<td><label htmlFor="tradePpg">Trade-in price per gallon</label></td>
<td><FuelSavingsTextInput onChange={fuelSavingsKeypress} name="tradePpg" value={appState.tradePpg}/></td>
</tr>
<tr>
<td><label htmlFor="milesDriven">Miles Driven</label></td>
<td>
<FuelSavingsTextInput onChange={fuelSavingsKeypress} name="milesDriven" value={appState.milesDriven}/> miles
per
<select name="milesDrivenTimeframe" onChange={onTimeframeChange} value={appState.milesDrivenTimeframe}>
<option value="week">Week</option>
<option value="month">Month</option>
<option value="year">Year</option>
</select>
</td>
</tr>
<tr>
<td><label>Date Modified</label></td>
<td>{appState.dateModified}</td>
</tr>
</tbody>
</table>
<hr/>
{appState.necessaryDataIsProvidedToCalculateSavings && <FuelSavingsResults savings={appState.savings}/>}
<input type="submit" value="Save" onClick={() => saveFuelSavings(appState)}/>
</div>
);
};
FuelSavingsForm.propTypes = {
saveFuelSavings: PropTypes.func.isRequired,
calculateFuelSavings: PropTypes.func.isRequired,
appState: PropTypes.object.isRequired
};
export default FuelSavingsForm;
|
packages/react-devtools-shared/src/devtools/views/Components/TreeFocusedContext.js | acdlite/react | /**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
import {createContext} from 'react';
const TreeFocusedContext = createContext<boolean>(false);
export default TreeFocusedContext;
|
src/Parser/Rogue/Subtlety/Modules/Talents/DarkShadow/DarkShadowEvis.js | enragednuke/WoWAnalyzer | import React from 'react';
import SPELLS from 'common/SPELLS';
import SpellIcon from 'common/SpellIcon';
import StatisticBox, { STATISTIC_ORDER } from 'Main/StatisticBox';
import SpellLink from 'common/SpellLink';
import Wrapper from 'common/Wrapper';
import DarkShadow from './DarkShadow';
class DarkShadowEvis extends DarkShadow {
suggestions(when) {
const totalEviscerateHitsInShadowDance = this.danceDamageTracker.getAbility(SPELLS.EVISCERATE.id).damageHits;
const danceEvis = totalEviscerateHitsInShadowDance / this.totalShadowDanceCast;
when(danceEvis).isLessThan(1.75)
.addSuggestion((suggest, actual, recommended) => {
return suggest(<Wrapper>Try to cast more <SpellLink id={SPELLS.EVISCERATE.id} /> during <SpellLink id={SPELLS.SHADOW_DANCE.id} /> when you are using <SpellLink id={SPELLS.DARK_SHADOW_TALENT.id} />. </Wrapper>)
.icon(SPELLS.EVISCERATE.icon)
.actual(`You cast an average of ${actual.toFixed(2)} Eviscerates during Shadow Dance. This number includes Eviscerates cast from Death from Above.`)
.recommended(`>${recommended} is recommended`)
.regular(1.5)
.major(1.25);
});
}
statistic() {
const totalEviscerateHitsInShadowDance = this.danceDamageTracker.getAbility(SPELLS.EVISCERATE.id).damageHits;
const danceEvis = totalEviscerateHitsInShadowDance / this.totalShadowDanceCast;
return (
<StatisticBox
icon={<SpellIcon id={SPELLS.EVISCERATE.id} />}
value={`${danceEvis.toFixed(2)}`}
label="Average Eviscerates in Shadow Dance"
tooltip={`Your average Eviscerate casts per Shadow Dance. You cast ${totalEviscerateHitsInShadowDance} Eviscerates in ${this.totalShadowDanceCast} Shadow Dances. This number includes Eviscerates cast from Death from Above.`}
/>
);
}
statisticOrder = STATISTIC_ORDER.OPTIONAL(1);
}
export default DarkShadowEvis;
|
ajax/libs/jquery-tools/1.2.7/jquery.tools.min.js | chrisharrington/cdnjs | /*!
* jQuery Tools v1.2.7 - The missing UI library for the Web
*
* dateinput/dateinput.js
* overlay/overlay.js
* overlay/overlay.apple.js
* rangeinput/rangeinput.js
* scrollable/scrollable.js
* scrollable/scrollable.autoscroll.js
* scrollable/scrollable.navigator.js
* tabs/tabs.js
* tabs/tabs.slideshow.js
* toolbox/toolbox.expose.js
* toolbox/toolbox.flashembed.js
* toolbox/toolbox.history.js
* toolbox/toolbox.mousewheel.js
* tooltip/tooltip.js
* tooltip/tooltip.dynamic.js
* tooltip/tooltip.slide.js
* validator/validator.js
*
* NO COPYRIGHTS OR LICENSES. DO WHAT YOU LIKE.
*
* http://flowplayer.org/tools/
*
* jquery.event.wheel.js - rev 1
* Copyright (c) 2008, Three Dub Media (http://threedubmedia.com)
* Liscensed under the MIT License (MIT-LICENSE.txt)
* http://www.opensource.org/licenses/mit-license.php
* Created: 2008-07-01 | Updated: 2008-07-14
*
* -----
*
*/
/*! jQuery v1.7.1 jquery.com | jquery.org/license */
(function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cv(a){if(!ck[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){cl||(cl=c.createElement("iframe"),cl.frameBorder=cl.width=cl.height=0),b.appendChild(cl);if(!cm||!cl.createElement)cm=(cl.contentWindow||cl.contentDocument).document,cm.write((c.compatMode==="CSS1Compat"?"<!doctype html>":"")+"<html><body>"),cm.close();d=cm.createElement(a),cm.body.appendChild(d),e=f.css(d,"display"),b.removeChild(cl)}ck[a]=e}return ck[a]}function cu(a,b){var c={};f.each(cq.concat.apply([],cq.slice(0,b)),function(){c[this]=a});return c}function ct(){cr=b}function cs(){setTimeout(ct,0);return cr=f.now()}function cj(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ci(){try{return new a.XMLHttpRequest}catch(b){}}function cc(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g<i;g++){if(g===1)for(h in a.converters)typeof h=="string"&&(e[h.toLowerCase()]=a.converters[h]);l=k,k=d[g];if(k==="*")k=l;else if(l!=="*"&&l!==k){m=l+" "+k,n=e[m]||e["* "+k];if(!n){p=b;for(o in e){j=o.split(" ");if(j[0]===l||j[0]==="*"){p=e[j[1]+" "+k];if(p){o=e[o],o===!0?n=p:p===!0&&(n=o);break}}}}!n&&!p&&f.error("No conversion from "+m.replace(" "," to ")),n!==!0&&(c=n?n(c):p(o(c)))}}return c}function cb(a,c,d){var e=a.contents,f=a.dataTypes,g=a.responseFields,h,i,j,k;for(i in g)i in d&&(c[g[i]]=d[i]);while(f[0]==="*")f.shift(),h===b&&(h=a.mimeType||c.getResponseHeader("content-type"));if(h)for(i in e)if(e[i]&&e[i].test(h)){f.unshift(i);break}if(f[0]in d)j=f[0];else{for(i in d){if(!f[0]||a.converters[i+" "+f[0]]){j=i;break}k||(k=i)}j=j||k}if(j){j!==f[0]&&f.unshift(j);return d[j]}}function ca(a,b,c,d){if(f.isArray(b))f.each(b,function(b,e){c||bE.test(a)?d(a,e):ca(a+"["+(typeof e=="object"||f.isArray(e)?b:"")+"]",e,c,d)});else if(!c&&b!=null&&typeof b=="object")for(var e in b)ca(a+"["+e+"]",b[e],c,d);else d(a,b)}function b_(a,c){var d,e,g=f.ajaxSettings.flatOptions||{};for(d in c)c[d]!==b&&((g[d]?a:e||(e={}))[d]=c[d]);e&&f.extend(!0,a,e)}function b$(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;var h=a[f],i=0,j=h?h.length:0,k=a===bT,l;for(;i<j&&(k||!l);i++)l=h[i](c,d,e),typeof l=="string"&&(!k||g[l]?l=b:(c.dataTypes.unshift(l),l=b$(a,c,d,e,l,g)));(k||!l)&&!g["*"]&&(l=b$(a,c,d,e,"*",g));return l}function bZ(a){return function(b,c){typeof b!="string"&&(c=b,b="*");if(f.isFunction(c)){var d=b.toLowerCase().split(bP),e=0,g=d.length,h,i,j;for(;e<g;e++)h=d[e],j=/^\+/.test(h),j&&(h=h.substr(1)||"*"),i=a[h]=a[h]||[],i[j?"unshift":"push"](c)}}}function bC(a,b,c){var d=b==="width"?a.offsetWidth:a.offsetHeight,e=b==="width"?bx:by,g=0,h=e.length;if(d>0){if(c!=="border")for(;g<h;g++)c||(d-=parseFloat(f.css(a,"padding"+e[g]))||0),c==="margin"?d+=parseFloat(f.css(a,c+e[g]))||0:d-=parseFloat(f.css(a,"border"+e[g]+"Width"))||0;return d+"px"}d=bz(a,b,b);if(d<0||d==null)d=a.style[b]||0;d=parseFloat(d)||0;if(c)for(;g<h;g++)d+=parseFloat(f.css(a,"padding"+e[g]))||0,c!=="padding"&&(d+=parseFloat(f.css(a,"border"+e[g]+"Width"))||0),c==="margin"&&(d+=parseFloat(f.css(a,c+e[g]))||0);return d+"px"}function bp(a,b){b.src?f.ajax({url:b.src,async:!1,dataType:"script"}):f.globalEval((b.text||b.textContent||b.innerHTML||"").replace(bf,"/*$0*/")),b.parentNode&&b.parentNode.removeChild(b)}function bo(a){var b=c.createElement("div");bh.appendChild(b),b.innerHTML=a.outerHTML;return b.firstChild}function bn(a){var b=(a.nodeName||"").toLowerCase();b==="input"?bm(a):b!=="script"&&typeof a.getElementsByTagName!="undefined"&&f.grep(a.getElementsByTagName("input"),bm)}function bm(a){if(a.type==="checkbox"||a.type==="radio")a.defaultChecked=a.checked}function bl(a){return typeof a.getElementsByTagName!="undefined"?a.getElementsByTagName("*"):typeof a.querySelectorAll!="undefined"?a.querySelectorAll("*"):[]}function bk(a,b){var c;if(b.nodeType===1){b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase();if(c==="object")b.outerHTML=a.outerHTML;else if(c!=="input"||a.type!=="checkbox"&&a.type!=="radio"){if(c==="option")b.selected=a.defaultSelected;else if(c==="input"||c==="textarea")b.defaultValue=a.defaultValue}else a.checked&&(b.defaultChecked=b.checked=a.checked),b.value!==a.value&&(b.value=a.value);b.removeAttribute(f.expando)}}function bj(a,b){if(b.nodeType===1&&!!f.hasData(a)){var c,d,e,g=f._data(a),h=f._data(b,g),i=g.events;if(i){delete h.handle,h.events={};for(c in i)for(d=0,e=i[c].length;d<e;d++)f.event.add(b,c+(i[c][d].namespace?".":"")+i[c][d].namespace,i[c][d],i[c][d].data)}h.data&&(h.data=f.extend({},h.data))}}function bi(a,b){return f.nodeName(a,"table")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function U(a){var b=V.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}function T(a,b,c){b=b||0;if(f.isFunction(b))return f.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return f.grep(a,function(a,d){return a===b===c});if(typeof b=="string"){var d=f.grep(a,function(a){return a.nodeType===1});if(O.test(b))return f.filter(b,d,!c);b=f.filter(b,d)}return f.grep(a,function(a,d){return f.inArray(a,b)>=0===c})}function S(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function K(){return!0}function J(){return!1}function n(a,b,c){var d=b+"defer",e=b+"queue",g=b+"mark",h=f._data(a,d);h&&(c==="queue"||!f._data(a,e))&&(c==="mark"||!f._data(a,g))&&setTimeout(function(){!f._data(a,e)&&!f._data(a,g)&&(f.removeData(a,d,!0),h.fire())},0)}function m(a){for(var b in a){if(b==="data"&&f.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function l(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(k,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNumeric(d)?parseFloat(d):j.test(d)?f.parseJSON(d):d}catch(g){}f.data(a,c,d)}else d=b}return d}function h(a){var b=g[a]={},c,d;a=a.split(/\s+/);for(c=0,d=a.length;c<d;c++)b[a[c]]=!0;return b}var c=a.document,d=a.navigator,e=a.location,f=function(){function J(){if(!e.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(J,1);return}e.ready()}}var e=function(a,b){return new e.fn.init(a,b,h)},f=a.jQuery,g=a.$,h,i=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=/-([a-z]|[0-9])/ig,w=/^-ms-/,x=function(a,b){return(b+"").toUpperCase()},y=d.userAgent,z,A,B,C=Object.prototype.toString,D=Object.prototype.hasOwnProperty,E=Array.prototype.push,F=Array.prototype.slice,G=String.prototype.trim,H=Array.prototype.indexOf,I={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=m.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.7.1",length:0,size:function(){return this.length},toArray:function(){return F.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?E.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),A.add(a);return this},eq:function(a){a=+a;return a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(F.apply(this,arguments),"slice",F.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:E,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j<k;j++)if((a=arguments[j])!=null)for(c in a){d=i[c],f=a[c];if(i===f)continue;l&&f&&(e.isPlainObject(f)||(g=e.isArray(f)))?(g?(g=!1,h=d&&e.isArray(d)?d:[]):h=d&&e.isPlainObject(d)?d:{},i[c]=e.extend(l,h,f)):f!==b&&(i[c]=f)}return i},e.extend({noConflict:function(b){a.$===e&&(a.$=g),b&&a.jQuery===e&&(a.jQuery=f);return e},isReady:!1,readyWait:1,holdReady:function(a){a?e.readyWait++:e.ready(!0)},ready:function(a){if(a===!0&&!--e.readyWait||a!==!0&&!e.isReady){if(!c.body)return setTimeout(e.ready,1);e.isReady=!0;if(a!==!0&&--e.readyWait>0)return;A.fireWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").off("ready")}},bindReady:function(){if(!A){A=e.Callbacks("once memory");if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",B,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",B),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&J()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):I[C.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!D.call(a,"constructor")&&!D.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||D.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw new Error(a)},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(c){var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(w,"ms-").replace(v,x)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g<h;)if(c.apply(a[g++],d)===!1)break}else if(i){for(f in a)if(c.call(a[f],f,a[f])===!1)break}else for(;g<h;)if(c.call(a[g],g,a[g++])===!1)break;return a},trim:G?function(a){return a==null?"":G.call(a)}:function(a){return a==null?"":(a+"").replace(k,"").replace(l,"")},makeArray:function(a,b){var c=b||[];if(a!=null){var d=e.type(a);a.length==null||d==="string"||d==="function"||d==="regexp"||e.isWindow(a)?E.call(c,a):e.merge(c,a)}return c},inArray:function(a,b,c){var d;if(b){if(H)return H.call(b,a,c);d=b.length,c=c?c<0?Math.max(0,d+c):c:0;for(;c<d;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,c){var d=a.length,e=0;if(typeof c.length=="number")for(var f=c.length;e<f;e++)a[d++]=c[e];else while(c[e]!==b)a[d++]=c[e++];a.length=d;return a},grep:function(a,b,c){var d=[],e;c=!!c;for(var f=0,g=a.length;f<g;f++)e=!!b(a[f],f),c!==e&&d.push(a[f]);return d},map:function(a,c,d){var f,g,h=[],i=0,j=a.length,k=a instanceof e||j!==b&&typeof j=="number"&&(j>0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i<j;i++)f=c(a[i],i,d),f!=null&&(h[h.length]=f);else for(g in a)f=c(a[g],g,d),f!=null&&(h[h.length]=f);return h.concat.apply([],h)},guid:1,proxy:function(a,c){if(typeof c=="string"){var d=a[c];c=a,a=d}if(!e.isFunction(a))return b;var f=F.call(arguments,2),g=function(){return a.apply(c,f.concat(F.call(arguments)))};g.guid=a.guid=a.guid||g.guid||e.guid++;return g},access:function(a,c,d,f,g,h){var i=a.length;if(typeof c=="object"){for(var j in c)e.access(a,j,c[j],f,g,d);return a}if(d!==b){f=!h&&f&&e.isFunction(d);for(var k=0;k<i;k++)g(a[k],c,f?d.call(a[k],k,g(a[k],c)):d,h);return a}return i?g(a[0],c):b},now:function(){return(new Date).getTime()},uaMatch:function(a){a=a.toLowerCase();var b=r.exec(a)||s.exec(a)||t.exec(a)||a.indexOf("compatible")<0&&u.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},sub:function(){function a(b,c){return new a.fn.init(b,c)}e.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.sub=this.sub,a.fn.init=function(d,f){f&&f instanceof e&&!(f instanceof a)&&(f=a(f));return e.fn.init.call(this,d,f,b)},a.fn.init.prototype=a.fn;var b=a(c);return a},browser:{}}),e.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){I["[object "+b+"]"]=b.toLowerCase()}),z=e.uaMatch(y),z.browser&&(e.browser[z.browser]=!0,e.browser.version=z.version),e.browser.webkit&&(e.browser.safari=!0),j.test(" ")&&(k=/^[\s\xA0]+/,l=/[\s\xA0]+$/),h=e(c),c.addEventListener?B=function(){c.removeEventListener("DOMContentLoaded",B,!1),e.ready()}:c.attachEvent&&(B=function(){c.readyState==="complete"&&(c.detachEvent("onreadystatechange",B),e.ready())});return e}(),g={};f.Callbacks=function(a){a=a?g[a]||h(a):{};var c=[],d=[],e,i,j,k,l,m=function(b){var d,e,g,h,i;for(d=0,e=b.length;d<e;d++)g=b[d],h=f.type(g),h==="array"?m(g):h==="function"&&(!a.unique||!o.has(g))&&c.push(g)},n=function(b,f){f=f||[],e=!a.memory||[b,f],i=!0,l=j||0,j=0,k=c.length;for(;c&&l<k;l++)if(c[l].apply(b,f)===!1&&a.stopOnFalse){e=!0;break}i=!1,c&&(a.once?e===!0?o.disable():c=[]:d&&d.length&&(e=d.shift(),o.fireWith(e[0],e[1])))},o={add:function(){if(c){var a=c.length;m(arguments),i?k=c.length:e&&e!==!0&&(j=a,n(e[0],e[1]))}return this},remove:function(){if(c){var b=arguments,d=0,e=b.length;for(;d<e;d++)for(var f=0;f<c.length;f++)if(b[d]===c[f]){i&&f<=k&&(k--,f<=l&&l--),c.splice(f--,1);if(a.unique)break}}return this},has:function(a){if(c){var b=0,d=c.length;for(;b<d;b++)if(a===c[b])return!0}return!1},empty:function(){c=[];return this},disable:function(){c=d=e=b;return this},disabled:function(){return!c},lock:function(){d=b,(!e||e===!0)&&o.disable();return this},locked:function(){return!d},fireWith:function(b,c){d&&(i?a.once||d.push([b,c]):(!a.once||!e)&&n(b,c));return this},fire:function(){o.fireWith(this,arguments);return this},fired:function(){return!!e}};return o};var i=[].slice;f.extend({Deferred:function(a){var b=f.Callbacks("once memory"),c=f.Callbacks("once memory"),d=f.Callbacks("memory"),e="pending",g={resolve:b,reject:c,notify:d},h={done:b.add,fail:c.add,progress:d.add,state:function(){return e},isResolved:b.fired,isRejected:c.fired,then:function(a,b,c){i.done(a).fail(b).progress(c);return this},always:function(){i.done.apply(i,arguments).fail.apply(i,arguments);return this},pipe:function(a,b,c){return f.Deferred(function(d){f.each({done:[a,"resolve"],fail:[b,"reject"],progress:[c,"notify"]},function(a,b){var c=b[0],e=b[1],g;f.isFunction(c)?i[a](function(){g=c.apply(this,arguments),g&&f.isFunction(g.promise)?g.promise().then(d.resolve,d.reject,d.notify):d[e+"With"](this===i?d:this,[g])}):i[a](d[e])})}).promise()},promise:function(a){if(a==null)a=h;else for(var b in h)a[b]=h[b];return a}},i=h.promise({}),j;for(j in g)i[j]=g[j].fire,i[j+"With"]=g[j].fireWith;i.done(function(){e="resolved"},c.disable,d.lock).fail(function(){e="rejected"},b.disable,d.lock),a&&a.call(i,i);return i},when:function(a){function m(a){return function(b){e[a]=arguments.length>1?i.call(arguments,0):b,j.notifyWith(k,e)}}function l(a){return function(c){b[a]=arguments.length>1?i.call(arguments,0):c,--g||j.resolveWith(j,b)}}var b=i.call(arguments,0),c=0,d=b.length,e=Array(d),g=d,h=d,j=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred(),k=j.promise();if(d>1){for(;c<d;c++)b[c]&&b[c].promise&&f.isFunction(b[c].promise)?b[c].promise().then(l(c),j.reject,m(c)):--g;g||j.resolveWith(j,b)}else j!==a&&j.resolveWith(j,d?[a]:[]);return k}}),f.support=function(){var b,d,e,g,h,i,j,k,l,m,n,o,p,q=c.createElement("div"),r=c.documentElement;q.setAttribute("className","t"),q.innerHTML=" <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>",d=q.getElementsByTagName("*"),e=q.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=q.getElementsByTagName("input")[0],b={leadingWhitespace:q.firstChild.nodeType===3,tbody:!q.getElementsByTagName("tbody").length,htmlSerialize:!!q.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:q.className!=="t",enctype:!!c.createElement("form").enctype,html5Clone:c.createElement("nav").cloneNode(!0).outerHTML!=="<:nav></:nav>",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},i.checked=!0,b.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,b.optDisabled=!h.disabled;try{delete q.test}catch(s){b.deleteExpando=!1}!q.addEventListener&&q.attachEvent&&q.fireEvent&&(q.attachEvent("onclick",function(){b.noCloneEvent=!1}),q.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),b.radioValue=i.value==="t",i.setAttribute("checked","checked"),q.appendChild(i),k=c.createDocumentFragment(),k.appendChild(q.lastChild),b.checkClone=k.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=i.checked,k.removeChild(i),k.appendChild(q),q.innerHTML="",a.getComputedStyle&&(j=c.createElement("div"),j.style.width="0",j.style.marginRight="0",q.style.width="2px",q.appendChild(j),b.reliableMarginRight=(parseInt((a.getComputedStyle(j,null)||{marginRight:0}).marginRight,10)||0)===0);if(q.attachEvent)for(o in{submit:1,change:1,focusin:1})n="on"+o,p=n in q,p||(q.setAttribute(n,"return;"),p=typeof q[n]=="function"),b[o+"Bubbles"]=p;k.removeChild(q),k=g=h=j=q=i=null,f(function(){var a,d,e,g,h,i,j,k,m,n,o,r=c.getElementsByTagName("body")[0];!r||(j=1,k="position:absolute;top:0;left:0;width:1px;height:1px;margin:0;",m="visibility:hidden;border:0;",n="style='"+k+"border:5px solid #000;padding:0;'",o="<div "+n+"><div></div></div>"+"<table "+n+" cellpadding='0' cellspacing='0'>"+"<tr><td></td></tr></table>",a=c.createElement("div"),a.style.cssText=m+"width:0;height:0;position:static;top:0;margin-top:"+j+"px",r.insertBefore(a,r.firstChild),q=c.createElement("div"),a.appendChild(q),q.innerHTML="<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>",l=q.getElementsByTagName("td"),p=l[0].offsetHeight===0,l[0].style.display="",l[1].style.display="none",b.reliableHiddenOffsets=p&&l[0].offsetHeight===0,q.innerHTML="",q.style.width=q.style.paddingLeft="1px",f.boxModel=b.boxModel=q.offsetWidth===2,typeof q.style.zoom!="undefined"&&(q.style.display="inline",q.style.zoom=1,b.inlineBlockNeedsLayout=q.offsetWidth===2,q.style.display="",q.innerHTML="<div style='width:4px;'></div>",b.shrinkWrapBlocks=q.offsetWidth!==2),q.style.cssText=k+m,q.innerHTML=o,d=q.firstChild,e=d.firstChild,h=d.nextSibling.firstChild.firstChild,i={doesNotAddBorder:e.offsetTop!==5,doesAddBorderForTableAndCells:h.offsetTop===5},e.style.position="fixed",e.style.top="20px",i.fixedPosition=e.offsetTop===20||e.offsetTop===15,e.style.position=e.style.top="",d.style.overflow="hidden",d.style.position="relative",i.subtractsBorderForOverflowNotVisible=e.offsetTop===-5,i.doesNotIncludeMarginInBodyOffset=r.offsetTop!==j,r.removeChild(a),q=a=null,f.extend(b,i))});return b}();var j=/^(?:\{.*\}|\[.*\])$/,k=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!m(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i,j=f.expando,k=typeof c=="string",l=a.nodeType,m=l?f.cache:a,n=l?a[j]:a[j]&&j,o=c==="events";if((!n||!m[n]||!o&&!e&&!m[n].data)&&k&&d===b)return;n||(l?a[j]=n=++f.uuid:n=j),m[n]||(m[n]={},l||(m[n].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?m[n]=f.extend(m[n],c):m[n].data=f.extend(m[n].data,c);g=h=m[n],e||(h.data||(h.data={}),h=h.data),d!==b&&(h[f.camelCase(c)]=d);if(o&&!h[c])return g.events;k?(i=h[c],i==null&&(i=h[f.camelCase(c)])):i=h;return i}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e,g,h=f.expando,i=a.nodeType,j=i?f.cache:a,k=i?a[h]:h;if(!j[k])return;if(b){d=c?j[k]:j[k].data;if(d){f.isArray(b)||(b in d?b=[b]:(b=f.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,g=b.length;e<g;e++)delete d[b[e]];if(!(c?m:f.isEmptyObject)(d))return}}if(!c){delete j[k].data;if(!m(j[k]))return}f.support.deleteExpando||!j.setInterval?delete j[k]:j[k]=null,i&&(f.support.deleteExpando?delete a[h]:a.removeAttribute?a.removeAttribute(h):a[h]=null)}},_data:function(a,b,c){return f.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=f.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),f.fn.extend({data:function(a,c){var d,e,g,h=null;if(typeof a=="undefined"){if(this.length){h=f.data(this[0]);if(this[0].nodeType===1&&!f._data(this[0],"parsedAttrs")){e=this[0].attributes;for(var i=0,j=e.length;i<j;i++)g=e[i].name,g.indexOf("data-")===0&&(g=f.camelCase(g.substring(5)),l(this[0],g,h[g]));f._data(this[0],"parsedAttrs",!0)}}return h}if(typeof a=="object")return this.each(function(){f.data(this,a)});d=a.split("."),d[1]=d[1]?"."+d[1]:"";if(c===b){h=this.triggerHandler("getData"+d[1]+"!",[d[0]]),h===b&&this.length&&(h=f.data(this[0],a),h=l(this[0],a,h));return h===b&&d[1]?this.data(d[0]):h}return this.each(function(){var b=f(this),e=[d[0],c];b.triggerHandler("setData"+d[1]+"!",e),f.data(this,a,c),b.triggerHandler("changeData"+d[1]+"!",e)})},removeData:function(a){return this.each(function(){f.removeData(this,a)})}}),f.extend({_mark:function(a,b){a&&(b=(b||"fx")+"mark",f._data(a,b,(f._data(a,b)||0)+1))},_unmark:function(a,b,c){a!==!0&&(c=b,b=a,a=!1);if(b){c=c||"fx";var d=c+"mark",e=a?0:(f._data(b,d)||1)-1;e?f._data(b,d,e):(f.removeData(b,d,!0),n(b,c,"mark"))}},queue:function(a,b,c){var d;if(a){b=(b||"fx")+"queue",d=f._data(a,b),c&&(!d||f.isArray(c)?d=f._data(a,b,f.makeArray(c)):d.push(c));return d||[]}},dequeue:function(a,b){b=b||"fx";var c=f.queue(a,b),d=c.shift(),e={};d==="inprogress"&&(d=c.shift()),d&&(b==="fx"&&c.unshift("inprogress"),f._data(a,b+".run",e),d.call(a,function(){f.dequeue(a,b)},e)),c.length||(f.removeData(a,b+"queue "+b+".run",!0),n(a,b,"queue"))}}),f.fn.extend({queue:function(a,c){typeof a!="string"&&(c=a,a="fx");if(c===b)return f.queue(this[0],a);return this.each(function(){var b=f.queue(this,a,c);a==="fx"&&b[0]!=="inprogress"&&f.dequeue(this,a)})},dequeue:function(a){return this.each(function(){f.dequeue(this,a)})},delay:function(a,b){a=f.fx?f.fx.speeds[a]||a:a,b=b||"fx";return this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,c){function m(){--h||d.resolveWith(e,[e])}typeof a!="string"&&(c=a,a=b),a=a||"fx";var d=f.Deferred(),e=this,g=e.length,h=1,i=a+"defer",j=a+"queue",k=a+"mark",l;while(g--)if(l=f.data(e[g],i,b,!0)||(f.data(e[g],j,b,!0)||f.data(e[g],k,b,!0))&&f.data(e[g],i,f.Callbacks("once memory"),!0))h++,l.add(m);m();return d.promise()}});var o=/[\n\t\r]/g,p=/\s+/,q=/\r/g,r=/^(?:button|input)$/i,s=/^(?:button|input|object|select|textarea)$/i,t=/^a(?:rea)?$/i,u=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,v=f.support.getSetAttribute,w,x,y;f.fn.extend({attr:function(a,b){return f.access(this,a,b,!0,f.attr)},removeAttr:function(a){return this.each(function(){f.removeAttr(this,a)})},prop:function(a,b){return f.access(this,a,b,!0,f.prop)},removeProp:function(a){a=f.propFix[a]||a;return this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,g,h,i;if(f.isFunction(a))return this.each(function(b){f(this).addClass(a.call(this,b,this.className))});if(a&&typeof a=="string"){b=a.split(p);for(c=0,d=this.length;c<d;c++){e=this[c];if(e.nodeType===1)if(!e.className&&b.length===1)e.className=a;else{g=" "+e.className+" ";for(h=0,i=b.length;h<i;h++)~g.indexOf(" "+b[h]+" ")||(g+=b[h]+" ");e.className=f.trim(g)}}}return this},removeClass:function(a){var c,d,e,g,h,i,j;if(f.isFunction(a))return this.each(function(b){f(this).removeClass(a.call(this,b,this.className))});if(a&&typeof a=="string"||a===b){c=(a||"").split(p);for(d=0,e=this.length;d<e;d++){g=this[d];if(g.nodeType===1&&g.className)if(a){h=(" "+g.className+" ").replace(o," ");for(i=0,j=c.length;i<j;i++)h=h.replace(" "+c[i]+" "," ");g.className=f.trim(h)}else g.className=""}}return this},toggleClass:function(a,b){var c=typeof a,d=typeof b=="boolean";if(f.isFunction(a))return this.each(function(c){f(this).toggleClass(a.call(this,c,this.className,b),b)});return this.each(function(){if(c==="string"){var e,g=0,h=f(this),i=b,j=a.split(p);while(e=j[g++])i=d?i:!h.hasClass(e),h[i?"addClass":"removeClass"](e)}else if(c==="undefined"||c==="boolean")this.className&&f._data(this,"__className__",this.className),this.className=this.className||a===!1?"":f._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ",c=0,d=this.length;for(;c<d;c++)if(this[c].nodeType===1&&(" "+this[c].className+" ").replace(o," ").indexOf(b)>-1)return!0;return!1},val:function(a){var c,d,e,g=this[0];{if(!!arguments.length){e=f.isFunction(a);return this.each(function(d){var g=f(this),h;if(this.nodeType===1){e?h=a.call(this,d,g.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}if(g){c=f.valHooks[g.nodeName.toLowerCase()]||f.valHooks[g.type];if(c&&"get"in c&&(d=c.get(g,"value"))!==b)return d;d=g.value;return typeof d=="string"?d.replace(q,""):d==null?"":d}}}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,g=a.selectedIndex,h=[],i=a.options,j=a.type==="select-one";if(g<0)return null;c=j?g:0,d=j?g+1:i.length;for(;c<d;c++){e=i[c];if(e.selected&&(f.support.optDisabled?!e.disabled:e.getAttribute("disabled")===null)&&(!e.parentNode.disabled||!f.nodeName(e.parentNode,"optgroup"))){b=f(e).val();if(j)return b;h.push(b)}}if(j&&!h.length&&i.length)return f(i[g]).val();return h},set:function(a,b){var c=f.makeArray(b);f(a).find("option").each(function(){this.selected=f.inArray(f(this).val(),c)>=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,d,e){var g,h,i,j=a.nodeType;if(!!a&&j!==3&&j!==8&&j!==2){if(e&&c in f.attrFn)return f(a)[c](d);if(typeof a.getAttribute=="undefined")return f.prop(a,c,d);i=j!==1||!f.isXMLDoc(a),i&&(c=c.toLowerCase(),h=f.attrHooks[c]||(u.test(c)?x:w));if(d!==b){if(d===null){f.removeAttr(a,c);return}if(h&&"set"in h&&i&&(g=h.set(a,d,c))!==b)return g;a.setAttribute(c,""+d);return d}if(h&&"get"in h&&i&&(g=h.get(a,c))!==null)return g;g=a.getAttribute(c);return g===null?b:g}},removeAttr:function(a,b){var c,d,e,g,h=0;if(b&&a.nodeType===1){d=b.toLowerCase().split(p),g=d.length;for(;h<g;h++)e=d[h],e&&(c=f.propFix[e]||e,f.attr(a,e,""),a.removeAttribute(v?e:c),u.test(e)&&c in a&&(a[c]=!1))}},attrHooks:{type:{set:function(a,b){if(r.test(a.nodeName)&&a.parentNode)f.error("type property can't be changed");else if(!f.support.radioValue&&b==="radio"&&f.nodeName(a,"input")){var c=a.value;a.setAttribute("type",b),c&&(a.value=c);return b}}},value:{get:function(a,b){if(w&&f.nodeName(a,"button"))return w.get(a,b);return b in a?a.value:null},set:function(a,b,c){if(w&&f.nodeName(a,"button"))return w.set(a,b,c);a.value=b}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(a,c,d){var e,g,h,i=a.nodeType;if(!!a&&i!==3&&i!==8&&i!==2){h=i!==1||!f.isXMLDoc(a),h&&(c=f.propFix[c]||c,g=f.propHooks[c]);return d!==b?g&&"set"in g&&(e=g.set(a,d,c))!==b?e:a[c]=d:g&&"get"in g&&(e=g.get(a,c))!==null?e:a[c]}},propHooks:{tabIndex:{get:function(a){var c=a.getAttributeNode("tabindex");return c&&c.specified?parseInt(c.value,10):s.test(a.nodeName)||t.test(a.nodeName)&&a.href?0:b}}}}),f.attrHooks.tabindex=f.propHooks.tabIndex,x={get:function(a,c){var d,e=f.prop(a,c);return e===!0||typeof e!="boolean"&&(d=a.getAttributeNode(c))&&d.nodeValue!==!1?c.toLowerCase():b},set:function(a,b,c){var d;b===!1?f.removeAttr(a,c):(d=f.propFix[c]||c,d in a&&(a[d]=!0),a.setAttribute(c,c.toLowerCase()));return c}},v||(y={name:!0,id:!0},w=f.valHooks.button={get:function(a,c){var d;d=a.getAttributeNode(c);return d&&(y[c]?d.nodeValue!=="":d.specified)?d.nodeValue:b},set:function(a,b,d){var e=a.getAttributeNode(d);e||(e=c.createAttribute(d),a.setAttributeNode(e));return e.nodeValue=b+""}},f.attrHooks.tabindex.set=w.set,f.each(["width","height"],function(a,b){f.attrHooks[b]=f.extend(f.attrHooks[b],{set:function(a,c){if(c===""){a.setAttribute(b,"auto");return c}}})}),f.attrHooks.contenteditable={get:w.get,set:function(a,b,c){b===""&&(b="false"),w.set(a,b,c)}}),f.support.hrefNormalized||f.each(["href","src","width","height"],function(a,c){f.attrHooks[c]=f.extend(f.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),f.support.style||(f.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=""+b}}),f.support.optSelected||(f.propHooks.selected=f.extend(f.propHooks.selected,{get:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex);return null}})),f.support.enctype||(f.propFix.enctype="encoding"),f.support.checkOn||f.each(["radio","checkbox"],function(){f.valHooks[this]={get:function(a){return a.getAttribute("value")===null?"on":a.value}}}),f.each(["radio","checkbox"],function(){f.valHooks[this]=f.extend(f.valHooks[this],{set:function(a,b){if(f.isArray(b))return a.checked=f.inArray(f(a).val(),b)>=0}})});var z=/^(?:textarea|input|select)$/i,A=/^([^\.]*)?(?:\.(.+))?$/,B=/\bhover(\.\S+)?\b/,C=/^key/,D=/^(?:mouse|contextmenu)|click/,E=/^(?:focusinfocus|focusoutblur)$/,F=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,G=function(a){var b=F.exec(a);b&&(b[1]=(b[1]||"").toLowerCase(),b[3]=b[3]&&new RegExp("(?:^|\\s)"+b[3]+"(?:\\s|$)"));return b},H=function(a,b){var c=a.attributes||{};return(!b[1]||a.nodeName.toLowerCase()===b[1])&&(!b[2]||(c.id||{}).value===b[2])&&(!b[3]||b[3].test((c["class"]||{}).value))},I=function(a){return f.event.special.hover?a:a.replace(B,"mouseenter$1 mouseleave$1")};
f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3||a.nodeType===8||!c||!d||!(h=f._data(a)))){d.handler&&(p=d,d=p.handler),d.guid||(d.guid=f.guid++),j=h.events,j||(h.events=j={}),i=h.handle,i||(h.handle=i=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.dispatch.apply(i.elem,arguments):b},i.elem=a),c=f.trim(I(c)).split(" ");for(k=0;k<c.length;k++){l=A.exec(c[k])||[],m=l[1],n=(l[2]||"").split(".").sort(),s=f.event.special[m]||{},m=(g?s.delegateType:s.bindType)||m,s=f.event.special[m]||{},o=f.extend({type:m,origType:l[1],data:e,handler:d,guid:d.guid,selector:g,quick:G(g),namespace:n.join(".")},p),r=j[m];if(!r){r=j[m]=[],r.delegateCount=0;if(!s.setup||s.setup.call(a,e,n,i)===!1)a.addEventListener?a.addEventListener(m,i,!1):a.attachEvent&&a.attachEvent("on"+m,i)}s.add&&(s.add.call(a,o),o.handler.guid||(o.handler.guid=d.guid)),g?r.splice(r.delegateCount++,0,o):r.push(o),f.event.global[m]=!0}a=null}},global:{},remove:function(a,b,c,d,e){var g=f.hasData(a)&&f._data(a),h,i,j,k,l,m,n,o,p,q,r,s;if(!!g&&!!(o=g.events)){b=f.trim(I(b||"")).split(" ");for(h=0;h<b.length;h++){i=A.exec(b[h])||[],j=k=i[1],l=i[2];if(!j){for(j in o)f.event.remove(a,j+b[h],c,d,!0);continue}p=f.event.special[j]||{},j=(d?p.delegateType:p.bindType)||j,r=o[j]||[],m=r.length,l=l?new RegExp("(^|\\.)"+l.split(".").sort().join("\\.(?:.*\\.)?")+"(\\.|$)"):null;for(n=0;n<r.length;n++)s=r[n],(e||k===s.origType)&&(!c||c.guid===s.guid)&&(!l||l.test(s.namespace))&&(!d||d===s.selector||d==="**"&&s.selector)&&(r.splice(n--,1),s.selector&&r.delegateCount--,p.remove&&p.remove.call(a,s));r.length===0&&m!==r.length&&((!p.teardown||p.teardown.call(a,l)===!1)&&f.removeEvent(a,j,g.handle),delete o[j])}f.isEmptyObject(o)&&(q=g.handle,q&&(q.elem=null),f.removeData(a,["events","handle"],!0))}},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(c,d,e,g){if(!e||e.nodeType!==3&&e.nodeType!==8){var h=c.type||c,i=[],j,k,l,m,n,o,p,q,r,s;if(E.test(h+f.event.triggered))return;h.indexOf("!")>=0&&(h=h.slice(0,-1),k=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if((!e||f.event.customEvent[h])&&!f.event.global[h])return;c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.isTrigger=!0,c.exclusive=k,c.namespace=i.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,o=h.indexOf(":")<0?"on"+h:"";if(!e){j=f.cache;for(l in j)j[l].events&&j[l].events[h]&&f.event.trigger(c,d,j[l].handle.elem,!0);return}c.result=b,c.target||(c.target=e),d=d!=null?f.makeArray(d):[],d.unshift(c),p=f.event.special[h]||{};if(p.trigger&&p.trigger.apply(e,d)===!1)return;r=[[e,p.bindType||h]];if(!g&&!p.noBubble&&!f.isWindow(e)){s=p.delegateType||h,m=E.test(s+h)?e:e.parentNode,n=null;for(;m;m=m.parentNode)r.push([m,s]),n=m;n&&n===e.ownerDocument&&r.push([n.defaultView||n.parentWindow||a,s])}for(l=0;l<r.length&&!c.isPropagationStopped();l++)m=r[l][0],c.type=r[l][1],q=(f._data(m,"events")||{})[c.type]&&f._data(m,"handle"),q&&q.apply(m,d),q=o&&m[o],q&&f.acceptData(m)&&q.apply(m,d)===!1&&c.preventDefault();c.type=h,!g&&!c.isDefaultPrevented()&&(!p._default||p._default.apply(e.ownerDocument,d)===!1)&&(h!=="click"||!f.nodeName(e,"a"))&&f.acceptData(e)&&o&&e[h]&&(h!=="focus"&&h!=="blur"||c.target.offsetWidth!==0)&&!f.isWindow(e)&&(n=e[o],n&&(e[o]=null),f.event.triggered=h,e[h](),f.event.triggered=b,n&&(e[o]=n));return c.result}},dispatch:function(c){c=f.event.fix(c||a.event);var d=(f._data(this,"events")||{})[c.type]||[],e=d.delegateCount,g=[].slice.call(arguments,0),h=!c.exclusive&&!c.namespace,i=[],j,k,l,m,n,o,p,q,r,s,t;g[0]=c,c.delegateTarget=this;if(e&&!c.target.disabled&&(!c.button||c.type!=="click")){m=f(this),m.context=this.ownerDocument||this;for(l=c.target;l!=this;l=l.parentNode||this){o={},q=[],m[0]=l;for(j=0;j<e;j++)r=d[j],s=r.selector,o[s]===b&&(o[s]=r.quick?H(l,r.quick):m.is(s)),o[s]&&q.push(r);q.length&&i.push({elem:l,matches:q})}}d.length>e&&i.push({elem:this,matches:d.slice(e)});for(j=0;j<i.length&&!c.isPropagationStopped();j++){p=i[j],c.currentTarget=p.elem;for(k=0;k<p.matches.length&&!c.isImmediatePropagationStopped();k++){r=p.matches[k];if(h||!c.namespace&&!r.namespace||c.namespace_re&&c.namespace_re.test(r.namespace))c.data=r.data,c.handleObj=r,n=((f.event.special[r.origType]||{}).handle||r.handler).apply(p.elem,g),n!==b&&(c.result=n,n===!1&&(c.preventDefault(),c.stopPropagation()))}}return c.result},props:"attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){a.which==null&&(a.which=b.charCode!=null?b.charCode:b.keyCode);return a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,d){var e,f,g,h=d.button,i=d.fromElement;a.pageX==null&&d.clientX!=null&&(e=a.target.ownerDocument||c,f=e.documentElement,g=e.body,a.pageX=d.clientX+(f&&f.scrollLeft||g&&g.scrollLeft||0)-(f&&f.clientLeft||g&&g.clientLeft||0),a.pageY=d.clientY+(f&&f.scrollTop||g&&g.scrollTop||0)-(f&&f.clientTop||g&&g.clientTop||0)),!a.relatedTarget&&i&&(a.relatedTarget=i===a.target?d.toElement:i),!a.which&&h!==b&&(a.which=h&1?1:h&2?3:h&4?2:0);return a}},fix:function(a){if(a[f.expando])return a;var d,e,g=a,h=f.event.fixHooks[a.type]||{},i=h.props?this.props.concat(h.props):this.props;a=f.Event(g);for(d=i.length;d;)e=i[--d],a[e]=g[e];a.target||(a.target=g.srcElement||c),a.target.nodeType===3&&(a.target=a.target.parentNode),a.metaKey===b&&(a.metaKey=a.ctrlKey);return h.filter?h.filter(a,g):a},special:{ready:{setup:f.bindReady},load:{noBubble:!0},focus:{delegateType:"focusin"},blur:{delegateType:"focusout"},beforeunload:{setup:function(a,b,c){f.isWindow(this)&&(this.onbeforeunload=c)},teardown:function(a,b){this.onbeforeunload===b&&(this.onbeforeunload=null)}}},simulate:function(a,b,c,d){var e=f.extend(new f.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?f.event.trigger(e,null,b):f.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},f.event.handle=f.event.dispatch,f.removeEvent=c.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){a.detachEvent&&a.detachEvent("on"+b,c)},f.Event=function(a,b){if(!(this instanceof f.Event))return new f.Event(a,b);a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?K:J):this.type=a,b&&f.extend(this,b),this.timeStamp=a&&a.timeStamp||f.now(),this[f.expando]=!0},f.Event.prototype={preventDefault:function(){this.isDefaultPrevented=K;var a=this.originalEvent;!a||(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){this.isPropagationStopped=K;var a=this.originalEvent;!a||(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=K,this.stopPropagation()},isDefaultPrevented:J,isPropagationStopped:J,isImmediatePropagationStopped:J},f.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){f.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c=this,d=a.relatedTarget,e=a.handleObj,g=e.selector,h;if(!d||d!==c&&!f.contains(c,d))a.type=e.origType,h=e.handler.apply(this,arguments),a.type=b;return h}}}),f.support.submitBubbles||(f.event.special.submit={setup:function(){if(f.nodeName(this,"form"))return!1;f.event.add(this,"click._submit keypress._submit",function(a){var c=a.target,d=f.nodeName(c,"input")||f.nodeName(c,"button")?c.form:b;d&&!d._submit_attached&&(f.event.add(d,"submit._submit",function(a){this.parentNode&&!a.isTrigger&&f.event.simulate("submit",this.parentNode,a,!0)}),d._submit_attached=!0)})},teardown:function(){if(f.nodeName(this,"form"))return!1;f.event.remove(this,"._submit")}}),f.support.changeBubbles||(f.event.special.change={setup:function(){if(z.test(this.nodeName)){if(this.type==="checkbox"||this.type==="radio")f.event.add(this,"propertychange._change",function(a){a.originalEvent.propertyName==="checked"&&(this._just_changed=!0)}),f.event.add(this,"click._change",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1,f.event.simulate("change",this,a,!0))});return!1}f.event.add(this,"beforeactivate._change",function(a){var b=a.target;z.test(b.nodeName)&&!b._change_attached&&(f.event.add(b,"change._change",function(a){this.parentNode&&!a.isSimulated&&!a.isTrigger&&f.event.simulate("change",this.parentNode,a,!0)}),b._change_attached=!0)})},handle:function(a){var b=a.target;if(this!==b||a.isSimulated||a.isTrigger||b.type!=="radio"&&b.type!=="checkbox")return a.handleObj.handler.apply(this,arguments)},teardown:function(){f.event.remove(this,"._change");return z.test(this.nodeName)}}),f.support.focusinBubbles||f.each({focus:"focusin",blur:"focusout"},function(a,b){var d=0,e=function(a){f.event.simulate(b,a.target,f.event.fix(a),!0)};f.event.special[b]={setup:function(){d++===0&&c.addEventListener(a,e,!0)},teardown:function(){--d===0&&c.removeEventListener(a,e,!0)}}}),f.fn.extend({on:function(a,c,d,e,g){var h,i;if(typeof a=="object"){typeof c!="string"&&(d=c,c=b);for(i in a)this.on(i,c,d,a[i],g);return this}d==null&&e==null?(e=c,d=c=b):e==null&&(typeof c=="string"?(e=d,d=b):(e=d,d=c,c=b));if(e===!1)e=J;else if(!e)return this;g===1&&(h=e,e=function(a){f().off(a);return h.apply(this,arguments)},e.guid=h.guid||(h.guid=f.guid++));return this.each(function(){f.event.add(this,a,e,d,c)})},one:function(a,b,c,d){return this.on.call(this,a,b,c,d,1)},off:function(a,c,d){if(a&&a.preventDefault&&a.handleObj){var e=a.handleObj;f(a.delegateTarget).off(e.namespace?e.type+"."+e.namespace:e.type,e.selector,e.handler);return this}if(typeof a=="object"){for(var g in a)this.off(g,c,a[g]);return this}if(c===!1||typeof c=="function")d=c,c=b;d===!1&&(d=J);return this.each(function(){f.event.remove(this,a,d,c)})},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},live:function(a,b,c){f(this.context).on(a,this.selector,b,c);return this},die:function(a,b){f(this.context).off(a,this.selector||"**",b);return this},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return arguments.length==1?this.off(a,"**"):this.off(b,a,c)},trigger:function(a,b){return this.each(function(){f.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0])return f.event.trigger(a,b,this[0],!0)},toggle:function(a){var b=arguments,c=a.guid||f.guid++,d=0,e=function(c){var e=(f._data(this,"lastToggle"+a.guid)||0)%d;f._data(this,"lastToggle"+a.guid,e+1),c.preventDefault();return b[e].apply(this,arguments)||!1};e.guid=c;while(d<b.length)b[d++].guid=c;return this.click(e)},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),f.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){f.fn[b]=function(a,c){c==null&&(c=a,a=null);return arguments.length>0?this.on(b,null,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0),C.test(b)&&(f.event.fixHooks[b]=f.event.keyHooks),D.test(b)&&(f.event.fixHooks[b]=f.event.mouseHooks)}),function(){function x(a,b,c,e,f,g){for(var h=0,i=e.length;h<i;h++){var j=e[h];if(j){var k=!1;j=j[a];while(j){if(j[d]===c){k=e[j.sizset];break}if(j.nodeType===1){g||(j[d]=c,j.sizset=h);if(typeof b!="string"){if(j===b){k=!0;break}}else if(m.filter(b,[j]).length>0){k=j;break}}j=j[a]}e[h]=k}}}function w(a,b,c,e,f,g){for(var h=0,i=e.length;h<i;h++){var j=e[h];if(j){var k=!1;j=j[a];while(j){if(j[d]===c){k=e[j.sizset];break}j.nodeType===1&&!g&&(j[d]=c,j.sizset=h);if(j.nodeName.toLowerCase()===b){k=j;break}j=j[a]}e[h]=k}}}var a=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d="sizcache"+(Math.random()+"").replace(".",""),e=0,g=Object.prototype.toString,h=!1,i=!0,j=/\\/g,k=/\r\n/g,l=/\W/;[0,0].sort(function(){i=!1;return 0});var m=function(b,d,e,f){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return e;var i,j,k,l,n,q,r,t,u=!0,v=m.isXML(d),w=[],x=b;do{a.exec(""),i=a.exec(x);if(i){x=i[3],w.push(i[1]);if(i[2]){l=i[3];break}}}while(i);if(w.length>1&&p.exec(b))if(w.length===2&&o.relative[w[0]])j=y(w[0]+w[1],d,f);else{j=o.relative[w[0]]?[d]:m(w.shift(),d);while(w.length)b=w.shift(),o.relative[b]&&(b+=w.shift()),j=y(b,j,f)}else{!f&&w.length>1&&d.nodeType===9&&!v&&o.match.ID.test(w[0])&&!o.match.ID.test(w[w.length-1])&&(n=m.find(w.shift(),d,v),d=n.expr?m.filter(n.expr,n.set)[0]:n.set[0]);if(d){n=f?{expr:w.pop(),set:s(f)}:m.find(w.pop(),w.length===1&&(w[0]==="~"||w[0]==="+")&&d.parentNode?d.parentNode:d,v),j=n.expr?m.filter(n.expr,n.set):n.set,w.length>0?k=s(j):u=!1;while(w.length)q=w.pop(),r=q,o.relative[q]?r=w.pop():q="",r==null&&(r=d),o.relative[q](k,r,v)}else k=w=[]}k||(k=j),k||m.error(q||b);if(g.call(k)==="[object Array]")if(!u)e.push.apply(e,k);else if(d&&d.nodeType===1)for(t=0;k[t]!=null;t++)k[t]&&(k[t]===!0||k[t].nodeType===1&&m.contains(d,k[t]))&&e.push(j[t]);else for(t=0;k[t]!=null;t++)k[t]&&k[t].nodeType===1&&e.push(j[t]);else s(k,e);l&&(m(l,h,e,f),m.uniqueSort(e));return e};m.uniqueSort=function(a){if(u){h=i,a.sort(u);if(h)for(var b=1;b<a.length;b++)a[b]===a[b-1]&&a.splice(b--,1)}return a},m.matches=function(a,b){return m(a,null,null,b)},m.matchesSelector=function(a,b){return m(b,null,null,[a]).length>0},m.find=function(a,b,c){var d,e,f,g,h,i;if(!a)return[];for(e=0,f=o.order.length;e<f;e++){h=o.order[e];if(g=o.leftMatch[h].exec(a)){i=g[1],g.splice(1,1);if(i.substr(i.length-1)!=="\\"){g[1]=(g[1]||"").replace(j,""),d=o.find[h](g,b,c);if(d!=null){a=a.replace(o.match[h],"");break}}}}d||(d=typeof b.getElementsByTagName!="undefined"?b.getElementsByTagName("*"):[]);return{set:d,expr:a}},m.filter=function(a,c,d,e){var f,g,h,i,j,k,l,n,p,q=a,r=[],s=c,t=c&&c[0]&&m.isXML(c[0]);while(a&&c.length){for(h in o.filter)if((f=o.leftMatch[h].exec(a))!=null&&f[2]){k=o.filter[h],l=f[1],g=!1,f.splice(1,1);if(l.substr(l.length-1)==="\\")continue;s===r&&(r=[]);if(o.preFilter[h]){f=o.preFilter[h](f,s,d,r,e,t);if(!f)g=i=!0;else if(f===!0)continue}if(f)for(n=0;(j=s[n])!=null;n++)j&&(i=k(j,f,n,s),p=e^i,d&&i!=null?p?g=!0:s[n]=!1:p&&(r.push(j),g=!0));if(i!==b){d||(s=r),a=a.replace(o.match[h],"");if(!g)return[];break}}if(a===q)if(g==null)m.error(a);else break;q=a}return s},m.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)};var n=m.getText=function(a){var b,c,d=a.nodeType,e="";if(d){if(d===1||d===9){if(typeof a.textContent=="string")return a.textContent;if(typeof a.innerText=="string")return a.innerText.replace(k,"");for(a=a.firstChild;a;a=a.nextSibling)e+=n(a)}else if(d===3||d===4)return a.nodeValue}else for(b=0;c=a[b];b++)c.nodeType!==8&&(e+=n(c));return e},o=m.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(a){return a.getAttribute("href")},type:function(a){return a.getAttribute("type")}},relative:{"+":function(a,b){var c=typeof b=="string",d=c&&!l.test(b),e=c&&!d;d&&(b=b.toLowerCase());for(var f=0,g=a.length,h;f<g;f++)if(h=a[f]){while((h=h.previousSibling)&&h.nodeType!==1);a[f]=e||h&&h.nodeName.toLowerCase()===b?h||!1:h===b}e&&m.filter(b,a,!0)},">":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!l.test(b)){b=b.toLowerCase();for(;e<f;e++){c=a[e];if(c){var g=c.parentNode;a[e]=g.nodeName.toLowerCase()===b?g:!1}}}else{for(;e<f;e++)c=a[e],c&&(a[e]=d?c.parentNode:c.parentNode===b);d&&m.filter(b,a,!0)}},"":function(a,b,c){var d,f=e++,g=x;typeof b=="string"&&!l.test(b)&&(b=b.toLowerCase(),d=b,g=w),g("parentNode",b,f,a,d,c)},"~":function(a,b,c){var d,f=e++,g=x;typeof b=="string"&&!l.test(b)&&(b=b.toLowerCase(),d=b,g=w),g("previousSibling",b,f,a,d,c)}},find:{ID:function(a,b,c){if(typeof b.getElementById!="undefined"&&!c){var d=b.getElementById(a[1]);return d&&d.parentNode?[d]:[]}},NAME:function(a,b){if(typeof b.getElementsByName!="undefined"){var c=[],d=b.getElementsByName(a[1]);for(var e=0,f=d.length;e<f;e++)d[e].getAttribute("name")===a[1]&&c.push(d[e]);return c.length===0?null:c}},TAG:function(a,b){if(typeof b.getElementsByTagName!="undefined")return b.getElementsByTagName(a[1])}},preFilter:{CLASS:function(a,b,c,d,e,f){a=" "+a[1].replace(j,"")+" ";if(f)return a;for(var g=0,h;(h=b[g])!=null;g++)h&&(e^(h.className&&(" "+h.className+" ").replace(/[\t\n\r]/g," ").indexOf(a)>=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(j,"")},TAG:function(a,b){return a[1].replace(j,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||m.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&m.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(j,"");!f&&o.attrMap[g]&&(a[1]=o.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(j,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=m(b[3],null,null,c);else{var g=m.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(o.match.POS.test(b[0])||o.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!m(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return b<c[3]-0},gt:function(a,b,c){return b>c[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=o.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||n([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h<i;h++)if(g[h]===a)return!1;return!0}m.error(e)},CHILD:function(a,b){var c,e,f,g,h,i,j,k=b[1],l=a;switch(k){case"only":case"first":while(l=l.previousSibling)if(l.nodeType===1)return!1;if(k==="first")return!0;l=a;case"last":while(l=l.nextSibling)if(l.nodeType===1)return!1;return!0;case"nth":c=b[2],e=b[3];if(c===1&&e===0)return!0;f=b[0],g=a.parentNode;if(g&&(g[d]!==f||!a.nodeIndex)){i=0;for(l=g.firstChild;l;l=l.nextSibling)l.nodeType===1&&(l.nodeIndex=++i);g[d]=f}j=a.nodeIndex-e;return c===0?j===0:j%c===0&&j/c>=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||!!a.nodeName&&a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=m.attr?m.attr(a,c):o.attrHandle[c]?o.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":!f&&m.attr?d!=null:f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=o.setFilters[e];if(f)return f(a,c,b,d)}}},p=o.match.POS,q=function(a,b){return"\\"+(b-0+1)};for(var r in o.match)o.match[r]=new RegExp(o.match[r].source+/(?![^\[]*\])(?![^\(]*\))/.source),o.leftMatch[r]=new RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[r].source.replace(/\\(\d+)/g,q));var s=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(t){s=function(a,b){var c=0,d=b||[];if(g.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var e=a.length;c<e;c++)d.push(a[c]);else for(;a[c];c++)d.push(a[c]);return d}}var u,v;c.documentElement.compareDocumentPosition?u=function(a,b){if(a===b){h=!0;return 0}if(!a.compareDocumentPosition||!b.compareDocumentPosition)return a.compareDocumentPosition?-1:1;return a.compareDocumentPosition(b)&4?-1:1}:(u=function(a,b){if(a===b){h=!0;return 0}if(a.sourceIndex&&b.sourceIndex)return a.sourceIndex-b.sourceIndex;var c,d,e=[],f=[],g=a.parentNode,i=b.parentNode,j=g;if(g===i)return v(a,b);if(!g)return-1;if(!i)return 1;while(j)e.unshift(j),j=j.parentNode;j=i;while(j)f.unshift(j),j=j.parentNode;c=e.length,d=f.length;for(var k=0;k<c&&k<d;k++)if(e[k]!==f[k])return v(e[k],f[k]);return k===c?v(a,f[k],-1):v(e[k],b,1)},v=function(a,b,c){if(a===b)return c;var d=a.nextSibling;while(d){if(d===b)return-1;d=d.nextSibling}return 1}),function(){var a=c.createElement("div"),d="script"+(new Date).getTime(),e=c.documentElement;a.innerHTML="<a name='"+d+"'/>",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(o.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},o.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(o.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="<a href='#'></a>",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(o.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=m,b=c.createElement("div"),d="__sizzle__";b.innerHTML="<p class='TEST'></p>";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){m=function(b,e,f,g){e=e||c;if(!g&&!m.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return s(e.getElementsByTagName(b),f);if(h[2]&&o.find.CLASS&&e.getElementsByClassName)return s(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return s([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return s([],f);if(i.id===h[3])return s([i],f)}try{return s(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var k=e,l=e.getAttribute("id"),n=l||d,p=e.parentNode,q=/^\s*[+~]/.test(b);l?n=n.replace(/'/g,"\\$&"):e.setAttribute("id",n),q&&p&&(e=e.parentNode);try{if(!q||p)return s(e.querySelectorAll("[id='"+n+"'] "+b),f)}catch(r){}finally{l||k.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)m[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}m.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!m.isXML(a))try{if(e||!o.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return m(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="<div class='test e'></div><div class='test'></div>";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;o.order.splice(1,0,"CLASS"),o.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?m.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?m.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:m.contains=function(){return!1},m.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var y=function(a,b,c){var d,e=[],f="",g=b.nodeType?[b]:b;while(d=o.match.PSEUDO.exec(a))f+=d[0],a=a.replace(o.match.PSEUDO,"");a=o.relative[a]?a+"*":a;for(var h=0,i=g.length;h<i;h++)m(a,g[h],e,c);return m.filter(f,e)};m.attr=f.attr,m.selectors.attrMap={},f.find=m,f.expr=m.selectors,f.expr[":"]=f.expr.filters,f.unique=m.uniqueSort,f.text=m.getText,f.isXMLDoc=m.isXML,f.contains=m.contains}();var L=/Until$/,M=/^(?:parents|prevUntil|prevAll)/,N=/,/,O=/^.[^:#\[\.,]*$/,P=Array.prototype.slice,Q=f.expr.match.POS,R={children:!0,contents:!0,next:!0,prev:!0};f.fn.extend({find:function(a){var b=this,c,d;if(typeof a!="string")return f(a).filter(function(){for(c=0,d=b.length;c<d;c++)if(f.contains(b[c],this))return!0});var e=this.pushStack("","find",a),g,h,i;for(c=0,d=this.length;c<d;c++){g=e.length,f.find(a,this[c],e);if(c>0)for(h=g;h<e.length;h++)for(i=0;i<g;i++)if(e[i]===e[h]){e.splice(h--,1);break}}return e},has:function(a){var b=f(a);return this.filter(function(){for(var a=0,c=b.length;a<c;a++)if(f.contains(this,b[a]))return!0})},not:function(a){return this.pushStack(T(this,a,!1),"not",a)},filter:function(a){return this.pushStack(T(this,a,!0),"filter",a)},is:function(a){return!!a&&(typeof a=="string"?Q.test(a)?f(a,this.context).index(this[0])>=0:f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h=1;while(g&&g.ownerDocument&&g!==b){for(d=0;d<a.length;d++)f(g).is(a[d])&&c.push({selector:a[d],elem:g,level:h});g=g.parentNode,h++}return c}var i=Q.test(a)||typeof a!="string"?f(a,b||this.context):0;for(d=0,e=this.length;d<e;d++){g=this[d];while(g){if(i?i.index(g)>-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=="string")return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(S(c[0])||S(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling(a.parentNode.firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c);L.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!R[a]?f.unique(e):e,(this.length>1||N.test(d))&&M.test(a)&&(e=e.reverse());return this.pushStack(e,a,P.call(arguments).join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var V="abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",W=/ jQuery\d+="(?:\d+|null)"/g,X=/^\s+/,Y=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Z=/<([\w:]+)/,$=/<tbody/i,_=/<|&#?\w+;/,ba=/<(?:script|style)/i,bb=/<(?:script|object|embed|option|style)/i,bc=new RegExp("<(?:"+V+")","i"),bd=/checked\s*(?:[^=]|=\s*.checked.)/i,be=/\/(java|ecma)script/i,bf=/^\s*<!(?:\[CDATA\[|\-\-)/,bg={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]},bh=U(c);bg.optgroup=bg.option,bg.tbody=bg.tfoot=bg.colgroup=bg.caption=bg.thead,bg.th=bg.td,f.support.htmlSerialize||(bg._default=[1,"div<div>","</div>"]),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()))});if(typeof a!="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=f.isFunction(a);return this.each(function(c){f(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f.clean(arguments);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f.clean(arguments));return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function()
{for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(W,""):null;if(typeof a=="string"&&!ba.test(a)&&(f.support.leadingWhitespace||!X.test(a))&&!bg[(Z.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Y,"<$1></$2>");try{for(var c=0,d=this.length;c<d;c++)this[c].nodeType===1&&(f.cleanData(this[c].getElementsByTagName("*")),this[c].innerHTML=a)}catch(e){this.empty().append(a)}}else f.isFunction(a)?this.each(function(b){var c=f(this);c.html(a.call(this,b,c.html()))}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(f.isFunction(a))return this.each(function(b){var c=f(this),d=c.html();c.replaceWith(a.call(this,b,d))});typeof a!="string"&&(a=f(a).detach());return this.each(function(){var b=this.nextSibling,c=this.parentNode;f(this).remove(),b?f(b).before(a):f(c).append(a)})}return this.length?this.pushStack(f(f.isFunction(a)?a():a),"replaceWith",a):this},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,d){var e,g,h,i,j=a[0],k=[];if(!f.support.checkClone&&arguments.length===3&&typeof j=="string"&&bd.test(j))return this.each(function(){f(this).domManip(a,c,d,!0)});if(f.isFunction(j))return this.each(function(e){var g=f(this);a[0]=j.call(this,e,c?g.html():b),g.domManip(a,c,d)});if(this[0]){i=j&&j.parentNode,f.support.parentNode&&i&&i.nodeType===11&&i.childNodes.length===this.length?e={fragment:i}:e=f.buildFragment(a,this,k),h=e.fragment,h.childNodes.length===1?g=h=h.firstChild:g=h.firstChild;if(g){c=c&&f.nodeName(g,"tr");for(var l=0,m=this.length,n=m-1;l<m;l++)d.call(c?bi(this[l],g):this[l],e.cacheable||m>1&&l<n?f.clone(h,!0,!0):h)}k.length&&f.each(k,bp)}return this}}),f.buildFragment=function(a,b,d){var e,g,h,i,j=a[0];b&&b[0]&&(i=b[0].ownerDocument||b[0]),i.createDocumentFragment||(i=c),a.length===1&&typeof j=="string"&&j.length<512&&i===c&&j.charAt(0)==="<"&&!bb.test(j)&&(f.support.checkClone||!bd.test(j))&&(f.support.html5Clone||!bc.test(j))&&(g=!0,h=f.fragments[j],h&&h!==1&&(e=h)),e||(e=i.createDocumentFragment(),f.clean(a,i,e,d)),g&&(f.fragments[j]=h?e:1);return{fragment:e,cacheable:g}},f.fragments={},f.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){f.fn[a]=function(c){var d=[],e=f(c),g=this.length===1&&this[0].parentNode;if(g&&g.nodeType===11&&g.childNodes.length===1&&e.length===1){e[b](this[0]);return this}for(var h=0,i=e.length;h<i;h++){var j=(h>0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d,e,g,h=f.support.html5Clone||!bc.test("<"+a.nodeName)?a.cloneNode(!0):bo(a);if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bk(a,h),d=bl(a),e=bl(h);for(g=0;d[g];++g)e[g]&&bk(d[g],e[g])}if(b){bj(a,h);if(c){d=bl(a),e=bl(h);for(g=0;d[g];++g)bj(d[g],e[g])}}d=e=null;return h},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var h=[],i;for(var j=0,k;(k=a[j])!=null;j++){typeof k=="number"&&(k+="");if(!k)continue;if(typeof k=="string")if(!_.test(k))k=b.createTextNode(k);else{k=k.replace(Y,"<$1></$2>");var l=(Z.exec(k)||["",""])[1].toLowerCase(),m=bg[l]||bg._default,n=m[0],o=b.createElement("div");b===c?bh.appendChild(o):U(b).appendChild(o),o.innerHTML=m[1]+k+m[2];while(n--)o=o.lastChild;if(!f.support.tbody){var p=$.test(k),q=l==="table"&&!p?o.firstChild&&o.firstChild.childNodes:m[1]==="<table>"&&!p?o.childNodes:[];for(i=q.length-1;i>=0;--i)f.nodeName(q[i],"tbody")&&!q[i].childNodes.length&&q[i].parentNode.removeChild(q[i])}!f.support.leadingWhitespace&&X.test(k)&&o.insertBefore(b.createTextNode(X.exec(k)[0]),o.firstChild),k=o.childNodes}var r;if(!f.support.appendChecked)if(k[0]&&typeof (r=k.length)=="number")for(i=0;i<r;i++)bn(k[i]);else bn(k);k.nodeType?h.push(k):h=f.merge(h,k)}if(d){g=function(a){return!a.type||be.test(a.type)};for(j=0;h[j];j++)if(e&&f.nodeName(h[j],"script")&&(!h[j].type||h[j].type.toLowerCase()==="text/javascript"))e.push(h[j].parentNode?h[j].parentNode.removeChild(h[j]):h[j]);else{if(h[j].nodeType===1){var s=f.grep(h[j].getElementsByTagName("script"),g);h.splice.apply(h,[j+1,0].concat(s))}d.appendChild(h[j])}}return h},cleanData:function(a){var b,c,d=f.cache,e=f.event.special,g=f.support.deleteExpando;for(var h=0,i;(i=a[h])!=null;h++){if(i.nodeName&&f.noData[i.nodeName.toLowerCase()])continue;c=i[f.expando];if(c){b=d[c];if(b&&b.events){for(var j in b.events)e[j]?f.event.remove(i,j):f.removeEvent(i,j,b.handle);b.handle&&(b.handle.elem=null)}g?delete i[f.expando]:i.removeAttribute&&i.removeAttribute(f.expando),delete d[c]}}}});var bq=/alpha\([^)]*\)/i,br=/opacity=([^)]*)/,bs=/([A-Z]|^ms)/g,bt=/^-?\d+(?:px)?$/i,bu=/^-?\d/,bv=/^([\-+])=([\-+.\de]+)/,bw={position:"absolute",visibility:"hidden",display:"block"},bx=["Left","Right"],by=["Top","Bottom"],bz,bA,bB;f.fn.css=function(a,c){if(arguments.length===2&&c===b)return this;return f.access(this,a,c,!0,function(a,c,d){return d!==b?f.style(a,c,d):f.css(a,c)})},f.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=bz(a,"opacity","opacity");return c===""?"1":c}return a.style.opacity}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":f.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!!a&&a.nodeType!==3&&a.nodeType!==8&&!!a.style){var g,h,i=f.camelCase(c),j=a.style,k=f.cssHooks[i];c=f.cssProps[i]||i;if(d===b){if(k&&"get"in k&&(g=k.get(a,!1,e))!==b)return g;return j[c]}h=typeof d,h==="string"&&(g=bv.exec(d))&&(d=+(g[1]+1)*+g[2]+parseFloat(f.css(a,c)),h="number");if(d==null||h==="number"&&isNaN(d))return;h==="number"&&!f.cssNumber[i]&&(d+="px");if(!k||!("set"in k)||(d=k.set(a,d))!==b)try{j[c]=d}catch(l){}}},css:function(a,c,d){var e,g;c=f.camelCase(c),g=f.cssHooks[c],c=f.cssProps[c]||c,c==="cssFloat"&&(c="float");if(g&&"get"in g&&(e=g.get(a,!0,d))!==b)return e;if(bz)return bz(a,c)},swap:function(a,b,c){var d={};for(var e in b)d[e]=a.style[e],a.style[e]=b[e];c.call(a);for(e in b)a.style[e]=d[e]}}),f.curCSS=f.css,f.each(["height","width"],function(a,b){f.cssHooks[b]={get:function(a,c,d){var e;if(c){if(a.offsetWidth!==0)return bC(a,b,d);f.swap(a,bw,function(){e=bC(a,b,d)});return e}},set:function(a,b){if(!bt.test(b))return b;b=parseFloat(b);if(b>=0)return b+"px"}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return br.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNumeric(b)?"alpha(opacity="+b*100+")":"",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bq,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bq.test(g)?g.replace(bq,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bz(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(bA=function(a,b){var c,d,e;b=b.replace(bs,"-$1").toLowerCase(),(d=a.ownerDocument.defaultView)&&(e=d.getComputedStyle(a,null))&&(c=e.getPropertyValue(b),c===""&&!f.contains(a.ownerDocument.documentElement,a)&&(c=f.style(a,b)));return c}),c.documentElement.currentStyle&&(bB=function(a,b){var c,d,e,f=a.currentStyle&&a.currentStyle[b],g=a.style;f===null&&g&&(e=g[b])&&(f=e),!bt.test(f)&&bu.test(f)&&(c=g.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),g.left=b==="fontSize"?"1em":f||0,f=g.pixelLeft+"px",g.left=c,d&&(a.runtimeStyle.left=d));return f===""?"auto":f}),bz=bA||bB,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style&&a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)});var bD=/%20/g,bE=/\[\]$/,bF=/\r?\n/g,bG=/#.*$/,bH=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bI=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bJ=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bK=/^(?:GET|HEAD)$/,bL=/^\/\//,bM=/\?/,bN=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,bO=/^(?:select|textarea)/i,bP=/\s+/,bQ=/([?&])_=[^&]*/,bR=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bS=f.fn.load,bT={},bU={},bV,bW,bX=["*/"]+["*"];try{bV=e.href}catch(bY){bV=c.createElement("a"),bV.href="",bV=bV.href}bW=bR.exec(bV.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bS)return bS.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("<div>").append(c.replace(bN,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bO.test(this.nodeName)||bI.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bF,"\r\n")}}):{name:b.name,value:c.replace(bF,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.on(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?b_(a,f.ajaxSettings):(b=a,a=f.ajaxSettings),b_(a,b);return a},ajaxSettings:{url:bV,isLocal:bJ.test(bW[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":bX},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:bZ(bT),ajaxTransport:bZ(bU),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a>0?4:0;var o,r,u,w=c,x=l?cb(d,v,l):b,y,z;if(a>=200&&a<300||a===304){if(d.ifModified){if(y=v.getResponseHeader("Last-Modified"))f.lastModified[k]=y;if(z=v.getResponseHeader("Etag"))f.etag[k]=z}if(a===304)w="notmodified",o=!0;else try{r=cc(d,x),w="success",o=!0}catch(A){w="parsererror",u=A}}else{u=w;if(!w||a)w="error",a<0&&(a=0)}v.status=a,v.statusText=""+(c||w),o?h.resolveWith(e,[r,w,v]):h.rejectWith(e,[v,w,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.fireWith(e,[v,w]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f.Callbacks("once memory"),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bH.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.add,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bG,"").replace(bL,bW[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bP),d.crossDomain==null&&(r=bR.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bW[1]&&r[2]==bW[2]&&(r[3]||(r[1]==="http:"?80:443))==(bW[3]||(bW[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),b$(bT,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bK.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bM.test(d.url)?"&":"?")+d.data,delete d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bQ,"$1_="+x);d.url=y+(y===d.url?(bM.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", "+bX+"; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=b$(bU,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){if(s<2)w(-1,z);else throw z}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)ca(g,a[g],c,e);return d.join("&").replace(bD,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var cd=f.now(),ce=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+cd++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=b.contentType==="application/x-www-form-urlencoded"&&typeof b.data=="string";if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(ce.test(b.url)||e&&ce.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(ce,l),b.url===j&&(e&&(k=k.replace(ce,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var cf=a.ActiveXObject?function(){for(var a in ch)ch[a](0,1)}:!1,cg=0,ch;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ci()||cj()}:ci,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,cf&&delete ch[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n),m.text=h.responseText;try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cg,cf&&(ch||(ch={},f(a).unload(cf)),ch[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var ck={},cl,cm,cn=/^(?:toggle|show|hide)$/,co=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,cp,cq=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cr;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(cu("show",3),a,b,c);for(var g=0,h=this.length;g<h;g++)d=this[g],d.style&&(e=d.style.display,!f._data(d,"olddisplay")&&e==="none"&&(e=d.style.display=""),e===""&&f.css(d,"display")==="none"&&f._data(d,"olddisplay",cv(d.nodeName)));for(g=0;g<h;g++){d=this[g];if(d.style){e=d.style.display;if(e===""||e==="none")d.style.display=f._data(d,"olddisplay")||""}}return this},hide:function(a,b,c){if(a||a===0)return this.animate(cu("hide",3),a,b,c);var d,e,g=0,h=this.length;for(;g<h;g++)d=this[g],d.style&&(e=f.css(d,"display"),e!=="none"&&!f._data(d,"olddisplay")&&f._data(d,"olddisplay",e));for(g=0;g<h;g++)this[g].style&&(this[g].style.display="none");return this},_toggle:f.fn.toggle,toggle:function(a,b,c){var d=typeof a=="boolean";f.isFunction(a)&&f.isFunction(b)?this._toggle.apply(this,arguments):a==null||d?this.each(function(){var b=d?a:f(this).is(":hidden");f(this)[b?"show":"hide"]()}):this.animate(cu("toggle",3),a,b,c);return this},fadeTo:function(a,b,c,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){function g(){e.queue===!1&&f._mark(this);var b=f.extend({},e),c=this.nodeType===1,d=c&&f(this).is(":hidden"),g,h,i,j,k,l,m,n,o;b.animatedProperties={};for(i in a){g=f.camelCase(i),i!==g&&(a[g]=a[i],delete a[i]),h=a[g],f.isArray(h)?(b.animatedProperties[g]=h[1],h=a[g]=h[0]):b.animatedProperties[g]=b.specialEasing&&b.specialEasing[g]||b.easing||"swing";if(h==="hide"&&d||h==="show"&&!d)return b.complete.call(this);c&&(g==="height"||g==="width")&&(b.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY],f.css(this,"display")==="inline"&&f.css(this,"float")==="none"&&(!f.support.inlineBlockNeedsLayout||cv(this.nodeName)==="inline"?this.style.display="inline-block":this.style.zoom=1))}b.overflow!=null&&(this.style.overflow="hidden");for(i in a)j=new f.fx(this,b,i),h=a[i],cn.test(h)?(o=f._data(this,"toggle"+i)||(h==="toggle"?d?"show":"hide":0),o?(f._data(this,"toggle"+i,o==="show"?"hide":"show"),j[o]()):j[h]()):(k=co.exec(h),l=j.cur(),k?(m=parseFloat(k[2]),n=k[3]||(f.cssNumber[i]?"":"px"),n!=="px"&&(f.style(this,i,(m||1)+n),l=(m||1)/j.cur()*l,f.style(this,i,l+n)),k[1]&&(m=(k[1]==="-="?-1:1)*m+l),j.custom(l,m,n)):j.custom(l,h,""));return!0}var e=f.speed(b,c,d);if(f.isEmptyObject(a))return this.each(e.complete,[!1]);a=f.extend({},a);return e.queue===!1?this.each(g):this.queue(e.queue,g)},stop:function(a,c,d){typeof a!="string"&&(d=c,c=a,a=b),c&&a!==!1&&this.queue(a||"fx",[]);return this.each(function(){function h(a,b,c){var e=b[c];f.removeData(a,c,!0),e.stop(d)}var b,c=!1,e=f.timers,g=f._data(this);d||f._unmark(!0,this);if(a==null)for(b in g)g[b]&&g[b].stop&&b.indexOf(".run")===b.length-4&&h(this,g,b);else g[b=a+".run"]&&g[b].stop&&h(this,g,b);for(b=e.length;b--;)e[b].elem===this&&(a==null||e[b].queue===a)&&(d?e[b](!0):e[b].saveState(),c=!0,e.splice(b,1));(!d||!c)&&f.dequeue(this,a)})}}),f.each({slideDown:cu("show",1),slideUp:cu("hide",1),slideToggle:cu("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){f.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),f.extend({speed:function(a,b,c){var d=a&&typeof a=="object"?f.extend({},a):{complete:c||!c&&b||f.isFunction(a)&&a,duration:a,easing:c&&b||b&&!f.isFunction(b)&&b};d.duration=f.fx.off?0:typeof d.duration=="number"?d.duration:d.duration in f.fx.speeds?f.fx.speeds[d.duration]:f.fx.speeds._default;if(d.queue==null||d.queue===!0)d.queue="fx";d.old=d.complete,d.complete=function(a){f.isFunction(d.old)&&d.old.call(this),d.queue?f.dequeue(this,d.queue):a!==!1&&f._unmark(this)};return d},easing:{linear:function(a,b,c,d){return c+d*a},swing:function(a,b,c,d){return(-Math.cos(a*Math.PI)/2+.5)*d+c}},timers:[],fx:function(a,b,c){this.options=b,this.elem=a,this.prop=c,b.orig=b.orig||{}}}),f.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this),(f.fx.step[this.prop]||f.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a,b=f.css(this.elem,this.prop);return isNaN(a=parseFloat(b))?!b||b==="auto"?0:b:a},custom:function(a,c,d){function h(a){return e.step(a)}var e=this,g=f.fx;this.startTime=cr||cs(),this.end=c,this.now=this.start=a,this.pos=this.state=0,this.unit=d||this.unit||(f.cssNumber[this.prop]?"":"px"),h.queue=this.options.queue,h.elem=this.elem,h.saveState=function(){e.options.hide&&f._data(e.elem,"fxshow"+e.prop)===b&&f._data(e.elem,"fxshow"+e.prop,e.start)},h()&&f.timers.push(h)&&!cp&&(cp=setInterval(g.tick,g.interval))},show:function(){var a=f._data(this.elem,"fxshow"+this.prop);this.options.orig[this.prop]=a||f.style(this.elem,this.prop),this.options.show=!0,a!==b?this.custom(this.cur(),a):this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur()),f(this.elem).show()},hide:function(){this.options.orig[this.prop]=f._data(this.elem,"fxshow"+this.prop)||f.style(this.elem,this.prop),this.options.hide=!0,this.custom(this.cur(),0)},step:function(a){var b,c,d,e=cr||cs(),g=!0,h=this.elem,i=this.options;if(a||e>=i.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),i.animatedProperties[this.prop]=!0;for(b in i.animatedProperties)i.animatedProperties[b]!==!0&&(g=!1);if(g){i.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){h.style["overflow"+b]=i.overflow[a]}),i.hide&&f(h).hide();if(i.hide||i.show)for(b in i.animatedProperties)f.style(h,b,i.orig[b]),f.removeData(h,"fxshow"+b,!0),f.removeData(h,"toggle"+b,!0);d=i.complete,d&&(i.complete=!1,d.call(h))}return!1}i.duration==Infinity?this.now=e:(c=e-this.startTime,this.state=c/i.duration,this.pos=f.easing[i.animatedProperties[this.prop]](this.state,c,0,1,i.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){var a,b=f.timers,c=0;for(;c<b.length;c++)a=b[c],!a()&&b[c]===a&&b.splice(c--,1);b.length||f.fx.stop()},interval:13,stop:function(){clearInterval(cp),cp=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){f.style(a.elem,"opacity",a.now)},_default:function(a){a.elem.style&&a.elem.style[a.prop]!=null?a.elem.style[a.prop]=a.now+a.unit:a.elem[a.prop]=a.now}}}),f.each(["width","height"],function(a,b){f.fx.step[b]=function(a){f.style(a.elem,b,Math.max(0,a.now)+a.unit)}}),f.expr&&f.expr.filters&&(f.expr.filters.animated=function(a){return f.grep(f.timers,function(b){return a===b.elem}).length});var cw=/^t(?:able|d|h)$/i,cx=/^(?:body|html)$/i;"getBoundingClientRect"in c.documentElement?f.fn.offset=function(a){var b=this[0],c;if(a)return this.each(function(b){f.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return f.offset.bodyOffset(b);try{c=b.getBoundingClientRect()}catch(d){}var e=b.ownerDocument,g=e.documentElement;if(!c||!f.contains(g,b))return c?{top:c.top,left:c.left}:{top:0,left:0};var h=e.body,i=cy(e),j=g.clientTop||h.clientTop||0,k=g.clientLeft||h.clientLeft||0,l=i.pageYOffset||f.support.boxModel&&g.scrollTop||h.scrollTop,m=i.pageXOffset||f.support.boxModel&&g.scrollLeft||h.scrollLeft,n=c.top+l-j,o=c.left+m-k;return{top:n,left:o}}:f.fn.offset=function(a){var b=this[0];if(a)return this.each(function(b){f.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return f.offset.bodyOffset(b);var c,d=b.offsetParent,e=b,g=b.ownerDocument,h=g.documentElement,i=g.body,j=g.defaultView,k=j?j.getComputedStyle(b,null):b.currentStyle,l=b.offsetTop,m=b.offsetLeft;while((b=b.parentNode)&&b!==i&&b!==h){if(f.support.fixedPosition&&k.position==="fixed")break;c=j?j.getComputedStyle(b,null):b.currentStyle,l-=b.scrollTop,m-=b.scrollLeft,b===d&&(l+=b.offsetTop,m+=b.offsetLeft,f.support.doesNotAddBorder&&(!f.support.doesAddBorderForTableAndCells||!cw.test(b.nodeName))&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),e=d,d=b.offsetParent),f.support.subtractsBorderForOverflowNotVisible&&c.overflow!=="visible"&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),k=c}if(k.position==="relative"||k.position==="static")l+=i.offsetTop,m+=i.offsetLeft;f.support.fixedPosition&&k.position==="fixed"&&(l+=Math.max(h.scrollTop,i.scrollTop),m+=Math.max(h.scrollLeft,i.scrollLeft));return{top:l,left:m}},f.offset={bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;f.support.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(f.css(a,"marginTop"))||0,c+=parseFloat(f.css(a,"marginLeft"))||0);return{top:b,left:c}},setOffset:function(a,b,c){var d=f.css(a,"position");d==="static"&&(a.style.position="relative");var e=f(a),g=e.offset(),h=f.css(a,"top"),i=f.css(a,"left"),j=(d==="absolute"||d==="fixed")&&f.inArray("auto",[h,i])>-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cx.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cx.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each(["Left","Top"],function(a,c){var d="scroll"+c;f.fn[d]=function(c){var e,g;if(c===b){e=this[0];if(!e)return null;g=cy(e);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:f.support.boxModel&&g.document.documentElement[d]||g.document.body[d]:e[d]}return this.each(function(){g=cy(this),g?g.scrollTo(a?f(g).scrollLeft():c,a?c:f(g).scrollTop()):this[d]=c})}}),f.each(["Height","Width"],function(a,c){var d=c.toLowerCase();f.fn["inner"+c]=function(){var a=this[0];return a?a.style?parseFloat(f.css(a,d,"padding")):this[d]():null},f.fn["outer"+c]=function(a){var b=this[0];return b?b.style?parseFloat(f.css(b,d,a?"margin":"border")):this[d]():null},f.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(f.isFunction(a))return this.each(function(b){var c=f(this);c[d](a.call(this,b,c[d]()))});if(f.isWindow(e)){var g=e.document.documentElement["client"+c],h=e.document.body;return e.document.compatMode==="CSS1Compat"&&g||h&&h["client"+c]||g}if(e.nodeType===9)return Math.max(e.documentElement["client"+c],e.body["scroll"+c],e.documentElement["scroll"+c],e.body["offset"+c],e.documentElement["offset"+c]);if(a===b){var i=f.css(e,d),j=parseFloat(i);return f.isNumeric(j)?j:i}return this.css(d,typeof a=="string"?a:a+"px")}}),a.jQuery=a.$=f,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return f})})(window);
(function(d,D){function M(b,a){b=""+b;for(a=a||2;b.length<a;)b="0"+b;return b}function N(b,a,d,g){var f=a.getDate(),l=a.getDay(),k=a.getMonth(),c=a.getFullYear(),f={d:f,dd:M(f),ddd:r[g].shortDays[l],dddd:r[g].days[l],m:k+1,mm:M(k+1),mmm:r[g].shortMonths[k],mmmm:r[g].months[k],yy:(""+c).slice(2),yyyy:c},b=O[b](d,a,f,g);return S.html(b).html()}function l(b){return parseInt(b,10)}function P(b,a){return b.getFullYear()===a.getFullYear()&&b.getMonth()==a.getMonth()&&b.getDate()==a.getDate()}function w(b){if(b!==
D){if(b.constructor==Date)return b;if("string"==typeof b){var a=b.split("-");if(3==a.length)return new Date(l(a[0]),l(a[1])-1,l(a[2]));if(!/^-?\d+$/.test(b))return;b=l(b)}a=new Date;a.setDate(a.getDate()+b);return a}}function T(b,a){function j(a,t,c){o=a;z=a.getFullYear();B=a.getMonth();A=a.getDate();c||(c=d.Event("api"));"click"==c.type&&!d.browser.msie&&b.focus();c.type="beforeChange";C.trigger(c,[a]);c.isDefaultPrevented()||(b.val(N(t.formatter,a,t.format,t.lang)),c.type="change",C.trigger(c),
b.data("date",a),f.hide(c))}function g(a){a.type="onShow";C.trigger(a);d(document).on("keydown.d",function(a){if(a.ctrlKey)return!0;var e=a.keyCode;if(8==e||46==e)return b.val(""),f.hide(a);if(27==e||9==e)return f.hide(a);if(0<=d(Q).index(e)){if(!u)return f.show(a),a.preventDefault();var h=d("#"+c.weeks+" a"),j=d("."+c.focus),g=h.index(j);j.removeClass(c.focus);if(74==e||40==e)g+=7;else if(75==e||38==e)g-=7;else if(76==e||39==e)g+=1;else if(72==e||37==e)g-=1;41<g?(f.addMonth(),j=d("#"+c.weeks+" a:eq("+
(g-42)+")")):0>g?(f.addMonth(-1),j=d("#"+c.weeks+" a:eq("+(g+42)+")")):j=h.eq(g);j.addClass(c.focus);return a.preventDefault()}if(34==e)return f.addMonth();if(33==e)return f.addMonth(-1);if(36==e)return f.today();13==e&&(d(a.target).is("select")||d("."+c.focus).click());return 0<=d([16,17,18,9]).index(e)});d(document).on("click.d",function(a){var e=a.target;!d(e).parents("#"+c.root).length&&e!=b[0]&&(!E||e!=E[0])&&f.hide(a)})}var f=this,q=new Date,k=q.getFullYear(),c=a.css,F=r[a.lang],i=d("#"+c.root),
K=i.find("#"+c.title),E,G,H,z,B,A,o=b.attr("data-value")||a.value||b.val(),n=b.attr("min")||a.min,p=b.attr("max")||a.max,u,I;0===n&&(n="0");o=w(o)||q;n=w(n||new Date(k+a.yearRange[0],1,1));p=w(p||new Date(k+a.yearRange[1]+1,1,-1));if(!F)throw"Dateinput: invalid language: "+a.lang;"date"==b.attr("type")&&(I=b.clone(),k=I.wrap("<div/>").parent().html(),k=d(k.replace(/type/i,"type=text data-orig-type")),a.value&&k.val(a.value),b.replaceWith(k),b=k);b.addClass(c.input);var C=b.add(f);if(!i.length){i=
d("<div><div><a/><div/><a/></div><div><div/><div/></div></div>").hide().css({position:"absolute"}).attr("id",c.root);i.children().eq(0).attr("id",c.head).end().eq(1).attr("id",c.body).children().eq(0).attr("id",c.days).end().eq(1).attr("id",c.weeks).end().end().end().find("a").eq(0).attr("id",c.prev).end().eq(1).attr("id",c.next);K=i.find("#"+c.head).find("div").attr("id",c.title);if(a.selectors){var x=d("<select/>").attr("id",c.month),y=d("<select/>").attr("id",c.year);K.html(x.add(y))}for(var k=
i.find("#"+c.days),L=0;7>L;L++)k.append(d("<span/>").text(F.shortDays[(L+a.firstDay)%7]));d("body").append(i)}a.trigger&&(E=d("<a/>").attr("href","#").addClass(c.trigger).click(function(e){a.toggle?f.toggle():f.show();return e.preventDefault()}).insertAfter(b));var J=i.find("#"+c.weeks),y=i.find("#"+c.year),x=i.find("#"+c.month);d.extend(f,{show:function(e){if(!b.attr("readonly")&&!b.attr("disabled")&&!u){e=e||d.Event();e.type="onBeforeShow";C.trigger(e);if(!e.isDefaultPrevented()){d.each(R,function(){this.hide()});
u=true;x.off("change").change(function(){f.setValue(l(y.val()),l(d(this).val()))});y.off("change").change(function(){f.setValue(l(d(this).val()),l(x.val()))});G=i.find("#"+c.prev).off("click").click(function(){G.hasClass(c.disabled)||f.addMonth(-1);return false});H=i.find("#"+c.next).off("click").click(function(){H.hasClass(c.disabled)||f.addMonth();return false});f.setValue(o);var t=b.offset();if(/iPad/i.test(navigator.userAgent))t.top=t.top-d(window).scrollTop();i.css({top:t.top+b.outerHeight({margins:true})+
a.offset[0],left:t.left+a.offset[1]});if(a.speed)i.show(a.speed,function(){g(e)});else{i.show();g(e)}return f}}},setValue:function(e,b,g){var h=l(b)>=-1?new Date(l(e),l(b),l(g==D||isNaN(g)?1:g)):e||o;h<n?h=n:h>p&&(h=p);typeof e=="string"&&(h=w(e));e=h.getFullYear();b=h.getMonth();g=h.getDate();if(b==-1){b=11;e--}else if(b==12){b=0;e++}if(!u){j(h,a);return f}B=b;z=e;A=g;var g=(new Date(e,b,1-a.firstDay)).getDay(),i=(new Date(e,b+1,0)).getDate(),k=(new Date(e,b-1+1,0)).getDate(),r;if(a.selectors){x.empty();
d.each(F.months,function(a,b){n<new Date(e,a+1,1)&&p>new Date(e,a,0)&&x.append(d("<option/>").html(b).attr("value",a))});y.empty();for(var h=q.getFullYear(),m=h+a.yearRange[0];m<h+a.yearRange[1];m++)n<new Date(m+1,0,1)&&p>new Date(m,0,0)&&y.append(d("<option/>").text(m));x.val(b);y.val(e)}else K.html(F.months[b]+" "+e);J.empty();G.add(H).removeClass(c.disabled);for(var m=!g?-7:0,s,v;m<(!g?35:42);m++){s=d("<a/>");if(m%7===0){r=d("<div/>").addClass(c.week);J.append(r)}if(m<g){s.addClass(c.off);v=k-
g+m+1;h=new Date(e,b-1,v)}else if(m>=g+i){s.addClass(c.off);v=m-i-g+1;h=new Date(e,b+1,v)}else{v=m-g+1;h=new Date(e,b,v);P(o,h)?s.attr("id",c.current).addClass(c.focus):P(q,h)&&s.attr("id",c.today)}n&&h<n&&s.add(G).addClass(c.disabled);p&&h>p&&s.add(H).addClass(c.disabled);s.attr("href","#"+v).text(v).data("date",h);r.append(s)}J.find("a").click(function(b){var e=d(this);if(!e.hasClass(c.disabled)){d("#"+c.current).removeAttr("id");e.attr("id",c.current);j(e.data("date"),a,b)}return false});c.sunday&&
J.find("."+c.week).each(function(){var b=a.firstDay?7-a.firstDay:0;d(this).children().slice(b,b+1).addClass(c.sunday)});return f},setMin:function(a,b){n=w(a);b&&o<n&&f.setValue(n);return f},setMax:function(a,b){p=w(a);b&&o>p&&f.setValue(p);return f},today:function(){return f.setValue(q)},addDay:function(a){return this.setValue(z,B,A+(a||1))},addMonth:function(a){var a=B+(a||1),b=(new Date(z,a+1,0)).getDate();return this.setValue(z,a,A<=b?A:b)},addYear:function(a){return this.setValue(z+(a||1),B,A)},
destroy:function(){b.add(document).off("click.d keydown.d");i.add(E).remove();b.removeData("dateinput").removeClass(c.input);I&&b.replaceWith(I)},hide:function(a){if(u){a=d.Event();a.type="onHide";C.trigger(a);if(a.isDefaultPrevented())return;d(document).off("click.d keydown.d");i.hide();u=false}return f},toggle:function(){return f.isOpen()?f.hide():f.show()},getConf:function(){return a},getInput:function(){return b},getCalendar:function(){return i},getValue:function(b){return b?N(a.formatter,o,b,
a.lang):o},isOpen:function(){return u}});d.each(["onBeforeShow","onShow","change","onHide"],function(b,c){if(d.isFunction(a[c]))d(f).on(c,a[c]);f[c]=function(a){if(a)d(f).on(c,a);return f}});a.editable||b.on("focus.d click.d",f.show).keydown(function(a){var c=a.keyCode;if(!u&&d(Q).index(c)>=0){f.show(a);return a.preventDefault()}(c==8||c==46)&&b.val("");return a.shiftKey||a.ctrlKey||a.altKey||c==9?true:a.preventDefault()});w(b.val())&&j(o,a)}d.tools=d.tools||{version:"@VERSION"};var R=[],O={},q,Q=
[75,76,38,39,74,72,40,37],r={};q=d.tools.dateinput={conf:{format:"mm/dd/yy",formatter:"default",selectors:!1,yearRange:[-5,5],lang:"en",offset:[0,0],speed:0,firstDay:0,min:D,max:D,trigger:0,toggle:0,editable:0,css:{prefix:"cal",input:"date",root:0,head:0,title:0,prev:0,next:0,month:0,year:0,days:0,body:0,weeks:0,today:0,current:0,week:0,off:0,sunday:0,focus:0,disabled:0,trigger:0}},addFormatter:function(b,a){O[b]=a},localize:function(b,a){d.each(a,function(b,d){a[b]=d.split(",")});r[b]=a}};q.localize("en",
{months:"January,February,March,April,May,June,July,August,September,October,November,December",shortMonths:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec",days:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday",shortDays:"Sun,Mon,Tue,Wed,Thu,Fri,Sat"});var S=d("<a/>");q.addFormatter("default",function(b,a,d){return b.replace(/d{1,4}|m{1,4}|yy(?:yy)?|"[^"]*"|'[^']*'/g,function(a){return a in d?d[a]:a})});q.addFormatter("prefixed",function(b,a,d){return b.replace(/%(d{1,4}|m{1,4}|yy(?:yy)?|"[^"]*"|'[^']*')/g,
function(a,b){return b in d?d[b]:a})});d.expr[":"].date=function(b){var a=b.getAttribute("type");return a&&"date"==a||!!d(b).data("dateinput")};d.fn.dateinput=function(b){if(this.data("dateinput"))return this;b=d.extend(!0,{},q.conf,b);d.each(b.css,function(a,d){!d&&"prefix"!=a&&(b.css[a]=(b.css.prefix||"")+(d||a))});var a;this.each(function(){var j=new T(d(this),b);R.push(j);j=j.getInput().data("dateinput",j);a=a?a.add(j):j});return a?a:this}})(jQuery);(function(b){function m(a,c){var d=this,h=a.add(d),n=b(window),e,f,k,g=b.tools.expose&&(c.mask||c.expose),l=Math.random().toString().slice(10);g&&("string"==typeof g&&(g={color:g}),g.closeOnClick=g.closeOnEsc=!1);var i=c.target||a.attr("rel");f=i?b(i):a;if(!f.length)throw"Could not find Overlay: "+i;a&&-1==a.index(f)&&a.click(function(b){d.load(b);return b.preventDefault()});b.extend(d,{load:function(a){if(d.isOpened())return d;var p=o[c.effect];if(!p)throw'Overlay: cannot find effect : "'+c.effect+
'"';c.oneInstance&&b.each(q,function(){this.close(a)});a=a||b.Event();a.type="onBeforeLoad";h.trigger(a);if(a.isDefaultPrevented())return d;k=true;g&&b(f).expose(g);var j=c.top,e=c.left,i=f.outerWidth({margin:true}),m=f.outerHeight({margin:true});typeof j=="string"&&(j=j=="center"?Math.max((n.height()-m)/2,0):parseInt(j,10)/100*n.height());e=="center"&&(e=Math.max((n.width()-i)/2,0));p[0].call(d,{top:j,left:e},function(){if(k){a.type="onLoad";h.trigger(a)}});if(g&&c.closeOnClick)b.mask.getMask().one("click",
d.close);if(c.closeOnClick)b(document).on("click."+l,function(a){b(a.target).parents(f).length||d.close(a)});if(c.closeOnEsc)b(document).on("keydown."+l,function(a){a.keyCode==27&&d.close(a)});return d},close:function(a){if(!d.isOpened())return d;a=a||b.Event();a.type="onBeforeClose";h.trigger(a);if(!a.isDefaultPrevented()){k=false;o[c.effect][1].call(d,function(){a.type="onClose";h.trigger(a)});b(document).off("click."+l+" keydown."+l);g&&b.mask.close();return d}},getOverlay:function(){return f},
getTrigger:function(){return a},getClosers:function(){return e},isOpened:function(){return k},getConf:function(){return c}});b.each(["onBeforeLoad","onStart","onLoad","onBeforeClose","onClose"],function(a,e){if(b.isFunction(c[e]))b(d).on(e,c[e]);d[e]=function(a){if(a)b(d).on(e,a);return d}});e=f.find(c.close||".close");!e.length&&!c.close&&(e=b('<a class="close"></a>'),f.prepend(e));e.click(function(a){d.close(a)});c.load&&d.load()}b.tools=b.tools||{version:"@VERSION"};b.tools.overlay={addEffect:function(a,
b,d){o[a]=[b,d]},conf:{close:null,closeOnClick:!0,closeOnEsc:!0,closeSpeed:"fast",effect:"default",fixed:!b.browser.msie||6<b.browser.version,left:"center",load:!1,mask:null,oneInstance:!0,speed:"normal",target:null,top:"10%"}};var q=[],o={};b.tools.overlay.addEffect("default",function(a,c){var d=this.getConf(),h=b(window);d.fixed||(a.top+=h.scrollTop(),a.left+=h.scrollLeft());a.position=d.fixed?"fixed":"absolute";this.getOverlay().css(a).fadeIn(d.speed,c)},function(a){this.getOverlay().fadeOut(this.getConf().closeSpeed,
a)});b.fn.overlay=function(a){var c=this.data("overlay");if(c)return c;b.isFunction(a)&&(a={onBeforeLoad:a});a=b.extend(!0,{},b.tools.overlay.conf,a);this.each(function(){c=new m(b(this),a);q.push(c);b(this).data("overlay",c)});return a.api?c:this}})(jQuery);(function(h){function l(a){var e=a.offset();return{top:e.top+a.height()/2,left:e.left+a.width()/2}}var i=h.tools.overlay,f=h(window);h.extend(i.conf,{start:{top:null,left:null},fadeInSpeed:"fast",zIndex:9999});i.addEffect("apple",function(a,e){var b=this.getOverlay(),d=this.getConf(),g=this.getTrigger(),i=this,m=b.outerWidth({margin:!0}),c=b.data("img"),n=d.fixed?"fixed":"absolute";if(!c){c=b.css("backgroundImage");if(!c)throw"background-image CSS property not set for overlay";c=c.slice(c.indexOf("(")+
1,c.indexOf(")")).replace(/\"/g,"");b.css("backgroundImage","none");c=h('<img src="'+c+'"/>');c.css({border:0,display:"none"}).width(m);h("body").append(c);b.data("img",c)}var j=d.start.top||Math.round(f.height()/2),k=d.start.left||Math.round(f.width()/2);g&&(g=l(g),j=g.top,k=g.left);d.fixed?(j-=f.scrollTop(),k-=f.scrollLeft()):(a.top+=f.scrollTop(),a.left+=f.scrollLeft());c.css({position:"absolute",top:j,left:k,width:0,zIndex:d.zIndex}).show();a.position=n;b.css(a);c.animate({top:a.top,left:a.left,
width:m},d.speed,function(){b.css("zIndex",d.zIndex+1).fadeIn(d.fadeInSpeed,function(){i.isOpened()&&!h(this).index(b)?e.call():b.hide()})}).css("position",n)},function(a){var e=this.getOverlay().hide(),b=this.getConf(),d=this.getTrigger(),e=e.data("img"),g={top:b.start.top,left:b.start.left,width:0};d&&h.extend(g,l(d));b.fixed&&e.css({position:"absolute"}).animate({top:"+="+f.scrollTop(),left:"+="+f.scrollLeft()},0);e.animate(g,b.closeSpeed,a)})})(jQuery);(function(a){function z(c,b){var a=Math.pow(10,b);return Math.round(c*a)/a}function m(c,b){var a=parseInt(c.css(b),10);return a?a:(a=c[0].currentStyle)&&a.width&&parseInt(a.width,10)}function y(a){return(a=a.data("events"))&&a.onSlide}function A(c,b){function e(a,d,f,e){void 0===f?f=d/i*v:e&&(f-=b.min);s&&(f=Math.round(f/s)*s);if(void 0===d||s)d=f*i/v;if(isNaN(f))return g;d=Math.max(0,Math.min(d,i));f=d/i*v;if(e||!n)f+=b.min;n&&(e?d=i-d:f=b.max-f);var f=z(f,r),h="click"==a.type;if(u&&void 0!==k&&
!h&&(a.type="onSlide",w.trigger(a,[f,d]),a.isDefaultPrevented()))return g;e=h?b.speed:0;h=h?function(){a.type="change";w.trigger(a,[f])}:null;n?(j.animate({top:d},e,h),b.progress&&x.animate({height:i-d+j.height()/2},e)):(j.animate({left:d},e,h),b.progress&&x.animate({width:d+j.width()/2},e));k=f;c.val(f);return g}function o(){(n=b.vertical||m(h,"height")>m(h,"width"))?(i=m(h,"height")-m(j,"height"),l=h.offset().top+i):(i=m(h,"width")-m(j,"width"),l=h.offset().left)}function q(){o();g.setValue(void 0!==
b.value?b.value:b.min)}var g=this,p=b.css,h=a("<div><div/><a href='#'/></div>").data("rangeinput",g),n,k,l,i;c.before(h);var j=h.addClass(p.slider).find("a").addClass(p.handle),x=h.find("div").addClass(p.progress);a.each(["min","max","step","value"],function(a,d){var f=c.attr(d);parseFloat(f)&&(b[d]=parseFloat(f,10))});var v=b.max-b.min,s="any"==b.step?0:b.step,r=b.precision;void 0===r&&(r=s.toString().split("."),r=2===r.length?r[1].length:0);if("range"==c.attr("type")){var t=c.clone().wrap("<div/>").parent().html(),
t=a(t.replace(/type/i,"type=text data-orig-type"));t.val(b.value);c.replaceWith(t);c=t}c.addClass(p.input);var w=a(g).add(c),u=!0;a.extend(g,{getValue:function(){return k},setValue:function(b,d){o();return e(d||a.Event("api"),void 0,b,true)},getConf:function(){return b},getProgress:function(){return x},getHandle:function(){return j},getInput:function(){return c},step:function(c,d){d=d||a.Event();g.setValue(k+(b.step=="any"?1:b.step)*(c||1),d)},stepUp:function(a){return g.step(a||1)},stepDown:function(a){return g.step(-a||
-1)}});a.each(["onSlide","change"],function(c,d){if(a.isFunction(b[d]))a(g).on(d,b[d]);g[d]=function(b){if(b)a(g).on(d,b);return g}});j.drag({drag:!1}).on("dragStart",function(){o();u=y(a(g))||y(c)}).on("drag",function(a,b,f){if(c.is(":disabled"))return false;e(a,n?b:f)}).on("dragEnd",function(a){if(!a.isDefaultPrevented()){a.type="change";w.trigger(a,[k])}}).click(function(a){return a.preventDefault()});h.click(function(a){if(c.is(":disabled")||a.target==j[0])return a.preventDefault();o();var b=
n?j.height()/2:j.width()/2;e(a,n?i-l-b+a.pageY:a.pageX-l-b)});b.keyboard&&c.keydown(function(b){if(!c.attr("readonly")){var d=b.keyCode,f=a([75,76,38,33,39]).index(d)!=-1,e=a([74,72,40,34,37]).index(d)!=-1;if((f||e)&&!b.shiftKey&&!b.altKey&&!b.ctrlKey){f?g.step(d==33?10:1,b):e&&g.step(d==34?-10:-1,b);return b.preventDefault()}}});c.blur(function(b){var c=a(this).val();c!==k&&g.setValue(c,b)});a.extend(c[0],{stepUp:g.stepUp,stepDown:g.stepDown});q();i||a(window).load(q)}a.tools=a.tools||{version:"@VERSION"};
var u;u=a.tools.rangeinput={conf:{min:0,max:100,step:"any",steps:0,value:0,precision:void 0,vertical:0,keyboard:!0,progress:!1,speed:100,css:{input:"range",slider:"slider",progress:"progress",handle:"handle"}}};var q,l;a.fn.drag=function(c){document.ondragstart=function(){return!1};c=a.extend({x:!0,y:!0,drag:!0},c);q=q||a(document).on("mousedown mouseup",function(b){var e=a(b.target);if("mousedown"==b.type&&e.data("drag")){var o=e.position(),m=b.pageX-o.left,g=b.pageY-o.top,p=!0;q.on("mousemove.drag",
function(a){var b=a.pageX-m,a=a.pageY-g,k={};c.x&&(k.left=b);c.y&&(k.top=a);p&&(e.trigger("dragStart"),p=!1);c.drag&&e.css(k);e.trigger("drag",[a,b]);l=e});b.preventDefault()}else try{l&&l.trigger("dragEnd")}finally{q.off("mousemove.drag"),l=null}});return this.data("drag",!0)};a.expr[":"].range=function(c){var b=c.getAttribute("type");return b&&"range"==b||!!a(c).filter("input").data("rangeinput")};a.fn.rangeinput=function(c){if(this.data("rangeinput"))return this;var c=a.extend(!0,{},u.conf,c),
b;this.each(function(){var e=new A(a(this),a.extend(!0,{},c)),e=e.getInput().data("rangeinput",e);b=b?b.add(e):e});return b?b:this}})(jQuery);(function(d){function p(f,b){var c=d(b);return 2>c.length?c:f.parent().find(b)}function u(f,b){var c=this,n=f.add(c),g=f.children(),l=0,j=b.vertical;k||(k=c);1<g.length&&(g=d(b.items,f));1<b.size&&(b.circular=!1);d.extend(c,{getConf:function(){return b},getIndex:function(){return l},getSize:function(){return c.getItems().size()},getNaviButtons:function(){return h.add(m)},getRoot:function(){return f},getItemWrap:function(){return g},getItems:function(){return g.find(b.item).not("."+b.clonedClass)},
move:function(a,b){return c.seekTo(l+a,b)},next:function(a){return c.move(b.size,a)},prev:function(a){return c.move(-b.size,a)},begin:function(a){return c.seekTo(0,a)},end:function(a){return c.seekTo(c.getSize()-1,a)},focus:function(){return k=c},addItem:function(a){a=d(a);if(b.circular){g.children().last().before(a);g.children().first().replaceWith(a.clone().addClass(b.clonedClass))}else{g.append(a);m.removeClass("disabled")}n.trigger("onAddItem",[a]);return c},seekTo:function(a,e,f){a.jquery||(a=
a*1);if(b.circular&&a===0&&l==-1&&e!==0||!b.circular&&a<0||a>c.getSize()||a<-1)return c;var i=a;a.jquery?a=c.getItems().index(a):i=c.getItems().eq(a);var h=d.Event("onBeforeSeek");if(!f){n.trigger(h,[a,e]);if(h.isDefaultPrevented()||!i.length)return c}i=j?{top:-i.position().top}:{left:-i.position().left};l=a;k=c;if(e===void 0)e=b.speed;g.animate(i,e,b.easing,f||function(){n.trigger("onSeek",[a])});return c}});d.each(["onBeforeSeek","onSeek","onAddItem"],function(a,e){if(d.isFunction(b[e]))d(c).on(e,
b[e]);c[e]=function(a){if(a)d(c).on(e,a);return c}});if(b.circular){var q=c.getItems().slice(-1).clone().prependTo(g),r=c.getItems().eq(1).clone().appendTo(g);q.add(r).addClass(b.clonedClass);c.onBeforeSeek(function(a,b,d){if(!a.isDefaultPrevented()){if(b==-1){c.seekTo(q,d,function(){c.end(0)});return a.preventDefault()}b==c.getSize()&&c.seekTo(r,d,function(){c.begin(0)})}});var o=f.parents().add(f).filter(function(){if(d(this).css("display")==="none")return true});o.length?(o.show(),c.seekTo(0,0,
function(){}),o.hide()):c.seekTo(0,0,function(){})}var h=p(f,b.prev).click(function(a){a.stopPropagation();c.prev()}),m=p(f,b.next).click(function(a){a.stopPropagation();c.next()});b.circular||(c.onBeforeSeek(function(a,e){setTimeout(function(){if(!a.isDefaultPrevented()){h.toggleClass(b.disabledClass,e<=0);m.toggleClass(b.disabledClass,e>=c.getSize()-1)}},1)}),b.initialIndex||h.addClass(b.disabledClass));2>c.getSize()&&h.add(m).addClass(b.disabledClass);b.mousewheel&&d.fn.mousewheel&&f.mousewheel(function(a,
e){if(b.mousewheel){c.move(e<0?1:-1,b.wheelSpeed||50);return false}});if(b.touch){var s,t;g[0].ontouchstart=function(a){a=a.touches[0];s=a.clientX;t=a.clientY};g[0].ontouchmove=function(a){if(a.touches.length==1&&!g.is(":animated")){var b=a.touches[0],d=s-b.clientX,b=t-b.clientY;c[j&&b>0||!j&&d>0?"next":"prev"]();a.preventDefault()}}}if(b.keyboard)d(document).on("keydown.scrollable",function(a){if(b.keyboard&&!a.altKey&&!a.ctrlKey&&!a.metaKey&&!d(a.target).is(":input")&&!(b.keyboard!="static"&&k!=
c)){var e=a.keyCode;if(j&&(e==38||e==40)){c.move(e==38?-1:1);return a.preventDefault()}if(!j&&(e==37||e==39)){c.move(e==37?-1:1);return a.preventDefault()}}});b.initialIndex&&c.seekTo(b.initialIndex,0,function(){})}d.tools=d.tools||{version:"@VERSION"};d.tools.scrollable={conf:{activeClass:"active",circular:!1,clonedClass:"cloned",disabledClass:"disabled",easing:"swing",initialIndex:0,item:"> *",items:".items",keyboard:!0,mousewheel:!1,next:".next",prev:".prev",size:1,speed:400,vertical:!1,touch:!0,
wheelSpeed:0}};var k;d.fn.scrollable=function(f){var b=this.data("scrollable");if(b)return b;f=d.extend({},d.tools.scrollable.conf,f);this.each(function(){b=new u(d(this),f);d(this).data("scrollable",b)});return f.api?b:this}})(jQuery);(function(d){var h=d.tools.scrollable;h.autoscroll={conf:{autoplay:!0,interval:3E3,autopause:!0}};d.fn.autoscroll=function(b){"number"==typeof b&&(b={interval:b});var e=d.extend({},h.autoscroll.conf,b),i;this.each(function(){function b(){c&&clearTimeout(c);c=setTimeout(function(){a.next()},e.interval)}var a=d(this).data("scrollable"),f=a.getRoot(),c,g=!1;a&&(i=a);a.play=function(){c||(g=!1,f.on("onSeek",b),b())};a.pause=function(){c=clearTimeout(c);f.off("onSeek",b)};a.resume=function(){g||a.play()};
a.stop=function(){g=!0;a.pause()};e.autopause&&f.add(a.getNaviButtons()).hover(a.pause,a.resume);e.autoplay&&a.play()});return e.api?i:this}})(jQuery);(function(b){function m(a,f){var d=b(f);return 2>d.length?d:a.parent().find(f)}var g=b.tools.scrollable;g.navigator={conf:{navi:".navi",naviItem:null,activeClass:"active",indexed:!1,idPrefix:null,history:!1}};b.fn.navigator=function(a){"string"==typeof a&&(a={navi:a});var a=b.extend({},g.navigator.conf,a),f;this.each(function(){function d(){return i.find(a.naviItem||"> *")}function g(h){var e=b("<"+(a.naviItem||"a")+"/>").click(function(a){b(this);c.seekTo(h);a.preventDefault();j&&history.pushState({i:h},
"")});0===h&&e.addClass(k);a.indexed&&e.text(h+1);a.idPrefix&&e.attr("id",a.idPrefix+h);return e.appendTo(i)}var c=b(this).data("scrollable"),i=a.navi.jquery?a.navi:m(c.getRoot(),a.navi),n=c.getNaviButtons(),k=a.activeClass,j=a.history&&!!history.pushState,l=c.getConf().size;c&&(f=c);c.getNaviButtons=function(){return n.add(i)};j&&(history.pushState({i:0},""),b(window).on("popstate",function(a){(a=a.originalEvent.state)&&c.seekTo(a.i)}));d().length?d().each(function(a){b(this).click(function(e){b(this);
c.seekTo(a);e.preventDefault();j&&history.pushState({i:a},"")})}):b.each(c.getItems(),function(a){a%l==0&&g(a)});c.onBeforeSeek(function(a,c){setTimeout(function(){if(!a.isDefaultPrevented()){var b=c/l;d().eq(b).length&&d().removeClass(k).eq(b).addClass(k)}},1)});c.onAddItem(function(a,b){var d=c.getItems().index(b);d%l==0&&g(d)})});return a.api?f:this}})(jQuery);(function(d){function n(c,a,b){var e=this,l=c.add(this),g=c.find(b.tabs),f=a.jquery?a:c.children(a),i;g.length||(g=c.children());f.length||(f=c.parent().find(a));f.length||(f=d(a));d.extend(this,{click:function(a,h){var f=g.eq(a),j=!c.data("tabs");"string"==typeof a&&a.replace("#","")&&(f=g.filter('[href*="'+a.replace("#","")+'"]'),a=Math.max(g.index(f),0));if(b.rotate){var k=g.length-1;if(0>a)return e.click(k,h);if(a>k)return e.click(0,h)}if(!f.length){if(0<=i)return e;a=b.initialIndex;f=g.eq(a)}if(a===
i)return e;h=h||d.Event();h.type="onBeforeClick";l.trigger(h,[a]);if(!h.isDefaultPrevented())return m[j?b.initialEffect&&b.effect||"default":b.effect].call(e,a,function(){i=a;h.type="onClick";l.trigger(h,[a])}),g.removeClass(b.current),f.addClass(b.current),e},getConf:function(){return b},getTabs:function(){return g},getPanes:function(){return f},getCurrentPane:function(){return f.eq(i)},getCurrentTab:function(){return g.eq(i)},getIndex:function(){return i},next:function(){return e.click(i+1)},prev:function(){return e.click(i-
1)},destroy:function(){g.off(b.event).removeClass(b.current);f.find('a[href^="#"]').off("click.T");return e}});d.each(["onBeforeClick","onClick"],function(a,c){if(d.isFunction(b[c]))d(e).on(c,b[c]);e[c]=function(a){if(a)d(e).on(c,a);return e}});b.history&&d.fn.history&&(d.tools.history.init(g),b.event="history");g.each(function(a){d(this).on(b.event,function(b){e.click(a,b);return b.preventDefault()})});f.find('a[href^="#"]').on("click.T",function(a){e.click(d(this).attr("href"),a)});location.hash&&
"a"==b.tabs&&c.find('[href="'+location.hash+'"]').length?e.click(location.hash):(0===b.initialIndex||0<b.initialIndex)&&e.click(b.initialIndex)}d.tools=d.tools||{version:"@VERSION"};d.tools.tabs={conf:{tabs:"a",current:"current",onBeforeClick:null,onClick:null,effect:"default",initialEffect:!1,initialIndex:0,event:"click",rotate:!1,slideUpSpeed:400,slideDownSpeed:400,history:!1},addEffect:function(c,a){m[c]=a}};var m={"default":function(c,a){this.getPanes().hide().eq(c).show();a.call()},fade:function(c,
a){var b=this.getConf(),e=b.fadeOutSpeed,d=this.getPanes();e?d.fadeOut(e):d.hide();d.eq(c).fadeIn(b.fadeInSpeed,a)},slide:function(c,a){var b=this.getConf();this.getPanes().slideUp(b.slideUpSpeed);this.getPanes().eq(c).slideDown(b.slideDownSpeed,a)},ajax:function(c,a){this.getPanes().eq(0).load(this.getTabs().eq(c).attr("href"),a)}},j,k;d.tools.tabs.addEffect("horizontal",function(c,a){if(!j){var b=this.getPanes().eq(c),e=this.getCurrentPane();k||(k=this.getPanes().eq(0).width());j=!0;b.show();e.animate({width:0},
{step:function(a){b.css("width",k-a)},complete:function(){d(this).hide();a.call();j=!1}});e.length||(a.call(),j=!1)}});d.fn.tabs=function(c,a){var b=this.data("tabs");b&&(b.destroy(),this.removeData("tabs"));d.isFunction(a)&&(a={onBeforeClick:a});a=d.extend({},d.tools.tabs.conf,a);this.each(function(){b=new n(d(this),c,a);d(this).data("tabs",b)});return a.api?b:this}})(jQuery);(function(d){function n(c,a){function h(a){var b=d(a);return 2>b.length?b:c.parent().find(a)}function i(){g=setTimeout(function(){e.next()},a.interval)}var b=this,f=c.add(this),e=c.data("tabs"),g,j=!0,m=h(a.next).click(function(){e.next()}),k=h(a.prev).click(function(){e.prev()});d.extend(b,{getTabs:function(){return e},getConf:function(){return a},play:function(){if(g)return b;var a=d.Event("onBeforePlay");f.trigger(a);if(a.isDefaultPrevented())return b;j=!1;f.trigger("onPlay");f.on("onClick",i);
i();return b},pause:function(){if(!g)return b;var a=d.Event("onBeforePause");f.trigger(a);if(a.isDefaultPrevented())return b;g=clearTimeout(g);f.trigger("onPause");f.off("onClick",i);return b},resume:function(){j||b.play()},stop:function(){b.pause();j=!0}});d.each(["onBeforePlay","onPlay","onBeforePause","onPause"],function(e,c){if(d.isFunction(a[c]))d(b).on(c,a[c]);b[c]=function(a){return d(b).on(c,a)}});a.autopause&&e.getTabs().add(m).add(k).add(e.getPanes()).hover(b.pause,b.resume);a.autoplay&&
b.play();a.clickable&&e.getPanes().click(function(){e.next()});if(!e.getConf().rotate){var l=a.disabledClass;e.getIndex()||k.addClass(l);e.onBeforeClick(function(a,b){k.toggleClass(l,!b);m.toggleClass(l,b==e.getTabs().length-1)})}}var h;h=d.tools.tabs.slideshow={conf:{next:".forward",prev:".backward",disabledClass:"disabled",autoplay:!1,autopause:!0,interval:3E3,clickable:!0,api:!1}};d.fn.slideshow=function(c){var a=this.data("slideshow");if(a)return a;c=d.extend({},h.conf,c);this.each(function(){a=
new n(d(this),c);d(this).data("slideshow",a)});return c.api?a:this}})(jQuery);(function(b){function j(){if(b.browser.msie){var a=b(document).height(),c=b(window).height();return[window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,20>a-c?c:a]}return[b(document).width(),b(document).height()]}function g(a){if(a)return a.call(b.mask)}b.tools=b.tools||{version:"@VERSION"};var k;k=b.tools.expose={conf:{maskId:"exposeMask",loadSpeed:"slow",closeSpeed:"fast",closeOnClick:!0,closeOnEsc:!0,zIndex:9998,opacity:0.8,startOpacity:0,color:"#fff",onLoad:null,
onClose:null}};var c,h,d,e,i;b.mask={load:function(a,f){if(d)return this;"string"==typeof a&&(a={color:a});a=a||e;e=a=b.extend(b.extend({},k.conf),a);c=b("#"+a.maskId);c.length||(c=b("<div/>").attr("id",a.maskId),b("body").append(c));var l=j();c.css({position:"absolute",top:0,left:0,width:l[0],height:l[1],display:"none",opacity:a.startOpacity,zIndex:a.zIndex});a.color&&c.css("backgroundColor",a.color);if(!1===g(a.onBeforeLoad))return this;if(a.closeOnEsc)b(document).on("keydown.mask",function(a){a.keyCode==
27&&b.mask.close(a)});if(a.closeOnClick)c.on("click.mask",function(a){b.mask.close(a)});b(window).on("resize.mask",function(){b.mask.fit()});f&&f.length&&(i=f.eq(0).css("zIndex"),b.each(f,function(){var a=b(this);/relative|absolute|fixed/i.test(a.css("position"))||a.css("position","relative")}),h=f.css({zIndex:Math.max(a.zIndex+1,"auto"==i?0:i)}));c.css({display:"block"}).fadeTo(a.loadSpeed,a.opacity,function(){b.mask.fit();g(a.onLoad);d="full"});d=!0;return this},close:function(){if(d){if(!1===g(e.onBeforeClose))return this;
c.fadeOut(e.closeSpeed,function(){g(e.onClose);h&&h.css({zIndex:i});d=!1});b(document).off("keydown.mask");c.off("click.mask");b(window).off("resize.mask")}return this},fit:function(){if(d){var a=j();c.css({width:a[0],height:a[1]})}},getMask:function(){return c},isLoaded:function(a){return a?"full"==d:d},getConf:function(){return e},getExposed:function(){return h}};b.fn.mask=function(a){b.mask.load(a);return this};b.fn.expose=function(a){b.mask.load(a,this);return this}})(jQuery);(function(){function h(a,b){if(b)for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);return a}function k(a,b){var c=[],d;for(d in a)a.hasOwnProperty(d)&&(c[d]=b(a[d]));return c}function l(a,b,c){if(e.isSupported(b.version))a.innerHTML=e.getHTML(b,c);else if(b.expressInstall&&e.isSupported([6,65]))a.innerHTML=e.getHTML(h(b,{src:b.expressInstall}),{MMredirectURL:location.href,MMplayerType:"PlugIn",MMdoctitle:document.title});else if(a.innerHTML.replace(/\s/g,"")||(a.innerHTML="<h2>Flash version "+b.version+
" or greater is required</h2><h3>"+(0<f[0]?"Your version is "+f:"You have no flash plugin installed")+"</h3>"+("A"==a.tagName?"<p>Click here to download latest version</p>":"<p>Download latest version from <a href='"+j+"'>here</a></p>"),"A"==a.tagName&&(a.onclick=function(){location.href=j})),b.onFail){var d=b.onFail.call(this);"string"==typeof d&&(a.innerHTML=d)}i&&(window[b.id]=document.getElementById(b.id));h(this,{getRoot:function(){return a},getOptions:function(){return b},getConf:function(){return c},
getApi:function(){return a.firstChild}})}var i=document.all,j="http://www.adobe.com/go/getflashplayer",m="function"==typeof jQuery,n=/(\d+)[^\d]+(\d+)[^\d]*(\d*)/,g={width:"100%",height:"100%",id:"_"+(""+Math.random()).slice(9),allowfullscreen:!0,allowscriptaccess:"always",quality:"high",version:[3,0],onFail:null,expressInstall:null,w3c:!1,cachebusting:!1};window.attachEvent&&window.attachEvent("onbeforeunload",function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){}});
window.flashembed=function(a,b,c){"string"==typeof a&&(a=document.getElementById(a.replace("#","")));if(a)return"string"==typeof b&&(b={src:b}),new l(a,h(h({},g),b),c)};var e=h(window.flashembed,{conf:g,getVersion:function(){var a,b;try{b=navigator.plugins["Shockwave Flash"].description.slice(16)}catch(c){try{b=(a=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7"))&&a.GetVariable("$version")}catch(d){try{b=(a=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6"))&&a.GetVariable("$version")}catch(e){}}}return(b=
n.exec(b))?[b[1],b[3]]:[0,0]},asString:function(a){if(null===a||void 0===a)return null;var b=typeof a;"object"==b&&a.push&&(b="array");switch(b){case "string":return a=a.replace(RegExp('(["\\\\])',"g"),"\\$1"),a=a.replace(/^\s?(\d+\.?\d*)%/,"$1pct"),'"'+a+'"';case "array":return"["+k(a,function(a){return e.asString(a)}).join(",")+"]";case "function":return'"function()"';case "object":var b=[],c;for(c in a)a.hasOwnProperty(c)&&b.push('"'+c+'":'+e.asString(a[c]));return"{"+b.join(",")+"}"}return(""+
a).replace(/\s/g," ").replace(/\'/g,'"')},getHTML:function(a,b){var a=h({},a),c='<object width="'+a.width+'" height="'+a.height+'" id="'+a.id+'" name="'+a.id+'"';a.cachebusting&&(a.src+=(-1!=a.src.indexOf("?")?"&":"?")+Math.random());c=a.w3c||!i?c+(' data="'+a.src+'" type="application/x-shockwave-flash"'):c+' classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"';c+=">";if(a.w3c||i)c+='<param name="movie" value="'+a.src+'" />';a.width=a.height=a.id=a.w3c=a.src=null;a.onFail=a.version=a.expressInstall=
null;for(var d in a)a[d]&&(c+='<param name="'+d+'" value="'+a[d]+'" />');d="";if(b){for(var f in b)if(b[f]){var g=b[f];d+=f+"="+encodeURIComponent(/function|object/.test(typeof g)?e.asString(g):g)+"&"}d=d.slice(0,-1);c+='<param name="flashvars" value=\''+d+"' />"}return c+"</object>"},isSupported:function(a){return f[0]>a[0]||f[0]==a[0]&&f[1]>=a[1]}}),f=e.getVersion();m&&(jQuery.tools=jQuery.tools||{version:"@VERSION"},jQuery.tools.flashembed={conf:g},jQuery.fn.flashembed=function(a,b){return this.each(function(){jQuery(this).data("flashembed",
flashembed(this,a,b))})})})();(function(a){function g(a){if(a){var b=d.contentWindow.document;b.open().close();b.location.hash=a}}var f,d,e,h;a.tools=a.tools||{version:"@VERSION"};a.tools.history={init:function(c){h||(a.browser.msie&&"8">a.browser.version?d||(d=a("<iframe/>").attr("src","javascript:false;").hide().get(0),a("body").append(d),setInterval(function(){var b=d.contentWindow.document.location.hash;f!==b&&a(window).trigger("hash",b)},100),g(location.hash||"#")):setInterval(function(){var b=location.hash;b!==f&&a(window).trigger("hash",
b)},100),e=!e?c:e.add(c),c.click(function(b){var c=a(this).attr("href");d&&g(c);if(c.slice(0,1)!="#"){location.href="#"+c;return b.preventDefault()}}),h=!0)}};a(window).on("hash",function(c,b){b?e.filter(function(){var c=a(this).attr("href");return c==b||c==b.replace("#","")}).trigger("history",[b]):e.eq(0).trigger("history",[b]);f=b});a.fn.history=function(c){a.tools.history.init(this);return this.on("history",c)}})(jQuery);(function(b){function c(a){switch(a.type){case "mousemove":return b.extend(a.data,{clientX:a.clientX,clientY:a.clientY,pageX:a.pageX,pageY:a.pageY});case "DOMMouseScroll":b.extend(a,a.data);a.delta=-a.detail/3;break;case "mousewheel":a.delta=a.wheelDelta/120}a.type="wheel";return b.event.handle.call(this,a,a.delta)}b.fn.mousewheel=function(a){return this[a?"on":"trigger"]("wheel",a)};b.event.special.wheel={setup:function(){b.event.add(this,d,c,{})},teardown:function(){b.event.remove(this,d,c)}};var d=
!b.browser.mozilla?"mousewheel":"DOMMouseScroll"+("1.9">b.browser.version?" mousemove":"")})(jQuery);(function(e){function p(a,b,d){var f=d.relative?a.position().top:a.offset().top,c=d.relative?a.position().left:a.offset().left,h=d.position[0],f=f-(b.outerHeight()-d.offset[0]),c=c+(a.outerWidth()+d.offset[1]);/iPad/i.test(navigator.userAgent)&&(f-=e(window).scrollTop());var i=b.outerHeight()+a.outerHeight();"center"==h&&(f+=i/2);"bottom"==h&&(f+=i);h=d.position[1];a=b.outerWidth()+a.outerWidth();"center"==h&&(c-=a/2);"left"==h&&(c-=a);return{top:f,left:c}}function n(a,b){var d=this,f=a.add(d),c,
h=0,i=0,m=a.attr("title"),q=a.attr("data-tooltip"),r=o[b.effect],l,s=a.is(":input"),n=s&&a.is(":checkbox, :radio, select, :button, :submit"),t=a.attr("type"),j=b.events[t]||b.events[s?n?"widget":"input":"def"];if(!r)throw'Nonexistent effect "'+b.effect+'"';j=j.split(/,\s*/);if(2!=j.length)throw"Tooltip: bad events configuration for "+t;a.on(j[0],function(a){clearTimeout(h);b.predelay?i=setTimeout(function(){d.show(a)},b.predelay):d.show(a)}).on(j[1],function(a){clearTimeout(i);b.delay?h=setTimeout(function(){d.hide(a)},
b.delay):d.hide(a)});m&&b.cancelDefault&&(a.removeAttr("title"),a.data("title",m));e.extend(d,{show:function(k){if(!c){if(q)c=e(q);else if(b.tip)c=e(b.tip).eq(0);else if(m)c=e(b.layout).addClass(b.tipClass).appendTo(document.body).hide().append(m);else{c=a.next();c.length||(c=a.parent().next())}if(!c.length)throw"Cannot find tooltip for "+a;}if(d.isShown())return d;c.stop(true,true);var g=p(a,c,b);b.tip&&c.html(a.data("title"));k=e.Event();k.type="onBeforeShow";f.trigger(k,[g]);if(k.isDefaultPrevented())return d;
g=p(a,c,b);c.css({position:"absolute",top:g.top,left:g.left});l=true;r[0].call(d,function(){k.type="onShow";l="full";f.trigger(k)});g=b.events.tooltip.split(/,\s*/);if(!c.data("__set")){c.off(g[0]).on(g[0],function(){clearTimeout(h);clearTimeout(i)});if(g[1]&&!a.is("input:not(:checkbox, :radio), textarea"))c.off(g[1]).on(g[1],function(b){b.relatedTarget!=a[0]&&a.trigger(j[1].split(" ")[0])});b.tip||c.data("__set",true)}return d},hide:function(a){if(!c||!d.isShown())return d;a=e.Event();a.type="onBeforeHide";
f.trigger(a);if(!a.isDefaultPrevented()){l=false;o[b.effect][1].call(d,function(){a.type="onHide";f.trigger(a)});return d}},isShown:function(a){return a?l=="full":l},getConf:function(){return b},getTip:function(){return c},getTrigger:function(){return a}});e.each(["onHide","onBeforeShow","onShow","onBeforeHide"],function(a,c){if(e.isFunction(b[c]))e(d).on(c,b[c]);d[c]=function(a){if(a)e(d).on(c,a);return d}})}e.tools=e.tools||{version:"@VERSION"};e.tools.tooltip={conf:{effect:"toggle",fadeOutSpeed:"fast",
predelay:0,delay:30,opacity:1,tip:0,fadeIE:!1,position:["top","center"],offset:[0,0],relative:!1,cancelDefault:!0,events:{def:"mouseenter,mouseleave",input:"focus,blur",widget:"focus mouseenter,blur mouseleave",tooltip:"mouseenter,mouseleave"},layout:"<div/>",tipClass:"tooltip"},addEffect:function(a,b,d){o[a]=[b,d]}};var o={toggle:[function(a){var b=this.getConf(),d=this.getTip(),b=b.opacity;1>b&&d.css({opacity:b});d.show();a.call()},function(a){this.getTip().hide();a.call()}],fade:[function(a){var b=
this.getConf();!e.browser.msie||b.fadeIE?this.getTip().fadeTo(b.fadeInSpeed,b.opacity,a):(this.getTip().show(),a())},function(a){var b=this.getConf();!e.browser.msie||b.fadeIE?this.getTip().fadeOut(b.fadeOutSpeed,a):(this.getTip().hide(),a())}]};e.fn.tooltip=function(a){var b=this.data("tooltip");if(b)return b;a=e.extend(!0,{},e.tools.tooltip.conf,a);"string"==typeof a.position&&(a.position=a.position.split(/,?\s/));this.each(function(){b=new n(e(this),a);e(this).data("tooltip",b)});return a.api?
b:this}})(jQuery);(function(c){var i=c.tools.tooltip;i.dynamic={conf:{classNames:"top right bottom left"}};c.fn.dynamic=function(f){"number"==typeof f&&(f={speed:f});var f=c.extend({},i.dynamic.conf,f),l=c.extend(!0,{},f),j=f.classNames.split(/\s/),e;this.each(function(){var h=c(this).tooltip().onBeforeShow(function(f,h){var d=this.getTip(),a=this.getConf();e||(e=[a.position[0],a.position[1],a.offset[0],a.offset[1],c.extend({},a)]);c.extend(a,e[4]);a.position=[e[0],e[1]];a.offset=[e[2],e[3]];d.css({visibility:"hidden",
position:"absolute",top:h.top,left:h.left}).show();var k=c.extend(!0,{},l),b;b=c(window);var g=b.width()+b.scrollLeft(),i=b.height()+b.scrollTop();b=[d.offset().top<=b.scrollTop(),g<=d.offset().left+d.width(),i<=d.offset().top+d.height(),b.scrollLeft()>=d.offset().left];a:{for(g=b.length;g--;)if(b[g]){g=!1;break a}g=!0}if(!g){b[2]&&(c.extend(a,k.top),a.position[0]="top",d.addClass(j[0]));b[3]&&(c.extend(a,k.right),a.position[1]="right",d.addClass(j[1]));b[0]&&(c.extend(a,k.bottom),a.position[0]="bottom",
d.addClass(j[2]));b[1]&&(c.extend(a,k.left),a.position[1]="left",d.addClass(j[3]));if(b[0]||b[2])a.offset[0]*=-1;if(b[1]||b[3])a.offset[1]*=-1}d.css({visibility:"visible"}).hide()});h.onBeforeShow(function(){var c=this.getConf();this.getTip();setTimeout(function(){c.position=[e[0],e[1]];c.offset=[e[2],e[3]]},0)});h.onHide(function(){this.getTip().removeClass(f.classNames)});ret=h});return f.api?ret:this}})(jQuery);(function(b){var e=b.tools.tooltip;b.extend(e.conf,{direction:"up",bounce:!1,slideOffset:10,slideInSpeed:200,slideOutSpeed:200,slideFade:!b.browser.msie});var f={up:["-","top"],down:["+","top"],left:["-","left"],right:["+","left"]};e.addEffect("slide",function(b){var a=this.getConf(),g=this.getTip(),c=a.slideFade?{opacity:a.opacity}:{},d=f[a.direction]||f.up;c[d[1]]=d[0]+"="+a.slideOffset;a.slideFade&&g.css({opacity:0});g.show().animate(c,a.slideInSpeed,b)},function(e){var a=this.getConf(),g=a.slideOffset,
c=a.slideFade?{opacity:0}:{},d=f[a.direction]||f.up,h=""+d[0];a.bounce&&(h="+"==h?"-":"+");c[d[1]]=h+"="+g;this.getTip().animate(c,a.slideOutSpeed,function(){b(this).hide();e.call()})})})(jQuery);(function(c){function i(b,a,f){var a=c(a).first()||a,d=b.offset().top,e=b.offset().left,g=f.position.split(/,?\s+/),j=g[0],g=g[1],d=d-(a.outerHeight()-f.offset[0]),e=e+(b.outerWidth()+f.offset[1]);/iPad/i.test(navigator.userAgent)&&(d-=c(window).scrollTop());f=a.outerHeight()+b.outerHeight();"center"==j&&(d+=f/2);"bottom"==j&&(d+=f);b=b.outerWidth();"center"==g&&(e-=(b+a.outerWidth())/2);"left"==g&&(e-=b);return{top:d,left:e}}function q(b){function a(){return this.getAttribute("type")==b}a.key='[type="'+
b+'"]';return a}function n(b,a,f){function p(a,b,e){if(f.grouped||!a.length){var g;!1===e||c.isArray(e)?(g=d.messages[b.key||b]||d.messages["*"],g=g[f.lang]||d.messages["*"].en,(b=g.match(/\$\d/g))&&c.isArray(e)&&c.each(b,function(a){g=g.replace(this,e[a])})):g=e[f.lang]||e;a.push(g)}}var e=this,g=a.add(e),b=b.not(":button, :image, :reset, :submit");a.attr("novalidate","novalidate");c.extend(e,{getConf:function(){return f},getForm:function(){return a},getInputs:function(){return b},reflow:function(){b.each(function(){var a=
c(this),b=a.data("msg.el");b&&(a=i(a,b,f),b.css({top:a.top,left:a.left}))});return e},invalidate:function(a,h){if(!h){var d=[];c.each(a,function(a,f){var c=b.filter("[name='"+a+"']");c.length&&(c.trigger("OI",[f]),d.push({input:c,messages:[f]}))});a=d;h=c.Event()}h.type="onFail";g.trigger(h,[a]);h.isDefaultPrevented()||l[f.effect][0].call(e,a,h);return e},reset:function(a){a=a||b;a.removeClass(f.errorClass).each(function(){var a=c(this).data("msg.el");a&&(a.remove(),c(this).data("msg.el",null))}).off(f.errorInputEvent+
".v"||"");return e},destroy:function(){a.off(f.formEvent+".V reset.V");b.off(f.inputEvent+".V change.V");return e.reset()},checkValidity:function(a,h){var a=a||b,a=a.not(":disabled"),d={},a=a.filter(function(){var a=c(this).attr("name");if(!d[a])return d[a]=!0,c(this)});if(!a.length)return!0;h=h||c.Event();h.type="onBeforeValidate";g.trigger(h,[a]);if(h.isDefaultPrevented())return h.result;var k=[];a.each(function(){var a=[],b=c(this).data("messages",a),d=m&&b.is(":date")?"onHide.v":f.errorInputEvent+
".v";b.off(d);c.each(o,function(){var c=this[0];if(b.filter(c).length){var d=this[1].call(e,b,b.val());if(!0!==d){h.type="onBeforeFail";g.trigger(h,[b,c]);if(h.isDefaultPrevented())return!1;var j=b.attr(f.messageAttr);if(j)return a=[j],!1;p(a,c,d)}}});if(a.length&&(k.push({input:b,messages:a}),b.trigger("OI",[a]),f.errorInputEvent))b.on(d,function(a){e.checkValidity(b,a)});if(f.singleError&&k.length)return!1});var i=l[f.effect];if(!i)throw'Validator: cannot find effect "'+f.effect+'"';if(k.length)return e.invalidate(k,
h),!1;i[1].call(e,a,h);h.type="onSuccess";g.trigger(h,[a]);a.off(f.errorInputEvent+".v");return!0}});c.each(["onBeforeValidate","onBeforeFail","onFail","onSuccess"],function(a,b){if(c.isFunction(f[b]))c(e).on(b,f[b]);e[b]=function(a){if(a)c(e).on(b,a);return e}});if(f.formEvent)a.on(f.formEvent+".V",function(b){if(!e.checkValidity(null,b))return b.preventDefault();b.target=a;b.type=f.formEvent});a.on("reset.V",function(){e.reset()});b[0]&&b[0].validity&&b.each(function(){this.oninvalid=function(){return!1}});
a[0]&&(a[0].checkValidity=e.checkValidity);if(f.inputEvent)b.on(f.inputEvent+".V",function(a){e.checkValidity(c(this),a)});b.filter(":checkbox, select").filter("[required]").on("change.V",function(a){var b=c(this);(this.checked||b.is("select")&&c(this).val())&&l[f.effect][1].call(e,b,a)});b.filter(":radio[required]").on("change.V",function(a){var b=c("[name='"+c(a.srcElement).attr("name")+"']");b!=null&&b.length!=0&&e.checkValidity(b,a)});c(window).resize(function(){e.reflow()})}c.tools=c.tools||
{version:"@VERSION"};var r=/\[type=([a-z]+)\]/,s=/^-?[0-9]*(\.[0-9]+)?$/,m=c.tools.dateinput,t=/^([a-z0-9_\.\-\+]+)@([\da-z\.\-]+)\.([a-z\.]{2,6})$/i,u=/^(https?:\/\/)?[\da-z\.\-]+\.[a-z\.]{2,6}[#&+_\?\/\w \.\-=]*$/i,d;d=c.tools.validator={conf:{grouped:!1,effect:"default",errorClass:"invalid",inputEvent:null,errorInputEvent:"keyup",formEvent:"submit",lang:"en",message:"<div/>",messageAttr:"data-message",messageClass:"error",offset:[0,0],position:"center right",singleError:!1,speed:"normal"},messages:{"*":{en:"Please correct this value"}},
localize:function(b,a){c.each(a,function(a,c){d.messages[a]=d.messages[a]||{};d.messages[a][b]=c})},localizeFn:function(b,a){d.messages[b]=d.messages[b]||{};c.extend(d.messages[b],a)},fn:function(b,a,f){c.isFunction(a)?f=a:("string"==typeof a&&(a={en:a}),this.messages[b.key||b]=a);(a=r.exec(b))&&(b=q(a[1]));o.push([b,f])},addEffect:function(b,a,f){l[b]=[a,f]}};var o=[],l={"default":[function(b){var a=this.getConf();c.each(b,function(b,d){var e=d.input;e.addClass(a.errorClass);var g=e.data("msg.el");
g||(g=c(a.message).addClass(a.messageClass).appendTo(document.body),e.data("msg.el",g));g.css({visibility:"hidden"}).find("p").remove();c.each(d.messages,function(a,b){c("<p/>").html(b).appendTo(g)});g.outerWidth()==g.parent().width()&&g.add(g.find("p")).css({display:"inline"});e=i(e,g,a);g.css({visibility:"visible",position:"absolute",top:e.top,left:e.left}).fadeIn(a.speed)})},function(b){var a=this.getConf();b.removeClass(a.errorClass).each(function(){var a=c(this).data("msg.el");a&&a.css({visibility:"hidden"})})}]};
c.each(["email","url","number"],function(b,a){c.expr[":"][a]=function(b){return b.getAttribute("type")===a}});c.fn.oninvalid=function(b){return this[b?"on":"trigger"]("OI",b)};d.fn(":email","Please enter a valid email address",function(b,a){return!a||t.test(a)});d.fn(":url","Please enter a valid URL",function(b,a){return!a||u.test(a)});d.fn(":number","Please enter a numeric value.",function(b,a){return s.test(a)});d.fn("[max]","Please enter a value no larger than $1",function(b,a){if(""===a||m&&b.is(":date"))return!0;
var c=b.attr("max");return parseFloat(a)<=parseFloat(c)?!0:[c]});d.fn("[min]","Please enter a value of at least $1",function(b,a){if(""===a||m&&b.is(":date"))return!0;var c=b.attr("min");return parseFloat(a)>=parseFloat(c)?!0:[c]});d.fn("[required]","Please complete this mandatory field.",function(b,a){return b.is(":checkbox")?b.is(":checked"):!!a});d.fn("[pattern]",function(b,a){return""===a||RegExp("^"+b.attr("pattern")+"$").test(a)});d.fn(":radio","Please select an option.",function(b){var a=!1;
c("[name='"+b.attr("name")+"']").each(function(b,d){c(d).is(":checked")&&(a=!0)});return a?!0:!1});c.fn.validator=function(b){var a=this.data("validator");a&&(a.destroy(),this.removeData("validator"));b=c.extend(!0,{},d.conf,b);if(this.is("form"))return this.each(function(){var d=c(this);a=new n(d.find(":input"),d,b);d.data("validator",a)});a=new n(this,this.eq(0).closest("form"),b);return this.data("validator",a)}})(jQuery);
|
html/node_modules/bs-recipes/recipes/webpack.react-hot-loader/app/js/main.js | HashtagTeamName/q | import React from 'react';
// It's important to not define HelloWorld component right in this file
// because in that case it will do full page reload on change
import HelloWorld from './HelloWorld.jsx';
React.render(<HelloWorld />, document.getElementById('react-root'));
|
app/javascript/client_messenger/messageWindow.js | michelson/chaskiq | import React from 'react'
import styled from '@emotion/styled'
const theme = {
desaturation: 0,
lightness: 0,
hue: 0,
bg: '#F7F7F7',
linkColor: '#2D77B6',
fontColor: '#1F2937',
accentColor: '#234457'
}
const IntroStyle = styled.div`
.close {
/*position: absolute;
top: 0.5rem;
right: 0.5rem;*/
position: absolute;
top: -3px;
right: 0.5rem;
}
`
const InnerStyle = styled.div`
${(props) => {
return props.theme.mode === 'dark'
? `background: rgba(0, 0, 0, 0.80);
color: rgba(200, 200, 200, 0.80);` : ''
}}
position: relative;
overflow: hidden;
overflow-y: auto;
img {
width: 100%;
}
code {
font-size: 1rem;
}
.close a {
display: inline-block;
padding: 0.5rem;
color: #DEA007;
font-size: 0.8rem;
text-transform: uppercase;
font-family: sans-serif;
}
small {
display: inline-block;
padding: 0;
cursor: grab;
}
blockquote {
opacity: 0.80;
border-left: 2px solid ${theme.bg};
code {
line-height: 1.1;
color: ${theme.bg}
}
}
.btn {
color: ${theme.bg};
&:hover {
box-shadow: none;
color: ${theme.bg};
}
}
`
const Header = styled.div`
${(props) => {
return props.theme.mode === 'dark'
? '' : `
background: rgba(253, 253, 253, 0.9);
box-shadow: 0px 0px 3px 0px #eaeaea;
`
}}
position: -webkit-sticky;
position: fixed;
top: 9px;
z-index: 1;
width: 96vw;
`
const Content = styled.div`
/*height: 300px;*/
padding: 1rem;
`
export default class Quest extends React.Component {
constructor (props) {
super(props)
this.state = {
isMinimized: false
}
}
render () {
return <IntroStyle>
<InnerStyle>
<Header>
</Header>
<Content>
{this.props.children}
</Content>
</InnerStyle>
</IntroStyle>
}
}
|
src/app/js/icons/TemplateIcon.js | AppSaloon/socket.io-tester | import React from 'react'
const TemplateIcon = ({size, color, customStyle, viewBox, children}) =>
<svg
style={{
height: size,
fill: color,
...customStyle
}}
version="1.1"
x="0px"
y="0px"
viewBox={viewBox}
>
{children}
</svg>
export default TemplateIcon
|
index.android.js | mrphu3074/react-native-bootstrap | import React from 'react';
import { AppRegistry } from 'react-native';
import RootApp from './src/RootApp'
AppRegistry.registerComponent('RNBootstrap', () => RootApp);
|
packages/material-ui-icons/src/WeekendSharp.js | allanalexandre/material-ui | import React from 'react';
import createSvgIcon from './utils/createSvgIcon';
export default createSvgIcon(
<React.Fragment><path fill="none" d="M0 0h24v24H0V0z" /><path d="M6 9.03V14h12V9.03h2V5H4v4.03z" /><path d="M19 15H5v-4.97H1V19h22v-8.97h-4z" /></React.Fragment>
, 'WeekendSharp');
|
ajax/libs/bootstrap-material-design/4.0.0-alpha/bootstrap-material-design.iife.js | extend1994/cdnjs | /*!
* Bootstrap Material Design v4.0.0-alpha (https://github.com/FezVrasta/bootstrap-material-design)
* Copyright 2014-2016 Federico Zivolo
* Licensed under MIT (https://github.com/FezVrasta/bootstrap-material-design/blob/master/LICENSE)
*/
(function () {
'use strict';
var __commonjs_global = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : this;
function __commonjs(fn, module) { return module = { exports: {} }, fn(module, module.exports, __commonjs_global), module.exports; }
var babelHelpers = {};
babelHelpers.typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
return typeof obj;
} : function (obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj;
};
babelHelpers.classCallCheck = function (instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
};
babelHelpers.createClass = function () {
function defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
return function (Constructor, protoProps, staticProps) {
if (protoProps) defineProperties(Constructor.prototype, protoProps);
if (staticProps) defineProperties(Constructor, staticProps);
return Constructor;
};
}();
babelHelpers.get = function get(object, property, receiver) {
if (object === null) object = Function.prototype;
var desc = Object.getOwnPropertyDescriptor(object, property);
if (desc === undefined) {
var parent = Object.getPrototypeOf(object);
if (parent === null) {
return undefined;
} else {
return get(parent, property, receiver);
}
} else if ("value" in desc) {
return desc.value;
} else {
var getter = desc.get;
if (getter === undefined) {
return undefined;
}
return getter.call(receiver);
}
};
babelHelpers.inherits = function (subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
}
subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: {
value: subClass,
enumerable: false,
writable: true,
configurable: true
}
});
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
};
babelHelpers.possibleConstructorReturn = function (self, call) {
if (!self) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return call && (typeof call === "object" || typeof call === "function") ? call : self;
};
babelHelpers;
var polyfill=__commonjs(function(module,exports,global){(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f;}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e);},l,l.exports,e,t,n,r);}return n[o].exports;}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++){s(r[o]);}return s;})({1:[function(_dereq_,module,exports){(function(global){ /* eslint max-len: 0 */"use strict";var _Object$defineProperty=_dereq_(3)["default"];_dereq_(284);_dereq_(2); // Should be removed in the next major release:
_dereq_(6);if(global._babelPolyfill){throw new Error("only one instance of babel-polyfill is allowed");}global._babelPolyfill=true;function define(O,key,value){O[key]||_Object$defineProperty(O,key,{writable:true,configurable:true,value:value});}define(String.prototype,"padLeft","".padStart);define(String.prototype,"padRight","".padEnd);"pop,reverse,shift,keys,values,entries,indexOf,every,some,forEach,map,filter,find,findIndex,includes,join,slice,concat,push,splice,unshift,sort,lastIndexOf,reduce,reduceRight,copyWithin,fill".split(",").forEach(function(key){[][key]&&define(Array,key,Function.call.bind([][key]));});}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{});},{"2":2,"284":284,"3":3,"6":6}],2:[function(_dereq_,module,exports){module.exports=_dereq_(285);},{"285":285}],3:[function(_dereq_,module,exports){module.exports={"default":_dereq_(4),__esModule:true};},{"4":4}],4:[function(_dereq_,module,exports){var $=_dereq_(5);module.exports=function defineProperty(it,key,desc){return $.setDesc(it,key,desc);};},{"5":5}],5:[function(_dereq_,module,exports){var $Object=Object;module.exports={create:$Object.create,getProto:$Object.getPrototypeOf,isEnum:{}.propertyIsEnumerable,getDesc:$Object.getOwnPropertyDescriptor,setDesc:$Object.defineProperty,setDescs:$Object.defineProperties,getKeys:$Object.keys,getNames:$Object.getOwnPropertyNames,getSymbols:$Object.getOwnPropertySymbols,each:[].forEach};},{}],6:[function(_dereq_,module,exports){_dereq_(118);module.exports=_dereq_(26).RegExp.escape;},{"118":118,"26":26}],7:[function(_dereq_,module,exports){module.exports=function(it){if(typeof it!='function')throw TypeError(it+' is not a function!');return it;};},{}],8:[function(_dereq_,module,exports){var cof=_dereq_(21);module.exports=function(it,msg){if(typeof it!='number'&&cof(it)!='Number')throw TypeError(msg);return +it;};},{"21":21}],9:[function(_dereq_,module,exports){ // 22.1.3.31 Array.prototype[@@unscopables]
var UNSCOPABLES=_dereq_(115)('unscopables'),ArrayProto=Array.prototype;if(ArrayProto[UNSCOPABLES]==undefined)_dereq_(41)(ArrayProto,UNSCOPABLES,{});module.exports=function(key){ArrayProto[UNSCOPABLES][key]=true;};},{"115":115,"41":41}],10:[function(_dereq_,module,exports){module.exports=function(it,Constructor,name,forbiddenField){if(!(it instanceof Constructor)||forbiddenField!==undefined&&forbiddenField in it){throw TypeError(name+': incorrect invocation!');}return it;};},{}],11:[function(_dereq_,module,exports){var isObject=_dereq_(50);module.exports=function(it){if(!isObject(it))throw TypeError(it+' is not an object!');return it;};},{"50":50}],12:[function(_dereq_,module,exports){ // 22.1.3.3 Array.prototype.copyWithin(target, start, end = this.length)
'use strict';var toObject=_dereq_(109),toIndex=_dereq_(105),toLength=_dereq_(108);module.exports=[].copyWithin||function copyWithin(target /*= 0*/,start /*= 0, end = @length*/){var O=toObject(this),len=toLength(O.length),to=toIndex(target,len),from=toIndex(start,len),end=arguments.length>2?arguments[2]:undefined,count=Math.min((end===undefined?len:toIndex(end,len))-from,len-to),inc=1;if(from<to&&to<from+count){inc=-1;from+=count-1;to+=count-1;}while(count-->0){if(from in O)O[to]=O[from];else delete O[to];to+=inc;from+=inc;}return O;};},{"105":105,"108":108,"109":109}],13:[function(_dereq_,module,exports){ // 22.1.3.6 Array.prototype.fill(value, start = 0, end = this.length)
'use strict';var toObject=_dereq_(109),toIndex=_dereq_(105),toLength=_dereq_(108);module.exports=function fill(value /*, start = 0, end = @length */){var O=toObject(this),length=toLength(O.length),aLen=arguments.length,index=toIndex(aLen>1?arguments[1]:undefined,length),end=aLen>2?arguments[2]:undefined,endPos=end===undefined?length:toIndex(end,length);while(endPos>index){O[index++]=value;}return O;};},{"105":105,"108":108,"109":109}],14:[function(_dereq_,module,exports){var forOf=_dereq_(38);module.exports=function(iter,ITERATOR){var result=[];forOf(iter,false,result.push,result,ITERATOR);return result;};},{"38":38}],15:[function(_dereq_,module,exports){ // false -> Array#indexOf
// true -> Array#includes
var toIObject=_dereq_(107),toLength=_dereq_(108),toIndex=_dereq_(105);module.exports=function(IS_INCLUDES){return function($this,el,fromIndex){var O=toIObject($this),length=toLength(O.length),index=toIndex(fromIndex,length),value; // Array#includes uses SameValueZero equality algorithm
if(IS_INCLUDES&&el!=el)while(length>index){value=O[index++];if(value!=value)return true; // Array#toIndex ignores holes, Array#includes - not
}else for(;length>index;index++){if(IS_INCLUDES||index in O){if(O[index]===el)return IS_INCLUDES||index;}}return !IS_INCLUDES&&-1;};};},{"105":105,"107":107,"108":108}],16:[function(_dereq_,module,exports){ // 0 -> Array#forEach
// 1 -> Array#map
// 2 -> Array#filter
// 3 -> Array#some
// 4 -> Array#every
// 5 -> Array#find
// 6 -> Array#findIndex
var ctx=_dereq_(27),IObject=_dereq_(46),toObject=_dereq_(109),toLength=_dereq_(108),asc=_dereq_(18);module.exports=function(TYPE,$create){var IS_MAP=TYPE==1,IS_FILTER=TYPE==2,IS_SOME=TYPE==3,IS_EVERY=TYPE==4,IS_FIND_INDEX=TYPE==6,NO_HOLES=TYPE==5||IS_FIND_INDEX,create=$create||asc;return function($this,callbackfn,that){var O=toObject($this),self=IObject(O),f=ctx(callbackfn,that,3),length=toLength(self.length),index=0,result=IS_MAP?create($this,length):IS_FILTER?create($this,0):undefined,val,res;for(;length>index;index++){if(NO_HOLES||index in self){val=self[index];res=f(val,index,O);if(TYPE){if(IS_MAP)result[index]=res; // map
else if(res)switch(TYPE){case 3:return true; // some
case 5:return val; // find
case 6:return index; // findIndex
case 2:result.push(val); // filter
}else if(IS_EVERY)return false; // every
}}}return IS_FIND_INDEX?-1:IS_SOME||IS_EVERY?IS_EVERY:result;};};},{"108":108,"109":109,"18":18,"27":27,"46":46}],17:[function(_dereq_,module,exports){var aFunction=_dereq_(7),toObject=_dereq_(109),IObject=_dereq_(46),toLength=_dereq_(108);module.exports=function(that,callbackfn,aLen,memo,isRight){aFunction(callbackfn);var O=toObject(that),self=IObject(O),length=toLength(O.length),index=isRight?length-1:0,i=isRight?-1:1;if(aLen<2)for(;;){if(index in self){memo=self[index];index+=i;break;}index+=i;if(isRight?index<0:length<=index){throw TypeError('Reduce of empty array with no initial value');}}for(;isRight?index>=0:length>index;index+=i){if(index in self){memo=callbackfn(memo,self[index],index,O);}}return memo;};},{"108":108,"109":109,"46":46,"7":7}],18:[function(_dereq_,module,exports){ // 9.4.2.3 ArraySpeciesCreate(originalArray, length)
var isObject=_dereq_(50),isArray=_dereq_(48),SPECIES=_dereq_(115)('species');module.exports=function(original,length){var C;if(isArray(original)){C=original.constructor; // cross-realm fallback
if(typeof C=='function'&&(C===Array||isArray(C.prototype)))C=undefined;if(isObject(C)){C=C[SPECIES];if(C===null)C=undefined;}}return new (C===undefined?Array:C)(length);};},{"115":115,"48":48,"50":50}],19:[function(_dereq_,module,exports){'use strict';var aFunction=_dereq_(7),isObject=_dereq_(50),invoke=_dereq_(45),arraySlice=[].slice,factories={};var construct=function construct(F,len,args){if(!(len in factories)){for(var n=[],i=0;i<len;i++){n[i]='a['+i+']';}factories[len]=Function('F,a','return new F('+n.join(',')+')');}return factories[len](F,args);};module.exports=Function.bind||function bind(that /*, args... */){var fn=aFunction(this),partArgs=arraySlice.call(arguments,1);var bound=function bound() /* args... */{var args=partArgs.concat(arraySlice.call(arguments));return this instanceof bound?construct(fn,args.length,args):invoke(fn,args,that);};if(isObject(fn.prototype))bound.prototype=fn.prototype;return bound;};},{"45":45,"50":50,"7":7}],20:[function(_dereq_,module,exports){ // getting tag from 19.1.3.6 Object.prototype.toString()
var cof=_dereq_(21),TAG=_dereq_(115)('toStringTag') // ES3 wrong here
,ARG=cof(function(){return arguments;}())=='Arguments'; // fallback for IE11 Script Access Denied error
var tryGet=function tryGet(it,key){try{return it[key];}catch(e){ /* empty */}};module.exports=function(it){var O,T,B;return it===undefined?'Undefined':it===null?'Null' // @@toStringTag case
:typeof (T=tryGet(O=Object(it),TAG))=='string'?T // builtinTag case
:ARG?cof(O) // ES3 arguments fallback
:(B=cof(O))=='Object'&&typeof O.callee=='function'?'Arguments':B;};},{"115":115,"21":21}],21:[function(_dereq_,module,exports){var toString={}.toString;module.exports=function(it){return toString.call(it).slice(8,-1);};},{}],22:[function(_dereq_,module,exports){'use strict';var dP=_dereq_(68).f,create=_dereq_(67),hide=_dereq_(41),redefineAll=_dereq_(86),ctx=_dereq_(27),anInstance=_dereq_(10),defined=_dereq_(28),forOf=_dereq_(38),$iterDefine=_dereq_(54),step=_dereq_(56),setSpecies=_dereq_(91),DESCRIPTORS=_dereq_(29),fastKey=_dereq_(63).fastKey,SIZE=DESCRIPTORS?'_s':'size';var getEntry=function getEntry(that,key){ // fast case
var index=fastKey(key),entry;if(index!=='F')return that._i[index]; // frozen object case
for(entry=that._f;entry;entry=entry.n){if(entry.k==key)return entry;}};module.exports={getConstructor:function getConstructor(wrapper,NAME,IS_MAP,ADDER){var C=wrapper(function(that,iterable){anInstance(that,C,NAME,'_i');that._i=create(null); // index
that._f=undefined; // first entry
that._l=undefined; // last entry
that[SIZE]=0; // size
if(iterable!=undefined)forOf(iterable,IS_MAP,that[ADDER],that);});redefineAll(C.prototype,{ // 23.1.3.1 Map.prototype.clear()
// 23.2.3.2 Set.prototype.clear()
clear:function clear(){for(var that=this,data=that._i,entry=that._f;entry;entry=entry.n){entry.r=true;if(entry.p)entry.p=entry.p.n=undefined;delete data[entry.i];}that._f=that._l=undefined;that[SIZE]=0;}, // 23.1.3.3 Map.prototype.delete(key)
// 23.2.3.4 Set.prototype.delete(value)
'delete':function _delete(key){var that=this,entry=getEntry(that,key);if(entry){var next=entry.n,prev=entry.p;delete that._i[entry.i];entry.r=true;if(prev)prev.n=next;if(next)next.p=prev;if(that._f==entry)that._f=next;if(that._l==entry)that._l=prev;that[SIZE]--;}return !!entry;}, // 23.2.3.6 Set.prototype.forEach(callbackfn, thisArg = undefined)
// 23.1.3.5 Map.prototype.forEach(callbackfn, thisArg = undefined)
forEach:function forEach(callbackfn /*, that = undefined */){anInstance(this,C,'forEach');var f=ctx(callbackfn,arguments.length>1?arguments[1]:undefined,3),entry;while(entry=entry?entry.n:this._f){f(entry.v,entry.k,this); // revert to the last existing entry
while(entry&&entry.r){entry=entry.p;}}}, // 23.1.3.7 Map.prototype.has(key)
// 23.2.3.7 Set.prototype.has(value)
has:function has(key){return !!getEntry(this,key);}});if(DESCRIPTORS)dP(C.prototype,'size',{get:function get(){return defined(this[SIZE]);}});return C;},def:function def(that,key,value){var entry=getEntry(that,key),prev,index; // change existing entry
if(entry){entry.v=value; // create new entry
}else {that._l=entry={i:index=fastKey(key,true), // <- index
k:key, // <- key
v:value, // <- value
p:prev=that._l, // <- previous entry
n:undefined, // <- next entry
r:false // <- removed
};if(!that._f)that._f=entry;if(prev)prev.n=entry;that[SIZE]++; // add to index
if(index!=='F')that._i[index]=entry;}return that;},getEntry:getEntry,setStrong:function setStrong(C,NAME,IS_MAP){ // add .keys, .values, .entries, [@@iterator]
// 23.1.3.4, 23.1.3.8, 23.1.3.11, 23.1.3.12, 23.2.3.5, 23.2.3.8, 23.2.3.10, 23.2.3.11
$iterDefine(C,NAME,function(iterated,kind){this._t=iterated; // target
this._k=kind; // kind
this._l=undefined; // previous
},function(){var that=this,kind=that._k,entry=that._l; // revert to the last existing entry
while(entry&&entry.r){entry=entry.p;} // get next entry
if(!that._t||!(that._l=entry=entry?entry.n:that._t._f)){ // or finish the iteration
that._t=undefined;return step(1);} // return step by kind
if(kind=='keys')return step(0,entry.k);if(kind=='values')return step(0,entry.v);return step(0,[entry.k,entry.v]);},IS_MAP?'entries':'values',!IS_MAP,true); // add [@@species], 23.1.2.2, 23.2.2.2
setSpecies(NAME);}};},{"10":10,"27":27,"28":28,"29":29,"38":38,"41":41,"54":54,"56":56,"63":63,"67":67,"68":68,"86":86,"91":91}],23:[function(_dereq_,module,exports){ // https://github.com/DavidBruant/Map-Set.prototype.toJSON
var classof=_dereq_(20),from=_dereq_(14);module.exports=function(NAME){return function toJSON(){if(classof(this)!=NAME)throw TypeError(NAME+"#toJSON isn't generic");return from(this);};};},{"14":14,"20":20}],24:[function(_dereq_,module,exports){'use strict';var redefineAll=_dereq_(86),getWeak=_dereq_(63).getWeak,anObject=_dereq_(11),isObject=_dereq_(50),anInstance=_dereq_(10),forOf=_dereq_(38),createArrayMethod=_dereq_(16),$has=_dereq_(40),arrayFind=createArrayMethod(5),arrayFindIndex=createArrayMethod(6),id=0; // fallback for uncaught frozen keys
var uncaughtFrozenStore=function uncaughtFrozenStore(that){return that._l||(that._l=new UncaughtFrozenStore());};var UncaughtFrozenStore=function UncaughtFrozenStore(){this.a=[];};var findUncaughtFrozen=function findUncaughtFrozen(store,key){return arrayFind(store.a,function(it){return it[0]===key;});};UncaughtFrozenStore.prototype={get:function get(key){var entry=findUncaughtFrozen(this,key);if(entry)return entry[1];},has:function has(key){return !!findUncaughtFrozen(this,key);},set:function set(key,value){var entry=findUncaughtFrozen(this,key);if(entry)entry[1]=value;else this.a.push([key,value]);},'delete':function _delete(key){var index=arrayFindIndex(this.a,function(it){return it[0]===key;});if(~index)this.a.splice(index,1);return !! ~index;}};module.exports={getConstructor:function getConstructor(wrapper,NAME,IS_MAP,ADDER){var C=wrapper(function(that,iterable){anInstance(that,C,NAME,'_i');that._i=id++; // collection id
that._l=undefined; // leak store for uncaught frozen objects
if(iterable!=undefined)forOf(iterable,IS_MAP,that[ADDER],that);});redefineAll(C.prototype,{ // 23.3.3.2 WeakMap.prototype.delete(key)
// 23.4.3.3 WeakSet.prototype.delete(value)
'delete':function _delete(key){if(!isObject(key))return false;var data=getWeak(key);if(data===true)return uncaughtFrozenStore(this)['delete'](key);return data&&$has(data,this._i)&&delete data[this._i];}, // 23.3.3.4 WeakMap.prototype.has(key)
// 23.4.3.4 WeakSet.prototype.has(value)
has:function has(key){if(!isObject(key))return false;var data=getWeak(key);if(data===true)return uncaughtFrozenStore(this).has(key);return data&&$has(data,this._i);}});return C;},def:function def(that,key,value){var data=getWeak(anObject(key),true);if(data===true)uncaughtFrozenStore(that).set(key,value);else data[that._i]=value;return that;},ufstore:uncaughtFrozenStore};},{"10":10,"11":11,"16":16,"38":38,"40":40,"50":50,"63":63,"86":86}],25:[function(_dereq_,module,exports){'use strict';var global=_dereq_(39),$export=_dereq_(33),redefine=_dereq_(87),redefineAll=_dereq_(86),meta=_dereq_(63),forOf=_dereq_(38),anInstance=_dereq_(10),isObject=_dereq_(50),fails=_dereq_(35),$iterDetect=_dereq_(55),setToStringTag=_dereq_(92),inheritIfRequired=_dereq_(44);module.exports=function(NAME,wrapper,methods,common,IS_MAP,IS_WEAK){var Base=global[NAME],C=Base,ADDER=IS_MAP?'set':'add',proto=C&&C.prototype,O={};var fixMethod=function fixMethod(KEY){var fn=proto[KEY];redefine(proto,KEY,KEY=='delete'?function(a){return IS_WEAK&&!isObject(a)?false:fn.call(this,a===0?0:a);}:KEY=='has'?function has(a){return IS_WEAK&&!isObject(a)?false:fn.call(this,a===0?0:a);}:KEY=='get'?function get(a){return IS_WEAK&&!isObject(a)?undefined:fn.call(this,a===0?0:a);}:KEY=='add'?function add(a){fn.call(this,a===0?0:a);return this;}:function set(a,b){fn.call(this,a===0?0:a,b);return this;});};if(typeof C!='function'||!(IS_WEAK||proto.forEach&&!fails(function(){new C().entries().next();}))){ // create collection constructor
C=common.getConstructor(wrapper,NAME,IS_MAP,ADDER);redefineAll(C.prototype,methods);meta.NEED=true;}else {var instance=new C() // early implementations not supports chaining
,HASNT_CHAINING=instance[ADDER](IS_WEAK?{}:-0,1)!=instance // V8 ~ Chromium 40- weak-collections throws on primitives, but should return false
,THROWS_ON_PRIMITIVES=fails(function(){instance.has(1);}) // most early implementations doesn't supports iterables, most modern - not close it correctly
,ACCEPT_ITERABLES=$iterDetect(function(iter){new C(iter);}) // eslint-disable-line no-new
// for early implementations -0 and +0 not the same
,BUGGY_ZERO=!IS_WEAK&&fails(function(){ // V8 ~ Chromium 42- fails only with 5+ elements
var $instance=new C(),index=5;while(index--){$instance[ADDER](index,index);}return !$instance.has(-0);});if(!ACCEPT_ITERABLES){C=wrapper(function(target,iterable){anInstance(target,C,NAME);var that=inheritIfRequired(new Base(),target,C);if(iterable!=undefined)forOf(iterable,IS_MAP,that[ADDER],that);return that;});C.prototype=proto;proto.constructor=C;}if(THROWS_ON_PRIMITIVES||BUGGY_ZERO){fixMethod('delete');fixMethod('has');IS_MAP&&fixMethod('get');}if(BUGGY_ZERO||HASNT_CHAINING)fixMethod(ADDER); // weak collections should not contains .clear method
if(IS_WEAK&&proto.clear)delete proto.clear;}setToStringTag(C,NAME);O[NAME]=C;$export($export.G+$export.W+$export.F*(C!=Base),O);if(!IS_WEAK)common.setStrong(C,NAME,IS_MAP);return C;};},{"10":10,"33":33,"35":35,"38":38,"39":39,"44":44,"50":50,"55":55,"63":63,"86":86,"87":87,"92":92}],26:[function(_dereq_,module,exports){var core=module.exports={version:'2.1.4'};if(typeof __e=='number')__e=core; // eslint-disable-line no-undef
},{}],27:[function(_dereq_,module,exports){ // optional / simple context binding
var aFunction=_dereq_(7);module.exports=function(fn,that,length){aFunction(fn);if(that===undefined)return fn;switch(length){case 1:return function(a){return fn.call(that,a);};case 2:return function(a,b){return fn.call(that,a,b);};case 3:return function(a,b,c){return fn.call(that,a,b,c);};}return function() /* ...args */{return fn.apply(that,arguments);};};},{"7":7}],28:[function(_dereq_,module,exports){ // 7.2.1 RequireObjectCoercible(argument)
module.exports=function(it){if(it==undefined)throw TypeError("Can't call method on "+it);return it;};},{}],29:[function(_dereq_,module,exports){ // Thank's IE8 for his funny defineProperty
module.exports=!_dereq_(35)(function(){return Object.defineProperty({},'a',{get:function get(){return 7;}}).a!=7;});},{"35":35}],30:[function(_dereq_,module,exports){var isObject=_dereq_(50),document=_dereq_(39).document // in old IE typeof document.createElement is 'object'
,is=isObject(document)&&isObject(document.createElement);module.exports=function(it){return is?document.createElement(it):{};};},{"39":39,"50":50}],31:[function(_dereq_,module,exports){ // IE 8- don't enum bug keys
module.exports='constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'.split(',');},{}],32:[function(_dereq_,module,exports){ // all enumerable object keys, includes symbols
var getKeys=_dereq_(76),gOPS=_dereq_(73),pIE=_dereq_(77);module.exports=function(it){var result=getKeys(it),getSymbols=gOPS.f;if(getSymbols){var symbols=getSymbols(it),isEnum=pIE.f,i=0,key;while(symbols.length>i){if(isEnum.call(it,key=symbols[i++]))result.push(key);}}return result;};},{"73":73,"76":76,"77":77}],33:[function(_dereq_,module,exports){var global=_dereq_(39),core=_dereq_(26),hide=_dereq_(41),redefine=_dereq_(87),ctx=_dereq_(27),PROTOTYPE='prototype';var $export=function $export(type,name,source){var IS_FORCED=type&$export.F,IS_GLOBAL=type&$export.G,IS_STATIC=type&$export.S,IS_PROTO=type&$export.P,IS_BIND=type&$export.B,target=IS_GLOBAL?global:IS_STATIC?global[name]||(global[name]={}):(global[name]||{})[PROTOTYPE],exports=IS_GLOBAL?core:core[name]||(core[name]={}),expProto=exports[PROTOTYPE]||(exports[PROTOTYPE]={}),key,own,out,exp;if(IS_GLOBAL)source=name;for(key in source){ // contains in native
own=!IS_FORCED&&target&&target[key]!==undefined; // export native or passed
out=(own?target:source)[key]; // bind timers to global for call from export context
exp=IS_BIND&&own?ctx(out,global):IS_PROTO&&typeof out=='function'?ctx(Function.call,out):out; // extend global
if(target)redefine(target,key,out,type&$export.U); // export
if(exports[key]!=out)hide(exports,key,exp);if(IS_PROTO&&expProto[key]!=out)expProto[key]=out;}};global.core=core; // type bitmap
$export.F=1; // forced
$export.G=2; // global
$export.S=4; // static
$export.P=8; // proto
$export.B=16; // bind
$export.W=32; // wrap
$export.U=64; // safe
$export.R=128; // real proto method for `library`
module.exports=$export;},{"26":26,"27":27,"39":39,"41":41,"87":87}],34:[function(_dereq_,module,exports){var MATCH=_dereq_(115)('match');module.exports=function(KEY){var re=/./;try{'/./'[KEY](re);}catch(e){try{re[MATCH]=false;return !'/./'[KEY](re);}catch(f){ /* empty */}}return true;};},{"115":115}],35:[function(_dereq_,module,exports){module.exports=function(exec){try{return !!exec();}catch(e){return true;}};},{}],36:[function(_dereq_,module,exports){'use strict';var hide=_dereq_(41),redefine=_dereq_(87),fails=_dereq_(35),defined=_dereq_(28),wks=_dereq_(115);module.exports=function(KEY,length,exec){var SYMBOL=wks(KEY),fns=exec(defined,SYMBOL,''[KEY]),strfn=fns[0],rxfn=fns[1];if(fails(function(){var O={};O[SYMBOL]=function(){return 7;};return ''[KEY](O)!=7;})){redefine(String.prototype,KEY,strfn);hide(RegExp.prototype,SYMBOL,length==2 // 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue)
// 21.2.5.11 RegExp.prototype[@@split](string, limit)
?function(string,arg){return rxfn.call(string,this,arg);} // 21.2.5.6 RegExp.prototype[@@match](string)
// 21.2.5.9 RegExp.prototype[@@search](string)
:function(string){return rxfn.call(string,this);});}};},{"115":115,"28":28,"35":35,"41":41,"87":87}],37:[function(_dereq_,module,exports){'use strict'; // 21.2.5.3 get RegExp.prototype.flags
var anObject=_dereq_(11);module.exports=function(){var that=anObject(this),result='';if(that.global)result+='g';if(that.ignoreCase)result+='i';if(that.multiline)result+='m';if(that.unicode)result+='u';if(that.sticky)result+='y';return result;};},{"11":11}],38:[function(_dereq_,module,exports){var ctx=_dereq_(27),call=_dereq_(52),isArrayIter=_dereq_(47),anObject=_dereq_(11),toLength=_dereq_(108),getIterFn=_dereq_(116);module.exports=function(iterable,entries,fn,that,ITERATOR){var iterFn=ITERATOR?function(){return iterable;}:getIterFn(iterable),f=ctx(fn,that,entries?2:1),index=0,length,step,iterator;if(typeof iterFn!='function')throw TypeError(iterable+' is not iterable!'); // fast case for arrays with default iterator
if(isArrayIter(iterFn))for(length=toLength(iterable.length);length>index;index++){entries?f(anObject(step=iterable[index])[0],step[1]):f(iterable[index]);}else for(iterator=iterFn.call(iterable);!(step=iterator.next()).done;){call(iterator,f,step.value,entries);}};},{"108":108,"11":11,"116":116,"27":27,"47":47,"52":52}],39:[function(_dereq_,module,exports){ // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
var global=module.exports=typeof window!='undefined'&&window.Math==Math?window:typeof self!='undefined'&&self.Math==Math?self:Function('return this')();if(typeof __g=='number')__g=global; // eslint-disable-line no-undef
},{}],40:[function(_dereq_,module,exports){var hasOwnProperty={}.hasOwnProperty;module.exports=function(it,key){return hasOwnProperty.call(it,key);};},{}],41:[function(_dereq_,module,exports){var dP=_dereq_(68),createDesc=_dereq_(85);module.exports=_dereq_(29)?function(object,key,value){return dP.f(object,key,createDesc(1,value));}:function(object,key,value){object[key]=value;return object;};},{"29":29,"68":68,"85":85}],42:[function(_dereq_,module,exports){module.exports=_dereq_(39).document&&document.documentElement;},{"39":39}],43:[function(_dereq_,module,exports){module.exports=!_dereq_(29)&&!_dereq_(35)(function(){return Object.defineProperty(_dereq_(30)('div'),'a',{get:function get(){return 7;}}).a!=7;});},{"29":29,"30":30,"35":35}],44:[function(_dereq_,module,exports){var isObject=_dereq_(50),setPrototypeOf=_dereq_(90).set;module.exports=function(that,target,C){var P,S=target.constructor;if(S!==C&&typeof S=='function'&&(P=S.prototype)!==C.prototype&&isObject(P)&&setPrototypeOf){setPrototypeOf(that,P);}return that;};},{"50":50,"90":90}],45:[function(_dereq_,module,exports){ // fast apply, http://jsperf.lnkit.com/fast-apply/5
module.exports=function(fn,args,that){var un=that===undefined;switch(args.length){case 0:return un?fn():fn.call(that);case 1:return un?fn(args[0]):fn.call(that,args[0]);case 2:return un?fn(args[0],args[1]):fn.call(that,args[0],args[1]);case 3:return un?fn(args[0],args[1],args[2]):fn.call(that,args[0],args[1],args[2]);case 4:return un?fn(args[0],args[1],args[2],args[3]):fn.call(that,args[0],args[1],args[2],args[3]);}return fn.apply(that,args);};},{}],46:[function(_dereq_,module,exports){ // fallback for non-array-like ES3 and non-enumerable old V8 strings
var cof=_dereq_(21);module.exports=Object('z').propertyIsEnumerable(0)?Object:function(it){return cof(it)=='String'?it.split(''):Object(it);};},{"21":21}],47:[function(_dereq_,module,exports){ // check on default Array iterator
var Iterators=_dereq_(57),ITERATOR=_dereq_(115)('iterator'),ArrayProto=Array.prototype;module.exports=function(it){return it!==undefined&&(Iterators.Array===it||ArrayProto[ITERATOR]===it);};},{"115":115,"57":57}],48:[function(_dereq_,module,exports){ // 7.2.2 IsArray(argument)
var cof=_dereq_(21);module.exports=Array.isArray||function isArray(arg){return cof(arg)=='Array';};},{"21":21}],49:[function(_dereq_,module,exports){ // 20.1.2.3 Number.isInteger(number)
var isObject=_dereq_(50),floor=Math.floor;module.exports=function isInteger(it){return !isObject(it)&&isFinite(it)&&floor(it)===it;};},{"50":50}],50:[function(_dereq_,module,exports){module.exports=function(it){return (typeof it==="undefined"?"undefined":babelHelpers.typeof(it))==='object'?it!==null:typeof it==='function';};},{}],51:[function(_dereq_,module,exports){ // 7.2.8 IsRegExp(argument)
var isObject=_dereq_(50),cof=_dereq_(21),MATCH=_dereq_(115)('match');module.exports=function(it){var isRegExp;return isObject(it)&&((isRegExp=it[MATCH])!==undefined?!!isRegExp:cof(it)=='RegExp');};},{"115":115,"21":21,"50":50}],52:[function(_dereq_,module,exports){ // call something on iterator step with safe closing on error
var anObject=_dereq_(11);module.exports=function(iterator,fn,value,entries){try{return entries?fn(anObject(value)[0],value[1]):fn(value); // 7.4.6 IteratorClose(iterator, completion)
}catch(e){var ret=iterator['return'];if(ret!==undefined)anObject(ret.call(iterator));throw e;}};},{"11":11}],53:[function(_dereq_,module,exports){'use strict';var create=_dereq_(67),descriptor=_dereq_(85),setToStringTag=_dereq_(92),IteratorPrototype={}; // 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
_dereq_(41)(IteratorPrototype,_dereq_(115)('iterator'),function(){return this;});module.exports=function(Constructor,NAME,next){Constructor.prototype=create(IteratorPrototype,{next:descriptor(1,next)});setToStringTag(Constructor,NAME+' Iterator');};},{"115":115,"41":41,"67":67,"85":85,"92":92}],54:[function(_dereq_,module,exports){'use strict';var LIBRARY=_dereq_(59),$export=_dereq_(33),redefine=_dereq_(87),hide=_dereq_(41),has=_dereq_(40),Iterators=_dereq_(57),$iterCreate=_dereq_(53),setToStringTag=_dereq_(92),getPrototypeOf=_dereq_(74),ITERATOR=_dereq_(115)('iterator'),BUGGY=!([].keys&&'next' in [].keys()) // Safari has buggy iterators w/o `next`
,FF_ITERATOR='@@iterator',KEYS='keys',VALUES='values';var returnThis=function returnThis(){return this;};module.exports=function(Base,NAME,Constructor,next,DEFAULT,IS_SET,FORCED){$iterCreate(Constructor,NAME,next);var getMethod=function getMethod(kind){if(!BUGGY&&kind in proto)return proto[kind];switch(kind){case KEYS:return function keys(){return new Constructor(this,kind);};case VALUES:return function values(){return new Constructor(this,kind);};}return function entries(){return new Constructor(this,kind);};};var TAG=NAME+' Iterator',DEF_VALUES=DEFAULT==VALUES,VALUES_BUG=false,proto=Base.prototype,$native=proto[ITERATOR]||proto[FF_ITERATOR]||DEFAULT&&proto[DEFAULT],$default=$native||getMethod(DEFAULT),$entries=DEFAULT?!DEF_VALUES?$default:getMethod('entries'):undefined,$anyNative=NAME=='Array'?proto.entries||$native:$native,methods,key,IteratorPrototype; // Fix native
if($anyNative){IteratorPrototype=getPrototypeOf($anyNative.call(new Base()));if(IteratorPrototype!==Object.prototype){ // Set @@toStringTag to native iterators
setToStringTag(IteratorPrototype,TAG,true); // fix for some old engines
if(!LIBRARY&&!has(IteratorPrototype,ITERATOR))hide(IteratorPrototype,ITERATOR,returnThis);}} // fix Array#{values, @@iterator}.name in V8 / FF
if(DEF_VALUES&&$native&&$native.name!==VALUES){VALUES_BUG=true;$default=function values(){return $native.call(this);};} // Define iterator
if((!LIBRARY||FORCED)&&(BUGGY||VALUES_BUG||!proto[ITERATOR])){hide(proto,ITERATOR,$default);} // Plug for library
Iterators[NAME]=$default;Iterators[TAG]=returnThis;if(DEFAULT){methods={values:DEF_VALUES?$default:getMethod(VALUES),keys:IS_SET?$default:getMethod(KEYS),entries:$entries};if(FORCED)for(key in methods){if(!(key in proto))redefine(proto,key,methods[key]);}else $export($export.P+$export.F*(BUGGY||VALUES_BUG),NAME,methods);}return methods;};},{"115":115,"33":33,"40":40,"41":41,"53":53,"57":57,"59":59,"74":74,"87":87,"92":92}],55:[function(_dereq_,module,exports){var ITERATOR=_dereq_(115)('iterator'),SAFE_CLOSING=false;try{var riter=[7][ITERATOR]();riter['return']=function(){SAFE_CLOSING=true;};Array.from(riter,function(){throw 2;});}catch(e){ /* empty */}module.exports=function(exec,skipClosing){if(!skipClosing&&!SAFE_CLOSING)return false;var safe=false;try{var arr=[7],iter=arr[ITERATOR]();iter.next=function(){safe=true;};arr[ITERATOR]=function(){return iter;};exec(arr);}catch(e){ /* empty */}return safe;};},{"115":115}],56:[function(_dereq_,module,exports){module.exports=function(done,value){return {value:value,done:!!done};};},{}],57:[function(_dereq_,module,exports){module.exports={};},{}],58:[function(_dereq_,module,exports){var getKeys=_dereq_(76),toIObject=_dereq_(107);module.exports=function(object,el){var O=toIObject(object),keys=getKeys(O),length=keys.length,index=0,key;while(length>index){if(O[key=keys[index++]]===el)return key;}};},{"107":107,"76":76}],59:[function(_dereq_,module,exports){module.exports=false;},{}],60:[function(_dereq_,module,exports){ // 20.2.2.14 Math.expm1(x)
module.exports=Math.expm1||function expm1(x){return (x=+x)==0?x:x>-1e-6&&x<1e-6?x+x*x/2:Math.exp(x)-1;};},{}],61:[function(_dereq_,module,exports){ // 20.2.2.20 Math.log1p(x)
module.exports=Math.log1p||function log1p(x){return (x=+x)>-1e-8&&x<1e-8?x-x*x/2:Math.log(1+x);};},{}],62:[function(_dereq_,module,exports){ // 20.2.2.28 Math.sign(x)
module.exports=Math.sign||function sign(x){return (x=+x)==0||x!=x?x:x<0?-1:1;};},{}],63:[function(_dereq_,module,exports){var META=_dereq_(114)('meta'),isObject=_dereq_(50),has=_dereq_(40),setDesc=_dereq_(68).f,id=0;var isExtensible=Object.isExtensible||function(){return true;};var FREEZE=!_dereq_(35)(function(){return isExtensible(Object.preventExtensions({}));});var setMeta=function setMeta(it){setDesc(it,META,{value:{i:'O'+ ++id, // object ID
w:{} // weak collections IDs
}});};var fastKey=function fastKey(it,create){ // return primitive with prefix
if(!isObject(it))return (typeof it==="undefined"?"undefined":babelHelpers.typeof(it))=='symbol'?it:(typeof it=='string'?'S':'P')+it;if(!has(it,META)){ // can't set metadata to uncaught frozen object
if(!isExtensible(it))return 'F'; // not necessary to add metadata
if(!create)return 'E'; // add missing metadata
setMeta(it); // return object ID
}return it[META].i;};var getWeak=function getWeak(it,create){if(!has(it,META)){ // can't set metadata to uncaught frozen object
if(!isExtensible(it))return true; // not necessary to add metadata
if(!create)return false; // add missing metadata
setMeta(it); // return hash weak collections IDs
}return it[META].w;}; // add metadata on freeze-family methods calling
var onFreeze=function onFreeze(it){if(FREEZE&&meta.NEED&&isExtensible(it)&&!has(it,META))setMeta(it);return it;};var meta=module.exports={KEY:META,NEED:false,fastKey:fastKey,getWeak:getWeak,onFreeze:onFreeze};},{"114":114,"35":35,"40":40,"50":50,"68":68}],64:[function(_dereq_,module,exports){var Map=_dereq_(147),$export=_dereq_(33),shared=_dereq_(94)('metadata'),store=shared.store||(shared.store=new (_dereq_(253))());var getOrCreateMetadataMap=function getOrCreateMetadataMap(target,targetKey,create){var targetMetadata=store.get(target);if(!targetMetadata){if(!create)return undefined;store.set(target,targetMetadata=new Map());}var keyMetadata=targetMetadata.get(targetKey);if(!keyMetadata){if(!create)return undefined;targetMetadata.set(targetKey,keyMetadata=new Map());}return keyMetadata;};var ordinaryHasOwnMetadata=function ordinaryHasOwnMetadata(MetadataKey,O,P){var metadataMap=getOrCreateMetadataMap(O,P,false);return metadataMap===undefined?false:metadataMap.has(MetadataKey);};var ordinaryGetOwnMetadata=function ordinaryGetOwnMetadata(MetadataKey,O,P){var metadataMap=getOrCreateMetadataMap(O,P,false);return metadataMap===undefined?undefined:metadataMap.get(MetadataKey);};var ordinaryDefineOwnMetadata=function ordinaryDefineOwnMetadata(MetadataKey,MetadataValue,O,P){getOrCreateMetadataMap(O,P,true).set(MetadataKey,MetadataValue);};var ordinaryOwnMetadataKeys=function ordinaryOwnMetadataKeys(target,targetKey){var metadataMap=getOrCreateMetadataMap(target,targetKey,false),keys=[];if(metadataMap)metadataMap.forEach(function(_,key){keys.push(key);});return keys;};var toMetaKey=function toMetaKey(it){return it===undefined||(typeof it==="undefined"?"undefined":babelHelpers.typeof(it))=='symbol'?it:String(it);};var exp=function exp(O){$export($export.S,'Reflect',O);};module.exports={store:store,map:getOrCreateMetadataMap,has:ordinaryHasOwnMetadata,get:ordinaryGetOwnMetadata,set:ordinaryDefineOwnMetadata,keys:ordinaryOwnMetadataKeys,key:toMetaKey,exp:exp};},{"147":147,"253":253,"33":33,"94":94}],65:[function(_dereq_,module,exports){var global=_dereq_(39),macrotask=_dereq_(104).set,Observer=global.MutationObserver||global.WebKitMutationObserver,process=global.process,Promise=global.Promise,isNode=_dereq_(21)(process)=='process',head,last,notify;var flush=function flush(){var parent,domain,fn;if(isNode&&(parent=process.domain)){process.domain=null;parent.exit();}while(head){domain=head.domain;fn=head.fn;if(domain)domain.enter();fn(); // <- currently we use it only for Promise - try / catch not required
if(domain)domain.exit();head=head.next;}last=undefined;if(parent)parent.enter();}; // Node.js
if(isNode){notify=function notify(){process.nextTick(flush);}; // browsers with MutationObserver
}else if(Observer){var toggle=1,node=document.createTextNode('');new Observer(flush).observe(node,{characterData:true}); // eslint-disable-line no-new
notify=function notify(){node.data=toggle=-toggle;}; // environments with maybe non-completely correct, but existent Promise
}else if(Promise&&Promise.resolve){notify=function notify(){Promise.resolve().then(flush);}; // for other environments - macrotask based on:
// - setImmediate
// - MessageChannel
// - window.postMessag
// - onreadystatechange
// - setTimeout
}else {notify=function notify(){ // strange IE + webpack dev server bug - use .call(global)
macrotask.call(global,flush);};}module.exports=function(fn){var task={fn:fn,next:undefined,domain:isNode&&process.domain};if(last)last.next=task;if(!head){head=task;notify();}last=task;};},{"104":104,"21":21,"39":39}],66:[function(_dereq_,module,exports){'use strict'; // 19.1.2.1 Object.assign(target, source, ...)
var getKeys=_dereq_(76),gOPS=_dereq_(73),pIE=_dereq_(77),toObject=_dereq_(109),IObject=_dereq_(46),$assign=Object.assign; // should work with symbols and should have deterministic property order (V8 bug)
module.exports=!$assign||_dereq_(35)(function(){var A={},B={},S=Symbol(),K='abcdefghijklmnopqrst';A[S]=7;K.split('').forEach(function(k){B[k]=k;});return $assign({},A)[S]!=7||Object.keys($assign({},B)).join('')!=K;})?function assign(target,source){ // eslint-disable-line no-unused-vars
var T=toObject(target),aLen=arguments.length,index=1,getSymbols=gOPS.f,isEnum=pIE.f;while(aLen>index){var S=IObject(arguments[index++]),keys=getSymbols?getKeys(S).concat(getSymbols(S)):getKeys(S),length=keys.length,j=0,key;while(length>j){if(isEnum.call(S,key=keys[j++]))T[key]=S[key];}}return T;}:$assign;},{"109":109,"35":35,"46":46,"73":73,"76":76,"77":77}],67:[function(_dereq_,module,exports){ // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
var anObject=_dereq_(11),dPs=_dereq_(69),enumBugKeys=_dereq_(31),IE_PROTO=_dereq_(93)('IE_PROTO'),Empty=function Empty(){ /* empty */},PROTOTYPE='prototype'; // Create object with fake `null` prototype: use iframe Object with cleared prototype
var _createDict=function createDict(){ // Thrash, waste and sodomy: IE GC bug
var iframe=_dereq_(30)('iframe'),i=enumBugKeys.length,gt='>',iframeDocument;iframe.style.display='none';_dereq_(42).appendChild(iframe);iframe.src='javascript:'; // eslint-disable-line no-script-url
// createDict = iframe.contentWindow.Object;
// html.removeChild(iframe);
iframeDocument=iframe.contentWindow.document;iframeDocument.open();iframeDocument.write('<script>document.F=Object</script'+gt);iframeDocument.close();_createDict=iframeDocument.F;while(i--){delete _createDict[PROTOTYPE][enumBugKeys[i]];}return _createDict();};module.exports=Object.create||function create(O,Properties){var result;if(O!==null){Empty[PROTOTYPE]=anObject(O);result=new Empty();Empty[PROTOTYPE]=null; // add "__proto__" for Object.getPrototypeOf polyfill
result[IE_PROTO]=O;}else result=_createDict();return Properties===undefined?result:dPs(result,Properties);};},{"11":11,"30":30,"31":31,"42":42,"69":69,"93":93}],68:[function(_dereq_,module,exports){var anObject=_dereq_(11),IE8_DOM_DEFINE=_dereq_(43),toPrimitive=_dereq_(110),dP=Object.defineProperty;exports.f=_dereq_(29)?Object.defineProperty:function defineProperty(O,P,Attributes){anObject(O);P=toPrimitive(P,true);anObject(Attributes);if(IE8_DOM_DEFINE)try{return dP(O,P,Attributes);}catch(e){ /* empty */}if('get' in Attributes||'set' in Attributes)throw TypeError('Accessors not supported!');if('value' in Attributes)O[P]=Attributes.value;return O;};},{"11":11,"110":110,"29":29,"43":43}],69:[function(_dereq_,module,exports){var dP=_dereq_(68),anObject=_dereq_(11),getKeys=_dereq_(76);module.exports=_dereq_(29)?Object.defineProperties:function defineProperties(O,Properties){anObject(O);var keys=getKeys(Properties),length=keys.length,i=0,P;while(length>i){dP.f(O,P=keys[i++],Properties[P]);}return O;};},{"11":11,"29":29,"68":68,"76":76}],70:[function(_dereq_,module,exports){var pIE=_dereq_(77),createDesc=_dereq_(85),toIObject=_dereq_(107),toPrimitive=_dereq_(110),has=_dereq_(40),IE8_DOM_DEFINE=_dereq_(43),gOPD=Object.getOwnPropertyDescriptor;exports.f=_dereq_(29)?gOPD:function getOwnPropertyDescriptor(O,P){O=toIObject(O);P=toPrimitive(P,true);if(IE8_DOM_DEFINE)try{return gOPD(O,P);}catch(e){ /* empty */}if(has(O,P))return createDesc(!pIE.f.call(O,P),O[P]);};},{"107":107,"110":110,"29":29,"40":40,"43":43,"77":77,"85":85}],71:[function(_dereq_,module,exports){ // fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window
var toIObject=_dereq_(107),gOPN=_dereq_(72).f,toString={}.toString;var windowNames=(typeof window==="undefined"?"undefined":babelHelpers.typeof(window))=='object'&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];var getWindowNames=function getWindowNames(it){try{return gOPN.f(it);}catch(e){return windowNames.slice();}};module.exports.f=function getOwnPropertyNames(it){return windowNames&&toString.call(it)=='[object Window]'?getWindowNames(it):gOPN(toIObject(it));};},{"107":107,"72":72}],72:[function(_dereq_,module,exports){ // 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O)
var $keys=_dereq_(75),hiddenKeys=_dereq_(31).concat('length','prototype');exports.f=Object.getOwnPropertyNames||function getOwnPropertyNames(O){return $keys(O,hiddenKeys);};},{"31":31,"75":75}],73:[function(_dereq_,module,exports){exports.f=Object.getOwnPropertySymbols;},{}],74:[function(_dereq_,module,exports){ // 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)
var has=_dereq_(40),toObject=_dereq_(109),IE_PROTO=_dereq_(93)('IE_PROTO'),ObjectProto=Object.prototype;module.exports=Object.getPrototypeOf||function(O){O=toObject(O);if(has(O,IE_PROTO))return O[IE_PROTO];if(typeof O.constructor=='function'&&O instanceof O.constructor){return O.constructor.prototype;}return O instanceof Object?ObjectProto:null;};},{"109":109,"40":40,"93":93}],75:[function(_dereq_,module,exports){var has=_dereq_(40),toIObject=_dereq_(107),arrayIndexOf=_dereq_(15)(false),IE_PROTO=_dereq_(93)('IE_PROTO');module.exports=function(object,names){var O=toIObject(object),i=0,result=[],key;for(key in O){if(key!=IE_PROTO)has(O,key)&&result.push(key);} // Don't enum bug & hidden keys
while(names.length>i){if(has(O,key=names[i++])){~arrayIndexOf(result,key)||result.push(key);}}return result;};},{"107":107,"15":15,"40":40,"93":93}],76:[function(_dereq_,module,exports){ // 19.1.2.14 / 15.2.3.14 Object.keys(O)
var $keys=_dereq_(75),enumBugKeys=_dereq_(31);module.exports=Object.keys||function keys(O){return $keys(O,enumBugKeys);};},{"31":31,"75":75}],77:[function(_dereq_,module,exports){exports.f={}.propertyIsEnumerable;},{}],78:[function(_dereq_,module,exports){ // most Object methods by ES6 should accept primitives
var $export=_dereq_(33),core=_dereq_(26),fails=_dereq_(35);module.exports=function(KEY,exec){var fn=(core.Object||{})[KEY]||Object[KEY],exp={};exp[KEY]=exec(fn);$export($export.S+$export.F*fails(function(){fn(1);}),'Object',exp);};},{"26":26,"33":33,"35":35}],79:[function(_dereq_,module,exports){var getKeys=_dereq_(76),toIObject=_dereq_(107),isEnum=_dereq_(77).f;module.exports=function(isEntries){return function(it){var O=toIObject(it),keys=getKeys(O),length=keys.length,i=0,result=[],key;while(length>i){if(isEnum.call(O,key=keys[i++])){result.push(isEntries?[key,O[key]]:O[key]);}}return result;};};},{"107":107,"76":76,"77":77}],80:[function(_dereq_,module,exports){ // all object keys, includes non-enumerable and symbols
var gOPN=_dereq_(72),gOPS=_dereq_(73),anObject=_dereq_(11),Reflect=_dereq_(39).Reflect;module.exports=Reflect&&Reflect.ownKeys||function ownKeys(it){var keys=gOPN.f(anObject(it)),getSymbols=gOPS.f;return getSymbols?keys.concat(getSymbols(it)):keys;};},{"11":11,"39":39,"72":72,"73":73}],81:[function(_dereq_,module,exports){var $parseFloat=_dereq_(39).parseFloat,$trim=_dereq_(102).trim;module.exports=1/$parseFloat(_dereq_(103)+'-0')!==-Infinity?function parseFloat(str){var string=$trim(String(str),3),result=$parseFloat(string);return result===0&&string.charAt(0)=='-'?-0:result;}:$parseFloat;},{"102":102,"103":103,"39":39}],82:[function(_dereq_,module,exports){var $parseInt=_dereq_(39).parseInt,$trim=_dereq_(102).trim,ws=_dereq_(103),hex=/^[\-+]?0[xX]/;module.exports=$parseInt(ws+'08')!==8||$parseInt(ws+'0x16')!==22?function parseInt(str,radix){var string=$trim(String(str),3);return $parseInt(string,radix>>>0||(hex.test(string)?16:10));}:$parseInt;},{"102":102,"103":103,"39":39}],83:[function(_dereq_,module,exports){'use strict';var path=_dereq_(84),invoke=_dereq_(45),aFunction=_dereq_(7);module.exports=function() /* ...pargs */{var fn=aFunction(this),length=arguments.length,pargs=Array(length),i=0,_=path._,holder=false;while(length>i){if((pargs[i]=arguments[i++])===_)holder=true;}return function() /* ...args */{var that=this,aLen=arguments.length,j=0,k=0,args;if(!holder&&!aLen)return invoke(fn,pargs,that);args=pargs.slice();if(holder)for(;length>j;j++){if(args[j]===_)args[j]=arguments[k++];}while(aLen>k){args.push(arguments[k++]);}return invoke(fn,args,that);};};},{"45":45,"7":7,"84":84}],84:[function(_dereq_,module,exports){module.exports=_dereq_(39);},{"39":39}],85:[function(_dereq_,module,exports){module.exports=function(bitmap,value){return {enumerable:!(bitmap&1),configurable:!(bitmap&2),writable:!(bitmap&4),value:value};};},{}],86:[function(_dereq_,module,exports){var redefine=_dereq_(87);module.exports=function(target,src,safe){for(var key in src){redefine(target,key,src[key],safe);}return target;};},{"87":87}],87:[function(_dereq_,module,exports){var global=_dereq_(39),hide=_dereq_(41),has=_dereq_(40),SRC=_dereq_(114)('src'),TO_STRING='toString',$toString=Function[TO_STRING],TPL=(''+$toString).split(TO_STRING);_dereq_(26).inspectSource=function(it){return $toString.call(it);};(module.exports=function(O,key,val,safe){var isFunction=typeof val=='function';if(isFunction)has(val,'name')||hide(val,'name',key);if(O[key]===val)return;if(isFunction)has(val,SRC)||hide(val,SRC,O[key]?''+O[key]:TPL.join(String(key)));if(O===global){O[key]=val;}else {if(!safe){delete O[key];hide(O,key,val);}else {if(O[key])O[key]=val;else hide(O,key,val);}} // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
})(Function.prototype,TO_STRING,function toString(){return typeof this=='function'&&this[SRC]||$toString.call(this);});},{"114":114,"26":26,"39":39,"40":40,"41":41}],88:[function(_dereq_,module,exports){module.exports=function(regExp,replace){var replacer=replace===Object(replace)?function(part){return replace[part];}:replace;return function(it){return String(it).replace(regExp,replacer);};};},{}],89:[function(_dereq_,module,exports){ // 7.2.9 SameValue(x, y)
module.exports=Object.is||function is(x,y){return x===y?x!==0||1/x===1/y:x!=x&&y!=y;};},{}],90:[function(_dereq_,module,exports){ // Works with __proto__ only. Old v8 can't work with null proto objects.
/* eslint-disable no-proto */var isObject=_dereq_(50),anObject=_dereq_(11);var check=function check(O,proto){anObject(O);if(!isObject(proto)&&proto!==null)throw TypeError(proto+": can't set as prototype!");};module.exports={set:Object.setPrototypeOf||('__proto__' in {}? // eslint-disable-line
function(test,buggy,set){try{set=_dereq_(27)(Function.call,_dereq_(70).f(Object.prototype,'__proto__').set,2);set(test,[]);buggy=!(test instanceof Array);}catch(e){buggy=true;}return function setPrototypeOf(O,proto){check(O,proto);if(buggy)O.__proto__=proto;else set(O,proto);return O;};}({},false):undefined),check:check};},{"11":11,"27":27,"50":50,"70":70}],91:[function(_dereq_,module,exports){'use strict';var global=_dereq_(39),dP=_dereq_(68),DESCRIPTORS=_dereq_(29),SPECIES=_dereq_(115)('species');module.exports=function(KEY){var C=global[KEY];if(DESCRIPTORS&&C&&!C[SPECIES])dP.f(C,SPECIES,{configurable:true,get:function get(){return this;}});};},{"115":115,"29":29,"39":39,"68":68}],92:[function(_dereq_,module,exports){var def=_dereq_(68).f,has=_dereq_(40),TAG=_dereq_(115)('toStringTag');module.exports=function(it,tag,stat){if(it&&!has(it=stat?it:it.prototype,TAG))def(it,TAG,{configurable:true,value:tag});};},{"115":115,"40":40,"68":68}],93:[function(_dereq_,module,exports){var shared=_dereq_(94)('keys'),uid=_dereq_(114);module.exports=function(key){return shared[key]||(shared[key]=uid(key));};},{"114":114,"94":94}],94:[function(_dereq_,module,exports){var global=_dereq_(39),SHARED='__core-js_shared__',store=global[SHARED]||(global[SHARED]={});module.exports=function(key){return store[key]||(store[key]={});};},{"39":39}],95:[function(_dereq_,module,exports){ // 7.3.20 SpeciesConstructor(O, defaultConstructor)
var anObject=_dereq_(11),aFunction=_dereq_(7),SPECIES=_dereq_(115)('species');module.exports=function(O,D){var C=anObject(O).constructor,S;return C===undefined||(S=anObject(C)[SPECIES])==undefined?D:aFunction(S);};},{"11":11,"115":115,"7":7}],96:[function(_dereq_,module,exports){var fails=_dereq_(35);module.exports=function(method,arg){return !!method&&fails(function(){arg?method.call(null,function(){},1):method.call(null);});};},{"35":35}],97:[function(_dereq_,module,exports){var toInteger=_dereq_(106),defined=_dereq_(28); // true -> String#at
// false -> String#codePointAt
module.exports=function(TO_STRING){return function(that,pos){var s=String(defined(that)),i=toInteger(pos),l=s.length,a,b;if(i<0||i>=l)return TO_STRING?'':undefined;a=s.charCodeAt(i);return a<0xd800||a>0xdbff||i+1===l||(b=s.charCodeAt(i+1))<0xdc00||b>0xdfff?TO_STRING?s.charAt(i):a:TO_STRING?s.slice(i,i+2):(a-0xd800<<10)+(b-0xdc00)+0x10000;};};},{"106":106,"28":28}],98:[function(_dereq_,module,exports){ // helper for String#{startsWith, endsWith, includes}
var isRegExp=_dereq_(51),defined=_dereq_(28);module.exports=function(that,searchString,NAME){if(isRegExp(searchString))throw TypeError('String#'+NAME+" doesn't accept regex!");return String(defined(that));};},{"28":28,"51":51}],99:[function(_dereq_,module,exports){var $export=_dereq_(33),fails=_dereq_(35),defined=_dereq_(28),quot=/"/g; // B.2.3.2.1 CreateHTML(string, tag, attribute, value)
var createHTML=function createHTML(string,tag,attribute,value){var S=String(defined(string)),p1='<'+tag;if(attribute!=='')p1+=' '+attribute+'="'+String(value).replace(quot,'"')+'"';return p1+'>'+S+'</'+tag+'>';};module.exports=function(NAME,exec){var O={};O[NAME]=exec(createHTML);$export($export.P+$export.F*fails(function(){var test=''[NAME]('"');return test!==test.toLowerCase()||test.split('"').length>3;}),'String',O);};},{"28":28,"33":33,"35":35}],100:[function(_dereq_,module,exports){ // https://github.com/tc39/proposal-string-pad-start-end
var toLength=_dereq_(108),repeat=_dereq_(101),defined=_dereq_(28);module.exports=function(that,maxLength,fillString,left){var S=String(defined(that)),stringLength=S.length,fillStr=fillString===undefined?' ':String(fillString),intMaxLength=toLength(maxLength);if(intMaxLength<=stringLength)return S;if(fillStr=='')fillStr=' ';var fillLen=intMaxLength-stringLength,stringFiller=repeat.call(fillStr,Math.ceil(fillLen/fillStr.length));if(stringFiller.length>fillLen)stringFiller=stringFiller.slice(0,fillLen);return left?stringFiller+S:S+stringFiller;};},{"101":101,"108":108,"28":28}],101:[function(_dereq_,module,exports){'use strict';var toInteger=_dereq_(106),defined=_dereq_(28);module.exports=function repeat(count){var str=String(defined(this)),res='',n=toInteger(count);if(n<0||n==Infinity)throw RangeError("Count can't be negative");for(;n>0;(n>>>=1)&&(str+=str)){if(n&1)res+=str;}return res;};},{"106":106,"28":28}],102:[function(_dereq_,module,exports){var $export=_dereq_(33),defined=_dereq_(28),fails=_dereq_(35),spaces=_dereq_(103),space='['+spaces+']',non="
",ltrim=RegExp('^'+space+space+'*'),rtrim=RegExp(space+space+'*$');var exporter=function exporter(KEY,exec,ALIAS){var exp={};var FORCE=fails(function(){return !!spaces[KEY]()||non[KEY]()!=non;});var fn=exp[KEY]=FORCE?exec(trim):spaces[KEY];if(ALIAS)exp[ALIAS]=fn;$export($export.P+$export.F*FORCE,'String',exp);}; // 1 -> String#trimLeft
// 2 -> String#trimRight
// 3 -> String#trim
var trim=exporter.trim=function(string,TYPE){string=String(defined(string));if(TYPE&1)string=string.replace(ltrim,'');if(TYPE&2)string=string.replace(rtrim,'');return string;};module.exports=exporter;},{"103":103,"28":28,"33":33,"35":35}],103:[function(_dereq_,module,exports){module.exports="\t\n\u000b\f\r "+" \u2028\u2029";},{}],104:[function(_dereq_,module,exports){var ctx=_dereq_(27),invoke=_dereq_(45),html=_dereq_(42),cel=_dereq_(30),global=_dereq_(39),process=global.process,setTask=global.setImmediate,clearTask=global.clearImmediate,MessageChannel=global.MessageChannel,counter=0,queue={},ONREADYSTATECHANGE='onreadystatechange',defer,channel,port;var run=function run(){var id=+this;if(queue.hasOwnProperty(id)){var fn=queue[id];delete queue[id];fn();}};var listener=function listener(event){run.call(event.data);}; // Node.js 0.9+ & IE10+ has setImmediate, otherwise:
if(!setTask||!clearTask){setTask=function setImmediate(fn){var args=[],i=1;while(arguments.length>i){args.push(arguments[i++]);}queue[++counter]=function(){invoke(typeof fn=='function'?fn:Function(fn),args);};defer(counter);return counter;};clearTask=function clearImmediate(id){delete queue[id];}; // Node.js 0.8-
if(_dereq_(21)(process)=='process'){defer=function defer(id){process.nextTick(ctx(run,id,1));}; // Browsers with MessageChannel, includes WebWorkers
}else if(MessageChannel){channel=new MessageChannel();port=channel.port2;channel.port1.onmessage=listener;defer=ctx(port.postMessage,port,1); // Browsers with postMessage, skip WebWorkers
// IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
}else if(global.addEventListener&&typeof postMessage=='function'&&!global.importScripts){defer=function defer(id){global.postMessage(id+'','*');};global.addEventListener('message',listener,false); // IE8-
}else if(ONREADYSTATECHANGE in cel('script')){defer=function defer(id){html.appendChild(cel('script'))[ONREADYSTATECHANGE]=function(){html.removeChild(this);run.call(id);};}; // Rest old browsers
}else {defer=function defer(id){setTimeout(ctx(run,id,1),0);};}}module.exports={set:setTask,clear:clearTask};},{"21":21,"27":27,"30":30,"39":39,"42":42,"45":45}],105:[function(_dereq_,module,exports){var toInteger=_dereq_(106),max=Math.max,min=Math.min;module.exports=function(index,length){index=toInteger(index);return index<0?max(index+length,0):min(index,length);};},{"106":106}],106:[function(_dereq_,module,exports){ // 7.1.4 ToInteger
var ceil=Math.ceil,floor=Math.floor;module.exports=function(it){return isNaN(it=+it)?0:(it>0?floor:ceil)(it);};},{}],107:[function(_dereq_,module,exports){ // to indexed object, toObject with fallback for non-array-like ES3 strings
var IObject=_dereq_(46),defined=_dereq_(28);module.exports=function(it){return IObject(defined(it));};},{"28":28,"46":46}],108:[function(_dereq_,module,exports){ // 7.1.15 ToLength
var toInteger=_dereq_(106),min=Math.min;module.exports=function(it){return it>0?min(toInteger(it),0x1fffffffffffff):0; // pow(2, 53) - 1 == 9007199254740991
};},{"106":106}],109:[function(_dereq_,module,exports){ // 7.1.13 ToObject(argument)
var defined=_dereq_(28);module.exports=function(it){return Object(defined(it));};},{"28":28}],110:[function(_dereq_,module,exports){ // 7.1.1 ToPrimitive(input [, PreferredType])
var isObject=_dereq_(50); // instead of the ES6 spec version, we didn't implement @@toPrimitive case
// and the second argument - flag - preferred type is a string
module.exports=function(it,S){if(!isObject(it))return it;var fn,val;if(S&&typeof (fn=it.toString)=='function'&&!isObject(val=fn.call(it)))return val;if(typeof (fn=it.valueOf)=='function'&&!isObject(val=fn.call(it)))return val;if(!S&&typeof (fn=it.toString)=='function'&&!isObject(val=fn.call(it)))return val;throw TypeError("Can't convert object to primitive value");};},{"50":50}],111:[function(_dereq_,module,exports){'use strict';if(_dereq_(29)){var LIBRARY=_dereq_(59),global=_dereq_(39),fails=_dereq_(35),$export=_dereq_(33),$typed=_dereq_(113),$buffer=_dereq_(112),ctx=_dereq_(27),anInstance=_dereq_(10),propertyDesc=_dereq_(85),hide=_dereq_(41),redefineAll=_dereq_(86),isInteger=_dereq_(49),toInteger=_dereq_(106),toLength=_dereq_(108),toIndex=_dereq_(105),toPrimitive=_dereq_(110),has=_dereq_(40),same=_dereq_(89),classof=_dereq_(20),isObject=_dereq_(50),toObject=_dereq_(109),isArrayIter=_dereq_(47),create=_dereq_(67),getPrototypeOf=_dereq_(74),gOPN=_dereq_(72).f,isIterable=_dereq_(117),getIterFn=_dereq_(116),uid=_dereq_(114),wks=_dereq_(115),createArrayMethod=_dereq_(16),createArrayIncludes=_dereq_(15),speciesConstructor=_dereq_(95),ArrayIterators=_dereq_(129),Iterators=_dereq_(57),$iterDetect=_dereq_(55),setSpecies=_dereq_(91),arrayFill=_dereq_(13),arrayCopyWithin=_dereq_(12),$DP=_dereq_(68),$GOPD=_dereq_(70),dP=$DP.f,gOPD=$GOPD.f,RangeError=global.RangeError,TypeError=global.TypeError,Uint8Array=global.Uint8Array,ARRAY_BUFFER='ArrayBuffer',SHARED_BUFFER='Shared'+ARRAY_BUFFER,BYTES_PER_ELEMENT='BYTES_PER_ELEMENT',PROTOTYPE='prototype',ArrayProto=Array[PROTOTYPE],$ArrayBuffer=$buffer.ArrayBuffer,$DataView=$buffer.DataView,arrayForEach=createArrayMethod(0),arrayFilter=createArrayMethod(2),arraySome=createArrayMethod(3),arrayEvery=createArrayMethod(4),arrayFind=createArrayMethod(5),arrayFindIndex=createArrayMethod(6),arrayIncludes=createArrayIncludes(true),arrayIndexOf=createArrayIncludes(false),arrayValues=ArrayIterators.values,arrayKeys=ArrayIterators.keys,arrayEntries=ArrayIterators.entries,arrayLastIndexOf=ArrayProto.lastIndexOf,arrayReduce=ArrayProto.reduce,arrayReduceRight=ArrayProto.reduceRight,arrayJoin=ArrayProto.join,arraySort=ArrayProto.sort,arraySlice=ArrayProto.slice,arrayToString=ArrayProto.toString,arrayToLocaleString=ArrayProto.toLocaleString,ITERATOR=wks('iterator'),TAG=wks('toStringTag'),TYPED_CONSTRUCTOR=uid('typed_constructor'),DEF_CONSTRUCTOR=uid('def_constructor'),ALL_CONSTRUCTORS=$typed.CONSTR,TYPED_ARRAY=$typed.TYPED,VIEW=$typed.VIEW,WRONG_LENGTH='Wrong length!';var $map=createArrayMethod(1,function(O,length){return allocate(speciesConstructor(O,O[DEF_CONSTRUCTOR]),length);});var LITTLE_ENDIAN=fails(function(){return new Uint8Array(new Uint16Array([1]).buffer)[0]===1;});var FORCED_SET=!!Uint8Array&&!!Uint8Array[PROTOTYPE].set&&fails(function(){new Uint8Array(1).set({});});var strictToLength=function strictToLength(it,SAME){if(it===undefined)throw TypeError(WRONG_LENGTH);var number=+it,length=toLength(it);if(SAME&&!same(number,length))throw RangeError(WRONG_LENGTH);return length;};var toOffset=function toOffset(it,BYTES){var offset=toInteger(it);if(offset<0||offset%BYTES)throw RangeError('Wrong offset!');return offset;};var validate=function validate(it){if(isObject(it)&&TYPED_ARRAY in it)return it;throw TypeError(it+' is not a typed array!');};var allocate=function allocate(C,length){if(!(isObject(C)&&TYPED_CONSTRUCTOR in C)){throw TypeError('It is not a typed array constructor!');}return new C(length);};var speciesFromList=function speciesFromList(O,list){return fromList(speciesConstructor(O,O[DEF_CONSTRUCTOR]),list);};var fromList=function fromList(C,list){var index=0,length=list.length,result=allocate(C,length);while(length>index){result[index]=list[index++];}return result;};var addGetter=function addGetter(it,key,internal){dP(it,key,{get:function get(){return this._d[internal];}});};var $from=function from(source /*, mapfn, thisArg */){var O=toObject(source),aLen=arguments.length,mapfn=aLen>1?arguments[1]:undefined,mapping=mapfn!==undefined,iterFn=getIterFn(O),i,length,values,result,step,iterator;if(iterFn!=undefined&&!isArrayIter(iterFn)){for(iterator=iterFn.call(O),values=[],i=0;!(step=iterator.next()).done;i++){values.push(step.value);}O=values;}if(mapping&&aLen>2)mapfn=ctx(mapfn,arguments[2],2);for(i=0,length=toLength(O.length),result=allocate(this,length);length>i;i++){result[i]=mapping?mapfn(O[i],i):O[i];}return result;};var $of=function of() /*...items*/{var index=0,length=arguments.length,result=allocate(this,length);while(length>index){result[index]=arguments[index++];}return result;}; // iOS Safari 6.x fails here
var TO_LOCALE_BUG=!!Uint8Array&&fails(function(){arrayToLocaleString.call(new Uint8Array(1));});var $toLocaleString=function toLocaleString(){return arrayToLocaleString.apply(TO_LOCALE_BUG?arraySlice.call(validate(this)):validate(this),arguments);};var proto={copyWithin:function copyWithin(target,start /*, end */){return arrayCopyWithin.call(validate(this),target,start,arguments.length>2?arguments[2]:undefined);},every:function every(callbackfn /*, thisArg */){return arrayEvery(validate(this),callbackfn,arguments.length>1?arguments[1]:undefined);},fill:function fill(value /*, start, end */){ // eslint-disable-line no-unused-vars
return arrayFill.apply(validate(this),arguments);},filter:function filter(callbackfn /*, thisArg */){return speciesFromList(this,arrayFilter(validate(this),callbackfn,arguments.length>1?arguments[1]:undefined));},find:function find(predicate /*, thisArg */){return arrayFind(validate(this),predicate,arguments.length>1?arguments[1]:undefined);},findIndex:function findIndex(predicate /*, thisArg */){return arrayFindIndex(validate(this),predicate,arguments.length>1?arguments[1]:undefined);},forEach:function forEach(callbackfn /*, thisArg */){arrayForEach(validate(this),callbackfn,arguments.length>1?arguments[1]:undefined);},indexOf:function indexOf(searchElement /*, fromIndex */){return arrayIndexOf(validate(this),searchElement,arguments.length>1?arguments[1]:undefined);},includes:function includes(searchElement /*, fromIndex */){return arrayIncludes(validate(this),searchElement,arguments.length>1?arguments[1]:undefined);},join:function join(separator){ // eslint-disable-line no-unused-vars
return arrayJoin.apply(validate(this),arguments);},lastIndexOf:function lastIndexOf(searchElement /*, fromIndex */){ // eslint-disable-line no-unused-vars
return arrayLastIndexOf.apply(validate(this),arguments);},map:function map(mapfn /*, thisArg */){return $map(validate(this),mapfn,arguments.length>1?arguments[1]:undefined);},reduce:function reduce(callbackfn /*, initialValue */){ // eslint-disable-line no-unused-vars
return arrayReduce.apply(validate(this),arguments);},reduceRight:function reduceRight(callbackfn /*, initialValue */){ // eslint-disable-line no-unused-vars
return arrayReduceRight.apply(validate(this),arguments);},reverse:function reverse(){var that=this,length=validate(that).length,middle=Math.floor(length/2),index=0,value;while(index<middle){value=that[index];that[index++]=that[--length];that[length]=value;}return that;},slice:function slice(start,end){return speciesFromList(this,arraySlice.call(validate(this),start,end));},some:function some(callbackfn /*, thisArg */){return arraySome(validate(this),callbackfn,arguments.length>1?arguments[1]:undefined);},sort:function sort(comparefn){return arraySort.call(validate(this),comparefn);},subarray:function subarray(begin,end){var O=validate(this),length=O.length,$begin=toIndex(begin,length);return new (speciesConstructor(O,O[DEF_CONSTRUCTOR]))(O.buffer,O.byteOffset+$begin*O.BYTES_PER_ELEMENT,toLength((end===undefined?length:toIndex(end,length))-$begin));}};var $set=function set(arrayLike /*, offset */){validate(this);var offset=toOffset(arguments[1],1),length=this.length,src=toObject(arrayLike),len=toLength(src.length),index=0;if(len+offset>length)throw RangeError(WRONG_LENGTH);while(index<len){this[offset+index]=src[index++];}};var $iterators={entries:function entries(){return arrayEntries.call(validate(this));},keys:function keys(){return arrayKeys.call(validate(this));},values:function values(){return arrayValues.call(validate(this));}};var isTAIndex=function isTAIndex(target,key){return isObject(target)&&target[TYPED_ARRAY]&&(typeof key==="undefined"?"undefined":babelHelpers.typeof(key))!='symbol'&&key in target&&String(+key)==String(key);};var $getDesc=function getOwnPropertyDescriptor(target,key){return isTAIndex(target,key=toPrimitive(key,true))?propertyDesc(2,target[key]):gOPD(target,key);};var $setDesc=function defineProperty(target,key,desc){if(isTAIndex(target,key=toPrimitive(key,true))&&isObject(desc)&&has(desc,'value')&&!has(desc,'get')&&!has(desc,'set') // TODO: add validation descriptor w/o calling accessors
&&!desc.configurable&&(!has(desc,'writable')||desc.writable)&&(!has(desc,'enumerable')||desc.enumerable)){target[key]=desc.value;return target;}else return dP(target,key,desc);};if(!ALL_CONSTRUCTORS){$GOPD.f=$getDesc;$DP.f=$setDesc;}$export($export.S+$export.F*!ALL_CONSTRUCTORS,'Object',{getOwnPropertyDescriptor:$getDesc,defineProperty:$setDesc});if(fails(function(){arrayToString.call({});})){arrayToString=arrayToLocaleString=function toString(){return arrayJoin.call(this);};}var $TypedArrayPrototype$=redefineAll({},proto);redefineAll($TypedArrayPrototype$,$iterators);hide($TypedArrayPrototype$,ITERATOR,$iterators.values);redefineAll($TypedArrayPrototype$,{set:$set,constructor:function constructor(){ /* noop */},toString:arrayToString,toLocaleString:$toLocaleString});addGetter($TypedArrayPrototype$,'buffer','b');addGetter($TypedArrayPrototype$,'byteOffset','o');addGetter($TypedArrayPrototype$,'byteLength','l');addGetter($TypedArrayPrototype$,'length','e');dP($TypedArrayPrototype$,TAG,{get:function get(){return this[TYPED_ARRAY];}});module.exports=function(KEY,BYTES,wrapper,CLAMPED){CLAMPED=!!CLAMPED;var NAME=KEY+(CLAMPED?'Clamped':'')+'Array',ISNT_UINT8=NAME!='Uint8Array',GETTER='get'+KEY,SETTER='set'+KEY,TypedArray=global[NAME],Base=TypedArray||{},TAC=TypedArray&&getPrototypeOf(TypedArray),FORCED=!TypedArray||!$typed.ABV,O={},TypedArrayPrototype=TypedArray&&TypedArray[PROTOTYPE];var getter=function getter(that,index){var data=that._d;return data.v[GETTER](index*BYTES+data.o,LITTLE_ENDIAN);};var setter=function setter(that,index,value){var data=that._d;if(CLAMPED)value=(value=Math.round(value))<0?0:value>0xff?0xff:value&0xff;data.v[SETTER](index*BYTES+data.o,value,LITTLE_ENDIAN);};var addElement=function addElement(that,index){dP(that,index,{get:function get(){return getter(this,index);},set:function set(value){return setter(this,index,value);},enumerable:true});};if(FORCED){TypedArray=wrapper(function(that,data,$offset,$length){anInstance(that,TypedArray,NAME,'_d');var index=0,offset=0,buffer,byteLength,length,klass;if(!isObject(data)){length=strictToLength(data,true);byteLength=length*BYTES;buffer=new $ArrayBuffer(byteLength);}else if(data instanceof $ArrayBuffer||(klass=classof(data))==ARRAY_BUFFER||klass==SHARED_BUFFER){buffer=data;offset=toOffset($offset,BYTES);var $len=data.byteLength;if($length===undefined){if($len%BYTES)throw RangeError(WRONG_LENGTH);byteLength=$len-offset;if(byteLength<0)throw RangeError(WRONG_LENGTH);}else {byteLength=toLength($length)*BYTES;if(byteLength+offset>$len)throw RangeError(WRONG_LENGTH);}length=byteLength/BYTES;}else if(TYPED_ARRAY in data){return fromList(TypedArray,data);}else {return $from.call(TypedArray,data);}hide(that,'_d',{b:buffer,o:offset,l:byteLength,e:length,v:new $DataView(buffer)});while(index<length){addElement(that,index++);}});TypedArrayPrototype=TypedArray[PROTOTYPE]=create($TypedArrayPrototype$);hide(TypedArrayPrototype,'constructor',TypedArray);}else if(!$iterDetect(function(iter){ // V8 works with iterators, but fails in many other cases
// https://code.google.com/p/v8/issues/detail?id=4552
new TypedArray(null); // eslint-disable-line no-new
new TypedArray(iter); // eslint-disable-line no-new
},true)){TypedArray=wrapper(function(that,data,$offset,$length){anInstance(that,TypedArray,NAME);var klass; // `ws` module bug, temporarily remove validation length for Uint8Array
// https://github.com/websockets/ws/pull/645
if(!isObject(data))return new Base(strictToLength(data,ISNT_UINT8));if(data instanceof $ArrayBuffer||(klass=classof(data))==ARRAY_BUFFER||klass==SHARED_BUFFER){return $length!==undefined?new Base(data,toOffset($offset,BYTES),$length):$offset!==undefined?new Base(data,toOffset($offset,BYTES)):new Base(data);}if(TYPED_ARRAY in data)return fromList(TypedArray,data);return $from.call(TypedArray,data);});arrayForEach(TAC!==Function.prototype?gOPN(Base).concat(gOPN(TAC)):gOPN(Base),function(key){if(!(key in TypedArray))hide(TypedArray,key,Base[key]);});TypedArray[PROTOTYPE]=TypedArrayPrototype;if(!LIBRARY)TypedArrayPrototype.constructor=TypedArray;}var $nativeIterator=TypedArrayPrototype[ITERATOR],CORRECT_ITER_NAME=!!$nativeIterator&&($nativeIterator.name=='values'||$nativeIterator.name==undefined),$iterator=$iterators.values;hide(TypedArray,TYPED_CONSTRUCTOR,true);hide(TypedArrayPrototype,TYPED_ARRAY,NAME);hide(TypedArrayPrototype,VIEW,true);hide(TypedArrayPrototype,DEF_CONSTRUCTOR,TypedArray);if(CLAMPED?new TypedArray(1)[TAG]!=NAME:!(TAG in TypedArrayPrototype)){dP(TypedArrayPrototype,TAG,{get:function get(){return NAME;}});}O[NAME]=TypedArray;$export($export.G+$export.W+$export.F*(TypedArray!=Base),O);$export($export.S,NAME,{BYTES_PER_ELEMENT:BYTES,from:$from,of:$of});if(!(BYTES_PER_ELEMENT in TypedArrayPrototype))hide(TypedArrayPrototype,BYTES_PER_ELEMENT,BYTES);$export($export.P,NAME,proto);$export($export.P+$export.F*FORCED_SET,NAME,{set:$set});$export($export.P+$export.F*!CORRECT_ITER_NAME,NAME,$iterators);$export($export.P+$export.F*(TypedArrayPrototype.toString!=arrayToString),NAME,{toString:arrayToString});$export($export.P+$export.F*(fails(function(){return [1,2].toLocaleString()!=new TypedArray([1,2]).toLocaleString();})||!fails(function(){TypedArrayPrototype.toLocaleString.call([1,2]);})),NAME,{toLocaleString:$toLocaleString});Iterators[NAME]=CORRECT_ITER_NAME?$nativeIterator:$iterator;if(!LIBRARY&&!CORRECT_ITER_NAME)hide(TypedArrayPrototype,ITERATOR,$iterator);setSpecies(NAME);};}else module.exports=function(){ /* empty */};},{"10":10,"105":105,"106":106,"108":108,"109":109,"110":110,"112":112,"113":113,"114":114,"115":115,"116":116,"117":117,"12":12,"129":129,"13":13,"15":15,"16":16,"20":20,"27":27,"29":29,"33":33,"35":35,"39":39,"40":40,"41":41,"47":47,"49":49,"50":50,"55":55,"57":57,"59":59,"67":67,"68":68,"70":70,"72":72,"74":74,"85":85,"86":86,"89":89,"91":91,"95":95}],112:[function(_dereq_,module,exports){'use strict';var global=_dereq_(39),DESCRIPTORS=_dereq_(29),LIBRARY=_dereq_(59),$typed=_dereq_(113),hide=_dereq_(41),redefineAll=_dereq_(86),fails=_dereq_(35),anInstance=_dereq_(10),toInteger=_dereq_(106),toLength=_dereq_(108),gOPN=_dereq_(72).f,dP=_dereq_(68).f,arrayFill=_dereq_(13),setToStringTag=_dereq_(92),ARRAY_BUFFER='ArrayBuffer',DATA_VIEW='DataView',PROTOTYPE='prototype',WRONG_LENGTH='Wrong length!',WRONG_INDEX='Wrong index!',$ArrayBuffer=global[ARRAY_BUFFER],$DataView=global[DATA_VIEW],Math=global.Math,parseInt=global.parseInt,RangeError=global.RangeError,Infinity=global.Infinity,BaseBuffer=$ArrayBuffer,abs=Math.abs,pow=Math.pow,min=Math.min,floor=Math.floor,log=Math.log,LN2=Math.LN2,BUFFER='buffer',BYTE_LENGTH='byteLength',BYTE_OFFSET='byteOffset',$BUFFER=DESCRIPTORS?'_b':BUFFER,$LENGTH=DESCRIPTORS?'_l':BYTE_LENGTH,$OFFSET=DESCRIPTORS?'_o':BYTE_OFFSET; // IEEE754 conversions based on https://github.com/feross/ieee754
var packIEEE754=function packIEEE754(value,mLen,nBytes){var buffer=Array(nBytes),eLen=nBytes*8-mLen-1,eMax=(1<<eLen)-1,eBias=eMax>>1,rt=mLen===23?pow(2,-24)-pow(2,-77):0,i=0,s=value<0||value===0&&1/value<0?1:0,e,m,c;value=abs(value);if(value!=value||value===Infinity){m=value!=value?1:0;e=eMax;}else {e=floor(log(value)/LN2);if(value*(c=pow(2,-e))<1){e--;c*=2;}if(e+eBias>=1){value+=rt/c;}else {value+=rt*pow(2,1-eBias);}if(value*c>=2){e++;c/=2;}if(e+eBias>=eMax){m=0;e=eMax;}else if(e+eBias>=1){m=(value*c-1)*pow(2,mLen);e=e+eBias;}else {m=value*pow(2,eBias-1)*pow(2,mLen);e=0;}}for(;mLen>=8;buffer[i++]=m&255,m/=256,mLen-=8){}e=e<<mLen|m;eLen+=mLen;for(;eLen>0;buffer[i++]=e&255,e/=256,eLen-=8){}buffer[--i]|=s*128;return buffer;};var unpackIEEE754=function unpackIEEE754(buffer,mLen,nBytes){var eLen=nBytes*8-mLen-1,eMax=(1<<eLen)-1,eBias=eMax>>1,nBits=eLen-7,i=nBytes-1,s=buffer[i--],e=s&127,m;s>>=7;for(;nBits>0;e=e*256+buffer[i],i--,nBits-=8){}m=e&(1<<-nBits)-1;e>>=-nBits;nBits+=mLen;for(;nBits>0;m=m*256+buffer[i],i--,nBits-=8){}if(e===0){e=1-eBias;}else if(e===eMax){return m?NaN:s?-Infinity:Infinity;}else {m=m+pow(2,mLen);e=e-eBias;}return (s?-1:1)*m*pow(2,e-mLen);};var unpackI32=function unpackI32(bytes){return bytes[3]<<24|bytes[2]<<16|bytes[1]<<8|bytes[0];};var packI8=function packI8(it){return [it&0xff];};var packI16=function packI16(it){return [it&0xff,it>>8&0xff];};var packI32=function packI32(it){return [it&0xff,it>>8&0xff,it>>16&0xff,it>>24&0xff];};var packF64=function packF64(it){return packIEEE754(it,52,8);};var packF32=function packF32(it){return packIEEE754(it,23,4);};var addGetter=function addGetter(C,key,internal){dP(C[PROTOTYPE],key,{get:function get(){return this[internal];}});};var get=function get(view,bytes,index,isLittleEndian){var numIndex=+index,intIndex=toInteger(numIndex);if(numIndex!=intIndex||intIndex<0||intIndex+bytes>view[$LENGTH])throw RangeError(WRONG_INDEX);var store=view[$BUFFER]._b,start=intIndex+view[$OFFSET],pack=store.slice(start,start+bytes);return isLittleEndian?pack:pack.reverse();};var set=function set(view,bytes,index,conversion,value,isLittleEndian){var numIndex=+index,intIndex=toInteger(numIndex);if(numIndex!=intIndex||intIndex<0||intIndex+bytes>view[$LENGTH])throw RangeError(WRONG_INDEX);var store=view[$BUFFER]._b,start=intIndex+view[$OFFSET],pack=conversion(+value);for(var i=0;i<bytes;i++){store[start+i]=pack[isLittleEndian?i:bytes-i-1];}};var validateArrayBufferArguments=function validateArrayBufferArguments(that,length){anInstance(that,$ArrayBuffer,ARRAY_BUFFER);var numberLength=+length,byteLength=toLength(numberLength);if(numberLength!=byteLength)throw RangeError(WRONG_LENGTH);return byteLength;};if(!$typed.ABV){$ArrayBuffer=function ArrayBuffer(length){var byteLength=validateArrayBufferArguments(this,length);this._b=arrayFill.call(Array(byteLength),0);this[$LENGTH]=byteLength;};$DataView=function DataView(buffer,byteOffset,byteLength){anInstance(this,$DataView,DATA_VIEW);anInstance(buffer,$ArrayBuffer,DATA_VIEW);var bufferLength=buffer[$LENGTH],offset=toInteger(byteOffset);if(offset<0||offset>bufferLength)throw RangeError('Wrong offset!');byteLength=byteLength===undefined?bufferLength-offset:toLength(byteLength);if(offset+byteLength>bufferLength)throw RangeError(WRONG_LENGTH);this[$BUFFER]=buffer;this[$OFFSET]=offset;this[$LENGTH]=byteLength;};if(DESCRIPTORS){addGetter($ArrayBuffer,BYTE_LENGTH,'_l');addGetter($DataView,BUFFER,'_b');addGetter($DataView,BYTE_LENGTH,'_l');addGetter($DataView,BYTE_OFFSET,'_o');}redefineAll($DataView[PROTOTYPE],{getInt8:function getInt8(byteOffset){return get(this,1,byteOffset)[0]<<24>>24;},getUint8:function getUint8(byteOffset){return get(this,1,byteOffset)[0];},getInt16:function getInt16(byteOffset /*, littleEndian */){var bytes=get(this,2,byteOffset,arguments[1]);return (bytes[1]<<8|bytes[0])<<16>>16;},getUint16:function getUint16(byteOffset /*, littleEndian */){var bytes=get(this,2,byteOffset,arguments[1]);return bytes[1]<<8|bytes[0];},getInt32:function getInt32(byteOffset /*, littleEndian */){return unpackI32(get(this,4,byteOffset,arguments[1]));},getUint32:function getUint32(byteOffset /*, littleEndian */){return unpackI32(get(this,4,byteOffset,arguments[1]))>>>0;},getFloat32:function getFloat32(byteOffset /*, littleEndian */){return unpackIEEE754(get(this,4,byteOffset,arguments[1]),23,4);},getFloat64:function getFloat64(byteOffset /*, littleEndian */){return unpackIEEE754(get(this,8,byteOffset,arguments[1]),52,8);},setInt8:function setInt8(byteOffset,value){set(this,1,byteOffset,packI8,value);},setUint8:function setUint8(byteOffset,value){set(this,1,byteOffset,packI8,value);},setInt16:function setInt16(byteOffset,value /*, littleEndian */){set(this,2,byteOffset,packI16,value,arguments[2]);},setUint16:function setUint16(byteOffset,value /*, littleEndian */){set(this,2,byteOffset,packI16,value,arguments[2]);},setInt32:function setInt32(byteOffset,value /*, littleEndian */){set(this,4,byteOffset,packI32,value,arguments[2]);},setUint32:function setUint32(byteOffset,value /*, littleEndian */){set(this,4,byteOffset,packI32,value,arguments[2]);},setFloat32:function setFloat32(byteOffset,value /*, littleEndian */){set(this,4,byteOffset,packF32,value,arguments[2]);},setFloat64:function setFloat64(byteOffset,value /*, littleEndian */){set(this,8,byteOffset,packF64,value,arguments[2]);}});}else {if(!fails(function(){new $ArrayBuffer(); // eslint-disable-line no-new
})||!fails(function(){new $ArrayBuffer(.5); // eslint-disable-line no-new
})){$ArrayBuffer=function ArrayBuffer(length){return new BaseBuffer(validateArrayBufferArguments(this,length));};var ArrayBufferProto=$ArrayBuffer[PROTOTYPE]=BaseBuffer[PROTOTYPE];for(var keys=gOPN(BaseBuffer),j=0,key;keys.length>j;){if(!((key=keys[j++]) in $ArrayBuffer))hide($ArrayBuffer,key,BaseBuffer[key]);};if(!LIBRARY)ArrayBufferProto.constructor=$ArrayBuffer;} // iOS Safari 7.x bug
var view=new $DataView(new $ArrayBuffer(2)),$setInt8=$DataView[PROTOTYPE].setInt8;view.setInt8(0,2147483648);view.setInt8(1,2147483649);if(view.getInt8(0)||!view.getInt8(1))redefineAll($DataView[PROTOTYPE],{setInt8:function setInt8(byteOffset,value){$setInt8.call(this,byteOffset,value<<24>>24);},setUint8:function setUint8(byteOffset,value){$setInt8.call(this,byteOffset,value<<24>>24);}},true);}setToStringTag($ArrayBuffer,ARRAY_BUFFER);setToStringTag($DataView,DATA_VIEW);hide($DataView[PROTOTYPE],$typed.VIEW,true);exports[ARRAY_BUFFER]=$ArrayBuffer;exports[DATA_VIEW]=$DataView;},{"10":10,"106":106,"108":108,"113":113,"13":13,"29":29,"35":35,"39":39,"41":41,"59":59,"68":68,"72":72,"86":86,"92":92}],113:[function(_dereq_,module,exports){var global=_dereq_(39),hide=_dereq_(41),uid=_dereq_(114),TYPED=uid('typed_array'),VIEW=uid('view'),ABV=!!(global.ArrayBuffer&&global.DataView),CONSTR=ABV,i=0,l=9,Typed;var TypedArrayConstructors='Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array'.split(',');while(i<l){if(Typed=global[TypedArrayConstructors[i++]]){hide(Typed.prototype,TYPED,true);hide(Typed.prototype,VIEW,true);}else CONSTR=false;}module.exports={ABV:ABV,CONSTR:CONSTR,TYPED:TYPED,VIEW:VIEW};},{"114":114,"39":39,"41":41}],114:[function(_dereq_,module,exports){var id=0,px=Math.random();module.exports=function(key){return 'Symbol('.concat(key===undefined?'':key,')_',(++id+px).toString(36));};},{}],115:[function(_dereq_,module,exports){var store=_dereq_(94)('wks'),uid=_dereq_(114),_Symbol=_dereq_(39).Symbol,USE_SYMBOL=typeof _Symbol=='function';module.exports=function(name){return store[name]||(store[name]=USE_SYMBOL&&_Symbol[name]||(USE_SYMBOL?_Symbol:uid)('Symbol.'+name));};},{"114":114,"39":39,"94":94}],116:[function(_dereq_,module,exports){var classof=_dereq_(20),ITERATOR=_dereq_(115)('iterator'),Iterators=_dereq_(57);module.exports=_dereq_(26).getIteratorMethod=function(it){if(it!=undefined)return it[ITERATOR]||it['@@iterator']||Iterators[classof(it)];};},{"115":115,"20":20,"26":26,"57":57}],117:[function(_dereq_,module,exports){var classof=_dereq_(20),ITERATOR=_dereq_(115)('iterator'),Iterators=_dereq_(57);module.exports=_dereq_(26).isIterable=function(it){var O=Object(it);return O[ITERATOR]!==undefined||'@@iterator' in O||Iterators.hasOwnProperty(classof(O));};},{"115":115,"20":20,"26":26,"57":57}],118:[function(_dereq_,module,exports){ // https://github.com/benjamingr/RexExp.escape
var $export=_dereq_(33),$re=_dereq_(88)(/[\\^$*+?.()|[\]{}]/g,'\\$&');$export($export.S,'RegExp',{escape:function escape(it){return $re(it);}});},{"33":33,"88":88}],119:[function(_dereq_,module,exports){ // 22.1.3.3 Array.prototype.copyWithin(target, start, end = this.length)
var $export=_dereq_(33);$export($export.P,'Array',{copyWithin:_dereq_(12)});_dereq_(9)('copyWithin');},{"12":12,"33":33,"9":9}],120:[function(_dereq_,module,exports){'use strict';var $export=_dereq_(33),$every=_dereq_(16)(4);$export($export.P+$export.F*!_dereq_(96)([].every,true),'Array',{ // 22.1.3.5 / 15.4.4.16 Array.prototype.every(callbackfn [, thisArg])
every:function every(callbackfn /* , thisArg */){return $every(this,callbackfn,arguments[1]);}});},{"16":16,"33":33,"96":96}],121:[function(_dereq_,module,exports){ // 22.1.3.6 Array.prototype.fill(value, start = 0, end = this.length)
var $export=_dereq_(33);$export($export.P,'Array',{fill:_dereq_(13)});_dereq_(9)('fill');},{"13":13,"33":33,"9":9}],122:[function(_dereq_,module,exports){'use strict';var $export=_dereq_(33),$filter=_dereq_(16)(2);$export($export.P+$export.F*!_dereq_(96)([].filter,true),'Array',{ // 22.1.3.7 / 15.4.4.20 Array.prototype.filter(callbackfn [, thisArg])
filter:function filter(callbackfn /* , thisArg */){return $filter(this,callbackfn,arguments[1]);}});},{"16":16,"33":33,"96":96}],123:[function(_dereq_,module,exports){'use strict'; // 22.1.3.9 Array.prototype.findIndex(predicate, thisArg = undefined)
var $export=_dereq_(33),$find=_dereq_(16)(6),KEY='findIndex',forced=true; // Shouldn't skip holes
if(KEY in [])Array(1)[KEY](function(){forced=false;});$export($export.P+$export.F*forced,'Array',{findIndex:function findIndex(callbackfn /*, that = undefined */){return $find(this,callbackfn,arguments.length>1?arguments[1]:undefined);}});_dereq_(9)(KEY);},{"16":16,"33":33,"9":9}],124:[function(_dereq_,module,exports){'use strict'; // 22.1.3.8 Array.prototype.find(predicate, thisArg = undefined)
var $export=_dereq_(33),$find=_dereq_(16)(5),KEY='find',forced=true; // Shouldn't skip holes
if(KEY in [])Array(1)[KEY](function(){forced=false;});$export($export.P+$export.F*forced,'Array',{find:function find(callbackfn /*, that = undefined */){return $find(this,callbackfn,arguments.length>1?arguments[1]:undefined);}});_dereq_(9)(KEY);},{"16":16,"33":33,"9":9}],125:[function(_dereq_,module,exports){'use strict';var $export=_dereq_(33),$forEach=_dereq_(16)(0),STRICT=_dereq_(96)([].forEach,true);$export($export.P+$export.F*!STRICT,'Array',{ // 22.1.3.10 / 15.4.4.18 Array.prototype.forEach(callbackfn [, thisArg])
forEach:function forEach(callbackfn /* , thisArg */){return $forEach(this,callbackfn,arguments[1]);}});},{"16":16,"33":33,"96":96}],126:[function(_dereq_,module,exports){'use strict';var ctx=_dereq_(27),$export=_dereq_(33),toObject=_dereq_(109),call=_dereq_(52),isArrayIter=_dereq_(47),toLength=_dereq_(108),getIterFn=_dereq_(116);$export($export.S+$export.F*!_dereq_(55)(function(iter){Array.from(iter);}),'Array',{ // 22.1.2.1 Array.from(arrayLike, mapfn = undefined, thisArg = undefined)
from:function from(arrayLike /*, mapfn = undefined, thisArg = undefined*/){var O=toObject(arrayLike),C=typeof this=='function'?this:Array,aLen=arguments.length,mapfn=aLen>1?arguments[1]:undefined,mapping=mapfn!==undefined,index=0,iterFn=getIterFn(O),length,result,step,iterator;if(mapping)mapfn=ctx(mapfn,aLen>2?arguments[2]:undefined,2); // if object isn't iterable or it's array with default iterator - use simple case
if(iterFn!=undefined&&!(C==Array&&isArrayIter(iterFn))){for(iterator=iterFn.call(O),result=new C();!(step=iterator.next()).done;index++){result[index]=mapping?call(iterator,mapfn,[step.value,index],true):step.value;}}else {length=toLength(O.length);for(result=new C(length);length>index;index++){result[index]=mapping?mapfn(O[index],index):O[index];}}result.length=index;return result;}});},{"108":108,"109":109,"116":116,"27":27,"33":33,"47":47,"52":52,"55":55}],127:[function(_dereq_,module,exports){'use strict';var $export=_dereq_(33),$indexOf=_dereq_(15)(false);$export($export.P+$export.F*!_dereq_(96)([].indexOf),'Array',{ // 22.1.3.11 / 15.4.4.14 Array.prototype.indexOf(searchElement [, fromIndex])
indexOf:function indexOf(searchElement /*, fromIndex = 0 */){return $indexOf(this,searchElement,arguments[1]);}});},{"15":15,"33":33,"96":96}],128:[function(_dereq_,module,exports){ // 22.1.2.2 / 15.4.3.2 Array.isArray(arg)
var $export=_dereq_(33);$export($export.S,'Array',{isArray:_dereq_(48)});},{"33":33,"48":48}],129:[function(_dereq_,module,exports){'use strict';var addToUnscopables=_dereq_(9),step=_dereq_(56),Iterators=_dereq_(57),toIObject=_dereq_(107); // 22.1.3.4 Array.prototype.entries()
// 22.1.3.13 Array.prototype.keys()
// 22.1.3.29 Array.prototype.values()
// 22.1.3.30 Array.prototype[@@iterator]()
module.exports=_dereq_(54)(Array,'Array',function(iterated,kind){this._t=toIObject(iterated); // target
this._i=0; // next index
this._k=kind; // kind
// 22.1.5.2.1 %ArrayIteratorPrototype%.next()
},function(){var O=this._t,kind=this._k,index=this._i++;if(!O||index>=O.length){this._t=undefined;return step(1);}if(kind=='keys')return step(0,index);if(kind=='values')return step(0,O[index]);return step(0,[index,O[index]]);},'values'); // argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7)
Iterators.Arguments=Iterators.Array;addToUnscopables('keys');addToUnscopables('values');addToUnscopables('entries');},{"107":107,"54":54,"56":56,"57":57,"9":9}],130:[function(_dereq_,module,exports){'use strict'; // 22.1.3.13 Array.prototype.join(separator)
var $export=_dereq_(33),toIObject=_dereq_(107),arrayJoin=[].join; // fallback for not array-like strings
$export($export.P+$export.F*(_dereq_(46)!=Object||!_dereq_(96)(arrayJoin)),'Array',{join:function join(separator){return arrayJoin.call(toIObject(this),separator===undefined?',':separator);}});},{"107":107,"33":33,"46":46,"96":96}],131:[function(_dereq_,module,exports){'use strict';var $export=_dereq_(33),toIObject=_dereq_(107),toInteger=_dereq_(106),toLength=_dereq_(108);$export($export.P+$export.F*!_dereq_(96)([].lastIndexOf),'Array',{ // 22.1.3.14 / 15.4.4.15 Array.prototype.lastIndexOf(searchElement [, fromIndex])
lastIndexOf:function lastIndexOf(searchElement /*, fromIndex = @[*-1] */){var O=toIObject(this),length=toLength(O.length),index=length-1;if(arguments.length>1)index=Math.min(index,toInteger(arguments[1]));if(index<0)index=length+index;for(;index>=0;index--){if(index in O)if(O[index]===searchElement)return index;}return -1;}});},{"106":106,"107":107,"108":108,"33":33,"96":96}],132:[function(_dereq_,module,exports){'use strict';var $export=_dereq_(33),$map=_dereq_(16)(1);$export($export.P+$export.F*!_dereq_(96)([].map,true),'Array',{ // 22.1.3.15 / 15.4.4.19 Array.prototype.map(callbackfn [, thisArg])
map:function map(callbackfn /* , thisArg */){return $map(this,callbackfn,arguments[1]);}});},{"16":16,"33":33,"96":96}],133:[function(_dereq_,module,exports){'use strict';var $export=_dereq_(33); // WebKit Array.of isn't generic
$export($export.S+$export.F*_dereq_(35)(function(){function F(){}return !(Array.of.call(F) instanceof F);}),'Array',{ // 22.1.2.3 Array.of( ...items)
of:function of() /* ...args */{var index=0,aLen=arguments.length,result=new (typeof this=='function'?this:Array)(aLen);while(aLen>index){result[index]=arguments[index++];}result.length=aLen;return result;}});},{"33":33,"35":35}],134:[function(_dereq_,module,exports){'use strict';var $export=_dereq_(33),$reduce=_dereq_(17);$export($export.P+$export.F*!_dereq_(96)([].reduceRight,true),'Array',{ // 22.1.3.19 / 15.4.4.22 Array.prototype.reduceRight(callbackfn [, initialValue])
reduceRight:function reduceRight(callbackfn /* , initialValue */){return $reduce(this,callbackfn,arguments.length,arguments[1],true);}});},{"17":17,"33":33,"96":96}],135:[function(_dereq_,module,exports){'use strict';var $export=_dereq_(33),$reduce=_dereq_(17);$export($export.P+$export.F*!_dereq_(96)([].reduce,true),'Array',{ // 22.1.3.18 / 15.4.4.21 Array.prototype.reduce(callbackfn [, initialValue])
reduce:function reduce(callbackfn /* , initialValue */){return $reduce(this,callbackfn,arguments.length,arguments[1],false);}});},{"17":17,"33":33,"96":96}],136:[function(_dereq_,module,exports){'use strict';var $export=_dereq_(33),html=_dereq_(42),cof=_dereq_(21),toIndex=_dereq_(105),toLength=_dereq_(108),arraySlice=[].slice; // fallback for not array-like ES3 strings and DOM objects
$export($export.P+$export.F*_dereq_(35)(function(){if(html)arraySlice.call(html);}),'Array',{slice:function slice(begin,end){var len=toLength(this.length),klass=cof(this);end=end===undefined?len:end;if(klass=='Array')return arraySlice.call(this,begin,end);var start=toIndex(begin,len),upTo=toIndex(end,len),size=toLength(upTo-start),cloned=Array(size),i=0;for(;i<size;i++){cloned[i]=klass=='String'?this.charAt(start+i):this[start+i];}return cloned;}});},{"105":105,"108":108,"21":21,"33":33,"35":35,"42":42}],137:[function(_dereq_,module,exports){'use strict';var $export=_dereq_(33),$some=_dereq_(16)(3);$export($export.P+$export.F*!_dereq_(96)([].some,true),'Array',{ // 22.1.3.23 / 15.4.4.17 Array.prototype.some(callbackfn [, thisArg])
some:function some(callbackfn /* , thisArg */){return $some(this,callbackfn,arguments[1]);}});},{"16":16,"33":33,"96":96}],138:[function(_dereq_,module,exports){'use strict';var $export=_dereq_(33),aFunction=_dereq_(7),toObject=_dereq_(109),fails=_dereq_(35),$sort=[].sort,test=[1,2,3];$export($export.P+$export.F*(fails(function(){ // IE8-
test.sort(undefined);})||!fails(function(){ // V8 bug
test.sort(null); // Old WebKit
})||!_dereq_(96)($sort)),'Array',{ // 22.1.3.25 Array.prototype.sort(comparefn)
sort:function sort(comparefn){return comparefn===undefined?$sort.call(toObject(this)):$sort.call(toObject(this),aFunction(comparefn));}});},{"109":109,"33":33,"35":35,"7":7,"96":96}],139:[function(_dereq_,module,exports){_dereq_(91)('Array');},{"91":91}],140:[function(_dereq_,module,exports){ // 20.3.3.1 / 15.9.4.4 Date.now()
var $export=_dereq_(33);$export($export.S,'Date',{now:function now(){return +new Date();}});},{"33":33}],141:[function(_dereq_,module,exports){'use strict'; // 20.3.4.36 / 15.9.5.43 Date.prototype.toISOString()
var $export=_dereq_(33),fails=_dereq_(35);var lz=function lz(num){return num>9?num:'0'+num;}; // PhantomJS / old WebKit has a broken implementations
$export($export.P+$export.F*(fails(function(){return new Date(-5e13-1).toISOString()!='0385-07-25T07:06:39.999Z';})||!fails(function(){new Date(NaN).toISOString();})),'Date',{toISOString:function toISOString(){if(!isFinite(this))throw RangeError('Invalid time value');var d=this,y=d.getUTCFullYear(),m=d.getUTCMilliseconds(),s=y<0?'-':y>9999?'+':'';return s+('00000'+Math.abs(y)).slice(s?-6:-4)+'-'+lz(d.getUTCMonth()+1)+'-'+lz(d.getUTCDate())+'T'+lz(d.getUTCHours())+':'+lz(d.getUTCMinutes())+':'+lz(d.getUTCSeconds())+'.'+(m>99?m:'0'+lz(m))+'Z';}});},{"33":33,"35":35}],142:[function(_dereq_,module,exports){'use strict';var $export=_dereq_(33),toObject=_dereq_(109),toPrimitive=_dereq_(110);$export($export.P+$export.F*_dereq_(35)(function(){return new Date(NaN).toJSON()!==null||Date.prototype.toJSON.call({toISOString:function toISOString(){return 1;}})!==1;}),'Date',{toJSON:function toJSON(key){var O=toObject(this),pv=toPrimitive(O);return typeof pv=='number'&&!isFinite(pv)?null:O.toISOString();}});},{"109":109,"110":110,"33":33,"35":35}],143:[function(_dereq_,module,exports){var DateProto=Date.prototype,INVALID_DATE='Invalid Date',TO_STRING='toString',$toString=DateProto[TO_STRING];if(new Date(NaN)+''!=INVALID_DATE){_dereq_(87)(DateProto,TO_STRING,function toString(){var value=+this;return value===value?$toString.call(this):INVALID_DATE;});}},{"87":87}],144:[function(_dereq_,module,exports){ // 19.2.3.2 / 15.3.4.5 Function.prototype.bind(thisArg, args...)
var $export=_dereq_(33);$export($export.P,'Function',{bind:_dereq_(19)});},{"19":19,"33":33}],145:[function(_dereq_,module,exports){'use strict';var isObject=_dereq_(50),getPrototypeOf=_dereq_(74),HAS_INSTANCE=_dereq_(115)('hasInstance'),FunctionProto=Function.prototype; // 19.2.3.6 Function.prototype[@@hasInstance](V)
if(!(HAS_INSTANCE in FunctionProto))_dereq_(68).f(FunctionProto,HAS_INSTANCE,{value:function value(O){if(typeof this!='function'||!isObject(O))return false;if(!isObject(this.prototype))return O instanceof this; // for environment w/o native `@@hasInstance` logic enough `instanceof`, but add this:
while(O=getPrototypeOf(O)){if(this.prototype===O)return true;}return false;}});},{"115":115,"50":50,"68":68,"74":74}],146:[function(_dereq_,module,exports){var dP=_dereq_(68).f,createDesc=_dereq_(85),has=_dereq_(40),FProto=Function.prototype,nameRE=/^\s*function ([^ (]*)/,NAME='name'; // 19.2.4.2 name
NAME in FProto||_dereq_(29)&&dP(FProto,NAME,{configurable:true,get:function get(){var match=(''+this).match(nameRE),name=match?match[1]:'';has(this,NAME)||dP(this,NAME,createDesc(5,name));return name;}});},{"29":29,"40":40,"68":68,"85":85}],147:[function(_dereq_,module,exports){'use strict';var strong=_dereq_(22); // 23.1 Map Objects
module.exports=_dereq_(25)('Map',function(get){return function Map(){return get(this,arguments.length>0?arguments[0]:undefined);};},{ // 23.1.3.6 Map.prototype.get(key)
get:function get(key){var entry=strong.getEntry(this,key);return entry&&entry.v;}, // 23.1.3.9 Map.prototype.set(key, value)
set:function set(key,value){return strong.def(this,key===0?0:key,value);}},strong,true);},{"22":22,"25":25}],148:[function(_dereq_,module,exports){ // 20.2.2.3 Math.acosh(x)
var $export=_dereq_(33),log1p=_dereq_(61),sqrt=Math.sqrt,$acosh=Math.acosh; // V8 bug https://code.google.com/p/v8/issues/detail?id=3509
$export($export.S+$export.F*!($acosh&&Math.floor($acosh(Number.MAX_VALUE))==710),'Math',{acosh:function acosh(x){return (x=+x)<1?NaN:x>94906265.62425156?Math.log(x)+Math.LN2:log1p(x-1+sqrt(x-1)*sqrt(x+1));}});},{"33":33,"61":61}],149:[function(_dereq_,module,exports){ // 20.2.2.5 Math.asinh(x)
var $export=_dereq_(33);function asinh(x){return !isFinite(x=+x)||x==0?x:x<0?-asinh(-x):Math.log(x+Math.sqrt(x*x+1));}$export($export.S,'Math',{asinh:asinh});},{"33":33}],150:[function(_dereq_,module,exports){ // 20.2.2.7 Math.atanh(x)
var $export=_dereq_(33);$export($export.S,'Math',{atanh:function atanh(x){return (x=+x)==0?x:Math.log((1+x)/(1-x))/2;}});},{"33":33}],151:[function(_dereq_,module,exports){ // 20.2.2.9 Math.cbrt(x)
var $export=_dereq_(33),sign=_dereq_(62);$export($export.S,'Math',{cbrt:function cbrt(x){return sign(x=+x)*Math.pow(Math.abs(x),1/3);}});},{"33":33,"62":62}],152:[function(_dereq_,module,exports){ // 20.2.2.11 Math.clz32(x)
var $export=_dereq_(33);$export($export.S,'Math',{clz32:function clz32(x){return (x>>>=0)?31-Math.floor(Math.log(x+0.5)*Math.LOG2E):32;}});},{"33":33}],153:[function(_dereq_,module,exports){ // 20.2.2.12 Math.cosh(x)
var $export=_dereq_(33),exp=Math.exp;$export($export.S,'Math',{cosh:function cosh(x){return (exp(x=+x)+exp(-x))/2;}});},{"33":33}],154:[function(_dereq_,module,exports){ // 20.2.2.14 Math.expm1(x)
var $export=_dereq_(33);$export($export.S,'Math',{expm1:_dereq_(60)});},{"33":33,"60":60}],155:[function(_dereq_,module,exports){ // 20.2.2.16 Math.fround(x)
var $export=_dereq_(33),sign=_dereq_(62),pow=Math.pow,EPSILON=pow(2,-52),EPSILON32=pow(2,-23),MAX32=pow(2,127)*(2-EPSILON32),MIN32=pow(2,-126);var roundTiesToEven=function roundTiesToEven(n){return n+1/EPSILON-1/EPSILON;};$export($export.S,'Math',{fround:function fround(x){var $abs=Math.abs(x),$sign=sign(x),a,result;if($abs<MIN32)return $sign*roundTiesToEven($abs/MIN32/EPSILON32)*MIN32*EPSILON32;a=(1+EPSILON32/EPSILON)*$abs;result=a-(a-$abs);if(result>MAX32||result!=result)return $sign*Infinity;return $sign*result;}});},{"33":33,"62":62}],156:[function(_dereq_,module,exports){ // 20.2.2.17 Math.hypot([value1[, value2[, … ]]])
var $export=_dereq_(33),abs=Math.abs;$export($export.S,'Math',{hypot:function hypot(value1,value2){ // eslint-disable-line no-unused-vars
var sum=0,i=0,aLen=arguments.length,larg=0,arg,div;while(i<aLen){arg=abs(arguments[i++]);if(larg<arg){div=larg/arg;sum=sum*div*div+1;larg=arg;}else if(arg>0){div=arg/larg;sum+=div*div;}else sum+=arg;}return larg===Infinity?Infinity:larg*Math.sqrt(sum);}});},{"33":33}],157:[function(_dereq_,module,exports){ // 20.2.2.18 Math.imul(x, y)
var $export=_dereq_(33),$imul=Math.imul; // some WebKit versions fails with big numbers, some has wrong arity
$export($export.S+$export.F*_dereq_(35)(function(){return $imul(0xffffffff,5)!=-5||$imul.length!=2;}),'Math',{imul:function imul(x,y){var UINT16=0xffff,xn=+x,yn=+y,xl=UINT16&xn,yl=UINT16&yn;return 0|xl*yl+((UINT16&xn>>>16)*yl+xl*(UINT16&yn>>>16)<<16>>>0);}});},{"33":33,"35":35}],158:[function(_dereq_,module,exports){ // 20.2.2.21 Math.log10(x)
var $export=_dereq_(33);$export($export.S,'Math',{log10:function log10(x){return Math.log(x)/Math.LN10;}});},{"33":33}],159:[function(_dereq_,module,exports){ // 20.2.2.20 Math.log1p(x)
var $export=_dereq_(33);$export($export.S,'Math',{log1p:_dereq_(61)});},{"33":33,"61":61}],160:[function(_dereq_,module,exports){ // 20.2.2.22 Math.log2(x)
var $export=_dereq_(33);$export($export.S,'Math',{log2:function log2(x){return Math.log(x)/Math.LN2;}});},{"33":33}],161:[function(_dereq_,module,exports){ // 20.2.2.28 Math.sign(x)
var $export=_dereq_(33);$export($export.S,'Math',{sign:_dereq_(62)});},{"33":33,"62":62}],162:[function(_dereq_,module,exports){ // 20.2.2.30 Math.sinh(x)
var $export=_dereq_(33),expm1=_dereq_(60),exp=Math.exp; // V8 near Chromium 38 has a problem with very small numbers
$export($export.S+$export.F*_dereq_(35)(function(){return !Math.sinh(-2e-17)!=-2e-17;}),'Math',{sinh:function sinh(x){return Math.abs(x=+x)<1?(expm1(x)-expm1(-x))/2:(exp(x-1)-exp(-x-1))*(Math.E/2);}});},{"33":33,"35":35,"60":60}],163:[function(_dereq_,module,exports){ // 20.2.2.33 Math.tanh(x)
var $export=_dereq_(33),expm1=_dereq_(60),exp=Math.exp;$export($export.S,'Math',{tanh:function tanh(x){var a=expm1(x=+x),b=expm1(-x);return a==Infinity?1:b==Infinity?-1:(a-b)/(exp(x)+exp(-x));}});},{"33":33,"60":60}],164:[function(_dereq_,module,exports){ // 20.2.2.34 Math.trunc(x)
var $export=_dereq_(33);$export($export.S,'Math',{trunc:function trunc(it){return (it>0?Math.floor:Math.ceil)(it);}});},{"33":33}],165:[function(_dereq_,module,exports){'use strict';var global=_dereq_(39),has=_dereq_(40),cof=_dereq_(21),inheritIfRequired=_dereq_(44),toPrimitive=_dereq_(110),fails=_dereq_(35),gOPN=_dereq_(72).f,gOPD=_dereq_(70).f,dP=_dereq_(68).f,$trim=_dereq_(102).trim,NUMBER='Number',$Number=global[NUMBER],Base=$Number,proto=$Number.prototype // Opera ~12 has broken Object#toString
,BROKEN_COF=cof(_dereq_(67)(proto))==NUMBER,TRIM='trim' in String.prototype; // 7.1.3 ToNumber(argument)
var toNumber=function toNumber(argument){var it=toPrimitive(argument,false);if(typeof it=='string'&&it.length>2){it=TRIM?it.trim():$trim(it,3);var first=it.charCodeAt(0),third,radix,maxCode;if(first===43||first===45){third=it.charCodeAt(2);if(third===88||third===120)return NaN; // Number('+0x1') should be NaN, old V8 fix
}else if(first===48){switch(it.charCodeAt(1)){case 66:case 98:radix=2;maxCode=49;break; // fast equal /^0b[01]+$/i
case 79:case 111:radix=8;maxCode=55;break; // fast equal /^0o[0-7]+$/i
default:return +it;}for(var digits=it.slice(2),i=0,l=digits.length,code;i<l;i++){code=digits.charCodeAt(i); // parseInt parses a string to a first unavailable symbol
// but ToNumber should return NaN if a string contains unavailable symbols
if(code<48||code>maxCode)return NaN;}return parseInt(digits,radix);}}return +it;};if(!$Number(' 0o1')||!$Number('0b1')||$Number('+0x1')){$Number=function Number(value){var it=arguments.length<1?0:value,that=this;return that instanceof $Number // check on 1..constructor(foo) case
&&(BROKEN_COF?fails(function(){proto.valueOf.call(that);}):cof(that)!=NUMBER)?inheritIfRequired(new Base(toNumber(it)),that,$Number):toNumber(it);};for(var keys=_dereq_(29)?gOPN(Base):( // ES3:
'MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,'+ // ES6 (in case, if modules with ES6 Number statics required before):
'EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,'+'MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger').split(','),j=0,key;keys.length>j;j++){if(has(Base,key=keys[j])&&!has($Number,key)){dP($Number,key,gOPD(Base,key));}}$Number.prototype=proto;proto.constructor=$Number;_dereq_(87)(global,NUMBER,$Number);}},{"102":102,"110":110,"21":21,"29":29,"35":35,"39":39,"40":40,"44":44,"67":67,"68":68,"70":70,"72":72,"87":87}],166:[function(_dereq_,module,exports){ // 20.1.2.1 Number.EPSILON
var $export=_dereq_(33);$export($export.S,'Number',{EPSILON:Math.pow(2,-52)});},{"33":33}],167:[function(_dereq_,module,exports){ // 20.1.2.2 Number.isFinite(number)
var $export=_dereq_(33),_isFinite=_dereq_(39).isFinite;$export($export.S,'Number',{isFinite:function isFinite(it){return typeof it=='number'&&_isFinite(it);}});},{"33":33,"39":39}],168:[function(_dereq_,module,exports){ // 20.1.2.3 Number.isInteger(number)
var $export=_dereq_(33);$export($export.S,'Number',{isInteger:_dereq_(49)});},{"33":33,"49":49}],169:[function(_dereq_,module,exports){ // 20.1.2.4 Number.isNaN(number)
var $export=_dereq_(33);$export($export.S,'Number',{isNaN:function isNaN(number){return number!=number;}});},{"33":33}],170:[function(_dereq_,module,exports){ // 20.1.2.5 Number.isSafeInteger(number)
var $export=_dereq_(33),isInteger=_dereq_(49),abs=Math.abs;$export($export.S,'Number',{isSafeInteger:function isSafeInteger(number){return isInteger(number)&&abs(number)<=0x1fffffffffffff;}});},{"33":33,"49":49}],171:[function(_dereq_,module,exports){ // 20.1.2.6 Number.MAX_SAFE_INTEGER
var $export=_dereq_(33);$export($export.S,'Number',{MAX_SAFE_INTEGER:0x1fffffffffffff});},{"33":33}],172:[function(_dereq_,module,exports){ // 20.1.2.10 Number.MIN_SAFE_INTEGER
var $export=_dereq_(33);$export($export.S,'Number',{MIN_SAFE_INTEGER:-0x1fffffffffffff});},{"33":33}],173:[function(_dereq_,module,exports){var $export=_dereq_(33),$parseFloat=_dereq_(81); // 20.1.2.12 Number.parseFloat(string)
$export($export.S+$export.F*(Number.parseFloat!=$parseFloat),'Number',{parseFloat:$parseFloat});},{"33":33,"81":81}],174:[function(_dereq_,module,exports){var $export=_dereq_(33),$parseInt=_dereq_(82); // 20.1.2.13 Number.parseInt(string, radix)
$export($export.S+$export.F*(Number.parseInt!=$parseInt),'Number',{parseInt:$parseInt});},{"33":33,"82":82}],175:[function(_dereq_,module,exports){'use strict';var $export=_dereq_(33),anInstance=_dereq_(10),toInteger=_dereq_(106),aNumberValue=_dereq_(8),repeat=_dereq_(101),$toFixed=1..toFixed,floor=Math.floor,data=[0,0,0,0,0,0],ERROR='Number.toFixed: incorrect invocation!',ZERO='0';var multiply=function multiply(n,c){var i=-1,c2=c;while(++i<6){c2+=n*data[i];data[i]=c2%1e7;c2=floor(c2/1e7);}};var divide=function divide(n){var i=6,c=0;while(--i>=0){c+=data[i];data[i]=floor(c/n);c=c%n*1e7;}};var numToString=function numToString(){var i=6,s='';while(--i>=0){if(s!==''||i===0||data[i]!==0){var t=String(data[i]);s=s===''?t:s+repeat.call(ZERO,7-t.length)+t;}}return s;};var pow=function pow(x,n,acc){return n===0?acc:n%2===1?pow(x,n-1,acc*x):pow(x*x,n/2,acc);};var log=function log(x){var n=0,x2=x;while(x2>=4096){n+=12;x2/=4096;}while(x2>=2){n+=1;x2/=2;}return n;};$export($export.P+$export.F*(!!$toFixed&&(0.00008.toFixed(3)!=='0.000'||0.9.toFixed(0)!=='1'||1.255.toFixed(2)!=='1.25'||1000000000000000128..toFixed(0)!=='1000000000000000128')||!_dereq_(35)(function(){ // V8 ~ Android 4.3-
$toFixed.call({});})),'Number',{toFixed:function toFixed(fractionDigits){var x=aNumberValue(this,ERROR),f=toInteger(fractionDigits),s='',m=ZERO,e,z,j,k;if(f<0||f>20)throw RangeError(ERROR);if(x!=x)return 'NaN';if(x<=-1e21||x>=1e21)return String(x);if(x<0){s='-';x=-x;}if(x>1e-21){e=log(x*pow(2,69,1))-69;z=e<0?x*pow(2,-e,1):x/pow(2,e,1);z*=0x10000000000000;e=52-e;if(e>0){multiply(0,z);j=f;while(j>=7){multiply(1e7,0);j-=7;}multiply(pow(10,j,1),0);j=e-1;while(j>=23){divide(1<<23);j-=23;}divide(1<<j);multiply(1,1);divide(2);m=numToString();}else {multiply(0,z);multiply(1<<-e,0);m=numToString()+repeat.call(ZERO,f);}}if(f>0){k=m.length;m=s+(k<=f?'0.'+repeat.call(ZERO,f-k)+m:m.slice(0,k-f)+'.'+m.slice(k-f));}else {m=s+m;}return m;}});},{"10":10,"101":101,"106":106,"33":33,"35":35,"8":8}],176:[function(_dereq_,module,exports){'use strict';var $export=_dereq_(33),$fails=_dereq_(35),aNumberValue=_dereq_(8),$toPrecision=1..toPrecision;$export($export.P+$export.F*($fails(function(){ // IE7-
return $toPrecision.call(1,undefined)!=='1';})||!$fails(function(){ // V8 ~ Android 4.3-
$toPrecision.call({});})),'Number',{toPrecision:function toPrecision(precision){var that=aNumberValue(this,'Number#toPrecision: incorrect invocation!');return precision===undefined?$toPrecision.call(that):$toPrecision.call(that,precision);}});},{"33":33,"35":35,"8":8}],177:[function(_dereq_,module,exports){ // 19.1.3.1 Object.assign(target, source)
var $export=_dereq_(33);$export($export.S+$export.F,'Object',{assign:_dereq_(66)});},{"33":33,"66":66}],178:[function(_dereq_,module,exports){var $export=_dereq_(33); // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
$export($export.S,'Object',{create:_dereq_(67)});},{"33":33,"67":67}],179:[function(_dereq_,module,exports){var $export=_dereq_(33); // 19.1.2.3 / 15.2.3.7 Object.defineProperties(O, Properties)
$export($export.S+$export.F*!_dereq_(29),'Object',{defineProperties:_dereq_(69)});},{"29":29,"33":33,"69":69}],180:[function(_dereq_,module,exports){var $export=_dereq_(33); // 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes)
$export($export.S+$export.F*!_dereq_(29),'Object',{defineProperty:_dereq_(68).f});},{"29":29,"33":33,"68":68}],181:[function(_dereq_,module,exports){ // 19.1.2.5 Object.freeze(O)
var isObject=_dereq_(50),meta=_dereq_(63).onFreeze;_dereq_(78)('freeze',function($freeze){return function freeze(it){return $freeze&&isObject(it)?$freeze(meta(it)):it;};});},{"50":50,"63":63,"78":78}],182:[function(_dereq_,module,exports){ // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P)
var toIObject=_dereq_(107),$getOwnPropertyDescriptor=_dereq_(70).f;_dereq_(78)('getOwnPropertyDescriptor',function(){return function getOwnPropertyDescriptor(it,key){return $getOwnPropertyDescriptor(toIObject(it),key);};});},{"107":107,"70":70,"78":78}],183:[function(_dereq_,module,exports){ // 19.1.2.7 Object.getOwnPropertyNames(O)
_dereq_(78)('getOwnPropertyNames',function(){return _dereq_(71).f;});},{"71":71,"78":78}],184:[function(_dereq_,module,exports){ // 19.1.2.9 Object.getPrototypeOf(O)
var toObject=_dereq_(109),$getPrototypeOf=_dereq_(74);_dereq_(78)('getPrototypeOf',function(){return function getPrototypeOf(it){return $getPrototypeOf(toObject(it));};});},{"109":109,"74":74,"78":78}],185:[function(_dereq_,module,exports){ // 19.1.2.11 Object.isExtensible(O)
var isObject=_dereq_(50);_dereq_(78)('isExtensible',function($isExtensible){return function isExtensible(it){return isObject(it)?$isExtensible?$isExtensible(it):true:false;};});},{"50":50,"78":78}],186:[function(_dereq_,module,exports){ // 19.1.2.12 Object.isFrozen(O)
var isObject=_dereq_(50);_dereq_(78)('isFrozen',function($isFrozen){return function isFrozen(it){return isObject(it)?$isFrozen?$isFrozen(it):false:true;};});},{"50":50,"78":78}],187:[function(_dereq_,module,exports){ // 19.1.2.13 Object.isSealed(O)
var isObject=_dereq_(50);_dereq_(78)('isSealed',function($isSealed){return function isSealed(it){return isObject(it)?$isSealed?$isSealed(it):false:true;};});},{"50":50,"78":78}],188:[function(_dereq_,module,exports){ // 19.1.3.10 Object.is(value1, value2)
var $export=_dereq_(33);$export($export.S,'Object',{is:_dereq_(89)});},{"33":33,"89":89}],189:[function(_dereq_,module,exports){ // 19.1.2.14 Object.keys(O)
var toObject=_dereq_(109),$keys=_dereq_(76);_dereq_(78)('keys',function(){return function keys(it){return $keys(toObject(it));};});},{"109":109,"76":76,"78":78}],190:[function(_dereq_,module,exports){ // 19.1.2.15 Object.preventExtensions(O)
var isObject=_dereq_(50),meta=_dereq_(63).onFreeze;_dereq_(78)('preventExtensions',function($preventExtensions){return function preventExtensions(it){return $preventExtensions&&isObject(it)?$preventExtensions(meta(it)):it;};});},{"50":50,"63":63,"78":78}],191:[function(_dereq_,module,exports){ // 19.1.2.17 Object.seal(O)
var isObject=_dereq_(50),meta=_dereq_(63).onFreeze;_dereq_(78)('seal',function($seal){return function seal(it){return $seal&&isObject(it)?$seal(meta(it)):it;};});},{"50":50,"63":63,"78":78}],192:[function(_dereq_,module,exports){ // 19.1.3.19 Object.setPrototypeOf(O, proto)
var $export=_dereq_(33);$export($export.S,'Object',{setPrototypeOf:_dereq_(90).set});},{"33":33,"90":90}],193:[function(_dereq_,module,exports){'use strict'; // 19.1.3.6 Object.prototype.toString()
var classof=_dereq_(20),test={};test[_dereq_(115)('toStringTag')]='z';if(test+''!='[object z]'){_dereq_(87)(Object.prototype,'toString',function toString(){return '[object '+classof(this)+']';},true);}},{"115":115,"20":20,"87":87}],194:[function(_dereq_,module,exports){var $export=_dereq_(33),$parseFloat=_dereq_(81); // 18.2.4 parseFloat(string)
$export($export.G+$export.F*(parseFloat!=$parseFloat),{parseFloat:$parseFloat});},{"33":33,"81":81}],195:[function(_dereq_,module,exports){var $export=_dereq_(33),$parseInt=_dereq_(82); // 18.2.5 parseInt(string, radix)
$export($export.G+$export.F*(parseInt!=$parseInt),{parseInt:$parseInt});},{"33":33,"82":82}],196:[function(_dereq_,module,exports){'use strict';var LIBRARY=_dereq_(59),global=_dereq_(39),ctx=_dereq_(27),classof=_dereq_(20),$export=_dereq_(33),isObject=_dereq_(50),anObject=_dereq_(11),aFunction=_dereq_(7),anInstance=_dereq_(10),forOf=_dereq_(38),setProto=_dereq_(90).set,speciesConstructor=_dereq_(95),task=_dereq_(104).set,microtask=_dereq_(65),PROMISE='Promise',TypeError=global.TypeError,process=global.process,$Promise=global[PROMISE],isNode=classof(process)=='process',empty=function empty(){ /* empty */},Internal,GenericPromiseCapability,Wrapper;var USE_NATIVE=!!function(){try{ // correct subclassing with @@species support
var promise=$Promise.resolve(1),FakePromise=(promise.constructor={})[_dereq_(115)('species')]=function(exec){exec(empty,empty);}; // unhandled rejections tracking support, NodeJS Promise without it fails @@species test
return (isNode||typeof PromiseRejectionEvent=='function')&&promise.then(empty) instanceof FakePromise;}catch(e){ /* empty */}}(); // helpers
var sameConstructor=function sameConstructor(a,b){ // with library wrapper special case
return a===b||a===$Promise&&b===Wrapper;};var isThenable=function isThenable(it){var then;return isObject(it)&&typeof (then=it.then)=='function'?then:false;};var newPromiseCapability=function newPromiseCapability(C){return sameConstructor($Promise,C)?new PromiseCapability(C):new GenericPromiseCapability(C);};var PromiseCapability=GenericPromiseCapability=function GenericPromiseCapability(C){var resolve,reject;this.promise=new C(function($$resolve,$$reject){if(resolve!==undefined||reject!==undefined)throw TypeError('Bad Promise constructor');resolve=$$resolve;reject=$$reject;});this.resolve=aFunction(resolve);this.reject=aFunction(reject);};var perform=function perform(exec){try{exec();}catch(e){return {error:e};}};var notify=function notify(promise,isReject){if(promise._n)return;promise._n=true;var chain=promise._c;microtask(function(){var value=promise._v,ok=promise._s==1,i=0;var run=function run(reaction){var handler=ok?reaction.ok:reaction.fail,resolve=reaction.resolve,reject=reaction.reject,result,then;try{if(handler){if(!ok){if(promise._h==2)onHandleUnhandled(promise);promise._h=1;}result=handler===true?value:handler(value);if(result===reaction.promise){reject(TypeError('Promise-chain cycle'));}else if(then=isThenable(result)){then.call(result,resolve,reject);}else resolve(result);}else reject(value);}catch(e){reject(e);}};while(chain.length>i){run(chain[i++]);} // variable length - can't use forEach
promise._c=[];promise._n=false;if(isReject&&!promise._h)onUnhandled(promise);});};var onUnhandled=function onUnhandled(promise){task.call(global,function(){var value=promise._v,abrupt,handler,console;if(isUnhandled(promise)){abrupt=perform(function(){if(isNode){process.emit('unhandledRejection',value,promise);}else if(handler=global.onunhandledrejection){handler({promise:promise,reason:value});}else if((console=global.console)&&console.error){console.error('Unhandled promise rejection',value);}}); // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should
promise._h=isNode||isUnhandled(promise)?2:1;}promise._a=undefined;if(abrupt)throw abrupt.error;});};var isUnhandled=function isUnhandled(promise){if(promise._h==1)return false;var chain=promise._a||promise._c,i=0,reaction;while(chain.length>i){reaction=chain[i++];if(reaction.fail||!isUnhandled(reaction.promise))return false;}return true;};var onHandleUnhandled=function onHandleUnhandled(promise){task.call(global,function(){var handler;if(isNode){process.emit('rejectionHandled',promise);}else if(handler=global.onrejectionhandled){handler({promise:promise,reason:promise._v});}});};var $reject=function $reject(value){var promise=this;if(promise._d)return;promise._d=true;promise=promise._w||promise; // unwrap
promise._v=value;promise._s=2;if(!promise._a)promise._a=promise._c.slice();notify(promise,true);};var $resolve=function $resolve(value){var promise=this,then;if(promise._d)return;promise._d=true;promise=promise._w||promise; // unwrap
try{if(promise===value)throw TypeError("Promise can't be resolved itself");if(then=isThenable(value)){microtask(function(){var wrapper={_w:promise,_d:false}; // wrap
try{then.call(value,ctx($resolve,wrapper,1),ctx($reject,wrapper,1));}catch(e){$reject.call(wrapper,e);}});}else {promise._v=value;promise._s=1;notify(promise,false);}}catch(e){$reject.call({_w:promise,_d:false},e); // wrap
}}; // constructor polyfill
if(!USE_NATIVE){ // 25.4.3.1 Promise(executor)
$Promise=function Promise(executor){anInstance(this,$Promise,PROMISE,'_h');aFunction(executor);Internal.call(this);try{executor(ctx($resolve,this,1),ctx($reject,this,1));}catch(err){$reject.call(this,err);}};Internal=function Promise(executor){this._c=[]; // <- awaiting reactions
this._a=undefined; // <- checked in isUnhandled reactions
this._s=0; // <- state
this._d=false; // <- done
this._v=undefined; // <- value
this._h=0; // <- rejection state, 0 - default, 1 - handled, 2 - unhandled
this._n=false; // <- notify
};Internal.prototype=_dereq_(86)($Promise.prototype,{ // 25.4.5.3 Promise.prototype.then(onFulfilled, onRejected)
then:function then(onFulfilled,onRejected){var reaction=newPromiseCapability(speciesConstructor(this,$Promise));reaction.ok=typeof onFulfilled=='function'?onFulfilled:true;reaction.fail=typeof onRejected=='function'&&onRejected;this._c.push(reaction);if(this._a)this._a.push(reaction);if(this._s)notify(this,false);return reaction.promise;}, // 25.4.5.1 Promise.prototype.catch(onRejected)
'catch':function _catch(onRejected){return this.then(undefined,onRejected);}});PromiseCapability=function PromiseCapability(){var promise=new Internal();this.promise=promise;this.resolve=ctx($resolve,promise,1);this.reject=ctx($reject,promise,1);};}$export($export.G+$export.W+$export.F*!USE_NATIVE,{Promise:$Promise});_dereq_(92)($Promise,PROMISE);_dereq_(91)(PROMISE);Wrapper=_dereq_(26)[PROMISE]; // statics
$export($export.S+$export.F*!USE_NATIVE,PROMISE,{ // 25.4.4.5 Promise.reject(r)
reject:function reject(r){var capability=newPromiseCapability(this),$$reject=capability.reject;$$reject(r);return capability.promise;}});$export($export.S+$export.F*(LIBRARY||!USE_NATIVE),PROMISE,{ // 25.4.4.6 Promise.resolve(x)
resolve:function resolve(x){ // instanceof instead of internal slot check because we should fix it without replacement native Promise core
if(x instanceof $Promise&&sameConstructor(x.constructor,this))return x;var capability=newPromiseCapability(this),$$resolve=capability.resolve;$$resolve(x);return capability.promise;}});$export($export.S+$export.F*!(USE_NATIVE&&_dereq_(55)(function(iter){$Promise.all(iter)['catch'](empty);})),PROMISE,{ // 25.4.4.1 Promise.all(iterable)
all:function all(iterable){var C=this,capability=newPromiseCapability(C),resolve=capability.resolve,reject=capability.reject;var abrupt=perform(function(){var values=[],index=0,remaining=1;forOf(iterable,false,function(promise){var $index=index++,alreadyCalled=false;values.push(undefined);remaining++;C.resolve(promise).then(function(value){if(alreadyCalled)return;alreadyCalled=true;values[$index]=value;--remaining||resolve(values);},reject);});--remaining||resolve(values);});if(abrupt)reject(abrupt.error);return capability.promise;}, // 25.4.4.4 Promise.race(iterable)
race:function race(iterable){var C=this,capability=newPromiseCapability(C),reject=capability.reject;var abrupt=perform(function(){forOf(iterable,false,function(promise){C.resolve(promise).then(capability.resolve,reject);});});if(abrupt)reject(abrupt.error);return capability.promise;}});},{"10":10,"104":104,"11":11,"115":115,"20":20,"26":26,"27":27,"33":33,"38":38,"39":39,"50":50,"55":55,"59":59,"65":65,"7":7,"86":86,"90":90,"91":91,"92":92,"95":95}],197:[function(_dereq_,module,exports){ // 26.1.1 Reflect.apply(target, thisArgument, argumentsList)
var $export=_dereq_(33),_apply=Function.apply;$export($export.S,'Reflect',{apply:function apply(target,thisArgument,argumentsList){return _apply.call(target,thisArgument,argumentsList);}});},{"33":33}],198:[function(_dereq_,module,exports){ // 26.1.2 Reflect.construct(target, argumentsList [, newTarget])
var $export=_dereq_(33),create=_dereq_(67),aFunction=_dereq_(7),anObject=_dereq_(11),isObject=_dereq_(50),bind=_dereq_(19); // MS Edge supports only 2 arguments
// FF Nightly sets third argument as `new.target`, but does not create `this` from it
$export($export.S+$export.F*_dereq_(35)(function(){function F(){}return !(Reflect.construct(function(){},[],F) instanceof F);}),'Reflect',{construct:function construct(Target,args /*, newTarget*/){aFunction(Target);var newTarget=arguments.length<3?Target:aFunction(arguments[2]);if(Target==newTarget){ // w/o altered newTarget, optimization for 0-4 arguments
if(args!=undefined)switch(anObject(args).length){case 0:return new Target();case 1:return new Target(args[0]);case 2:return new Target(args[0],args[1]);case 3:return new Target(args[0],args[1],args[2]);case 4:return new Target(args[0],args[1],args[2],args[3]);} // w/o altered newTarget, lot of arguments case
var $args=[null];$args.push.apply($args,args);return new (bind.apply(Target,$args))();} // with altered newTarget, not support built-in constructors
var proto=newTarget.prototype,instance=create(isObject(proto)?proto:Object.prototype),result=Function.apply.call(Target,instance,args);return isObject(result)?result:instance;}});},{"11":11,"19":19,"33":33,"35":35,"50":50,"67":67,"7":7}],199:[function(_dereq_,module,exports){ // 26.1.3 Reflect.defineProperty(target, propertyKey, attributes)
var dP=_dereq_(68),$export=_dereq_(33),anObject=_dereq_(11),toPrimitive=_dereq_(110); // MS Edge has broken Reflect.defineProperty - throwing instead of returning false
$export($export.S+$export.F*_dereq_(35)(function(){Reflect.defineProperty(dP.f({},1,{value:1}),1,{value:2});}),'Reflect',{defineProperty:function defineProperty(target,propertyKey,attributes){anObject(target);propertyKey=toPrimitive(propertyKey,true);anObject(attributes);try{dP.f(target,propertyKey,attributes);return true;}catch(e){return false;}}});},{"11":11,"110":110,"33":33,"35":35,"68":68}],200:[function(_dereq_,module,exports){ // 26.1.4 Reflect.deleteProperty(target, propertyKey)
var $export=_dereq_(33),gOPD=_dereq_(70).f,anObject=_dereq_(11);$export($export.S,'Reflect',{deleteProperty:function deleteProperty(target,propertyKey){var desc=gOPD(anObject(target),propertyKey);return desc&&!desc.configurable?false:delete target[propertyKey];}});},{"11":11,"33":33,"70":70}],201:[function(_dereq_,module,exports){'use strict'; // 26.1.5 Reflect.enumerate(target)
var $export=_dereq_(33),anObject=_dereq_(11);var Enumerate=function Enumerate(iterated){this._t=anObject(iterated); // target
this._i=0; // next index
var keys=this._k=[] // keys
,key;for(key in iterated){keys.push(key);}};_dereq_(53)(Enumerate,'Object',function(){var that=this,keys=that._k,key;do {if(that._i>=keys.length)return {value:undefined,done:true};}while(!((key=keys[that._i++]) in that._t));return {value:key,done:false};});$export($export.S,'Reflect',{enumerate:function enumerate(target){return new Enumerate(target);}});},{"11":11,"33":33,"53":53}],202:[function(_dereq_,module,exports){ // 26.1.7 Reflect.getOwnPropertyDescriptor(target, propertyKey)
var gOPD=_dereq_(70),$export=_dereq_(33),anObject=_dereq_(11);$export($export.S,'Reflect',{getOwnPropertyDescriptor:function getOwnPropertyDescriptor(target,propertyKey){return gOPD.f(anObject(target),propertyKey);}});},{"11":11,"33":33,"70":70}],203:[function(_dereq_,module,exports){ // 26.1.8 Reflect.getPrototypeOf(target)
var $export=_dereq_(33),getProto=_dereq_(74),anObject=_dereq_(11);$export($export.S,'Reflect',{getPrototypeOf:function getPrototypeOf(target){return getProto(anObject(target));}});},{"11":11,"33":33,"74":74}],204:[function(_dereq_,module,exports){ // 26.1.6 Reflect.get(target, propertyKey [, receiver])
var gOPD=_dereq_(70),getPrototypeOf=_dereq_(74),has=_dereq_(40),$export=_dereq_(33),isObject=_dereq_(50),anObject=_dereq_(11);function get(target,propertyKey /*, receiver*/){var receiver=arguments.length<3?target:arguments[2],desc,proto;if(anObject(target)===receiver)return target[propertyKey];if(desc=gOPD.f(target,propertyKey))return has(desc,'value')?desc.value:desc.get!==undefined?desc.get.call(receiver):undefined;if(isObject(proto=getPrototypeOf(target)))return get(proto,propertyKey,receiver);}$export($export.S,'Reflect',{get:get});},{"11":11,"33":33,"40":40,"50":50,"70":70,"74":74}],205:[function(_dereq_,module,exports){ // 26.1.9 Reflect.has(target, propertyKey)
var $export=_dereq_(33);$export($export.S,'Reflect',{has:function has(target,propertyKey){return propertyKey in target;}});},{"33":33}],206:[function(_dereq_,module,exports){ // 26.1.10 Reflect.isExtensible(target)
var $export=_dereq_(33),anObject=_dereq_(11),$isExtensible=Object.isExtensible;$export($export.S,'Reflect',{isExtensible:function isExtensible(target){anObject(target);return $isExtensible?$isExtensible(target):true;}});},{"11":11,"33":33}],207:[function(_dereq_,module,exports){ // 26.1.11 Reflect.ownKeys(target)
var $export=_dereq_(33);$export($export.S,'Reflect',{ownKeys:_dereq_(80)});},{"33":33,"80":80}],208:[function(_dereq_,module,exports){ // 26.1.12 Reflect.preventExtensions(target)
var $export=_dereq_(33),anObject=_dereq_(11),$preventExtensions=Object.preventExtensions;$export($export.S,'Reflect',{preventExtensions:function preventExtensions(target){anObject(target);try{if($preventExtensions)$preventExtensions(target);return true;}catch(e){return false;}}});},{"11":11,"33":33}],209:[function(_dereq_,module,exports){ // 26.1.14 Reflect.setPrototypeOf(target, proto)
var $export=_dereq_(33),setProto=_dereq_(90);if(setProto)$export($export.S,'Reflect',{setPrototypeOf:function setPrototypeOf(target,proto){setProto.check(target,proto);try{setProto.set(target,proto);return true;}catch(e){return false;}}});},{"33":33,"90":90}],210:[function(_dereq_,module,exports){ // 26.1.13 Reflect.set(target, propertyKey, V [, receiver])
var dP=_dereq_(68),gOPD=_dereq_(70),getPrototypeOf=_dereq_(74),has=_dereq_(40),$export=_dereq_(33),createDesc=_dereq_(85),anObject=_dereq_(11),isObject=_dereq_(50);function set(target,propertyKey,V /*, receiver*/){var receiver=arguments.length<4?target:arguments[3],ownDesc=gOPD.f(anObject(target),propertyKey),existingDescriptor,proto;if(!ownDesc){if(isObject(proto=getPrototypeOf(target))){return set(proto,propertyKey,V,receiver);}ownDesc=createDesc(0);}if(has(ownDesc,'value')){if(ownDesc.writable===false||!isObject(receiver))return false;existingDescriptor=gOPD.f(receiver,propertyKey)||createDesc(0);existingDescriptor.value=V;dP.f(receiver,propertyKey,existingDescriptor);return true;}return ownDesc.set===undefined?false:(ownDesc.set.call(receiver,V),true);}$export($export.S,'Reflect',{set:set});},{"11":11,"33":33,"40":40,"50":50,"68":68,"70":70,"74":74,"85":85}],211:[function(_dereq_,module,exports){var global=_dereq_(39),inheritIfRequired=_dereq_(44),dP=_dereq_(68).f,gOPN=_dereq_(72).f,isRegExp=_dereq_(51),$flags=_dereq_(37),$RegExp=global.RegExp,Base=$RegExp,proto=$RegExp.prototype,re1=/a/g,re2=/a/g // "new" creates a new object, old webkit buggy here
,CORRECT_NEW=new $RegExp(re1)!==re1;if(_dereq_(29)&&(!CORRECT_NEW||_dereq_(35)(function(){re2[_dereq_(115)('match')]=false; // RegExp constructor can alter flags and IsRegExp works correct with @@match
return $RegExp(re1)!=re1||$RegExp(re2)==re2||$RegExp(re1,'i')!='/a/i';}))){$RegExp=function RegExp(p,f){var tiRE=this instanceof $RegExp,piRE=isRegExp(p),fiU=f===undefined;return !tiRE&&piRE&&p.constructor===$RegExp&&fiU?p:inheritIfRequired(CORRECT_NEW?new Base(piRE&&!fiU?p.source:p,f):Base((piRE=p instanceof $RegExp)?p.source:p,piRE&&fiU?$flags.call(p):f),tiRE?this:proto,$RegExp);};var proxy=function proxy(key){key in $RegExp||dP($RegExp,key,{configurable:true,get:function get(){return Base[key];},set:function set(it){Base[key]=it;}});};for(var keys=gOPN(Base),i=0;keys.length>i;){proxy(keys[i++]);}proto.constructor=$RegExp;$RegExp.prototype=proto;_dereq_(87)(global,'RegExp',$RegExp);}_dereq_(91)('RegExp');},{"115":115,"29":29,"35":35,"37":37,"39":39,"44":44,"51":51,"68":68,"72":72,"87":87,"91":91}],212:[function(_dereq_,module,exports){ // 21.2.5.3 get RegExp.prototype.flags()
if(_dereq_(29)&&/./g.flags!='g')_dereq_(68).f(RegExp.prototype,'flags',{configurable:true,get:_dereq_(37)});},{"29":29,"37":37,"68":68}],213:[function(_dereq_,module,exports){ // @@match logic
_dereq_(36)('match',1,function(defined,MATCH,$match){ // 21.1.3.11 String.prototype.match(regexp)
return [function match(regexp){'use strict';var O=defined(this),fn=regexp==undefined?undefined:regexp[MATCH];return fn!==undefined?fn.call(regexp,O):new RegExp(regexp)[MATCH](String(O));},$match];});},{"36":36}],214:[function(_dereq_,module,exports){ // @@replace logic
_dereq_(36)('replace',2,function(defined,REPLACE,$replace){ // 21.1.3.14 String.prototype.replace(searchValue, replaceValue)
return [function replace(searchValue,replaceValue){'use strict';var O=defined(this),fn=searchValue==undefined?undefined:searchValue[REPLACE];return fn!==undefined?fn.call(searchValue,O,replaceValue):$replace.call(String(O),searchValue,replaceValue);},$replace];});},{"36":36}],215:[function(_dereq_,module,exports){ // @@search logic
_dereq_(36)('search',1,function(defined,SEARCH,$search){ // 21.1.3.15 String.prototype.search(regexp)
return [function search(regexp){'use strict';var O=defined(this),fn=regexp==undefined?undefined:regexp[SEARCH];return fn!==undefined?fn.call(regexp,O):new RegExp(regexp)[SEARCH](String(O));},$search];});},{"36":36}],216:[function(_dereq_,module,exports){ // @@split logic
_dereq_(36)('split',2,function(defined,SPLIT,$split){'use strict';var isRegExp=_dereq_(51),_split=$split,$push=[].push,$SPLIT='split',LENGTH='length',LAST_INDEX='lastIndex';if('abbc'[$SPLIT](/(b)*/)[1]=='c'||'test'[$SPLIT](/(?:)/,-1)[LENGTH]!=4||'ab'[$SPLIT](/(?:ab)*/)[LENGTH]!=2||'.'[$SPLIT](/(.?)(.?)/)[LENGTH]!=4||'.'[$SPLIT](/()()/)[LENGTH]>1||''[$SPLIT](/.?/)[LENGTH]){var NPCG=/()??/.exec('')[1]===undefined; // nonparticipating capturing group
// based on es5-shim implementation, need to rework it
$split=function $split(separator,limit){var string=String(this);if(separator===undefined&&limit===0)return []; // If `separator` is not a regex, use native split
if(!isRegExp(separator))return _split.call(string,separator,limit);var output=[];var flags=(separator.ignoreCase?'i':'')+(separator.multiline?'m':'')+(separator.unicode?'u':'')+(separator.sticky?'y':'');var lastLastIndex=0;var splitLimit=limit===undefined?4294967295:limit>>>0; // Make `global` and avoid `lastIndex` issues by working with a copy
var separatorCopy=new RegExp(separator.source,flags+'g');var separator2,match,lastIndex,lastLength,i; // Doesn't need flags gy, but they don't hurt
if(!NPCG)separator2=new RegExp('^'+separatorCopy.source+'$(?!\\s)',flags);while(match=separatorCopy.exec(string)){ // `separatorCopy.lastIndex` is not reliable cross-browser
lastIndex=match.index+match[0][LENGTH];if(lastIndex>lastLastIndex){output.push(string.slice(lastLastIndex,match.index)); // Fix browsers whose `exec` methods don't consistently return `undefined` for NPCG
if(!NPCG&&match[LENGTH]>1)match[0].replace(separator2,function(){for(i=1;i<arguments[LENGTH]-2;i++){if(arguments[i]===undefined)match[i]=undefined;}});if(match[LENGTH]>1&&match.index<string[LENGTH])$push.apply(output,match.slice(1));lastLength=match[0][LENGTH];lastLastIndex=lastIndex;if(output[LENGTH]>=splitLimit)break;}if(separatorCopy[LAST_INDEX]===match.index)separatorCopy[LAST_INDEX]++; // Avoid an infinite loop
}if(lastLastIndex===string[LENGTH]){if(lastLength||!separatorCopy.test(''))output.push('');}else output.push(string.slice(lastLastIndex));return output[LENGTH]>splitLimit?output.slice(0,splitLimit):output;}; // Chakra, V8
}else if('0'[$SPLIT](undefined,0)[LENGTH]){$split=function $split(separator,limit){return separator===undefined&&limit===0?[]:_split.call(this,separator,limit);};} // 21.1.3.17 String.prototype.split(separator, limit)
return [function split(separator,limit){var O=defined(this),fn=separator==undefined?undefined:separator[SPLIT];return fn!==undefined?fn.call(separator,O,limit):$split.call(String(O),separator,limit);},$split];});},{"36":36,"51":51}],217:[function(_dereq_,module,exports){'use strict';_dereq_(212);var anObject=_dereq_(11),$flags=_dereq_(37),DESCRIPTORS=_dereq_(29),TO_STRING='toString',$toString=/./[TO_STRING];var define=function define(fn){_dereq_(87)(RegExp.prototype,TO_STRING,fn,true);}; // 21.2.5.14 RegExp.prototype.toString()
if(_dereq_(35)(function(){return $toString.call({source:'a',flags:'b'})!='/a/b';})){define(function toString(){var R=anObject(this);return '/'.concat(R.source,'/','flags' in R?R.flags:!DESCRIPTORS&&R instanceof RegExp?$flags.call(R):undefined);}); // FF44- RegExp#toString has a wrong name
}else if($toString.name!=TO_STRING){define(function toString(){return $toString.call(this);});}},{"11":11,"212":212,"29":29,"35":35,"37":37,"87":87}],218:[function(_dereq_,module,exports){'use strict';var strong=_dereq_(22); // 23.2 Set Objects
module.exports=_dereq_(25)('Set',function(get){return function Set(){return get(this,arguments.length>0?arguments[0]:undefined);};},{ // 23.2.3.1 Set.prototype.add(value)
add:function add(value){return strong.def(this,value=value===0?0:value,value);}},strong);},{"22":22,"25":25}],219:[function(_dereq_,module,exports){'use strict'; // B.2.3.2 String.prototype.anchor(name)
_dereq_(99)('anchor',function(createHTML){return function anchor(name){return createHTML(this,'a','name',name);};});},{"99":99}],220:[function(_dereq_,module,exports){'use strict'; // B.2.3.3 String.prototype.big()
_dereq_(99)('big',function(createHTML){return function big(){return createHTML(this,'big','','');};});},{"99":99}],221:[function(_dereq_,module,exports){'use strict'; // B.2.3.4 String.prototype.blink()
_dereq_(99)('blink',function(createHTML){return function blink(){return createHTML(this,'blink','','');};});},{"99":99}],222:[function(_dereq_,module,exports){'use strict'; // B.2.3.5 String.prototype.bold()
_dereq_(99)('bold',function(createHTML){return function bold(){return createHTML(this,'b','','');};});},{"99":99}],223:[function(_dereq_,module,exports){'use strict';var $export=_dereq_(33),$at=_dereq_(97)(false);$export($export.P,'String',{ // 21.1.3.3 String.prototype.codePointAt(pos)
codePointAt:function codePointAt(pos){return $at(this,pos);}});},{"33":33,"97":97}],224:[function(_dereq_,module,exports){ // 21.1.3.6 String.prototype.endsWith(searchString [, endPosition])
'use strict';var $export=_dereq_(33),toLength=_dereq_(108),context=_dereq_(98),ENDS_WITH='endsWith',$endsWith=''[ENDS_WITH];$export($export.P+$export.F*_dereq_(34)(ENDS_WITH),'String',{endsWith:function endsWith(searchString /*, endPosition = @length */){var that=context(this,searchString,ENDS_WITH),endPosition=arguments.length>1?arguments[1]:undefined,len=toLength(that.length),end=endPosition===undefined?len:Math.min(toLength(endPosition),len),search=String(searchString);return $endsWith?$endsWith.call(that,search,end):that.slice(end-search.length,end)===search;}});},{"108":108,"33":33,"34":34,"98":98}],225:[function(_dereq_,module,exports){'use strict'; // B.2.3.6 String.prototype.fixed()
_dereq_(99)('fixed',function(createHTML){return function fixed(){return createHTML(this,'tt','','');};});},{"99":99}],226:[function(_dereq_,module,exports){'use strict'; // B.2.3.7 String.prototype.fontcolor(color)
_dereq_(99)('fontcolor',function(createHTML){return function fontcolor(color){return createHTML(this,'font','color',color);};});},{"99":99}],227:[function(_dereq_,module,exports){'use strict'; // B.2.3.8 String.prototype.fontsize(size)
_dereq_(99)('fontsize',function(createHTML){return function fontsize(size){return createHTML(this,'font','size',size);};});},{"99":99}],228:[function(_dereq_,module,exports){var $export=_dereq_(33),toIndex=_dereq_(105),fromCharCode=String.fromCharCode,$fromCodePoint=String.fromCodePoint; // length should be 1, old FF problem
$export($export.S+$export.F*(!!$fromCodePoint&&$fromCodePoint.length!=1),'String',{ // 21.1.2.2 String.fromCodePoint(...codePoints)
fromCodePoint:function fromCodePoint(x){ // eslint-disable-line no-unused-vars
var res=[],aLen=arguments.length,i=0,code;while(aLen>i){code=+arguments[i++];if(toIndex(code,0x10ffff)!==code)throw RangeError(code+' is not a valid code point');res.push(code<0x10000?fromCharCode(code):fromCharCode(((code-=0x10000)>>10)+0xd800,code%0x400+0xdc00));}return res.join('');}});},{"105":105,"33":33}],229:[function(_dereq_,module,exports){ // 21.1.3.7 String.prototype.includes(searchString, position = 0)
'use strict';var $export=_dereq_(33),context=_dereq_(98),INCLUDES='includes';$export($export.P+$export.F*_dereq_(34)(INCLUDES),'String',{includes:function includes(searchString /*, position = 0 */){return !! ~context(this,searchString,INCLUDES).indexOf(searchString,arguments.length>1?arguments[1]:undefined);}});},{"33":33,"34":34,"98":98}],230:[function(_dereq_,module,exports){'use strict'; // B.2.3.9 String.prototype.italics()
_dereq_(99)('italics',function(createHTML){return function italics(){return createHTML(this,'i','','');};});},{"99":99}],231:[function(_dereq_,module,exports){'use strict';var $at=_dereq_(97)(true); // 21.1.3.27 String.prototype[@@iterator]()
_dereq_(54)(String,'String',function(iterated){this._t=String(iterated); // target
this._i=0; // next index
// 21.1.5.2.1 %StringIteratorPrototype%.next()
},function(){var O=this._t,index=this._i,point;if(index>=O.length)return {value:undefined,done:true};point=$at(O,index);this._i+=point.length;return {value:point,done:false};});},{"54":54,"97":97}],232:[function(_dereq_,module,exports){'use strict'; // B.2.3.10 String.prototype.link(url)
_dereq_(99)('link',function(createHTML){return function link(url){return createHTML(this,'a','href',url);};});},{"99":99}],233:[function(_dereq_,module,exports){var $export=_dereq_(33),toIObject=_dereq_(107),toLength=_dereq_(108);$export($export.S,'String',{ // 21.1.2.4 String.raw(callSite, ...substitutions)
raw:function raw(callSite){var tpl=toIObject(callSite.raw),len=toLength(tpl.length),aLen=arguments.length,res=[],i=0;while(len>i){res.push(String(tpl[i++]));if(i<aLen)res.push(String(arguments[i]));}return res.join('');}});},{"107":107,"108":108,"33":33}],234:[function(_dereq_,module,exports){var $export=_dereq_(33);$export($export.P,'String',{ // 21.1.3.13 String.prototype.repeat(count)
repeat:_dereq_(101)});},{"101":101,"33":33}],235:[function(_dereq_,module,exports){'use strict'; // B.2.3.11 String.prototype.small()
_dereq_(99)('small',function(createHTML){return function small(){return createHTML(this,'small','','');};});},{"99":99}],236:[function(_dereq_,module,exports){ // 21.1.3.18 String.prototype.startsWith(searchString [, position ])
'use strict';var $export=_dereq_(33),toLength=_dereq_(108),context=_dereq_(98),STARTS_WITH='startsWith',$startsWith=''[STARTS_WITH];$export($export.P+$export.F*_dereq_(34)(STARTS_WITH),'String',{startsWith:function startsWith(searchString /*, position = 0 */){var that=context(this,searchString,STARTS_WITH),index=toLength(Math.min(arguments.length>1?arguments[1]:undefined,that.length)),search=String(searchString);return $startsWith?$startsWith.call(that,search,index):that.slice(index,index+search.length)===search;}});},{"108":108,"33":33,"34":34,"98":98}],237:[function(_dereq_,module,exports){'use strict'; // B.2.3.12 String.prototype.strike()
_dereq_(99)('strike',function(createHTML){return function strike(){return createHTML(this,'strike','','');};});},{"99":99}],238:[function(_dereq_,module,exports){'use strict'; // B.2.3.13 String.prototype.sub()
_dereq_(99)('sub',function(createHTML){return function sub(){return createHTML(this,'sub','','');};});},{"99":99}],239:[function(_dereq_,module,exports){'use strict'; // B.2.3.14 String.prototype.sup()
_dereq_(99)('sup',function(createHTML){return function sup(){return createHTML(this,'sup','','');};});},{"99":99}],240:[function(_dereq_,module,exports){'use strict'; // 21.1.3.25 String.prototype.trim()
_dereq_(102)('trim',function($trim){return function trim(){return $trim(this,3);};});},{"102":102}],241:[function(_dereq_,module,exports){'use strict'; // ECMAScript 6 symbols shim
var global=_dereq_(39),core=_dereq_(26),has=_dereq_(40),DESCRIPTORS=_dereq_(29),$export=_dereq_(33),redefine=_dereq_(87),META=_dereq_(63).KEY,$fails=_dereq_(35),shared=_dereq_(94),setToStringTag=_dereq_(92),uid=_dereq_(114),wks=_dereq_(115),keyOf=_dereq_(58),enumKeys=_dereq_(32),isArray=_dereq_(48),anObject=_dereq_(11),toIObject=_dereq_(107),toPrimitive=_dereq_(110),createDesc=_dereq_(85),_create=_dereq_(67),gOPNExt=_dereq_(71),$GOPD=_dereq_(70),$DP=_dereq_(68),gOPD=$GOPD.f,dP=$DP.f,gOPN=gOPNExt.f,$Symbol=global.Symbol,$JSON=global.JSON,_stringify=$JSON&&$JSON.stringify,setter=false,HIDDEN=wks('_hidden'),isEnum={}.propertyIsEnumerable,SymbolRegistry=shared('symbol-registry'),AllSymbols=shared('symbols'),ObjectProto=Object.prototype,USE_NATIVE=typeof $Symbol=='function',QObject=global.QObject; // fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687
var setSymbolDesc=DESCRIPTORS&&$fails(function(){return _create(dP({},'a',{get:function get(){return dP(this,'a',{value:7}).a;}})).a!=7;})?function(it,key,D){var protoDesc=gOPD(ObjectProto,key);if(protoDesc)delete ObjectProto[key];dP(it,key,D);if(protoDesc&&it!==ObjectProto)dP(ObjectProto,key,protoDesc);}:dP;var wrap=function wrap(tag){var sym=AllSymbols[tag]=_create($Symbol.prototype);sym._k=tag;DESCRIPTORS&&setter&&setSymbolDesc(ObjectProto,tag,{configurable:true,set:function set(value){if(has(this,HIDDEN)&&has(this[HIDDEN],tag))this[HIDDEN][tag]=false;setSymbolDesc(this,tag,createDesc(1,value));}});return sym;};var isSymbol=function isSymbol(it){return (typeof it==="undefined"?"undefined":babelHelpers.typeof(it))=='symbol';};var $defineProperty=function defineProperty(it,key,D){anObject(it);key=toPrimitive(key,true);anObject(D);if(has(AllSymbols,key)){if(!D.enumerable){if(!has(it,HIDDEN))dP(it,HIDDEN,createDesc(1,{}));it[HIDDEN][key]=true;}else {if(has(it,HIDDEN)&&it[HIDDEN][key])it[HIDDEN][key]=false;D=_create(D,{enumerable:createDesc(0,false)});}return setSymbolDesc(it,key,D);}return dP(it,key,D);};var $defineProperties=function defineProperties(it,P){anObject(it);var keys=enumKeys(P=toIObject(P)),i=0,l=keys.length,key;while(l>i){$defineProperty(it,key=keys[i++],P[key]);}return it;};var $create=function create(it,P){return P===undefined?_create(it):$defineProperties(_create(it),P);};var $propertyIsEnumerable=function propertyIsEnumerable(key){var E=isEnum.call(this,key=toPrimitive(key,true));return E||!has(this,key)||!has(AllSymbols,key)||has(this,HIDDEN)&&this[HIDDEN][key]?E:true;};var $getOwnPropertyDescriptor=function getOwnPropertyDescriptor(it,key){var D=gOPD(it=toIObject(it),key=toPrimitive(key,true));if(D&&has(AllSymbols,key)&&!(has(it,HIDDEN)&&it[HIDDEN][key]))D.enumerable=true;return D;};var $getOwnPropertyNames=function getOwnPropertyNames(it){var names=gOPN(toIObject(it)),result=[],i=0,key;while(names.length>i){if(!has(AllSymbols,key=names[i++])&&key!=HIDDEN&&key!=META)result.push(key);}return result;};var $getOwnPropertySymbols=function getOwnPropertySymbols(it){var names=gOPN(toIObject(it)),result=[],i=0,key;while(names.length>i){if(has(AllSymbols,key=names[i++]))result.push(AllSymbols[key]);}return result;};var $stringify=function stringify(it){if(it===undefined||isSymbol(it))return; // IE8 returns string on undefined
var args=[it],i=1,replacer,$replacer;while(arguments.length>i){args.push(arguments[i++]);}replacer=args[1];if(typeof replacer=='function')$replacer=replacer;if($replacer||!isArray(replacer))replacer=function replacer(key,value){if($replacer)value=$replacer.call(this,key,value);if(!isSymbol(value))return value;};args[1]=replacer;return _stringify.apply($JSON,args);};var BUGGY_JSON=$fails(function(){var S=$Symbol(); // MS Edge converts symbol values to JSON as {}
// WebKit converts symbol values to JSON as null
// V8 throws on boxed symbols
return _stringify([S])!='[null]'||_stringify({a:S})!='{}'||_stringify(Object(S))!='{}';}); // 19.4.1.1 Symbol([description])
if(!USE_NATIVE){$Symbol=function _Symbol2(){if(isSymbol(this))throw TypeError('Symbol is not a constructor');return wrap(uid(arguments.length>0?arguments[0]:undefined));};redefine($Symbol.prototype,'toString',function toString(){return this._k;});isSymbol=function isSymbol(it){return it instanceof $Symbol;};$GOPD.f=$getOwnPropertyDescriptor;$DP.f=$defineProperty;_dereq_(72).f=gOPNExt.f=$getOwnPropertyNames;_dereq_(77).f=$propertyIsEnumerable;_dereq_(73).f=$getOwnPropertySymbols;if(DESCRIPTORS&&!_dereq_(59)){redefine(ObjectProto,'propertyIsEnumerable',$propertyIsEnumerable,true);}}$export($export.G+$export.W+$export.F*!USE_NATIVE,{Symbol:$Symbol}); // 19.4.2.2 Symbol.hasInstance
// 19.4.2.3 Symbol.isConcatSpreadable
// 19.4.2.4 Symbol.iterator
// 19.4.2.6 Symbol.match
// 19.4.2.8 Symbol.replace
// 19.4.2.9 Symbol.search
// 19.4.2.10 Symbol.species
// 19.4.2.11 Symbol.split
// 19.4.2.12 Symbol.toPrimitive
// 19.4.2.13 Symbol.toStringTag
// 19.4.2.14 Symbol.unscopables
for(var symbols='hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables'.split(','),i=0;symbols.length>i;){var key=symbols[i++],Wrapper=core.Symbol,sym=wks(key);if(!(key in Wrapper))dP(Wrapper,key,{value:USE_NATIVE?sym:wrap(sym)});}; // Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173
if(!QObject||!QObject.prototype||!QObject.prototype.findChild)setter=true;$export($export.S+$export.F*!USE_NATIVE,'Symbol',{ // 19.4.2.1 Symbol.for(key)
'for':function _for(key){return has(SymbolRegistry,key+='')?SymbolRegistry[key]:SymbolRegistry[key]=$Symbol(key);}, // 19.4.2.5 Symbol.keyFor(sym)
keyFor:function keyFor(key){return keyOf(SymbolRegistry,key);},useSetter:function useSetter(){setter=true;},useSimple:function useSimple(){setter=false;}});$export($export.S+$export.F*!USE_NATIVE,'Object',{ // 19.1.2.2 Object.create(O [, Properties])
create:$create, // 19.1.2.4 Object.defineProperty(O, P, Attributes)
defineProperty:$defineProperty, // 19.1.2.3 Object.defineProperties(O, Properties)
defineProperties:$defineProperties, // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P)
getOwnPropertyDescriptor:$getOwnPropertyDescriptor, // 19.1.2.7 Object.getOwnPropertyNames(O)
getOwnPropertyNames:$getOwnPropertyNames, // 19.1.2.8 Object.getOwnPropertySymbols(O)
getOwnPropertySymbols:$getOwnPropertySymbols}); // 24.3.2 JSON.stringify(value [, replacer [, space]])
$JSON&&$export($export.S+$export.F*(!USE_NATIVE||BUGGY_JSON),'JSON',{stringify:$stringify}); // 19.4.3.5 Symbol.prototype[@@toStringTag]
setToStringTag($Symbol,'Symbol'); // 20.2.1.9 Math[@@toStringTag]
setToStringTag(Math,'Math',true); // 24.3.3 JSON[@@toStringTag]
setToStringTag(global.JSON,'JSON',true);},{"107":107,"11":11,"110":110,"114":114,"115":115,"26":26,"29":29,"32":32,"33":33,"35":35,"39":39,"40":40,"48":48,"58":58,"59":59,"63":63,"67":67,"68":68,"70":70,"71":71,"72":72,"73":73,"77":77,"85":85,"87":87,"92":92,"94":94}],242:[function(_dereq_,module,exports){'use strict';var $export=_dereq_(33),$typed=_dereq_(113),buffer=_dereq_(112),anObject=_dereq_(11),toIndex=_dereq_(105),toLength=_dereq_(108),isObject=_dereq_(50),TYPED_ARRAY=_dereq_(115)('typed_array'),ArrayBuffer=_dereq_(39).ArrayBuffer,speciesConstructor=_dereq_(95),$ArrayBuffer=buffer.ArrayBuffer,$DataView=buffer.DataView,$isView=$typed.ABV&&ArrayBuffer.isView,$slice=$ArrayBuffer.prototype.slice,VIEW=$typed.VIEW,ARRAY_BUFFER='ArrayBuffer';$export($export.G+$export.W+$export.F*(ArrayBuffer!==$ArrayBuffer),{ArrayBuffer:$ArrayBuffer});$export($export.S+$export.F*!$typed.CONSTR,ARRAY_BUFFER,{ // 24.1.3.1 ArrayBuffer.isView(arg)
isView:function isView(it){return $isView&&$isView(it)||isObject(it)&&VIEW in it;}});$export($export.P+$export.U+$export.F*_dereq_(35)(function(){return !new $ArrayBuffer(2).slice(1,undefined).byteLength;}),ARRAY_BUFFER,{ // 24.1.4.3 ArrayBuffer.prototype.slice(start, end)
slice:function slice(start,end){if($slice!==undefined&&end===undefined)return $slice.call(anObject(this),start); // FF fix
var len=anObject(this).byteLength,first=toIndex(start,len),final=toIndex(end===undefined?len:end,len),result=new (speciesConstructor(this,$ArrayBuffer))(toLength(final-first)),viewS=new $DataView(this),viewT=new $DataView(result),index=0;while(first<final){viewT.setUint8(index++,viewS.getUint8(first++));}return result;}});_dereq_(91)(ARRAY_BUFFER);},{"105":105,"108":108,"11":11,"112":112,"113":113,"115":115,"33":33,"35":35,"39":39,"50":50,"91":91,"95":95}],243:[function(_dereq_,module,exports){var $export=_dereq_(33);$export($export.G+$export.W+$export.F*!_dereq_(113).ABV,{DataView:_dereq_(112).DataView});},{"112":112,"113":113,"33":33}],244:[function(_dereq_,module,exports){_dereq_(111)('Float32',4,function(init){return function Float32Array(data,byteOffset,length){return init(this,data,byteOffset,length);};});},{"111":111}],245:[function(_dereq_,module,exports){_dereq_(111)('Float64',8,function(init){return function Float64Array(data,byteOffset,length){return init(this,data,byteOffset,length);};});},{"111":111}],246:[function(_dereq_,module,exports){_dereq_(111)('Int16',2,function(init){return function Int16Array(data,byteOffset,length){return init(this,data,byteOffset,length);};});},{"111":111}],247:[function(_dereq_,module,exports){_dereq_(111)('Int32',4,function(init){return function Int32Array(data,byteOffset,length){return init(this,data,byteOffset,length);};});},{"111":111}],248:[function(_dereq_,module,exports){_dereq_(111)('Int8',1,function(init){return function Int8Array(data,byteOffset,length){return init(this,data,byteOffset,length);};});},{"111":111}],249:[function(_dereq_,module,exports){_dereq_(111)('Uint16',2,function(init){return function Uint16Array(data,byteOffset,length){return init(this,data,byteOffset,length);};});},{"111":111}],250:[function(_dereq_,module,exports){_dereq_(111)('Uint32',4,function(init){return function Uint32Array(data,byteOffset,length){return init(this,data,byteOffset,length);};});},{"111":111}],251:[function(_dereq_,module,exports){_dereq_(111)('Uint8',1,function(init){return function Uint8Array(data,byteOffset,length){return init(this,data,byteOffset,length);};});},{"111":111}],252:[function(_dereq_,module,exports){_dereq_(111)('Uint8',1,function(init){return function Uint8ClampedArray(data,byteOffset,length){return init(this,data,byteOffset,length);};},true);},{"111":111}],253:[function(_dereq_,module,exports){'use strict';var each=_dereq_(16)(0),redefine=_dereq_(87),meta=_dereq_(63),assign=_dereq_(66),weak=_dereq_(24),isObject=_dereq_(50),has=_dereq_(40),getWeak=meta.getWeak,isExtensible=Object.isExtensible,uncaughtFrozenStore=weak.ufstore,tmp={},InternalMap;var wrapper=function wrapper(get){return function WeakMap(){return get(this,arguments.length>0?arguments[0]:undefined);};};var methods={ // 23.3.3.3 WeakMap.prototype.get(key)
get:function get(key){if(isObject(key)){var data=getWeak(key);if(data===true)return uncaughtFrozenStore(this).get(key);return data?data[this._i]:undefined;}}, // 23.3.3.5 WeakMap.prototype.set(key, value)
set:function set(key,value){return weak.def(this,key,value);}}; // 23.3 WeakMap Objects
var $WeakMap=module.exports=_dereq_(25)('WeakMap',wrapper,methods,weak,true,true); // IE11 WeakMap frozen keys fix
if(new $WeakMap().set((Object.freeze||Object)(tmp),7).get(tmp)!=7){InternalMap=weak.getConstructor(wrapper);assign(InternalMap.prototype,methods);meta.NEED=true;each(['delete','has','get','set'],function(key){var proto=$WeakMap.prototype,method=proto[key];redefine(proto,key,function(a,b){ // store frozen objects on internal weakmap shim
if(isObject(a)&&!isExtensible(a)){if(!this._f)this._f=new InternalMap();var result=this._f[key](a,b);return key=='set'?this:result; // store all the rest on native weakmap
}return method.call(this,a,b);});});}},{"16":16,"24":24,"25":25,"40":40,"50":50,"63":63,"66":66,"87":87}],254:[function(_dereq_,module,exports){'use strict';var weak=_dereq_(24); // 23.4 WeakSet Objects
_dereq_(25)('WeakSet',function(get){return function WeakSet(){return get(this,arguments.length>0?arguments[0]:undefined);};},{ // 23.4.3.1 WeakSet.prototype.add(value)
add:function add(value){return weak.def(this,value,true);}},weak,false,true);},{"24":24,"25":25}],255:[function(_dereq_,module,exports){'use strict';var $export=_dereq_(33),$includes=_dereq_(15)(true);$export($export.P,'Array',{ // https://github.com/domenic/Array.prototype.includes
includes:function includes(el /*, fromIndex = 0 */){return $includes(this,el,arguments.length>1?arguments[1]:undefined);}});_dereq_(9)('includes');},{"15":15,"33":33,"9":9}],256:[function(_dereq_,module,exports){ // https://github.com/ljharb/proposal-is-error
var $export=_dereq_(33),cof=_dereq_(21);$export($export.S,'Error',{isError:function isError(it){return cof(it)==='Error';}});},{"21":21,"33":33}],257:[function(_dereq_,module,exports){ // https://github.com/DavidBruant/Map-Set.prototype.toJSON
var $export=_dereq_(33);$export($export.P+$export.R,'Map',{toJSON:_dereq_(23)('Map')});},{"23":23,"33":33}],258:[function(_dereq_,module,exports){ // https://gist.github.com/BrendanEich/4294d5c212a6d2254703
var $export=_dereq_(33);$export($export.S,'Math',{iaddh:function iaddh(x0,x1,y0,y1){var $x0=x0>>>0,$x1=x1>>>0,$y0=y0>>>0;return $x1+(y1>>>0)+(($x0&$y0|($x0|$y0)&~($x0+$y0>>>0))>>>31)|0;}});},{"33":33}],259:[function(_dereq_,module,exports){ // https://gist.github.com/BrendanEich/4294d5c212a6d2254703
var $export=_dereq_(33);$export($export.S,'Math',{imulh:function imulh(u,v){var UINT16=0xffff,$u=+u,$v=+v,u0=$u&UINT16,v0=$v&UINT16,u1=$u>>16,v1=$v>>16,t=(u1*v0>>>0)+(u0*v0>>>16);return u1*v1+(t>>16)+((u0*v1>>>0)+(t&UINT16)>>16);}});},{"33":33}],260:[function(_dereq_,module,exports){ // https://gist.github.com/BrendanEich/4294d5c212a6d2254703
var $export=_dereq_(33);$export($export.S,'Math',{isubh:function isubh(x0,x1,y0,y1){var $x0=x0>>>0,$x1=x1>>>0,$y0=y0>>>0;return $x1-(y1>>>0)-((~$x0&$y0|~($x0^$y0)&$x0-$y0>>>0)>>>31)|0;}});},{"33":33}],261:[function(_dereq_,module,exports){ // https://gist.github.com/BrendanEich/4294d5c212a6d2254703
var $export=_dereq_(33);$export($export.S,'Math',{umulh:function umulh(u,v){var UINT16=0xffff,$u=+u,$v=+v,u0=$u&UINT16,v0=$v&UINT16,u1=$u>>>16,v1=$v>>>16,t=(u1*v0>>>0)+(u0*v0>>>16);return u1*v1+(t>>>16)+((u0*v1>>>0)+(t&UINT16)>>>16);}});},{"33":33}],262:[function(_dereq_,module,exports){ // http://goo.gl/XkBrjD
var $export=_dereq_(33),$entries=_dereq_(79)(true);$export($export.S,'Object',{entries:function entries(it){return $entries(it);}});},{"33":33,"79":79}],263:[function(_dereq_,module,exports){ // https://gist.github.com/WebReflection/9353781
var $export=_dereq_(33),ownKeys=_dereq_(80),toIObject=_dereq_(107),createDesc=_dereq_(85),gOPD=_dereq_(70),dP=_dereq_(68);$export($export.S,'Object',{getOwnPropertyDescriptors:function getOwnPropertyDescriptors(object){var O=toIObject(object),getDesc=gOPD.f,keys=ownKeys(O),result={},i=0,key,D;while(keys.length>i){D=getDesc(O,key=keys[i++]);if(key in result)dP.f(result,key,createDesc(0,D));else result[key]=D;}return result;}});},{"107":107,"33":33,"68":68,"70":70,"80":80,"85":85}],264:[function(_dereq_,module,exports){ // http://goo.gl/XkBrjD
var $export=_dereq_(33),$values=_dereq_(79)(false);$export($export.S,'Object',{values:function values(it){return $values(it);}});},{"33":33,"79":79}],265:[function(_dereq_,module,exports){var metadata=_dereq_(64),anObject=_dereq_(11),toMetaKey=metadata.key,ordinaryDefineOwnMetadata=metadata.set;metadata.exp({defineMetadata:function defineMetadata(metadataKey,metadataValue,target,targetKey){ordinaryDefineOwnMetadata(metadataKey,metadataValue,anObject(target),toMetaKey(targetKey));}});},{"11":11,"64":64}],266:[function(_dereq_,module,exports){var metadata=_dereq_(64),anObject=_dereq_(11),toMetaKey=metadata.key,getOrCreateMetadataMap=metadata.map,store=metadata.store;metadata.exp({deleteMetadata:function deleteMetadata(metadataKey,target /*, targetKey */){var targetKey=arguments.length<3?undefined:toMetaKey(arguments[2]),metadataMap=getOrCreateMetadataMap(anObject(target),targetKey,false);if(metadataMap===undefined||!metadataMap['delete'](metadataKey))return false;if(metadataMap.size)return true;var targetMetadata=store.get(target);targetMetadata['delete'](targetKey);return !!targetMetadata.size||store['delete'](target);}});},{"11":11,"64":64}],267:[function(_dereq_,module,exports){var Set=_dereq_(218),from=_dereq_(14),metadata=_dereq_(64),anObject=_dereq_(11),getPrototypeOf=_dereq_(74),ordinaryOwnMetadataKeys=metadata.keys,toMetaKey=metadata.key;var ordinaryMetadataKeys=function ordinaryMetadataKeys(O,P){var oKeys=ordinaryOwnMetadataKeys(O,P),parent=getPrototypeOf(O);if(parent===null)return oKeys;var pKeys=ordinaryMetadataKeys(parent,P);return pKeys.length?oKeys.length?from(new Set(oKeys.concat(pKeys))):pKeys:oKeys;};metadata.exp({getMetadataKeys:function getMetadataKeys(target /*, targetKey */){return ordinaryMetadataKeys(anObject(target),arguments.length<2?undefined:toMetaKey(arguments[1]));}});},{"11":11,"14":14,"218":218,"64":64,"74":74}],268:[function(_dereq_,module,exports){var metadata=_dereq_(64),anObject=_dereq_(11),getPrototypeOf=_dereq_(74),ordinaryHasOwnMetadata=metadata.has,ordinaryGetOwnMetadata=metadata.get,toMetaKey=metadata.key;var ordinaryGetMetadata=function ordinaryGetMetadata(MetadataKey,O,P){var hasOwn=ordinaryHasOwnMetadata(MetadataKey,O,P);if(hasOwn)return ordinaryGetOwnMetadata(MetadataKey,O,P);var parent=getPrototypeOf(O);return parent!==null?ordinaryGetMetadata(MetadataKey,parent,P):undefined;};metadata.exp({getMetadata:function getMetadata(metadataKey,target /*, targetKey */){return ordinaryGetMetadata(metadataKey,anObject(target),arguments.length<3?undefined:toMetaKey(arguments[2]));}});},{"11":11,"64":64,"74":74}],269:[function(_dereq_,module,exports){var metadata=_dereq_(64),anObject=_dereq_(11),ordinaryOwnMetadataKeys=metadata.keys,toMetaKey=metadata.key;metadata.exp({getOwnMetadataKeys:function getOwnMetadataKeys(target /*, targetKey */){return ordinaryOwnMetadataKeys(anObject(target),arguments.length<2?undefined:toMetaKey(arguments[1]));}});},{"11":11,"64":64}],270:[function(_dereq_,module,exports){var metadata=_dereq_(64),anObject=_dereq_(11),ordinaryGetOwnMetadata=metadata.get,toMetaKey=metadata.key;metadata.exp({getOwnMetadata:function getOwnMetadata(metadataKey,target /*, targetKey */){return ordinaryGetOwnMetadata(metadataKey,anObject(target),arguments.length<3?undefined:toMetaKey(arguments[2]));}});},{"11":11,"64":64}],271:[function(_dereq_,module,exports){var metadata=_dereq_(64),anObject=_dereq_(11),getPrototypeOf=_dereq_(74),ordinaryHasOwnMetadata=metadata.has,toMetaKey=metadata.key;var ordinaryHasMetadata=function ordinaryHasMetadata(MetadataKey,O,P){var hasOwn=ordinaryHasOwnMetadata(MetadataKey,O,P);if(hasOwn)return true;var parent=getPrototypeOf(O);return parent!==null?ordinaryHasMetadata(MetadataKey,parent,P):false;};metadata.exp({hasMetadata:function hasMetadata(metadataKey,target /*, targetKey */){return ordinaryHasMetadata(metadataKey,anObject(target),arguments.length<3?undefined:toMetaKey(arguments[2]));}});},{"11":11,"64":64,"74":74}],272:[function(_dereq_,module,exports){var metadata=_dereq_(64),anObject=_dereq_(11),ordinaryHasOwnMetadata=metadata.has,toMetaKey=metadata.key;metadata.exp({hasOwnMetadata:function hasOwnMetadata(metadataKey,target /*, targetKey */){return ordinaryHasOwnMetadata(metadataKey,anObject(target),arguments.length<3?undefined:toMetaKey(arguments[2]));}});},{"11":11,"64":64}],273:[function(_dereq_,module,exports){var metadata=_dereq_(64),anObject=_dereq_(11),aFunction=_dereq_(7),toMetaKey=metadata.key,ordinaryDefineOwnMetadata=metadata.set;metadata.exp({metadata:function metadata(metadataKey,metadataValue){return function decorator(target,targetKey){ordinaryDefineOwnMetadata(metadataKey,metadataValue,(targetKey!==undefined?anObject:aFunction)(target),toMetaKey(targetKey));};}});},{"11":11,"64":64,"7":7}],274:[function(_dereq_,module,exports){ // https://github.com/DavidBruant/Map-Set.prototype.toJSON
var $export=_dereq_(33);$export($export.P+$export.R,'Set',{toJSON:_dereq_(23)('Set')});},{"23":23,"33":33}],275:[function(_dereq_,module,exports){'use strict'; // https://github.com/mathiasbynens/String.prototype.at
var $export=_dereq_(33),$at=_dereq_(97)(true);$export($export.P,'String',{at:function at(pos){return $at(this,pos);}});},{"33":33,"97":97}],276:[function(_dereq_,module,exports){'use strict';var $export=_dereq_(33),$pad=_dereq_(100);$export($export.P,'String',{padEnd:function padEnd(maxLength /*, fillString = ' ' */){return $pad(this,maxLength,arguments.length>1?arguments[1]:undefined,false);}});},{"100":100,"33":33}],277:[function(_dereq_,module,exports){'use strict';var $export=_dereq_(33),$pad=_dereq_(100);$export($export.P,'String',{padStart:function padStart(maxLength /*, fillString = ' ' */){return $pad(this,maxLength,arguments.length>1?arguments[1]:undefined,true);}});},{"100":100,"33":33}],278:[function(_dereq_,module,exports){'use strict'; // https://github.com/sebmarkbage/ecmascript-string-left-right-trim
_dereq_(102)('trimLeft',function($trim){return function trimLeft(){return $trim(this,1);};},'trimStart');},{"102":102}],279:[function(_dereq_,module,exports){'use strict'; // https://github.com/sebmarkbage/ecmascript-string-left-right-trim
_dereq_(102)('trimRight',function($trim){return function trimRight(){return $trim(this,2);};},'trimEnd');},{"102":102}],280:[function(_dereq_,module,exports){ // https://github.com/ljharb/proposal-global
var $export=_dereq_(33);$export($export.S,'System',{global:_dereq_(39)});},{"33":33,"39":39}],281:[function(_dereq_,module,exports){var $iterators=_dereq_(129),redefine=_dereq_(87),global=_dereq_(39),hide=_dereq_(41),Iterators=_dereq_(57),wks=_dereq_(115),ITERATOR=wks('iterator'),TO_STRING_TAG=wks('toStringTag'),ArrayValues=Iterators.Array;for(var collections=['NodeList','DOMTokenList','MediaList','StyleSheetList','CSSRuleList'],i=0;i<5;i++){var NAME=collections[i],Collection=global[NAME],proto=Collection&&Collection.prototype,key;if(proto){if(!proto[ITERATOR])hide(proto,ITERATOR,ArrayValues);if(!proto[TO_STRING_TAG])hide(proto,TO_STRING_TAG,NAME);Iterators[NAME]=ArrayValues;for(key in $iterators){if(!proto[key])redefine(proto,key,$iterators[key],true);}}}},{"115":115,"129":129,"39":39,"41":41,"57":57,"87":87}],282:[function(_dereq_,module,exports){var $export=_dereq_(33),$task=_dereq_(104);$export($export.G+$export.B,{setImmediate:$task.set,clearImmediate:$task.clear});},{"104":104,"33":33}],283:[function(_dereq_,module,exports){ // ie9- setTimeout & setInterval additional parameters fix
var global=_dereq_(39),$export=_dereq_(33),invoke=_dereq_(45),partial=_dereq_(83),navigator=global.navigator,MSIE=!!navigator&&/MSIE .\./.test(navigator.userAgent); // <- dirty ie9- check
var wrap=function wrap(set){return MSIE?function(fn,time /*, ...args */){return set(invoke(partial,[].slice.call(arguments,2),typeof fn=='function'?fn:Function(fn)),time);}:set;};$export($export.G+$export.B+$export.F*MSIE,{setTimeout:wrap(global.setTimeout),setInterval:wrap(global.setInterval)});},{"33":33,"39":39,"45":45,"83":83}],284:[function(_dereq_,module,exports){_dereq_(241);_dereq_(178);_dereq_(180);_dereq_(179);_dereq_(182);_dereq_(184);_dereq_(189);_dereq_(183);_dereq_(181);_dereq_(191);_dereq_(190);_dereq_(186);_dereq_(187);_dereq_(185);_dereq_(177);_dereq_(188);_dereq_(192);_dereq_(193);_dereq_(144);_dereq_(146);_dereq_(145);_dereq_(195);_dereq_(194);_dereq_(165);_dereq_(175);_dereq_(176);_dereq_(166);_dereq_(167);_dereq_(168);_dereq_(169);_dereq_(170);_dereq_(171);_dereq_(172);_dereq_(173);_dereq_(174);_dereq_(148);_dereq_(149);_dereq_(150);_dereq_(151);_dereq_(152);_dereq_(153);_dereq_(154);_dereq_(155);_dereq_(156);_dereq_(157);_dereq_(158);_dereq_(159);_dereq_(160);_dereq_(161);_dereq_(162);_dereq_(163);_dereq_(164);_dereq_(228);_dereq_(233);_dereq_(240);_dereq_(231);_dereq_(223);_dereq_(224);_dereq_(229);_dereq_(234);_dereq_(236);_dereq_(219);_dereq_(220);_dereq_(221);_dereq_(222);_dereq_(225);_dereq_(226);_dereq_(227);_dereq_(230);_dereq_(232);_dereq_(235);_dereq_(237);_dereq_(238);_dereq_(239);_dereq_(140);_dereq_(143);_dereq_(141);_dereq_(142);_dereq_(128);_dereq_(126);_dereq_(133);_dereq_(130);_dereq_(136);_dereq_(138);_dereq_(125);_dereq_(132);_dereq_(122);_dereq_(137);_dereq_(120);_dereq_(135);_dereq_(134);_dereq_(127);_dereq_(131);_dereq_(119);_dereq_(121);_dereq_(124);_dereq_(123);_dereq_(139);_dereq_(129);_dereq_(211);_dereq_(217);_dereq_(212);_dereq_(213);_dereq_(214);_dereq_(215);_dereq_(216);_dereq_(196);_dereq_(147);_dereq_(218);_dereq_(253);_dereq_(254);_dereq_(242);_dereq_(243);_dereq_(248);_dereq_(251);_dereq_(252);_dereq_(246);_dereq_(249);_dereq_(247);_dereq_(250);_dereq_(244);_dereq_(245);_dereq_(197);_dereq_(198);_dereq_(199);_dereq_(200);_dereq_(201);_dereq_(204);_dereq_(202);_dereq_(203);_dereq_(205);_dereq_(206);_dereq_(207);_dereq_(208);_dereq_(210);_dereq_(209);_dereq_(255);_dereq_(275);_dereq_(277);_dereq_(276);_dereq_(278);_dereq_(279);_dereq_(263);_dereq_(264);_dereq_(262);_dereq_(257);_dereq_(274);_dereq_(280);_dereq_(256);_dereq_(258);_dereq_(260);_dereq_(259);_dereq_(261);_dereq_(265);_dereq_(266);_dereq_(268);_dereq_(267);_dereq_(270);_dereq_(269);_dereq_(271);_dereq_(272);_dereq_(273);_dereq_(283);_dereq_(282);_dereq_(281);module.exports=_dereq_(26);},{"119":119,"120":120,"121":121,"122":122,"123":123,"124":124,"125":125,"126":126,"127":127,"128":128,"129":129,"130":130,"131":131,"132":132,"133":133,"134":134,"135":135,"136":136,"137":137,"138":138,"139":139,"140":140,"141":141,"142":142,"143":143,"144":144,"145":145,"146":146,"147":147,"148":148,"149":149,"150":150,"151":151,"152":152,"153":153,"154":154,"155":155,"156":156,"157":157,"158":158,"159":159,"160":160,"161":161,"162":162,"163":163,"164":164,"165":165,"166":166,"167":167,"168":168,"169":169,"170":170,"171":171,"172":172,"173":173,"174":174,"175":175,"176":176,"177":177,"178":178,"179":179,"180":180,"181":181,"182":182,"183":183,"184":184,"185":185,"186":186,"187":187,"188":188,"189":189,"190":190,"191":191,"192":192,"193":193,"194":194,"195":195,"196":196,"197":197,"198":198,"199":199,"200":200,"201":201,"202":202,"203":203,"204":204,"205":205,"206":206,"207":207,"208":208,"209":209,"210":210,"211":211,"212":212,"213":213,"214":214,"215":215,"216":216,"217":217,"218":218,"219":219,"220":220,"221":221,"222":222,"223":223,"224":224,"225":225,"226":226,"227":227,"228":228,"229":229,"230":230,"231":231,"232":232,"233":233,"234":234,"235":235,"236":236,"237":237,"238":238,"239":239,"240":240,"241":241,"242":242,"243":243,"244":244,"245":245,"246":246,"247":247,"248":248,"249":249,"250":250,"251":251,"252":252,"253":253,"254":254,"255":255,"256":256,"257":257,"258":258,"259":259,"26":26,"260":260,"261":261,"262":262,"263":263,"264":264,"265":265,"266":266,"267":267,"268":268,"269":269,"270":270,"271":271,"272":272,"273":273,"274":274,"275":275,"276":276,"277":277,"278":278,"279":279,"280":280,"281":281,"282":282,"283":283}],285:[function(_dereq_,module,exports){(function(global){ /**
* Copyright (c) 2014, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* https://raw.github.com/facebook/regenerator/master/LICENSE file. An
* additional grant of patent rights can be found in the PATENTS file in
* the same directory.
*/!function(global){"use strict";var hasOwn=Object.prototype.hasOwnProperty;var undefined; // More compressible than void 0.
var iteratorSymbol=typeof Symbol==="function"&&Symbol.iterator||"@@iterator";var inModule=(typeof module==="undefined"?"undefined":babelHelpers.typeof(module))==="object";var runtime=global.regeneratorRuntime;if(runtime){if(inModule){ // If regeneratorRuntime is defined globally and we're in a module,
// make the exports object identical to regeneratorRuntime.
module.exports=runtime;} // Don't bother evaluating the rest of this file if the runtime was
// already defined globally.
return;} // Define the runtime globally (as expected by generated code) as either
// module.exports (if we're in a module) or a new, empty object.
runtime=global.regeneratorRuntime=inModule?module.exports:{};function wrap(innerFn,outerFn,self,tryLocsList){ // If outerFn provided, then outerFn.prototype instanceof Generator.
var generator=Object.create((outerFn||Generator).prototype);var context=new Context(tryLocsList||[]); // The ._invoke method unifies the implementations of the .next,
// .throw, and .return methods.
generator._invoke=makeInvokeMethod(innerFn,self,context);return generator;}runtime.wrap=wrap; // Try/catch helper to minimize deoptimizations. Returns a completion
// record like context.tryEntries[i].completion. This interface could
// have been (and was previously) designed to take a closure to be
// invoked without arguments, but in all the cases we care about we
// already have an existing method we want to call, so there's no need
// to create a new function object. We can even get away with assuming
// the method takes exactly one argument, since that happens to be true
// in every case, so we don't have to touch the arguments object. The
// only additional allocation required is the completion record, which
// has a stable shape and so hopefully should be cheap to allocate.
function tryCatch(fn,obj,arg){try{return {type:"normal",arg:fn.call(obj,arg)};}catch(err){return {type:"throw",arg:err};}}var GenStateSuspendedStart="suspendedStart";var GenStateSuspendedYield="suspendedYield";var GenStateExecuting="executing";var GenStateCompleted="completed"; // Returning this object from the innerFn has the same effect as
// breaking out of the dispatch switch statement.
var ContinueSentinel={}; // Dummy constructor functions that we use as the .constructor and
// .constructor.prototype properties for functions that return Generator
// objects. For full spec compliance, you may wish to configure your
// minifier not to mangle the names of these two functions.
function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}var Gp=GeneratorFunctionPrototype.prototype=Generator.prototype;GeneratorFunction.prototype=Gp.constructor=GeneratorFunctionPrototype;GeneratorFunctionPrototype.constructor=GeneratorFunction;GeneratorFunction.displayName="GeneratorFunction"; // Helper for defining the .next, .throw, and .return methods of the
// Iterator interface in terms of a single ._invoke method.
function defineIteratorMethods(prototype){["next","throw","return"].forEach(function(method){prototype[method]=function(arg){return this._invoke(method,arg);};});}runtime.isGeneratorFunction=function(genFun){var ctor=typeof genFun==="function"&&genFun.constructor;return ctor?ctor===GeneratorFunction|| // For the native GeneratorFunction constructor, the best we can
// do is to check its .name property.
(ctor.displayName||ctor.name)==="GeneratorFunction":false;};runtime.mark=function(genFun){if(Object.setPrototypeOf){Object.setPrototypeOf(genFun,GeneratorFunctionPrototype);}else {genFun.__proto__=GeneratorFunctionPrototype;}genFun.prototype=Object.create(Gp);return genFun;}; // Within the body of any async function, `await x` is transformed to
// `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
// `value instanceof AwaitArgument` to determine if the yielded value is
// meant to be awaited. Some may consider the name of this method too
// cutesy, but they are curmudgeons.
runtime.awrap=function(arg){return new AwaitArgument(arg);};function AwaitArgument(arg){this.arg=arg;}function AsyncIterator(generator){ // This invoke function is written in a style that assumes some
// calling function (or Promise) will handle exceptions.
function invoke(method,arg){var result=generator[method](arg);var value=result.value;return value instanceof AwaitArgument?Promise.resolve(value.arg).then(invokeNext,invokeThrow):Promise.resolve(value).then(function(unwrapped){ // When a yielded Promise is resolved, its final value becomes
// the .value of the Promise<{value,done}> result for the
// current iteration. If the Promise is rejected, however, the
// result for this iteration will be rejected with the same
// reason. Note that rejections of yielded Promises are not
// thrown back into the generator function, as is the case
// when an awaited Promise is rejected. This difference in
// behavior between yield and await is important, because it
// allows the consumer to decide what to do with the yielded
// rejection (swallow it and continue, manually .throw it back
// into the generator, abandon iteration, whatever). With
// await, by contrast, there is no opportunity to examine the
// rejection reason outside the generator function, so the
// only option is to throw it from the await expression, and
// let the generator function handle the exception.
result.value=unwrapped;return result;});}if((typeof process==="undefined"?"undefined":babelHelpers.typeof(process))==="object"&&process.domain){invoke=process.domain.bind(invoke);}var invokeNext=invoke.bind(generator,"next");var invokeThrow=invoke.bind(generator,"throw");var invokeReturn=invoke.bind(generator,"return");var previousPromise;function enqueue(method,arg){function callInvokeWithMethodAndArg(){return invoke(method,arg);}return previousPromise= // If enqueue has been called before, then we want to wait until
// all previous Promises have been resolved before calling invoke,
// so that results are always delivered in the correct order. If
// enqueue has not been called before, then it is important to
// call invoke immediately, without waiting on a callback to fire,
// so that the async generator function has the opportunity to do
// any necessary setup in a predictable way. This predictability
// is why the Promise constructor synchronously invokes its
// executor callback, and why async functions synchronously
// execute code before the first await. Since we implement simple
// async functions in terms of async generators, it is especially
// important to get this right, even though it requires care.
previousPromise?previousPromise.then(callInvokeWithMethodAndArg, // Avoid propagating failures to Promises returned by later
// invocations of the iterator.
callInvokeWithMethodAndArg):new Promise(function(resolve){resolve(callInvokeWithMethodAndArg());});} // Define the unified helper method that is used to implement .next,
// .throw, and .return (see defineIteratorMethods).
this._invoke=enqueue;}defineIteratorMethods(AsyncIterator.prototype); // Note that simple async functions are implemented on top of
// AsyncIterator objects; they just return a Promise for the value of
// the final result produced by the iterator.
runtime.async=function(innerFn,outerFn,self,tryLocsList){var iter=new AsyncIterator(wrap(innerFn,outerFn,self,tryLocsList));return runtime.isGeneratorFunction(outerFn)?iter // If outerFn is a generator, return the full iterator.
:iter.next().then(function(result){return result.done?result.value:iter.next();});};function makeInvokeMethod(innerFn,self,context){var state=GenStateSuspendedStart;return function invoke(method,arg){if(state===GenStateExecuting){throw new Error("Generator is already running");}if(state===GenStateCompleted){if(method==="throw"){throw arg;} // Be forgiving, per 25.3.3.3.3 of the spec:
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
return doneResult();}while(true){var delegate=context.delegate;if(delegate){if(method==="return"||method==="throw"&&delegate.iterator[method]===undefined){ // A return or throw (when the delegate iterator has no throw
// method) always terminates the yield* loop.
context.delegate=null; // If the delegate iterator has a return method, give it a
// chance to clean up.
var returnMethod=delegate.iterator["return"];if(returnMethod){var record=tryCatch(returnMethod,delegate.iterator,arg);if(record.type==="throw"){ // If the return method threw an exception, let that
// exception prevail over the original return or throw.
method="throw";arg=record.arg;continue;}}if(method==="return"){ // Continue with the outer return, now that the delegate
// iterator has been terminated.
continue;}}var record=tryCatch(delegate.iterator[method],delegate.iterator,arg);if(record.type==="throw"){context.delegate=null; // Like returning generator.throw(uncaught), but without the
// overhead of an extra function call.
method="throw";arg=record.arg;continue;} // Delegate generator ran and handled its own exceptions so
// regardless of what the method was, we continue as if it is
// "next" with an undefined arg.
method="next";arg=undefined;var info=record.arg;if(info.done){context[delegate.resultName]=info.value;context.next=delegate.nextLoc;}else {state=GenStateSuspendedYield;return info;}context.delegate=null;}if(method==="next"){context._sent=arg;if(state===GenStateSuspendedYield){context.sent=arg;}else {context.sent=undefined;}}else if(method==="throw"){if(state===GenStateSuspendedStart){state=GenStateCompleted;throw arg;}if(context.dispatchException(arg)){ // If the dispatched exception was caught by a catch block,
// then let that catch block handle the exception normally.
method="next";arg=undefined;}}else if(method==="return"){context.abrupt("return",arg);}state=GenStateExecuting;var record=tryCatch(innerFn,self,context);if(record.type==="normal"){ // If an exception is thrown from innerFn, we leave state ===
// GenStateExecuting and loop back for another invocation.
state=context.done?GenStateCompleted:GenStateSuspendedYield;var info={value:record.arg,done:context.done};if(record.arg===ContinueSentinel){if(context.delegate&&method==="next"){ // Deliberately forget the last sent value so that we don't
// accidentally pass it on to the delegate.
arg=undefined;}}else {return info;}}else if(record.type==="throw"){state=GenStateCompleted; // Dispatch the exception by looping back around to the
// context.dispatchException(arg) call above.
method="throw";arg=record.arg;}}};} // Define Generator.prototype.{next,throw,return} in terms of the
// unified ._invoke helper method.
defineIteratorMethods(Gp);Gp[iteratorSymbol]=function(){return this;};Gp.toString=function(){return "[object Generator]";};function pushTryEntry(locs){var entry={tryLoc:locs[0]};if(1 in locs){entry.catchLoc=locs[1];}if(2 in locs){entry.finallyLoc=locs[2];entry.afterLoc=locs[3];}this.tryEntries.push(entry);}function resetTryEntry(entry){var record=entry.completion||{};record.type="normal";delete record.arg;entry.completion=record;}function Context(tryLocsList){ // The root entry object (effectively a try statement without a catch
// or a finally block) gives us a place to store values thrown from
// locations where there is no enclosing try statement.
this.tryEntries=[{tryLoc:"root"}];tryLocsList.forEach(pushTryEntry,this);this.reset(true);}runtime.keys=function(object){var keys=[];for(var key in object){keys.push(key);}keys.reverse(); // Rather than returning an object with a next method, we keep
// things simple and return the next function itself.
return function next(){while(keys.length){var key=keys.pop();if(key in object){next.value=key;next.done=false;return next;}} // To avoid creating an additional object, we just hang the .value
// and .done properties off the next function object itself. This
// also ensures that the minifier will not anonymize the function.
next.done=true;return next;};};function values(iterable){if(iterable){var iteratorMethod=iterable[iteratorSymbol];if(iteratorMethod){return iteratorMethod.call(iterable);}if(typeof iterable.next==="function"){return iterable;}if(!isNaN(iterable.length)){var i=-1,next=function next(){while(++i<iterable.length){if(hasOwn.call(iterable,i)){next.value=iterable[i];next.done=false;return next;}}next.value=undefined;next.done=true;return next;};return next.next=next;}} // Return an iterator with no values.
return {next:doneResult};}runtime.values=values;function doneResult(){return {value:undefined,done:true};}Context.prototype={constructor:Context,reset:function reset(skipTempReset){this.prev=0;this.next=0;this.sent=undefined;this.done=false;this.delegate=null;this.tryEntries.forEach(resetTryEntry);if(!skipTempReset){for(var name in this){ // Not sure about the optimal order of these conditions:
if(name.charAt(0)==="t"&&hasOwn.call(this,name)&&!isNaN(+name.slice(1))){this[name]=undefined;}}}},stop:function stop(){this.done=true;var rootEntry=this.tryEntries[0];var rootRecord=rootEntry.completion;if(rootRecord.type==="throw"){throw rootRecord.arg;}return this.rval;},dispatchException:function dispatchException(exception){if(this.done){throw exception;}var context=this;function handle(loc,caught){record.type="throw";record.arg=exception;context.next=loc;return !!caught;}for(var i=this.tryEntries.length-1;i>=0;--i){var entry=this.tryEntries[i];var record=entry.completion;if(entry.tryLoc==="root"){ // Exception thrown outside of any try block that could handle
// it, so set the completion value of the entire function to
// throw the exception.
return handle("end");}if(entry.tryLoc<=this.prev){var hasCatch=hasOwn.call(entry,"catchLoc");var hasFinally=hasOwn.call(entry,"finallyLoc");if(hasCatch&&hasFinally){if(this.prev<entry.catchLoc){return handle(entry.catchLoc,true);}else if(this.prev<entry.finallyLoc){return handle(entry.finallyLoc);}}else if(hasCatch){if(this.prev<entry.catchLoc){return handle(entry.catchLoc,true);}}else if(hasFinally){if(this.prev<entry.finallyLoc){return handle(entry.finallyLoc);}}else {throw new Error("try statement without catch or finally");}}}},abrupt:function abrupt(type,arg){for(var i=this.tryEntries.length-1;i>=0;--i){var entry=this.tryEntries[i];if(entry.tryLoc<=this.prev&&hasOwn.call(entry,"finallyLoc")&&this.prev<entry.finallyLoc){var finallyEntry=entry;break;}}if(finallyEntry&&(type==="break"||type==="continue")&&finallyEntry.tryLoc<=arg&&arg<=finallyEntry.finallyLoc){ // Ignore the finally entry if control is not jumping to a
// location outside the try/catch block.
finallyEntry=null;}var record=finallyEntry?finallyEntry.completion:{};record.type=type;record.arg=arg;if(finallyEntry){this.next=finallyEntry.finallyLoc;}else {this.complete(record);}return ContinueSentinel;},complete:function complete(record,afterLoc){if(record.type==="throw"){throw record.arg;}if(record.type==="break"||record.type==="continue"){this.next=record.arg;}else if(record.type==="return"){this.rval=record.arg;this.next="end";}else if(record.type==="normal"&&afterLoc){this.next=afterLoc;}},finish:function finish(finallyLoc){for(var i=this.tryEntries.length-1;i>=0;--i){var entry=this.tryEntries[i];if(entry.finallyLoc===finallyLoc){this.complete(entry.completion,entry.afterLoc);resetTryEntry(entry);return ContinueSentinel;}}},"catch":function _catch(tryLoc){for(var i=this.tryEntries.length-1;i>=0;--i){var entry=this.tryEntries[i];if(entry.tryLoc===tryLoc){var record=entry.completion;if(record.type==="throw"){var thrown=record.arg;resetTryEntry(entry);}return thrown;}} // The context.catch method must only be called with a location
// argument that corresponds to a known catch block.
throw new Error("illegal catch attempt");},delegateYield:function delegateYield(iterable,resultName,nextLoc){this.delegate={iterator:values(iterable),resultName:resultName,nextLoc:nextLoc};return ContinueSentinel;}};}( // Among the various tricks for obtaining a reference to the global
// object, this seems to be the most reliable technique that does not
// use indirect eval (which violates Content Security Policy).
(typeof global==="undefined"?"undefined":babelHelpers.typeof(global))==="object"?global:(typeof window==="undefined"?"undefined":babelHelpers.typeof(window))==="object"?window:(typeof self==="undefined"?"undefined":babelHelpers.typeof(self))==="object"?self:this);}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{});},{}]},{},[1]);});polyfill&&(typeof polyfill==="undefined"?"undefined":babelHelpers.typeof(polyfill))==='object'&&'default' in polyfill?polyfill['default']:polyfill;
var util = __commonjs(function (module, exports, global) {
(function (global, factory) {
if (typeof define === 'function' && define.amd) {
define(['exports', 'module'], factory);
} else if (typeof exports !== 'undefined' && typeof module !== 'undefined') {
factory(exports, module);
} else {
var mod = {
exports: {}
};
factory(mod.exports, mod);
global.util = mod.exports;
}
})(__commonjs_global, function (exports, module) {
/**
* --------------------------------------------------------------------------
* Bootstrap (v4.0.0-alpha.2): util.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
'use strict';
var Util = function ($) {
/**
* ------------------------------------------------------------------------
* Private TransitionEnd Helpers
* ------------------------------------------------------------------------
*/
var transition = false;
var TransitionEndEvent = {
WebkitTransition: 'webkitTransitionEnd',
MozTransition: 'transitionend',
OTransition: 'oTransitionEnd otransitionend',
transition: 'transitionend'
};
// shoutout AngusCroll (https://goo.gl/pxwQGp)
function toType(obj) {
return {}.toString.call(obj).match(/\s([a-zA-Z]+)/)[1].toLowerCase();
}
function isElement(obj) {
return (obj[0] || obj).nodeType;
}
function getSpecialTransitionEndEvent() {
return {
bindType: transition.end,
delegateType: transition.end,
handle: function handle(event) {
if ($(event.target).is(this)) {
return event.handleObj.handler.apply(this, arguments);
}
}
};
}
function transitionEndTest() {
if (window.QUnit) {
return false;
}
var el = document.createElement('bootstrap');
for (var _name in TransitionEndEvent) {
if (el.style[_name] !== undefined) {
return { end: TransitionEndEvent[_name] };
}
}
return false;
}
function transitionEndEmulator(duration) {
var _this = this;
var called = false;
$(this).one(Util.TRANSITION_END, function () {
called = true;
});
setTimeout(function () {
if (!called) {
Util.triggerTransitionEnd(_this);
}
}, duration);
return this;
}
function setTransitionEndSupport() {
transition = transitionEndTest();
$.fn.emulateTransitionEnd = transitionEndEmulator;
if (Util.supportsTransitionEnd()) {
$.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
}
}
/**
* --------------------------------------------------------------------------
* Public Util Api
* --------------------------------------------------------------------------
*/
var Util = {
TRANSITION_END: 'bsTransitionEnd',
getUID: function getUID(prefix) {
do {
/* eslint-disable no-bitwise */
prefix += ~ ~(Math.random() * 1000000); // "~~" acts like a faster Math.floor() here
/* eslint-enable no-bitwise */
} while (document.getElementById(prefix));
return prefix;
},
getSelectorFromElement: function getSelectorFromElement(element) {
var selector = element.getAttribute('data-target');
if (!selector) {
selector = element.getAttribute('href') || '';
selector = /^#[a-z]/i.test(selector) ? selector : null;
}
return selector;
},
reflow: function reflow(element) {
new Function('bs', 'return bs')(element.offsetHeight);
},
triggerTransitionEnd: function triggerTransitionEnd(element) {
$(element).trigger(transition.end);
},
supportsTransitionEnd: function supportsTransitionEnd() {
return Boolean(transition);
},
typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
for (var property in configTypes) {
if (configTypes.hasOwnProperty(property)) {
var expectedTypes = configTypes[property];
var value = config[property];
var valueType = undefined;
if (value && isElement(value)) {
valueType = 'element';
} else {
valueType = toType(value);
}
if (!new RegExp(expectedTypes).test(valueType)) {
throw new Error(componentName.toUpperCase() + ': ' + ('Option "' + property + '" provided type "' + valueType + '" ') + ('but expected type "' + expectedTypes + '".'));
}
}
}
}
};
setTransitionEndSupport();
return Util;
}(jQuery);
module.exports = Util;
});
});
var require$$0$1 = util && (typeof util === 'undefined' ? 'undefined' : babelHelpers.typeof(util)) === 'object' && 'default' in util ? util['default'] : util;
var tooltip = __commonjs(function (module, exports, global) {
(function (global, factory) {
if (typeof define === 'function' && define.amd) {
define(['exports', 'module', './util'], factory);
} else if (typeof exports !== 'undefined' && typeof module !== 'undefined') {
factory(exports, module, require$$0$1);
} else {
var mod = {
exports: {}
};
factory(mod.exports, mod, global.Util);
global.tooltip = mod.exports;
}
})(__commonjs_global, function (exports, module, _util) {
/* global Tether */
'use strict';
var _createClass = function () {
function defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ('value' in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);
}
}return function (Constructor, protoProps, staticProps) {
if (protoProps) defineProperties(Constructor.prototype, protoProps);if (staticProps) defineProperties(Constructor, staticProps);return Constructor;
};
}();
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { 'default': obj };
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError('Cannot call a class as a function');
}
}
var _Util = _interopRequireDefault(_util);
/**
* --------------------------------------------------------------------------
* Bootstrap (v4.0.0-alpha.2): tooltip.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
var Tooltip = function ($) {
/**
* Check for Tether dependency
* Tether - http://github.hubspot.com/tether/
*/
if (window.Tether === undefined) {
throw new Error('Bootstrap tooltips require Tether (http://github.hubspot.com/tether/)');
}
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var NAME = 'tooltip';
var VERSION = '4.0.0-alpha.2';
var DATA_KEY = 'bs.tooltip';
var EVENT_KEY = '.' + DATA_KEY;
var JQUERY_NO_CONFLICT = $.fn[NAME];
var TRANSITION_DURATION = 150;
var CLASS_PREFIX = 'bs-tether';
var Default = {
animation: true,
template: '<div class="tooltip" role="tooltip">' + '<div class="tooltip-arrow"></div>' + '<div class="tooltip-inner"></div></div>',
trigger: 'hover focus',
title: '',
delay: 0,
html: false,
selector: false,
placement: 'top',
offset: '0 0',
constraints: []
};
var DefaultType = {
animation: 'boolean',
template: 'string',
title: '(string|element|function)',
trigger: 'string',
delay: '(number|object)',
html: 'boolean',
selector: '(string|boolean)',
placement: '(string|function)',
offset: 'string',
constraints: 'array'
};
var AttachmentMap = {
TOP: 'bottom center',
RIGHT: 'middle left',
BOTTOM: 'top center',
LEFT: 'middle right'
};
var HoverState = {
IN: 'in',
OUT: 'out'
};
var Event = {
HIDE: 'hide' + EVENT_KEY,
HIDDEN: 'hidden' + EVENT_KEY,
SHOW: 'show' + EVENT_KEY,
SHOWN: 'shown' + EVENT_KEY,
INSERTED: 'inserted' + EVENT_KEY,
CLICK: 'click' + EVENT_KEY,
FOCUSIN: 'focusin' + EVENT_KEY,
FOCUSOUT: 'focusout' + EVENT_KEY,
MOUSEENTER: 'mouseenter' + EVENT_KEY,
MOUSELEAVE: 'mouseleave' + EVENT_KEY
};
var ClassName = {
FADE: 'fade',
IN: 'in'
};
var Selector = {
TOOLTIP: '.tooltip',
TOOLTIP_INNER: '.tooltip-inner'
};
var TetherClass = {
element: false,
enabled: false
};
var Trigger = {
HOVER: 'hover',
FOCUS: 'focus',
CLICK: 'click',
MANUAL: 'manual'
};
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
var Tooltip = function () {
function Tooltip(element, config) {
_classCallCheck(this, Tooltip);
// private
this._isEnabled = true;
this._timeout = 0;
this._hoverState = '';
this._activeTrigger = {};
this._tether = null;
// protected
this.element = element;
this.config = this._getConfig(config);
this.tip = null;
this._setListeners();
}
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
// getters
_createClass(Tooltip, [{
key: 'enable',
// public
value: function enable() {
this._isEnabled = true;
}
}, {
key: 'disable',
value: function disable() {
this._isEnabled = false;
}
}, {
key: 'toggleEnabled',
value: function toggleEnabled() {
this._isEnabled = !this._isEnabled;
}
}, {
key: 'toggle',
value: function toggle(event) {
if (event) {
var dataKey = this.constructor.DATA_KEY;
var context = $(event.currentTarget).data(dataKey);
if (!context) {
context = new this.constructor(event.currentTarget, this._getDelegateConfig());
$(event.currentTarget).data(dataKey, context);
}
context._activeTrigger.click = !context._activeTrigger.click;
if (context._isWithActiveTrigger()) {
context._enter(null, context);
} else {
context._leave(null, context);
}
} else {
if ($(this.getTipElement()).hasClass(ClassName.IN)) {
this._leave(null, this);
return;
}
this._enter(null, this);
}
}
}, {
key: 'dispose',
value: function dispose() {
clearTimeout(this._timeout);
this.cleanupTether();
$.removeData(this.element, this.constructor.DATA_KEY);
$(this.element).off(this.constructor.EVENT_KEY);
if (this.tip) {
$(this.tip).remove();
}
this._isEnabled = null;
this._timeout = null;
this._hoverState = null;
this._activeTrigger = null;
this._tether = null;
this.element = null;
this.config = null;
this.tip = null;
}
}, {
key: 'show',
value: function show() {
var _this = this;
var showEvent = $.Event(this.constructor.Event.SHOW);
if (this.isWithContent() && this._isEnabled) {
$(this.element).trigger(showEvent);
var isInTheDom = $.contains(this.element.ownerDocument.documentElement, this.element);
if (showEvent.isDefaultPrevented() || !isInTheDom) {
return;
}
var tip = this.getTipElement();
var tipId = _Util['default'].getUID(this.constructor.NAME);
tip.setAttribute('id', tipId);
this.element.setAttribute('aria-describedby', tipId);
this.setContent();
if (this.config.animation) {
$(tip).addClass(ClassName.FADE);
}
var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
var attachment = this._getAttachment(placement);
$(tip).data(this.constructor.DATA_KEY, this).appendTo(document.body);
$(this.element).trigger(this.constructor.Event.INSERTED);
this._tether = new Tether({
attachment: attachment,
element: tip,
target: this.element,
classes: TetherClass,
classPrefix: CLASS_PREFIX,
offset: this.config.offset,
constraints: this.config.constraints,
addTargetClasses: false
});
_Util['default'].reflow(tip);
this._tether.position();
$(tip).addClass(ClassName.IN);
var complete = function complete() {
var prevHoverState = _this._hoverState;
_this._hoverState = null;
$(_this.element).trigger(_this.constructor.Event.SHOWN);
if (prevHoverState === HoverState.OUT) {
_this._leave(null, _this);
}
};
if (_Util['default'].supportsTransitionEnd() && $(this.tip).hasClass(ClassName.FADE)) {
$(this.tip).one(_Util['default'].TRANSITION_END, complete).emulateTransitionEnd(Tooltip._TRANSITION_DURATION);
return;
}
complete();
}
}
}, {
key: 'hide',
value: function hide(callback) {
var _this2 = this;
var tip = this.getTipElement();
var hideEvent = $.Event(this.constructor.Event.HIDE);
var complete = function complete() {
if (_this2._hoverState !== HoverState.IN && tip.parentNode) {
tip.parentNode.removeChild(tip);
}
_this2.element.removeAttribute('aria-describedby');
$(_this2.element).trigger(_this2.constructor.Event.HIDDEN);
_this2.cleanupTether();
if (callback) {
callback();
}
};
$(this.element).trigger(hideEvent);
if (hideEvent.isDefaultPrevented()) {
return;
}
$(tip).removeClass(ClassName.IN);
if (_Util['default'].supportsTransitionEnd() && $(this.tip).hasClass(ClassName.FADE)) {
$(tip).one(_Util['default'].TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION);
} else {
complete();
}
this._hoverState = '';
}
// protected
}, {
key: 'isWithContent',
value: function isWithContent() {
return Boolean(this.getTitle());
}
}, {
key: 'getTipElement',
value: function getTipElement() {
return this.tip = this.tip || $(this.config.template)[0];
}
}, {
key: 'setContent',
value: function setContent() {
var $tip = $(this.getTipElement());
this.setElementContent($tip.find(Selector.TOOLTIP_INNER), this.getTitle());
$tip.removeClass(ClassName.FADE).removeClass(ClassName.IN);
this.cleanupTether();
}
}, {
key: 'setElementContent',
value: function setElementContent($element, content) {
var html = this.config.html;
if ((typeof content === 'undefined' ? 'undefined' : babelHelpers.typeof(content)) === 'object' && (content.nodeType || content.jquery)) {
// content is a DOM node or a jQuery
if (html) {
if (!$(content).parent().is($element)) {
$element.empty().append(content);
}
} else {
$element.text($(content).text());
}
} else {
$element[html ? 'html' : 'text'](content);
}
}
}, {
key: 'getTitle',
value: function getTitle() {
var title = this.element.getAttribute('data-original-title');
if (!title) {
title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
}
return title;
}
}, {
key: 'cleanupTether',
value: function cleanupTether() {
if (this._tether) {
this._tether.destroy();
}
}
// private
}, {
key: '_getAttachment',
value: function _getAttachment(placement) {
return AttachmentMap[placement.toUpperCase()];
}
}, {
key: '_setListeners',
value: function _setListeners() {
var _this3 = this;
var triggers = this.config.trigger.split(' ');
triggers.forEach(function (trigger) {
if (trigger === 'click') {
$(_this3.element).on(_this3.constructor.Event.CLICK, _this3.config.selector, $.proxy(_this3.toggle, _this3));
} else if (trigger !== Trigger.MANUAL) {
var eventIn = trigger === Trigger.HOVER ? _this3.constructor.Event.MOUSEENTER : _this3.constructor.Event.FOCUSIN;
var eventOut = trigger === Trigger.HOVER ? _this3.constructor.Event.MOUSELEAVE : _this3.constructor.Event.FOCUSOUT;
$(_this3.element).on(eventIn, _this3.config.selector, $.proxy(_this3._enter, _this3)).on(eventOut, _this3.config.selector, $.proxy(_this3._leave, _this3));
}
});
if (this.config.selector) {
this.config = $.extend({}, this.config, {
trigger: 'manual',
selector: ''
});
} else {
this._fixTitle();
}
}
}, {
key: '_fixTitle',
value: function _fixTitle() {
var titleType = babelHelpers.typeof(this.element.getAttribute('data-original-title'));
if (this.element.getAttribute('title') || titleType !== 'string') {
this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
this.element.setAttribute('title', '');
}
}
}, {
key: '_enter',
value: function _enter(event, context) {
var dataKey = this.constructor.DATA_KEY;
context = context || $(event.currentTarget).data(dataKey);
if (!context) {
context = new this.constructor(event.currentTarget, this._getDelegateConfig());
$(event.currentTarget).data(dataKey, context);
}
if (event) {
context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true;
}
if ($(context.getTipElement()).hasClass(ClassName.IN) || context._hoverState === HoverState.IN) {
context._hoverState = HoverState.IN;
return;
}
clearTimeout(context._timeout);
context._hoverState = HoverState.IN;
if (!context.config.delay || !context.config.delay.show) {
context.show();
return;
}
context._timeout = setTimeout(function () {
if (context._hoverState === HoverState.IN) {
context.show();
}
}, context.config.delay.show);
}
}, {
key: '_leave',
value: function _leave(event, context) {
var dataKey = this.constructor.DATA_KEY;
context = context || $(event.currentTarget).data(dataKey);
if (!context) {
context = new this.constructor(event.currentTarget, this._getDelegateConfig());
$(event.currentTarget).data(dataKey, context);
}
if (event) {
context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false;
}
if (context._isWithActiveTrigger()) {
return;
}
clearTimeout(context._timeout);
context._hoverState = HoverState.OUT;
if (!context.config.delay || !context.config.delay.hide) {
context.hide();
return;
}
context._timeout = setTimeout(function () {
if (context._hoverState === HoverState.OUT) {
context.hide();
}
}, context.config.delay.hide);
}
}, {
key: '_isWithActiveTrigger',
value: function _isWithActiveTrigger() {
for (var trigger in this._activeTrigger) {
if (this._activeTrigger[trigger]) {
return true;
}
}
return false;
}
}, {
key: '_getConfig',
value: function _getConfig(config) {
config = $.extend({}, this.constructor.Default, $(this.element).data(), config);
if (config.delay && typeof config.delay === 'number') {
config.delay = {
show: config.delay,
hide: config.delay
};
}
_Util['default'].typeCheckConfig(NAME, config, this.constructor.DefaultType);
return config;
}
}, {
key: '_getDelegateConfig',
value: function _getDelegateConfig() {
var config = {};
if (this.config) {
for (var key in this.config) {
if (this.constructor.Default[key] !== this.config[key]) {
config[key] = this.config[key];
}
}
}
return config;
}
// static
}], [{
key: '_jQueryInterface',
value: function _jQueryInterface(config) {
return this.each(function () {
var data = $(this).data(DATA_KEY);
var _config = (typeof config === 'undefined' ? 'undefined' : babelHelpers.typeof(config)) === 'object' ? config : null;
if (!data && /destroy|hide/.test(config)) {
return;
}
if (!data) {
data = new Tooltip(this, _config);
$(this).data(DATA_KEY, data);
}
if (typeof config === 'string') {
if (data[config] === undefined) {
throw new Error('No method named "' + config + '"');
}
data[config]();
}
});
}
}, {
key: 'VERSION',
get: function get() {
return VERSION;
}
}, {
key: 'Default',
get: function get() {
return Default;
}
}, {
key: 'NAME',
get: function get() {
return NAME;
}
}, {
key: 'DATA_KEY',
get: function get() {
return DATA_KEY;
}
}, {
key: 'Event',
get: function get() {
return Event;
}
}, {
key: 'EVENT_KEY',
get: function get() {
return EVENT_KEY;
}
}, {
key: 'DefaultType',
get: function get() {
return DefaultType;
}
}]);
return Tooltip;
}();
$.fn[NAME] = Tooltip._jQueryInterface;
$.fn[NAME].Constructor = Tooltip;
$.fn[NAME].noConflict = function () {
$.fn[NAME] = JQUERY_NO_CONFLICT;
return Tooltip._jQueryInterface;
};
return Tooltip;
}(jQuery);
module.exports = Tooltip;
});
});
var require$$0 = tooltip && (typeof tooltip === 'undefined' ? 'undefined' : babelHelpers.typeof(tooltip)) === 'object' && 'default' in tooltip ? tooltip['default'] : tooltip;
var popover = __commonjs(function (module, exports, global) {
(function (global, factory) {
if (typeof define === 'function' && define.amd) {
define(['exports', 'module', './tooltip'], factory);
} else if (typeof exports !== 'undefined' && typeof module !== 'undefined') {
factory(exports, module, require$$0);
} else {
var mod = {
exports: {}
};
factory(mod.exports, mod, global.Tooltip);
global.popover = mod.exports;
}
})(__commonjs_global, function (exports, module, _tooltip) {
'use strict';
var _createClass = function () {
function defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ('value' in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);
}
}return function (Constructor, protoProps, staticProps) {
if (protoProps) defineProperties(Constructor.prototype, protoProps);if (staticProps) defineProperties(Constructor, staticProps);return Constructor;
};
}();
var _get = function get(_x, _x2, _x3) {
var _again = true;_function: while (_again) {
var object = _x,
property = _x2,
receiver = _x3;_again = false;if (object === null) object = Function.prototype;var desc = Object.getOwnPropertyDescriptor(object, property);if (desc === undefined) {
var parent = Object.getPrototypeOf(object);if (parent === null) {
return undefined;
} else {
_x = parent;_x2 = property;_x3 = receiver;_again = true;desc = parent = undefined;continue _function;
}
} else if ('value' in desc) {
return desc.value;
} else {
var getter = desc.get;if (getter === undefined) {
return undefined;
}return getter.call(receiver);
}
}
};
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { 'default': obj };
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError('Cannot call a class as a function');
}
}
function _inherits(subClass, superClass) {
if (typeof superClass !== 'function' && superClass !== null) {
throw new TypeError('Super expression must either be null or a function, not ' + (typeof superClass === 'undefined' ? 'undefined' : babelHelpers.typeof(superClass)));
}subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
}
var _Tooltip2 = _interopRequireDefault(_tooltip);
/**
* --------------------------------------------------------------------------
* Bootstrap (v4.0.0-alpha.2): popover.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
var Popover = function ($) {
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var NAME = 'popover';
var VERSION = '4.0.0-alpha.2';
var DATA_KEY = 'bs.popover';
var EVENT_KEY = '.' + DATA_KEY;
var JQUERY_NO_CONFLICT = $.fn[NAME];
var Default = $.extend({}, _Tooltip2['default'].Default, {
placement: 'right',
trigger: 'click',
content: '',
template: '<div class="popover" role="tooltip">' + '<div class="popover-arrow"></div>' + '<h3 class="popover-title"></h3>' + '<div class="popover-content"></div></div>'
});
var DefaultType = $.extend({}, _Tooltip2['default'].DefaultType, {
content: '(string|element|function)'
});
var ClassName = {
FADE: 'fade',
IN: 'in'
};
var Selector = {
TITLE: '.popover-title',
CONTENT: '.popover-content',
ARROW: '.popover-arrow'
};
var Event = {
HIDE: 'hide' + EVENT_KEY,
HIDDEN: 'hidden' + EVENT_KEY,
SHOW: 'show' + EVENT_KEY,
SHOWN: 'shown' + EVENT_KEY,
INSERTED: 'inserted' + EVENT_KEY,
CLICK: 'click' + EVENT_KEY,
FOCUSIN: 'focusin' + EVENT_KEY,
FOCUSOUT: 'focusout' + EVENT_KEY,
MOUSEENTER: 'mouseenter' + EVENT_KEY,
MOUSELEAVE: 'mouseleave' + EVENT_KEY
};
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
var Popover = function (_Tooltip) {
_inherits(Popover, _Tooltip);
function Popover() {
_classCallCheck(this, Popover);
_get(Object.getPrototypeOf(Popover.prototype), 'constructor', this).apply(this, arguments);
}
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
_createClass(Popover, [{
key: 'isWithContent',
// overrides
value: function isWithContent() {
return this.getTitle() || this._getContent();
}
}, {
key: 'getTipElement',
value: function getTipElement() {
return this.tip = this.tip || $(this.config.template)[0];
}
}, {
key: 'setContent',
value: function setContent() {
var $tip = $(this.getTipElement());
// we use append for html objects to maintain js events
this.setElementContent($tip.find(Selector.TITLE), this.getTitle());
this.setElementContent($tip.find(Selector.CONTENT), this._getContent());
$tip.removeClass(ClassName.FADE).removeClass(ClassName.IN);
this.cleanupTether();
}
// private
}, {
key: '_getContent',
value: function _getContent() {
return this.element.getAttribute('data-content') || (typeof this.config.content === 'function' ? this.config.content.call(this.element) : this.config.content);
}
// static
}], [{
key: '_jQueryInterface',
value: function _jQueryInterface(config) {
return this.each(function () {
var data = $(this).data(DATA_KEY);
var _config = (typeof config === 'undefined' ? 'undefined' : babelHelpers.typeof(config)) === 'object' ? config : null;
if (!data && /destroy|hide/.test(config)) {
return;
}
if (!data) {
data = new Popover(this, _config);
$(this).data(DATA_KEY, data);
}
if (typeof config === 'string') {
if (data[config] === undefined) {
throw new Error('No method named "' + config + '"');
}
data[config]();
}
});
}
}, {
key: 'VERSION',
// getters
get: function get() {
return VERSION;
}
}, {
key: 'Default',
get: function get() {
return Default;
}
}, {
key: 'NAME',
get: function get() {
return NAME;
}
}, {
key: 'DATA_KEY',
get: function get() {
return DATA_KEY;
}
}, {
key: 'Event',
get: function get() {
return Event;
}
}, {
key: 'EVENT_KEY',
get: function get() {
return EVENT_KEY;
}
}, {
key: 'DefaultType',
get: function get() {
return DefaultType;
}
}]);
return Popover;
}(_Tooltip2['default']);
$.fn[NAME] = Popover._jQueryInterface;
$.fn[NAME].Constructor = Popover;
$.fn[NAME].noConflict = function () {
$.fn[NAME] = JQUERY_NO_CONFLICT;
return Popover._jQueryInterface;
};
return Popover;
}(jQuery);
module.exports = Popover;
});
});
popover && (typeof popover === 'undefined' ? 'undefined' : babelHelpers.typeof(popover)) === 'object' && 'default' in popover ? popover['default'] : popover;
var tab = __commonjs(function (module, exports, global) {
(function (global, factory) {
if (typeof define === 'function' && define.amd) {
define(['exports', 'module', './util'], factory);
} else if (typeof exports !== 'undefined' && typeof module !== 'undefined') {
factory(exports, module, require$$0$1);
} else {
var mod = {
exports: {}
};
factory(mod.exports, mod, global.Util);
global.tab = mod.exports;
}
})(__commonjs_global, function (exports, module, _util) {
'use strict';
var _createClass = function () {
function defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ('value' in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);
}
}return function (Constructor, protoProps, staticProps) {
if (protoProps) defineProperties(Constructor.prototype, protoProps);if (staticProps) defineProperties(Constructor, staticProps);return Constructor;
};
}();
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { 'default': obj };
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError('Cannot call a class as a function');
}
}
var _Util = _interopRequireDefault(_util);
/**
* --------------------------------------------------------------------------
* Bootstrap (v4.0.0-alpha.2): tab.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
var Tab = function ($) {
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var NAME = 'tab';
var VERSION = '4.0.0-alpha.2';
var DATA_KEY = 'bs.tab';
var EVENT_KEY = '.' + DATA_KEY;
var DATA_API_KEY = '.data-api';
var JQUERY_NO_CONFLICT = $.fn[NAME];
var TRANSITION_DURATION = 150;
var Event = {
HIDE: 'hide' + EVENT_KEY,
HIDDEN: 'hidden' + EVENT_KEY,
SHOW: 'show' + EVENT_KEY,
SHOWN: 'shown' + EVENT_KEY,
CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY
};
var ClassName = {
DROPDOWN_MENU: 'dropdown-menu',
ACTIVE: 'active',
FADE: 'fade',
IN: 'in'
};
var Selector = {
A: 'a',
LI: 'li',
DROPDOWN: '.dropdown',
UL: 'ul:not(.dropdown-menu)',
FADE_CHILD: '> .nav-item .fade, > .fade',
ACTIVE: '.active',
ACTIVE_CHILD: '> .nav-item > .active, > .active',
DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"]',
DROPDOWN_TOGGLE: '.dropdown-toggle',
DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .active'
};
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
var Tab = function () {
function Tab(element) {
_classCallCheck(this, Tab);
this._element = element;
}
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
// getters
_createClass(Tab, [{
key: 'show',
// public
value: function show() {
var _this = this;
if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName.ACTIVE)) {
return;
}
var target = undefined;
var previous = undefined;
var ulElement = $(this._element).closest(Selector.UL)[0];
var selector = _Util['default'].getSelectorFromElement(this._element);
if (ulElement) {
previous = $.makeArray($(ulElement).find(Selector.ACTIVE));
previous = previous[previous.length - 1];
}
var hideEvent = $.Event(Event.HIDE, {
relatedTarget: this._element
});
var showEvent = $.Event(Event.SHOW, {
relatedTarget: previous
});
if (previous) {
$(previous).trigger(hideEvent);
}
$(this._element).trigger(showEvent);
if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) {
return;
}
if (selector) {
target = $(selector)[0];
}
this._activate(this._element, ulElement);
var complete = function complete() {
var hiddenEvent = $.Event(Event.HIDDEN, {
relatedTarget: _this._element
});
var shownEvent = $.Event(Event.SHOWN, {
relatedTarget: previous
});
$(previous).trigger(hiddenEvent);
$(_this._element).trigger(shownEvent);
};
if (target) {
this._activate(target, target.parentNode, complete);
} else {
complete();
}
}
}, {
key: 'dispose',
value: function dispose() {
$.removeClass(this._element, DATA_KEY);
this._element = null;
}
// private
}, {
key: '_activate',
value: function _activate(element, container, callback) {
var active = $(container).find(Selector.ACTIVE_CHILD)[0];
var isTransitioning = callback && _Util['default'].supportsTransitionEnd() && (active && $(active).hasClass(ClassName.FADE) || Boolean($(container).find(Selector.FADE_CHILD)[0]));
var complete = $.proxy(this._transitionComplete, this, element, active, isTransitioning, callback);
if (active && isTransitioning) {
$(active).one(_Util['default'].TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION);
} else {
complete();
}
if (active) {
$(active).removeClass(ClassName.IN);
}
}
}, {
key: '_transitionComplete',
value: function _transitionComplete(element, active, isTransitioning, callback) {
if (active) {
$(active).removeClass(ClassName.ACTIVE);
var dropdownChild = $(active).find(Selector.DROPDOWN_ACTIVE_CHILD)[0];
if (dropdownChild) {
$(dropdownChild).removeClass(ClassName.ACTIVE);
}
active.setAttribute('aria-expanded', false);
}
$(element).addClass(ClassName.ACTIVE);
element.setAttribute('aria-expanded', true);
if (isTransitioning) {
_Util['default'].reflow(element);
$(element).addClass(ClassName.IN);
} else {
$(element).removeClass(ClassName.FADE);
}
if (element.parentNode && $(element.parentNode).hasClass(ClassName.DROPDOWN_MENU)) {
var dropdownElement = $(element).closest(Selector.DROPDOWN)[0];
if (dropdownElement) {
$(dropdownElement).find(Selector.DROPDOWN_TOGGLE).addClass(ClassName.ACTIVE);
}
element.setAttribute('aria-expanded', true);
}
if (callback) {
callback();
}
}
// static
}], [{
key: '_jQueryInterface',
value: function _jQueryInterface(config) {
return this.each(function () {
var $this = $(this);
var data = $this.data(DATA_KEY);
if (!data) {
data = data = new Tab(this);
$this.data(DATA_KEY, data);
}
if (typeof config === 'string') {
if (data[config] === undefined) {
throw new Error('No method named "' + config + '"');
}
data[config]();
}
});
}
}, {
key: 'VERSION',
get: function get() {
return VERSION;
}
}]);
return Tab;
}();
$(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
event.preventDefault();
Tab._jQueryInterface.call($(this), 'show');
});
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
$.fn[NAME] = Tab._jQueryInterface;
$.fn[NAME].Constructor = Tab;
$.fn[NAME].noConflict = function () {
$.fn[NAME] = JQUERY_NO_CONFLICT;
return Tab._jQueryInterface;
};
return Tab;
}(jQuery);
module.exports = Tab;
});
});
tab && (typeof tab === 'undefined' ? 'undefined' : babelHelpers.typeof(tab)) === 'object' && 'default' in tab ? tab['default'] : tab;
var scrollspy = __commonjs(function (module, exports, global) {
(function (global, factory) {
if (typeof define === 'function' && define.amd) {
define(['exports', 'module', './util'], factory);
} else if (typeof exports !== 'undefined' && typeof module !== 'undefined') {
factory(exports, module, require$$0$1);
} else {
var mod = {
exports: {}
};
factory(mod.exports, mod, global.Util);
global.scrollspy = mod.exports;
}
})(__commonjs_global, function (exports, module, _util) {
'use strict';
var _createClass = function () {
function defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ('value' in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);
}
}return function (Constructor, protoProps, staticProps) {
if (protoProps) defineProperties(Constructor.prototype, protoProps);if (staticProps) defineProperties(Constructor, staticProps);return Constructor;
};
}();
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { 'default': obj };
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError('Cannot call a class as a function');
}
}
var _Util = _interopRequireDefault(_util);
/**
* --------------------------------------------------------------------------
* Bootstrap (v4.0.0-alpha.2): scrollspy.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
var ScrollSpy = function ($) {
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var NAME = 'scrollspy';
var VERSION = '4.0.0-alpha.2';
var DATA_KEY = 'bs.scrollspy';
var EVENT_KEY = '.' + DATA_KEY;
var DATA_API_KEY = '.data-api';
var JQUERY_NO_CONFLICT = $.fn[NAME];
var Default = {
offset: 10,
method: 'auto',
target: ''
};
var DefaultType = {
offset: 'number',
method: 'string',
target: '(string|element)'
};
var Event = {
ACTIVATE: 'activate' + EVENT_KEY,
SCROLL: 'scroll' + EVENT_KEY,
LOAD_DATA_API: 'load' + EVENT_KEY + DATA_API_KEY
};
var ClassName = {
DROPDOWN_ITEM: 'dropdown-item',
DROPDOWN_MENU: 'dropdown-menu',
NAV_LINK: 'nav-link',
NAV: 'nav',
ACTIVE: 'active'
};
var Selector = {
DATA_SPY: '[data-spy="scroll"]',
ACTIVE: '.active',
LIST_ITEM: '.list-item',
LI: 'li',
LI_DROPDOWN: 'li.dropdown',
NAV_LINKS: '.nav-link',
DROPDOWN: '.dropdown',
DROPDOWN_ITEMS: '.dropdown-item',
DROPDOWN_TOGGLE: '.dropdown-toggle'
};
var OffsetMethod = {
OFFSET: 'offset',
POSITION: 'position'
};
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
var ScrollSpy = function () {
function ScrollSpy(element, config) {
_classCallCheck(this, ScrollSpy);
this._element = element;
this._scrollElement = element.tagName === 'BODY' ? window : element;
this._config = this._getConfig(config);
this._selector = this._config.target + ' ' + Selector.NAV_LINKS + ',' + (this._config.target + ' ' + Selector.DROPDOWN_ITEMS);
this._offsets = [];
this._targets = [];
this._activeTarget = null;
this._scrollHeight = 0;
$(this._scrollElement).on(Event.SCROLL, $.proxy(this._process, this));
this.refresh();
this._process();
}
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
// getters
_createClass(ScrollSpy, [{
key: 'refresh',
// public
value: function refresh() {
var _this = this;
var autoMethod = this._scrollElement !== this._scrollElement.window ? OffsetMethod.POSITION : OffsetMethod.OFFSET;
var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0;
this._offsets = [];
this._targets = [];
this._scrollHeight = this._getScrollHeight();
var targets = $.makeArray($(this._selector));
targets.map(function (element) {
var target = undefined;
var targetSelector = _Util['default'].getSelectorFromElement(element);
if (targetSelector) {
target = $(targetSelector)[0];
}
if (target && (target.offsetWidth || target.offsetHeight)) {
// todo (fat): remove sketch reliance on jQuery position/offset
return [$(target)[offsetMethod]().top + offsetBase, targetSelector];
}
}).filter(function (item) {
return item;
}).sort(function (a, b) {
return a[0] - b[0];
}).forEach(function (item) {
_this._offsets.push(item[0]);
_this._targets.push(item[1]);
});
}
}, {
key: 'dispose',
value: function dispose() {
$.removeData(this._element, DATA_KEY);
$(this._scrollElement).off(EVENT_KEY);
this._element = null;
this._scrollElement = null;
this._config = null;
this._selector = null;
this._offsets = null;
this._targets = null;
this._activeTarget = null;
this._scrollHeight = null;
}
// private
}, {
key: '_getConfig',
value: function _getConfig(config) {
config = $.extend({}, Default, config);
if (typeof config.target !== 'string') {
var id = $(config.target).attr('id');
if (!id) {
id = _Util['default'].getUID(NAME);
$(config.target).attr('id', id);
}
config.target = '#' + id;
}
_Util['default'].typeCheckConfig(NAME, config, DefaultType);
return config;
}
}, {
key: '_getScrollTop',
value: function _getScrollTop() {
return this._scrollElement === window ? this._scrollElement.scrollY : this._scrollElement.scrollTop;
}
}, {
key: '_getScrollHeight',
value: function _getScrollHeight() {
return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
}
}, {
key: '_process',
value: function _process() {
var scrollTop = this._getScrollTop() + this._config.offset;
var scrollHeight = this._getScrollHeight();
var maxScroll = this._config.offset + scrollHeight - this._scrollElement.offsetHeight;
if (this._scrollHeight !== scrollHeight) {
this.refresh();
}
if (scrollTop >= maxScroll) {
var target = this._targets[this._targets.length - 1];
if (this._activeTarget !== target) {
this._activate(target);
}
}
if (this._activeTarget && scrollTop < this._offsets[0]) {
this._activeTarget = null;
this._clear();
return;
}
for (var i = this._offsets.length; i--;) {
var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (this._offsets[i + 1] === undefined || scrollTop < this._offsets[i + 1]);
if (isActiveTarget) {
this._activate(this._targets[i]);
}
}
}
}, {
key: '_activate',
value: function _activate(target) {
this._activeTarget = target;
this._clear();
var queries = this._selector.split(',');
queries = queries.map(function (selector) {
return selector + '[data-target="' + target + '"],' + (selector + '[href="' + target + '"]');
});
var $link = $(queries.join(','));
if ($link.hasClass(ClassName.DROPDOWN_ITEM)) {
$link.closest(Selector.DROPDOWN).find(Selector.DROPDOWN_TOGGLE).addClass(ClassName.ACTIVE);
$link.addClass(ClassName.ACTIVE);
} else {
// todo (fat) this is kinda sus...
// recursively add actives to tested nav-links
$link.parents(Selector.LI).find(Selector.NAV_LINKS).addClass(ClassName.ACTIVE);
}
$(this._scrollElement).trigger(Event.ACTIVATE, {
relatedTarget: target
});
}
}, {
key: '_clear',
value: function _clear() {
$(this._selector).filter(Selector.ACTIVE).removeClass(ClassName.ACTIVE);
}
// static
}], [{
key: '_jQueryInterface',
value: function _jQueryInterface(config) {
return this.each(function () {
var data = $(this).data(DATA_KEY);
var _config = (typeof config === 'undefined' ? 'undefined' : babelHelpers.typeof(config)) === 'object' && config || null;
if (!data) {
data = new ScrollSpy(this, _config);
$(this).data(DATA_KEY, data);
}
if (typeof config === 'string') {
if (data[config] === undefined) {
throw new Error('No method named "' + config + '"');
}
data[config]();
}
});
}
}, {
key: 'VERSION',
get: function get() {
return VERSION;
}
}, {
key: 'Default',
get: function get() {
return Default;
}
}]);
return ScrollSpy;
}();
$(window).on(Event.LOAD_DATA_API, function () {
var scrollSpys = $.makeArray($(Selector.DATA_SPY));
for (var i = scrollSpys.length; i--;) {
var $spy = $(scrollSpys[i]);
ScrollSpy._jQueryInterface.call($spy, $spy.data());
}
});
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
$.fn[NAME] = ScrollSpy._jQueryInterface;
$.fn[NAME].Constructor = ScrollSpy;
$.fn[NAME].noConflict = function () {
$.fn[NAME] = JQUERY_NO_CONFLICT;
return ScrollSpy._jQueryInterface;
};
return ScrollSpy;
}(jQuery);
module.exports = ScrollSpy;
});
});
scrollspy && (typeof scrollspy === 'undefined' ? 'undefined' : babelHelpers.typeof(scrollspy)) === 'object' && 'default' in scrollspy ? scrollspy['default'] : scrollspy;
var modal = __commonjs(function (module, exports, global) {
(function (global, factory) {
if (typeof define === 'function' && define.amd) {
define(['exports', 'module', './util'], factory);
} else if (typeof exports !== 'undefined' && typeof module !== 'undefined') {
factory(exports, module, require$$0$1);
} else {
var mod = {
exports: {}
};
factory(mod.exports, mod, global.Util);
global.modal = mod.exports;
}
})(__commonjs_global, function (exports, module, _util) {
'use strict';
var _createClass = function () {
function defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ('value' in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);
}
}return function (Constructor, protoProps, staticProps) {
if (protoProps) defineProperties(Constructor.prototype, protoProps);if (staticProps) defineProperties(Constructor, staticProps);return Constructor;
};
}();
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { 'default': obj };
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError('Cannot call a class as a function');
}
}
var _Util = _interopRequireDefault(_util);
/**
* --------------------------------------------------------------------------
* Bootstrap (v4.0.0-alpha.2): modal.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
var Modal = function ($) {
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var NAME = 'modal';
var VERSION = '4.0.0-alpha.2';
var DATA_KEY = 'bs.modal';
var EVENT_KEY = '.' + DATA_KEY;
var DATA_API_KEY = '.data-api';
var JQUERY_NO_CONFLICT = $.fn[NAME];
var TRANSITION_DURATION = 300;
var BACKDROP_TRANSITION_DURATION = 150;
var Default = {
backdrop: true,
keyboard: true,
focus: true,
show: true
};
var DefaultType = {
backdrop: '(boolean|string)',
keyboard: 'boolean',
focus: 'boolean',
show: 'boolean'
};
var Event = {
HIDE: 'hide' + EVENT_KEY,
HIDDEN: 'hidden' + EVENT_KEY,
SHOW: 'show' + EVENT_KEY,
SHOWN: 'shown' + EVENT_KEY,
FOCUSIN: 'focusin' + EVENT_KEY,
RESIZE: 'resize' + EVENT_KEY,
CLICK_DISMISS: 'click.dismiss' + EVENT_KEY,
KEYDOWN_DISMISS: 'keydown.dismiss' + EVENT_KEY,
MOUSEUP_DISMISS: 'mouseup.dismiss' + EVENT_KEY,
MOUSEDOWN_DISMISS: 'mousedown.dismiss' + EVENT_KEY,
CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY
};
var ClassName = {
SCROLLBAR_MEASURER: 'modal-scrollbar-measure',
BACKDROP: 'modal-backdrop',
OPEN: 'modal-open',
FADE: 'fade',
IN: 'in'
};
var Selector = {
DIALOG: '.modal-dialog',
DATA_TOGGLE: '[data-toggle="modal"]',
DATA_DISMISS: '[data-dismiss="modal"]',
FIXED_CONTENT: '.navbar-fixed-top, .navbar-fixed-bottom, .is-fixed'
};
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
var Modal = function () {
function Modal(element, config) {
_classCallCheck(this, Modal);
this._config = this._getConfig(config);
this._element = element;
this._dialog = $(element).find(Selector.DIALOG)[0];
this._backdrop = null;
this._isShown = false;
this._isBodyOverflowing = false;
this._ignoreBackdropClick = false;
this._originalBodyPadding = 0;
this._scrollbarWidth = 0;
}
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
// getters
_createClass(Modal, [{
key: 'toggle',
// public
value: function toggle(relatedTarget) {
return this._isShown ? this.hide() : this.show(relatedTarget);
}
}, {
key: 'show',
value: function show(relatedTarget) {
var _this = this;
var showEvent = $.Event(Event.SHOW, {
relatedTarget: relatedTarget
});
$(this._element).trigger(showEvent);
if (this._isShown || showEvent.isDefaultPrevented()) {
return;
}
this._isShown = true;
this._checkScrollbar();
this._setScrollbar();
$(document.body).addClass(ClassName.OPEN);
this._setEscapeEvent();
this._setResizeEvent();
$(this._element).on(Event.CLICK_DISMISS, Selector.DATA_DISMISS, $.proxy(this.hide, this));
$(this._dialog).on(Event.MOUSEDOWN_DISMISS, function () {
$(_this._element).one(Event.MOUSEUP_DISMISS, function (event) {
if ($(event.target).is(_this._element)) {
_this._ignoreBackdropClick = true;
}
});
});
this._showBackdrop($.proxy(this._showElement, this, relatedTarget));
}
}, {
key: 'hide',
value: function hide(event) {
if (event) {
event.preventDefault();
}
var hideEvent = $.Event(Event.HIDE);
$(this._element).trigger(hideEvent);
if (!this._isShown || hideEvent.isDefaultPrevented()) {
return;
}
this._isShown = false;
this._setEscapeEvent();
this._setResizeEvent();
$(document).off(Event.FOCUSIN);
$(this._element).removeClass(ClassName.IN);
$(this._element).off(Event.CLICK_DISMISS);
$(this._dialog).off(Event.MOUSEDOWN_DISMISS);
if (_Util['default'].supportsTransitionEnd() && $(this._element).hasClass(ClassName.FADE)) {
$(this._element).one(_Util['default'].TRANSITION_END, $.proxy(this._hideModal, this)).emulateTransitionEnd(TRANSITION_DURATION);
} else {
this._hideModal();
}
}
}, {
key: 'dispose',
value: function dispose() {
$.removeData(this._element, DATA_KEY);
$(window).off(EVENT_KEY);
$(document).off(EVENT_KEY);
$(this._element).off(EVENT_KEY);
$(this._backdrop).off(EVENT_KEY);
this._config = null;
this._element = null;
this._dialog = null;
this._backdrop = null;
this._isShown = null;
this._isBodyOverflowing = null;
this._ignoreBackdropClick = null;
this._originalBodyPadding = null;
this._scrollbarWidth = null;
}
// private
}, {
key: '_getConfig',
value: function _getConfig(config) {
config = $.extend({}, Default, config);
_Util['default'].typeCheckConfig(NAME, config, DefaultType);
return config;
}
}, {
key: '_showElement',
value: function _showElement(relatedTarget) {
var _this2 = this;
var transition = _Util['default'].supportsTransitionEnd() && $(this._element).hasClass(ClassName.FADE);
if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
// don't move modals dom position
document.body.appendChild(this._element);
}
this._element.style.display = 'block';
this._element.scrollTop = 0;
if (transition) {
_Util['default'].reflow(this._element);
}
$(this._element).addClass(ClassName.IN);
if (this._config.focus) {
this._enforceFocus();
}
var shownEvent = $.Event(Event.SHOWN, {
relatedTarget: relatedTarget
});
var transitionComplete = function transitionComplete() {
if (_this2._config.focus) {
_this2._element.focus();
}
$(_this2._element).trigger(shownEvent);
};
if (transition) {
$(this._dialog).one(_Util['default'].TRANSITION_END, transitionComplete).emulateTransitionEnd(TRANSITION_DURATION);
} else {
transitionComplete();
}
}
}, {
key: '_enforceFocus',
value: function _enforceFocus() {
var _this3 = this;
$(document).off(Event.FOCUSIN) // guard against infinite focus loop
.on(Event.FOCUSIN, function (event) {
if (document !== event.target && _this3._element !== event.target && !$(_this3._element).has(event.target).length) {
_this3._element.focus();
}
});
}
}, {
key: '_setEscapeEvent',
value: function _setEscapeEvent() {
var _this4 = this;
if (this._isShown && this._config.keyboard) {
$(this._element).on(Event.KEYDOWN_DISMISS, function (event) {
if (event.which === 27) {
_this4.hide();
}
});
} else if (!this._isShown) {
$(this._element).off(Event.KEYDOWN_DISMISS);
}
}
}, {
key: '_setResizeEvent',
value: function _setResizeEvent() {
if (this._isShown) {
$(window).on(Event.RESIZE, $.proxy(this._handleUpdate, this));
} else {
$(window).off(Event.RESIZE);
}
}
}, {
key: '_hideModal',
value: function _hideModal() {
var _this5 = this;
this._element.style.display = 'none';
this._showBackdrop(function () {
$(document.body).removeClass(ClassName.OPEN);
_this5._resetAdjustments();
_this5._resetScrollbar();
$(_this5._element).trigger(Event.HIDDEN);
});
}
}, {
key: '_removeBackdrop',
value: function _removeBackdrop() {
if (this._backdrop) {
$(this._backdrop).remove();
this._backdrop = null;
}
}
}, {
key: '_showBackdrop',
value: function _showBackdrop(callback) {
var _this6 = this;
var animate = $(this._element).hasClass(ClassName.FADE) ? ClassName.FADE : '';
if (this._isShown && this._config.backdrop) {
var doAnimate = _Util['default'].supportsTransitionEnd() && animate;
this._backdrop = document.createElement('div');
this._backdrop.className = ClassName.BACKDROP;
if (animate) {
$(this._backdrop).addClass(animate);
}
$(this._backdrop).appendTo(document.body);
$(this._element).on(Event.CLICK_DISMISS, function (event) {
if (_this6._ignoreBackdropClick) {
_this6._ignoreBackdropClick = false;
return;
}
if (event.target !== event.currentTarget) {
return;
}
if (_this6._config.backdrop === 'static') {
_this6._element.focus();
} else {
_this6.hide();
}
});
if (doAnimate) {
_Util['default'].reflow(this._backdrop);
}
$(this._backdrop).addClass(ClassName.IN);
if (!callback) {
return;
}
if (!doAnimate) {
callback();
return;
}
$(this._backdrop).one(_Util['default'].TRANSITION_END, callback).emulateTransitionEnd(BACKDROP_TRANSITION_DURATION);
} else if (!this._isShown && this._backdrop) {
$(this._backdrop).removeClass(ClassName.IN);
var callbackRemove = function callbackRemove() {
_this6._removeBackdrop();
if (callback) {
callback();
}
};
if (_Util['default'].supportsTransitionEnd() && $(this._element).hasClass(ClassName.FADE)) {
$(this._backdrop).one(_Util['default'].TRANSITION_END, callbackRemove).emulateTransitionEnd(BACKDROP_TRANSITION_DURATION);
} else {
callbackRemove();
}
} else if (callback) {
callback();
}
}
// ----------------------------------------------------------------------
// the following methods are used to handle overflowing modals
// todo (fat): these should probably be refactored out of modal.js
// ----------------------------------------------------------------------
}, {
key: '_handleUpdate',
value: function _handleUpdate() {
this._adjustDialog();
}
}, {
key: '_adjustDialog',
value: function _adjustDialog() {
var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
if (!this._isBodyOverflowing && isModalOverflowing) {
this._element.style.paddingLeft = this._scrollbarWidth + 'px';
}
if (this._isBodyOverflowing && !isModalOverflowing) {
this._element.style.paddingRight = this._scrollbarWidth + 'px~';
}
}
}, {
key: '_resetAdjustments',
value: function _resetAdjustments() {
this._element.style.paddingLeft = '';
this._element.style.paddingRight = '';
}
}, {
key: '_checkScrollbar',
value: function _checkScrollbar() {
var fullWindowWidth = window.innerWidth;
if (!fullWindowWidth) {
// workaround for missing window.innerWidth in IE8
var documentElementRect = document.documentElement.getBoundingClientRect();
fullWindowWidth = documentElementRect.right - Math.abs(documentElementRect.left);
}
this._isBodyOverflowing = document.body.clientWidth < fullWindowWidth;
this._scrollbarWidth = this._getScrollbarWidth();
}
}, {
key: '_setScrollbar',
value: function _setScrollbar() {
var bodyPadding = parseInt($(Selector.FIXED_CONTENT).css('padding-right') || 0, 10);
this._originalBodyPadding = document.body.style.paddingRight || '';
if (this._isBodyOverflowing) {
document.body.style.paddingRight = bodyPadding + this._scrollbarWidth + 'px';
}
}
}, {
key: '_resetScrollbar',
value: function _resetScrollbar() {
document.body.style.paddingRight = this._originalBodyPadding;
}
}, {
key: '_getScrollbarWidth',
value: function _getScrollbarWidth() {
// thx d.walsh
var scrollDiv = document.createElement('div');
scrollDiv.className = ClassName.SCROLLBAR_MEASURER;
document.body.appendChild(scrollDiv);
var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth;
document.body.removeChild(scrollDiv);
return scrollbarWidth;
}
// static
}], [{
key: '_jQueryInterface',
value: function _jQueryInterface(config, relatedTarget) {
return this.each(function () {
var data = $(this).data(DATA_KEY);
var _config = $.extend({}, Modal.Default, $(this).data(), (typeof config === 'undefined' ? 'undefined' : babelHelpers.typeof(config)) === 'object' && config);
if (!data) {
data = new Modal(this, _config);
$(this).data(DATA_KEY, data);
}
if (typeof config === 'string') {
if (data[config] === undefined) {
throw new Error('No method named "' + config + '"');
}
data[config](relatedTarget);
} else if (_config.show) {
data.show(relatedTarget);
}
});
}
}, {
key: 'VERSION',
get: function get() {
return VERSION;
}
}, {
key: 'Default',
get: function get() {
return Default;
}
}]);
return Modal;
}();
$(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
var _this7 = this;
var target = undefined;
var selector = _Util['default'].getSelectorFromElement(this);
if (selector) {
target = $(selector)[0];
}
var config = $(target).data(DATA_KEY) ? 'toggle' : $.extend({}, $(target).data(), $(this).data());
if (this.tagName === 'A') {
event.preventDefault();
}
var $target = $(target).one(Event.SHOW, function (showEvent) {
if (showEvent.isDefaultPrevented()) {
// only register focus restorer if modal will actually get shown
return;
}
$target.one(Event.HIDDEN, function () {
if ($(_this7).is(':visible')) {
_this7.focus();
}
});
});
Modal._jQueryInterface.call($(target), config, this);
});
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
$.fn[NAME] = Modal._jQueryInterface;
$.fn[NAME].Constructor = Modal;
$.fn[NAME].noConflict = function () {
$.fn[NAME] = JQUERY_NO_CONFLICT;
return Modal._jQueryInterface;
};
return Modal;
}(jQuery);
module.exports = Modal;
});
});
modal && (typeof modal === 'undefined' ? 'undefined' : babelHelpers.typeof(modal)) === 'object' && 'default' in modal ? modal['default'] : modal;
var dropdown = __commonjs(function (module, exports, global) {
(function (global, factory) {
if (typeof define === 'function' && define.amd) {
define(['exports', 'module', './util'], factory);
} else if (typeof exports !== 'undefined' && typeof module !== 'undefined') {
factory(exports, module, require$$0$1);
} else {
var mod = {
exports: {}
};
factory(mod.exports, mod, global.Util);
global.dropdown = mod.exports;
}
})(__commonjs_global, function (exports, module, _util) {
'use strict';
var _createClass = function () {
function defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ('value' in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);
}
}return function (Constructor, protoProps, staticProps) {
if (protoProps) defineProperties(Constructor.prototype, protoProps);if (staticProps) defineProperties(Constructor, staticProps);return Constructor;
};
}();
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { 'default': obj };
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError('Cannot call a class as a function');
}
}
var _Util = _interopRequireDefault(_util);
/**
* --------------------------------------------------------------------------
* Bootstrap (v4.0.0-alpha.2): dropdown.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
var Dropdown = function ($) {
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var NAME = 'dropdown';
var VERSION = '4.0.0-alpha.2';
var DATA_KEY = 'bs.dropdown';
var EVENT_KEY = '.' + DATA_KEY;
var DATA_API_KEY = '.data-api';
var JQUERY_NO_CONFLICT = $.fn[NAME];
var Event = {
HIDE: 'hide' + EVENT_KEY,
HIDDEN: 'hidden' + EVENT_KEY,
SHOW: 'show' + EVENT_KEY,
SHOWN: 'shown' + EVENT_KEY,
CLICK: 'click' + EVENT_KEY,
CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY,
KEYDOWN_DATA_API: 'keydown' + EVENT_KEY + DATA_API_KEY
};
var ClassName = {
BACKDROP: 'dropdown-backdrop',
DISABLED: 'disabled',
OPEN: 'open'
};
var Selector = {
BACKDROP: '.dropdown-backdrop',
DATA_TOGGLE: '[data-toggle="dropdown"]',
FORM_CHILD: '.dropdown form',
ROLE_MENU: '[role="menu"]',
ROLE_LISTBOX: '[role="listbox"]',
NAVBAR_NAV: '.navbar-nav',
VISIBLE_ITEMS: '[role="menu"] li:not(.disabled) a, ' + '[role="listbox"] li:not(.disabled) a'
};
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
var Dropdown = function () {
function Dropdown(element) {
_classCallCheck(this, Dropdown);
this._element = element;
this._addEventListeners();
}
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
// getters
_createClass(Dropdown, [{
key: 'toggle',
// public
value: function toggle() {
if (this.disabled || $(this).hasClass(ClassName.DISABLED)) {
return false;
}
var parent = Dropdown._getParentFromElement(this);
var isActive = $(parent).hasClass(ClassName.OPEN);
Dropdown._clearMenus();
if (isActive) {
return false;
}
if ('ontouchstart' in document.documentElement && !$(parent).closest(Selector.NAVBAR_NAV).length) {
// if mobile we use a backdrop because click events don't delegate
var dropdown = document.createElement('div');
dropdown.className = ClassName.BACKDROP;
$(dropdown).insertBefore(this);
$(dropdown).on('click', Dropdown._clearMenus);
}
var relatedTarget = { relatedTarget: this };
var showEvent = $.Event(Event.SHOW, relatedTarget);
$(parent).trigger(showEvent);
if (showEvent.isDefaultPrevented()) {
return false;
}
this.focus();
this.setAttribute('aria-expanded', 'true');
$(parent).toggleClass(ClassName.OPEN);
$(parent).trigger($.Event(Event.SHOWN, relatedTarget));
return false;
}
}, {
key: 'dispose',
value: function dispose() {
$.removeData(this._element, DATA_KEY);
$(this._element).off(EVENT_KEY);
this._element = null;
}
// private
}, {
key: '_addEventListeners',
value: function _addEventListeners() {
$(this._element).on(Event.CLICK, this.toggle);
}
// static
}], [{
key: '_jQueryInterface',
value: function _jQueryInterface(config) {
return this.each(function () {
var data = $(this).data(DATA_KEY);
if (!data) {
$(this).data(DATA_KEY, data = new Dropdown(this));
}
if (typeof config === 'string') {
if (data[config] === undefined) {
throw new Error('No method named "' + config + '"');
}
data[config].call(this);
}
});
}
}, {
key: '_clearMenus',
value: function _clearMenus(event) {
if (event && event.which === 3) {
return;
}
var backdrop = $(Selector.BACKDROP)[0];
if (backdrop) {
backdrop.parentNode.removeChild(backdrop);
}
var toggles = $.makeArray($(Selector.DATA_TOGGLE));
for (var i = 0; i < toggles.length; i++) {
var _parent = Dropdown._getParentFromElement(toggles[i]);
var relatedTarget = { relatedTarget: toggles[i] };
if (!$(_parent).hasClass(ClassName.OPEN)) {
continue;
}
if (event && event.type === 'click' && /input|textarea/i.test(event.target.tagName) && $.contains(_parent, event.target)) {
continue;
}
var hideEvent = $.Event(Event.HIDE, relatedTarget);
$(_parent).trigger(hideEvent);
if (hideEvent.isDefaultPrevented()) {
continue;
}
toggles[i].setAttribute('aria-expanded', 'false');
$(_parent).removeClass(ClassName.OPEN).trigger($.Event(Event.HIDDEN, relatedTarget));
}
}
}, {
key: '_getParentFromElement',
value: function _getParentFromElement(element) {
var parent = undefined;
var selector = _Util['default'].getSelectorFromElement(element);
if (selector) {
parent = $(selector)[0];
}
return parent || element.parentNode;
}
}, {
key: '_dataApiKeydownHandler',
value: function _dataApiKeydownHandler(event) {
if (!/(38|40|27|32)/.test(event.which) || /input|textarea/i.test(event.target.tagName)) {
return;
}
event.preventDefault();
event.stopPropagation();
if (this.disabled || $(this).hasClass(ClassName.DISABLED)) {
return;
}
var parent = Dropdown._getParentFromElement(this);
var isActive = $(parent).hasClass(ClassName.OPEN);
if (!isActive && event.which !== 27 || isActive && event.which === 27) {
if (event.which === 27) {
var toggle = $(parent).find(Selector.DATA_TOGGLE)[0];
$(toggle).trigger('focus');
}
$(this).trigger('click');
return;
}
var items = $.makeArray($(Selector.VISIBLE_ITEMS));
items = items.filter(function (item) {
return item.offsetWidth || item.offsetHeight;
});
if (!items.length) {
return;
}
var index = items.indexOf(event.target);
if (event.which === 38 && index > 0) {
// up
index--;
}
if (event.which === 40 && index < items.length - 1) {
// down
index++;
}
if (index < 0) {
index = 0;
}
items[index].focus();
}
}, {
key: 'VERSION',
get: function get() {
return VERSION;
}
}]);
return Dropdown;
}();
$(document).on(Event.KEYDOWN_DATA_API, Selector.DATA_TOGGLE, Dropdown._dataApiKeydownHandler).on(Event.KEYDOWN_DATA_API, Selector.ROLE_MENU, Dropdown._dataApiKeydownHandler).on(Event.KEYDOWN_DATA_API, Selector.ROLE_LISTBOX, Dropdown._dataApiKeydownHandler).on(Event.CLICK_DATA_API, Dropdown._clearMenus).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, Dropdown.prototype.toggle).on(Event.CLICK_DATA_API, Selector.FORM_CHILD, function (e) {
e.stopPropagation();
});
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
$.fn[NAME] = Dropdown._jQueryInterface;
$.fn[NAME].Constructor = Dropdown;
$.fn[NAME].noConflict = function () {
$.fn[NAME] = JQUERY_NO_CONFLICT;
return Dropdown._jQueryInterface;
};
return Dropdown;
}(jQuery);
module.exports = Dropdown;
});
});
dropdown && (typeof dropdown === 'undefined' ? 'undefined' : babelHelpers.typeof(dropdown)) === 'object' && 'default' in dropdown ? dropdown['default'] : dropdown;
var collapse = __commonjs(function (module, exports, global) {
(function (global, factory) {
if (typeof define === 'function' && define.amd) {
define(['exports', 'module', './util'], factory);
} else if (typeof exports !== 'undefined' && typeof module !== 'undefined') {
factory(exports, module, require$$0$1);
} else {
var mod = {
exports: {}
};
factory(mod.exports, mod, global.Util);
global.collapse = mod.exports;
}
})(__commonjs_global, function (exports, module, _util) {
'use strict';
var _createClass = function () {
function defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ('value' in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);
}
}return function (Constructor, protoProps, staticProps) {
if (protoProps) defineProperties(Constructor.prototype, protoProps);if (staticProps) defineProperties(Constructor, staticProps);return Constructor;
};
}();
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { 'default': obj };
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError('Cannot call a class as a function');
}
}
var _Util = _interopRequireDefault(_util);
/**
* --------------------------------------------------------------------------
* Bootstrap (v4.0.0-alpha.2): collapse.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
var Collapse = function ($) {
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var NAME = 'collapse';
var VERSION = '4.0.0-alpha.2';
var DATA_KEY = 'bs.collapse';
var EVENT_KEY = '.' + DATA_KEY;
var DATA_API_KEY = '.data-api';
var JQUERY_NO_CONFLICT = $.fn[NAME];
var TRANSITION_DURATION = 600;
var Default = {
toggle: true,
parent: ''
};
var DefaultType = {
toggle: 'boolean',
parent: 'string'
};
var Event = {
SHOW: 'show' + EVENT_KEY,
SHOWN: 'shown' + EVENT_KEY,
HIDE: 'hide' + EVENT_KEY,
HIDDEN: 'hidden' + EVENT_KEY,
CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY
};
var ClassName = {
IN: 'in',
COLLAPSE: 'collapse',
COLLAPSING: 'collapsing',
COLLAPSED: 'collapsed'
};
var Dimension = {
WIDTH: 'width',
HEIGHT: 'height'
};
var Selector = {
ACTIVES: '.panel > .in, .panel > .collapsing',
DATA_TOGGLE: '[data-toggle="collapse"]'
};
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
var Collapse = function () {
function Collapse(element, config) {
_classCallCheck(this, Collapse);
this._isTransitioning = false;
this._element = element;
this._config = this._getConfig(config);
this._triggerArray = $.makeArray($('[data-toggle="collapse"][href="#' + element.id + '"],' + ('[data-toggle="collapse"][data-target="#' + element.id + '"]')));
this._parent = this._config.parent ? this._getParent() : null;
if (!this._config.parent) {
this._addAriaAndCollapsedClass(this._element, this._triggerArray);
}
if (this._config.toggle) {
this.toggle();
}
}
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
// getters
_createClass(Collapse, [{
key: 'toggle',
// public
value: function toggle() {
if ($(this._element).hasClass(ClassName.IN)) {
this.hide();
} else {
this.show();
}
}
}, {
key: 'show',
value: function show() {
var _this = this;
if (this._isTransitioning || $(this._element).hasClass(ClassName.IN)) {
return;
}
var actives = undefined;
var activesData = undefined;
if (this._parent) {
actives = $.makeArray($(Selector.ACTIVES));
if (!actives.length) {
actives = null;
}
}
if (actives) {
activesData = $(actives).data(DATA_KEY);
if (activesData && activesData._isTransitioning) {
return;
}
}
var startEvent = $.Event(Event.SHOW);
$(this._element).trigger(startEvent);
if (startEvent.isDefaultPrevented()) {
return;
}
if (actives) {
Collapse._jQueryInterface.call($(actives), 'hide');
if (!activesData) {
$(actives).data(DATA_KEY, null);
}
}
var dimension = this._getDimension();
$(this._element).removeClass(ClassName.COLLAPSE).addClass(ClassName.COLLAPSING);
this._element.style[dimension] = 0;
this._element.setAttribute('aria-expanded', true);
if (this._triggerArray.length) {
$(this._triggerArray).removeClass(ClassName.COLLAPSED).attr('aria-expanded', true);
}
this.setTransitioning(true);
var complete = function complete() {
$(_this._element).removeClass(ClassName.COLLAPSING).addClass(ClassName.COLLAPSE).addClass(ClassName.IN);
_this._element.style[dimension] = '';
_this.setTransitioning(false);
$(_this._element).trigger(Event.SHOWN);
};
if (!_Util['default'].supportsTransitionEnd()) {
complete();
return;
}
var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
var scrollSize = 'scroll' + capitalizedDimension;
$(this._element).one(_Util['default'].TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION);
this._element.style[dimension] = this._element[scrollSize] + 'px';
}
}, {
key: 'hide',
value: function hide() {
var _this2 = this;
if (this._isTransitioning || !$(this._element).hasClass(ClassName.IN)) {
return;
}
var startEvent = $.Event(Event.HIDE);
$(this._element).trigger(startEvent);
if (startEvent.isDefaultPrevented()) {
return;
}
var dimension = this._getDimension();
var offsetDimension = dimension === Dimension.WIDTH ? 'offsetWidth' : 'offsetHeight';
this._element.style[dimension] = this._element[offsetDimension] + 'px';
_Util['default'].reflow(this._element);
$(this._element).addClass(ClassName.COLLAPSING).removeClass(ClassName.COLLAPSE).removeClass(ClassName.IN);
this._element.setAttribute('aria-expanded', false);
if (this._triggerArray.length) {
$(this._triggerArray).addClass(ClassName.COLLAPSED).attr('aria-expanded', false);
}
this.setTransitioning(true);
var complete = function complete() {
_this2.setTransitioning(false);
$(_this2._element).removeClass(ClassName.COLLAPSING).addClass(ClassName.COLLAPSE).trigger(Event.HIDDEN);
};
this._element.style[dimension] = 0;
if (!_Util['default'].supportsTransitionEnd()) {
complete();
return;
}
$(this._element).one(_Util['default'].TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION);
}
}, {
key: 'setTransitioning',
value: function setTransitioning(isTransitioning) {
this._isTransitioning = isTransitioning;
}
}, {
key: 'dispose',
value: function dispose() {
$.removeData(this._element, DATA_KEY);
this._config = null;
this._parent = null;
this._element = null;
this._triggerArray = null;
this._isTransitioning = null;
}
// private
}, {
key: '_getConfig',
value: function _getConfig(config) {
config = $.extend({}, Default, config);
config.toggle = Boolean(config.toggle); // coerce string values
_Util['default'].typeCheckConfig(NAME, config, DefaultType);
return config;
}
}, {
key: '_getDimension',
value: function _getDimension() {
var hasWidth = $(this._element).hasClass(Dimension.WIDTH);
return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT;
}
}, {
key: '_getParent',
value: function _getParent() {
var _this3 = this;
var parent = $(this._config.parent)[0];
var selector = '[data-toggle="collapse"][data-parent="' + this._config.parent + '"]';
$(parent).find(selector).each(function (i, element) {
_this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
});
return parent;
}
}, {
key: '_addAriaAndCollapsedClass',
value: function _addAriaAndCollapsedClass(element, triggerArray) {
if (element) {
var isOpen = $(element).hasClass(ClassName.IN);
element.setAttribute('aria-expanded', isOpen);
if (triggerArray.length) {
$(triggerArray).toggleClass(ClassName.COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
}
}
}
// static
}], [{
key: '_getTargetFromElement',
value: function _getTargetFromElement(element) {
var selector = _Util['default'].getSelectorFromElement(element);
return selector ? $(selector)[0] : null;
}
}, {
key: '_jQueryInterface',
value: function _jQueryInterface(config) {
return this.each(function () {
var $this = $(this);
var data = $this.data(DATA_KEY);
var _config = $.extend({}, Default, $this.data(), (typeof config === 'undefined' ? 'undefined' : babelHelpers.typeof(config)) === 'object' && config);
if (!data && _config.toggle && /show|hide/.test(config)) {
_config.toggle = false;
}
if (!data) {
data = new Collapse(this, _config);
$this.data(DATA_KEY, data);
}
if (typeof config === 'string') {
if (data[config] === undefined) {
throw new Error('No method named "' + config + '"');
}
data[config]();
}
});
}
}, {
key: 'VERSION',
get: function get() {
return VERSION;
}
}, {
key: 'Default',
get: function get() {
return Default;
}
}]);
return Collapse;
}();
$(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
event.preventDefault();
var target = Collapse._getTargetFromElement(this);
var data = $(target).data(DATA_KEY);
var config = data ? 'toggle' : $(this).data();
Collapse._jQueryInterface.call($(target), config);
});
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
$.fn[NAME] = Collapse._jQueryInterface;
$.fn[NAME].Constructor = Collapse;
$.fn[NAME].noConflict = function () {
$.fn[NAME] = JQUERY_NO_CONFLICT;
return Collapse._jQueryInterface;
};
return Collapse;
}(jQuery);
module.exports = Collapse;
});
});
collapse && (typeof collapse === 'undefined' ? 'undefined' : babelHelpers.typeof(collapse)) === 'object' && 'default' in collapse ? collapse['default'] : collapse;
var carousel = __commonjs(function (module, exports, global) {
(function (global, factory) {
if (typeof define === 'function' && define.amd) {
define(['exports', 'module', './util'], factory);
} else if (typeof exports !== 'undefined' && typeof module !== 'undefined') {
factory(exports, module, require$$0$1);
} else {
var mod = {
exports: {}
};
factory(mod.exports, mod, global.Util);
global.carousel = mod.exports;
}
})(__commonjs_global, function (exports, module, _util) {
'use strict';
var _createClass = function () {
function defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ('value' in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);
}
}return function (Constructor, protoProps, staticProps) {
if (protoProps) defineProperties(Constructor.prototype, protoProps);if (staticProps) defineProperties(Constructor, staticProps);return Constructor;
};
}();
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { 'default': obj };
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError('Cannot call a class as a function');
}
}
var _Util = _interopRequireDefault(_util);
/**
* --------------------------------------------------------------------------
* Bootstrap (v4.0.0-alpha.2): carousel.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
var Carousel = function ($) {
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var NAME = 'carousel';
var VERSION = '4.0.0-alpha.2';
var DATA_KEY = 'bs.carousel';
var EVENT_KEY = '.' + DATA_KEY;
var DATA_API_KEY = '.data-api';
var JQUERY_NO_CONFLICT = $.fn[NAME];
var TRANSITION_DURATION = 600;
var Default = {
interval: 5000,
keyboard: true,
slide: false,
pause: 'hover',
wrap: true
};
var DefaultType = {
interval: '(number|boolean)',
keyboard: 'boolean',
slide: '(boolean|string)',
pause: '(string|boolean)',
wrap: 'boolean'
};
var Direction = {
NEXT: 'next',
PREVIOUS: 'prev'
};
var Event = {
SLIDE: 'slide' + EVENT_KEY,
SLID: 'slid' + EVENT_KEY,
KEYDOWN: 'keydown' + EVENT_KEY,
MOUSEENTER: 'mouseenter' + EVENT_KEY,
MOUSELEAVE: 'mouseleave' + EVENT_KEY,
LOAD_DATA_API: 'load' + EVENT_KEY + DATA_API_KEY,
CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY
};
var ClassName = {
CAROUSEL: 'carousel',
ACTIVE: 'active',
SLIDE: 'slide',
RIGHT: 'right',
LEFT: 'left',
ITEM: 'carousel-item'
};
var Selector = {
ACTIVE: '.active',
ACTIVE_ITEM: '.active.carousel-item',
ITEM: '.carousel-item',
NEXT_PREV: '.next, .prev',
INDICATORS: '.carousel-indicators',
DATA_SLIDE: '[data-slide], [data-slide-to]',
DATA_RIDE: '[data-ride="carousel"]'
};
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
var Carousel = function () {
function Carousel(element, config) {
_classCallCheck(this, Carousel);
this._items = null;
this._interval = null;
this._activeElement = null;
this._isPaused = false;
this._isSliding = false;
this._config = this._getConfig(config);
this._element = $(element)[0];
this._indicatorsElement = $(this._element).find(Selector.INDICATORS)[0];
this._addEventListeners();
}
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
// getters
_createClass(Carousel, [{
key: 'next',
// public
value: function next() {
if (!this._isSliding) {
this._slide(Direction.NEXT);
}
}
}, {
key: 'nextWhenVisible',
value: function nextWhenVisible() {
// Don't call next when the page isn't visible
if (!document.hidden) {
this.next();
}
}
}, {
key: 'prev',
value: function prev() {
if (!this._isSliding) {
this._slide(Direction.PREVIOUS);
}
}
}, {
key: 'pause',
value: function pause(event) {
if (!event) {
this._isPaused = true;
}
if ($(this._element).find(Selector.NEXT_PREV)[0] && _Util['default'].supportsTransitionEnd()) {
_Util['default'].triggerTransitionEnd(this._element);
this.cycle(true);
}
clearInterval(this._interval);
this._interval = null;
}
}, {
key: 'cycle',
value: function cycle(event) {
if (!event) {
this._isPaused = false;
}
if (this._interval) {
clearInterval(this._interval);
this._interval = null;
}
if (this._config.interval && !this._isPaused) {
this._interval = setInterval($.proxy(document.visibilityState ? this.nextWhenVisible : this.next, this), this._config.interval);
}
}
}, {
key: 'to',
value: function to(index) {
var _this = this;
this._activeElement = $(this._element).find(Selector.ACTIVE_ITEM)[0];
var activeIndex = this._getItemIndex(this._activeElement);
if (index > this._items.length - 1 || index < 0) {
return;
}
if (this._isSliding) {
$(this._element).one(Event.SLID, function () {
return _this.to(index);
});
return;
}
if (activeIndex === index) {
this.pause();
this.cycle();
return;
}
var direction = index > activeIndex ? Direction.NEXT : Direction.PREVIOUS;
this._slide(direction, this._items[index]);
}
}, {
key: 'dispose',
value: function dispose() {
$(this._element).off(EVENT_KEY);
$.removeData(this._element, DATA_KEY);
this._items = null;
this._config = null;
this._element = null;
this._interval = null;
this._isPaused = null;
this._isSliding = null;
this._activeElement = null;
this._indicatorsElement = null;
}
// private
}, {
key: '_getConfig',
value: function _getConfig(config) {
config = $.extend({}, Default, config);
_Util['default'].typeCheckConfig(NAME, config, DefaultType);
return config;
}
}, {
key: '_addEventListeners',
value: function _addEventListeners() {
if (this._config.keyboard) {
$(this._element).on(Event.KEYDOWN, $.proxy(this._keydown, this));
}
if (this._config.pause === 'hover' && !('ontouchstart' in document.documentElement)) {
$(this._element).on(Event.MOUSEENTER, $.proxy(this.pause, this)).on(Event.MOUSELEAVE, $.proxy(this.cycle, this));
}
}
}, {
key: '_keydown',
value: function _keydown(event) {
event.preventDefault();
if (/input|textarea/i.test(event.target.tagName)) {
return;
}
switch (event.which) {
case 37:
this.prev();break;
case 39:
this.next();break;
default:
return;
}
}
}, {
key: '_getItemIndex',
value: function _getItemIndex(element) {
this._items = $.makeArray($(element).parent().find(Selector.ITEM));
return this._items.indexOf(element);
}
}, {
key: '_getItemByDirection',
value: function _getItemByDirection(direction, activeElement) {
var isNextDirection = direction === Direction.NEXT;
var isPrevDirection = direction === Direction.PREVIOUS;
var activeIndex = this._getItemIndex(activeElement);
var lastItemIndex = this._items.length - 1;
var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
if (isGoingToWrap && !this._config.wrap) {
return activeElement;
}
var delta = direction === Direction.PREVIOUS ? -1 : 1;
var itemIndex = (activeIndex + delta) % this._items.length;
return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
}
}, {
key: '_triggerSlideEvent',
value: function _triggerSlideEvent(relatedTarget, directionalClassname) {
var slideEvent = $.Event(Event.SLIDE, {
relatedTarget: relatedTarget,
direction: directionalClassname
});
$(this._element).trigger(slideEvent);
return slideEvent;
}
}, {
key: '_setActiveIndicatorElement',
value: function _setActiveIndicatorElement(element) {
if (this._indicatorsElement) {
$(this._indicatorsElement).find(Selector.ACTIVE).removeClass(ClassName.ACTIVE);
var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
if (nextIndicator) {
$(nextIndicator).addClass(ClassName.ACTIVE);
}
}
}
}, {
key: '_slide',
value: function _slide(direction, element) {
var _this2 = this;
var activeElement = $(this._element).find(Selector.ACTIVE_ITEM)[0];
var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
var isCycling = Boolean(this._interval);
var directionalClassName = direction === Direction.NEXT ? ClassName.LEFT : ClassName.RIGHT;
if (nextElement && $(nextElement).hasClass(ClassName.ACTIVE)) {
this._isSliding = false;
return;
}
var slideEvent = this._triggerSlideEvent(nextElement, directionalClassName);
if (slideEvent.isDefaultPrevented()) {
return;
}
if (!activeElement || !nextElement) {
// some weirdness is happening, so we bail
return;
}
this._isSliding = true;
if (isCycling) {
this.pause();
}
this._setActiveIndicatorElement(nextElement);
var slidEvent = $.Event(Event.SLID, {
relatedTarget: nextElement,
direction: directionalClassName
});
if (_Util['default'].supportsTransitionEnd() && $(this._element).hasClass(ClassName.SLIDE)) {
$(nextElement).addClass(direction);
_Util['default'].reflow(nextElement);
$(activeElement).addClass(directionalClassName);
$(nextElement).addClass(directionalClassName);
$(activeElement).one(_Util['default'].TRANSITION_END, function () {
$(nextElement).removeClass(directionalClassName).removeClass(direction);
$(nextElement).addClass(ClassName.ACTIVE);
$(activeElement).removeClass(ClassName.ACTIVE).removeClass(direction).removeClass(directionalClassName);
_this2._isSliding = false;
setTimeout(function () {
return $(_this2._element).trigger(slidEvent);
}, 0);
}).emulateTransitionEnd(TRANSITION_DURATION);
} else {
$(activeElement).removeClass(ClassName.ACTIVE);
$(nextElement).addClass(ClassName.ACTIVE);
this._isSliding = false;
$(this._element).trigger(slidEvent);
}
if (isCycling) {
this.cycle();
}
}
// static
}], [{
key: '_jQueryInterface',
value: function _jQueryInterface(config) {
return this.each(function () {
var data = $(this).data(DATA_KEY);
var _config = $.extend({}, Default, $(this).data());
if ((typeof config === 'undefined' ? 'undefined' : babelHelpers.typeof(config)) === 'object') {
$.extend(_config, config);
}
var action = typeof config === 'string' ? config : _config.slide;
if (!data) {
data = new Carousel(this, _config);
$(this).data(DATA_KEY, data);
}
if (typeof config === 'number') {
data.to(config);
} else if (typeof action === 'string') {
if (data[action] === undefined) {
throw new Error('No method named "' + action + '"');
}
data[action]();
} else if (_config.interval) {
data.pause();
data.cycle();
}
});
}
}, {
key: '_dataApiClickHandler',
value: function _dataApiClickHandler(event) {
var selector = _Util['default'].getSelectorFromElement(this);
if (!selector) {
return;
}
var target = $(selector)[0];
if (!target || !$(target).hasClass(ClassName.CAROUSEL)) {
return;
}
var config = $.extend({}, $(target).data(), $(this).data());
var slideIndex = this.getAttribute('data-slide-to');
if (slideIndex) {
config.interval = false;
}
Carousel._jQueryInterface.call($(target), config);
if (slideIndex) {
$(target).data(DATA_KEY).to(slideIndex);
}
event.preventDefault();
}
}, {
key: 'VERSION',
get: function get() {
return VERSION;
}
}, {
key: 'Default',
get: function get() {
return Default;
}
}]);
return Carousel;
}();
$(document).on(Event.CLICK_DATA_API, Selector.DATA_SLIDE, Carousel._dataApiClickHandler);
$(window).on(Event.LOAD_DATA_API, function () {
$(Selector.DATA_RIDE).each(function () {
var $carousel = $(this);
Carousel._jQueryInterface.call($carousel, $carousel.data());
});
});
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
$.fn[NAME] = Carousel._jQueryInterface;
$.fn[NAME].Constructor = Carousel;
$.fn[NAME].noConflict = function () {
$.fn[NAME] = JQUERY_NO_CONFLICT;
return Carousel._jQueryInterface;
};
return Carousel;
}(jQuery);
module.exports = Carousel;
});
});
carousel && (typeof carousel === 'undefined' ? 'undefined' : babelHelpers.typeof(carousel)) === 'object' && 'default' in carousel ? carousel['default'] : carousel;
var button = __commonjs(function (module, exports, global) {
(function (global, factory) {
if (typeof define === 'function' && define.amd) {
define(['exports', 'module'], factory);
} else if (typeof exports !== 'undefined' && typeof module !== 'undefined') {
factory(exports, module);
} else {
var mod = {
exports: {}
};
factory(mod.exports, mod);
global.button = mod.exports;
}
})(__commonjs_global, function (exports, module) {
/**
* --------------------------------------------------------------------------
* Bootstrap (v4.0.0-alpha.2): button.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
'use strict';
var _createClass = function () {
function defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ('value' in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);
}
}return function (Constructor, protoProps, staticProps) {
if (protoProps) defineProperties(Constructor.prototype, protoProps);if (staticProps) defineProperties(Constructor, staticProps);return Constructor;
};
}();
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError('Cannot call a class as a function');
}
}
var Button = function ($) {
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var NAME = 'button';
var VERSION = '4.0.0-alpha.2';
var DATA_KEY = 'bs.button';
var EVENT_KEY = '.' + DATA_KEY;
var DATA_API_KEY = '.data-api';
var JQUERY_NO_CONFLICT = $.fn[NAME];
var ClassName = {
ACTIVE: 'active',
BUTTON: 'btn',
FOCUS: 'focus'
};
var Selector = {
DATA_TOGGLE_CARROT: '[data-toggle^="button"]',
DATA_TOGGLE: '[data-toggle="buttons"]',
INPUT: 'input',
ACTIVE: '.active',
BUTTON: '.btn'
};
var Event = {
CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY,
FOCUS_BLUR_DATA_API: 'focus' + EVENT_KEY + DATA_API_KEY + ' ' + ('blur' + EVENT_KEY + DATA_API_KEY)
};
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
var Button = function () {
function Button(element) {
_classCallCheck(this, Button);
this._element = element;
}
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
// getters
_createClass(Button, [{
key: 'toggle',
// public
value: function toggle() {
var triggerChangeEvent = true;
var rootElement = $(this._element).closest(Selector.DATA_TOGGLE)[0];
if (rootElement) {
var input = $(this._element).find(Selector.INPUT)[0];
if (input) {
if (input.type === 'radio') {
if (input.checked && $(this._element).hasClass(ClassName.ACTIVE)) {
triggerChangeEvent = false;
} else {
var activeElement = $(rootElement).find(Selector.ACTIVE)[0];
if (activeElement) {
$(activeElement).removeClass(ClassName.ACTIVE);
}
}
}
if (triggerChangeEvent) {
input.checked = !$(this._element).hasClass(ClassName.ACTIVE);
$(this._element).trigger('change');
}
input.focus();
}
} else {
this._element.setAttribute('aria-pressed', !$(this._element).hasClass(ClassName.ACTIVE));
}
if (triggerChangeEvent) {
$(this._element).toggleClass(ClassName.ACTIVE);
}
}
}, {
key: 'dispose',
value: function dispose() {
$.removeData(this._element, DATA_KEY);
this._element = null;
}
// static
}], [{
key: '_jQueryInterface',
value: function _jQueryInterface(config) {
return this.each(function () {
var data = $(this).data(DATA_KEY);
if (!data) {
data = new Button(this);
$(this).data(DATA_KEY, data);
}
if (config === 'toggle') {
data[config]();
}
});
}
}, {
key: 'VERSION',
get: function get() {
return VERSION;
}
}]);
return Button;
}();
$(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE_CARROT, function (event) {
event.preventDefault();
var button = event.target;
if (!$(button).hasClass(ClassName.BUTTON)) {
button = $(button).closest(Selector.BUTTON);
}
Button._jQueryInterface.call($(button), 'toggle');
}).on(Event.FOCUS_BLUR_DATA_API, Selector.DATA_TOGGLE_CARROT, function (event) {
var button = $(event.target).closest(Selector.BUTTON)[0];
$(button).toggleClass(ClassName.FOCUS, /^focus(in)?$/.test(event.type));
});
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
$.fn[NAME] = Button._jQueryInterface;
$.fn[NAME].Constructor = Button;
$.fn[NAME].noConflict = function () {
$.fn[NAME] = JQUERY_NO_CONFLICT;
return Button._jQueryInterface;
};
return Button;
}(jQuery);
module.exports = Button;
});
});
button && (typeof button === 'undefined' ? 'undefined' : babelHelpers.typeof(button)) === 'object' && 'default' in button ? button['default'] : button;
var alert = __commonjs(function (module, exports, global) {
(function (global, factory) {
if (typeof define === 'function' && define.amd) {
define(['exports', 'module', './util'], factory);
} else if (typeof exports !== 'undefined' && typeof module !== 'undefined') {
factory(exports, module, require$$0$1);
} else {
var mod = {
exports: {}
};
factory(mod.exports, mod, global.Util);
global.alert = mod.exports;
}
})(__commonjs_global, function (exports, module, _util) {
'use strict';
var _createClass = function () {
function defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ('value' in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);
}
}return function (Constructor, protoProps, staticProps) {
if (protoProps) defineProperties(Constructor.prototype, protoProps);if (staticProps) defineProperties(Constructor, staticProps);return Constructor;
};
}();
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { 'default': obj };
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError('Cannot call a class as a function');
}
}
var _Util = _interopRequireDefault(_util);
/**
* --------------------------------------------------------------------------
* Bootstrap (v4.0.0-alpha.2): alert.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
var Alert = function ($) {
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var NAME = 'alert';
var VERSION = '4.0.0-alpha.2';
var DATA_KEY = 'bs.alert';
var EVENT_KEY = '.' + DATA_KEY;
var DATA_API_KEY = '.data-api';
var JQUERY_NO_CONFLICT = $.fn[NAME];
var TRANSITION_DURATION = 150;
var Selector = {
DISMISS: '[data-dismiss="alert"]'
};
var Event = {
CLOSE: 'close' + EVENT_KEY,
CLOSED: 'closed' + EVENT_KEY,
CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY
};
var ClassName = {
ALERT: 'alert',
FADE: 'fade',
IN: 'in'
};
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
var Alert = function () {
function Alert(element) {
_classCallCheck(this, Alert);
this._element = element;
}
/**
* ------------------------------------------------------------------------
* Data Api implementation
* ------------------------------------------------------------------------
*/
// getters
_createClass(Alert, [{
key: 'close',
// public
value: function close(element) {
element = element || this._element;
var rootElement = this._getRootElement(element);
var customEvent = this._triggerCloseEvent(rootElement);
if (customEvent.isDefaultPrevented()) {
return;
}
this._removeElement(rootElement);
}
}, {
key: 'dispose',
value: function dispose() {
$.removeData(this._element, DATA_KEY);
this._element = null;
}
// private
}, {
key: '_getRootElement',
value: function _getRootElement(element) {
var selector = _Util['default'].getSelectorFromElement(element);
var parent = false;
if (selector) {
parent = $(selector)[0];
}
if (!parent) {
parent = $(element).closest('.' + ClassName.ALERT)[0];
}
return parent;
}
}, {
key: '_triggerCloseEvent',
value: function _triggerCloseEvent(element) {
var closeEvent = $.Event(Event.CLOSE);
$(element).trigger(closeEvent);
return closeEvent;
}
}, {
key: '_removeElement',
value: function _removeElement(element) {
$(element).removeClass(ClassName.IN);
if (!_Util['default'].supportsTransitionEnd() || !$(element).hasClass(ClassName.FADE)) {
this._destroyElement(element);
return;
}
$(element).one(_Util['default'].TRANSITION_END, $.proxy(this._destroyElement, this, element)).emulateTransitionEnd(TRANSITION_DURATION);
}
}, {
key: '_destroyElement',
value: function _destroyElement(element) {
$(element).detach().trigger(Event.CLOSED).remove();
}
// static
}], [{
key: '_jQueryInterface',
value: function _jQueryInterface(config) {
return this.each(function () {
var $element = $(this);
var data = $element.data(DATA_KEY);
if (!data) {
data = new Alert(this);
$element.data(DATA_KEY, data);
}
if (config === 'close') {
data[config](this);
}
});
}
}, {
key: '_handleDismiss',
value: function _handleDismiss(alertInstance) {
return function (event) {
if (event) {
event.preventDefault();
}
alertInstance.close(this);
};
}
}, {
key: 'VERSION',
get: function get() {
return VERSION;
}
}]);
return Alert;
}();
$(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert()));
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
$.fn[NAME] = Alert._jQueryInterface;
$.fn[NAME].Constructor = Alert;
$.fn[NAME].noConflict = function () {
$.fn[NAME] = JQUERY_NO_CONFLICT;
return Alert._jQueryInterface;
};
return Alert;
}(jQuery);
module.exports = Alert;
});
});
alert && (typeof alert === 'undefined' ? 'undefined' : babelHelpers.typeof(alert)) === 'object' && 'default' in alert ? alert['default'] : alert;
var npm = __commonjs(function (module) {
// This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment.
});
npm && (typeof npm === 'undefined' ? 'undefined' : babelHelpers.typeof(npm)) === 'object' && 'default' in npm ? npm['default'] : npm;
var Util = function () {
/**
* ------------------------------------------------------------------------
* Private TransitionEnd Helpers
* ------------------------------------------------------------------------
*/
var transitionEnd = false;
var _transitionEndSelector = '';
var TransitionEndEvent = {
WebkitTransition: 'webkitTransitionEnd',
MozTransition: 'transitionend',
OTransition: 'oTransitionEnd otransitionend',
transition: 'transitionend'
};
function transitionEndTest() {
if (window.QUnit) {
return false;
}
var el = document.createElement('mdb');
for (var name in TransitionEndEvent) {
if (el.style[name] !== undefined) {
return TransitionEndEvent[name]; // { end: TransitionEndEvent[name] }
}
}
return false;
}
function setTransitionEndSupport() {
transitionEnd = transitionEndTest();
// generate a concatenated transition end event selector
for (var name in TransitionEndEvent) {
_transitionEndSelector += ' ' + TransitionEndEvent[name];
}
}
/**
* --------------------------------------------------------------------------
* Public Util Api
* --------------------------------------------------------------------------
*/
var Util = {
transitionEndSupported: function transitionEndSupported() {
return transitionEnd;
},
transitionEndSelector: function transitionEndSelector() {
return _transitionEndSelector;
},
isChar: function isChar(event) {
if (typeof event.which === 'undefined') {
return true;
} else if (typeof event.which === 'number' && event.which > 0) {
return !event.ctrlKey && !event.metaKey && !event.altKey && event.which !== 8 // backspace
&& event.which !== 9 // tab
&& event.which !== 13 // enter
&& event.which !== 16 // shift
&& event.which !== 17 // ctrl
&& event.which !== 20 // caps lock
&& event.which !== 27 // escape
;
}
return false;
},
assert: function assert($element, invalidTest, message) {
if (invalidTest) {
if (!$element === undefined) {
$element.css('border', '1px solid red');
}
console.error(message, $element); // eslint-disable-line no-console
throw message;
}
},
describe: function describe($element) {
if ($element === undefined) {
return 'undefined';
} else if ($element.length === 0) {
return '(no matching elements)';
}
return $element[0].outerHTML.split('>')[0] + '>';
}
};
setTransitionEndSupport();
return Util;
}(jQuery);
var Base = function ($) {
var ClassName = {
MDB_FORM_GROUP: 'mdb-form-group',
IS_FILLED: 'is-filled',
IS_FOCUSED: 'is-focused'
};
var Selector = {
MDB_FORM_GROUP: '.' + ClassName.MDB_FORM_GROUP
};
var Default = {};
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
var Base = function () {
/**
*
* @param element
* @param config
* @param properties - anything that needs to be set as this[key] = value. Works around the need to call `super` before using `this`
*/
function Base($element, config) {
var properties = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2];
babelHelpers.classCallCheck(this, Base);
this.$element = $element;
this.config = $.extend(true, {}, Default, config);
// set properties for use in the constructor initialization
for (var key in properties) {
this[key] = properties[key];
}
}
babelHelpers.createClass(Base, [{
key: 'dispose',
value: function dispose(dataKey) {
$.removeData(this.$element, dataKey);
this.$element = null;
this.config = null;
}
// ------------------------------------------------------------------------
// protected
}, {
key: 'addFormGroupFocus',
value: function addFormGroupFocus() {
if (!this.$element.prop('disabled')) {
this.$mdbFormGroup.addClass(ClassName.IS_FOCUSED);
}
}
}, {
key: 'removeFormGroupFocus',
value: function removeFormGroupFocus() {
this.$mdbFormGroup.removeClass(ClassName.IS_FOCUSED);
}
}, {
key: 'removeIsFilled',
value: function removeIsFilled() {
this.$mdbFormGroup.removeClass(ClassName.IS_FILLED);
}
}, {
key: 'addIsFilled',
value: function addIsFilled() {
this.$mdbFormGroup.addClass(ClassName.IS_FILLED);
}
// Find mdb-form-group
}, {
key: 'findMdbFormGroup',
value: function findMdbFormGroup() {
var raiseError = arguments.length <= 0 || arguments[0] === undefined ? true : arguments[0];
var mfg = this.$element.closest(Selector.MDB_FORM_GROUP);
if (mfg.length === 0 && raiseError) {
$.error('Failed to find ' + Selector.MDB_FORM_GROUP + ' for ' + Util.describe(this.$element));
}
return mfg;
}
// ------------------------------------------------------------------------
// private
// ------------------------------------------------------------------------
// static
}]);
return Base;
}();
return Base;
}(jQuery);
var BaseInput = function ($) {
var ClassName = {
FORM_GROUP: 'form-group',
MDB_FORM_GROUP: 'mdb-form-group',
MDB_LABEL: 'mdb-label',
MDB_LABEL_STATIC: 'mdb-label-static',
MDB_LABEL_PLACEHOLDER: 'mdb-label-placeholder',
MDB_LABEL_FLOATING: 'mdb-label-floating',
HAS_DANGER: 'has-danger',
IS_FILLED: 'is-filled',
IS_FOCUSED: 'is-focused'
};
var Selector = {
FORM_GROUP: '.' + ClassName.FORM_GROUP,
MDB_FORM_GROUP: '.' + ClassName.MDB_FORM_GROUP,
MDB_LABEL_WILDCARD: 'label[class^=\'' + ClassName.MDB_LABEL + '\'], label[class*=\' ' + ClassName.MDB_LABEL + '\']' // match any label variant if specified
};
var Default = {
validate: false,
formGroup: {
required: false
},
mdbFormGroup: {
template: '<span class=\'' + ClassName.MDB_FORM_GROUP + '\'></span>',
create: true, // create a wrapper if form-group not found
required: true // not recommended to turn this off, only used for inline components
},
label: {
required: false,
// Prioritized find order for resolving the label to be used as an mdb-label if not specified in the markup
// - a function(thisComponent); or
// - a string selector used like $mdbFormGroup.find(selector)
//
// Note this only runs if $mdbFormGroup.find(Selector.MDB_LABEL_WILDCARD) fails to find a label (as authored in the markup)
//
selectors: ['.form-control-label', // in the case of horizontal or inline forms, this will be marked
'> label' // usual case for text inputs, first child. Deeper would find toggle labels so don't do that.
],
className: ClassName.MDB_LABEL_STATIC
},
requiredClasses: [],
invalidComponentMatches: [],
convertInputSizeVariations: true
};
var FormControlSizeMarkers = {
'form-control-lg': 'mdb-form-group-lg',
'form-control-sm': 'mdb-form-group-sm'
};
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
var BaseInput = function (_Base) {
babelHelpers.inherits(BaseInput, _Base);
/**
*
* @param element
* @param config
* @param properties - anything that needs to be set as this[key] = value. Works around the need to call `super` before using `this`
*/
function BaseInput($element, config) {
var properties = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2];
babelHelpers.classCallCheck(this, BaseInput);
// Enforce no overlap between components to prevent side effects
var _this = babelHelpers.possibleConstructorReturn(this, Object.getPrototypeOf(BaseInput).call(this, $element, $.extend(true, {}, Default, config), properties));
_this._rejectInvalidComponentMatches();
// Enforce expected structure (if any)
_this.rejectWithoutRequiredStructure();
// Enforce required classes for a consistent rendering
_this._rejectWithoutRequiredClasses();
// Resolve the form-group first, it will be used for mdb-form-group if possible
// note: different components have different rules
_this.$formGroup = _this.findFormGroup(_this.config.formGroup.required);
// Will add mdb-form-group to form-group or create an mdb-form-group
// Performance Note: for those forms that are really performance driven, create the markup with the .mdb-form-group to avoid
// rendering changes once added.
_this.$mdbFormGroup = _this.resolveMdbFormGroup();
// Resolve and mark the mdbLabel if necessary as defined by the config
_this.$mdbLabel = _this.resolveMdbLabel();
// Signal to the mdb-form-group that a form-control-* variation is being used
_this.resolveMdbFormGroupSizing();
_this.addFocusListener();
_this.addChangeListener();
return _this;
}
babelHelpers.createClass(BaseInput, [{
key: 'dispose',
value: function dispose(dataKey) {
babelHelpers.get(Object.getPrototypeOf(BaseInput.prototype), 'dispose', this).call(this, dataKey);
this.$mdbFormGroup = null;
this.$formGroup = null;
}
// ------------------------------------------------------------------------
// protected
}, {
key: 'rejectWithoutRequiredStructure',
value: function rejectWithoutRequiredStructure() {
// implement
}
}, {
key: 'addFocusListener',
value: function addFocusListener() {
var _this2 = this;
this.$element.on('focus', function () {
_this2.addFormGroupFocus();
}).on('blur', function () {
_this2.removeFormGroupFocus();
});
}
}, {
key: 'addChangeListener',
value: function addChangeListener() {
var _this3 = this;
this.$element.on('keydown paste', function (event) {
if (Util.isChar(event)) {
_this3.addIsFilled();
}
}).on('keyup change', function () {
// make sure empty is added back when there is a programmatic value change.
// NOTE: programmatic changing of value using $.val() must trigger the change event i.e. $.val('x').trigger('change')
if (_this3.isEmpty()) {
_this3.removeIsFilled();
} else {
_this3.addIsFilled();
}
if (_this3.config.validate) {
// Validation events do not bubble, so they must be attached directly to the text: http://jsfiddle.net/PEpRM/1/
// Further, even the bind method is being caught, but since we are already calling #checkValidity here, just alter
// the form-group on change.
//
// NOTE: I'm not sure we should be intervening regarding validation, this seems better as a README and snippet of code.
// BUT, I've left it here for backwards compatibility.
var isValid = typeof _this3.$element[0].checkValidity === 'undefined' || _this3.$element[0].checkValidity();
if (isValid) {
_this3.removeHasDanger();
} else {
_this3.addHasDanger();
}
}
});
}
}, {
key: 'addHasDanger',
value: function addHasDanger() {
this.$mdbFormGroup.addClass(ClassName.HAS_DANGER);
}
}, {
key: 'removeHasDanger',
value: function removeHasDanger() {
this.$mdbFormGroup.removeClass(ClassName.HAS_DANGER);
}
}, {
key: 'isEmpty',
value: function isEmpty() {
return this.$element.val() === null || this.$element.val() === undefined || this.$element.val() === '';
}
// Will add mdb-form-group to form-group or create a mdb-form-group if necessary
}, {
key: 'resolveMdbFormGroup',
value: function resolveMdbFormGroup() {
var mfg = this.findMdbFormGroup(false);
if (mfg === undefined || mfg.length === 0) {
if (this.config.mdbFormGroup.create && (this.$formGroup === undefined || this.$formGroup.length === 0)) {
// If a form-group doesn't exist (not recommended), take a guess and wrap the element (assuming no label).
// note: it's possible to make this smarter, but I need to see valid cases before adding any complexity.
this.outerElement().wrap(this.config.mdbFormGroup.template);
} else {
// a form-group does exist, add our marker class to it
this.$formGroup.addClass(ClassName.MDB_FORM_GROUP);
// OLD: may want to implement this after all, see how the styling turns out, but using an existing form-group is less manipulation of the dom and therefore preferable
// A form-group does exist, so add an mdb-form-group wrapping it's internal contents
//fg.wrapInner(this.config.mdbFormGroup.template)
}
mfg = this.findMdbFormGroup(this.config.mdbFormGroup.required);
}
return mfg;
}
// Demarcation element (e.g. first child of a form-group)
// Subclasses such as file inputs may have different structures
}, {
key: 'outerElement',
value: function outerElement() {
return this.$element;
}
// Will add mdb-label to mdb-form-group if not already specified
}, {
key: 'resolveMdbLabel',
value: function resolveMdbLabel() {
var label = this.$mdbFormGroup.find(Selector.MDB_LABEL_WILDCARD);
if (label === undefined || label.length === 0) {
// we need to find it based on the configured selectors
label = this.findMdbLabel(this.config.label.required);
if (label === undefined || label.length === 0) {
// no label found, and finder did not require one
} else {
// a candidate label was found, add the configured default class name
label.addClass(this.config.label.className);
}
}
return label;
}
// Find mdb-label variant based on the config selectors
}, {
key: 'findMdbLabel',
value: function findMdbLabel() {
var raiseError = arguments.length <= 0 || arguments[0] === undefined ? true : arguments[0];
var label = null;
// use the specified selector order
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
try {
for (var _iterator = this.config.label.selectors[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var selector = _step.value;
if ($.isFunction(selector)) {
label = selector(this);
} else {
label = this.$mdbFormGroup.find(selector);
}
if (label !== undefined && label.length > 0) {
break;
}
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator.return) {
_iterator.return();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}
if (label.length === 0 && raiseError) {
$.error('Failed to find ' + Selector.MDB_LABEL_WILDCARD + ' within form-group for ' + Util.describe(this.$element));
}
return label;
}
// Find mdb-form-group
}, {
key: 'findFormGroup',
value: function findFormGroup() {
var raiseError = arguments.length <= 0 || arguments[0] === undefined ? true : arguments[0];
var fg = this.$element.closest(Selector.FORM_GROUP);
if (fg.length === 0 && raiseError) {
$.error('Failed to find ' + Selector.FORM_GROUP + ' for ' + Util.describe(this.$element));
}
return fg;
}
// Due to the interconnected nature of labels/inputs/help-blocks, signal the mdb-form-group-* size variation based on
// a found form-control-* size
}, {
key: 'resolveMdbFormGroupSizing',
value: function resolveMdbFormGroupSizing() {
if (!this.config.convertInputSizeVariations) {
return;
}
// Modification - Change text-sm/lg to form-group-sm/lg instead (preferred standard and simpler css/less variants)
for (var inputSize in FormControlSizeMarkers) {
if (this.$element.hasClass(inputSize)) {
//this.$element.removeClass(inputSize)
this.$mdbFormGroup.addClass(FormControlSizeMarkers[inputSize]);
}
}
}
// ------------------------------------------------------------------------
// private
}, {
key: '_rejectInvalidComponentMatches',
value: function _rejectInvalidComponentMatches() {
var _iteratorNormalCompletion2 = true;
var _didIteratorError2 = false;
var _iteratorError2 = undefined;
try {
for (var _iterator2 = this.config.invalidComponentMatches[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
var otherComponent = _step2.value;
otherComponent.rejectMatch(this.constructor.name, this.$element);
}
} catch (err) {
_didIteratorError2 = true;
_iteratorError2 = err;
} finally {
try {
if (!_iteratorNormalCompletion2 && _iterator2.return) {
_iterator2.return();
}
} finally {
if (_didIteratorError2) {
throw _iteratorError2;
}
}
}
}
}, {
key: '_rejectWithoutRequiredClasses',
value: function _rejectWithoutRequiredClasses() {
var _iteratorNormalCompletion3 = true;
var _didIteratorError3 = false;
var _iteratorError3 = undefined;
try {
for (var _iterator3 = this.config.requiredClasses[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
var requiredClass = _step3.value;
var found = false;
// allow one of several classes to be passed in x||y
if (requiredClass.indexOf('||') !== -1) {
var oneOf = requiredClass.split('||');
var _iteratorNormalCompletion4 = true;
var _didIteratorError4 = false;
var _iteratorError4 = undefined;
try {
for (var _iterator4 = oneOf[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
var _requiredClass = _step4.value;
if (this.$element.hasClass(_requiredClass)) {
found = true;
break;
}
}
} catch (err) {
_didIteratorError4 = true;
_iteratorError4 = err;
} finally {
try {
if (!_iteratorNormalCompletion4 && _iterator4.return) {
_iterator4.return();
}
} finally {
if (_didIteratorError4) {
throw _iteratorError4;
}
}
}
} else if (this.$element.hasClass(requiredClass)) {
found = true;
}
// error if not found
if (!found) {
$.error(this.constructor.name + ' element: ' + Util.describe(this.$element) + ' requires class: ' + requiredClass);
}
}
} catch (err) {
_didIteratorError3 = true;
_iteratorError3 = err;
} finally {
try {
if (!_iteratorNormalCompletion3 && _iterator3.return) {
_iterator3.return();
}
} finally {
if (_didIteratorError3) {
throw _iteratorError3;
}
}
}
}
// ------------------------------------------------------------------------
// static
}]);
return BaseInput;
}(Base);
return BaseInput;
}(jQuery);
var BaseSelection = function ($) {
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var Default = {
label: {
required: false
// Prioritized find order for resolving the label to be used as an mdb-label if not specified in the markup
// - a function(thisComponent); or
// - a string selector used like $mdbFormGroup.find(selector)
//
// Note this only runs if $mdbFormGroup.find(Selector.MDB_LABEL_WILDCARD) fails to find a label (as authored in the markup)
//
//selectors: [
// `.form-control-label`, // in the case of horizontal or inline forms, this will be marked
// `> label` // usual case for text inputs
//]
}
};
var Selector = {
LABEL: 'label'
};
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
var BaseSelection = function (_BaseInput) {
babelHelpers.inherits(BaseSelection, _BaseInput);
function BaseSelection($element, config, properties) {
babelHelpers.classCallCheck(this, BaseSelection);
var _this = babelHelpers.possibleConstructorReturn(this, Object.getPrototypeOf(BaseSelection).call(this, $element, $.extend(true, {}, Default, config), properties));
// properties = {inputType: checkbox, outerClass: checkbox-inline}
// '.checkbox|switch|radio > label > input[type=checkbox|radio]'
// '.${this.outerClass} > label > input[type=${this.inputType}]'
_this.decorateMarkup();
return _this;
}
// ------------------------------------------------------------------------
// protected
babelHelpers.createClass(BaseSelection, [{
key: 'decorateMarkup',
value: function decorateMarkup() {
this.$element.after(this.config.template);
}
// Demarcation element (e.g. first child of a form-group)
}, {
key: 'outerElement',
value: function outerElement() {
// .checkbox|switch|radio > label > input[type=checkbox|radio]
// label.checkbox-inline > input[type=checkbox|radio]
// .${this.outerClass} > label > input[type=${this.inputType}]
return this.$element.parent().closest('.' + this.outerClass);
}
}, {
key: 'rejectWithoutRequiredStructure',
value: function rejectWithoutRequiredStructure() {
// '.checkbox|switch|radio > label > input[type=checkbox|radio]'
// '.${this.outerClass} > label > input[type=${this.inputType}]'
Util.assert(this.$element, !this.$element.parent().prop('tagName') === 'label', this.constructor.name + '\'s ' + Util.describe(this.$element) + ' parent element should be <label>.');
Util.assert(this.$element, !this.outerElement().hasClass(this.outerClass), this.constructor.name + '\'s ' + Util.describe(this.$element) + ' outer element should have class ' + this.outerClass + '.');
}
}, {
key: 'addFocusListener',
value: function addFocusListener() {
var _this2 = this;
// checkboxes didn't appear to bubble to the document, so we'll bind these directly
this.$element.closest(Selector.LABEL).hover(function () {
_this2.addFormGroupFocus();
}, function () {
_this2.removeFormGroupFocus();
});
}
}, {
key: 'addChangeListener',
value: function addChangeListener() {
var _this3 = this;
this.$element.change(function () {
_this3.$element.blur();
});
}
// ------------------------------------------------------------------------
// private
}]);
return BaseSelection;
}(BaseInput);
return BaseSelection;
}(jQuery);
var Checkbox = function ($) {
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var NAME = 'checkbox';
var DATA_KEY = 'mdb.' + NAME;
var JQUERY_NAME = 'mdb' + (NAME.charAt(0).toUpperCase() + NAME.slice(1));
var JQUERY_NO_CONFLICT = $.fn[JQUERY_NAME];
var Default = {
template: '<span class=\'checkbox-decorator\'><span class=\'check\'></span></span>'
};
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
var Checkbox = function (_BaseSelection) {
babelHelpers.inherits(Checkbox, _BaseSelection);
function Checkbox($element, config) {
var properties = arguments.length <= 2 || arguments[2] === undefined ? { inputType: NAME, outerClass: NAME } : arguments[2];
babelHelpers.classCallCheck(this, Checkbox);
return babelHelpers.possibleConstructorReturn(this, Object.getPrototypeOf(Checkbox).call(this, $element, $.extend(true,
//{invalidComponentMatches: [File, Radio, Text, Textarea, Select]},
Default, config), properties));
}
babelHelpers.createClass(Checkbox, [{
key: 'dispose',
value: function dispose() {
var dataKey = arguments.length <= 0 || arguments[0] === undefined ? DATA_KEY : arguments[0];
babelHelpers.get(Object.getPrototypeOf(Checkbox.prototype), 'dispose', this).call(this, dataKey);
}
}], [{
key: 'matches',
value: function matches($element) {
// '.checkbox > label > input[type=checkbox]'
if ($element.attr('type') === 'checkbox') {
return true;
}
return false;
}
}, {
key: 'rejectMatch',
value: function rejectMatch(component, $element) {
Util.assert(this.$element, this.matches($element), component + ' component element ' + Util.describe($element) + ' is invalid for type=\'checkbox\'.');
}
// ------------------------------------------------------------------------
// protected
// ------------------------------------------------------------------------
// protected
// ------------------------------------------------------------------------
// private
// ------------------------------------------------------------------------
// static
}, {
key: '_jQueryInterface',
value: function _jQueryInterface(config) {
return this.each(function () {
var $element = $(this);
var data = $element.data(DATA_KEY);
if (!data) {
data = new Checkbox($element, config);
$element.data(DATA_KEY, data);
}
});
}
}]);
return Checkbox;
}(BaseSelection);
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
$.fn[JQUERY_NAME] = Checkbox._jQueryInterface;
$.fn[JQUERY_NAME].Constructor = Checkbox;
$.fn[JQUERY_NAME].noConflict = function () {
$.fn[JQUERY_NAME] = JQUERY_NO_CONFLICT;
return Checkbox._jQueryInterface;
};
return Checkbox;
}(jQuery);
var CheckboxInline = function ($) {
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var NAME = 'checkboxInline';
var DATA_KEY = 'mdb.' + NAME;
var JQUERY_NAME = 'mdb' + (NAME.charAt(0).toUpperCase() + NAME.slice(1));
var JQUERY_NO_CONFLICT = $.fn[JQUERY_NAME];
var Default = {
mdbFormGroup: {
create: false, // no mdb-form-group creation if form-group not present. It messes with the layout.
required: false
}
};
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
var CheckboxInline = function (_Checkbox) {
babelHelpers.inherits(CheckboxInline, _Checkbox);
function CheckboxInline($element, config) {
var properties = arguments.length <= 2 || arguments[2] === undefined ? { inputType: 'checkbox', outerClass: 'checkbox-inline' } : arguments[2];
babelHelpers.classCallCheck(this, CheckboxInline);
return babelHelpers.possibleConstructorReturn(this, Object.getPrototypeOf(CheckboxInline).call(this, $element, $.extend(true, {}, Default, config), properties));
}
babelHelpers.createClass(CheckboxInline, [{
key: 'dispose',
value: function dispose() {
babelHelpers.get(Object.getPrototypeOf(CheckboxInline.prototype), 'dispose', this).call(this, DATA_KEY);
}
//static matches($element) {
// // '.checkbox-inline > input[type=checkbox]'
// if ($element.attr('type') === 'checkbox') {
// return true
// }
// return false
//}
//
//static rejectMatch(component, $element) {
// Util.assert(this.$element, this.matches($element), `${component} component element ${Util.describe($element)} is invalid for type='checkbox'.`)
//}
// ------------------------------------------------------------------------
// protected
// ------------------------------------------------------------------------
// protected
// ------------------------------------------------------------------------
// private
// ------------------------------------------------------------------------
// static
}], [{
key: '_jQueryInterface',
value: function _jQueryInterface(config) {
return this.each(function () {
var $element = $(this);
var data = $element.data(DATA_KEY);
if (!data) {
data = new CheckboxInline($element, config);
$element.data(DATA_KEY, data);
}
});
}
}]);
return CheckboxInline;
}(Checkbox);
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
$.fn[JQUERY_NAME] = CheckboxInline._jQueryInterface;
$.fn[JQUERY_NAME].Constructor = CheckboxInline;
$.fn[JQUERY_NAME].noConflict = function () {
$.fn[JQUERY_NAME] = JQUERY_NO_CONFLICT;
return CheckboxInline._jQueryInterface;
};
return CheckboxInline;
}(jQuery);
var CollapseInline = function ($) {
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var NAME = 'collapseInline';
var DATA_KEY = 'mdb.' + NAME;
var JQUERY_NAME = 'mdb' + (NAME.charAt(0).toUpperCase() + NAME.slice(1));
var JQUERY_NO_CONFLICT = $.fn[JQUERY_NAME];
var Selector = {
ANY_INPUT: 'input, select, textarea'
};
var ClassName = {
IN: 'in',
COLLAPSE: 'collapse',
COLLAPSING: 'collapsing',
COLLAPSED: 'collapsed',
WIDTH: 'width'
};
var Default = {};
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
var CollapseInline = function (_Base) {
babelHelpers.inherits(CollapseInline, _Base);
// $element is expected to be the trigger
// i.e. <button class="btn mdb-btn-icon" for="search" data-toggle="collapse" data-target="#search-field" aria-expanded="false" aria-controls="search-field">
function CollapseInline($element, config) {
babelHelpers.classCallCheck(this, CollapseInline);
var _this = babelHelpers.possibleConstructorReturn(this, Object.getPrototypeOf(CollapseInline).call(this, $element, $.extend(true, {}, Default, config)));
_this.$mdbFormGroup = _this.findMdbFormGroup(true);
var collapseSelector = $element.data('target');
_this.$collapse = $(collapseSelector);
Util.assert($element, _this.$collapse.length === 0, 'Cannot find collapse target for ' + Util.describe($element));
Util.assert(_this.$collapse, !_this.$collapse.hasClass(ClassName.COLLAPSE), Util.describe(_this.$collapse) + ' is expected to have the \'' + ClassName.COLLAPSE + '\' class. It is being targeted by ' + Util.describe($element));
// find the first input for focusing
var $inputs = _this.$mdbFormGroup.find(Selector.ANY_INPUT);
if ($inputs.length > 0) {
_this.$input = $inputs.first();
}
// automatically add the marker class to collapse width instead of height - nice convenience because it is easily forgotten
if (!_this.$collapse.hasClass(ClassName.WIDTH)) {
_this.$collapse.addClass(ClassName.WIDTH);
}
if (_this.$input) {
// add a listener to set focus
_this.$collapse.on('shown.bs.collapse', function () {
_this.$input.focus();
});
// add a listener to collapse field
_this.$input.blur(function () {
_this.$collapse.collapse('hide');
});
}
return _this;
}
babelHelpers.createClass(CollapseInline, [{
key: 'dispose',
value: function dispose() {
babelHelpers.get(Object.getPrototypeOf(CollapseInline.prototype), 'dispose', this).call(this, DATA_KEY);
this.$mdbFormGroup = null;
this.$collapse = null;
this.$input = null;
}
// ------------------------------------------------------------------------
// private
// ------------------------------------------------------------------------
// static
}], [{
key: '_jQueryInterface',
value: function _jQueryInterface(config) {
return this.each(function () {
var $element = $(this);
var data = $element.data(DATA_KEY);
if (!data) {
data = new CollapseInline($element, config);
$element.data(DATA_KEY, data);
}
});
}
}]);
return CollapseInline;
}(Base);
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
$.fn[JQUERY_NAME] = CollapseInline._jQueryInterface;
$.fn[JQUERY_NAME].Constructor = CollapseInline;
$.fn[JQUERY_NAME].noConflict = function () {
$.fn[JQUERY_NAME] = JQUERY_NO_CONFLICT;
return CollapseInline._jQueryInterface;
};
return CollapseInline;
}(jQuery);
var File = function ($) {
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var NAME = 'file';
var DATA_KEY = 'mdb.' + NAME;
var JQUERY_NAME = 'mdb' + (NAME.charAt(0).toUpperCase() + NAME.slice(1));
var JQUERY_NO_CONFLICT = $.fn[JQUERY_NAME];
var Default = {};
var ClassName = {
FILE: NAME,
IS_FILE: 'is-file'
};
var Selector = {
FILENAMES: 'input.form-control[readonly]'
};
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
var File = function (_BaseInput) {
babelHelpers.inherits(File, _BaseInput);
function File($element, config) {
babelHelpers.classCallCheck(this, File);
var _this = babelHelpers.possibleConstructorReturn(this, Object.getPrototypeOf(File).call(this, $element, $.extend(true,
//{invalidComponentMatches: [Checkbox, Radio, Text, Textarea, Select, Switch]},
Default, config)));
_this.$mdbFormGroup.addClass(ClassName.IS_FILE);
return _this;
}
babelHelpers.createClass(File, [{
key: 'dispose',
value: function dispose() {
babelHelpers.get(Object.getPrototypeOf(File.prototype), 'dispose', this).call(this, DATA_KEY);
}
}, {
key: 'outerElement',
// ------------------------------------------------------------------------
// protected
// Demarcation element (e.g. first child of a form-group)
value: function outerElement() {
// label.file > input[type=file]
return this.$element.parent().closest('.' + ClassName.FILE);
}
}, {
key: 'rejectWithoutRequiredStructure',
value: function rejectWithoutRequiredStructure() {
// label.file > input[type=file]
Util.assert(this.$element, !this.outerElement().prop('tagName') === 'label', this.constructor.name + '\'s ' + Util.describe(this.$element) + ' parent element ' + Util.describe(this.outerElement()) + ' should be <label>.');
Util.assert(this.$element, !this.outerElement().hasClass(ClassName.FILE), this.constructor.name + '\'s ' + Util.describe(this.$element) + ' parent element ' + Util.describe(this.outerElement()) + ' should have class .' + ClassName.FILE + '.');
}
}, {
key: 'addFocusListener',
value: function addFocusListener() {
var _this2 = this;
this.$mdbFormGroup.on('focus', function () {
_this2.addFormGroupFocus();
}).on('blur', function () {
_this2.removeFormGroupFocus();
});
}
}, {
key: 'addChangeListener',
value: function addChangeListener() {
var _this3 = this;
// set the fileinput readonly field with the name of the file
this.$element.on('change', function () {
var value = '';
$.each(_this3.$element.files, function (i, file) {
value += file.name + ' , ';
});
value = value.substring(0, value.length - 2);
if (value) {
_this3.addIsFilled();
} else {
_this3.removeIsFilled();
}
_this3.$mdbFormGroup.find(Selector.FILENAMES).val(value);
});
}
// ------------------------------------------------------------------------
// private
// ------------------------------------------------------------------------
// static
}], [{
key: 'matches',
value: function matches($element) {
if ($element.attr('type') === 'file') {
return true;
}
return false;
}
}, {
key: 'rejectMatch',
value: function rejectMatch(component, $element) {
Util.assert(this.$element, this.matches($element), component + ' component element ' + Util.describe($element) + ' is invalid for type=\'file\'.');
}
}, {
key: '_jQueryInterface',
value: function _jQueryInterface(config) {
return this.each(function () {
var $element = $(this);
var data = $element.data(DATA_KEY);
if (!data) {
data = new File($element, config);
$element.data(DATA_KEY, data);
}
});
}
}]);
return File;
}(BaseInput);
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
$.fn[JQUERY_NAME] = File._jQueryInterface;
$.fn[JQUERY_NAME].Constructor = File;
$.fn[JQUERY_NAME].noConflict = function () {
$.fn[JQUERY_NAME] = JQUERY_NO_CONFLICT;
return File._jQueryInterface;
};
return File;
}(jQuery);
var Radio = function ($) {
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var NAME = 'radio';
var DATA_KEY = 'mdb.' + NAME;
var JQUERY_NAME = 'mdb' + (NAME.charAt(0).toUpperCase() + NAME.slice(1));
var JQUERY_NO_CONFLICT = $.fn[JQUERY_NAME];
var Default = {
template: '<span class=\'mdb-radio-outer-circle\'></span><span class=\'mdb-radio-inner-circle\'></span>'
};
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
var Radio = function (_BaseSelection) {
babelHelpers.inherits(Radio, _BaseSelection);
function Radio($element, config) {
var properties = arguments.length <= 2 || arguments[2] === undefined ? { inputType: NAME, outerClass: NAME } : arguments[2];
babelHelpers.classCallCheck(this, Radio);
return babelHelpers.possibleConstructorReturn(this, Object.getPrototypeOf(Radio).call(this, $element, $.extend(true,
//{invalidComponentMatches: [Checkbox, File, Switch, Text]},
Default, config), properties));
}
babelHelpers.createClass(Radio, [{
key: 'dispose',
value: function dispose() {
var dataKey = arguments.length <= 0 || arguments[0] === undefined ? DATA_KEY : arguments[0];
babelHelpers.get(Object.getPrototypeOf(Radio.prototype), 'dispose', this).call(this, dataKey);
}
}], [{
key: 'matches',
value: function matches($element) {
// '.radio > label > input[type=radio]'
if ($element.attr('type') === 'radio') {
return true;
}
return false;
}
}, {
key: 'rejectMatch',
value: function rejectMatch(component, $element) {
Util.assert(this.$element, this.matches($element), component + ' component element ' + Util.describe($element) + ' is invalid for type=\'radio\'.');
}
// ------------------------------------------------------------------------
// protected
//decorateMarkup() {
// this.$element.after(this.config.template)
//}
// ------------------------------------------------------------------------
// private
// ------------------------------------------------------------------------
// static
}, {
key: '_jQueryInterface',
value: function _jQueryInterface(config) {
return this.each(function () {
var $element = $(this);
var data = $element.data(DATA_KEY);
if (!data) {
data = new Radio($element, config);
$element.data(DATA_KEY, data);
}
});
}
}]);
return Radio;
}(BaseSelection);
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
$.fn[JQUERY_NAME] = Radio._jQueryInterface;
$.fn[JQUERY_NAME].Constructor = Radio;
$.fn[JQUERY_NAME].noConflict = function () {
$.fn[JQUERY_NAME] = JQUERY_NO_CONFLICT;
return Radio._jQueryInterface;
};
return Radio;
}(jQuery);
var RadioInline = function ($) {
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var NAME = 'radioInline';
var DATA_KEY = 'mdb.' + NAME;
var JQUERY_NAME = 'mdb' + (NAME.charAt(0).toUpperCase() + NAME.slice(1));
var JQUERY_NO_CONFLICT = $.fn[JQUERY_NAME];
var Default = {
mdbFormGroup: {
create: false, // no mdb-form-group creation if form-group not present. It messes with the layout.
required: false
}
};
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
var RadioInline = function (_Radio) {
babelHelpers.inherits(RadioInline, _Radio);
function RadioInline($element, config) {
var properties = arguments.length <= 2 || arguments[2] === undefined ? { inputType: 'radio', outerClass: 'radio-inline' } : arguments[2];
babelHelpers.classCallCheck(this, RadioInline);
return babelHelpers.possibleConstructorReturn(this, Object.getPrototypeOf(RadioInline).call(this, $element, $.extend(true, {}, Default, config), properties));
}
babelHelpers.createClass(RadioInline, [{
key: 'dispose',
value: function dispose() {
babelHelpers.get(Object.getPrototypeOf(RadioInline.prototype), 'dispose', this).call(this, DATA_KEY);
}
// ------------------------------------------------------------------------
// protected
// ------------------------------------------------------------------------
// protected
// ------------------------------------------------------------------------
// private
// ------------------------------------------------------------------------
// static
}], [{
key: '_jQueryInterface',
value: function _jQueryInterface(config) {
return this.each(function () {
var $element = $(this);
var data = $element.data(DATA_KEY);
if (!data) {
data = new RadioInline($element, config);
$element.data(DATA_KEY, data);
}
});
}
}]);
return RadioInline;
}(Radio);
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
$.fn[JQUERY_NAME] = RadioInline._jQueryInterface;
$.fn[JQUERY_NAME].Constructor = RadioInline;
$.fn[JQUERY_NAME].noConflict = function () {
$.fn[JQUERY_NAME] = JQUERY_NO_CONFLICT;
return RadioInline._jQueryInterface;
};
return RadioInline;
}(jQuery);
var BaseFormControl = function ($) {
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var Default = {
requiredClasses: ['form-control']
};
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
var BaseFormControl = function (_BaseInput) {
babelHelpers.inherits(BaseFormControl, _BaseInput);
function BaseFormControl($element, config) {
babelHelpers.classCallCheck(this, BaseFormControl);
// Initially mark as empty
var _this = babelHelpers.possibleConstructorReturn(this, Object.getPrototypeOf(BaseFormControl).call(this, $element, $.extend(true, Default, config)));
if (_this.isEmpty()) {
_this.removeIsFilled();
}
return _this;
}
return BaseFormControl;
}(BaseInput);
return BaseFormControl;
}(jQuery);
var Select = function ($) {
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var NAME = 'select';
var DATA_KEY = 'mdb.' + NAME;
var JQUERY_NAME = 'mdb' + (NAME.charAt(0).toUpperCase() + NAME.slice(1));
var JQUERY_NO_CONFLICT = $.fn[JQUERY_NAME];
var Default = {
requiredClasses: ['form-control||custom-select']
};
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
var Select = function (_BaseFormControl) {
babelHelpers.inherits(Select, _BaseFormControl);
function Select($element, config) {
babelHelpers.classCallCheck(this, Select);
// floating labels will cover the options, so trigger them to be above (if used)
var _this = babelHelpers.possibleConstructorReturn(this, Object.getPrototypeOf(Select).call(this, $element, $.extend(true,
//{invalidComponentMatches: [Checkbox, File, Radio, Switch, Text, Textarea]},
Default, config)));
_this.addIsFilled();
return _this;
}
babelHelpers.createClass(Select, [{
key: 'dispose',
value: function dispose() {
babelHelpers.get(Object.getPrototypeOf(Select.prototype), 'dispose', this).call(this, DATA_KEY);
}
}], [{
key: 'matches',
value: function matches($element) {
if ($element.prop('tagName') === 'select') {
return true;
}
return false;
}
}, {
key: 'rejectMatch',
value: function rejectMatch(component, $element) {
Util.assert(this.$element, this.matches($element), component + ' component element ' + Util.describe($element) + ' is invalid for <select>.');
}
// ------------------------------------------------------------------------
// protected
// ------------------------------------------------------------------------
// private
// ------------------------------------------------------------------------
// static
}, {
key: '_jQueryInterface',
value: function _jQueryInterface(config) {
return this.each(function () {
var $element = $(this);
var data = $element.data(DATA_KEY);
if (!data) {
data = new Select($element, config);
$element.data(DATA_KEY, data);
}
});
}
}]);
return Select;
}(BaseFormControl);
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
$.fn[JQUERY_NAME] = Select._jQueryInterface;
$.fn[JQUERY_NAME].Constructor = Select;
$.fn[JQUERY_NAME].noConflict = function () {
$.fn[JQUERY_NAME] = JQUERY_NO_CONFLICT;
return Select._jQueryInterface;
};
return Select;
}(jQuery);
var Switch = function ($) {
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var NAME = 'switch';
var DATA_KEY = 'mdb.' + NAME;
var JQUERY_NAME = 'mdb' + (NAME.charAt(0).toUpperCase() + NAME.slice(1));
var JQUERY_NO_CONFLICT = $.fn[JQUERY_NAME];
var Default = {
template: '<span class=\'mdb-switch-track\'></span>'
};
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
var Switch = function (_Checkbox) {
babelHelpers.inherits(Switch, _Checkbox);
function Switch($element, config) {
var properties = arguments.length <= 2 || arguments[2] === undefined ? { inputType: 'checkbox', outerClass: 'switch' } : arguments[2];
babelHelpers.classCallCheck(this, Switch);
return babelHelpers.possibleConstructorReturn(this, Object.getPrototypeOf(Switch).call(this, $element, $.extend(true, {}, Default, config), properties));
// selector: '.switch > label > input[type=checkbox]'
}
babelHelpers.createClass(Switch, [{
key: 'dispose',
value: function dispose() {
babelHelpers.get(Object.getPrototypeOf(Switch.prototype), 'dispose', this).call(this, DATA_KEY);
}
// ------------------------------------------------------------------------
// protected
// ------------------------------------------------------------------------
// private
// ------------------------------------------------------------------------
// static
}], [{
key: '_jQueryInterface',
value: function _jQueryInterface(config) {
return this.each(function () {
var $element = $(this);
var data = $element.data(DATA_KEY);
if (!data) {
data = new Switch($element, config);
$element.data(DATA_KEY, data);
}
});
}
}]);
return Switch;
}(Checkbox);
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
$.fn[JQUERY_NAME] = Switch._jQueryInterface;
$.fn[JQUERY_NAME].Constructor = Switch;
$.fn[JQUERY_NAME].noConflict = function () {
$.fn[JQUERY_NAME] = JQUERY_NO_CONFLICT;
return Switch._jQueryInterface;
};
return Switch;
}(jQuery);
var Text = function ($) {
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var NAME = 'text';
var DATA_KEY = 'mdb.' + NAME;
var JQUERY_NAME = 'mdb' + (NAME.charAt(0).toUpperCase() + NAME.slice(1));
var JQUERY_NO_CONFLICT = $.fn[JQUERY_NAME];
var Default = {};
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
var Text = function (_BaseFormControl) {
babelHelpers.inherits(Text, _BaseFormControl);
function Text($element, config) {
babelHelpers.classCallCheck(this, Text);
return babelHelpers.possibleConstructorReturn(this, Object.getPrototypeOf(Text).call(this, $element, $.extend(true,
//{invalidComponentMatches: [Checkbox, File, Radio, Switch, Select, Textarea]},
Default, config)));
}
babelHelpers.createClass(Text, [{
key: 'dispose',
value: function dispose() {
var dataKey = arguments.length <= 0 || arguments[0] === undefined ? DATA_KEY : arguments[0];
babelHelpers.get(Object.getPrototypeOf(Text.prototype), 'dispose', this).call(this, dataKey);
}
}], [{
key: 'matches',
value: function matches($element) {
if ($element.attr('type') === 'text') {
return true;
}
return false;
}
}, {
key: 'rejectMatch',
value: function rejectMatch(component, $element) {
Util.assert(this.$element, this.matches($element), component + ' component element ' + Util.describe($element) + ' is invalid for type=\'text\'.');
}
// ------------------------------------------------------------------------
// protected
// ------------------------------------------------------------------------
// private
// ------------------------------------------------------------------------
// static
}, {
key: '_jQueryInterface',
value: function _jQueryInterface(config) {
return this.each(function () {
var $element = $(this);
var data = $element.data(DATA_KEY);
if (!data) {
data = new Text($element, config);
$element.data(DATA_KEY, data);
}
});
}
}]);
return Text;
}(BaseFormControl);
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
$.fn[JQUERY_NAME] = Text._jQueryInterface;
$.fn[JQUERY_NAME].Constructor = Text;
$.fn[JQUERY_NAME].noConflict = function () {
$.fn[JQUERY_NAME] = JQUERY_NO_CONFLICT;
return Text._jQueryInterface;
};
return Text;
}(jQuery);
var Textarea = function ($) {
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var NAME = 'textarea';
var DATA_KEY = 'mdb.' + NAME;
var JQUERY_NAME = 'mdb' + (NAME.charAt(0).toUpperCase() + NAME.slice(1));
var JQUERY_NO_CONFLICT = $.fn[JQUERY_NAME];
var Default = {};
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
var Textarea = function (_BaseFormControl) {
babelHelpers.inherits(Textarea, _BaseFormControl);
function Textarea($element, config) {
babelHelpers.classCallCheck(this, Textarea);
return babelHelpers.possibleConstructorReturn(this, Object.getPrototypeOf(Textarea).call(this, $element, $.extend(true,
//{invalidComponentMatches: [Checkbox, File, Radio, Text, Select, Switch]},
Default, config)));
}
babelHelpers.createClass(Textarea, [{
key: 'dispose',
value: function dispose() {
babelHelpers.get(Object.getPrototypeOf(Textarea.prototype), 'dispose', this).call(this, DATA_KEY);
}
}], [{
key: 'matches',
value: function matches($element) {
if ($element.prop('tagName') === 'textarea') {
return true;
}
return false;
}
}, {
key: 'rejectMatch',
value: function rejectMatch(component, $element) {
Util.assert(this.$element, this.matches($element), component + ' component element ' + Util.describe($element) + ' is invalid for <textarea>.');
}
// ------------------------------------------------------------------------
// protected
// ------------------------------------------------------------------------
// private
// ------------------------------------------------------------------------
// static
}, {
key: '_jQueryInterface',
value: function _jQueryInterface(config) {
return this.each(function () {
var $element = $(this);
var data = $element.data(DATA_KEY);
if (!data) {
data = new Textarea($element, config);
$element.data(DATA_KEY, data);
}
});
}
}]);
return Textarea;
}(BaseFormControl);
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
$.fn[JQUERY_NAME] = Textarea._jQueryInterface;
$.fn[JQUERY_NAME].Constructor = Textarea;
$.fn[JQUERY_NAME].noConflict = function () {
$.fn[JQUERY_NAME] = JQUERY_NO_CONFLICT;
return Textarea._jQueryInterface;
};
return Textarea;
}(jQuery);
var BaseLayout = function ($) {
var ClassName = {
CANVAS: 'mdb-layout-canvas',
CONTAINER: 'mdb-layout-container',
BACKDROP: 'mdb-layout-backdrop'
};
var Selector = {
CANVAS: '.' + ClassName.CANVAS,
CONTAINER: '.' + ClassName.CONTAINER,
BACKDROP: '.' + ClassName.BACKDROP
};
var Default = {
canvas: {
create: true,
required: true,
template: '<div class="' + ClassName.CANVAS + '"></div>'
},
backdrop: {
create: true,
required: true,
template: '<div class="' + ClassName.BACKDROP + '"></div>'
}
};
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
var BaseLayout = function (_Base) {
babelHelpers.inherits(BaseLayout, _Base);
function BaseLayout($element, config) {
var properties = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2];
babelHelpers.classCallCheck(this, BaseLayout);
var _this = babelHelpers.possibleConstructorReturn(this, Object.getPrototypeOf(BaseLayout).call(this, $element, $.extend(true, {}, Default, config), properties));
_this.$container = _this.findContainer(true);
_this.$backdrop = _this.resolveBackdrop();
_this.resolveCanvas();
return _this;
}
babelHelpers.createClass(BaseLayout, [{
key: 'dispose',
value: function dispose(dataKey) {
babelHelpers.get(Object.getPrototypeOf(BaseLayout.prototype), 'dispose', this).call(this, dataKey);
this.$container = null;
this.$backdrop = null;
}
// ------------------------------------------------------------------------
// protected
// Will wrap container in mdb-layout-canvas if necessary
}, {
key: 'resolveCanvas',
value: function resolveCanvas() {
var bd = this.findCanvas(false);
if (bd === undefined || bd.length === 0) {
if (this.config.canvas.create) {
this.$container.wrap(this.config.canvas.template);
}
bd = this.findCanvas(this.config.canvas.required);
}
return bd;
}
// Find closest mdb-layout-container based on the given context
}, {
key: 'findCanvas',
value: function findCanvas() {
var raiseError = arguments.length <= 0 || arguments[0] === undefined ? true : arguments[0];
var context = arguments.length <= 1 || arguments[1] === undefined ? this.$container : arguments[1];
var canvas = context.closest(Selector.CANVAS);
if (canvas.length === 0 && raiseError) {
$.error('Failed to find ' + Selector.CANVAS + ' for ' + Util.describe(context));
}
return canvas;
}
// Will add mdb-layout-backdrop to mdb-layout-container if necessary
}, {
key: 'resolveBackdrop',
value: function resolveBackdrop() {
var bd = this.findBackdrop(false);
if (bd === undefined || bd.length === 0) {
if (this.config.backdrop.create) {
this.$container.append(this.config.backdrop.template);
}
bd = this.findBackdrop(this.config.backdrop.required);
}
return bd;
}
// Find closest mdb-layout-container based on the given context
}, {
key: 'findBackdrop',
value: function findBackdrop() {
var raiseError = arguments.length <= 0 || arguments[0] === undefined ? true : arguments[0];
var context = arguments.length <= 1 || arguments[1] === undefined ? this.$container : arguments[1];
var backdrop = context.find('> ' + Selector.BACKDROP);
if (backdrop.length === 0 && raiseError) {
$.error('Failed to find ' + Selector.BACKDROP + ' for ' + Util.describe(context));
}
return backdrop;
}
// Find closest mdb-layout-container based on the given context
}, {
key: 'findContainer',
value: function findContainer() {
var raiseError = arguments.length <= 0 || arguments[0] === undefined ? true : arguments[0];
var context = arguments.length <= 1 || arguments[1] === undefined ? this.$element : arguments[1];
var container = context.closest(Selector.CONTAINER);
if (container.length === 0 && raiseError) {
$.error('Failed to find ' + Selector.CONTAINER + ' for ' + Util.describe(context));
}
return container;
}
// ------------------------------------------------------------------------
// private
// ------------------------------------------------------------------------
// static
}]);
return BaseLayout;
}(Base);
return BaseLayout;
}(jQuery);
var Drawer = function ($) {
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var NAME = 'drawer';
var DATA_KEY = 'mdb.' + NAME;
var JQUERY_NAME = 'mdb' + (NAME.charAt(0).toUpperCase() + NAME.slice(1));
var JQUERY_NO_CONFLICT = $.fn[JQUERY_NAME];
var Keycodes = {
ESCAPE: 27
//ENTER: 13,
//SPACE: 32
};
var ClassName = {
IN: 'in',
DRAWER_IN: 'mdb-drawer-in',
DRAWER_OUT: 'mdb-drawer-out',
DRAWER: 'mdb-layout-drawer',
CONTAINER: 'mdb-layout-container'
};
var Default = {
focusSelector: 'a, button, input'
};
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
var Drawer = function (_BaseLayout) {
babelHelpers.inherits(Drawer, _BaseLayout);
// $element is expected to be the trigger
// i.e. <button class="btn mdb-btn-icon" for="search" data-toggle="drawer" data-target="#my-side-nav-drawer" aria-expanded="false" aria-controls="my-side-nav-drawer">
function Drawer($element, config) {
babelHelpers.classCallCheck(this, Drawer);
var _this = babelHelpers.possibleConstructorReturn(this, Object.getPrototypeOf(Drawer).call(this, $element, $.extend(true, {}, Default, config)));
_this.$toggles = $('[data-toggle="drawer"][href="#' + _this.$element[0].id + '"], [data-toggle="drawer"][data-target="#' + _this.$element[0].id + '"]');
_this._addAria();
// click or escape on the backdrop closes the drawer
_this.$backdrop.keydown(function (ev) {
if (ev.which === Keycodes.ESCAPE) {
_this.hide();
}
}).click(function () {
_this.hide();
});
// escape on the drawer closes it
_this.$element.keydown(function (ev) {
if (ev.which === Keycodes.ESCAPE) {
_this.hide();
}
});
// any toggle button clicks
_this.$toggles.click(function () {
_this.toggle();
});
return _this;
}
babelHelpers.createClass(Drawer, [{
key: 'dispose',
value: function dispose() {
babelHelpers.get(Object.getPrototypeOf(Drawer.prototype), 'dispose', this).call(this, DATA_KEY);
this.$toggles = null;
}
}, {
key: 'toggle',
value: function toggle() {
if (this._isOpen()) {
this.hide();
} else {
this.show();
}
}
}, {
key: 'show',
value: function show() {
if (this._isForcedClosed() || this._isOpen()) {
return;
}
this.$toggles.attr('aria-expanded', true);
this.$element.attr('aria-expanded', true);
this.$element.attr('aria-hidden', false);
// focus on the first focusable item
var $focusOn = this.$element.find(this.config.focusSelector);
if ($focusOn.length > 0) {
$focusOn.first().focus();
}
this.$container.addClass(ClassName.DRAWER_IN);
// backdrop is responsively styled based on mdb-drawer-overlay, therefore style is none of our concern, simply add the marker class and let the scss determine if it should be displayed or not.
this.$backdrop.addClass(ClassName.IN);
}
}, {
key: 'hide',
value: function hide() {
if (!this._isOpen()) {
return;
}
this.$toggles.attr('aria-expanded', false);
this.$element.attr('aria-expanded', false);
this.$element.attr('aria-hidden', true);
this.$container.removeClass(ClassName.DRAWER_IN);
this.$backdrop.removeClass(ClassName.IN);
}
// ------------------------------------------------------------------------
// private
}, {
key: '_isOpen',
value: function _isOpen() {
return this.$container.hasClass(ClassName.DRAWER_IN);
}
}, {
key: '_isForcedClosed',
value: function _isForcedClosed() {
return this.$container.hasClass(ClassName.DRAWER_OUT);
}
}, {
key: '_addAria',
value: function _addAria() {
var isOpen = this._isOpen();
this.$element.attr('aria-expanded', isOpen);
this.$element.attr('aria-hidden', isOpen);
if (this.$toggles.length) {
this.$toggles.attr('aria-expanded', isOpen);
}
}
// ------------------------------------------------------------------------
// static
}], [{
key: '_jQueryInterface',
value: function _jQueryInterface(config) {
return this.each(function () {
var $element = $(this);
var data = $element.data(DATA_KEY);
if (!data) {
data = new Drawer($element, config);
$element.data(DATA_KEY, data);
}
});
}
}]);
return Drawer;
}(BaseLayout);
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
$.fn[JQUERY_NAME] = Drawer._jQueryInterface;
$.fn[JQUERY_NAME].Constructor = Drawer;
$.fn[JQUERY_NAME].noConflict = function () {
$.fn[JQUERY_NAME] = JQUERY_NO_CONFLICT;
return Drawer._jQueryInterface;
};
return Drawer;
}(jQuery);
var Ripples = function ($) {
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var NAME = 'ripples';
var DATA_KEY = 'mdb.' + NAME;
var JQUERY_NAME = 'mdb' + (NAME.charAt(0).toUpperCase() + NAME.slice(1));
var JQUERY_NO_CONFLICT = $.fn[JQUERY_NAME];
var ClassName = {
CONTAINER: 'ripple-container',
DECORATOR: 'ripple-decorator'
};
var Selector = {
CONTAINER: '.' + ClassName.CONTAINER,
DECORATOR: '.' + ClassName.DECORATOR //,
};
var Default = {
container: {
template: '<div class=\'' + ClassName.CONTAINER + '\'></div>'
},
decorator: {
template: '<div class=\'' + ClassName.DECORATOR + '\'></div>'
},
trigger: {
start: 'mousedown touchstart',
end: 'mouseup mouseleave touchend'
},
touchUserAgentRegex: /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i,
duration: 500
};
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
var Ripples = function () {
function Ripples($element, config) {
var _this = this;
babelHelpers.classCallCheck(this, Ripples);
this.$element = $element;
//console.log(`Adding ripples to ${Util.describe(this.$element)}`) // eslint-disable-line no-console
this.config = $.extend(true, {}, Default, config);
// attach initial listener
this.$element.on(this.config.trigger.start, function (event) {
_this._onStartRipple(event);
});
}
babelHelpers.createClass(Ripples, [{
key: 'dispose',
value: function dispose() {
$.removeData(this.$element, DATA_KEY);
this.$element = null;
this.$container = null;
this.$decorator = null;
this.config = null;
}
// ------------------------------------------------------------------------
// private
}, {
key: '_onStartRipple',
value: function _onStartRipple(event) {
var _this2 = this;
// Verify if the user is just touching on a device and return if so
if (this._isTouch() && event.type === 'mousedown') {
return;
}
// Find or create the ripple container element
this._findOrCreateContainer();
// Get relY and relX positions of the container element
var relY = this._getRelY(event);
var relX = this._getRelX(event);
// If relY and/or relX are false, return the event
if (!relY && !relX) {
return;
}
// set the location and color each time (even if element is cached)
this.$decorator.css({
left: relX,
top: relY,
'background-color': this._getRipplesColor()
});
// Make sure the ripple has the styles applied (ugly hack but it works)
this._forceStyleApplication();
// Turn on the ripple animation
this.rippleOn();
// Call the rippleEnd function when the transition 'on' ends
setTimeout(function () {
_this2.rippleEnd();
}, this.config.duration);
// Detect when the user leaves the element to cleanup if not already done?
this.$element.on(this.config.trigger.end, function () {
if (_this2.$decorator) {
// guard against race condition/mouse attack
_this2.$decorator.data('mousedown', 'off');
if (_this2.$decorator.data('animating') === 'off') {
_this2.rippleOut();
}
}
});
}
}, {
key: '_findOrCreateContainer',
value: function _findOrCreateContainer() {
if (!this.$container || !this.$container.length > 0) {
this.$element.append(this.config.container.template);
this.$container = this.$element.find(Selector.CONTAINER);
}
// always add the rippleElement, it is always removed
this.$container.append(this.config.decorator.template);
this.$decorator = this.$container.find(Selector.DECORATOR);
}
// Make sure the ripple has the styles applied (ugly hack but it works)
}, {
key: '_forceStyleApplication',
value: function _forceStyleApplication() {
return window.getComputedStyle(this.$decorator[0]).opacity;
}
/**
* Get the relX
*/
}, {
key: '_getRelX',
value: function _getRelX(event) {
var wrapperOffset = this.$container.offset();
var result = null;
if (!this._isTouch()) {
// Get the mouse position relative to the ripple wrapper
result = event.pageX - wrapperOffset.left;
} else {
// Make sure the user is using only one finger and then get the touch
// position relative to the ripple wrapper
event = event.originalEvent;
if (event.touches.length === 1) {
result = event.touches[0].pageX - wrapperOffset.left;
} else {
result = false;
}
}
return result;
}
/**
* Get the relY
*/
}, {
key: '_getRelY',
value: function _getRelY(event) {
var containerOffset = this.$container.offset();
var result = null;
if (!this._isTouch()) {
/**
* Get the mouse position relative to the ripple wrapper
*/
result = event.pageY - containerOffset.top;
} else {
/**
* Make sure the user is using only one finger and then get the touch
* position relative to the ripple wrapper
*/
event = event.originalEvent;
if (event.touches.length === 1) {
result = event.touches[0].pageY - containerOffset.top;
} else {
result = false;
}
}
return result;
}
/**
* Get the ripple color
*/
}, {
key: '_getRipplesColor',
value: function _getRipplesColor() {
var color = this.$element.data('ripple-color') ? this.$element.data('ripple-color') : window.getComputedStyle(this.$element[0]).color;
return color;
}
/**
* Verify if the client is using a mobile device
*/
}, {
key: '_isTouch',
value: function _isTouch() {
return this.config.touchUserAgentRegex.test(navigator.userAgent);
}
/**
* End the animation of the ripple
*/
}, {
key: 'rippleEnd',
value: function rippleEnd() {
if (this.$decorator) {
// guard against race condition/mouse attack
this.$decorator.data('animating', 'off');
if (this.$decorator.data('mousedown') === 'off') {
this.rippleOut(this.$decorator);
}
}
}
/**
* Turn off the ripple effect
*/
}, {
key: 'rippleOut',
value: function rippleOut() {
var _this3 = this;
this.$decorator.off();
if (Util.transitionEndSupported()) {
this.$decorator.addClass('ripple-out');
} else {
this.$decorator.animate({ opacity: 0 }, 100, function () {
_this3.$decorator.trigger('transitionend');
});
}
this.$decorator.on(Util.transitionEndSelector(), function () {
if (_this3.$decorator) {
_this3.$decorator.remove();
_this3.$decorator = null;
}
});
}
/**
* Turn on the ripple effect
*/
}, {
key: 'rippleOn',
value: function rippleOn() {
var _this4 = this;
var size = this._getNewSize();
if (Util.transitionEndSupported()) {
this.$decorator.css({
'-ms-transform': 'scale(' + size + ')',
'-moz-transform': 'scale(' + size + ')',
'-webkit-transform': 'scale(' + size + ')',
transform: 'scale(' + size + ')'
}).addClass('ripple-on').data('animating', 'on').data('mousedown', 'on');
} else {
this.$decorator.animate({
width: Math.max(this.$element.outerWidth(), this.$element.outerHeight()) * 2,
height: Math.max(this.$element.outerWidth(), this.$element.outerHeight()) * 2,
'margin-left': Math.max(this.$element.outerWidth(), this.$element.outerHeight()) * -1,
'margin-top': Math.max(this.$element.outerWidth(), this.$element.outerHeight()) * -1,
opacity: 0.2
}, this.config.duration, function () {
_this4.$decorator.trigger('transitionend');
});
}
}
/**
* Get the new size based on the element height/width and the ripple width
*/
}, {
key: '_getNewSize',
value: function _getNewSize() {
return Math.max(this.$element.outerWidth(), this.$element.outerHeight()) / this.$decorator.outerWidth() * 2.5;
}
// ------------------------------------------------------------------------
// static
}], [{
key: '_jQueryInterface',
value: function _jQueryInterface(config) {
return this.each(function () {
var $element = $(this);
var data = $element.data(DATA_KEY);
if (!data) {
data = new Ripples($element, config);
$element.data(DATA_KEY, data);
}
});
}
}]);
return Ripples;
}();
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
$.fn[JQUERY_NAME] = Ripples._jQueryInterface;
$.fn[JQUERY_NAME].Constructor = Ripples;
$.fn[JQUERY_NAME].noConflict = function () {
$.fn[JQUERY_NAME] = JQUERY_NO_CONFLICT;
return Ripples._jQueryInterface;
};
return Ripples;
}(jQuery);
var Autofill = function ($) {
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var NAME = 'autofill';
var DATA_KEY = 'mdb.' + NAME;
var JQUERY_NAME = 'mdb' + (NAME.charAt(0).toUpperCase() + NAME.slice(1));
var JQUERY_NO_CONFLICT = $.fn[JQUERY_NAME];
var Default = {};
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
var Autofill = function (_Base) {
babelHelpers.inherits(Autofill, _Base);
function Autofill($element, config) {
babelHelpers.classCallCheck(this, Autofill);
var _this = babelHelpers.possibleConstructorReturn(this, Object.getPrototypeOf(Autofill).call(this, $element, $.extend(true, {}, Default, config)));
_this._watchLoading();
_this._attachEventHandlers();
return _this;
}
babelHelpers.createClass(Autofill, [{
key: 'dispose',
value: function dispose() {
babelHelpers.get(Object.getPrototypeOf(Autofill.prototype), 'dispose', this).call(this, DATA_KEY);
}
// ------------------------------------------------------------------------
// private
}, {
key: '_watchLoading',
value: function _watchLoading() {
var _this2 = this;
// After 10 seconds we are quite sure all the needed inputs are autofilled then we can stop checking them
setTimeout(function () {
clearInterval(_this2._onLoading);
}, 10000);
}
// This part of code will detect autofill when the page is loading (username and password inputs for example)
}, {
key: '_onLoading',
value: function _onLoading() {
setInterval(function () {
$('input[type!=checkbox]').each(function (index, element) {
var $element = $(element);
if ($element.val() && $element.val() !== $element.attr('value')) {
$element.trigger('change');
}
});
}, 100);
}
}, {
key: '_attachEventHandlers',
value: function _attachEventHandlers() {
// Listen on inputs of the focused form
// (because user can select from the autofill dropdown only when the input has focus)
var focused = null;
$(document).on('focus', 'input', function (event) {
var $inputs = $(event.currentTarget).closest('form').find('input').not('[type=file]');
focused = setInterval(function () {
$inputs.each(function (index, element) {
var $element = $(element);
if ($element.val() !== $element.attr('value')) {
$element.trigger('change');
}
});
}, 100);
}).on('blur', '.form-group input', function () {
clearInterval(focused);
});
}
// ------------------------------------------------------------------------
// static
}], [{
key: '_jQueryInterface',
value: function _jQueryInterface(config) {
return this.each(function () {
var $element = $(this);
var data = $element.data(DATA_KEY);
if (!data) {
data = new Autofill($element, config);
$element.data(DATA_KEY, data);
}
});
}
}]);
return Autofill;
}(Base);
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
$.fn[JQUERY_NAME] = Autofill._jQueryInterface;
$.fn[JQUERY_NAME].Constructor = Autofill;
$.fn[JQUERY_NAME].noConflict = function () {
$.fn[JQUERY_NAME] = JQUERY_NO_CONFLICT;
return Autofill._jQueryInterface;
};
return Autofill;
}(jQuery);
/**
* $.bootstrapMaterialDesign(config) is a macro class to configure the components generally
* used in Material Design for Bootstrap. You may pass overrides to the configurations
* which will be passed into each component, or you may omit use of this class and
* configure each component separately.
*/
var BootstrapMaterialDesign = function ($) {
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var NAME = 'bootstrapMaterialDesign';
var DATA_KEY = 'mdb.' + NAME;
var JQUERY_NAME = NAME; // retain this full name since it is long enough not to conflict
var JQUERY_NO_CONFLICT = $.fn[JQUERY_NAME];
/**
* Global configuration:
* The global configuration hash will be mixed in to each components' config.
* e.g. calling $.bootstrapMaterialDesign({global: { validate: true } }) would pass `validate:true` to every component
*
*
* Component configuration:
* - selector: may be a string or an array. Any array will be joined with a comma to generate the selector
* - disable any component by defining it as false with an override. e.g. $.bootstrapMaterialDesign({ autofill: false })
*
* @see each individual component for more configuration settings.
*/
var Default = {
global: {
validate: false,
label: {
className: 'mdb-label-static' // default style of label to be used if not specified in the html markup
}
},
autofill: {
selector: 'body'
},
checkbox: {
selector: '.checkbox > label > input[type=checkbox]'
},
checkboxInline: {
selector: 'label.checkbox-inline > input[type=checkbox]'
},
collapseInline: {
selector: '.mdb-collapse-inline [data-toggle="collapse"]'
},
drawer: {
selector: '.mdb-layout-drawer'
},
file: {
selector: 'input[type=file]'
},
radio: {
selector: '.radio > label > input[type=radio]'
},
radioInline: {
selector: 'label.radio-inline > input[type=radio]'
},
ripples: {
//selector: ['.btn:not(.btn-link):not(.ripple-none)'] // testing only
selector: ['.btn:not(.btn-link):not(.ripple-none)', '.card-image:not(.ripple-none)', '.navbar a:not(.ripple-none)', '.dropdown-menu a:not(.ripple-none)', '.nav-tabs a:not(.ripple-none)', '.pagination li:not(.active):not(.disabled) a:not(.ripple-none)', '.ripple' // generic marker class to add ripple to elements
]
},
select: {
selector: ['select']
},
switch: {
selector: '.switch > label > input[type=checkbox]'
},
text: {
// omit inputs we have specialized components to handle - we need to match text, email, etc. The easiest way to do this appears to be just omit the ones we don't want to match and let the rest fall through to this.
selector: ['input[type!=\'hidden\'][type!=\'checkbox\'][type!=\'radio\'][type!=\'file\'][type!=\'button\'][type!=\'submit\'][type!=\'reset\']']
},
textarea: {
selector: ['textarea']
},
arrive: true,
// create an ordered component list for instantiation
instantiation: ['ripples', 'checkbox', 'checkboxInline', 'collapseInline', 'drawer',
//'file',
'radio', 'radioInline', 'switch', 'text', 'textarea', 'select', 'autofill']
};
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
var BootstrapMaterialDesign = function () {
function BootstrapMaterialDesign($element, config) {
var _this = this;
babelHelpers.classCallCheck(this, BootstrapMaterialDesign);
this.$element = $element;
this.config = $.extend(true, {}, Default, config);
var $document = $(document);
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
try {
var _loop = function _loop() {
var component = _step.value;
// the component's config fragment is passed in directly, allowing users to override
var componentConfig = _this.config[component];
// check to make sure component config is enabled (not `false`)
if (componentConfig) {
(function () {
// assemble the selector as it may be an array
var selector = _this._resolveSelector(componentConfig);
// mix in global options
componentConfig = $.extend(true, {}, _this.config.global, componentConfig);
// create the jquery fn name e.g. 'mdbText' for 'text'
var componentName = '' + (component.charAt(0).toUpperCase() + component.slice(1));
var jqueryFn = 'mdb' + componentName;
try {
// safely instantiate component on selector elements with config, report errors and move on.
// console.debug(`instantiating: $('${selector}')[${jqueryFn}](${componentConfig})`) // eslint-disable-line no-console
$(selector)[jqueryFn](componentConfig);
// add to arrive if present and enabled
if (document.arrive && _this.config.arrive) {
$document.arrive(selector, function (element) {
// eslint-disable-line no-loop-func
$(element)[jqueryFn](componentConfig);
});
}
} catch (e) {
var message = 'Failed to instantiate component: $(\'' + selector + '\')[' + jqueryFn + '](' + componentConfig + ')';
console.error(message, e, '\nSelected elements: ', $(selector)); // eslint-disable-line no-console
throw e;
}
})();
}
};
for (var _iterator = this.config.instantiation[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
_loop();
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator.return) {
_iterator.return();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}
}
babelHelpers.createClass(BootstrapMaterialDesign, [{
key: 'dispose',
value: function dispose() {
$.removeData(this.$element, DATA_KEY);
this.$element = null;
this.config = null;
}
// ------------------------------------------------------------------------
// private
}, {
key: '_resolveSelector',
value: function _resolveSelector(componentConfig) {
var selector = componentConfig.selector;
if (Array.isArray(selector)) {
selector = selector.join(', ');
}
return selector;
}
// ------------------------------------------------------------------------
// static
}], [{
key: '_jQueryInterface',
value: function _jQueryInterface(config) {
return this.each(function () {
var $element = $(this);
var data = $element.data(DATA_KEY);
if (!data) {
data = new BootstrapMaterialDesign($element, config);
$element.data(DATA_KEY, data);
}
});
}
}]);
return BootstrapMaterialDesign;
}();
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
*/
$.fn[JQUERY_NAME] = BootstrapMaterialDesign._jQueryInterface;
$.fn[JQUERY_NAME].Constructor = BootstrapMaterialDesign;
$.fn[JQUERY_NAME].noConflict = function () {
$.fn[JQUERY_NAME] = JQUERY_NO_CONFLICT;
return BootstrapMaterialDesign._jQueryInterface;
};
return BootstrapMaterialDesign;
}(jQuery);
}());
//# sourceMappingURL=bootstrap-material-design.iife.js.map |
src/widgets/DropdownRow.js | sussol/mobile | /* eslint-disable react/forbid-prop-types */
/**
* mSupply Mobile
* Sustainable Solutions (NZ) Ltd. 2019
*/
import React from 'react';
import { StyleSheet, TextInput } from 'react-native';
import PropTypes from 'prop-types';
import { DropDown } from './DropDown';
import { FlexRow } from './FlexRow';
import { LIGHT_GREY, SUSSOL_ORANGE, APP_FONT_FAMILY } from '../globalStyles';
/**
* Layout component rendering a Dropdown and a TextInput.
*
* @prop {Text} currentOptionText Text to display for the label text prop.
* @prop {Array} options The options of the drop down. See PopoverDropdown.
* @prop {Func} onSelection Callback when selecting a dropdown option.
* @prop {String} dropdownTitle The title of the drop down menu when opened.
* @prop {String} placeholder Placeholder string value, when no value has been chosen/entered.
* @prop {Bool} isDisabled Indicator if this component should not be editable.
*/
export const DropdownRow = ({
currentOptionText,
options,
onSelection,
dropdownTitle,
placeholder,
isDisabled,
onChangeText,
}) => (
<FlexRow alignItems="center" justifyContent="center">
<DropDown
style={localStyles.dropDownStyle}
values={options}
onValueChange={onSelection}
headerValue={dropdownTitle}
isDisabled={!options.length}
/>
<TextInput
editable={!isDisabled}
onChangeText={onChangeText}
value={currentOptionText}
underlineColorAndroid={SUSSOL_ORANGE}
style={localStyles.textInputStyle}
placeholder={placeholder}
placeholderTextColor={LIGHT_GREY}
/>
</FlexRow>
);
const localStyles = StyleSheet.create({
containerStyle: {
flexDirection: 'row',
justifyContent: 'space-between',
alignItems: 'center',
},
iconsContainerStyle: {
flexDirection: 'row-reverse',
justifyContent: 'space-between',
flex: 1,
},
textInputStyle: {
flex: 2,
fontFamily: APP_FONT_FAMILY,
},
dropDownStyle: {
flex: 1,
marginBottom: 0,
marginLeft: 0,
marginTop: 0,
},
});
DropdownRow.defaultProps = {
placeholder: '',
currentOptionText: '',
isDisabled: false,
};
DropdownRow.propTypes = {
currentOptionText: PropTypes.string,
options: PropTypes.array.isRequired,
onSelection: PropTypes.func.isRequired,
dropdownTitle: PropTypes.string.isRequired,
onChangeText: PropTypes.func.isRequired,
placeholder: PropTypes.string,
isDisabled: PropTypes.bool,
};
|
test/test_helper.js | lnrd256/twitter_client | import _$ from 'jquery';
import React from 'react';
import ReactDOM from 'react-dom';
import TestUtils from 'react-addons-test-utils';
import jsdom from 'jsdom';
import chai, { expect } from 'chai';
import chaiJquery from 'chai-jquery';
import { Provider } from 'react-redux';
import { createStore } from 'redux';
import reducers from '../src/reducers';
global.document = jsdom.jsdom('<!doctype html><html><body></body></html>');
global.window = global.document.defaultView;
global.navigator = global.window.navigator;
const $ = _$(window);
chaiJquery(chai, chai.util, $);
function renderComponent(ComponentClass, props = {}, state = {}) {
const componentInstance = TestUtils.renderIntoDocument(
<Provider store={createStore(reducers, state)}>
<ComponentClass {...props} />
</Provider>
);
return $(ReactDOM.findDOMNode(componentInstance));
}
$.fn.simulate = function(eventName, value) {
if (value) {
this.val(value);
}
TestUtils.Simulate[eventName](this[0]);
};
export {renderComponent, expect};
|
app/jsx/assignments_2/teacher/components/Overrides/OverrideSummary.js | djbender/canvas-lms | /*
* Copyright (C) 2018 - present Instructure, Inc.
*
* This file is part of Canvas.
*
* Canvas is free software: you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License as published by the Free
* Software Foundation, version 3 of the License.
*
* Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import React from 'react'
import I18n from 'i18n!assignments_2'
import {OverrideShape} from '../../assignmentData'
import OverrideAttempts from './OverrideAttempts'
import OverrideAssignTo from './OverrideAssignTo'
import OverrideSubmissionTypes from './OverrideSubmissionTypes'
import TeacherViewContext from '../TeacherViewContext'
import AvailabilityDates from '../../../shared/AvailabilityDates'
import FriendlyDatetime from '../../../../shared/FriendlyDatetime'
import {Flex, View, Responsive} from '@instructure/ui-layout'
import {Text} from '@instructure/ui-elements'
export default class OverrideSummary extends React.Component {
static contextType = TeacherViewContext
static propTypes = {
override: OverrideShape
}
renderTitle(override) {
return <Text weight="bold">{override.title}</Text>
}
renderAttemptsAllowedAndSubmissionTypes(override) {
const allowed = override.allowedAttempts
const attempts = Number.isInteger(allowed) ? allowed : 1
return (
<Text>
<OverrideAttempts allowedAttempts={override.allowedAttempts} variant="summary" />
<div style={{display: 'inline-block', padding: '0 .5em'}}>|</div>
<OverrideSubmissionTypes variant="summary" override={override} />
</Text>
)
}
renderDueDate(override) {
return (
<Text color="secondary">
{override.dueAt ? (
<FriendlyDatetime
prefix={I18n.t('Due: ')}
dateTime={override.dueAt}
format={I18n.t('#date.formats.full')}
/>
) : (
I18n.t('No Due Date')
)}
</Text>
)
}
// it's unfortunate but when both unlock and lock dates exist
// AvailabilityDates only prefixes with "Available" if the formatStyle="long"
// If I chnage it there, it will alter the Student view
renderAvailability(override) {
// both dates exist, manually add Available prefix
if (override.unlockAt && override.lockAt) {
return (
<Text color="secondary">
{I18n.t('Available ')}
<AvailabilityDates assignment={override} formatStyle="short" />
</Text>
)
}
// only one date exists, AvailabilityDates will include the Available prefix
if (override.unlockAt || override.lockAt) {
return (
<Text color="secondary">
<AvailabilityDates assignment={override} formatStyle="short" />
</Text>
)
}
// no dates exist, so the assignment is simply Available
return <Text>{I18n.t('Available')}</Text>
}
render() {
const override = this.props.override
if (override) {
return (
<Responsive
match="media"
query={{
largerScreen: {minWidth: '36rem'}
}}
>
{(props, matches) => {
const largerScreen = matches.includes('largerScreen')
const leftColumn = (
<View display="block" margin={largerScreen ? '0' : '0 0 small'}>
<View display="block" margin="0 0 xxx-small">
<OverrideAssignTo override={override} variant="summary" />
</View>
<View display="block">
{this.renderAttemptsAllowedAndSubmissionTypes(override)}
</View>
</View>
)
const rightColumn = (
<View display="block">
<View display="block" margin="0 0 xxx-small">
{this.renderDueDate(override)}
</View>
<View display="block">{this.renderAvailability(override)}</View>
</View>
)
return (
<View as="div" data-testid="OverrideSummary">
{largerScreen ? (
<Flex justifyItems="space-between">
<Flex.Item grow shrink>
{leftColumn}
</Flex.Item>
<Flex.Item textAlign="end">{rightColumn}</Flex.Item>
</Flex>
) : (
<View display="block">
{leftColumn}
{rightColumn}
</View>
)}
</View>
)
}}
</Responsive>
)
} else {
return <View as="div" />
}
}
}
|
examples/react-native/components/Home.js | aksonov/react-native-router-flux | import React from 'react';
import {View, Text, StyleSheet} from 'react-native';
import Button from 'react-native-button';
import {Actions} from 'react-native-router-flux';
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
});
class Home extends React.Component {
render() {
return (
<View style={styles.container}>
<Text>Replace screen</Text>
<Text>Prop from dynamic method: {this.props.homeProp}</Text>
<Button onPress={Actions.pop}>Back</Button>
</View>
);
}
}
module.exports = Home;
|
src/ui/quark/CenteredContent/index.js | jkubos/tickator-ide | import React from 'react'
import classNames from 'classnames'
import styles from './style.less'
export class CenteredContent extends React.Component {
render() {
return <div className={styles.main} onClick={e=>this._onClick(e)}>
{this.props.children}
</div>
}
_onClick(e) {
if (this.props.onClick) {
this.props.onClick(e)
}
}
}
|
project/LearnReact/node_modules/material-ui/svg-icons/av/closed-caption.js | xzzw9987/Memos | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _pure = require('recompose/pure');
var _pure2 = _interopRequireDefault(_pure);
var _SvgIcon = require('../../SvgIcon');
var _SvgIcon2 = _interopRequireDefault(_SvgIcon);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var AvClosedCaption = function AvClosedCaption(props) {
return _react2.default.createElement(
_SvgIcon2.default,
props,
_react2.default.createElement('path', { d: 'M19 4H5c-1.11 0-2 .9-2 2v12c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-8 7H9.5v-.5h-2v3h2V13H11v1c0 .55-.45 1-1 1H7c-.55 0-1-.45-1-1v-4c0-.55.45-1 1-1h3c.55 0 1 .45 1 1v1zm7 0h-1.5v-.5h-2v3h2V13H18v1c0 .55-.45 1-1 1h-3c-.55 0-1-.45-1-1v-4c0-.55.45-1 1-1h3c.55 0 1 .45 1 1v1z' })
);
};
AvClosedCaption = (0, _pure2.default)(AvClosedCaption);
AvClosedCaption.displayName = 'AvClosedCaption';
exports.default = AvClosedCaption; |
ajax/libs/6to5/3.0.0/browser.js | wmkcc/cdnjs | !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.to5=e()}}(function(){var define,module,exports;return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){(function(global){"use strict";var transform=module.exports=require("./transformation/transform");transform.version=require("../../package").version;transform.transform=transform;transform.run=function(code,opts){opts=opts||{};opts.sourceMap="inline";return new Function(transform(code,opts).code)()};transform.load=function(url,callback,opts,hold){opts=opts||{};opts.filename=opts.filename||url;var xhr=global.ActiveXObject?new global.ActiveXObject("Microsoft.XMLHTTP"):new global.XMLHttpRequest;xhr.open("GET",url,true);if("overrideMimeType"in xhr)xhr.overrideMimeType("text/plain");xhr.onreadystatechange=function(){if(xhr.readyState!==4)return;var status=xhr.status;if(status===0||status===200){var param=[xhr.responseText,opts];if(!hold)transform.run.apply(transform,param);if(callback)callback(param)}else{throw new Error("Could not load "+url)}};xhr.send(null)};var runScripts=function(){var scripts=[];var types=["text/ecmascript-6","text/6to5","module"];var index=0;var exec=function(){var param=scripts[index];if(param instanceof Array){transform.run.apply(transform,param);index++;exec()}};var run=function(script,i){var opts={};if(script.src){transform.load(script.src,function(param){scripts[i]=param;exec()},opts,true)}else{opts.filename="embedded";scripts[i]=[script.innerHTML,opts]}};var _scripts=global.document.getElementsByTagName("script");for(var i=0;i<_scripts.length;++i){var _script=_scripts[i];if(types.indexOf(_script.type)>=0)scripts.push(_script)}for(i in scripts){run(scripts[i],i)}exec()};if(global.addEventListener){global.addEventListener("DOMContentLoaded",runScripts,false)}else if(global.attachEvent){global.attachEvent("onload",runScripts)}}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"../../package":193,"./transformation/transform":47}],2:[function(require,module,exports){"use strict";module.exports=File;var SHEBANG_REGEX=/^\#\!.*/;var transform=require("./transformation/transform");var generate=require("./generation/generator");var clone=require("./helpers/clone");var Scope=require("./traverse/scope");var util=require("./util");var t=require("./types");var _=require("lodash");function File(opts){this.dynamicImportIds={};this.dynamicImported=[];this.dynamicImports=[];this.dynamicData={};this.data={};this.lastStatements=[];this.opts=File.normaliseOptions(opts);this.ast={};this.buildTransformers()}File.helpers=["inherits","defaults","prototype-properties","apply-constructor","tagged-template-literal","tagged-template-literal-loose","interop-require","to-array","sliced-to-array","object-without-properties","has-own","slice","bind","define-property","async-to-generator","interop-require-wildcard","typeof","extends","get"];File.validOptions=["filename","filenameRelative","blacklist","whitelist","loose","optional","modules","sourceMap","sourceMapName","sourceFileName","sourceRoot","moduleRoot","moduleIds","comments","reactCompat","keepModuleIdExtensions","code","ast","format","playground","experimental"];File.normaliseOptions=function(opts){opts=clone(opts);for(var key in opts){if(File.validOptions.indexOf(key)<0){throw new ReferenceError("Unknown option: "+key)}}_.defaults(opts,{keepModuleIdExtensions:false,experimental:false,reactCompat:false,playground:false,whitespace:true,moduleIds:false,blacklist:[],whitelist:[],sourceMap:false,optional:[],comments:true,filename:"unknown",modules:"common",loose:[],code:true,ast:true});opts.filename=opts.filename.replace(/\\/g,"/");opts.blacklist=util.arrayify(opts.blacklist);opts.whitelist=util.arrayify(opts.whitelist);opts.optional=util.arrayify(opts.optional);opts.loose=util.arrayify(opts.loose);if(_.contains(opts.loose,"all")){opts.loose=Object.keys(transform.transformers)}_.defaults(opts,{moduleRoot:opts.sourceRoot});_.defaults(opts,{sourceRoot:opts.moduleRoot});_.defaults(opts,{filenameRelative:opts.filename});_.defaults(opts,{sourceFileName:opts.filenameRelative,sourceMapName:opts.filenameRelative});if(opts.playground){opts.experimental=true}opts.blacklist=transform._ensureTransformerNames("blacklist",opts.blacklist);opts.whitelist=transform._ensureTransformerNames("whitelist",opts.whitelist);opts.optional=transform._ensureTransformerNames("optional",opts.optional);opts.loose=transform._ensureTransformerNames("loose",opts.loose);return opts};File.prototype.isLoose=function(key){return _.contains(this.opts.loose,key)};File.prototype.buildTransformers=function(){var file=this;var transformers={};var secondaryStack=[];var stack=[];_.each(transform.transformers,function(transformer,key){var pass=transformers[key]=transformer.buildPass(file);if(pass.canRun(file)){stack.push(pass);if(transformer.secondPass){secondaryStack.push(pass)}if(transformer.manipulateOptions){transformer.manipulateOptions(file.opts,file)}}});this.transformerStack=stack.concat(secondaryStack);this.transformers=transformers};File.prototype.toArray=function(node,i){if(t.isArrayExpression(node)){return node}else if(t.isIdentifier(node)&&node.name==="arguments"){return t.callExpression(t.memberExpression(this.addHelper("slice"),t.identifier("call")),[node])}else{var declarationName="to-array";var args=[node];if(i){args.push(t.literal(i));declarationName="sliced-to-array"}return t.callExpression(this.addHelper(declarationName),args)}};File.prototype.getModuleFormatter=function(type){var ModuleFormatter=_.isFunction(type)?type:transform.moduleFormatters[type];if(!ModuleFormatter){var loc=util.resolve(type);if(loc)ModuleFormatter=require(loc)}if(!ModuleFormatter){throw new ReferenceError("Unknown module formatter type "+JSON.stringify(type))}return new ModuleFormatter(this)};File.prototype.parseShebang=function(code){var shebangMatch=code.match(SHEBANG_REGEX);if(shebangMatch){this.shebang=shebangMatch[0];code=code.replace(SHEBANG_REGEX,"")}return code};File.prototype.set=function(key,val){return this.data[key]=val};File.prototype.setDynamic=function(key,fn){this.dynamicData[key]=fn};File.prototype.get=function(key){var data=this.data[key];if(data){return data}else{var dynamic=this.dynamicData[key];if(dynamic){return this.set(key,dynamic())}}};File.prototype.addImport=function(source,name){name=name||source;var id=this.dynamicImportIds[name];if(!id){id=this.dynamicImportIds[name]=this.generateUidIdentifier(name);var specifiers=[t.importSpecifier(t.identifier("default"),id)];var declar=t.importDeclaration(specifiers,t.literal(source));declar._blockHoist=3;this.dynamicImported.push(declar);this.moduleFormatter.importSpecifier(specifiers[0],declar,this.dynamicImports)}return id};File.prototype.isConsequenceExpressionStatement=function(node){return t.isExpressionStatement(node)&&this.lastStatements.indexOf(node)>=0};File.prototype.addHelper=function(name){if(!_.contains(File.helpers,name)){throw new ReferenceError("unknown declaration "+name)}var program=this.ast.program;var declar=program._declarations&&program._declarations[name];if(declar)return declar.id;var runtime=this.get("runtimeIdentifier");if(runtime){name=t.identifier(t.toIdentifier(name));return t.memberExpression(runtime,name)}else{var ref=util.template(name);ref._compact=true;var uid=this.generateUidIdentifier(name);this.scope.push({key:name,id:uid,init:ref});return uid}};File.prototype.errorWithNode=function(node,msg,Error){Error=Error||SyntaxError;var loc=node.loc.start;var err=new Error("Line "+loc.line+": "+msg);err.loc=loc;return err};File.prototype.addCode=function(code){code=(code||"")+"";this.code=code;return this.parseShebang(code)};File.prototype.parse=function(code){var self=this;code=this.addCode(code);var opts=this.opts;opts.allowImportExportEverywhere=this.isLoose("modules");return util.parse(opts,code,function(tree){self.transform(tree);return self.generate()})};File.prototype.transform=function(ast){var self=this;this.ast=ast;this.lastStatements=t.getLastStatements(ast.program);this.scope=new Scope(ast.program,null,this);this.moduleFormatter=this.getModuleFormatter(this.opts.modules);var astRun=function(key){_.each(self.transformerStack,function(pass){pass.astRun(key)})};astRun("enter");_.each(this.transformerStack,function(pass){pass.transform()});astRun("exit")};File.prototype.generate=function(){var opts=this.opts;var ast=this.ast;var result={code:"",opts:opts,map:null,ast:null};if(opts.ast)result.ast=ast;if(!opts.code)return result;var _result=generate(ast,opts,this.code);result.code=_result.code;result.map=_result.map;if(this.shebang){result.code=this.shebang+"\n"+result.code}if(opts.sourceMap==="inline"){result.code+="\n"+util.sourceMapToComment(result.map)}return result};File.prototype.generateUid=function(name,scope){name=t.toIdentifier(name).replace(/^_+/,"");scope=scope||this.scope;var uid;var i=0;do{uid=this._generateUid(name,i);i++}while(scope.has(uid));return uid};File.prototype.generateUidIdentifier=function(name,scope){scope=scope||this.scope;var id=t.identifier(this.generateUid(name,scope));scope.add(id);return id};File.prototype._generateUid=function(name,i){var id=name;if(i>1)id+=i;return"_"+id}},{"./generation/generator":4,"./helpers/clone":23,"./transformation/transform":47,"./traverse/scope":98,"./types":101,"./util":104,lodash:164}],3:[function(require,module,exports){"use strict";module.exports=Buffer;var util=require("../util");var _=require("lodash");function Buffer(position,format){this.position=position;this._indent=format.indent.base;this.format=format;this.buf=""}Buffer.prototype.get=function(){return util.trimRight(this.buf)};Buffer.prototype.getIndent=function(){if(this.format.compact){return""}else{return util.repeat(this._indent,this.format.indent.style)}};Buffer.prototype.indentSize=function(){return this.getIndent().length};Buffer.prototype.indent=function(){this._indent++};Buffer.prototype.dedent=function(){this._indent--};Buffer.prototype.semicolon=function(){this.push(";")};Buffer.prototype.ensureSemicolon=function(){if(!this.isLast(";"))this.semicolon()};Buffer.prototype.rightBrace=function(){this.newline(true);this.push("}")};Buffer.prototype.keyword=function(name){this.push(name);this.push(" ")};Buffer.prototype.space=function(){if(this.buf&&!this.isLast([" ","\n"])){this.push(" ")}};Buffer.prototype.removeLast=function(cha){if(!this.isLast(cha))return;this.buf=this.buf.substr(0,this.buf.length-1);this.position.unshift(cha)};Buffer.prototype.newline=function(i,removeLast){if(this.format.compact){this.space();return}removeLast=removeLast||false;if(_.isNumber(i)){if(this.endsWith("{\n"))i--;if(this.endsWith(util.repeat(i,"\n")))return;while(i--){this._newline(removeLast)}return}if(_.isBoolean(i)){removeLast=i}this._newline(removeLast)};Buffer.prototype._newline=function(removeLast){if(removeLast&&this.isLast("\n"))this.removeLast("\n");this.removeLast(" ");this._removeSpacesAfterLastNewline();this._push("\n")};Buffer.prototype._removeSpacesAfterLastNewline=function(){var lastNewlineIndex=this.buf.lastIndexOf("\n");if(lastNewlineIndex===-1)return;var index=this.buf.length-1;while(index>lastNewlineIndex){if(this.buf[index]!==" "){break}index--}if(index===lastNewlineIndex){this.buf=this.buf.substring(0,index+1)}};Buffer.prototype.push=function(str,noIndent){if(this._indent&&!noIndent&&str!=="\n"){var indent=this.getIndent();str=str.replace(/\n/g,"\n"+indent);if(this.isLast("\n"))str=indent+str}this._push(str)};Buffer.prototype._push=function(str){this.position.push(str);this.buf+=str};Buffer.prototype.endsWith=function(str){var d=this.buf.length-str.length;return d>=0&&this.buf.lastIndexOf(str)===d};Buffer.prototype.isLast=function(cha,trimRight){var buf=this.buf;if(trimRight)buf=util.trimRight(buf);var last=buf[buf.length-1];if(Array.isArray(cha)){return _.contains(cha,last)}else{return cha===last}}},{"../util":104,lodash:164}],4:[function(require,module,exports){"use strict";module.exports=function(ast,opts,code){var gen=new CodeGenerator(ast,opts,code);return gen.generate()};module.exports.CodeGenerator=CodeGenerator;var detectIndent=require("detect-indent");var Whitespace=require("./whitespace");var SourceMap=require("./source-map");var Position=require("./position");var Buffer=require("./buffer");var util=require("../util");var n=require("./node");var t=require("../types");var _=require("lodash");function CodeGenerator(ast,opts,code){opts=opts||{};this.comments=ast.comments||[];this.tokens=ast.tokens||[];this.format=CodeGenerator.normaliseOptions(code,opts);this.ast=ast;this.whitespace=new Whitespace(this.tokens,this.comments);this.position=new Position;this.map=new SourceMap(this.position,opts,code);this.buffer=new Buffer(this.position,this.format)}_.each(Buffer.prototype,function(fn,key){CodeGenerator.prototype[key]=function(){return fn.apply(this.buffer,arguments)}});CodeGenerator.normaliseOptions=function(code,opts){var indent=detectIndent(code);var style=indent.indent;if(!style||style===" ")style=" ";return _.merge({parentheses:true,comments:opts.comments==null||opts.comments,compact:false,indent:{adjustMultilineComment:true,style:style,base:0}},opts.format||{})};CodeGenerator.generators={templateLiterals:require("./generators/template-literals"),comprehensions:require("./generators/comprehensions"),expressions:require("./generators/expressions"),statements:require("./generators/statements"),playground:require("./generators/playground"),classes:require("./generators/classes"),methods:require("./generators/methods"),modules:require("./generators/modules"),types:require("./generators/types"),flow:require("./generators/flow"),base:require("./generators/base"),jsx:require("./generators/jsx")};_.each(CodeGenerator.generators,function(generator){_.extend(CodeGenerator.prototype,generator)});CodeGenerator.prototype.generate=function(){var ast=this.ast;this.print(ast);var comments=[];_.each(ast.comments,function(comment){if(!comment._displayed)comments.push(comment)});this._printComments(comments);return{map:this.map.get(),code:this.buffer.get()}};CodeGenerator.prototype.buildPrint=function(parent){var self=this;var print=function(node,opts){return self.print(node,parent,opts)};print.sequence=function(nodes,opts){opts=opts||{};opts.statement=true;return self.printJoin(print,nodes,opts)};print.join=function(nodes,opts){return self.printJoin(print,nodes,opts)};print.block=function(node){return self.printBlock(print,node)};print.indentOnComments=function(node){return self.printAndIndentOnComments(print,node)};return print};CodeGenerator.prototype.print=function(node,parent,opts){if(!node)return"";if(parent&&parent._compact){node._compact=true}var oldCompact=this.format.compact;if(node._compact){this.format.compact=true}var self=this;opts=opts||{};var newline=function(leading){if(!opts.statement&&!n.isUserWhitespacable(node,parent)){return}var lines=0;if(node.start!=null&&!node._ignoreUserWhitespace){if(leading){lines=self.whitespace.getNewlinesBefore(node)}else{lines=self.whitespace.getNewlinesAfter(node)}}else{if(!leading)lines++;var needs=n.needsWhitespaceAfter;if(leading)needs=n.needsWhitespaceBefore;lines+=needs(node,parent);if(!self.buffer.get())lines=0}self.newline(lines)};if(this[node.type]){var needsNoLineTermParens=n.needsParensNoLineTerminator(node,parent);var needsParens=needsNoLineTermParens||n.needsParens(node,parent);if(needsParens)this.push("(");if(needsNoLineTermParens)this.indent();this.printLeadingComments(node,parent);newline(true);if(opts.before)opts.before();this.map.mark(node,"start");this[node.type](node,this.buildPrint(node),parent);if(needsNoLineTermParens){this.newline();this.dedent()}if(needsParens)this.push(")");this.map.mark(node,"end");if(opts.after)opts.after();newline(false);this.printTrailingComments(node,parent)}else{throw new ReferenceError("unknown node of type "+JSON.stringify(node.type)+" with constructor "+JSON.stringify(node&&node.constructor.name))}this.format.compact=oldCompact};CodeGenerator.prototype.printJoin=function(print,nodes,opts){if(!nodes||!nodes.length)return;opts=opts||{};var self=this;var len=nodes.length;if(opts.indent)self.indent();_.each(nodes,function(node,i){print(node,{statement:opts.statement,after:function(){if(opts.iterator){opts.iterator(node,i)}if(opts.separator&&i<len-1){self.push(opts.separator)}}})});if(opts.indent)self.dedent()};CodeGenerator.prototype.printAndIndentOnComments=function(print,node){var indent=!!node.leadingComments;if(indent)this.indent();print(node);if(indent)this.dedent()};CodeGenerator.prototype.printBlock=function(print,node){if(t.isEmptyStatement(node)){this.semicolon()}else{this.push(" ");print(node)}};CodeGenerator.prototype.generateComment=function(comment){var val=comment.value;if(comment.type==="Line"){val="//"+val}else{val="/*"+val+"*/"}return val};CodeGenerator.prototype.printTrailingComments=function(node,parent){this._printComments(this.getComments("trailingComments",node,parent))};CodeGenerator.prototype.printLeadingComments=function(node,parent){this._printComments(this.getComments("leadingComments",node,parent))};CodeGenerator.prototype.getComments=function(key,node,parent){if(t.isExpressionStatement(parent)){return[]}var comments=[];var nodes=[node];var self=this;if(t.isExpressionStatement(node)){nodes.push(node.argument)}_.each(nodes,function(node){comments=comments.concat(self._getComments(key,node))});return comments};CodeGenerator.prototype._getComments=function(key,node){return node&&node[key]||[]};CodeGenerator.prototype._printComments=function(comments){if(this.format.compact)return;if(!this.format.comments)return;if(!comments||!comments.length)return;var self=this;_.each(comments,function(comment){var skip=false;_.each(self.ast.comments,function(origComment){if(origComment.start===comment.start){if(origComment._displayed)skip=true;origComment._displayed=true;return false}});if(skip)return;self.newline(self.whitespace.getNewlinesBefore(comment));var column=self.position.column;var val=self.generateComment(comment);if(column&&!self.isLast(["\n"," ","[","{"])){self._push(" ");column++}if(comment.type==="Block"&&self.format.indent.adjustMultilineComment){var offset=comment.loc.start.column;if(offset){var newlineRegex=new RegExp("\\n\\s{1,"+offset+"}","g");val=val.replace(newlineRegex,"\n")}var indent=Math.max(self.indentSize(),column);val=val.replace(/\n/g,"\n"+util.repeat(indent))}if(column===0){val=self.getIndent()+val}self._push(val);self.newline(self.whitespace.getNewlinesAfter(comment))})}},{"../types":101,"../util":104,"./buffer":3,"./generators/base":5,"./generators/classes":6,"./generators/comprehensions":7,"./generators/expressions":8,"./generators/flow":9,"./generators/jsx":10,"./generators/methods":11,"./generators/modules":12,"./generators/playground":13,"./generators/statements":14,"./generators/template-literals":15,"./generators/types":16,"./node":17,"./position":20,"./source-map":21,"./whitespace":22,"detect-indent":155,lodash:164}],5:[function(require,module,exports){"use strict";exports.File=function(node,print){print(node.program)};exports.Program=function(node,print){print.sequence(node.body)};exports.BlockStatement=function(node,print){if(node.body.length===0){this.push("{}")}else{this.push("{");this.newline();print.sequence(node.body,{indent:true});this.removeLast("\n");this.rightBrace()}}},{}],6:[function(require,module,exports){"use strict";exports.ClassExpression=exports.ClassDeclaration=function(node,print){this.push("class");if(node.id){this.space();print(node.id)}if(node.superClass){this.push(" extends ");print(node.superClass)}this.space();print(node.body)};exports.ClassBody=function(node,print){if(node.body.length===0){this.push("{}")}else{this.push("{");this.newline();this.indent();print.sequence(node.body);this.dedent();this.rightBrace()}};exports.MethodDefinition=function(node,print){if(node.static){this.push("static ")}this._method(node,print)}},{}],7:[function(require,module,exports){"use strict";exports.ComprehensionBlock=function(node,print){this.keyword("for");this.push("(");print(node.left);this.push(" of ");print(node.right);this.push(")")};exports.ComprehensionExpression=function(node,print){this.push(node.generator?"(":"[");print.join(node.blocks,{separator:" "});this.space();if(node.filter){this.keyword("if");this.push("(");print(node.filter);this.push(")");this.space()}print(node.body);this.push(node.generator?")":"]")}},{}],8:[function(require,module,exports){"use strict";var util=require("../../util");var t=require("../../types");var _=require("lodash");exports.UnaryExpression=function(node,print){var hasSpace=/[a-z]$/.test(node.operator);var arg=node.argument;if(t.isUpdateExpression(arg)||t.isUnaryExpression(arg)){hasSpace=true}if(t.isUnaryExpression(arg)&&arg.operator==="!"){hasSpace=false}this.push(node.operator);if(hasSpace)this.space();print(node.argument)};exports.UpdateExpression=function(node,print){if(node.prefix){this.push(node.operator);print(node.argument)}else{print(node.argument);this.push(node.operator)}};exports.ConditionalExpression=function(node,print){print(node.test);this.push(" ? ");print(node.consequent);this.push(" : ");print(node.alternate)};exports.NewExpression=function(node,print){this.push("new ");print(node.callee);if(node.arguments.length||this.format.parentheses){this.push("(");print.join(node.arguments,{separator:", "});this.push(")")}};exports.SequenceExpression=function(node,print){print.join(node.expressions,{separator:", "})};exports.ThisExpression=function(){this.push("this")};exports.CallExpression=function(node,print){print(node.callee);this.push("(");var separator=",";if(node._prettyCall){separator+="\n";this.newline();this.indent()}else{separator+=" "}print.join(node.arguments,{separator:separator});if(node._prettyCall){this.newline();this.dedent()}this.push(")")};var buildYieldAwait=function(keyword){return function(node,print){this.push(keyword);if(node.delegate)this.push("*");if(node.argument){this.space();print(node.argument)}}};exports.YieldExpression=buildYieldAwait("yield");exports.AwaitExpression=buildYieldAwait("await");exports.EmptyStatement=function(){this.semicolon()};exports.ExpressionStatement=function(node,print){print(node.expression);this.semicolon()};exports.BinaryExpression=exports.LogicalExpression=exports.AssignmentPattern=exports.AssignmentExpression=function(node,print){print(node.left);this.space();this.push(node.operator);this.space();print(node.right)};var SCIENTIFIC_NOTATION=/e/i;exports.MemberExpression=function(node,print){var obj=node.object;print(obj);if(!node.computed&&t.isMemberExpression(node.property)){throw new TypeError("Got a MemberExpression for MemberExpression property")}var computed=node.computed;if(t.isLiteral(node.property)&&_.isNumber(node.property.value)){computed=true}if(computed){this.push("[");print(node.property);this.push("]")}else{if(t.isLiteral(obj)&&util.isInteger(obj.value)&&!SCIENTIFIC_NOTATION.test(obj.value.toString())){this.push(".")}this.push(".");print(node.property)}}},{"../../types":101,"../../util":104,lodash:164}],9:[function(require,module,exports){"use strict";exports.AnyTypeAnnotation=exports.ArrayTypeAnnotation=exports.BooleanTypeAnnotation=exports.ClassProperty=exports.DeclareClass=exports.DeclareFunction=exports.DeclareModule=exports.DeclareVariable=exports.FunctionTypeAnnotation=exports.FunctionTypeParam=exports.GenericTypeAnnotation=exports.InterfaceExtends=exports.InterfaceDeclaration=exports.IntersectionTypeAnnotation=exports.NullableTypeAnnotation=exports.NumberTypeAnnotation=exports.StringLiteralTypeAnnotation=exports.StringTypeAnnotation=exports.TupleTypeAnnotation=exports.TypeofTypeAnnotation=exports.TypeAlias=exports.TypeAnnotation=exports.TypeParameterDeclaration=exports.TypeParameterInstantiation=exports.ObjectTypeAnnotation=exports.ObjectTypeCallProperty=exports.ObjectTypeIndexer=exports.ObjectTypeProperty=exports.QualifiedTypeIdentifier=exports.UnionTypeAnnotation=exports.VoidTypeAnnotation=function(){}},{}],10:[function(require,module,exports){"use strict";var t=require("../../types");var _=require("lodash");exports.JSXAttribute=function(node,print){print(node.name);if(node.value){this.push("=");print(node.value)}};exports.JSXIdentifier=function(node){this.push(node.name)};exports.JSXNamespacedName=function(node,print){print(node.namespace);this.push(":");print(node.name)};exports.JSXMemberExpression=function(node,print){print(node.object);this.push(".");print(node.property)};exports.JSXSpreadAttribute=function(node,print){this.push("{...");print(node.argument);this.push("}")};exports.JSXExpressionContainer=function(node,print){this.push("{");print(node.expression);this.push("}")};exports.JSXElement=function(node,print){var self=this;var open=node.openingElement;print(open);if(open.selfClosing)return;this.indent();_.each(node.children,function(child){if(t.isLiteral(child)){self.push(child.value)}else{print(child)}});this.dedent();print(node.closingElement)};exports.JSXOpeningElement=function(node,print){this.push("<");print(node.name);if(node.attributes.length>0){this.push(" ");print.join(node.attributes,{separator:" "})}this.push(node.selfClosing?" />":">")};exports.JSXClosingElement=function(node,print){this.push("</");print(node.name);this.push(">")};exports.JSXEmptyExpression=function(){}},{"../../types":101,lodash:164}],11:[function(require,module,exports){"use strict";var t=require("../../types");exports._params=function(node,print){this.push("(");print.join(node.params,{separator:", "});this.push(")")};exports._method=function(node,print){var value=node.value;var kind=node.kind;var key=node.key;if(!kind||kind==="init"){if(value.generator){this.push("*")}}else{this.push(kind+" ")}if(value.async)this.push("async ");if(node.computed){this.push("[");print(key);this.push("]")}else{print(key)}this._params(value,print);this.push(" ");print(value.body)};exports.FunctionDeclaration=exports.FunctionExpression=function(node,print){if(node.async)this.push("async ");this.push("function");if(node.generator)this.push("*");this.push(" ");if(node.id){this.space();print(node.id)}this._params(node,print);this.space();print(node.body)};exports.ArrowFunctionExpression=function(node,print){if(node.async)this.push("async ");if(node.params.length===1&&t.isIdentifier(node.params[0])){print(node.params[0])}else{this._params(node,print)}this.push(" => ");print(node.body)}},{"../../types":101}],12:[function(require,module,exports){"use strict";var t=require("../../types");var _=require("lodash");exports.ImportSpecifier=function(node,print){if(t.isSpecifierDefault(node)){print(t.getSpecifierName(node))}else{return exports.ExportSpecifier.apply(this,arguments)}};exports.ExportSpecifier=function(node,print){print(node.id);if(node.name){this.push(" as ");print(node.name)}};exports.ExportBatchSpecifier=function(){this.push("*")};exports.ExportDeclaration=function(node,print){this.push("export ");var specifiers=node.specifiers;if(node.default){this.push("default ")}if(node.declaration){print(node.declaration);if(t.isStatement(node.declaration))return}else{if(specifiers.length===1&&t.isExportBatchSpecifier(specifiers[0])){print(specifiers[0])}else{this.push("{");if(specifiers.length){this.space();print.join(specifiers,{separator:", "});this.space()}this.push("}")}if(node.source){this.push(" from ");print(node.source)}}this.ensureSemicolon()};exports.ImportDeclaration=function(node,print){var self=this;this.push("import ");var specfiers=node.specifiers;if(specfiers&&specfiers.length){var foundImportSpecifier=false;_.each(node.specifiers,function(spec,i){if(+i>0){self.push(", ")}var isDefault=t.isSpecifierDefault(spec);if(!isDefault&&spec.type!=="ImportBatchSpecifier"&&!foundImportSpecifier){foundImportSpecifier=true;self.push("{ ")}print(spec)});if(foundImportSpecifier){this.push(" }")}this.push(" from ")}print(node.source);this.semicolon()};exports.ImportBatchSpecifier=function(node,print){this.push("* as ");print(node.name)}},{"../../types":101,lodash:164}],13:[function(require,module,exports){"use strict";var _=require("lodash");_.each(["BindMemberExpression","BindFunctionExpression"],function(type){exports[type]=function(){throw new ReferenceError("Trying to render non-standard playground node "+JSON.stringify(type))}})},{lodash:164}],14:[function(require,module,exports){"use strict";var util=require("../../util");var t=require("../../types");exports.WithStatement=function(node,print){this.keyword("with");this.push("(");print(node.object);this.push(")");print.block(node.body)};exports.IfStatement=function(node,print){this.keyword("if");this.push("(");print(node.test);this.push(")");this.space();print.indentOnComments(node.consequent);if(node.alternate){if(this.isLast("}"))this.push(" ");this.keyword("else");print.indentOnComments(node.alternate)}};exports.ForStatement=function(node,print){this.keyword("for");this.push("(");print(node.init);this.push(";");if(node.test){this.push(" ");print(node.test)}this.push(";");if(node.update){this.push(" ");print(node.update)}this.push(")");print.block(node.body)};exports.WhileStatement=function(node,print){this.keyword("while");this.push("(");print(node.test);this.push(")");print.block(node.body)};var buildForXStatement=function(op){return function(node,print){this.keyword("for");this.push("(");print(node.left);this.push(" "+op+" ");print(node.right);this.push(")");print.block(node.body)}};exports.ForInStatement=buildForXStatement("in");exports.ForOfStatement=buildForXStatement("of");exports.DoWhileStatement=function(node,print){this.keyword("do");print(node.body);this.space();this.keyword("while");this.push("(");print(node.test);this.push(");")};var buildLabelStatement=function(prefix,key){return function(node,print){this.push(prefix);var label=node[key||"label"];if(label){this.push(" ");print(label)}this.semicolon()}};exports.ContinueStatement=buildLabelStatement("continue");exports.ReturnStatement=buildLabelStatement("return","argument");exports.BreakStatement=buildLabelStatement("break");exports.LabeledStatement=function(node,print){print(node.label);this.push(": ");print(node.body)};exports.TryStatement=function(node,print){this.keyword("try");print(node.block);this.space();if(node.handlers){print(node.handlers[0])}else{print(node.handler)}if(node.finalizer){this.space();this.push("finally ");print(node.finalizer)}};exports.CatchClause=function(node,print){this.keyword("catch");this.push("(");print(node.param);this.push(") ");print(node.body)};exports.ThrowStatement=function(node,print){this.push("throw ");print(node.argument);this.semicolon()};exports.SwitchStatement=function(node,print){this.keyword("switch");this.push("(");print(node.discriminant);this.push(")");this.space();this.push("{");print.sequence(node.cases,{indent:true});this.push("}")};exports.SwitchCase=function(node,print){if(node.test){this.push("case ");print(node.test);this.push(":")}else{this.push("default:")}this.newline();print.sequence(node.consequent,{indent:true})};exports.DebuggerStatement=function(){this.push("debugger;")};exports.VariableDeclaration=function(node,print,parent){this.push(node.kind+" ");var hasInits=false;if(!t.isFor(parent)){for(var i=0;i<node.declarations.length;i++){if(node.declarations[i].init){hasInits=true}}}var sep=",";if(hasInits){sep+="\n"+util.repeat(node.kind.length+1)}else{sep+=" "}print.join(node.declarations,{separator:sep});
if(!t.isFor(parent)){this.semicolon()}};exports.PrivateDeclaration=function(node,print){this.push("private ");print.join(node.declarations,{separator:", "});this.semicolon()};exports.VariableDeclarator=function(node,print){if(node.init){print(node.id);this.space();this.push("=");this.space();print(node.init)}else{print(node.id)}}},{"../../types":101,"../../util":104}],15:[function(require,module,exports){"use strict";var _=require("lodash");exports.TaggedTemplateExpression=function(node,print){print(node.tag);print(node.quasi)};exports.TemplateElement=function(node){this._push(node.value.raw)};exports.TemplateLiteral=function(node,print){this.push("`");var quasis=node.quasis;var self=this;var len=quasis.length;_.each(quasis,function(quasi,i){print(quasi);if(i+1<len){self.push("${ ");print(node.expressions[i]);self.push(" }")}});this._push("`")}},{lodash:164}],16:[function(require,module,exports){"use strict";var _=require("lodash");exports.Identifier=function(node){this.push(node.name)};exports.RestElement=exports.SpreadElement=exports.SpreadProperty=function(node,print){this.push("...");print(node.argument)};exports.VirtualPropertyExpression=function(node,print){print(node.object);this.push("::");print(node.property)};exports.ObjectExpression=exports.ObjectPattern=function(node,print){var props=node.properties;if(props.length){this.push("{");this.space();print.join(props,{separator:", ",indent:true});this.space();this.push("}")}else{this.push("{}")}};exports.Property=function(node,print){if(node.method||node.kind==="get"||node.kind==="set"){this._method(node,print)}else{if(node.computed){this.push("[");print(node.key);this.push("]")}else{print(node.key);if(node.shorthand)return}this.push(": ");print(node.value)}};exports.ArrayExpression=exports.ArrayPattern=function(node,print){var elems=node.elements;var self=this;var len=elems.length;this.push("[");_.each(elems,function(elem,i){if(!elem){self.push(",")}else{if(i>0)self.push(" ");print(elem);if(i<len-1)self.push(",")}});this.push("]")};exports.Literal=function(node){var val=node.value;var type=typeof val;if(type==="string"){val=JSON.stringify(val);val=val.replace(/[\u000A\u000D\u2028\u2029]/g,function(c){return"\\u"+("0000"+c.charCodeAt(0).toString(16)).slice(-4)});this.push(val)}else if(type==="boolean"||type==="number"){this.push(JSON.stringify(val))}else if(node.regex){this.push("/"+node.regex.pattern+"/"+node.regex.flags)}else if(val===null){this.push("null")}}},{lodash:164}],17:[function(require,module,exports){"use strict";module.exports=Node;var whitespace=require("./whitespace");var parens=require("./parentheses");var t=require("../../types");var _=require("lodash");var find=function(obj,node,parent){if(!obj)return;var result;var types=Object.keys(obj);for(var i=0;i<types.length;i++){var type=types[i];if(t.is(type,node)){var fn=obj[type];result=fn(node,parent);if(result!=null)break}}return result};function Node(node,parent){this.parent=parent;this.node=node}Node.isUserWhitespacable=function(node){return t.isUserWhitespacable(node)};Node.needsWhitespace=function(node,parent,type){if(!node)return 0;if(t.isExpressionStatement(node)){node=node.expression}var lines=find(whitespace[type].nodes,node,parent);if(lines)return lines;_.each(find(whitespace[type].list,node,parent),function(expr){lines=Node.needsWhitespace(expr,node,type);if(lines)return false});return lines||0};Node.needsWhitespaceBefore=function(node,parent){return Node.needsWhitespace(node,parent,"before")};Node.needsWhitespaceAfter=function(node,parent){return Node.needsWhitespace(node,parent,"after")};Node.needsParens=function(node,parent){if(!parent)return false;if(t.isNewExpression(parent)&&parent.callee===node){if(t.isCallExpression(node))return true;var hasCall=_.some(node,function(val){return t.isCallExpression(val)});if(hasCall)return true}return find(parens,node,parent)};Node.needsParensNoLineTerminator=function(node,parent){if(!parent)return false;if(!node.leadingComments||!node.leadingComments.length){return false}if(t.isYieldExpression(parent)||t.isAwaitExpression(parent)){return true}if(t.isContinueStatement(parent)||t.isBreakStatement(parent)||t.isReturnStatement(parent)||t.isThrowStatement(parent)){return true}return false};_.each(Node,function(fn,key){Node.prototype[key]=function(){var args=new Array(arguments.length+2);args[0]=this.node;args[1]=this.parent;for(var i=0;i<args.length;i++){args[i+2]=arguments[i]}return Node[key].apply(null,args)}})},{"../../types":101,"./parentheses":18,"./whitespace":19,lodash:164}],18:[function(require,module,exports){"use strict";var t=require("../../types");var _=require("lodash");var PRECEDENCE={};_.each([["||"],["&&"],["|"],["^"],["&"],["==","===","!=","!=="],["<",">","<=",">=","in","instanceof"],[">>","<<",">>>"],["+","-"],["*","/","%"],["**"]],function(tier,i){_.each(tier,function(op){PRECEDENCE[op]=i})});exports.UpdateExpression=function(node,parent){if(t.isMemberExpression(parent)&&parent.object===node){return true}};exports.ObjectExpression=function(node,parent){if(t.isExpressionStatement(parent)){return true}if(t.isMemberExpression(parent)&&parent.object===node){return true}return false};exports.Binary=function(node,parent){if((t.isCallExpression(parent)||t.isNewExpression(parent))&&parent.callee===node){return true}if(t.isUnaryLike(parent)){return true}if(t.isMemberExpression(parent)&&parent.object===node){return true}if(t.isBinary(parent)){var parentOp=parent.operator;var parentPos=PRECEDENCE[parentOp];var nodeOp=node.operator;var nodePos=PRECEDENCE[nodeOp];if(parentPos>nodePos){return true}if(parentPos===nodePos&&parent.right===node){return true}}};exports.BinaryExpression=function(node,parent){if(node.operator==="in"){if(t.isVariableDeclarator(parent)){return true}if(t.isFor(parent)){return true}}};exports.SequenceExpression=function(node,parent){if(t.isForStatement(parent)){return false}if(t.isExpressionStatement(parent)&&parent.expression===node){return false}return true};exports.YieldExpression=function(node,parent){return t.isBinary(parent)||t.isUnaryLike(parent)||t.isCallExpression(parent)||t.isMemberExpression(parent)||t.isNewExpression(parent)||t.isConditionalExpression(parent)||t.isYieldExpression(parent)};exports.ClassExpression=function(node,parent){return t.isExpressionStatement(parent)};exports.UnaryLike=function(node,parent){return t.isMemberExpression(parent)&&parent.object===node};exports.FunctionExpression=function(node,parent){if(t.isExpressionStatement(parent)){return true}if(t.isMemberExpression(parent)&&parent.object===node){return true}if(t.isCallExpression(parent)&&parent.callee===node){return true}};exports.AssignmentExpression=exports.ConditionalExpression=function(node,parent){if(t.isUnaryLike(parent)){return true}if(t.isBinary(parent)){return true}if(t.isCallExpression(parent)||t.isNewExpression(parent)){if(parent.callee===node){return true}}if(t.isConditionalExpression(parent)&&parent.test===node){return true}if(t.isMemberExpression(parent)&&parent.object===node){return true}return false}},{"../../types":101,lodash:164}],19:[function(require,module,exports){"use strict";var _=require("lodash");var t=require("../../types");exports.before={nodes:{Property:function(node,parent){if(parent.properties[0]===node){return 1}},SpreadProperty:function(node,parent){return exports.before.nodes.Property(node,parent)},SwitchCase:function(node,parent){if(parent.cases[0]===node){return 1}},CallExpression:function(node){if(t.isFunction(node.callee)){return 1}}}};exports.after={nodes:{AssignmentExpression:function(node){if(t.isFunction(node.right)){return 1}}},list:{VariableDeclaration:function(node){return _.map(node.declarations,"init")},ArrayExpression:function(node){return node.elements},ObjectExpression:function(node){return node.properties}}};_.each({Function:1,Class:1,For:1,ArrayExpression:{after:1},ObjectExpression:{after:1},SwitchStatement:1,IfStatement:{before:1},CallExpression:{after:1},Literal:{after:1}},function(amounts,type){if(_.isNumber(amounts)){amounts={after:amounts,before:amounts}}_.each([type].concat(t.FLIPPED_ALIAS_KEYS[type]||[]),function(type){_.each(amounts,function(amount,key){exports[key].nodes[type]=function(){return amount}})})})},{"../../types":101,lodash:164}],20:[function(require,module,exports){"use strict";module.exports=Position;function Position(){this.line=1;this.column=0}Position.prototype.push=function(str){for(var i=0;i<str.length;i++){if(str[i]==="\n"){this.line++;this.column=0}else{this.column++}}};Position.prototype.unshift=function(str){for(var i=0;i<str.length;i++){if(str[i]==="\n"){this.line--}else{this.column--}}}},{}],21:[function(require,module,exports){"use strict";module.exports=SourceMap;var sourceMap=require("source-map");var t=require("../types");function SourceMap(position,opts,code){this.position=position;this.opts=opts;if(opts.sourceMap){this.map=new sourceMap.SourceMapGenerator({file:opts.sourceMapName,sourceRoot:opts.sourceRoot});this.map.setSourceContent(opts.sourceFileName,code)}else{this.map=null}}SourceMap.prototype.get=function(){var map=this.map;if(map){return map.toJSON()}else{return map}};SourceMap.prototype.mark=function(node,type){var loc=node.loc;if(!loc)return;var map=this.map;if(!map)return;if(t.isProgram(node)||t.isFile(node))return;var position=this.position;var generated={line:position.line,column:position.column};var original=loc[type];if(generated.line===original.line&&generated.column===original.column)return;map.addMapping({source:this.opts.sourceFileName,generated:generated,original:original})}},{"../types":101,"source-map":181}],22:[function(require,module,exports){"use strict";module.exports=Whitespace;var _=require("lodash");function getLookupIndex(i,base,max){i+=base;if(i>=max)i-=max;return i}function Whitespace(tokens,comments){this.tokens=_.sortBy(tokens.concat(comments),"start");this.used={};this._lastFoundIndex=0}Whitespace.prototype.getNewlinesBefore=function(node){var startToken;var endToken;var tokens=this.tokens;var token;for(var j=0;j<tokens.length;j++){var i=getLookupIndex(j,this._lastFoundIndex,this.tokens.length);token=tokens[i];if(node.start===token.start){startToken=tokens[i-1];endToken=token;this._lastFoundIndex=i;break}}return this.getNewlinesBetween(startToken,endToken)};Whitespace.prototype.getNewlinesAfter=function(node){var startToken;var endToken;var tokens=this.tokens;var token;for(var j=0;j<tokens.length;j++){var i=getLookupIndex(j,this._lastFoundIndex,this.tokens.length);token=tokens[i];if(node.end===token.end){startToken=token;endToken=tokens[i+1];this._lastFoundIndex=i;break}}if(endToken.type.type==="eof"){return 1}else{var lines=this.getNewlinesBetween(startToken,endToken);if(node.type==="Line"&&!lines){return 1}else{return lines}}};Whitespace.prototype.getNewlinesBetween=function(startToken,endToken){var start=startToken?startToken.loc.end.line:1;var end=endToken.loc.start.line;var lines=0;for(var line=start;line<end;line++){if(typeof this.used[line]==="undefined"){this.used[line]=true;lines++}}return lines}},{lodash:164}],23:[function(require,module,exports){"use strict";module.exports=function cloneDeep(obj){var obj2={};if(!obj)return obj2;for(var key in obj){obj2[key]=obj[key]}return obj2}},{}],24:[function(require,module,exports){var supportsColor=require("supports-color");var tokenize=require("js-tokenizer");var chalk=require("chalk");var util=require("../util");var defs={string1:"red",string2:"red",punct:["white","bold"],curly:"green",parens:["blue","bold"],square:["yellow"],name:"white",keyword:["cyan"],number:"magenta",regexp:"magenta",comment1:"grey",comment2:"grey"};var highlight=function(text){var colorize=function(str,col){if(!col)return str;if(Array.isArray(col)){col.forEach(function(col){str=chalk[col](str)})}else{str=chalk[col](str)}return str};return tokenize(text,true).map(function(str){var type=tokenize.type(str);return colorize(str,defs[type])}).join("")};module.exports=function(lines,lineNumber,colNumber){colNumber=Math.max(colNumber,0);if(supportsColor){lines=highlight(lines)}lines=lines.split("\n");var start=Math.max(lineNumber-3,0);var end=Math.min(lines.length,lineNumber+3);var width=(end+"").length;if(!lineNumber&&!colNumber){start=0;end=lines.length}return"\n"+lines.slice(start,end).map(function(line,i){var curr=i+start+1;var gutter=curr===lineNumber?"> ":" ";var sep=curr+util.repeat(width+1);gutter+=sep+"| ";var str=gutter+line;if(colNumber&&curr===lineNumber){str+="\n";str+=util.repeat(gutter.length-2);str+="|"+util.repeat(colNumber)+"^"}return str}).join("\n")}},{"../util":104,chalk:146,"js-tokenizer":163,"supports-color":192}],25:[function(require,module,exports){"use strict";module.exports=function(){return Object.create(null)}},{}],26:[function(require,module,exports){"use strict";module.exports=function toFastProperties(obj){function f(){}f.prototype=obj;return f;eval(obj)}},{}],27:[function(require,module,exports){"use strict";var t=require("./types");var _=require("lodash");require("./types/node");var estraverse=require("estraverse");_.extend(estraverse.VisitorKeys,t.VISITOR_KEYS);var types=require("ast-types");var def=types.Type.def;var or=types.Type.or;def("File").bases("Node").build("program").field("program",def("Program"));def("AssignmentPattern").bases("Pattern").build("left","right").field("left",def("Pattern")).field("right",def("Expression"));def("ImportBatchSpecifier").bases("Specifier").build("name").field("name",def("Identifier"));def("RestElement").bases("Node").build("argument").field("argument",def("Pattern"));def("VirtualPropertyExpression").bases("Expression").build("object","property").field("object",def("Expression")).field("property",or(def("Identifier"),def("Expression")));def("PrivateDeclaration").bases("Declaration").build("declarations").field("declarations",[def("Identifier")]);def("BindMemberExpression").bases("Expression").build("object","property","arguments").field("object",def("Expression")).field("property",or(def("Identifier"),def("Expression"))).field("arguments",[def("Expression")]);def("BindFunctionExpression").bases("Expression").build("callee","arguments").field("callee",def("Expression")).field("arguments",[def("Expression")]);types.finalize()},{"./types":101,"./types/node":102,"ast-types":119,estraverse:158,lodash:164}],28:[function(require,module,exports){"use strict";var explode=require("./explode-assignable-expression");var t=require("../../types");module.exports=function(exports,opts){var isAssignment=function(node){return node.operator===opts.operator+"="};var buildAssignment=function(left,right){return t.assignmentExpression("=",left,right)};exports.ExpressionStatement=function(node,parent,scope,context,file){if(file.isConsequenceExpressionStatement(node))return;var expr=node.expression;if(!isAssignment(expr))return;var nodes=[];var exploded=explode(expr.left,nodes,file,scope,true);nodes.push(t.expressionStatement(buildAssignment(exploded.ref,opts.build(exploded.uid,expr.right))));return nodes};exports.AssignmentExpression=function(node,parent,scope,context,file){if(!isAssignment(node))return;var nodes=[];var exploded=explode(node.left,nodes,file,scope);nodes.push(buildAssignment(exploded.ref,opts.build(exploded.uid,node.right)));return t.toSequenceExpression(nodes,scope)};exports.BinaryExpression=function(node){if(node.operator!==opts.operator)return;return opts.build(node.left,node.right)}}},{"../../types":101,"./explode-assignable-expression":31}],29:[function(require,module,exports){"use strict";var t=require("../../types");module.exports=function build(node,buildBody){var self=node.blocks.shift();if(!self)return;var child=build(node,buildBody);if(!child){child=buildBody();if(node.filter){child=t.ifStatement(node.filter,t.blockStatement([child]))}}return t.forOfStatement(t.variableDeclaration("let",[t.variableDeclarator(self.left)]),self.right,t.blockStatement([child]))}},{"../../types":101}],30:[function(require,module,exports){"use strict";var explode=require("./explode-assignable-expression");var t=require("../../types");module.exports=function(exports,opts){var buildAssignment=function(left,right){return t.assignmentExpression("=",left,right)};exports.ExpressionStatement=function(node,parent,scope,context,file){if(file.isConsequenceExpressionStatement(node))return;var expr=node.expression;if(!opts.is(expr,file))return;var nodes=[];var exploded=explode(expr.left,nodes,file,scope);nodes.push(t.ifStatement(opts.build(exploded.uid,file),t.expressionStatement(buildAssignment(exploded.ref,expr.right))));return nodes};exports.AssignmentExpression=function(node,parent,scope,context,file){if(!opts.is(node,file))return;var nodes=[];var exploded=explode(node.left,nodes,file,scope);nodes.push(t.logicalExpression("&&",opts.build(exploded.uid,file),buildAssignment(exploded.ref,node.right)));nodes.push(exploded.ref);return t.toSequenceExpression(nodes,scope)}}},{"../../types":101,"./explode-assignable-expression":31}],31:[function(require,module,exports){"use strict";var t=require("../../types");var getObjRef=function(node,nodes,file,scope){var ref;if(t.isIdentifier(node)){if(scope.has(node.name,true)){return node}else{ref=node}}else if(t.isMemberExpression(node)){ref=node.object;if(t.isIdentifier(ref)&&scope.has(ref.name)){return ref}}else{throw new Error("We can't explode this node type "+node.type)}var temp=scope.generateUidBasedOnNode(ref);nodes.push(t.variableDeclaration("var",[t.variableDeclarator(temp,ref)]));return temp};var getPropRef=function(node,nodes,file,scope){var prop=node.property;var key=t.toComputedKey(node,prop);if(t.isLiteral(key))return key;var temp=scope.generateUidBasedOnNode(prop);nodes.push(t.variableDeclaration("var",[t.variableDeclarator(temp,prop)]));return temp};module.exports=function(node,nodes,file,scope,allowedSingleIdent){var obj;if(t.isIdentifier(node)&&allowedSingleIdent){obj=node}else{obj=getObjRef(node,nodes,file,scope)}var ref,uid;if(t.isIdentifier(node)){ref=node;uid=obj}else{var prop=getPropRef(node,nodes,file,scope);var computed=node.computed||t.isLiteral(prop);uid=ref=t.memberExpression(obj,prop,computed)}return{uid:uid,ref:ref}}},{"../../types":101}],32:[function(require,module,exports){"use strict";var traverse=require("../../traverse");var util=require("../../util");var t=require("../../types");var visitor={enter:function(node,parent,scope,context,state){if(!t.isIdentifier(node,{name:state.id}))return;if(!t.isReferenced(node,parent))return;var localDeclar=scope.get(state.id,true);if(localDeclar!==state.outerDeclar)return;state.selfReference=true;context.stop()}};exports.property=function(node,file,scope){var key=t.toComputedKey(node,node.key);if(!t.isLiteral(key))return node;var id=t.toIdentifier(key.value);key=t.identifier(id);var state={id:id,selfReference:false,outerDeclar:scope.get(id,true)};traverse(node,visitor,scope,state);if(state.selfReference){node.value=util.template("property-method-assignment-wrapper",{FUNCTION:node.value,FUNCTION_ID:key,FUNCTION_KEY:scope.generateUidIdentifier(id),WRAPPER_KEY:scope.generateUidIdentifier(id+"Wrapper")})}else{node.value.id=key}}},{"../../traverse":97,"../../types":101,"../../util":104}],33:[function(require,module,exports){"use strict";var traverse=require("../../traverse");var t=require("../../types");var visitor={enter:function(node,parent,scope,context){if(t.isFunction(node))context.skip();if(t.isAwaitExpression(node)){node.type="YieldExpression"}}};module.exports=function(node,callId,scope){node.async=false;node.generator=true;traverse(node,visitor,scope);var call=t.callExpression(callId,[node]);var id=node.id;delete node.id;if(t.isFunctionDeclaration(node)){var declar=t.variableDeclaration("let",[t.variableDeclarator(id,call)]);declar._blockHoist=true;return declar}else{return call}}},{"../../traverse":97,"../../types":101}],34:[function(require,module,exports){"use strict";module.exports=ReplaceSupers;var traverse=require("../../traverse");var t=require("../../types");function ReplaceSupers(opts){this.topLevelThisReference=null;this.methodNode=opts.methodNode;this.className=opts.className;this.superName=opts.superName;this.isLoose=opts.isLoose;this.scope=opts.scope;this.file=opts.file}ReplaceSupers.prototype.superProperty=function(property,isStatic,isComputed,thisExpression){return t.callExpression(this.file.addHelper("get"),[t.callExpression(t.memberExpression(t.identifier("Object"),t.identifier("getPrototypeOf")),[isStatic?this.className:t.memberExpression(this.className,t.identifier("prototype"))]),isComputed?property:t.literal(property.name),thisExpression])};ReplaceSupers.prototype.looseSuperProperty=function(methodNode,id,parent){var methodName=methodNode.key;var superName=this.superName||t.identifier("Function");if(parent.property===id){return}else if(t.isCallExpression(parent,{callee:id})){parent.arguments.unshift(t.thisExpression());if(methodName.name==="constructor"){return t.memberExpression(superName,t.identifier("call"))}else{id=superName;if(!methodNode.static){id=t.memberExpression(id,t.identifier("prototype"))}id=t.memberExpression(id,methodName,methodNode.computed);return t.memberExpression(id,t.identifier("call"))}}else if(t.isMemberExpression(parent)&&!methodNode.static){return t.memberExpression(superName,t.identifier("prototype"))}else{return superName}};ReplaceSupers.prototype.replace=function(){this.traverseLevel(this.methodNode.value,true)};var visitor={enter:function(node,parent,scope,context,state){var topLevel=state.topLevel;var self=state.self;if(t.isFunction(node)&&!t.isArrowFunctionExpression(node)){self.traverseLevel(node,false);return context.skip()}if(t.isProperty(node,{method:true})||t.isMethodDefinition(node)){return context.skip()}var getThisReference=topLevel?t.thisExpression:self.getThisReference;var callback=self.specHandle;if(self.isLoose)callback=self.looseHandle;return callback.call(self,getThisReference,node,parent)}};ReplaceSupers.prototype.traverseLevel=function(node,topLevel){var state={self:this,topLevel:topLevel};traverse(node,visitor,this.scope,state)};ReplaceSupers.prototype.getThisReference=function(){if(this.topLevelThisReference){return this.topLevelThisReference}else{var ref=this.topLevelThisReference=this.file.generateUidIdentifier("this");this.methodNode.value.body.body.unshift(t.variableDeclaration("var",[t.variableDeclarator(this.topLevelThisReference,t.thisExpression())]));return ref}};ReplaceSupers.prototype.looseHandle=function(getThisReference,node,parent){if(t.isIdentifier(node,{name:"super"})){return this.looseSuperProperty(this.methodNode,node,parent)}else if(t.isCallExpression(node)){var callee=node.callee;if(!t.isMemberExpression(callee))return;if(callee.object.name!=="super")return;t.appendToMemberExpression(callee,t.identifier("call"));node.arguments.unshift(getThisReference())}};ReplaceSupers.prototype.specHandle=function(getThisReference,node,parent){var methodNode=this.methodNode;var property;var computed;var args;if(t.isIdentifier(node,{name:"super"})){if(!(t.isMemberExpression(parent)&&!parent.computed&&parent.property===node)){throw this.file.errorWithNode(node,"illegal use of bare super")}}else if(t.isCallExpression(node)){var callee=node.callee;if(t.isIdentifier(callee,{name:"super"})){property=methodNode.key;computed=methodNode.computed;args=node.arguments;if(methodNode.key.name!=="constructor"){var methodName=methodNode.key.name||"METHOD_NAME";throw this.file.errorWithNode(node,"Direct super call is illegal in non-constructor, use super."+methodName+"() instead")}}else{if(!t.isMemberExpression(callee))return;if(callee.object.name!=="super")return;property=callee.property;computed=callee.computed;args=node.arguments}}else if(t.isMemberExpression(node)){if(!t.isIdentifier(node.object,{name:"super"}))return;property=node.property;computed=node.computed}if(!property)return;var thisReference=getThisReference();var superProperty=this.superProperty(property,methodNode.static,computed,thisReference);if(args){if(args.length===1&&t.isSpreadElement(args[0])){return t.callExpression(t.memberExpression(superProperty,t.identifier("apply")),[thisReference,args[0].argument])}else{return t.callExpression(t.memberExpression(superProperty,t.identifier("call")),[thisReference].concat(args))}}else{return superProperty}}},{"../../traverse":97,"../../types":101}],35:[function(require,module,exports){"use strict";var t=require("../../types");exports.has=function(node){var first=node.body[0];return t.isExpressionStatement(first)&&t.isLiteral(first.expression,{value:"use strict"})};exports.wrap=function(node,callback){var useStrictNode;if(exports.has(node)){useStrictNode=node.body.shift()}callback();if(useStrictNode){node.body.unshift(useStrictNode)}}},{"../../types":101}],36:[function(require,module,exports){"use strict";module.exports=DefaultFormatter;var traverse=require("../../traverse");var object=require("../../helpers/object");var util=require("../../util");var t=require("../../types");var _=require("lodash");function DefaultFormatter(file){this.file=file;this.ids=object();this.hasNonDefaultExports=false;this.hasLocalExports=false;this.hasLocalImports=false;this.localImportOccurences=object();this.localExports=object();this.localImports=object();this.getLocalExports();this.getLocalImports();this.remapAssignments()}DefaultFormatter.prototype.doDefaultExportInterop=function(node){return node.default&&!this.noInteropRequire&&!this.hasNonDefaultExports};DefaultFormatter.prototype.bumpImportOccurences=function(node){var source=node.source.value;var occurs=this.localImportOccurences;occurs[source]=occurs[source]||0;occurs[source]+=node.specifiers.length};var exportsVisitor={enter:function(node,parent,scope,context,formatter){var declar=node&&node.declaration;if(t.isExportDeclaration(node)){formatter.hasLocalImports=true;if(declar&&t.isStatement(declar)){_.extend(formatter.localExports,t.getIds(declar,true))}if(!node.default){formatter.hasNonDefaultExports=true}if(node.source){formatter.bumpImportOccurences(node)}}}};DefaultFormatter.prototype.getLocalExports=function(){traverse(this.file.ast,exportsVisitor,this.file.scope,this)};var importsVisitor={enter:function(node,parent,scope,context,formatter){if(t.isImportDeclaration(node)){formatter.hasLocalImports=true;_.extend(formatter.localImports,t.getIds(node,true));formatter.bumpImportOccurences(node)}}};DefaultFormatter.prototype.getLocalImports=function(){traverse(this.file.ast,importsVisitor,this.file.scope,this)};var remapVisitor={enter:function(node,parent,scope,context,formatter){if(t.isUpdateExpression(node)&&formatter.isLocalReference(node.argument,scope)){context.skip();var assign=t.assignmentExpression(node.operator[0]+"=",node.argument,t.literal(1));var remapped=formatter.remapExportAssignment(assign);if(t.isExpressionStatement(parent)||node.prefix){return remapped}var nodes=[];nodes.push(remapped);var operator;if(node.operator==="--"){operator="+"}else{operator="-"}nodes.push(t.binaryExpression(operator,node.argument,t.literal(1)));return t.sequenceExpression(nodes)}if(t.isAssignmentExpression(node)&&formatter.isLocalReference(node.left,scope)){context.skip();return formatter.remapExportAssignment(node)}}};DefaultFormatter.prototype.remapAssignments=function(){if(this.hasLocalImports){traverse(this.file.ast,remapVisitor,this.file.scope,this)}};DefaultFormatter.prototype.isLocalReference=function(node){var localImports=this.localImports;return t.isIdentifier(node)&&localImports[node.name]&&localImports[node.name]!==node};DefaultFormatter.prototype.checkLocalReference=function(node){var file=this.file;if(this.isLocalReference(node)){throw file.errorWithNode(node,"Illegal assignment of module import")}};DefaultFormatter.prototype.remapExportAssignment=function(node){return t.assignmentExpression("=",node.left,t.assignmentExpression(node.operator,t.memberExpression(t.identifier("exports"),node.left),node.right))};DefaultFormatter.prototype.isLocalReference=function(node,scope){var localExports=this.localExports;var name=node.name;return t.isIdentifier(node)&&localExports[name]&&localExports[name]===scope.get(name,true)};DefaultFormatter.prototype.getModuleName=function(){var opts=this.file.opts;var filenameRelative=opts.filenameRelative;var moduleName="";if(opts.moduleRoot){moduleName=opts.moduleRoot+"/"}if(!opts.filenameRelative){return moduleName+opts.filename.replace(/^\//,"")}if(opts.sourceRoot){var sourceRootRegEx=new RegExp("^"+opts.sourceRoot+"/?");filenameRelative=filenameRelative.replace(sourceRootRegEx,"")}if(!opts.keepModuleIdExtensions){filenameRelative=filenameRelative.replace(/\.(.*?)$/,"")}moduleName+=filenameRelative;moduleName=moduleName.replace(/\\/g,"/");return moduleName};DefaultFormatter.prototype._pushStatement=function(ref,nodes){if(t.isClass(ref)||t.isFunction(ref)){if(ref.id){nodes.push(t.toStatement(ref));ref=ref.id}}return ref};DefaultFormatter.prototype._hoistExport=function(declar,assign,priority){if(t.isFunctionDeclaration(declar)){assign._blockHoist=priority||2}return assign};DefaultFormatter.prototype.getExternalReference=function(node,nodes){var ids=this.ids;var id=node.source.value;if(ids[id]){return ids[id]}else{return this.ids[id]=this._getExternalReference(node,nodes)}};DefaultFormatter.prototype.exportSpecifier=function(specifier,node,nodes){var inherits=false;if(node.specifiers.length===1)inherits=node;if(node.source){var ref=this.getExternalReference(node,nodes);if(t.isExportBatchSpecifier(specifier)){nodes.push(this.buildExportsWildcard(ref,node))}else{if(t.isSpecifierDefault(specifier)&&!this.noInteropRequire){ref=t.callExpression(this.file.addHelper("interop-require"),[ref])}else{ref=t.memberExpression(ref,t.getSpecifierId(specifier))}nodes.push(this.buildExportsAssignment(t.getSpecifierName(specifier),ref,node))}}else{nodes.push(this.buildExportsAssignment(t.getSpecifierName(specifier),specifier.id,node))}};DefaultFormatter.prototype.buildExportsWildcard=function(objectIdentifier){return t.expressionStatement(t.callExpression(this.file.addHelper("defaults"),[t.identifier("exports"),t.callExpression(this.file.addHelper("interop-require-wildcard"),[objectIdentifier])]))};DefaultFormatter.prototype.buildExportsAssignment=function(id,init){return util.template("exports-assign",{VALUE:init,KEY:id},true)};DefaultFormatter.prototype.exportDeclaration=function(node,nodes){var declar=node.declaration;var id=declar.id;if(node.default){id=t.identifier("default")}var assign;if(t.isVariableDeclaration(declar)){for(var i=0;i<declar.declarations.length;i++){var decl=declar.declarations[i];decl.init=this.buildExportsAssignment(decl.id,decl.init,node).expression;var newDeclar=t.variableDeclaration(declar.kind,[decl]);if(i===0)t.inherits(newDeclar,declar);nodes.push(newDeclar)}}else{var ref=declar;if(t.isFunctionDeclaration(declar)||t.isClassDeclaration(declar)){ref=declar.id;nodes.push(declar)}assign=this.buildExportsAssignment(id,ref,node);nodes.push(assign);this._hoistExport(declar,assign)}}},{"../../helpers/object":25,"../../traverse":97,"../../types":101,"../../util":104,lodash:164}],37:[function(require,module,exports){"use strict";var util=require("../../util");module.exports=function(Parent){var Constructor=function(){this.noInteropRequire=true;Parent.apply(this,arguments)};util.inherits(Constructor,Parent);return Constructor}},{"../../util":104}],38:[function(require,module,exports){"use strict";module.exports=require("./_strict")(require("./amd"))},{"./_strict":37,"./amd":39}],39:[function(require,module,exports){"use strict";module.exports=AMDFormatter;var DefaultFormatter=require("./_default");var CommonFormatter=require("./common");var util=require("../../util");var t=require("../../types");var _=require("lodash");function AMDFormatter(){CommonFormatter.apply(this,arguments)}util.inherits(AMDFormatter,DefaultFormatter);AMDFormatter.prototype.buildDependencyLiterals=function(){var names=[];for(var name in this.ids){names.push(t.literal(name))}return names};AMDFormatter.prototype.transform=function(ast){var program=ast.program;var body=program.body;var names=[t.literal("exports")];
if(this.passModuleArg)names.push(t.literal("module"));names=names.concat(this.buildDependencyLiterals());names=t.arrayExpression(names);var params=_.values(this.ids);if(this.passModuleArg)params.unshift(t.identifier("module"));params.unshift(t.identifier("exports"));var container=t.functionExpression(null,params,t.blockStatement(body));var defineArgs=[names,container];var moduleName=this.getModuleName();if(moduleName)defineArgs.unshift(t.literal(moduleName));var call=t.callExpression(t.identifier("define"),defineArgs);program.body=[t.expressionStatement(call)]};AMDFormatter.prototype.getModuleName=function(){if(this.file.opts.moduleIds){return DefaultFormatter.prototype.getModuleName.apply(this,arguments)}else{return null}};AMDFormatter.prototype._getExternalReference=function(node){return this.file.generateUidIdentifier(node.source.value)};AMDFormatter.prototype.importDeclaration=function(node){this.getExternalReference(node)};AMDFormatter.prototype.importSpecifier=function(specifier,node,nodes){var key=t.getSpecifierName(specifier);var ref=this.getExternalReference(node);if(_.contains(this.file.dynamicImported,node)){this.ids[node.source.value]=key;return}else if(t.isImportBatchSpecifier(specifier)){}else if(t.isSpecifierDefault(specifier)&&!this.noInteropRequire){ref=t.callExpression(this.file.addHelper("interop-require"),[ref])}else{ref=t.memberExpression(ref,t.getSpecifierId(specifier),false)}nodes.push(t.variableDeclaration("var",[t.variableDeclarator(key,ref)]))};AMDFormatter.prototype.exportDeclaration=function(node){if(this.doDefaultExportInterop(node)){this.passModuleArg=true}CommonFormatter.prototype.exportDeclaration.apply(this,arguments)}},{"../../types":101,"../../util":104,"./_default":36,"./common":41,lodash:164}],40:[function(require,module,exports){"use strict";module.exports=require("./_strict")(require("./common"))},{"./_strict":37,"./common":41}],41:[function(require,module,exports){"use strict";module.exports=CommonJSFormatter;var DefaultFormatter=require("./_default");var util=require("../../util");var t=require("../../types");var _=require("lodash");function CommonJSFormatter(file){DefaultFormatter.apply(this,arguments);if(this.hasNonDefaultExports){file.ast.program.body.push(util.template("exports-module-declaration",true))}}util.inherits(CommonJSFormatter,DefaultFormatter);CommonJSFormatter.prototype.importSpecifier=function(specifier,node,nodes){var variableName=t.getSpecifierName(specifier);var ref=this.getExternalReference(node,nodes);if(t.isSpecifierDefault(specifier)){if(!_.contains(this.file.dynamicImported,node)){ref=t.callExpression(this.file.addHelper("interop-require"),[ref])}nodes.push(t.variableDeclaration("var",[t.variableDeclarator(variableName,ref)]))}else{if(specifier.type==="ImportBatchSpecifier"){nodes.push(t.variableDeclaration("var",[t.variableDeclarator(variableName,t.callExpression(this.file.addHelper("interop-require-wildcard"),[ref]))]))}else{nodes.push(t.variableDeclaration("var",[t.variableDeclarator(variableName,t.memberExpression(ref,t.getSpecifierId(specifier)))]))}}};CommonJSFormatter.prototype.importDeclaration=function(node,nodes){nodes.push(util.template("require",{MODULE_NAME:node.source},true))};CommonJSFormatter.prototype.exportDeclaration=function(node,nodes){if(this.doDefaultExportInterop(node)){var declar=node.declaration;var assign=util.template("exports-default-assign",{VALUE:this._pushStatement(declar,nodes)},true);if(t.isFunctionDeclaration(declar)){assign._blockHoist=3}nodes.push(assign);return}DefaultFormatter.prototype.exportDeclaration.apply(this,arguments)};CommonJSFormatter.prototype._getExternalReference=function(node,nodes){var source=node.source.value;var call=t.callExpression(t.identifier("require"),[node.source]);if(this.localImportOccurences[source]>1){var uid=this.file.generateUidIdentifier(source);nodes.push(t.variableDeclaration("var",[t.variableDeclarator(uid,call)]));return uid}else{return call}}},{"../../types":101,"../../util":104,"./_default":36,lodash:164}],42:[function(require,module,exports){"use strict";module.exports=IgnoreFormatter;var t=require("../../types");function IgnoreFormatter(){}IgnoreFormatter.prototype.exportDeclaration=function(node,nodes){var declar=t.toStatement(node.declaration,true);if(declar)nodes.push(t.inherits(declar,node))};IgnoreFormatter.prototype.importDeclaration=IgnoreFormatter.prototype.importSpecifier=IgnoreFormatter.prototype.exportSpecifier=function(){}},{"../../types":101}],43:[function(require,module,exports){module.exports={commonStrict:require("./common-strict"),amdStrict:require("./amd-strict"),umdStrict:require("./umd-strict"),common:require("./common"),system:require("./system"),ignore:require("./ignore"),amd:require("./amd"),umd:require("./umd")}},{"./amd":39,"./amd-strict":38,"./common":41,"./common-strict":40,"./ignore":42,"./system":44,"./umd":46,"./umd-strict":45}],44:[function(require,module,exports){"use strict";module.exports=SystemFormatter;var DefaultFormatter=require("./_default");var AMDFormatter=require("./amd");var useStrict=require("../helpers/use-strict");var traverse=require("../../traverse");var util=require("../../util");var t=require("../../types");var _=require("lodash");function SystemFormatter(file){this.exportIdentifier=file.generateUidIdentifier("export");this.noInteropRequire=true;DefaultFormatter.apply(this,arguments)}util.inherits(SystemFormatter,AMDFormatter);SystemFormatter.prototype._addImportSource=function(node,exportNode){node._importSource=exportNode.source&&exportNode.source.value;return node};SystemFormatter.prototype.buildExportsWildcard=function(objectIdentifier,node){var leftIdentifier=this.file.generateUidIdentifier("key");var valIdentifier=t.memberExpression(objectIdentifier,leftIdentifier,true);var left=t.variableDeclaration("var",[t.variableDeclarator(leftIdentifier)]);var right=objectIdentifier;var block=t.blockStatement([t.expressionStatement(this.buildExportCall(leftIdentifier,valIdentifier))]);return this._addImportSource(t.forInStatement(left,right,block),node)};SystemFormatter.prototype.buildExportsAssignment=function(id,init,node){var call=this.buildExportCall(t.literal(id.name),init,true);return this._addImportSource(call,node)};SystemFormatter.prototype.remapExportAssignment=function(node){return this.buildExportCall(t.literal(node.left.name),node)};SystemFormatter.prototype.buildExportCall=function(id,init,isStatement){var call=t.callExpression(this.exportIdentifier,[id,init]);if(isStatement){return t.expressionStatement(call)}else{return call}};SystemFormatter.prototype.importSpecifier=function(specifier,node,nodes){AMDFormatter.prototype.importSpecifier.apply(this,arguments);this._addImportSource(_.last(nodes),node)};var runnerSettersVisitor={enter:function(node,parent,scope,context,state){if(node._importSource===state.source){if(t.isVariableDeclaration(node)){_.each(node.declarations,function(declar){state.hoistDeclarators.push(t.variableDeclarator(declar.id));state.nodes.push(t.expressionStatement(t.assignmentExpression("=",declar.id,declar.init)))})}else{state.nodes.push(node)}context.remove()}}};SystemFormatter.prototype.buildRunnerSetters=function(block,hoistDeclarators){var scope=this.file.scope;return t.arrayExpression(_.map(this.ids,function(uid,source){var state={source:source,nodes:[],hoistDeclarators:hoistDeclarators};traverse(block,runnerSettersVisitor,scope,state);return t.functionExpression(null,[uid],t.blockStatement(state.nodes))}))};var hoistVariablesVisitor={enter:function(node,parent,scope,context,hoistDeclarators){if(t.isFunction(node)){return context.skip()}if(t.isVariableDeclaration(node)){if(node.kind!=="var"&&!t.isProgram(parent)){return}if(node._blockHoist)return;var nodes=[];for(var i=0;i<node.declarations.length;i++){var declar=node.declarations[i];hoistDeclarators.push(t.variableDeclarator(declar.id));if(declar.init){var assign=t.expressionStatement(t.assignmentExpression("=",declar.id,declar.init));nodes.push(assign)}}if(t.isFor(parent)){if(parent.left===node){return node.declarations[0].id}if(parent.init===node){return t.toSequenceExpression(nodes,scope)}}return nodes}}};var hoistFunctionsVisitor={enter:function(node,parent,scope,context,handlerBody){if(t.isFunction(node))context.skip();if(t.isFunctionDeclaration(node)||node._blockHoist){handlerBody.push(node);context.remove()}}};SystemFormatter.prototype.transform=function(ast){var program=ast.program;var hoistDeclarators=[];var moduleName=this.getModuleName();var moduleNameLiteral=t.literal(moduleName);var block=t.blockStatement(program.body);var runner=util.template("system",{MODULE_NAME:moduleNameLiteral,MODULE_DEPENDENCIES:t.arrayExpression(this.buildDependencyLiterals()),EXPORT_IDENTIFIER:this.exportIdentifier,SETTERS:this.buildRunnerSetters(block,hoistDeclarators),EXECUTE:t.functionExpression(null,[],block)},true);var handlerBody=runner.expression.arguments[2].body.body;if(!moduleName)runner.expression.arguments.shift();var returnStatement=handlerBody.pop();traverse(block,hoistVariablesVisitor,this.file.scope,hoistDeclarators);if(hoistDeclarators.length){var hoistDeclar=t.variableDeclaration("var",hoistDeclarators);hoistDeclar._blockHoist=true;handlerBody.unshift(hoistDeclar)}traverse(block,hoistFunctionsVisitor,this.file.scope,handlerBody);handlerBody.push(returnStatement);if(useStrict.has(block)){handlerBody.unshift(block.body.shift())}program.body=[runner]}},{"../../traverse":97,"../../types":101,"../../util":104,"../helpers/use-strict":35,"./_default":36,"./amd":39,lodash:164}],45:[function(require,module,exports){"use strict";module.exports=require("./_strict")(require("./umd"))},{"./_strict":37,"./umd":46}],46:[function(require,module,exports){"use strict";module.exports=UMDFormatter;var AMDFormatter=require("./amd");var util=require("../../util");var t=require("../../types");var _=require("lodash");function UMDFormatter(){AMDFormatter.apply(this,arguments)}util.inherits(UMDFormatter,AMDFormatter);UMDFormatter.prototype.transform=function(ast){var program=ast.program;var body=program.body;var names=[];for(var name in this.ids){names.push(t.literal(name))}var ids=_.values(this.ids);var args=[t.identifier("exports")];if(this.passModuleArg)args.push(t.identifier("module"));args=args.concat(ids);var factory=t.functionExpression(null,args,t.blockStatement(body));var defineArgs=[t.literal("exports")];if(this.passModuleArg)defineArgs.push(t.literal("module"));defineArgs=defineArgs.concat(names);defineArgs=[t.arrayExpression(defineArgs)];var testExports=util.template("test-exports");var testModule=util.template("test-module");var commonTests=this.passModuleArg?t.logicalExpression("&&",testExports,testModule):testExports;var commonArgs=[t.identifier("exports")];if(this.passModuleArg)commonArgs.push(t.identifier("module"));commonArgs=commonArgs.concat(names.map(function(name){return t.callExpression(t.identifier("require"),[name])}));var moduleName=this.getModuleName();if(moduleName)defineArgs.unshift(t.literal(moduleName));var runner=util.template("umd-runner-body",{AMD_ARGUMENTS:defineArgs,COMMON_TEST:commonTests,COMMON_ARGUMENTS:commonArgs});var call=t.callExpression(runner,[factory]);program.body=[t.expressionStatement(call)]}},{"../../types":101,"../../util":104,"./amd":39,lodash:164}],47:[function(require,module,exports){"use strict";module.exports=transform;var Transformer=require("./transformer");var object=require("../helpers/object");var File=require("../file");var util=require("../util");var _=require("lodash");function transform(code,opts){var file=new File(opts);return file.parse(code)}transform.fromAst=function(ast,code,opts){ast=util.normaliseAst(ast);var file=new File(opts);file.addCode(code);file.transform(ast);return file.generate()};transform._ensureTransformerNames=function(type,rawKeys){var keys=[];for(var i=0;i<rawKeys.length;i++){var key=rawKeys[i];var deprecatedKey=transform.deprecatedTransformerMap[key];if(deprecatedKey){console.error("The transformer "+key+" has been renamed to "+deprecatedKey+" in v3.0.0 - backwards compatibilty will be removed 4.0.0");rawKeys.push(deprecatedKey)}else if(transform.transformers[key]){keys.push(key)}else if(transform.namespaces[key]){keys=keys.concat(transform.namespaces[key])}else{throw new ReferenceError("Unknown transformer "+key+" specified in "+type+" - "+"transformer key names have been changed in 3.0.0 see "+"the changelog for more info "+"https://github.com/6to5/6to5/blob/master/CHANGELOG.md#300")}}return keys};transform.transformers=object();transform.namespaces=object();transform.deprecatedTransformerMap=require("./transformers/deprecated");transform.moduleFormatters=require("./modules");var rawTransformers=require("./transformers");_.each(rawTransformers,function(transformer,key){var namespace=key.split(".")[0];transform.namespaces[namespace]=transform.namespaces[namespace]||[];transform.namespaces[namespace].push(key);transform.transformers[key]=new Transformer(key,transformer)})},{"../file":2,"../helpers/object":25,"../util":104,"./modules":43,"./transformer":49,"./transformers":71,"./transformers/deprecated":50,lodash:164}],48:[function(require,module,exports){module.exports=TransformerPass;var traverse=require("../traverse");var _=require("lodash");function TransformerPass(file,transformer){this.transformer=transformer;this.handlers=transformer.handlers;this.file=file}TransformerPass.prototype.astRun=function(key){var handlers=this.handlers;var file=this.file;if(handlers.ast&&handlers.ast[key]){handlers.ast[key](file.ast,file)}};TransformerPass.prototype.canRun=function(){var transformer=this.transformer;var opts=this.file.opts;var key=transformer.key;if(key[0]==="_")return true;var blacklist=opts.blacklist;if(blacklist.length&&_.contains(blacklist,key))return false;var whitelist=opts.whitelist;if(whitelist.length&&!_.contains(whitelist,key))return false;if(transformer.optional&&!_.contains(opts.optional,key))return false;if(transformer.experimental&&!opts.experimental)return false;return true};var transformVisitor={enter:function(node,parent,scope,context,state){var fns=state.handlers[node.type];if(!fns)return;return fns.enter(node,parent,scope,context,state.file,state.pass)},exit:function(node,parent,scope,context,state){var fns=state.handlers[node.type];if(!fns)return;return fns.exit(node,parent,scope,context,state.file,state.pass)}};TransformerPass.prototype.transform=function(){var file=this.file;this.astRun("before");var state={file:file,handlers:this.handlers,pass:this};traverse(file.ast,transformVisitor,file.scope,state);this.astRun("after")}},{"../traverse":97,lodash:164}],49:[function(require,module,exports){"use strict";module.exports=Transformer;var TransformerPass=require("./transformer-pass");var t=require("../types");var _=require("lodash");function Transformer(key,transformer,opts){this.manipulateOptions=transformer.manipulateOptions;this.experimental=!!transformer.experimental;this.secondPass=!!transformer.secondPass;this.optional=!!transformer.optional;this.handlers=this.normalise(transformer);this.opts=opts||{};this.key=key}Transformer.prototype.normalise=function(transformer){var self=this;if(_.isFunction(transformer)){transformer={ast:transformer}}_.each(transformer,function(fns,type){if(type[0]==="_"){self[type]=fns;return}if(_.isFunction(fns))fns={enter:fns};if(!_.isObject(fns))return;if(!fns.enter)fns.enter=_.noop;if(!fns.exit)fns.exit=_.noop;transformer[type]=fns;var aliases=t.FLIPPED_ALIAS_KEYS[type];if(aliases){_.each(aliases,function(alias){transformer[alias]=fns})}});return transformer};Transformer.prototype.buildPass=function(file){return new TransformerPass(file,this)}},{"../types":101,"./transformer-pass":48,lodash:164}],50:[function(require,module,exports){module.exports={specNoForInOfAssignment:"validation.noForInOfAssignment",specSetters:"validation.setters",specBlockScopedFunctions:"spec.blockScopedFunctions",malletOperator:"playground.malletOperator",methodBinding:"playground.methodBinding",memoizationOperator:"playground.memoizationOperator",objectGetterMemoization:"playground.objectGetterMemoization",modules:"es6.modules",propertyNameShorthand:"es6.properties.shorthand",arrayComprehension:"es7.comprehensions",generatorComprehension:"es7.comprehensions",arrowFunctions:"es6.arrowFunctions",classes:"es6.classes",objectSpread:"es7.objectSpread",exponentiationOperator:"es7.exponentiationOperator",spread:"es6.spread",templateLiterals:"es6.templateLiterals",propertyMethodAssignment:"es6.properties.shorthand",computedPropertyNames:"es6.properties.computed",defaultParameters:"es6.parameters.default",restParameters:"es6.parameters.rest",destructuring:"es6.destructuring",forOf:"es6.forOf",unicodeRegex:"es6.unicodeRegex",abstractReferences:"es7.abstractReferences",constants:"es6.constants",letScoping:"es6.letScoping",blockScopingTDZ:"es6.blockScopingTDZ",generators:"regenerator",protoToAssign:"spec.protoToAssign",typeofSymbol:"spec.typeofSymbol",coreAliasing:"selfContained",undefinedToVoid:"spec.undefinedToVoid",undeclaredVariableCheck:"validation.undeclaredVariableCheck",specPropertyLiterals:"minification.propertyLiterals",specMemberExpressionLiterals:"minification.memberExpressionLiterals"}},{}],51:[function(require,module,exports){"use strict";var util=require("../../../util");var t=require("../../../types");exports.ObjectExpression=function(node){var mutatorMap={};var hasAny=false;node.properties=node.properties.filter(function(prop){if(prop.kind==="get"||prop.kind==="set"){hasAny=true;util.pushMutatorMap(mutatorMap,prop.key,prop.kind,prop.computed,prop.value);return false}else{return true}});if(!hasAny)return;return t.callExpression(t.memberExpression(t.identifier("Object"),t.identifier("defineProperties")),[node,util.buildDefineProperties(mutatorMap)])}},{"../../../types":101,"../../../util":104}],52:[function(require,module,exports){"use strict";var t=require("../../../types");exports.ArrowFunctionExpression=function(node){t.ensureBlock(node);node._aliasFunction="arrow";node.expression=false;node.type="FunctionExpression";return node}},{"../../../types":101}],53:[function(require,module,exports){"use strict";var traverse=require("../../../traverse");var t=require("../../../types");var visitor={enter:function(node,parent,scope,context,state){if(!t.isReferencedIdentifier(node,parent))return;var declared=state.letRefs[node.name];if(!declared)return;if(scope.get(node.name,true)!==declared)return;var declaredLoc=declared.loc;var referenceLoc=node.loc;if(!declaredLoc||!referenceLoc)return;var before=referenceLoc.start.line<declaredLoc.start.line;if(referenceLoc.start.line===declaredLoc.start.line){before=referenceLoc.start.col<declaredLoc.start.col}if(before){throw state.file.errorWithNode(node,"Temporal dead zone - accessing a variable before it's initialized")}}};exports.optional=true;exports.Loop=exports.Program=exports.BlockStatement=function(node,parent,scope,context,file){var letRefs=node._letReferences;if(!letRefs)return;var state={letRefs:letRefs,file:file};traverse(node,visitor,scope,state)}},{"../../../traverse":97,"../../../types":101}],54:[function(require,module,exports){"use strict";var traverse=require("../../../traverse");var object=require("../../../helpers/object");var util=require("../../../util");var t=require("../../../types");var _=require("lodash");var isLet=function(node,parent){if(!t.isVariableDeclaration(node))return false;if(node._let)return true;if(node.kind!=="let")return false;if(!t.isFor(parent)||t.isFor(parent)&&parent.left!==node){for(var i=0;i<node.declarations.length;i++){var declar=node.declarations[i];declar.init=declar.init||t.identifier("undefined")}}node._let=true;node.kind="var";return true};var isVar=function(node,parent){return t.isVariableDeclaration(node,{kind:"var"})&&!isLet(node,parent)};var standardiseLets=function(declars){for(var i=0;i<declars.length;i++){delete declars[i]._let}};exports.VariableDeclaration=function(node,parent){isLet(node,parent)};exports.Loop=function(node,parent,scope,context,file){var init=node.left||node.init;if(isLet(init,node)){t.ensureBlock(node);node.body._letDeclarators=[init]}if(t.isLabeledStatement(parent)){node.label=parent.label}var letScoping=new LetScoping(node,node.body,parent,scope,file);letScoping.run();if(node.label&&!t.isLabeledStatement(parent)){return t.labeledStatement(node.label,node)}};exports.Program=exports.BlockStatement=function(block,parent,scope,context,file){if(!t.isLoop(parent)){var letScoping=new LetScoping(false,block,parent,scope,file);letScoping.run()}};function LetScoping(loopParent,block,parent,scope,file){this.loopParent=loopParent;this.parent=parent;this.scope=scope;this.block=block;this.file=file;this.outsideLetReferences=object();this.hasLetReferences=false;this.letReferences=block._letReferences=object();this.body=[]}LetScoping.prototype.run=function(){var block=this.block;if(block._letDone)return;block._letDone=true;var needsClosure=this.getLetReferences();if(t.isFunction(this.parent)||t.isProgram(this.block))return;if(!this.hasLetReferences)return;if(needsClosure){this.needsClosure()}else{this.remap()}};function replace(node,parent,scope,context,remaps){if(!t.isReferencedIdentifier(node,parent))return;var remap=remaps[node.name];if(!remap)return;var own=scope.get(node.name,true);if(own===remap.node){node.name=remap.uid}else{if(context)context.skip()}}var replaceVisitor={enter:replace};function traverseReplace(node,parent,scope,remaps){replace(node,parent,scope,null,remaps);traverse(node,replaceVisitor,scope,remaps)}LetScoping.prototype.remap=function(){var hasRemaps=false;var letRefs=this.letReferences;var scope=this.scope;var remaps=object();for(var key in letRefs){var ref=letRefs[key];if(scope.parentHas(key)){var uid=scope.generateUidIdentifier(ref.name).name;ref.name=uid;hasRemaps=true;remaps[key]=remaps[uid]={node:ref,uid:uid}}}if(!hasRemaps)return;var loopParent=this.loopParent;if(loopParent){traverseReplace(loopParent.right,loopParent,scope,remaps);traverseReplace(loopParent.test,loopParent,scope,remaps);traverseReplace(loopParent.update,loopParent,scope,remaps)}traverse(this.block,replaceVisitor,scope,remaps)};LetScoping.prototype.needsClosure=function(){var block=this.block;this.has=this.checkLoop();this.hoistVarDeclarations();var params=_.values(this.outsideLetReferences);var fn=t.functionExpression(null,params,t.blockStatement(block.body));fn._aliasFunction=true;block.body=this.body;var call=t.callExpression(fn,params);var ret=this.scope.generateUidIdentifier("ret");var hasYield=traverse.hasType(fn.body,this.scope,"YieldExpression",t.FUNCTION_TYPES);if(hasYield){fn.generator=true;call=t.yieldExpression(call,true)}var hasAsync=traverse.hasType(fn.body,this.scope,"AwaitExpression",t.FUNCTION_TYPES);if(hasAsync){fn.async=true;call=t.awaitExpression(call,true)}this.build(ret,call)};var letReferenceFunctionVisitor={enter:function(node,parent,scope,context,state){if(!t.isReferencedIdentifier(node,parent))return;if(scope.hasOwn(node.name,true))return;if(!state.letReferences[node.name])return;state.closurify=true}};var letReferenceBlockVisitor={enter:function(node,parent,scope,context,state){if(t.isFunction(node)){traverse(node,letReferenceFunctionVisitor,scope,state);return context.skip()}}};LetScoping.prototype.getLetReferences=function(){var block=this.block;var declarators=block._letDeclarators||[];var declar;for(var i=0;i<declarators.length;i++){declar=declarators[i];_.extend(this.outsideLetReferences,t.getIds(declar,true))}if(block.body){for(i=0;i<block.body.length;i++){declar=block.body[i];if(isLet(declar,block)){declarators=declarators.concat(declar.declarations)}}}for(i=0;i<declarators.length;i++){declar=declarators[i];var keys=t.getIds(declar,true);_.extend(this.letReferences,keys);this.hasLetReferences=true}if(!this.hasLetReferences)return;standardiseLets(declarators);var state={letReferences:this.letReferences,closurify:false};traverse(this.block,letReferenceBlockVisitor,this.scope,state);return state.closurify};var loopVisitor={enter:function(node,parent,scope,context,state){var replace;if(t.isFunction(node)||t.isLoop(node)){return context.skip()}if(node&&!node.label&&state.isLoop){if(t.isBreakStatement(node)){if(t.isSwitchCase(parent))return;state.hasBreak=true;replace=t.returnStatement(t.literal("break"))}else if(t.isContinueStatement(node)){state.hasContinue=true;replace=t.returnStatement(t.literal("continue"))}}if(t.isReturnStatement(node)){state.hasReturn=true;replace=t.returnStatement(t.objectExpression([t.property("init",t.identifier("v"),node.argument||t.identifier("undefined"))]))}if(replace)return t.inherits(replace,node)}};LetScoping.prototype.checkLoop=function(){var state={hasContinue:false,hasReturn:false,hasBreak:false,isLoop:!!this.loopParent};traverse(this.block,loopVisitor,this.scope,state);return state};var hoistVarDeclarationsVisitor={enter:function(node,parent,scope,context,self){if(t.isForStatement(node)){if(isVar(node.init,node)){node.init=t.sequenceExpression(self.pushDeclar(node.init))}}else if(t.isFor(node)){if(isVar(node.left,node)){node.left=node.left.declarations[0].id}}else if(isVar(node,parent)){return self.pushDeclar(node).map(t.expressionStatement)}else if(t.isFunction(node)){return context.skip()}}};LetScoping.prototype.hoistVarDeclarations=function(){traverse(this.block,hoistVarDeclarationsVisitor,this.scope,this)};LetScoping.prototype.pushDeclar=function(node){this.body.push(t.variableDeclaration(node.kind,node.declarations.map(function(declar){return t.variableDeclarator(declar.id)})));var replace=[];for(var i=0;i<node.declarations.length;i++){var declar=node.declarations[i];if(!declar.init)continue;var expr=t.assignmentExpression("=",declar.id,declar.init);replace.push(t.inherits(expr,declar))}return replace};LetScoping.prototype.build=function(ret,call){var has=this.has;if(has.hasReturn||has.hasBreak||has.hasContinue){this.buildHas(ret,call)}else{this.body.push(t.expressionStatement(call))}};LetScoping.prototype.buildHas=function(ret,call){var body=this.body;body.push(t.variableDeclaration("var",[t.variableDeclarator(ret,call)]));var loopParent=this.loopParent;var retCheck;var has=this.has;var cases=[];if(has.hasReturn){retCheck=util.template("let-scoping-return",{RETURN:ret})}if(has.hasBreak||has.hasContinue){if(!loopParent){throw new Error("Has no loop parent but we're trying to reassign breaks "+"and continues, something is going wrong here.")}var label=loopParent.label=loopParent.label||this.scope.generateUidIdentifier("loop");if(has.hasBreak){cases.push(t.switchCase(t.literal("break"),[t.breakStatement(label)]))}if(has.hasContinue){cases.push(t.switchCase(t.literal("continue"),[t.continueStatement(label)]))}if(has.hasReturn){cases.push(t.switchCase(null,[retCheck]))}if(cases.length===1){var single=cases[0];body.push(t.ifStatement(t.binaryExpression("===",ret,single.test),single.consequent[0]))}else{body.push(t.switchStatement(ret,cases))}}else{if(has.hasReturn)body.push(retCheck)}}},{"../../../helpers/object":25,"../../../traverse":97,"../../../types":101,"../../../util":104,lodash:164}],55:[function(require,module,exports){"use strict";var ReplaceSupers=require("../../helpers/replace-supers");var nameMethod=require("../../helpers/name-method");var util=require("../../../util");var t=require("../../../types");exports.ClassDeclaration=function(node,parent,scope,context,file){return new Class(node,file,scope,true).run()};exports.ClassExpression=function(node,parent,scope,context,file){if(!node.id){if(t.isProperty(parent)&&parent.value===node&&!parent.computed&&t.isIdentifier(parent.key)){node.id=parent.key}if(t.isVariableDeclarator(parent)&&t.isIdentifier(parent.id)){node.id=parent.id}}return new Class(node,file,scope,false).run()};function Class(node,file,scope,isStatement){this.isStatement=isStatement;this.scope=scope;this.node=node;this.file=file;this.hasInstanceMutators=false;this.hasStaticMutators=false;this.instanceMutatorMap={};this.staticMutatorMap={};this.hasConstructor=false;this.className=node.id||scope.generateUidIdentifier("class");this.superName=node.superClass;this.isLoose=file.isLoose("es6.classes")}Class.prototype.run=function(){var superName=this.superName;var className=this.className;var file=this.file;var body=this.body=[];var constructor;if(this.node.id){constructor=t.functionDeclaration(className,[],t.blockStatement([]));body.push(constructor)}else{constructor=t.functionExpression(null,[],t.blockStatement([]));body.push(t.variableDeclaration("var",[t.variableDeclarator(className,constructor)]))}this.constructor=constructor;var closureParams=[];var closureArgs=[];if(superName){closureArgs.push(superName);if(!t.isIdentifier(superName)){var superRef=this.scope.generateUidBasedOnNode(superName,this.file);superName=superRef}closureParams.push(superName);this.superName=superName;body.push(t.expressionStatement(t.callExpression(file.addHelper("inherits"),[className,superName])))}this.buildBody();t.inheritsComments(body[0],this.node);var init;if(body.length===1){init=t.toExpression(constructor)}else{body.push(t.returnStatement(className));init=t.callExpression(t.functionExpression(null,closureParams,t.blockStatement(body)),closureArgs)}if(this.isStatement){return t.variableDeclaration("let",[t.variableDeclarator(className,init)])}else{return init}};Class.prototype.buildBody=function(){var constructor=this.constructor;var className=this.className;var superName=this.superName;var classBody=this.node.body.body;var body=this.body;for(var i=0;i<classBody.length;i++){var node=classBody[i];if(t.isMethodDefinition(node)){var replaceSupers=new ReplaceSupers({methodNode:node,className:this.className,superName:this.superName,isLoose:this.isLoose,scope:this.scope,file:this.file});replaceSupers.replace();if(node.key.name==="constructor"){this.pushConstructor(node)}else{this.pushMethod(node)}}else if(t.isPrivateDeclaration(node)){this.closure=true;body.unshift(node)}}if(!this.hasConstructor&&superName&&!t.isFalsyExpression(superName)){var defaultConstructorTemplate="class-super-constructor-call";if(this.isLoose)defaultConstructorTemplate+="-loose";constructor.body.body.push(util.template(defaultConstructorTemplate,{CLASS_NAME:className,SUPER_NAME:this.superName},true))}var instanceProps;var staticProps;if(this.hasInstanceMutators){instanceProps=util.buildDefineProperties(this.instanceMutatorMap)}if(this.hasStaticMutators){staticProps=util.buildDefineProperties(this.staticMutatorMap)}if(instanceProps||staticProps){staticProps=staticProps||t.literal(null);var args=[className,staticProps];if(instanceProps)args.push(instanceProps);body.push(t.expressionStatement(t.callExpression(this.file.addHelper("prototype-properties"),args)))}};Class.prototype.pushMethod=function(node){var methodName=node.key;var kind=node.kind;if(kind===""){nameMethod.property(node,this.file,this.scope);if(this.isLoose){var className=this.className;if(!node.static)className=t.memberExpression(className,t.identifier("prototype"));methodName=t.memberExpression(className,methodName,node.computed);var expr=t.expressionStatement(t.assignmentExpression("=",methodName,node.value));t.inheritsComments(expr,node);this.body.push(expr);return}kind="value"}var mutatorMap=this.instanceMutatorMap;if(node.static){this.hasStaticMutators=true;mutatorMap=this.staticMutatorMap}else{this.hasInstanceMutators=true}util.pushMutatorMap(mutatorMap,methodName,kind,node.computed,node)};Class.prototype.pushConstructor=function(method){if(method.kind){throw this.file.errorWithNode(method,"illegal kind for constructor method")}var construct=this.constructor;var fn=method.value;this.hasConstructor=true;t.inherits(construct,fn);t.inheritsComments(construct,method);construct._ignoreUserWhitespace=true;construct.params=fn.params;construct.body=fn.body}},{"../../../types":101,"../../../util":104,"../../helpers/name-method":32,"../../helpers/replace-supers":34}],56:[function(require,module,exports){"use strict";var traverse=require("../../../traverse");var t=require("../../../types");var visitor={enter:function(node,parent,scope,context,state){if(t.isDeclaration(node)||t.isAssignmentExpression(node)){var ids=t.getIds(node,true);
for(var key in ids){var id=ids[key];var constant=state.constants[key];if(!constant)continue;if(id===constant)continue;throw state.file.errorWithNode(id,key+" is read-only")}}else if(t.isScope(node)){context.skip()}}};exports.Scope=function(node,parent,scope,context,file){traverse(node,visitor,scope,{constants:scope.getAllOfKind("const"),file:file})};exports.VariableDeclaration=function(node){if(node.kind==="const")node.kind="let"}},{"../../../traverse":97,"../../../types":101}],57:[function(require,module,exports){"use strict";var t=require("../../../types");var buildVariableAssign=function(opts,id,init){var op=opts.operator;if(t.isMemberExpression(id))op="=";var node;if(op){node=t.expressionStatement(t.assignmentExpression(op,id,init))}else{node=t.variableDeclaration(opts.kind,[t.variableDeclarator(id,init)])}node._blockHoist=opts.blockHoist;return node};var buildVariableDeclar=function(opts,id,init){var declar=t.variableDeclaration("var",[t.variableDeclarator(id,init)]);declar._blockHoist=opts.blockHoist;return declar};var push=function(opts,nodes,elem,parentId){if(t.isObjectPattern(elem)){pushObjectPattern(opts,nodes,elem,parentId)}else if(t.isArrayPattern(elem)){pushArrayPattern(opts,nodes,elem,parentId)}else if(t.isAssignmentPattern(elem)){pushAssignmentPattern(opts,nodes,elem,parentId)}else{nodes.push(buildVariableAssign(opts,elem,parentId))}};var pushAssignmentPattern=function(opts,nodes,pattern,parentId){var tempParentId=opts.scope.generateUidBasedOnNode(parentId,opts.file);nodes.push(t.variableDeclaration("var",[t.variableDeclarator(tempParentId,parentId)]));nodes.push(buildVariableAssign(opts,pattern.left,t.conditionalExpression(t.binaryExpression("===",tempParentId,t.identifier("undefined")),pattern.right,tempParentId)))};var pushObjectPattern=function(opts,nodes,pattern,parentId){for(var i=0;i<pattern.properties.length;i++){var prop=pattern.properties[i];if(t.isSpreadProperty(prop)){var keys=[];for(var i2=0;i2<pattern.properties.length;i2++){var prop2=pattern.properties[i2];if(i2>=i)break;if(t.isSpreadProperty(prop2))continue;var key=prop2.key;if(t.isIdentifier(key)){key=t.literal(prop2.key.name)}keys.push(key)}keys=t.arrayExpression(keys);var value=t.callExpression(opts.file.addHelper("object-without-properties"),[parentId,keys]);nodes.push(buildVariableAssign(opts,prop.argument,value))}else{if(t.isLiteral(prop.key))prop.computed=true;var pattern2=prop.value;var patternId2=t.memberExpression(parentId,prop.key,prop.computed);if(t.isPattern(pattern2)){push(opts,nodes,pattern2,patternId2)}else{nodes.push(buildVariableAssign(opts,pattern2,patternId2))}}}};var pushArrayPattern=function(opts,nodes,pattern,parentId){if(!pattern.elements)return;var i;var hasRest=false;for(i=0;i<pattern.elements.length;i++){if(t.isRestElement(pattern.elements[i])){hasRest=true;break}}var toArray=opts.file.toArray(parentId,!hasRest&&pattern.elements.length);var _parentId=opts.scope.generateUidBasedOnNode(parentId,opts.file);nodes.push(buildVariableDeclar(opts,_parentId,toArray));parentId=_parentId;for(i=0;i<pattern.elements.length;i++){var elem=pattern.elements[i];if(!elem)continue;i=+i;var newPatternId;if(t.isRestElement(elem)){newPatternId=opts.file.toArray(parentId);if(i>0){newPatternId=t.callExpression(t.memberExpression(newPatternId,t.identifier("slice")),[t.literal(i)])}elem=elem.argument}else{newPatternId=t.memberExpression(parentId,t.literal(i),true)}push(opts,nodes,elem,newPatternId)}};var pushPattern=function(opts){var nodes=opts.nodes;var pattern=opts.pattern;var parentId=opts.id;var scope=opts.scope;if(!t.isArrayExpression(parentId)&&!t.isMemberExpression(parentId)&&!t.isIdentifier(parentId)){var key=scope.generateUidBasedOnNode(parentId);nodes.push(buildVariableDeclar(opts,key,parentId));parentId=key}push(opts,nodes,pattern,parentId)};exports.ForInStatement=exports.ForOfStatement=function(node,parent,scope,context,file){var declar=node.left;if(!t.isVariableDeclaration(declar))return;var pattern=declar.declarations[0].id;if(!t.isPattern(pattern))return;var key=scope.generateUidIdentifier("ref");node.left=t.variableDeclaration(declar.kind,[t.variableDeclarator(key,null)]);var nodes=[];push({kind:declar.kind,file:file,scope:scope},nodes,pattern,key);t.ensureBlock(node);var block=node.body;block.body=nodes.concat(block.body)};exports.Function=function(node,parent,scope,context,file){var nodes=[];var hasDestructuring=false;node.params=node.params.map(function(pattern,i){if(!t.isPattern(pattern))return pattern;hasDestructuring=true;var parentId=scope.generateUidIdentifier("ref");pushPattern({blockHoist:node.params.length-i,pattern:pattern,nodes:nodes,scope:scope,file:file,kind:"var",id:parentId});return parentId});if(!hasDestructuring)return;t.ensureBlock(node);var block=node.body;block.body=nodes.concat(block.body)};exports.CatchClause=function(node,parent,scope,context,file){var pattern=node.param;if(!t.isPattern(pattern))return;var ref=scope.generateUidIdentifier("ref");node.param=ref;var nodes=[];push({kind:"var",file:file,scope:scope},nodes,pattern,ref);node.body.body=nodes.concat(node.body.body)};exports.ExpressionStatement=function(node,parent,scope,context,file){var expr=node.expression;if(expr.type!=="AssignmentExpression")return;if(!t.isPattern(expr.left))return;if(file.isConsequenceExpressionStatement(node))return;var nodes=[];var ref=scope.generateUidIdentifier("ref");nodes.push(t.variableDeclaration("var",[t.variableDeclarator(ref,expr.right)]));push({operator:expr.operator,file:file,scope:scope},nodes,expr.left,ref);return nodes};exports.AssignmentExpression=function(node,parent,scope,context,file){if(!t.isPattern(node.left))return;var ref=scope.generateUidIdentifier("temp");scope.push({key:ref.name,id:ref});var nodes=[];nodes.push(t.assignmentExpression("=",ref,node.right));push({operator:node.operator,file:file,scope:scope},nodes,node.left,ref);nodes.push(ref);return t.toSequenceExpression(nodes,scope)};exports.VariableDeclaration=function(node,parent,scope,context,file){if(t.isForInStatement(parent)||t.isForOfStatement(parent))return;var nodes=[];var i;var declar;var hasPattern=false;for(i=0;i<node.declarations.length;i++){declar=node.declarations[i];if(t.isPattern(declar.id)){hasPattern=true;break}}if(!hasPattern)return;for(i=0;i<node.declarations.length;i++){declar=node.declarations[i];var patternId=declar.init;var pattern=declar.id;var opts={pattern:pattern,nodes:nodes,scope:scope,kind:node.kind,file:file,id:patternId};if(t.isPattern(pattern)&&patternId){pushPattern(opts);if(+i!==node.declarations.length-1){t.inherits(nodes[nodes.length-1],declar)}}else{nodes.push(t.inherits(buildVariableAssign(opts,declar.id,declar.init),declar))}}if(!t.isProgram(parent)&&!t.isBlockStatement(parent)){declar=null;for(i=0;i<nodes.length;i++){node=nodes[i];declar=declar||t.variableDeclaration(node.kind,[]);if(!t.isVariableDeclaration(node)&&declar.kind!==node.kind){throw file.errorWithNode(node,"Cannot use this node within the current parent")}declar.declarations=declar.declarations.concat(node.declarations)}return declar}return nodes}},{"../../../types":101}],58:[function(require,module,exports){"use strict";var util=require("../../../util");var t=require("../../../types");exports.ForOfStatement=function(node,parent,scope,context,file){var callback=spec;if(file.isLoose("es6.forOf"))callback=loose;var build=callback(node,parent,scope,context,file);var declar=build.declar;var loop=build.loop;var block=loop.body;t.inheritsComments(loop,node);t.ensureBlock(node);if(declar){if(build.shouldUnshift){block.body.unshift(declar)}else{block.body.push(declar)}}block.body=block.body.concat(node.body.body);loop._scopeInfo=node._scopeInfo;return loop};var loose=function(node,parent,scope,context,file){var left=node.left;var declar,id;if(t.isIdentifier(left)||t.isPattern(left)){id=left}else if(t.isVariableDeclaration(left)){id=left.declarations[0].id;declar=t.variableDeclaration(left.kind,[t.variableDeclarator(id)])}else{throw file.errorWithNode(left,"Unknown node type "+left.type+" in ForOfStatement")}var loop=util.template("for-of-loose",{LOOP_OBJECT:scope.generateUidIdentifier("iterator"),IS_ARRAY:scope.generateUidIdentifier("isArray"),OBJECT:node.right,INDEX:scope.generateUidIdentifier("i"),ID:id});return{shouldUnshift:true,declar:declar,loop:loop}};var spec=function(node,parent,scope,context,file){var left=node.left;var declar;var stepKey=scope.generateUidIdentifier("step");var stepValue=t.memberExpression(stepKey,t.identifier("value"));if(t.isIdentifier(left)||t.isPattern(left)){declar=t.expressionStatement(t.assignmentExpression("=",left,stepValue))}else if(t.isVariableDeclaration(left)){declar=t.variableDeclaration(left.kind,[t.variableDeclarator(left.declarations[0].id,stepValue)])}else{throw file.errorWithNode(left,"Unknown node type "+left.type+" in ForOfStatement")}var loop=util.template("for-of",{ITERATOR_KEY:scope.generateUidIdentifier("iterator"),STEP_KEY:stepKey,OBJECT:node.right});return{declar:declar,loop:loop}}},{"../../../types":101,"../../../util":104}],59:[function(require,module,exports){"use strict";var t=require("../../../types");exports.ImportDeclaration=function(node,parent,scope,context,file){var nodes=[];if(node.specifiers.length){for(var i=0;i<node.specifiers.length;i++){file.moduleFormatter.importSpecifier(node.specifiers[i],node,nodes,parent)}}else{file.moduleFormatter.importDeclaration(node,nodes,parent)}if(nodes.length===1){nodes[0]._blockHoist=node._blockHoist}return nodes};exports.ExportDeclaration=function(node,parent,scope,context,file){var nodes=[];var i;if(node.declaration){if(t.isVariableDeclaration(node.declaration)){var declar=node.declaration.declarations[0];declar.init=declar.init||t.identifier("undefined")}file.moduleFormatter.exportDeclaration(node,nodes,parent)}else if(node.specifiers){for(i=0;i<node.specifiers.length;i++){file.moduleFormatter.exportSpecifier(node.specifiers[i],node,nodes,parent)}}if(node._blockHoist){for(i=0;i<nodes.length;i++){nodes[i]._blockHoist=node._blockHoist}}return nodes}},{"../../../types":101}],60:[function(require,module,exports){"use strict";var util=require("../../../util");var t=require("../../../types");var hasDefaults=function(node){for(var i=0;i<node.params.length;i++){if(t.isAssignmentPattern(node.params[i]))return true}return false};exports.Function=function(node,parent,scope){if(!hasDefaults(node))return;t.ensureBlock(node);var iife=false;var body=[];var argsIdentifier=t.identifier("arguments");argsIdentifier._ignoreAliasFunctions=true;var lastNonDefaultParam=0;for(var i=0;i<node.params.length;i++){var param=node.params[i];if(!t.isAssignmentPattern(param)){lastNonDefaultParam=+i+1;continue}var left=param.left;var right=param.right;node.params[i]=scope.generateUidIdentifier("x");var localDeclar=scope.get(left.name,true);if(localDeclar!==left){iife=true}var defNode=util.template("default-parameter",{VARIABLE_NAME:left,DEFAULT_VALUE:right,ARGUMENT_KEY:t.literal(+i),ARGUMENTS:argsIdentifier},true);defNode._blockHoist=node.params.length-i;body.push(defNode)}node.params=node.params.slice(0,lastNonDefaultParam);if(iife){var container=t.functionExpression(null,[],node.body,node.generator);container._aliasFunction=true;body.push(t.returnStatement(t.callExpression(container,[])));node.body=t.blockStatement(body)}else{node.body.body=body.concat(node.body.body)}}},{"../../../types":101,"../../../util":104}],61:[function(require,module,exports){"use strict";var util=require("../../../util");var t=require("../../../types");var hasRest=function(node){return t.isRestElement(node.params[node.params.length-1])};exports.Function=function(node,parent,scope){if(!hasRest(node))return;var rest=node.params.pop().argument;t.ensureBlock(node);var argsId=t.identifier("arguments");argsId._ignoreAliasFunctions=true;var start=t.literal(node.params.length);var key=scope.generateUidIdentifier("key");var len=scope.generateUidIdentifier("len");var arrKey=key;var arrLen=len;if(node.params.length){arrKey=t.binaryExpression("-",key,start);arrLen=t.conditionalExpression(t.binaryExpression(">",len,start),t.binaryExpression("-",len,start),t.literal(0))}if(t.isPattern(rest)){var pattern=rest;rest=scope.generateUidIdentifier("ref");var restDeclar=t.variableDeclaration("var",[t.variableDeclarator(pattern,rest)]);restDeclar._blockHoist=node.params.length+1;node.body.body.unshift(restDeclar)}node.body.body.unshift(util.template("rest",{ARGUMENTS:argsId,ARRAY_KEY:arrKey,ARRAY_LEN:arrLen,START:start,ARRAY:rest,KEY:key,LEN:len}))}},{"../../../types":101,"../../../util":104}],62:[function(require,module,exports){"use strict";var t=require("../../../types");exports.ObjectExpression=function(node,parent,scope,context,file){var hasComputed=false;for(var i=0;i<node.properties.length;i++){hasComputed=t.isProperty(node.properties[i],{computed:true,kind:"init"});if(hasComputed)break}if(!hasComputed)return;var initProps=[];var objId=scope.generateUidBasedOnNode(parent);var body=[];var container=t.functionExpression(null,[],t.blockStatement(body));container._aliasFunction=true;var callback=spec;if(file.isLoose("es6.properties.computed"))callback=loose;var result=callback(node,body,objId,initProps,file);if(result)return result;body.unshift(t.variableDeclaration("var",[t.variableDeclarator(objId,t.objectExpression(initProps))]));body.push(t.returnStatement(objId));return t.callExpression(container,[])};var loose=function(node,body,objId){for(var i=0;i<node.properties.length;i++){var prop=node.properties[i];body.push(t.expressionStatement(t.assignmentExpression("=",t.memberExpression(objId,prop.key,prop.computed),prop.value)))}};var spec=function(node,body,objId,initProps,file){var props=node.properties;var prop,key;for(var i=0;i<props.length;i++){prop=props[i];if(prop.kind!=="init")continue;key=prop.key;if(!prop.computed&&t.isIdentifier(key)){prop.key=t.literal(key.name)}}var broken=false;for(i=0;i<props.length;i++){prop=props[i];if(prop.computed){broken=true}if(prop.kind!=="init"||!broken||t.isLiteral(t.toComputedKey(prop,prop.key),{value:"__proto__"})){initProps.push(prop);props[i]=null}}for(i=0;i<props.length;i++){prop=props[i];if(!prop)continue;key=prop.key;var bodyNode;if(prop.computed&&t.isMemberExpression(key)&&t.isIdentifier(key.object,{name:"Symbol"})){bodyNode=t.assignmentExpression("=",t.memberExpression(objId,key,true),prop.value)}else{bodyNode=t.callExpression(file.addHelper("define-property"),[objId,key,prop.value])}body.push(t.expressionStatement(bodyNode))}if(body.length===1){var first=body[0].expression;if(t.isCallExpression(first)){first.arguments[0]=t.objectExpression(initProps);return first}}}},{"../../../types":101}],63:[function(require,module,exports){"use strict";var nameMethod=require("../../helpers/name-method");var t=require("../../../types");var _=require("lodash");exports.Property=function(node,parent,scope,context,file){if(node.method){node.method=false;nameMethod.property(node,file,scope)}if(node.shorthand){node.shorthand=false;node.key=t.removeComments(_.clone(node.key))}}},{"../../../types":101,"../../helpers/name-method":32,lodash:164}],64:[function(require,module,exports){"use strict";var t=require("../../../types");var _=require("lodash");var getSpreadLiteral=function(spread,file){return file.toArray(spread.argument)};var hasSpread=function(nodes){for(var i=0;i<nodes.length;i++){if(t.isSpreadElement(nodes[i])){return true}}return false};var build=function(props,file){var nodes=[];var _props=[];var push=function(){if(!_props.length)return;nodes.push(t.arrayExpression(_props));_props=[]};for(var i=0;i<props.length;i++){var prop=props[i];if(t.isSpreadElement(prop)){push();nodes.push(getSpreadLiteral(prop,file))}else{_props.push(prop)}}push();return nodes};exports.ArrayExpression=function(node,parent,scope,context,file){var elements=node.elements;if(!hasSpread(elements))return;var nodes=build(elements,file);var first=nodes.shift();if(!t.isArrayExpression(first)){nodes.unshift(first);first=t.arrayExpression([])}return t.callExpression(t.memberExpression(first,t.identifier("concat")),nodes)};exports.CallExpression=function(node,parent,scope,context,file){var args=node.arguments;if(!hasSpread(args))return;var contextLiteral=t.identifier("undefined");node.arguments=[];var nodes;if(args.length===1&&args[0].argument.name==="arguments"){nodes=[args[0].argument]}else{nodes=build(args,file)}var first=nodes.shift();if(nodes.length){node.arguments.push(t.callExpression(t.memberExpression(first,t.identifier("concat")),nodes))}else{node.arguments.push(first)}var callee=node.callee;if(t.isMemberExpression(callee)){var temp=scope.generateTempBasedOnNode(callee.object);if(temp){callee.object=t.assignmentExpression("=",temp,callee.object);contextLiteral=temp}else{contextLiteral=callee.object}t.appendToMemberExpression(callee,t.identifier("apply"))}else{node.callee=t.memberExpression(node.callee,t.identifier("apply"))}node.arguments.unshift(contextLiteral)};exports.NewExpression=function(node,parent,scope,context,file){var args=node.arguments;if(!hasSpread(args))return;var nativeType=t.isIdentifier(node.callee)&&_.contains(t.NATIVE_TYPE_NAMES,node.callee.name);var nodes=build(args,file);if(nativeType){nodes.unshift(t.arrayExpression([t.literal(null)]))}var first=nodes.shift();if(nodes.length){args=t.callExpression(t.memberExpression(first,t.identifier("concat")),nodes)}else{args=first}if(nativeType){return t.newExpression(t.callExpression(t.memberExpression(file.addHelper("bind"),t.identifier("apply")),[node.callee,args]),[])}else{return t.callExpression(file.addHelper("apply-constructor"),[node.callee,args])}}},{"../../../types":101,lodash:164}],65:[function(require,module,exports){"use strict";var t=require("../../../types");var buildBinaryExpression=function(left,right){return t.binaryExpression("+",left,right)};exports.TaggedTemplateExpression=function(node,parent,scope,context,file){var args=[];var quasi=node.quasi;var strings=[];var raw=[];for(var i=0;i<quasi.quasis.length;i++){var elem=quasi.quasis[i];strings.push(t.literal(elem.value.cooked));raw.push(t.literal(elem.value.raw))}strings=t.arrayExpression(strings);raw=t.arrayExpression(raw);var templateName="tagged-template-literal";if(file.isLoose("es6.templateLiterals"))templateName+="-loose";args.push(t.callExpression(file.addHelper(templateName),[strings,raw]));args=args.concat(quasi.expressions);return t.callExpression(node.tag,args)};exports.TemplateLiteral=function(node){var nodes=[];var i;for(i=0;i<node.quasis.length;i++){var elem=node.quasis[i];nodes.push(t.literal(elem.value.cooked));var expr=node.expressions.shift();if(expr)nodes.push(expr)}if(nodes.length>1){var last=nodes[nodes.length-1];if(t.isLiteral(last,{value:""}))nodes.pop();var root=buildBinaryExpression(nodes.shift(),nodes.shift());for(i=0;i<nodes.length;i++){root=buildBinaryExpression(root,nodes[i])}return root}else{return nodes[0]}}},{"../../../types":101}],66:[function(require,module,exports){"use strict";var rewritePattern=require("regexpu/rewrite-pattern");var _=require("lodash");exports.Literal=function(node){var regex=node.regex;if(!regex)return;var flags=regex.flags.split("");if(regex.flags.indexOf("u")<0)return;_.pull(flags,"u");regex.pattern=rewritePattern(regex.pattern,regex.flags);regex.flags=flags.join("")}},{lodash:164,"regexpu/rewrite-pattern":180}],67:[function(require,module,exports){"use strict";var util=require("../../../util");var t=require("../../../types");exports.experimental=true;var container=function(parent,call,ret,file){if(t.isExpressionStatement(parent)&&!file.isConsequenceExpressionStatement(parent)){return call}else{var exprs=[];if(t.isSequenceExpression(call)){exprs=call.expressions}else{exprs.push(call)}exprs.push(ret);return t.sequenceExpression(exprs)}};exports.AssignmentExpression=function(node,parent,scope,context,file){var left=node.left;if(!t.isVirtualPropertyExpression(left))return;var value=node.right;var temp;if(!t.isExpressionStatement(parent)){temp=scope.generateTempBasedOnNode(node.right);if(temp)value=temp}if(node.operator!=="="){value=t.binaryExpression(node.operator[0],util.template("abstract-expression-get",{PROPERTY:node.property,OBJECT:node.object}),value)}var call=util.template("abstract-expression-set",{PROPERTY:left.property,OBJECT:left.object,VALUE:value});if(temp){call=t.sequenceExpression([t.assignmentExpression("=",temp,node.right),call])}return container(parent,call,value,file)};exports.UnaryExpression=function(node,parent,scope,context,file){var arg=node.argument;if(!t.isVirtualPropertyExpression(arg))return;if(node.operator!=="delete")return;var call=util.template("abstract-expression-delete",{PROPERTY:arg.property,OBJECT:arg.object});return container(parent,call,t.literal(true),file)};exports.CallExpression=function(node,parent,scope){var callee=node.callee;if(!t.isVirtualPropertyExpression(callee))return;var temp=scope.generateTempBasedOnNode(callee.object);var call=util.template("abstract-expression-call",{PROPERTY:callee.property,OBJECT:temp||callee.object});call.arguments=call.arguments.concat(node.arguments);if(temp){return t.sequenceExpression([t.assignmentExpression("=",temp,callee.object),call])}else{return call}};exports.VirtualPropertyExpression=function(node){return util.template("abstract-expression-get",{PROPERTY:node.property,OBJECT:node.object})};exports.PrivateDeclaration=function(node){return t.variableDeclaration("const",node.declarations.map(function(id){return t.variableDeclarator(id,t.newExpression(t.identifier("WeakMap"),[]))}))}},{"../../../types":101,"../../../util":104}],68:[function(require,module,exports){"use strict";var buildComprehension=require("../../helpers/build-comprehension");var traverse=require("../../../traverse");var util=require("../../../util");var t=require("../../../types");exports.experimental=true;exports.ComprehensionExpression=function(node,parent,scope,context,file){var callback=array;if(node.generator)callback=generator;return callback(node,parent,scope,file)};var generator=function(node){var body=[];var container=t.functionExpression(null,[],t.blockStatement(body),true);container._aliasFunction=true;body.push(buildComprehension(node,function(){return t.expressionStatement(t.yieldExpression(node.body))}));return t.callExpression(container,[])};var array=function(node,parent,scope,file){var uid=scope.generateUidBasedOnNode(parent,file);var container=util.template("array-comprehension-container",{KEY:uid});container.callee._aliasFunction=true;var block=container.callee.body;var body=block.body;if(traverse.hasType(node,scope,"YieldExpression",t.FUNCTION_TYPES)){container.callee.generator=true;container=t.yieldExpression(container,true)}var returnStatement=body.pop();body.push(buildComprehension(node,function(){return util.template("array-push",{STATEMENT:node.body,KEY:uid},true)}));body.push(returnStatement);return container}},{"../../../traverse":97,"../../../types":101,"../../../util":104,"../../helpers/build-comprehension":29}],69:[function(require,module,exports){"use strict";exports.experimental=true;var build=require("../../helpers/build-binary-assignment-operator-transformer");var t=require("../../../types");var MATH_POW=t.memberExpression(t.identifier("Math"),t.identifier("pow"));build(exports,{operator:"**",build:function(left,right){return t.callExpression(MATH_POW,[left,right])}})},{"../../../types":101,"../../helpers/build-binary-assignment-operator-transformer":28}],70:[function(require,module,exports){"use strict";var t=require("../../../types");exports.experimental=true;exports.ObjectExpression=function(node,parent,scope,context,file){var hasSpread=false;var i;var prop;for(i=0;i<node.properties.length;i++){prop=node.properties[i];if(t.isSpreadProperty(prop)){hasSpread=true;break}}if(!hasSpread)return;var args=[];var props=[];var push=function(){if(!props.length)return;args.push(t.objectExpression(props));props=[]};for(i=0;i<node.properties.length;i++){prop=node.properties[i];if(t.isSpreadProperty(prop)){push();args.push(prop.argument)}else{props.push(prop)}}push();if(!t.isObjectExpression(args[0])){args.unshift(t.objectExpression([]))}return t.callExpression(file.addHelper("extends"),args)}},{"../../../types":101}],71:[function(require,module,exports){module.exports={useStrict:require("./other/use-strict"),"validation.undeclaredVariableCheck":require("./validation/undeclared-variable-check"),"validation.noForInOfAssignment":require("./validation/no-for-in-of-assignment"),"validation.setters":require("./validation/setters"),"spec.blockScopedFunctions":require("./spec/block-scoped-functions"),"playground.malletOperator":require("./playground/mallet-operator"),"playground.methodBinding":require("./playground/method-binding"),"playground.memoizationOperator":require("./playground/memoization-operator"),"playground.objectGetterMemoization":require("./playground/object-getter-memoization"),react:require("./other/react"),_modulesSplit:require("./internal/modules-split"),"es7.comprehensions":require("./es7/comprehensions"),"es6.arrowFunctions":require("./es6/arrow-functions"),"es6.classes":require("./es6/classes"),asyncToGenerator:require("./other/async-to-generator"),bluebirdCoroutines:require("./other/bluebird-coroutines"),"es7.objectSpread":require("./es7/object-spread"),"es7.exponentiationOperator":require("./es7/exponentiation-operator"),"es6.spread":require("./es6/spread"),"es6.templateLiterals":require("./es6/template-literals"),"es5.properties.mutators":require("./es5/properties.mutators"),"es6.properties.shorthand":require("./es6/properties.shorthand"),"es6.properties.computed":require("./es6/properties.computed"),"es6.forOf":require("./es6/for-of"),"es6.unicodeRegex":require("./es6/unicode-regex"),"es7.abstractReferences":require("./es7/abstract-references"),"es6.constants":require("./es6/constants"),"es6.blockScoping":require("./es6/block-scoping"),"es6.blockScopingTDZ":require("./es6/block-scoping-tdz"),regenerator:require("./other/regenerator"),"es6.parameters.default":require("./es6/parameters.default"),"es6.parameters.rest":require("./es6/parameters.rest"),"es6.destructuring":require("./es6/destructuring"),selfContained:require("./other/self-contained"),"es6.modules":require("./es6/modules"),_blockHoist:require("./internal/block-hoist"),"spec.protoToAssign":require("./spec/proto-to-assign"),_declarations:require("./internal/declarations"),_aliasFunctions:require("./internal/alias-functions"),_moduleFormatter:require("./internal/module-formatter"),"spec.typeofSymbol":require("./spec/typeof-symbol"),"spec.undefinedToVoid":require("./spec/undefined-to-void"),"minification.propertyLiterals":require("./minification/property-literals"),"minification.memberExpressionLiterals":require("./minification/member-expression-literals")}},{"./es5/properties.mutators":51,"./es6/arrow-functions":52,"./es6/block-scoping":54,"./es6/block-scoping-tdz":53,"./es6/classes":55,"./es6/constants":56,"./es6/destructuring":57,"./es6/for-of":58,"./es6/modules":59,"./es6/parameters.default":60,"./es6/parameters.rest":61,"./es6/properties.computed":62,"./es6/properties.shorthand":63,"./es6/spread":64,"./es6/template-literals":65,"./es6/unicode-regex":66,"./es7/abstract-references":67,"./es7/comprehensions":68,"./es7/exponentiation-operator":69,"./es7/object-spread":70,"./internal/alias-functions":72,"./internal/block-hoist":73,"./internal/declarations":74,"./internal/module-formatter":75,"./internal/modules-split":76,"./minification/member-expression-literals":77,"./minification/property-literals":78,"./other/async-to-generator":79,"./other/bluebird-coroutines":80,"./other/react":81,"./other/regenerator":82,"./other/self-contained":83,"./other/use-strict":84,"./playground/mallet-operator":85,"./playground/memoization-operator":86,"./playground/method-binding":87,"./playground/object-getter-memoization":88,"./spec/block-scoped-functions":89,"./spec/proto-to-assign":90,"./spec/typeof-symbol":91,"./spec/undefined-to-void":92,"./validation/no-for-in-of-assignment":93,"./validation/setters":94,"./validation/undeclared-variable-check":95}],72:[function(require,module,exports){"use strict";var traverse=require("../../../traverse");var t=require("../../../types");var functionChildrenVisitor={enter:function(node,parent,scope,context,state){if(t.isFunction(node)&&!node._aliasFunction){return context.skip()}if(node._ignoreAliasFunctions)return context.skip();var getId;if(t.isIdentifier(node)&&node.name==="arguments"){getId=state.getArgumentsId}else if(t.isThisExpression(node)){getId=state.getThisId}else{return}if(t.isReferenced(node,parent))return getId()}};var functionVisitor={enter:function(node,parent,scope,context,state){if(!node._aliasFunction){if(t.isFunction(node)){return context.skip()}else{return}}traverse(node,functionChildrenVisitor,scope,state);return context.skip()}};var go=function(getBody,node,scope){var argumentsId;var thisId;var state={getArgumentsId:function(){return argumentsId=argumentsId||scope.generateUidIdentifier("arguments")},getThisId:function(){return thisId=thisId||scope.generateUidIdentifier("this")}};traverse(node,functionVisitor,scope,state);var body;var pushDeclaration=function(id,init){body=body||getBody();body.unshift(t.variableDeclaration("var",[t.variableDeclarator(id,init)]))};if(argumentsId){pushDeclaration(argumentsId,t.identifier("arguments"))}if(thisId){pushDeclaration(thisId,t.thisExpression())}};exports.Program=function(node,parent,scope){go(function(){return node.body},node,scope)};exports.FunctionDeclaration=exports.FunctionExpression=function(node,parent,scope){go(function(){t.ensureBlock(node);return node.body.body},node,scope)}},{"../../../traverse":97,"../../../types":101}],73:[function(require,module,exports){"use strict";var useStrict=require("../../helpers/use-strict");var _=require("lodash");exports.BlockStatement=exports.Program={exit:function(node){var hasChange=false;for(var i=0;i<node.body.length;i++){var bodyNode=node.body[i];if(bodyNode&&bodyNode._blockHoist!=null)hasChange=true}if(!hasChange)return;useStrict.wrap(node,function(){var nodePriorities=_.groupBy(node.body,function(bodyNode){var priority=bodyNode._blockHoist;if(priority==null)priority=1;if(priority===true)priority=2;return priority});node.body=_.flatten(_.values(nodePriorities).reverse())})}}},{"../../helpers/use-strict":35,lodash:164}],74:[function(require,module,exports){"use strict";var useStrict=require("../../helpers/use-strict");var t=require("../../../types");exports.secondPass=true;exports.BlockStatement=exports.Program=function(node){if(!node._declarations)return;var kinds={};var kind;useStrict.wrap(node,function(){for(var i in node._declarations){var declar=node._declarations[i];kind=declar.kind||"var";var declarNode=t.variableDeclarator(declar.id,declar.init);if(!declar.init){kinds[kind]=kinds[kind]||[];kinds[kind].push(declarNode)}else{node.body.unshift(t.variableDeclaration(kind,[declarNode]))}}for(kind in kinds){node.body.unshift(t.variableDeclaration(kind,kinds[kind]))}});node._declarations=null}},{"../../../types":101,"../../helpers/use-strict":35}],75:[function(require,module,exports){"use strict";var useStrict=require("../../helpers/use-strict");exports.ast={exit:function(ast,file){if(!file.transformers["es6.modules"].canRun())return;useStrict.wrap(ast.program,function(){ast.program.body=file.dynamicImports.concat(ast.program.body)});if(file.moduleFormatter.transform){file.moduleFormatter.transform(ast)}}}},{"../../helpers/use-strict":35}],76:[function(require,module,exports){"use strict";var t=require("../../../types");exports.ExportDeclaration=function(node,parent,scope){var declar=node.declaration;if(node.default){if(t.isClassDeclaration(declar)){node.declaration=declar.id;return[declar,node]}else if(t.isClassExpression(declar)){var temp=scope.generateUidIdentifier("default");declar=t.variableDeclaration("var",[t.variableDeclarator(temp,declar)]);node.declaration=temp;return[declar,node]}}else{if(t.isFunctionDeclaration(declar)){node.specifiers=[t.importSpecifier(declar.id,declar.id)];node.declaration=null;
node._blockHoist=2;return[declar,node]}}}},{"../../../types":101}],77:[function(require,module,exports){"use strict";var t=require("../../../types");exports.MemberExpression=function(node){var prop=node.property;if(node.computed&&t.isLiteral(prop)&&t.isValidIdentifier(prop.value)){node.property=t.identifier(prop.value);node.computed=false}else if(!node.computed&&t.isIdentifier(prop)&&!t.isValidIdentifier(prop.name)){node.property=t.literal(prop.name);node.computed=true}}},{"../../../types":101}],78:[function(require,module,exports){"use strict";var t=require("../../../types");exports.Property=function(node){var key=node.key;if(t.isLiteral(key)&&t.isValidIdentifier(key.value)){node.key=t.identifier(key.value);node.computed=false}else if(!node.computed&&t.isIdentifier(key)&&!t.isValidIdentifier(key.name)){node.key=t.literal(key.name)}}},{"../../../types":101}],79:[function(require,module,exports){"use strict";var remapAsyncToGenerator=require("../../helpers/remap-async-to-generator");var bluebirdCoroutines=require("./bluebird-coroutines");exports.optional=true;exports.manipulateOptions=bluebirdCoroutines.manipulateOptions;exports.Function=function(node,parent,scope,context,file){if(!node.async||node.generator)return;return remapAsyncToGenerator(node,file.addHelper("async-to-generator"),scope)}},{"../../helpers/remap-async-to-generator":33,"./bluebird-coroutines":80}],80:[function(require,module,exports){"use strict";var remapAsyncToGenerator=require("../../helpers/remap-async-to-generator");var t=require("../../../types");exports.manipulateOptions=function(opts){opts.experimental=true;opts.blacklist.push("regenerator")};exports.optional=true;exports.Function=function(node,parent,scope,context,file){if(!node.async||node.generator)return;return remapAsyncToGenerator(node,t.memberExpression(file.addImport("bluebird"),t.identifier("coroutine")),scope)}},{"../../../types":101,"../../helpers/remap-async-to-generator":33}],81:[function(require,module,exports){"use strict";var esutils=require("esutils");var t=require("../../../types");exports.JSXIdentifier=function(node){if(esutils.keyword.isIdentifierName(node.name)){node.type="Identifier"}else{return t.literal(node.name)}};exports.JSXNamespacedName=function(node,parent,scope,context,file){throw file.errorWithNode(node,"Namespace tags are not supported. ReactJSX is not XML.")};exports.JSXMemberExpression={exit:function(node){node.computed=t.isLiteral(node.property);node.type="MemberExpression"}};exports.JSXExpressionContainer=function(node){return node.expression};exports.JSXAttribute={exit:function(node){var value=node.value||t.literal(true);return t.inherits(t.property("init",node.name,value),node)}};var isCompatTag=function(tagName){return/^[a-z]|\-/.test(tagName)};exports.JSXOpeningElement={exit:function(node,parent,scope,context,file){var reactCompat=file.opts.reactCompat;var tagExpr=node.name;var args=[];var tagName;if(t.isIdentifier(tagExpr)){tagName=tagExpr.name}else if(t.isLiteral(tagExpr)){tagName=tagExpr.value}if(!reactCompat){if(tagName&&isCompatTag(tagName)){args.push(t.literal(tagName))}else{args.push(tagExpr)}}var attribs=node.attributes;if(attribs.length){attribs=buildJSXOpeningElementAttributes(attribs,file)}else{attribs=t.literal(null)}args.push(attribs);if(reactCompat){if(tagName&&isCompatTag(tagName)){return t.callExpression(t.memberExpression(t.memberExpression(t.identifier("React"),t.identifier("DOM")),tagExpr,t.isLiteral(tagExpr)),args)}}else{tagExpr=t.memberExpression(t.identifier("React"),t.identifier("createElement"))}return t.callExpression(tagExpr,args)}};var buildJSXOpeningElementAttributes=function(attribs,file){var _props=[];var objs=[];var pushProps=function(){if(!_props.length)return;objs.push(t.objectExpression(_props));_props=[]};while(attribs.length){var prop=attribs.shift();if(t.isJSXSpreadAttribute(prop)){pushProps();objs.push(prop.argument)}else{_props.push(prop)}}pushProps();if(objs.length===1){attribs=objs[0]}else{if(!t.isObjectExpression(objs[0])){objs.unshift(t.objectExpression([]))}attribs=t.callExpression(file.addHelper("extends"),objs)}return attribs};exports.JSXElement={exit:function(node){var callExpr=node.openingElement;for(var i=0;i<node.children.length;i++){var child=node.children[i];if(t.isLiteral(child)&&typeof child.value==="string"){cleanJSXElementLiteralChild(child,callExpr.arguments);continue}else if(t.isJSXEmptyExpression(child)){continue}callExpr.arguments.push(child)}if(callExpr.arguments.length>=3){callExpr._prettyCall=true}return t.inherits(callExpr,node)}};var cleanJSXElementLiteralChild=function(child,args){var lines=child.value.split(/\r\n|\n|\r/);for(var i=0;i<lines.length;i++){var line=lines[i];var isFirstLine=i===0;var isLastLine=i===lines.length-1;var trimmedLine=line.replace(/\t/g," ");if(!isFirstLine){trimmedLine=trimmedLine.replace(/^[ ]+/,"")}if(!isLastLine){trimmedLine=trimmedLine.replace(/[ ]+$/,"")}if(trimmedLine){args.push(t.literal(trimmedLine))}}};var isCreateClass=function(call){if(!call||!t.isCallExpression(call))return false;var callee=call.callee;if(!t.isMemberExpression(callee))return false;var obj=callee.object;if(!t.isIdentifier(obj,{name:"React"}))return false;var prop=callee.property;if(!t.isIdentifier(prop,{name:"createClass"}))return false;var args=call.arguments;if(args.length!==1)return false;var first=args[0];if(!t.isObjectExpression(first))return;return true};var addDisplayName=function(id,call){if(!isCreateClass(call))return;var props=call.arguments[0].properties;var safe=true;for(var i=0;i<props.length;i++){var prop=props[i];if(t.isIdentifier(prop.key,{name:"displayName"})){safe=false;break}}if(safe){props.unshift(t.property("init",t.identifier("displayName"),t.literal(id)))}};exports.AssignmentExpression=exports.Property=exports.VariableDeclarator=function(node){var left,right;if(t.isAssignmentExpression(node)){left=node.left;right=node.right}else if(t.isProperty(node)){left=node.key;right=node.value}else if(t.isVariableDeclarator(node)){left=node.id;right=node.init}if(t.isMemberExpression(left)){left=left.property}if(t.isIdentifier(left)){addDisplayName(left.name,right)}}},{"../../../types":101,esutils:162}],82:[function(require,module,exports){"use strict";var regenerator=require("regenerator-6to5");exports.ast={before:function(ast,file){regenerator.transform(ast,{includeRuntime:file.opts.includeRegenerator&&"if used"})}}},{"regenerator-6to5":172}],83:[function(require,module,exports){"use strict";var traverse=require("../../../traverse");var util=require("../../../util");var core=require("core-js/library");var t=require("../../../types");var _=require("lodash");var coreHas=function(node){return node.name!=="_"&&_.has(core,node.name)};var ALIASABLE_CONSTRUCTORS=["Symbol","Promise","Map","WeakMap","Set","WeakSet"];var astVisitor={enter:function(node,parent,scope,context,file){var prop;if(t.isMemberExpression(node)&&t.isReferenced(node,parent)){var obj=node.object;prop=node.property;if(!t.isReferenced(obj,node))return;if(!node.computed&&coreHas(obj)&&_.has(core[obj.name],prop.name)){context.skip();return t.prependToMemberExpression(node,file.get("coreIdentifier"))}}else if(t.isReferencedIdentifier(node,parent)&&!t.isMemberExpression(parent)&&_.contains(ALIASABLE_CONSTRUCTORS,node.name)&&!scope.get(node.name,true)){return t.memberExpression(file.get("coreIdentifier"),node)}else if(t.isCallExpression(node)){if(node.arguments.length)return;var callee=node.callee;if(!t.isMemberExpression(callee))return;if(!callee.computed)return;prop=callee.property;if(!t.isIdentifier(prop.object,{name:"Symbol"}))return;if(!t.isIdentifier(prop.property,{name:"iterator"}))return;return util.template("corejs-iterator",{CORE_ID:file.get("coreIdentifier"),VALUE:callee.object})}}};exports.optional=true;exports.ast={enter:function(ast,file){file.setDynamic("runtimeIdentifier",function(){return file.addImport("6to5-runtime/helpers","to5Helpers")});file.setDynamic("coreIdentifier",function(){return file.addImport("6to5-runtime/core-js","core")});file.setDynamic("regeneratorIdentifier",function(){return file.addImport("6to5-runtime/regenerator","regeneratorRuntime")})},after:function(ast,file){traverse(ast,astVisitor,null,file)}};exports.Identifier=function(node,parent,scope,context,file){if(node.name==="regeneratorRuntime"&&t.isReferenced(node,parent)){return file.get("regeneratorIdentifier")}}},{"../../../traverse":97,"../../../types":101,"../../../util":104,"core-js/library":154,lodash:164}],84:[function(require,module,exports){"use strict";var useStrict=require("../../helpers/use-strict");var t=require("../../../types");exports.ast={exit:function(ast){if(!useStrict.has(ast.program)){ast.program.body.unshift(t.expressionStatement(t.literal("use strict")))}}};exports.FunctionDeclaration=exports.FunctionExpression=function(node,parent,scope,context){context.skip()};exports.ThisExpression=function(node,parent,scope,context,file){throw file.errorWithNode(node,"Top level `this` is not allowed",ReferenceError)}},{"../../../types":101,"../../helpers/use-strict":35}],85:[function(require,module,exports){"use strict";var build=require("../../helpers/build-conditional-assignment-operator-transformer");var t=require("../../../types");build(exports,{is:function(node,file){var is=t.isAssignmentExpression(node)&&node.operator==="||=";if(is){var left=node.left;if(!t.isMemberExpression(left)&&!t.isIdentifier(left)){throw file.errorWithNode(left,"Expected type MemeberExpression or Identifier")}return true}},build:function(node){return t.unaryExpression("!",node,true)}})},{"../../../types":101,"../../helpers/build-conditional-assignment-operator-transformer":30}],86:[function(require,module,exports){"use strict";var build=require("../../helpers/build-conditional-assignment-operator-transformer");var t=require("../../../types");build(exports,{is:function(node){var is=t.isAssignmentExpression(node)&&node.operator==="?=";if(is)t.assertMemberExpression(node.left);return is},build:function(node,file){return t.unaryExpression("!",t.callExpression(t.memberExpression(file.addHelper("has-own"),t.identifier("call")),[node.object,node.property]),true)}})},{"../../../types":101,"../../helpers/build-conditional-assignment-operator-transformer":30}],87:[function(require,module,exports){"use strict";var t=require("../../../types");exports.BindMemberExpression=function(node,parent,scope){var object=node.object;var prop=node.property;var temp=scope.generateTempBasedOnNode(node.object);if(temp)object=temp;var call=t.callExpression(t.memberExpression(t.memberExpression(object,prop),t.identifier("bind")),[object].concat(node.arguments));if(temp){return t.sequenceExpression([t.assignmentExpression("=",temp,node.object),call])}else{return call}};exports.BindFunctionExpression=function(node,parent,scope,context,file){var buildCall=function(args){var param=scope.generateUidIdentifier("val");return t.functionExpression(null,[param],t.blockStatement([t.returnStatement(t.callExpression(t.memberExpression(param,node.callee),args))]))};var temp=scope.generateTemp(file,"args");return t.sequenceExpression([t.assignmentExpression("=",temp,t.arrayExpression(node.arguments)),buildCall(node.arguments.map(function(node,i){return t.memberExpression(temp,t.literal(i),true)}))])}},{"../../../types":101}],88:[function(require,module,exports){"use strict";var traverse=require("../../../traverse");var t=require("../../../types");var visitor={enter:function(node,parent,scope,context,state){if(t.isFunction(node))return;if(t.isReturnStatement(node)&&node.argument){node.argument=t.memberExpression(t.callExpression(state.file.addHelper("define-property"),[t.thisExpression(),state.key,node.argument]),state.key,true)}}};exports.Property=exports.MethodDefinition=function(node,parent,scope,context,file){if(node.kind!=="memo")return;node.kind="get";var value=node.value;t.ensureBlock(value);var key=node.key;if(t.isIdentifier(key)&&!node.computed){key=t.literal(key.name)}var state={key:key,file:file};traverse(value,visitor,scope,state)}},{"../../../traverse":97,"../../../types":101}],89:[function(require,module,exports){"use strict";var t=require("../../../types");exports.BlockStatement=function(node,parent){if(t.isFunction(parent)||t.isExportDeclaration(parent)){return}for(var i=0;i<node.body.length;i++){var func=node.body[i];if(!t.isFunctionDeclaration(i))continue;var declar=t.variableDeclaration("let",[t.variableDeclarator(func.id,t.toExpression(func))]);declar._blockHoist=2;func.id=null;func.body[i]=declar}}},{"../../../types":101}],90:[function(require,module,exports){"use strict";var t=require("../../../types");var _=require("lodash");var isProtoKey=function(node){return t.isLiteral(t.toComputedKey(node,node.key),{value:"__proto__"})};var isProtoAssignmentExpression=function(node){var left=node.left;return t.isMemberExpression(left)&&t.isLiteral(t.toComputedKey(left,left.property),{value:"__proto__"})};var buildDefaultsCallExpression=function(expr,ref,file){return t.expressionStatement(t.callExpression(file.addHelper("defaults"),[ref,expr.right]))};exports.optional=true;exports.secondPass=true;exports.AssignmentExpression=function(node,parent,scope,context,file){if(!isProtoAssignmentExpression(node))return;var nodes=[];var left=node.left.object;var temp=scope.generateTempBasedOnNode(node.left.object);nodes.push(t.expressionStatement(t.assignmentExpression("=",temp,left)));nodes.push(buildDefaultsCallExpression(node,temp,file));if(temp)nodes.push(temp);return t.toSequenceExpression(nodes)};exports.ExpressionStatement=function(node,parent,scope,context,file){var expr=node.expression;if(!t.isAssignmentExpression(expr,{operator:"="}))return;if(isProtoAssignmentExpression(expr)){return buildDefaultsCallExpression(expr,expr.left.object,file)}};exports.ObjectExpression=function(node,parent,scope,context,file){var proto;for(var i=0;i<node.properties.length;i++){var prop=node.properties[i];if(isProtoKey(prop)){proto=prop.value;_.pull(node.properties,prop)}}if(proto){var args=[t.objectExpression([]),proto];if(node.properties.length)args.push(node);return t.callExpression(file.addHelper("extends"),args)}}},{"../../../types":101,lodash:164}],91:[function(require,module,exports){"use strict";var t=require("../../../types");exports.optional=true;exports.UnaryExpression=function(node,parent,scope,context,file){context.skip();if(node.operator==="typeof"){var call=t.callExpression(file.addHelper("typeof"),[node.argument]);if(t.isIdentifier(node.argument)){var undefLiteral=t.literal("undefined");return t.conditionalExpression(t.binaryExpression("===",t.unaryExpression("typeof",node.argument),undefLiteral),undefLiteral,call)}else{return call}}}},{"../../../types":101}],92:[function(require,module,exports){"use strict";var t=require("../../../types");exports.optional=true;exports.Identifier=function(node,parent){if(node.name==="undefined"&&t.isReferenced(node,parent)){return t.unaryExpression("void",t.literal(0),true)}}},{"../../../types":101}],93:[function(require,module,exports){"use strict";var t=require("../../../types");exports.ForInStatement=exports.ForOfStatement=function(node,parent,scope,context,file){var left=node.left;if(t.isVariableDeclaration(left)){var declar=left.declarations[0];if(declar.init)throw file.errorWithNode(declar,"No assignments allowed in for-in/of head")}}},{"../../../types":101}],94:[function(require,module,exports){"use strict";exports.MethodDefinition=exports.Property=function(node,parent,scope,context,file){if(node.kind==="set"&&node.value.params.length!==1){throw file.errorWithNode(node.value,"Setters must have only one parameter")}}},{}],95:[function(require,module,exports){"use strict";exports.optional=true;exports.Identifier=function(node,parent,scope,context,file){if(!scope.has(node.name,true)){throw file.errorWithNode(node,"Reference to undeclared variable",ReferenceError)}}},{}],96:[function(require,module,exports){module.exports=["Set","Map","WeakMap","WeakSet","Proxy","Promise","Reflect","Symbol","System","__filename","__dirname","GLOBAL","global","module","require","Buffer","console","exports","process","setTimeout","clearTimeout","setInterval","clearInterval","setImmediate","clearImmediate","Array","Boolean","Date","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","Error","eval","EvalError","Function","hasOwnProperty","isFinite","isNaN","JSON","Map","Math","Number","Object","Proxy","Promise","parseInt","parseFloat","RangeError","ReferenceError","RegExp","Set","String","SyntaxError","TypeError","URIError","WeakMap","WeakSet","arguments","NaN","window","self"]},{}],97:[function(require,module,exports){"use strict";module.exports=traverse;var Scope=require("./scope");var t=require("../types");var _=require("lodash");function TraversalContext(){this.shouldFlatten=false;this.shouldRemove=false;this.shouldSkip=false;this.shouldStop=false}TraversalContext.prototype.flatten=function(){this.shouldFlatten=true};TraversalContext.prototype.remove=function(){this.shouldRemove=true;this.shouldSkip=true};TraversalContext.prototype.skip=function(){this.shouldSkip=true};TraversalContext.prototype.stop=function(){this.shouldStop=true;this.shouldSkip=true};TraversalContext.prototype.reset=function(){this.shouldRemove=false;this.shouldSkip=false;this.shouldStop=false};function replaceNode(obj,key,node,result){var isArray=Array.isArray(result);var inheritTo=result;if(isArray)inheritTo=result[0];if(inheritTo)t.inheritsComments(inheritTo,node);obj[key]=result;if(isArray&&_.contains(t.STATEMENT_OR_BLOCK_KEYS,key)&&!t.isBlockStatement(obj)){t.ensureBlock(obj,key)}if(isArray){return true}}TraversalContext.prototype.enterNode=function(obj,key,node,enter,parent,scope,state){var result=enter(node,parent,scope,this,state);var flatten=false;if(result){flatten=replaceNode(obj,key,node,result);node=result;if(flatten){this.shouldFlatten=true}}if(this.shouldRemove){obj[key]=null;this.shouldFlatten=true}return node};TraversalContext.prototype.exitNode=function(obj,key,node,exit,parent,scope,state){var result=exit(node,parent,scope,this,state);var flatten=false;if(result){flatten=replaceNode(obj,key,node,result);node=result;if(flatten){this.shouldFlatten=true}}return node};TraversalContext.prototype.visitNode=function(obj,key,opts,scope,parent,state){this.reset();var node=obj[key];if(opts.blacklist&&opts.blacklist.indexOf(node.type)>-1){return}var ourScope=scope;if(t.isScope(node)){ourScope=new Scope(node,scope)}node=this.enterNode(obj,key,node,opts.enter,parent,ourScope,state);if(this.shouldSkip){return this.shouldStop}if(Array.isArray(node)){for(var i=0;i<node.length;i++){traverseNode(node[i],opts,ourScope,state)}}else{traverseNode(node,opts,ourScope,state);this.exitNode(obj,key,node,opts.exit,parent,ourScope,state)}return this.shouldStop};TraversalContext.prototype.visit=function(node,key,opts,scope,state){var nodes=node[key];if(!nodes)return;if(!Array.isArray(nodes)){return this.visitNode(node,key,opts,scope,node,state)}if(nodes.length===0){return}for(var i=0;i<nodes.length;i++){if(nodes[i]&&this.visitNode(nodes,i,opts,scope,node,state)){return true}}if(this.shouldFlatten){node[key]=_.flatten(node[key]);if(key==="body"){node[key]=_.compact(node[key])}}};function traverseNode(node,opts,scope,state){var keys=t.VISITOR_KEYS[node.type];if(!keys)return;var context=new TraversalContext;for(var i=0;i<keys.length;i++){if(context.visit(node,keys[i],opts,scope,state)){return}}}function traverse(parent,opts,scope,state){if(!parent)return;if(!scope){if(parent.type!=="Program"&&parent.type!=="File"){throw new Error("Must pass a scope unless traversing a Program/File got a "+parent.type+" node")}}if(!opts)opts={};if(!opts.enter)opts.enter=_.noop;if(!opts.exit)opts.exit=_.noop;if(Array.isArray(parent)){for(var i=0;i<parent.length;i++){traverseNode(parent[i],opts,scope,state)}}else{traverseNode(parent,opts,scope,state)}}function clearNode(node){node._declarations=null;node.extendedRange=null;node._scopeInfo=null;node.tokens=null;node.range=null;node.start=null;node.end=null;node.loc=null;node.raw=null;if(Array.isArray(node.trailingComments)){clearComments(node.trailingComments)}if(Array.isArray(node.leadingComments)){clearComments(node.leadingComments)}}var clearVisitor={enter:clearNode};function clearComments(comments){for(var i=0;i<comments.length;i++){clearNode(comments[i])}}traverse.removeProperties=function(tree){clearNode(tree);traverse(tree,clearVisitor);return tree};function hasBlacklistedType(node,parent,scope,context,state){if(node.type===state.type){state.has=true;context.skip()}}traverse.hasType=function(tree,scope,type,blacklistTypes){if(_.contains(blacklistTypes,tree.type))return false;if(tree.type===type)return true;var state={has:false,type:type};traverse(tree,{blacklist:blacklistTypes,enter:hasBlacklistedType},scope,state);return state.has}},{"../types":101,"./scope":98,lodash:164}],98:[function(require,module,exports){"use strict";module.exports=Scope;var traverse=require("./index");var object=require("../helpers/object");var t=require("../types");var _=require("lodash");var FOR_KEYS=["left","init"];function Scope(block,parent,file){this.parent=parent;this.block=block;this.file=parent?parent.file:file;var info=this.getInfo();this.references=info.references;this.declarations=info.declarations;this.declarationKinds=info.declarationKinds}Scope.defaultDeclarations=require("./global-keys");Scope.prototype._add=function(node,references,throwOnDuplicate){if(!node)return;var ids=t.getIds(node,true);for(var key in ids){var id=ids[key];if(throwOnDuplicate&&references[key]){throw this.file.errorWithNode(id,"Duplicate declaration",TypeError)}references[key]=id}};Scope.prototype.generateTemp=function(file,name){var id=file.generateUidIdentifier(name||"temp",this);this.push({key:id.name,id:id});return id};Scope.prototype.generateUidIdentifier=function(name){return this.file.generateUidIdentifier(name,this)};Scope.prototype.generateUidBasedOnNode=function(parent){var node=parent;if(t.isAssignmentExpression(parent)){node=parent.left}else if(t.isVariableDeclarator(parent)){node=parent.id}else if(t.isProperty(node)){node=node.key}var parts=[];var add=function(node){if(t.isMemberExpression(node)){add(node.object);add(node.property)}else if(t.isIdentifier(node)){parts.push(node.name)}else if(t.isLiteral(node)){parts.push(node.value)}else if(t.isCallExpression(node)){add(node.callee)}};add(node);var id=parts.join("$");id=id.replace(/^_/,"")||"ref";return this.file.generateUidIdentifier(id,this)};Scope.prototype.generateTempBasedOnNode=function(node){if(t.isIdentifier(node)&&this.has(node.name,true)){return null}var id=this.generateUidBasedOnNode(node);this.push({key:id.name,id:id});return id};var functionVariableVisitor={enter:function(node,parent,scope,context,state){if(t.isFor(node)){_.each(FOR_KEYS,function(key){var declar=node[key];if(t.isVar(declar))state.add(declar)})}if(t.isFunction(node))return context.skip();if(state.blockId&&node===state.blockId)return;if(t.isDeclaration(node)&&!t.isBlockScoped(node)){state.add(node)}}};var programReferenceVisitor={enter:function(node,parent,scope,context,add){if(t.isReferencedIdentifier(node,parent)&&!scope.has(node.name)){add(node,true)}}};var blockVariableVisitor={enter:function(node,parent,scope,context,add){if(t.isBlockScoped(node)){add(node,false,true);context.stop()}else if(t.isScope(node)){context.skip()}}};Scope.prototype.getInfo=function(){var parent=this.parent;var block=this.block;var self=this;if(block._scopeInfo)return block._scopeInfo;var info=block._scopeInfo={};var references=info.references=object();var declarations=info.declarations=object();var declarationKinds=info.declarationKinds={};var add=function(node,reference,throwOnDuplicate){self._add(node,references);if(!reference){self._add(node,declarations,throwOnDuplicate);self._add(node,declarationKinds[node.kind]=declarationKinds[node.kind]||object())}};if(parent&&t.isBlockStatement(block)&&t.isFor(parent.block)){return info}if(t.isFor(block)){_.each(FOR_KEYS,function(key){var node=block[key];if(t.isBlockScoped(node))add(node,false,true)});if(t.isBlockStatement(block.body)){block=block.body}}if(t.isBlockStatement(block)||t.isProgram(block)){traverse(block,blockVariableVisitor,this,add)}if(t.isCatchClause(block)){add(block.param)}if(t.isComprehensionExpression(block)){add(block)}if(t.isProgram(block)||t.isFunction(block)){traverse(block,functionVariableVisitor,this,{blockId:block.id,add:add})}if(t.isProgram(block)){traverse(block,programReferenceVisitor,this,add)}if(t.isFunction(block)){_.each(block.params,function(param){add(param)})}return info};Scope.prototype.push=function(opts){var block=this.block;if(t.isFor(block)||t.isCatchClause(block)||t.isFunction(block)){t.ensureBlock(block);block=block.body}if(t.isBlockStatement(block)||t.isProgram(block)){block._declarations=block._declarations||{};block._declarations[opts.key]={kind:opts.kind,id:opts.id,init:opts.init}}else{throw new TypeError("cannot add a declaration here in node type "+block.type)}};Scope.prototype.add=function(node){var scope=this.getFunctionParent();scope._add(node,scope.references)};Scope.prototype.getFunctionParent=function(){var scope=this;while(scope.parent&&!t.isFunction(scope.block)){scope=scope.parent}return scope};Scope.prototype.getAllOfKind=function(kind){var ids=object();var scope=this;do{_.defaults(ids,scope.declarationKinds[kind]);scope=scope.parent}while(scope);return ids};Scope.prototype.get=function(id,decl){return id&&(this.getOwn(id,decl)||this.parentGet(id,decl))};Scope.prototype.getOwn=function(id,decl){var refs=this.references;if(decl)refs=this.declarations;return _.has(refs,id)&&refs[id]};Scope.prototype.parentGet=function(id,decl){return this.parent&&this.parent.get(id,decl)};Scope.prototype.has=function(id,decl){return id&&(this.hasOwn(id,decl)||this.parentHas(id,decl))||_.contains(Scope.defaultDeclarations,id)};Scope.prototype.hasOwn=function(id,decl){return!!this.getOwn(id,decl)};Scope.prototype.parentHas=function(id,decl){return this.parent&&this.parent.has(id,decl)}},{"../helpers/object":25,"../types":101,"./global-keys":96,"./index":97,lodash:164}],99:[function(require,module,exports){module.exports={ExpressionStatement:["Statement"],BreakStatement:["Statement"],ContinueStatement:["Statement"],DebuggerStatement:["Statement"],DoWhileStatement:["Statement","Loop","While"],IfStatement:["Statement"],ReturnStatement:["Statement"],SwitchStatement:["Statement"],ThrowStatement:["Statement"],TryStatement:["Statement"],WhileStatement:["Statement","Loop","While"],WithStatement:["Statement"],EmptyStatement:["Statement"],LabeledStatement:["Statement"],VariableDeclaration:["Statement","Declaration"],ExportDeclaration:["Statement","Declaration"],ImportDeclaration:["Statement","Declaration"],PrivateDeclaration:["Statement","Declaration"],ArrowFunctionExpression:["Scope","Function","Expression"],FunctionDeclaration:["Statement","Declaration","Scope","Function"],FunctionExpression:["Scope","Function","Expression"],BlockStatement:["Statement","Scope"],Program:["Scope"],CatchClause:["Scope"],LogicalExpression:["Binary","Expression"],BinaryExpression:["Binary","Expression"],UnaryExpression:["UnaryLike","Expression"],SpreadProperty:["UnaryLike"],SpreadElement:["UnaryLike"],ClassDeclaration:["Statement","Declaration","Class"],ClassExpression:["Class","Expression"],ForOfStatement:["Statement","For","Scope","Loop"],ForInStatement:["Statement","For","Scope","Loop"],ForStatement:["Statement","For","Scope","Loop"],ObjectPattern:["Pattern"],ArrayPattern:["Pattern"],AssignmentPattern:["Pattern"],Property:["UserWhitespacable"],JSXElement:["UserWhitespacable","Expression"],ArrayExpression:["Expression"],AssignmentExpression:["Expression"],AwaitExpression:["Expression"],BindFunctionExpression:["Expression"],BindMemberExpression:["Expression"],CallExpression:["Expression"],ComprehensionExpression:["Expression","Scope"],ConditionalExpression:["Expression"],Identifier:["Expression"],Literal:["Expression"],MemberExpression:["Expression"],NewExpression:["Expression"],ObjectExpression:["Expression"],SequenceExpression:["Expression"],TaggedTemplateExpression:["Expression"],ThisExpression:["Expression"],UpdateExpression:["Expression"],VirtualPropertyExpression:["Expression"],JSXEmptyExpression:["Expression"],JSXMemberExpression:["Expression"],YieldExpression:["Expression"]}},{}],100:[function(require,module,exports){module.exports={ArrayExpression:["elements"],ArrowFunctionExpression:["params","body"],AssignmentExpression:["operator","left","right"],BinaryExpression:["operator","left","right"],BlockStatement:["body"],CallExpression:["callee","arguments"],ConditionalExpression:["test","consequent","alternate"],ExpressionStatement:["expression"],File:["program","comments","tokens"],FunctionExpression:["id","params","body","generator"],FunctionDeclaration:["id","params","body","generator"],Identifier:["name"],IfStatement:["test","consequent","alternate"],ImportDeclaration:["specifiers","source"],ImportSpecifier:["id","name"],Literal:["value"],LogicalExpression:["operator","left","right"],MemberExpression:["object","property","computed"],MethodDefinition:["key","value","computed","kind"],NewExpression:["callee","arguments"],ObjectExpression:["properties"],Program:["body"],Property:["kind","key","value","computed"],ReturnStatement:["argument"],SequenceExpression:["expressions"],ThrowExpression:["argument"],UnaryExpression:["operator","argument","prefix"],VariableDeclaration:["kind","declarations"],VariableDeclarator:["id","init"],WithStatement:["object","body"],YieldExpression:["argument","delegate"]}},{}],101:[function(require,module,exports){"use strict";var toFastProperties=require("../helpers/to-fast-properties");var esutils=require("esutils");var Node=require("./node");var _=require("lodash");var t=exports;t.NATIVE_TYPE_NAMES=["Array","Object","Number","Boolean","Date","Array","String"];function registerType(type,skipAliasCheck){var is=t["is"+type]=function(node,opts){return t.is(type,node,opts,skipAliasCheck)};t["assert"+type]=function(node,opts){opts=opts||{};if(!is(node,opts)){throw new Error("Expected type "+JSON.stringify(type)+" with option "+JSON.stringify(opts))}}}t.STATEMENT_OR_BLOCK_KEYS=["consequent","body"];t.VISITOR_KEYS=require("./visitor-keys");t.ALIAS_KEYS=require("./alias-keys");t.FLIPPED_ALIAS_KEYS={};_.each(t.VISITOR_KEYS,function(keys,type){registerType(type,true)});_.each(t.ALIAS_KEYS,function(aliases,type){_.each(aliases,function(alias){var types=t.FLIPPED_ALIAS_KEYS[alias]=t.FLIPPED_ALIAS_KEYS[alias]||[];types.push(type)})});_.each(t.FLIPPED_ALIAS_KEYS,function(types,type){t[type.toUpperCase()+"_TYPES"]=types;registerType(type,false)});t.is=function(type,node,opts,skipAliasCheck){if(!node)return;var typeMatches=type===node.type;if(!typeMatches&&!skipAliasCheck){var aliases=t.FLIPPED_ALIAS_KEYS[type];if(typeof aliases!=="undefined"){typeMatches=aliases.indexOf(node.type)>-1}}if(!typeMatches){return false}if(typeof opts!=="undefined"){return t.shallowEqual(node,opts)}return true};t.BUILDER_KEYS=_.defaults(require("./builder-keys"),t.VISITOR_KEYS);_.each(t.BUILDER_KEYS,function(keys,type){t[type[0].toLowerCase()+type.slice(1)]=function(){var args=arguments;var node=new Node;node.start=null;node.type=type;_.each(keys,function(key,i){node[key]=args[i]});return node}});t.toComputedKey=function(node,key){if(!node.computed){if(t.isIdentifier(key))key=t.literal(key.name)}return key};t.isFalsyExpression=function(node){if(t.isLiteral(node)){return!node.value}else if(t.isIdentifier(node)){return node.name==="undefined"}return false};t.toSequenceExpression=function(nodes,scope){var exprs=[];_.each(nodes,function(node){if(t.isExpression(node)){exprs.push(node)}if(t.isExpressionStatement(node)){exprs.push(node.expression)}else if(t.isVariableDeclaration(node)){_.each(node.declarations,function(declar){scope.push({kind:node.kind,key:declar.id.name,id:declar.id});exprs.push(t.assignmentExpression("=",declar.id,declar.init))})}});if(exprs.length===1){return exprs[0]}else{return t.sequenceExpression(exprs)
}};t.shallowEqual=function(actual,expected){var keys=Object.keys(expected);var key;for(var i=0;i<keys.length;i++){key=keys[i];if(actual[key]!==expected[key])return false}return true};t.appendToMemberExpression=function(member,append,computed){member.object=t.memberExpression(member.object,member.property,member.computed);member.property=append;member.computed=!!computed;return member};t.prependToMemberExpression=function(member,append){member.object=t.memberExpression(append,member.object);return member};t.isReferenced=function(node,parent){if(t.isProperty(parent)&&parent.key===node&&!parent.computed)return false;if(t.isFunction(parent)){if(_.contains(parent.params,node))return false;for(var i=0;i<parent.params.length;i++){var param=parent.params[i];if(param===node){return false}else if(t.isRestElement(param)&¶m.argument===node){return false}}}if(t.isMethodDefinition(parent)&&parent.key===node&&!parent.computed){return false}if(t.isCatchClause(parent)&&parent.param===node)return false;if(t.isVariableDeclarator(parent)&&parent.id===node)return false;var isMemberExpression=t.isMemberExpression(parent);var isComputedProperty=isMemberExpression&&parent.property===node&&parent.computed;var isObject=isMemberExpression&&parent.object===node;if(!isMemberExpression||isComputedProperty||isObject)return true;return false};t.isReferencedIdentifier=function(node,parent){return t.isIdentifier(node)&&t.isReferenced(node,parent)};t.isValidIdentifier=function(name){return _.isString(name)&&esutils.keyword.isIdentifierName(name)&&!esutils.keyword.isReservedWordES6(name,true)};t.toIdentifier=function(name){if(t.isIdentifier(name))return name.name;name=name+"";name=name.replace(/[^a-zA-Z0-9$_]/g,"-");name=name.replace(/^[-0-9]+/,"");name=name.replace(/[-_\s]+(.)?/g,function(match,c){return c?c.toUpperCase():""});name=name.replace(/^\_/,"");if(!t.isValidIdentifier(name)){name="_"+name}return name||"_"};t.ensureBlock=function(node,key){key=key||"body";node[key]=t.toBlock(node[key],node)};t.toStatement=function(node,ignore){if(t.isStatement(node)){return node}var mustHaveId=false;var newType;if(t.isClass(node)){mustHaveId=true;newType="ClassDeclaration"}else if(t.isFunction(node)){mustHaveId=true;newType="FunctionDeclaration"}else if(t.isAssignmentExpression(node)){return t.expressionStatement(node)}if(mustHaveId&&!node.id){newType=false}if(!newType){if(ignore){return false}else{throw new Error("cannot turn "+node.type+" to a statement")}}node.type=newType;return node};exports.toExpression=function(node){if(t.isExpressionStatement(node)){node=node.expression}if(t.isClass(node)){node.type="ClassExpression"}else if(t.isFunction(node)){node.type="FunctionExpression"}if(t.isExpression(node)){return node}else{throw new Error("cannot turn "+node.type+" to an expression")}};t.toBlock=function(node,parent){if(t.isBlockStatement(node)){return node}if(t.isEmptyStatement(node)){node=[]}if(!Array.isArray(node)){if(!t.isStatement(node)){if(t.isFunction(parent)){node=t.returnStatement(node)}else{node=t.expressionStatement(node)}}node=[node]}return t.blockStatement(node)};t.getIds=function(node,map,ignoreTypes){ignoreTypes=ignoreTypes||[];var search=[].concat(node);var ids={};while(search.length){var id=search.shift();if(!id)continue;if(_.contains(ignoreTypes,id.type))continue;var nodeKeys=t.getIds.nodes[id.type];var arrKeys=t.getIds.arrays[id.type];var i,key;if(t.isIdentifier(id)){ids[id.name]=id}else if(nodeKeys){for(i=0;i<nodeKeys.length;i++){key=nodeKeys[i];if(id[key]){search.push(id[key]);break}}}else if(arrKeys){for(i=0;i<arrKeys.length;i++){key=arrKeys[i];search=search.concat(id[key]||[])}}}if(!map)ids=_.keys(ids);return ids};t.getIds.nodes={AssignmentExpression:["left"],ImportBatchSpecifier:["name"],ImportSpecifier:["name","id"],ExportSpecifier:["name","id"],VariableDeclarator:["id"],FunctionDeclaration:["id"],ClassDeclaration:["id"],MemeberExpression:["object"],SpreadElement:["argument"],RestElement:["argument"],Property:["value"],ComprehensionBlock:["left"],AssignmentPattern:["left"]};t.getIds.arrays={PrivateDeclaration:["declarations"],ComprehensionExpression:["blocks"],ExportDeclaration:["specifiers","declaration"],ImportDeclaration:["specifiers"],VariableDeclaration:["declarations"],ArrayPattern:["elements"],ObjectPattern:["properties"]};t.isLet=function(node){return t.isVariableDeclaration(node)&&(node.kind!=="var"||node._let)};t.isBlockScoped=function(node){return t.isFunctionDeclaration(node)||t.isLet(node)};t.isVar=function(node){return t.isVariableDeclaration(node,{kind:"var"})&&!node._let};t.COMMENT_KEYS=["leadingComments","trailingComments"];t.removeComments=function(child){_.each(t.COMMENT_KEYS,function(key){delete child[key]});return child};t.inheritsComments=function(child,parent){_.each(t.COMMENT_KEYS,function(key){child[key]=_.uniq(_.compact([].concat(child[key],parent[key])))});return child};t.inherits=function(child,parent){child.range=parent.range;child.start=parent.start;child.loc=parent.loc;child.end=parent.end;t.inheritsComments(child,parent);return child};t.getLastStatements=function(node){var nodes=[];var add=function(node){nodes=nodes.concat(t.getLastStatements(node))};if(t.isIfStatement(node)){add(node.consequent);add(node.alternate)}else if(t.isFor(node)||t.isWhile(node)){add(node.body)}else if(t.isProgram(node)||t.isBlockStatement(node)){add(node.body[node.body.length-1])}else if(node){nodes.push(node)}return nodes};t.getSpecifierName=function(specifier){return specifier.name||specifier.id};t.getSpecifierId=function(specifier){if(specifier.default){return t.identifier("default")}else{return specifier.id}};t.isSpecifierDefault=function(specifier){return specifier.default||t.isIdentifier(specifier.id)&&specifier.id.name==="default"};toFastProperties(t);toFastProperties(t.VISITOR_KEYS)},{"../helpers/to-fast-properties":26,"./alias-keys":99,"./builder-keys":100,"./node":102,"./visitor-keys":103,esutils:162,lodash:164}],102:[function(require,module,exports){"use strict";module.exports=Node;var acorn=require("acorn-6to5");var oldNode=acorn.Node;acorn.Node=Node;function Node(){oldNode.apply(this)}},{"acorn-6to5":105}],103:[function(require,module,exports){module.exports={ArrayExpression:["elements"],ArrayPattern:["elements"],ArrowFunctionExpression:["params","defaults","rest","body"],AssignmentExpression:["left","right"],AssignmentPattern:["left","right"],AwaitExpression:["argument"],BinaryExpression:["left","right"],BindFunctionExpression:["callee","arguments"],BindMemberExpression:["object","property","arguments"],BlockStatement:["body"],BreakStatement:["label"],CallExpression:["callee","arguments"],CatchClause:["param","body"],ClassBody:["body"],ClassDeclaration:["id","body","superClass"],ClassExpression:["id","body","superClass"],ComprehensionBlock:["left","right","body"],ComprehensionExpression:["filter","blocks","body"],ConditionalExpression:["test","consequent","alternate"],ContinueStatement:["label"],DebuggerStatement:[],DoWhileStatement:["body","test"],EmptyStatement:[],ExportBatchSpecifier:[],ExportDeclaration:["declaration","specifiers","source"],ExportSpecifier:["id","name"],ExpressionStatement:["expression"],File:["program"],ForInStatement:["left","right","body"],ForOfStatement:["left","right","body"],ForStatement:["init","test","update","body"],FunctionDeclaration:["id","params","defaults","rest","body"],FunctionExpression:["id","params","defaults","rest","body"],Identifier:[],IfStatement:["test","consequent","alternate"],ImportBatchSpecifier:["id"],ImportDeclaration:["specifiers","source"],ImportSpecifier:["id","name"],LabeledStatement:["label","body"],Literal:[],LogicalExpression:["left","right"],MemberExpression:["object","property"],MethodDefinition:["key","value"],NewExpression:["callee","arguments"],ObjectExpression:["properties"],ObjectPattern:["properties"],PrivateDeclaration:["declarations"],Program:["body"],Property:["key","value"],RestElement:["argument"],ReturnStatement:["argument"],SequenceExpression:["expressions"],SpreadElement:["argument"],SpreadProperty:["argument"],SwitchCase:["test","consequent"],SwitchStatement:["discriminant","cases"],TaggedTemplateExpression:["tag","quasi"],TemplateElement:[],TemplateLiteral:["quasis","expressions"],ThisExpression:[],ThrowStatement:["argument"],TryStatement:["block","handlers","handler","guardedHandlers","finalizer"],UnaryExpression:["argument"],UpdateExpression:["argument"],VariableDeclaration:["declarations"],VariableDeclarator:["id","init"],VirtualPropertyExpression:["object","property"],WhileStatement:["test","body"],WithStatement:["object","body"],YieldExpression:["argument"],AnyTypeAnnotation:[],ArrayTypeAnnotation:[],BooleanTypeAnnotation:[],ClassProperty:["key"],DeclareClass:[],DeclareFunction:[],DeclareModule:[],DeclareVariable:[],FunctionTypeAnnotation:[],FunctionTypeParam:[],GenericTypeAnnotation:[],InterfaceExtends:[],InterfaceDeclaration:[],IntersectionTypeAnnotation:[],NullableTypeAnnotation:[],NumberTypeAnnotation:[],StringLiteralTypeAnnotation:[],StringTypeAnnotation:[],TupleTypeAnnotation:[],TypeofTypeAnnotation:[],TypeAlias:[],TypeAnnotation:[],TypeParameterDeclaration:[],TypeParameterInstantiation:[],ObjectTypeAnnotation:[],ObjectTypeCallProperty:[],ObjectTypeIndexer:[],ObjectTypeProperty:[],QualifiedTypeIdentifier:[],UnionTypeAnnotation:[],VoidTypeAnnotation:[],JSXAttribute:["name","value"],JSXClosingElement:["name"],JSXElement:["openingElement","closingElement","children"],JSXEmptyExpression:[],JSXExpressionContainer:["expression"],JSXIdentifier:[],JSXMemberExpression:["object","property"],JSXNamespacedName:["namespace","name"],JSXOpeningElement:["name","attributes"],JSXSpreadAttribute:["argument"]}},{}],104:[function(require,module,exports){(function(Buffer,__dirname){"use strict";require("./patch");var estraverse=require("estraverse");var codeFrame=require("./helpers/code-frame");var traverse=require("./traverse");var acorn=require("acorn-6to5");var path=require("path");var util=require("util");var fs=require("fs");var t=require("./types");var _=require("lodash");exports.inherits=util.inherits;exports.canCompile=function(filename,altExts){var exts=altExts||exports.canCompile.EXTENSIONS;var ext=path.extname(filename);return _.contains(exts,ext)};exports.canCompile.EXTENSIONS=[".js",".jsx",".es6",".es"];exports.isInteger=function(i){return _.isNumber(i)&&i%1===0};exports.resolve=function(loc){try{return require.resolve(loc)}catch(err){return null}};exports.trimRight=function(str){return str.replace(/[\n\s]+$/g,"")};exports.list=function(val){return val?val.split(","):[]};exports.regexify=function(val){if(!val)return new RegExp(/.^/);if(Array.isArray(val))val=val.join("|");if(_.isString(val))return new RegExp(val);if(_.isRegExp(val))return val;throw new TypeError("illegal type for regexify")};exports.arrayify=function(val){if(!val)return[];if(_.isString(val))return exports.list(val);if(Array.isArray(val))return val;throw new TypeError("illegal type for arrayify")};exports.isAbsolute=function(loc){if(!loc)return false;if(loc[0]==="/")return true;if(loc[1]===":"&&loc[2]==="\\")return true;return false};exports.sourceMapToComment=function(map){var json=JSON.stringify(map);var base64=new Buffer(json).toString("base64");return"//# sourceMappingURL=data:application/json;base64,"+base64};exports.pushMutatorMap=function(mutatorMap,key,kind,computed,method){var alias;if(t.isIdentifier(key)){alias=key.name;if(computed)alias="computed:"+alias}else if(t.isLiteral(key)){alias=String(key.value)}else{alias=JSON.stringify(traverse.removeProperties(_.cloneDeep(key)))}var map;if(_.has(mutatorMap,alias)){map=mutatorMap[alias]}else{map={}}mutatorMap[alias]=map;map._key=key;if(computed){map._computed=true}map[kind]=method};exports.buildDefineProperties=function(mutatorMap){var objExpr=t.objectExpression([]);_.each(mutatorMap,function(map){var mapNode=t.objectExpression([]);var propNode=t.property("init",map._key,mapNode,map._computed);if(!map.get&&!map.set){map.writable=t.literal(true)}map.enumerable=t.literal(true);map.configurable=t.literal(true);_.each(map,function(node,key){if(key[0]==="_")return;node=_.clone(node);var inheritNode=node;if(t.isMethodDefinition(node))node=node.value;var prop=t.property("init",t.identifier(key),node);t.inheritsComments(prop,inheritNode);t.removeComments(inheritNode);mapNode.properties.push(prop)});objExpr.properties.push(propNode)});return objExpr};var templateVisitor={enter:function(node,parent,scope,context,nodes){if(t.isIdentifier(node)&&_.has(nodes,node.name)){return nodes[node.name]}}};exports.template=function(name,nodes,keepExpression){var template=exports.templates[name];if(!template)throw new ReferenceError("unknown template "+name);if(nodes===true){keepExpression=true;nodes=null}template=_.cloneDeep(template);if(!_.isEmpty(nodes)){traverse(template,templateVisitor,null,nodes)}var node=template.body[0];if(!keepExpression&&t.isExpressionStatement(node)){return node.expression}else{return node}};exports.repeat=function(width,cha){cha=cha||" ";var result="";for(var i=0;i<width;i++){result+=cha}return result};exports.normaliseAst=function(ast,comments,tokens){if(ast&&ast.type==="Program"){return t.file(ast,comments||[],tokens||[])}else{throw new Error("Not a valid ast?")}};exports.parse=function(opts,code,callback){try{var comments=[];var tokens=[];var ast=acorn.parse(code,{allowImportExportEverywhere:opts.allowImportExportEverywhere,allowReturnOutsideFunction:true,ecmaVersion:opts.experimental?7:6,playground:opts.playground,strictMode:true,onComment:comments,locations:true,onToken:tokens,ranges:true});estraverse.attachComments(ast,comments,tokens);ast=exports.normaliseAst(ast,comments,tokens);if(callback){return callback(ast)}else{return ast}}catch(err){if(!err._6to5){err._6to5=true;var message=opts.filename+": "+err.message;var loc=err.loc;if(loc){var frame=codeFrame(code,loc.line,loc.column+1);message+=frame}if(err.stack)err.stack=err.stack.replace(err.message,message);err.message=message}throw err}};exports.parseTemplate=function(loc,code){var ast=exports.parse({filename:loc},code).program;return traverse.removeProperties(ast)};var loadTemplates=function(){var templates={};var templatesLoc=__dirname+"/transformation/templates";if(!fs.existsSync(templatesLoc)){throw new Error("no templates directory - this is most likely the "+"result of a broken `npm publish`. Please report to "+"https://github.com/6to5/6to5/issues")}_.each(fs.readdirSync(templatesLoc),function(name){if(name[0]===".")return;var key=path.basename(name,path.extname(name));var loc=templatesLoc+"/"+name;var code=fs.readFileSync(loc,"utf8");templates[key]=exports.parseTemplate(loc,code)});return templates};try{exports.templates=require("../../templates.json")}catch(err){if(err.code!=="MODULE_NOT_FOUND")throw err;exports.templates=loadTemplates()}}).call(this,require("buffer").Buffer,"/lib/6to5")},{"../../templates.json":194,"./helpers/code-frame":24,"./patch":27,"./traverse":97,"./types":101,"acorn-6to5":105,buffer:122,estraverse:158,fs:120,lodash:164,path:129,util:145}],105:[function(require,module,exports){(function(root,mod){if(typeof exports=="object"&&typeof module=="object")return mod(exports);if(typeof define=="function"&&define.amd)return define(["exports"],mod);mod(root.acorn||(root.acorn={}))})(this,function(exports){"use strict";exports.version="0.11.1";var options,input,inputLen,sourceFile;exports.parse=function(inpt,opts){input=String(inpt);inputLen=input.length;setOptions(opts);initTokenState();var startPos=options.locations?[tokPos,curPosition()]:tokPos;initParserState();return parseTopLevel(options.program||startNodeAt(startPos))};var defaultOptions=exports.defaultOptions={playground:false,ecmaVersion:5,strictSemicolons:false,allowTrailingCommas:true,forbidReserved:false,allowReturnOutsideFunction:false,allowImportExportEverywhere:false,allowHashBang:false,locations:false,onToken:null,onComment:null,ranges:false,program:null,sourceFile:null,directSourceFile:null,preserveParens:false};exports.parseExpressionAt=function(inpt,pos,opts){input=String(inpt);inputLen=input.length;setOptions(opts);initTokenState(pos);initParserState();return parseExpression()};var isArray=function(obj){return Object.prototype.toString.call(obj)==="[object Array]"};function setOptions(opts){options={};for(var opt in defaultOptions)options[opt]=opts&&has(opts,opt)?opts[opt]:defaultOptions[opt];sourceFile=options.sourceFile||null;if(isArray(options.onToken)){var tokens=options.onToken;options.onToken=function(token){tokens.push(token)}}if(isArray(options.onComment)){var comments=options.onComment;options.onComment=function(block,text,start,end,startLoc,endLoc){var comment={type:block?"Block":"Line",value:text,start:start,end:end};if(options.locations){comment.loc=new SourceLocation;comment.loc.start=startLoc;comment.loc.end=endLoc}if(options.ranges)comment.range=[start,end];comments.push(comment)}}if(options.strictMode){strict=true}if(options.ecmaVersion>=6){isKeyword=isEcma6Keyword}else{isKeyword=isEcma5AndLessKeyword}}var getLineInfo=exports.getLineInfo=function(input,offset){for(var line=1,cur=0;;){lineBreak.lastIndex=cur;var match=lineBreak.exec(input);if(match&&match.index<offset){++line;cur=match.index+match[0].length}else break}return{line:line,column:offset-cur}};function Token(){this.type=tokType;this.value=tokVal;this.start=tokStart;this.end=tokEnd;if(options.locations){this.loc=new SourceLocation;this.loc.end=tokEndLoc}if(options.ranges)this.range=[tokStart,tokEnd]}exports.Token=Token;exports.tokenize=function(inpt,opts){input=String(inpt);inputLen=input.length;setOptions(opts);initTokenState();skipSpace();function getToken(){lastEnd=tokEnd;readToken();return new Token}getToken.jumpTo=function(pos,exprAllowed){tokPos=pos;if(options.locations){tokCurLine=1;tokLineStart=lineBreak.lastIndex=0;var match;while((match=lineBreak.exec(input))&&match.index<pos){++tokCurLine;tokLineStart=match.index+match[0].length}}tokExprAllowed=!!exprAllowed;skipSpace()};getToken.current=function(){return new Token};if(typeof Symbol!=="undefined"){getToken[Symbol.iterator]=function(){return{next:function(){var token=getToken();return{done:token.type===_eof,value:token}}}}}getToken.options=options;return getToken};var tokPos;var tokStart,tokEnd;var tokStartLoc,tokEndLoc;var tokType,tokVal;var tokContext,tokExprAllowed;var tokCurLine,tokLineStart;var lastStart,lastEnd,lastEndLoc;var inFunction,inGenerator,inAsync,labels,strict,inXJSChild,inXJSTag,inType;function initParserState(){lastStart=lastEnd=tokPos;if(options.locations)lastEndLoc=curPosition();inFunction=inGenerator=inAsync=false;labels=[];skipSpace();readToken()}function raise(pos,message){var loc=getLineInfo(input,pos);message+=" ("+loc.line+":"+loc.column+")";var err=new SyntaxError(message);err.pos=pos;err.loc=loc;err.raisedAt=tokPos;throw err}var empty=[];var _num={type:"num"},_regexp={type:"regexp"},_string={type:"string"};var _name={type:"name"},_eof={type:"eof"};var _jsxName={type:"jsxName"};var _xjsName={type:"xjsName"},_xjsText={type:"xjsText"};var _break={keyword:"break"},_case={keyword:"case",beforeExpr:true},_catch={keyword:"catch"};var _continue={keyword:"continue"},_debugger={keyword:"debugger"},_default={keyword:"default"};var _do={keyword:"do",isLoop:true},_else={keyword:"else",beforeExpr:true};var _finally={keyword:"finally"},_for={keyword:"for",isLoop:true},_function={keyword:"function"};var _if={keyword:"if"},_return={keyword:"return",beforeExpr:true},_switch={keyword:"switch"};var _throw={keyword:"throw",beforeExpr:true},_try={keyword:"try"},_var={keyword:"var"};var _let={keyword:"let"},_const={keyword:"const"};var _while={keyword:"while",isLoop:true},_with={keyword:"with"},_new={keyword:"new",beforeExpr:true};var _this={keyword:"this"};var _class={keyword:"class"},_extends={keyword:"extends",beforeExpr:true};var _export={keyword:"export"},_import={keyword:"import"};var _yield={keyword:"yield",beforeExpr:true};var _null={keyword:"null",atomValue:null},_true={keyword:"true",atomValue:true};var _false={keyword:"false",atomValue:false};var _in={keyword:"in",binop:7,beforeExpr:true};var keywordTypes={"break":_break,"case":_case,"catch":_catch,"continue":_continue,"debugger":_debugger,"default":_default,"do":_do,"else":_else,"finally":_finally,"for":_for,"function":_function,"if":_if,"return":_return,"switch":_switch,"throw":_throw,"try":_try,"var":_var,let:_let,"const":_const,"while":_while,"with":_with,"null":_null,"true":_true,"false":_false,"new":_new,"in":_in,"instanceof":{keyword:"instanceof",binop:7,beforeExpr:true},"this":_this,"typeof":{keyword:"typeof",prefix:true,beforeExpr:true},"void":{keyword:"void",prefix:true,beforeExpr:true},"delete":{keyword:"delete",prefix:true,beforeExpr:true},"class":_class,"extends":_extends,"export":_export,"import":_import,"yield":_yield};var _bracketL={type:"[",beforeExpr:true},_bracketR={type:"]"},_braceL={type:"{",beforeExpr:true};var _braceR={type:"}"},_parenL={type:"(",beforeExpr:true},_parenR={type:")"};var _comma={type:",",beforeExpr:true},_semi={type:";",beforeExpr:true};var _colon={type:":",beforeExpr:true},_dot={type:"."},_question={type:"?",beforeExpr:true};var _arrow={type:"=>",beforeExpr:true},_template={type:"template"};var _ellipsis={type:"...",beforeExpr:true};var _backQuote={type:"`"},_dollarBraceL={type:"${",beforeExpr:true};var _jsxText={type:"jsxText"};var _paamayimNekudotayim={type:"::",beforeExpr:true};var _at={type:"@"};var _hash={type:"#"};var _slash={binop:10,beforeExpr:true},_eq={isAssign:true,beforeExpr:true};var _assign={isAssign:true,beforeExpr:true};var _incDec={postfix:true,prefix:true,isUpdate:true},_prefix={prefix:true,beforeExpr:true};var _logicalOR={binop:1,beforeExpr:true};var _logicalAND={binop:2,beforeExpr:true};var _bitwiseOR={binop:3,beforeExpr:true};var _bitwiseXOR={binop:4,beforeExpr:true};var _bitwiseAND={binop:5,beforeExpr:true};var _equality={binop:6,beforeExpr:true};var _relational={binop:7,beforeExpr:true};var _bitShift={binop:8,beforeExpr:true};var _plusMin={binop:9,prefix:true,beforeExpr:true};var _modulo={binop:10,beforeExpr:true};var _star={binop:10,beforeExpr:true};var _exponent={binop:11,beforeExpr:true,rightAssociative:true};var _jsxTagStart={type:"jsxTagStart"},_jsxTagEnd={type:"jsxTagEnd"};exports.tokTypes={bracketL:_bracketL,bracketR:_bracketR,braceL:_braceL,braceR:_braceR,parenL:_parenL,parenR:_parenR,comma:_comma,semi:_semi,colon:_colon,dot:_dot,ellipsis:_ellipsis,question:_question,slash:_slash,eq:_eq,name:_name,eof:_eof,num:_num,regexp:_regexp,string:_string,paamayimNekudotayim:_paamayimNekudotayim,exponent:_exponent,at:_at,hash:_hash,arrow:_arrow,template:_template,star:_star,assign:_assign,backQuote:_backQuote,dollarBraceL:_dollarBraceL};for(var kw in keywordTypes)exports.tokTypes["_"+kw]=keywordTypes[kw];var isReservedWord3=function anonymous(str){switch(str.length){case 6:switch(str){case"double":case"export":case"import":case"native":case"public":case"static":case"throws":return true}return false;case 4:switch(str){case"byte":case"char":case"enum":case"goto":case"long":return true}return false;case 5:switch(str){case"class":case"final":case"float":case"short":case"super":return true}return false;case 7:switch(str){case"boolean":case"extends":case"package":case"private":return true}return false;case 9:switch(str){case"interface":case"protected":case"transient":return true}return false;case 8:switch(str){case"abstract":case"volatile":return true}return false;case 10:return str==="implements";case 3:return str==="int";case 12:return str==="synchronized"}};var isReservedWord5=function anonymous(str){switch(str.length){case 5:switch(str){case"class":case"super":case"const":return true}return false;case 6:switch(str){case"export":case"import":return true}return false;case 4:return str==="enum";case 7:return str==="extends"}};var isStrictReservedWord=function anonymous(str){switch(str.length){case 9:switch(str){case"interface":case"protected":return true}return false;case 7:switch(str){case"package":case"private":return true}return false;case 6:switch(str){case"public":case"static":return true}return false;case 10:return str==="implements";case 3:return str==="let";case 5:return str==="yield"}};var isStrictBadIdWord=function anonymous(str){switch(str){case"eval":case"arguments":return true}return false};var ecma5AndLessKeywords="break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this";var isEcma5AndLessKeyword=function anonymous(str){switch(str.length){case 4:switch(str){case"case":case"else":case"with":case"null":case"true":case"void":case"this":return true}return false;case 5:switch(str){case"break":case"catch":case"throw":case"while":case"false":return true}return false;case 3:switch(str){case"for":case"try":case"var":case"new":return true}return false;case 6:switch(str){case"return":case"switch":case"typeof":case"delete":return true}return false;case 8:switch(str){case"continue":case"debugger":case"function":return true}return false;case 2:switch(str){case"do":case"if":case"in":return true}return false;case 7:switch(str){case"default":case"finally":return true}return false;case 10:return str==="instanceof"}};var ecma6AndLessKeywords=ecma5AndLessKeywords+" let const class extends export import yield";var isEcma6Keyword=function anonymous(str){switch(str.length){case 5:switch(str){case"break":case"catch":case"throw":case"while":case"false":case"const":case"class":case"yield":return true}return false;case 4:switch(str){case"case":case"else":case"with":case"null":case"true":case"void":case"this":return true}return false;case 6:switch(str){case"return":case"switch":case"typeof":case"delete":case"export":case"import":return true}return false;case 3:switch(str){case"for":case"try":case"var":case"new":case"let":return true}return false;case 8:switch(str){case"continue":case"debugger":case"function":return true}return false;case 7:switch(str){case"default":case"finally":case"extends":return true}return false;case 2:switch(str){case"do":case"if":case"in":return true}return false;case 10:return str==="instanceof"}};var isKeyword=isEcma5AndLessKeyword;var nonASCIIwhitespace=/[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/;var nonASCIIidentifierStartChars="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠ-ࢲऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々-〇〡-〩〱-〵〸-〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞭꞰꞱꟷ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭟꭤꭥꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ";var nonASCIIidentifierChars="̀-ͯ҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࣤ-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ଁ-ଃ଼ା-ୄେୈୋ-୍ୖୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఃా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ഁ-ഃാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ංඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ູົຼ່-ໍ໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠐-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏ᦰ-ᧀᧈᧉ᧐-᧙ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭ᳲ-᳴᳸᳹᷀-᷵᷼-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯꘠-꘩꙯ꙴ-꙽ꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧꢀꢁꢴ-꣄꣐-꣙꣠-꣱꤀-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︭︳︴﹍-﹏0-9_";var nonASCIIidentifierStart=new RegExp("["+nonASCIIidentifierStartChars+"]");var nonASCIIidentifier=new RegExp("["+nonASCIIidentifierStartChars+nonASCIIidentifierChars+"]");var decimalNumber=/^\d+$/;var hexNumber=/^[\da-fA-F]+$/;var newline=/[\n\r\u2028\u2029]/;function isNewLine(code){return code===10||code===13||code===8232||code==8233}var lineBreak=/\r\n|[\n\r\u2028\u2029]/g;var isIdentifierStart=exports.isIdentifierStart=function(code){if(code<65)return code===36;if(code<91)return true;if(code<97)return code===95;if(code<123)return true;return code>=170&&nonASCIIidentifierStart.test(String.fromCharCode(code))};var isIdentifierChar=exports.isIdentifierChar=function(code){if(code<48)return code===36;if(code<58)return true;if(code<65)return false;if(code<91)return true;if(code<97)return code===95;if(code<123)return true;return code>=170&&nonASCIIidentifier.test(String.fromCharCode(code))};function Position(line,col){this.line=line;this.column=col}Position.prototype.offset=function(n){return new Position(this.line,this.column+n)};function curPosition(){return new Position(tokCurLine,tokPos-tokLineStart)}function initTokenState(pos){if(pos){tokPos=pos;tokLineStart=Math.max(0,input.lastIndexOf("\n",pos));tokCurLine=input.slice(0,tokLineStart).split(newline).length}else{tokCurLine=1;tokPos=tokLineStart=0}tokType=_eof;tokContext=[b_stat];tokExprAllowed=true;inType=strict=false;if(tokPos===0&&options.allowHashBang&&input.slice(0,2)==="#!"){skipLineComment(2)}}var b_stat={token:"{",isExpr:false},b_expr={token:"{",isExpr:true},b_tmpl={token:"${",isExpr:true};var p_stat={token:"(",isExpr:false},p_expr={token:"(",isExpr:true};var q_tmpl={token:"`",isExpr:true},f_expr={token:"function",isExpr:true};var j_oTag={token:"<tag",isExpr:false},j_cTag={token:"</tag",isExpr:false},j_expr={token:"<tag>...</tag>",isExpr:true};function curTokContext(){return tokContext[tokContext.length-1]}function braceIsBlock(prevType){var parent;if(prevType===_colon&&(parent=curTokContext()).token=="{")return!parent.isExpr;if(prevType===_return)return newline.test(input.slice(lastEnd,tokStart));if(prevType===_else||prevType===_semi||prevType===_eof)return true;if(prevType==_braceL)return curTokContext()===b_stat;return!tokExprAllowed}function finishToken(type,val){tokEnd=tokPos;if(options.locations)tokEndLoc=curPosition();var prevType=tokType,preserveSpace=false;tokType=type;tokVal=val;if(type===_parenR||type===_braceR){var out=tokContext.pop();if(out===b_tmpl){preserveSpace=tokExprAllowed=true}else if(out===b_stat&&curTokContext()===f_expr){tokContext.pop();tokExprAllowed=false}else{tokExprAllowed=!(out&&out.isExpr)}}else if(type===_braceL){switch(curTokContext()){case j_oTag:tokContext.push(b_expr);break;case j_expr:tokContext.push(b_tmpl);break;default:tokContext.push(braceIsBlock(prevType)?b_stat:b_expr)}tokExprAllowed=true}else if(type===_dollarBraceL){tokContext.push(b_tmpl);tokExprAllowed=true}else if(type==_parenL){var statementParens=prevType===_if||prevType===_for||prevType===_with||prevType===_while;tokContext.push(statementParens?p_stat:p_expr);tokExprAllowed=true}else if(type==_incDec){}else if(type.keyword&&prevType==_dot){tokExprAllowed=false}else if(type==_function){if(curTokContext()!==b_stat){tokContext.push(f_expr)}tokExprAllowed=false}else if(type===_backQuote){if(curTokContext()===q_tmpl){tokContext.pop()}else{tokContext.push(q_tmpl);preserveSpace=true}tokExprAllowed=false}else if(type===_jsxTagStart){tokContext.push(j_expr);tokContext.push(j_oTag);tokExprAllowed=false}else if(type===_jsxTagEnd){var out=tokContext.pop();if(out===j_oTag&&prevType===_slash||out===j_cTag){tokContext.pop();preserveSpace=tokExprAllowed=curTokContext()===j_expr}else{preserveSpace=tokExprAllowed=true}}else if(type===_jsxText){preserveSpace=tokExprAllowed=true}else if(type===_slash&&prevType===_jsxTagStart){tokContext.length-=2;tokContext.push(j_cTag);tokExprAllowed=false}else{tokExprAllowed=type.beforeExpr}if(!preserveSpace)skipSpace()}function skipBlockComment(){var startLoc=options.onComment&&options.locations&&curPosition();var start=tokPos,end=input.indexOf("*/",tokPos+=2);if(end===-1)raise(tokPos-2,"Unterminated comment");tokPos=end+2;if(options.locations){lineBreak.lastIndex=start;
var match;while((match=lineBreak.exec(input))&&match.index<tokPos){++tokCurLine;tokLineStart=match.index+match[0].length}}if(options.onComment)options.onComment(true,input.slice(start+2,end),start,tokPos,startLoc,options.locations&&curPosition())}function skipLineComment(startSkip){var start=tokPos;var startLoc=options.onComment&&options.locations&&curPosition();var ch=input.charCodeAt(tokPos+=startSkip);while(tokPos<inputLen&&ch!==10&&ch!==13&&ch!==8232&&ch!==8233){++tokPos;ch=input.charCodeAt(tokPos)}if(options.onComment)options.onComment(false,input.slice(start+startSkip,tokPos),start,tokPos,startLoc,options.locations&&curPosition())}function skipSpace(){while(tokPos<inputLen){var ch=input.charCodeAt(tokPos);if(ch===32){++tokPos}else if(ch===13){++tokPos;var next=input.charCodeAt(tokPos);if(next===10){++tokPos}if(options.locations){++tokCurLine;tokLineStart=tokPos}}else if(ch===10||ch===8232||ch===8233){++tokPos;if(options.locations){++tokCurLine;tokLineStart=tokPos}}else if(ch>8&&ch<14){++tokPos}else if(ch===47){var next=input.charCodeAt(tokPos+1);if(next===42){skipBlockComment()}else if(next===47){skipLineComment(2)}else break}else if(ch===160){++tokPos}else if(ch>=5760&&nonASCIIwhitespace.test(String.fromCharCode(ch))){++tokPos}else{break}}}function readToken_dot(){var next=input.charCodeAt(tokPos+1);if(next>=48&&next<=57)return readNumber(true);var next2=input.charCodeAt(tokPos+2);if(options.playground&&next===63){tokPos+=2;return finishToken(_dotQuestion)}else if(options.ecmaVersion>=6&&next===46&&next2===46){tokPos+=3;return finishToken(_ellipsis)}else{++tokPos;return finishToken(_dot)}}function readToken_slash(){var next=input.charCodeAt(tokPos+1);if(tokExprAllowed){++tokPos;return readRegexp()}if(next===61)return finishOp(_assign,2);return finishOp(_slash,1)}function readToken_modulo(){var next=input.charCodeAt(tokPos+1);if(next===61)return finishOp(_assign,2);return finishOp(_modulo,1)}function readToken_mult(){var type=_star;var width=1;var next=input.charCodeAt(tokPos+1);if(options.ecmaVersion>=7&&next===42){width++;next=input.charCodeAt(tokPos+2);type=_exponent}if(next===61){width++;type=_assign}return finishOp(type,width)}function readToken_pipe_amp(code){var next=input.charCodeAt(tokPos+1);if(next===code){if(options.playground&&input.charCodeAt(tokPos+2)===61)return finishOp(_assign,3);return finishOp(code===124?_logicalOR:_logicalAND,2)}if(next===61)return finishOp(_assign,2);return finishOp(code===124?_bitwiseOR:_bitwiseAND,1)}function readToken_caret(){var next=input.charCodeAt(tokPos+1);if(next===61)return finishOp(_assign,2);return finishOp(_bitwiseXOR,1)}function readToken_plus_min(code){var next=input.charCodeAt(tokPos+1);if(next===code){if(next==45&&input.charCodeAt(tokPos+2)==62&&newline.test(input.slice(lastEnd,tokPos))){skipLineComment(3);skipSpace();return readToken()}return finishOp(_incDec,2)}if(next===61)return finishOp(_assign,2);return finishOp(_plusMin,1)}function readToken_lt_gt(code){var next=input.charCodeAt(tokPos+1);var size=1;if(!inType&&next===code){size=code===62&&input.charCodeAt(tokPos+2)===62?3:2;if(input.charCodeAt(tokPos+size)===61)return finishOp(_assign,size+1);return finishOp(_bitShift,size)}if(next==33&&code==60&&input.charCodeAt(tokPos+2)==45&&input.charCodeAt(tokPos+3)==45){skipLineComment(4);skipSpace();return readToken()}if(!inType){if(tokExprAllowed&&code===60){++tokPos;return finishToken(_jsxTagStart)}if(code===62){var context=curTokContext();if(context===j_oTag||context===j_cTag){++tokPos;return finishToken(_jsxTagEnd)}}}if(next===61)size=input.charCodeAt(tokPos+2)===61?3:2;return finishOp(_relational,size)}function readToken_eq_excl(code){var next=input.charCodeAt(tokPos+1);if(next===61)return finishOp(_equality,input.charCodeAt(tokPos+2)===61?3:2);if(code===61&&next===62&&options.ecmaVersion>=6){tokPos+=2;return finishToken(_arrow)}return finishOp(code===61?_eq:_prefix,1)}function getTemplateToken(code){if(tokType===_string){if(code===96){++tokPos;return finishToken(_bquote)}else if(code===36&&input.charCodeAt(tokPos+1)===123){tokPos+=2;return finishToken(_dollarBraceL)}}return readTmplString()}function getTokenFromCode(code){switch(code){case 46:return readToken_dot();case 40:++tokPos;return finishToken(_parenL);case 41:++tokPos;return finishToken(_parenR);case 59:++tokPos;return finishToken(_semi);case 44:++tokPos;return finishToken(_comma);case 91:++tokPos;return finishToken(_bracketL);case 93:++tokPos;return finishToken(_bracketR);case 123:++tokPos;return finishToken(_braceL);case 125:++tokPos;return finishToken(_braceR);case 63:++tokPos;return finishToken(_question);case 64:if(options.playground){++tokPos;return finishToken(_at)}case 35:if(options.playground){++tokPos;return finishToken(_hash)}case 58:++tokPos;if(options.ecmaVersion>=7){var next=input.charCodeAt(tokPos);if(next===58){++tokPos;return finishToken(_paamayimNekudotayim)}}return finishToken(_colon);case 96:if(options.ecmaVersion>=6){++tokPos;return finishToken(_backQuote)}else{return false}case 48:var next=input.charCodeAt(tokPos+1);if(next===120||next===88)return readRadixNumber(16);if(options.ecmaVersion>=6){if(next===111||next===79)return readRadixNumber(8);if(next===98||next===66)return readRadixNumber(2)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return readNumber(false);case 34:case 39:return inXJSTag?readXJSStringLiteral():readString(code);case 47:return readToken_slash();case 37:return readToken_modulo();case 42:return readToken_mult();case 124:case 38:return readToken_pipe_amp(code);case 94:return readToken_caret();case 43:case 45:return readToken_plus_min(code);case 60:case 62:return readToken_lt_gt(code);case 61:case 33:return readToken_eq_excl(code);case 126:return finishOp(_prefix,1)}return false}function readToken(){tokStart=tokPos;if(options.locations)tokStartLoc=curPosition();if(tokPos>=inputLen)return finishToken(_eof);var context=curTokContext();if(context===q_tmpl){return readTmplToken()}if(context===j_expr){return readJSXToken()}var code=input.charCodeAt(tokPos);if(context===j_oTag||context===j_cTag){if(isIdentifierStart(code))return readJSXWord()}else if(context===j_expr){return readJSXToken()}else{if(isIdentifierStart(code)||code===92)return readWord()}var tok=getTokenFromCode(code);if(tok===false){var ch=String.fromCharCode(code);if(ch==="\\"||nonASCIIidentifierStart.test(ch))return readWord();raise(tokPos,"Unexpected character '"+ch+"'")}return tok}function finishOp(type,size,shouldSkipSpace){var str=input.slice(tokPos,tokPos+size);tokPos+=size;finishToken(type,str,shouldSkipSpace)}var regexpUnicodeSupport=false;try{new RegExp("","u");regexpUnicodeSupport=true}catch(e){}function readRegexp(){var content="",escaped,inClass,start=tokPos;for(;;){if(tokPos>=inputLen)raise(start,"Unterminated regular expression");var ch=nextChar();if(newline.test(ch))raise(start,"Unterminated regular expression");if(!escaped){if(ch==="[")inClass=true;else if(ch==="]"&&inClass)inClass=false;else if(ch==="/"&&!inClass)break;escaped=ch==="\\"}else escaped=false;++tokPos}var content=input.slice(start,tokPos);++tokPos;var mods=readWord1();var tmp=content;if(mods){var validFlags=/^[gmsiy]*$/;if(options.ecmaVersion>=6)validFlags=/^[gmsiyu]*$/;if(!validFlags.test(mods))raise(start,"Invalid regular expression flag");if(mods.indexOf("u")>=0&&!regexpUnicodeSupport){tmp=tmp.replace(/\\u\{([0-9a-fA-F]{5,6})\}/g,"x").replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x")}}try{new RegExp(tmp)}catch(e){if(e instanceof SyntaxError)raise(start,"Error parsing regular expression: "+e.message);raise(e)}try{var value=new RegExp(content,mods)}catch(err){value=null}return finishToken(_regexp,{pattern:content,flags:mods,value:value})}function readInt(radix,len){var start=tokPos,total=0;for(var i=0,e=len==null?Infinity:len;i<e;++i){var code=input.charCodeAt(tokPos),val;if(code>=97)val=code-97+10;else if(code>=65)val=code-65+10;else if(code>=48&&code<=57)val=code-48;else val=Infinity;if(val>=radix)break;++tokPos;total=total*radix+val}if(tokPos===start||len!=null&&tokPos-start!==len)return null;return total}function readRadixNumber(radix){tokPos+=2;var val=readInt(radix);if(val==null)raise(tokStart+2,"Expected number in radix "+radix);if(isIdentifierStart(input.charCodeAt(tokPos)))raise(tokPos,"Identifier directly after number");return finishToken(_num,val)}function readNumber(startsWithDot){var start=tokPos,isFloat=false,octal=input.charCodeAt(tokPos)===48;if(!startsWithDot&&readInt(10)===null)raise(start,"Invalid number");if(input.charCodeAt(tokPos)===46){++tokPos;readInt(10);isFloat=true}var next=input.charCodeAt(tokPos);if(next===69||next===101){next=input.charCodeAt(++tokPos);if(next===43||next===45)++tokPos;if(readInt(10)===null)raise(start,"Invalid number");isFloat=true}if(isIdentifierStart(input.charCodeAt(tokPos)))raise(tokPos,"Identifier directly after number");var str=input.slice(start,tokPos),val;if(isFloat)val=parseFloat(str);else if(!octal||str.length===1)val=parseInt(str,10);else if(/[89]/.test(str)||strict)raise(start,"Invalid number");else val=parseInt(str,8);return finishToken(_num,val)}function readCodePoint(){var ch=input.charCodeAt(tokPos),code;if(ch===123){if(options.ecmaVersion<6)unexpected();++tokPos;code=readHexChar(input.indexOf("}",tokPos)-tokPos);++tokPos;if(code>1114111)unexpected()}else{code=readHexChar(4)}if(code<=65535){return String.fromCharCode(code)}var cu1=(code-65536>>10)+55296;var cu2=(code-65536&1023)+56320;return String.fromCharCode(cu1,cu2)}function readString(quote){var isJSX=curTokContext()===j_oTag;var out="",chunkStart=++tokPos;for(;;){if(tokPos>=inputLen)raise(tokStart,"Unterminated string constant");var ch=input.charCodeAt(tokPos);if(ch===quote)break;if(ch===92&&!isJSX){out+=input.slice(chunkStart,tokPos);out+=readEscapedChar();chunkStart=tokPos}else if(ch===38&&isJSX){out+=input.slice(chunkStart,tokPos);out+=readJSXEntity();chunkStart=tokPos}else{if(isNewLine(ch))raise(tokStart,"Unterminated string constant");++tokPos}}out+=input.slice(chunkStart,tokPos++);return finishToken(_string,out)}function readTmplToken(){var out="",chunkStart=tokPos;for(;;){if(tokPos>=inputLen)raise(tokStart,"Unterminated template");var ch=input.charCodeAt(tokPos);if(ch===96||ch===36&&input.charCodeAt(tokPos+1)===123){if(tokPos===tokStart&&tokType===_template){if(ch===36){tokPos+=2;return finishToken(_dollarBraceL)}else{++tokPos;return finishToken(_backQuote)}}out+=input.slice(chunkStart,tokPos);return finishToken(_template,out)}if(ch===92){out+=input.slice(chunkStart,tokPos);out+=readEscapedChar();chunkStart=tokPos}else if(isNewLine(ch)){out+=input.slice(chunkStart,tokPos);++tokPos;if(ch===13&&input.charCodeAt(tokPos)===10){++tokPos;out+="\n"}else{out+=String.fromCharCode(ch)}if(options.locations){++tokCurLine;tokLineStart=tokPos}chunkStart=tokPos}else{++tokPos}}}var XHTMLEntities={quot:'"',amp:"&",apos:"'",lt:"<",gt:">",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",ensp:" ",emsp:" ",thinsp:" ",zwnj:"",zwj:"",lrm:"",rlm:"",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",frasl:"⁄",euro:"€",image:"ℑ",weierp:"℘",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪","int":"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦"};function readJSXEntity(){var str="",count=0,entity;var ch=input[tokPos];if(ch!=="&")raise(tokPos,"Entity must start with an ampersand");var startPos=++tokPos;while(tokPos<inputLen&&count++<10){ch=input[tokPos++];if(ch===";"){if(str[0]==="#"){if(str[1]==="x"){str=str.substr(2);if(hexNumber.test(str)){entity=String.fromCharCode(parseInt(str,16))}}else{str=str.substr(1);if(decimalNumber.test(str)){entity=String.fromCharCode(parseInt(str,10))}}}else{entity=XHTMLEntities[str]}break}str+=ch}if(!entity){tokPos=startPos;return"&"}return entity}function readJSXToken(){var out="",start=tokPos;for(;;){if(tokPos>=inputLen)raise(tokStart,"Unterminated JSX contents");var ch=input.charCodeAt(tokPos);switch(ch){case 123:case 60:if(tokPos===start){return getTokenFromCode(ch)}return finishToken(_jsxText,out);case 38:out+=readJSXEntity();break;default:++tokPos;if(isNewLine(ch)){if(ch===13&&input.charCodeAt(tokPos)===10){++tokPos;ch=10}if(options.locations){++tokCurLine;tokLineStart=tokPos}}out+=String.fromCharCode(ch)}}}function readEscapedChar(){var ch=input.charCodeAt(++tokPos);var octal=/^[0-7]+/.exec(input.slice(tokPos,tokPos+3));if(octal)octal=octal[0];while(octal&&parseInt(octal,8)>255)octal=octal.slice(0,-1);if(octal==="0")octal=null;++tokPos;if(octal){if(strict)raise(tokPos-2,"Octal literal in strict mode");tokPos+=octal.length-1;return String.fromCharCode(parseInt(octal,8))}else{switch(ch){case 110:return"\n";case 114:return"\r";case 120:return String.fromCharCode(readHexChar(2));case 117:return readCodePoint();case 116:return" ";case 98:return"\b";case 118:return"";case 102:return"\f";case 48:return"\x00";case 13:if(input.charCodeAt(tokPos)===10)++tokPos;case 10:if(options.locations){tokLineStart=tokPos;++tokCurLine}return"";default:return String.fromCharCode(ch)}}}var XHTMLEntities={quot:'"',amp:"&",apos:"'",lt:"<",gt:">",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",ensp:" ",emsp:" ",thinsp:" ",zwnj:"",zwj:"",lrm:"",rlm:"",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",frasl:"⁄",euro:"€",image:"ℑ",weierp:"℘",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪","int":"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦"};function readXJSEntity(){var str="",count=0,entity;var ch=nextChar();if(ch!=="&")raise(tokPos,"Entity must start with an ampersand");var startPos=++tokPos;while(tokPos<inputLen&&count++<10){ch=nextChar();tokPos++;if(ch===";"){if(str[0]==="#"){if(str[1]==="x"){str=str.substr(2);if(hexNumber.test(str)){entity=String.fromCharCode(parseInt(str,16))}}else{str=str.substr(1);if(decimalNumber.test(str)){entity=String.fromCharCode(parseInt(str,10))}}}else{entity=XHTMLEntities[str]}break}str+=ch}if(!entity){tokPos=startPos;return"&"}return entity}function readXJSText(stopChars){var str="";while(tokPos<inputLen){var ch=nextChar();if(stopChars.indexOf(ch)!==-1){break}if(ch==="&"){str+=readXJSEntity()}else{++tokPos;if(ch==="\r"&&nextChar()==="\n"){str+=ch;++tokPos;ch="\n"}if(ch==="\n"&&options.locations){tokLineStart=tokPos;++tokCurLine}str+=ch}}return finishToken(_xjsText,str)}function readXJSStringLiteral(){var quote=input.charCodeAt(tokPos);if(quote!==34&"e!==39){raise("String literal must starts with a quote")}++tokPos;readXJSText([String.fromCharCode(quote)]);if(quote!==input.charCodeAt(tokPos)){unexpected()}++tokPos;return finishToken(tokType,tokVal)}function readHexChar(len){var n=readInt(16,len);if(n===null)raise(tokStart,"Bad character escape sequence");return n}var containsEsc;function readWord1(){containsEsc=false;var word="",first=true,chunkStart=tokPos;for(;;){var ch=input.charCodeAt(tokPos);if(isIdentifierChar(ch)){++tokPos}else if(ch===92){containsEsc=true;word+=input.slice(chunkStart,tokPos);if(input.charCodeAt(++tokPos)!=117)raise(tokPos,"Expecting Unicode escape sequence \\uXXXX");++tokPos;var esc=readHexChar(4);var escStr=String.fromCharCode(esc);if(!escStr)raise(tokPos-1,"Invalid Unicode escape");if(!(first?isIdentifierStart(esc):isIdentifierChar(esc)))raise(tokPos-4,"Invalid Unicode escape");word+=escStr;chunkStart=tokPos}else{break}first=false}return word+input.slice(chunkStart,tokPos)}function readWord(){var word=readWord1();var type=inXJSTag?_xjsName:_name;if(!containsEsc&&isKeyword(word))type=keywordTypes[word];return finishToken(type,word)}function readJSXWord(){var ch,start=tokPos;do{ch=input.charCodeAt(++tokPos)}while(isIdentifierChar(ch)||ch===45);return finishToken(_jsxName,input.slice(start,tokPos))}function next(){if(options.onToken)options.onToken(new Token);lastStart=tokStart;lastEnd=tokEnd;lastEndLoc=tokEndLoc;readToken()}function setStrict(strct){strict=strct;if(tokType!==_num&&tokType!==_string)return;tokPos=tokStart;if(options.locations){while(tokPos<tokLineStart){tokLineStart=input.lastIndexOf("\n",tokLineStart-2)+1;--tokCurLine}}skipSpace();readToken()}function Node(){this.type=null;this.start=tokStart;this.end=null}exports.Node=Node;function SourceLocation(){this.start=tokStartLoc;this.end=null;if(sourceFile!==null)this.source=sourceFile}function startNode(){var node=new exports.Node;if(options.locations)node.loc=new SourceLocation;if(options.directSourceFile)node.sourceFile=options.directSourceFile;if(options.ranges)node.range=[tokStart,0];return node}function storeCurrentPos(){return options.locations?[tokStart,tokStartLoc]:tokStart}function startNodeAt(pos){var node=new exports.Node,start=pos;if(options.locations){node.loc=new SourceLocation;node.loc.start=start[1];start=pos[0]}node.start=start;if(options.directSourceFile)node.sourceFile=options.directSourceFile;if(options.ranges)node.range=[start,0];return node}function finishNode(node,type){node.type=type;node.end=lastEnd;if(options.locations)node.loc.end=lastEndLoc;if(options.ranges)node.range[1]=lastEnd;return node}function finishNodeAt(node,type,pos){if(options.locations){node.loc.end=pos[1];pos=pos[0]}node.type=type;node.end=pos;if(options.ranges)node.range[1]=pos;return node}function isUseStrict(stmt){return options.ecmaVersion>=5&&stmt.type==="ExpressionStatement"&&stmt.expression.type==="Literal"&&stmt.expression.value==="use strict"}function eat(type){if(tokType===type){next();return true}else{return false}}function isContextual(name){return tokType===_name&&tokVal===name}function eatContextual(name){return tokVal===name&&eat(_name)}function expectContextual(name){if(!eatContextual(name))unexpected()}function canInsertSemicolon(){return!options.strictSemicolons&&(tokType===_eof||tokType===_braceR||newline.test(input.slice(lastEnd,tokStart)))}function semicolon(){if(!eat(_semi)&&!canInsertSemicolon())unexpected()}function expect(type){eat(type)||unexpected()}function nextChar(){return input.charAt(tokPos)}function unexpected(pos){raise(pos!=null?pos:tokStart,"Unexpected token")}function has(obj,propName){return Object.prototype.hasOwnProperty.call(obj,propName)}function toAssignable(node){if(options.ecmaVersion>=6&&node){switch(node.type){case"Identifier":case"MemberExpression":case"VirtualPropertyExpression":case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":break;case"ObjectExpression":node.type="ObjectPattern";for(var i=0;i<node.properties.length;i++){var prop=node.properties[i];if(prop.kind!=="init")raise(prop.key.start,"Object pattern can't contain getter or setter");toAssignable(prop.value)}break;case"ArrayExpression":node.type="ArrayPattern";toAssignableList(node.elements);break;case"AssignmentExpression":if(node.operator==="="){node.type="AssignmentPattern"}else{raise(node.left.end,"Only '=' operator can be used for specifying default value.")}break;default:raise(node.start,"Assigning to rvalue")}}return node}function toAssignableList(exprList){if(exprList.length){for(var i=0;i<exprList.length-1;i++){toAssignable(exprList[i])}var last=exprList[exprList.length-1];switch(last.type){case"RestElement":break;case"SpreadElement":last.type="RestElement";var arg=last.argument;toAssignable(arg);if(arg.type!=="Identifier"&&arg.type!=="ArrayPattern")unexpected(arg.start);break;default:toAssignable(last)}}return exprList}function parseSpread(refShorthandDefaultPos){var node=startNode();next();node.argument=parseMaybeAssign(refShorthandDefaultPos);return finishNode(node,"SpreadElement")}function parseRest(){var node=startNode();next();node.argument=tokType===_name||tokType===_bracketL?parseAssignableAtom():unexpected();return finishNode(node,"RestElement")}function parseAssignableAtom(){if(options.ecmaVersion<6)return parseIdent();switch(tokType){case _name:return parseIdent();case _bracketL:var node=startNode();next();node.elements=parseAssignableList(_bracketR,true);return finishNode(node,"ArrayPattern");case _braceL:return parseObj(true);default:unexpected()}}function parseAssignableList(close,allowEmpty){var elts=[],first=true;while(!eat(close)){first?first=false:expect(_comma);if(tokType===_ellipsis){elts.push(parseAssignableListItemTypes(parseRest()));expect(close);break}var elem;if(allowEmpty&&tokType===_comma){elem=null}else{var left=parseAssignableAtom();parseAssignableListItemTypes(left);elem=parseMaybeDefault(null,left)}elts.push(elem)}return elts}function parseAssignableListItemTypes(param){if(eat(_question)){param.optional=true}if(tokType===_colon){param.typeAnnotation=parseTypeAnnotation()}finishNode(param,param.type);return param}function parseMaybeDefault(startPos,left){left=left||parseAssignableAtom();if(!eat(_eq))return left;var node=startPos?startNodeAt(startPos):startNode();node.operator="=";node.left=left;node.right=parseMaybeAssign();return finishNode(node,"AssignmentPattern")}function checkFunctionParam(param,nameHash){switch(param.type){case"Identifier":if(isStrictReservedWord(param.name)||isStrictBadIdWord(param.name))raise(param.start,"Defining '"+param.name+"' in strict mode");if(has(nameHash,param.name))raise(param.start,"Argument name clash in strict mode");nameHash[param.name]=true;break;case"ObjectPattern":for(var i=0;i<param.properties.length;i++)checkFunctionParam(param.properties[i].value,nameHash);break;case"ArrayPattern":for(var i=0;i<param.elements.length;i++){var elem=param.elements[i];if(elem)checkFunctionParam(elem,nameHash)}break;case"RestElement":return checkFunctionParam(param.argument,nameHash)}}function checkPropClash(prop,propHash){if(options.ecmaVersion>=6)return;var key=prop.key,name;switch(key.type){case"Identifier":name=key.name;break;case"Literal":name=String(key.value);break;default:return}var kind=prop.kind||"init",other;if(has(propHash,name)){other=propHash[name];var isGetSet=kind!=="init";if((strict||isGetSet)&&other[kind]||!(isGetSet^other.init))raise(key.start,"Redefinition of property")}else{other=propHash[name]={init:false,get:false,set:false}}other[kind]=true}function checkLVal(expr,isBinding){switch(expr.type){case"Identifier":if(strict&&(isStrictBadIdWord(expr.name)||isStrictReservedWord(expr.name)))raise(expr.start,(isBinding?"Binding ":"Assigning to ")+expr.name+" in strict mode");break;case"MemberExpression":if(isBinding)raise(expr.start,"Binding to member expression");break;case"ObjectPattern":for(var i=0;i<expr.properties.length;i++){var prop=expr.properties[i];if(prop.type==="Property")prop=prop.value;checkLVal(prop,isBinding)}break;case"ArrayPattern":for(var i=0;i<expr.elements.length;i++){var elem=expr.elements[i];if(elem)checkLVal(elem,isBinding)}break;case"AssignmentPattern":checkLVal(expr.left);break;case"SpreadProperty":case"VirtualPropertyExpression":break;case"RestElement":checkLVal(expr.argument);break;default:raise(expr.start,"Assigning to rvalue")}}function parseTopLevel(node){var first=true;if(!node.body)node.body=[];while(tokType!==_eof){var stmt=parseStatement(true,true);node.body.push(stmt);if(first&&isUseStrict(stmt))setStrict(true);first=false}next();return finishNode(node,"Program")}var loopLabel={kind:"loop"},switchLabel={kind:"switch"};function parseStatement(declaration,topLevel){var starttype=tokType,node=startNode();switch(starttype){case _break:case _continue:return parseBreakContinueStatement(node,starttype.keyword);case _debugger:return parseDebuggerStatement(node);case _do:return parseDoStatement(node);case _for:return parseForStatement(node);case _function:if(!declaration&&options.ecmaVersion>=6)unexpected();return parseFunctionStatement(node);case _class:if(!declaration)unexpected();return parseClass(node,true);case _if:return parseIfStatement(node);case _return:return parseReturnStatement(node);case _switch:return parseSwitchStatement(node);case _throw:return parseThrowStatement(node);case _try:return parseTryStatement(node);case _let:case _const:if(!declaration)unexpected();case _var:return parseVarStatement(node,starttype.keyword);case _while:return parseWhileStatement(node);case _with:return parseWithStatement(node);case _braceL:return parseBlock();case _semi:return parseEmptyStatement(node);case _export:case _import:if(!topLevel&&!options.allowImportExportEverywhere)raise(tokStart,"'import' and 'export' may only appear at the top level");return starttype===_import?parseImport(node):parseExport(node);default:var maybeName=tokVal,expr=parseExpression();if(options.ecmaVersion>=7&&starttype===_name&&maybeName==="async"&&tokType===_function&&!canInsertSemicolon()){next();var func=parseFunctionStatement(node);func.async=true;return func}if(starttype===_name&&expr.type==="Identifier"){if(eat(_colon)){return parseLabeledStatement(node,maybeName,expr)}if(options.ecmaVersion>=7&&expr.name==="private"&&tokType===_name){return parsePrivate(node)}else if(expr.name==="declare"){if(tokType===_class||tokType===_name||tokType===_function||tokType===_var){return parseDeclare(node)}}else if(tokType===_name){if(expr.name==="interface"){return parseInterface(node)}else if(expr.name==="type"){return parseTypeAlias(node)}}}if(expr.type==="FunctionExpression"&&expr.async){if(expr.id){expr.type="FunctionDeclaration";return expr}else{unexpected(expr.start+"async function ".length)}}return parseExpressionStatement(node,expr)}}function parseBreakContinueStatement(node,keyword){var isBreak=keyword=="break";next();if(eat(_semi)||canInsertSemicolon())node.label=null;else if(tokType!==_name)unexpected();else{node.label=parseIdent();semicolon()}for(var i=0;i<labels.length;++i){var lab=labels[i];if(node.label==null||lab.name===node.label.name){if(lab.kind!=null&&(isBreak||lab.kind==="loop"))break;if(node.label&&isBreak)break}}if(i===labels.length)raise(node.start,"Unsyntactic "+keyword);return finishNode(node,isBreak?"BreakStatement":"ContinueStatement")}function parseDebuggerStatement(node){next();semicolon();return finishNode(node,"DebuggerStatement")}function parseDoStatement(node){next();labels.push(loopLabel);node.body=parseStatement(false);labels.pop();expect(_while);node.test=parseParenExpression();if(options.ecmaVersion>=6)eat(_semi);else semicolon();return finishNode(node,"DoWhileStatement")}function parseForStatement(node){next();labels.push(loopLabel);expect(_parenL);if(tokType===_semi)return parseFor(node,null);if(tokType===_var||tokType===_let){var init=startNode(),varKind=tokType.keyword,isLet=tokType===_let;next();parseVar(init,true,varKind);finishNode(init,"VariableDeclaration");if((tokType===_in||options.ecmaVersion>=6&&isContextual("of"))&&init.declarations.length===1&&!(isLet&&init.declarations[0].init))return parseForIn(node,init);return parseFor(node,init)}var refShorthandDefaultPos={start:0};var init=parseExpression(true,refShorthandDefaultPos);if(tokType===_in||options.ecmaVersion>=6&&isContextual("of")){toAssignable(init);checkLVal(init);return parseForIn(node,init)}else if(refShorthandDefaultPos.start){unexpected(refShorthandDefaultPos.start)}return parseFor(node,init)}function parseFunctionStatement(node){next();return parseFunction(node,true,false)}function parseIfStatement(node){next();node.test=parseParenExpression();node.consequent=parseStatement(false);node.alternate=eat(_else)?parseStatement(false):null;return finishNode(node,"IfStatement")}function parseReturnStatement(node){if(!inFunction&&!options.allowReturnOutsideFunction)raise(tokStart,"'return' outside of function");next();if(eat(_semi)||canInsertSemicolon())node.argument=null;else{node.argument=parseExpression();semicolon()}return finishNode(node,"ReturnStatement")}function parseSwitchStatement(node){next();node.discriminant=parseParenExpression();node.cases=[];expect(_braceL);labels.push(switchLabel);for(var cur,sawDefault;tokType!=_braceR;){if(tokType===_case||tokType===_default){var isCase=tokType===_case;if(cur)finishNode(cur,"SwitchCase");node.cases.push(cur=startNode());cur.consequent=[];next();if(isCase)cur.test=parseExpression();else{if(sawDefault)raise(lastStart,"Multiple default clauses");sawDefault=true;cur.test=null}expect(_colon)}else{if(!cur)unexpected();
cur.consequent.push(parseStatement(true))}}if(cur)finishNode(cur,"SwitchCase");next();labels.pop();return finishNode(node,"SwitchStatement")}function parseThrowStatement(node){next();if(newline.test(input.slice(lastEnd,tokStart)))raise(lastEnd,"Illegal newline after throw");node.argument=parseExpression();semicolon();return finishNode(node,"ThrowStatement")}function parseTryStatement(node){next();node.block=parseBlock();node.handler=null;if(tokType===_catch){var clause=startNode();next();expect(_parenL);clause.param=parseAssignableAtom();checkLVal(clause.param,true);expect(_parenR);clause.guard=null;clause.body=parseBlock();node.handler=finishNode(clause,"CatchClause")}node.guardedHandlers=empty;node.finalizer=eat(_finally)?parseBlock():null;if(!node.handler&&!node.finalizer)raise(node.start,"Missing catch or finally clause");return finishNode(node,"TryStatement")}function parseVarStatement(node,kind){next();parseVar(node,false,kind);semicolon();return finishNode(node,"VariableDeclaration")}function parseWhileStatement(node){next();node.test=parseParenExpression();labels.push(loopLabel);node.body=parseStatement(false);labels.pop();return finishNode(node,"WhileStatement")}function parseWithStatement(node){if(strict)raise(tokStart,"'with' in strict mode");next();node.object=parseParenExpression();node.body=parseStatement(false);return finishNode(node,"WithStatement")}function parseEmptyStatement(node){next();return finishNode(node,"EmptyStatement")}function parseLabeledStatement(node,maybeName,expr){for(var i=0;i<labels.length;++i)if(labels[i].name===maybeName)raise(expr.start,"Label '"+maybeName+"' is already declared");var kind=tokType.isLoop?"loop":tokType===_switch?"switch":null;labels.push({name:maybeName,kind:kind});node.body=parseStatement(true);labels.pop();node.label=expr;return finishNode(node,"LabeledStatement")}function parseExpressionStatement(node,expr){node.expression=expr;semicolon();return finishNode(node,"ExpressionStatement")}function parseParenExpression(){expect(_parenL);var val=parseExpression();expect(_parenR);return val}function parseBlock(allowStrict){var node=startNode(),first=true,oldStrict;node.body=[];expect(_braceL);while(!eat(_braceR)){var stmt=parseStatement(true);node.body.push(stmt);if(first&&allowStrict&&isUseStrict(stmt)){oldStrict=strict;setStrict(strict=true)}first=false}if(oldStrict===false)setStrict(false);return finishNode(node,"BlockStatement")}function parseFor(node,init){node.init=init;expect(_semi);node.test=tokType===_semi?null:parseExpression();expect(_semi);node.update=tokType===_parenR?null:parseExpression();expect(_parenR);node.body=parseStatement(false);labels.pop();return finishNode(node,"ForStatement")}function parseForIn(node,init){var type=tokType===_in?"ForInStatement":"ForOfStatement";next();node.left=init;node.right=parseExpression();expect(_parenR);node.body=parseStatement(false);labels.pop();return finishNode(node,type)}function parseVar(node,noIn,kind){node.declarations=[];node.kind=kind;for(;;){var decl=startNode();decl.id=parseAssignableAtom();checkLVal(decl.id,true);if(tokType===_colon){decl.id.typeAnnotation=parseTypeAnnotation();finishNode(decl.id,decl.id.type)}decl.init=eat(_eq)?parseMaybeAssign(noIn):kind===_const.keyword?unexpected():null;node.declarations.push(finishNode(decl,"VariableDeclarator"));if(!eat(_comma))break}return node}function parseExpression(noIn,refShorthandDefaultPos){var start=storeCurrentPos();var expr=parseMaybeAssign(noIn,refShorthandDefaultPos);if(tokType===_comma){var node=startNodeAt(start);node.expressions=[expr];while(eat(_comma))node.expressions.push(parseMaybeAssign(noIn,refShorthandDefaultPos));return finishNode(node,"SequenceExpression")}return expr}function parseMaybeAssign(noIn,refShorthandDefaultPos,afterLeftParse){var failOnShorthandAssign;if(!refShorthandDefaultPos){refShorthandDefaultPos={start:0};failOnShorthandAssign=true}else{failOnShorthandAssign=false}var start=storeCurrentPos();var left=parseMaybeConditional(noIn,refShorthandDefaultPos);if(afterLeftParse)afterLeftParse(left);if(tokType.isAssign){var node=startNodeAt(start);node.operator=tokVal;node.left=tokType===_eq?toAssignable(left):left;refShorthandDefaultPos.start=0;checkLVal(left);next();node.right=parseMaybeAssign(noIn);return finishNode(node,"AssignmentExpression")}else if(failOnShorthandAssign&&refShorthandDefaultPos.start){unexpected(refShorthandDefaultPos.start)}return left}function parseMaybeConditional(noIn,refShorthandDefaultPos){var start=storeCurrentPos();var expr=parseExprOps(noIn,refShorthandDefaultPos);if(refShorthandDefaultPos&&refShorthandDefaultPos.start)return expr;if(eat(_question)){var node=startNodeAt(start);if(options.playground&&eat(_eq)){var left=node.left=toAssignable(expr);if(left.type!=="MemberExpression")raise(left.start,"You can only use member expressions in memoization assignment");node.right=parseMaybeAssign(noIn);node.operator="?=";return finishNode(node,"AssignmentExpression")}node.test=expr;node.consequent=parseMaybeAssign();expect(_colon);node.alternate=parseMaybeAssign(noIn);return finishNode(node,"ConditionalExpression")}return expr}function parseExprOps(noIn,refShorthandDefaultPos){var start=storeCurrentPos();var expr=parseMaybeUnary(refShorthandDefaultPos);if(refShorthandDefaultPos&&refShorthandDefaultPos.start)return expr;return parseExprOp(expr,start,-1,noIn)}function parseExprOp(left,leftStart,minPrec,noIn){var prec=tokType.binop;if(prec!=null&&(!noIn||tokType!==_in)){if(prec>minPrec){var node=startNodeAt(leftStart);node.left=left;node.operator=tokVal;var op=tokType;next();var start=storeCurrentPos();node.right=parseExprOp(parseMaybeUnary(),start,op.rightAssociative?prec-1:prec,noIn);finishNode(node,op===_logicalOR||op===_logicalAND?"LogicalExpression":"BinaryExpression");return parseExprOp(node,leftStart,minPrec,noIn)}}return left}function parseMaybeUnary(refShorthandDefaultPos){if(tokType.prefix){var node=startNode(),update=tokType.isUpdate;node.operator=tokVal;node.prefix=true;next();node.argument=parseMaybeUnary();if(refShorthandDefaultPos&&refShorthandDefaultPos.start)unexpected(refShorthandDefaultPos.start);if(update)checkLVal(node.argument);else if(strict&&node.operator==="delete"&&node.argument.type==="Identifier")raise(node.start,"Deleting local variable in strict mode");return finishNode(node,update?"UpdateExpression":"UnaryExpression")}var start=storeCurrentPos();var expr=parseExprSubscripts(refShorthandDefaultPos);if(refShorthandDefaultPos&&refShorthandDefaultPos.start)return expr;while(tokType.postfix&&!canInsertSemicolon()){var node=startNodeAt(start);node.operator=tokVal;node.prefix=false;node.argument=expr;checkLVal(expr);next();expr=finishNode(node,"UpdateExpression")}return expr}function parseExprSubscripts(refShorthandDefaultPos){var start=storeCurrentPos();var expr=parseExprAtom(refShorthandDefaultPos);if(refShorthandDefaultPos&&refShorthandDefaultPos.start)return expr;return parseSubscripts(expr,start)}function parseSubscripts(base,start,noCalls){if(options.playground&&eat(_hash)){var node=startNodeAt(start);node.object=base;node.property=parseIdent(true);if(eat(_parenL)){node.arguments=parseExprList(_parenR,false)}else{node.arguments=[]}return parseSubscripts(finishNode(node,"BindMemberExpression"),start,noCalls)}else if(eat(_paamayimNekudotayim)){var node=startNodeAt(start);node.object=base;node.property=parseIdent(true);return parseSubscripts(finishNode(node,"VirtualPropertyExpression"),start,noCalls)}else if(eat(_dot)){var node=startNodeAt(start);node.object=base;node.property=parseIdent(true);node.computed=false;return parseSubscripts(finishNode(node,"MemberExpression"),start,noCalls)}else if(eat(_bracketL)){var node=startNodeAt(start);node.object=base;node.property=parseExpression();node.computed=true;expect(_bracketR);return parseSubscripts(finishNode(node,"MemberExpression"),start,noCalls)}else if(!noCalls&&eat(_parenL)){var node=startNodeAt(start);node.callee=base;node.arguments=parseExprList(_parenR,false);return parseSubscripts(finishNode(node,"CallExpression"),start,noCalls)}else if(tokType===_backQuote){var node=startNodeAt(start);node.tag=base;node.quasi=parseTemplate();return parseSubscripts(finishNode(node,"TaggedTemplateExpression"),start,noCalls)}return base}function parseExprAtom(refShorthandDefaultPos){switch(tokType){case _this:var node=startNode();next();return finishNode(node,"ThisExpression");case _at:var start=storeCurrentPos();var node=startNode();var thisNode=startNode();next();node.object=finishNode(thisNode,"ThisExpression");node.property=parseSubscripts(parseIdent(),start);node.computed=false;return finishNode(node,"MemberExpression");case _yield:if(inGenerator)return parseYield();case _name:var start=storeCurrentPos();var node=startNode();var id=parseIdent(tokType!==_name);if(options.ecmaVersion>=7){if(id.name==="async"){if(tokType===_parenL){next();var exprList;if(tokType!==_parenR){var val=parseExpression();exprList=val.type==="SequenceExpression"?val.expressions:[val]}else{exprList=[]}expect(_parenR);if(eat(_arrow)){return parseArrowExpression(node,exprList,true)}else{node.callee=id;node.arguments=exprList;return parseSubscripts(finishNode(node,"CallExpression"),start)}}else if(tokType===_name){id=parseIdent();if(eat(_arrow)){return parseArrowExpression(node,[id],true)}return id}if(tokType===_function&&!canInsertSemicolon()){next();return parseFunction(node,false,true)}}else if(id.name==="await"){if(inAsync)return parseAwait(node)}}if(eat(_arrow)){return parseArrowExpression(node,[id])}return id;case _regexp:var node=startNode();node.regex={pattern:tokVal.pattern,flags:tokVal.flags};node.value=tokVal.value;node.raw=input.slice(tokStart,tokEnd);next();return finishNode(node,"Literal");case _num:case _string:case _jsxText:var node=startNode();node.value=tokVal;node.raw=input.slice(tokStart,tokEnd);next();return finishNode(node,"Literal");case _null:case _true:case _false:var node=startNode();node.value=tokType.atomValue;node.raw=tokType.keyword;next();return finishNode(node,"Literal");case _parenL:return parseParenAndDistinguishExpression();case _bracketL:var node=startNode();next();if(options.ecmaVersion>=7&&tokType===_for){return parseComprehension(node,false)}node.elements=parseExprList(_bracketR,true,true,refShorthandDefaultPos);return finishNode(node,"ArrayExpression");case _braceL:return parseObj(false,refShorthandDefaultPos);case _function:var node=startNode();next();return parseFunction(node,false,false);case _class:return parseClass(startNode(),false);case _new:return parseNew();case _backQuote:return parseTemplate();case _hash:return parseBindFunctionExpression();case _jsxTagStart:return parseJSXElement();default:unexpected()}}function parseBindFunctionExpression(){var node=startNode();next();var start=storeCurrentPos();node.callee=parseSubscripts(parseExprAtom(),start,true);if(eat(_parenL)){node.arguments=parseExprList(_parenR,false)}else{node.arguments=[]}return finishNode(node,"BindFunctionExpression")}function parseParenAndDistinguishExpression(){var start=storeCurrentPos(),val;if(options.ecmaVersion>=6){next();if(options.ecmaVersion>=7&&tokType===_for){return parseComprehension(startNodeAt(start),true)}var innerStart=storeCurrentPos(),exprList=[],first=true;var refShorthandDefaultPos={start:0},spreadStart,innerParenStart,typeStart;var parseParenItem=function(node){if(tokType===_colon){typeStart=typeStart||tokStart;node.returnType=parseTypeAnnotation()}return node};while(tokType!==_parenR){first?first=false:expect(_comma);if(tokType===_ellipsis){spreadStart=tokStart;exprList.push(parseParenItem(parseRest()));break}else{if(tokType===_parenL&&!innerParenStart){innerParenStart=tokStart}exprList.push(parseMaybeAssign(false,refShorthandDefaultPos,parseParenItem))}}var innerEnd=storeCurrentPos();expect(_parenR);if(eat(_arrow)){if(innerParenStart)unexpected(innerParenStart);return parseArrowExpression(startNodeAt(start),exprList)}if(!exprList.length)unexpected(lastStart);if(typeStart)unexpected(typeStart);if(spreadStart)unexpected(spreadStart);if(refShorthandDefaultPos.start)unexpected(refShorthandDefaultPos.start);if(exprList.length>1){val=startNodeAt(innerStart);val.expressions=exprList;finishNodeAt(val,"SequenceExpression",innerEnd)}else{val=exprList[0]}}else{val=parseParenExpression()}if(options.preserveParens){var par=startNodeAt(start);par.expression=val;return finishNode(par,"ParenthesizedExpression")}else{return val}}function parseNew(){var node=startNode();next();var start=storeCurrentPos();node.callee=parseSubscripts(parseExprAtom(),start,true);if(eat(_parenL))node.arguments=parseExprList(_parenR,false);else node.arguments=empty;return finishNode(node,"NewExpression")}function parseTemplateElement(){var elem=startNode();elem.value={raw:input.slice(tokStart,tokEnd),cooked:tokVal};next();elem.tail=tokType===_backQuote;return finishNode(elem,"TemplateElement")}function parseTemplate(){var node=startNode();next();node.expressions=[];var curElt=parseTemplateElement();node.quasis=[curElt];while(!curElt.tail){expect(_dollarBraceL);node.expressions.push(parseExpression());expect(_braceR);node.quasis.push(curElt=parseTemplateElement())}next();return finishNode(node,"TemplateLiteral")}function parseObj(isPattern,refShorthandDefaultPos){var node=startNode(),first=true,propHash={};node.properties=[];next();while(!eat(_braceR)){if(!first){expect(_comma);if(options.allowTrailingCommas&&eat(_braceR))break}else first=false;var prop=startNode(),start,isGenerator=false,isAsync=false;if(options.ecmaVersion>=7&&tokType===_ellipsis){prop=parseSpread();prop.type="SpreadProperty";node.properties.push(prop);continue}if(options.ecmaVersion>=6){prop.method=false;prop.shorthand=false;if(isPattern){start=storeCurrentPos()}else{isGenerator=eat(_star)}}if(options.ecmaVersion>=7&&isContextual("async")){var asyncId=parseIdent();if(tokType===_colon||tokType===_parenL){prop.key=asyncId}else{isAsync=true;parsePropertyName(prop)}}else{parsePropertyName(prop)}var typeParameters;if(isRelational("<")){typeParameters=parseTypeParameterDeclaration();if(tokType!==_parenL)unexpected()}if(eat(_colon)){prop.value=isPattern?parseMaybeDefault(start):parseMaybeAssign(false,refShorthandDefaultPos);prop.kind="init"}else if(options.ecmaVersion>=6&&tokType===_parenL){if(isPattern)unexpected();prop.kind="init";prop.method=true;prop.value=parseMethod(isGenerator,isAsync)}else if(options.ecmaVersion>=5&&!prop.computed&&prop.key.type==="Identifier"&&(prop.key.name==="get"||prop.key.name==="set"||options.playground&&prop.key.name==="memo")&&(tokType!=_comma&&tokType!=_braceR)){if(isGenerator||isAsync||isPattern)unexpected();prop.kind=prop.key.name;parsePropertyName(prop);prop.value=parseMethod(false,false)}else if(options.ecmaVersion>=6&&!prop.computed&&prop.key.type==="Identifier"){prop.kind="init";if(isPattern){prop.value=parseMaybeDefault(start,prop.key)}else if(tokType===_eq&&refShorthandDefaultPos){if(!refShorthandDefaultPos.start)refShorthandDefaultPos.start=tokStart;prop.value=parseMaybeDefault(start,prop.key)}else{prop.value=prop.key}prop.shorthand=true}else unexpected();prop.value.typeParameters=typeParameters;checkPropClash(prop,propHash);node.properties.push(finishNode(prop,"Property"))}return finishNode(node,isPattern?"ObjectPattern":"ObjectExpression")}function parsePropertyName(prop){if(options.ecmaVersion>=6){if(eat(_bracketL)){prop.computed=true;prop.key=parseExpression();expect(_bracketR);return}else{prop.computed=false}}prop.key=tokType===_num||tokType===_string?parseExprAtom():parseIdent(true)}function initFunction(node,isAsync){node.id=null;if(options.ecmaVersion>=6){node.generator=false;node.expression=false}if(options.ecmaVersion>=7){node.async=isAsync}}function parseFunction(node,isStatement,isAsync,allowExpressionBody){initFunction(node,isAsync);if(options.ecmaVersion>=6){node.generator=eat(_star)}if(isStatement||tokType===_name){node.id=parseIdent()}if(isRelational("<")){node.typeParameters=parseTypeParameterDeclaration()}parseFunctionParams(node);parseFunctionBody(node,allowExpressionBody);return finishNode(node,isStatement?"FunctionDeclaration":"FunctionExpression")}function parseMethod(isGenerator,isAsync){var node=startNode();initFunction(node,isAsync);parseFunctionParams(node);var allowExpressionBody;if(options.ecmaVersion>=6){node.generator=isGenerator;allowExpressionBody=true}else{allowExpressionBody=false}parseFunctionBody(node,allowExpressionBody);return finishNode(node,"FunctionExpression")}function parseFunctionParams(node){expect(_parenL);node.params=parseAssignableList(_parenR,false);if(tokType===_colon){node.returnType=parseTypeAnnotation()}}function parseArrowExpression(node,params,isAsync){initFunction(node,isAsync);node.params=toAssignableList(params,true);parseFunctionBody(node,true);return finishNode(node,"ArrowFunctionExpression")}function parseFunctionBody(node,allowExpression){var isExpression=allowExpression&&tokType!==_braceL;var oldInAsync=inAsync;inAsync=node.async;if(isExpression){node.body=parseMaybeAssign();node.expression=true}else{var oldInFunc=inFunction,oldInGen=inGenerator,oldLabels=labels;inFunction=true;inGenerator=node.generator;labels=[];node.body=parseBlock(true);node.expression=false;inFunction=oldInFunc;inGenerator=oldInGen;labels=oldLabels}inAsync=oldInAsync;if(strict||!isExpression&&node.body.body.length&&isUseStrict(node.body.body[0])){var nameHash={};if(node.id)checkFunctionParam(node.id,{});for(var i=0;i<node.params.length;i++)checkFunctionParam(node.params[i],nameHash)}}function parsePrivate(node){node.declarations=[];do{node.declarations.push(parseIdent())}while(eat(_comma));semicolon();return finishNode(node,"PrivateDeclaration")}function parseClass(node,isStatement){next();node.id=tokType===_name?parseIdent():isStatement?unexpected():null;if(isRelational("<")){node.typeParameters=parseTypeParameterDeclaration()}node.superClass=eat(_extends)?parseExprSubscripts():null;if(node.superClass&&isRelational("<")){node.superTypeParameters=parseTypeParameterInstantiation()}if(isContextual("implements")){next();node.implements=parseClassImplements()}var classBody=startNode();classBody.body=[];expect(_braceL);while(!eat(_braceR)){if(eat(_semi))continue;var method=startNode();if(options.ecmaVersion>=7&&isContextual("private")){next();classBody.body.push(parsePrivate(method));continue}var isGenerator=eat(_star);var isAsync=false;parsePropertyName(method);if(tokType!==_parenL&&!method.computed&&method.key.type==="Identifier"&&method.key.name==="static"){if(isGenerator||isAsync)unexpected();method["static"]=true;isGenerator=eat(_star);parsePropertyName(method)}else{method["static"]=false}if(tokType!==_parenL&&!method.computed&&method.key.type==="Identifier"&&method.key.name==="async"){isAsync=true;parsePropertyName(method)}if(tokType!==_parenL&&!method.computed&&method.key.type==="Identifier"&&(method.key.name==="get"||method.key.name==="set")||options.playground&&method.key.name==="memo"){if(isGenerator||isAsync)unexpected();method.kind=method.key.name;parsePropertyName(method)}else{method.kind=""}if(tokType===_colon){method.typeAnnotation=parseTypeAnnotation();semicolon();classBody.body.push(finishNode(method,"ClassProperty"))}else{var typeParameters;if(isRelational("<")){typeParameters=parseTypeParameterDeclaration()}method.value=parseMethod(isGenerator,isAsync);method.value.typeParameters=typeParameters;classBody.body.push(finishNode(method,"MethodDefinition"));eat(_semi)}}node.body=finishNode(classBody,"ClassBody");return finishNode(node,isStatement?"ClassDeclaration":"ClassExpression")}function parseClassImplements(){var implemented=[];do{var node=startNode();node.id=parseIdent();if(isRelational("<")){node.typeParameters=parseTypeParameterInstantiation()}else{node.typeParameters=null}implemented.push(finishNode(node,"ClassImplements"))}while(eat(_comma));return implemented}function parseExprList(close,allowTrailingComma,allowEmpty,refShorthandDefaultPos){var elts=[],first=true;while(!eat(close)){if(!first){expect(_comma);if(allowTrailingComma&&options.allowTrailingCommas&&eat(close))break}else first=false;if(allowEmpty&&tokType===_comma){elts.push(null)}else{if(tokType===_ellipsis)elts.push(parseSpread(refShorthandDefaultPos));else elts.push(parseMaybeAssign(false,refShorthandDefaultPos))}}return elts}function parseIdent(liberal){var node=startNode();if(liberal&&options.forbidReserved=="everywhere")liberal=false;if(tokType===_name){if(!liberal&&(options.forbidReserved&&(options.ecmaVersion===3?isReservedWord3:isReservedWord5)(tokVal)||strict&&isStrictReservedWord(tokVal))&&input.slice(tokStart,tokEnd).indexOf("\\")==-1)raise(tokStart,"The keyword '"+tokVal+"' is reserved");node.name=tokVal}else if(liberal&&tokType.keyword){node.name=tokType.keyword}else{unexpected()}next();return finishNode(node,"Identifier")}function parseExport(node){next();if(tokType===_var||tokType===_const||tokType===_let||tokType===_function||tokType===_class||isContextual("async")){node.declaration=parseStatement(true);node["default"]=false;node.specifiers=null;node.source=null}else if(eat(_default)){var declar=node.declaration=parseMaybeAssign(true);if(declar.id){if(declar.type==="FunctionExpression"){declar.type="FunctionDeclaration"}else if(declar.type==="ClassExpression"){declar.type="ClassDeclaration"}}node["default"]=true;node.specifiers=null;node.source=null;semicolon()}else{var isBatch=tokType===_star;node.declaration=null;node["default"]=false;node.specifiers=parseExportSpecifiers();if(eatContextual("from")){node.source=tokType===_string?parseExprAtom():unexpected()}else{if(isBatch)unexpected();node.source=null}semicolon()}return finishNode(node,"ExportDeclaration")}function parseExportSpecifiers(){var nodes=[],first=true;if(tokType===_star){var node=startNode();next();nodes.push(finishNode(node,"ExportBatchSpecifier"))}else{expect(_braceL);while(!eat(_braceR)){if(!first){expect(_comma);if(options.allowTrailingCommas&&eat(_braceR))break}else first=false;var node=startNode();node.id=parseIdent(tokType===_default);node.name=eatContextual("as")?parseIdent(true):null;nodes.push(finishNode(node,"ExportSpecifier"))}}return nodes}function parseImport(node){next();if(tokType===_string){node.specifiers=[];node.source=parseExprAtom()}else{node.specifiers=parseImportSpecifiers();expectContextual("from");node.source=tokType===_string?parseExprAtom():unexpected()}semicolon();return finishNode(node,"ImportDeclaration")}function parseImportSpecifiers(){var nodes=[],first=true;if(tokType===_name){var node=startNode();node.id=parseIdent();checkLVal(node.id,true);node.name=null;node["default"]=true;nodes.push(finishNode(node,"ImportSpecifier"));if(!eat(_comma))return nodes}if(tokType===_star){var node=startNode();next();expectContextual("as");node.name=parseIdent();checkLVal(node.name,true);nodes.push(finishNode(node,"ImportBatchSpecifier"));return nodes}expect(_braceL);while(!eat(_braceR)){if(!first){expect(_comma);if(options.allowTrailingCommas&&eat(_braceR))break}else first=false;var node=startNode();node.id=parseIdent(true);node.name=eatContextual("as")?parseIdent():null;checkLVal(node.name||node.id,true);node["default"]=false;nodes.push(finishNode(node,"ImportSpecifier"))}return nodes}function parseYield(){var node=startNode();next();if(eat(_semi)||canInsertSemicolon()){node.delegate=false;node.argument=null}else{node.delegate=eat(_star);node.argument=parseMaybeAssign()}return finishNode(node,"YieldExpression")}function parseAwait(node){if(eat(_semi)||canInsertSemicolon()){unexpected()}node.delegate=eat(_star);node.argument=parseMaybeAssign(true);return finishNode(node,"AwaitExpression")}function parseComprehension(node,isGenerator){node.blocks=[];while(tokType===_for){var block=startNode();next();expect(_parenL);block.left=parseAssignableAtom();checkLVal(block.left,true);expectContextual("of");block.right=parseExpression();expect(_parenR);node.blocks.push(finishNode(block,"ComprehensionBlock"))}node.filter=eat(_if)?parseParenExpression():null;node.body=parseExpression();expect(isGenerator?_parenR:_bracketR);node.generator=isGenerator;return finishNode(node,"ComprehensionExpression")}function getQualifiedJSXName(object){if(object.type==="JSXIdentifier"){return object.name}if(object.type==="JSXNamespacedName"){return object.namespace.name+":"+object.name.name}if(object.type==="JSXMemberExpression"){return getQualifiedJSXName(object.object)+"."+getQualifiedJSXName(object.property)}}function parseJSXIdentifier(){var node=startNode();if(tokType===_jsxName){node.name=tokVal}else if(tokType.keyword){node.name=tokType.keyword}else{unexpected()}next();return finishNode(node,"JSXIdentifier")}function parseJSXNamespacedName(){var start=storeCurrentPos();var name=parseJSXIdentifier();if(!eat(_colon))return name;var node=startNodeAt(start);node.namespace=name;node.name=parseJSXIdentifier();return finishNode(node,"JSXNamespacedName")}function parseJSXElementName(){var start=storeCurrentPos();var node=parseJSXNamespacedName();while(eat(_dot)){var newNode=startNodeAt(start);newNode.object=node;newNode.property=parseJSXIdentifier();node=finishNode(newNode,"JSXMemberExpression")}return node}function parseJSXAttributeValue(){switch(tokType){case _braceL:var node=parseJSXExpressionContainer();if(node.expression.type==="JSXEmptyExpression"){raise(node.start,"JSX attributes must only be assigned a non-empty "+"expression")}return node;case _jsxTagStart:return parseJSXElement();case _jsxText:case _string:return parseExprAtom();default:raise(tokStart,"JSX value should be either an expression or a quoted JSX text")}}function parseJSXEmptyExpression(){if(tokType!==_braceR){unexpected()}var tmp;tmp=tokStart;tokStart=lastEnd;lastEnd=tmp;tmp=tokStartLoc;tokStartLoc=lastEndLoc;lastEndLoc=tmp;return finishNode(startNode(),"JSXEmptyExpression")}function parseJSXExpressionContainer(){var node=startNode();next();node.expression=tokType===_braceR?parseJSXEmptyExpression():parseExpression();expect(_braceR);return finishNode(node,"JSXExpressionContainer")}function parseJSXAttribute(){var node=startNode();if(eat(_braceL)){expect(_ellipsis);node.argument=parseMaybeAssign();expect(_braceR);return finishNode(node,"JSXSpreadAttribute")}node.name=parseJSXNamespacedName();node.value=eat(_eq)?parseJSXAttributeValue():null;return finishNode(node,"JSXAttribute")}function parseJSXOpeningElementAt(start){var node=startNodeAt(start);node.attributes=[];node.name=parseJSXElementName();while(tokType!==_slash&&tokType!==_jsxTagEnd){node.attributes.push(parseJSXAttribute())}node.selfClosing=eat(_slash);expect(_jsxTagEnd);return finishNode(node,"JSXOpeningElement")}function parseJSXClosingElementAt(start){var node=startNodeAt(start);node.name=parseJSXElementName();expect(_jsxTagEnd);return finishNode(node,"JSXClosingElement")}function parseJSXElementAt(start){var node=startNodeAt(start);var children=[];var openingElement=parseJSXOpeningElementAt(start);var closingElement=null;if(!openingElement.selfClosing){contents:for(;;){switch(tokType){case _jsxTagStart:start=storeCurrentPos();next();if(eat(_slash)){closingElement=parseJSXClosingElementAt(start);break contents}children.push(parseJSXElementAt(start));break;case _jsxText:children.push(parseExprAtom());break;case _braceL:children.push(parseJSXExpressionContainer());break;default:unexpected()}}if(getQualifiedJSXName(closingElement.name)!==getQualifiedJSXName(openingElement.name)){raise(closingElement.start,"Expected corresponding JSX closing tag for <"+getQualifiedJSXName(openingElement.name)+">")}}node.openingElement=openingElement;node.closingElement=closingElement;node.children=children;return finishNode(node,"JSXElement")}function isRelational(op){return tokType===_relational&&tokVal===op}function expectRelational(op){if(isRelational(op)){next()}else{unexpected()}}function parseJSXElement(){var start=storeCurrentPos();next();return parseJSXElementAt(start)}function parseDeclareClass(node){next();parseInterfaceish(node,true);return finishNode(node,"DeclareClass")}function parseDeclareFunction(node){next();var id=node.id=parseIdent();var typeNode=startNode();var typeContainer=startNode();if(isRelational("<")){typeNode.typeParameters=parseTypeParameterDeclaration()}else{typeNode.typeParameters=null}expect(_parenL);var tmp=parseFunctionTypeParams();typeNode.params=tmp.params;typeNode.rest=tmp.rest;expect(_parenR);expect(_colon);typeNode.returnType=parseType();typeContainer.typeAnnotation=finishNode(typeNode,"FunctionTypeAnnotation");id.typeAnnotation=finishNode(typeContainer,"TypeAnnotation");finishNode(id,id.type);semicolon();return finishNode(node,"DeclareFunction")}function parseDeclare(node){if(tokType===_class){return parseDeclareClass(node)}else if(tokType===_function){return parseDeclareFunction(node)}else if(tokType===_var){return parseDeclareVariable(node)}else if(isContextual("module")){return parseDeclareModule(node)}else{unexpected()}}function parseDeclareVariable(node){next();node.id=parseTypeAnnotatableIdentifier();semicolon();return finishNode(node,"DeclareVariable")}function parseDeclareModule(node){next();if(tokType===_string){node.id=parseExprAtom()}else{node.id=parseIdent()}var bodyNode=node.body=startNode();var body=bodyNode.body=[];expect(_braceL);while(tokType!==_braceR){var node2=startNode();next();body.push(parseDeclare(node2))}expect(_braceR);finishNode(bodyNode,"BlockStatement");return finishNode(node,"DeclareModule")}function parseInterfaceish(node,allowStatic){node.id=parseIdent();if(isRelational("<")){node.typeParameters=parseTypeParameterDeclaration()}else{node.typeParameters=null}node.extends=[];if(eat(_extends)){do{node.extends.push(parseInterfaceExtends())}while(eat(_comma))}node.body=parseObjectType(allowStatic)}function parseInterfaceExtends(){var node=startNode();node.id=parseIdent();if(isRelational("<")){node.typeParameters=parseTypeParameterInstantiation()}else{node.typeParameters=null}return finishNode(node,"InterfaceExtends")}function parseInterface(node){parseInterfaceish(node,false);return finishNode(node,"InterfaceDeclaration")}function parseTypeAlias(node){node.id=parseIdent();if(isRelational("<")){node.typeParameters=parseTypeParameterDeclaration()}else{node.typeParameters=null}expect(_eq);node.right=parseType();semicolon();return finishNode(node,"TypeAlias")}function parseTypeParameterDeclaration(){var node=startNode();node.params=[];expectRelational("<");while(!isRelational(">")){node.params.push(parseIdent());if(!isRelational(">")){expect(_comma)}}expectRelational(">");return finishNode(node,"TypeParameterDeclaration")}function parseTypeParameterInstantiation(){var node=startNode(),oldInType=inType;node.params=[];inType=true;expectRelational("<");while(!isRelational(">")){node.params.push(parseType());if(!isRelational(">")){expect(_comma)}}expectRelational(">");inType=oldInType;return finishNode(node,"TypeParameterInstantiation")}function parseObjectPropertyKey(){return tokType===_num||tokType===_string?parseExprAtom():parseIdent(true)}function parseObjectTypeIndexer(node,isStatic){node.static=isStatic;expect(_bracketL);node.id=parseObjectPropertyKey();expect(_colon);node.key=parseType();expect(_bracketR);expect(_colon);node.value=parseType();return finishNode(node,"ObjectTypeIndexer")}function parseObjectTypeMethodish(node){node.params=[];node.rest=null;node.typeParameters=null;if(isRelational("<")){node.typeParameters=parseTypeParameterDeclaration()}expect(_parenL);while(tokType===_name){node.params.push(parseFunctionTypeParam());if(tokType!==_parenR){expect(_comma)}}if(eat(_ellipsis)){node.rest=parseFunctionTypeParam()}expect(_parenR);expect(_colon);node.returnType=parseType();return finishNode(node,"FunctionTypeAnnotation")}function parseObjectTypeMethod(start,isStatic,key){var node=startNodeAt(start);node.value=parseObjectTypeMethodish(startNodeAt(start));node.static=isStatic;node.key=key;node.optional=false;return finishNode(node,"ObjectTypeProperty")}function parseObjectTypeCallProperty(node,isStatic){var valueNode=startNode();node.static=isStatic;node.value=parseObjectTypeMethodish(valueNode);
return finishNode(node,"ObjectTypeCallProperty")}function parseObjectType(allowStatic){var nodeStart=startNode();var node;var optional=false;var property;var propertyKey;var propertyTypeAnnotation;var token;var isStatic;nodeStart.callProperties=[];nodeStart.properties=[];nodeStart.indexers=[];expect(_braceL);while(tokType!==_braceR){var start=storeCurrentPos();node=startNode();if(allowStatic&&isContextual("static")){next();isStatic=true}if(tokType===_bracketL){nodeStart.indexers.push(parseObjectTypeIndexer(node,isStatic))}else if(tokType===_parenL||isRelational("<")){nodeStart.callProperties.push(parseObjectTypeCallProperty(node,allowStatic))}else{if(isStatic&&tokType===_colon){propertyKey=parseIdent()}else{propertyKey=parseObjectPropertyKey()}if(isRelational("<")||tokType===_parenL){nodeStart.properties.push(parseObjectTypeMethod(start,isStatic,propertyKey))}else{if(eat(_question)){optional=true}expect(_colon);node.key=propertyKey;node.value=parseType();node.optional=optional;node.static=isStatic;nodeStart.properties.push(finishNode(node,"ObjectTypeProperty"))}}if(!eat(_semi)&&tokType!==_braceR){unexpected()}}expect(_braceR);return finishNode(nodeStart,"ObjectTypeAnnotation")}function parseGenericType(start,id){var node=startNodeAt(start);node.typeParameters=null;node.id=id;while(eat(_dot)){var node2=startNodeAt(start);node2.qualification=node.id;node2.id=parseIdent();node.id=finishNode(node2,"QualifiedTypeIdentifier")}if(isRelational("<")){node.typeParameters=parseTypeParameterInstantiation()}return finishNode(node,"GenericTypeAnnotation")}function parseVoidType(){var node=startNode();expect(keywordTypes["void"]);return finishNode(node,"VoidTypeAnnotation")}function parseTypeofType(){var node=startNode();expect(keywordTypes["typeof"]);node.argument=parsePrimaryType();return finishNode(node,"TypeofTypeAnnotation")}function parseTupleType(){var node=startNode();node.types=[];expect(_bracketL);while(tokPos<inputLen&&tokType!==_bracketR){node.types.push(parseType());if(tokType===_bracketR)break;expect(_comma)}expect(_bracketR);return finishNode(node,"TupleTypeAnnotation")}function parseFunctionTypeParam(){var optional=false;var node=startNode();node.name=parseIdent();if(eat(_question)){optional=true}expect(_colon);node.optional=optional;node.typeAnnotation=parseType();return finishNode(node,"FunctionTypeParam")}function parseFunctionTypeParams(){var ret={params:[],rest:null};while(tokType===_name){ret.params.push(parseFunctionTypeParam());if(tokType!==_parenR){expect(_comma)}}if(eat(_ellipsis)){ret.rest=parseFunctionTypeParam()}return ret}function identToTypeAnnotation(start,node,id){switch(id.name){case"any":return finishNode(node,"AnyTypeAnnotation");case"bool":case"boolean":return finishNode(node,"BooleanTypeAnnotation");case"number":return finishNode(node,"NumberTypeAnnotation");case"string":return finishNode(node,"StringTypeAnnotation");default:return parseGenericType(start,id)}}function parsePrimaryType(){var typeIdentifier=null;var params=null;var returnType=null;var start=storeCurrentPos();var node=startNode();var rest=null;var tmp;var typeParameters;var token;var type;var isGroupedType=false;switch(tokType){case _name:return identToTypeAnnotation(start,node,parseIdent());case _braceL:return parseObjectType();case _bracketL:return parseTupleType();case _relational:if(tokVal==="<"){node.typeParameters=parseTypeParameterDeclaration();expect(_parenL);tmp=parseFunctionTypeParams();node.params=tmp.params;node.rest=tmp.rest;expect(_parenR);expect(_arrow);node.returnType=parseType();return finishNode(node,"FunctionTypeAnnotation")}case _parenL:next();var tmpId;if(tokType!==_parenR&&tokType!==_ellipsis){if(tokType===_name){}else{isGroupedType=true}}if(isGroupedType){if(tmpId&&_parenR){type=tmpId}else{type=parseType();expect(_parenR)}if(eat(_arrow)){raise(node,"Unexpected token =>. It looks like "+"you are trying to write a function type, but you ended up "+"writing a grouped type followed by an =>, which is a syntax "+"error. Remember, function type parameters are named so function "+"types look like (name1: type1, name2: type2) => returnType. You "+"probably wrote (type1) => returnType")}return type}tmp=parseFunctionTypeParams();node.params=tmp.params;node.rest=tmp.rest;expect(_parenR);expect(_arrow);node.returnType=parseType();node.typeParameters=null;return finishNode(node,"FunctionTypeAnnotation");case _string:node.value=tokVal;node.raw=input.slice(tokStart,tokEnd);next();return finishNode(node,"StringLiteralTypeAnnotation");default:if(tokType.keyword){switch(tokType.keyword){case"void":return parseVoidType();case"typeof":return parseTypeofType()}}}unexpected()}function parsePostfixType(){var node=startNode();var type=node.elementType=parsePrimaryType();if(tokType===_bracketL){expect(_bracketL);expect(_bracketR);return finishNode(node,"ArrayTypeAnnotation")}return type}function parsePrefixType(){var node=startNode();if(eat(_question)){node.typeAnnotation=parsePrefixType();return finishNode(node,"NullableTypeAnnotation")}return parsePostfixType()}function parseIntersectionType(){var node=startNode();var type=parsePrefixType();node.types=[type];while(eat(_bitwiseAND)){node.types.push(parsePrefixType())}return node.types.length===1?type:finishNode(node,"IntersectionTypeAnnotation")}function parseUnionType(){var node=startNode();var type=parseIntersectionType();node.types=[type];while(eat(_bitwiseOR)){node.types.push(parseIntersectionType())}return node.types.length===1?type:finishNode(node,"UnionTypeAnnotation")}function parseType(){var oldInType=inType;inType=true;var type=parseUnionType();inType=oldInType;return type}function parseTypeAnnotation(){var node=startNode();var oldInType=inType;inType=true;expect(_colon);node.typeAnnotation=parseType();inType=oldInType;return finishNode(node,"TypeAnnotation")}function parseTypeAnnotatableIdentifier(requireTypeAnnotation,canBeOptionalParam){var node=startNode();var ident=parseIdent();var isOptionalParam=false;if(canBeOptionalParam&&eat(_question)){expect(_question);isOptionalParam=true}if(requireTypeAnnotation||tokType===_colon){ident.typeAnnotation=parseTypeAnnotation();finishNode(ident,ident.type)}if(isOptionalParam){ident.optional=true;finishNode(ident,ident.type)}return ident}})},{}],106:[function(require,module,exports){var types=require("../lib/types");var Type=types.Type;var def=Type.def;var or=Type.or;var builtin=types.builtInTypes;var isString=builtin.string;var isNumber=builtin.number;var isBoolean=builtin.boolean;var isRegExp=builtin.RegExp;var shared=require("../lib/shared");var defaults=shared.defaults;var geq=shared.geq;def("Printable").field("loc",or(def("SourceLocation"),null),defaults["null"],true);def("Node").bases("Printable").field("type",isString);def("SourceLocation").build("start","end","source").field("start",def("Position")).field("end",def("Position")).field("source",or(isString,null),defaults["null"]);def("Position").build("line","column").field("line",geq(1)).field("column",geq(0));def("Program").bases("Node").build("body").field("body",[def("Statement")]).field("comments",or([or(def("Block"),def("Line"))],null),defaults["null"],true);def("Function").bases("Node").field("id",or(def("Identifier"),null),defaults["null"]).field("params",[def("Pattern")]).field("body",or(def("BlockStatement"),def("Expression")));def("Statement").bases("Node");def("EmptyStatement").bases("Statement").build();def("BlockStatement").bases("Statement").build("body").field("body",[def("Statement")]);def("ExpressionStatement").bases("Statement").build("expression").field("expression",def("Expression"));def("IfStatement").bases("Statement").build("test","consequent","alternate").field("test",def("Expression")).field("consequent",def("Statement")).field("alternate",or(def("Statement"),null),defaults["null"]);def("LabeledStatement").bases("Statement").build("label","body").field("label",def("Identifier")).field("body",def("Statement"));def("BreakStatement").bases("Statement").build("label").field("label",or(def("Identifier"),null),defaults["null"]);def("ContinueStatement").bases("Statement").build("label").field("label",or(def("Identifier"),null),defaults["null"]);def("WithStatement").bases("Statement").build("object","body").field("object",def("Expression")).field("body",def("Statement"));def("SwitchStatement").bases("Statement").build("discriminant","cases","lexical").field("discriminant",def("Expression")).field("cases",[def("SwitchCase")]).field("lexical",isBoolean,defaults["false"]);def("ReturnStatement").bases("Statement").build("argument").field("argument",or(def("Expression"),null));def("ThrowStatement").bases("Statement").build("argument").field("argument",def("Expression"));def("TryStatement").bases("Statement").build("block","handler","finalizer").field("block",def("BlockStatement")).field("handler",or(def("CatchClause"),null),function(){return this.handlers&&this.handlers[0]||null}).field("handlers",[def("CatchClause")],function(){return this.handler?[this.handler]:[]},true).field("guardedHandlers",[def("CatchClause")],defaults.emptyArray).field("finalizer",or(def("BlockStatement"),null),defaults["null"]);def("CatchClause").bases("Node").build("param","guard","body").field("param",def("Pattern")).field("guard",or(def("Expression"),null),defaults["null"]).field("body",def("BlockStatement"));def("WhileStatement").bases("Statement").build("test","body").field("test",def("Expression")).field("body",def("Statement"));def("DoWhileStatement").bases("Statement").build("body","test").field("body",def("Statement")).field("test",def("Expression"));def("ForStatement").bases("Statement").build("init","test","update","body").field("init",or(def("VariableDeclaration"),def("Expression"),null)).field("test",or(def("Expression"),null)).field("update",or(def("Expression"),null)).field("body",def("Statement"));def("ForInStatement").bases("Statement").build("left","right","body","each").field("left",or(def("VariableDeclaration"),def("Expression"))).field("right",def("Expression")).field("body",def("Statement")).field("each",isBoolean);def("DebuggerStatement").bases("Statement").build();def("Declaration").bases("Statement");def("FunctionDeclaration").bases("Function","Declaration").build("id","params","body").field("id",def("Identifier"));def("FunctionExpression").bases("Function","Expression").build("id","params","body");def("VariableDeclaration").bases("Declaration").build("kind","declarations").field("kind",or("var","let","const")).field("declarations",[or(def("VariableDeclarator"),def("Identifier"))]);def("VariableDeclarator").bases("Node").build("id","init").field("id",def("Pattern")).field("init",or(def("Expression"),null));def("Expression").bases("Node","Pattern");def("ThisExpression").bases("Expression").build();def("ArrayExpression").bases("Expression").build("elements").field("elements",[or(def("Expression"),null)]);def("ObjectExpression").bases("Expression").build("properties").field("properties",[def("Property")]);def("Property").bases("Node").build("kind","key","value").field("kind",or("init","get","set")).field("key",or(def("Literal"),def("Identifier"))).field("value",def("Expression"));def("SequenceExpression").bases("Expression").build("expressions").field("expressions",[def("Expression")]);var UnaryOperator=or("-","+","!","~","typeof","void","delete");def("UnaryExpression").bases("Expression").build("operator","argument","prefix").field("operator",UnaryOperator).field("argument",def("Expression")).field("prefix",isBoolean,defaults["true"]);var BinaryOperator=or("==","!=","===","!==","<","<=",">",">=","<<",">>",">>>","+","-","*","/","%","&","|","^","in","instanceof","..");def("BinaryExpression").bases("Expression").build("operator","left","right").field("operator",BinaryOperator).field("left",def("Expression")).field("right",def("Expression"));var AssignmentOperator=or("=","+=","-=","*=","/=","%=","<<=",">>=",">>>=","|=","^=","&=");def("AssignmentExpression").bases("Expression").build("operator","left","right").field("operator",AssignmentOperator).field("left",def("Pattern")).field("right",def("Expression"));var UpdateOperator=or("++","--");def("UpdateExpression").bases("Expression").build("operator","argument","prefix").field("operator",UpdateOperator).field("argument",def("Expression")).field("prefix",isBoolean);var LogicalOperator=or("||","&&");def("LogicalExpression").bases("Expression").build("operator","left","right").field("operator",LogicalOperator).field("left",def("Expression")).field("right",def("Expression"));def("ConditionalExpression").bases("Expression").build("test","consequent","alternate").field("test",def("Expression")).field("consequent",def("Expression")).field("alternate",def("Expression"));def("NewExpression").bases("Expression").build("callee","arguments").field("callee",def("Expression")).field("arguments",[def("Expression")]);def("CallExpression").bases("Expression").build("callee","arguments").field("callee",def("Expression")).field("arguments",[def("Expression")]);def("MemberExpression").bases("Expression").build("object","property","computed").field("object",def("Expression")).field("property",or(def("Identifier"),def("Expression"))).field("computed",isBoolean);def("Pattern").bases("Node");def("ObjectPattern").bases("Pattern").build("properties").field("properties",[def("PropertyPattern")]);def("PropertyPattern").bases("Pattern").build("key","pattern").field("key",or(def("Literal"),def("Identifier"))).field("pattern",def("Pattern"));def("ArrayPattern").bases("Pattern").build("elements").field("elements",[or(def("Pattern"),null)]);def("SwitchCase").bases("Node").build("test","consequent").field("test",or(def("Expression"),null)).field("consequent",[def("Statement")]);def("Identifier").bases("Node","Expression","Pattern").build("name").field("name",isString);def("Literal").bases("Node","Expression").build("value").field("value",or(isString,isBoolean,null,isNumber,isRegExp));def("Block").bases("Printable").build("loc","value").field("value",isString);def("Line").bases("Printable").build("loc","value").field("value",isString)},{"../lib/shared":117,"../lib/types":118}],107:[function(require,module,exports){require("./core");var types=require("../lib/types");var def=types.Type.def;var or=types.Type.or;var builtin=types.builtInTypes;var isString=builtin.string;var isBoolean=builtin.boolean;def("XMLDefaultDeclaration").bases("Declaration").field("namespace",def("Expression"));def("XMLAnyName").bases("Expression");def("XMLQualifiedIdentifier").bases("Expression").field("left",or(def("Identifier"),def("XMLAnyName"))).field("right",or(def("Identifier"),def("Expression"))).field("computed",isBoolean);def("XMLFunctionQualifiedIdentifier").bases("Expression").field("right",or(def("Identifier"),def("Expression"))).field("computed",isBoolean);def("XMLAttributeSelector").bases("Expression").field("attribute",def("Expression"));def("XMLFilterExpression").bases("Expression").field("left",def("Expression")).field("right",def("Expression"));def("XMLElement").bases("XML","Expression").field("contents",[def("XML")]);def("XMLList").bases("XML","Expression").field("contents",[def("XML")]);def("XML").bases("Node");def("XMLEscape").bases("XML").field("expression",def("Expression"));def("XMLText").bases("XML").field("text",isString);def("XMLStartTag").bases("XML").field("contents",[def("XML")]);def("XMLEndTag").bases("XML").field("contents",[def("XML")]);def("XMLPointTag").bases("XML").field("contents",[def("XML")]);def("XMLName").bases("XML").field("contents",or(isString,[def("XML")]));def("XMLAttribute").bases("XML").field("value",isString);def("XMLCdata").bases("XML").field("contents",isString);def("XMLComment").bases("XML").field("contents",isString);def("XMLProcessingInstruction").bases("XML").field("target",isString).field("contents",or(isString,null))},{"../lib/types":118,"./core":106}],108:[function(require,module,exports){require("./core");var types=require("../lib/types");var def=types.Type.def;var or=types.Type.or;var builtin=types.builtInTypes;var isBoolean=builtin.boolean;var isObject=builtin.object;var isString=builtin.string;var defaults=require("../lib/shared").defaults;def("Function").field("generator",isBoolean,defaults["false"]).field("expression",isBoolean,defaults["false"]).field("defaults",[or(def("Expression"),null)],defaults.emptyArray).field("rest",or(def("Identifier"),null),defaults["null"]);def("FunctionDeclaration").build("id","params","body","generator","expression");def("FunctionExpression").build("id","params","body","generator","expression");def("ArrowFunctionExpression").bases("Function","Expression").build("params","body","expression").field("id",null,defaults["null"]).field("generator",false);def("YieldExpression").bases("Expression").build("argument","delegate").field("argument",or(def("Expression"),null)).field("delegate",isBoolean,defaults["false"]);def("GeneratorExpression").bases("Expression").build("body","blocks","filter").field("body",def("Expression")).field("blocks",[def("ComprehensionBlock")]).field("filter",or(def("Expression"),null));def("ComprehensionExpression").bases("Expression").build("body","blocks","filter").field("body",def("Expression")).field("blocks",[def("ComprehensionBlock")]).field("filter",or(def("Expression"),null));def("ComprehensionBlock").bases("Node").build("left","right","each").field("left",def("Pattern")).field("right",def("Expression")).field("each",isBoolean);def("ModuleSpecifier").bases("Literal").build("value").field("value",isString);def("Property").field("key",or(def("Literal"),def("Identifier"),def("Expression"))).field("method",isBoolean,defaults["false"]).field("shorthand",isBoolean,defaults["false"]).field("computed",isBoolean,defaults["false"]);def("PropertyPattern").field("key",or(def("Literal"),def("Identifier"),def("Expression"))).field("computed",isBoolean,defaults["false"]);def("MethodDefinition").bases("Declaration").build("kind","key","value").field("kind",or("init","get","set","")).field("key",or(def("Literal"),def("Identifier"),def("Expression"))).field("value",def("Function")).field("computed",isBoolean,defaults["false"]);def("SpreadElement").bases("Node").build("argument").field("argument",def("Expression"));def("ArrayExpression").field("elements",[or(def("Expression"),def("SpreadElement"),null)]);def("NewExpression").field("arguments",[or(def("Expression"),def("SpreadElement"))]);def("CallExpression").field("arguments",[or(def("Expression"),def("SpreadElement"))]);def("SpreadElementPattern").bases("Pattern").build("argument").field("argument",def("Pattern"));var ClassBodyElement=or(def("MethodDefinition"),def("VariableDeclarator"),def("ClassPropertyDefinition"),def("ClassProperty"));def("ClassProperty").bases("Declaration").build("key").field("key",or(def("Literal"),def("Identifier"),def("Expression"))).field("computed",isBoolean,defaults["false"]);def("ClassPropertyDefinition").bases("Declaration").build("definition").field("definition",ClassBodyElement);def("ClassBody").bases("Declaration").build("body").field("body",[ClassBodyElement]);def("ClassDeclaration").bases("Declaration").build("id","body","superClass").field("id",def("Identifier")).field("body",def("ClassBody")).field("superClass",or(def("Expression"),null),defaults["null"]);def("ClassExpression").bases("Expression").build("id","body","superClass").field("id",or(def("Identifier"),null),defaults["null"]).field("body",def("ClassBody")).field("superClass",or(def("Expression"),null),defaults["null"]).field("implements",[def("ClassImplements")],defaults.emptyArray);def("ClassImplements").bases("Node").build("id").field("id",def("Identifier")).field("superClass",or(def("Expression"),null),defaults["null"]);def("Specifier").bases("Node");def("NamedSpecifier").bases("Specifier").field("id",def("Identifier")).field("name",or(def("Identifier"),null),defaults["null"]);def("ExportSpecifier").bases("NamedSpecifier").build("id","name");def("ExportBatchSpecifier").bases("Specifier").build();def("ImportSpecifier").bases("NamedSpecifier").build("id","name");def("ImportNamespaceSpecifier").bases("Specifier").build("id").field("id",def("Identifier"));def("ImportDefaultSpecifier").bases("Specifier").build("id").field("id",def("Identifier"));def("ExportDeclaration").bases("Declaration").build("default","declaration","specifiers","source").field("default",isBoolean).field("declaration",or(def("Declaration"),def("Expression"),null)).field("specifiers",[or(def("ExportSpecifier"),def("ExportBatchSpecifier"))],defaults.emptyArray).field("source",or(def("ModuleSpecifier"),null),defaults["null"]);def("ImportDeclaration").bases("Declaration").build("specifiers","source").field("specifiers",[or(def("ImportSpecifier"),def("ImportNamespaceSpecifier"),def("ImportDefaultSpecifier"))],defaults.emptyArray).field("source",def("ModuleSpecifier"));def("TaggedTemplateExpression").bases("Expression").field("tag",def("Expression")).field("quasi",def("TemplateLiteral"));def("TemplateLiteral").bases("Expression").build("quasis","expressions").field("quasis",[def("TemplateElement")]).field("expressions",[def("Expression")]);def("TemplateElement").bases("Node").build("value","tail").field("value",{cooked:isString,raw:isString}).field("tail",isBoolean)},{"../lib/shared":117,"../lib/types":118,"./core":106}],109:[function(require,module,exports){require("./core");var types=require("../lib/types");var def=types.Type.def;var or=types.Type.or;var builtin=types.builtInTypes;var isBoolean=builtin.boolean;var defaults=require("../lib/shared").defaults;def("Function").field("async",isBoolean,defaults["false"]);def("SpreadProperty").bases("Node").build("argument").field("argument",def("Expression"));def("ObjectExpression").field("properties",[or(def("Property"),def("SpreadProperty"))]);def("SpreadPropertyPattern").bases("Pattern").build("argument").field("argument",def("Pattern"));def("ObjectPattern").field("properties",[or(def("PropertyPattern"),def("SpreadPropertyPattern"))]);def("AwaitExpression").bases("Expression").build("argument","all").field("argument",or(def("Expression"),null)).field("all",isBoolean,defaults["false"])},{"../lib/shared":117,"../lib/types":118,"./core":106}],110:[function(require,module,exports){require("./core");var types=require("../lib/types");var def=types.Type.def;var or=types.Type.or;var builtin=types.builtInTypes;var isString=builtin.string;var isBoolean=builtin.boolean;var defaults=require("../lib/shared").defaults;def("XJSAttribute").bases("Node").build("name","value").field("name",or(def("XJSIdentifier"),def("XJSNamespacedName"))).field("value",or(def("Literal"),def("XJSExpressionContainer"),null),defaults["null"]);def("XJSIdentifier").bases("Node").build("name").field("name",isString);def("XJSNamespacedName").bases("Node").build("namespace","name").field("namespace",def("XJSIdentifier")).field("name",def("XJSIdentifier"));def("XJSMemberExpression").bases("MemberExpression").build("object","property").field("object",or(def("XJSIdentifier"),def("XJSMemberExpression"))).field("property",def("XJSIdentifier")).field("computed",isBoolean,defaults.false);var XJSElementName=or(def("XJSIdentifier"),def("XJSNamespacedName"),def("XJSMemberExpression"));def("XJSSpreadAttribute").bases("Node").build("argument").field("argument",def("Expression"));var XJSAttributes=[or(def("XJSAttribute"),def("XJSSpreadAttribute"))];def("XJSExpressionContainer").bases("Expression").build("expression").field("expression",def("Expression"));def("XJSElement").bases("Expression").build("openingElement","closingElement","children").field("openingElement",def("XJSOpeningElement")).field("closingElement",or(def("XJSClosingElement"),null),defaults["null"]).field("children",[or(def("XJSElement"),def("XJSExpressionContainer"),def("XJSText"),def("Literal"))],defaults.emptyArray).field("name",XJSElementName,function(){return this.openingElement.name}).field("selfClosing",isBoolean,function(){return this.openingElement.selfClosing}).field("attributes",XJSAttributes,function(){return this.openingElement.attributes});def("XJSOpeningElement").bases("Node").build("name","attributes","selfClosing").field("name",XJSElementName).field("attributes",XJSAttributes,defaults.emptyArray).field("selfClosing",isBoolean,defaults["false"]);def("XJSClosingElement").bases("Node").build("name").field("name",XJSElementName);def("XJSText").bases("Literal").build("value").field("value",isString);def("XJSEmptyExpression").bases("Expression").build();def("Type").bases("Node");def("AnyTypeAnnotation").bases("Type");def("VoidTypeAnnotation").bases("Type");def("NumberTypeAnnotation").bases("Type");def("StringTypeAnnotation").bases("Type");def("StringLiteralTypeAnnotation").bases("Type").build("value","raw").field("value",isString).field("raw",isString);def("BooleanTypeAnnotation").bases("Type");def("TypeAnnotation").bases("Node").build("typeAnnotation").field("typeAnnotation",def("Type"));def("NullableTypeAnnotation").bases("Type").build("typeAnnotation").field("typeAnnotation",def("Type"));def("FunctionTypeAnnotation").bases("Type").build("params","returnType","rest","typeParameters").field("params",[def("FunctionTypeParam")]).field("returnType",def("Type")).field("rest",or(def("FunctionTypeParam"),null)).field("typeParameters",or(def("TypeParameterDeclaration"),null));def("FunctionTypeParam").bases("Node").build("name","typeAnnotation","optional").field("name",def("Identifier")).field("typeAnnotation",def("Type")).field("optional",isBoolean);def("ArrayTypeAnnotation").bases("Type").build("elementType").field("elementType",def("Type"));def("ObjectTypeAnnotation").bases("Type").build("properties").field("properties",[def("ObjectTypeProperty")]).field("indexers",[def("ObjectTypeIndexer")],defaults.emptyArray).field("callProperties",[def("ObjectTypeCallProperty")],defaults.emptyArray);def("ObjectTypeProperty").bases("Node").build("key","value","optional").field("key",or(def("Literal"),def("Identifier"))).field("value",def("Type")).field("optional",isBoolean);def("ObjectTypeIndexer").bases("Node").build("id","key","value").field("id",def("Identifier")).field("key",def("Type")).field("value",def("Type"));def("ObjectTypeCallProperty").bases("Node").build("value").field("value",def("FunctionTypeAnnotation")).field("static",isBoolean,false);def("QualifiedTypeIdentifier").bases("Node").build("qualification","id").field("qualification",or(def("Identifier"),def("QualifiedTypeIdentifier"))).field("id",def("Identifier"));def("GenericTypeAnnotation").bases("Type").build("id","typeParameters").field("id",or(def("Identifier"),def("QualifiedTypeIdentifier"))).field("typeParameters",or(def("TypeParameterInstantiation"),null));def("MemberTypeAnnotation").bases("Type").build("object","property").field("object",def("Identifier")).field("property",or(def("MemberTypeAnnotation"),def("GenericTypeAnnotation")));def("UnionTypeAnnotation").bases("Type").build("types").field("types",[def("Type")]);def("IntersectionTypeAnnotation").bases("Type").build("types").field("types",[def("Type")]);def("TypeofTypeAnnotation").bases("Type").build("argument").field("argument",def("Type"));def("Identifier").field("typeAnnotation",or(def("TypeAnnotation"),null),defaults["null"]);def("TypeParameterDeclaration").bases("Node").build("params").field("params",[def("Identifier")]);def("TypeParameterInstantiation").bases("Node").build("params").field("params",[def("Type")]);def("Function").field("returnType",or(def("TypeAnnotation"),null),defaults["null"]).field("typeParameters",or(def("TypeParameterDeclaration"),null),defaults["null"]);def("ClassProperty").build("key","typeAnnotation").field("typeAnnotation",def("TypeAnnotation")).field("static",isBoolean,false);def("ClassImplements").field("typeParameters",or(def("TypeParameterInstantiation"),null),defaults["null"]);def("InterfaceDeclaration").bases("Statement").build("id","body","extends").field("id",def("Identifier")).field("typeParameters",or(def("TypeParameterDeclaration"),null),defaults["null"]).field("body",def("ObjectTypeAnnotation")).field("extends",[def("InterfaceExtends")]);def("InterfaceExtends").bases("Node").build("id").field("id",def("Identifier")).field("typeParameters",or(def("TypeParameterInstantiation"),null));def("TypeAlias").bases("Statement").build("id","typeParameters","right").field("id",def("Identifier")).field("typeParameters",or(def("TypeParameterDeclaration"),null)).field("right",def("Type"));def("TupleTypeAnnotation").bases("Type").build("types").field("types",[def("Type")]);def("DeclareVariable").bases("Statement").build("id").field("id",def("Identifier"));def("DeclareFunction").bases("Statement").build("id").field("id",def("Identifier"));def("DeclareClass").bases("InterfaceDeclaration").build("id");def("DeclareModule").bases("Statement").build("id","body").field("id",or(def("Identifier"),def("Literal"))).field("body",def("BlockStatement"))},{"../lib/shared":117,"../lib/types":118,"./core":106}],111:[function(require,module,exports){require("./core");var types=require("../lib/types");var def=types.Type.def;var or=types.Type.or;var geq=require("../lib/shared").geq;def("ForOfStatement").bases("Statement").build("left","right","body").field("left",or(def("VariableDeclaration"),def("Expression"))).field("right",def("Expression")).field("body",def("Statement"));def("LetStatement").bases("Statement").build("head","body").field("head",[def("VariableDeclarator")]).field("body",def("Statement"));def("LetExpression").bases("Expression").build("head","body").field("head",[def("VariableDeclarator")]).field("body",def("Expression"));def("GraphExpression").bases("Expression").build("index","expression").field("index",geq(0)).field("expression",def("Literal"));def("GraphIndexExpression").bases("Expression").build("index").field("index",geq(0))},{"../lib/shared":117,"../lib/types":118,"./core":106}],112:[function(require,module,exports){var assert=require("assert");var types=require("../main");var getFieldNames=types.getFieldNames;var getFieldValue=types.getFieldValue;var isArray=types.builtInTypes.array;var isObject=types.builtInTypes.object;var isDate=types.builtInTypes.Date;var isRegExp=types.builtInTypes.RegExp;var hasOwn=Object.prototype.hasOwnProperty;function astNodesAreEquivalent(a,b,problemPath){if(isArray.check(problemPath)){problemPath.length=0}else{problemPath=null}return areEquivalent(a,b,problemPath)}astNodesAreEquivalent.assert=function(a,b){var problemPath=[];if(!astNodesAreEquivalent(a,b,problemPath)){if(problemPath.length===0){assert.strictEqual(a,b)}else{assert.ok(false,"Nodes differ in the following path: "+problemPath.map(subscriptForProperty).join(""))}}};function subscriptForProperty(property){if(/[_$a-z][_$a-z0-9]*/i.test(property)){return"."+property}return"["+JSON.stringify(property)+"]"}function areEquivalent(a,b,problemPath){if(a===b){return true}if(isArray.check(a)){return arraysAreEquivalent(a,b,problemPath)}if(isObject.check(a)){return objectsAreEquivalent(a,b,problemPath)}if(isDate.check(a)){return isDate.check(b)&&+a===+b}if(isRegExp.check(a)){return isRegExp.check(b)&&(a.source===b.source&&a.global===b.global&&a.multiline===b.multiline&&a.ignoreCase===b.ignoreCase)}return a==b}function arraysAreEquivalent(a,b,problemPath){isArray.assert(a);var aLength=a.length;if(!isArray.check(b)||b.length!==aLength){if(problemPath){problemPath.push("length")}return false}for(var i=0;i<aLength;++i){if(problemPath){problemPath.push(i)}if(i in a!==i in b){return false}if(!areEquivalent(a[i],b[i],problemPath)){return false}if(problemPath){assert.strictEqual(problemPath.pop(),i)}}return true}function objectsAreEquivalent(a,b,problemPath){isObject.assert(a);if(!isObject.check(b)){return false}if(a.type!==b.type){if(problemPath){problemPath.push("type")}return false}var aNames=getFieldNames(a);var aNameCount=aNames.length;var bNames=getFieldNames(b);var bNameCount=bNames.length;if(aNameCount===bNameCount){for(var i=0;i<aNameCount;++i){var name=aNames[i];var aChild=getFieldValue(a,name);var bChild=getFieldValue(b,name);if(problemPath){problemPath.push(name)
}if(!areEquivalent(aChild,bChild,problemPath)){return false}if(problemPath){assert.strictEqual(problemPath.pop(),name)}}return true}if(!problemPath){return false}var seenNames=Object.create(null);for(i=0;i<aNameCount;++i){seenNames[aNames[i]]=true}for(i=0;i<bNameCount;++i){name=bNames[i];if(!hasOwn.call(seenNames,name)){problemPath.push(name);return false}delete seenNames[name]}for(name in seenNames){problemPath.push(name);break}return false}module.exports=astNodesAreEquivalent},{"../main":119,assert:121}],113:[function(require,module,exports){var assert=require("assert");var types=require("./types");var n=types.namedTypes;var b=types.builders;var isNumber=types.builtInTypes.number;var isArray=types.builtInTypes.array;var Path=require("./path");var Scope=require("./scope");function NodePath(value,parentPath,name){assert.ok(this instanceof NodePath);Path.call(this,value,parentPath,name)}require("util").inherits(NodePath,Path);var NPp=NodePath.prototype;Object.defineProperties(NPp,{node:{get:function(){Object.defineProperty(this,"node",{configurable:true,value:this._computeNode()});return this.node}},parent:{get:function(){Object.defineProperty(this,"parent",{configurable:true,value:this._computeParent()});return this.parent}},scope:{get:function(){Object.defineProperty(this,"scope",{configurable:true,value:this._computeScope()});return this.scope}}});NPp.replace=function(){delete this.node;delete this.parent;delete this.scope;return Path.prototype.replace.apply(this,arguments)};NPp.prune=function(){var remainingNodePath=this.parent;this.replace();return cleanUpNodesAfterPrune(remainingNodePath)};NPp._computeNode=function(){var value=this.value;if(n.Node.check(value)){return value}var pp=this.parentPath;return pp&&pp.node||null};NPp._computeParent=function(){var value=this.value;var pp=this.parentPath;if(!n.Node.check(value)){while(pp&&!n.Node.check(pp.value)){pp=pp.parentPath}if(pp){pp=pp.parentPath}}while(pp&&!n.Node.check(pp.value)){pp=pp.parentPath}return pp||null};NPp._computeScope=function(){var value=this.value;var pp=this.parentPath;var scope=pp&&pp.scope;if(n.Node.check(value)&&Scope.isEstablishedBy(value)){scope=new Scope(this,scope)}return scope||null};NPp.getValueProperty=function(name){return types.getFieldValue(this.value,name)};NPp.needsParens=function(assumeExpressionContext){var pp=this.parentPath;if(!pp){return false}var node=this.value;if(!n.Expression.check(node)){return false}if(node.type==="Identifier"){return false}while(!n.Node.check(pp.value)){pp=pp.parentPath;if(!pp){return false}}var parent=pp.value;switch(node.type){case"UnaryExpression":case"SpreadElement":case"SpreadProperty":return parent.type==="MemberExpression"&&this.name==="object"&&parent.object===node;case"BinaryExpression":case"LogicalExpression":switch(parent.type){case"CallExpression":return this.name==="callee"&&parent.callee===node;case"UnaryExpression":case"SpreadElement":case"SpreadProperty":return true;case"MemberExpression":return this.name==="object"&&parent.object===node;case"BinaryExpression":case"LogicalExpression":var po=parent.operator;var pp=PRECEDENCE[po];var no=node.operator;var np=PRECEDENCE[no];if(pp>np){return true}if(pp===np&&this.name==="right"){assert.strictEqual(parent.right,node);return true}default:return false}case"SequenceExpression":switch(parent.type){case"ForStatement":return false;case"ExpressionStatement":return this.name!=="expression";default:return true}case"YieldExpression":switch(parent.type){case"BinaryExpression":case"LogicalExpression":case"UnaryExpression":case"SpreadElement":case"SpreadProperty":case"CallExpression":case"MemberExpression":case"NewExpression":case"ConditionalExpression":case"YieldExpression":return true;default:return false}case"Literal":return parent.type==="MemberExpression"&&isNumber.check(node.value)&&this.name==="object"&&parent.object===node;case"AssignmentExpression":case"ConditionalExpression":switch(parent.type){case"UnaryExpression":case"SpreadElement":case"SpreadProperty":case"BinaryExpression":case"LogicalExpression":return true;case"CallExpression":return this.name==="callee"&&parent.callee===node;case"ConditionalExpression":return this.name==="test"&&parent.test===node;case"MemberExpression":return this.name==="object"&&parent.object===node;default:return false}default:if(parent.type==="NewExpression"&&this.name==="callee"&&parent.callee===node){return containsCallExpression(node)}}if(assumeExpressionContext!==true&&!this.canBeFirstInStatement()&&this.firstInStatement())return true;return false};function isBinary(node){return n.BinaryExpression.check(node)||n.LogicalExpression.check(node)}function isUnaryLike(node){return n.UnaryExpression.check(node)||n.SpreadElement&&n.SpreadElement.check(node)||n.SpreadProperty&&n.SpreadProperty.check(node)}var PRECEDENCE={};[["||"],["&&"],["|"],["^"],["&"],["==","===","!=","!=="],["<",">","<=",">=","in","instanceof"],[">>","<<",">>>"],["+","-"],["*","/","%"]].forEach(function(tier,i){tier.forEach(function(op){PRECEDENCE[op]=i})});function containsCallExpression(node){if(n.CallExpression.check(node)){return true}if(isArray.check(node)){return node.some(containsCallExpression)}if(n.Node.check(node)){return types.someField(node,function(name,child){return containsCallExpression(child)})}return false}NPp.canBeFirstInStatement=function(){var node=this.node;return!n.FunctionExpression.check(node)&&!n.ObjectExpression.check(node)};NPp.firstInStatement=function(){return firstInStatement(this)};function firstInStatement(path){for(var node,parent;path.parent;path=path.parent){node=path.node;parent=path.parent.node;if(n.BlockStatement.check(parent)&&path.parent.name==="body"&&path.name===0){assert.strictEqual(parent.body[0],node);return true}if(n.ExpressionStatement.check(parent)&&path.name==="expression"){assert.strictEqual(parent.expression,node);return true}if(n.SequenceExpression.check(parent)&&path.parent.name==="expressions"&&path.name===0){assert.strictEqual(parent.expressions[0],node);continue}if(n.CallExpression.check(parent)&&path.name==="callee"){assert.strictEqual(parent.callee,node);continue}if(n.MemberExpression.check(parent)&&path.name==="object"){assert.strictEqual(parent.object,node);continue}if(n.ConditionalExpression.check(parent)&&path.name==="test"){assert.strictEqual(parent.test,node);continue}if(isBinary(parent)&&path.name==="left"){assert.strictEqual(parent.left,node);continue}if(n.UnaryExpression.check(parent)&&!parent.prefix&&path.name==="argument"){assert.strictEqual(parent.argument,node);continue}return false}return true}function cleanUpNodesAfterPrune(remainingNodePath){if(n.VariableDeclaration.check(remainingNodePath.node)){var declarations=remainingNodePath.get("declarations").value;if(!declarations||declarations.length===0){return remainingNodePath.prune()}}else if(n.ExpressionStatement.check(remainingNodePath.node)){if(!remainingNodePath.get("expression").value){return remainingNodePath.prune()}}else if(n.IfStatement.check(remainingNodePath.node)){cleanUpIfStatementAfterPrune(remainingNodePath)}return remainingNodePath}function cleanUpIfStatementAfterPrune(ifStatement){var testExpression=ifStatement.get("test").value;var alternate=ifStatement.get("alternate").value;var consequent=ifStatement.get("consequent").value;if(!consequent&&!alternate){var testExpressionStatement=b.expressionStatement(testExpression);ifStatement.replace(testExpressionStatement)}else if(!consequent&&alternate){var negatedTestExpression=b.unaryExpression("!",testExpression,true);if(n.UnaryExpression.check(testExpression)&&testExpression.operator==="!"){negatedTestExpression=testExpression.argument}ifStatement.get("test").replace(negatedTestExpression);ifStatement.get("consequent").replace(alternate);ifStatement.get("alternate").replace()}}module.exports=NodePath},{"./path":115,"./scope":116,"./types":118,assert:121,util:145}],114:[function(require,module,exports){var assert=require("assert");var types=require("./types");var NodePath=require("./node-path");var Node=types.namedTypes.Node;var isArray=types.builtInTypes.array;var isObject=types.builtInTypes.object;var isFunction=types.builtInTypes.function;var hasOwn=Object.prototype.hasOwnProperty;var undefined;function PathVisitor(){assert.ok(this instanceof PathVisitor);this._reusableContextStack=[];this._methodNameTable=computeMethodNameTable(this);this.Context=makeContextConstructor(this);this._visiting=false;this._changeReported=false}function computeMethodNameTable(visitor){var typeNames=Object.create(null);for(var methodName in visitor){if(/^visit[A-Z]/.test(methodName)){typeNames[methodName.slice("visit".length)]=true}}var supertypeTable=types.computeSupertypeLookupTable(typeNames);var methodNameTable=Object.create(null);var typeNames=Object.keys(supertypeTable);var typeNameCount=typeNames.length;for(var i=0;i<typeNameCount;++i){var typeName=typeNames[i];methodName="visit"+supertypeTable[typeName];if(isFunction.check(visitor[methodName])){methodNameTable[typeName]=methodName}}return methodNameTable}PathVisitor.fromMethodsObject=function fromMethodsObject(methods){if(methods instanceof PathVisitor){return methods}if(!isObject.check(methods)){return new PathVisitor}function Visitor(){assert.ok(this instanceof Visitor);PathVisitor.call(this)}var Vp=Visitor.prototype=Object.create(PVp);Vp.constructor=Visitor;extend(Vp,methods);extend(Visitor,PathVisitor);isFunction.assert(Visitor.fromMethodsObject);isFunction.assert(Visitor.visit);return new Visitor};function extend(target,source){for(var property in source){if(hasOwn.call(source,property)){target[property]=source[property]}}return target}PathVisitor.visit=function visit(node,methods){return PathVisitor.fromMethodsObject(methods).visit(node)};var PVp=PathVisitor.prototype;var recursiveVisitWarning=["Recursively calling visitor.visit(path) resets visitor state.","Try this.visit(path) or this.traverse(path) instead."].join(" ");PVp.visit=function(){assert.ok(!this._visiting,recursiveVisitWarning);this._visiting=true;this._changeReported=false;var argc=arguments.length;var args=new Array(argc);for(var i=0;i<argc;++i){args[i]=arguments[i]}if(!(args[0]instanceof NodePath)){args[0]=new NodePath({root:args[0]}).get("root")}this.reset.apply(this,args);try{return this.visitWithoutReset(args[0])}finally{this._visiting=false}};PVp.reset=function(path){};PVp.visitWithoutReset=function(path){if(this instanceof this.Context){return this.visitor.visitWithoutReset(path)}assert.ok(path instanceof NodePath);var value=path.value;var methodName=Node.check(value)&&this._methodNameTable[value.type];if(methodName){var context=this.acquireContext(path);try{return context.invokeVisitorMethod(methodName)}finally{this.releaseContext(context)}}else{return visitChildren(path,this)}};function visitChildren(path,visitor){assert.ok(path instanceof NodePath);assert.ok(visitor instanceof PathVisitor);var value=path.value;if(isArray.check(value)){path.each(visitor.visitWithoutReset,visitor)}else if(!isObject.check(value)){}else{var childNames=types.getFieldNames(value);var childCount=childNames.length;var childPaths=[];for(var i=0;i<childCount;++i){var childName=childNames[i];if(!hasOwn.call(value,childName)){value[childName]=types.getFieldValue(value,childName)}childPaths.push(path.get(childName))}for(var i=0;i<childCount;++i){visitor.visitWithoutReset(childPaths[i])}}return path.value}PVp.acquireContext=function(path){if(this._reusableContextStack.length===0){return new this.Context(path)}return this._reusableContextStack.pop().reset(path)};PVp.releaseContext=function(context){assert.ok(context instanceof this.Context);this._reusableContextStack.push(context);context.currentPath=null};PVp.reportChanged=function(){this._changeReported=true};PVp.wasChangeReported=function(){return this._changeReported};function makeContextConstructor(visitor){function Context(path){assert.ok(this instanceof Context);assert.ok(this instanceof PathVisitor);assert.ok(path instanceof NodePath);Object.defineProperty(this,"visitor",{value:visitor,writable:false,enumerable:true,configurable:false});this.currentPath=path;this.needToCallTraverse=true;Object.seal(this)}assert.ok(visitor instanceof PathVisitor);var Cp=Context.prototype=Object.create(visitor);Cp.constructor=Context;extend(Cp,sharedContextProtoMethods);return Context}var sharedContextProtoMethods=Object.create(null);sharedContextProtoMethods.reset=function reset(path){assert.ok(this instanceof this.Context);assert.ok(path instanceof NodePath);this.currentPath=path;this.needToCallTraverse=true;return this};sharedContextProtoMethods.invokeVisitorMethod=function invokeVisitorMethod(methodName){assert.ok(this instanceof this.Context);assert.ok(this.currentPath instanceof NodePath);var result=this.visitor[methodName].call(this,this.currentPath);if(result===false){this.needToCallTraverse=false}else if(result!==undefined){this.currentPath=this.currentPath.replace(result)[0];if(this.needToCallTraverse){this.traverse(this.currentPath)}}assert.strictEqual(this.needToCallTraverse,false,"Must either call this.traverse or return false in "+methodName);var path=this.currentPath;return path&&path.value};sharedContextProtoMethods.traverse=function traverse(path,newVisitor){assert.ok(this instanceof this.Context);assert.ok(path instanceof NodePath);assert.ok(this.currentPath instanceof NodePath);this.needToCallTraverse=false;return visitChildren(path,PathVisitor.fromMethodsObject(newVisitor||this.visitor))};sharedContextProtoMethods.visit=function visit(path,newVisitor){assert.ok(this instanceof this.Context);assert.ok(path instanceof NodePath);assert.ok(this.currentPath instanceof NodePath);this.needToCallTraverse=false;return PathVisitor.fromMethodsObject(newVisitor||this.visitor).visitWithoutReset(path)};sharedContextProtoMethods.reportChanged=function reportChanged(){this.visitor.reportChanged()};module.exports=PathVisitor},{"./node-path":113,"./types":118,assert:121}],115:[function(require,module,exports){var assert=require("assert");var Op=Object.prototype;var hasOwn=Op.hasOwnProperty;var types=require("./types");var isArray=types.builtInTypes.array;var isNumber=types.builtInTypes.number;var Ap=Array.prototype;var slice=Ap.slice;var map=Ap.map;function Path(value,parentPath,name){assert.ok(this instanceof Path);if(parentPath){assert.ok(parentPath instanceof Path)}else{parentPath=null;name=null}this.value=value;this.parentPath=parentPath;this.name=name;this.__childCache=null}var Pp=Path.prototype;function getChildCache(path){return path.__childCache||(path.__childCache=Object.create(null))}function getChildPath(path,name){var cache=getChildCache(path);var actualChildValue=path.getValueProperty(name);var childPath=cache[name];if(!hasOwn.call(cache,name)||childPath.value!==actualChildValue){childPath=cache[name]=new path.constructor(actualChildValue,path,name)}return childPath}Pp.getValueProperty=function getValueProperty(name){return this.value[name]};Pp.get=function get(name){var path=this;var names=arguments;var count=names.length;for(var i=0;i<count;++i){path=getChildPath(path,names[i])}return path};Pp.each=function each(callback,context){var childPaths=[];var len=this.value.length;var i=0;for(var i=0;i<len;++i){if(hasOwn.call(this.value,i)){childPaths[i]=this.get(i)}}context=context||this;for(i=0;i<len;++i){if(hasOwn.call(childPaths,i)){callback.call(context,childPaths[i])}}};Pp.map=function map(callback,context){var result=[];this.each(function(childPath){result.push(callback.call(this,childPath))},context);return result};Pp.filter=function filter(callback,context){var result=[];this.each(function(childPath){if(callback.call(this,childPath)){result.push(childPath)}},context);return result};function emptyMoves(){}function getMoves(path,offset,start,end){isArray.assert(path.value);if(offset===0){return emptyMoves}var length=path.value.length;if(length<1){return emptyMoves}var argc=arguments.length;if(argc===2){start=0;end=length}else if(argc===3){start=Math.max(start,0);end=length}else{start=Math.max(start,0);end=Math.min(end,length)}isNumber.assert(start);isNumber.assert(end);var moves=Object.create(null);var cache=getChildCache(path);for(var i=start;i<end;++i){if(hasOwn.call(path.value,i)){var childPath=path.get(i);assert.strictEqual(childPath.name,i);var newIndex=i+offset;childPath.name=newIndex;moves[newIndex]=childPath;delete cache[i]}}delete cache.length;return function(){for(var newIndex in moves){var childPath=moves[newIndex];assert.strictEqual(childPath.name,+newIndex);cache[newIndex]=childPath;path.value[newIndex]=childPath.value}}}Pp.shift=function shift(){var move=getMoves(this,-1);var result=this.value.shift();move();return result};Pp.unshift=function unshift(node){var move=getMoves(this,arguments.length);var result=this.value.unshift.apply(this.value,arguments);move();return result};Pp.push=function push(node){isArray.assert(this.value);delete getChildCache(this).length;return this.value.push.apply(this.value,arguments)};Pp.pop=function pop(){isArray.assert(this.value);var cache=getChildCache(this);delete cache[this.value.length-1];delete cache.length;return this.value.pop()};Pp.insertAt=function insertAt(index,node){var argc=arguments.length;var move=getMoves(this,argc-1,index);if(move===emptyMoves){return this}index=Math.max(index,0);for(var i=1;i<argc;++i){this.value[index+i-1]=arguments[i]}move();return this};Pp.insertBefore=function insertBefore(node){var pp=this.parentPath;var argc=arguments.length;var insertAtArgs=[this.name];for(var i=0;i<argc;++i){insertAtArgs.push(arguments[i])}return pp.insertAt.apply(pp,insertAtArgs)};Pp.insertAfter=function insertAfter(node){var pp=this.parentPath;var argc=arguments.length;var insertAtArgs=[this.name+1];for(var i=0;i<argc;++i){insertAtArgs.push(arguments[i])}return pp.insertAt.apply(pp,insertAtArgs)};function repairRelationshipWithParent(path){assert.ok(path instanceof Path);var pp=path.parentPath;if(!pp){return path}var parentValue=pp.value;var parentCache=getChildCache(pp);if(parentValue[path.name]===path.value){parentCache[path.name]=path}else if(isArray.check(parentValue)){var i=parentValue.indexOf(path.value);if(i>=0){parentCache[path.name=i]=path}}else{parentValue[path.name]=path.value;parentCache[path.name]=path}assert.strictEqual(parentValue[path.name],path.value);assert.strictEqual(path.parentPath.get(path.name),path);return path}Pp.replace=function replace(replacement){var results=[];var parentValue=this.parentPath.value;var parentCache=getChildCache(this.parentPath);var count=arguments.length;repairRelationshipWithParent(this);if(isArray.check(parentValue)){var originalLength=parentValue.length;var move=getMoves(this.parentPath,count-1,this.name+1);var spliceArgs=[this.name,1];for(var i=0;i<count;++i){spliceArgs.push(arguments[i])}var splicedOut=parentValue.splice.apply(parentValue,spliceArgs);assert.strictEqual(splicedOut[0],this.value);assert.strictEqual(parentValue.length,originalLength-1+count);move();if(count===0){delete this.value;delete parentCache[this.name];this.__childCache=null}else{assert.strictEqual(parentValue[this.name],replacement);if(this.value!==replacement){this.value=replacement;this.__childCache=null}for(i=0;i<count;++i){results.push(this.parentPath.get(this.name+i))}assert.strictEqual(results[0],this)}}else if(count===1){if(this.value!==replacement){this.__childCache=null}this.value=parentValue[this.name]=replacement;results.push(this)}else if(count===0){delete parentValue[this.name];delete this.value;this.__childCache=null}else{assert.ok(false,"Could not replace path")}return results};module.exports=Path},{"./types":118,assert:121}],116:[function(require,module,exports){var assert=require("assert");var types=require("./types");var Type=types.Type;var namedTypes=types.namedTypes;var Node=namedTypes.Node;var Expression=namedTypes.Expression;var isArray=types.builtInTypes.array;var hasOwn=Object.prototype.hasOwnProperty;var b=types.builders;function Scope(path,parentScope){assert.ok(this instanceof Scope);assert.ok(path instanceof require("./node-path"));ScopeType.assert(path.value);var depth;if(parentScope){assert.ok(parentScope instanceof Scope);depth=parentScope.depth+1}else{parentScope=null;depth=0}Object.defineProperties(this,{path:{value:path},node:{value:path.value},isGlobal:{value:!parentScope,enumerable:true},depth:{value:depth},parent:{value:parentScope},bindings:{value:{}}})}var scopeTypes=[namedTypes.Program,namedTypes.Function,namedTypes.CatchClause];var ScopeType=Type.or.apply(Type,scopeTypes);Scope.isEstablishedBy=function(node){return ScopeType.check(node)};var Sp=Scope.prototype;Sp.didScan=false;Sp.declares=function(name){this.scan();return hasOwn.call(this.bindings,name)};Sp.declareTemporary=function(prefix){if(prefix){assert.ok(/^[a-z$_]/i.test(prefix),prefix)}else{prefix="t$"}prefix+=this.depth.toString(36)+"$";this.scan();var index=0;while(this.declares(prefix+index)){++index}var name=prefix+index;return this.bindings[name]=types.builders.identifier(name)};Sp.injectTemporary=function(identifier,init){identifier||(identifier=this.declareTemporary());var bodyPath=this.path.get("body");if(namedTypes.BlockStatement.check(bodyPath.value)){bodyPath=bodyPath.get("body")}bodyPath.unshift(b.variableDeclaration("var",[b.variableDeclarator(identifier,init||null)]));return identifier};Sp.scan=function(force){if(force||!this.didScan){for(var name in this.bindings){delete this.bindings[name]}scanScope(this.path,this.bindings);this.didScan=true}};Sp.getBindings=function(){this.scan();return this.bindings};function scanScope(path,bindings){var node=path.value;ScopeType.assert(node);if(namedTypes.CatchClause.check(node)){addPattern(path.get("param"),bindings)}else{recursiveScanScope(path,bindings)}}function recursiveScanScope(path,bindings){var node=path.value;if(path.parent&&namedTypes.FunctionExpression.check(path.parent.node)&&path.parent.node.id){addPattern(path.parent.get("id"),bindings)}if(!node){}else if(isArray.check(node)){path.each(function(childPath){recursiveScanChild(childPath,bindings)})}else if(namedTypes.Function.check(node)){path.get("params").each(function(paramPath){addPattern(paramPath,bindings)});recursiveScanChild(path.get("body"),bindings)}else if(namedTypes.VariableDeclarator.check(node)){addPattern(path.get("id"),bindings);recursiveScanChild(path.get("init"),bindings)}else if(node.type==="ImportSpecifier"||node.type==="ImportNamespaceSpecifier"||node.type==="ImportDefaultSpecifier"){addPattern(node.name?path.get("name"):path.get("id"),bindings)}else if(Node.check(node)&&!Expression.check(node)){types.eachField(node,function(name,child){var childPath=path.get(name);assert.strictEqual(childPath.value,child);recursiveScanChild(childPath,bindings)})}}function recursiveScanChild(path,bindings){var node=path.value;if(!node||Expression.check(node)){}else if(namedTypes.FunctionDeclaration.check(node)){addPattern(path.get("id"),bindings)}else if(namedTypes.ClassDeclaration&&namedTypes.ClassDeclaration.check(node)){addPattern(path.get("id"),bindings)}else if(ScopeType.check(node)){if(namedTypes.CatchClause.check(node)){var catchParamName=node.param.name;var hadBinding=hasOwn.call(bindings,catchParamName);recursiveScanScope(path.get("body"),bindings);if(!hadBinding){delete bindings[catchParamName]}}}else{recursiveScanScope(path,bindings)}}function addPattern(patternPath,bindings){var pattern=patternPath.value;namedTypes.Pattern.assert(pattern);if(namedTypes.Identifier.check(pattern)){if(hasOwn.call(bindings,pattern.name)){bindings[pattern.name].push(patternPath)}else{bindings[pattern.name]=[patternPath]}}else if(namedTypes.SpreadElement&&namedTypes.SpreadElement.check(pattern)){addPattern(patternPath.get("argument"),bindings)}}Sp.lookup=function(name){for(var scope=this;scope;scope=scope.parent)if(scope.declares(name))break;return scope};Sp.getGlobalScope=function(){var scope=this;while(!scope.isGlobal)scope=scope.parent;return scope};module.exports=Scope},{"./node-path":113,"./types":118,assert:121}],117:[function(require,module,exports){var types=require("../lib/types");var Type=types.Type;var builtin=types.builtInTypes;var isNumber=builtin.number;exports.geq=function(than){return new Type(function(value){return isNumber.check(value)&&value>=than},isNumber+" >= "+than)};exports.defaults={"null":function(){return null},emptyArray:function(){return[]},"false":function(){return false},"true":function(){return true},undefined:function(){}};var naiveIsPrimitive=Type.or(builtin.string,builtin.number,builtin.boolean,builtin.null,builtin.undefined);exports.isPrimitive=new Type(function(value){if(value===null)return true;var type=typeof value;return!(type==="object"||type==="function")},naiveIsPrimitive.toString())},{"../lib/types":118}],118:[function(require,module,exports){var assert=require("assert");var Ap=Array.prototype;var slice=Ap.slice;var map=Ap.map;var each=Ap.forEach;var Op=Object.prototype;var objToStr=Op.toString;var funObjStr=objToStr.call(function(){});var strObjStr=objToStr.call("");var hasOwn=Op.hasOwnProperty;function Type(check,name){var self=this;assert.ok(self instanceof Type,self);assert.strictEqual(objToStr.call(check),funObjStr,check+" is not a function");var nameObjStr=objToStr.call(name);assert.ok(nameObjStr===funObjStr||nameObjStr===strObjStr,name+" is neither a function nor a string");Object.defineProperties(self,{name:{value:name},check:{value:function(value,deep){var result=check.call(self,value,deep);if(!result&&deep&&objToStr.call(deep)===funObjStr)deep(self,value);return result}}})}var Tp=Type.prototype;exports.Type=Type;Tp.assert=function(value,deep){if(!this.check(value,deep)){var str=shallowStringify(value);assert.ok(false,str+" does not match type "+this);return false}return true};function shallowStringify(value){if(isObject.check(value))return"{"+Object.keys(value).map(function(key){return key+": "+value[key]}).join(", ")+"}";if(isArray.check(value))return"["+value.map(shallowStringify).join(", ")+"]";return JSON.stringify(value)}Tp.toString=function(){var name=this.name;if(isString.check(name))return name;if(isFunction.check(name))return name.call(this)+"";return name+" type"};var builtInTypes={};exports.builtInTypes=builtInTypes;function defBuiltInType(example,name){var objStr=objToStr.call(example);Object.defineProperty(builtInTypes,name,{enumerable:true,value:new Type(function(value){return objToStr.call(value)===objStr},name)});return builtInTypes[name]}var isString=defBuiltInType("","string");var isFunction=defBuiltInType(function(){},"function");var isArray=defBuiltInType([],"array");var isObject=defBuiltInType({},"object");var isRegExp=defBuiltInType(/./,"RegExp");var isDate=defBuiltInType(new Date,"Date");var isNumber=defBuiltInType(3,"number");var isBoolean=defBuiltInType(true,"boolean");var isNull=defBuiltInType(null,"null");var isUndefined=defBuiltInType(void 0,"undefined");function toType(from,name){if(from instanceof Type)return from;if(from instanceof Def)return from.type;if(isArray.check(from))return Type.fromArray(from);if(isObject.check(from))return Type.fromObject(from);if(isFunction.check(from))return new Type(from,name);return new Type(function(value){return value===from},isUndefined.check(name)?function(){return from+""}:name)}Type.or=function(){var types=[];var len=arguments.length;for(var i=0;i<len;++i)types.push(toType(arguments[i]));return new Type(function(value,deep){for(var i=0;i<len;++i)if(types[i].check(value,deep))return true;return false},function(){return types.join(" | ")})};Type.fromArray=function(arr){assert.ok(isArray.check(arr));assert.strictEqual(arr.length,1,"only one element type is permitted for typed arrays");return toType(arr[0]).arrayOf()};Tp.arrayOf=function(){var elemType=this;return new Type(function(value,deep){return isArray.check(value)&&value.every(function(elem){return elemType.check(elem,deep)})},function(){return"["+elemType+"]"})};Type.fromObject=function(obj){var fields=Object.keys(obj).map(function(name){return new Field(name,obj[name])});return new Type(function(value,deep){return isObject.check(value)&&fields.every(function(field){return field.type.check(value[field.name],deep)})},function(){return"{ "+fields.join(", ")+" }"})};function Field(name,type,defaultFn,hidden){var self=this;assert.ok(self instanceof Field);isString.assert(name);type=toType(type);var properties={name:{value:name},type:{value:type},hidden:{value:!!hidden}};if(isFunction.check(defaultFn)){properties.defaultFn={value:defaultFn}}Object.defineProperties(self,properties)}var Fp=Field.prototype;Fp.toString=function(){return JSON.stringify(this.name)+": "+this.type};Fp.getValue=function(obj){var value=obj[this.name];if(!isUndefined.check(value))return value;if(this.defaultFn)value=this.defaultFn.call(obj);return value};Type.def=function(typeName){isString.assert(typeName);return hasOwn.call(defCache,typeName)?defCache[typeName]:defCache[typeName]=new Def(typeName)};var defCache=Object.create(null);function Def(typeName){var self=this;assert.ok(self instanceof Def);Object.defineProperties(self,{typeName:{value:typeName},baseNames:{value:[]},ownFields:{value:Object.create(null)},allSupertypes:{value:Object.create(null)},supertypeList:{value:[]},allFields:{value:Object.create(null)},fieldNames:{value:[]},type:{value:new Type(function(value,deep){return self.check(value,deep)},typeName)}})}Def.fromValue=function(value){if(value&&typeof value==="object"){var type=value.type;if(typeof type==="string"&&hasOwn.call(defCache,type)){var d=defCache[type];if(d.finalized){return d}}}return null};var Dp=Def.prototype;Dp.isSupertypeOf=function(that){if(that instanceof Def){assert.strictEqual(this.finalized,true);assert.strictEqual(that.finalized,true);return hasOwn.call(that.allSupertypes,this.typeName)}else{assert.ok(false,that+" is not a Def")}};exports.getSupertypeNames=function(typeName){assert.ok(hasOwn.call(defCache,typeName));var d=defCache[typeName];assert.strictEqual(d.finalized,true);return d.supertypeList.slice(1)};exports.computeSupertypeLookupTable=function(candidates){var table={};var typeNames=Object.keys(defCache);var typeNameCount=typeNames.length;for(var i=0;i<typeNameCount;++i){var typeName=typeNames[i];var d=defCache[typeName];assert.strictEqual(d.finalized,true);for(var j=0;j<d.supertypeList.length;++j){var superTypeName=d.supertypeList[j];if(hasOwn.call(candidates,superTypeName)){table[typeName]=superTypeName;break}}}return table};Dp.checkAllFields=function(value,deep){var allFields=this.allFields;assert.strictEqual(this.finalized,true);function checkFieldByName(name){var field=allFields[name];var type=field.type;var child=field.getValue(value);return type.check(child,deep)}return isObject.check(value)&&Object.keys(allFields).every(checkFieldByName)};Dp.check=function(value,deep){assert.strictEqual(this.finalized,true,"prematurely checking unfinalized type "+this.typeName);if(!isObject.check(value))return false;var vDef=Def.fromValue(value);if(!vDef){if(this.typeName==="SourceLocation"||this.typeName==="Position"){return this.checkAllFields(value,deep)}return false}if(deep&&vDef===this)return this.checkAllFields(value,deep);if(!this.isSupertypeOf(vDef))return false;if(!deep)return true;return vDef.checkAllFields(value,deep)&&this.checkAllFields(value,false)};Dp.bases=function(){var bases=this.baseNames;assert.strictEqual(this.finalized,false);each.call(arguments,function(baseName){isString.assert(baseName);if(bases.indexOf(baseName)<0)bases.push(baseName)});return this};Object.defineProperty(Dp,"buildable",{value:false});var builders={};exports.builders=builders;var nodePrototype={};exports.defineMethod=function(name,func){var old=nodePrototype[name];if(isUndefined.check(func)){delete nodePrototype[name]}else{isFunction.assert(func);Object.defineProperty(nodePrototype,name,{enumerable:true,configurable:true,value:func})}return old};Dp.build=function(){var self=this;Object.defineProperty(self,"buildParams",{value:slice.call(arguments),writable:false,enumerable:false,configurable:true});assert.strictEqual(self.finalized,false);
isString.arrayOf().assert(self.buildParams);if(self.buildable){return self}self.field("type",self.typeName,function(){return self.typeName});Object.defineProperty(self,"buildable",{value:true});Object.defineProperty(builders,getBuilderName(self.typeName),{enumerable:true,value:function(){var args=arguments;var argc=args.length;var built=Object.create(nodePrototype);assert.ok(self.finalized,"attempting to instantiate unfinalized type "+self.typeName);function add(param,i){if(hasOwn.call(built,param))return;var all=self.allFields;assert.ok(hasOwn.call(all,param),param);var field=all[param];var type=field.type;var value;if(isNumber.check(i)&&i<argc){value=args[i]}else if(field.defaultFn){value=field.defaultFn.call(built)}else{var message="no value or default function given for field "+JSON.stringify(param)+" of "+self.typeName+"("+self.buildParams.map(function(name){return all[name]}).join(", ")+")";assert.ok(false,message)}if(!type.check(value)){assert.ok(false,shallowStringify(value)+" does not match field "+field+" of type "+self.typeName)}built[param]=value}self.buildParams.forEach(function(param,i){add(param,i)});Object.keys(self.allFields).forEach(function(param){add(param)});assert.strictEqual(built.type,self.typeName);return built}});return self};function getBuilderName(typeName){return typeName.replace(/^[A-Z]+/,function(upperCasePrefix){var len=upperCasePrefix.length;switch(len){case 0:return"";case 1:return upperCasePrefix.toLowerCase();default:return upperCasePrefix.slice(0,len-1).toLowerCase()+upperCasePrefix.charAt(len-1)}})}Dp.field=function(name,type,defaultFn,hidden){assert.strictEqual(this.finalized,false);this.ownFields[name]=new Field(name,type,defaultFn,hidden);return this};var namedTypes={};exports.namedTypes=namedTypes;function getFieldNames(object){var d=Def.fromValue(object);if(d){return d.fieldNames.slice(0)}if("type"in object){assert.ok(false,"did not recognize object of type "+JSON.stringify(object.type))}return Object.keys(object)}exports.getFieldNames=getFieldNames;function getFieldValue(object,fieldName){var d=Def.fromValue(object);if(d){var field=d.allFields[fieldName];if(field){return field.getValue(object)}}return object[fieldName]}exports.getFieldValue=getFieldValue;exports.eachField=function(object,callback,context){getFieldNames(object).forEach(function(name){callback.call(this,name,getFieldValue(object,name))},context)};exports.someField=function(object,callback,context){return getFieldNames(object).some(function(name){return callback.call(this,name,getFieldValue(object,name))},context)};Object.defineProperty(Dp,"finalized",{value:false});Dp.finalize=function(){if(!this.finalized){var allFields=this.allFields;var allSupertypes=this.allSupertypes;this.baseNames.forEach(function(name){var def=defCache[name];def.finalize();extend(allFields,def.allFields);extend(allSupertypes,def.allSupertypes)});extend(allFields,this.ownFields);allSupertypes[this.typeName]=this;this.fieldNames.length=0;for(var fieldName in allFields){if(hasOwn.call(allFields,fieldName)&&!allFields[fieldName].hidden){this.fieldNames.push(fieldName)}}Object.defineProperty(namedTypes,this.typeName,{enumerable:true,value:this.type});Object.defineProperty(this,"finalized",{value:true});populateSupertypeList(this.typeName,this.supertypeList)}};function populateSupertypeList(typeName,list){list.length=0;list.push(typeName);var lastSeen=Object.create(null);for(var pos=0;pos<list.length;++pos){typeName=list[pos];var d=defCache[typeName];assert.strictEqual(d.finalized,true);if(hasOwn.call(lastSeen,typeName)){delete list[lastSeen[typeName]]}lastSeen[typeName]=pos;list.push.apply(list,d.baseNames)}for(var to=0,from=to,len=list.length;from<len;++from){if(hasOwn.call(list,from)){list[to++]=list[from]}}list.length=to}function extend(into,from){Object.keys(from).forEach(function(name){into[name]=from[name]});return into}exports.finalize=function(){Object.keys(defCache).forEach(function(name){defCache[name].finalize()})}},{assert:121}],119:[function(require,module,exports){var types=require("./lib/types");require("./def/core");require("./def/es6");require("./def/es7");require("./def/mozilla");require("./def/e4x");require("./def/fb-harmony");types.finalize();exports.Type=types.Type;exports.builtInTypes=types.builtInTypes;exports.namedTypes=types.namedTypes;exports.builders=types.builders;exports.defineMethod=types.defineMethod;exports.getFieldNames=types.getFieldNames;exports.getFieldValue=types.getFieldValue;exports.eachField=types.eachField;exports.someField=types.someField;exports.getSupertypeNames=types.getSupertypeNames;exports.astNodesAreEquivalent=require("./lib/equiv");exports.finalize=types.finalize;exports.NodePath=require("./lib/node-path");exports.PathVisitor=require("./lib/path-visitor");exports.visit=exports.PathVisitor.visit},{"./def/core":106,"./def/e4x":107,"./def/es6":108,"./def/es7":109,"./def/fb-harmony":110,"./def/mozilla":111,"./lib/equiv":112,"./lib/node-path":113,"./lib/path-visitor":114,"./lib/types":118}],120:[function(require,module,exports){},{}],121:[function(require,module,exports){var util=require("util/");var pSlice=Array.prototype.slice;var hasOwn=Object.prototype.hasOwnProperty;var assert=module.exports=ok;assert.AssertionError=function AssertionError(options){this.name="AssertionError";this.actual=options.actual;this.expected=options.expected;this.operator=options.operator;if(options.message){this.message=options.message;this.generatedMessage=false}else{this.message=getMessage(this);this.generatedMessage=true}var stackStartFunction=options.stackStartFunction||fail;if(Error.captureStackTrace){Error.captureStackTrace(this,stackStartFunction)}else{var err=new Error;if(err.stack){var out=err.stack;var fn_name=stackStartFunction.name;var idx=out.indexOf("\n"+fn_name);if(idx>=0){var next_line=out.indexOf("\n",idx+1);out=out.substring(next_line+1)}this.stack=out}}};util.inherits(assert.AssertionError,Error);function replacer(key,value){if(util.isUndefined(value)){return""+value}if(util.isNumber(value)&&!isFinite(value)){return value.toString()}if(util.isFunction(value)||util.isRegExp(value)){return value.toString()}return value}function truncate(s,n){if(util.isString(s)){return s.length<n?s:s.slice(0,n)}else{return s}}function getMessage(self){return truncate(JSON.stringify(self.actual,replacer),128)+" "+self.operator+" "+truncate(JSON.stringify(self.expected,replacer),128)}function fail(actual,expected,message,operator,stackStartFunction){throw new assert.AssertionError({message:message,actual:actual,expected:expected,operator:operator,stackStartFunction:stackStartFunction})}assert.fail=fail;function ok(value,message){if(!value)fail(value,true,message,"==",assert.ok)}assert.ok=ok;assert.equal=function equal(actual,expected,message){if(actual!=expected)fail(actual,expected,message,"==",assert.equal)};assert.notEqual=function notEqual(actual,expected,message){if(actual==expected){fail(actual,expected,message,"!=",assert.notEqual)}};assert.deepEqual=function deepEqual(actual,expected,message){if(!_deepEqual(actual,expected)){fail(actual,expected,message,"deepEqual",assert.deepEqual)}};function _deepEqual(actual,expected){if(actual===expected){return true}else if(util.isBuffer(actual)&&util.isBuffer(expected)){if(actual.length!=expected.length)return false;for(var i=0;i<actual.length;i++){if(actual[i]!==expected[i])return false}return true}else if(util.isDate(actual)&&util.isDate(expected)){return actual.getTime()===expected.getTime()}else if(util.isRegExp(actual)&&util.isRegExp(expected)){return actual.source===expected.source&&actual.global===expected.global&&actual.multiline===expected.multiline&&actual.lastIndex===expected.lastIndex&&actual.ignoreCase===expected.ignoreCase}else if(!util.isObject(actual)&&!util.isObject(expected)){return actual==expected}else{return objEquiv(actual,expected)}}function isArguments(object){return Object.prototype.toString.call(object)=="[object Arguments]"}function objEquiv(a,b){if(util.isNullOrUndefined(a)||util.isNullOrUndefined(b))return false;if(a.prototype!==b.prototype)return false;if(util.isPrimitive(a)||util.isPrimitive(b)){return a===b}var aIsArgs=isArguments(a),bIsArgs=isArguments(b);if(aIsArgs&&!bIsArgs||!aIsArgs&&bIsArgs)return false;if(aIsArgs){a=pSlice.call(a);b=pSlice.call(b);return _deepEqual(a,b)}var ka=objectKeys(a),kb=objectKeys(b),key,i;if(ka.length!=kb.length)return false;ka.sort();kb.sort();for(i=ka.length-1;i>=0;i--){if(ka[i]!=kb[i])return false}for(i=ka.length-1;i>=0;i--){key=ka[i];if(!_deepEqual(a[key],b[key]))return false}return true}assert.notDeepEqual=function notDeepEqual(actual,expected,message){if(_deepEqual(actual,expected)){fail(actual,expected,message,"notDeepEqual",assert.notDeepEqual)}};assert.strictEqual=function strictEqual(actual,expected,message){if(actual!==expected){fail(actual,expected,message,"===",assert.strictEqual)}};assert.notStrictEqual=function notStrictEqual(actual,expected,message){if(actual===expected){fail(actual,expected,message,"!==",assert.notStrictEqual)}};function expectedException(actual,expected){if(!actual||!expected){return false}if(Object.prototype.toString.call(expected)=="[object RegExp]"){return expected.test(actual)}else if(actual instanceof expected){return true}else if(expected.call({},actual)===true){return true}return false}function _throws(shouldThrow,block,expected,message){var actual;if(util.isString(expected)){message=expected;expected=null}try{block()}catch(e){actual=e}message=(expected&&expected.name?" ("+expected.name+").":".")+(message?" "+message:".");if(shouldThrow&&!actual){fail(actual,expected,"Missing expected exception"+message)}if(!shouldThrow&&expectedException(actual,expected)){fail(actual,expected,"Got unwanted exception"+message)}if(shouldThrow&&actual&&expected&&!expectedException(actual,expected)||!shouldThrow&&actual){throw actual}}assert.throws=function(block,error,message){_throws.apply(this,[true].concat(pSlice.call(arguments)))};assert.doesNotThrow=function(block,message){_throws.apply(this,[false].concat(pSlice.call(arguments)))};assert.ifError=function(err){if(err){throw err}};var objectKeys=Object.keys||function(obj){var keys=[];for(var key in obj){if(hasOwn.call(obj,key))keys.push(key)}return keys}},{"util/":145}],122:[function(require,module,exports){var base64=require("base64-js");var ieee754=require("ieee754");var isArray=require("is-array");exports.Buffer=Buffer;exports.SlowBuffer=SlowBuffer;exports.INSPECT_MAX_BYTES=50;Buffer.poolSize=8192;var kMaxLength=1073741823;var rootParent={};Buffer.TYPED_ARRAY_SUPPORT=function(){try{var buf=new ArrayBuffer(0);var arr=new Uint8Array(buf);arr.foo=function(){return 42};return 42===arr.foo()&&typeof arr.subarray==="function"&&new Uint8Array(1).subarray(1,1).byteLength===0}catch(e){return false}}();function Buffer(subject,encoding,noZero){if(!(this instanceof Buffer))return new Buffer(subject,encoding,noZero);var type=typeof subject;var length;if(type==="number")length=subject>0?subject>>>0:0;else if(type==="string"){length=Buffer.byteLength(subject,encoding)}else if(type==="object"&&subject!==null){if(subject.type==="Buffer"&&isArray(subject.data))subject=subject.data;length=+subject.length>0?Math.floor(+subject.length):0}else throw new TypeError("must start with number, buffer, array or string");if(length>kMaxLength)throw new RangeError("Attempt to allocate Buffer larger than maximum "+"size: 0x"+kMaxLength.toString(16)+" bytes");var buf;if(Buffer.TYPED_ARRAY_SUPPORT){buf=Buffer._augment(new Uint8Array(length))}else{buf=this;buf.length=length;buf._isBuffer=true}var i;if(Buffer.TYPED_ARRAY_SUPPORT&&typeof subject.byteLength==="number"){buf._set(subject)}else if(isArrayish(subject)){if(Buffer.isBuffer(subject)){for(i=0;i<length;i++)buf[i]=subject.readUInt8(i)}else{for(i=0;i<length;i++)buf[i]=(subject[i]%256+256)%256}}else if(type==="string"){buf.write(subject,0,encoding)}else if(type==="number"&&!Buffer.TYPED_ARRAY_SUPPORT&&!noZero){for(i=0;i<length;i++){buf[i]=0}}if(length>0&&length<=Buffer.poolSize)buf.parent=rootParent;return buf}function SlowBuffer(subject,encoding,noZero){if(!(this instanceof SlowBuffer))return new SlowBuffer(subject,encoding,noZero);var buf=new Buffer(subject,encoding,noZero);delete buf.parent;return buf}Buffer.isBuffer=function(b){return!!(b!=null&&b._isBuffer)};Buffer.compare=function(a,b){if(!Buffer.isBuffer(a)||!Buffer.isBuffer(b))throw new TypeError("Arguments must be Buffers");var x=a.length;var y=b.length;for(var i=0,len=Math.min(x,y);i<len&&a[i]===b[i];i++){}if(i!==len){x=a[i];y=b[i]}if(x<y)return-1;if(y<x)return 1;return 0};Buffer.isEncoding=function(encoding){switch(String(encoding).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return true;default:return false}};Buffer.concat=function(list,totalLength){if(!isArray(list))throw new TypeError("Usage: Buffer.concat(list[, length])");if(list.length===0){return new Buffer(0)}else if(list.length===1){return list[0]}var i;if(totalLength===undefined){totalLength=0;for(i=0;i<list.length;i++){totalLength+=list[i].length}}var buf=new Buffer(totalLength);var pos=0;for(i=0;i<list.length;i++){var item=list[i];item.copy(buf,pos);pos+=item.length}return buf};Buffer.byteLength=function(str,encoding){var ret;str=str+"";switch(encoding||"utf8"){case"ascii":case"binary":case"raw":ret=str.length;break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":ret=str.length*2;break;case"hex":ret=str.length>>>1;break;case"utf8":case"utf-8":ret=utf8ToBytes(str).length;break;case"base64":ret=base64ToBytes(str).length;break;default:ret=str.length}return ret};Buffer.prototype.length=undefined;Buffer.prototype.parent=undefined;Buffer.prototype.toString=function(encoding,start,end){var loweredCase=false;start=start>>>0;end=end===undefined||end===Infinity?this.length:end>>>0;if(!encoding)encoding="utf8";if(start<0)start=0;if(end>this.length)end=this.length;if(end<=start)return"";while(true){switch(encoding){case"hex":return hexSlice(this,start,end);case"utf8":case"utf-8":return utf8Slice(this,start,end);case"ascii":return asciiSlice(this,start,end);case"binary":return binarySlice(this,start,end);case"base64":return base64Slice(this,start,end);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return utf16leSlice(this,start,end);default:if(loweredCase)throw new TypeError("Unknown encoding: "+encoding);encoding=(encoding+"").toLowerCase();loweredCase=true}}};Buffer.prototype.equals=function(b){if(!Buffer.isBuffer(b))throw new TypeError("Argument must be a Buffer");return Buffer.compare(this,b)===0};Buffer.prototype.inspect=function(){var str="";var max=exports.INSPECT_MAX_BYTES;if(this.length>0){str=this.toString("hex",0,max).match(/.{2}/g).join(" ");if(this.length>max)str+=" ... "}return"<Buffer "+str+">"};Buffer.prototype.compare=function(b){if(!Buffer.isBuffer(b))throw new TypeError("Argument must be a Buffer");return Buffer.compare(this,b)};Buffer.prototype.get=function(offset){console.log(".get() is deprecated. Access using array indexes instead.");return this.readUInt8(offset)};Buffer.prototype.set=function(v,offset){console.log(".set() is deprecated. Access using array indexes instead.");return this.writeUInt8(v,offset)};function hexWrite(buf,string,offset,length){offset=Number(offset)||0;var remaining=buf.length-offset;if(!length){length=remaining}else{length=Number(length);if(length>remaining){length=remaining}}var strLen=string.length;if(strLen%2!==0)throw new Error("Invalid hex string");if(length>strLen/2){length=strLen/2}for(var i=0;i<length;i++){var byte=parseInt(string.substr(i*2,2),16);if(isNaN(byte))throw new Error("Invalid hex string");buf[offset+i]=byte}return i}function utf8Write(buf,string,offset,length){var charsWritten=blitBuffer(utf8ToBytes(string,buf.length-offset),buf,offset,length);return charsWritten}function asciiWrite(buf,string,offset,length){var charsWritten=blitBuffer(asciiToBytes(string),buf,offset,length);return charsWritten}function binaryWrite(buf,string,offset,length){return asciiWrite(buf,string,offset,length)}function base64Write(buf,string,offset,length){var charsWritten=blitBuffer(base64ToBytes(string),buf,offset,length);return charsWritten}function utf16leWrite(buf,string,offset,length){var charsWritten=blitBuffer(utf16leToBytes(string,buf.length-offset),buf,offset,length,2);return charsWritten}Buffer.prototype.write=function(string,offset,length,encoding){if(isFinite(offset)){if(!isFinite(length)){encoding=length;length=undefined}}else{var swap=encoding;encoding=offset;offset=length;length=swap}offset=Number(offset)||0;if(length<0||offset<0||offset>this.length)throw new RangeError("attempt to write outside buffer bounds");var remaining=this.length-offset;if(!length){length=remaining}else{length=Number(length);if(length>remaining){length=remaining}}encoding=String(encoding||"utf8").toLowerCase();var ret;switch(encoding){case"hex":ret=hexWrite(this,string,offset,length);break;case"utf8":case"utf-8":ret=utf8Write(this,string,offset,length);break;case"ascii":ret=asciiWrite(this,string,offset,length);break;case"binary":ret=binaryWrite(this,string,offset,length);break;case"base64":ret=base64Write(this,string,offset,length);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":ret=utf16leWrite(this,string,offset,length);break;default:throw new TypeError("Unknown encoding: "+encoding)}return ret};Buffer.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function base64Slice(buf,start,end){if(start===0&&end===buf.length){return base64.fromByteArray(buf)}else{return base64.fromByteArray(buf.slice(start,end))}}function utf8Slice(buf,start,end){var res="";var tmp="";end=Math.min(buf.length,end);for(var i=start;i<end;i++){if(buf[i]<=127){res+=decodeUtf8Char(tmp)+String.fromCharCode(buf[i]);tmp=""}else{tmp+="%"+buf[i].toString(16)}}return res+decodeUtf8Char(tmp)}function asciiSlice(buf,start,end){var ret="";end=Math.min(buf.length,end);for(var i=start;i<end;i++){ret+=String.fromCharCode(buf[i]&127)}return ret}function binarySlice(buf,start,end){var ret="";end=Math.min(buf.length,end);for(var i=start;i<end;i++){ret+=String.fromCharCode(buf[i])}return ret}function hexSlice(buf,start,end){var len=buf.length;if(!start||start<0)start=0;if(!end||end<0||end>len)end=len;var out="";for(var i=start;i<end;i++){out+=toHex(buf[i])}return out}function utf16leSlice(buf,start,end){var bytes=buf.slice(start,end);var res="";for(var i=0;i<bytes.length;i+=2){res+=String.fromCharCode(bytes[i]+bytes[i+1]*256)}return res}Buffer.prototype.slice=function(start,end){var len=this.length;start=~~start;end=end===undefined?len:~~end;if(start<0){start+=len;if(start<0)start=0}else if(start>len){start=len}if(end<0){end+=len;if(end<0)end=0}else if(end>len){end=len}if(end<start)end=start;var newBuf;if(Buffer.TYPED_ARRAY_SUPPORT){newBuf=Buffer._augment(this.subarray(start,end))}else{var sliceLen=end-start;newBuf=new Buffer(sliceLen,undefined,true);for(var i=0;i<sliceLen;i++){newBuf[i]=this[i+start]}}if(newBuf.length)newBuf.parent=this.parent||this;return newBuf};function checkOffset(offset,ext,length){if(offset%1!==0||offset<0)throw new RangeError("offset is not uint");if(offset+ext>length)throw new RangeError("Trying to access beyond buffer length")}Buffer.prototype.readUIntLE=function(offset,byteLength,noAssert){offset=offset>>>0;byteLength=byteLength>>>0;if(!noAssert)checkOffset(offset,byteLength,this.length);var val=this[offset];var mul=1;var i=0;while(++i<byteLength&&(mul*=256))val+=this[offset+i]*mul;return val};Buffer.prototype.readUIntBE=function(offset,byteLength,noAssert){offset=offset>>>0;byteLength=byteLength>>>0;if(!noAssert)checkOffset(offset,byteLength,this.length);var val=this[offset+--byteLength];var mul=1;while(byteLength>0&&(mul*=256))val+=this[offset+--byteLength]*mul;return val};Buffer.prototype.readUInt8=function(offset,noAssert){if(!noAssert)checkOffset(offset,1,this.length);return this[offset]};Buffer.prototype.readUInt16LE=function(offset,noAssert){if(!noAssert)checkOffset(offset,2,this.length);return this[offset]|this[offset+1]<<8};Buffer.prototype.readUInt16BE=function(offset,noAssert){if(!noAssert)checkOffset(offset,2,this.length);return this[offset]<<8|this[offset+1]};Buffer.prototype.readUInt32LE=function(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return(this[offset]|this[offset+1]<<8|this[offset+2]<<16)+this[offset+3]*16777216};Buffer.prototype.readUInt32BE=function(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return this[offset]*16777216+(this[offset+1]<<16|this[offset+2]<<8|this[offset+3])};Buffer.prototype.readIntLE=function(offset,byteLength,noAssert){offset=offset>>>0;byteLength=byteLength>>>0;if(!noAssert)checkOffset(offset,byteLength,this.length);var val=this[offset];var mul=1;var i=0;while(++i<byteLength&&(mul*=256))val+=this[offset+i]*mul;mul*=128;if(val>=mul)val-=Math.pow(2,8*byteLength);return val};Buffer.prototype.readIntBE=function(offset,byteLength,noAssert){offset=offset>>>0;byteLength=byteLength>>>0;if(!noAssert)checkOffset(offset,byteLength,this.length);var i=byteLength;var mul=1;var val=this[offset+--i];while(i>0&&(mul*=256))val+=this[offset+--i]*mul;mul*=128;if(val>=mul)val-=Math.pow(2,8*byteLength);return val};Buffer.prototype.readInt8=function(offset,noAssert){if(!noAssert)checkOffset(offset,1,this.length);if(!(this[offset]&128))return this[offset];return(255-this[offset]+1)*-1};Buffer.prototype.readInt16LE=function(offset,noAssert){if(!noAssert)checkOffset(offset,2,this.length);var val=this[offset]|this[offset+1]<<8;return val&32768?val|4294901760:val};Buffer.prototype.readInt16BE=function(offset,noAssert){if(!noAssert)checkOffset(offset,2,this.length);var val=this[offset+1]|this[offset]<<8;return val&32768?val|4294901760:val};Buffer.prototype.readInt32LE=function(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return this[offset]|this[offset+1]<<8|this[offset+2]<<16|this[offset+3]<<24};Buffer.prototype.readInt32BE=function(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return this[offset]<<24|this[offset+1]<<16|this[offset+2]<<8|this[offset+3]};Buffer.prototype.readFloatLE=function(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return ieee754.read(this,offset,true,23,4)};Buffer.prototype.readFloatBE=function(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return ieee754.read(this,offset,false,23,4)};Buffer.prototype.readDoubleLE=function(offset,noAssert){if(!noAssert)checkOffset(offset,8,this.length);return ieee754.read(this,offset,true,52,8)};Buffer.prototype.readDoubleBE=function(offset,noAssert){if(!noAssert)checkOffset(offset,8,this.length);return ieee754.read(this,offset,false,52,8)};function checkInt(buf,value,offset,ext,max,min){if(!Buffer.isBuffer(buf))throw new TypeError("buffer must be a Buffer instance");if(value>max||value<min)throw new RangeError("value is out of bounds");if(offset+ext>buf.length)throw new RangeError("index out of range")}Buffer.prototype.writeUIntLE=function(value,offset,byteLength,noAssert){value=+value;offset=offset>>>0;byteLength=byteLength>>>0;if(!noAssert)checkInt(this,value,offset,byteLength,Math.pow(2,8*byteLength),0);var mul=1;var i=0;this[offset]=value&255;while(++i<byteLength&&(mul*=256))this[offset+i]=value/mul>>>0&255;return offset+byteLength};Buffer.prototype.writeUIntBE=function(value,offset,byteLength,noAssert){value=+value;offset=offset>>>0;byteLength=byteLength>>>0;if(!noAssert)checkInt(this,value,offset,byteLength,Math.pow(2,8*byteLength),0);var i=byteLength-1;var mul=1;this[offset+i]=value&255;while(--i>=0&&(mul*=256))this[offset+i]=value/mul>>>0&255;return offset+byteLength};Buffer.prototype.writeUInt8=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,1,255,0);if(!Buffer.TYPED_ARRAY_SUPPORT)value=Math.floor(value);this[offset]=value;return offset+1};function objectWriteUInt16(buf,value,offset,littleEndian){if(value<0)value=65535+value+1;for(var i=0,j=Math.min(buf.length-offset,2);i<j;i++){buf[offset+i]=(value&255<<8*(littleEndian?i:1-i))>>>(littleEndian?i:1-i)*8}}Buffer.prototype.writeUInt16LE=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,2,65535,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value;this[offset+1]=value>>>8}else objectWriteUInt16(this,value,offset,true);return offset+2};Buffer.prototype.writeUInt16BE=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,2,65535,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value>>>8;this[offset+1]=value}else objectWriteUInt16(this,value,offset,false);return offset+2};function objectWriteUInt32(buf,value,offset,littleEndian){if(value<0)value=4294967295+value+1;for(var i=0,j=Math.min(buf.length-offset,4);i<j;i++){buf[offset+i]=value>>>(littleEndian?i:3-i)*8&255}}Buffer.prototype.writeUInt32LE=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,4,4294967295,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset+3]=value>>>24;this[offset+2]=value>>>16;this[offset+1]=value>>>8;this[offset]=value}else objectWriteUInt32(this,value,offset,true);return offset+4};Buffer.prototype.writeUInt32BE=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,4,4294967295,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value>>>24;this[offset+1]=value>>>16;this[offset+2]=value>>>8;this[offset+3]=value}else objectWriteUInt32(this,value,offset,false);return offset+4};Buffer.prototype.writeIntLE=function(value,offset,byteLength,noAssert){value=+value;offset=offset>>>0;if(!noAssert){checkInt(this,value,offset,byteLength,Math.pow(2,8*byteLength-1)-1,-Math.pow(2,8*byteLength-1))}var i=0;var mul=1;var sub=value<0?1:0;this[offset]=value&255;while(++i<byteLength&&(mul*=256))this[offset+i]=(value/mul>>0)-sub&255;return offset+byteLength};Buffer.prototype.writeIntBE=function(value,offset,byteLength,noAssert){value=+value;offset=offset>>>0;if(!noAssert){checkInt(this,value,offset,byteLength,Math.pow(2,8*byteLength-1)-1,-Math.pow(2,8*byteLength-1))}var i=byteLength-1;var mul=1;var sub=value<0?1:0;this[offset+i]=value&255;while(--i>=0&&(mul*=256))this[offset+i]=(value/mul>>0)-sub&255;return offset+byteLength};Buffer.prototype.writeInt8=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,1,127,-128);if(!Buffer.TYPED_ARRAY_SUPPORT)value=Math.floor(value);if(value<0)value=255+value+1;this[offset]=value;return offset+1};Buffer.prototype.writeInt16LE=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,2,32767,-32768);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value;this[offset+1]=value>>>8}else objectWriteUInt16(this,value,offset,true);return offset+2};Buffer.prototype.writeInt16BE=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,2,32767,-32768);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value>>>8;this[offset+1]=value}else objectWriteUInt16(this,value,offset,false);return offset+2};Buffer.prototype.writeInt32LE=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,4,2147483647,-2147483648);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value;this[offset+1]=value>>>8;this[offset+2]=value>>>16;this[offset+3]=value>>>24}else objectWriteUInt32(this,value,offset,true);return offset+4};Buffer.prototype.writeInt32BE=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,4,2147483647,-2147483648);if(value<0)value=4294967295+value+1;if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value>>>24;this[offset+1]=value>>>16;this[offset+2]=value>>>8;this[offset+3]=value}else objectWriteUInt32(this,value,offset,false);return offset+4};function checkIEEE754(buf,value,offset,ext,max,min){if(value>max||value<min)throw new RangeError("value is out of bounds");if(offset+ext>buf.length)throw new RangeError("index out of range");if(offset<0)throw new RangeError("index out of range")}function writeFloat(buf,value,offset,littleEndian,noAssert){if(!noAssert)checkIEEE754(buf,value,offset,4,3.4028234663852886e38,-3.4028234663852886e38);ieee754.write(buf,value,offset,littleEndian,23,4);return offset+4}Buffer.prototype.writeFloatLE=function(value,offset,noAssert){return writeFloat(this,value,offset,true,noAssert)};Buffer.prototype.writeFloatBE=function(value,offset,noAssert){return writeFloat(this,value,offset,false,noAssert)};function writeDouble(buf,value,offset,littleEndian,noAssert){if(!noAssert)checkIEEE754(buf,value,offset,8,1.7976931348623157e308,-1.7976931348623157e308);ieee754.write(buf,value,offset,littleEndian,52,8);return offset+8}Buffer.prototype.writeDoubleLE=function(value,offset,noAssert){return writeDouble(this,value,offset,true,noAssert)};Buffer.prototype.writeDoubleBE=function(value,offset,noAssert){return writeDouble(this,value,offset,false,noAssert)};Buffer.prototype.copy=function(target,target_start,start,end){var source=this;if(!start)start=0;if(!end&&end!==0)end=this.length;if(target_start>=target.length)target_start=target.length;if(!target_start)target_start=0;if(end>0&&end<start)end=start;if(end===start)return 0;if(target.length===0||source.length===0)return 0;if(target_start<0)throw new RangeError("targetStart out of bounds");if(start<0||start>=source.length)throw new RangeError("sourceStart out of bounds");if(end<0)throw new RangeError("sourceEnd out of bounds");if(end>this.length)end=this.length;if(target.length-target_start<end-start)end=target.length-target_start+start;var len=end-start;if(len<1e3||!Buffer.TYPED_ARRAY_SUPPORT){for(var i=0;i<len;i++){target[i+target_start]=this[i+start]}}else{target._set(this.subarray(start,start+len),target_start)}return len};Buffer.prototype.fill=function(value,start,end){if(!value)value=0;if(!start)start=0;if(!end)end=this.length;if(end<start)throw new RangeError("end < start");if(end===start)return;if(this.length===0)return;if(start<0||start>=this.length)throw new RangeError("start out of bounds");if(end<0||end>this.length)throw new RangeError("end out of bounds");var i;if(typeof value==="number"){for(i=start;i<end;i++){this[i]=value}}else{var bytes=utf8ToBytes(value.toString());var len=bytes.length;for(i=start;i<end;i++){this[i]=bytes[i%len]}}return this};Buffer.prototype.toArrayBuffer=function(){if(typeof Uint8Array!=="undefined"){if(Buffer.TYPED_ARRAY_SUPPORT){return new Buffer(this).buffer}else{var buf=new Uint8Array(this.length);for(var i=0,len=buf.length;i<len;i+=1){buf[i]=this[i]}return buf.buffer}}else{throw new TypeError("Buffer.toArrayBuffer not supported in this browser")}};var BP=Buffer.prototype;Buffer._augment=function(arr){arr.constructor=Buffer;arr._isBuffer=true;arr._get=arr.get;arr._set=arr.set;arr.get=BP.get;arr.set=BP.set;arr.write=BP.write;arr.toString=BP.toString;arr.toLocaleString=BP.toString;arr.toJSON=BP.toJSON;arr.equals=BP.equals;arr.compare=BP.compare;arr.copy=BP.copy;arr.slice=BP.slice;arr.readUIntLE=BP.readUIntLE;arr.readUIntBE=BP.readUIntBE;arr.readUInt8=BP.readUInt8;arr.readUInt16LE=BP.readUInt16LE;arr.readUInt16BE=BP.readUInt16BE;arr.readUInt32LE=BP.readUInt32LE;arr.readUInt32BE=BP.readUInt32BE;arr.readIntLE=BP.readIntLE;arr.readIntBE=BP.readIntBE;arr.readInt8=BP.readInt8;arr.readInt16LE=BP.readInt16LE;arr.readInt16BE=BP.readInt16BE;arr.readInt32LE=BP.readInt32LE;arr.readInt32BE=BP.readInt32BE;arr.readFloatLE=BP.readFloatLE;arr.readFloatBE=BP.readFloatBE;arr.readDoubleLE=BP.readDoubleLE;arr.readDoubleBE=BP.readDoubleBE;arr.writeUInt8=BP.writeUInt8;arr.writeUIntLE=BP.writeUIntLE;arr.writeUIntBE=BP.writeUIntBE;arr.writeUInt16LE=BP.writeUInt16LE;arr.writeUInt16BE=BP.writeUInt16BE;arr.writeUInt32LE=BP.writeUInt32LE;arr.writeUInt32BE=BP.writeUInt32BE;arr.writeIntLE=BP.writeIntLE;arr.writeIntBE=BP.writeIntBE;arr.writeInt8=BP.writeInt8;arr.writeInt16LE=BP.writeInt16LE;
arr.writeInt16BE=BP.writeInt16BE;arr.writeInt32LE=BP.writeInt32LE;arr.writeInt32BE=BP.writeInt32BE;arr.writeFloatLE=BP.writeFloatLE;arr.writeFloatBE=BP.writeFloatBE;arr.writeDoubleLE=BP.writeDoubleLE;arr.writeDoubleBE=BP.writeDoubleBE;arr.fill=BP.fill;arr.inspect=BP.inspect;arr.toArrayBuffer=BP.toArrayBuffer;return arr};var INVALID_BASE64_RE=/[^+\/0-9A-z\-]/g;function base64clean(str){str=stringtrim(str).replace(INVALID_BASE64_RE,"");if(str.length<2)return"";while(str.length%4!==0){str=str+"="}return str}function stringtrim(str){if(str.trim)return str.trim();return str.replace(/^\s+|\s+$/g,"")}function isArrayish(subject){return isArray(subject)||Buffer.isBuffer(subject)||subject&&typeof subject==="object"&&typeof subject.length==="number"}function toHex(n){if(n<16)return"0"+n.toString(16);return n.toString(16)}function utf8ToBytes(string,units){var codePoint,length=string.length;var leadSurrogate=null;units=units||Infinity;var bytes=[];var i=0;for(;i<length;i++){codePoint=string.charCodeAt(i);if(codePoint>55295&&codePoint<57344){if(leadSurrogate){if(codePoint<56320){if((units-=3)>-1)bytes.push(239,191,189);leadSurrogate=codePoint;continue}else{codePoint=leadSurrogate-55296<<10|codePoint-56320|65536;leadSurrogate=null}}else{if(codePoint>56319){if((units-=3)>-1)bytes.push(239,191,189);continue}else if(i+1===length){if((units-=3)>-1)bytes.push(239,191,189);continue}else{leadSurrogate=codePoint;continue}}}else if(leadSurrogate){if((units-=3)>-1)bytes.push(239,191,189);leadSurrogate=null}if(codePoint<128){if((units-=1)<0)break;bytes.push(codePoint)}else if(codePoint<2048){if((units-=2)<0)break;bytes.push(codePoint>>6|192,codePoint&63|128)}else if(codePoint<65536){if((units-=3)<0)break;bytes.push(codePoint>>12|224,codePoint>>6&63|128,codePoint&63|128)}else if(codePoint<2097152){if((units-=4)<0)break;bytes.push(codePoint>>18|240,codePoint>>12&63|128,codePoint>>6&63|128,codePoint&63|128)}else{throw new Error("Invalid code point")}}return bytes}function asciiToBytes(str){var byteArray=[];for(var i=0;i<str.length;i++){byteArray.push(str.charCodeAt(i)&255)}return byteArray}function utf16leToBytes(str,units){var c,hi,lo;var byteArray=[];for(var i=0;i<str.length;i++){if((units-=2)<0)break;c=str.charCodeAt(i);hi=c>>8;lo=c%256;byteArray.push(lo);byteArray.push(hi)}return byteArray}function base64ToBytes(str){return base64.toByteArray(base64clean(str))}function blitBuffer(src,dst,offset,length,unitSize){if(unitSize)length-=length%unitSize;for(var i=0;i<length;i++){if(i+offset>=dst.length||i>=src.length)break;dst[i+offset]=src[i]}return i}function decodeUtf8Char(str){try{return decodeURIComponent(str)}catch(err){return String.fromCharCode(65533)}}},{"base64-js":123,ieee754:124,"is-array":125}],123:[function(require,module,exports){var lookup="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";(function(exports){"use strict";var Arr=typeof Uint8Array!=="undefined"?Uint8Array:Array;var PLUS="+".charCodeAt(0);var SLASH="/".charCodeAt(0);var NUMBER="0".charCodeAt(0);var LOWER="a".charCodeAt(0);var UPPER="A".charCodeAt(0);var PLUS_URL_SAFE="-".charCodeAt(0);var SLASH_URL_SAFE="_".charCodeAt(0);function decode(elt){var code=elt.charCodeAt(0);if(code===PLUS||code===PLUS_URL_SAFE)return 62;if(code===SLASH||code===SLASH_URL_SAFE)return 63;if(code<NUMBER)return-1;if(code<NUMBER+10)return code-NUMBER+26+26;if(code<UPPER+26)return code-UPPER;if(code<LOWER+26)return code-LOWER+26}function b64ToByteArray(b64){var i,j,l,tmp,placeHolders,arr;if(b64.length%4>0){throw new Error("Invalid string. Length must be a multiple of 4")}var len=b64.length;placeHolders="="===b64.charAt(len-2)?2:"="===b64.charAt(len-1)?1:0;arr=new Arr(b64.length*3/4-placeHolders);l=placeHolders>0?b64.length-4:b64.length;var L=0;function push(v){arr[L++]=v}for(i=0,j=0;i<l;i+=4,j+=3){tmp=decode(b64.charAt(i))<<18|decode(b64.charAt(i+1))<<12|decode(b64.charAt(i+2))<<6|decode(b64.charAt(i+3));push((tmp&16711680)>>16);push((tmp&65280)>>8);push(tmp&255)}if(placeHolders===2){tmp=decode(b64.charAt(i))<<2|decode(b64.charAt(i+1))>>4;push(tmp&255)}else if(placeHolders===1){tmp=decode(b64.charAt(i))<<10|decode(b64.charAt(i+1))<<4|decode(b64.charAt(i+2))>>2;push(tmp>>8&255);push(tmp&255)}return arr}function uint8ToBase64(uint8){var i,extraBytes=uint8.length%3,output="",temp,length;function encode(num){return lookup.charAt(num)}function tripletToBase64(num){return encode(num>>18&63)+encode(num>>12&63)+encode(num>>6&63)+encode(num&63)}for(i=0,length=uint8.length-extraBytes;i<length;i+=3){temp=(uint8[i]<<16)+(uint8[i+1]<<8)+uint8[i+2];output+=tripletToBase64(temp)}switch(extraBytes){case 1:temp=uint8[uint8.length-1];output+=encode(temp>>2);output+=encode(temp<<4&63);output+="==";break;case 2:temp=(uint8[uint8.length-2]<<8)+uint8[uint8.length-1];output+=encode(temp>>10);output+=encode(temp>>4&63);output+=encode(temp<<2&63);output+="=";break}return output}exports.toByteArray=b64ToByteArray;exports.fromByteArray=uint8ToBase64})(typeof exports==="undefined"?this.base64js={}:exports)},{}],124:[function(require,module,exports){exports.read=function(buffer,offset,isLE,mLen,nBytes){var e,m,eLen=nBytes*8-mLen-1,eMax=(1<<eLen)-1,eBias=eMax>>1,nBits=-7,i=isLE?nBytes-1:0,d=isLE?-1:1,s=buffer[offset+i];i+=d;e=s&(1<<-nBits)-1;s>>=-nBits;nBits+=eLen;for(;nBits>0;e=e*256+buffer[offset+i],i+=d,nBits-=8);m=e&(1<<-nBits)-1;e>>=-nBits;nBits+=mLen;for(;nBits>0;m=m*256+buffer[offset+i],i+=d,nBits-=8);if(e===0){e=1-eBias}else if(e===eMax){return m?NaN:(s?-1:1)*Infinity}else{m=m+Math.pow(2,mLen);e=e-eBias}return(s?-1:1)*m*Math.pow(2,e-mLen)};exports.write=function(buffer,value,offset,isLE,mLen,nBytes){var e,m,c,eLen=nBytes*8-mLen-1,eMax=(1<<eLen)-1,eBias=eMax>>1,rt=mLen===23?Math.pow(2,-24)-Math.pow(2,-77):0,i=isLE?0:nBytes-1,d=isLE?1:-1,s=value<0||value===0&&1/value<0?1:0;value=Math.abs(value);if(isNaN(value)||value===Infinity){m=isNaN(value)?1:0;e=eMax}else{e=Math.floor(Math.log(value)/Math.LN2);if(value*(c=Math.pow(2,-e))<1){e--;c*=2}if(e+eBias>=1){value+=rt/c}else{value+=rt*Math.pow(2,1-eBias)}if(value*c>=2){e++;c/=2}if(e+eBias>=eMax){m=0;e=eMax}else if(e+eBias>=1){m=(value*c-1)*Math.pow(2,mLen);e=e+eBias}else{m=value*Math.pow(2,eBias-1)*Math.pow(2,mLen);e=0}}for(;mLen>=8;buffer[offset+i]=m&255,i+=d,m/=256,mLen-=8);e=e<<mLen|m;eLen+=mLen;for(;eLen>0;buffer[offset+i]=e&255,i+=d,e/=256,eLen-=8);buffer[offset+i-d]|=s*128}},{}],125:[function(require,module,exports){var isArray=Array.isArray;var str=Object.prototype.toString;module.exports=isArray||function(val){return!!val&&"[object Array]"==str.call(val)}},{}],126:[function(require,module,exports){function EventEmitter(){this._events=this._events||{};this._maxListeners=this._maxListeners||undefined}module.exports=EventEmitter;EventEmitter.EventEmitter=EventEmitter;EventEmitter.prototype._events=undefined;EventEmitter.prototype._maxListeners=undefined;EventEmitter.defaultMaxListeners=10;EventEmitter.prototype.setMaxListeners=function(n){if(!isNumber(n)||n<0||isNaN(n))throw TypeError("n must be a positive number");this._maxListeners=n;return this};EventEmitter.prototype.emit=function(type){var er,handler,len,args,i,listeners;if(!this._events)this._events={};if(type==="error"){if(!this._events.error||isObject(this._events.error)&&!this._events.error.length){er=arguments[1];if(er instanceof Error){throw er}throw TypeError('Uncaught, unspecified "error" event.')}}handler=this._events[type];if(isUndefined(handler))return false;if(isFunction(handler)){switch(arguments.length){case 1:handler.call(this);break;case 2:handler.call(this,arguments[1]);break;case 3:handler.call(this,arguments[1],arguments[2]);break;default:len=arguments.length;args=new Array(len-1);for(i=1;i<len;i++)args[i-1]=arguments[i];handler.apply(this,args)}}else if(isObject(handler)){len=arguments.length;args=new Array(len-1);for(i=1;i<len;i++)args[i-1]=arguments[i];listeners=handler.slice();len=listeners.length;for(i=0;i<len;i++)listeners[i].apply(this,args)}return true};EventEmitter.prototype.addListener=function(type,listener){var m;if(!isFunction(listener))throw TypeError("listener must be a function");if(!this._events)this._events={};if(this._events.newListener)this.emit("newListener",type,isFunction(listener.listener)?listener.listener:listener);if(!this._events[type])this._events[type]=listener;else if(isObject(this._events[type]))this._events[type].push(listener);else this._events[type]=[this._events[type],listener];if(isObject(this._events[type])&&!this._events[type].warned){var m;if(!isUndefined(this._maxListeners)){m=this._maxListeners}else{m=EventEmitter.defaultMaxListeners}if(m&&m>0&&this._events[type].length>m){this._events[type].warned=true;console.error("(node) warning: possible EventEmitter memory "+"leak detected. %d listeners added. "+"Use emitter.setMaxListeners() to increase limit.",this._events[type].length);if(typeof console.trace==="function"){console.trace()}}}return this};EventEmitter.prototype.on=EventEmitter.prototype.addListener;EventEmitter.prototype.once=function(type,listener){if(!isFunction(listener))throw TypeError("listener must be a function");var fired=false;function g(){this.removeListener(type,g);if(!fired){fired=true;listener.apply(this,arguments)}}g.listener=listener;this.on(type,g);return this};EventEmitter.prototype.removeListener=function(type,listener){var list,position,length,i;if(!isFunction(listener))throw TypeError("listener must be a function");if(!this._events||!this._events[type])return this;list=this._events[type];length=list.length;position=-1;if(list===listener||isFunction(list.listener)&&list.listener===listener){delete this._events[type];if(this._events.removeListener)this.emit("removeListener",type,listener)}else if(isObject(list)){for(i=length;i-->0;){if(list[i]===listener||list[i].listener&&list[i].listener===listener){position=i;break}}if(position<0)return this;if(list.length===1){list.length=0;delete this._events[type]}else{list.splice(position,1)}if(this._events.removeListener)this.emit("removeListener",type,listener)}return this};EventEmitter.prototype.removeAllListeners=function(type){var key,listeners;if(!this._events)return this;if(!this._events.removeListener){if(arguments.length===0)this._events={};else if(this._events[type])delete this._events[type];return this}if(arguments.length===0){for(key in this._events){if(key==="removeListener")continue;this.removeAllListeners(key)}this.removeAllListeners("removeListener");this._events={};return this}listeners=this._events[type];if(isFunction(listeners)){this.removeListener(type,listeners)}else{while(listeners.length)this.removeListener(type,listeners[listeners.length-1])}delete this._events[type];return this};EventEmitter.prototype.listeners=function(type){var ret;if(!this._events||!this._events[type])ret=[];else if(isFunction(this._events[type]))ret=[this._events[type]];else ret=this._events[type].slice();return ret};EventEmitter.listenerCount=function(emitter,type){var ret;if(!emitter._events||!emitter._events[type])ret=0;else if(isFunction(emitter._events[type]))ret=1;else ret=emitter._events[type].length;return ret};function isFunction(arg){return typeof arg==="function"}function isNumber(arg){return typeof arg==="number"}function isObject(arg){return typeof arg==="object"&&arg!==null}function isUndefined(arg){return arg===void 0}},{}],127:[function(require,module,exports){if(typeof Object.create==="function"){module.exports=function inherits(ctor,superCtor){ctor.super_=superCtor;ctor.prototype=Object.create(superCtor.prototype,{constructor:{value:ctor,enumerable:false,writable:true,configurable:true}})}}else{module.exports=function inherits(ctor,superCtor){ctor.super_=superCtor;var TempCtor=function(){};TempCtor.prototype=superCtor.prototype;ctor.prototype=new TempCtor;ctor.prototype.constructor=ctor}}},{}],128:[function(require,module,exports){module.exports=Array.isArray||function(arr){return Object.prototype.toString.call(arr)=="[object Array]"}},{}],129:[function(require,module,exports){(function(process){function normalizeArray(parts,allowAboveRoot){var up=0;for(var i=parts.length-1;i>=0;i--){var last=parts[i];if(last==="."){parts.splice(i,1)}else if(last===".."){parts.splice(i,1);up++}else if(up){parts.splice(i,1);up--}}if(allowAboveRoot){for(;up--;up){parts.unshift("..")}}return parts}var splitPathRe=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;var splitPath=function(filename){return splitPathRe.exec(filename).slice(1)};exports.resolve=function(){var resolvedPath="",resolvedAbsolute=false;for(var i=arguments.length-1;i>=-1&&!resolvedAbsolute;i--){var path=i>=0?arguments[i]:process.cwd();if(typeof path!=="string"){throw new TypeError("Arguments to path.resolve must be strings")}else if(!path){continue}resolvedPath=path+"/"+resolvedPath;resolvedAbsolute=path.charAt(0)==="/"}resolvedPath=normalizeArray(filter(resolvedPath.split("/"),function(p){return!!p}),!resolvedAbsolute).join("/");return(resolvedAbsolute?"/":"")+resolvedPath||"."};exports.normalize=function(path){var isAbsolute=exports.isAbsolute(path),trailingSlash=substr(path,-1)==="/";path=normalizeArray(filter(path.split("/"),function(p){return!!p}),!isAbsolute).join("/");if(!path&&!isAbsolute){path="."}if(path&&trailingSlash){path+="/"}return(isAbsolute?"/":"")+path};exports.isAbsolute=function(path){return path.charAt(0)==="/"};exports.join=function(){var paths=Array.prototype.slice.call(arguments,0);return exports.normalize(filter(paths,function(p,index){if(typeof p!=="string"){throw new TypeError("Arguments to path.join must be strings")}return p}).join("/"))};exports.relative=function(from,to){from=exports.resolve(from).substr(1);to=exports.resolve(to).substr(1);function trim(arr){var start=0;for(;start<arr.length;start++){if(arr[start]!=="")break}var end=arr.length-1;for(;end>=0;end--){if(arr[end]!=="")break}if(start>end)return[];return arr.slice(start,end-start+1)}var fromParts=trim(from.split("/"));var toParts=trim(to.split("/"));var length=Math.min(fromParts.length,toParts.length);var samePartsLength=length;for(var i=0;i<length;i++){if(fromParts[i]!==toParts[i]){samePartsLength=i;break}}var outputParts=[];for(var i=samePartsLength;i<fromParts.length;i++){outputParts.push("..")}outputParts=outputParts.concat(toParts.slice(samePartsLength));return outputParts.join("/")};exports.sep="/";exports.delimiter=":";exports.dirname=function(path){var result=splitPath(path),root=result[0],dir=result[1];if(!root&&!dir){return"."}if(dir){dir=dir.substr(0,dir.length-1)}return root+dir};exports.basename=function(path,ext){var f=splitPath(path)[2];if(ext&&f.substr(-1*ext.length)===ext){f=f.substr(0,f.length-ext.length)}return f};exports.extname=function(path){return splitPath(path)[3]};function filter(xs,f){if(xs.filter)return xs.filter(f);var res=[];for(var i=0;i<xs.length;i++){if(f(xs[i],i,xs))res.push(xs[i])}return res}var substr="ab".substr(-1)==="b"?function(str,start,len){return str.substr(start,len)}:function(str,start,len){if(start<0)start=str.length+start;return str.substr(start,len)}}).call(this,require("_process"))},{_process:130}],130:[function(require,module,exports){var process=module.exports={};var queue=[];var draining=false;function drainQueue(){if(draining){return}draining=true;var currentQueue;var len=queue.length;while(len){currentQueue=queue;queue=[];var i=-1;while(++i<len){currentQueue[i]()}len=queue.length}draining=false}process.nextTick=function(fun){queue.push(fun);if(!draining){setTimeout(drainQueue,0)}};process.title="browser";process.browser=true;process.env={};process.argv=[];process.version="";function noop(){}process.on=noop;process.addListener=noop;process.once=noop;process.off=noop;process.removeListener=noop;process.removeAllListeners=noop;process.emit=noop;process.binding=function(name){throw new Error("process.binding is not supported")};process.cwd=function(){return"/"};process.chdir=function(dir){throw new Error("process.chdir is not supported")};process.umask=function(){return 0}},{}],131:[function(require,module,exports){module.exports=require("./lib/_stream_duplex.js")},{"./lib/_stream_duplex.js":132}],132:[function(require,module,exports){(function(process){module.exports=Duplex;var objectKeys=Object.keys||function(obj){var keys=[];for(var key in obj)keys.push(key);return keys};var util=require("core-util-is");util.inherits=require("inherits");var Readable=require("./_stream_readable");var Writable=require("./_stream_writable");util.inherits(Duplex,Readable);forEach(objectKeys(Writable.prototype),function(method){if(!Duplex.prototype[method])Duplex.prototype[method]=Writable.prototype[method]});function Duplex(options){if(!(this instanceof Duplex))return new Duplex(options);Readable.call(this,options);Writable.call(this,options);if(options&&options.readable===false)this.readable=false;if(options&&options.writable===false)this.writable=false;this.allowHalfOpen=true;if(options&&options.allowHalfOpen===false)this.allowHalfOpen=false;this.once("end",onend)}function onend(){if(this.allowHalfOpen||this._writableState.ended)return;process.nextTick(this.end.bind(this))}function forEach(xs,f){for(var i=0,l=xs.length;i<l;i++){f(xs[i],i)}}}).call(this,require("_process"))},{"./_stream_readable":134,"./_stream_writable":136,_process:130,"core-util-is":137,inherits:127}],133:[function(require,module,exports){module.exports=PassThrough;var Transform=require("./_stream_transform");var util=require("core-util-is");util.inherits=require("inherits");util.inherits(PassThrough,Transform);function PassThrough(options){if(!(this instanceof PassThrough))return new PassThrough(options);Transform.call(this,options)}PassThrough.prototype._transform=function(chunk,encoding,cb){cb(null,chunk)}},{"./_stream_transform":135,"core-util-is":137,inherits:127}],134:[function(require,module,exports){(function(process){module.exports=Readable;var isArray=require("isarray");var Buffer=require("buffer").Buffer;Readable.ReadableState=ReadableState;var EE=require("events").EventEmitter;if(!EE.listenerCount)EE.listenerCount=function(emitter,type){return emitter.listeners(type).length};var Stream=require("stream");var util=require("core-util-is");util.inherits=require("inherits");var StringDecoder;util.inherits(Readable,Stream);function ReadableState(options,stream){options=options||{};var hwm=options.highWaterMark;this.highWaterMark=hwm||hwm===0?hwm:16*1024;this.highWaterMark=~~this.highWaterMark;this.buffer=[];this.length=0;this.pipes=null;this.pipesCount=0;this.flowing=false;this.ended=false;this.endEmitted=false;this.reading=false;this.calledRead=false;this.sync=true;this.needReadable=false;this.emittedReadable=false;this.readableListening=false;this.objectMode=!!options.objectMode;this.defaultEncoding=options.defaultEncoding||"utf8";this.ranOut=false;this.awaitDrain=0;this.readingMore=false;this.decoder=null;this.encoding=null;if(options.encoding){if(!StringDecoder)StringDecoder=require("string_decoder/").StringDecoder;this.decoder=new StringDecoder(options.encoding);this.encoding=options.encoding}}function Readable(options){if(!(this instanceof Readable))return new Readable(options);this._readableState=new ReadableState(options,this);this.readable=true;Stream.call(this)}Readable.prototype.push=function(chunk,encoding){var state=this._readableState;if(typeof chunk==="string"&&!state.objectMode){encoding=encoding||state.defaultEncoding;if(encoding!==state.encoding){chunk=new Buffer(chunk,encoding);encoding=""}}return readableAddChunk(this,state,chunk,encoding,false)};Readable.prototype.unshift=function(chunk){var state=this._readableState;return readableAddChunk(this,state,chunk,"",true)};function readableAddChunk(stream,state,chunk,encoding,addToFront){var er=chunkInvalid(state,chunk);if(er){stream.emit("error",er)}else if(chunk===null||chunk===undefined){state.reading=false;if(!state.ended)onEofChunk(stream,state)}else if(state.objectMode||chunk&&chunk.length>0){if(state.ended&&!addToFront){var e=new Error("stream.push() after EOF");stream.emit("error",e)}else if(state.endEmitted&&addToFront){var e=new Error("stream.unshift() after end event");stream.emit("error",e)}else{if(state.decoder&&!addToFront&&!encoding)chunk=state.decoder.write(chunk);state.length+=state.objectMode?1:chunk.length;if(addToFront){state.buffer.unshift(chunk)}else{state.reading=false;state.buffer.push(chunk)}if(state.needReadable)emitReadable(stream);maybeReadMore(stream,state)}}else if(!addToFront){state.reading=false}return needMoreData(state)}function needMoreData(state){return!state.ended&&(state.needReadable||state.length<state.highWaterMark||state.length===0)}Readable.prototype.setEncoding=function(enc){if(!StringDecoder)StringDecoder=require("string_decoder/").StringDecoder;this._readableState.decoder=new StringDecoder(enc);this._readableState.encoding=enc};var MAX_HWM=8388608;function roundUpToNextPowerOf2(n){if(n>=MAX_HWM){n=MAX_HWM}else{n--;for(var p=1;p<32;p<<=1)n|=n>>p;n++}return n}function howMuchToRead(n,state){if(state.length===0&&state.ended)return 0;if(state.objectMode)return n===0?0:1;if(n===null||isNaN(n)){if(state.flowing&&state.buffer.length)return state.buffer[0].length;else return state.length}if(n<=0)return 0;if(n>state.highWaterMark)state.highWaterMark=roundUpToNextPowerOf2(n);if(n>state.length){if(!state.ended){state.needReadable=true;return 0}else return state.length}return n}Readable.prototype.read=function(n){var state=this._readableState;state.calledRead=true;var nOrig=n;var ret;if(typeof n!=="number"||n>0)state.emittedReadable=false;if(n===0&&state.needReadable&&(state.length>=state.highWaterMark||state.ended)){emitReadable(this);return null}n=howMuchToRead(n,state);if(n===0&&state.ended){ret=null;if(state.length>0&&state.decoder){ret=fromList(n,state);state.length-=ret.length}if(state.length===0)endReadable(this);return ret}var doRead=state.needReadable;if(state.length-n<=state.highWaterMark)doRead=true;if(state.ended||state.reading)doRead=false;if(doRead){state.reading=true;state.sync=true;if(state.length===0)state.needReadable=true;this._read(state.highWaterMark);state.sync=false}if(doRead&&!state.reading)n=howMuchToRead(nOrig,state);if(n>0)ret=fromList(n,state);else ret=null;if(ret===null){state.needReadable=true;n=0}state.length-=n;if(state.length===0&&!state.ended)state.needReadable=true;if(state.ended&&!state.endEmitted&&state.length===0)endReadable(this);return ret};function chunkInvalid(state,chunk){var er=null;if(!Buffer.isBuffer(chunk)&&"string"!==typeof chunk&&chunk!==null&&chunk!==undefined&&!state.objectMode){er=new TypeError("Invalid non-string/buffer chunk")}return er}function onEofChunk(stream,state){if(state.decoder&&!state.ended){var chunk=state.decoder.end();if(chunk&&chunk.length){state.buffer.push(chunk);state.length+=state.objectMode?1:chunk.length}}state.ended=true;if(state.length>0)emitReadable(stream);else endReadable(stream)}function emitReadable(stream){var state=stream._readableState;state.needReadable=false;if(state.emittedReadable)return;state.emittedReadable=true;if(state.sync)process.nextTick(function(){emitReadable_(stream)});else emitReadable_(stream)}function emitReadable_(stream){stream.emit("readable")}function maybeReadMore(stream,state){if(!state.readingMore){state.readingMore=true;process.nextTick(function(){maybeReadMore_(stream,state)})}}function maybeReadMore_(stream,state){var len=state.length;while(!state.reading&&!state.flowing&&!state.ended&&state.length<state.highWaterMark){stream.read(0);if(len===state.length)break;else len=state.length}state.readingMore=false}Readable.prototype._read=function(n){this.emit("error",new Error("not implemented"))};Readable.prototype.pipe=function(dest,pipeOpts){var src=this;var state=this._readableState;switch(state.pipesCount){case 0:state.pipes=dest;break;case 1:state.pipes=[state.pipes,dest];break;default:state.pipes.push(dest);break}state.pipesCount+=1;var doEnd=(!pipeOpts||pipeOpts.end!==false)&&dest!==process.stdout&&dest!==process.stderr;var endFn=doEnd?onend:cleanup;if(state.endEmitted)process.nextTick(endFn);else src.once("end",endFn);dest.on("unpipe",onunpipe);function onunpipe(readable){if(readable!==src)return;cleanup()}function onend(){dest.end()}var ondrain=pipeOnDrain(src);dest.on("drain",ondrain);function cleanup(){dest.removeListener("close",onclose);dest.removeListener("finish",onfinish);dest.removeListener("drain",ondrain);dest.removeListener("error",onerror);dest.removeListener("unpipe",onunpipe);src.removeListener("end",onend);src.removeListener("end",cleanup);if(!dest._writableState||dest._writableState.needDrain)ondrain()}function onerror(er){unpipe();dest.removeListener("error",onerror);if(EE.listenerCount(dest,"error")===0)dest.emit("error",er)}if(!dest._events||!dest._events.error)dest.on("error",onerror);else if(isArray(dest._events.error))dest._events.error.unshift(onerror);else dest._events.error=[onerror,dest._events.error];function onclose(){dest.removeListener("finish",onfinish);unpipe()}dest.once("close",onclose);function onfinish(){dest.removeListener("close",onclose);unpipe()}dest.once("finish",onfinish);function unpipe(){src.unpipe(dest)}dest.emit("pipe",src);if(!state.flowing){this.on("readable",pipeOnReadable);state.flowing=true;process.nextTick(function(){flow(src)})}return dest};function pipeOnDrain(src){return function(){var dest=this;var state=src._readableState;state.awaitDrain--;if(state.awaitDrain===0)flow(src)}}function flow(src){var state=src._readableState;var chunk;state.awaitDrain=0;function write(dest,i,list){var written=dest.write(chunk);if(false===written){state.awaitDrain++}}while(state.pipesCount&&null!==(chunk=src.read())){if(state.pipesCount===1)write(state.pipes,0,null);else forEach(state.pipes,write);src.emit("data",chunk);if(state.awaitDrain>0)return}if(state.pipesCount===0){state.flowing=false;if(EE.listenerCount(src,"data")>0)emitDataEvents(src);return}state.ranOut=true}function pipeOnReadable(){if(this._readableState.ranOut){this._readableState.ranOut=false;flow(this)}}Readable.prototype.unpipe=function(dest){var state=this._readableState;if(state.pipesCount===0)return this;if(state.pipesCount===1){if(dest&&dest!==state.pipes)return this;if(!dest)dest=state.pipes;state.pipes=null;state.pipesCount=0;this.removeListener("readable",pipeOnReadable);state.flowing=false;if(dest)dest.emit("unpipe",this);return this}if(!dest){var dests=state.pipes;var len=state.pipesCount;state.pipes=null;state.pipesCount=0;this.removeListener("readable",pipeOnReadable);state.flowing=false;for(var i=0;i<len;i++)dests[i].emit("unpipe",this);return this}var i=indexOf(state.pipes,dest);if(i===-1)return this;state.pipes.splice(i,1);state.pipesCount-=1;if(state.pipesCount===1)state.pipes=state.pipes[0];dest.emit("unpipe",this);return this};Readable.prototype.on=function(ev,fn){var res=Stream.prototype.on.call(this,ev,fn);if(ev==="data"&&!this._readableState.flowing)emitDataEvents(this);if(ev==="readable"&&this.readable){var state=this._readableState;if(!state.readableListening){state.readableListening=true;state.emittedReadable=false;state.needReadable=true;if(!state.reading){this.read(0)}else if(state.length){emitReadable(this,state)}}}return res};Readable.prototype.addListener=Readable.prototype.on;Readable.prototype.resume=function(){emitDataEvents(this);this.read(0);this.emit("resume")};Readable.prototype.pause=function(){emitDataEvents(this,true);this.emit("pause")};function emitDataEvents(stream,startPaused){var state=stream._readableState;if(state.flowing){throw new Error("Cannot switch to old mode now.")}var paused=startPaused||false;var readable=false;stream.readable=true;stream.pipe=Stream.prototype.pipe;stream.on=stream.addListener=Stream.prototype.on;stream.on("readable",function(){readable=true;var c;while(!paused&&null!==(c=stream.read()))stream.emit("data",c);if(c===null){readable=false;stream._readableState.needReadable=true}});stream.pause=function(){paused=true;this.emit("pause")};stream.resume=function(){paused=false;if(readable)process.nextTick(function(){stream.emit("readable")});else this.read(0);this.emit("resume")};stream.emit("readable")}Readable.prototype.wrap=function(stream){var state=this._readableState;var paused=false;var self=this;stream.on("end",function(){if(state.decoder&&!state.ended){var chunk=state.decoder.end();if(chunk&&chunk.length)self.push(chunk)}self.push(null)});stream.on("data",function(chunk){if(state.decoder)chunk=state.decoder.write(chunk);if(state.objectMode&&(chunk===null||chunk===undefined))return;else if(!state.objectMode&&(!chunk||!chunk.length))return;var ret=self.push(chunk);if(!ret){paused=true;stream.pause()}});for(var i in stream){if(typeof stream[i]==="function"&&typeof this[i]==="undefined"){this[i]=function(method){return function(){return stream[method].apply(stream,arguments)}}(i)}}var events=["error","close","destroy","pause","resume"];forEach(events,function(ev){stream.on(ev,self.emit.bind(self,ev))});self._read=function(n){if(paused){paused=false;stream.resume()}};return self};Readable._fromList=fromList;function fromList(n,state){var list=state.buffer;var length=state.length;var stringMode=!!state.decoder;var objectMode=!!state.objectMode;var ret;if(list.length===0)return null;if(length===0)ret=null;else if(objectMode)ret=list.shift();else if(!n||n>=length){if(stringMode)ret=list.join("");else ret=Buffer.concat(list,length);list.length=0}else{if(n<list[0].length){var buf=list[0];ret=buf.slice(0,n);list[0]=buf.slice(n)}else if(n===list[0].length){ret=list.shift()}else{if(stringMode)ret="";else ret=new Buffer(n);var c=0;for(var i=0,l=list.length;i<l&&c<n;i++){var buf=list[0];var cpy=Math.min(n-c,buf.length);if(stringMode)ret+=buf.slice(0,cpy);else buf.copy(ret,c,0,cpy);if(cpy<buf.length)list[0]=buf.slice(cpy);else list.shift();c+=cpy}}}return ret}function endReadable(stream){var state=stream._readableState;if(state.length>0)throw new Error("endReadable called on non-empty stream");if(!state.endEmitted&&state.calledRead){state.ended=true;process.nextTick(function(){if(!state.endEmitted&&state.length===0){state.endEmitted=true;stream.readable=false;stream.emit("end")}})}}function forEach(xs,f){for(var i=0,l=xs.length;i<l;i++){f(xs[i],i)}}function indexOf(xs,x){for(var i=0,l=xs.length;i<l;i++){if(xs[i]===x)return i}return-1}}).call(this,require("_process"))},{_process:130,buffer:122,"core-util-is":137,events:126,inherits:127,isarray:128,stream:142,"string_decoder/":143}],135:[function(require,module,exports){module.exports=Transform;var Duplex=require("./_stream_duplex");var util=require("core-util-is");util.inherits=require("inherits");util.inherits(Transform,Duplex);function TransformState(options,stream){this.afterTransform=function(er,data){return afterTransform(stream,er,data)};this.needTransform=false;this.transforming=false;this.writecb=null;this.writechunk=null}function afterTransform(stream,er,data){var ts=stream._transformState;ts.transforming=false;var cb=ts.writecb;if(!cb)return stream.emit("error",new Error("no writecb in Transform class"));ts.writechunk=null;ts.writecb=null;if(data!==null&&data!==undefined)stream.push(data);if(cb)cb(er);var rs=stream._readableState;rs.reading=false;if(rs.needReadable||rs.length<rs.highWaterMark){stream._read(rs.highWaterMark)}}function Transform(options){if(!(this instanceof Transform))return new Transform(options);Duplex.call(this,options);var ts=this._transformState=new TransformState(options,this);var stream=this;this._readableState.needReadable=true;this._readableState.sync=false;this.once("finish",function(){if("function"===typeof this._flush)this._flush(function(er){done(stream,er)});else done(stream)})}Transform.prototype.push=function(chunk,encoding){this._transformState.needTransform=false;return Duplex.prototype.push.call(this,chunk,encoding)};Transform.prototype._transform=function(chunk,encoding,cb){throw new Error("not implemented")};Transform.prototype._write=function(chunk,encoding,cb){var ts=this._transformState;ts.writecb=cb;ts.writechunk=chunk;ts.writeencoding=encoding;if(!ts.transforming){var rs=this._readableState;if(ts.needTransform||rs.needReadable||rs.length<rs.highWaterMark)this._read(rs.highWaterMark)
}};Transform.prototype._read=function(n){var ts=this._transformState;if(ts.writechunk!==null&&ts.writecb&&!ts.transforming){ts.transforming=true;this._transform(ts.writechunk,ts.writeencoding,ts.afterTransform)}else{ts.needTransform=true}};function done(stream,er){if(er)return stream.emit("error",er);var ws=stream._writableState;var rs=stream._readableState;var ts=stream._transformState;if(ws.length)throw new Error("calling transform done when ws.length != 0");if(ts.transforming)throw new Error("calling transform done when still transforming");return stream.push(null)}},{"./_stream_duplex":132,"core-util-is":137,inherits:127}],136:[function(require,module,exports){(function(process){module.exports=Writable;var Buffer=require("buffer").Buffer;Writable.WritableState=WritableState;var util=require("core-util-is");util.inherits=require("inherits");var Stream=require("stream");util.inherits(Writable,Stream);function WriteReq(chunk,encoding,cb){this.chunk=chunk;this.encoding=encoding;this.callback=cb}function WritableState(options,stream){options=options||{};var hwm=options.highWaterMark;this.highWaterMark=hwm||hwm===0?hwm:16*1024;this.objectMode=!!options.objectMode;this.highWaterMark=~~this.highWaterMark;this.needDrain=false;this.ending=false;this.ended=false;this.finished=false;var noDecode=options.decodeStrings===false;this.decodeStrings=!noDecode;this.defaultEncoding=options.defaultEncoding||"utf8";this.length=0;this.writing=false;this.sync=true;this.bufferProcessing=false;this.onwrite=function(er){onwrite(stream,er)};this.writecb=null;this.writelen=0;this.buffer=[];this.errorEmitted=false}function Writable(options){var Duplex=require("./_stream_duplex");if(!(this instanceof Writable)&&!(this instanceof Duplex))return new Writable(options);this._writableState=new WritableState(options,this);this.writable=true;Stream.call(this)}Writable.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe. Not readable."))};function writeAfterEnd(stream,state,cb){var er=new Error("write after end");stream.emit("error",er);process.nextTick(function(){cb(er)})}function validChunk(stream,state,chunk,cb){var valid=true;if(!Buffer.isBuffer(chunk)&&"string"!==typeof chunk&&chunk!==null&&chunk!==undefined&&!state.objectMode){var er=new TypeError("Invalid non-string/buffer chunk");stream.emit("error",er);process.nextTick(function(){cb(er)});valid=false}return valid}Writable.prototype.write=function(chunk,encoding,cb){var state=this._writableState;var ret=false;if(typeof encoding==="function"){cb=encoding;encoding=null}if(Buffer.isBuffer(chunk))encoding="buffer";else if(!encoding)encoding=state.defaultEncoding;if(typeof cb!=="function")cb=function(){};if(state.ended)writeAfterEnd(this,state,cb);else if(validChunk(this,state,chunk,cb))ret=writeOrBuffer(this,state,chunk,encoding,cb);return ret};function decodeChunk(state,chunk,encoding){if(!state.objectMode&&state.decodeStrings!==false&&typeof chunk==="string"){chunk=new Buffer(chunk,encoding)}return chunk}function writeOrBuffer(stream,state,chunk,encoding,cb){chunk=decodeChunk(state,chunk,encoding);if(Buffer.isBuffer(chunk))encoding="buffer";var len=state.objectMode?1:chunk.length;state.length+=len;var ret=state.length<state.highWaterMark;if(!ret)state.needDrain=true;if(state.writing)state.buffer.push(new WriteReq(chunk,encoding,cb));else doWrite(stream,state,len,chunk,encoding,cb);return ret}function doWrite(stream,state,len,chunk,encoding,cb){state.writelen=len;state.writecb=cb;state.writing=true;state.sync=true;stream._write(chunk,encoding,state.onwrite);state.sync=false}function onwriteError(stream,state,sync,er,cb){if(sync)process.nextTick(function(){cb(er)});else cb(er);stream._writableState.errorEmitted=true;stream.emit("error",er)}function onwriteStateUpdate(state){state.writing=false;state.writecb=null;state.length-=state.writelen;state.writelen=0}function onwrite(stream,er){var state=stream._writableState;var sync=state.sync;var cb=state.writecb;onwriteStateUpdate(state);if(er)onwriteError(stream,state,sync,er,cb);else{var finished=needFinish(stream,state);if(!finished&&!state.bufferProcessing&&state.buffer.length)clearBuffer(stream,state);if(sync){process.nextTick(function(){afterWrite(stream,state,finished,cb)})}else{afterWrite(stream,state,finished,cb)}}}function afterWrite(stream,state,finished,cb){if(!finished)onwriteDrain(stream,state);cb();if(finished)finishMaybe(stream,state)}function onwriteDrain(stream,state){if(state.length===0&&state.needDrain){state.needDrain=false;stream.emit("drain")}}function clearBuffer(stream,state){state.bufferProcessing=true;for(var c=0;c<state.buffer.length;c++){var entry=state.buffer[c];var chunk=entry.chunk;var encoding=entry.encoding;var cb=entry.callback;var len=state.objectMode?1:chunk.length;doWrite(stream,state,len,chunk,encoding,cb);if(state.writing){c++;break}}state.bufferProcessing=false;if(c<state.buffer.length)state.buffer=state.buffer.slice(c);else state.buffer.length=0}Writable.prototype._write=function(chunk,encoding,cb){cb(new Error("not implemented"))};Writable.prototype.end=function(chunk,encoding,cb){var state=this._writableState;if(typeof chunk==="function"){cb=chunk;chunk=null;encoding=null}else if(typeof encoding==="function"){cb=encoding;encoding=null}if(typeof chunk!=="undefined"&&chunk!==null)this.write(chunk,encoding);if(!state.ending&&!state.finished)endWritable(this,state,cb)};function needFinish(stream,state){return state.ending&&state.length===0&&!state.finished&&!state.writing}function finishMaybe(stream,state){var need=needFinish(stream,state);if(need){state.finished=true;stream.emit("finish")}return need}function endWritable(stream,state,cb){state.ending=true;finishMaybe(stream,state);if(cb){if(state.finished)process.nextTick(cb);else stream.once("finish",cb)}state.ended=true}}).call(this,require("_process"))},{"./_stream_duplex":132,_process:130,buffer:122,"core-util-is":137,inherits:127,stream:142}],137:[function(require,module,exports){(function(Buffer){function isArray(ar){return Array.isArray(ar)}exports.isArray=isArray;function isBoolean(arg){return typeof arg==="boolean"}exports.isBoolean=isBoolean;function isNull(arg){return arg===null}exports.isNull=isNull;function isNullOrUndefined(arg){return arg==null}exports.isNullOrUndefined=isNullOrUndefined;function isNumber(arg){return typeof arg==="number"}exports.isNumber=isNumber;function isString(arg){return typeof arg==="string"}exports.isString=isString;function isSymbol(arg){return typeof arg==="symbol"}exports.isSymbol=isSymbol;function isUndefined(arg){return arg===void 0}exports.isUndefined=isUndefined;function isRegExp(re){return isObject(re)&&objectToString(re)==="[object RegExp]"}exports.isRegExp=isRegExp;function isObject(arg){return typeof arg==="object"&&arg!==null}exports.isObject=isObject;function isDate(d){return isObject(d)&&objectToString(d)==="[object Date]"}exports.isDate=isDate;function isError(e){return isObject(e)&&(objectToString(e)==="[object Error]"||e instanceof Error)}exports.isError=isError;function isFunction(arg){return typeof arg==="function"}exports.isFunction=isFunction;function isPrimitive(arg){return arg===null||typeof arg==="boolean"||typeof arg==="number"||typeof arg==="string"||typeof arg==="symbol"||typeof arg==="undefined"}exports.isPrimitive=isPrimitive;function isBuffer(arg){return Buffer.isBuffer(arg)}exports.isBuffer=isBuffer;function objectToString(o){return Object.prototype.toString.call(o)}}).call(this,require("buffer").Buffer)},{buffer:122}],138:[function(require,module,exports){module.exports=require("./lib/_stream_passthrough.js")},{"./lib/_stream_passthrough.js":133}],139:[function(require,module,exports){var Stream=require("stream");exports=module.exports=require("./lib/_stream_readable.js");exports.Stream=Stream;exports.Readable=exports;exports.Writable=require("./lib/_stream_writable.js");exports.Duplex=require("./lib/_stream_duplex.js");exports.Transform=require("./lib/_stream_transform.js");exports.PassThrough=require("./lib/_stream_passthrough.js")},{"./lib/_stream_duplex.js":132,"./lib/_stream_passthrough.js":133,"./lib/_stream_readable.js":134,"./lib/_stream_transform.js":135,"./lib/_stream_writable.js":136,stream:142}],140:[function(require,module,exports){module.exports=require("./lib/_stream_transform.js")},{"./lib/_stream_transform.js":135}],141:[function(require,module,exports){module.exports=require("./lib/_stream_writable.js")},{"./lib/_stream_writable.js":136}],142:[function(require,module,exports){module.exports=Stream;var EE=require("events").EventEmitter;var inherits=require("inherits");inherits(Stream,EE);Stream.Readable=require("readable-stream/readable.js");Stream.Writable=require("readable-stream/writable.js");Stream.Duplex=require("readable-stream/duplex.js");Stream.Transform=require("readable-stream/transform.js");Stream.PassThrough=require("readable-stream/passthrough.js");Stream.Stream=Stream;function Stream(){EE.call(this)}Stream.prototype.pipe=function(dest,options){var source=this;function ondata(chunk){if(dest.writable){if(false===dest.write(chunk)&&source.pause){source.pause()}}}source.on("data",ondata);function ondrain(){if(source.readable&&source.resume){source.resume()}}dest.on("drain",ondrain);if(!dest._isStdio&&(!options||options.end!==false)){source.on("end",onend);source.on("close",onclose)}var didOnEnd=false;function onend(){if(didOnEnd)return;didOnEnd=true;dest.end()}function onclose(){if(didOnEnd)return;didOnEnd=true;if(typeof dest.destroy==="function")dest.destroy()}function onerror(er){cleanup();if(EE.listenerCount(this,"error")===0){throw er}}source.on("error",onerror);dest.on("error",onerror);function cleanup(){source.removeListener("data",ondata);dest.removeListener("drain",ondrain);source.removeListener("end",onend);source.removeListener("close",onclose);source.removeListener("error",onerror);dest.removeListener("error",onerror);source.removeListener("end",cleanup);source.removeListener("close",cleanup);dest.removeListener("close",cleanup)}source.on("end",cleanup);source.on("close",cleanup);dest.on("close",cleanup);dest.emit("pipe",source);return dest}},{events:126,inherits:127,"readable-stream/duplex.js":131,"readable-stream/passthrough.js":138,"readable-stream/readable.js":139,"readable-stream/transform.js":140,"readable-stream/writable.js":141}],143:[function(require,module,exports){var Buffer=require("buffer").Buffer;var isBufferEncoding=Buffer.isEncoding||function(encoding){switch(encoding&&encoding.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return true;default:return false}};function assertEncoding(encoding){if(encoding&&!isBufferEncoding(encoding)){throw new Error("Unknown encoding: "+encoding)}}var StringDecoder=exports.StringDecoder=function(encoding){this.encoding=(encoding||"utf8").toLowerCase().replace(/[-_]/,"");assertEncoding(encoding);switch(this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2;this.detectIncompleteChar=utf16DetectIncompleteChar;break;case"base64":this.surrogateSize=3;this.detectIncompleteChar=base64DetectIncompleteChar;break;default:this.write=passThroughWrite;return}this.charBuffer=new Buffer(6);this.charReceived=0;this.charLength=0};StringDecoder.prototype.write=function(buffer){var charStr="";while(this.charLength){var available=buffer.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:buffer.length;buffer.copy(this.charBuffer,this.charReceived,0,available);this.charReceived+=available;if(this.charReceived<this.charLength){return""}buffer=buffer.slice(available,buffer.length);charStr=this.charBuffer.slice(0,this.charLength).toString(this.encoding);var charCode=charStr.charCodeAt(charStr.length-1);if(charCode>=55296&&charCode<=56319){this.charLength+=this.surrogateSize;charStr="";continue}this.charReceived=this.charLength=0;if(buffer.length===0){return charStr}break}this.detectIncompleteChar(buffer);var end=buffer.length;if(this.charLength){buffer.copy(this.charBuffer,0,buffer.length-this.charReceived,end);end-=this.charReceived}charStr+=buffer.toString(this.encoding,0,end);var end=charStr.length-1;var charCode=charStr.charCodeAt(end);if(charCode>=55296&&charCode<=56319){var size=this.surrogateSize;this.charLength+=size;this.charReceived+=size;this.charBuffer.copy(this.charBuffer,size,0,size);buffer.copy(this.charBuffer,0,0,size);return charStr.substring(0,end)}return charStr};StringDecoder.prototype.detectIncompleteChar=function(buffer){var i=buffer.length>=3?3:buffer.length;for(;i>0;i--){var c=buffer[buffer.length-i];if(i==1&&c>>5==6){this.charLength=2;break}if(i<=2&&c>>4==14){this.charLength=3;break}if(i<=3&&c>>3==30){this.charLength=4;break}}this.charReceived=i};StringDecoder.prototype.end=function(buffer){var res="";if(buffer&&buffer.length)res=this.write(buffer);if(this.charReceived){var cr=this.charReceived;var buf=this.charBuffer;var enc=this.encoding;res+=buf.slice(0,cr).toString(enc)}return res};function passThroughWrite(buffer){return buffer.toString(this.encoding)}function utf16DetectIncompleteChar(buffer){this.charReceived=buffer.length%2;this.charLength=this.charReceived?2:0}function base64DetectIncompleteChar(buffer){this.charReceived=buffer.length%3;this.charLength=this.charReceived?3:0}},{buffer:122}],144:[function(require,module,exports){module.exports=function isBuffer(arg){return arg&&typeof arg==="object"&&typeof arg.copy==="function"&&typeof arg.fill==="function"&&typeof arg.readUInt8==="function"}},{}],145:[function(require,module,exports){(function(process,global){var formatRegExp=/%[sdj%]/g;exports.format=function(f){if(!isString(f)){var objects=[];for(var i=0;i<arguments.length;i++){objects.push(inspect(arguments[i]))}return objects.join(" ")}var i=1;var args=arguments;var len=args.length;var str=String(f).replace(formatRegExp,function(x){if(x==="%%")return"%";if(i>=len)return x;switch(x){case"%s":return String(args[i++]);case"%d":return Number(args[i++]);case"%j":try{return JSON.stringify(args[i++])}catch(_){return"[Circular]"}default:return x}});for(var x=args[i];i<len;x=args[++i]){if(isNull(x)||!isObject(x)){str+=" "+x}else{str+=" "+inspect(x)}}return str};exports.deprecate=function(fn,msg){if(isUndefined(global.process)){return function(){return exports.deprecate(fn,msg).apply(this,arguments)}}if(process.noDeprecation===true){return fn}var warned=false;function deprecated(){if(!warned){if(process.throwDeprecation){throw new Error(msg)}else if(process.traceDeprecation){console.trace(msg)}else{console.error(msg)}warned=true}return fn.apply(this,arguments)}return deprecated};var debugs={};var debugEnviron;exports.debuglog=function(set){if(isUndefined(debugEnviron))debugEnviron=process.env.NODE_DEBUG||"";set=set.toUpperCase();if(!debugs[set]){if(new RegExp("\\b"+set+"\\b","i").test(debugEnviron)){var pid=process.pid;debugs[set]=function(){var msg=exports.format.apply(exports,arguments);console.error("%s %d: %s",set,pid,msg)}}else{debugs[set]=function(){}}}return debugs[set]};function inspect(obj,opts){var ctx={seen:[],stylize:stylizeNoColor};if(arguments.length>=3)ctx.depth=arguments[2];if(arguments.length>=4)ctx.colors=arguments[3];if(isBoolean(opts)){ctx.showHidden=opts}else if(opts){exports._extend(ctx,opts)}if(isUndefined(ctx.showHidden))ctx.showHidden=false;if(isUndefined(ctx.depth))ctx.depth=2;if(isUndefined(ctx.colors))ctx.colors=false;if(isUndefined(ctx.customInspect))ctx.customInspect=true;if(ctx.colors)ctx.stylize=stylizeWithColor;return formatValue(ctx,obj,ctx.depth)}exports.inspect=inspect;inspect.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]};inspect.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"};function stylizeWithColor(str,styleType){var style=inspect.styles[styleType];if(style){return"["+inspect.colors[style][0]+"m"+str+"["+inspect.colors[style][1]+"m"}else{return str}}function stylizeNoColor(str,styleType){return str}function arrayToHash(array){var hash={};array.forEach(function(val,idx){hash[val]=true});return hash}function formatValue(ctx,value,recurseTimes){if(ctx.customInspect&&value&&isFunction(value.inspect)&&value.inspect!==exports.inspect&&!(value.constructor&&value.constructor.prototype===value)){var ret=value.inspect(recurseTimes,ctx);if(!isString(ret)){ret=formatValue(ctx,ret,recurseTimes)}return ret}var primitive=formatPrimitive(ctx,value);if(primitive){return primitive}var keys=Object.keys(value);var visibleKeys=arrayToHash(keys);if(ctx.showHidden){keys=Object.getOwnPropertyNames(value)}if(isError(value)&&(keys.indexOf("message")>=0||keys.indexOf("description")>=0)){return formatError(value)}if(keys.length===0){if(isFunction(value)){var name=value.name?": "+value.name:"";return ctx.stylize("[Function"+name+"]","special")}if(isRegExp(value)){return ctx.stylize(RegExp.prototype.toString.call(value),"regexp")}if(isDate(value)){return ctx.stylize(Date.prototype.toString.call(value),"date")}if(isError(value)){return formatError(value)}}var base="",array=false,braces=["{","}"];if(isArray(value)){array=true;braces=["[","]"]}if(isFunction(value)){var n=value.name?": "+value.name:"";base=" [Function"+n+"]"}if(isRegExp(value)){base=" "+RegExp.prototype.toString.call(value)}if(isDate(value)){base=" "+Date.prototype.toUTCString.call(value)}if(isError(value)){base=" "+formatError(value)}if(keys.length===0&&(!array||value.length==0)){return braces[0]+base+braces[1]}if(recurseTimes<0){if(isRegExp(value)){return ctx.stylize(RegExp.prototype.toString.call(value),"regexp")}else{return ctx.stylize("[Object]","special")}}ctx.seen.push(value);var output;if(array){output=formatArray(ctx,value,recurseTimes,visibleKeys,keys)}else{output=keys.map(function(key){return formatProperty(ctx,value,recurseTimes,visibleKeys,key,array)})}ctx.seen.pop();return reduceToSingleString(output,base,braces)}function formatPrimitive(ctx,value){if(isUndefined(value))return ctx.stylize("undefined","undefined");if(isString(value)){var simple="'"+JSON.stringify(value).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return ctx.stylize(simple,"string")}if(isNumber(value))return ctx.stylize(""+value,"number");if(isBoolean(value))return ctx.stylize(""+value,"boolean");if(isNull(value))return ctx.stylize("null","null")}function formatError(value){return"["+Error.prototype.toString.call(value)+"]"}function formatArray(ctx,value,recurseTimes,visibleKeys,keys){var output=[];for(var i=0,l=value.length;i<l;++i){if(hasOwnProperty(value,String(i))){output.push(formatProperty(ctx,value,recurseTimes,visibleKeys,String(i),true))}else{output.push("")}}keys.forEach(function(key){if(!key.match(/^\d+$/)){output.push(formatProperty(ctx,value,recurseTimes,visibleKeys,key,true))}});return output}function formatProperty(ctx,value,recurseTimes,visibleKeys,key,array){var name,str,desc;desc=Object.getOwnPropertyDescriptor(value,key)||{value:value[key]};if(desc.get){if(desc.set){str=ctx.stylize("[Getter/Setter]","special")}else{str=ctx.stylize("[Getter]","special")}}else{if(desc.set){str=ctx.stylize("[Setter]","special")}}if(!hasOwnProperty(visibleKeys,key)){name="["+key+"]"}if(!str){if(ctx.seen.indexOf(desc.value)<0){if(isNull(recurseTimes)){str=formatValue(ctx,desc.value,null)}else{str=formatValue(ctx,desc.value,recurseTimes-1)}if(str.indexOf("\n")>-1){if(array){str=str.split("\n").map(function(line){return" "+line}).join("\n").substr(2)}else{str="\n"+str.split("\n").map(function(line){return" "+line}).join("\n")}}}else{str=ctx.stylize("[Circular]","special")}}if(isUndefined(name)){if(array&&key.match(/^\d+$/)){return str}name=JSON.stringify(""+key);if(name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)){name=name.substr(1,name.length-2);name=ctx.stylize(name,"name")}else{name=name.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'");name=ctx.stylize(name,"string")}}return name+": "+str}function reduceToSingleString(output,base,braces){var numLinesEst=0;var length=output.reduce(function(prev,cur){numLinesEst++;if(cur.indexOf("\n")>=0)numLinesEst++;return prev+cur.replace(/\u001b\[\d\d?m/g,"").length+1},0);if(length>60){return braces[0]+(base===""?"":base+"\n ")+" "+output.join(",\n ")+" "+braces[1]}return braces[0]+base+" "+output.join(", ")+" "+braces[1]}function isArray(ar){return Array.isArray(ar)}exports.isArray=isArray;function isBoolean(arg){return typeof arg==="boolean"}exports.isBoolean=isBoolean;function isNull(arg){return arg===null}exports.isNull=isNull;function isNullOrUndefined(arg){return arg==null}exports.isNullOrUndefined=isNullOrUndefined;function isNumber(arg){return typeof arg==="number"}exports.isNumber=isNumber;function isString(arg){return typeof arg==="string"}exports.isString=isString;function isSymbol(arg){return typeof arg==="symbol"}exports.isSymbol=isSymbol;function isUndefined(arg){return arg===void 0}exports.isUndefined=isUndefined;function isRegExp(re){return isObject(re)&&objectToString(re)==="[object RegExp]"}exports.isRegExp=isRegExp;function isObject(arg){return typeof arg==="object"&&arg!==null}exports.isObject=isObject;function isDate(d){return isObject(d)&&objectToString(d)==="[object Date]"}exports.isDate=isDate;function isError(e){return isObject(e)&&(objectToString(e)==="[object Error]"||e instanceof Error)}exports.isError=isError;function isFunction(arg){return typeof arg==="function"}exports.isFunction=isFunction;function isPrimitive(arg){return arg===null||typeof arg==="boolean"||typeof arg==="number"||typeof arg==="string"||typeof arg==="symbol"||typeof arg==="undefined"}exports.isPrimitive=isPrimitive;exports.isBuffer=require("./support/isBuffer");function objectToString(o){return Object.prototype.toString.call(o)}function pad(n){return n<10?"0"+n.toString(10):n.toString(10)}var months=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function timestamp(){var d=new Date;var time=[pad(d.getHours()),pad(d.getMinutes()),pad(d.getSeconds())].join(":");return[d.getDate(),months[d.getMonth()],time].join(" ")}exports.log=function(){console.log("%s - %s",timestamp(),exports.format.apply(exports,arguments))};exports.inherits=require("inherits");exports._extend=function(origin,add){if(!add||!isObject(add))return origin;var keys=Object.keys(add);var i=keys.length;while(i--){origin[keys[i]]=add[keys[i]]}return origin};function hasOwnProperty(obj,prop){return Object.prototype.hasOwnProperty.call(obj,prop)}}).call(this,require("_process"),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./support/isBuffer":144,_process:130,inherits:127}],146:[function(require,module,exports){"use strict";var escapeStringRegexp=require("escape-string-regexp");var ansiStyles=require("ansi-styles");var stripAnsi=require("strip-ansi");var hasAnsi=require("has-ansi");var supportsColor=require("supports-color");var defineProps=Object.defineProperties;var chalk=module.exports;function build(_styles){var builder=function builder(){return applyStyle.apply(builder,arguments)};builder._styles=_styles;builder.__proto__=proto;return builder}var styles=function(){var ret={};ansiStyles.grey=ansiStyles.gray;Object.keys(ansiStyles).forEach(function(key){ansiStyles[key].closeRe=new RegExp(escapeStringRegexp(ansiStyles[key].close),"g");ret[key]={get:function(){return build(this._styles.concat(key))}}});return ret}();var proto=defineProps(function chalk(){},styles);function applyStyle(){var args=arguments;var argsLen=args.length;var str=argsLen!==0&&String(arguments[0]);if(argsLen>1){for(var a=1;a<argsLen;a++){str+=" "+args[a]}}if(!chalk.enabled||!str){return str}var nestedStyles=this._styles;for(var i=0;i<nestedStyles.length;i++){var code=ansiStyles[nestedStyles[i]];str=code.open+str.replace(code.closeRe,code.open)+code.close}return str}function init(){var ret={};Object.keys(styles).forEach(function(name){ret[name]={get:function(){return build([name])}}});return ret}defineProps(chalk,init());chalk.styles=ansiStyles;chalk.hasColor=hasAnsi;chalk.stripColor=stripAnsi;chalk.supportsColor=supportsColor;if(chalk.enabled===undefined){chalk.enabled=chalk.supportsColor}},{"ansi-styles":147,"escape-string-regexp":148,"has-ansi":149,"strip-ansi":151,"supports-color":153}],147:[function(require,module,exports){"use strict";var styles=module.exports;var codes={reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29],black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],gray:[90,39],bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49]};Object.keys(codes).forEach(function(key){var val=codes[key];var style=styles[key]={};style.open="["+val[0]+"m";style.close="["+val[1]+"m"})},{}],148:[function(require,module,exports){"use strict";var matchOperatorsRe=/[|\\{}()[\]^$+*?.]/g;module.exports=function(str){if(typeof str!=="string"){throw new TypeError("Expected a string")}return str.replace(matchOperatorsRe,"\\$&")}},{}],149:[function(require,module,exports){"use strict";var ansiRegex=require("ansi-regex");var re=new RegExp(ansiRegex().source);module.exports=re.test.bind(re)},{"ansi-regex":150}],150:[function(require,module,exports){"use strict";module.exports=function(){return/\u001b\[(?:[0-9]{1,3}(?:;[0-9]{1,3})*)?[m|K]/g}},{}],151:[function(require,module,exports){"use strict";var ansiRegex=require("ansi-regex")();module.exports=function(str){return typeof str==="string"?str.replace(ansiRegex,""):str}},{"ansi-regex":152}],152:[function(require,module,exports){arguments[4][150][0].apply(exports,arguments)},{dup:150}],153:[function(require,module,exports){(function(process){"use strict";module.exports=function(){if(process.argv.indexOf("--no-color")!==-1){return false}if(process.argv.indexOf("--color")!==-1){return true}if(process.stdout&&!process.stdout.isTTY){return false}if(process.platform==="win32"){return true}if("COLORTERM"in process.env){return true}if(process.env.TERM==="dumb"){return false}if(/^screen|^xterm|^vt100|color|ansi|cygwin|linux/i.test(process.env.TERM)){return true}return false}()}).call(this,require("_process"))},{_process:130}],154:[function(require,module,exports){!function(global,framework,undefined){"use strict";var OBJECT="Object",FUNCTION="Function",ARRAY="Array",STRING="String",NUMBER="Number",REGEXP="RegExp",DATE="Date",MAP="Map",SET="Set",WEAKMAP="WeakMap",WEAKSET="WeakSet",SYMBOL="Symbol",PROMISE="Promise",MATH="Math",ARGUMENTS="Arguments",PROTOTYPE="prototype",CONSTRUCTOR="constructor",TO_STRING="toString",TO_STRING_TAG=TO_STRING+"Tag",TO_LOCALE="toLocaleString",HAS_OWN="hasOwnProperty",FOR_EACH="forEach",ITERATOR="iterator",FF_ITERATOR="@@"+ITERATOR,PROCESS="process",CREATE_ELEMENT="createElement",Function=global[FUNCTION],Object=global[OBJECT],Array=global[ARRAY],String=global[STRING],Number=global[NUMBER],RegExp=global[REGEXP],Date=global[DATE],Map=global[MAP],Set=global[SET],WeakMap=global[WEAKMAP],WeakSet=global[WEAKSET],Symbol=global[SYMBOL],Math=global[MATH],TypeError=global.TypeError,setTimeout=global.setTimeout,setImmediate=global.setImmediate,clearImmediate=global.clearImmediate,process=global[PROCESS],nextTick=process&&process.nextTick,document=global.document,html=document&&document.documentElement,navigator=global.navigator,define=global.define,ArrayProto=Array[PROTOTYPE],ObjectProto=Object[PROTOTYPE],FunctionProto=Function[PROTOTYPE],Infinity=1/0,DOT=".";function isObject(it){return it!=null&&(typeof it=="object"||typeof it=="function")}function isFunction(it){return typeof it=="function"}var isNative=ctx(/./.test,/\[native code\]\s*\}\s*$/,1);var buildIn={Undefined:1,Null:1,Array:1,String:1,Arguments:1,Function:1,Error:1,Boolean:1,Number:1,Date:1,RegExp:1},toString=ObjectProto[TO_STRING];function setToStringTag(it,tag,stat){if(it&&!has(it=stat?it:it[PROTOTYPE],SYMBOL_TAG))hidden(it,SYMBOL_TAG,tag)}function cof(it){return it==undefined?it===undefined?"Undefined":"Null":toString.call(it).slice(8,-1)}function classof(it){var klass=cof(it),tag;return klass==OBJECT&&(tag=it[SYMBOL_TAG])?has(buildIn,tag)?"~"+tag:tag:klass}var call=FunctionProto.call,apply=FunctionProto.apply,REFERENCE_GET;function part(){var fn=assertFunction(this),length=arguments.length,args=Array(length),i=0,_=path._,holder=false;while(length>i)if((args[i]=arguments[i++])===_)holder=true;return function(){var that=this,_length=arguments.length,i=0,j=0,_args;if(!holder&&!_length)return invoke(fn,args,that);_args=args.slice();if(holder)for(;length>i;i++)if(_args[i]===_)_args[i]=arguments[j++];while(_length>j)_args.push(arguments[j++]);return invoke(fn,_args,that)}}function ctx(fn,that,length){assertFunction(fn);if(~length&&that===undefined)return fn;switch(length){case 1:return function(a){return fn.call(that,a)};case 2:return function(a,b){return fn.call(that,a,b)};case 3:return function(a,b,c){return fn.call(that,a,b,c)}}return function(){return fn.apply(that,arguments)}}function invoke(fn,args,that){var un=that===undefined;switch(args.length|0){case 0:return un?fn():fn.call(that);case 1:return un?fn(args[0]):fn.call(that,args[0]);case 2:return un?fn(args[0],args[1]):fn.call(that,args[0],args[1]);case 3:return un?fn(args[0],args[1],args[2]):fn.call(that,args[0],args[1],args[2]);case 4:return un?fn(args[0],args[1],args[2],args[3]):fn.call(that,args[0],args[1],args[2],args[3]);case 5:return un?fn(args[0],args[1],args[2],args[3],args[4]):fn.call(that,args[0],args[1],args[2],args[3],args[4])}return fn.apply(that,args)}function construct(target,argumentsList){var instance=create((arguments.length<3?target:assertFunction(arguments[2]))[PROTOTYPE]),result=apply.call(target,instance,argumentsList);return isObject(result)?result:instance}var create=Object.create,getPrototypeOf=Object.getPrototypeOf,setPrototypeOf=Object.setPrototypeOf,defineProperty=Object.defineProperty,defineProperties=Object.defineProperties,getOwnDescriptor=Object.getOwnPropertyDescriptor,getKeys=Object.keys,getNames=Object.getOwnPropertyNames,getSymbols=Object.getOwnPropertySymbols,has=ctx(call,ObjectProto[HAS_OWN],2),ES5Object=Object,Dict;function toObject(it){return ES5Object(assertDefined(it))}function returnIt(it){return it}function returnThis(){return this}function get(object,key){if(has(object,key))return object[key]}function ownKeys(it){assertObject(it);return getSymbols?getNames(it).concat(getSymbols(it)):getNames(it)}var assign=Object.assign||function(target,source){var T=Object(assertDefined(target)),l=arguments.length,i=1;while(l>i){var S=ES5Object(arguments[i++]),keys=getKeys(S),length=keys.length,j=0,key;while(length>j)T[key=keys[j++]]=S[key]}return T};function keyOf(object,el){var O=toObject(object),keys=getKeys(O),length=keys.length,index=0,key;while(length>index)if(O[key=keys[index++]]===el)return key}function array(it){return String(it).split(",")}var push=ArrayProto.push,unshift=ArrayProto.unshift,slice=ArrayProto.slice,splice=ArrayProto.splice,indexOf=ArrayProto.indexOf,forEach=ArrayProto[FOR_EACH];function createArrayMethod(type){var isMap=type==1,isFilter=type==2,isSome=type==3,isEvery=type==4,isFindIndex=type==6,noholes=type==5||isFindIndex;return function(callbackfn){var O=Object(assertDefined(this)),that=arguments[1],self=ES5Object(O),f=ctx(callbackfn,that,3),length=toLength(self.length),index=0,result=isMap?Array(length):isFilter?[]:undefined,val,res;for(;length>index;index++)if(noholes||index in self){val=self[index];res=f(val,index,O);if(type){if(isMap)result[index]=res;else if(res)switch(type){case 3:return true;case 5:return val;case 6:return index;case 2:result.push(val)}else if(isEvery)return false}}return isFindIndex?-1:isSome||isEvery?isEvery:result}}function createArrayContains(isContains){return function(el){var O=toObject(this),length=toLength(O.length),index=toIndex(arguments[1],length);
if(isContains&&el!=el){for(;length>index;index++)if(sameNaN(O[index]))return isContains||index}else for(;length>index;index++)if(isContains||index in O){if(O[index]===el)return isContains||index}return!isContains&&-1}}function generic(A,B){return typeof A=="function"?A:B}var MAX_SAFE_INTEGER=9007199254740991,ceil=Math.ceil,floor=Math.floor,max=Math.max,min=Math.min,random=Math.random,trunc=Math.trunc||function(it){return(it>0?floor:ceil)(it)};function sameNaN(number){return number!=number}function toInteger(it){return isNaN(it)?0:trunc(it)}function toLength(it){return it>0?min(toInteger(it),MAX_SAFE_INTEGER):0}function toIndex(index,length){var index=toInteger(index);return index<0?max(index+length,0):min(index,length)}function createReplacer(regExp,replace,isStatic){var replacer=isObject(replace)?function(part){return replace[part]}:replace;return function(it){return String(isStatic?it:this).replace(regExp,replacer)}}function createPointAt(toString){return function(pos){var s=String(assertDefined(this)),i=toInteger(pos),l=s.length,a,b;if(i<0||i>=l)return toString?"":undefined;a=s.charCodeAt(i);return a<55296||a>56319||i+1===l||(b=s.charCodeAt(i+1))<56320||b>57343?toString?s.charAt(i):a:toString?s.slice(i,i+2):(a-55296<<10)+(b-56320)+65536}}var REDUCE_ERROR="Reduce of empty object with no initial value";function assert(condition,msg1,msg2){if(!condition)throw TypeError(msg2?msg1+msg2:msg1)}function assertDefined(it){if(it==undefined)throw TypeError("Function called on null or undefined");return it}function assertFunction(it){assert(isFunction(it),it," is not a function!");return it}function assertObject(it){assert(isObject(it),it," is not an object!");return it}function assertInstance(it,Constructor,name){assert(it instanceof Constructor,name,": use the 'new' operator!")}function descriptor(bitmap,value){return{enumerable:!(bitmap&1),configurable:!(bitmap&2),writable:!(bitmap&4),value:value}}function simpleSet(object,key,value){object[key]=value;return object}function createDefiner(bitmap){return DESC?function(object,key,value){return defineProperty(object,key,descriptor(bitmap,value))}:simpleSet}function uid(key){return SYMBOL+"("+key+")_"+(++sid+random())[TO_STRING](36)}function getWellKnownSymbol(name,setter){return Symbol&&Symbol[name]||(setter?Symbol:safeSymbol)(SYMBOL+DOT+name)}var DESC=!!function(){try{return defineProperty({},DOT,ObjectProto)}catch(e){}}(),sid=0,hidden=createDefiner(1),set=Symbol?simpleSet:hidden,safeSymbol=Symbol||uid;function assignHidden(target,src){for(var key in src)hidden(target,key,src[key]);return target}var SYMBOL_UNSCOPABLES=getWellKnownSymbol("unscopables"),ArrayUnscopables=ArrayProto[SYMBOL_UNSCOPABLES]||{},SYMBOL_SPECIES=getWellKnownSymbol("species");function setSpecies(C){if(framework||!isNative(C))defineProperty(C,SYMBOL_SPECIES,{configurable:true,get:returnThis})}var SYMBOL_ITERATOR=getWellKnownSymbol(ITERATOR),SYMBOL_TAG=getWellKnownSymbol(TO_STRING_TAG),SUPPORT_FF_ITER=FF_ITERATOR in ArrayProto,ITER=safeSymbol("iter"),KEY=1,VALUE=2,Iterators={},IteratorPrototype={},NATIVE_ITERATORS=SYMBOL_ITERATOR in ArrayProto,BUGGY_ITERATORS="keys"in ArrayProto&&!("next"in[].keys());setIterator(IteratorPrototype,returnThis);function setIterator(O,value){hidden(O,SYMBOL_ITERATOR,value);SUPPORT_FF_ITER&&hidden(O,FF_ITERATOR,value)}function createIterator(Constructor,NAME,next,proto){Constructor[PROTOTYPE]=create(proto||IteratorPrototype,{next:descriptor(1,next)});setToStringTag(Constructor,NAME+" Iterator")}function defineIterator(Constructor,NAME,value,DEFAULT){var proto=Constructor[PROTOTYPE],iter=get(proto,SYMBOL_ITERATOR)||get(proto,FF_ITERATOR)||DEFAULT&&get(proto,DEFAULT)||value;if(framework){setIterator(proto,iter);if(iter!==value){var iterProto=getPrototypeOf(iter.call(new Constructor));setToStringTag(iterProto,NAME+" Iterator",true);has(proto,FF_ITERATOR)&&setIterator(iterProto,returnThis)}}Iterators[NAME]=iter;Iterators[NAME+" Iterator"]=returnThis;return iter}function defineStdIterators(Base,NAME,Constructor,next,DEFAULT,IS_SET){function createIter(kind){return function(){return new Constructor(this,kind)}}createIterator(Constructor,NAME,next);var entries=createIter(KEY+VALUE),values=createIter(VALUE);if(DEFAULT==VALUE)values=defineIterator(Base,NAME,values,"values");else entries=defineIterator(Base,NAME,entries,"entries");if(DEFAULT){$define(PROTO+FORCED*BUGGY_ITERATORS,NAME,{entries:entries,keys:IS_SET?values:createIter(KEY),values:values})}}function iterResult(done,value){return{value:value,done:!!done}}function isIterable(it){var O=Object(it),Symbol=global[SYMBOL],hasExt=(Symbol&&Symbol[ITERATOR]||FF_ITERATOR)in O;return hasExt||SYMBOL_ITERATOR in O||has(Iterators,classof(O))}function getIterator(it){var Symbol=global[SYMBOL],ext=it[Symbol&&Symbol[ITERATOR]||FF_ITERATOR],getIter=ext||it[SYMBOL_ITERATOR]||Iterators[classof(it)];return assertObject(getIter.call(it))}function stepCall(fn,value,entries){return entries?invoke(fn,value):fn(value)}function forOf(iterable,entries,fn,that){var iterator=getIterator(iterable),f=ctx(fn,that,entries?2:1),step;while(!(step=iterator.next()).done)if(stepCall(f,step.value,entries)===false)return}var NODE=cof(process)==PROCESS,core={},path=framework?global:core,old=global.core,exportGlobal,FORCED=1,GLOBAL=2,STATIC=4,PROTO=8,BIND=16,WRAP=32;function $define(type,name,source){var key,own,out,exp,isGlobal=type&GLOBAL,target=isGlobal?global:type&STATIC?global[name]:(global[name]||ObjectProto)[PROTOTYPE],exports=isGlobal?core:core[name]||(core[name]={});if(isGlobal)source=name;for(key in source){own=!(type&FORCED)&&target&&key in target&&(!isFunction(target[key])||isNative(target[key]));out=(own?target:source)[key];if(type&BIND&&own)exp=ctx(out,global);else if(type&WRAP&&!framework&&target[key]==out){exp=function(param){return this instanceof out?new out(param):out(param)};exp[PROTOTYPE]=out[PROTOTYPE]}else exp=type&PROTO&&isFunction(out)?ctx(call,out):out;if(exports[key]!=out)hidden(exports,key,exp);if(framework&&target&&!own){if(isGlobal)target[key]=out;else delete target[key]&&hidden(target,key,out)}}}if(typeof module!="undefined"&&module.exports)module.exports=core;else if(isFunction(define)&&define.amd)define(function(){return core});else exportGlobal=true;if(exportGlobal||framework){core.noConflict=function(){global.core=old;return core};global.core=core}$define(GLOBAL+FORCED,{global:global});!function(TAG,SymbolRegistry,AllSymbols,setter){if(!isNative(Symbol)){Symbol=function(description){assert(!(this instanceof Symbol),SYMBOL+" is not a "+CONSTRUCTOR);var tag=uid(description);AllSymbols[tag]=true;DESC&&setter&&defineProperty(ObjectProto,tag,{configurable:true,set:function(value){hidden(this,tag,value)}});return set(create(Symbol[PROTOTYPE]),TAG,tag)};hidden(Symbol[PROTOTYPE],TO_STRING,function(){return this[TAG]})}$define(GLOBAL+WRAP,{Symbol:Symbol});var symbolStatics={"for":function(key){return has(SymbolRegistry,key+="")?SymbolRegistry[key]:SymbolRegistry[key]=Symbol(key)},iterator:SYMBOL_ITERATOR,keyFor:part.call(keyOf,SymbolRegistry),species:SYMBOL_SPECIES,toStringTag:SYMBOL_TAG=getWellKnownSymbol(TO_STRING_TAG,true),unscopables:SYMBOL_UNSCOPABLES,pure:safeSymbol,set:set,useSetter:function(){setter=true},useSimple:function(){setter=false}};forEach.call(array("hasInstance,isConcatSpreadable,match,replace,search,split,toPrimitive"),function(it){symbolStatics[it]=getWellKnownSymbol(it)});$define(STATIC,SYMBOL,symbolStatics);setToStringTag(Symbol,SYMBOL);$define(STATIC+FORCED*!isNative(Symbol),OBJECT,{getOwnPropertyNames:function(it){var names=getNames(toObject(it)),result=[],key,i=0;while(names.length>i)has(AllSymbols,key=names[i++])||result.push(key);return result},getOwnPropertySymbols:function(it){var names=getNames(toObject(it)),result=[],key,i=0;while(names.length>i)has(AllSymbols,key=names[i++])&&result.push(key);return result}})}(safeSymbol("tag"),{},{},true);!function(RegExpProto,isFinite,tmp,NAME){var RangeError=global.RangeError,isInteger=Number.isInteger||function(it){return!isObject(it)&&isFinite(it)&&floor(it)===it},sign=Math.sign||function sign(x){return(x=+x)==0||x!=x?x:x<0?-1:1},E=Math.E,pow=Math.pow,abs=Math.abs,exp=Math.exp,log=Math.log,sqrt=Math.sqrt,fcc=String.fromCharCode,at=createPointAt(true);var objectStatic={assign:assign,is:function(x,y){return x===y?x!==0||1/x===1/y:x!=x&&y!=y}};"__proto__"in ObjectProto&&function(buggy,set){try{set=ctx(call,getOwnDescriptor(ObjectProto,"__proto__").set,2);set({},ArrayProto)}catch(e){buggy=true}objectStatic.setPrototypeOf=setPrototypeOf=setPrototypeOf||function(O,proto){assertObject(O);assert(proto===null||isObject(proto),proto,": can't set as prototype!");if(buggy)O.__proto__=proto;else set(O,proto);return O}}();$define(STATIC,OBJECT,objectStatic);function asinh(x){return!isFinite(x=+x)||x==0?x:x<0?-asinh(-x):log(x+sqrt(x*x+1))}function expm1(x){return(x=+x)==0?x:x>-1e-6&&x<1e-6?x+x*x/2:exp(x)-1}$define(STATIC,NUMBER,{EPSILON:pow(2,-52),isFinite:function(it){return typeof it=="number"&&isFinite(it)},isInteger:isInteger,isNaN:sameNaN,isSafeInteger:function(number){return isInteger(number)&&abs(number)<=MAX_SAFE_INTEGER},MAX_SAFE_INTEGER:MAX_SAFE_INTEGER,MIN_SAFE_INTEGER:-MAX_SAFE_INTEGER,parseFloat:parseFloat,parseInt:parseInt});$define(STATIC,MATH,{acosh:function(x){return(x=+x)<1?NaN:isFinite(x)?log(x/E+sqrt(x+1)*sqrt(x-1)/E)+1:x},asinh:asinh,atanh:function(x){return(x=+x)==0?x:log((1+x)/(1-x))/2},cbrt:function(x){return sign(x=+x)*pow(abs(x),1/3)},clz32:function(x){return(x>>>=0)?32-x[TO_STRING](2).length:32},cosh:function(x){return(exp(x=+x)+exp(-x))/2},expm1:expm1,fround:function(x){return new Float32Array([x])[0]},hypot:function(value1,value2){var sum=0,len1=arguments.length,len2=len1,args=Array(len1),larg=-Infinity,arg;while(len1--){arg=args[len1]=+arguments[len1];if(arg==Infinity||arg==-Infinity)return Infinity;if(arg>larg)larg=arg}larg=arg||1;while(len2--)sum+=pow(args[len2]/larg,2);return larg*sqrt(sum)},imul:function(x,y){var UInt16=65535,xn=+x,yn=+y,xl=UInt16&xn,yl=UInt16&yn;return 0|xl*yl+((UInt16&xn>>>16)*yl+xl*(UInt16&yn>>>16)<<16>>>0)},log1p:function(x){return(x=+x)>-1e-8&&x<1e-8?x-x*x/2:log(1+x)},log10:function(x){return log(x)/Math.LN10},log2:function(x){return log(x)/Math.LN2},sign:sign,sinh:function(x){return abs(x=+x)<1?(expm1(x)-expm1(-x))/2:(exp(x-1)-exp(-x-1))*(E/2)},tanh:function(x){var a=expm1(x=+x),b=expm1(-x);return a==Infinity?1:b==Infinity?-1:(a-b)/(exp(x)+exp(-x))},trunc:trunc});setToStringTag(Math,MATH,true);function assertNotRegExp(it){if(cof(it)==REGEXP)throw TypeError()}$define(STATIC,STRING,{fromCodePoint:function(x){var res=[],len=arguments.length,i=0,code;while(len>i){code=+arguments[i++];if(toIndex(code,1114111)!==code)throw RangeError(code+" is not a valid code point");res.push(code<65536?fcc(code):fcc(((code-=65536)>>10)+55296,code%1024+56320))}return res.join("")},raw:function(callSite){var raw=toObject(callSite.raw),len=toLength(raw.length),sln=arguments.length,res=[],i=0;while(len>i){res.push(String(raw[i++]));if(i<sln)res.push(String(arguments[i]))}return res.join("")}});$define(PROTO,STRING,{codePointAt:createPointAt(false),endsWith:function(searchString){assertNotRegExp(searchString);var that=String(assertDefined(this)),endPosition=arguments[1],len=toLength(that.length),end=endPosition===undefined?len:min(toLength(endPosition),len);searchString+="";return that.slice(end-searchString.length,end)===searchString},includes:function(searchString){assertNotRegExp(searchString);return!!~String(assertDefined(this)).indexOf(searchString,arguments[1])},repeat:function(count){var str=String(assertDefined(this)),res="",n=toInteger(count);if(0>n||n==Infinity)throw RangeError("Count can't be negative");for(;n>0;(n>>>=1)&&(str+=str))if(n&1)res+=str;return res},startsWith:function(searchString){assertNotRegExp(searchString);var that=String(assertDefined(this)),index=toLength(min(arguments[1],that.length));searchString+="";return that.slice(index,index+searchString.length)===searchString}});defineStdIterators(String,STRING,function(iterated){set(this,ITER,{o:String(iterated),i:0})},function(){var iter=this[ITER],O=iter.o,index=iter.i,point;if(index>=O.length)return iterResult(1);point=at.call(O,index);iter.i+=point.length;return iterResult(0,point)});$define(STATIC,ARRAY,{from:function(arrayLike){var O=Object(assertDefined(arrayLike)),result=new(generic(this,Array)),mapfn=arguments[1],that=arguments[2],mapping=mapfn!==undefined,f=mapping?ctx(mapfn,that,2):undefined,index=0,length;if(isIterable(O))for(var iter=getIterator(O),step;!(step=iter.next()).done;index++){result[index]=mapping?f(step.value,index):step.value}else for(length=toLength(O.length);length>index;index++){result[index]=mapping?f(O[index],index):O[index]}result.length=index;return result},of:function(){var index=0,length=arguments.length,result=new(generic(this,Array))(length);while(length>index)result[index]=arguments[index++];result.length=length;return result}});$define(PROTO,ARRAY,{copyWithin:function(target,start){var O=Object(assertDefined(this)),len=toLength(O.length),to=toIndex(target,len),from=toIndex(start,len),end=arguments[2],fin=end===undefined?len:toIndex(end,len),count=min(fin-from,len-to),inc=1;if(from<to&&to<from+count){inc=-1;from=from+count-1;to=to+count-1}while(count-->0){if(from in O)O[to]=O[from];else delete O[to];to+=inc;from+=inc}return O},fill:function(value){var O=Object(assertDefined(this)),length=toLength(O.length),index=toIndex(arguments[1],length),end=arguments[2],endPos=end===undefined?length:toIndex(end,length);while(endPos>index)O[index++]=value;return O},find:createArrayMethod(5),findIndex:createArrayMethod(6)});defineStdIterators(Array,ARRAY,function(iterated,kind){set(this,ITER,{o:toObject(iterated),i:0,k:kind})},function(){var iter=this[ITER],O=iter.o,kind=iter.k,index=iter.i++;if(!O||index>=O.length)return iter.o=undefined,iterResult(1);if(kind==KEY)return iterResult(0,index);if(kind==VALUE)return iterResult(0,O[index]);return iterResult(0,[index,O[index]])},VALUE);Iterators[ARGUMENTS]=Iterators[ARRAY];setToStringTag(global.JSON,"JSON",true);function wrapObjectMethod(key,MODE){var fn=Object[key],exp=core[OBJECT][key],f=0,o={};if(!exp||isNative(exp)){o[key]=MODE==1?function(it){return isObject(it)?fn(it):it}:MODE==2?function(it){return isObject(it)?fn(it):true}:MODE==3?function(it){return isObject(it)?fn(it):false}:MODE==4?function(it,key){return fn(toObject(it),key)}:function(it){return fn(toObject(it))};try{fn(DOT)}catch(e){f=1}$define(STATIC+FORCED*f,OBJECT,o)}}wrapObjectMethod("freeze",1);wrapObjectMethod("seal",1);wrapObjectMethod("preventExtensions",1);wrapObjectMethod("isFrozen",2);wrapObjectMethod("isSealed",2);wrapObjectMethod("isExtensible",3);wrapObjectMethod("getOwnPropertyDescriptor",4);wrapObjectMethod("getPrototypeOf");wrapObjectMethod("keys");wrapObjectMethod("getOwnPropertyNames");if(framework){tmp[SYMBOL_TAG]=DOT;if(cof(tmp)!=DOT)hidden(ObjectProto,TO_STRING,function(){return"[object "+classof(this)+"]"});NAME in FunctionProto||defineProperty(FunctionProto,NAME,{configurable:true,get:function(){var match=String(this).match(/^\s*function ([^ (]*)/),name=match?match[1]:"";has(this,NAME)||defineProperty(this,NAME,descriptor(5,name));return name},set:function(value){has(this,NAME)||defineProperty(this,NAME,descriptor(0,value))}});if(DESC&&!function(){try{return RegExp(/a/g,"i")=="/a/i"}catch(e){}}()){var _RegExp=RegExp;RegExp=function RegExp(pattern,flags){return new _RegExp(cof(pattern)==REGEXP&&flags!==undefined?pattern.source:pattern,flags)};forEach.call(getNames(_RegExp),function(key){key in RegExp||defineProperty(RegExp,key,{configurable:true,get:function(){return _RegExp[key]},set:function(it){_RegExp[key]=it}})});RegExpProto[CONSTRUCTOR]=RegExp;RegExp[PROTOTYPE]=RegExpProto;hidden(global,REGEXP,RegExp)}if(/./g.flags!="g")defineProperty(RegExpProto,"flags",{configurable:true,get:createReplacer(/^.*\/(\w*)$/,"$1")});forEach.call(array("find,findIndex,fill,copyWithin,entries,keys,values"),function(it){ArrayUnscopables[it]=true});SYMBOL_UNSCOPABLES in ArrayProto||hidden(ArrayProto,SYMBOL_UNSCOPABLES,ArrayUnscopables)}setSpecies(RegExp);setSpecies(Array)}(RegExp[PROTOTYPE],isFinite,{},"name");isFunction(setImmediate)&&isFunction(clearImmediate)||function(ONREADYSTATECHANGE){var postMessage=global.postMessage,addEventListener=global.addEventListener,MessageChannel=global.MessageChannel,counter=0,queue={},defer,channel,port;setImmediate=function(fn){var args=[],i=1;while(arguments.length>i)args.push(arguments[i++]);queue[++counter]=function(){invoke(isFunction(fn)?fn:Function(fn),args)};defer(counter);return counter};clearImmediate=function(id){delete queue[id]};function run(id){if(has(queue,id)){var fn=queue[id];delete queue[id];fn()}}function listner(event){run(event.data)}if(NODE){defer=function(id){nextTick(part.call(run,id))}}else if(addEventListener&&isFunction(postMessage)&&!global.importScripts){defer=function(id){postMessage(id,"*")};addEventListener("message",listner,false)}else if(isFunction(MessageChannel)){channel=new MessageChannel;port=channel.port2;channel.port1.onmessage=listner;defer=ctx(port.postMessage,port,1)}else if(document&&ONREADYSTATECHANGE in document[CREATE_ELEMENT]("script")){defer=function(id){html.appendChild(document[CREATE_ELEMENT]("script"))[ONREADYSTATECHANGE]=function(){html.removeChild(this);run(id)}}}else{defer=function(id){setTimeout(part.call(run,id),0)}}}("onreadystatechange");$define(GLOBAL+BIND,{setImmediate:setImmediate,clearImmediate:clearImmediate});!function(Promise,test){isFunction(Promise)&&isFunction(Promise.resolve)&&Promise.resolve(test=new Promise(function(){}))==test||function(asap,DEF){function isThenable(o){var then;if(isObject(o))then=o.then;return isFunction(then)?then:false}function notify(def){var chain=def.chain;chain.length&&asap(function(){var msg=def.msg,ok=def.state==1,i=0;while(chain.length>i)!function(react){var cb=ok?react.ok:react.fail,ret,then;try{if(cb){ret=cb===true?msg:cb(msg);if(ret===react.P){react.rej(TypeError(PROMISE+"-chain cycle"))}else if(then=isThenable(ret)){then.call(ret,react.res,react.rej)}else react.res(ret)}else react.rej(msg)}catch(err){react.rej(err)}}(chain[i++]);chain.length=0})}function resolve(msg){var def=this,then,wrapper;if(def.done)return;def.done=true;def=def.def||def;try{if(then=isThenable(msg)){wrapper={def:def,done:false};then.call(msg,ctx(resolve,wrapper,1),ctx(reject,wrapper,1))}else{def.msg=msg;def.state=1;notify(def)}}catch(err){reject.call(wrapper||{def:def,done:false},err)}}function reject(msg){var def=this;if(def.done)return;def.done=true;def=def.def||def;def.msg=msg;def.state=2;notify(def)}function getConstructor(C){var S=assertObject(C)[SYMBOL_SPECIES];return S!=undefined?S:C}Promise=function(executor){assertFunction(executor);assertInstance(this,Promise,PROMISE);var def={chain:[],state:0,done:false,msg:undefined};hidden(this,DEF,def);try{executor(ctx(resolve,def,1),ctx(reject,def,1))}catch(err){reject.call(def,err)}};assignHidden(Promise[PROTOTYPE],{then:function(onFulfilled,onRejected){var S=assertObject(assertObject(this)[CONSTRUCTOR])[SYMBOL_SPECIES];var react={ok:isFunction(onFulfilled)?onFulfilled:true,fail:isFunction(onRejected)?onRejected:false},P=react.P=new(S!=undefined?S:Promise)(function(resolve,reject){react.res=assertFunction(resolve);react.rej=assertFunction(reject)}),def=this[DEF];def.chain.push(react);def.state&¬ify(def);return P},"catch":function(onRejected){return this.then(undefined,onRejected)}});assignHidden(Promise,{all:function(iterable){var Promise=getConstructor(this),values=[];return new Promise(function(resolve,reject){forOf(iterable,false,push,values);var remaining=values.length,results=Array(remaining);if(remaining)forEach.call(values,function(promise,index){Promise.resolve(promise).then(function(value){results[index]=value;--remaining||resolve(results)},reject)});else resolve(results)})},race:function(iterable){var Promise=getConstructor(this);return new Promise(function(resolve,reject){forOf(iterable,false,function(promise){Promise.resolve(promise).then(resolve,reject)})})},reject:function(r){return new(getConstructor(this))(function(resolve,reject){reject(r)})},resolve:function(x){return isObject(x)&&DEF in x&&getPrototypeOf(x)===this[PROTOTYPE]?x:new(getConstructor(this))(function(resolve,reject){resolve(x)})}})}(nextTick||setImmediate,safeSymbol("def"));setToStringTag(Promise,PROMISE);setSpecies(Promise);$define(GLOBAL+FORCED*!isNative(Promise),{Promise:Promise})}(global[PROMISE]);!function(){var UID=safeSymbol("uid"),DATA=safeSymbol("data"),WEAK=safeSymbol("weak"),LAST=safeSymbol("last"),FIRST=safeSymbol("first"),SIZE=DESC?safeSymbol("size"):"size",uid=0;function getCollection(C,NAME,methods,commonMethods,isMap,isWeak){var ADDER=isMap?"set":"add",proto=C&&C[PROTOTYPE],O={};function initFromIterable(that,iterable){if(iterable!=undefined)forOf(iterable,isMap,that[ADDER],that);return that}function fixSVZ(key,chain){var method=proto[key];framework&&hidden(proto,key,function(a,b){var result=method.call(this,a===0?0:a,b);return chain?this:result})}if(!isNative(C)||!(isWeak||!BUGGY_ITERATORS&&has(proto,"entries"))){C=isWeak?function(iterable){assertInstance(this,C,NAME);set(this,UID,uid++);initFromIterable(this,iterable)}:function(iterable){var that=this;assertInstance(that,C,NAME);set(that,DATA,create(null));set(that,SIZE,0);set(that,LAST,undefined);set(that,FIRST,undefined);initFromIterable(that,iterable)};assignHidden(assignHidden(C[PROTOTYPE],methods),commonMethods);isWeak||defineProperty(C[PROTOTYPE],"size",{get:function(){return assertDefined(this[SIZE])}})}else{var Native=C,inst=new C,chain=inst[ADDER](isWeak?{}:-0,1),buggyZero;if(!NATIVE_ITERATORS||!C.length){C=function(iterable){assertInstance(this,C,NAME);return initFromIterable(new Native,iterable)};C[PROTOTYPE]=proto}isWeak||inst[FOR_EACH](function(val,key){buggyZero=1/key===-Infinity});if(buggyZero){fixSVZ("delete");fixSVZ("has");isMap&&fixSVZ("get")}if(buggyZero||chain!==inst)fixSVZ(ADDER,true)}setToStringTag(C,NAME);setSpecies(C);O[NAME]=C;$define(GLOBAL+WRAP+FORCED*!isNative(C),O);isWeak||defineStdIterators(C,NAME,function(iterated,kind){set(this,ITER,{o:iterated,k:kind})},function(){var iter=this[ITER],O=iter.o,kind=iter.k,entry=iter.l;while(entry&&entry.r)entry=entry.p;if(!O||!(iter.l=entry=entry?entry.n:O[FIRST]))return iter.o=undefined,iterResult(1);if(kind==KEY)return iterResult(0,entry.k);if(kind==VALUE)return iterResult(0,entry.v);return iterResult(0,[entry.k,entry.v])},isMap?KEY+VALUE:VALUE,!isMap);return C}function fastKey(it,create){if(!isObject(it))return(typeof it=="string"?"S":"P")+it;if(!has(it,UID)){if(create)hidden(it,UID,++uid);else return""}return"O"+it[UID]}function def(that,key,value){var index=fastKey(key,true),data=that[DATA],last=that[LAST],entry;if(index in data)data[index].v=value;else{entry=data[index]={k:key,v:value,p:last};if(!that[FIRST])that[FIRST]=entry;if(last)last.n=entry;that[LAST]=entry;that[SIZE]++}return that}function del(that,index){var data=that[DATA],entry=data[index],next=entry.n,prev=entry.p;delete data[index];entry.r=true;if(prev)prev.n=next;if(next)next.p=prev;if(that[FIRST]==entry)that[FIRST]=next;if(that[LAST]==entry)that[LAST]=prev;that[SIZE]--}var collectionMethods={clear:function(){for(var index in this[DATA])del(this,index)},"delete":function(key){var index=fastKey(key),contains=index in this[DATA];if(contains)del(this,index);return contains},forEach:function(callbackfn){var f=ctx(callbackfn,arguments[1],3),entry;while(entry=entry?entry.n:this[FIRST]){f(entry.v,entry.k,this);while(entry&&entry.r)entry=entry.p}},has:function(key){return fastKey(key)in this[DATA]}};Map=getCollection(Map,MAP,{get:function(key){var entry=this[DATA][fastKey(key)];return entry&&entry.v},set:function(key,value){return def(this,key===0?0:key,value)}},collectionMethods,true);Set=getCollection(Set,SET,{add:function(value){return def(this,value=value===0?0:value,value)}},collectionMethods);function setWeak(that,key,value){has(assertObject(key),WEAK)||hidden(key,WEAK,{});key[WEAK][that[UID]]=value;return that}function hasWeak(key){return isObject(key)&&has(key,WEAK)&&has(key[WEAK],this[UID])}var weakMethods={"delete":function(key){return hasWeak.call(this,key)&&delete key[WEAK][this[UID]]},has:hasWeak};WeakMap=getCollection(WeakMap,WEAKMAP,{get:function(key){if(isObject(key)&&has(key,WEAK))return key[WEAK][this[UID]]},set:function(key,value){return setWeak(this,key,value)}},weakMethods,true,true);WeakSet=getCollection(WeakSet,WEAKSET,{add:function(value){return setWeak(this,value,true)}},weakMethods,false,true)}();!function(){function Enumerate(iterated){var keys=[],key;for(key in iterated)keys.push(key);set(this,ITER,{o:iterated,a:keys,i:0})}createIterator(Enumerate,OBJECT,function(){var iter=this[ITER],keys=iter.a,key;do{if(iter.i>=keys.length)return iterResult(1)}while(!((key=keys[iter.i++])in iter.o));return iterResult(0,key)});function wrap(fn){return function(it){assertObject(it);try{return fn.apply(undefined,arguments),true}catch(e){return false}}}function reflectGet(target,propertyKey){var receiver=arguments.length<3?target:arguments[2],desc=getOwnDescriptor(assertObject(target),propertyKey),proto;if(desc)return desc.get?desc.get.call(receiver):desc.value;return isObject(proto=getPrototypeOf(target))?reflectGet(proto,propertyKey,receiver):undefined}function reflectSet(target,propertyKey,V){var receiver=arguments.length<4?target:arguments[3],desc=getOwnDescriptor(assertObject(target),propertyKey),proto;if(desc){if(desc.writable===false)return false;if(desc.set)return desc.set.call(receiver,V),true}if(isObject(proto=getPrototypeOf(target)))return reflectSet(proto,propertyKey,V,receiver);desc=getOwnDescriptor(receiver,propertyKey)||descriptor(0);desc.value=V;return defineProperty(receiver,propertyKey,desc),true}var isExtensible=Object.isExtensible||returnIt;var reflect={apply:ctx(call,apply,3),construct:construct,defineProperty:wrap(defineProperty),deleteProperty:function(target,propertyKey){var desc=getOwnDescriptor(assertObject(target),propertyKey);return desc&&!desc.configurable?false:delete target[propertyKey]},enumerate:function(target){return new Enumerate(assertObject(target))},get:reflectGet,getOwnPropertyDescriptor:function(target,propertyKey){return getOwnDescriptor(assertObject(target),propertyKey)},getPrototypeOf:function(target){return getPrototypeOf(assertObject(target))},has:function(target,propertyKey){return propertyKey in target},isExtensible:function(target){return!!isExtensible(assertObject(target))},ownKeys:ownKeys,preventExtensions:wrap(Object.preventExtensions||returnIt),set:reflectSet};if(setPrototypeOf)reflect.setPrototypeOf=function(target,proto){return setPrototypeOf(assertObject(target),proto),true};$define(GLOBAL,{Reflect:{}});$define(STATIC,"Reflect",reflect)}();!function(){$define(PROTO,ARRAY,{includes:createArrayContains(true)});$define(PROTO,STRING,{at:createPointAt(true)});function createObjectToArray(isEntries){return function(object){var O=toObject(object),keys=getKeys(object),length=keys.length,i=0,result=Array(length),key;if(isEntries)while(length>i)result[i]=[key=keys[i++],O[key]];else while(length>i)result[i]=O[keys[i++]];return result}}$define(STATIC,OBJECT,{values:createObjectToArray(false),entries:createObjectToArray(true)});$define(STATIC,REGEXP,{escape:createReplacer(/([\\\-[\]{}()*+?.,^$|])/g,"\\$1",true)})}();!function(REFERENCE){REFERENCE_GET=getWellKnownSymbol(REFERENCE+"Get",true);var REFERENCE_SET=getWellKnownSymbol(REFERENCE+SET,true),REFERENCE_DELETE=getWellKnownSymbol(REFERENCE+"Delete",true);$define(STATIC,SYMBOL,{referenceGet:REFERENCE_GET,referenceSet:REFERENCE_SET,referenceDelete:REFERENCE_DELETE});hidden(FunctionProto,REFERENCE_GET,returnThis);function setMapMethods(Constructor){if(Constructor){var MapProto=Constructor[PROTOTYPE];hidden(MapProto,REFERENCE_GET,MapProto.get);hidden(MapProto,REFERENCE_SET,MapProto.set);hidden(MapProto,REFERENCE_DELETE,MapProto["delete"])}}setMapMethods(Map);setMapMethods(WeakMap)}("reference");!function(NodeList){if(framework&&NodeList&&!(SYMBOL_ITERATOR in NodeList[PROTOTYPE])){hidden(NodeList[PROTOTYPE],SYMBOL_ITERATOR,Iterators[ARRAY])}Iterators.NodeList=Iterators[ARRAY]}(global.NodeList);!function(DICT){Dict=function(iterable){var dict=create(null);if(iterable!=undefined){if(isIterable(iterable)){for(var iter=getIterator(iterable),step,value;!(step=iter.next()).done;){value=step.value;dict[value[0]]=value[1]}}else assign(dict,iterable)}return dict};Dict[PROTOTYPE]=null;function DictIterator(iterated,kind){set(this,ITER,{o:toObject(iterated),a:getKeys(iterated),i:0,k:kind})}createIterator(DictIterator,DICT,function(){var iter=this[ITER],O=iter.o,keys=iter.a,kind=iter.k,key;do{if(iter.i>=keys.length)return iterResult(1)}while(!has(O,key=keys[iter.i++]));if(kind==KEY)return iterResult(0,key);if(kind==VALUE)return iterResult(0,O[key]);return iterResult(0,[key,O[key]])});function createDictIter(kind){return function(it){return new DictIterator(it,kind)}}function createDictMethod(type){var isMap=type==1,isEvery=type==4;return function(object,callbackfn,that){var f=ctx(callbackfn,that,3),O=toObject(object),result=isMap||type==7||type==2?new(generic(this,Dict)):undefined,key,val,res;for(key in O)if(has(O,key)){val=O[key];res=f(val,key,object);if(type){if(isMap)result[key]=res;else if(res)switch(type){case 2:result[key]=val;break;case 3:return true;case 5:return val;case 6:return key;case 7:result[res[0]]=res[1]}else if(isEvery)return false}}return type==3||isEvery?isEvery:result}}function createDictReduce(isTurn){return function(object,mapfn,init){assertFunction(mapfn);var O=toObject(object),keys=getKeys(O),length=keys.length,i=0,memo,key,result;if(isTurn)memo=init==undefined?new(generic(this,Dict)):Object(init);else if(arguments.length<3){assert(length,REDUCE_ERROR);memo=O[keys[i++]]}else memo=Object(init);while(length>i)if(has(O,key=keys[i++])){result=mapfn(memo,O[key],key,object);if(isTurn){if(result===false)break}else memo=result}return memo}}var findKey=createDictMethod(6);function includes(object,el){return(el==el?keyOf(object,el):findKey(object,sameNaN))!==undefined}var dictMethods={keys:createDictIter(KEY),values:createDictIter(VALUE),entries:createDictIter(KEY+VALUE),forEach:createDictMethod(0),map:createDictMethod(1),filter:createDictMethod(2),some:createDictMethod(3),every:createDictMethod(4),find:createDictMethod(5),findKey:findKey,mapPairs:createDictMethod(7),reduce:createDictReduce(false),turn:createDictReduce(true),keyOf:keyOf,includes:includes,has:has,get:get,set:createDefiner(0),isDict:function(it){return isObject(it)&&getPrototypeOf(it)===Dict[PROTOTYPE]}};if(REFERENCE_GET)for(var key in dictMethods)!function(fn){function method(){for(var args=[this],i=0;i<arguments.length;)args.push(arguments[i++]);return invoke(fn,args)}fn[REFERENCE_GET]=function(){return method}}(dictMethods[key]);$define(GLOBAL+FORCED,{Dict:assignHidden(Dict,dictMethods)})}("Dict");!function(ENTRIES,FN){function $for(iterable,entries){if(!(this instanceof $for))return new $for(iterable,entries);this[ITER]=getIterator(iterable);this[ENTRIES]=!!entries}createIterator($for,"Wrapper",function(){return this[ITER].next()});var $forProto=$for[PROTOTYPE];setIterator($forProto,function(){return this[ITER]});function createChainIterator(next){function Iter(I,fn,that){this[ITER]=getIterator(I);this[ENTRIES]=I[ENTRIES];this[FN]=ctx(fn,that,I[ENTRIES]?2:1)}createIterator(Iter,"Chain",next,$forProto);setIterator(Iter[PROTOTYPE],returnThis);return Iter}var MapIter=createChainIterator(function(){var step=this[ITER].next();return step.done?step:iterResult(0,stepCall(this[FN],step.value,this[ENTRIES]))});var FilterIter=createChainIterator(function(){for(;;){var step=this[ITER].next();if(step.done||stepCall(this[FN],step.value,this[ENTRIES]))return step}});assignHidden($forProto,{of:function(fn,that){forOf(this,this[ENTRIES],fn,that)},array:function(fn,that){var result=[];forOf(fn!=undefined?this.map(fn,that):this,false,push,result);
return result},filter:function(fn,that){return new FilterIter(this,fn,that)},map:function(fn,that){return new MapIter(this,fn,that)}});$for.isIterable=isIterable;$for.getIterator=getIterator;$define(GLOBAL+FORCED,{$for:$for})}("entries",safeSymbol("fn"));!function(_,toLocaleString){core._=path._=path._||{};$define(PROTO+FORCED,FUNCTION,{part:part,only:function(numberArguments,that){var fn=assertFunction(this),n=toLength(numberArguments),isThat=arguments.length>1;return function(){var length=min(n,arguments.length),args=Array(length),i=0;while(length>i)args[i]=arguments[i++];return invoke(fn,args,isThat?that:this)}}});function tie(key){var that=this,bound={};return hidden(that,_,function(key){if(key===undefined||!(key in that))return toLocaleString.call(that);return has(bound,key)?bound[key]:bound[key]=ctx(that[key],that,-1)})[_](key)}hidden(path._,TO_STRING,function(){return _});hidden(ObjectProto,_,tie);DESC||hidden(ArrayProto,_,tie)}(DESC?uid("tie"):TO_LOCALE,ObjectProto[TO_LOCALE]);!function(){function define(target,mixin){var keys=ownKeys(toObject(mixin)),length=keys.length,i=0,key;while(length>i)defineProperty(target,key=keys[i++],getOwnDescriptor(mixin,key));return target}$define(STATIC+FORCED,OBJECT,{isObject:isObject,classof:classof,define:define,make:function(proto,mixin){return define(create(proto),mixin)}})}();$define(PROTO+FORCED,ARRAY,{turn:function(fn,target){assertFunction(fn);var memo=target==undefined?[]:Object(target),O=ES5Object(this),length=toLength(O.length),index=0;while(length>index)if(fn(memo,O[index],index++,this)===false)break;return memo}});if(framework)ArrayUnscopables.turn=true;!function(arrayStatics){function setArrayStatics(keys,length){forEach.call(array(keys),function(key){if(key in ArrayProto)arrayStatics[key]=ctx(call,ArrayProto[key],length)})}setArrayStatics("pop,reverse,shift,keys,values,entries",1);setArrayStatics("indexOf,every,some,forEach,map,filter,find,findIndex,includes",3);setArrayStatics("join,slice,concat,push,splice,unshift,sort,lastIndexOf,"+"reduce,reduceRight,copyWithin,fill,turn");$define(STATIC,ARRAY,arrayStatics)}({});!function(numberMethods){function NumberIterator(iterated){set(this,ITER,{l:toLength(iterated),i:0})}createIterator(NumberIterator,NUMBER,function(){var iter=this[ITER],i=iter.i++;return i<iter.l?iterResult(0,i):iterResult(1)});defineIterator(Number,NUMBER,function(){return new NumberIterator(this)});numberMethods.random=function(lim){var a=+this,b=lim==undefined?0:+lim,m=min(a,b);return random()*(max(a,b)-m)+m};forEach.call(array("round,floor,ceil,abs,sin,asin,cos,acos,tan,atan,exp,sqrt,max,min,pow,atan2,"+"acosh,asinh,atanh,cbrt,clz32,cosh,expm1,hypot,imul,log1p,log10,log2,sign,sinh,tanh,trunc"),function(key){var fn=Math[key];if(fn)numberMethods[key]=function(){var args=[+this],i=0;while(arguments.length>i)args.push(arguments[i++]);return invoke(fn,args)}});$define(PROTO+FORCED,NUMBER,numberMethods)}({});!function(){var escapeHTMLDict={"&":"&","<":"<",">":">",'"':""","'":"'"},unescapeHTMLDict={},key;for(key in escapeHTMLDict)unescapeHTMLDict[escapeHTMLDict[key]]=key;$define(PROTO+FORCED,STRING,{escapeHTML:createReplacer(/[&<>"']/g,escapeHTMLDict),unescapeHTML:createReplacer(/&(?:amp|lt|gt|quot|apos);/g,unescapeHTMLDict)})}();!function(formatRegExp,flexioRegExp,locales,current,SECONDS,MINUTES,HOURS,MONTH,YEAR){function createFormat(prefix){return function(template,locale){var that=this,dict=locales[has(locales,locale)?locale:current];function get(unit){return that[prefix+unit]()}return String(template).replace(formatRegExp,function(part){switch(part){case"s":return get(SECONDS);case"ss":return lz(get(SECONDS));case"m":return get(MINUTES);case"mm":return lz(get(MINUTES));case"h":return get(HOURS);case"hh":return lz(get(HOURS));case"D":return get(DATE);case"DD":return lz(get(DATE));case"W":return dict[0][get("Day")];case"N":return get(MONTH)+1;case"NN":return lz(get(MONTH)+1);case"M":return dict[2][get(MONTH)];case"MM":return dict[1][get(MONTH)];case"Y":return get(YEAR);case"YY":return lz(get(YEAR)%100)}return part})}}function lz(num){return num>9?num:"0"+num}function addLocale(lang,locale){function split(index){var result=[];forEach.call(array(locale.months),function(it){result.push(it.replace(flexioRegExp,"$"+index))});return result}locales[lang]=[array(locale.weekdays),split(1),split(2)];return core}$define(PROTO+FORCED,DATE,{format:createFormat("get"),formatUTC:createFormat("getUTC")});addLocale(current,{weekdays:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday",months:"January,February,March,April,May,June,July,August,September,October,November,December"});addLocale("ru",{weekdays:"Воскресенье,Понедельник,Вторник,Среда,Четверг,Пятница,Суббота",months:"Январ:я|ь,Феврал:я|ь,Март:а|,Апрел:я|ь,Ма:я|й,Июн:я|ь,"+"Июл:я|ь,Август:а|,Сентябр:я|ь,Октябр:я|ь,Ноябр:я|ь,Декабр:я|ь"});core.locale=function(locale){return has(locales,locale)?current=locale:current};core.addLocale=addLocale}(/\b\w\w?\b/g,/:(.*)\|(.*)$/,{},"en","Seconds","Minutes","Hours","Month","FullYear")}(typeof self!="undefined"&&self.Math===Math?self:Function("return this")(),false)},{}],155:[function(require,module,exports){"use strict";var repeating=require("repeating");var INDENT_RE=/^(?:( )+|\t+)/;function getMostUsed(indents){var result=0;var maxUsed=0;var maxWeight=0;for(var n in indents){var indent=indents[n];var u=indent[0];var w=indent[1];if(u>maxUsed||u===maxUsed&&w>maxWeight){maxUsed=u;maxWeight=w;result=+n}}return result}module.exports=function(str){if(typeof str!=="string"){throw new TypeError("Expected a string")}var tabs=0;var spaces=0;var prev=0;var indents={};var current;var isIndent;str.split(/\n/g).forEach(function(line){if(!line){return}var indent;var matches=line.match(INDENT_RE);if(!matches){indent=0}else{indent=matches[0].length;if(matches[1]){spaces++}else{tabs++}}var diff=indent-prev;prev=indent;if(diff){isIndent=diff>0;current=indents[isIndent?diff:-diff];if(current){current[0]++}else{current=indents[diff]=[1,0]}}else if(current){current[1]+=+isIndent}});var amount=getMostUsed(indents);var type;var actual;if(!amount){type=null;actual=""}else if(spaces>=tabs){type="space";actual=repeating(" ",amount)}else{type="tab";actual=repeating(" ",amount)}return{amount:amount,type:type,indent:actual}}},{repeating:156}],156:[function(require,module,exports){"use strict";var isFinite=require("is-finite");module.exports=function(str,n){if(typeof str!=="string"){throw new TypeError("Expected a string as the first argument")}if(n<0||!isFinite(n)){throw new TypeError("Expected a finite positive number")}var ret="";do{if(n&1){ret+=str}str+=str}while(n=n>>1);return ret}},{"is-finite":157}],157:[function(require,module,exports){"use strict";module.exports=Number.isFinite||function(val){if(typeof val!=="number"||val!==val||val===Infinity||val===-Infinity){return false}return true}},{}],158:[function(require,module,exports){(function(root,factory){"use strict";if(typeof define==="function"&&define.amd){define(["exports"],factory)}else if(typeof exports!=="undefined"){factory(exports)}else{factory(root.estraverse={})}})(this,function clone(exports){"use strict";var Syntax,isArray,VisitorOption,VisitorKeys,objectCreate,objectKeys,BREAK,SKIP,REMOVE;function ignoreJSHintError(){}isArray=Array.isArray;if(!isArray){isArray=function isArray(array){return Object.prototype.toString.call(array)==="[object Array]"}}function deepCopy(obj){var ret={},key,val;for(key in obj){if(obj.hasOwnProperty(key)){val=obj[key];if(typeof val==="object"&&val!==null){ret[key]=deepCopy(val)}else{ret[key]=val}}}return ret}function shallowCopy(obj){var ret={},key;for(key in obj){if(obj.hasOwnProperty(key)){ret[key]=obj[key]}}return ret}ignoreJSHintError(shallowCopy);function upperBound(array,func){var diff,len,i,current;len=array.length;i=0;while(len){diff=len>>>1;current=i+diff;if(func(array[current])){len=diff}else{i=current+1;len-=diff+1}}return i}function lowerBound(array,func){var diff,len,i,current;len=array.length;i=0;while(len){diff=len>>>1;current=i+diff;if(func(array[current])){i=current+1;len-=diff+1}else{len=diff}}return i}ignoreJSHintError(lowerBound);objectCreate=Object.create||function(){function F(){}return function(o){F.prototype=o;return new F}}();objectKeys=Object.keys||function(o){var keys=[],key;for(key in o){keys.push(key)}return keys};function extend(to,from){objectKeys(from).forEach(function(key){to[key]=from[key]});return to}Syntax={AssignmentExpression:"AssignmentExpression",ArrayExpression:"ArrayExpression",ArrayPattern:"ArrayPattern",ArrowFunctionExpression:"ArrowFunctionExpression",AwaitExpression:"AwaitExpression",BlockStatement:"BlockStatement",BinaryExpression:"BinaryExpression",BreakStatement:"BreakStatement",CallExpression:"CallExpression",CatchClause:"CatchClause",ClassBody:"ClassBody",ClassDeclaration:"ClassDeclaration",ClassExpression:"ClassExpression",ComprehensionBlock:"ComprehensionBlock",ComprehensionExpression:"ComprehensionExpression",ConditionalExpression:"ConditionalExpression",ContinueStatement:"ContinueStatement",DebuggerStatement:"DebuggerStatement",DirectiveStatement:"DirectiveStatement",DoWhileStatement:"DoWhileStatement",EmptyStatement:"EmptyStatement",ExportBatchSpecifier:"ExportBatchSpecifier",ExportDeclaration:"ExportDeclaration",ExportSpecifier:"ExportSpecifier",ExpressionStatement:"ExpressionStatement",ForStatement:"ForStatement",ForInStatement:"ForInStatement",ForOfStatement:"ForOfStatement",FunctionDeclaration:"FunctionDeclaration",FunctionExpression:"FunctionExpression",GeneratorExpression:"GeneratorExpression",Identifier:"Identifier",IfStatement:"IfStatement",ImportDeclaration:"ImportDeclaration",ImportDefaultSpecifier:"ImportDefaultSpecifier",ImportNamespaceSpecifier:"ImportNamespaceSpecifier",ImportSpecifier:"ImportSpecifier",Literal:"Literal",LabeledStatement:"LabeledStatement",LogicalExpression:"LogicalExpression",MemberExpression:"MemberExpression",MethodDefinition:"MethodDefinition",ModuleSpecifier:"ModuleSpecifier",NewExpression:"NewExpression",ObjectExpression:"ObjectExpression",ObjectPattern:"ObjectPattern",Program:"Program",Property:"Property",ReturnStatement:"ReturnStatement",SequenceExpression:"SequenceExpression",SpreadElement:"SpreadElement",SwitchStatement:"SwitchStatement",SwitchCase:"SwitchCase",TaggedTemplateExpression:"TaggedTemplateExpression",TemplateElement:"TemplateElement",TemplateLiteral:"TemplateLiteral",ThisExpression:"ThisExpression",ThrowStatement:"ThrowStatement",TryStatement:"TryStatement",UnaryExpression:"UnaryExpression",UpdateExpression:"UpdateExpression",VariableDeclaration:"VariableDeclaration",VariableDeclarator:"VariableDeclarator",WhileStatement:"WhileStatement",WithStatement:"WithStatement",YieldExpression:"YieldExpression"};VisitorKeys={AssignmentExpression:["left","right"],ArrayExpression:["elements"],ArrayPattern:["elements"],ArrowFunctionExpression:["params","defaults","rest","body"],AwaitExpression:["argument"],BlockStatement:["body"],BinaryExpression:["left","right"],BreakStatement:["label"],CallExpression:["callee","arguments"],CatchClause:["param","body"],ClassBody:["body"],ClassDeclaration:["id","body","superClass"],ClassExpression:["id","body","superClass"],ComprehensionBlock:["left","right"],ComprehensionExpression:["blocks","filter","body"],ConditionalExpression:["test","consequent","alternate"],ContinueStatement:["label"],DebuggerStatement:[],DirectiveStatement:[],DoWhileStatement:["body","test"],EmptyStatement:[],ExportBatchSpecifier:[],ExportDeclaration:["declaration","specifiers","source"],ExportSpecifier:["id","name"],ExpressionStatement:["expression"],ForStatement:["init","test","update","body"],ForInStatement:["left","right","body"],ForOfStatement:["left","right","body"],FunctionDeclaration:["id","params","defaults","rest","body"],FunctionExpression:["id","params","defaults","rest","body"],GeneratorExpression:["blocks","filter","body"],Identifier:[],IfStatement:["test","consequent","alternate"],ImportDeclaration:["specifiers","source"],ImportDefaultSpecifier:["id"],ImportNamespaceSpecifier:["id"],ImportSpecifier:["id","name"],Literal:[],LabeledStatement:["label","body"],LogicalExpression:["left","right"],MemberExpression:["object","property"],MethodDefinition:["key","value"],ModuleSpecifier:[],NewExpression:["callee","arguments"],ObjectExpression:["properties"],ObjectPattern:["properties"],Program:["body"],Property:["key","value"],ReturnStatement:["argument"],SequenceExpression:["expressions"],SpreadElement:["argument"],SwitchStatement:["discriminant","cases"],SwitchCase:["test","consequent"],TaggedTemplateExpression:["tag","quasi"],TemplateElement:[],TemplateLiteral:["quasis","expressions"],ThisExpression:[],ThrowStatement:["argument"],TryStatement:["block","handlers","handler","guardedHandlers","finalizer"],UnaryExpression:["argument"],UpdateExpression:["argument"],VariableDeclaration:["declarations"],VariableDeclarator:["id","init"],WhileStatement:["test","body"],WithStatement:["object","body"],YieldExpression:["argument"]};BREAK={};SKIP={};REMOVE={};VisitorOption={Break:BREAK,Skip:SKIP,Remove:REMOVE};function Reference(parent,key){this.parent=parent;this.key=key}Reference.prototype.replace=function replace(node){this.parent[this.key]=node};Reference.prototype.remove=function remove(){if(isArray(this.parent)){this.parent.splice(this.key,1);return true}else{this.replace(null);return false}};function Element(node,path,wrap,ref){this.node=node;this.path=path;this.wrap=wrap;this.ref=ref}function Controller(){}Controller.prototype.path=function path(){var i,iz,j,jz,result,element;function addToPath(result,path){if(isArray(path)){for(j=0,jz=path.length;j<jz;++j){result.push(path[j])}}else{result.push(path)}}if(!this.__current.path){return null}result=[];for(i=2,iz=this.__leavelist.length;i<iz;++i){element=this.__leavelist[i];addToPath(result,element.path)}addToPath(result,this.__current.path);return result};Controller.prototype.type=function(){var node=this.current();return node.type||this.__current.wrap};Controller.prototype.parents=function parents(){var i,iz,result;result=[];for(i=1,iz=this.__leavelist.length;i<iz;++i){result.push(this.__leavelist[i].node)}return result};Controller.prototype.current=function current(){return this.__current.node};Controller.prototype.__execute=function __execute(callback,element){var previous,result;result=undefined;previous=this.__current;this.__current=element;this.__state=null;if(callback){result=callback.call(this,element.node,this.__leavelist[this.__leavelist.length-1].node)}this.__current=previous;return result};Controller.prototype.notify=function notify(flag){this.__state=flag};Controller.prototype.skip=function(){this.notify(SKIP)};Controller.prototype["break"]=function(){this.notify(BREAK)};Controller.prototype.remove=function(){this.notify(REMOVE)};Controller.prototype.__initialize=function(root,visitor){this.visitor=visitor;this.root=root;this.__worklist=[];this.__leavelist=[];this.__current=null;this.__state=null;this.__fallback=visitor.fallback==="iteration";this.__keys=VisitorKeys;if(visitor.keys){this.__keys=extend(objectCreate(this.__keys),visitor.keys)}};function isNode(node){if(node==null){return false}return typeof node==="object"&&typeof node.type==="string"}function isProperty(nodeType,key){return(nodeType===Syntax.ObjectExpression||nodeType===Syntax.ObjectPattern)&&"properties"===key}Controller.prototype.traverse=function traverse(root,visitor){var worklist,leavelist,element,node,nodeType,ret,key,current,current2,candidates,candidate,sentinel;this.__initialize(root,visitor);sentinel={};worklist=this.__worklist;leavelist=this.__leavelist;worklist.push(new Element(root,null,null,null));leavelist.push(new Element(null,null,null,null));while(worklist.length){element=worklist.pop();if(element===sentinel){element=leavelist.pop();ret=this.__execute(visitor.leave,element);if(this.__state===BREAK||ret===BREAK){return}continue}if(element.node){ret=this.__execute(visitor.enter,element);if(this.__state===BREAK||ret===BREAK){return}worklist.push(sentinel);leavelist.push(element);if(this.__state===SKIP||ret===SKIP){continue}node=element.node;nodeType=element.wrap||node.type;candidates=this.__keys[nodeType];if(!candidates){if(this.__fallback){candidates=objectKeys(node)}else{throw new Error("Unknown node type "+nodeType+".")}}current=candidates.length;while((current-=1)>=0){key=candidates[current];candidate=node[key];if(!candidate){continue}if(isArray(candidate)){current2=candidate.length;while((current2-=1)>=0){if(!candidate[current2]){continue}if(isProperty(nodeType,candidates[current])){element=new Element(candidate[current2],[key,current2],"Property",null)}else if(isNode(candidate[current2])){element=new Element(candidate[current2],[key,current2],null,null)}else{continue}worklist.push(element)}}else if(isNode(candidate)){worklist.push(new Element(candidate,key,null,null))}}}}};Controller.prototype.replace=function replace(root,visitor){function removeElem(element){var i,key,nextElem,parent;if(element.ref.remove()){key=element.ref.key;parent=element.ref.parent;i=worklist.length;while(i--){nextElem=worklist[i];if(nextElem.ref&&nextElem.ref.parent===parent){if(nextElem.ref.key<key){break}--nextElem.ref.key}}}}var worklist,leavelist,node,nodeType,target,element,current,current2,candidates,candidate,sentinel,outer,key;this.__initialize(root,visitor);sentinel={};worklist=this.__worklist;leavelist=this.__leavelist;outer={root:root};element=new Element(root,null,null,new Reference(outer,"root"));worklist.push(element);leavelist.push(element);while(worklist.length){element=worklist.pop();if(element===sentinel){element=leavelist.pop();target=this.__execute(visitor.leave,element);if(target!==undefined&&target!==BREAK&&target!==SKIP&&target!==REMOVE){element.ref.replace(target)}if(this.__state===REMOVE||target===REMOVE){removeElem(element)}if(this.__state===BREAK||target===BREAK){return outer.root}continue}target=this.__execute(visitor.enter,element);if(target!==undefined&&target!==BREAK&&target!==SKIP&&target!==REMOVE){element.ref.replace(target);element.node=target}if(this.__state===REMOVE||target===REMOVE){removeElem(element);element.node=null}if(this.__state===BREAK||target===BREAK){return outer.root}node=element.node;if(!node){continue}worklist.push(sentinel);leavelist.push(element);if(this.__state===SKIP||target===SKIP){continue}nodeType=element.wrap||node.type;candidates=this.__keys[nodeType];if(!candidates){if(this.__fallback){candidates=objectKeys(node)}else{throw new Error("Unknown node type "+nodeType+".")}}current=candidates.length;while((current-=1)>=0){key=candidates[current];candidate=node[key];if(!candidate){continue}if(isArray(candidate)){current2=candidate.length;while((current2-=1)>=0){if(!candidate[current2]){continue}if(isProperty(nodeType,candidates[current])){element=new Element(candidate[current2],[key,current2],"Property",new Reference(candidate,current2))}else if(isNode(candidate[current2])){element=new Element(candidate[current2],[key,current2],null,new Reference(candidate,current2))}else{continue}worklist.push(element)}}else if(isNode(candidate)){worklist.push(new Element(candidate,key,null,new Reference(node,key)))}}}return outer.root};function traverse(root,visitor){var controller=new Controller;return controller.traverse(root,visitor)}function replace(root,visitor){var controller=new Controller;return controller.replace(root,visitor)}function extendCommentRange(comment,tokens){var target;target=upperBound(tokens,function search(token){return token.range[0]>comment.range[0]});comment.extendedRange=[comment.range[0],comment.range[1]];if(target!==tokens.length){comment.extendedRange[1]=tokens[target].range[0]}target-=1;if(target>=0){comment.extendedRange[0]=tokens[target].range[1]}return comment}function attachComments(tree,providedComments,tokens){var comments=[],comment,len,i,cursor;if(!tree.range){throw new Error("attachComments needs range information")}if(!tokens.length){if(providedComments.length){for(i=0,len=providedComments.length;i<len;i+=1){comment=deepCopy(providedComments[i]);comment.extendedRange=[0,tree.range[0]];comments.push(comment)}tree.leadingComments=comments}return tree}for(i=0,len=providedComments.length;i<len;i+=1){comments.push(extendCommentRange(deepCopy(providedComments[i]),tokens))}cursor=0;traverse(tree,{enter:function(node){var comment;while(cursor<comments.length){comment=comments[cursor];if(comment.extendedRange[1]>node.range[0]){break}if(comment.extendedRange[1]===node.range[0]){if(!node.leadingComments){node.leadingComments=[]}node.leadingComments.push(comment);comments.splice(cursor,1)}else{cursor+=1}}if(cursor===comments.length){return VisitorOption.Break}if(comments[cursor].extendedRange[0]>node.range[1]){return VisitorOption.Skip}}});cursor=0;traverse(tree,{leave:function(node){var comment;while(cursor<comments.length){comment=comments[cursor];if(node.range[1]<comment.extendedRange[0]){break}if(node.range[1]===comment.extendedRange[0]){if(!node.trailingComments){node.trailingComments=[]}node.trailingComments.push(comment);comments.splice(cursor,1)}else{cursor+=1}}if(cursor===comments.length){return VisitorOption.Break}if(comments[cursor].extendedRange[0]>node.range[1]){return VisitorOption.Skip}}});return tree}exports.version="1.8.1-dev";exports.Syntax=Syntax;exports.traverse=traverse;exports.replace=replace;exports.attachComments=attachComments;exports.VisitorKeys=VisitorKeys;exports.VisitorOption=VisitorOption;exports.Controller=Controller;exports.cloneEnvironment=function(){return clone({})};return exports})},{}],159:[function(require,module,exports){(function(){"use strict";function isExpression(node){if(node==null){return false}switch(node.type){case"ArrayExpression":case"AssignmentExpression":case"BinaryExpression":case"CallExpression":case"ConditionalExpression":case"FunctionExpression":case"Identifier":case"Literal":case"LogicalExpression":case"MemberExpression":case"NewExpression":case"ObjectExpression":case"SequenceExpression":case"ThisExpression":case"UnaryExpression":case"UpdateExpression":return true}return false}function isIterationStatement(node){if(node==null){return false}switch(node.type){case"DoWhileStatement":case"ForInStatement":case"ForStatement":case"WhileStatement":return true}return false}function isStatement(node){if(node==null){return false}switch(node.type){case"BlockStatement":case"BreakStatement":case"ContinueStatement":case"DebuggerStatement":case"DoWhileStatement":case"EmptyStatement":case"ExpressionStatement":case"ForInStatement":case"ForStatement":case"IfStatement":case"LabeledStatement":case"ReturnStatement":case"SwitchStatement":case"ThrowStatement":case"TryStatement":case"VariableDeclaration":case"WhileStatement":case"WithStatement":return true}return false}function isSourceElement(node){return isStatement(node)||node!=null&&node.type==="FunctionDeclaration"}function trailingStatement(node){switch(node.type){case"IfStatement":if(node.alternate!=null){return node.alternate}return node.consequent;case"LabeledStatement":case"ForStatement":case"ForInStatement":case"WhileStatement":case"WithStatement":return node.body}return null}function isProblematicIfStatement(node){var current;if(node.type!=="IfStatement"){return false}if(node.alternate==null){return false}current=node.consequent;do{if(current.type==="IfStatement"){if(current.alternate==null){return true}}current=trailingStatement(current)}while(current);return false}module.exports={isExpression:isExpression,isStatement:isStatement,isIterationStatement:isIterationStatement,isSourceElement:isSourceElement,isProblematicIfStatement:isProblematicIfStatement,trailingStatement:trailingStatement}})()},{}],160:[function(require,module,exports){(function(){"use strict";var Regex,NON_ASCII_WHITESPACES;Regex={NonAsciiIdentifierStart:new RegExp("[ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԧԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠࢢ-ࢬऄ-हऽॐक़-ॡॱ-ॷॹ-ॿঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-ళవ-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛰᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤜᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々-〇〡-〩〱-〵〸-〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚗꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꪀ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ]"),NonAsciiIdentifierPart:new RegExp("[ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮ̀-ʹͶͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁ҃-҇Ҋ-ԧԱ-Ֆՙա-և֑-ׇֽֿׁׂׅׄא-תװ-ײؐ-ؚؠ-٩ٮ-ۓە-ۜ۟-۪ۨ-ۼۿܐ-݊ݍ-ޱ߀-ߵߺࠀ-࠭ࡀ-࡛ࢠࢢ-ࢬࣤ-ࣾऀ-ॣ०-९ॱ-ॷॹ-ॿঁ-ঃঅ-ঌএঐও-নপ-রলশ-হ়-ৄেৈো-ৎৗড়ঢ়য়-ৣ০-ৱਁ-ਃਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹ਼ਾ-ੂੇੈੋ-੍ੑਖ਼-ੜਫ਼੦-ੵઁ-ઃઅ-ઍએ-ઑઓ-નપ-રલળવ-હ઼-ૅે-ૉો-્ૐૠ-ૣ૦-૯ଁ-ଃଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହ଼-ୄେୈୋ-୍ୖୗଡ଼ଢ଼ୟ-ୣ୦-୯ୱஂஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹா-ூெ-ைொ-்ௐௗ௦-௯ఁ-ఃఅ-ఌఎ-ఐఒ-నప-ళవ-హఽ-ౄె-ైొ-్ౕౖౘౙౠ-ౣ౦-౯ಂಃಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹ಼-ೄೆ-ೈೊ-್ೕೖೞೠ-ೣ೦-೯ೱೲംഃഅ-ഌഎ-ഐഒ-ഺഽ-ൄെ-ൈൊ-ൎൗൠ-ൣ൦-൯ൺ-ൿංඃඅ-ඖක-නඳ-රලව-ෆ්ා-ුූෘ-ෟෲෳก-ฺเ-๎๐-๙ກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ູົ-ຽເ-ໄໆ່-ໍ໐-໙ໜ-ໟༀ༘༙༠-༩༹༵༷༾-ཇཉ-ཬཱ-྄྆-ྗྙ-ྼ࿆က-၉ၐ-ႝႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚ፝-፟ᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛰᜀ-ᜌᜎ-᜔ᜠ-᜴ᝀ-ᝓᝠ-ᝬᝮ-ᝰᝲᝳក-៓ៗៜ៝០-៩᠋-᠍᠐-᠙ᠠ-ᡷᢀ-ᢪᢰ-ᣵᤀ-ᤜᤠ-ᤫᤰ-᤻᥆-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉ᧐-᧙ᨀ-ᨛᨠ-ᩞ᩠-᩿᩼-᪉᪐-᪙ᪧᬀ-ᭋ᭐-᭙᭫-᭳ᮀ-᯳ᰀ-᰷᱀-᱉ᱍ-ᱽ᳐-᳔᳒-ᳶᴀ-ᷦ᷼-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼ‿⁀⁔ⁱⁿₐ-ₜ⃐-⃥⃜⃡-⃰ℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯ⵿-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⷠ-ⷿⸯ々-〇〡-〯〱-〵〸-〼ぁ-ゖ゙゚ゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘫꙀ-꙯ꙴ-꙽ꙿ-ꚗꚟ-꛱ꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꠧꡀ-ꡳꢀ-꣄꣐-꣙꣠-ꣷꣻ꤀-꤭ꤰ-꥓ꥠ-ꥼꦀ-꧀ꧏ-꧙ꨀ-ꨶꩀ-ꩍ꩐-꩙ꩠ-ꩶꩺꩻꪀ-ꫂꫛ-ꫝꫠ-ꫯꫲ-꫶ꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯪ꯬꯭꯰-꯹가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻ︀-️︠-︦︳︴﹍-﹏ﹰ-ﹴﹶ-ﻼ0-9A-Z_a-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ]")};function isDecimalDigit(ch){return ch>=48&&ch<=57}function isHexDigit(ch){return isDecimalDigit(ch)||97<=ch&&ch<=102||65<=ch&&ch<=70}function isOctalDigit(ch){return ch>=48&&ch<=55}NON_ASCII_WHITESPACES=[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279];function isWhiteSpace(ch){return ch===32||ch===9||ch===11||ch===12||ch===160||ch>=5760&&NON_ASCII_WHITESPACES.indexOf(ch)>=0}function isLineTerminator(ch){return ch===10||ch===13||ch===8232||ch===8233}function isIdentifierStart(ch){return ch>=97&&ch<=122||ch>=65&&ch<=90||ch===36||ch===95||ch===92||ch>=128&&Regex.NonAsciiIdentifierStart.test(String.fromCharCode(ch))}function isIdentifierPart(ch){return ch>=97&&ch<=122||ch>=65&&ch<=90||ch>=48&&ch<=57||ch===36||ch===95||ch===92||ch>=128&&Regex.NonAsciiIdentifierPart.test(String.fromCharCode(ch))}module.exports={isDecimalDigit:isDecimalDigit,isHexDigit:isHexDigit,isOctalDigit:isOctalDigit,isWhiteSpace:isWhiteSpace,isLineTerminator:isLineTerminator,isIdentifierStart:isIdentifierStart,isIdentifierPart:isIdentifierPart}})()},{}],161:[function(require,module,exports){(function(){"use strict";var code=require("./code");function isStrictModeReservedWordES6(id){switch(id){case"implements":case"interface":case"package":case"private":case"protected":case"public":case"static":case"let":return true;default:return false}}function isKeywordES5(id,strict){if(!strict&&id==="yield"){return false}return isKeywordES6(id,strict)}function isKeywordES6(id,strict){if(strict&&isStrictModeReservedWordES6(id)){return true}switch(id.length){case 2:return id==="if"||id==="in"||id==="do";case 3:return id==="var"||id==="for"||id==="new"||id==="try";case 4:return id==="this"||id==="else"||id==="case"||id==="void"||id==="with"||id==="enum";case 5:return id==="while"||id==="break"||id==="catch"||id==="throw"||id==="const"||id==="yield"||id==="class"||id==="super";case 6:return id==="return"||id==="typeof"||id==="delete"||id==="switch"||id==="export"||id==="import";case 7:return id==="default"||id==="finally"||id==="extends";case 8:return id==="function"||id==="continue"||id==="debugger";case 10:return id==="instanceof";default:return false}}function isReservedWordES5(id,strict){return id==="null"||id==="true"||id==="false"||isKeywordES5(id,strict)}function isReservedWordES6(id,strict){return id==="null"||id==="true"||id==="false"||isKeywordES6(id,strict)}function isRestrictedWord(id){return id==="eval"||id==="arguments"}function isIdentifierName(id){var i,iz,ch;if(id.length===0){return false}ch=id.charCodeAt(0);if(!code.isIdentifierStart(ch)||ch===92){return false}for(i=1,iz=id.length;i<iz;++i){ch=id.charCodeAt(i);if(!code.isIdentifierPart(ch)||ch===92){return false}}return true}function isIdentifierES5(id,strict){return isIdentifierName(id)&&!isReservedWordES5(id,strict)}function isIdentifierES6(id,strict){return isIdentifierName(id)&&!isReservedWordES6(id,strict)}module.exports={isKeywordES5:isKeywordES5,isKeywordES6:isKeywordES6,isReservedWordES5:isReservedWordES5,isReservedWordES6:isReservedWordES6,isRestrictedWord:isRestrictedWord,isIdentifierName:isIdentifierName,isIdentifierES5:isIdentifierES5,isIdentifierES6:isIdentifierES6}})()},{"./code":160}],162:[function(require,module,exports){(function(){"use strict";exports.ast=require("./ast");exports.code=require("./code");exports.keyword=require("./keyword")})()},{"./ast":159,"./code":160,"./keyword":161}],163:[function(require,module,exports){function combine(){return new RegExp("("+[].slice.call(arguments).map(function(e){var e=e.toString();return"(?:"+e.substring(1,e.length-1)+")"}).join("|")+")")}function makeTester(rx){var s=rx.toString();return new RegExp("^"+s.substring(1,s.length-1)+"$")}var pattern={string1:/"(?:(?:\\\n|\\"|[^"\n]))*?"/,string2:/'(?:(?:\\\n|\\'|[^'\n]))*?'/,comment1:/\/\*[\s\S]*?\*\//,comment2:/\/\/.*?\n/,whitespace:/\s+/,keyword:/\b(?:var|let|for|if|else|in|class|function|return|with|case|break|switch|export|new|while|do|throw|catch)\b/,regexp:/\/(?:(?:\\\/|[^\n\/]))*?\//,name:/[a-zA-Z_\$][a-zA-Z_\$0-9]*/,number:/\d+(?:\.\d+)?(?:e[+-]?\d+)?/,parens:/[\(\)]/,curly:/[{}]/,square:/[\[\]]/,punct:/[;.:\?\^%<>=!&|+\-,~]/};var match=combine(pattern.string1,pattern.string2,pattern.comment1,pattern.comment2,pattern.regexp,pattern.whitespace,pattern.name,pattern.number,pattern.parens,pattern.curly,pattern.square,pattern.punct);var tester={};for(var k in pattern){tester[k]=makeTester(pattern[k])}module.exports=function(str,doNotThrow){return str.split(match).filter(function(e,i){if(i%2)return true;if(e!==""){if(!doNotThrow)throw new Error("invalid token:"+JSON.stringify(e));return true}})};module.exports.type=function(e){for(var type in pattern)if(tester[type].test(e))return type;return"invalid"}},{}],164:[function(require,module,exports){(function(global){(function(){var undefined;var VERSION="3.0.0";var BIND_FLAG=1,BIND_KEY_FLAG=2,CURRY_BOUND_FLAG=4,CURRY_FLAG=8,CURRY_RIGHT_FLAG=16,PARTIAL_FLAG=32,PARTIAL_RIGHT_FLAG=64,REARG_FLAG=128,ARY_FLAG=256;var DEFAULT_TRUNC_LENGTH=30,DEFAULT_TRUNC_OMISSION="...";var HOT_COUNT=150,HOT_SPAN=16;var LAZY_FILTER_FLAG=0,LAZY_MAP_FLAG=1,LAZY_WHILE_FLAG=2;var FUNC_ERROR_TEXT="Expected a function";var PLACEHOLDER="__lodash_placeholder__";var argsTag="[object Arguments]",arrayTag="[object Array]",boolTag="[object Boolean]",dateTag="[object Date]",errorTag="[object Error]",funcTag="[object Function]",mapTag="[object Map]",numberTag="[object Number]",objectTag="[object Object]",regexpTag="[object RegExp]",setTag="[object Set]",stringTag="[object String]",weakMapTag="[object WeakMap]";var arrayBufferTag="[object ArrayBuffer]",float32Tag="[object Float32Array]",float64Tag="[object Float64Array]",int8Tag="[object Int8Array]",int16Tag="[object Int16Array]",int32Tag="[object Int32Array]",uint8Tag="[object Uint8Array]",uint8ClampedTag="[object Uint8ClampedArray]",uint16Tag="[object Uint16Array]",uint32Tag="[object Uint32Array]";var reEmptyStringLeading=/\b__p \+= '';/g,reEmptyStringMiddle=/\b(__p \+=) '' \+/g,reEmptyStringTrailing=/(__e\(.*?\)|\b__t\)) \+\n'';/g;var reEscapedHtml=/&(?:amp|lt|gt|quot|#39|#96);/g,reUnescapedHtml=/[&<>"'`]/g,reHasEscapedHtml=RegExp(reEscapedHtml.source),reHasUnescapedHtml=RegExp(reUnescapedHtml.source);
var reEscape=/<%-([\s\S]+?)%>/g,reEvaluate=/<%([\s\S]+?)%>/g,reInterpolate=/<%=([\s\S]+?)%>/g;var reEsTemplate=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;var reFlags=/\w*$/;var reFuncName=/^\s*function[ \n\r\t]+\w/;var reHexPrefix=/^0[xX]/;var reHostCtor=/^\[object .+?Constructor\]$/;var reLatin1=/[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g;var reNoMatch=/($^)/;var reRegExpChars=/[.*+?^${}()|[\]\/\\]/g,reHasRegExpChars=RegExp(reRegExpChars.source);var reThis=/\bthis\b/;var reUnescapedString=/['\n\r\u2028\u2029\\]/g;var reWords=function(){var upper="[A-Z\\xc0-\\xd6\\xd8-\\xde]",lower="[a-z\\xdf-\\xf6\\xf8-\\xff]+";return RegExp(upper+"{2,}(?="+upper+lower+")|"+upper+"?"+lower+"|"+upper+"+|[0-9]+","g")}();var whitespace=" \f "+"\n\r\u2028\u2029"+" ";var contextProps=["Array","ArrayBuffer","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Math","Number","Object","RegExp","Set","String","_","clearTimeout","document","isFinite","parseInt","setTimeout","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","window","WinRTError"];var templateCounter=-1;var typedArrayTags={};typedArrayTags[float32Tag]=typedArrayTags[float64Tag]=typedArrayTags[int8Tag]=typedArrayTags[int16Tag]=typedArrayTags[int32Tag]=typedArrayTags[uint8Tag]=typedArrayTags[uint8ClampedTag]=typedArrayTags[uint16Tag]=typedArrayTags[uint32Tag]=true;typedArrayTags[argsTag]=typedArrayTags[arrayTag]=typedArrayTags[arrayBufferTag]=typedArrayTags[boolTag]=typedArrayTags[dateTag]=typedArrayTags[errorTag]=typedArrayTags[funcTag]=typedArrayTags[mapTag]=typedArrayTags[numberTag]=typedArrayTags[objectTag]=typedArrayTags[regexpTag]=typedArrayTags[setTag]=typedArrayTags[stringTag]=typedArrayTags[weakMapTag]=false;var cloneableTags={};cloneableTags[argsTag]=cloneableTags[arrayTag]=cloneableTags[arrayBufferTag]=cloneableTags[boolTag]=cloneableTags[dateTag]=cloneableTags[float32Tag]=cloneableTags[float64Tag]=cloneableTags[int8Tag]=cloneableTags[int16Tag]=cloneableTags[int32Tag]=cloneableTags[numberTag]=cloneableTags[objectTag]=cloneableTags[regexpTag]=cloneableTags[stringTag]=cloneableTags[uint8Tag]=cloneableTags[uint8ClampedTag]=cloneableTags[uint16Tag]=cloneableTags[uint32Tag]=true;cloneableTags[errorTag]=cloneableTags[funcTag]=cloneableTags[mapTag]=cloneableTags[setTag]=cloneableTags[weakMapTag]=false;var debounceOptions={leading:false,maxWait:0,trailing:false};var deburredLetters={"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss"};var htmlEscapes={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"};var htmlUnescapes={"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"};var objectTypes={"function":true,object:true};var stringEscapes={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"};var root=objectTypes[typeof window]&&window!==(this&&this.window)?window:this;var freeExports=objectTypes[typeof exports]&&exports&&!exports.nodeType&&exports;var freeModule=objectTypes[typeof module]&&module&&!module.nodeType&&module;var freeGlobal=freeExports&&freeModule&&typeof global=="object"&&global;if(freeGlobal&&(freeGlobal.global===freeGlobal||freeGlobal.window===freeGlobal||freeGlobal.self===freeGlobal)){root=freeGlobal}var moduleExports=freeModule&&freeModule.exports===freeExports&&freeExports;function baseCompareAscending(value,other){if(value!==other){var valIsReflexive=value===value,othIsReflexive=other===other;if(value>other||!valIsReflexive||typeof value=="undefined"&&othIsReflexive){return 1}if(value<other||!othIsReflexive||typeof other=="undefined"&&valIsReflexive){return-1}}return 0}function baseIndexOf(array,value,fromIndex){if(value!==value){return indexOfNaN(array,fromIndex)}var index=(fromIndex||0)-1,length=array.length;while(++index<length){if(array[index]===value){return index}}return-1}function baseSortBy(array,comparer){var length=array.length;array.sort(comparer);while(length--){array[length]=array[length].value}return array}function baseToString(value){if(typeof value=="string"){return value}return value==null?"":value+""}function charAtCallback(string){return string.charCodeAt(0)}function charsLeftIndex(string,chars){var index=-1,length=string.length;while(++index<length&&chars.indexOf(string.charAt(index))>-1){}return index}function charsRightIndex(string,chars){var index=string.length;while(index--&&chars.indexOf(string.charAt(index))>-1){}return index}function compareAscending(object,other){return baseCompareAscending(object.criteria,other.criteria)||object.index-other.index}function compareMultipleAscending(object,other){var index=-1,objCriteria=object.criteria,othCriteria=other.criteria,length=objCriteria.length;while(++index<length){var result=baseCompareAscending(objCriteria[index],othCriteria[index]);if(result){return result}}return object.index-other.index}function deburrLetter(letter){return deburredLetters[letter]}function escapeHtmlChar(chr){return htmlEscapes[chr]}function escapeStringChar(chr){return"\\"+stringEscapes[chr]}function indexOfNaN(array,fromIndex,fromRight){var length=array.length,index=fromRight?fromIndex||length:(fromIndex||0)-1;while(fromRight?index--:++index<length){var other=array[index];if(other!==other){return index}}return-1}function isObjectLike(value){return value&&typeof value=="object"||false}function isSpace(charCode){return charCode<=160&&(charCode>=9&&charCode<=13)||charCode==32||charCode==160||charCode==5760||charCode==6158||charCode>=8192&&(charCode<=8202||charCode==8232||charCode==8233||charCode==8239||charCode==8287||charCode==12288||charCode==65279)}function replaceHolders(array,placeholder){var index=-1,length=array.length,resIndex=-1,result=[];while(++index<length){if(array[index]===placeholder){array[index]=PLACEHOLDER;result[++resIndex]=index}}return result}function sortedUniq(array,iteratee){var seen,index=-1,length=array.length,resIndex=-1,result=[];while(++index<length){var value=array[index],computed=iteratee?iteratee(value,index,array):value;if(!index||seen!==computed){seen=computed;result[++resIndex]=value}}return result}function trimmedLeftIndex(string){var index=-1,length=string.length;while(++index<length&&isSpace(string.charCodeAt(index))){}return index}function trimmedRightIndex(string){var index=string.length;while(index--&&isSpace(string.charCodeAt(index))){}return index}function unescapeHtmlChar(chr){return htmlUnescapes[chr]}function runInContext(context){context=context?_.defaults(root.Object(),context,_.pick(root,contextProps)):root;var Array=context.Array,Date=context.Date,Error=context.Error,Function=context.Function,Math=context.Math,Number=context.Number,Object=context.Object,RegExp=context.RegExp,String=context.String,TypeError=context.TypeError;var arrayProto=Array.prototype,objectProto=Object.prototype;var document=(document=context.window)&&document.document;var fnToString=Function.prototype.toString;var getLength=baseProperty("length");var hasOwnProperty=objectProto.hasOwnProperty;var idCounter=0;var objToString=objectProto.toString;var oldDash=context._;var reNative=RegExp("^"+escapeRegExp(objToString).replace(/toString|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var ArrayBuffer=isNative(ArrayBuffer=context.ArrayBuffer)&&ArrayBuffer,bufferSlice=isNative(bufferSlice=ArrayBuffer&&new ArrayBuffer(0).slice)&&bufferSlice,ceil=Math.ceil,clearTimeout=context.clearTimeout,floor=Math.floor,getPrototypeOf=isNative(getPrototypeOf=Object.getPrototypeOf)&&getPrototypeOf,push=arrayProto.push,propertyIsEnumerable=objectProto.propertyIsEnumerable,Set=isNative(Set=context.Set)&&Set,setTimeout=context.setTimeout,splice=arrayProto.splice,Uint8Array=isNative(Uint8Array=context.Uint8Array)&&Uint8Array,unshift=arrayProto.unshift,WeakMap=isNative(WeakMap=context.WeakMap)&&WeakMap;var Float64Array=function(){try{var func=isNative(func=context.Float64Array)&&func,result=new func(new ArrayBuffer(10),0,1)&&func}catch(e){}return result}();var nativeIsArray=isNative(nativeIsArray=Array.isArray)&&nativeIsArray,nativeCreate=isNative(nativeCreate=Object.create)&&nativeCreate,nativeIsFinite=context.isFinite,nativeKeys=isNative(nativeKeys=Object.keys)&&nativeKeys,nativeMax=Math.max,nativeMin=Math.min,nativeNow=isNative(nativeNow=Date.now)&&nativeNow,nativeNumIsFinite=isNative(nativeNumIsFinite=Number.isFinite)&&nativeNumIsFinite,nativeParseInt=context.parseInt,nativeRandom=Math.random;var NEGATIVE_INFINITY=Number.NEGATIVE_INFINITY,POSITIVE_INFINITY=Number.POSITIVE_INFINITY;var MAX_ARRAY_LENGTH=Math.pow(2,32)-1,MAX_ARRAY_INDEX=MAX_ARRAY_LENGTH-1,HALF_MAX_ARRAY_LENGTH=MAX_ARRAY_LENGTH>>>1;var FLOAT64_BYTES_PER_ELEMENT=Float64Array?Float64Array.BYTES_PER_ELEMENT:0;var MAX_SAFE_INTEGER=Math.pow(2,53)-1;var metaMap=WeakMap&&new WeakMap;function lodash(value){if(isObjectLike(value)&&!isArray(value)){if(value instanceof LodashWrapper){return value}if(hasOwnProperty.call(value,"__wrapped__")){return new LodashWrapper(value.__wrapped__,value.__chain__,arrayCopy(value.__actions__))}}return new LodashWrapper(value)}function LodashWrapper(value,chainAll,actions){this.__actions__=actions||[];this.__chain__=!!chainAll;this.__wrapped__=value}var support=lodash.support={};(function(x){support.funcDecomp=!isNative(context.WinRTError)&&reThis.test(runInContext);support.funcNames=typeof Function.name=="string";try{support.dom=document.createDocumentFragment().nodeType===11}catch(e){support.dom=false}try{support.nonEnumArgs=!propertyIsEnumerable.call(arguments,1)}catch(e){support.nonEnumArgs=true}})(0,0);lodash.templateSettings={escape:reEscape,evaluate:reEvaluate,interpolate:reInterpolate,variable:"",imports:{_:lodash}};function LazyWrapper(value){this.actions=null;this.dir=1;this.dropCount=0;this.filtered=false;this.iteratees=null;this.takeCount=POSITIVE_INFINITY;this.views=null;this.wrapped=value}function lazyClone(){var actions=this.actions,iteratees=this.iteratees,views=this.views,result=new LazyWrapper(this.wrapped);result.actions=actions?arrayCopy(actions):null;result.dir=this.dir;result.dropCount=this.dropCount;result.filtered=this.filtered;result.iteratees=iteratees?arrayCopy(iteratees):null;result.takeCount=this.takeCount;result.views=views?arrayCopy(views):null;return result}function lazyReverse(){var filtered=this.filtered,result=filtered?new LazyWrapper(this):this.clone();result.dir=this.dir*-1;result.filtered=filtered;return result}function lazyValue(){var array=this.wrapped.value();if(!isArray(array)){return baseWrapperValue(array,this.actions)}var dir=this.dir,isRight=dir<0,length=array.length,view=getView(0,length,this.views),start=view.start,end=view.end,dropCount=this.dropCount,takeCount=nativeMin(end-start,this.takeCount-dropCount),index=isRight?end:start-1,iteratees=this.iteratees,iterLength=iteratees?iteratees.length:0,resIndex=0,result=[];outer:while(length--&&resIndex<takeCount){index+=dir;var iterIndex=-1,value=array[index];while(++iterIndex<iterLength){var data=iteratees[iterIndex],iteratee=data.iteratee,computed=iteratee(value,index,array),type=data.type;if(type==LAZY_MAP_FLAG){value=computed}else if(!computed){if(type==LAZY_FILTER_FLAG){continue outer}else{break outer}}}if(dropCount){dropCount--}else{result[resIndex++]=value}}return isRight?result.reverse():result}function MapCache(){this.__data__={}}function mapDelete(key){return this.has(key)&&delete this.__data__[key]}function mapGet(key){return key=="__proto__"?undefined:this.__data__[key]}function mapHas(key){return key!="__proto__"&&hasOwnProperty.call(this.__data__,key)}function mapSet(key,value){if(key!="__proto__"){this.__data__[key]=value}return this}function SetCache(values){var length=values?values.length:0;this.data={hash:nativeCreate(null),set:new Set};while(length--){this.push(values[length])}}function cacheIndexOf(cache,value){var data=cache.data,result=typeof value=="string"||isObject(value)?data.set.has(value):data.hash[value];return result?0:-1}function cachePush(value){var data=this.data;if(typeof value=="string"||isObject(value)){data.set.add(value)}else{data.hash[value]=true}}function arrayCopy(source,array){var index=-1,length=source.length;array||(array=Array(length));while(++index<length){array[index]=source[index]}return array}function arrayEach(array,iteratee){var index=-1,length=array.length;while(++index<length){if(iteratee(array[index],index,array)===false){break}}return array}function arrayEachRight(array,iteratee){var length=array.length;while(length--){if(iteratee(array[length],length,array)===false){break}}return array}function arrayEvery(array,predicate){var index=-1,length=array.length;while(++index<length){if(!predicate(array[index],index,array)){return false}}return true}function arrayFilter(array,predicate){var index=-1,length=array.length,resIndex=-1,result=[];while(++index<length){var value=array[index];if(predicate(value,index,array)){result[++resIndex]=value}}return result}function arrayMap(array,iteratee){var index=-1,length=array.length,result=Array(length);while(++index<length){result[index]=iteratee(array[index],index,array)}return result}function arrayMax(array){var index=-1,length=array.length,result=NEGATIVE_INFINITY;while(++index<length){var value=array[index];if(value>result){result=value}}return result}function arrayMin(array){var index=-1,length=array.length,result=POSITIVE_INFINITY;while(++index<length){var value=array[index];if(value<result){result=value}}return result}function arrayReduce(array,iteratee,accumulator,initFromArray){var index=-1,length=array.length;if(initFromArray&&length){accumulator=array[++index]}while(++index<length){accumulator=iteratee(accumulator,array[index],index,array)}return accumulator}function arrayReduceRight(array,iteratee,accumulator,initFromArray){var length=array.length;if(initFromArray&&length){accumulator=array[--length]}while(length--){accumulator=iteratee(accumulator,array[length],length,array)}return accumulator}function arraySome(array,predicate){var index=-1,length=array.length;while(++index<length){if(predicate(array[index],index,array)){return true}}return false}function assignDefaults(objectValue,sourceValue){return typeof objectValue=="undefined"?sourceValue:objectValue}function assignOwnDefaults(objectValue,sourceValue,key,object){return typeof objectValue=="undefined"||!hasOwnProperty.call(object,key)?sourceValue:objectValue}function baseAssign(object,source,customizer){var props=keys(source);if(!customizer){return baseCopy(source,object,props)}var index=-1,length=props.length;while(++index<length){var key=props[index],value=object[key],result=customizer(value,source[key],key,object,source);if((result===result?result!==value:value===value)||typeof value=="undefined"&&!(key in object)){object[key]=result}}return object}function baseAt(collection,props){var index=-1,length=collection.length,isArr=isLength(length),propsLength=props.length,result=Array(propsLength);while(++index<propsLength){var key=props[index];if(isArr){key=parseFloat(key);result[index]=isIndex(key,length)?collection[key]:undefined}else{result[index]=collection[key]}}return result}function baseCopy(source,object,props){if(!props){props=object;object={}}var index=-1,length=props.length;while(++index<length){var key=props[index];object[key]=source[key]}return object}function baseBindAll(object,methodNames){var index=-1,length=methodNames.length;while(++index<length){var key=methodNames[index];object[key]=createWrapper(object[key],BIND_FLAG,object)}return object}function baseCallback(func,thisArg,argCount){var type=typeof func;if(type=="function"){return typeof thisArg!="undefined"&&isBindable(func)?bindCallback(func,thisArg,argCount):func}if(func==null){return identity}return type=="object"?baseMatches(func,!argCount):baseProperty(argCount?baseToString(func):func)}function baseClone(value,isDeep,customizer,key,object,stackA,stackB){var result;if(customizer){result=object?customizer(value,key,object):customizer(value)}if(typeof result!="undefined"){return result}if(!isObject(value)){return value}var isArr=isArray(value);if(isArr){result=initCloneArray(value);if(!isDeep){return arrayCopy(value,result)}}else{var tag=objToString.call(value),isFunc=tag==funcTag;if(tag==objectTag||tag==argsTag||isFunc&&!object){result=initCloneObject(isFunc?{}:value);if(!isDeep){return baseCopy(value,result,keys(value))}}else{return cloneableTags[tag]?initCloneByTag(value,tag,isDeep):object?value:{}}}stackA||(stackA=[]);stackB||(stackB=[]);var length=stackA.length;while(length--){if(stackA[length]==value){return stackB[length]}}stackA.push(value);stackB.push(result);(isArr?arrayEach:baseForOwn)(value,function(subValue,key){result[key]=baseClone(subValue,isDeep,customizer,key,value,stackA,stackB)});return result}var baseCreate=function(){function Object(){}return function(prototype){if(isObject(prototype)){Object.prototype=prototype;var result=new Object;Object.prototype=null}return result||context.Object()}}();function baseDelay(func,wait,args,fromIndex){if(!isFunction(func)){throw new TypeError(FUNC_ERROR_TEXT)}return setTimeout(function(){func.apply(undefined,baseSlice(args,fromIndex))},wait)}function baseDifference(array,values){var length=array?array.length:0,result=[];if(!length){return result}var index=-1,indexOf=getIndexOf(),isCommon=indexOf==baseIndexOf,cache=isCommon&&values.length>=200&&createCache(values),valuesLength=values.length;if(cache){indexOf=cacheIndexOf;isCommon=false;values=cache}outer:while(++index<length){var value=array[index];if(isCommon&&value===value){var valuesIndex=valuesLength;while(valuesIndex--){if(values[valuesIndex]===value){continue outer}}result.push(value)}else if(indexOf(values,value)<0){result.push(value)}}return result}function baseEach(collection,iteratee){var length=collection?collection.length:0;if(!isLength(length)){return baseForOwn(collection,iteratee)}var index=-1,iterable=toObject(collection);while(++index<length){if(iteratee(iterable[index],index,iterable)===false){break}}return collection}function baseEachRight(collection,iteratee){var length=collection?collection.length:0;if(!isLength(length)){return baseForOwnRight(collection,iteratee)}var iterable=toObject(collection);while(length--){if(iteratee(iterable[length],length,iterable)===false){break}}return collection}function baseEvery(collection,predicate){var result=true;baseEach(collection,function(value,index,collection){result=!!predicate(value,index,collection);return result});return result}function baseFilter(collection,predicate){var result=[];baseEach(collection,function(value,index,collection){if(predicate(value,index,collection)){result.push(value)}});return result}function baseFind(collection,predicate,eachFunc,retKey){var result;eachFunc(collection,function(value,key,collection){if(predicate(value,key,collection)){result=retKey?key:value;return false}});return result}function baseFlatten(array,isDeep,isStrict,fromIndex){var index=(fromIndex||0)-1,length=array.length,resIndex=-1,result=[];while(++index<length){var value=array[index];if(isObjectLike(value)&&isLength(value.length)&&(isArray(value)||isArguments(value))){if(isDeep){value=baseFlatten(value,isDeep,isStrict)}var valIndex=-1,valLength=value.length;result.length+=valLength;while(++valIndex<valLength){result[++resIndex]=value[valIndex]}}else if(!isStrict){result[++resIndex]=value}}return result}function baseFor(object,iteratee,keysFunc){var index=-1,iterable=toObject(object),props=keysFunc(object),length=props.length;while(++index<length){var key=props[index];if(iteratee(iterable[key],key,iterable)===false){break}}return object}function baseForRight(object,iteratee,keysFunc){var iterable=toObject(object),props=keysFunc(object),length=props.length;while(length--){var key=props[length];if(iteratee(iterable[key],key,iterable)===false){break}}return object}function baseForIn(object,iteratee){return baseFor(object,iteratee,keysIn)}function baseForOwn(object,iteratee){return baseFor(object,iteratee,keys)}function baseForOwnRight(object,iteratee){return baseForRight(object,iteratee,keys)}function baseFunctions(object,props){var index=-1,length=props.length,resIndex=-1,result=[];while(++index<length){var key=props[index];if(isFunction(object[key])){result[++resIndex]=key}}return result}function baseInvoke(collection,methodName,args){var index=-1,isFunc=typeof methodName=="function",length=collection?collection.length:0,result=isLength(length)?Array(length):[];baseEach(collection,function(value){var func=isFunc?methodName:value!=null&&value[methodName];result[++index]=func?func.apply(value,args):undefined});return result}function baseIsEqual(value,other,customizer,isWhere,stackA,stackB){if(value===other){return value!==0||1/value==1/other}var valType=typeof value,othType=typeof other;if(valType!="function"&&valType!="object"&&othType!="function"&&othType!="object"||value==null||other==null){return value!==value&&other!==other}return baseIsEqualDeep(value,other,baseIsEqual,customizer,isWhere,stackA,stackB)}function baseIsEqualDeep(object,other,equalFunc,customizer,isWhere,stackA,stackB){var objIsArr=isArray(object),othIsArr=isArray(other),objTag=arrayTag,othTag=arrayTag;if(!objIsArr){objTag=objToString.call(object);if(objTag==argsTag){objTag=objectTag}else if(objTag!=objectTag){objIsArr=isTypedArray(object)}}if(!othIsArr){othTag=objToString.call(other);if(othTag==argsTag){othTag=objectTag}else if(othTag!=objectTag){othIsArr=isTypedArray(other)}}var objIsObj=objTag==objectTag,othIsObj=othTag==objectTag,isSameTag=objTag==othTag;if(isSameTag&&!(objIsArr||objIsObj)){return equalByTag(object,other,objTag)}var valWrapped=objIsObj&&hasOwnProperty.call(object,"__wrapped__"),othWrapped=othIsObj&&hasOwnProperty.call(other,"__wrapped__");if(valWrapped||othWrapped){return equalFunc(valWrapped?object.value():object,othWrapped?other.value():other,customizer,isWhere,stackA,stackB)}if(!isSameTag){return false}stackA||(stackA=[]);stackB||(stackB=[]);var length=stackA.length;while(length--){if(stackA[length]==object){return stackB[length]==other}}stackA.push(object);stackB.push(other);var result=(objIsArr?equalArrays:equalObjects)(object,other,equalFunc,customizer,isWhere,stackA,stackB);stackA.pop();stackB.pop();return result}function baseIsMatch(object,props,values,strictCompareFlags,customizer){var length=props.length;if(object==null){return!length}var index=-1,noCustomizer=!customizer;while(++index<length){if(noCustomizer&&strictCompareFlags[index]?values[index]!==object[props[index]]:!hasOwnProperty.call(object,props[index])){return false}}index=-1;while(++index<length){var key=props[index];if(noCustomizer&&strictCompareFlags[index]){var result=hasOwnProperty.call(object,key)}else{var objValue=object[key],srcValue=values[index];result=customizer?customizer(objValue,srcValue,key):undefined;if(typeof result=="undefined"){result=baseIsEqual(srcValue,objValue,customizer,true)}}if(!result){return false}}return true}function baseMap(collection,iteratee){var result=[];baseEach(collection,function(value,key,collection){result.push(iteratee(value,key,collection))});return result}function baseMatches(source,isCloned){var props=keys(source),length=props.length;if(length==1){var key=props[0],value=source[key];if(isStrictComparable(value)){return function(object){return object!=null&&value===object[key]&&hasOwnProperty.call(object,key)}}}if(isCloned){source=baseClone(source,true)}var values=Array(length),strictCompareFlags=Array(length);while(length--){value=source[props[length]];values[length]=value;strictCompareFlags[length]=isStrictComparable(value)}return function(object){return baseIsMatch(object,props,values,strictCompareFlags)}}function baseMerge(object,source,customizer,stackA,stackB){var isSrcArr=isLength(source.length)&&(isArray(source)||isTypedArray(source));(isSrcArr?arrayEach:baseForOwn)(source,function(srcValue,key,source){if(isObjectLike(srcValue)){stackA||(stackA=[]);stackB||(stackB=[]);return baseMergeDeep(object,source,key,baseMerge,customizer,stackA,stackB)}var value=object[key],result=customizer?customizer(value,srcValue,key,object,source):undefined,isCommon=typeof result=="undefined";if(isCommon){result=srcValue}if((isSrcArr||typeof result!="undefined")&&(isCommon||(result===result?result!==value:value===value))){object[key]=result}});return object}function baseMergeDeep(object,source,key,mergeFunc,customizer,stackA,stackB){var length=stackA.length,srcValue=source[key];while(length--){if(stackA[length]==srcValue){object[key]=stackB[length];return}}var value=object[key],result=customizer?customizer(value,srcValue,key,object,source):undefined,isCommon=typeof result=="undefined";if(isCommon){result=srcValue;if(isLength(srcValue.length)&&(isArray(srcValue)||isTypedArray(srcValue))){result=isArray(value)?value:value?arrayCopy(value):[]}else if(isPlainObject(srcValue)||isArguments(srcValue)){result=isArguments(value)?toPlainObject(value):isPlainObject(value)?value:{}}}stackA.push(srcValue);stackB.push(result);if(isCommon){object[key]=mergeFunc(result,srcValue,customizer,stackA,stackB)}else if(result===result?result!==value:value===value){object[key]=result}}function baseProperty(key){return function(object){return object==null?undefined:object[key]}}function basePullAt(array,indexes){var length=indexes.length,result=baseAt(array,indexes);indexes.sort(baseCompareAscending);while(length--){var index=parseFloat(indexes[length]);if(index!=previous&&isIndex(index)){var previous=index;splice.call(array,index,1)}}return result}function baseRandom(min,max){return min+floor(nativeRandom()*(max-min+1))}function baseReduce(collection,iteratee,accumulator,initFromCollection,eachFunc){eachFunc(collection,function(value,index,collection){accumulator=initFromCollection?(initFromCollection=false,value):iteratee(accumulator,value,index,collection)});return accumulator}var baseSetData=!metaMap?identity:function(func,data){metaMap.set(func,data);return func};function baseSlice(array,start,end){var index=-1,length=array.length;start=start==null?0:+start||0;if(start<0){start=-start>length?0:length+start}end=typeof end=="undefined"||end>length?length:+end||0;if(end<0){end+=length}length=start>end?0:end-start;var result=Array(length);while(++index<length){result[index]=array[index+start]}return result}function baseSome(collection,predicate){var result;baseEach(collection,function(value,index,collection){result=predicate(value,index,collection);return!result});return!!result}function baseUniq(array,iteratee){var index=-1,indexOf=getIndexOf(),length=array.length,isCommon=indexOf==baseIndexOf,isLarge=isCommon&&length>=200,seen=isLarge&&createCache(),result=[];if(seen){indexOf=cacheIndexOf;isCommon=false}else{isLarge=false;seen=iteratee?[]:result}outer:while(++index<length){var value=array[index],computed=iteratee?iteratee(value,index,array):value;if(isCommon&&value===value){var seenIndex=seen.length;while(seenIndex--){if(seen[seenIndex]===computed){continue outer}}if(iteratee){seen.push(computed)}result.push(value)}else if(indexOf(seen,computed)<0){if(iteratee||isLarge){seen.push(computed)}result.push(value)}}return result}function baseValues(object,props){var index=-1,length=props.length,result=Array(length);while(++index<length){result[index]=object[props[index]]}return result}function baseWrapperValue(value,actions){var result=value;if(result instanceof LazyWrapper){result=result.value()}var index=-1,length=actions.length;while(++index<length){var args=[result],action=actions[index];push.apply(args,action.args);result=action.func.apply(action.thisArg,args)}return result}function binaryIndex(array,value,retHighest){var low=0,high=array?array.length:low;if(typeof value=="number"&&value===value&&high<=HALF_MAX_ARRAY_LENGTH){while(low<high){var mid=low+high>>>1,computed=array[mid];if(retHighest?computed<=value:computed<value){low=mid+1}else{high=mid}}return high}return binaryIndexBy(array,value,identity,retHighest)}function binaryIndexBy(array,value,iteratee,retHighest){value=iteratee(value);var low=0,high=array?array.length:0,valIsNaN=value!==value,valIsUndef=typeof value=="undefined";while(low<high){var mid=floor((low+high)/2),computed=iteratee(array[mid]),isReflexive=computed===computed;if(valIsNaN){var setLow=isReflexive||retHighest}else if(valIsUndef){setLow=isReflexive&&(retHighest||typeof computed!="undefined")}else{setLow=retHighest?computed<=value:computed<value}if(setLow){low=mid+1}else{high=mid}}return nativeMin(high,MAX_ARRAY_INDEX)}function bindCallback(func,thisArg,argCount){if(typeof func!="function"){return identity}if(typeof thisArg=="undefined"){return func}switch(argCount){case 1:return function(value){return func.call(thisArg,value)};case 3:return function(value,index,collection){return func.call(thisArg,value,index,collection)};case 4:return function(accumulator,value,index,collection){return func.call(thisArg,accumulator,value,index,collection)};case 5:return function(value,other,key,object,source){return func.call(thisArg,value,other,key,object,source)}}return function(){return func.apply(thisArg,arguments)}}function bufferClone(buffer){return bufferSlice.call(buffer,0)}if(!bufferSlice){bufferClone=!(ArrayBuffer&&Uint8Array)?constant(null):function(buffer){var byteLength=buffer.byteLength,floatLength=Float64Array?floor(byteLength/FLOAT64_BYTES_PER_ELEMENT):0,offset=floatLength*FLOAT64_BYTES_PER_ELEMENT,result=new ArrayBuffer(byteLength);if(floatLength){var view=new Float64Array(result,0,floatLength);view.set(new Float64Array(buffer,0,floatLength))}if(byteLength!=offset){view=new Uint8Array(result,offset);view.set(new Uint8Array(buffer,offset))}return result}}function composeArgs(args,partials,holders){var holdersLength=holders.length,argsIndex=-1,argsLength=nativeMax(args.length-holdersLength,0),leftIndex=-1,leftLength=partials.length,result=Array(argsLength+leftLength);while(++leftIndex<leftLength){result[leftIndex]=partials[leftIndex]}while(++argsIndex<holdersLength){result[holders[argsIndex]]=args[argsIndex]}while(argsLength--){result[leftIndex++]=args[argsIndex++]}return result}function composeArgsRight(args,partials,holders){var holdersIndex=-1,holdersLength=holders.length,argsIndex=-1,argsLength=nativeMax(args.length-holdersLength,0),rightIndex=-1,rightLength=partials.length,result=Array(argsLength+rightLength);while(++argsIndex<argsLength){result[argsIndex]=args[argsIndex]}var pad=argsIndex;while(++rightIndex<rightLength){result[pad+rightIndex]=partials[rightIndex]}while(++holdersIndex<holdersLength){result[pad+holders[holdersIndex]]=args[argsIndex++]}return result}function createAggregator(setter,initializer){return function(collection,iteratee,thisArg){var result=initializer?initializer():{};iteratee=getCallback(iteratee,thisArg,3);if(isArray(collection)){var index=-1,length=collection.length;while(++index<length){var value=collection[index];setter(result,value,iteratee(value,index,collection),collection)}}else{baseEach(collection,function(value,key,collection){setter(result,value,iteratee(value,key,collection),collection)})}return result}}function createAssigner(assigner){return function(){var length=arguments.length,object=arguments[0];if(length<2||object==null){return object}if(length>3&&isIterateeCall(arguments[1],arguments[2],arguments[3])){length=2}if(length>3&&typeof arguments[length-2]=="function"){var customizer=bindCallback(arguments[--length-1],arguments[length--],5)}else if(length>2&&typeof arguments[length-1]=="function"){customizer=arguments[--length]}var index=0;while(++index<length){var source=arguments[index];if(source){assigner(object,source,customizer)}}return object}}function createBindWrapper(func,thisArg){var Ctor=createCtorWrapper(func);
function wrapper(){return(this instanceof wrapper?Ctor:func).apply(thisArg,arguments)}return wrapper}var createCache=!(nativeCreate&&Set)?constant(null):function(values){return new SetCache(values)};function createCompounder(callback){return function(string){var index=-1,array=words(deburr(string)),length=array.length,result="";while(++index<length){result=callback(result,array[index],index)}return result}}function createCtorWrapper(Ctor){return function(){var thisBinding=baseCreate(Ctor.prototype),result=Ctor.apply(thisBinding,arguments);return isObject(result)?result:thisBinding}}function createExtremum(arrayFunc,isMin){return function(collection,iteratee,thisArg){if(thisArg&&isIterateeCall(collection,iteratee,thisArg)){iteratee=null}var func=getCallback(),noIteratee=iteratee==null;if(!(func===baseCallback&&noIteratee)){noIteratee=false;iteratee=func(iteratee,thisArg,3)}if(noIteratee){var isArr=isArray(collection);if(!isArr&&isString(collection)){iteratee=charAtCallback}else{return arrayFunc(isArr?collection:toIterable(collection))}}return extremumBy(collection,iteratee,isMin)}}function createHybridWrapper(func,bitmask,thisArg,partials,holders,partialsRight,holdersRight,argPos,ary,arity){var isAry=bitmask&ARY_FLAG,isBind=bitmask&BIND_FLAG,isBindKey=bitmask&BIND_KEY_FLAG,isCurry=bitmask&CURRY_FLAG,isCurryBound=bitmask&CURRY_BOUND_FLAG,isCurryRight=bitmask&CURRY_RIGHT_FLAG;var Ctor=!isBindKey&&createCtorWrapper(func),key=func;function wrapper(){var length=arguments.length,index=length,args=Array(length);while(index--){args[index]=arguments[index]}if(partials){args=composeArgs(args,partials,holders)}if(partialsRight){args=composeArgsRight(args,partialsRight,holdersRight)}if(isCurry||isCurryRight){var placeholder=wrapper.placeholder,argsHolders=replaceHolders(args,placeholder);length-=argsHolders.length;if(length<arity){var newArgPos=argPos?arrayCopy(argPos):null,newArity=nativeMax(arity-length,0),newsHolders=isCurry?argsHolders:null,newHoldersRight=isCurry?null:argsHolders,newPartials=isCurry?args:null,newPartialsRight=isCurry?null:args;bitmask|=isCurry?PARTIAL_FLAG:PARTIAL_RIGHT_FLAG;bitmask&=~(isCurry?PARTIAL_RIGHT_FLAG:PARTIAL_FLAG);if(!isCurryBound){bitmask&=~(BIND_FLAG|BIND_KEY_FLAG)}var result=createHybridWrapper(func,bitmask,thisArg,newPartials,newsHolders,newPartialsRight,newHoldersRight,newArgPos,ary,newArity);result.placeholder=placeholder;return result}}var thisBinding=isBind?thisArg:this;if(isBindKey){func=thisBinding[key]}if(argPos){args=reorder(args,argPos)}if(isAry&&ary<args.length){args.length=ary}return(this instanceof wrapper?Ctor||createCtorWrapper(func):func).apply(thisBinding,args)}return wrapper}function createPad(string,length,chars){var strLength=string.length;length=+length;if(strLength>=length||!nativeIsFinite(length)){return""}var padLength=length-strLength;chars=chars==null?" ":baseToString(chars);return repeat(chars,ceil(padLength/chars.length)).slice(0,padLength)}function createPartialWrapper(func,bitmask,thisArg,partials){var isBind=bitmask&BIND_FLAG,Ctor=createCtorWrapper(func);function wrapper(){var argsIndex=-1,argsLength=arguments.length,leftIndex=-1,leftLength=partials.length,args=Array(argsLength+leftLength);while(++leftIndex<leftLength){args[leftIndex]=partials[leftIndex]}while(argsLength--){args[leftIndex++]=arguments[++argsIndex]}return(this instanceof wrapper?Ctor:func).apply(isBind?thisArg:this,args)}return wrapper}function createWrapper(func,bitmask,thisArg,partials,holders,argPos,ary,arity){var isBindKey=bitmask&BIND_KEY_FLAG;if(!isBindKey&&!isFunction(func)){throw new TypeError(FUNC_ERROR_TEXT)}var length=partials?partials.length:0;if(!length){bitmask&=~(PARTIAL_FLAG|PARTIAL_RIGHT_FLAG);partials=holders=null}length-=holders?holders.length:0;if(bitmask&PARTIAL_RIGHT_FLAG){var partialsRight=partials,holdersRight=holders;partials=holders=null}var data=!isBindKey&&getData(func),newData=[func,bitmask,thisArg,partials,holders,partialsRight,holdersRight,argPos,ary,arity];if(data&&data!==true){mergeData(newData,data);bitmask=newData[1];arity=newData[9]}newData[9]=arity==null?isBindKey?0:func.length:nativeMax(arity-length,0)||0;if(bitmask==BIND_FLAG){var result=createBindWrapper(newData[0],newData[2])}else if((bitmask==PARTIAL_FLAG||bitmask==(BIND_FLAG|PARTIAL_FLAG))&&!newData[4].length){result=createPartialWrapper.apply(null,newData)}else{result=createHybridWrapper.apply(null,newData)}var setter=data?baseSetData:setData;return setter(result,newData)}function equalArrays(array,other,equalFunc,customizer,isWhere,stackA,stackB){var index=-1,arrLength=array.length,othLength=other.length,result=true;if(arrLength!=othLength&&!(isWhere&&othLength>arrLength)){return false}while(result&&++index<arrLength){var arrValue=array[index],othValue=other[index];result=undefined;if(customizer){result=isWhere?customizer(othValue,arrValue,index):customizer(arrValue,othValue,index)}if(typeof result=="undefined"){if(isWhere){var othIndex=othLength;while(othIndex--){othValue=other[othIndex];result=arrValue&&arrValue===othValue||equalFunc(arrValue,othValue,customizer,isWhere,stackA,stackB);if(result){break}}}else{result=arrValue&&arrValue===othValue||equalFunc(arrValue,othValue,customizer,isWhere,stackA,stackB)}}}return!!result}function equalByTag(object,other,tag){switch(tag){case boolTag:case dateTag:return+object==+other;case errorTag:return object.name==other.name&&object.message==other.message;case numberTag:return object!=+object?other!=+other:object==0?1/object==1/other:object==+other;case regexpTag:case stringTag:return object==baseToString(other)}return false}function equalObjects(object,other,equalFunc,customizer,isWhere,stackA,stackB){var objProps=keys(object),objLength=objProps.length,othProps=keys(other),othLength=othProps.length;if(objLength!=othLength&&!isWhere){return false}var hasCtor,index=-1;while(++index<objLength){var key=objProps[index],result=hasOwnProperty.call(other,key);if(result){var objValue=object[key],othValue=other[key];result=undefined;if(customizer){result=isWhere?customizer(othValue,objValue,key):customizer(objValue,othValue,key)}if(typeof result=="undefined"){result=objValue&&objValue===othValue||equalFunc(objValue,othValue,customizer,isWhere,stackA,stackB)}}if(!result){return false}hasCtor||(hasCtor=key=="constructor")}if(!hasCtor){var objCtor=object.constructor,othCtor=other.constructor;if(objCtor!=othCtor&&("constructor"in object&&"constructor"in other)&&!(typeof objCtor=="function"&&objCtor instanceof objCtor&&typeof othCtor=="function"&&othCtor instanceof othCtor)){return false}}return true}function extremumBy(collection,iteratee,isMin){var exValue=isMin?POSITIVE_INFINITY:NEGATIVE_INFINITY,computed=exValue,result=computed;baseEach(collection,function(value,index,collection){var current=iteratee(value,index,collection);if((isMin?current<computed:current>computed)||current===exValue&¤t===result){computed=current;result=value}});return result}function getCallback(func,thisArg,argCount){var result=lodash.callback||callback;result=result===callback?baseCallback:result;return argCount?result(func,thisArg,argCount):result}var getData=!metaMap?noop:function(func){return metaMap.get(func)};function getIndexOf(collection,target,fromIndex){var result=lodash.indexOf||indexOf;result=result===indexOf?baseIndexOf:result;return collection?result(collection,target,fromIndex):result}function getView(start,end,transforms){var index=-1,length=transforms?transforms.length:0;while(++index<length){var data=transforms[index],size=data.size;switch(data.type){case"drop":start+=size;break;case"dropRight":end-=size;break;case"take":end=nativeMin(end,start+size);break;case"takeRight":start=nativeMax(start,end-size);break}}return{start:start,end:end}}function initCloneArray(array){var length=array.length,result=new array.constructor(length);if(length&&typeof array[0]=="string"&&hasOwnProperty.call(array,"index")){result.index=array.index;result.input=array.input}return result}function initCloneObject(object){var Ctor=object.constructor;if(!(typeof Ctor=="function"&&Ctor instanceof Ctor)){Ctor=Object}return new Ctor}function initCloneByTag(object,tag,isDeep){var Ctor=object.constructor;switch(tag){case arrayBufferTag:return bufferClone(object);case boolTag:case dateTag:return new Ctor(+object);case float32Tag:case float64Tag:case int8Tag:case int16Tag:case int32Tag:case uint8Tag:case uint8ClampedTag:case uint16Tag:case uint32Tag:var buffer=object.buffer;return new Ctor(isDeep?bufferClone(buffer):buffer,object.byteOffset,object.length);case numberTag:case stringTag:return new Ctor(object);case regexpTag:var result=new Ctor(object.source,reFlags.exec(object));result.lastIndex=object.lastIndex}return result}function isBindable(func){var support=lodash.support,result=!(support.funcNames?func.name:support.funcDecomp);if(!result){var source=fnToString.call(func);if(!support.funcNames){result=!reFuncName.test(source)}if(!result){result=reThis.test(source)||isNative(func);baseSetData(func,result)}}return result}function isIndex(value,length){value=+value;length=length==null?MAX_SAFE_INTEGER:length;return value>-1&&value%1==0&&value<length}function isIterateeCall(value,index,object){if(!isObject(object)){return false}var type=typeof index;if(type=="number"){var length=object.length,prereq=isLength(length)&&isIndex(index,length)}else{prereq=type=="string"&&index in value}return prereq&&object[index]===value}function isLength(value){return typeof value=="number"&&value>-1&&value%1==0&&value<=MAX_SAFE_INTEGER}function isStrictComparable(value){return value===value&&(value===0?1/value>0:!isObject(value))}function mergeData(data,source){var bitmask=data[1],srcBitmask=source[1],newBitmask=bitmask|srcBitmask;var arityFlags=ARY_FLAG|REARG_FLAG,bindFlags=BIND_FLAG|BIND_KEY_FLAG,comboFlags=arityFlags|bindFlags|CURRY_BOUND_FLAG|CURRY_RIGHT_FLAG;var isAry=bitmask&ARY_FLAG&&!(srcBitmask&ARY_FLAG),isRearg=bitmask&REARG_FLAG&&!(srcBitmask&REARG_FLAG),argPos=(isRearg?data:source)[7],ary=(isAry?data:source)[8];var isCommon=!(bitmask>=REARG_FLAG&&srcBitmask>bindFlags)&&!(bitmask>bindFlags&&srcBitmask>=REARG_FLAG);var isCombo=newBitmask>=arityFlags&&newBitmask<=comboFlags&&(bitmask<REARG_FLAG||(isRearg||isAry)&&argPos.length<=ary);if(!(isCommon||isCombo)){return data}if(srcBitmask&BIND_FLAG){data[2]=source[2];newBitmask|=bitmask&BIND_FLAG?0:CURRY_BOUND_FLAG}var value=source[3];if(value){var partials=data[3];data[3]=partials?composeArgs(partials,value,source[4]):arrayCopy(value);data[4]=partials?replaceHolders(data[3],PLACEHOLDER):arrayCopy(source[4])}value=source[5];if(value){partials=data[5];data[5]=partials?composeArgsRight(partials,value,source[6]):arrayCopy(value);data[6]=partials?replaceHolders(data[5],PLACEHOLDER):arrayCopy(source[6])}value=source[7];if(value){data[7]=arrayCopy(value)}if(srcBitmask&ARY_FLAG){data[8]=data[8]==null?source[8]:nativeMin(data[8],source[8])}if(data[9]==null){data[9]=source[9]}data[0]=source[0];data[1]=newBitmask;return data}function pickByArray(object,props){object=toObject(object);var index=-1,length=props.length,result={};while(++index<length){var key=props[index];if(key in object){result[key]=object[key]}}return result}function pickByCallback(object,predicate){var result={};baseForIn(object,function(value,key,object){if(predicate(value,key,object)){result[key]=value}});return result}function reorder(array,indexes){var arrLength=array.length,length=nativeMin(indexes.length,arrLength),oldArray=arrayCopy(array);while(length--){var index=indexes[length];array[length]=isIndex(index,arrLength)?oldArray[index]:undefined}return array}var setData=function(){var count=0,lastCalled=0;return function(key,value){var stamp=now(),remaining=HOT_SPAN-(stamp-lastCalled);lastCalled=stamp;if(remaining>0){if(++count>=HOT_COUNT){return key}}else{count=0}return baseSetData(key,value)}}();function shimIsPlainObject(value){var Ctor,support=lodash.support;if(!(isObjectLike(value)&&objToString.call(value)==objectTag)||!hasOwnProperty.call(value,"constructor")&&(Ctor=value.constructor,typeof Ctor=="function"&&!(Ctor instanceof Ctor))){return false}var result;baseForIn(value,function(subValue,key){result=key});return typeof result=="undefined"||hasOwnProperty.call(value,result)}function shimKeys(object){var props=keysIn(object),propsLength=props.length,length=propsLength&&object.length,support=lodash.support;var allowIndexes=length&&isLength(length)&&(isArray(object)||support.nonEnumArgs&&isArguments(object));var index=-1,result=[];while(++index<propsLength){var key=props[index];if(allowIndexes&&isIndex(key,length)||hasOwnProperty.call(object,key)){result.push(key)}}return result}function toIterable(value){if(value==null){return[]}if(!isLength(value.length)){return values(value)}return isObject(value)?value:Object(value)}function toObject(value){return isObject(value)?value:Object(value)}function chunk(array,size,guard){if(guard?isIterateeCall(array,size,guard):size==null){size=1}else{size=nativeMax(+size||1,1)}var index=0,length=array?array.length:0,resIndex=-1,result=Array(ceil(length/size));while(index<length){result[++resIndex]=baseSlice(array,index,index+=size)}return result}function compact(array){var index=-1,length=array?array.length:0,resIndex=-1,result=[];while(++index<length){var value=array[index];if(value){result[++resIndex]=value}}return result}function difference(){var index=-1,length=arguments.length;while(++index<length){var value=arguments[index];if(isArray(value)||isArguments(value)){break}}return baseDifference(value,baseFlatten(arguments,false,true,++index))}function drop(array,n,guard){var length=array?array.length:0;if(!length){return[]}if(guard?isIterateeCall(array,n,guard):n==null){n=1}return baseSlice(array,n<0?0:n)}function dropRight(array,n,guard){var length=array?array.length:0;if(!length){return[]}if(guard?isIterateeCall(array,n,guard):n==null){n=1}n=length-(+n||0);return baseSlice(array,0,n<0?0:n)}function dropRightWhile(array,predicate,thisArg){var length=array?array.length:0;if(!length){return[]}predicate=getCallback(predicate,thisArg,3);while(length--&&predicate(array[length],length,array)){}return baseSlice(array,0,length+1)}function dropWhile(array,predicate,thisArg){var length=array?array.length:0;if(!length){return[]}var index=-1;predicate=getCallback(predicate,thisArg,3);while(++index<length&&predicate(array[index],index,array)){}return baseSlice(array,index)}function findIndex(array,predicate,thisArg){var index=-1,length=array?array.length:0;predicate=getCallback(predicate,thisArg,3);while(++index<length){if(predicate(array[index],index,array)){return index}}return-1}function findLastIndex(array,predicate,thisArg){var length=array?array.length:0;predicate=getCallback(predicate,thisArg,3);while(length--){if(predicate(array[length],length,array)){return length}}return-1}function first(array){return array?array[0]:undefined}function flatten(array,isDeep,guard){var length=array?array.length:0;if(guard&&isIterateeCall(array,isDeep,guard)){isDeep=false}return length?baseFlatten(array,isDeep):[]}function flattenDeep(array){var length=array?array.length:0;return length?baseFlatten(array,true):[]}function indexOf(array,value,fromIndex){var length=array?array.length:0;if(!length){return-1}if(typeof fromIndex=="number"){fromIndex=fromIndex<0?nativeMax(length+fromIndex,0):fromIndex||0}else if(fromIndex){var index=binaryIndex(array,value),other=array[index];return(value===value?value===other:other!==other)?index:-1}return baseIndexOf(array,value,fromIndex)}function initial(array){return dropRight(array,1)}function intersection(){var args=[],argsIndex=-1,argsLength=arguments.length,caches=[],indexOf=getIndexOf(),isCommon=indexOf==baseIndexOf;while(++argsIndex<argsLength){var value=arguments[argsIndex];if(isArray(value)||isArguments(value)){args.push(value);caches.push(isCommon&&value.length>=120&&createCache(argsIndex&&value))}}argsLength=args.length;var array=args[0],index=-1,length=array?array.length:0,result=[],seen=caches[0];outer:while(++index<length){value=array[index];if((seen?cacheIndexOf(seen,value):indexOf(result,value))<0){argsIndex=argsLength;while(--argsIndex){var cache=caches[argsIndex];if((cache?cacheIndexOf(cache,value):indexOf(args[argsIndex],value))<0){continue outer}}if(seen){seen.push(value)}result.push(value)}}return result}function last(array){var length=array?array.length:0;return length?array[length-1]:undefined}function lastIndexOf(array,value,fromIndex){var length=array?array.length:0;if(!length){return-1}var index=length;if(typeof fromIndex=="number"){index=(fromIndex<0?nativeMax(length+fromIndex,0):nativeMin(fromIndex||0,length-1))+1}else if(fromIndex){index=binaryIndex(array,value,true)-1;var other=array[index];return(value===value?value===other:other!==other)?index:-1}if(value!==value){return indexOfNaN(array,index,true)}while(index--){if(array[index]===value){return index}}return-1}function pull(){var array=arguments[0];if(!(array&&array.length)){return array}var index=0,indexOf=getIndexOf(),length=arguments.length;while(++index<length){var fromIndex=0,value=arguments[index];while((fromIndex=indexOf(array,value,fromIndex))>-1){splice.call(array,fromIndex,1)}}return array}function pullAt(array){return basePullAt(array||[],baseFlatten(arguments,false,false,1))}function remove(array,predicate,thisArg){var index=-1,length=array?array.length:0,result=[];predicate=getCallback(predicate,thisArg,3);while(++index<length){var value=array[index];if(predicate(value,index,array)){result.push(value);splice.call(array,index--,1);length--}}return result}function rest(array){return drop(array,1)}function slice(array,start,end){var length=array?array.length:0;if(!length){return[]}if(end&&typeof end!="number"&&isIterateeCall(array,start,end)){start=0;end=length}return baseSlice(array,start,end)}function sortedIndex(array,value,iteratee,thisArg){var func=getCallback(iteratee);return func===baseCallback&&iteratee==null?binaryIndex(array,value):binaryIndexBy(array,value,func(iteratee,thisArg,1))}function sortedLastIndex(array,value,iteratee,thisArg){var func=getCallback(iteratee);return func===baseCallback&&iteratee==null?binaryIndex(array,value,true):binaryIndexBy(array,value,func(iteratee,thisArg,1),true)}function take(array,n,guard){var length=array?array.length:0;if(!length){return[]}if(guard?isIterateeCall(array,n,guard):n==null){n=1}return baseSlice(array,0,n<0?0:n)}function takeRight(array,n,guard){var length=array?array.length:0;if(!length){return[]}if(guard?isIterateeCall(array,n,guard):n==null){n=1}n=length-(+n||0);return baseSlice(array,n<0?0:n)}function takeRightWhile(array,predicate,thisArg){var length=array?array.length:0;if(!length){return[]}predicate=getCallback(predicate,thisArg,3);while(length--&&predicate(array[length],length,array)){}return baseSlice(array,length+1)}function takeWhile(array,predicate,thisArg){var length=array?array.length:0;if(!length){return[]}var index=-1;predicate=getCallback(predicate,thisArg,3);while(++index<length&&predicate(array[index],index,array)){}return baseSlice(array,0,index)}function union(){return baseUniq(baseFlatten(arguments,false,true))}function uniq(array,isSorted,iteratee,thisArg){var length=array?array.length:0;if(!length){return[]}if(typeof isSorted!="boolean"&&isSorted!=null){thisArg=iteratee;iteratee=isIterateeCall(array,isSorted,thisArg)?null:isSorted;isSorted=false}var func=getCallback();if(!(func===baseCallback&&iteratee==null)){iteratee=func(iteratee,thisArg,3)}return isSorted&&getIndexOf()==baseIndexOf?sortedUniq(array,iteratee):baseUniq(array,iteratee)}function unzip(array){var index=-1,length=(array&&array.length&&arrayMax(arrayMap(array,getLength)))>>>0,result=Array(length);while(++index<length){result[index]=arrayMap(array,baseProperty(index))}return result}function without(array){return baseDifference(array,baseSlice(arguments,1))}function xor(){var index=-1,length=arguments.length;while(++index<length){var array=arguments[index];if(isArray(array)||isArguments(array)){var result=result?baseDifference(result,array).concat(baseDifference(array,result)):array}}return result?baseUniq(result):[]}function zip(){var length=arguments.length,array=Array(length);while(length--){array[length]=arguments[length]}return unzip(array)}function zipObject(props,values){var index=-1,length=props?props.length:0,result={};if(length&&!values&&!isArray(props[0])){values=[]}while(++index<length){var key=props[index];if(values){result[key]=values[index]}else if(key){result[key[0]]=key[1]}}return result}function chain(value){var result=lodash(value);result.__chain__=true;return result}function tap(value,interceptor,thisArg){interceptor.call(thisArg,value);return value}function thru(value,interceptor,thisArg){return interceptor.call(thisArg,value)}function wrapperChain(){return chain(this)}function wrapperReverse(){var value=this.__wrapped__;if(value instanceof LazyWrapper){return new LodashWrapper(value.reverse())}return this.thru(function(value){return value.reverse()})}function wrapperToString(){return this.value()+""}function wrapperValue(){return baseWrapperValue(this.__wrapped__,this.__actions__)}function at(collection){var length=collection?collection.length:0;if(isLength(length)){collection=toIterable(collection)}return baseAt(collection,baseFlatten(arguments,false,false,1))}function includes(collection,target,fromIndex){var length=collection?collection.length:0;if(!isLength(length)){collection=values(collection);length=collection.length}if(!length){return false}if(typeof fromIndex=="number"){fromIndex=fromIndex<0?nativeMax(length+fromIndex,0):fromIndex||0}else{fromIndex=0}return typeof collection=="string"||!isArray(collection)&&isString(collection)?fromIndex<length&&collection.indexOf(target,fromIndex)>-1:getIndexOf(collection,target,fromIndex)>-1}var countBy=createAggregator(function(result,value,key){hasOwnProperty.call(result,key)?++result[key]:result[key]=1});function every(collection,predicate,thisArg){var func=isArray(collection)?arrayEvery:baseEvery;if(typeof predicate!="function"||typeof thisArg!="undefined"){predicate=getCallback(predicate,thisArg,3)}return func(collection,predicate)}function filter(collection,predicate,thisArg){var func=isArray(collection)?arrayFilter:baseFilter;predicate=getCallback(predicate,thisArg,3);return func(collection,predicate)}function find(collection,predicate,thisArg){if(isArray(collection)){var index=findIndex(collection,predicate,thisArg);return index>-1?collection[index]:undefined}predicate=getCallback(predicate,thisArg,3);return baseFind(collection,predicate,baseEach)}function findLast(collection,predicate,thisArg){predicate=getCallback(predicate,thisArg,3);return baseFind(collection,predicate,baseEachRight)}function findWhere(collection,source){return find(collection,matches(source))}function forEach(collection,iteratee,thisArg){return typeof iteratee=="function"&&typeof thisArg=="undefined"&&isArray(collection)?arrayEach(collection,iteratee):baseEach(collection,bindCallback(iteratee,thisArg,3))}function forEachRight(collection,iteratee,thisArg){return typeof iteratee=="function"&&typeof thisArg=="undefined"&&isArray(collection)?arrayEachRight(collection,iteratee):baseEachRight(collection,bindCallback(iteratee,thisArg,3))}var groupBy=createAggregator(function(result,value,key){if(hasOwnProperty.call(result,key)){result[key].push(value)}else{result[key]=[value]}});var indexBy=createAggregator(function(result,value,key){result[key]=value});function invoke(collection,methodName){return baseInvoke(collection,methodName,baseSlice(arguments,2))}function map(collection,iteratee,thisArg){var func=isArray(collection)?arrayMap:baseMap;iteratee=getCallback(iteratee,thisArg,3);return func(collection,iteratee)}var max=createExtremum(arrayMax);var min=createExtremum(arrayMin,true);var partition=createAggregator(function(result,value,key){result[key?0:1].push(value)},function(){return[[],[]]});function pluck(collection,key){return map(collection,property(key))}function reduce(collection,iteratee,accumulator,thisArg){var func=isArray(collection)?arrayReduce:baseReduce;return func(collection,getCallback(iteratee,thisArg,4),accumulator,arguments.length<3,baseEach)}function reduceRight(collection,iteratee,accumulator,thisArg){var func=isArray(collection)?arrayReduceRight:baseReduce;return func(collection,getCallback(iteratee,thisArg,4),accumulator,arguments.length<3,baseEachRight)}function reject(collection,predicate,thisArg){var func=isArray(collection)?arrayFilter:baseFilter;predicate=getCallback(predicate,thisArg,3);return func(collection,function(value,index,collection){return!predicate(value,index,collection)})}function sample(collection,n,guard){if(guard?isIterateeCall(collection,n,guard):n==null){collection=toIterable(collection);var length=collection.length;return length>0?collection[baseRandom(0,length-1)]:undefined}var result=shuffle(collection);result.length=nativeMin(n<0?0:+n||0,result.length);return result}function shuffle(collection){collection=toIterable(collection);var index=-1,length=collection.length,result=Array(length);while(++index<length){var rand=baseRandom(0,index);if(index!=rand){result[index]=result[rand]}result[rand]=collection[index]}return result}function size(collection){var length=collection?collection.length:0;return isLength(length)?length:keys(collection).length}function some(collection,predicate,thisArg){var func=isArray(collection)?arraySome:baseSome;if(typeof predicate!="function"||typeof thisArg!="undefined"){predicate=getCallback(predicate,thisArg,3)}return func(collection,predicate)}function sortBy(collection,iteratee,thisArg){var index=-1,length=collection?collection.length:0,result=isLength(length)?Array(length):[];if(thisArg&&isIterateeCall(collection,iteratee,thisArg)){iteratee=null}iteratee=getCallback(iteratee,thisArg,3);baseEach(collection,function(value,key,collection){result[++index]={criteria:iteratee(value,key,collection),index:index,value:value}});return baseSortBy(result,compareAscending)}function sortByAll(collection){var args=arguments;if(args.length>3&&isIterateeCall(args[1],args[2],args[3])){args=[collection,args[1]]}var index=-1,length=collection?collection.length:0,props=baseFlatten(args,false,false,1),result=isLength(length)?Array(length):[];baseEach(collection,function(value,key,collection){var length=props.length,criteria=Array(length);while(length--){criteria[length]=value==null?undefined:value[props[length]]}result[++index]={criteria:criteria,index:index,value:value}});return baseSortBy(result,compareMultipleAscending)}function where(collection,source){return filter(collection,matches(source))}var now=nativeNow||function(){return(new Date).getTime()};function after(n,func){if(!isFunction(func)){if(isFunction(n)){var temp=n;n=func;func=temp}else{throw new TypeError(FUNC_ERROR_TEXT)}}n=nativeIsFinite(n=+n)?n:0;return function(){if(--n<1){return func.apply(this,arguments)}}}function ary(func,n,guard){if(guard&&isIterateeCall(func,n,guard)){n=null}n=func&&n==null?func.length:nativeMax(+n||0,0);return createWrapper(func,ARY_FLAG,null,null,null,null,n)}function before(n,func){var result;if(!isFunction(func)){if(isFunction(n)){var temp=n;n=func;func=temp}else{throw new TypeError(FUNC_ERROR_TEXT)}}return function(){if(--n>0){result=func.apply(this,arguments)}else{func=null}return result}}function bind(func,thisArg){var bitmask=BIND_FLAG;if(arguments.length>2){var partials=baseSlice(arguments,2),holders=replaceHolders(partials,bind.placeholder);bitmask|=PARTIAL_FLAG}return createWrapper(func,bitmask,thisArg,partials,holders)}function bindAll(object){return baseBindAll(object,arguments.length>1?baseFlatten(arguments,false,false,1):functions(object))}function bindKey(object,key){var bitmask=BIND_FLAG|BIND_KEY_FLAG;if(arguments.length>2){var partials=baseSlice(arguments,2),holders=replaceHolders(partials,bindKey.placeholder);bitmask|=PARTIAL_FLAG}return createWrapper(key,bitmask,object,partials,holders)}function curry(func,arity,guard){if(guard&&isIterateeCall(func,arity,guard)){arity=null}var result=createWrapper(func,CURRY_FLAG,null,null,null,null,null,arity);result.placeholder=curry.placeholder;return result}function curryRight(func,arity,guard){if(guard&&isIterateeCall(func,arity,guard)){arity=null}var result=createWrapper(func,CURRY_RIGHT_FLAG,null,null,null,null,null,arity);result.placeholder=curryRight.placeholder;return result}function debounce(func,wait,options){var args,maxTimeoutId,result,stamp,thisArg,timeoutId,trailingCall,lastCalled=0,maxWait=false,trailing=true;if(!isFunction(func)){throw new TypeError(FUNC_ERROR_TEXT)}wait=wait<0?0:wait;if(options===true){var leading=true;trailing=false}else if(isObject(options)){leading=options.leading;maxWait="maxWait"in options&&nativeMax(+options.maxWait||0,wait);trailing="trailing"in options?options.trailing:trailing}function cancel(){if(timeoutId){clearTimeout(timeoutId)}if(maxTimeoutId){clearTimeout(maxTimeoutId)}maxTimeoutId=timeoutId=trailingCall=undefined}function delayed(){var remaining=wait-(now()-stamp);if(remaining<=0||remaining>wait){if(maxTimeoutId){clearTimeout(maxTimeoutId)}var isCalled=trailingCall;maxTimeoutId=timeoutId=trailingCall=undefined;if(isCalled){lastCalled=now();result=func.apply(thisArg,args);if(!timeoutId&&!maxTimeoutId){args=thisArg=null}}}else{timeoutId=setTimeout(delayed,remaining)}}function maxDelayed(){if(timeoutId){clearTimeout(timeoutId)}maxTimeoutId=timeoutId=trailingCall=undefined;if(trailing||maxWait!==wait){lastCalled=now();result=func.apply(thisArg,args);if(!timeoutId&&!maxTimeoutId){args=thisArg=null}}}function debounced(){args=arguments;stamp=now();thisArg=this;trailingCall=trailing&&(timeoutId||!leading);if(maxWait===false){var leadingCall=leading&&!timeoutId}else{if(!maxTimeoutId&&!leading){lastCalled=stamp}var remaining=maxWait-(stamp-lastCalled),isCalled=remaining<=0||remaining>maxWait;if(isCalled){if(maxTimeoutId){maxTimeoutId=clearTimeout(maxTimeoutId)}lastCalled=stamp;result=func.apply(thisArg,args)}else if(!maxTimeoutId){maxTimeoutId=setTimeout(maxDelayed,remaining)}}if(isCalled&&timeoutId){timeoutId=clearTimeout(timeoutId)}else if(!timeoutId&&wait!==maxWait){timeoutId=setTimeout(delayed,wait)}if(leadingCall){isCalled=true;result=func.apply(thisArg,args)}if(isCalled&&!timeoutId&&!maxTimeoutId){args=thisArg=null}return result}debounced.cancel=cancel;return debounced}function defer(func){return baseDelay(func,1,arguments,1)}function delay(func,wait){return baseDelay(func,wait,arguments,2)}function flow(){var funcs=arguments,length=funcs.length;if(!length){return function(){}}if(!arrayEvery(funcs,isFunction)){throw new TypeError(FUNC_ERROR_TEXT)}return function(){var index=0,result=funcs[index].apply(this,arguments);while(++index<length){result=funcs[index].call(this,result)}return result}}function flowRight(){var funcs=arguments,fromIndex=funcs.length-1;if(fromIndex<0){return function(){}}if(!arrayEvery(funcs,isFunction)){throw new TypeError(FUNC_ERROR_TEXT)}return function(){var index=fromIndex,result=funcs[index].apply(this,arguments);while(index--){result=funcs[index].call(this,result)}return result}}function memoize(func,resolver){if(!isFunction(func)||resolver&&!isFunction(resolver)){throw new TypeError(FUNC_ERROR_TEXT)}var memoized=function(){var cache=memoized.cache,key=resolver?resolver.apply(this,arguments):arguments[0];if(cache.has(key)){return cache.get(key)}var result=func.apply(this,arguments);cache.set(key,result);return result};memoized.cache=new memoize.Cache;return memoized}function negate(predicate){if(!isFunction(predicate)){throw new TypeError(FUNC_ERROR_TEXT)}return function(){return!predicate.apply(this,arguments)}}function once(func){return before(func,2)}function partial(func){var partials=baseSlice(arguments,1),holders=replaceHolders(partials,partial.placeholder);return createWrapper(func,PARTIAL_FLAG,null,partials,holders)}function partialRight(func){var partials=baseSlice(arguments,1),holders=replaceHolders(partials,partialRight.placeholder);return createWrapper(func,PARTIAL_RIGHT_FLAG,null,partials,holders)
}function rearg(func){var indexes=baseFlatten(arguments,false,false,1);return createWrapper(func,REARG_FLAG,null,null,null,indexes)}function throttle(func,wait,options){var leading=true,trailing=true;if(!isFunction(func)){throw new TypeError(FUNC_ERROR_TEXT)}if(options===false){leading=false}else if(isObject(options)){leading="leading"in options?!!options.leading:leading;trailing="trailing"in options?!!options.trailing:trailing}debounceOptions.leading=leading;debounceOptions.maxWait=+wait;debounceOptions.trailing=trailing;return debounce(func,wait,debounceOptions)}function wrap(value,wrapper){wrapper=wrapper==null?identity:wrapper;return createWrapper(wrapper,PARTIAL_FLAG,null,[value],[])}function clone(value,isDeep,customizer,thisArg){if(typeof isDeep!="boolean"&&isDeep!=null){thisArg=customizer;customizer=isIterateeCall(value,isDeep,thisArg)?null:isDeep;isDeep=false}customizer=typeof customizer=="function"&&bindCallback(customizer,thisArg,1);return baseClone(value,isDeep,customizer)}function cloneDeep(value,customizer,thisArg){customizer=typeof customizer=="function"&&bindCallback(customizer,thisArg,1);return baseClone(value,true,customizer)}function isArguments(value){var length=isObjectLike(value)?value.length:undefined;return isLength(length)&&objToString.call(value)==argsTag||false}var isArray=nativeIsArray||function(value){return isObjectLike(value)&&isLength(value.length)&&objToString.call(value)==arrayTag||false};function isBoolean(value){return value===true||value===false||isObjectLike(value)&&objToString.call(value)==boolTag||false}function isDate(value){return isObjectLike(value)&&objToString.call(value)==dateTag||false}function isElement(value){return value&&value.nodeType===1&&isObjectLike(value)&&objToString.call(value).indexOf("Element")>-1||false}if(!support.dom){isElement=function(value){return value&&value.nodeType===1&&isObjectLike(value)&&!isPlainObject(value)||false}}function isEmpty(value){if(value==null){return true}var length=value.length;if(isLength(length)&&(isArray(value)||isString(value)||isArguments(value)||isObjectLike(value)&&isFunction(value.splice))){return!length}return!keys(value).length}function isEqual(value,other,customizer,thisArg){customizer=typeof customizer=="function"&&bindCallback(customizer,thisArg,3);if(!customizer&&isStrictComparable(value)&&isStrictComparable(other)){return value===other}var result=customizer?customizer(value,other):undefined;return typeof result=="undefined"?baseIsEqual(value,other,customizer):!!result}function isError(value){return isObjectLike(value)&&typeof value.message=="string"&&objToString.call(value)==errorTag||false}var isFinite=nativeNumIsFinite||function(value){return typeof value=="number"&&nativeIsFinite(value)};function isFunction(value){return typeof value=="function"||false}if(isFunction(/x/)||Uint8Array&&!isFunction(Uint8Array)){isFunction=function(value){return objToString.call(value)==funcTag}}function isObject(value){var type=typeof value;return type=="function"||value&&type=="object"||false}function isMatch(object,source,customizer,thisArg){var props=keys(source),length=props.length;customizer=typeof customizer=="function"&&bindCallback(customizer,thisArg,3);if(!customizer&&length==1){var key=props[0],value=source[key];if(isStrictComparable(value)){return object!=null&&value===object[key]&&hasOwnProperty.call(object,key)}}var values=Array(length),strictCompareFlags=Array(length);while(length--){value=values[length]=source[props[length]];strictCompareFlags[length]=isStrictComparable(value)}return baseIsMatch(object,props,values,strictCompareFlags,customizer)}function isNaN(value){return isNumber(value)&&value!=+value}function isNative(value){if(value==null){return false}if(objToString.call(value)==funcTag){return reNative.test(fnToString.call(value))}return isObjectLike(value)&&reHostCtor.test(value)||false}function isNull(value){return value===null}function isNumber(value){return typeof value=="number"||isObjectLike(value)&&objToString.call(value)==numberTag||false}var isPlainObject=!getPrototypeOf?shimIsPlainObject:function(value){if(!(value&&objToString.call(value)==objectTag)){return false}var valueOf=value.valueOf,objProto=isNative(valueOf)&&(objProto=getPrototypeOf(valueOf))&&getPrototypeOf(objProto);return objProto?value==objProto||getPrototypeOf(value)==objProto:shimIsPlainObject(value)};function isRegExp(value){return isObjectLike(value)&&objToString.call(value)==regexpTag||false}function isString(value){return typeof value=="string"||isObjectLike(value)&&objToString.call(value)==stringTag||false}function isTypedArray(value){return isObjectLike(value)&&isLength(value.length)&&typedArrayTags[objToString.call(value)]||false}function isUndefined(value){return typeof value=="undefined"}function toArray(value){var length=value?value.length:0;if(!isLength(length)){return values(value)}if(!length){return[]}return arrayCopy(value)}function toPlainObject(value){return baseCopy(value,keysIn(value))}var assign=createAssigner(baseAssign);function create(prototype,properties,guard){var result=baseCreate(prototype);if(guard&&isIterateeCall(prototype,properties,guard)){properties=null}return properties?baseCopy(properties,result,keys(properties)):result}function defaults(object){if(object==null){return object}var args=arrayCopy(arguments);args.push(assignDefaults);return assign.apply(undefined,args)}function findKey(object,predicate,thisArg){predicate=getCallback(predicate,thisArg,3);return baseFind(object,predicate,baseForOwn,true)}function findLastKey(object,predicate,thisArg){predicate=getCallback(predicate,thisArg,3);return baseFind(object,predicate,baseForOwnRight,true)}function forIn(object,iteratee,thisArg){if(typeof iteratee!="function"||typeof thisArg!="undefined"){iteratee=bindCallback(iteratee,thisArg,3)}return baseFor(object,iteratee,keysIn)}function forInRight(object,iteratee,thisArg){iteratee=bindCallback(iteratee,thisArg,3);return baseForRight(object,iteratee,keysIn)}function forOwn(object,iteratee,thisArg){if(typeof iteratee!="function"||typeof thisArg!="undefined"){iteratee=bindCallback(iteratee,thisArg,3)}return baseForOwn(object,iteratee)}function forOwnRight(object,iteratee,thisArg){iteratee=bindCallback(iteratee,thisArg,3);return baseForRight(object,iteratee,keys)}function functions(object){return baseFunctions(object,keysIn(object))}function has(object,key){return object?hasOwnProperty.call(object,key):false}function invert(object,multiValue,guard){if(guard&&isIterateeCall(object,multiValue,guard)){multiValue=null}var index=-1,props=keys(object),length=props.length,result={};while(++index<length){var key=props[index],value=object[key];if(multiValue){if(hasOwnProperty.call(result,value)){result[value].push(key)}else{result[value]=[key]}}else{result[value]=key}}return result}var keys=!nativeKeys?shimKeys:function(object){if(object){var Ctor=object.constructor,length=object.length}if(typeof Ctor=="function"&&Ctor.prototype===object||typeof object!="function"&&(length&&isLength(length))){return shimKeys(object)}return isObject(object)?nativeKeys(object):[]};function keysIn(object){if(object==null){return[]}if(!isObject(object)){object=Object(object)}var length=object.length;length=length&&isLength(length)&&(isArray(object)||support.nonEnumArgs&&isArguments(object))&&length||0;var Ctor=object.constructor,index=-1,isProto=typeof Ctor=="function"&&Ctor.prototype==object,result=Array(length),skipIndexes=length>0;while(++index<length){result[index]=index+""}for(var key in object){if(!(skipIndexes&&isIndex(key,length))&&!(key=="constructor"&&(isProto||!hasOwnProperty.call(object,key)))){result.push(key)}}return result}function mapValues(object,iteratee,thisArg){var result={};iteratee=getCallback(iteratee,thisArg,3);baseForOwn(object,function(value,key,object){result[key]=iteratee(value,key,object)});return result}var merge=createAssigner(baseMerge);function omit(object,predicate,thisArg){if(object==null){return{}}if(typeof predicate!="function"){var props=arrayMap(baseFlatten(arguments,false,false,1),String);return pickByArray(object,baseDifference(keysIn(object),props))}predicate=bindCallback(predicate,thisArg,3);return pickByCallback(object,function(value,key,object){return!predicate(value,key,object)})}function pairs(object){var index=-1,props=keys(object),length=props.length,result=Array(length);while(++index<length){var key=props[index];result[index]=[key,object[key]]}return result}function pick(object,predicate,thisArg){if(object==null){return{}}return typeof predicate=="function"?pickByCallback(object,bindCallback(predicate,thisArg,3)):pickByArray(object,baseFlatten(arguments,false,false,1))}function result(object,key,defaultValue){var value=object==null?undefined:object[key];if(typeof value=="undefined"){value=defaultValue}return isFunction(value)?value.call(object):value}function transform(object,iteratee,accumulator,thisArg){var isArr=isArray(object)||isTypedArray(object);iteratee=getCallback(iteratee,thisArg,4);if(accumulator==null){if(isArr||isObject(object)){var Ctor=object.constructor;if(isArr){accumulator=isArray(object)?new Ctor:[]}else{accumulator=baseCreate(typeof Ctor=="function"&&Ctor.prototype)}}else{accumulator={}}}(isArr?arrayEach:baseForOwn)(object,function(value,index,object){return iteratee(accumulator,value,index,object)});return accumulator}function values(object){return baseValues(object,keys(object))}function valuesIn(object){return baseValues(object,keysIn(object))}function random(min,max,floating){if(floating&&isIterateeCall(min,max,floating)){max=floating=null}var noMin=min==null,noMax=max==null;if(floating==null){if(noMax&&typeof min=="boolean"){floating=min;min=1}else if(typeof max=="boolean"){floating=max;noMax=true}}if(noMin&&noMax){max=1;noMax=false}min=+min||0;if(noMax){max=min;min=0}else{max=+max||0}if(floating||min%1||max%1){var rand=nativeRandom();return nativeMin(min+rand*(max-min+parseFloat("1e-"+((rand+"").length-1))),max)}return baseRandom(min,max)}var camelCase=createCompounder(function(result,word,index){word=word.toLowerCase();return index?result+word.charAt(0).toUpperCase()+word.slice(1):word});function capitalize(string){string=baseToString(string);return string&&string.charAt(0).toUpperCase()+string.slice(1)}function deburr(string){string=baseToString(string);return string&&string.replace(reLatin1,deburrLetter)}function endsWith(string,target,position){string=baseToString(string);target=target+"";var length=string.length;position=(typeof position=="undefined"?length:nativeMin(position<0?0:+position||0,length))-target.length;return position>=0&&string.indexOf(target,position)==position}function escape(string){string=baseToString(string);return string&&reHasUnescapedHtml.test(string)?string.replace(reUnescapedHtml,escapeHtmlChar):string}function escapeRegExp(string){string=baseToString(string);return string&&reHasRegExpChars.test(string)?string.replace(reRegExpChars,"\\$&"):string}var kebabCase=createCompounder(function(result,word,index){return result+(index?"-":"")+word.toLowerCase()});function pad(string,length,chars){string=baseToString(string);length=+length;var strLength=string.length;if(strLength>=length||!nativeIsFinite(length)){return string}var mid=(length-strLength)/2,leftLength=floor(mid),rightLength=ceil(mid);chars=createPad("",rightLength,chars);return chars.slice(0,leftLength)+string+chars}function padLeft(string,length,chars){string=baseToString(string);return string&&createPad(string,length,chars)+string}function padRight(string,length,chars){string=baseToString(string);return string&&string+createPad(string,length,chars)}function parseInt(string,radix,guard){if(guard&&isIterateeCall(string,radix,guard)){radix=0}return nativeParseInt(string,radix)}if(nativeParseInt(whitespace+"08")!=8){parseInt=function(string,radix,guard){if(guard?isIterateeCall(string,radix,guard):radix==null){radix=0}else if(radix){radix=+radix}string=trim(string);return nativeParseInt(string,radix||(reHexPrefix.test(string)?16:10))}}function repeat(string,n){var result="";string=baseToString(string);n=+n;if(n<1||!string||!nativeIsFinite(n)){return result}do{if(n%2){result+=string}n=floor(n/2);string+=string}while(n);return result}var snakeCase=createCompounder(function(result,word,index){return result+(index?"_":"")+word.toLowerCase()});function startsWith(string,target,position){string=baseToString(string);position=position==null?0:nativeMin(position<0?0:+position||0,string.length);return string.lastIndexOf(target,position)==position}function template(string,options,otherOptions){var settings=lodash.templateSettings;if(otherOptions&&isIterateeCall(string,options,otherOptions)){options=otherOptions=null}string=baseToString(string);options=baseAssign(baseAssign({},otherOptions||options),settings,assignOwnDefaults);var imports=baseAssign(baseAssign({},options.imports),settings.imports,assignOwnDefaults),importsKeys=keys(imports),importsValues=baseValues(imports,importsKeys);var isEscaping,isEvaluating,index=0,interpolate=options.interpolate||reNoMatch,source="__p += '";var reDelimiters=RegExp((options.escape||reNoMatch).source+"|"+interpolate.source+"|"+(interpolate===reInterpolate?reEsTemplate:reNoMatch).source+"|"+(options.evaluate||reNoMatch).source+"|$","g");var sourceURL="//# sourceURL="+("sourceURL"in options?options.sourceURL:"lodash.templateSources["+ ++templateCounter+"]")+"\n";string.replace(reDelimiters,function(match,escapeValue,interpolateValue,esTemplateValue,evaluateValue,offset){interpolateValue||(interpolateValue=esTemplateValue);source+=string.slice(index,offset).replace(reUnescapedString,escapeStringChar);if(escapeValue){isEscaping=true;source+="' +\n__e("+escapeValue+") +\n'"}if(evaluateValue){isEvaluating=true;source+="';\n"+evaluateValue+";\n__p += '"}if(interpolateValue){source+="' +\n((__t = ("+interpolateValue+")) == null ? '' : __t) +\n'"}index=offset+match.length;return match});source+="';\n";var variable=options.variable;if(!variable){source="with (obj) {\n"+source+"\n}\n"}source=(isEvaluating?source.replace(reEmptyStringLeading,""):source).replace(reEmptyStringMiddle,"$1").replace(reEmptyStringTrailing,"$1;");source="function("+(variable||"obj")+") {\n"+(variable?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(isEscaping?", __e = _.escape":"")+(isEvaluating?", __j = Array.prototype.join;\n"+"function print() { __p += __j.call(arguments, '') }\n":";\n")+source+"return __p\n}";var result=attempt(function(){return Function(importsKeys,sourceURL+"return "+source).apply(undefined,importsValues)});result.source=source;if(isError(result)){throw result}return result}function trim(string,chars,guard){var value=string;string=baseToString(string);if(!string){return string}if(guard?isIterateeCall(value,chars,guard):chars==null){return string.slice(trimmedLeftIndex(string),trimmedRightIndex(string)+1)}chars=baseToString(chars);return string.slice(charsLeftIndex(string,chars),charsRightIndex(string,chars)+1)}function trimLeft(string,chars,guard){var value=string;string=baseToString(string);if(!string){return string}if(guard?isIterateeCall(value,chars,guard):chars==null){return string.slice(trimmedLeftIndex(string))}return string.slice(charsLeftIndex(string,baseToString(chars)))}function trimRight(string,chars,guard){var value=string;string=baseToString(string);if(!string){return string}if(guard?isIterateeCall(value,chars,guard):chars==null){return string.slice(0,trimmedRightIndex(string)+1)}return string.slice(0,charsRightIndex(string,baseToString(chars))+1)}function trunc(string,options,guard){if(guard&&isIterateeCall(string,options,guard)){options=null}var length=DEFAULT_TRUNC_LENGTH,omission=DEFAULT_TRUNC_OMISSION;if(options!=null){if(isObject(options)){var separator="separator"in options?options.separator:separator;length="length"in options?+options.length||0:length;omission="omission"in options?baseToString(options.omission):omission}else{length=+options||0}}string=baseToString(string);if(length>=string.length){return string}var end=length-omission.length;if(end<1){return omission}var result=string.slice(0,end);if(separator==null){return result+omission}if(isRegExp(separator)){if(string.slice(end).search(separator)){var match,newEnd,substring=string.slice(0,end);if(!separator.global){separator=RegExp(separator.source,(reFlags.exec(separator)||"")+"g")}separator.lastIndex=0;while(match=separator.exec(substring)){newEnd=match.index}result=result.slice(0,newEnd==null?end:newEnd)}}else if(string.indexOf(separator,end)!=end){var index=result.lastIndexOf(separator);if(index>-1){result=result.slice(0,index)}}return result+omission}function unescape(string){string=baseToString(string);return string&&reHasEscapedHtml.test(string)?string.replace(reEscapedHtml,unescapeHtmlChar):string}function words(string,pattern,guard){if(guard&&isIterateeCall(string,pattern,guard)){pattern=null}string=baseToString(string);return string.match(pattern||reWords)||[]}function attempt(func){try{return func()}catch(e){return isError(e)?e:Error(e)}}function callback(func,thisArg,guard){if(guard&&isIterateeCall(func,thisArg,guard)){thisArg=null}return baseCallback(func,thisArg)}function constant(value){return function(){return value}}function identity(value){return value}function matches(source){return baseMatches(source,true)}function mixin(object,source,options){if(options==null){var isObj=isObject(source),props=isObj&&keys(source),methodNames=props&&props.length&&baseFunctions(source,props);if(!(methodNames?methodNames.length:isObj)){methodNames=false;options=source;source=object;object=this}}if(!methodNames){methodNames=baseFunctions(source,keys(source))}var chain=true,index=-1,isFunc=isFunction(object),length=methodNames.length;if(options===false){chain=false}else if(isObject(options)&&"chain"in options){chain=options.chain}while(++index<length){var methodName=methodNames[index],func=source[methodName];object[methodName]=func;if(isFunc){object.prototype[methodName]=function(func){return function(){var chainAll=this.__chain__;if(chain||chainAll){var result=object(this.__wrapped__);(result.__actions__=arrayCopy(this.__actions__)).push({func:func,args:arguments,thisArg:object});result.__chain__=chainAll;return result}var args=[this.value()];push.apply(args,arguments);return func.apply(object,args)}}(func)}}return object}function noConflict(){context._=oldDash;return this}function noop(){}function property(key){return baseProperty(key+"")}function propertyOf(object){return function(key){return object==null?undefined:object[key]}}function range(start,end,step){if(step&&isIterateeCall(start,end,step)){end=step=null}start=+start||0;step=step==null?1:+step||0;if(end==null){end=start;start=0}else{end=+end||0}var index=-1,length=nativeMax(ceil((end-start)/(step||1)),0),result=Array(length);while(++index<length){result[index]=start;start+=step}return result}function times(n,iteratee,thisArg){n=+n;if(n<1||!nativeIsFinite(n)){return[]}var index=-1,result=Array(nativeMin(n,MAX_ARRAY_LENGTH));iteratee=bindCallback(iteratee,thisArg,1);while(++index<n){if(index<MAX_ARRAY_LENGTH){result[index]=iteratee(index)}else{iteratee(index)}}return result}function uniqueId(prefix){var id=++idCounter;return baseToString(prefix)+id}LodashWrapper.prototype=lodash.prototype;MapCache.prototype["delete"]=mapDelete;MapCache.prototype.get=mapGet;MapCache.prototype.has=mapHas;MapCache.prototype.set=mapSet;SetCache.prototype.push=cachePush;memoize.Cache=MapCache;lodash.after=after;lodash.ary=ary;lodash.assign=assign;lodash.at=at;lodash.before=before;lodash.bind=bind;lodash.bindAll=bindAll;lodash.bindKey=bindKey;lodash.callback=callback;lodash.chain=chain;lodash.chunk=chunk;lodash.compact=compact;lodash.constant=constant;lodash.countBy=countBy;lodash.create=create;lodash.curry=curry;lodash.curryRight=curryRight;lodash.debounce=debounce;lodash.defaults=defaults;lodash.defer=defer;lodash.delay=delay;lodash.difference=difference;lodash.drop=drop;lodash.dropRight=dropRight;lodash.dropRightWhile=dropRightWhile;lodash.dropWhile=dropWhile;lodash.filter=filter;lodash.flatten=flatten;lodash.flattenDeep=flattenDeep;lodash.flow=flow;lodash.flowRight=flowRight;lodash.forEach=forEach;lodash.forEachRight=forEachRight;lodash.forIn=forIn;lodash.forInRight=forInRight;lodash.forOwn=forOwn;lodash.forOwnRight=forOwnRight;lodash.functions=functions;lodash.groupBy=groupBy;lodash.indexBy=indexBy;lodash.initial=initial;lodash.intersection=intersection;lodash.invert=invert;lodash.invoke=invoke;lodash.keys=keys;lodash.keysIn=keysIn;lodash.map=map;lodash.mapValues=mapValues;lodash.matches=matches;lodash.memoize=memoize;lodash.merge=merge;lodash.mixin=mixin;lodash.negate=negate;lodash.omit=omit;lodash.once=once;lodash.pairs=pairs;lodash.partial=partial;lodash.partialRight=partialRight;lodash.partition=partition;lodash.pick=pick;lodash.pluck=pluck;lodash.property=property;lodash.propertyOf=propertyOf;lodash.pull=pull;lodash.pullAt=pullAt;lodash.range=range;lodash.rearg=rearg;lodash.reject=reject;lodash.remove=remove;lodash.rest=rest;lodash.shuffle=shuffle;lodash.slice=slice;lodash.sortBy=sortBy;lodash.sortByAll=sortByAll;lodash.take=take;lodash.takeRight=takeRight;lodash.takeRightWhile=takeRightWhile;lodash.takeWhile=takeWhile;lodash.tap=tap;lodash.throttle=throttle;lodash.thru=thru;lodash.times=times;lodash.toArray=toArray;lodash.toPlainObject=toPlainObject;lodash.transform=transform;lodash.union=union;lodash.uniq=uniq;lodash.unzip=unzip;lodash.values=values;lodash.valuesIn=valuesIn;lodash.where=where;lodash.without=without;lodash.wrap=wrap;lodash.xor=xor;lodash.zip=zip;lodash.zipObject=zipObject;lodash.backflow=flowRight;lodash.collect=map;lodash.compose=flowRight;lodash.each=forEach;lodash.eachRight=forEachRight;lodash.extend=assign;lodash.iteratee=callback;lodash.methods=functions;lodash.object=zipObject;lodash.select=filter;lodash.tail=rest;lodash.unique=uniq;mixin(lodash,lodash);lodash.attempt=attempt;lodash.camelCase=camelCase;lodash.capitalize=capitalize;lodash.clone=clone;lodash.cloneDeep=cloneDeep;lodash.deburr=deburr;lodash.endsWith=endsWith;lodash.escape=escape;lodash.escapeRegExp=escapeRegExp;lodash.every=every;lodash.find=find;lodash.findIndex=findIndex;lodash.findKey=findKey;lodash.findLast=findLast;lodash.findLastIndex=findLastIndex;lodash.findLastKey=findLastKey;lodash.findWhere=findWhere;lodash.first=first;lodash.has=has;lodash.identity=identity;lodash.includes=includes;lodash.indexOf=indexOf;lodash.isArguments=isArguments;lodash.isArray=isArray;lodash.isBoolean=isBoolean;lodash.isDate=isDate;lodash.isElement=isElement;lodash.isEmpty=isEmpty;lodash.isEqual=isEqual;lodash.isError=isError;lodash.isFinite=isFinite;lodash.isFunction=isFunction;lodash.isMatch=isMatch;lodash.isNaN=isNaN;lodash.isNative=isNative;lodash.isNull=isNull;lodash.isNumber=isNumber;lodash.isObject=isObject;lodash.isPlainObject=isPlainObject;lodash.isRegExp=isRegExp;lodash.isString=isString;lodash.isTypedArray=isTypedArray;lodash.isUndefined=isUndefined;lodash.kebabCase=kebabCase;lodash.last=last;lodash.lastIndexOf=lastIndexOf;lodash.max=max;lodash.min=min;lodash.noConflict=noConflict;lodash.noop=noop;lodash.now=now;lodash.pad=pad;lodash.padLeft=padLeft;lodash.padRight=padRight;lodash.parseInt=parseInt;lodash.random=random;lodash.reduce=reduce;lodash.reduceRight=reduceRight;lodash.repeat=repeat;lodash.result=result;lodash.runInContext=runInContext;lodash.size=size;lodash.snakeCase=snakeCase;lodash.some=some;lodash.sortedIndex=sortedIndex;lodash.sortedLastIndex=sortedLastIndex;lodash.startsWith=startsWith;lodash.template=template;lodash.trim=trim;lodash.trimLeft=trimLeft;lodash.trimRight=trimRight;lodash.trunc=trunc;lodash.unescape=unescape;lodash.uniqueId=uniqueId;lodash.words=words;lodash.all=every;lodash.any=some;lodash.contains=includes;lodash.detect=find;lodash.foldl=reduce;lodash.foldr=reduceRight;lodash.head=first;lodash.include=includes;lodash.inject=reduce;mixin(lodash,function(){var source={};baseForOwn(lodash,function(func,methodName){if(!lodash.prototype[methodName]){source[methodName]=func}});return source}(),false);lodash.sample=sample;lodash.prototype.sample=function(n){if(!this.__chain__&&n==null){return sample(this.value())}return this.thru(function(value){return sample(value,n)})};lodash.VERSION=VERSION;arrayEach(["bind","bindKey","curry","curryRight","partial","partialRight"],function(methodName){lodash[methodName].placeholder=lodash});arrayEach(["filter","map","takeWhile"],function(methodName,index){var isFilter=index==LAZY_FILTER_FLAG;LazyWrapper.prototype[methodName]=function(iteratee,thisArg){var result=this.clone(),filtered=result.filtered,iteratees=result.iteratees||(result.iteratees=[]);result.filtered=filtered||isFilter||index==LAZY_WHILE_FLAG&&result.dir<0;iteratees.push({iteratee:getCallback(iteratee,thisArg,3),type:index});return result}});arrayEach(["drop","take"],function(methodName,index){var countName=methodName+"Count",whileName=methodName+"While";LazyWrapper.prototype[methodName]=function(n){n=n==null?1:nativeMax(+n||0,0);var result=this.clone();if(result.filtered){var value=result[countName];result[countName]=index?nativeMin(value,n):value+n}else{var views=result.views||(result.views=[]);views.push({size:n,type:methodName+(result.dir<0?"Right":"")})}return result};LazyWrapper.prototype[methodName+"Right"]=function(n){return this.reverse()[methodName](n).reverse()};LazyWrapper.prototype[methodName+"RightWhile"]=function(predicate,thisArg){return this.reverse()[whileName](predicate,thisArg).reverse()}});arrayEach(["first","last"],function(methodName,index){var takeName="take"+(index?"Right":"");LazyWrapper.prototype[methodName]=function(){return this[takeName](1).value()[0]}});arrayEach(["initial","rest"],function(methodName,index){var dropName="drop"+(index?"":"Right");LazyWrapper.prototype[methodName]=function(){return this[dropName](1)}});arrayEach(["pluck","where"],function(methodName,index){var operationName=index?"filter":"map",createCallback=index?matches:property;LazyWrapper.prototype[methodName]=function(value){return this[operationName](createCallback(value))}});LazyWrapper.prototype.dropWhile=function(iteratee,thisArg){var done,lastIndex,isRight=this.dir<0;iteratee=getCallback(iteratee,thisArg,3);return this.filter(function(value,index,array){done=done&&(isRight?index<lastIndex:index>lastIndex);lastIndex=index;return done||(done=!iteratee(value,index,array))})};LazyWrapper.prototype.reject=function(iteratee,thisArg){iteratee=getCallback(iteratee,thisArg,3);return this.filter(function(value,index,array){return!iteratee(value,index,array)})};LazyWrapper.prototype.slice=function(start,end){start=start==null?0:+start||0;var result=start<0?this.takeRight(-start):this.drop(start);if(typeof end!="undefined"){end=+end||0;result=end<0?result.dropRight(-end):result.take(end-start)}return result};baseForOwn(LazyWrapper.prototype,function(func,methodName){var retUnwrapped=/^(?:first|last)$/.test(methodName);lodash.prototype[methodName]=function(){var value=this.__wrapped__,args=arguments,chainAll=this.__chain__,isHybrid=!!this.__actions__.length,isLazy=value instanceof LazyWrapper,onlyLazy=isLazy&&!isHybrid;if(retUnwrapped&&!chainAll){return onlyLazy?func.call(value):lodash[methodName](this.value())}var interceptor=function(value){var otherArgs=[value];push.apply(otherArgs,args);return lodash[methodName].apply(lodash,otherArgs)};if(isLazy||isArray(value)){var wrapper=onlyLazy?value:new LazyWrapper(this),result=func.apply(wrapper,args);if(!retUnwrapped&&(isHybrid||result.actions)){var actions=result.actions||(result.actions=[]);actions.push({func:thru,args:[interceptor],thisArg:lodash})}return new LodashWrapper(result,chainAll)}return this.thru(interceptor)}});arrayEach(["concat","join","pop","push","shift","sort","splice","unshift"],function(methodName){var func=arrayProto[methodName],chainName=/^(?:push|sort|unshift)$/.test(methodName)?"tap":"thru",retUnwrapped=/^(?:join|pop|shift)$/.test(methodName);lodash.prototype[methodName]=function(){var args=arguments;if(retUnwrapped&&!this.__chain__){return func.apply(this.value(),args)}return this[chainName](function(value){return func.apply(value,args)})}});LazyWrapper.prototype.clone=lazyClone;LazyWrapper.prototype.reverse=lazyReverse;LazyWrapper.prototype.value=lazyValue;lodash.prototype.chain=wrapperChain;lodash.prototype.reverse=wrapperReverse;lodash.prototype.toString=wrapperToString;lodash.prototype.toJSON=lodash.prototype.valueOf=lodash.prototype.value=wrapperValue;lodash.prototype.collect=lodash.prototype.map;lodash.prototype.head=lodash.prototype.first;lodash.prototype.select=lodash.prototype.filter;lodash.prototype.tail=lodash.prototype.rest;return lodash}var _=runInContext();if(typeof define=="function"&&typeof define.amd=="object"&&define.amd){root._=_;define(function(){return _})}else if(freeExports&&freeModule){if(moduleExports){(freeModule.exports=_)._=_}else{freeExports._=_}}else{root._=_}}).call(this)}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],165:[function(require,module,exports){"use strict";var originalObject=Object;var originalDefProp=Object.defineProperty;var originalCreate=Object.create;function defProp(obj,name,value){if(originalDefProp)try{originalDefProp.call(originalObject,obj,name,{value:value})}catch(definePropertyIsBrokenInIE8){obj[name]=value}else{obj[name]=value}}function makeSafeToCall(fun){if(fun){defProp(fun,"call",fun.call);defProp(fun,"apply",fun.apply)}return fun}makeSafeToCall(originalDefProp);makeSafeToCall(originalCreate);var hasOwn=makeSafeToCall(Object.prototype.hasOwnProperty);var numToStr=makeSafeToCall(Number.prototype.toString);var strSlice=makeSafeToCall(String.prototype.slice);var cloner=function(){};function create(prototype){if(originalCreate){return originalCreate.call(originalObject,prototype)}cloner.prototype=prototype||null;return new cloner}var rand=Math.random;var uniqueKeys=create(null);function makeUniqueKey(){do var uniqueKey=internString(strSlice.call(numToStr.call(rand(),36),2));while(hasOwn.call(uniqueKeys,uniqueKey));return uniqueKeys[uniqueKey]=uniqueKey}function internString(str){var obj={};obj[str]=true;return Object.keys(obj)[0]}defProp(exports,"makeUniqueKey",makeUniqueKey);var originalGetOPNs=Object.getOwnPropertyNames;Object.getOwnPropertyNames=function getOwnPropertyNames(object){for(var names=originalGetOPNs(object),src=0,dst=0,len=names.length;src<len;++src){if(!hasOwn.call(uniqueKeys,names[src])){if(src>dst){names[dst]=names[src]}++dst}}names.length=dst;return names};function defaultCreatorFn(object){return create(null)}function makeAccessor(secretCreatorFn){var brand=makeUniqueKey();var passkey=create(null);secretCreatorFn=secretCreatorFn||defaultCreatorFn;function register(object){var secret;function vault(key,forget){if(key===passkey){return forget?secret=null:secret||(secret=secretCreatorFn(object))}}defProp(object,brand,vault)}function accessor(object){if(!hasOwn.call(object,brand))register(object);return object[brand](passkey)}accessor.forget=function(object){if(hasOwn.call(object,brand))object[brand](passkey,true)};return accessor}defProp(exports,"makeAccessor",makeAccessor)},{}],166:[function(require,module,exports){var assert=require("assert");var types=require("ast-types");var isArray=types.builtInTypes.array;var b=types.builders;var n=types.namedTypes;var leap=require("./leap");var meta=require("./meta");var util=require("./util");var runtimeKeysMethod=util.runtimeProperty("keys");var hasOwn=Object.prototype.hasOwnProperty;function Emitter(contextId){assert.ok(this instanceof Emitter);n.Identifier.assert(contextId);Object.defineProperties(this,{contextId:{value:contextId},listing:{value:[]},marked:{value:[true]},finalLoc:{value:loc()},tryEntries:{value:[]}});Object.defineProperties(this,{leapManager:{value:new leap.LeapManager(this)}})}var Ep=Emitter.prototype;exports.Emitter=Emitter;function loc(){return b.literal(-1)}Ep.mark=function(loc){n.Literal.assert(loc);var index=this.listing.length;if(loc.value===-1){loc.value=index
}else{assert.strictEqual(loc.value,index)}this.marked[index]=true;return loc};Ep.emit=function(node){if(n.Expression.check(node))node=b.expressionStatement(node);n.Statement.assert(node);this.listing.push(node)};Ep.emitAssign=function(lhs,rhs){this.emit(this.assign(lhs,rhs));return lhs};Ep.assign=function(lhs,rhs){return b.expressionStatement(b.assignmentExpression("=",lhs,rhs))};Ep.contextProperty=function(name,computed){return b.memberExpression(this.contextId,computed?b.literal(name):b.identifier(name),!!computed)};var volatileContextPropertyNames={prev:true,next:true,sent:true,rval:true};Ep.isVolatileContextProperty=function(expr){if(n.MemberExpression.check(expr)){if(expr.computed){return true}if(n.Identifier.check(expr.object)&&n.Identifier.check(expr.property)&&expr.object.name===this.contextId.name&&hasOwn.call(volatileContextPropertyNames,expr.property.name)){return true}}return false};Ep.stop=function(rval){if(rval){this.setReturnValue(rval)}this.jump(this.finalLoc)};Ep.setReturnValue=function(valuePath){n.Expression.assert(valuePath.value);this.emitAssign(this.contextProperty("rval"),this.explodeExpression(valuePath))};Ep.clearPendingException=function(tryLoc,assignee){n.Literal.assert(tryLoc);var catchCall=b.callExpression(this.contextProperty("catch",true),[tryLoc]);if(assignee){this.emitAssign(assignee,catchCall)}else{this.emit(catchCall)}};Ep.jump=function(toLoc){this.emitAssign(this.contextProperty("next"),toLoc);this.emit(b.breakStatement())};Ep.jumpIf=function(test,toLoc){n.Expression.assert(test);n.Literal.assert(toLoc);this.emit(b.ifStatement(test,b.blockStatement([this.assign(this.contextProperty("next"),toLoc),b.breakStatement()])))};Ep.jumpIfNot=function(test,toLoc){n.Expression.assert(test);n.Literal.assert(toLoc);var negatedTest;if(n.UnaryExpression.check(test)&&test.operator==="!"){negatedTest=test.argument}else{negatedTest=b.unaryExpression("!",test)}this.emit(b.ifStatement(negatedTest,b.blockStatement([this.assign(this.contextProperty("next"),toLoc),b.breakStatement()])))};var nextTempId=0;Ep.makeTempVar=function(){return this.contextProperty("t"+nextTempId++)};Ep.getContextFunction=function(id){var func=b.functionExpression(id||null,[this.contextId],b.blockStatement([this.getDispatchLoop()]),false,false);func._aliasFunction=true;return func};Ep.getDispatchLoop=function(){var self=this;var cases=[];var current;var alreadyEnded=false;self.listing.forEach(function(stmt,i){if(self.marked.hasOwnProperty(i)){cases.push(b.switchCase(b.literal(i),current=[]));alreadyEnded=false}if(!alreadyEnded){current.push(stmt);if(isSwitchCaseEnder(stmt))alreadyEnded=true}});this.finalLoc.value=this.listing.length;cases.push(b.switchCase(this.finalLoc,[]),b.switchCase(b.literal("end"),[b.returnStatement(b.callExpression(this.contextProperty("stop"),[]))]));return b.whileStatement(b.literal(1),b.switchStatement(b.assignmentExpression("=",this.contextProperty("prev"),this.contextProperty("next")),cases))};function isSwitchCaseEnder(stmt){return n.BreakStatement.check(stmt)||n.ContinueStatement.check(stmt)||n.ReturnStatement.check(stmt)||n.ThrowStatement.check(stmt)}Ep.getTryEntryList=function(){if(this.tryEntries.length===0){return null}var lastLocValue=0;return b.arrayExpression(this.tryEntries.map(function(tryEntry){var thisLocValue=tryEntry.firstLoc.value;assert.ok(thisLocValue>=lastLocValue,"try entries out of order");lastLocValue=thisLocValue;var ce=tryEntry.catchEntry;var fe=tryEntry.finallyEntry;var triple=[tryEntry.firstLoc,ce?ce.firstLoc:null];if(fe){triple[2]=fe.firstLoc}return b.arrayExpression(triple)}))};Ep.explode=function(path,ignoreResult){assert.ok(path instanceof types.NodePath);var node=path.value;var self=this;n.Node.assert(node);if(n.Statement.check(node))return self.explodeStatement(path);if(n.Expression.check(node))return self.explodeExpression(path,ignoreResult);if(n.Declaration.check(node))throw getDeclError(node);switch(node.type){case"Program":return path.get("body").map(self.explodeStatement,self);case"VariableDeclarator":throw getDeclError(node);case"Property":case"SwitchCase":case"CatchClause":throw new Error(node.type+" nodes should be handled by their parents");default:throw new Error("unknown Node of type "+JSON.stringify(node.type))}};function getDeclError(node){return new Error("all declarations should have been transformed into "+"assignments before the Exploder began its work: "+JSON.stringify(node))}Ep.explodeStatement=function(path,labelId){assert.ok(path instanceof types.NodePath);var stmt=path.value;var self=this;n.Statement.assert(stmt);if(labelId){n.Identifier.assert(labelId)}else{labelId=null}if(n.BlockStatement.check(stmt)){return path.get("body").each(self.explodeStatement,self)}if(!meta.containsLeap(stmt)){self.emit(stmt);return}switch(stmt.type){case"ExpressionStatement":self.explodeExpression(path.get("expression"),true);break;case"LabeledStatement":var after=loc();self.leapManager.withEntry(new leap.LabeledEntry(after,stmt.label),function(){self.explodeStatement(path.get("body"),stmt.label)});self.mark(after);break;case"WhileStatement":var before=loc();var after=loc();self.mark(before);self.jumpIfNot(self.explodeExpression(path.get("test")),after);self.leapManager.withEntry(new leap.LoopEntry(after,before,labelId),function(){self.explodeStatement(path.get("body"))});self.jump(before);self.mark(after);break;case"DoWhileStatement":var first=loc();var test=loc();var after=loc();self.mark(first);self.leapManager.withEntry(new leap.LoopEntry(after,test,labelId),function(){self.explode(path.get("body"))});self.mark(test);self.jumpIf(self.explodeExpression(path.get("test")),first);self.mark(after);break;case"ForStatement":var head=loc();var update=loc();var after=loc();if(stmt.init){self.explode(path.get("init"),true)}self.mark(head);if(stmt.test){self.jumpIfNot(self.explodeExpression(path.get("test")),after)}else{}self.leapManager.withEntry(new leap.LoopEntry(after,update,labelId),function(){self.explodeStatement(path.get("body"))});self.mark(update);if(stmt.update){self.explode(path.get("update"),true)}self.jump(head);self.mark(after);break;case"ForInStatement":n.Identifier.assert(stmt.left);var head=loc();var after=loc();var keyIterNextFn=self.makeTempVar();self.emitAssign(keyIterNextFn,b.callExpression(runtimeKeysMethod,[self.explodeExpression(path.get("right"))]));self.mark(head);var keyInfoTmpVar=self.makeTempVar();self.jumpIf(b.memberExpression(b.assignmentExpression("=",keyInfoTmpVar,b.callExpression(keyIterNextFn,[])),b.identifier("done"),false),after);self.emitAssign(stmt.left,b.memberExpression(keyInfoTmpVar,b.identifier("value"),false));self.leapManager.withEntry(new leap.LoopEntry(after,head,labelId),function(){self.explodeStatement(path.get("body"))});self.jump(head);self.mark(after);break;case"BreakStatement":self.emitAbruptCompletion({type:"break",target:self.leapManager.getBreakLoc(stmt.label)});break;case"ContinueStatement":self.emitAbruptCompletion({type:"continue",target:self.leapManager.getContinueLoc(stmt.label)});break;case"SwitchStatement":var disc=self.emitAssign(self.makeTempVar(),self.explodeExpression(path.get("discriminant")));var after=loc();var defaultLoc=loc();var condition=defaultLoc;var caseLocs=[];var cases=stmt.cases||[];for(var i=cases.length-1;i>=0;--i){var c=cases[i];n.SwitchCase.assert(c);if(c.test){condition=b.conditionalExpression(b.binaryExpression("===",disc,c.test),caseLocs[i]=loc(),condition)}else{caseLocs[i]=defaultLoc}}self.jump(self.explodeExpression(new types.NodePath(condition,path,"discriminant")));self.leapManager.withEntry(new leap.SwitchEntry(after),function(){path.get("cases").each(function(casePath){var c=casePath.value;var i=casePath.name;self.mark(caseLocs[i]);casePath.get("consequent").each(self.explodeStatement,self)})});self.mark(after);if(defaultLoc.value===-1){self.mark(defaultLoc);assert.strictEqual(after.value,defaultLoc.value)}break;case"IfStatement":var elseLoc=stmt.alternate&&loc();var after=loc();self.jumpIfNot(self.explodeExpression(path.get("test")),elseLoc||after);self.explodeStatement(path.get("consequent"));if(elseLoc){self.jump(after);self.mark(elseLoc);self.explodeStatement(path.get("alternate"))}self.mark(after);break;case"ReturnStatement":self.emitAbruptCompletion({type:"return",value:self.explodeExpression(path.get("argument"))});break;case"WithStatement":throw new Error(node.type+" not supported in generator functions.");case"TryStatement":var after=loc();var handler=stmt.handler;if(!handler&&stmt.handlers){handler=stmt.handlers[0]||null}var catchLoc=handler&&loc();var catchEntry=catchLoc&&new leap.CatchEntry(catchLoc,handler.param);var finallyLoc=stmt.finalizer&&loc();var finallyEntry=finallyLoc&&new leap.FinallyEntry(finallyLoc);var tryEntry=new leap.TryEntry(self.getUnmarkedCurrentLoc(),catchEntry,finallyEntry);self.tryEntries.push(tryEntry);self.updateContextPrevLoc(tryEntry.firstLoc);self.leapManager.withEntry(tryEntry,function(){self.explodeStatement(path.get("block"));if(catchLoc){if(finallyLoc){self.jump(finallyLoc)}else{self.jump(after)}self.updateContextPrevLoc(self.mark(catchLoc));var bodyPath=path.get("handler","body");var safeParam=self.makeTempVar();self.clearPendingException(tryEntry.firstLoc,safeParam);var catchScope=bodyPath.scope;var catchParamName=handler.param.name;n.CatchClause.assert(catchScope.node);assert.strictEqual(catchScope.lookup(catchParamName),catchScope);types.visit(bodyPath,{visitIdentifier:function(path){if(util.isReference(path,catchParamName)&&path.scope.lookup(catchParamName)===catchScope){return safeParam}this.traverse(path)},visitFunction:function(path){if(path.scope.declares(catchParamName)){return false}this.traverse(path)}});self.leapManager.withEntry(catchEntry,function(){self.explodeStatement(bodyPath)})}if(finallyLoc){self.updateContextPrevLoc(self.mark(finallyLoc));self.leapManager.withEntry(finallyEntry,function(){self.explodeStatement(path.get("finalizer"))});self.emit(b.callExpression(self.contextProperty("finish"),[finallyEntry.firstLoc]))}});self.mark(after);break;case"ThrowStatement":self.emit(b.throwStatement(self.explodeExpression(path.get("argument"))));break;default:throw new Error("unknown Statement of type "+JSON.stringify(stmt.type))}};Ep.emitAbruptCompletion=function(record){if(!isValidCompletion(record)){assert.ok(false,"invalid completion record: "+JSON.stringify(record))}assert.notStrictEqual(record.type,"normal","normal completions are not abrupt");var abruptArgs=[b.literal(record.type)];if(record.type==="break"||record.type==="continue"){n.Literal.assert(record.target);abruptArgs[1]=record.target}else if(record.type==="return"||record.type==="throw"){if(record.value){n.Expression.assert(record.value);abruptArgs[1]=record.value}}this.emit(b.returnStatement(b.callExpression(this.contextProperty("abrupt"),abruptArgs)))};function isValidCompletion(record){var type=record.type;if(type==="normal"){return!hasOwn.call(record,"target")}if(type==="break"||type==="continue"){return!hasOwn.call(record,"value")&&n.Literal.check(record.target)}if(type==="return"||type==="throw"){return hasOwn.call(record,"value")&&!hasOwn.call(record,"target")}return false}Ep.getUnmarkedCurrentLoc=function(){return b.literal(this.listing.length)};Ep.updateContextPrevLoc=function(loc){if(loc){n.Literal.assert(loc);if(loc.value===-1){loc.value=this.listing.length}else{assert.strictEqual(loc.value,this.listing.length)}}else{loc=this.getUnmarkedCurrentLoc()}this.emitAssign(this.contextProperty("prev"),loc)};Ep.explodeExpression=function(path,ignoreResult){assert.ok(path instanceof types.NodePath);var expr=path.value;if(expr){n.Expression.assert(expr)}else{return expr}var self=this;var result;function finish(expr){n.Expression.assert(expr);if(ignoreResult){self.emit(expr)}else{return expr}}if(!meta.containsLeap(expr)){return finish(expr)}var hasLeapingChildren=meta.containsLeap.onlyChildren(expr);function explodeViaTempVar(tempVar,childPath,ignoreChildResult){assert.ok(childPath instanceof types.NodePath);assert.ok(!ignoreChildResult||!tempVar,"Ignoring the result of a child expression but forcing it to "+"be assigned to a temporary variable?");var result=self.explodeExpression(childPath,ignoreChildResult);if(ignoreChildResult){}else if(tempVar||hasLeapingChildren&&(self.isVolatileContextProperty(result)||meta.hasSideEffects(result))){result=self.emitAssign(tempVar||self.makeTempVar(),result)}return result}switch(expr.type){case"MemberExpression":return finish(b.memberExpression(self.explodeExpression(path.get("object")),expr.computed?explodeViaTempVar(null,path.get("property")):expr.property,expr.computed));case"CallExpression":var oldCalleePath=path.get("callee");var newCallee=self.explodeExpression(oldCalleePath);if(!n.MemberExpression.check(oldCalleePath.node)&&n.MemberExpression.check(newCallee)){newCallee=b.sequenceExpression([b.literal(0),newCallee])}return finish(b.callExpression(newCallee,path.get("arguments").map(function(argPath){return explodeViaTempVar(null,argPath)})));case"NewExpression":return finish(b.newExpression(explodeViaTempVar(null,path.get("callee")),path.get("arguments").map(function(argPath){return explodeViaTempVar(null,argPath)})));case"ObjectExpression":return finish(b.objectExpression(path.get("properties").map(function(propPath){return b.property(propPath.value.kind,propPath.value.key,explodeViaTempVar(null,propPath.get("value")))})));case"ArrayExpression":return finish(b.arrayExpression(path.get("elements").map(function(elemPath){return explodeViaTempVar(null,elemPath)})));case"SequenceExpression":var lastIndex=expr.expressions.length-1;path.get("expressions").each(function(exprPath){if(exprPath.name===lastIndex){result=self.explodeExpression(exprPath,ignoreResult)}else{self.explodeExpression(exprPath,true)}});return result;case"LogicalExpression":var after=loc();if(!ignoreResult){result=self.makeTempVar()}var left=explodeViaTempVar(result,path.get("left"));if(expr.operator==="&&"){self.jumpIfNot(left,after)}else{assert.strictEqual(expr.operator,"||");self.jumpIf(left,after)}explodeViaTempVar(result,path.get("right"),ignoreResult);self.mark(after);return result;case"ConditionalExpression":var elseLoc=loc();var after=loc();var test=self.explodeExpression(path.get("test"));self.jumpIfNot(test,elseLoc);if(!ignoreResult){result=self.makeTempVar()}explodeViaTempVar(result,path.get("consequent"),ignoreResult);self.jump(after);self.mark(elseLoc);explodeViaTempVar(result,path.get("alternate"),ignoreResult);self.mark(after);return result;case"UnaryExpression":return finish(b.unaryExpression(expr.operator,self.explodeExpression(path.get("argument")),!!expr.prefix));case"BinaryExpression":return finish(b.binaryExpression(expr.operator,explodeViaTempVar(null,path.get("left")),explodeViaTempVar(null,path.get("right"))));case"AssignmentExpression":return finish(b.assignmentExpression(expr.operator,self.explodeExpression(path.get("left")),self.explodeExpression(path.get("right"))));case"UpdateExpression":return finish(b.updateExpression(expr.operator,self.explodeExpression(path.get("argument")),expr.prefix));case"YieldExpression":var after=loc();var arg=expr.argument&&self.explodeExpression(path.get("argument"));if(arg&&expr.delegate){var result=self.makeTempVar();self.emit(b.returnStatement(b.callExpression(self.contextProperty("delegateYield"),[arg,b.literal(result.property.name),after])));self.mark(after);return result}self.emitAssign(self.contextProperty("next"),after);self.emit(b.returnStatement(arg||null));self.mark(after);return self.contextProperty("sent");default:throw new Error("unknown Expression of type "+JSON.stringify(expr.type))}}},{"./leap":168,"./meta":169,"./util":170,assert:121,"ast-types":119}],167:[function(require,module,exports){var assert=require("assert");var types=require("ast-types");var n=types.namedTypes;var b=types.builders;var hasOwn=Object.prototype.hasOwnProperty;exports.hoist=function(funPath){assert.ok(funPath instanceof types.NodePath);n.Function.assert(funPath.value);var vars={};function varDeclToExpr(vdec,includeIdentifiers){n.VariableDeclaration.assert(vdec);var exprs=[];vdec.declarations.forEach(function(dec){vars[dec.id.name]=dec.id;if(dec.init){exprs.push(b.assignmentExpression("=",dec.id,dec.init))}else if(includeIdentifiers){exprs.push(dec.id)}});if(exprs.length===0)return null;if(exprs.length===1)return exprs[0];return b.sequenceExpression(exprs)}types.visit(funPath.get("body"),{visitVariableDeclaration:function(path){var expr=varDeclToExpr(path.value,false);if(expr===null){path.replace()}else{return b.expressionStatement(expr)}return false},visitForStatement:function(path){var init=path.value.init;if(n.VariableDeclaration.check(init)){path.get("init").replace(varDeclToExpr(init,false))}this.traverse(path)},visitForInStatement:function(path){var left=path.value.left;if(n.VariableDeclaration.check(left)){path.get("left").replace(varDeclToExpr(left,true))}this.traverse(path)},visitFunctionDeclaration:function(path){var node=path.value;vars[node.id.name]=node.id;var parentNode=path.parent.node;var assignment=b.expressionStatement(b.assignmentExpression("=",node.id,b.functionExpression(node.id,node.params,node.body,node.generator,node.expression)));if(n.BlockStatement.check(path.parent.node)){path.parent.get("body").unshift(assignment);path.replace()}else{path.replace(assignment)}return false},visitFunctionExpression:function(path){return false}});var paramNames={};funPath.get("params").each(function(paramPath){var param=paramPath.value;if(n.Identifier.check(param)){paramNames[param.name]=param}else{}});var declarations=[];Object.keys(vars).forEach(function(name){if(!hasOwn.call(paramNames,name)){declarations.push(b.variableDeclarator(vars[name],null))}});if(declarations.length===0){return null}return b.variableDeclaration("var",declarations)}},{assert:121,"ast-types":119}],168:[function(require,module,exports){var assert=require("assert");var types=require("ast-types");var n=types.namedTypes;var b=types.builders;var inherits=require("util").inherits;var hasOwn=Object.prototype.hasOwnProperty;function Entry(){assert.ok(this instanceof Entry)}function FunctionEntry(returnLoc){Entry.call(this);n.Literal.assert(returnLoc);this.returnLoc=returnLoc}inherits(FunctionEntry,Entry);exports.FunctionEntry=FunctionEntry;function LoopEntry(breakLoc,continueLoc,label){Entry.call(this);n.Literal.assert(breakLoc);n.Literal.assert(continueLoc);if(label){n.Identifier.assert(label)}else{label=null}this.breakLoc=breakLoc;this.continueLoc=continueLoc;this.label=label}inherits(LoopEntry,Entry);exports.LoopEntry=LoopEntry;function SwitchEntry(breakLoc){Entry.call(this);n.Literal.assert(breakLoc);this.breakLoc=breakLoc}inherits(SwitchEntry,Entry);exports.SwitchEntry=SwitchEntry;function TryEntry(firstLoc,catchEntry,finallyEntry){Entry.call(this);n.Literal.assert(firstLoc);if(catchEntry){assert.ok(catchEntry instanceof CatchEntry)}else{catchEntry=null}if(finallyEntry){assert.ok(finallyEntry instanceof FinallyEntry)}else{finallyEntry=null}assert.ok(catchEntry||finallyEntry);this.firstLoc=firstLoc;this.catchEntry=catchEntry;this.finallyEntry=finallyEntry}inherits(TryEntry,Entry);exports.TryEntry=TryEntry;function CatchEntry(firstLoc,paramId){Entry.call(this);n.Literal.assert(firstLoc);n.Identifier.assert(paramId);this.firstLoc=firstLoc;this.paramId=paramId}inherits(CatchEntry,Entry);exports.CatchEntry=CatchEntry;function FinallyEntry(firstLoc){Entry.call(this);n.Literal.assert(firstLoc);this.firstLoc=firstLoc}inherits(FinallyEntry,Entry);exports.FinallyEntry=FinallyEntry;function LabeledEntry(breakLoc,label){Entry.call(this);n.Literal.assert(breakLoc);n.Identifier.assert(label);this.breakLoc=breakLoc;this.label=label}inherits(LabeledEntry,Entry);exports.LabeledEntry=LabeledEntry;function LeapManager(emitter){assert.ok(this instanceof LeapManager);var Emitter=require("./emit").Emitter;assert.ok(emitter instanceof Emitter);this.emitter=emitter;this.entryStack=[new FunctionEntry(emitter.finalLoc)]}var LMp=LeapManager.prototype;exports.LeapManager=LeapManager;LMp.withEntry=function(entry,callback){assert.ok(entry instanceof Entry);this.entryStack.push(entry);try{callback.call(this.emitter)}finally{var popped=this.entryStack.pop();assert.strictEqual(popped,entry)}};LMp._findLeapLocation=function(property,label){for(var i=this.entryStack.length-1;i>=0;--i){var entry=this.entryStack[i];var loc=entry[property];if(loc){if(label){if(entry.label&&entry.label.name===label.name){return loc}}else if(entry instanceof LabeledEntry){}else{return loc}}}return null};LMp.getBreakLoc=function(label){return this._findLeapLocation("breakLoc",label)};LMp.getContinueLoc=function(label){return this._findLeapLocation("continueLoc",label)}},{"./emit":166,assert:121,"ast-types":119,util:145}],169:[function(require,module,exports){var assert=require("assert");var m=require("private").makeAccessor();var types=require("ast-types");var isArray=types.builtInTypes.array;var n=types.namedTypes;var hasOwn=Object.prototype.hasOwnProperty;function makePredicate(propertyName,knownTypes){function onlyChildren(node){n.Node.assert(node);var result=false;function check(child){if(result){}else if(isArray.check(child)){child.some(check)}else if(n.Node.check(child)){assert.strictEqual(result,false);result=predicate(child)}return result}types.eachField(node,function(name,child){check(child)});return result}function predicate(node){n.Node.assert(node);var meta=m(node);if(hasOwn.call(meta,propertyName))return meta[propertyName];if(hasOwn.call(opaqueTypes,node.type))return meta[propertyName]=false;if(hasOwn.call(knownTypes,node.type))return meta[propertyName]=true;return meta[propertyName]=onlyChildren(node)}predicate.onlyChildren=onlyChildren;return predicate}var opaqueTypes={FunctionExpression:true};var sideEffectTypes={CallExpression:true,ForInStatement:true,UnaryExpression:true,BinaryExpression:true,AssignmentExpression:true,UpdateExpression:true,NewExpression:true};var leapTypes={YieldExpression:true,BreakStatement:true,ContinueStatement:true,ReturnStatement:true,ThrowStatement:true};for(var type in leapTypes){if(hasOwn.call(leapTypes,type)){sideEffectTypes[type]=leapTypes[type]}}exports.hasSideEffects=makePredicate("hasSideEffects",sideEffectTypes);exports.containsLeap=makePredicate("containsLeap",leapTypes)},{assert:121,"ast-types":119,"private":165}],170:[function(require,module,exports){var assert=require("assert");var types=require("ast-types");var n=types.namedTypes;var b=types.builders;var hasOwn=Object.prototype.hasOwnProperty;exports.defaults=function(obj){var len=arguments.length;var extension;for(var i=1;i<len;++i){if(extension=arguments[i]){for(var key in extension){if(hasOwn.call(extension,key)&&!hasOwn.call(obj,key)){obj[key]=extension[key]}}}}return obj};exports.runtimeProperty=function(name){return b.memberExpression(b.identifier("regeneratorRuntime"),b.identifier(name),false)};exports.isReference=function(path,name){var node=path.value;if(!n.Identifier.check(node)){return false}if(name&&node.name!==name){return false}var parent=path.parent.value;switch(parent.type){case"VariableDeclarator":return path.name==="init";case"MemberExpression":return path.name==="object"||parent.computed&&path.name==="property";case"FunctionExpression":case"FunctionDeclaration":case"ArrowFunctionExpression":if(path.name==="id"){return false}if(parent.params===path.parentPath&&parent.params[path.name]===node){return false}return true;case"ClassDeclaration":case"ClassExpression":return path.name!=="id";case"CatchClause":return path.name!=="param";case"Property":case"MethodDefinition":return path.name!=="key";case"ImportSpecifier":case"ImportDefaultSpecifier":case"ImportNamespaceSpecifier":case"LabeledStatement":return false;default:return true}}},{assert:121,"ast-types":119}],171:[function(require,module,exports){var assert=require("assert");var fs=require("fs");var types=require("ast-types");var n=types.namedTypes;var b=types.builders;var isArray=types.builtInTypes.array;var isObject=types.builtInTypes.object;var NodePath=types.NodePath;var hoist=require("./hoist").hoist;var Emitter=require("./emit").Emitter;var runtimeProperty=require("./util").runtimeProperty;var runtimeWrapMethod=runtimeProperty("wrap");var runtimeMarkMethod=runtimeProperty("mark");var runtimeValuesMethod=runtimeProperty("values");var runtimeAsyncMethod=runtimeProperty("async");exports.transform=function transform(node,options){options=options||{};var path=node instanceof NodePath?node:new NodePath(node);visitor.visit(path,options);node=path.value;options.madeChanges=visitor.wasChangeReported();return node};var visitor=types.PathVisitor.fromMethodsObject({reset:function(node,options){this.options=options},visitFunction:function(path){this.traverse(path);var node=path.value;var shouldTransformAsync=node.async&&!this.options.disableAsync;if(!node.generator&&!shouldTransformAsync){return}this.reportChanged();node.generator=false;if(node.expression){node.expression=false;node.body=b.blockStatement([b.returnStatement(node.body)])}if(shouldTransformAsync){awaitVisitor.visit(path.get("body"))}var outerFnId=node.id||(node.id=path.scope.parent.declareTemporary("callee$"));var innerFnId=b.identifier(node.id.name+"$");var contextId=path.scope.declareTemporary("context$");var vars=hoist(path);var emitter=new Emitter(contextId);emitter.explode(path.get("body"));var outerBody=[];if(vars&&vars.declarations.length>0){outerBody.push(vars)}var wrapArgs=[emitter.getContextFunction(innerFnId),shouldTransformAsync?b.literal(null):outerFnId,b.thisExpression()];var tryEntryList=emitter.getTryEntryList();if(tryEntryList){wrapArgs.push(tryEntryList)}var wrapCall=b.callExpression(shouldTransformAsync?runtimeAsyncMethod:runtimeWrapMethod,wrapArgs);outerBody.push(b.returnStatement(wrapCall));node.body=b.blockStatement(outerBody);if(shouldTransformAsync){node.async=false;return}if(n.FunctionDeclaration.check(node)){var pp=path.parent;while(pp&&!(n.BlockStatement.check(pp.value)||n.Program.check(pp.value))){pp=pp.parent}if(!pp){return}path.replace();node.type="FunctionExpression";var varDecl=b.variableDeclaration("var",[b.variableDeclarator(node.id,b.callExpression(runtimeMarkMethod,[node]))]);if(node.comments){varDecl.leadingComments=node.leadingComments;varDecl.trailingComments=node.trailingComments;node.leadingComments=null;node.trailingComments=null}varDecl._blockHoist=3;var bodyPath=pp.get("body");var bodyLen=bodyPath.value.length;bodyPath.push(varDecl)}else{n.FunctionExpression.assert(node);return b.callExpression(runtimeMarkMethod,[node])}}});function shouldNotHoistAbove(stmtPath){var value=stmtPath.value;n.Statement.assert(value);if(n.ExpressionStatement.check(value)&&n.Literal.check(value.expression)&&value.expression.value==="use strict"){return true}if(n.VariableDeclaration.check(value)){for(var i=0;i<value.declarations.length;++i){var decl=value.declarations[i];if(n.CallExpression.check(decl.init)&&types.astNodesAreEquivalent(decl.init.callee,runtimeMarkMethod)){return true}}}return false}var awaitVisitor=types.PathVisitor.fromMethodsObject({visitFunction:function(path){return false},visitAwaitExpression:function(path){return b.yieldExpression(path.value.argument,false)}})},{"./emit":166,"./hoist":167,"./util":170,assert:121,"ast-types":119,fs:120}],172:[function(require,module,exports){(function(__dirname){var assert=require("assert");var path=require("path");var fs=require("fs");var through=require("through");var transform=require("./lib/visit").transform;var utils=require("./lib/util");var types=require("ast-types");var genOrAsyncFunExp=/\bfunction\s*\*|\basync\b/;var blockBindingExp=/\b(let|const)\s+/;function exports(file,options){var data=[];return through(write,end);function write(buf){data.push(buf)}function end(){this.queue(compile(data.join(""),options).code);this.queue(null)}}module.exports=exports;function runtime(){require("./runtime")}exports.runtime=runtime;runtime.path=path.join(__dirname,"runtime.js");exports.transform=transform}).call(this,"/node_modules/regenerator-6to5")},{"./lib/util":170,"./lib/visit":171,"./runtime":174,assert:121,"ast-types":119,fs:120,path:129,through:173}],173:[function(require,module,exports){(function(process){var Stream=require("stream");exports=module.exports=through;through.through=through;function through(write,end,opts){write=write||function(data){this.queue(data)};end=end||function(){this.queue(null)};var ended=false,destroyed=false,buffer=[],_ended=false;var stream=new Stream;stream.readable=stream.writable=true;stream.paused=false;stream.autoDestroy=!(opts&&opts.autoDestroy===false);stream.write=function(data){write.call(this,data);return!stream.paused};function drain(){while(buffer.length&&!stream.paused){var data=buffer.shift();if(null===data)return stream.emit("end");else stream.emit("data",data)}}stream.queue=stream.push=function(data){if(_ended)return stream;if(data==null)_ended=true;buffer.push(data);drain();return stream};stream.on("end",function(){stream.readable=false;if(!stream.writable&&stream.autoDestroy)process.nextTick(function(){stream.destroy()})});function _end(){stream.writable=false;end.call(stream);if(!stream.readable&&stream.autoDestroy)stream.destroy()}stream.end=function(data){if(ended)return;ended=true;if(arguments.length)stream.write(data);_end();return stream};stream.destroy=function(){if(destroyed)return;destroyed=true;ended=true;buffer.length=0;stream.writable=stream.readable=false;stream.emit("close");return stream};stream.pause=function(){if(stream.paused)return;stream.paused=true;return stream};stream.resume=function(){if(stream.paused){stream.paused=false;stream.emit("resume")}drain();if(!stream.paused)stream.emit("drain");return stream};return stream}}).call(this,require("_process"))},{_process:130,stream:142}],174:[function(require,module,exports){(function(global){!function(global){"use strict";var hasOwn=Object.prototype.hasOwnProperty;var undefined;var iteratorSymbol=typeof Symbol==="function"&&Symbol.iterator||"@@iterator";var inModule=typeof module==="object";var runtime=global.regeneratorRuntime;if(runtime){if(inModule){module.exports=runtime}return}runtime=global.regeneratorRuntime=inModule?module.exports:{};function wrap(innerFn,outerFn,self,tryList){return new Generator(innerFn,outerFn,self||null,tryList||[])}runtime.wrap=wrap;function tryCatch(fn,obj,arg){try{return{type:"normal",arg:fn.call(obj,arg)}}catch(err){return{type:"throw",arg:err}}}var GenStateSuspendedStart="suspendedStart";var GenStateSuspendedYield="suspendedYield";var GenStateExecuting="executing";var GenStateCompleted="completed";var ContinueSentinel={};function GeneratorFunction(){}function GeneratorFunctionPrototype(){}var Gp=GeneratorFunctionPrototype.prototype=Generator.prototype;GeneratorFunction.prototype=Gp.constructor=GeneratorFunctionPrototype;GeneratorFunctionPrototype.constructor=GeneratorFunction;GeneratorFunction.displayName="GeneratorFunction";runtime.isGeneratorFunction=function(genFun){var ctor=typeof genFun==="function"&&genFun.constructor;return ctor?ctor===GeneratorFunction||(ctor.displayName||ctor.name)==="GeneratorFunction":false};runtime.mark=function(genFun){genFun.__proto__=GeneratorFunctionPrototype;genFun.prototype=Object.create(Gp);return genFun};runtime.async=function(innerFn,outerFn,self,tryList){return new Promise(function(resolve,reject){var generator=wrap(innerFn,outerFn,self,tryList);var callNext=step.bind(generator.next);var callThrow=step.bind(generator["throw"]);function step(arg){var record=tryCatch(this,null,arg);if(record.type==="throw"){reject(record.arg);return}var info=record.arg;if(info.done){resolve(info.value)}else{Promise.resolve(info.value).then(callNext,callThrow)}}callNext()})};function Generator(innerFn,outerFn,self,tryList){var generator=outerFn?Object.create(outerFn.prototype):this;var context=new Context(tryList);var state=GenStateSuspendedStart;function invoke(method,arg){if(state===GenStateExecuting){throw new Error("Generator is already running")}if(state===GenStateCompleted){return doneResult()
}while(true){var delegate=context.delegate;if(delegate){var record=tryCatch(delegate.iterator[method],delegate.iterator,arg);if(record.type==="throw"){context.delegate=null;method="throw";arg=record.arg;continue}method="next";arg=undefined;var info=record.arg;if(info.done){context[delegate.resultName]=info.value;context.next=delegate.nextLoc}else{state=GenStateSuspendedYield;return info}context.delegate=null}if(method==="next"){if(state===GenStateSuspendedStart&&typeof arg!=="undefined"){throw new TypeError("attempt to send "+JSON.stringify(arg)+" to newborn generator")}if(state===GenStateSuspendedYield){context.sent=arg}else{delete context.sent}}else if(method==="throw"){if(state===GenStateSuspendedStart){state=GenStateCompleted;throw arg}if(context.dispatchException(arg)){method="next";arg=undefined}}else if(method==="return"){context.abrupt("return",arg)}state=GenStateExecuting;var record=tryCatch(innerFn,self,context);if(record.type==="normal"){state=context.done?GenStateCompleted:GenStateSuspendedYield;var info={value:record.arg,done:context.done};if(record.arg===ContinueSentinel){if(context.delegate&&method==="next"){arg=undefined}}else{return info}}else if(record.type==="throw"){state=GenStateCompleted;if(method==="next"){context.dispatchException(record.arg)}else{arg=record.arg}}}}generator.next=invoke.bind(generator,"next");generator["throw"]=invoke.bind(generator,"throw");generator["return"]=invoke.bind(generator,"return");return generator}Gp[iteratorSymbol]=function(){return this};Gp.toString=function(){return"[object Generator]"};function pushTryEntry(triple){var entry={tryLoc:triple[0]};if(1 in triple){entry.catchLoc=triple[1]}if(2 in triple){entry.finallyLoc=triple[2]}this.tryEntries.push(entry)}function resetTryEntry(entry,i){var record=entry.completion||{};record.type=i===0?"normal":"return";delete record.arg;entry.completion=record}function Context(tryList){this.tryEntries=[{tryLoc:"root"}];tryList.forEach(pushTryEntry,this);this.reset()}runtime.keys=function(object){var keys=[];for(var key in object){keys.push(key)}keys.reverse();return function next(){while(keys.length){var key=keys.pop();if(key in object){next.value=key;next.done=false;return next}}next.done=true;return next}};function values(iterable){if(iterable){var iteratorMethod=iterable[iteratorSymbol];if(iteratorMethod){return iteratorMethod.call(iterable)}if(typeof iterable.next==="function"){return iterable}if(!isNaN(iterable.length)){var i=-1,next=function next(){while(++i<iterable.length){if(hasOwn.call(iterable,i)){next.value=iterable[i];next.done=false;return next}}next.value=undefined;next.done=true;return next};return next.next=next}}return{next:doneResult}}runtime.values=values;function doneResult(){return{value:undefined,done:true}}Context.prototype={constructor:Context,reset:function(){this.prev=0;this.next=0;this.sent=undefined;this.done=false;this.delegate=null;this.tryEntries.forEach(resetTryEntry);for(var tempIndex=0,tempName;hasOwn.call(this,tempName="t"+tempIndex)||tempIndex<20;++tempIndex){this[tempName]=null}},stop:function(){this.done=true;var rootEntry=this.tryEntries[0];var rootRecord=rootEntry.completion;if(rootRecord.type==="throw"){throw rootRecord.arg}return this.rval},dispatchException:function(exception){if(this.done){throw exception}var context=this;function handle(loc,caught){record.type="throw";record.arg=exception;context.next=loc;return!!caught}for(var i=this.tryEntries.length-1;i>=0;--i){var entry=this.tryEntries[i];var record=entry.completion;if(entry.tryLoc==="root"){return handle("end")}if(entry.tryLoc<=this.prev){var hasCatch=hasOwn.call(entry,"catchLoc");var hasFinally=hasOwn.call(entry,"finallyLoc");if(hasCatch&&hasFinally){if(this.prev<entry.catchLoc){return handle(entry.catchLoc,true)}else if(this.prev<entry.finallyLoc){return handle(entry.finallyLoc)}}else if(hasCatch){if(this.prev<entry.catchLoc){return handle(entry.catchLoc,true)}}else if(hasFinally){if(this.prev<entry.finallyLoc){return handle(entry.finallyLoc)}}else{throw new Error("try statement without catch or finally")}}}},_findFinallyEntry:function(finallyLoc){for(var i=this.tryEntries.length-1;i>=0;--i){var entry=this.tryEntries[i];if(entry.tryLoc<=this.prev&&hasOwn.call(entry,"finallyLoc")&&(entry.finallyLoc===finallyLoc||this.prev<entry.finallyLoc)){return entry}}},abrupt:function(type,arg){var entry=this._findFinallyEntry();var record=entry?entry.completion:{};record.type=type;record.arg=arg;if(entry){this.next=entry.finallyLoc}else{this.complete(record)}return ContinueSentinel},complete:function(record){if(record.type==="throw"){throw record.arg}if(record.type==="break"||record.type==="continue"){this.next=record.arg}else if(record.type==="return"){this.rval=record.arg;this.next="end"}return ContinueSentinel},finish:function(finallyLoc){var entry=this._findFinallyEntry(finallyLoc);return this.complete(entry.completion)},"catch":function(tryLoc){for(var i=this.tryEntries.length-1;i>=0;--i){var entry=this.tryEntries[i];if(entry.tryLoc===tryLoc){var record=entry.completion;if(record.type==="throw"){var thrown=record.arg;resetTryEntry(entry,i)}return thrown}}throw new Error("illegal catch attempt")},delegateYield:function(iterable,resultName,nextLoc){this.delegate={iterator:values(iterable),resultName:resultName,nextLoc:nextLoc};return ContinueSentinel}}}(typeof global==="object"?global:typeof window==="object"?window:this)}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],175:[function(require,module,exports){var regenerate=require("regenerate");exports.REGULAR={d:regenerate().addRange(48,57),D:regenerate().addRange(0,47).addRange(58,65535),s:regenerate(32,160,5760,6158,8239,8287,12288,65279).addRange(9,13).addRange(8192,8202).addRange(8232,8233),S:regenerate().addRange(0,8).addRange(14,31).addRange(33,159).addRange(161,5759).addRange(5761,6157).addRange(6159,8191).addRange(8203,8231).addRange(8234,8238).addRange(8240,8286).addRange(8288,12287).addRange(12289,65278).addRange(65280,65535),w:regenerate(95).addRange(48,57).addRange(65,90).addRange(97,122),W:regenerate(96).addRange(0,47).addRange(58,64).addRange(91,94).addRange(123,65535)};exports.UNICODE={d:regenerate().addRange(48,57),D:regenerate().addRange(0,47).addRange(58,1114111),s:regenerate(32,160,5760,6158,8239,8287,12288,65279).addRange(9,13).addRange(8192,8202).addRange(8232,8233),S:regenerate().addRange(0,8).addRange(14,31).addRange(33,159).addRange(161,5759).addRange(5761,6157).addRange(6159,8191).addRange(8203,8231).addRange(8234,8238).addRange(8240,8286).addRange(8288,12287).addRange(12289,65278).addRange(65280,1114111),w:regenerate(95).addRange(48,57).addRange(65,90).addRange(97,122),W:regenerate(96).addRange(0,47).addRange(58,64).addRange(91,94).addRange(123,1114111)};exports.UNICODE_IGNORE_CASE={d:regenerate().addRange(48,57),D:regenerate().addRange(0,47).addRange(58,1114111),s:regenerate(32,160,5760,6158,8239,8287,12288,65279).addRange(9,13).addRange(8192,8202).addRange(8232,8233),S:regenerate().addRange(0,8).addRange(14,31).addRange(33,159).addRange(161,5759).addRange(5761,6157).addRange(6159,8191).addRange(8203,8231).addRange(8234,8238).addRange(8240,8286).addRange(8288,12287).addRange(12289,65278).addRange(65280,1114111),w:regenerate(95,383,8490).addRange(48,57).addRange(65,90).addRange(97,122),W:regenerate(75,83,96).addRange(0,47).addRange(58,64).addRange(91,94).addRange(123,1114111)}},{regenerate:177}],176:[function(require,module,exports){module.exports={75:8490,83:383,107:8490,115:383,181:924,197:8491,383:83,452:453,453:452,455:456,456:455,458:459,459:458,497:498,498:497,837:8126,914:976,917:1013,920:1012,921:8126,922:1008,924:181,928:982,929:1009,931:962,934:981,937:8486,962:931,976:914,977:1012,981:934,982:928,1008:922,1009:929,1012:[920,977],1013:917,7776:7835,7835:7776,8126:[837,921],8486:937,8490:75,8491:197,66560:66600,66561:66601,66562:66602,66563:66603,66564:66604,66565:66605,66566:66606,66567:66607,66568:66608,66569:66609,66570:66610,66571:66611,66572:66612,66573:66613,66574:66614,66575:66615,66576:66616,66577:66617,66578:66618,66579:66619,66580:66620,66581:66621,66582:66622,66583:66623,66584:66624,66585:66625,66586:66626,66587:66627,66588:66628,66589:66629,66590:66630,66591:66631,66592:66632,66593:66633,66594:66634,66595:66635,66596:66636,66597:66637,66598:66638,66599:66639,66600:66560,66601:66561,66602:66562,66603:66563,66604:66564,66605:66565,66606:66566,66607:66567,66608:66568,66609:66569,66610:66570,66611:66571,66612:66572,66613:66573,66614:66574,66615:66575,66616:66576,66617:66577,66618:66578,66619:66579,66620:66580,66621:66581,66622:66582,66623:66583,66624:66584,66625:66585,66626:66586,66627:66587,66628:66588,66629:66589,66630:66590,66631:66591,66632:66592,66633:66593,66634:66594,66635:66595,66636:66596,66637:66597,66638:66598,66639:66599,71840:71872,71841:71873,71842:71874,71843:71875,71844:71876,71845:71877,71846:71878,71847:71879,71848:71880,71849:71881,71850:71882,71851:71883,71852:71884,71853:71885,71854:71886,71855:71887,71856:71888,71857:71889,71858:71890,71859:71891,71860:71892,71861:71893,71862:71894,71863:71895,71864:71896,71865:71897,71866:71898,71867:71899,71868:71900,71869:71901,71870:71902,71871:71903,71872:71840,71873:71841,71874:71842,71875:71843,71876:71844,71877:71845,71878:71846,71879:71847,71880:71848,71881:71849,71882:71850,71883:71851,71884:71852,71885:71853,71886:71854,71887:71855,71888:71856,71889:71857,71890:71858,71891:71859,71892:71860,71893:71861,71894:71862,71895:71863,71896:71864,71897:71865,71898:71866,71899:71867,71900:71868,71901:71869,71902:71870,71903:71871}},{}],177:[function(require,module,exports){(function(global){(function(root){var freeExports=typeof exports=="object"&&exports;var freeModule=typeof module=="object"&&module&&module.exports==freeExports&&module;var freeGlobal=typeof global=="object"&&global;if(freeGlobal.global===freeGlobal||freeGlobal.window===freeGlobal){root=freeGlobal}var ERRORS={rangeOrder:"A range’s `stop` value must be greater than or equal "+"to the `start` value.",codePointRange:"Invalid code point value. Code points range from "+"U+000000 to U+10FFFF."};var HIGH_SURROGATE_MIN=55296;var HIGH_SURROGATE_MAX=56319;var LOW_SURROGATE_MIN=56320;var LOW_SURROGATE_MAX=57343;var regexNull=/\\x00([^0123456789]|$)/g;var object={};var hasOwnProperty=object.hasOwnProperty;var extend=function(destination,source){var key;for(key in source){if(hasOwnProperty.call(source,key)){destination[key]=source[key]}}return destination};var forEach=function(array,callback){var index=-1;var length=array.length;while(++index<length){callback(array[index],index)}};var toString=object.toString;var isArray=function(value){return toString.call(value)=="[object Array]"};var isNumber=function(value){return typeof value=="number"||toString.call(value)=="[object Number]"};var zeroes="0000";var pad=function(number,totalCharacters){var string=String(number);return string.length<totalCharacters?(zeroes+string).slice(-totalCharacters):string};var hex=function(number){return Number(number).toString(16).toUpperCase()};var slice=[].slice;var dataFromCodePoints=function(codePoints){var index=-1;var length=codePoints.length;var max=length-1;var result=[];var isStart=true;var tmp;var previous=0;while(++index<length){tmp=codePoints[index];if(isStart){result.push(tmp);previous=tmp;isStart=false}else{if(tmp==previous+1){if(index!=max){previous=tmp;continue}else{isStart=true;result.push(tmp+1)}}else{result.push(previous+1,tmp);previous=tmp}}}if(!isStart){result.push(tmp+1)}return result};var dataRemove=function(data,codePoint){var index=0;var start;var end;var length=data.length;while(index<length){start=data[index];end=data[index+1];if(codePoint>=start&&codePoint<end){if(codePoint==start){if(end==start+1){data.splice(index,2);return data}else{data[index]=codePoint+1;return data}}else if(codePoint==end-1){data[index+1]=codePoint;return data}else{data.splice(index,2,start,codePoint,codePoint+1,end);return data}}index+=2}return data};var dataRemoveRange=function(data,rangeStart,rangeEnd){if(rangeEnd<rangeStart){throw Error(ERRORS.rangeOrder)}var index=0;var start;var end;while(index<data.length){start=data[index];end=data[index+1]-1;if(start>rangeEnd){return data}if(rangeStart<=start&&rangeEnd>=end){data.splice(index,2);continue}if(rangeStart>=start&&rangeEnd<end){if(rangeStart==start){data[index]=rangeEnd+1;data[index+1]=end+1;return data}data.splice(index,2,start,rangeStart,rangeEnd+1,end+1);return data}if(rangeStart>=start&&rangeStart<=end){data[index+1]=rangeStart}else if(rangeEnd>=start&&rangeEnd<=end){data[index]=rangeEnd+1;return data}index+=2}return data};var dataAdd=function(data,codePoint){var index=0;var start;var end;var lastIndex=null;var length=data.length;if(codePoint<0||codePoint>1114111){throw RangeError(ERRORS.codePointRange)}while(index<length){start=data[index];end=data[index+1];if(codePoint>=start&&codePoint<end){return data}if(codePoint==start-1){data[index]=codePoint;return data}if(start>codePoint){data.splice(lastIndex!=null?lastIndex+2:0,0,codePoint,codePoint+1);return data}if(codePoint==end){if(codePoint+1==data[index+2]){data.splice(index,4,start,data[index+3]);return data}data[index+1]=codePoint+1;return data}lastIndex=index;index+=2}data.push(codePoint,codePoint+1);return data};var dataAddData=function(dataA,dataB){var index=0;var start;var end;var data=dataA.slice();var length=dataB.length;while(index<length){start=dataB[index];end=dataB[index+1]-1;if(start==end){data=dataAdd(data,start)}else{data=dataAddRange(data,start,end)}index+=2}return data};var dataRemoveData=function(dataA,dataB){var index=0;var start;var end;var data=dataA.slice();var length=dataB.length;while(index<length){start=dataB[index];end=dataB[index+1]-1;if(start==end){data=dataRemove(data,start)}else{data=dataRemoveRange(data,start,end)}index+=2}return data};var dataAddRange=function(data,rangeStart,rangeEnd){if(rangeEnd<rangeStart){throw Error(ERRORS.rangeOrder)}if(rangeStart<0||rangeStart>1114111||rangeEnd<0||rangeEnd>1114111){throw RangeError(ERRORS.codePointRange)}var index=0;var start;var end;var added=false;var length=data.length;while(index<length){start=data[index];end=data[index+1];if(added){if(start==rangeEnd+1){data.splice(index-1,2);return data}if(start>rangeEnd){return data}if(start>=rangeStart&&start<=rangeEnd){if(end>rangeStart&&end-1<=rangeEnd){data.splice(index,2);index-=2}else{data.splice(index-1,2);index-=2}}}else if(start==rangeEnd+1){data[index]=rangeStart;return data}else if(start>rangeEnd){data.splice(index,0,rangeStart,rangeEnd+1);return data}else if(rangeStart>=start&&rangeStart<end&&rangeEnd+1<=end){return data}else if(rangeStart>=start&&rangeStart<end||end==rangeStart){data[index+1]=rangeEnd+1;added=true}else if(rangeStart<=start&&rangeEnd+1>=end){data[index]=rangeStart;data[index+1]=rangeEnd+1;added=true}index+=2}if(!added){data.push(rangeStart,rangeEnd+1)}return data};var dataContains=function(data,codePoint){var index=0;var length=data.length;var start=data[index];var end=data[length-1];if(length>=2){if(codePoint<start||codePoint>end){return false}}while(index<length){start=data[index];end=data[index+1];if(codePoint>=start&&codePoint<end){return true}index+=2}return false};var dataIntersection=function(data,codePoints){var index=0;var length=codePoints.length;var codePoint;var result=[];while(index<length){codePoint=codePoints[index];if(dataContains(data,codePoint)){result.push(codePoint)}++index}return dataFromCodePoints(result)};var dataIsEmpty=function(data){return!data.length};var dataIsSingleton=function(data){return data.length==2&&data[0]+1==data[1]};var dataToArray=function(data){var index=0;var start;var end;var result=[];var length=data.length;while(index<length){start=data[index];end=data[index+1];while(start<end){result.push(start);++start}index+=2}return result};var floor=Math.floor;var highSurrogate=function(codePoint){return parseInt(floor((codePoint-65536)/1024)+HIGH_SURROGATE_MIN,10)};var lowSurrogate=function(codePoint){return parseInt((codePoint-65536)%1024+LOW_SURROGATE_MIN,10)};var stringFromCharCode=String.fromCharCode;var codePointToString=function(codePoint){var string;if(codePoint==9){string="\\t"}else if(codePoint==10){string="\\n"}else if(codePoint==12){string="\\f"}else if(codePoint==13){string="\\r"}else if(codePoint==92){string="\\\\"}else if(codePoint==36||codePoint>=40&&codePoint<=43||codePoint==45||codePoint==46||codePoint==63||codePoint>=91&&codePoint<=94||codePoint>=123&&codePoint<=125){string="\\"+stringFromCharCode(codePoint)}else if(codePoint>=32&&codePoint<=126){string=stringFromCharCode(codePoint)}else if(codePoint<=255){string="\\x"+pad(hex(codePoint),2)}else{string="\\u"+pad(hex(codePoint),4)}return string};var symbolToCodePoint=function(symbol){var length=symbol.length;var first=symbol.charCodeAt(0);var second;if(first>=HIGH_SURROGATE_MIN&&first<=HIGH_SURROGATE_MAX&&length>1){second=symbol.charCodeAt(1);return(first-HIGH_SURROGATE_MIN)*1024+second-LOW_SURROGATE_MIN+65536}return first};var createBMPCharacterClasses=function(data){var result="";var index=0;var start;var end;var length=data.length;if(dataIsSingleton(data)){return codePointToString(data[0])}while(index<length){start=data[index];end=data[index+1]-1;if(start==end){result+=codePointToString(start)}else if(start+1==end){result+=codePointToString(start)+codePointToString(end)}else{result+=codePointToString(start)+"-"+codePointToString(end)}index+=2}return"["+result+"]"};var splitAtBMP=function(data){var loneHighSurrogates=[];var loneLowSurrogates=[];var bmp=[];var astral=[];var index=0;var start;var end;var length=data.length;while(index<length){start=data[index];end=data[index+1]-1;if(start<HIGH_SURROGATE_MIN){if(end<HIGH_SURROGATE_MIN){bmp.push(start,end+1)}if(end>=HIGH_SURROGATE_MIN&&end<=HIGH_SURROGATE_MAX){bmp.push(start,HIGH_SURROGATE_MIN);loneHighSurrogates.push(HIGH_SURROGATE_MIN,end+1)}if(end>=LOW_SURROGATE_MIN&&end<=LOW_SURROGATE_MAX){bmp.push(start,HIGH_SURROGATE_MIN);loneHighSurrogates.push(HIGH_SURROGATE_MIN,HIGH_SURROGATE_MAX+1);loneLowSurrogates.push(LOW_SURROGATE_MIN,end+1)}if(end>LOW_SURROGATE_MAX){bmp.push(start,HIGH_SURROGATE_MIN);loneHighSurrogates.push(HIGH_SURROGATE_MIN,HIGH_SURROGATE_MAX+1);loneLowSurrogates.push(LOW_SURROGATE_MIN,LOW_SURROGATE_MAX+1);if(end<=65535){bmp.push(LOW_SURROGATE_MAX+1,end+1)}else{bmp.push(LOW_SURROGATE_MAX+1,65535+1);astral.push(65535+1,end+1)}}}else if(start>=HIGH_SURROGATE_MIN&&start<=HIGH_SURROGATE_MAX){if(end>=HIGH_SURROGATE_MIN&&end<=HIGH_SURROGATE_MAX){loneHighSurrogates.push(start,end+1)}if(end>=LOW_SURROGATE_MIN&&end<=LOW_SURROGATE_MAX){loneHighSurrogates.push(start,HIGH_SURROGATE_MAX+1);loneLowSurrogates.push(LOW_SURROGATE_MIN,end+1)}if(end>LOW_SURROGATE_MAX){loneHighSurrogates.push(start,HIGH_SURROGATE_MAX+1);loneLowSurrogates.push(LOW_SURROGATE_MIN,LOW_SURROGATE_MAX+1);if(end<=65535){bmp.push(LOW_SURROGATE_MAX+1,end+1)}else{bmp.push(LOW_SURROGATE_MAX+1,65535+1);astral.push(65535+1,end+1)}}}else if(start>=LOW_SURROGATE_MIN&&start<=LOW_SURROGATE_MAX){if(end>=LOW_SURROGATE_MIN&&end<=LOW_SURROGATE_MAX){loneLowSurrogates.push(start,end+1)}if(end>LOW_SURROGATE_MAX){loneLowSurrogates.push(start,LOW_SURROGATE_MAX+1);if(end<=65535){bmp.push(LOW_SURROGATE_MAX+1,end+1)}else{bmp.push(LOW_SURROGATE_MAX+1,65535+1);astral.push(65535+1,end+1)}}}else if(start>LOW_SURROGATE_MAX&&start<=65535){if(end<=65535){bmp.push(start,end+1)}else{bmp.push(start,65535+1);astral.push(65535+1,end+1)}}else{astral.push(start,end+1)}index+=2}return{loneHighSurrogates:loneHighSurrogates,loneLowSurrogates:loneLowSurrogates,bmp:bmp,astral:astral}};var optimizeSurrogateMappings=function(surrogateMappings){var result=[];var tmpLow=[];var addLow=false;var mapping;var nextMapping;var highSurrogates;var lowSurrogates;var nextHighSurrogates;var nextLowSurrogates;var index=-1;var length=surrogateMappings.length;while(++index<length){mapping=surrogateMappings[index];nextMapping=surrogateMappings[index+1];if(!nextMapping){result.push(mapping);continue}highSurrogates=mapping[0];lowSurrogates=mapping[1];nextHighSurrogates=nextMapping[0];nextLowSurrogates=nextMapping[1];tmpLow=lowSurrogates;while(nextHighSurrogates&&highSurrogates[0]==nextHighSurrogates[0]&&highSurrogates[1]==nextHighSurrogates[1]){if(dataIsSingleton(nextLowSurrogates)){tmpLow=dataAdd(tmpLow,nextLowSurrogates[0])}else{tmpLow=dataAddRange(tmpLow,nextLowSurrogates[0],nextLowSurrogates[1]-1)}++index;mapping=surrogateMappings[index];highSurrogates=mapping[0];lowSurrogates=mapping[1];nextMapping=surrogateMappings[index+1];nextHighSurrogates=nextMapping&&nextMapping[0];nextLowSurrogates=nextMapping&&nextMapping[1];addLow=true}result.push([highSurrogates,addLow?tmpLow:lowSurrogates]);addLow=false}return optimizeByLowSurrogates(result)};var optimizeByLowSurrogates=function(surrogateMappings){if(surrogateMappings.length==1){return surrogateMappings}var index=-1;var innerIndex=-1;while(++index<surrogateMappings.length){var mapping=surrogateMappings[index];var lowSurrogates=mapping[1];var lowSurrogateStart=lowSurrogates[0];var lowSurrogateEnd=lowSurrogates[1];innerIndex=index;while(++innerIndex<surrogateMappings.length){var otherMapping=surrogateMappings[innerIndex];var otherLowSurrogates=otherMapping[1];var otherLowSurrogateStart=otherLowSurrogates[0];var otherLowSurrogateEnd=otherLowSurrogates[1];if(lowSurrogateStart==otherLowSurrogateStart&&lowSurrogateEnd==otherLowSurrogateEnd){if(dataIsSingleton(otherMapping[0])){mapping[0]=dataAdd(mapping[0],otherMapping[0][0])}else{mapping[0]=dataAddRange(mapping[0],otherMapping[0][0],otherMapping[0][1]-1)}surrogateMappings.splice(innerIndex,1);--innerIndex}}}return surrogateMappings};var surrogateSet=function(data){if(!data.length){return[]}var index=0;var start;var end;var startHigh;var startLow;var prevStartHigh=0;var prevEndHigh=0;var tmpLow=[];var endHigh;var endLow;var surrogateMappings=[];var length=data.length;var dataHigh=[];while(index<length){start=data[index];end=data[index+1]-1;startHigh=highSurrogate(start);startLow=lowSurrogate(start);endHigh=highSurrogate(end);endLow=lowSurrogate(end);var startsWithLowestLowSurrogate=startLow==LOW_SURROGATE_MIN;var endsWithHighestLowSurrogate=endLow==LOW_SURROGATE_MAX;var complete=false;if(startHigh==endHigh||startsWithLowestLowSurrogate&&endsWithHighestLowSurrogate){surrogateMappings.push([[startHigh,endHigh+1],[startLow,endLow+1]]);complete=true}else{surrogateMappings.push([[startHigh,startHigh+1],[startLow,LOW_SURROGATE_MAX+1]])}if(!complete&&startHigh+1<endHigh){if(endsWithHighestLowSurrogate){surrogateMappings.push([[startHigh+1,endHigh+1],[LOW_SURROGATE_MIN,endLow+1]]);complete=true}else{surrogateMappings.push([[startHigh+1,endHigh],[LOW_SURROGATE_MIN,LOW_SURROGATE_MAX+1]])}}if(!complete){surrogateMappings.push([[endHigh,endHigh+1],[LOW_SURROGATE_MIN,endLow+1]])}prevStartHigh=startHigh;prevEndHigh=endHigh;index+=2}return optimizeSurrogateMappings(surrogateMappings)};var createSurrogateCharacterClasses=function(surrogateMappings){var result=[];forEach(surrogateMappings,function(surrogateMapping){var highSurrogates=surrogateMapping[0];var lowSurrogates=surrogateMapping[1];result.push(createBMPCharacterClasses(highSurrogates)+createBMPCharacterClasses(lowSurrogates))});return result.join("|")};var createCharacterClassesFromData=function(data,bmpOnly){var result=[];var parts=splitAtBMP(data);var loneHighSurrogates=parts.loneHighSurrogates;var loneLowSurrogates=parts.loneLowSurrogates;var bmp=parts.bmp;var astral=parts.astral;var hasAstral=!dataIsEmpty(parts.astral);var hasLoneHighSurrogates=!dataIsEmpty(loneHighSurrogates);var hasLoneLowSurrogates=!dataIsEmpty(loneLowSurrogates);var surrogateMappings=surrogateSet(astral);if(bmpOnly){bmp=dataAddData(bmp,loneHighSurrogates);hasLoneHighSurrogates=false;bmp=dataAddData(bmp,loneLowSurrogates);hasLoneLowSurrogates=false}if(!dataIsEmpty(bmp)){result.push(createBMPCharacterClasses(bmp))}if(surrogateMappings.length){result.push(createSurrogateCharacterClasses(surrogateMappings))}if(hasLoneHighSurrogates){result.push(createBMPCharacterClasses(loneHighSurrogates)+"(?![\\uDC00-\\uDFFF])")}if(hasLoneLowSurrogates){result.push("(?:[^\\uD800-\\uDBFF]|^)"+createBMPCharacterClasses(loneLowSurrogates))}return result.join("|")};var regenerate=function(value){if(arguments.length>1){value=slice.call(arguments)}if(this instanceof regenerate){this.data=[];return value?this.add(value):this}return(new regenerate).add(value)};regenerate.version="1.2.0";var proto=regenerate.prototype;extend(proto,{add:function(value){var $this=this;if(value==null){return $this}if(value instanceof regenerate){$this.data=dataAddData($this.data,value.data);return $this}if(arguments.length>1){value=slice.call(arguments)}if(isArray(value)){forEach(value,function(item){$this.add(item)});return $this}$this.data=dataAdd($this.data,isNumber(value)?value:symbolToCodePoint(value));return $this},remove:function(value){var $this=this;if(value==null){return $this}if(value instanceof regenerate){$this.data=dataRemoveData($this.data,value.data);return $this}if(arguments.length>1){value=slice.call(arguments)}if(isArray(value)){forEach(value,function(item){$this.remove(item)});return $this}$this.data=dataRemove($this.data,isNumber(value)?value:symbolToCodePoint(value));return $this},addRange:function(start,end){var $this=this;$this.data=dataAddRange($this.data,isNumber(start)?start:symbolToCodePoint(start),isNumber(end)?end:symbolToCodePoint(end));return $this},removeRange:function(start,end){var $this=this;var startCodePoint=isNumber(start)?start:symbolToCodePoint(start);var endCodePoint=isNumber(end)?end:symbolToCodePoint(end);$this.data=dataRemoveRange($this.data,startCodePoint,endCodePoint);return $this},intersection:function(argument){var $this=this;var array=argument instanceof regenerate?dataToArray(argument.data):argument;$this.data=dataIntersection($this.data,array);return $this},contains:function(codePoint){return dataContains(this.data,isNumber(codePoint)?codePoint:symbolToCodePoint(codePoint))},clone:function(){var set=new regenerate;set.data=this.data.slice(0);return set},toString:function(options){var result=createCharacterClassesFromData(this.data,options?options.bmpOnly:false);return result.replace(regexNull,"\\0$1")},toRegExp:function(flags){return RegExp(this.toString(),flags||"")},valueOf:function(){return dataToArray(this.data)}});proto.toArray=proto.valueOf;if(typeof define=="function"&&typeof define.amd=="object"&&define.amd){define(function(){return regenerate})}else if(freeExports&&!freeExports.nodeType){if(freeModule){freeModule.exports=regenerate}else{freeExports.regenerate=regenerate}}else{root.regenerate=regenerate}})(this)}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],178:[function(require,module,exports){(function(global){(function(){"use strict";var objectTypes={"function":true,object:true};var root=objectTypes[typeof window]&&window||this;var oldRoot=root;var freeExports=objectTypes[typeof exports]&&exports;var freeModule=objectTypes[typeof module]&&module&&!module.nodeType&&module;var freeGlobal=freeExports&&freeModule&&typeof global=="object"&&global;if(freeGlobal&&(freeGlobal.global===freeGlobal||freeGlobal.window===freeGlobal||freeGlobal.self===freeGlobal)){root=freeGlobal}var stringFromCharCode=String.fromCharCode;var floor=Math.floor;function fromCodePoint(){var MAX_SIZE=16384;var codeUnits=[];var highSurrogate;var lowSurrogate;var index=-1;var length=arguments.length;if(!length){return""}var result="";while(++index<length){var codePoint=Number(arguments[index]);if(!isFinite(codePoint)||codePoint<0||codePoint>1114111||floor(codePoint)!=codePoint){throw RangeError("Invalid code point: "+codePoint)}if(codePoint<=65535){codeUnits.push(codePoint)}else{codePoint-=65536;highSurrogate=(codePoint>>10)+55296;lowSurrogate=codePoint%1024+56320;codeUnits.push(highSurrogate,lowSurrogate)}if(index+1==length||codeUnits.length>MAX_SIZE){result+=stringFromCharCode.apply(null,codeUnits);codeUnits.length=0}}return result}function assertType(type,expected){if(expected.indexOf("|")==-1){if(type==expected){return}throw Error("Invalid node type: "+type)}expected=assertType.hasOwnProperty(expected)?assertType[expected]:assertType[expected]=RegExp("^(?:"+expected+")$");if(expected.test(type)){return}throw Error("Invalid node type: "+type)}function generate(node){var type=node.type;if(generate.hasOwnProperty(type)&&typeof generate[type]=="function"){return generate[type](node)}throw Error("Invalid node type: "+type)}function generateAlternative(node){assertType(node.type,"alternative");var terms=node.body,length=terms?terms.length:0;if(length==1){return generateTerm(terms[0])}else{var i=-1,result="";while(++i<length){result+=generateTerm(terms[i])}return result}}function generateAnchor(node){assertType(node.type,"anchor");switch(node.kind){case"start":return"^";case"end":return"$";case"boundary":return"\\b";case"not-boundary":return"\\B";default:throw Error("Invalid assertion")}}function generateAtom(node){assertType(node.type,"anchor|characterClass|characterClassEscape|dot|group|reference|value");return generate(node)}function generateCharacterClass(node){assertType(node.type,"characterClass");var classRanges=node.body,length=classRanges?classRanges.length:0;var i=-1,result="[";if(node.negative){result+="^"}while(++i<length){result+=generateClassAtom(classRanges[i])}result+="]";return result}function generateCharacterClassEscape(node){assertType(node.type,"characterClassEscape");return"\\"+node.value}function generateCharacterClassRange(node){assertType(node.type,"characterClassRange");var min=node.min,max=node.max;if(min.type=="characterClassRange"||max.type=="characterClassRange"){throw Error("Invalid character class range")}return generateClassAtom(min)+"-"+generateClassAtom(max)}function generateClassAtom(node){assertType(node.type,"anchor|characterClassEscape|characterClassRange|dot|value");return generate(node)}function generateDisjunction(node){assertType(node.type,"disjunction");var body=node.body,length=body?body.length:0;if(length==0){throw Error("No body")}else if(length==1){return generate(body[0])}else{var i=-1,result="";while(++i<length){if(i!=0){result+="|"}result+=generate(body[i])}return result}}function generateDot(node){assertType(node.type,"dot");return"."}function generateGroup(node){assertType(node.type,"group");var result="(";switch(node.behavior){case"normal":break;case"ignore":result+="?:";break;case"lookahead":result+="?=";break;case"negativeLookahead":result+="?!";break;default:throw Error("Invalid behaviour: "+node.behaviour)}var body=node.body,length=body?body.length:0;if(length==1){result+=generate(body[0])}else{var i=-1;while(++i<length){result+=generate(body[i])}}result+=")";return result}function generateQuantifier(node){assertType(node.type,"quantifier");var quantifier="",min=node.min,max=node.max;switch(max){case undefined:case null:switch(min){case 0:quantifier="*";break;case 1:quantifier="+";break;default:quantifier="{"+min+",}";break}break;default:if(min==max){quantifier="{"+min+"}"}else if(min==0&&max==1){quantifier="?"}else{quantifier="{"+min+","+max+"}"}break}if(!node.greedy){quantifier+="?"}return generateAtom(node.body[0])+quantifier}function generateReference(node){assertType(node.type,"reference");return"\\"+node.matchIndex}function generateTerm(node){assertType(node.type,"anchor|characterClass|characterClassEscape|empty|group|quantifier|reference|value");return generate(node)}function generateValue(node){assertType(node.type,"value");var kind=node.kind,codePoint=node.codePoint;switch(kind){case"controlLetter":return"\\c"+fromCodePoint(codePoint+64);case"hexadecimalEscape":return"\\x"+("00"+codePoint.toString(16).toUpperCase()).slice(-2);case"identifier":return"\\"+fromCodePoint(codePoint);case"null":return"\\"+codePoint;case"octal":return"\\"+codePoint.toString(8);case"singleEscape":switch(codePoint){case 8:return"\\b";case 9:return"\\t";
case 10:return"\\n";case 11:return"\\v";case 12:return"\\f";case 13:return"\\r";default:throw Error("Invalid codepoint: "+codePoint)}case"symbol":return fromCodePoint(codePoint);case"unicodeEscape":return"\\u"+("0000"+codePoint.toString(16).toUpperCase()).slice(-4);case"unicodeCodePointEscape":return"\\u{"+codePoint.toString(16).toUpperCase()+"}";default:throw Error("Unsupported node kind: "+kind)}}generate.alternative=generateAlternative;generate.anchor=generateAnchor;generate.characterClass=generateCharacterClass;generate.characterClassEscape=generateCharacterClassEscape;generate.characterClassRange=generateCharacterClassRange;generate.disjunction=generateDisjunction;generate.dot=generateDot;generate.group=generateGroup;generate.quantifier=generateQuantifier;generate.reference=generateReference;generate.value=generateValue;if(typeof define=="function"&&typeof define.amd=="object"&&define.amd){define(function(){return{generate:generate}})}else if(freeExports&&freeModule){freeExports.generate=generate}else{root.regjsgen={generate:generate}}}).call(this)}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],179:[function(require,module,exports){(function(){function parse(str,flags){var hasUnicodeFlag=(flags||"").indexOf("u")!==-1;var pos=0;var closedCaptureCounter=0;function addRaw(node){node.raw=str.substring(node.range[0],node.range[1]);return node}function updateRawStart(node,start){node.range[0]=start;return addRaw(node)}function createAnchor(kind,rawLength){return addRaw({type:"anchor",kind:kind,range:[pos-rawLength,pos]})}function createValue(kind,codePoint,from,to){return addRaw({type:"value",kind:kind,codePoint:codePoint,range:[from,to]})}function createEscaped(kind,codePoint,value,fromOffset){fromOffset=fromOffset||0;return createValue(kind,codePoint,pos-(value.length+fromOffset),pos)}function createCharacter(matches){var _char=matches[0];var first=_char.charCodeAt(0);if(hasUnicodeFlag){var second;if(_char.length===1&&first>=55296&&first<=56319){second=lookahead().charCodeAt(0);if(second>=56320&&second<=57343){pos++;return createValue("symbol",(first-55296)*1024+second-56320+65536,pos-2,pos)}}}return createValue("symbol",first,pos-1,pos)}function createDisjunction(alternatives,from,to){return addRaw({type:"disjunction",body:alternatives,range:[from,to]})}function createDot(){return addRaw({type:"dot",range:[pos-1,pos]})}function createCharacterClassEscape(value){return addRaw({type:"characterClassEscape",value:value,range:[pos-2,pos]})}function createReference(matchIndex){return addRaw({type:"reference",matchIndex:parseInt(matchIndex,10),range:[pos-1-matchIndex.length,pos]})}function createGroup(behavior,disjunction,from,to){return addRaw({type:"group",behavior:behavior,body:disjunction,range:[from,to]})}function createQuantifier(min,max,from,to){if(to==null){from=pos-1;to=pos}return addRaw({type:"quantifier",min:min,max:max,greedy:true,body:null,range:[from,to]})}function createAlternative(terms,from,to){return addRaw({type:"alternative",body:terms,range:[from,to]})}function createCharacterClass(classRanges,negative,from,to){return addRaw({type:"characterClass",body:classRanges,negative:negative,range:[from,to]})}function createClassRange(min,max,from,to){if(min.codePoint>max.codePoint){throw SyntaxError("invalid range in character class")}return addRaw({type:"characterClassRange",min:min,max:max,range:[from,to]})}function flattenBody(body){if(body.type==="alternative"){return body.body}else{return[body]}}function isEmpty(obj){return obj.type==="empty"}function incr(amount){amount=amount||1;var res=str.substring(pos,pos+amount);pos+=amount||1;return res}function skip(value){if(!match(value)){throw SyntaxError("character: "+value)}}function match(value){if(str.indexOf(value,pos)===pos){return incr(value.length)}}function lookahead(){return str[pos]}function current(value){return str.indexOf(value,pos)===pos}function next(value){return str[pos+1]===value}function matchReg(regExp){var subStr=str.substring(pos);var res=subStr.match(regExp);if(res){res.range=[];res.range[0]=pos;incr(res[0].length);res.range[1]=pos}return res}function parseDisjunction(){var res=[],from=pos;res.push(parseAlternative());while(match("|")){res.push(parseAlternative())}if(res.length===1){return res[0]}return createDisjunction(res,from,pos)}function parseAlternative(){var res=[],from=pos;var term;while(term=parseTerm()){res.push(term)}if(res.length===1){return res[0]}return createAlternative(res,from,pos)}function parseTerm(){if(pos>=str.length||current("|")||current(")")){return null}var anchor=parseAnchor();if(anchor){return anchor}var atom=parseAtom();if(!atom){throw SyntaxError("Expected atom")}var quantifier=parseQuantifier()||false;if(quantifier){quantifier.body=flattenBody(atom);updateRawStart(quantifier,atom.range[0]);return quantifier}return atom}function parseGroup(matchA,typeA,matchB,typeB){var type=null,from=pos;if(match(matchA)){type=typeA}else if(match(matchB)){type=typeB}else{return false}var body=parseDisjunction();if(!body){throw SyntaxError("Expected disjunction")}skip(")");var group=createGroup(type,flattenBody(body),from,pos);if(type=="normal"){closedCaptureCounter++}return group}function parseAnchor(){var res,from=pos;if(match("^")){return createAnchor("start",1)}else if(match("$")){return createAnchor("end",1)}else if(match("\\b")){return createAnchor("boundary",2)}else if(match("\\B")){return createAnchor("not-boundary",2)}else{return parseGroup("(?=","lookahead","(?!","negativeLookahead")}}function parseQuantifier(){var res;var quantifier;var min,max;if(match("*")){quantifier=createQuantifier(0)}else if(match("+")){quantifier=createQuantifier(1)}else if(match("?")){quantifier=createQuantifier(0,1)}else if(res=matchReg(/^\{([0-9]+)\}/)){min=parseInt(res[1],10);quantifier=createQuantifier(min,min,res.range[0],res.range[1])}else if(res=matchReg(/^\{([0-9]+),\}/)){min=parseInt(res[1],10);quantifier=createQuantifier(min,undefined,res.range[0],res.range[1])}else if(res=matchReg(/^\{([0-9]+),([0-9]+)\}/)){min=parseInt(res[1],10);max=parseInt(res[2],10);if(min>max){throw SyntaxError("numbers out of order in {} quantifier")}quantifier=createQuantifier(min,max,res.range[0],res.range[1])}if(quantifier){if(match("?")){quantifier.greedy=false;quantifier.range[1]+=1}}return quantifier}function parseAtom(){var res;if(res=matchReg(/^[^^$\\.*+?(){[|]/)){return createCharacter(res)}else if(match(".")){return createDot()}else if(match("\\")){res=parseAtomEscape();if(!res){throw SyntaxError("atomEscape")}return res}else if(res=parseCharacterClass()){return res}else{return parseGroup("(?:","ignore","(","normal")}}function parseUnicodeSurrogatePairEscape(firstEscape){if(hasUnicodeFlag){var first,second;if(firstEscape.kind=="unicodeEscape"&&(first=firstEscape.codePoint)>=55296&&first<=56319&¤t("\\")&&next("u")){var prevPos=pos;pos++;var secondEscape=parseClassEscape();if(secondEscape.kind=="unicodeEscape"&&(second=secondEscape.codePoint)>=56320&&second<=57343){firstEscape.range[1]=secondEscape.range[1];firstEscape.codePoint=(first-55296)*1024+second-56320+65536;firstEscape.type="value";firstEscape.kind="unicodeCodePointEscape";addRaw(firstEscape)}else{pos=prevPos}}}return firstEscape}function parseClassEscape(){return parseAtomEscape(true)}function parseAtomEscape(insideCharacterClass){var res;res=parseDecimalEscape();if(res){return res}if(insideCharacterClass){if(match("b")){return createEscaped("singleEscape",8,"\\b")}else if(match("B")){throw SyntaxError("\\B not possible inside of CharacterClass")}}res=parseCharacterEscape();return res}function parseDecimalEscape(){var res,match;if(res=matchReg(/^(?!0)\d+/)){match=res[0];var refIdx=parseInt(res[0],10);if(refIdx<=closedCaptureCounter){return createReference(res[0])}else{incr(-res[0].length);if(res=matchReg(/^[0-7]{1,3}/)){return createEscaped("octal",parseInt(res[0],8),res[0],1)}else{res=createCharacter(matchReg(/^[89]/));return updateRawStart(res,res.range[0]-1)}}}else if(res=matchReg(/^[0-7]{1,3}/)){match=res[0];if(/^0{1,3}$/.test(match)){return createEscaped("null",0,"0",match.length+1)}else{return createEscaped("octal",parseInt(match,8),match,1)}}else if(res=matchReg(/^[dDsSwW]/)){return createCharacterClassEscape(res[0])}return false}function parseCharacterEscape(){var res;if(res=matchReg(/^[fnrtv]/)){var codePoint=0;switch(res[0]){case"t":codePoint=9;break;case"n":codePoint=10;break;case"v":codePoint=11;break;case"f":codePoint=12;break;case"r":codePoint=13;break}return createEscaped("singleEscape",codePoint,"\\"+res[0])}else if(res=matchReg(/^c([a-zA-Z])/)){return createEscaped("controlLetter",res[1].charCodeAt(0)%32,res[1],2)}else if(res=matchReg(/^x([0-9a-fA-F]{2})/)){return createEscaped("hexadecimalEscape",parseInt(res[1],16),res[1],2)}else if(res=matchReg(/^u([0-9a-fA-F]{4})/)){return parseUnicodeSurrogatePairEscape(createEscaped("unicodeEscape",parseInt(res[1],16),res[1],2))}else if(hasUnicodeFlag&&(res=matchReg(/^u\{([0-9a-fA-F]{1,})\}/))){return createEscaped("unicodeCodePointEscape",parseInt(res[1],16),res[1],4)}else{return parseIdentityEscape()}}function isIdentifierPart(ch){var NonAsciiIdentifierPart=new RegExp("[ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮ̀-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁ҃-҇Ҋ-ԯԱ-Ֆՙա-և֑-ׇֽֿׁׂׅׄא-תװ-ײؐ-ؚؠ-٩ٮ-ۓە-ۜ۟-۪ۨ-ۼۿܐ-݊ݍ-ޱ߀-ߵߺࠀ-࠭ࡀ-࡛ࢠ-ࢲࣤ-ॣ०-९ॱ-ঃঅ-ঌএঐও-নপ-রলশ-হ়-ৄেৈো-ৎৗড়ঢ়য়-ৣ০-ৱਁ-ਃਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹ਼ਾ-ੂੇੈੋ-੍ੑਖ਼-ੜਫ਼੦-ੵઁ-ઃઅ-ઍએ-ઑઓ-નપ-રલળવ-હ઼-ૅે-ૉો-્ૐૠ-ૣ૦-૯ଁ-ଃଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହ଼-ୄେୈୋ-୍ୖୗଡ଼ଢ଼ୟ-ୣ୦-୯ୱஂஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹா-ூெ-ைொ-்ௐௗ௦-௯ఀ-ఃఅ-ఌఎ-ఐఒ-నప-హఽ-ౄె-ైొ-్ౕౖౘౙౠ-ౣ౦-౯ಁ-ಃಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹ಼-ೄೆ-ೈೊ-್ೕೖೞೠ-ೣ೦-೯ೱೲഁ-ഃഅ-ഌഎ-ഐഒ-ഺഽ-ൄെ-ൈൊ-ൎൗൠ-ൣ൦-൯ൺ-ൿංඃඅ-ඖක-නඳ-රලව-ෆ්ා-ුූෘ-ෟ෦-෯ෲෳก-ฺเ-๎๐-๙ກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ູົ-ຽເ-ໄໆ່-ໍ໐-໙ໜ-ໟༀ༘༙༠-༩༹༵༷༾-ཇཉ-ཬཱ-྄྆-ྗྙ-ྼ࿆က-၉ၐ-ႝႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚ፝-፟ᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-᜔ᜠ-᜴ᝀ-ᝓᝠ-ᝬᝮ-ᝰᝲᝳក-៓ៗៜ៝០-៩᠋-᠍᠐-᠙ᠠ-ᡷᢀ-ᢪᢰ-ᣵᤀ-ᤞᤠ-ᤫᤰ-᤻᥆-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉ᧐-᧙ᨀ-ᨛᨠ-ᩞ᩠-᩿᩼-᪉᪐-᪙ᪧ᪰-᪽ᬀ-ᭋ᭐-᭙᭫-᭳ᮀ-᯳ᰀ-᰷᱀-᱉ᱍ-ᱽ᳐-᳔᳒-ᳶ᳸᳹ᴀ-᷵᷼-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼ‿⁀⁔ⁱⁿₐ-ₜ⃐-⃥⃜⃡-⃰ℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯ⵿-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⷠ-ⷿⸯ々-〇〡-〯〱-〵〸-〼ぁ-ゖ゙゚ゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘫꙀ-꙯ꙴ-꙽ꙿ-ꚝꚟ-꛱ꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞭꞰꞱꟷ-ꠧꡀ-ꡳꢀ-꣄꣐-꣙꣠-ꣷꣻ꤀-꤭ꤰ-꥓ꥠ-ꥼꦀ-꧀ꧏ-꧙ꧠ-ꧾꨀ-ꨶꩀ-ꩍ꩐-꩙ꩠ-ꩶꩺ-ꫂꫛ-ꫝꫠ-ꫯꫲ-꫶ꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭟꭤꭥꯀ-ꯪ꯬꯭꯰-꯹가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻ︀-️︠-︭︳︴﹍-﹏ﹰ-ﹴﹶ-ﻼ0-9A-Z_a-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ]");return ch===36||ch===95||ch>=65&&ch<=90||ch>=97&&ch<=122||ch>=48&&ch<=57||ch===92||ch>=128&&NonAsciiIdentifierPart.test(String.fromCharCode(ch))}function parseIdentityEscape(){var ZWJ="";var ZWNJ="";var res;var tmp;if(!isIdentifierPart(lookahead())){tmp=incr();return createEscaped("identifier",tmp.charCodeAt(0),tmp,1)}if(match(ZWJ)){return createEscaped("identifier",8204,ZWJ)}else if(match(ZWNJ)){return createEscaped("identifier",8205,ZWNJ)}return null}function parseCharacterClass(){var res,from=pos;if(res=matchReg(/^\[\^/)){res=parseClassRanges();skip("]");return createCharacterClass(res,true,from,pos)}else if(match("[")){res=parseClassRanges();skip("]");return createCharacterClass(res,false,from,pos)}return null}function parseClassRanges(){var res;if(current("]")){return[]}else{res=parseNonemptyClassRanges();if(!res){throw SyntaxError("nonEmptyClassRanges")}return res}}function parseHelperClassRanges(atom){var from,to,res;if(current("-")&&!next("]")){skip("-");res=parseClassAtom();if(!res){throw SyntaxError("classAtom")}to=pos;var classRanges=parseClassRanges();if(!classRanges){throw SyntaxError("classRanges")}from=atom.range[0];if(classRanges.type==="empty"){return[createClassRange(atom,res,from,to)]}return[createClassRange(atom,res,from,to)].concat(classRanges)}res=parseNonemptyClassRangesNoDash();if(!res){throw SyntaxError("nonEmptyClassRangesNoDash")}return[atom].concat(res)}function parseNonemptyClassRanges(){var atom=parseClassAtom();if(!atom){throw SyntaxError("classAtom")}if(current("]")){return[atom]}return parseHelperClassRanges(atom)}function parseNonemptyClassRangesNoDash(){var res=parseClassAtom();if(!res){throw SyntaxError("classAtom")}if(current("]")){return res}return parseHelperClassRanges(res)}function parseClassAtom(){if(match("-")){return createCharacter("-")}else{return parseClassAtomNoDash()}}function parseClassAtomNoDash(){var res;if(res=matchReg(/^[^\\\]-]/)){return createCharacter(res[0])}else if(match("\\")){res=parseClassEscape();if(!res){throw SyntaxError("classEscape")}return parseUnicodeSurrogatePairEscape(res)}}str=String(str);if(str===""){str="(?:)"}var result=parseDisjunction();if(result.range[1]!==str.length){throw SyntaxError("Could not parse entire input - got stuck: "+str)}return result}var regjsparser={parse:parse};if(typeof module!=="undefined"&&module.exports){module.exports=regjsparser}else{window.regjsparser=regjsparser}})()},{}],180:[function(require,module,exports){var generate=require("regjsgen").generate;var parse=require("regjsparser").parse;var regenerate=require("regenerate");var iuMappings=require("./data/iu-mappings.json");var ESCAPE_SETS=require("./data/character-class-escape-sets.js");function getCharacterClassEscapeSet(character){if(unicode){if(ignoreCase){return ESCAPE_SETS.UNICODE_IGNORE_CASE[character]}return ESCAPE_SETS.UNICODE[character]}return ESCAPE_SETS.REGULAR[character]}var object={};var hasOwnProperty=object.hasOwnProperty;function has(object,property){return hasOwnProperty.call(object,property)}var UNICODE_SET=regenerate().addRange(0,1114111);var BMP_SET=regenerate().addRange(0,65535);var DOT_SET_UNICODE=UNICODE_SET.clone().remove(10,13,8232,8233);var DOT_SET=DOT_SET_UNICODE.clone().intersection(BMP_SET);regenerate.prototype.iuAddRange=function(min,max){var $this=this;do{var folded=caseFold(min);if(folded){$this.add(folded)}}while(++min<=max);return $this};function assign(target,source){for(var key in source){target[key]=source[key]}}function update(item,pattern){var tree=parse(pattern,"");switch(tree.type){case"characterClass":case"group":case"value":break;default:tree=wrap(tree,pattern)}assign(item,tree)}function wrap(tree,pattern){return{type:"group",behavior:"ignore",body:[tree],raw:"(?:"+pattern+")"}}function caseFold(codePoint){return has(iuMappings,codePoint)?iuMappings[codePoint]:false}var ignoreCase=false;var unicode=false;function processCharacterClass(characterClassItem){var set=regenerate();var body=characterClassItem.body.forEach(function(item){switch(item.type){case"value":set.add(item.codePoint);if(ignoreCase&&unicode){var folded=caseFold(item.codePoint);if(folded){set.add(folded)}}break;case"characterClassRange":var min=item.min.codePoint;var max=item.max.codePoint;set.addRange(min,max);if(ignoreCase&&unicode){set.iuAddRange(min,max)}break;case"characterClassEscape":set.add(getCharacterClassEscapeSet(item.value));break;default:throw Error("Unknown term type: "+item.type)}});if(characterClassItem.negative){set=(unicode?UNICODE_SET:BMP_SET).clone().remove(set)}update(characterClassItem,set.toString());return characterClassItem}function processTerm(item){switch(item.type){case"dot":update(item,(unicode?DOT_SET_UNICODE:DOT_SET).toString());break;case"characterClass":item=processCharacterClass(item);break;case"characterClassEscape":update(item,getCharacterClassEscapeSet(item.value).toString());break;case"alternative":case"disjunction":case"group":case"quantifier":item.body=item.body.map(processTerm);break;case"value":var codePoint=item.codePoint;var set=regenerate(codePoint);if(ignoreCase&&unicode){var folded=caseFold(codePoint);if(folded){set.add(folded)}}update(item,set.toString());break;case"anchor":case"empty":case"group":case"reference":break;default:throw Error("Unknown term type: "+item.type)}return item}module.exports=function(pattern,flags){var tree=parse(pattern,flags);ignoreCase=flags?flags.indexOf("i")>-1:false;unicode=flags?flags.indexOf("u")>-1:false;assign(tree,processTerm(tree));return generate(tree)}},{"./data/character-class-escape-sets.js":175,"./data/iu-mappings.json":176,regenerate:177,regjsgen:178,regjsparser:179}],181:[function(require,module,exports){exports.SourceMapGenerator=require("./source-map/source-map-generator").SourceMapGenerator;exports.SourceMapConsumer=require("./source-map/source-map-consumer").SourceMapConsumer;exports.SourceNode=require("./source-map/source-node").SourceNode},{"./source-map/source-map-consumer":187,"./source-map/source-map-generator":188,"./source-map/source-node":189}],182:[function(require,module,exports){if(typeof define!=="function"){var define=require("amdefine")(module,require)}define(function(require,exports,module){var util=require("./util");function ArraySet(){this._array=[];this._set={}}ArraySet.fromArray=function ArraySet_fromArray(aArray,aAllowDuplicates){var set=new ArraySet;for(var i=0,len=aArray.length;i<len;i++){set.add(aArray[i],aAllowDuplicates)}return set};ArraySet.prototype.add=function ArraySet_add(aStr,aAllowDuplicates){var isDuplicate=this.has(aStr);var idx=this._array.length;if(!isDuplicate||aAllowDuplicates){this._array.push(aStr)}if(!isDuplicate){this._set[util.toSetString(aStr)]=idx}};ArraySet.prototype.has=function ArraySet_has(aStr){return Object.prototype.hasOwnProperty.call(this._set,util.toSetString(aStr))};ArraySet.prototype.indexOf=function ArraySet_indexOf(aStr){if(this.has(aStr)){return this._set[util.toSetString(aStr)]}throw new Error('"'+aStr+'" is not in the set.')};ArraySet.prototype.at=function ArraySet_at(aIdx){if(aIdx>=0&&aIdx<this._array.length){return this._array[aIdx]}throw new Error("No element indexed by "+aIdx)};ArraySet.prototype.toArray=function ArraySet_toArray(){return this._array.slice()};exports.ArraySet=ArraySet})},{"./util":190,amdefine:191}],183:[function(require,module,exports){if(typeof define!=="function"){var define=require("amdefine")(module,require)}define(function(require,exports,module){var base64=require("./base64");var VLQ_BASE_SHIFT=5;var VLQ_BASE=1<<VLQ_BASE_SHIFT;var VLQ_BASE_MASK=VLQ_BASE-1;var VLQ_CONTINUATION_BIT=VLQ_BASE;function toVLQSigned(aValue){return aValue<0?(-aValue<<1)+1:(aValue<<1)+0}function fromVLQSigned(aValue){var isNegative=(aValue&1)===1;var shifted=aValue>>1;return isNegative?-shifted:shifted}exports.encode=function base64VLQ_encode(aValue){var encoded="";var digit;var vlq=toVLQSigned(aValue);do{digit=vlq&VLQ_BASE_MASK;vlq>>>=VLQ_BASE_SHIFT;if(vlq>0){digit|=VLQ_CONTINUATION_BIT}encoded+=base64.encode(digit)}while(vlq>0);return encoded};exports.decode=function base64VLQ_decode(aStr,aOutParam){var i=0;var strLen=aStr.length;var result=0;var shift=0;var continuation,digit;do{if(i>=strLen){throw new Error("Expected more digits in base 64 VLQ value.")}digit=base64.decode(aStr.charAt(i++));continuation=!!(digit&VLQ_CONTINUATION_BIT);digit&=VLQ_BASE_MASK;result=result+(digit<<shift);shift+=VLQ_BASE_SHIFT}while(continuation);aOutParam.value=fromVLQSigned(result);aOutParam.rest=aStr.slice(i)}})},{"./base64":184,amdefine:191}],184:[function(require,module,exports){if(typeof define!=="function"){var define=require("amdefine")(module,require)}define(function(require,exports,module){var charToIntMap={};var intToCharMap={};"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("").forEach(function(ch,index){charToIntMap[ch]=index;intToCharMap[index]=ch});exports.encode=function base64_encode(aNumber){if(aNumber in intToCharMap){return intToCharMap[aNumber]}throw new TypeError("Must be between 0 and 63: "+aNumber)};exports.decode=function base64_decode(aChar){if(aChar in charToIntMap){return charToIntMap[aChar]}throw new TypeError("Not a valid base 64 digit: "+aChar)}})},{amdefine:191}],185:[function(require,module,exports){if(typeof define!=="function"){var define=require("amdefine")(module,require)}define(function(require,exports,module){function recursiveSearch(aLow,aHigh,aNeedle,aHaystack,aCompare){var mid=Math.floor((aHigh-aLow)/2)+aLow;var cmp=aCompare(aNeedle,aHaystack[mid],true);if(cmp===0){return mid}else if(cmp>0){if(aHigh-mid>1){return recursiveSearch(mid,aHigh,aNeedle,aHaystack,aCompare)}return mid}else{if(mid-aLow>1){return recursiveSearch(aLow,mid,aNeedle,aHaystack,aCompare)}return aLow<0?-1:aLow}}exports.search=function search(aNeedle,aHaystack,aCompare){if(aHaystack.length===0){return-1}return recursiveSearch(-1,aHaystack.length,aNeedle,aHaystack,aCompare)}})},{amdefine:191}],186:[function(require,module,exports){if(typeof define!=="function"){var define=require("amdefine")(module,require)}define(function(require,exports,module){var util=require("./util");function generatedPositionAfter(mappingA,mappingB){var lineA=mappingA.generatedLine;var lineB=mappingB.generatedLine;var columnA=mappingA.generatedColumn;var columnB=mappingB.generatedColumn;return lineB>lineA||lineB==lineA&&columnB>=columnA||util.compareByGeneratedPositions(mappingA,mappingB)<=0}function MappingList(){this._array=[];this._sorted=true;this._last={generatedLine:-1,generatedColumn:0}}MappingList.prototype.unsortedForEach=function MappingList_forEach(aCallback,aThisArg){this._array.forEach(aCallback,aThisArg)};MappingList.prototype.add=function MappingList_add(aMapping){var mapping;if(generatedPositionAfter(this._last,aMapping)){this._last=aMapping;this._array.push(aMapping)}else{this._sorted=false;this._array.push(aMapping)}};MappingList.prototype.toArray=function MappingList_toArray(){if(!this._sorted){this._array.sort(util.compareByGeneratedPositions);this._sorted=true}return this._array};exports.MappingList=MappingList})},{"./util":190,amdefine:191}],187:[function(require,module,exports){if(typeof define!=="function"){var define=require("amdefine")(module,require)}define(function(require,exports,module){var util=require("./util");var binarySearch=require("./binary-search");var ArraySet=require("./array-set").ArraySet;var base64VLQ=require("./base64-vlq");function SourceMapConsumer(aSourceMap){var sourceMap=aSourceMap;if(typeof aSourceMap==="string"){sourceMap=JSON.parse(aSourceMap.replace(/^\)\]\}'/,""))}var version=util.getArg(sourceMap,"version");var sources=util.getArg(sourceMap,"sources");var names=util.getArg(sourceMap,"names",[]);var sourceRoot=util.getArg(sourceMap,"sourceRoot",null);var sourcesContent=util.getArg(sourceMap,"sourcesContent",null);var mappings=util.getArg(sourceMap,"mappings");var file=util.getArg(sourceMap,"file",null);if(version!=this._version){throw new Error("Unsupported version: "+version)}sources=sources.map(util.normalize);this._names=ArraySet.fromArray(names,true);this._sources=ArraySet.fromArray(sources,true);this.sourceRoot=sourceRoot;this.sourcesContent=sourcesContent;this._mappings=mappings;this.file=file}SourceMapConsumer.fromSourceMap=function SourceMapConsumer_fromSourceMap(aSourceMap){var smc=Object.create(SourceMapConsumer.prototype);smc._names=ArraySet.fromArray(aSourceMap._names.toArray(),true);smc._sources=ArraySet.fromArray(aSourceMap._sources.toArray(),true);smc.sourceRoot=aSourceMap._sourceRoot;smc.sourcesContent=aSourceMap._generateSourcesContent(smc._sources.toArray(),smc.sourceRoot);smc.file=aSourceMap._file;smc.__generatedMappings=aSourceMap._mappings.toArray().slice();smc.__originalMappings=aSourceMap._mappings.toArray().slice().sort(util.compareByOriginalPositions);return smc};SourceMapConsumer.prototype._version=3;Object.defineProperty(SourceMapConsumer.prototype,"sources",{get:function(){return this._sources.toArray().map(function(s){return this.sourceRoot!=null?util.join(this.sourceRoot,s):s},this)}});SourceMapConsumer.prototype.__generatedMappings=null;Object.defineProperty(SourceMapConsumer.prototype,"_generatedMappings",{get:function(){if(!this.__generatedMappings){this.__generatedMappings=[];this.__originalMappings=[];this._parseMappings(this._mappings,this.sourceRoot)}return this.__generatedMappings}});SourceMapConsumer.prototype.__originalMappings=null;Object.defineProperty(SourceMapConsumer.prototype,"_originalMappings",{get:function(){if(!this.__originalMappings){this.__generatedMappings=[];this.__originalMappings=[];this._parseMappings(this._mappings,this.sourceRoot)}return this.__originalMappings}});SourceMapConsumer.prototype._nextCharIsMappingSeparator=function SourceMapConsumer_nextCharIsMappingSeparator(aStr){var c=aStr.charAt(0);return c===";"||c===","};SourceMapConsumer.prototype._parseMappings=function SourceMapConsumer_parseMappings(aStr,aSourceRoot){var generatedLine=1;var previousGeneratedColumn=0;var previousOriginalLine=0;var previousOriginalColumn=0;var previousSource=0;var previousName=0;var str=aStr;var temp={};var mapping;while(str.length>0){if(str.charAt(0)===";"){generatedLine++;str=str.slice(1);previousGeneratedColumn=0}else if(str.charAt(0)===","){str=str.slice(1)}else{mapping={};mapping.generatedLine=generatedLine;base64VLQ.decode(str,temp);mapping.generatedColumn=previousGeneratedColumn+temp.value;previousGeneratedColumn=mapping.generatedColumn;str=temp.rest;if(str.length>0&&!this._nextCharIsMappingSeparator(str)){base64VLQ.decode(str,temp);mapping.source=this._sources.at(previousSource+temp.value);previousSource+=temp.value;str=temp.rest;if(str.length===0||this._nextCharIsMappingSeparator(str)){throw new Error("Found a source, but no line and column")}base64VLQ.decode(str,temp);mapping.originalLine=previousOriginalLine+temp.value;previousOriginalLine=mapping.originalLine;mapping.originalLine+=1;str=temp.rest;if(str.length===0||this._nextCharIsMappingSeparator(str)){throw new Error("Found a source and line, but no column")}base64VLQ.decode(str,temp);mapping.originalColumn=previousOriginalColumn+temp.value;previousOriginalColumn=mapping.originalColumn;str=temp.rest;if(str.length>0&&!this._nextCharIsMappingSeparator(str)){base64VLQ.decode(str,temp);mapping.name=this._names.at(previousName+temp.value);previousName+=temp.value;str=temp.rest}}this.__generatedMappings.push(mapping);if(typeof mapping.originalLine==="number"){this.__originalMappings.push(mapping)}}}this.__generatedMappings.sort(util.compareByGeneratedPositions);this.__originalMappings.sort(util.compareByOriginalPositions)};SourceMapConsumer.prototype._findMapping=function SourceMapConsumer_findMapping(aNeedle,aMappings,aLineName,aColumnName,aComparator){if(aNeedle[aLineName]<=0){throw new TypeError("Line must be greater than or equal to 1, got "+aNeedle[aLineName])}if(aNeedle[aColumnName]<0){throw new TypeError("Column must be greater than or equal to 0, got "+aNeedle[aColumnName])}return binarySearch.search(aNeedle,aMappings,aComparator)};SourceMapConsumer.prototype.computeColumnSpans=function SourceMapConsumer_computeColumnSpans(){for(var index=0;index<this._generatedMappings.length;++index){var mapping=this._generatedMappings[index];if(index+1<this._generatedMappings.length){var nextMapping=this._generatedMappings[index+1];if(mapping.generatedLine===nextMapping.generatedLine){mapping.lastGeneratedColumn=nextMapping.generatedColumn-1;continue}}mapping.lastGeneratedColumn=Infinity}};SourceMapConsumer.prototype.originalPositionFor=function SourceMapConsumer_originalPositionFor(aArgs){var needle={generatedLine:util.getArg(aArgs,"line"),generatedColumn:util.getArg(aArgs,"column")};var index=this._findMapping(needle,this._generatedMappings,"generatedLine","generatedColumn",util.compareByGeneratedPositions);if(index>=0){var mapping=this._generatedMappings[index];if(mapping.generatedLine===needle.generatedLine){var source=util.getArg(mapping,"source",null);if(source!=null&&this.sourceRoot!=null){source=util.join(this.sourceRoot,source)}return{source:source,line:util.getArg(mapping,"originalLine",null),column:util.getArg(mapping,"originalColumn",null),name:util.getArg(mapping,"name",null)}}}return{source:null,line:null,column:null,name:null}};SourceMapConsumer.prototype.sourceContentFor=function SourceMapConsumer_sourceContentFor(aSource){if(!this.sourcesContent){return null}if(this.sourceRoot!=null){aSource=util.relative(this.sourceRoot,aSource)}if(this._sources.has(aSource)){return this.sourcesContent[this._sources.indexOf(aSource)]}var url;if(this.sourceRoot!=null&&(url=util.urlParse(this.sourceRoot))){var fileUriAbsPath=aSource.replace(/^file:\/\//,"");if(url.scheme=="file"&&this._sources.has(fileUriAbsPath)){return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)]}if((!url.path||url.path=="/")&&this._sources.has("/"+aSource)){return this.sourcesContent[this._sources.indexOf("/"+aSource)]}}throw new Error('"'+aSource+'" is not in the SourceMap.')};SourceMapConsumer.prototype.generatedPositionFor=function SourceMapConsumer_generatedPositionFor(aArgs){var needle={source:util.getArg(aArgs,"source"),originalLine:util.getArg(aArgs,"line"),originalColumn:util.getArg(aArgs,"column")};if(this.sourceRoot!=null){needle.source=util.relative(this.sourceRoot,needle.source)}var index=this._findMapping(needle,this._originalMappings,"originalLine","originalColumn",util.compareByOriginalPositions);if(index>=0){var mapping=this._originalMappings[index];return{line:util.getArg(mapping,"generatedLine",null),column:util.getArg(mapping,"generatedColumn",null),lastColumn:util.getArg(mapping,"lastGeneratedColumn",null)}}return{line:null,column:null,lastColumn:null}};SourceMapConsumer.prototype.allGeneratedPositionsFor=function SourceMapConsumer_allGeneratedPositionsFor(aArgs){var needle={source:util.getArg(aArgs,"source"),originalLine:util.getArg(aArgs,"line"),originalColumn:Infinity};if(this.sourceRoot!=null){needle.source=util.relative(this.sourceRoot,needle.source)}var mappings=[];var index=this._findMapping(needle,this._originalMappings,"originalLine","originalColumn",util.compareByOriginalPositions);if(index>=0){var mapping=this._originalMappings[index];while(mapping&&mapping.originalLine===needle.originalLine){mappings.push({line:util.getArg(mapping,"generatedLine",null),column:util.getArg(mapping,"generatedColumn",null),lastColumn:util.getArg(mapping,"lastGeneratedColumn",null)});mapping=this._originalMappings[--index]}}return mappings.reverse()};SourceMapConsumer.GENERATED_ORDER=1;SourceMapConsumer.ORIGINAL_ORDER=2;SourceMapConsumer.prototype.eachMapping=function SourceMapConsumer_eachMapping(aCallback,aContext,aOrder){var context=aContext||null;var order=aOrder||SourceMapConsumer.GENERATED_ORDER;var mappings;switch(order){case SourceMapConsumer.GENERATED_ORDER:mappings=this._generatedMappings;break;case SourceMapConsumer.ORIGINAL_ORDER:mappings=this._originalMappings;break;default:throw new Error("Unknown order of iteration.")}var sourceRoot=this.sourceRoot;mappings.map(function(mapping){var source=mapping.source;if(source!=null&&sourceRoot!=null){source=util.join(sourceRoot,source)}return{source:source,generatedLine:mapping.generatedLine,generatedColumn:mapping.generatedColumn,originalLine:mapping.originalLine,originalColumn:mapping.originalColumn,name:mapping.name}}).forEach(aCallback,context)};exports.SourceMapConsumer=SourceMapConsumer})},{"./array-set":182,"./base64-vlq":183,"./binary-search":185,"./util":190,amdefine:191}],188:[function(require,module,exports){if(typeof define!=="function"){var define=require("amdefine")(module,require)}define(function(require,exports,module){var base64VLQ=require("./base64-vlq");var util=require("./util");var ArraySet=require("./array-set").ArraySet;var MappingList=require("./mapping-list").MappingList;function SourceMapGenerator(aArgs){if(!aArgs){aArgs={}}this._file=util.getArg(aArgs,"file",null);this._sourceRoot=util.getArg(aArgs,"sourceRoot",null);this._skipValidation=util.getArg(aArgs,"skipValidation",false);this._sources=new ArraySet;this._names=new ArraySet;this._mappings=new MappingList;this._sourcesContents=null}SourceMapGenerator.prototype._version=3;SourceMapGenerator.fromSourceMap=function SourceMapGenerator_fromSourceMap(aSourceMapConsumer){var sourceRoot=aSourceMapConsumer.sourceRoot;var generator=new SourceMapGenerator({file:aSourceMapConsumer.file,sourceRoot:sourceRoot});aSourceMapConsumer.eachMapping(function(mapping){var newMapping={generated:{line:mapping.generatedLine,column:mapping.generatedColumn}};if(mapping.source!=null){newMapping.source=mapping.source;if(sourceRoot!=null){newMapping.source=util.relative(sourceRoot,newMapping.source)}newMapping.original={line:mapping.originalLine,column:mapping.originalColumn};
if(mapping.name!=null){newMapping.name=mapping.name}}generator.addMapping(newMapping)});aSourceMapConsumer.sources.forEach(function(sourceFile){var content=aSourceMapConsumer.sourceContentFor(sourceFile);if(content!=null){generator.setSourceContent(sourceFile,content)}});return generator};SourceMapGenerator.prototype.addMapping=function SourceMapGenerator_addMapping(aArgs){var generated=util.getArg(aArgs,"generated");var original=util.getArg(aArgs,"original",null);var source=util.getArg(aArgs,"source",null);var name=util.getArg(aArgs,"name",null);if(!this._skipValidation){this._validateMapping(generated,original,source,name)}if(source!=null&&!this._sources.has(source)){this._sources.add(source)}if(name!=null&&!this._names.has(name)){this._names.add(name)}this._mappings.add({generatedLine:generated.line,generatedColumn:generated.column,originalLine:original!=null&&original.line,originalColumn:original!=null&&original.column,source:source,name:name})};SourceMapGenerator.prototype.setSourceContent=function SourceMapGenerator_setSourceContent(aSourceFile,aSourceContent){var source=aSourceFile;if(this._sourceRoot!=null){source=util.relative(this._sourceRoot,source)}if(aSourceContent!=null){if(!this._sourcesContents){this._sourcesContents={}}this._sourcesContents[util.toSetString(source)]=aSourceContent}else if(this._sourcesContents){delete this._sourcesContents[util.toSetString(source)];if(Object.keys(this._sourcesContents).length===0){this._sourcesContents=null}}};SourceMapGenerator.prototype.applySourceMap=function SourceMapGenerator_applySourceMap(aSourceMapConsumer,aSourceFile,aSourceMapPath){var sourceFile=aSourceFile;if(aSourceFile==null){if(aSourceMapConsumer.file==null){throw new Error("SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, "+'or the source map\'s "file" property. Both were omitted.')}sourceFile=aSourceMapConsumer.file}var sourceRoot=this._sourceRoot;if(sourceRoot!=null){sourceFile=util.relative(sourceRoot,sourceFile)}var newSources=new ArraySet;var newNames=new ArraySet;this._mappings.unsortedForEach(function(mapping){if(mapping.source===sourceFile&&mapping.originalLine!=null){var original=aSourceMapConsumer.originalPositionFor({line:mapping.originalLine,column:mapping.originalColumn});if(original.source!=null){mapping.source=original.source;if(aSourceMapPath!=null){mapping.source=util.join(aSourceMapPath,mapping.source)}if(sourceRoot!=null){mapping.source=util.relative(sourceRoot,mapping.source)}mapping.originalLine=original.line;mapping.originalColumn=original.column;if(original.name!=null){mapping.name=original.name}}}var source=mapping.source;if(source!=null&&!newSources.has(source)){newSources.add(source)}var name=mapping.name;if(name!=null&&!newNames.has(name)){newNames.add(name)}},this);this._sources=newSources;this._names=newNames;aSourceMapConsumer.sources.forEach(function(sourceFile){var content=aSourceMapConsumer.sourceContentFor(sourceFile);if(content!=null){if(aSourceMapPath!=null){sourceFile=util.join(aSourceMapPath,sourceFile)}if(sourceRoot!=null){sourceFile=util.relative(sourceRoot,sourceFile)}this.setSourceContent(sourceFile,content)}},this)};SourceMapGenerator.prototype._validateMapping=function SourceMapGenerator_validateMapping(aGenerated,aOriginal,aSource,aName){if(aGenerated&&"line"in aGenerated&&"column"in aGenerated&&aGenerated.line>0&&aGenerated.column>=0&&!aOriginal&&!aSource&&!aName){return}else if(aGenerated&&"line"in aGenerated&&"column"in aGenerated&&aOriginal&&"line"in aOriginal&&"column"in aOriginal&&aGenerated.line>0&&aGenerated.column>=0&&aOriginal.line>0&&aOriginal.column>=0&&aSource){return}else{throw new Error("Invalid mapping: "+JSON.stringify({generated:aGenerated,source:aSource,original:aOriginal,name:aName}))}};SourceMapGenerator.prototype._serializeMappings=function SourceMapGenerator_serializeMappings(){var previousGeneratedColumn=0;var previousGeneratedLine=1;var previousOriginalColumn=0;var previousOriginalLine=0;var previousName=0;var previousSource=0;var result="";var mapping;var mappings=this._mappings.toArray();for(var i=0,len=mappings.length;i<len;i++){mapping=mappings[i];if(mapping.generatedLine!==previousGeneratedLine){previousGeneratedColumn=0;while(mapping.generatedLine!==previousGeneratedLine){result+=";";previousGeneratedLine++}}else{if(i>0){if(!util.compareByGeneratedPositions(mapping,mappings[i-1])){continue}result+=","}}result+=base64VLQ.encode(mapping.generatedColumn-previousGeneratedColumn);previousGeneratedColumn=mapping.generatedColumn;if(mapping.source!=null){result+=base64VLQ.encode(this._sources.indexOf(mapping.source)-previousSource);previousSource=this._sources.indexOf(mapping.source);result+=base64VLQ.encode(mapping.originalLine-1-previousOriginalLine);previousOriginalLine=mapping.originalLine-1;result+=base64VLQ.encode(mapping.originalColumn-previousOriginalColumn);previousOriginalColumn=mapping.originalColumn;if(mapping.name!=null){result+=base64VLQ.encode(this._names.indexOf(mapping.name)-previousName);previousName=this._names.indexOf(mapping.name)}}}return result};SourceMapGenerator.prototype._generateSourcesContent=function SourceMapGenerator_generateSourcesContent(aSources,aSourceRoot){return aSources.map(function(source){if(!this._sourcesContents){return null}if(aSourceRoot!=null){source=util.relative(aSourceRoot,source)}var key=util.toSetString(source);return Object.prototype.hasOwnProperty.call(this._sourcesContents,key)?this._sourcesContents[key]:null},this)};SourceMapGenerator.prototype.toJSON=function SourceMapGenerator_toJSON(){var map={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};if(this._file!=null){map.file=this._file}if(this._sourceRoot!=null){map.sourceRoot=this._sourceRoot}if(this._sourcesContents){map.sourcesContent=this._generateSourcesContent(map.sources,map.sourceRoot)}return map};SourceMapGenerator.prototype.toString=function SourceMapGenerator_toString(){return JSON.stringify(this)};exports.SourceMapGenerator=SourceMapGenerator})},{"./array-set":182,"./base64-vlq":183,"./mapping-list":186,"./util":190,amdefine:191}],189:[function(require,module,exports){if(typeof define!=="function"){var define=require("amdefine")(module,require)}define(function(require,exports,module){var SourceMapGenerator=require("./source-map-generator").SourceMapGenerator;var util=require("./util");var REGEX_NEWLINE=/(\r?\n)/;var NEWLINE_CODE=10;var isSourceNode="$$$isSourceNode$$$";function SourceNode(aLine,aColumn,aSource,aChunks,aName){this.children=[];this.sourceContents={};this.line=aLine==null?null:aLine;this.column=aColumn==null?null:aColumn;this.source=aSource==null?null:aSource;this.name=aName==null?null:aName;this[isSourceNode]=true;if(aChunks!=null)this.add(aChunks)}SourceNode.fromStringWithSourceMap=function SourceNode_fromStringWithSourceMap(aGeneratedCode,aSourceMapConsumer,aRelativePath){var node=new SourceNode;var remainingLines=aGeneratedCode.split(REGEX_NEWLINE);var shiftNextLine=function(){var lineContents=remainingLines.shift();var newLine=remainingLines.shift()||"";return lineContents+newLine};var lastGeneratedLine=1,lastGeneratedColumn=0;var lastMapping=null;aSourceMapConsumer.eachMapping(function(mapping){if(lastMapping!==null){if(lastGeneratedLine<mapping.generatedLine){var code="";addMappingWithCode(lastMapping,shiftNextLine());lastGeneratedLine++;lastGeneratedColumn=0}else{var nextLine=remainingLines[0];var code=nextLine.substr(0,mapping.generatedColumn-lastGeneratedColumn);remainingLines[0]=nextLine.substr(mapping.generatedColumn-lastGeneratedColumn);lastGeneratedColumn=mapping.generatedColumn;addMappingWithCode(lastMapping,code);lastMapping=mapping;return}}while(lastGeneratedLine<mapping.generatedLine){node.add(shiftNextLine());lastGeneratedLine++}if(lastGeneratedColumn<mapping.generatedColumn){var nextLine=remainingLines[0];node.add(nextLine.substr(0,mapping.generatedColumn));remainingLines[0]=nextLine.substr(mapping.generatedColumn);lastGeneratedColumn=mapping.generatedColumn}lastMapping=mapping},this);if(remainingLines.length>0){if(lastMapping){addMappingWithCode(lastMapping,shiftNextLine())}node.add(remainingLines.join(""))}aSourceMapConsumer.sources.forEach(function(sourceFile){var content=aSourceMapConsumer.sourceContentFor(sourceFile);if(content!=null){if(aRelativePath!=null){sourceFile=util.join(aRelativePath,sourceFile)}node.setSourceContent(sourceFile,content)}});return node;function addMappingWithCode(mapping,code){if(mapping===null||mapping.source===undefined){node.add(code)}else{var source=aRelativePath?util.join(aRelativePath,mapping.source):mapping.source;node.add(new SourceNode(mapping.originalLine,mapping.originalColumn,source,code,mapping.name))}}};SourceNode.prototype.add=function SourceNode_add(aChunk){if(Array.isArray(aChunk)){aChunk.forEach(function(chunk){this.add(chunk)},this)}else if(aChunk[isSourceNode]||typeof aChunk==="string"){if(aChunk){this.children.push(aChunk)}}else{throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+aChunk)}return this};SourceNode.prototype.prepend=function SourceNode_prepend(aChunk){if(Array.isArray(aChunk)){for(var i=aChunk.length-1;i>=0;i--){this.prepend(aChunk[i])}}else if(aChunk[isSourceNode]||typeof aChunk==="string"){this.children.unshift(aChunk)}else{throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+aChunk)}return this};SourceNode.prototype.walk=function SourceNode_walk(aFn){var chunk;for(var i=0,len=this.children.length;i<len;i++){chunk=this.children[i];if(chunk[isSourceNode]){chunk.walk(aFn)}else{if(chunk!==""){aFn(chunk,{source:this.source,line:this.line,column:this.column,name:this.name})}}}};SourceNode.prototype.join=function SourceNode_join(aSep){var newChildren;var i;var len=this.children.length;if(len>0){newChildren=[];for(i=0;i<len-1;i++){newChildren.push(this.children[i]);newChildren.push(aSep)}newChildren.push(this.children[i]);this.children=newChildren}return this};SourceNode.prototype.replaceRight=function SourceNode_replaceRight(aPattern,aReplacement){var lastChild=this.children[this.children.length-1];if(lastChild[isSourceNode]){lastChild.replaceRight(aPattern,aReplacement)}else if(typeof lastChild==="string"){this.children[this.children.length-1]=lastChild.replace(aPattern,aReplacement)}else{this.children.push("".replace(aPattern,aReplacement))}return this};SourceNode.prototype.setSourceContent=function SourceNode_setSourceContent(aSourceFile,aSourceContent){this.sourceContents[util.toSetString(aSourceFile)]=aSourceContent};SourceNode.prototype.walkSourceContents=function SourceNode_walkSourceContents(aFn){for(var i=0,len=this.children.length;i<len;i++){if(this.children[i][isSourceNode]){this.children[i].walkSourceContents(aFn)}}var sources=Object.keys(this.sourceContents);for(var i=0,len=sources.length;i<len;i++){aFn(util.fromSetString(sources[i]),this.sourceContents[sources[i]])}};SourceNode.prototype.toString=function SourceNode_toString(){var str="";this.walk(function(chunk){str+=chunk});return str};SourceNode.prototype.toStringWithSourceMap=function SourceNode_toStringWithSourceMap(aArgs){var generated={code:"",line:1,column:0};var map=new SourceMapGenerator(aArgs);var sourceMappingActive=false;var lastOriginalSource=null;var lastOriginalLine=null;var lastOriginalColumn=null;var lastOriginalName=null;this.walk(function(chunk,original){generated.code+=chunk;if(original.source!==null&&original.line!==null&&original.column!==null){if(lastOriginalSource!==original.source||lastOriginalLine!==original.line||lastOriginalColumn!==original.column||lastOriginalName!==original.name){map.addMapping({source:original.source,original:{line:original.line,column:original.column},generated:{line:generated.line,column:generated.column},name:original.name})}lastOriginalSource=original.source;lastOriginalLine=original.line;lastOriginalColumn=original.column;lastOriginalName=original.name;sourceMappingActive=true}else if(sourceMappingActive){map.addMapping({generated:{line:generated.line,column:generated.column}});lastOriginalSource=null;sourceMappingActive=false}for(var idx=0,length=chunk.length;idx<length;idx++){if(chunk.charCodeAt(idx)===NEWLINE_CODE){generated.line++;generated.column=0;if(idx+1===length){lastOriginalSource=null;sourceMappingActive=false}else if(sourceMappingActive){map.addMapping({source:original.source,original:{line:original.line,column:original.column},generated:{line:generated.line,column:generated.column},name:original.name})}}else{generated.column++}}});this.walkSourceContents(function(sourceFile,sourceContent){map.setSourceContent(sourceFile,sourceContent)});return{code:generated.code,map:map}};exports.SourceNode=SourceNode})},{"./source-map-generator":188,"./util":190,amdefine:191}],190:[function(require,module,exports){if(typeof define!=="function"){var define=require("amdefine")(module,require)}define(function(require,exports,module){function getArg(aArgs,aName,aDefaultValue){if(aName in aArgs){return aArgs[aName]}else if(arguments.length===3){return aDefaultValue}else{throw new Error('"'+aName+'" is a required argument.')}}exports.getArg=getArg;var urlRegexp=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.]*)(?::(\d+))?(\S*)$/;var dataUrlRegexp=/^data:.+\,.+$/;function urlParse(aUrl){var match=aUrl.match(urlRegexp);if(!match){return null}return{scheme:match[1],auth:match[2],host:match[3],port:match[4],path:match[5]}}exports.urlParse=urlParse;function urlGenerate(aParsedUrl){var url="";if(aParsedUrl.scheme){url+=aParsedUrl.scheme+":"}url+="//";if(aParsedUrl.auth){url+=aParsedUrl.auth+"@"}if(aParsedUrl.host){url+=aParsedUrl.host}if(aParsedUrl.port){url+=":"+aParsedUrl.port}if(aParsedUrl.path){url+=aParsedUrl.path}return url}exports.urlGenerate=urlGenerate;function normalize(aPath){var path=aPath;var url=urlParse(aPath);if(url){if(!url.path){return aPath}path=url.path}var isAbsolute=path.charAt(0)==="/";var parts=path.split(/\/+/);for(var part,up=0,i=parts.length-1;i>=0;i--){part=parts[i];if(part==="."){parts.splice(i,1)}else if(part===".."){up++}else if(up>0){if(part===""){parts.splice(i+1,up);up=0}else{parts.splice(i,2);up--}}}path=parts.join("/");if(path===""){path=isAbsolute?"/":"."}if(url){url.path=path;return urlGenerate(url)}return path}exports.normalize=normalize;function join(aRoot,aPath){if(aRoot===""){aRoot="."}if(aPath===""){aPath="."}var aPathUrl=urlParse(aPath);var aRootUrl=urlParse(aRoot);if(aRootUrl){aRoot=aRootUrl.path||"/"}if(aPathUrl&&!aPathUrl.scheme){if(aRootUrl){aPathUrl.scheme=aRootUrl.scheme}return urlGenerate(aPathUrl)}if(aPathUrl||aPath.match(dataUrlRegexp)){return aPath}if(aRootUrl&&!aRootUrl.host&&!aRootUrl.path){aRootUrl.host=aPath;return urlGenerate(aRootUrl)}var joined=aPath.charAt(0)==="/"?aPath:normalize(aRoot.replace(/\/+$/,"")+"/"+aPath);if(aRootUrl){aRootUrl.path=joined;return urlGenerate(aRootUrl)}return joined}exports.join=join;function relative(aRoot,aPath){if(aRoot===""){aRoot="."}aRoot=aRoot.replace(/\/$/,"");var url=urlParse(aRoot);if(aPath.charAt(0)=="/"&&url&&url.path=="/"){return aPath.slice(1)}return aPath.indexOf(aRoot+"/")===0?aPath.substr(aRoot.length+1):aPath}exports.relative=relative;function toSetString(aStr){return"$"+aStr}exports.toSetString=toSetString;function fromSetString(aStr){return aStr.substr(1)}exports.fromSetString=fromSetString;function strcmp(aStr1,aStr2){var s1=aStr1||"";var s2=aStr2||"";return(s1>s2)-(s1<s2)}function compareByOriginalPositions(mappingA,mappingB,onlyCompareOriginal){var cmp;cmp=strcmp(mappingA.source,mappingB.source);if(cmp){return cmp}cmp=mappingA.originalLine-mappingB.originalLine;if(cmp){return cmp}cmp=mappingA.originalColumn-mappingB.originalColumn;if(cmp||onlyCompareOriginal){return cmp}cmp=strcmp(mappingA.name,mappingB.name);if(cmp){return cmp}cmp=mappingA.generatedLine-mappingB.generatedLine;if(cmp){return cmp}return mappingA.generatedColumn-mappingB.generatedColumn}exports.compareByOriginalPositions=compareByOriginalPositions;function compareByGeneratedPositions(mappingA,mappingB,onlyCompareGenerated){var cmp;cmp=mappingA.generatedLine-mappingB.generatedLine;if(cmp){return cmp}cmp=mappingA.generatedColumn-mappingB.generatedColumn;if(cmp||onlyCompareGenerated){return cmp}cmp=strcmp(mappingA.source,mappingB.source);if(cmp){return cmp}cmp=mappingA.originalLine-mappingB.originalLine;if(cmp){return cmp}cmp=mappingA.originalColumn-mappingB.originalColumn;if(cmp){return cmp}return strcmp(mappingA.name,mappingB.name)}exports.compareByGeneratedPositions=compareByGeneratedPositions})},{amdefine:191}],191:[function(require,module,exports){(function(process,__filename){"use strict";function amdefine(module,requireFn){"use strict";var defineCache={},loaderCache={},alreadyCalled=false,path=require("path"),makeRequire,stringRequire;function trimDots(ary){var i,part;for(i=0;ary[i];i+=1){part=ary[i];if(part==="."){ary.splice(i,1);i-=1}else if(part===".."){if(i===1&&(ary[2]===".."||ary[0]==="..")){break}else if(i>0){ary.splice(i-1,2);i-=2}}}}function normalize(name,baseName){var baseParts;if(name&&name.charAt(0)==="."){if(baseName){baseParts=baseName.split("/");baseParts=baseParts.slice(0,baseParts.length-1);baseParts=baseParts.concat(name.split("/"));trimDots(baseParts);name=baseParts.join("/")}}return name}function makeNormalize(relName){return function(name){return normalize(name,relName)}}function makeLoad(id){function load(value){loaderCache[id]=value}load.fromText=function(id,text){throw new Error("amdefine does not implement load.fromText")};return load}makeRequire=function(systemRequire,exports,module,relId){function amdRequire(deps,callback){if(typeof deps==="string"){return stringRequire(systemRequire,exports,module,deps,relId)}else{deps=deps.map(function(depName){return stringRequire(systemRequire,exports,module,depName,relId)});process.nextTick(function(){callback.apply(null,deps)})}}amdRequire.toUrl=function(filePath){if(filePath.indexOf(".")===0){return normalize(filePath,path.dirname(module.filename))}else{return filePath}};return amdRequire};requireFn=requireFn||function req(){return module.require.apply(module,arguments)};function runFactory(id,deps,factory){var r,e,m,result;if(id){e=loaderCache[id]={};m={id:id,uri:__filename,exports:e};r=makeRequire(requireFn,e,m,id)}else{if(alreadyCalled){throw new Error("amdefine with no module ID cannot be called more than once per file.")}alreadyCalled=true;e=module.exports;m=module;r=makeRequire(requireFn,e,m,module.id)}if(deps){deps=deps.map(function(depName){return r(depName)})}if(typeof factory==="function"){result=factory.apply(m.exports,deps)}else{result=factory}if(result!==undefined){m.exports=result;if(id){loaderCache[id]=m.exports}}}stringRequire=function(systemRequire,exports,module,id,relId){var index=id.indexOf("!"),originalId=id,prefix,plugin;if(index===-1){id=normalize(id,relId);if(id==="require"){return makeRequire(systemRequire,exports,module,relId)}else if(id==="exports"){return exports}else if(id==="module"){return module}else if(loaderCache.hasOwnProperty(id)){return loaderCache[id]}else if(defineCache[id]){runFactory.apply(null,defineCache[id]);return loaderCache[id]}else{if(systemRequire){return systemRequire(originalId)}else{throw new Error("No module with ID: "+id)}}}else{prefix=id.substring(0,index);id=id.substring(index+1,id.length);plugin=stringRequire(systemRequire,exports,module,prefix,relId);if(plugin.normalize){id=plugin.normalize(id,makeNormalize(relId))}else{id=normalize(id,relId)}if(loaderCache[id]){return loaderCache[id]}else{plugin.load(id,makeRequire(systemRequire,exports,module,relId),makeLoad(id),{});return loaderCache[id]}}};function define(id,deps,factory){if(Array.isArray(id)){factory=deps;deps=id;id=undefined}else if(typeof id!=="string"){factory=id;id=deps=undefined}if(deps&&!Array.isArray(deps)){factory=deps;deps=undefined}if(!deps){deps=["require","exports","module"]}if(id){defineCache[id]=[id,deps,factory]}else{runFactory(id,deps,factory)}}define.require=function(id){if(loaderCache[id]){return loaderCache[id]}if(defineCache[id]){runFactory.apply(null,defineCache[id]);return loaderCache[id]}};define.amd={};return define}module.exports=amdefine}).call(this,require("_process"),"/node_modules/source-map/node_modules/amdefine/amdefine.js")},{_process:130,path:129}],192:[function(require,module,exports){(function(process){"use strict";var argv=process.argv;module.exports=function(){if(argv.indexOf("--no-color")!==-1||argv.indexOf("--no-colors")!==-1||argv.indexOf("--color=false")!==-1){return false}if(argv.indexOf("--color")!==-1||argv.indexOf("--colors")!==-1||argv.indexOf("--color=true")!==-1||argv.indexOf("--color=always")!==-1){return true}if(process.stdout&&!process.stdout.isTTY){return false}if(process.platform==="win32"){return true}if("COLORTERM"in process.env){return true}if(process.env.TERM==="dumb"){return false}if(/^screen|^xterm|^vt100|color|ansi|cygwin|linux/i.test(process.env.TERM)){return true}return false}()}).call(this,require("_process"))},{_process:130}],193:[function(require,module,exports){module.exports={name:"6to5",description:"Turn ES6 code into readable vanilla ES5 with source maps",version:"3.0.0",author:"Sebastian McKenzie <sebmck@gmail.com>",homepage:"https://6to5.org/",repository:"6to5/6to5",preferGlobal:true,main:"lib/6to5/index.js",bin:{"6to5":"./bin/6to5/index.js","6to5-node":"./bin/6to5-node"},browser:{"./lib/6to5/index.js":"./lib/6to5/browser.js","./lib/6to5/register.js":"./lib/6to5/register-browser.js"},keywords:["harmony","classes","modules","let","const","var","es6","transpile","transpiler","6to5"],scripts:{bench:"make bench",test:"make test"},dependencies:{"acorn-6to5":"0.11.1-25","ast-types":"~0.6.1",chalk:"^0.5.1",chokidar:"0.12.6",commander:"2.6.0","core-js":"0.4.6","detect-indent":"^3.0.0",estraverse:"1.9.1",esutils:"1.1.6",esvalid:"1.1.0","fs-readdir-recursive":"0.1.0","js-tokenizer":"^1.3.3",lodash:"3.0.0","output-file-sync":"^1.1.0","private":"0.1.6","regenerator-6to5":"0.8.9-6",regexpu:"1.1.0",roadrunner:"1.0.4","source-map":"0.1.43","source-map-support":"0.2.9","supports-color":"^1.2.0"},devDependencies:{browserify:"8.1.1",chai:"1.10.0",istanbul:"0.3.5",jscs:"^1.10.0",jshint:"2.6.0","jshint-stylish":"1.0.0",matcha:"0.6.0",mocha:"2.1.0",rimraf:"2.2.8","uglify-js":"2.4.16"},optionalDependencies:{kexec:"1.1.1"}}},{}],194:[function(require,module,exports){module.exports={"abstract-expression-call":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"PROPERTY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Symbol",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"referenceGet",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:true,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"OBJECT",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"call",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"OBJECT",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"abstract-expression-delete":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"PROPERTY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Symbol",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"referenceDelete",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:true,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"OBJECT",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"abstract-expression-get":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"PROPERTY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Symbol",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"referenceGet",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:true,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"OBJECT",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"abstract-expression-set":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"PROPERTY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Symbol",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"referenceSet",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:true,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"OBJECT",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"VALUE",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"apply-constructor":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:false,expression:false,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Constructor",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"args",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"instance",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Object",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"create",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Constructor",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"prototype",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"result",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Constructor",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"apply",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"instance",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"args",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"ConditionalExpression",start:null,end:null,loc:null,range:null,test:{type:"LogicalExpression",start:null,end:null,loc:null,range:null,left:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"result",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"!=",right:{type:"Literal",start:null,end:null,loc:null,range:null,value:null,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"&&",right:{type:"LogicalExpression",start:null,end:null,loc:null,range:null,left:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"UnaryExpression",start:null,end:null,loc:null,range:null,operator:"typeof",prefix:true,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"result",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"==",right:{type:"Literal",start:null,end:null,loc:null,range:null,value:"object",raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"||",right:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"UnaryExpression",start:null,end:null,loc:null,range:null,operator:"typeof",prefix:true,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"result",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"==",right:{type:"Literal",start:null,end:null,loc:null,range:null,value:"function",raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"result",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},alternate:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"instance",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"array-comprehension-container":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:false,expression:false,params:[],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"KEY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"ArrayExpression",start:null,end:null,loc:null,range:null,elements:[],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"KEY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},arguments:[],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"array-from":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Array",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"from",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"VALUE",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"array-push":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"KEY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"push",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"STATEMENT",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"async-to-generator":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:false,expression:false,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"fn",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:false,expression:false,params:[],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"gen",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"fn",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"apply",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"ThisExpression",start:null,end:null,loc:null,range:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arguments",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"NewExpression",start:null,end:null,loc:null,range:null,callee:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Promise",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:false,expression:false,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"resolve",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"reject",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"callNext",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"step",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"bind",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"gen",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"next",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"callThrow",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"step",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"bind",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"gen",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"throw",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"FunctionDeclaration",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"step",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},generator:false,expression:false,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arg",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"TryStatement",start:null,end:null,loc:null,range:null,block:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"info",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"ThisExpression",start:null,end:null,loc:null,range:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arg",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"value",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"info",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"value",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},handler:{type:"CatchClause",start:null,end:null,loc:null,range:null,param:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"error",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},guard:null,body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"reject",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"error",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},guardedHandlers:[],finalizer:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"info",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"done",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"resolve",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"value",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},alternate:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Promise",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"resolve",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"value",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"then",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"callNext",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"callThrow",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"callNext",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},bind:{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Function",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"prototype",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"bind",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},call:{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"OBJECT",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"call",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"CONTEXT",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"class-super-constructor-call-loose":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"SUPER_NAME",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"!=",right:{type:"Literal",start:null,end:null,loc:null,range:null,value:null,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"SUPER_NAME",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"apply",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"ThisExpression",start:null,end:null,loc:null,range:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arguments",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},alternate:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"class-super-constructor-call":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Object",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"getPrototypeOf",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"CLASS_NAME",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"!==",right:{type:"Literal",start:null,end:null,loc:null,range:null,value:null,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Object",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"getPrototypeOf",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"CLASS_NAME",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"apply",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"ThisExpression",start:null,end:null,loc:null,range:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arguments",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},alternate:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"corejs-iterator":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"CORE_ID",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"$for",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"getIterator",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"VALUE",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"default-parameter":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"VARIABLE_NAME",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"ConditionalExpression",start:null,end:null,loc:null,range:null,test:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"ARGUMENTS",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"ARGUMENT_KEY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:true,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"===",right:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"undefined",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"DEFAULT_VALUE",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},alternate:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"ARGUMENTS",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"ARGUMENT_KEY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:true,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},defaults:{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:false,expression:false,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"defaults",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ForInStatement",start:null,end:null,loc:null,range:null,left:{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"key",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"defaults",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"key",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:true,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"===",right:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"undefined",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"key",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:true,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"defaults",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"key",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:true,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},alternate:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"define-property":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:false,expression:false,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"key",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"value",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Object",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"defineProperty",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"key",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"ObjectExpression",start:null,end:null,loc:null,range:null,properties:[{type:"Property",start:null,end:null,loc:null,range:null,method:false,shorthand:false,computed:false,key:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"value",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},value:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"value",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},kind:"init",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Property",start:null,end:null,loc:null,range:null,method:false,shorthand:false,computed:false,key:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"enumerable",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},value:{type:"Literal",start:null,end:null,loc:null,range:null,value:true,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},kind:"init",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Property",start:null,end:null,loc:null,range:null,method:false,shorthand:false,computed:false,key:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"configurable",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},value:{type:"Literal",start:null,end:null,loc:null,range:null,value:true,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},kind:"init",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Property",start:null,end:null,loc:null,range:null,method:false,shorthand:false,computed:false,key:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"writable",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},value:{type:"Literal",start:null,end:null,loc:null,range:null,value:true,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},kind:"init",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"exports-assign":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"exports",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"KEY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"VALUE",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"exports-default-assign":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"module",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"exports",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"VALUE",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"exports-module-declaration":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"exports",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"__esModule",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"Literal",start:null,end:null,loc:null,range:null,value:true,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"extends":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:false,expression:false,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"target",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ForStatement",start:null,end:null,loc:null,range:null,init:{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"i",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"Literal",start:null,end:null,loc:null,range:null,value:1,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},test:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"i",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"<",right:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arguments",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"length",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},update:{type:"UpdateExpression",start:null,end:null,loc:null,range:null,operator:"++",prefix:false,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"i",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"source",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arguments",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"i",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:true,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"ForInStatement",start:null,end:null,loc:null,range:null,left:{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"key",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"source",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Object",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"prototype",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"hasOwnProperty",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"call",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"source",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"key",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"target",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"key",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:true,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"source",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"key",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:true,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},alternate:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"target",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"for-of-loose":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ForStatement",start:null,end:null,loc:null,range:null,init:{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"LOOP_OBJECT",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"OBJECT",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"IS_ARRAY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Array",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"isArray",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"LOOP_OBJECT",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"INDEX",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"Literal",start:null,end:null,loc:null,range:null,value:0,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"LOOP_OBJECT",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"ConditionalExpression",start:null,end:null,loc:null,range:null,test:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"IS_ARRAY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"LOOP_OBJECT",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},alternate:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"LOOP_OBJECT",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Symbol",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"iterator",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:true,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},test:null,update:null,body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"IS_ARRAY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"INDEX",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:">=",right:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"LOOP_OBJECT",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"length",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BreakStatement",start:null,end:null,loc:null,range:null,label:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},alternate:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"ID",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"LOOP_OBJECT",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"UpdateExpression",start:null,end:null,loc:null,range:null,operator:"++",prefix:false,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"INDEX",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:true,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},alternate:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"INDEX",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"LOOP_OBJECT",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"next",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"INDEX",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"done",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BreakStatement",start:null,end:null,loc:null,range:null,label:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},alternate:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"ID",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"INDEX",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"value",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"for-of":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ForStatement",start:null,end:null,loc:null,range:null,init:{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"ITERATOR_KEY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"OBJECT",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Symbol",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"iterator",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:true,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"STEP_KEY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},test:{type:"UnaryExpression",start:null,end:null,loc:null,range:null,operator:"!",prefix:true,argument:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"STEP_KEY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"ITERATOR_KEY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"next",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"done",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},update:null,body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},get:{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"get",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},generator:false,expression:false,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"object",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"property",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"receiver",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"desc",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Object",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"getOwnPropertyDescriptor",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"object",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"property",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"desc",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"===",right:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"undefined",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"parent",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Object",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"getPrototypeOf",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"object",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"parent",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"===",right:{type:"Literal",start:null,end:null,loc:null,range:null,value:null,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"undefined",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},alternate:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"get",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"parent",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"property",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"receiver",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},alternate:{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"LogicalExpression",start:null,end:null,loc:null,range:null,left:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"Literal",start:null,end:null,loc:null,range:null,value:"value",raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},operator:"in",right:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"desc",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"&&",right:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"desc",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"writable",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"desc",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"value",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},alternate:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"getter",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"desc",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"get",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"getter",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"===",right:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"undefined",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"undefined",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},alternate:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"getter",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"call",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"receiver",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"has-own":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Object",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"prototype",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"hasOwnProperty",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},inherits:{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:false,expression:false,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"subClass",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"superClass",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"LogicalExpression",start:null,end:null,loc:null,range:null,left:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"UnaryExpression",start:null,end:null,loc:null,range:null,operator:"typeof",prefix:true,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"superClass",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"!==",right:{type:"Literal",start:null,end:null,loc:null,range:null,value:"function",raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"&&",right:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"superClass",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"!==",right:{type:"Literal",start:null,end:null,loc:null,range:null,value:null,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ThrowStatement",start:null,end:null,loc:null,range:null,argument:{type:"NewExpression",start:null,end:null,loc:null,range:null,callee:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"TypeError",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"Literal",start:null,end:null,loc:null,range:null,value:"Super expression must either be null or a function, not ",raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},operator:"+",right:{type:"UnaryExpression",start:null,end:null,loc:null,range:null,operator:"typeof",prefix:true,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"superClass",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},alternate:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"subClass",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"prototype",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Object",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"create",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"LogicalExpression",start:null,end:null,loc:null,range:null,left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"superClass",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"&&",right:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"superClass",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"prototype",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"ObjectExpression",start:null,end:null,loc:null,range:null,properties:[{type:"Property",start:null,end:null,loc:null,range:null,method:false,shorthand:false,computed:false,key:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"constructor",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},value:{type:"ObjectExpression",start:null,end:null,loc:null,range:null,properties:[{type:"Property",start:null,end:null,loc:null,range:null,method:false,shorthand:false,computed:false,key:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"value",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},value:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"subClass",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},kind:"init",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Property",start:null,end:null,loc:null,range:null,method:false,shorthand:false,computed:false,key:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"enumerable",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},value:{type:"Literal",start:null,end:null,loc:null,range:null,value:false,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},kind:"init",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Property",start:null,end:null,loc:null,range:null,method:false,shorthand:false,computed:false,key:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"writable",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},value:{type:"Literal",start:null,end:null,loc:null,range:null,value:true,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},kind:"init",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Property",start:null,end:null,loc:null,range:null,method:false,shorthand:false,computed:false,key:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"configurable",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},value:{type:"Literal",start:null,end:null,loc:null,range:null,value:true,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},kind:"init",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},kind:"init",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"superClass",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"subClass",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"__proto__",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"superClass",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},alternate:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"interop-require-wildcard":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:false,expression:false,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"ConditionalExpression",start:null,end:null,loc:null,range:null,test:{type:"LogicalExpression",start:null,end:null,loc:null,range:null,left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"&&",right:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"__esModule",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},alternate:{type:"ObjectExpression",start:null,end:null,loc:null,range:null,properties:[{type:"Property",start:null,end:null,loc:null,range:null,method:false,shorthand:false,computed:false,key:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"default",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},value:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},kind:"init",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"interop-require":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:false,expression:false,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"ConditionalExpression",start:null,end:null,loc:null,range:null,test:{type:"LogicalExpression",start:null,end:null,loc:null,range:null,left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"&&",right:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"__esModule",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"default",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},alternate:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"let-scoping-return":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"UnaryExpression",start:null,end:null,loc:null,range:null,operator:"typeof",prefix:true,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"RETURN",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"===",right:{type:"Literal",start:null,end:null,loc:null,range:null,value:"object",raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"RETURN",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"v",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},alternate:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"object-without-properties":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:false,expression:false,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"keys",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"target",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"ObjectExpression",start:null,end:null,loc:null,range:null,properties:[],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"ForInStatement",start:null,end:null,loc:null,range:null,left:{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"i",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"keys",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"indexOf",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"i",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:">=",right:{type:"Literal",start:null,end:null,loc:null,range:null,value:0,raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"ContinueStatement",start:null,end:null,loc:null,range:null,label:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},alternate:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"UnaryExpression",start:null,end:null,loc:null,range:null,operator:"!",prefix:true,argument:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Object",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"prototype",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"hasOwnProperty",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"call",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"i",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"ContinueStatement",start:null,end:null,loc:null,range:null,label:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},alternate:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"target",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"i",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:true,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"i",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:true,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"target",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"property-method-assignment-wrapper":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:false,expression:false,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"FUNCTION_KEY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"WRAPPER_KEY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"FUNCTION_ID",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},generator:false,expression:false,params:[],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"FUNCTION_KEY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"apply",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"ThisExpression",start:null,end:null,loc:null,range:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arguments",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"WRAPPER_KEY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"toString",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:false,expression:false,params:[],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"FUNCTION_KEY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"toString",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"WRAPPER_KEY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"FUNCTION",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"prototype-identifier":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"CLASS_NAME",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"prototype",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"prototype-properties":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:false,expression:false,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"child",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"staticProps",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"instanceProps",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"staticProps",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Object",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"defineProperties",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"child",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"staticProps",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},alternate:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"instanceProps",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Object",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"defineProperties",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"child",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"prototype",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"instanceProps",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},alternate:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"require-assign-key":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"VARIABLE_NAME",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"require",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"MODULE_NAME",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"KEY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},require:{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"require",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"MODULE_NAME",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},rest:{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ForStatement",start:null,end:null,loc:null,range:null,init:{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"LEN",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"ARGUMENTS",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"length",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"ARRAY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Array",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"ARRAY_LEN",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"KEY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"START",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},test:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"KEY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"<",right:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"LEN",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},update:{type:"UpdateExpression",start:null,end:null,loc:null,range:null,operator:"++",prefix:false,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"KEY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"ARRAY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"ARRAY_KEY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:true,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"ARGUMENTS",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"KEY",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:true,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"self-global":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"ConditionalExpression",start:null,end:null,loc:null,range:null,test:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"UnaryExpression",start:null,end:null,loc:null,range:null,operator:"typeof",prefix:true,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"global",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"===",right:{type:"Literal",start:null,end:null,loc:null,range:null,value:"undefined",raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"self",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},alternate:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"global",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},slice:{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Array",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"prototype",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"slice",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"sliced-to-array":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:false,expression:false,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arr",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"i",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Array",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"isArray",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arr",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arr",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},alternate:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"_arr",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"ArrayExpression",start:null,end:null,loc:null,range:null,elements:[],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"ForStatement",start:null,end:null,loc:null,range:null,init:{type:"VariableDeclaration",start:null,end:null,loc:null,range:null,declarations:[{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"_iterator",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arr",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Symbol",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"iterator",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:true,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"VariableDeclarator",start:null,end:null,loc:null,range:null,id:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"_step",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},init:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],kind:"var",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},test:{type:"UnaryExpression",start:null,end:null,loc:null,range:null,operator:"!",prefix:true,argument:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"_step",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"_iterator",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"next",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"done",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},update:null,body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"_arr",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"push",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"_step",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"value",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"LogicalExpression",start:null,end:null,loc:null,range:null,left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"i",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"&&",right:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"_arr",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"length",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"===",right:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"i",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BreakStatement",start:null,end:null,loc:null,range:null,label:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},alternate:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"_arr",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},system:{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"System",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"register",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"MODULE_NAME",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"MODULE_DEPENDENCIES",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:false,expression:false,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"EXPORT_IDENTIFIER",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"ObjectExpression",start:null,end:null,loc:null,range:null,properties:[{type:"Property",start:null,end:null,loc:null,range:null,method:false,shorthand:false,computed:false,key:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"setters",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},value:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"SETTERS",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},kind:"init",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Property",start:null,end:null,loc:null,range:null,method:false,shorthand:false,computed:false,key:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"execute",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},value:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"EXECUTE",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},kind:"init",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"tagged-template-literal-loose":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:false,expression:false,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"strings",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"raw",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"AssignmentExpression",start:null,end:null,loc:null,range:null,operator:"=",left:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"strings",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"raw",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},right:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"raw",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"strings",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"tagged-template-literal":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:false,expression:false,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"strings",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"raw",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Object",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"freeze",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Object",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"defineProperties",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"strings",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"ObjectExpression",start:null,end:null,loc:null,range:null,properties:[{type:"Property",start:null,end:null,loc:null,range:null,method:false,shorthand:false,computed:false,key:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"raw",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},value:{type:"ObjectExpression",start:null,end:null,loc:null,range:null,properties:[{type:"Property",start:null,end:null,loc:null,range:null,method:false,shorthand:false,computed:false,key:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"value",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},value:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Object",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"freeze",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"raw",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},kind:"init",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},kind:"init",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"test-exports":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"UnaryExpression",start:null,end:null,loc:null,range:null,operator:"typeof",prefix:true,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"exports",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"!==",right:{type:"Literal",start:null,end:null,loc:null,range:null,value:"undefined",raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"test-module":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"UnaryExpression",start:null,end:null,loc:null,range:null,operator:"typeof",prefix:true,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"module",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"!==",right:{type:"Literal",start:null,end:null,loc:null,range:null,value:"undefined",raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"to-array":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:false,expression:false,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arr",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"ConditionalExpression",start:null,end:null,loc:null,range:null,test:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Array",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"isArray",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arr",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arr",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},alternate:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Array",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"from",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"arr",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"typeof":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:false,expression:false,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ReturnStatement",start:null,end:null,loc:null,range:null,argument:{type:"ConditionalExpression",start:null,end:null,loc:null,range:null,test:{type:"LogicalExpression",start:null,end:null,loc:null,range:null,left:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"&&",right:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"constructor",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"===",right:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"Symbol",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"Literal",start:null,end:null,loc:null,range:null,value:"symbol",raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},alternate:{type:"UnaryExpression",start:null,end:null,loc:null,range:null,operator:"typeof",prefix:true,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"obj",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},"umd-runner-body":{type:"Program",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"FunctionExpression",start:null,end:null,loc:null,range:null,id:null,generator:false,expression:false,params:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"factory",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],body:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"LogicalExpression",start:null,end:null,loc:null,range:null,left:{type:"BinaryExpression",start:null,end:null,loc:null,range:null,left:{type:"UnaryExpression",start:null,end:null,loc:null,range:null,operator:"typeof",prefix:true,argument:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"define",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"===",right:{type:"Literal",start:null,end:null,loc:null,range:null,value:"function",raw:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},operator:"&&",right:{type:"MemberExpression",start:null,end:null,loc:null,range:null,object:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"define",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},property:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"amd",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},computed:false,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"define",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"AMD_ARGUMENTS",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},{type:"Identifier",start:null,end:null,loc:null,range:null,name:"factory",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},alternate:{type:"IfStatement",start:null,end:null,loc:null,range:null,test:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"COMMON_TEST",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},consequent:{type:"BlockStatement",start:null,end:null,loc:null,range:null,body:[{type:"ExpressionStatement",start:null,end:null,loc:null,range:null,expression:{type:"CallExpression",start:null,end:null,loc:null,range:null,callee:{type:"Identifier",start:null,end:null,loc:null,range:null,name:"factory",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},arguments:[{type:"Identifier",start:null,end:null,loc:null,range:null,name:"COMMON_ARGUMENTS",_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},alternate:null,_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_scopeInfo:null,_declarations:null,extendedRange:null,tokens:null,raw:null},_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}],_declarations:null,extendedRange:null,_scopeInfo:null,tokens:null,raw:null}}
},{}]},{},[1])(1)}); |
internals/templates/languageProvider/languageProvider.js | pashakbit/react-gallery | /*
*
* LanguageProvider
*
* this component connects the redux state language locale to the
* IntlProvider component and i18n messages (loaded from `app/translations`)
*/
import React from 'react';
import { connect } from 'react-redux';
import { createSelector } from 'reselect';
import { IntlProvider } from 'react-intl';
import { selectLocale } from './selectors';
export class LanguageProvider extends React.Component { // eslint-disable-line react/prefer-stateless-function
render() {
return (
<IntlProvider locale={this.props.locale} key={this.props.locale} messages={this.props.messages[this.props.locale]}>
{React.Children.only(this.props.children)}
</IntlProvider>
);
}
}
LanguageProvider.propTypes = {
locale: React.PropTypes.string,
messages: React.PropTypes.object,
children: React.PropTypes.element.isRequired,
};
const mapStateToProps = createSelector(
selectLocale(),
(locale) => ({ locale })
);
function mapDispatchToProps(dispatch) {
return {
dispatch,
};
}
export default connect(mapStateToProps, mapDispatchToProps)(LanguageProvider);
|
ajax/libs/6to5/1.14.9/browser.js | codevinsky/cdnjs | !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.to5=e()}}(function(){var define,module,exports;return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){(function(global){var transform=module.exports=require("./transformation/transform");transform.transform=transform;transform.run=function(code,opts){opts=opts||{};opts.sourceMap="inline";return new Function(transform(code,opts).code)()};transform.load=function(url,callback,opts,hold){opts=opts||{};opts.filename=opts.filename||url;var xhr=global.ActiveXObject?new global.ActiveXObject("Microsoft.XMLHTTP"):new global.XMLHttpRequest;xhr.open("GET",url,true);if("overrideMimeType"in xhr)xhr.overrideMimeType("text/plain");xhr.onreadystatechange=function(){if(xhr.readyState!==4)return;var status=xhr.status;if(status===0||status===200){var param=[xhr.responseText,opts];if(!hold)transform.run.apply(transform,param);if(callback)callback(param)}else{throw new Error("Could not load "+url)}};xhr.send(null)};var runScripts=function(){var scripts=[];var types=["text/ecmascript-6","text/6to5"];var index=0;var exec=function(){var param=scripts[index];if(param instanceof Array){transform.run.apply(transform,param);index++;exec()}};var run=function(script,i){var opts={};if(script.src){transform.load(script.src,function(param){scripts[i]=param;exec()},opts,true)}else{opts.filename="embedded";scripts[i]=[script.innerHTML,opts]}};var _scripts=global.document.getElementsByTagName("script");for(var i in _scripts){var _script=_scripts[i];if(types.indexOf(_script.type)>=0)scripts.push(_script)}for(i in scripts){run(scripts[i],i)}exec()};if(global.addEventListener){global.addEventListener("DOMContentLoaded",runScripts,false)}else if(global.attachEvent){global.attachEvent("onload",runScripts)}}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./transformation/transform":29}],2:[function(require,module,exports){module.exports=File;var SHEBANG_REGEX=/^\#\!.*/;var transform=require("./transformation/transform");var generate=require("./generation/generator");var Scope=require("./traverse/scope");var util=require("./util");var t=require("./types");var _=require("lodash");function File(opts){this.opts=File.normaliseOptions(opts);this.uids={};this.ast={}}File.declarations=["extends","class-props","apply-constructor","tagged-template-literal","interop-require","to-array","object-spread","has-own","slice"];File.normaliseOptions=function(opts){opts=_.cloneDeep(opts||{});_.defaults(opts,{experimental:false,playground:false,whitespace:true,blacklist:[],whitelist:[],sourceMap:false,comments:true,filename:"unknown",modules:"common",runtime:false,code:true});opts.filename=opts.filename.replace(/\\/g,"/");opts.blacklist=util.arrayify(opts.blacklist);opts.whitelist=util.arrayify(opts.whitelist);_.defaults(opts,{moduleRoot:opts.sourceRoot});_.defaults(opts,{sourceRoot:opts.moduleRoot});_.defaults(opts,{filenameRelative:opts.filename});_.defaults(opts,{sourceFileName:opts.filenameRelative,sourceMapName:opts.filenameRelative});if(opts.runtime===true){opts.runtime="to5Runtime"}if(opts.playground){opts.experimental=true}transform._ensureTransformerNames("blacklist",opts.blacklist);transform._ensureTransformerNames("whitelist",opts.whitelist);return opts};File.prototype.toArray=function(node){if(t.isArrayExpression(node)){return node}else if(t.isIdentifier(node)&&node.name==="arguments"){return t.callExpression(t.memberExpression(this.addDeclaration("slice"),t.identifier("call")),[node])}else{return t.callExpression(this.addDeclaration("to-array"),[node])}};File.prototype.getModuleFormatter=function(type){var ModuleFormatter=_.isFunction(type)?type:transform.moduleFormatters[type];if(!ModuleFormatter){var loc=util.resolve(type);if(loc)ModuleFormatter=require(loc)}if(!ModuleFormatter){throw new ReferenceError("unknown module formatter type "+type)}return new ModuleFormatter(this)};File.prototype.parseShebang=function(code){var shebangMatch=code.match(SHEBANG_REGEX);if(shebangMatch){this.shebang=shebangMatch[0];code=code.replace(SHEBANG_REGEX,"")}return code};File.prototype.addDeclaration=function(name){if(!_.contains(File.declarations,name)){throw new ReferenceError("unknown declaration "+name)}var program=this.ast.program;var declar=program._declarations&&program._declarations[name];if(declar)return declar.id;var ref;var runtimeNamespace=this.opts.runtime;if(runtimeNamespace){name=t.identifier(t.toIdentifier(name));return t.memberExpression(t.identifier(runtimeNamespace),name)}else{ref=util.template(name)}var uid=this.generateUidIdentifier(name);this.scope.push({key:name,id:uid,init:ref});return uid};File.prototype.errorWithNode=function(node,msg,Error){Error=Error||SyntaxError;var loc=node.loc.start;var err=new Error("Line "+loc.line+": "+msg);err.loc=loc;return err};File.prototype.parse=function(code){code=(code||"")+"";var self=this;this.code=code;code=this.parseShebang(code);return util.parse(this.opts,code,function(tree){self.transform(tree);return self.generate()})};File.prototype.transform=function(ast){this.ast=ast;this.scope=new Scope(ast.program);this.moduleFormatter=this.getModuleFormatter(this.opts.modules);var self=this;_.each(transform.transformers,function(transformer){transformer.transform(self)})};File.prototype.generate=function(){var opts=this.opts;var ast=this.ast;if(!opts.code){return{code:"",map:null,ast:ast}}var result=generate(ast,opts,this.code);if(this.shebang){result.code=this.shebang+"\n"+result.code}if(opts.sourceMap==="inline"){result.code+="\n"+util.sourceMapToComment(result.map)}result.ast=result;return result};File.prototype.generateUid=function(name,scope){name=t.toIdentifier(name);scope=scope||this.scope;var uid;do{uid=this._generateUid(name)}while(scope.has(uid));return uid};File.prototype.generateUidIdentifier=function(name,scope){return t.identifier(this.generateUid(name,scope))};File.prototype._generateUid=function(name){var uids=this.uids;var i=uids[name]||1;var id=name;if(i>1)id+=i;uids[name]=i+1;return"_"+id}},{"./generation/generator":4,"./transformation/transform":29,"./traverse/scope":71,"./types":74,"./util":76,lodash:108}],3:[function(require,module,exports){module.exports=Buffer;var util=require("../util");var _=require("lodash");function Buffer(position,format){this.position=position;this._indent=format.indent.base;this.format=format;this.buf=""}Buffer.prototype.get=function(){return util.trimRight(this.buf)};Buffer.prototype.getIndent=function(){if(this.format.compact){return""}else{return util.repeat(this._indent,this.format.indent.style)}};Buffer.prototype.indentSize=function(){return this.getIndent().length};Buffer.prototype.indent=function(){this._indent++};Buffer.prototype.dedent=function(){this._indent--};Buffer.prototype.semicolon=function(){if(this.format.semicolons)this.push(";")};Buffer.prototype.ensureSemicolon=function(){if(!this.isLast(";"))this.semicolon()};Buffer.prototype.rightBrace=function(){this.newline(true);this.push("}")};Buffer.prototype.keyword=function(name){this.push(name);this.push(" ")};Buffer.prototype.space=function(){if(this.buf&&!this.isLast([" ","\n"])){this.push(" ")}};Buffer.prototype.removeLast=function(cha){if(!this.isLast(cha))return;this.buf=this.buf.slice(0,-1);this.position.unshift(cha)};Buffer.prototype.newline=function(i,removeLast){if(!this.buf)return;if(this.format.compact)return;if(this.endsWith("{\n"))return;if(_.isBoolean(i)){removeLast=i;i=null}if(_.isNumber(i)){if(this.endsWith(util.repeat(i,"\n")))return;var self=this;_.times(i,function(){self.newline(null,removeLast)});return}if(removeLast&&this.isLast("\n"))this.removeLast("\n");this.removeLast(" ");this.buf=this.buf.replace(/\n +$/,"\n");this._push("\n")};Buffer.prototype.push=function(str,noIndent){if(this._indent&&!noIndent&&str!=="\n"){var indent=this.getIndent();str=str.replace(/\n/g,"\n"+indent);if(this.isLast("\n"))str=indent+str}this._push(str)};Buffer.prototype._push=function(str){this.position.push(str);this.buf+=str};Buffer.prototype.endsWith=function(str){return this.buf.slice(-str.length)===str};Buffer.prototype.isLast=function(cha,trimRight){var buf=this.buf;if(trimRight)buf=util.trimRight(buf);var chars=[].concat(cha);return _.contains(chars,_.last(buf))}},{"../util":76,lodash:108}],4:[function(require,module,exports){module.exports=function(ast,opts,code){var gen=new CodeGenerator(ast,opts,code);return gen.generate()};module.exports.CodeGenerator=CodeGenerator;var Whitespace=require("./whitespace");var SourceMap=require("./source-map");var Position=require("./position");var Buffer=require("./buffer");var util=require("../util");var n=require("./node");var t=require("../types");var _=require("lodash");function CodeGenerator(ast,opts,code){opts=opts||{};this.comments=ast.comments||[];this.tokens=ast.tokens||[];this.format=CodeGenerator.normaliseOptions(opts);this.ast=ast;this.whitespace=new Whitespace(this.tokens,this.comments);this.position=new Position;this.map=new SourceMap(this.position,opts,code);this.buffer=new Buffer(this.position,this.format)}_.each(Buffer.prototype,function(fn,key){CodeGenerator.prototype[key]=function(){return fn.apply(this.buffer,arguments)}});CodeGenerator.normaliseOptions=function(opts){return _.merge({parentheses:true,semicolons:true,comments:opts.comments==null||opts.comments,compact:false,indent:{adjustMultilineComment:true,style:" ",base:0}},opts.format||{})};CodeGenerator.generators={templateLiterals:require("./generators/template-literals"),comprehensions:require("./generators/comprehensions"),expressions:require("./generators/expressions"),statements:require("./generators/statements"),playground:require("./generators/playground"),classes:require("./generators/classes"),methods:require("./generators/methods"),modules:require("./generators/modules"),types:require("./generators/types"),base:require("./generators/base"),jsx:require("./generators/jsx")};_.each(CodeGenerator.generators,function(generator){_.extend(CodeGenerator.prototype,generator)});CodeGenerator.prototype.generate=function(){var ast=this.ast;this.print(ast);return{map:this.map.get(),code:this.buffer.get()}};CodeGenerator.prototype.buildPrint=function(parent){var self=this;var print=function(node,opts){return self.print(node,parent,opts)};print.sequence=function(nodes,opts){opts=opts||{};opts.statement=true;return self.printJoin(print,nodes,opts)};print.join=function(nodes,opts){return self.printJoin(print,nodes,opts)};print.block=function(node){return self.printBlock(print,node)};print.indentOnComments=function(node){return self.printAndIndentOnComments(print,node)};return print};CodeGenerator.prototype.print=function(node,parent,opts){if(!node)return"";var self=this;opts=opts||{};var newline=function(leading){if(!opts.statement&&!n.isUserWhitespacable(node,parent)){return}var lines=0;if(node.start!=null){if(leading){lines=self.whitespace.getNewlinesBefore(node)}else{lines=self.whitespace.getNewlinesAfter(node)}}else{if(!leading)lines++;var needs=n.needsWhitespaceAfter;if(leading)needs=n.needsWhitespaceBefore;lines+=needs(node,parent)}self.newline(lines)};if(this[node.type]){this.printLeadingComments(node,parent);newline(true);if(opts.before)opts.before();this.map.mark(node,"start");var needsParens=parent!==node._parent&&n.needsParens(node,parent);if(needsParens)this.push("(");this[node.type](node,this.buildPrint(node),parent);if(needsParens)this.push(")");this.map.mark(node,"end");if(opts.after)opts.after();newline(false);this.printTrailingComments(node,parent)}else{throw new ReferenceError("unknown node "+node.type)}};CodeGenerator.prototype.printJoin=function(print,nodes,opts){if(!nodes||!nodes.length)return;opts=opts||{};var self=this;var len=nodes.length;if(opts.indent)self.indent();_.each(nodes,function(node,i){print(node,{statement:opts.statement,after:function(){if(opts.iterator){opts.iterator(node,i)}if(opts.separator&&i<len-1){self.push(opts.separator)}}})});if(opts.indent)self.dedent()};CodeGenerator.prototype.printAndIndentOnComments=function(print,node){var indent=!!node.leadingComments;if(indent)this.indent();print(node);if(indent)this.dedent()};CodeGenerator.prototype.printBlock=function(print,node){if(t.isEmptyStatement(node)){this.semicolon()}else{this.push(" ");print(node)}};CodeGenerator.prototype.generateComment=function(comment){var val=comment.value;if(comment.type==="Line"){val="//"+val}else{val="/*"+val+"*/"}return val};CodeGenerator.prototype.printTrailingComments=function(node,parent){this._printComments(this.getComments("trailingComments",node,parent))};CodeGenerator.prototype.printLeadingComments=function(node,parent){this._printComments(this.getComments("leadingComments",node,parent))};CodeGenerator.prototype.getComments=function(key,node,parent){if(t.isExpressionStatement(parent)){return[]}var comments=[];var nodes=[node];var self=this;if(t.isExpressionStatement(node)){nodes.push(node.argument)}_.each(nodes,function(node){comments=comments.concat(self._getComments(key,node))});return comments};CodeGenerator.prototype._getComments=function(key,node){return node&&node[key]||[]};CodeGenerator.prototype._printComments=function(comments){if(this.format.compact)return;if(!this.format.comments)return;if(!comments||!comments.length)return;var self=this;_.each(comments,function(comment){self.newline(self.whitespace.getNewlinesBefore(comment));var column=self.position.column;var val=self.generateComment(comment);if(column&&!self.isLast(["\n"," ","[","{"])){self._push(" ");column++}if(comment.type==="Block"&&self.format.indent.adjustMultilineComment){var offset=comment.loc.start.column;if(offset){var newlineRegex=new RegExp("\\n\\s{1,"+offset+"}","g");val=val.replace(newlineRegex,"\n")}var indent=Math.max(self.indentSize(),column);val=val.replace(/\n/g,"\n"+util.repeat(indent))}if(column===0){val=self.getIndent()+val}self._push(val);self.newline(self.whitespace.getNewlinesAfter(comment))})}},{"../types":74,"../util":76,"./buffer":3,"./generators/base":5,"./generators/classes":6,"./generators/comprehensions":7,"./generators/expressions":8,"./generators/jsx":9,"./generators/methods":10,"./generators/modules":11,"./generators/playground":12,"./generators/statements":13,"./generators/template-literals":14,"./generators/types":15,"./node":16,"./position":19,"./source-map":20,"./whitespace":21,lodash:108}],5:[function(require,module,exports){exports.File=function(node,print){print(node.program)};exports.Program=function(node,print){print.sequence(node.body)};exports.BlockStatement=function(node,print){if(node.body.length===0){this.push("{}")}else{this.push("{");this.newline();print.sequence(node.body,{indent:true});this.removeLast("\n");this.rightBrace()}}},{}],6:[function(require,module,exports){exports.ClassExpression=exports.ClassDeclaration=function(node,print){this.push("class");if(node.id){this.space();print(node.id)}if(node.superClass){this.push(" extends ");print(node.superClass)}this.space();print(node.body)};exports.ClassBody=function(node,print){if(node.body.length===0){this.push("{}")}else{this.push("{");this.newline();this.indent();print.sequence(node.body);this.dedent();this.rightBrace()}};exports.MethodDefinition=function(node,print){if(node.static){this.push("static ")}this._method(node,print)}},{}],7:[function(require,module,exports){exports.ComprehensionBlock=function(node,print){this.keyword("for");this.push("(");print(node.left);this.push(" of ");print(node.right);this.push(")")};exports.ComprehensionExpression=function(node,print){this.push(node.generator?"(":"[");print.join(node.blocks,{separator:" "});this.space();if(node.filter){this.keyword("if");this.push("(");print(node.filter);this.push(")");this.space()}print(node.body);this.push(node.generator?")":"]")}},{}],8:[function(require,module,exports){var util=require("../../util");var t=require("../../types");exports.UnaryExpression=function(node,print){var hasSpace=/[a-z]$/.test(node.operator);var arg=node.argument;if(t.isUpdateExpression(arg)||t.isUnaryExpression(arg)){hasSpace=true}if(t.isUnaryExpression(arg)&&arg.operator==="!"){hasSpace=false}this.push(node.operator);if(hasSpace)this.space();print(node.argument)};exports.ParenthesizedExpression=function(node,print){this.push("(");print(node.expression);this.push(")")};exports.UpdateExpression=function(node,print){if(node.prefix){this.push(node.operator);print(node.argument)}else{print(node.argument);this.push(node.operator)}};exports.ConditionalExpression=function(node,print){print(node.test);this.push(" ? ");print(node.consequent);this.push(" : ");print(node.alternate)};exports.NewExpression=function(node,print){this.push("new ");print(node.callee);if(node.arguments.length||this.format.parentheses){this.push("(");print.join(node.arguments,{separator:", "});this.push(")")}};exports.SequenceExpression=function(node,print){print.join(node.expressions,{separator:", "})};exports.ThisExpression=function(){this.push("this")};exports.CallExpression=function(node,print){print(node.callee);this.push("(");print.join(node.arguments,{separator:", "});this.push(")")};var buildYieldAwait=function(keyword){return function(node,print){this.push(keyword);if(node.delegate)this.push("*");if(node.argument){this.space();print(node.argument)}}};exports.YieldExpression=buildYieldAwait("yield");exports.AwaitExpression=buildYieldAwait("await");exports.EmptyStatement=function(){this.semicolon()};exports.ExpressionStatement=function(node,print){print(node.expression);this.semicolon()};exports.BinaryExpression=exports.LogicalExpression=exports.AssignmentExpression=function(node,print){print(node.left);this.push(" "+node.operator+" ");print(node.right)};exports.MemberExpression=function(node,print){print(node.object);if(node.computed){this.push("[");print(node.property);this.push("]")}else{if(t.isLiteral(node.object)&&util.isInteger(node.object.value)){this.push(".")}this.push(".");print(node.property)}}},{"../../types":74,"../../util":76}],9:[function(require,module,exports){var t=require("../../types");var _=require("lodash");exports.XJSAttribute=function(node,print){print(node.name);if(node.value){this.push("=");print(node.value)}};exports.XJSIdentifier=function(node){this.push(node.name)};exports.XJSNamespacedName=function(node,print){print(node.namespace);this.push(":");print(node.name)};exports.XJSMemberExpression=function(node,print){print(node.object);this.push(".");print(node.property)};exports.XJSSpreadAttribute=function(node,print){this.push("{...");print(node.argument);this.push("}")};exports.XJSExpressionContainer=function(node,print){this.push("{");print(node.expression);this.push("}")};exports.XJSElement=function(node,print){var self=this;var open=node.openingElement;print(open);if(open.selfClosing)return;this.indent();_.each(node.children,function(child){if(t.isLiteral(child)){self.push(child.value)}else{print(child)}});this.dedent();print(node.closingElement)};exports.XJSOpeningElement=function(node,print){this.push("<");print(node.name);if(node.attributes.length>0){this.space();print.join(node.attributes,{separator:" "})}this.push(node.selfClosing?" />":">")};exports.XJSClosingElement=function(node,print){this.push("</");print(node.name);this.push(">")};exports.XJSEmptyExpression=function(){}},{"../../types":74,lodash:108}],10:[function(require,module,exports){var t=require("../../types");exports._params=function(node,print){var self=this;this.push("(");print.join(node.params,{separator:", ",iterator:function(param,i){var def=node.defaults&&node.defaults[i];if(def){self.push(" = ");print(def)}}});if(node.rest){if(node.params.length){this.push(", ")}this.push("...");print(node.rest)}this.push(")")};exports._method=function(node,print){var value=node.value;var kind=node.kind;var key=node.key;if(!kind||kind==="init"){if(value.generator){this.push("*")}}else{this.push(kind+" ")}if(value.async)this.push("async ");if(node.computed){this.push("[");print(key);this.push("]")}else{print(key)}this._params(value,print);this.space();print(value.body)};exports.FunctionDeclaration=exports.FunctionExpression=function(node,print){if(node.async)this.push("async ");this.push("function");if(node.generator)this.push("*");this.space();if(node.id)print(node.id);this._params(node,print);this.space();print(node.body)};exports.ArrowFunctionExpression=function(node,print){if(node.async)this.push("async ");if(node.params.length===1&&!node.defaults.length&&!node.rest&&t.isIdentifier(node.params[0])){print(node.params[0])}else{this._params(node,print)}this.push(" => ");print(node.body)}},{"../../types":74}],11:[function(require,module,exports){var t=require("../../types");var _=require("lodash");exports.ImportSpecifier=exports.ExportSpecifier=function(node,print){print(node.id);if(node.name){this.push(" as ");print(node.name)}};exports.ExportBatchSpecifier=function(){this.push("*")};exports.ExportDeclaration=function(node,print){this.push("export ");var specifiers=node.specifiers;if(node.default){this.push("default ")}if(node.declaration){print(node.declaration);if(t.isStatement(node.declaration))return}else{if(specifiers.length===1&&t.isExportBatchSpecifier(specifiers[0])){print(specifiers[0])}else{this.push("{");if(specifiers.length){this.space();print.join(specifiers,{separator:", "});this.space()}this.push("}")}if(node.source){this.push(" from ");print(node.source)}}this.ensureSemicolon()};exports.ImportDeclaration=function(node,print){var self=this;this.push("import ");var specfiers=node.specifiers;if(specfiers&&specfiers.length){var foundImportSpecifier=false;_.each(node.specifiers,function(spec,i){if(+i>0){self.push(", ")}if(!spec.default&&spec.type!=="ImportBatchSpecifier"&&!foundImportSpecifier){foundImportSpecifier=true;self.push("{ ")}print(spec)});if(foundImportSpecifier){this.push(" }")}this.push(" from ")}print(node.source);this.semicolon()};exports.ImportBatchSpecifier=function(node,print){this.push("* as ");print(node.name)}},{"../../types":74,lodash:108}],12:[function(require,module,exports){var _=require("lodash");_.each(["BindMemberExpression","BindFunctionExpression"],function(type){exports[type]=function(){throw new ReferenceError("Trying to render non-standard playground node "+JSON.stringify(type))}})},{lodash:108}],13:[function(require,module,exports){var t=require("../../types");exports.WithStatement=function(node,print){this.keyword("with");this.push("(");print(node.object);this.push(")");print.block(node.body)};exports.IfStatement=function(node,print){this.keyword("if");this.push("(");print(node.test);this.push(") ");print.indentOnComments(node.consequent);if(node.alternate){if(this.isLast("}"))this.space();this.keyword("else");print.indentOnComments(node.alternate)}};exports.ForStatement=function(node,print){this.keyword("for");this.push("(");print(node.init);this.push(";");if(node.test){this.space();print(node.test)}this.push(";");if(node.update){this.space();print(node.update)}this.push(")");print.block(node.body)};exports.WhileStatement=function(node,print){this.keyword("while");this.push("(");print(node.test);this.push(")");print.block(node.body)};var buildForXStatement=function(op){return function(node,print){this.keyword("for");this.push("(");print(node.left);this.push(" "+op+" ");print(node.right);this.push(")");print.block(node.body)}};exports.ForInStatement=buildForXStatement("in");exports.ForOfStatement=buildForXStatement("of");exports.DoWhileStatement=function(node,print){this.keyword("do");print(node.body);this.space();this.keyword("while");this.push("(");print(node.test);this.push(");")};var buildLabelStatement=function(prefix,key){return function(node,print){this.push(prefix);var label=node[key||"label"];if(label){this.space();print(label)}this.semicolon()}};exports.ContinueStatement=buildLabelStatement("continue");exports.ReturnStatement=buildLabelStatement("return","argument");exports.BreakStatement=buildLabelStatement("break");exports.LabeledStatement=function(node,print){print(node.label);this.push(": ");print(node.body)};exports.TryStatement=function(node,print){this.keyword("try");print(node.block);this.space();print(node.handler);if(node.finalizer){this.space();this.push("finally ");print(node.finalizer)}};exports.CatchClause=function(node,print){this.keyword("catch");this.push("(");print(node.param);this.push(") ");print(node.body)};exports.ThrowStatement=function(node,print){this.push("throw ");print(node.argument);this.semicolon()};exports.SwitchStatement=function(node,print){this.keyword("switch");this.push("(");print(node.discriminant);this.push(") {");print.sequence(node.cases,{indent:true});this.push("}")};exports.SwitchCase=function(node,print){if(node.test){this.push("case ");print(node.test);this.push(":")}else{this.push("default:")}this.space();print.sequence(node.consequent,{indent:true})};exports.DebuggerStatement=function(){this.push("debugger;")};exports.VariableDeclaration=function(node,print,parent){this.push(node.kind+" ");print.join(node.declarations,{separator:", "});if(!t.isFor(parent)){this.semicolon()}};exports.VariableDeclarator=function(node,print){if(node.init){print(node.id);this.push(" = ");print(node.init)}else{print(node.id)}}},{"../../types":74}],14:[function(require,module,exports){var _=require("lodash");exports.TaggedTemplateExpression=function(node,print){print(node.tag);print(node.quasi)};exports.TemplateElement=function(node){this._push(node.value.raw)};exports.TemplateLiteral=function(node,print){this.push("`");var quasis=node.quasis;var self=this;var len=quasis.length;_.each(quasis,function(quasi,i){print(quasi);if(i+1<len){self.push("${ ");print(node.expressions[i]);self.push(" }")}});this._push("`")}},{lodash:108}],15:[function(require,module,exports){var _=require("lodash");exports.Identifier=function(node){this.push(node.name)};exports.SpreadElement=exports.SpreadProperty=function(node,print){this.push("...");print(node.argument)};exports.VirtualPropertyExpression=function(node,print){print(node.object);this.push("::");print(node.property)};exports.ObjectExpression=exports.ObjectPattern=function(node,print){var props=node.properties;if(props.length){this.push("{");this.space();print.join(props,{separator:", ",indent:true});this.space();this.push("}")}else{this.push("{}")}};exports.Property=function(node,print){if(node.method||node.kind==="get"||node.kind==="set"){this._method(node,print)}else{if(node.computed){this.push("[");print(node.key);this.push("]")}else{print(node.key);if(node.shorthand)return}this.push(": ");print(node.value)}};exports.ArrayExpression=exports.ArrayPattern=function(node,print){var elems=node.elements;var self=this;var len=elems.length;this.push("[");_.each(elems,function(elem,i){if(!elem){self.push(",")}else{if(i>0)self.push(" ");print(elem);if(i<len-1)self.push(",")}});this.push("]")};exports.Literal=function(node){var val=node.value;var type=typeof val;if(type==="string"){val=JSON.stringify(val);val=val.replace(/[\u007f-\uffff]/g,function(c){return"\\u"+("0000"+c.charCodeAt(0).toString(16)).slice(-4)});this.push(val)}else if(type==="boolean"||type==="number"){this.push(JSON.stringify(val))}else if(node.regex){this.push("/"+node.regex.pattern+"/"+node.regex.flags)}else if(val===null){this.push("null")}}},{lodash:108}],16:[function(require,module,exports){module.exports=Node;var whitespace=require("./whitespace");var parens=require("./parentheses");var t=require("../../types");var _=require("lodash");var find=function(obj,node,parent){var result;_.each(obj,function(fn,type){if(t["is"+type](node)){result=fn(node,parent);if(result!=null)return false}});return result};function Node(node,parent){this.parent=parent;this.node=node}Node.prototype.isUserWhitespacable=function(){return t.isUserWhitespacable(this.node)};Node.prototype.needsWhitespace=function(type){var parent=this.parent;var node=this.node;if(!node)return 0;if(t.isExpressionStatement(node)){node=node.expression}var lines=find(whitespace[type].nodes,node,parent);if(lines)return lines;_.each(find(whitespace[type].list,node,parent),function(expr){lines=Node.needsWhitespace(expr,node,type);if(lines)return false});return lines||0};Node.prototype.needsWhitespaceBefore=function(){return this.needsWhitespace("before")};Node.prototype.needsWhitespaceAfter=function(){return this.needsWhitespace("after")};Node.prototype.needsParens=function(){var parent=this.parent;var node=this.node;if(!parent)return false;if(t.isNewExpression(parent)&&parent.callee===node){return t.isCallExpression(node)||_.some(node,function(val){return t.isCallExpression(val)})}return find(parens,node,parent)};_.each(Node.prototype,function(fn,key){Node[key]=function(node,parent){var n=new Node(node,parent);var args=_.toArray(arguments).slice(2);return n[key].apply(n,args)}})},{"../../types":74,"./parentheses":17,"./whitespace":18,lodash:108}],17:[function(require,module,exports){var t=require("../../types");var _=require("lodash");var PRECEDENCE={};_.each([["||"],["&&"],["|"],["^"],["&"],["==","===","!=","!=="],["<",">","<=",">=","in","instanceof"],[">>","<<",">>>"],["+","-"],["*","/","%"]],function(tier,i){_.each(tier,function(op){PRECEDENCE[op]=i})});exports.Binary=function(node,parent){if(t.isCallExpression(parent)&&parent.callee===node){return true}if(t.isUnaryLike(parent)){return true}if(t.isMemberExpression(parent)&&parent.object===node){return true}if(t.isBinary(parent)){var parentOp=parent.operator;var parentPos=PRECEDENCE[parentOp];var nodeOp=node.operator;var nodePos=PRECEDENCE[nodeOp];if(parentPos>nodePos){return true}if(parentPos===nodePos&&parent.right===node){return true}}};exports.BinaryExpression=function(node,parent){if(node.operator==="in"){if(t.isVariableDeclarator(parent)){return true}if(t.isFor(parent)){return true}}};exports.SequenceExpression=function(node,parent){if(t.isForStatement(parent)){return false}if(t.isExpressionStatement(parent)&&parent.expression===node){return false}return true};exports.YieldExpression=function(node,parent){return t.isBinary(parent)||t.isUnaryLike(parent)||t.isCallExpression(parent)||t.isMemberExpression(parent)||t.isNewExpression(parent)||t.isConditionalExpression(parent)||t.isYieldExpression(parent)};exports.Literal=function(node,parent){if(_.isNumber(node.value)&&t.isMemberExpression(parent)&&parent.object===node){return true}};exports.ClassExpression=function(node,parent){return t.isExpressionStatement(parent)};exports.UnaryLike=function(node,parent){return t.isMemberExpression(parent)&&parent.object===node};exports.FunctionExpression=function(node,parent){if(t.isExpressionStatement(parent)){return true}if(t.isMemberExpression(parent)&&parent.object===node){return true}if(t.isCallExpression(parent)&&parent.callee===node){return true}};exports.AssignmentExpression=exports.ConditionalExpression=function(node,parent){if(t.isUnaryLike(parent)){return true}if(t.isBinary(parent)){return true}if(t.isCallExpression(parent)&&parent.callee===node){return true}if(t.isConditionalExpression(parent)&&parent.test===node){return true}if(t.isMemberExpression(parent)&&parent.object===node){return true}return false}},{"../../types":74,lodash:108}],18:[function(require,module,exports){var _=require("lodash");var t=require("../../types");exports.before={nodes:{Property:function(node,parent){if(parent.properties[0]===node){return 1}},SpreadProperty:function(node,parent){return exports.before.nodes.Property(node,parent)},SwitchCase:function(node,parent){if(parent.cases[0]===node){return 1
}},CallExpression:function(node){if(t.isFunction(node.callee)){return 1}}}};exports.after={nodes:{},list:{VariableDeclaration:function(node){return _.map(node.declarations,"init")},ArrayExpression:function(node){return node.elements},ObjectExpression:function(node){return node.properties}}};_.each({Function:1,Class:1,For:1,SwitchStatement:1,IfStatement:{before:1},CallExpression:{after:1},Literal:{after:1}},function(amounts,type){if(_.isNumber(amounts))amounts={after:amounts,before:amounts};_.each(amounts,function(amount,key){exports[key].nodes[type]=function(){return amount}})})},{"../../types":74,lodash:108}],19:[function(require,module,exports){module.exports=Position;var _=require("lodash");function Position(){this.line=1;this.column=0}Position.prototype.push=function(str){var self=this;_.each(str,function(cha){if(cha==="\n"){self.line++;self.column=0}else{self.column++}})};Position.prototype.unshift=function(str){var self=this;_.each(str,function(cha){if(cha==="\n"){self.line--}else{self.column--}})}},{lodash:108}],20:[function(require,module,exports){module.exports=SourceMap;var sourceMap=require("source-map");var t=require("../types");function SourceMap(position,opts,code){this.position=position;this.opts=opts;if(opts.sourceMap){this.map=new sourceMap.SourceMapGenerator({file:opts.sourceMapName,sourceRoot:opts.sourceRoot});this.map.setSourceContent(opts.sourceFileName,code)}else{this.map=null}}SourceMap.prototype.get=function(){var map=this.map;if(map){return map.toJSON()}else{return map}};SourceMap.prototype.mark=function(node,type){var loc=node.loc;if(!loc)return;var map=this.map;if(!map)return;if(t.isProgram(node)||t.isFile(node))return;var position=this.position;var generated={line:position.line,column:position.column};var original=loc[type];if(generated.line===original.line&&generated.column===original.column)return;map.addMapping({source:this.opts.sourceFileName,generated:generated,original:original})}},{"../types":74,"source-map":116}],21:[function(require,module,exports){module.exports=Whitespace;var _=require("lodash");function Whitespace(tokens,comments){this.tokens=_.sortBy(tokens.concat(comments),"start");this.used=[]}Whitespace.prototype.getNewlinesBefore=function(node){var startToken;var endToken;var tokens=this.tokens;_.each(tokens,function(token,i){if(node.start===token.start){startToken=tokens[i-1];endToken=token;return false}});return this.getNewlinesBetween(startToken,endToken)};Whitespace.prototype.getNewlinesAfter=function(node){var startToken;var endToken;var tokens=this.tokens;_.each(tokens,function(token,i){if(node.end===token.end){startToken=token;endToken=tokens[i+1];return false}});return this.getNewlinesBetween(startToken,endToken)};Whitespace.prototype.getNewlinesBetween=function(startToken,endToken){var start=startToken?startToken.loc.end.line:1;var end=endToken.loc.start.line;var lines=0;for(var line=start;line<end;line++){if(!_.contains(this.used,line)){this.used.push(line);lines++}}return lines}},{lodash:108}],22:[function(require,module,exports){var t=require("./types");var _=require("lodash");var types=require("ast-types");var def=types.Type.def;var or=types.Type.or;def("File").bases("Node").build("program").field("program",def("Program"));def("ParenthesizedExpression").bases("Expression").build("expression").field("expression",def("Expression"));def("ImportBatchSpecifier").bases("Specifier").build("name").field("name",def("Identifier"));def("VirtualPropertyExpression").bases("Expression").build("object","property").field("object",def("Expression")).field("property",or(def("Identifier"),def("Expression")));def("BindMemberExpression").bases("Expression").build("object","property","arguments").field("object",def("Expression")).field("property",or(def("Identifier"),def("Expression"))).field("arguments",[def("Expression")]);def("BindFunctionExpression").bases("Expression").build("callee","arguments").field("callee",def("Expression")).field("arguments",[def("Expression")]);types.finalize();var estraverse=require("estraverse");_.extend(estraverse.VisitorKeys,t.VISITOR_KEYS)},{"./types":74,"ast-types":91,estraverse:103,lodash:108}],23:[function(require,module,exports){module.exports=AMDFormatter;var CommonJSFormatter=require("./common");var util=require("../../util");var t=require("../../types");var _=require("lodash");function AMDFormatter(file){this.file=file;this.ids={}}util.inherits(AMDFormatter,CommonJSFormatter);AMDFormatter.prototype.transform=function(ast){var program=ast.program;var body=program.body;var names=[t.literal("exports")];_.each(this.ids,function(id,name){names.push(t.literal(name))});names=t.arrayExpression(names);var params=_.values(this.ids);params.unshift(t.identifier("exports"));var container=t.functionExpression(null,params,t.blockStatement(body));var defineArgs=[names,container];var moduleName=this.getModuleName();if(moduleName)defineArgs.unshift(t.literal(moduleName));var call=t.callExpression(t.identifier("define"),defineArgs);program.body=[t.expressionStatement(call)]};AMDFormatter.prototype.getModuleName=function(){if(this.file.opts.amdModuleIds){return CommonJSFormatter.prototype.getModuleName.apply(this,arguments)}else{return null}};AMDFormatter.prototype._push=function(node){var id=node.source.value;var ids=this.ids;if(ids[id]){return ids[id]}else{return this.ids[id]=this.file.generateUidIdentifier(id)}};AMDFormatter.prototype.import=function(node){this._push(node)};AMDFormatter.prototype.importSpecifier=function(specifier,node,nodes){var key=t.getSpecifierName(specifier);var id=specifier.id;if(specifier.default){id=t.identifier("default")}var ref;if(t.isImportBatchSpecifier(specifier)){ref=this._push(node)}else{ref=t.memberExpression(this._push(node),id,false)}nodes.push(t.variableDeclaration("var",[t.variableDeclarator(key,ref)]))};AMDFormatter.prototype.exportSpecifier=function(specifier,node,nodes){var self=this;return this._exportSpecifier(function(){return self._push(node)},specifier,node,nodes)}},{"../../types":74,"../../util":76,"./common":25,lodash:108}],24:[function(require,module,exports){module.exports=CommonJSInteropFormatter;var CommonJSFormatter=require("./common");var util=require("../../util");var t=require("../../types");var _=require("lodash");function CommonJSInteropFormatter(file){CommonJSFormatter.apply(this,arguments);var has=false;_.each(file.ast.program.body,function(node){if(t.isExportDeclaration(node)&&!node.default)has=true});this.has=has}util.inherits(CommonJSInteropFormatter,CommonJSFormatter);CommonJSInteropFormatter.prototype.importSpecifier=function(specifier,node,nodes){var variableName=t.getSpecifierName(specifier);if(specifier.default){nodes.push(t.variableDeclaration("var",[t.variableDeclarator(variableName,t.callExpression(this.file.addDeclaration("interop-require"),[util.template("require",{MODULE_NAME:node.source.raw})]))]))}else{CommonJSFormatter.prototype.importSpecifier.apply(this,arguments)}};CommonJSInteropFormatter.prototype.export=function(node,nodes){if(node.default&&!this.has){var declar=node.declaration;var assign=util.template("exports-default-module",{VALUE:this._pushStatement(declar,nodes)},true);nodes.push(this._hoistExport(declar,assign));return}CommonJSFormatter.prototype.export.apply(this,arguments)};CommonJSInteropFormatter.prototype.exportSpecifier=function(){CommonJSFormatter.prototype.exportSpecifier.apply(this,arguments)}},{"../../types":74,"../../util":76,"./common":25,lodash:108}],25:[function(require,module,exports){module.exports=CommonJSFormatter;var util=require("../../util");var t=require("../../types");function CommonJSFormatter(file){this.file=file}CommonJSFormatter.prototype.getModuleName=function(){var opts=this.file.opts;var filenameRelative=opts.filenameRelative;var moduleName="";if(opts.moduleRoot){moduleName=opts.moduleRoot+"/"}if(!opts.filenameRelative){return moduleName+opts.filename.replace(/^\//,"")}if(opts.sourceRoot){var sourceRootRegEx=new RegExp("^"+opts.sourceRoot+"/?");filenameRelative=filenameRelative.replace(sourceRootRegEx,"")}filenameRelative=filenameRelative.replace(/\.(.*?)$/,"");moduleName+=filenameRelative;return moduleName};CommonJSFormatter.prototype.import=function(node,nodes){nodes.push(util.template("require",{MODULE_NAME:node.source.raw},true))};CommonJSFormatter.prototype.importSpecifier=function(specifier,node,nodes){var variableName=t.getSpecifierName(specifier);if(specifier.default){specifier.id=t.identifier("default")}var templateName="require-assign";if(specifier.type!=="ImportBatchSpecifier")templateName+="-key";nodes.push(util.template(templateName,{VARIABLE_NAME:variableName,MODULE_NAME:node.source.raw,KEY:specifier.id}))};CommonJSFormatter.prototype._hoistExport=function(declar,assign){if(t.isFunctionDeclaration(declar)){assign._blockHoist=true}return assign};CommonJSFormatter.prototype._pushStatement=function(ref,nodes){if(t.isClass(ref)||t.isFunction(ref)){if(ref.id){nodes.push(t.toStatement(ref));ref=ref.id}}return ref};CommonJSFormatter.prototype.export=function(node,nodes){var declar=node.declaration;if(node.default){nodes.push(util.template("exports-default",{VALUE:this._pushStatement(declar,nodes)},true))}else{var assign;if(t.isVariableDeclaration(declar)){var decl=declar.declarations[0];if(decl.init){decl.init=util.template("exports-assign",{VALUE:decl.init,KEY:decl.id})}nodes.push(declar)}else{assign=util.template("exports-assign",{VALUE:declar.id,KEY:declar.id},true);nodes.push(t.toStatement(declar));nodes.push(assign);this._hoistExport(declar,assign)}}};CommonJSFormatter.prototype._exportSpecifier=function(getRef,specifier,node,nodes){var variableName=t.getSpecifierName(specifier);var inherits=false;if(node.specifiers.length===1)inherits=node;if(node.source){if(t.isExportBatchSpecifier(specifier)){nodes.push(util.template("exports-wildcard",{OBJECT:getRef()},true))}else{nodes.push(util.template("exports-assign-key",{VARIABLE_NAME:variableName.name,OBJECT:getRef(),KEY:specifier.id},true))}}else{nodes.push(util.template("exports-assign",{VALUE:specifier.id,KEY:variableName},true))}};CommonJSFormatter.prototype.exportSpecifier=function(specifier,node,nodes){this._exportSpecifier(function(){return t.callExpression(t.identifier("require"),[node.source])},specifier,node,nodes)}},{"../../types":74,"../../util":76}],26:[function(require,module,exports){module.exports=IgnoreFormatter;var t=require("../../types");function IgnoreFormatter(){}IgnoreFormatter.prototype.import=function(){};IgnoreFormatter.prototype.importSpecifier=function(){};IgnoreFormatter.prototype.export=function(node,nodes){var declar=t.toStatement(node.declaration,true);if(declar)nodes.push(t.inherits(declar,node))};IgnoreFormatter.prototype.exportSpecifier=function(){}},{"../../types":74}],27:[function(require,module,exports){module.exports=SystemFormatter;var util=require("../../util");var t=require("../../types");var _=require("lodash");var SETTER_MODULE_NAMESPACE=t.identifier("m");var DEFAULT_IDENTIFIER=t.identifier("default");var NULL_SETTER=t.literal(null);function SystemFormatter(file){this.exportedStatements=[];this.importedModule={};this.exportIdentifier=file.generateUidIdentifier("export");this.file=file}SystemFormatter.prototype.transform=function(ast){var program=ast.program;var body=program.body;var moduleName=this.file.opts.filename.replace(/^.*\//,"").replace(/\..*$/,"");var dependencies=Object.keys(this.importedModule).map(t.literal);var moduleNameVariableNode=t.variableDeclaration("var",[t.variableDeclarator(t.identifier("__moduleName"),t.literal(moduleName))]);body.splice(1,0,moduleNameVariableNode);var declaredSetters=_(this.importedModule).map().flatten().pluck("variableName").pluck("name").uniq().map(t.identifier).map(function(name){return t.variableDeclarator(name)}).value();if(declaredSetters.length){body.splice(2,0,t.variableDeclaration("var",declaredSetters))}var executeFunctionExpression=t.functionExpression(null,[],t.blockStatement(this.exportedStatements));var settersArrayExpression=t.arrayExpression(this._buildSetters());var moduleReturnStatement=t.returnStatement(t.objectExpression([t.property("init",t.identifier("setters"),settersArrayExpression),t.property("init",t.identifier("execute"),executeFunctionExpression)]));body.push(moduleReturnStatement);var runner=util.template("register",{MODULE_NAME:t.literal(moduleName),MODULE_DEPENDENCIES:t.arrayExpression(dependencies),MODULE_BODY:t.functionExpression(null,[this.exportIdentifier],t.blockStatement(body))});program.body=[t.expressionStatement(runner)]};SystemFormatter.prototype._buildSetters=function(){return _.map(this.importedModule,function(specs){if(!specs.length){return NULL_SETTER}var expressionStatements=_.map(specs,function(spec){var right=SETTER_MODULE_NAMESPACE;if(!spec.isBatch){right=t.memberExpression(right,spec.key)}return t.expressionStatement(t.assignmentExpression("=",spec.variableName,right))});return t.functionExpression(null,[SETTER_MODULE_NAMESPACE],t.blockStatement(expressionStatements))})};SystemFormatter.prototype.import=function(node){var MODULE_NAME=node.source.value;this.importedModule[MODULE_NAME]=this.importedModule[MODULE_NAME]||[]};SystemFormatter.prototype.importSpecifier=function(specifier,node){var variableName=t.getSpecifierName(specifier);if(specifier.default){specifier.id=DEFAULT_IDENTIFIER}var MODULE_NAME=node.source.value;this.importedModule[MODULE_NAME]=this.importedModule[MODULE_NAME]||[];this.importedModule[MODULE_NAME].push({variableName:variableName,isBatch:specifier.type==="ImportBatchSpecifier",key:specifier.id})};SystemFormatter.prototype._export=function(name,identifier){this.exportedStatements.push(t.expressionStatement(t.callExpression(this.exportIdentifier,[t.literal(name),identifier])))};SystemFormatter.prototype.export=function(node,nodes){var declar=node.declaration;var variableName,identifier;if(node.default){variableName=DEFAULT_IDENTIFIER.name;if(t.isClass(declar)||t.isFunction(declar)){if(!declar.id){declar.id=this.file.generateUidIdentifier("anonymous")}nodes.push(t.toStatement(declar));declar=declar.id}identifier=declar}else if(t.isVariableDeclaration(declar)){variableName=declar.declarations[0].id.name;identifier=declar.declarations[0].id;nodes.push(declar)}else{variableName=declar.id.name;identifier=declar.id;nodes.push(declar)}this._export(variableName,identifier)};SystemFormatter.prototype.exportSpecifier=function(specifier,node){var variableName=t.getSpecifierName(specifier);if(node.source){if(t.isExportBatchSpecifier(specifier)){var exportIdentifier=t.identifier("exports");this.exportedStatements.push(t.variableDeclaration("var",[t.variableDeclarator(exportIdentifier,this.exportIdentifier)]));this.exportedStatements.push(util.template("exports-wildcard",{OBJECT:t.identifier(node.source.value)},true))}else{this._export(variableName.name,t.memberExpression(t.identifier(node.source.value),specifier.id))}}else{this._export(variableName.name,specifier.id)}}},{"../../types":74,"../../util":76,lodash:108}],28:[function(require,module,exports){module.exports=UMDFormatter;var AMDFormatter=require("./amd");var util=require("../../util");var t=require("../../types");var _=require("lodash");function UMDFormatter(){AMDFormatter.apply(this,arguments)}util.inherits(UMDFormatter,AMDFormatter);UMDFormatter.prototype.transform=function(ast){var program=ast.program;var body=program.body;var names=[];_.each(this.ids,function(id,name){names.push(t.literal(name))});var ids=_.values(this.ids);var args=[t.identifier("exports")].concat(ids);var factory=t.functionExpression(null,args,t.blockStatement(body));var defineArgs=[t.arrayExpression([t.literal("exports")].concat(names))];var moduleName=this.getModuleName();if(moduleName)defineArgs.unshift(t.literal(moduleName));var runner=util.template("umd-runner-body",{AMD_ARGUMENTS:defineArgs,COMMON_ARGUMENTS:names.map(function(name){return t.callExpression(t.identifier("require"),[name])})});var call=t.callExpression(runner,[factory]);program.body=[t.expressionStatement(call)]}},{"../../types":74,"../../util":76,"./amd":23,lodash:108}],29:[function(require,module,exports){module.exports=transform;var Transformer=require("./transformer");var File=require("../file");var _=require("lodash");function transform(code,opts){var file=new File(opts);return file.parse(code)}transform._ensureTransformerNames=function(type,keys){_.each(keys,function(key){if(!_.has(transform.transformers,key)){throw new ReferenceError("unknown transformer "+key+" specified in "+type)}})};transform.transformers={};transform.moduleFormatters={common:require("./modules/common"),commonInterop:require("./modules/common-interop"),system:require("./modules/system"),ignore:require("./modules/ignore"),amd:require("./modules/amd"),umd:require("./modules/umd")};_.each({modules:require("./transformers/es6-modules"),propertyNameShorthand:require("./transformers/es6-property-name-shorthand"),arrayComprehension:require("./transformers/es7-array-comprehension"),generatorComprehension:require("./transformers/es7-generator-comprehension"),arrowFunctions:require("./transformers/es6-arrow-functions"),classes:require("./transformers/es6-classes"),computedPropertyNames:require("./transformers/es6-computed-property-names"),objectSpread:require("./transformers/es7-object-spread"),exponentiationOperator:require("./transformers/es7-exponentiation-operator"),spread:require("./transformers/es6-spread"),templateLiterals:require("./transformers/es6-template-literals"),propertyMethodAssignment:require("./transformers/es5-property-method-assignment"),defaultParameters:require("./transformers/es6-default-parameters"),restParameters:require("./transformers/es6-rest-parameters"),destructuring:require("./transformers/es6-destructuring"),forOf:require("./transformers/es6-for-of"),unicodeRegex:require("./transformers/es6-unicode-regex"),abstractReferences:require("./transformers/es7-abstract-references"),react:require("./transformers/react"),constants:require("./transformers/es6-constants"),letScoping:require("./transformers/es6-let-scoping"),generators:require("./transformers/es6-generators"),methodBinding:require("./transformers/playground-method-binding"),memoizationOperator:require("./transformers/playground-memoization-operator"),_blockHoist:require("./transformers/_block-hoist"),_declarations:require("./transformers/_declarations"),_aliasFunctions:require("./transformers/_alias-functions"),useStrict:require("./transformers/use-strict"),_propertyLiterals:require("./transformers/_property-literals"),_memberExpressioLiterals:require("./transformers/_member-expression-literals"),_moduleFormatter:require("./transformers/_module-formatter")},function(transformer,key){transform.transformers[key]=new Transformer(key,transformer)})},{"../file":2,"./modules/amd":23,"./modules/common":25,"./modules/common-interop":24,"./modules/ignore":26,"./modules/system":27,"./modules/umd":28,"./transformer":30,"./transformers/_alias-functions":31,"./transformers/_block-hoist":32,"./transformers/_declarations":33,"./transformers/_member-expression-literals":34,"./transformers/_module-formatter":35,"./transformers/_property-literals":36,"./transformers/es5-property-method-assignment":37,"./transformers/es6-arrow-functions":38,"./transformers/es6-classes":39,"./transformers/es6-computed-property-names":40,"./transformers/es6-constants":41,"./transformers/es6-default-parameters":42,"./transformers/es6-destructuring":43,"./transformers/es6-for-of":44,"./transformers/es6-generators":49,"./transformers/es6-let-scoping":54,"./transformers/es6-modules":55,"./transformers/es6-property-name-shorthand":56,"./transformers/es6-rest-parameters":57,"./transformers/es6-spread":58,"./transformers/es6-template-literals":59,"./transformers/es6-unicode-regex":60,"./transformers/es7-abstract-references":61,"./transformers/es7-array-comprehension":62,"./transformers/es7-exponentiation-operator":63,"./transformers/es7-generator-comprehension":64,"./transformers/es7-object-spread":65,"./transformers/playground-memoization-operator":66,"./transformers/playground-method-binding":67,"./transformers/react":68,"./transformers/use-strict":69,lodash:108}],30:[function(require,module,exports){module.exports=Transformer;var traverse=require("../traverse");var t=require("../types");var _=require("lodash");function Transformer(key,transformer){this.transformer=Transformer.normalise(transformer);this.key=key}Transformer.normalise=function(transformer){if(_.isFunction(transformer)){transformer={ast:transformer}}_.each(transformer,function(fns,type){if(type[0]==="_")return;if(_.isFunction(fns))fns={enter:fns};transformer[type]=fns});return transformer};Transformer.prototype.transform=function(file){if(!this.canRun(file))return;var transformer=this.transformer;var ast=file.ast;var astRun=function(key){if(transformer.ast&&transformer.ast[key]){transformer.ast[key](ast,file)}};astRun("enter");var build=function(exit){return function(node,parent,scope){var types=[node.type].concat(t.ALIAS_KEYS[node.type]||[]);var fns=transformer.all;_.each(types,function(type){fns=transformer[type]||fns});if(!fns)return;var fn=fns.enter;if(exit)fn=fns.exit;if(!fn)return;return fn(node,parent,file,scope)}};traverse(ast,{enter:build(),exit:build(true)});astRun("exit")};Transformer.prototype.canRun=function(file){var opts=file.opts;var key=this.key;var blacklist=opts.blacklist;if(blacklist.length&&_.contains(blacklist,key))return false;if(key[0]!=="_"){var whitelist=opts.whitelist;if(whitelist.length&&!_.contains(whitelist,key))return false}return true}},{"../traverse":70,"../types":74,lodash:108}],31:[function(require,module,exports){var traverse=require("../../traverse");var t=require("../../types");var go=function(getBody,node,file,scope){var argumentsId;var thisId;var getArgumentsId=function(){return argumentsId=argumentsId||file.generateUidIdentifier("arguments",scope)};var getThisId=function(){return thisId=thisId||file.generateUidIdentifier("this",scope)};traverse(node,function(node){if(!node._aliasFunction){if(t.isFunction(node)){return false}else{return}}traverse(node,function(node,parent){if(t.isFunction(node)&&!node._aliasFunction){return false}if(node._ignoreAliasFunctions)return false;var getId;if(t.isIdentifier(node)&&node.name==="arguments"){getId=getArgumentsId}else if(t.isThisExpression(node)){getId=getThisId}else{return}if(t.isReferenced(node,parent))return getId()});return false});var body;var pushDeclaration=function(id,init){body=body||getBody();body.unshift(t.variableDeclaration("var",[t.variableDeclarator(id,init)]))};if(argumentsId){pushDeclaration(argumentsId,t.identifier("arguments"))}if(thisId){pushDeclaration(thisId,t.identifier("this"))}};exports.Program=function(node,parent,file,scope){go(function(){return node.body},node,file,scope)};exports.FunctionDeclaration=exports.FunctionExpression=function(node,parent,file,scope){go(function(){t.ensureBlock(node);return node.body.body},node,file,scope)}},{"../../traverse":70,"../../types":74}],32:[function(require,module,exports){exports.BlockStatement=exports.Program={exit:function(node){var unshift=[];node.body=node.body.filter(function(bodyNode){if(bodyNode._blockHoist){unshift.push(bodyNode);return false}else{return true}});node.body=unshift.concat(node.body)}}},{}],33:[function(require,module,exports){var t=require("../../types");var _=require("lodash");exports.BlockStatement=exports.Program=function(node){var kinds={};_.each(node._declarations,function(declar){var kind=declar.kind||"var";var declarNode=t.variableDeclarator(declar.id,declar.init);if(!declar.init){kinds[kind]=kinds[kind]||[];kinds[kind].push(declarNode)}else{node.body.unshift(t.variableDeclaration(kind,[declarNode]))}});_.each(kinds,function(declars,kind){node.body.unshift(t.variableDeclaration(kind,declars))})}},{"../../types":74,lodash:108}],34:[function(require,module,exports){var esutils=require("esutils");var t=require("../../types");exports.MemberExpression=function(node){var prop=node.property;if(node.computed&&t.isLiteral(prop)&&t.isValidIdentifier(prop.value)){node.property=t.identifier(prop.value);node.computed=false}else if(!node.computed&&t.isIdentifier(prop)&&esutils.keyword.isKeywordES6(prop.name,true)){node.property=t.literal(prop.name);node.computed=true}}},{"../../types":74,esutils:107}],35:[function(require,module,exports){var transform=require("../transform");exports.ast={exit:function(ast,file){if(!transform.transformers.modules.canRun(file))return;if(file.moduleFormatter.transform){file.moduleFormatter.transform(ast)}}}},{"../transform":29}],36:[function(require,module,exports){var esutils=require("esutils");var t=require("../../types");exports.Property=function(node){var key=node.key;if(t.isLiteral(key)&&t.isValidIdentifier(key.value)){node.key=t.identifier(key.value);node.computed=false}else if(!node.computed&&t.isIdentifier(key)&&esutils.keyword.isKeywordES6(key.name,true)){node.key=t.literal(key.name)}}},{"../../types":74,esutils:107}],37:[function(require,module,exports){var util=require("../../util");var _=require("lodash");exports.Property=function(node){if(node.method)node.method=false};exports.ObjectExpression=function(node,parent,file){var mutatorMap={};node.properties=node.properties.filter(function(prop){if(prop.kind==="get"||prop.kind==="set"){util.pushMutatorMap(mutatorMap,prop.key,prop.kind,prop.value);return false}else{return true}});if(_.isEmpty(mutatorMap))return;var objId=util.getUid(parent,file);return util.template("object-define-properties-closure",{KEY:objId,OBJECT:node,CONTENT:util.template("object-define-properties",{OBJECT:objId,PROPS:util.buildDefineProperties(mutatorMap)})})}},{"../../util":76,lodash:108}],38:[function(require,module,exports){var t=require("../../types");exports.ArrowFunctionExpression=function(node){t.ensureBlock(node);node._aliasFunction=true;node.expression=false;node.type="FunctionExpression";return node}},{"../../types":74}],39:[function(require,module,exports){var traverse=require("../../traverse");var util=require("../../util");var t=require("../../types");var _=require("lodash");exports.ClassDeclaration=function(node,parent,file,scope){var built=new Class(node,file,scope).run();var declar=t.variableDeclaration("let",[t.variableDeclarator(node.id,built)]);t.inheritsComments(declar,node);return declar};exports.ClassExpression=function(node,parent,file,scope){return new Class(node,file,scope).run()};var getMemberExpressionObject=function(node){while(t.isMemberExpression(node)){node=node.object}return node};function Class(node,file,scope){this.scope=scope;this.node=node;this.file=file;this.instanceMutatorMap={};this.staticMutatorMap={};this.hasConstructor=false;this.className=node.id||file.generateUidIdentifier("class",scope);this.superName=node.superClass}Class.prototype.run=function(){var superClassArgument=this.superName;var superClassCallee=this.superName;var superName=this.superName;var className=this.className;var file=this.file;if(superName){if(t.isMemberExpression(superName)){superClassArgument=superClassCallee=getMemberExpressionObject(superName)}else if(!t.isIdentifier(superName)){superClassArgument=superName;superClassCallee=superName=file.generateUidIdentifier("ref",this.scope)}}this.superName=superName;var container=util.template("class",{CLASS_NAME:className});var block=container.callee.expression.body;var body=this.body=block.body;var constructor=this.constructor=body[0].declarations[0].init;if(this.node.id)constructor.id=className;var returnStatement=body.pop();if(superName){body.push(t.expressionStatement(t.callExpression(file.addDeclaration("extends"),[className,superName])));container.arguments.push(superClassArgument);container.callee.expression.params.push(superClassCallee)}this.buildBody();if(body.length===1){return constructor}else{body.push(returnStatement);return container}};Class.prototype.buildBody=function(){var constructor=this.constructor;var className=this.className;var superName=this.superName;var classBody=this.node.body.body;var body=this.body;var self=this;_.each(classBody,function(node){self.replaceInstanceSuperReferences(node);if(node.key.name==="constructor"){self.pushConstructor(node)}else{self.pushMethod(node)}});if(!this.hasConstructor&&superName){constructor.body.body.push(util.template("class-super-constructor-call",{SUPER_NAME:superName},true))}var instanceProps;var staticProps;if(!_.isEmpty(this.instanceMutatorMap)){var protoId=util.template("prototype-identifier",{CLASS_NAME:className});instanceProps=util.buildDefineProperties(this.instanceMutatorMap,protoId)}if(!_.isEmpty(this.staticMutatorMap)){staticProps=util.buildDefineProperties(this.staticMutatorMap,className)}if(instanceProps||staticProps){staticProps=staticProps||t.literal(null);var args=[className,staticProps];if(instanceProps)args.push(instanceProps);body.push(t.expressionStatement(t.callExpression(this.file.addDeclaration("class-props"),args)))}};Class.prototype.pushMethod=function(node){var methodName=node.key;var mutatorMap=this.instanceMutatorMap;if(node.static)mutatorMap=this.staticMutatorMap;var kind=node.kind;if(kind===""){kind="value";util.pushMutatorMap(mutatorMap,methodName,"writable",t.identifier("true"))}util.pushMutatorMap(mutatorMap,methodName,kind,node)};Class.prototype.superIdentifier=function(methodNode,id,parent){var methodName=methodNode.key;var superName=this.superName||t.identifier("Function");if(parent.property===id){return}else if(t.isCallExpression(parent,{callee:id})){parent.arguments.unshift(t.thisExpression());if(methodName.name==="constructor"){return t.memberExpression(superName,t.identifier("call"))}else{id=superName;if(!methodNode.static){id=t.memberExpression(id,t.identifier("prototype"))}id=t.memberExpression(id,methodName,methodNode.computed);return t.memberExpression(id,t.identifier("call"))}}else if(t.isMemberExpression(parent)&&!methodNode.static){return t.memberExpression(superName,t.identifier("prototype"))}else{return superName}};Class.prototype.replaceInstanceSuperReferences=function(methodNode){var method=methodNode.value;var self=this;traverse(method,function(node,parent){if(t.isIdentifier(node,{name:"super"})){return self.superIdentifier(methodNode,node,parent)}else if(t.isCallExpression(node)){var callee=node.callee;if(!t.isMemberExpression(callee))return;if(callee.object.name!=="super")return;callee.property=t.memberExpression(callee.property,t.identifier("call"));node.arguments.unshift(t.thisExpression())}})};Class.prototype.pushConstructor=function(method){if(method.kind!==""){throw this.file.errorWithNode(method,"illegal kind for constructor method")}var construct=this.constructor;var fn=method.value;this.hasConstructor=true;t.inherits(construct,fn);t.inheritsComments(construct,method);construct.defaults=fn.defaults;construct.params=fn.params;construct.body=fn.body;construct.rest=fn.rest}},{"../../traverse":70,"../../types":74,"../../util":76,lodash:108}],40:[function(require,module,exports){var util=require("../../util");var t=require("../../types");var _=require("lodash");exports.ObjectExpression=function(node,parent,file){var hasComputed=false;var computed=[];node.properties=node.properties.filter(function(prop){if(prop.computed){hasComputed=true;computed.unshift(prop);return false}else{return true}});if(!hasComputed)return;var objId=util.getUid(parent,file);var container=util.template("function-return-obj",{KEY:objId,OBJECT:node});var containerCallee=container.callee.expression;var containerBody=containerCallee.body.body;containerCallee._aliasFunction=true;_.each(computed,function(prop){containerBody.unshift(t.expressionStatement(t.assignmentExpression("=",t.memberExpression(objId,prop.key,true),prop.value)))});return container}},{"../../types":74,"../../util":76,lodash:108}],41:[function(require,module,exports){var traverse=require("../../traverse");var t=require("../../types");var _=require("lodash");exports.Program=exports.BlockStatement=exports.ForInStatement=exports.ForOfStatement=exports.ForStatement=function(node,parent,file){var constants={};
var check=function(parent,names){_.each(names,function(nameNode,name){if(!_.has(constants,name))return;if(parent&&t.isBlockStatement(parent)&&parent!==constants[name])return;throw file.errorWithNode(nameNode,name+" is read-only")})};var getIds=function(node){return t.getIds(node,true,["MemberExpression"])};_.each(node.body,function(child,parent){if(child&&t.isVariableDeclaration(child,{kind:"const"})){_.each(child.declarations,function(declar){_.each(getIds(declar),function(nameNode,name){var names={};names[name]=nameNode;check(parent,names);constants[name]=parent});declar._ignoreConstant=true});child._ignoreConstant=true;child.kind="let"}});if(_.isEmpty(constants))return;traverse(node,function(child,parent){if(child._ignoreConstant)return;if(t.isVariableDeclaration(child))return;if(t.isVariableDeclarator(child)||t.isDeclaration(child)||t.isAssignmentExpression(child)){check(parent,getIds(child))}})}},{"../../traverse":70,"../../types":74,lodash:108}],42:[function(require,module,exports){var traverse=require("../../traverse");var util=require("../../util");var t=require("../../types");var _=require("lodash");exports.Function=function(node,parent,file,scope){if(!node.defaults||!node.defaults.length)return;t.ensureBlock(node);var ids=node.params.map(function(param){return t.getIds(param)});var closure=false;_.each(node.defaults,function(def,i){if(!def)return;var param=node.params[i];_.each(ids.slice(i),function(ids){var check=function(node,parent){if(!t.isIdentifier(node)||!t.isReferenced(node,parent))return;if(_.contains(ids,node.name)){throw file.errorWithNode(node,"Temporal dead zone - accessing a variable before it's initialized")}if(scope.has(node.name)){closure=true}};check(def,node);traverse(def,check)});var has=scope.get(param.name);if(has&&!_.contains(node.params,has)){closure=true}});var body=[];_.each(node.defaults,function(def,i){if(!def)return;body.push(util.template("if-undefined-set-to",{VARIABLE:node.params[i],DEFAULT:def},true))});if(closure){var container=t.functionExpression(null,[],node.body,node.generator);container._aliasFunction=true;body.push(t.returnStatement(t.callExpression(container,[])));node.body=t.blockStatement(body)}else{node.body.body=body.concat(node.body.body)}node.defaults=[]}},{"../../traverse":70,"../../types":74,"../../util":76,lodash:108}],43:[function(require,module,exports){var t=require("../../types");var _=require("lodash");var buildVariableAssign=function(opts,id,init){var op=opts.operator;if(t.isMemberExpression(id))op="=";if(op){return t.expressionStatement(t.assignmentExpression("=",id,init))}else{return t.variableDeclaration(opts.kind,[t.variableDeclarator(id,init)])}};var push=function(opts,nodes,elem,parentId){if(t.isObjectPattern(elem)){pushObjectPattern(opts,nodes,elem,parentId)}else if(t.isArrayPattern(elem)){pushArrayPattern(opts,nodes,elem,parentId)}else{nodes.push(buildVariableAssign(opts,elem,parentId))}};var pushObjectPattern=function(opts,nodes,pattern,parentId){_.each(pattern.properties,function(prop,i){if(t.isSpreadProperty(prop)){var keys=[];_.each(pattern.properties,function(prop2,i2){if(i2>=i)return false;if(t.isSpreadProperty(prop2))return;var key=prop2.key;if(t.isIdentifier(key)){key=t.literal(prop2.key.name)}keys.push(key)});keys=t.arrayExpression(keys);var value=t.callExpression(opts.file.addDeclaration("object-spread"),[parentId,keys]);nodes.push(buildVariableAssign(opts,prop.argument,value))}else{var pattern2=prop.value;var patternId2=t.memberExpression(parentId,prop.key,prop.computed);if(t.isPattern(pattern2)){push(opts,nodes,pattern2,patternId2)}else{nodes.push(buildVariableAssign(opts,pattern2,patternId2))}}})};var pushArrayPattern=function(opts,nodes,pattern,parentId){var _parentId=opts.file.generateUidIdentifier("ref",opts.scope);nodes.push(t.variableDeclaration("var",[t.variableDeclarator(_parentId,opts.file.toArray(parentId))]));parentId=_parentId;_.each(pattern.elements,function(elem,i){if(!elem)return;var newPatternId;if(t.isSpreadElement(elem)){newPatternId=opts.file.toArray(parentId);if(+i>0){newPatternId=t.callExpression(t.memberExpression(newPatternId,t.identifier("slice")),[t.literal(i)])}elem=elem.argument}else{newPatternId=t.memberExpression(parentId,t.literal(i),true)}push(opts,nodes,elem,newPatternId)})};var pushPattern=function(opts){var nodes=opts.nodes;var pattern=opts.pattern;var parentId=opts.id;var file=opts.file;var scope=opts.scope;if(!t.isMemberExpression(parentId)&&!t.isIdentifier(parentId)){var key=file.generateUidIdentifier("ref",scope);nodes.push(t.variableDeclaration("var",[t.variableDeclarator(key,parentId)]));parentId=key}push(opts,nodes,pattern,parentId)};exports.ForInStatement=exports.ForOfStatement=function(node,parent,file,scope){var declar=node.left;if(!t.isVariableDeclaration(declar))return;var pattern=declar.declarations[0].id;if(!t.isPattern(pattern))return;var key=file.generateUidIdentifier("ref",scope);node.left=t.variableDeclaration(declar.kind,[t.variableDeclarator(key,null)]);var nodes=[];push({kind:declar.kind,file:file,scope:scope},nodes,pattern,key);t.ensureBlock(node);var block=node.body;block.body=nodes.concat(block.body)};exports.Function=function(node,parent,file,scope){var nodes=[];var hasDestructuring=false;node.params=node.params.map(function(pattern){if(!t.isPattern(pattern))return pattern;hasDestructuring=true;var parentId=file.generateUidIdentifier("ref",scope);pushPattern({kind:"var",nodes:nodes,pattern:pattern,id:parentId,file:file,scope:scope});return parentId});if(!hasDestructuring)return;t.ensureBlock(node);var block=node.body;block.body=nodes.concat(block.body)};exports.ExpressionStatement=function(node,parent,file,scope){var expr=node.expression;if(expr.type!=="AssignmentExpression")return;if(!t.isPattern(expr.left))return;var nodes=[];var ref=file.generateUidIdentifier("ref",scope);nodes.push(t.variableDeclaration("var",[t.variableDeclarator(ref,expr.right)]));push({operator:expr.operator,file:file,scope:scope},nodes,expr.left,ref);return nodes};exports.AssignmentExpression=function(node,parent,file,scope){if(parent.type==="ExpressionStatement")return;if(!t.isPattern(node.left))return;var tempName=file.generateUid("temp",scope);var ref=t.identifier(tempName);scope.push({key:tempName,id:ref});var nodes=[];nodes.push(t.assignmentExpression("=",ref,node.right));push({operator:node.operator,file:file,scope:scope},nodes,node.left,ref);nodes.push(ref);return t.toSequenceExpression(nodes,scope)};exports.VariableDeclaration=function(node,parent,file,scope){if(t.isForInStatement(parent)||t.isForOfStatement(parent))return;var nodes=[];var hasPattern=false;_.each(node.declarations,function(declar){if(t.isPattern(declar.id)){hasPattern=true;return false}});if(!hasPattern)return;_.each(node.declarations,function(declar){var patternId=declar.init;var pattern=declar.id;var opts={kind:node.kind,nodes:nodes,pattern:pattern,id:patternId,file:file,scope:scope};if(t.isPattern(pattern)&&patternId){pushPattern(opts)}else{nodes.push(buildVariableAssign(opts,declar.id,declar.init))}});if(!t.isProgram(parent)&&!t.isBlockStatement(parent)){var declar;_.each(nodes,function(node){declar=declar||t.variableDeclaration(node.kind,[]);if(!t.isVariableDeclaration(node)&&declar.kind!==node.kind){throw file.errorWithNode(node,"Cannot use this node within the current parent")}declar.declarations=declar.declarations.concat(node.declarations)});return declar}return nodes}},{"../../types":74,lodash:108}],44:[function(require,module,exports){var util=require("../../util");var t=require("../../types");exports.ForOfStatement=function(node,parent,file,scope){var left=node.left;var declar;var stepKey=file.generateUidIdentifier("step",scope);var stepValue=t.memberExpression(stepKey,t.identifier("value"));if(t.isIdentifier(left)){declar=t.expressionStatement(t.assignmentExpression("=",left,stepValue))}else if(t.isVariableDeclaration(left)){declar=t.variableDeclaration(left.kind,[t.variableDeclarator(left.declarations[0].id,stepValue)])}else{throw file.errorWithNode(left,"Unknown node type "+left.type+" in ForOfStatement")}var node2=util.template("for-of",{ITERATOR_KEY:file.generateUidIdentifier("iterator",scope),STEP_KEY:stepKey,OBJECT:node.right});t.ensureBlock(node);var block=node2.body;block.body.push(declar);block.body=block.body.concat(node.body.body);return node2}},{"../../types":74,"../../util":76}],45:[function(require,module,exports){var assert=require("assert");var loc=require("../util").loc;var t=require("../../../../types");exports.ParenthesizedExpression=function(expr,path,explodeViaTempVar,finish){return finish(this.explodeExpression(path.get("expression")))};exports.MemberExpression=function(expr,path,explodeViaTempVar,finish){return finish(t.memberExpression(this.explodeExpression(path.get("object")),expr.computed?explodeViaTempVar(null,path.get("property")):expr.property,expr.computed))};exports.CallExpression=function(expr,path,explodeViaTempVar,finish){var oldCalleePath=path.get("callee");var newCallee=this.explodeExpression(oldCalleePath);if(!t.isMemberExpression(oldCalleePath.node)&&t.isMemberExpression(newCallee)){newCallee=t.sequenceExpression([t.literal(0),newCallee])}return finish(t.callExpression(newCallee,path.get("arguments").map(function(argPath){return explodeViaTempVar(null,argPath)})))};exports.NewExpression=function(expr,path,explodeViaTempVar,finish){return finish(t.newExpression(explodeViaTempVar(null,path.get("callee")),path.get("arguments").map(function(argPath){return explodeViaTempVar(null,argPath)})))};exports.ObjectExpression=function(expr,path,explodeViaTempVar,finish){return finish(t.objectExpression(path.get("properties").map(function(propPath){return t.property(propPath.value.kind,propPath.value.key,explodeViaTempVar(null,propPath.get("value")))})))};exports.ArrayExpression=function(expr,path,explodeViaTempVar,finish){return finish(t.arrayExpression(path.get("elements").map(function(elemPath){return explodeViaTempVar(null,elemPath)})))};exports.SequenceExpression=function(expr,path,explodeViaTempVar,finish,ignoreResult){var lastIndex=expr.expressions.length-1;var self=this;var result;path.get("expressions").each(function(exprPath){if(exprPath.name===lastIndex){result=self.explodeExpression(exprPath,ignoreResult)}else{self.explodeExpression(exprPath,true)}});return result};exports.LogicalExpression=function(expr,path,explodeViaTempVar,finish,ignoreResult){var after=loc();var result;if(!ignoreResult){result=this.makeTempVar()}var left=explodeViaTempVar(result,path.get("left"));if(expr.operator==="&&"){this.jumpIfNot(left,after)}else{assert.strictEqual(expr.operator,"||");this.jumpIf(left,after)}explodeViaTempVar(result,path.get("right"),ignoreResult);this.mark(after);return result};exports.ConditionalExpression=function(expr,path,explodeViaTempVar,finish,ignoreResult){var elseLoc=loc();var after=loc();var test=this.explodeExpression(path.get("test"));var result;this.jumpIfNot(test,elseLoc);if(!ignoreResult){result=this.makeTempVar()}explodeViaTempVar(result,path.get("consequent"),ignoreResult);this.jump(after);this.mark(elseLoc);explodeViaTempVar(result,path.get("alternate"),ignoreResult);this.mark(after);return result};exports.UnaryExpression=function(expr,path,explodeViaTempVar,finish){return finish(t.unaryExpression(expr.operator,this.explodeExpression(path.get("argument")),!!expr.prefix))};exports.BinaryExpression=function(expr,path,explodeViaTempVar,finish){return finish(t.binaryExpression(expr.operator,explodeViaTempVar(null,path.get("left")),explodeViaTempVar(null,path.get("right"))))};exports.AssignmentExpression=function(expr,path,explodeViaTempVar,finish){return finish(t.assignmentExpression(expr.operator,this.explodeExpression(path.get("left")),this.explodeExpression(path.get("right"))))};exports.UpdateExpression=function(expr,path,explodeViaTempVar,finish){return finish(t.updateExpression(expr.operator,this.explodeExpression(path.get("argument")),expr.prefix))};exports.YieldExpression=function(expr,path){var after=loc();var arg=expr.argument&&this.explodeExpression(path.get("argument"));var result;if(arg&&expr.delegate){result=this.makeTempVar();this.emit(t.returnStatement(t.callExpression(this.contextProperty("delegateYield"),[arg,t.literal(result.property.name),after])));this.mark(after);return result}this.emitAssign(this.contextProperty("next"),after);this.emit(t.returnStatement(arg||null));this.mark(after);return this.contextProperty("sent")}},{"../../../../types":74,"../util":52,assert:93}],46:[function(require,module,exports){var assert=require("assert");var types=require("ast-types");var leap=require("../leap");var util=require("../util");var t=require("../../../../types");var runtimeKeysMethod=util.runtimeProperty("keys");var loc=util.loc;exports.ExpressionStatement=function(path){this.explodeExpression(path.get("expression"),true)};exports.LabeledStatement=function(path,stmt){this.explodeStatement(path.get("body"),stmt.label)};exports.WhileStatement=function(path,stmt,labelId){var before=loc();var after=loc();this.mark(before);this.jumpIfNot(this.explodeExpression(path.get("test")),after);this.leapManager.withEntry(new leap.LoopEntry(after,before,labelId),function(){this.explodeStatement(path.get("body"))});this.jump(before);this.mark(after)};exports.DoWhileStatement=function(path,stmt,labelId){var first=loc();var test=loc();var after=loc();this.mark(first);this.leapManager.withEntry(new leap.LoopEntry(after,test,labelId),function(){this.explode(path.get("body"))});this.mark(test);this.jumpIf(this.explodeExpression(path.get("test")),first);this.mark(after)};exports.ForStatement=function(path,stmt,labelId){var head=loc();var update=loc();var after=loc();if(stmt.init){this.explode(path.get("init"),true)}this.mark(head);if(stmt.test){this.jumpIfNot(this.explodeExpression(path.get("test")),after)}else{}this.leapManager.withEntry(new leap.LoopEntry(after,update,labelId),function(){this.explodeStatement(path.get("body"))});this.mark(update);if(stmt.update){this.explode(path.get("update"),true)}this.jump(head);this.mark(after)};exports.ForInStatement=function(path,stmt,labelId){t.assertIdentifier(stmt.left);var head=loc();var after=loc();var keyIterNextFn=this.makeTempVar();this.emitAssign(keyIterNextFn,t.callExpression(runtimeKeysMethod,[this.explodeExpression(path.get("right"))]));this.mark(head);var keyInfoTmpVar=this.makeTempVar();this.jumpIf(t.memberExpression(t.assignmentExpression("=",keyInfoTmpVar,t.callExpression(keyIterNextFn,[])),t.identifier("done"),false),after);this.emitAssign(stmt.left,t.memberExpression(keyInfoTmpVar,t.identifier("value"),false));this.leapManager.withEntry(new leap.LoopEntry(after,head,labelId),function(){this.explodeStatement(path.get("body"))});this.jump(head);this.mark(after)};exports.BreakStatement=function(path,stmt){this.emitAbruptCompletion({type:"break",target:this.leapManager.getBreakLoc(stmt.label)})};exports.ContinueStatement=function(path,stmt){this.emitAbruptCompletion({type:"continue",target:this.leapManager.getContinueLoc(stmt.label)})};exports.SwitchStatement=function(path,stmt){var disc=this.emitAssign(this.makeTempVar(),this.explodeExpression(path.get("discriminant")));var after=loc();var defaultLoc=loc();var condition=defaultLoc;var caseLocs=[];var self=this;var cases=stmt.cases||[];for(var i=cases.length-1;i>=0;--i){var c=cases[i];t.assertSwitchCase(c);if(c.test){condition=t.conditionalExpression(t.binaryExpression("===",disc,c.test),caseLocs[i]=loc(),condition)}else{caseLocs[i]=defaultLoc}}this.jump(this.explodeExpression(new types.NodePath(condition,path,"discriminant")));this.leapManager.withEntry(new leap.SwitchEntry(after),function(){path.get("cases").each(function(casePath){var i=casePath.name;self.mark(caseLocs[i]);casePath.get("consequent").each(self.explodeStatement,self)})});this.mark(after);if(defaultLoc.value===-1){this.mark(defaultLoc);assert.strictEqual(after.value,defaultLoc.value)}};exports.IfStatement=function(path,stmt){var elseLoc=stmt.alternate&&loc();var after=loc();this.jumpIfNot(this.explodeExpression(path.get("test")),elseLoc||after);this.explodeStatement(path.get("consequent"));if(elseLoc){this.jump(after);this.mark(elseLoc);this.explodeStatement(path.get("alternate"))}this.mark(after)};exports.ReturnStatement=function(path){this.emitAbruptCompletion({type:"return",value:this.explodeExpression(path.get("argument"))})};exports.TryStatement=function(path,stmt){var after=loc();var self=this;var handler=stmt.handler;if(!handler&&stmt.handlers){handler=stmt.handlers[0]||null}var catchLoc=handler&&loc();var catchEntry=catchLoc&&new leap.CatchEntry(catchLoc,handler.param);var finallyLoc=stmt.finalizer&&loc();var finallyEntry=finallyLoc&&new leap.FinallyEntry(finallyLoc);var tryEntry=new leap.TryEntry(this.getUnmarkedCurrentLoc(),catchEntry,finallyEntry);this.tryEntries.push(tryEntry);this.updateContextPrevLoc(tryEntry.firstLoc);this.leapManager.withEntry(tryEntry,function(){this.explodeStatement(path.get("block"));if(catchLoc){if(finallyLoc){this.jump(finallyLoc)}else{this.jump(after)}this.updateContextPrevLoc(self.mark(catchLoc));var bodyPath=path.get("handler","body");var safeParam=this.makeTempVar();this.clearPendingException(tryEntry.firstLoc,safeParam);var catchScope=bodyPath.scope;var catchParamName=handler.param.name;t.assertCatchClause(catchScope.node);assert.strictEqual(catchScope.lookup(catchParamName),catchScope);types.visit(bodyPath,{visitIdentifier:function(path){if(path.value.name===catchParamName&&path.scope.lookup(catchParamName)===catchScope){return safeParam}this.traverse(path)}});this.leapManager.withEntry(catchEntry,function(){this.explodeStatement(bodyPath)})}if(finallyLoc){this.updateContextPrevLoc(this.mark(finallyLoc));this.leapManager.withEntry(finallyEntry,function(){this.explodeStatement(path.get("finalizer"))});this.emit(t.callExpression(this.contextProperty("finish"),[finallyEntry.firstLoc]))}});this.mark(after)};exports.ThrowStatement=function(path){this.emit(t.throwStatement(this.explodeExpression(path.get("argument"))))}},{"../../../../types":74,"../leap":50,"../util":52,assert:93,"ast-types":91}],47:[function(require,module,exports){exports.Emitter=Emitter;var explodeExpressions=require("./explode-expressions");var explodeStatements=require("./explode-statements");var assert=require("assert");var types=require("ast-types");var leap=require("../leap");var meta=require("../meta");var util=require("../util");var t=require("../../../../types");var _=require("lodash");var loc=util.loc;var n=types.namedTypes;function Emitter(contextId){assert.ok(this instanceof Emitter);t.assertIdentifier(contextId);this.contextId=contextId;this.listing=[];this.marked=[true];this.finalLoc=loc();this.tryEntries=[];this.leapManager=new leap.LeapManager(this)}Emitter.prototype.mark=function(loc){t.assertLiteral(loc);var index=this.listing.length;if(loc.value===-1){loc.value=index}else{assert.strictEqual(loc.value,index)}this.marked[index]=true;return loc};Emitter.prototype.emit=function(node){if(t.isExpression(node))node=t.expressionStatement(node);t.assertStatement(node);this.listing.push(node)};Emitter.prototype.emitAssign=function(lhs,rhs){this.emit(this.assign(lhs,rhs));return lhs};Emitter.prototype.assign=function(lhs,rhs){return t.expressionStatement(t.assignmentExpression("=",lhs,rhs))};Emitter.prototype.contextProperty=function(name,computed){return t.memberExpression(this.contextId,computed?t.literal(name):t.identifier(name),!!computed)};var volatileContextPropertyNames={prev:true,next:true,sent:true,rval:true};Emitter.prototype.isVolatileContextProperty=function(expr){if(t.isMemberExpression(expr)){if(expr.computed){return true}if(t.isIdentifier(expr.object)&&t.isIdentifier(expr.property)&&expr.object.name===this.contextId.name&&_.has(volatileContextPropertyNames,expr.property.name)){return true}}return false};Emitter.prototype.stop=function(rval){if(rval){this.setReturnValue(rval)}this.jump(this.finalLoc)};Emitter.prototype.setReturnValue=function(valuePath){t.assertExpression(valuePath.value);this.emitAssign(this.contextProperty("rval"),this.explodeExpression(valuePath))};Emitter.prototype.clearPendingException=function(tryLoc,assignee){t.assertLiteral(tryLoc);var catchCall=t.callExpression(this.contextProperty("catch",true),[tryLoc]);if(assignee){this.emitAssign(assignee,catchCall)}else{this.emit(catchCall)}};Emitter.prototype.jump=function(toLoc){this.emitAssign(this.contextProperty("next"),toLoc);this.emit(t.breakStatement())};Emitter.prototype.jumpIf=function(test,toLoc){t.assertExpression(test);t.assertLiteral(toLoc);this.emit(t.ifStatement(test,t.blockStatement([this.assign(this.contextProperty("next"),toLoc),t.breakStatement()])))};Emitter.prototype.jumpIfNot=function(test,toLoc){t.assertExpression(test);t.assertLiteral(toLoc);var negatedTest;if(t.isUnaryExpression(test)&&test.operator==="!"){negatedTest=test.argument}else{negatedTest=t.unaryExpression("!",test)}this.emit(t.ifStatement(negatedTest,t.blockStatement([this.assign(this.contextProperty("next"),toLoc),t.breakStatement()])))};var nextTempId=0;Emitter.prototype.makeTempVar=function(){return this.contextProperty("t"+nextTempId++)};Emitter.prototype.getContextFunction=function(id){var node=t.functionExpression(id||null,[this.contextId],t.blockStatement([this.getDispatchLoop()]),false,false);node._aliasFunction=true;return node};Emitter.prototype.getDispatchLoop=function(){var self=this;var cases=[];var current;var alreadyEnded=false;self.listing.forEach(function(stmt,i){if(self.marked.hasOwnProperty(i)){cases.push(t.switchCase(t.literal(i),current=[]));alreadyEnded=false}if(!alreadyEnded){current.push(stmt);if(isSwitchCaseEnder(stmt))alreadyEnded=true}});this.finalLoc.value=this.listing.length;cases.push(t.switchCase(this.finalLoc,[]),t.switchCase(t.literal("end"),[t.returnStatement(t.callExpression(this.contextProperty("stop"),[]))]));return t.whileStatement(t.literal(true),t.switchStatement(t.assignmentExpression("=",this.contextProperty("prev"),this.contextProperty("next")),cases))};function isSwitchCaseEnder(stmt){return t.isBreakStatement(stmt)||t.isContinueStatement(stmt)||t.isReturnStatement(stmt)||t.isThrowStatement(stmt)}Emitter.prototype.getTryEntryList=function(){if(this.tryEntries.length===0){return null}var lastLocValue=0;return t.arrayExpression(this.tryEntries.map(function(tryEntry){var thisLocValue=tryEntry.firstLoc.value;assert.ok(thisLocValue>=lastLocValue,"try entries out of order");lastLocValue=thisLocValue;var ce=tryEntry.catchEntry;var fe=tryEntry.finallyEntry;var triple=[tryEntry.firstLoc,ce?ce.firstLoc:null];if(fe){triple[2]=fe.firstLoc}return t.arrayExpression(triple)}))};Emitter.prototype.explode=function(path,ignoreResult){assert.ok(path instanceof types.NodePath);var node=path.value;var self=this;n.Node.check(node);if(t.isStatement(node))return self.explodeStatement(path);if(t.isExpression(node))return self.explodeExpression(path,ignoreResult);if(t.isDeclaration(node))throw getDeclError(node);switch(node.type){case"Program":return path.get("body").map(self.explodeStatement,self);case"VariableDeclarator":throw getDeclError(node);case"Property":case"SwitchCase":case"CatchClause":throw new Error(node.type+" nodes should be handled by their parents");default:throw new Error("unknown Node of type "+JSON.stringify(node.type))}};function getDeclError(node){return new Error("all declarations should have been transformed into "+"assignments before the Exploder began its work: "+JSON.stringify(node))}Emitter.prototype.explodeStatement=function(path,labelId){assert.ok(path instanceof types.NodePath);var stmt=path.value;var self=this;t.assertStatement(stmt);if(labelId){t.assertIdentifier(labelId)}else{labelId=null}if(t.isBlockStatement(stmt)){return path.get("body").each(self.explodeStatement,self)}if(!meta.containsLeap(stmt)){self.emit(stmt);return}var fn=explodeStatements[stmt.type];if(fn){fn.call(this,path,stmt,labelId)}else{throw new Error("unknown Statement of type "+JSON.stringify(stmt.type))}};Emitter.prototype.emitAbruptCompletion=function(record){if(!isValidCompletion(record)){assert.ok(false,"invalid completion record: "+JSON.stringify(record))}assert.notStrictEqual(record.type,"normal","normal completions are not abrupt");var abruptArgs=[t.literal(record.type)];if(record.type==="break"||record.type==="continue"){t.assertLiteral(record.target);abruptArgs[1]=record.target}else if(record.type==="return"||record.type==="throw"){if(record.value){t.assertExpression(record.value);abruptArgs[1]=record.value}}this.emit(t.returnStatement(t.callExpression(this.contextProperty("abrupt"),abruptArgs)))};function isValidCompletion(record){var type=record.type;if(type==="normal"){return!_.has(record,"target")}if(type==="break"||type==="continue"){return!_.has(record,"value")&&t.isLiteral(record.target)}if(type==="return"||type==="throw"){return _.has(record,"value")&&!_.has(record,"target")}return false}Emitter.prototype.getUnmarkedCurrentLoc=function(){return t.literal(this.listing.length)};Emitter.prototype.updateContextPrevLoc=function(loc){if(loc){t.assertLiteral(loc);if(loc.value===-1){loc.value=this.listing.length}else{assert.strictEqual(loc.value,this.listing.length)}}else{loc=this.getUnmarkedCurrentLoc()}this.emitAssign(this.contextProperty("prev"),loc)};Emitter.prototype.explodeExpression=function(path,ignoreResult){assert.ok(path instanceof types.NodePath);var expr=path.value;if(expr){t.assertExpression(expr)}else{return expr}var self=this;function finish(expr){t.assertExpression(expr);if(ignoreResult){self.emit(expr)}else{return expr}}if(!meta.containsLeap(expr)){return finish(expr)}var hasLeapingChildren=meta.containsLeap.onlyChildren(expr);function explodeViaTempVar(tempVar,childPath,ignoreChildResult){assert.ok(childPath instanceof types.NodePath);assert.ok(!ignoreChildResult||!tempVar,"Ignoring the result of a child expression but forcing it to "+"be assigned to a temporary variable?");var result=self.explodeExpression(childPath,ignoreChildResult);if(ignoreChildResult){}else if(tempVar||hasLeapingChildren&&(self.isVolatileContextProperty(result)||meta.hasSideEffects(result))){result=self.emitAssign(tempVar||self.makeTempVar(),result)}return result}var fn=explodeExpressions[expr.type];if(fn){return fn.call(this,expr,path,explodeViaTempVar,finish,ignoreResult)}else{throw new Error("unknown Expression of type "+JSON.stringify(expr.type))}}},{"../../../../types":74,"../leap":50,"../meta":51,"../util":52,"./explode-expressions":45,"./explode-statements":46,assert:93,"ast-types":91,lodash:108}],48:[function(require,module,exports){var assert=require("assert");var types=require("ast-types");var t=require("../../../types");var _=require("lodash");exports.hoist=function(funPath){assert.ok(funPath instanceof types.NodePath);t.assertFunction(funPath.value);var vars={};function varDeclToExpr(vdec,includeIdentifiers){t.assertVariableDeclaration(vdec);var exprs=[];vdec.declarations.forEach(function(dec){vars[dec.id.name]=dec.id;if(dec.init){exprs.push(t.assignmentExpression("=",dec.id,dec.init))}else if(includeIdentifiers){exprs.push(dec.id)}});if(exprs.length===0)return null;if(exprs.length===1)return exprs[0];return t.sequenceExpression(exprs)}types.visit(funPath.get("body"),{visitVariableDeclaration:function(path){var expr=varDeclToExpr(path.value,false);if(expr===null){path.replace()}else{return t.expressionStatement(expr)}return false},visitForStatement:function(path){var init=path.value.init;if(t.isVariableDeclaration(init)){path.get("init").replace(varDeclToExpr(init,false))}this.traverse(path)},visitForInStatement:function(path){var left=path.value.left;if(t.isVariableDeclaration(left)){path.get("left").replace(varDeclToExpr(left,true))}this.traverse(path)},visitFunctionDeclaration:function(path){var node=path.value;vars[node.id.name]=node.id;var assignment=t.expressionStatement(t.assignmentExpression("=",node.id,t.functionExpression(node.id,node.params,node.body,node.generator,node.expression)));if(t.isBlockStatement(path.parent.node)){path.parent.get("body").unshift(assignment);path.replace()}else{path.replace(assignment)}return false},visitFunctionExpression:function(){return false}});var paramNames={};funPath.get("params").each(function(paramPath){var param=paramPath.value;if(t.isIdentifier(param)){paramNames[param.name]=param}else{}});var declarations=[];Object.keys(vars).forEach(function(name){if(!_.has(paramNames,name)){declarations.push(t.variableDeclarator(vars[name],null))}});if(declarations.length===0){return null}return t.variableDeclaration("var",declarations)}},{"../../../types":74,assert:93,"ast-types":91,lodash:108}],49:[function(require,module,exports){module.exports=require("./visit").transform},{"./visit":53}],50:[function(require,module,exports){exports.FunctionEntry=FunctionEntry;exports.FinallyEntry=FinallyEntry;exports.SwitchEntry=SwitchEntry;exports.LeapManager=LeapManager;exports.CatchEntry=CatchEntry;exports.LoopEntry=LoopEntry;exports.TryEntry=TryEntry;var assert=require("assert");var util=require("util");var t=require("../../../types");var inherits=util.inherits;function Entry(){assert.ok(this instanceof Entry)}function FunctionEntry(returnLoc){Entry.call(this);t.assertLiteral(returnLoc);this.returnLoc=returnLoc}inherits(FunctionEntry,Entry);function LoopEntry(breakLoc,continueLoc,label){Entry.call(this);t.assertLiteral(breakLoc);t.assertLiteral(continueLoc);if(label){t.assertIdentifier(label)}else{label=null}this.breakLoc=breakLoc;this.continueLoc=continueLoc;this.label=label}inherits(LoopEntry,Entry);function SwitchEntry(breakLoc){Entry.call(this);t.assertLiteral(breakLoc);this.breakLoc=breakLoc}inherits(SwitchEntry,Entry);function TryEntry(firstLoc,catchEntry,finallyEntry){Entry.call(this);t.assertLiteral(firstLoc);if(catchEntry){assert.ok(catchEntry instanceof CatchEntry)}else{catchEntry=null}if(finallyEntry){assert.ok(finallyEntry instanceof FinallyEntry)}else{finallyEntry=null}assert.ok(catchEntry||finallyEntry);this.firstLoc=firstLoc;this.catchEntry=catchEntry;this.finallyEntry=finallyEntry}inherits(TryEntry,Entry);function CatchEntry(firstLoc,paramId){Entry.call(this);t.assertLiteral(firstLoc);t.assertIdentifier(paramId);this.firstLoc=firstLoc;this.paramId=paramId}inherits(CatchEntry,Entry);function FinallyEntry(firstLoc){Entry.call(this);t.assertLiteral(firstLoc);this.firstLoc=firstLoc}inherits(FinallyEntry,Entry);function LeapManager(emitter){assert.ok(this instanceof LeapManager);var Emitter=require("./emit").Emitter;assert.ok(emitter instanceof Emitter);this.emitter=emitter;this.entryStack=[new FunctionEntry(emitter.finalLoc)]}LeapManager.prototype.withEntry=function(entry,callback){assert.ok(entry instanceof Entry);this.entryStack.push(entry);try{callback.call(this.emitter)}finally{var popped=this.entryStack.pop();assert.strictEqual(popped,entry)}};LeapManager.prototype._findLeapLocation=function(property,label){for(var i=this.entryStack.length-1;i>=0;--i){var entry=this.entryStack[i];var loc=entry[property];if(loc){if(label){if(entry.label&&entry.label.name===label.name){return loc}}else{return loc}}}return null};LeapManager.prototype.getBreakLoc=function(label){return this._findLeapLocation("breakLoc",label)};LeapManager.prototype.getContinueLoc=function(label){return this._findLeapLocation("continueLoc",label)}},{"../../../types":74,"./emit":47,assert:93,util:102}],51:[function(require,module,exports){var assert=require("assert");var types=require("ast-types");var m=require("private").makeAccessor();var _=require("lodash");var isArray=types.builtInTypes.array;var n=types.namedTypes;function makePredicate(propertyName,knownTypes){function onlyChildren(node){n.Node.check(node);var result=false;function check(child){if(result){}else if(isArray.check(child)){child.some(check)}else if(n.Node.check(child)){assert.strictEqual(result,false);result=predicate(child)}return result}types.eachField(node,function(name,child){check(child)});return result}function predicate(node){n.Node.check(node);var meta=m(node);if(_.has(meta,propertyName))return meta[propertyName];
if(_.has(opaqueTypes,node.type))return meta[propertyName]=false;if(_.has(knownTypes,node.type))return meta[propertyName]=true;return meta[propertyName]=onlyChildren(node)}predicate.onlyChildren=onlyChildren;return predicate}var opaqueTypes={FunctionExpression:true};var sideEffectTypes={CallExpression:true,ForInStatement:true,UnaryExpression:true,BinaryExpression:true,AssignmentExpression:true,UpdateExpression:true,NewExpression:true};var leapTypes={YieldExpression:true,BreakStatement:true,ContinueStatement:true,ReturnStatement:true,ThrowStatement:true};for(var type in leapTypes){if(_.has(leapTypes,type)){sideEffectTypes[type]=leapTypes[type]}}exports.hasSideEffects=makePredicate("hasSideEffects",sideEffectTypes);exports.containsLeap=makePredicate("containsLeap",leapTypes)},{assert:93,"ast-types":91,lodash:108,"private":109}],52:[function(require,module,exports){var t=require("../../../types");exports.runtimeProperty=function(name){return t.memberExpression(t.identifier("regeneratorRuntime"),t.identifier(name))};exports.loc=function(){return t.literal(-1)}},{"../../../types":74}],53:[function(require,module,exports){var runtimeProperty=require("./util").runtimeProperty;var Emitter=require("./emit").Emitter;var hoist=require("./hoist").hoist;var types=require("ast-types");var t=require("../../../types");var runtimeAsyncMethod=runtimeProperty("async");var runtimeWrapMethod=runtimeProperty("wrap");var runtimeMarkMethod=runtimeProperty("mark");exports.transform=function transform(node,file){return types.visit(node,{visitFunction:function(path){return visitor.call(this,path,file)}})};var visitor=function(path,file){this.traverse(path);var node=path.value;var scope;if(!node.generator&&!node.async){return}node.generator=false;if(node.expression){node.expression=false;node.body=t.blockStatement([t.returnStatement(node.body)])}if(node.async){awaitVisitor.visit(path.get("body"))}var outerFnId=node.id||(node.id=file.generateUidIdentifier("callee",scope));var innerFnId=t.identifier(node.id.name+"$");var contextId=file.generateUidIdentifier("context",scope);var vars=hoist(path);var emitter=new Emitter(contextId);emitter.explode(path.get("body"));var outerBody=[];if(vars&&vars.declarations.length>0){outerBody.push(vars)}var wrapArgs=[emitter.getContextFunction(innerFnId),node.async?t.literal(null):outerFnId,t.thisExpression()];var tryEntryList=emitter.getTryEntryList();if(tryEntryList){wrapArgs.push(tryEntryList)}var wrapCall=t.callExpression(node.async?runtimeAsyncMethod:runtimeWrapMethod,wrapArgs);outerBody.push(t.returnStatement(wrapCall));node.body=t.blockStatement(outerBody);if(node.async){node.async=false;return}if(t.isFunctionDeclaration(node)){var pp=path.parent;while(pp&&!(t.isBlockStatement(pp.value)||t.isProgram(pp.value))){pp=pp.parent}if(!pp){return}path.replace();node.type="FunctionExpression";var varDecl=t.variableDeclaration("var",[t.variableDeclarator(node.id,t.callExpression(runtimeMarkMethod,[node]))]);t.inheritsComments(varDecl,node);t.removeComments(node);varDecl._blockHoist=true;var bodyPath=pp.get("body");var bodyLen=bodyPath.value.length;for(var i=0;i<bodyLen;++i){var firstStmtPath=bodyPath.get(i);if(!shouldNotHoistAbove(firstStmtPath)){firstStmtPath.insertBefore(varDecl);return}}bodyPath.push(varDecl)}else{t.assertFunctionExpression(node);return t.callExpression(runtimeMarkMethod,[node])}};function shouldNotHoistAbove(stmtPath){var value=stmtPath.value;t.assertStatement(value);if(t.isExpressionStatement(value)&&t.isLiteral(value.expression)&&value.expression.value==="use strict"){return true}if(t.isVariableDeclaration(value)){for(var i=0;i<value.declarations.length;++i){var decl=value.declarations[i];if(t.isCallExpression(decl.init)&&types.astNodesAreEquivalent(decl.init.callee,runtimeMarkMethod)){return true}}}return false}var awaitVisitor=types.PathVisitor.fromMethodsObject({visitFunction:function(){return false},visitAwaitExpression:function(path){return t.yieldExpression(path.value.argument,false)}})},{"../../../types":74,"./emit":47,"./hoist":48,"./util":52,"ast-types":91}],54:[function(require,module,exports){var traverse=require("../../traverse");var util=require("../../util");var t=require("../../types");var _=require("lodash");var isLet=function(node){if(!t.isVariableDeclaration(node))return false;if(node._let)return true;if(node.kind!=="let")return false;node._let=true;node.kind="var";return true};var isVar=function(node){return t.isVariableDeclaration(node,{kind:"var"})&&!isLet(node)};var standardiseLets=function(declars){_.each(declars,function(declar){delete declar._let})};exports.VariableDeclaration=function(node){isLet(node)};exports.For=function(node,parent,file,scope){var init=node.left||node.init;if(isLet(init)){t.ensureBlock(node);node.body._letDeclars=[init]}if(t.isLabeledStatement(parent)){node.label=parent.label}var letScoping=new LetScoping(node,node.body,parent,file,scope);letScoping.run();if(node.label&&!t.isLabeledStatement(parent)){return t.labeledStatement(node.label,node)}};exports.BlockStatement=function(block,parent,file,scope){if(!t.isFor(parent)){var letScoping=new LetScoping(false,block,parent,file,scope);letScoping.run()}};function LetScoping(forParent,block,parent,file,scope){this.forParent=forParent;this.parent=parent;this.scope=scope;this.block=block;this.file=file;this.letReferences={};this.body=[]}LetScoping.prototype.run=function(){var block=this.block;if(block._letDone)return;block._letDone=true;this.info=this.getInfo();this.remap();if(t.isFunction(this.parent))return this.noClosure();if(!this.info.keys.length)return this.noClosure();var referencesInClosure=this.getLetReferences();if(!referencesInClosure)return this.noClosure();this.has=this.checkFor();this.hoistVarDeclarations();standardiseLets(this.info.declarators);var letReferences=_.values(this.letReferences);var fn=t.functionExpression(null,letReferences,t.blockStatement(block.body));fn._aliasFunction=true;block.body=this.body;var params=this.getParams(letReferences);var call=t.callExpression(fn,params);var ret=this.file.generateUidIdentifier("ret",this.scope);var hasYield=traverse.hasType(fn.body,"YieldExpression",t.FUNCTION_TYPES);if(hasYield){fn.generator=true;call=t.yieldExpression(call,true)}this.build(ret,call)};LetScoping.prototype.noClosure=function(){standardiseLets(this.info.declarators)};LetScoping.prototype.remap=function(){var replacements=this.info.duplicates;var block=this.block;if(_.isEmpty(replacements))return;var replace=function(node,parent,scope){if(!t.isIdentifier(node))return;if(!t.isReferenced(node,parent))return;if(scope&&scope.hasOwn(node.name))return;node.name=replacements[node.name]||node.name};var traverseReplace=function(node,parent){replace(node,parent);traverse(node,replace)};var forParent=this.forParent;if(forParent){traverseReplace(forParent.right,forParent);traverseReplace(forParent.test,forParent);traverseReplace(forParent.update,forParent)}traverse(block,replace)};LetScoping.prototype.getInfo=function(){var block=this.block;var scope=this.scope;var file=this.file;var opts={outsideKeys:[],declarators:block._letDeclars||[],duplicates:{},keys:[]};var duplicates=function(id,key){var has=scope.parentGet(key);if(has&&has!==id){opts.duplicates[key]=id.name=file.generateUid(key,scope)}};_.each(opts.declarators,function(declar){opts.declarators.push(declar);var keys=t.getIds(declar,true);_.each(keys,duplicates);keys=_.keys(keys);opts.outsideKeys=opts.outsideKeys.concat(keys);opts.keys=opts.keys.concat(keys)});_.each(block.body,function(declar){if(!isLet(declar))return;_.each(t.getIds(declar,true),function(id,key){duplicates(id,key);opts.keys.push(key)})});return opts};LetScoping.prototype.checkFor=function(){var has={hasContinue:false,hasReturn:false,hasBreak:false};var forParent=this.forParent;traverse(this.block,function(node){var replace;if(t.isFunction(node)||t.isFor(node)){return false}if(forParent&&node&&!node.label){if(t.isBreakStatement(node)){has.hasBreak=true;replace=t.returnStatement(t.literal("break"))}else if(t.isContinueStatement(node)){has.hasContinue=true;replace=t.returnStatement(t.literal("continue"))}}if(t.isReturnStatement(node)){has.hasReturn=true;replace=t.returnStatement(t.objectExpression([t.property("init",t.identifier("v"),node.argument||t.identifier("undefined"))]))}if(replace)return t.inherits(replace,node)});return has};LetScoping.prototype.hoistVarDeclarations=function(){var self=this;traverse(this.block,function(node){if(t.isForStatement(node)){if(isVar(node.init)){node.init=t.sequenceExpression(self.pushDeclar(node.init))}}else if(t.isFor(node)){if(isVar(node.left)){node.left=node.left.declarations[0].id}}else if(isVar(node)){return self.pushDeclar(node).map(t.expressionStatement)}else if(t.isFunction(node)){return false}})};LetScoping.prototype.getParams=function(params){var info=this.info;params=_.cloneDeep(params);_.each(params,function(param){param.name=info.duplicates[param.name]||param.name});return params};LetScoping.prototype.getLetReferences=function(){var closurify=false;var self=this;traverse(this.block,function(node,parent,scope){if(t.isFunction(node)){traverse(node,function(node,parent){if(!t.isIdentifier(node))return;if(!t.isReferenced(node,parent))return;if(scope.hasOwn(node.name))return;closurify=true;if(!_.contains(self.info.outsideKeys,node.name))return;self.letReferences[node.name]=node});return false}else if(t.isFor(node)){return false}});return closurify};LetScoping.prototype.pushDeclar=function(node){this.body.push(t.variableDeclaration(node.kind,node.declarations.map(function(declar){return t.variableDeclarator(declar.id)})));var replace=[];_.each(node.declarations,function(declar){if(!declar.init)return;var expr=t.assignmentExpression("=",declar.id,declar.init);replace.push(t.inherits(expr,declar))});return replace};LetScoping.prototype.build=function(ret,call){var has=this.has;if(has.hasReturn||has.hasBreak||has.hasContinue){this.buildHas(ret,call)}else{this.body.push(t.expressionStatement(call))}};LetScoping.prototype.buildHas=function(ret,call){var body=this.body;body.push(t.variableDeclaration("var",[t.variableDeclarator(ret,call)]));var forParent=this.forParent;var retCheck;var has=this.has;var cases=[];if(has.hasReturn){retCheck=util.template("let-scoping-return",{RETURN:ret})}if(has.hasBreak||has.hasContinue){var label=forParent.label=forParent.label||this.file.generateUidIdentifier("loop",this.scope);if(has.hasBreak){cases.push(t.switchCase(t.literal("break"),[t.breakStatement(label)]))}if(has.hasContinue){cases.push(t.switchCase(t.literal("continue"),[t.continueStatement(label)]))}if(has.hasReturn){cases.push(t.switchCase(null,[retCheck]))}if(cases.length===1){var single=cases[0];body.push(t.ifStatement(t.binaryExpression("===",ret,single.test),single.consequent[0]))}else{body.push(t.switchStatement(ret,cases))}}else{if(has.hasReturn)body.push(retCheck)}}},{"../../traverse":70,"../../types":74,"../../util":76,lodash:108}],55:[function(require,module,exports){var _=require("lodash");exports.ImportDeclaration=function(node,parent,file){var nodes=[];if(node.specifiers.length){_.each(node.specifiers,function(specifier){file.moduleFormatter.importSpecifier(specifier,node,nodes,parent)})}else{file.moduleFormatter.import(node,nodes,parent)}return nodes};exports.ExportDeclaration=function(node,parent,file){var nodes=[];if(node.declaration){file.moduleFormatter.export(node,nodes,parent)}else{_.each(node.specifiers,function(specifier){file.moduleFormatter.exportSpecifier(specifier,node,nodes,parent)})}return nodes}},{lodash:108}],56:[function(require,module,exports){exports.Property=function(node){if(!node.shorthand)return;node.shorthand=false}},{}],57:[function(require,module,exports){var t=require("../../types");exports.Function=function(node,parent,file){if(!node.rest)return;var rest=node.rest;delete node.rest;t.ensureBlock(node);var call=file.toArray(t.identifier("arguments"));if(node.params.length){call.arguments.push(t.literal(node.params.length))}call._ignoreAliasFunctions=true;node.body.body.unshift(t.variableDeclaration("var",[t.variableDeclarator(rest,call)]))}},{"../../types":74}],58:[function(require,module,exports){var t=require("../../types");var _=require("lodash");var getSpreadLiteral=function(spread,file){return file.toArray(spread.argument)};var hasSpread=function(nodes){var has=false;_.each(nodes,function(node){if(t.isSpreadElement(node)){has=true;return false}});return has};var build=function(props,file){var nodes=[];var _props=[];var push=function(){if(!_props.length)return;nodes.push(t.arrayExpression(_props));_props=[]};_.each(props,function(prop){if(t.isSpreadElement(prop)){push();nodes.push(getSpreadLiteral(prop,file))}else{_props.push(prop)}});push();return nodes};exports.ArrayExpression=function(node,parent,file){var elements=node.elements;if(!hasSpread(elements))return;var nodes=build(elements,file);var first=nodes.shift();if(!t.isArrayExpression(first)){nodes.unshift(first);first=t.arrayExpression([])}return t.callExpression(t.memberExpression(first,t.identifier("concat")),nodes)};exports.CallExpression=function(node,parent,file){var args=node.arguments;if(!hasSpread(args))return;var contextLiteral=t.literal(null);node.arguments=[];var nodes;if(args.length===1&&args[0].argument.name==="arguments"){nodes=[args[0].argument]}else{nodes=build(args,file)}var first=nodes.shift();if(nodes.length){node.arguments.push(t.callExpression(t.memberExpression(first,t.identifier("concat")),nodes))}else{node.arguments.push(first)}var callee=node.callee;if(t.isMemberExpression(callee)){contextLiteral=callee.object;if(callee.computed){callee.object=t.memberExpression(callee.object,callee.property,true);callee.property=t.identifier("apply");callee.computed=false}else{callee.property=t.memberExpression(callee.property,t.identifier("apply"))}}else{node.callee=t.memberExpression(node.callee,t.identifier("apply"))}node.arguments.unshift(contextLiteral)};exports.NewExpression=function(node,parent,file){var args=node.arguments;if(!hasSpread(args))return;var nodes=build(args,file);var first=nodes.shift();if(nodes.length){args=t.callExpression(t.memberExpression(first,t.identifier("concat")),nodes)}else{args=first}return t.callExpression(file.addDeclaration("apply-constructor"),[node.callee,args])}},{"../../types":74,lodash:108}],59:[function(require,module,exports){var t=require("../../types");var _=require("lodash");var buildBinaryExpression=function(left,right){return t.binaryExpression("+",left,right)};exports.TaggedTemplateExpression=function(node,parent,file){var args=[];var quasi=node.quasi;var strings=[];var raw=[];_.each(quasi.quasis,function(elem){strings.push(t.literal(elem.value.cooked));raw.push(t.literal(elem.value.raw))});args.push(t.callExpression(file.addDeclaration("tagged-template-literal"),[t.arrayExpression(strings),t.arrayExpression(raw)]));args=args.concat(quasi.expressions);return t.callExpression(node.tag,args)};exports.TemplateLiteral=function(node){var nodes=[];_.each(node.quasis,function(elem){nodes.push(t.literal(elem.value.raw));var expr=node.expressions.shift();if(expr){if(t.isBinary(expr))expr=t.parenthesizedExpression(expr);nodes.push(expr)}});if(nodes.length>1){var last=_.last(nodes);if(t.isLiteral(last,{value:""}))nodes.pop();var root=buildBinaryExpression(nodes.shift(),nodes.shift());_.each(nodes,function(node){root=buildBinaryExpression(root,node)});return root}else{return nodes[0]}}},{"../../types":74,lodash:108}],60:[function(require,module,exports){var rewritePattern=require("regexpu/rewrite-pattern");var _=require("lodash");exports.Literal=function(node){var regex=node.regex;if(!regex)return;var flags=regex.flags.split("");if(!_.contains(regex.flags,"u"))return;_.pull(flags,"u");regex.pattern=rewritePattern(regex.pattern,regex.flags);regex.flags=flags.join("")}},{lodash:108,"regexpu/rewrite-pattern":115}],61:[function(require,module,exports){var util=require("../../util");var t=require("../../types");var container=function(parent,call,ret){if(t.isExpressionStatement(parent)){return call}else{var exprs=[];if(t.isSequenceExpression(call)){exprs=call.expressions}else{exprs.push(call)}exprs.push(ret);return t.sequenceExpression(exprs)}};exports.AssignmentExpression=function(node,parent,file,scope){var left=node.left;if(!t.isVirtualPropertyExpression(left))return;var value=node.right;var temp;if(!t.isExpressionStatement(parent)){if(t.isDynamic(value)){var tempName=file.generateUid("temp");temp=value=t.identifier(tempName);scope.push({key:tempName,id:temp})}}var call=util.template("abstract-expression-set",{PROPERTY:left.property,OBJECT:left.object,VALUE:value});if(temp){call=t.sequenceExpression([t.assignmentExpression("=",temp,node.right),call])}return container(parent,call,value)};exports.UnaryExpression=function(node,parent){var arg=node.argument;if(!t.isVirtualPropertyExpression(arg))return;if(node.operator!=="delete")return;var call=util.template("abstract-expression-delete",{PROPERTY:arg.property,OBJECT:arg.object});return container(parent,call,t.literal(true))};exports.CallExpression=function(node,parent,file,scope){var callee=node.callee;if(!t.isVirtualPropertyExpression(callee))return;var temp;if(t.isDynamic(callee.object)){var tempName=file.generateUid("temp");temp=t.identifier(tempName);scope.push({key:tempName,id:temp})}var call=util.template("abstract-expression-call",{PROPERTY:callee.property,OBJECT:temp||callee.object});call.arguments=call.arguments.concat(node.arguments);if(temp){return t.sequenceExpression([t.assignmentExpression("=",temp,callee.object),call])}else{return call}};exports.VirtualPropertyExpression=function(node){return util.template("abstract-expression-get",{PROPERTY:node.property,OBJECT:node.object})}},{"../../types":74,"../../util":76}],62:[function(require,module,exports){var util=require("../../util");var t=require("../../types");var _=require("lodash");var single=function(node,file){var block=node.blocks[0];var templateName="array-expression-comprehension-map";if(node.filter)templateName="array-expression-comprehension-filter";var result=util.template(templateName,{STATEMENT:node.body,FILTER:node.filter,ARRAY:file.toArray(block.right),KEY:block.left});_.each([result.callee.object,result],function(call){if(t.isCallExpression(call)){call.arguments[0]._aliasFunction=true}});return result};var multiple=function(node,file){var uid=file.generateUidIdentifier("arr");var container=util.template("array-comprehension-container",{KEY:uid});container.callee.expression._aliasFunction=true;var block=container.callee.expression.body;var body=block.body;var returnStatement=body.pop();body.push(exports._build(node,function(){return util.template("array-push",{STATEMENT:node.body,KEY:uid},true)}));body.push(returnStatement);return container};exports._build=function(node,buildBody){var self=node.blocks.shift();if(!self)return;var child=exports._build(node,buildBody);if(!child){child=buildBody();if(node.filter){child=t.ifStatement(node.filter,t.blockStatement([child]))}}return t.forOfStatement(t.variableDeclaration("var",[t.variableDeclarator(self.left)]),self.right,t.blockStatement([child]))};exports.ComprehensionExpression=function(node,parent,file){if(node.generator)return;if(node.blocks.length===1){return single(node,file)}else{return multiple(node,file)}}},{"../../types":74,"../../util":76,lodash:108}],63:[function(require,module,exports){var t=require("../../types");var pow=t.memberExpression(t.identifier("Math"),t.identifier("pow"));exports.AssignmentExpression=function(node){if(node.operator!=="**=")return;node.operator="=";node.right=t.callExpression(pow,[node.left,node.right])};exports.BinaryExpression=function(node){if(node.operator!=="**")return;return t.callExpression(pow,[node.left,node.right])}},{"../../types":74}],64:[function(require,module,exports){var arrayComprehension=require("./es7-array-comprehension");var t=require("../../types");exports.ComprehensionExpression=function(node){if(!node.generator)return;var body=[];var container=t.functionExpression(null,[],t.blockStatement(body),true);body.push(arrayComprehension._build(node,function(){return t.expressionStatement(t.yieldExpression(node.body))}));return t.callExpression(container,[])}},{"../../types":74,"./es7-array-comprehension":62}],65:[function(require,module,exports){var t=require("../../types");var _=require("lodash");exports.ObjectExpression=function(node){var hasSpread=false;_.each(node.properties,function(prop){if(t.isSpreadProperty(prop)){hasSpread=true;return false}});if(!hasSpread)return;var args=[];var props=[];var push=function(){if(!props.length)return;args.push(t.objectExpression(props));props=[]};_.each(node.properties,function(prop){if(t.isSpreadProperty(prop)){push();args.push(prop.argument)}else{props.push(prop)}});push();if(!t.isObjectExpression(args[0])){args.unshift(t.objectExpression([]))}return t.callExpression(t.memberExpression(t.identifier("Object"),t.identifier("assign")),args)}},{"../../types":74,lodash:108}],66:[function(require,module,exports){var t=require("../../types");var isMemo=function(node){var is=t.isAssignmentExpression(node)&&node.operator==="?=";if(is)t.assertMemberExpression(node.left);return is};var getPropRef=function(nodes,prop,file,scope){if(t.isIdentifier(prop)){return t.literal(prop.name)}else{var temp=file.generateUidIdentifier("propKey",scope);nodes.push(t.variableDeclaration("var",[t.variableDeclarator(temp,prop)]));return temp}};var getObjRef=function(nodes,obj,file,scope){if(t.isDynamic(obj)){var temp=file.generateUidIdentifier("obj",scope);nodes.push(t.variableDeclaration("var",[t.variableDeclarator(temp,obj)]));return temp}else{return obj}};var buildHasOwn=function(obj,prop,file){return t.unaryExpression("!",t.callExpression(t.memberExpression(file.addDeclaration("has-own"),t.identifier("call")),[obj,prop]),true)};var buildAbsoluteRef=function(left,obj,prop){var computed=left.computed||t.isLiteral(prop);return t.memberExpression(obj,prop,computed)};var buildAssignment=function(expr,obj,prop){return t.assignmentExpression("=",buildAbsoluteRef(expr.left,obj,prop),expr.right)};exports.ExpressionStatement=function(node,parent,file,scope){var expr=node.expression;if(!isMemo(expr))return;var nodes=[];var left=expr.left;var obj=getObjRef(nodes,left.object,file,scope);var prop=getPropRef(nodes,left.property,file,scope);nodes.push(t.ifStatement(buildHasOwn(obj,prop,file),t.expressionStatement(buildAssignment(expr,obj,prop))));return nodes};exports.AssignmentExpression=function(node,parent,file,scope){if(t.isExpressionStatement(parent))return;if(!isMemo(node))return;var nodes=[];var left=node.left;var obj=getObjRef(nodes,left.object,file,scope);var prop=getPropRef(nodes,left.property,file,scope);nodes.push(t.logicalExpression("&&",buildHasOwn(obj,prop,file),buildAssignment(node,obj,prop)));nodes.push(buildAbsoluteRef(left,obj,prop));return t.toSequenceExpression(nodes,scope)}},{"../../types":74}],67:[function(require,module,exports){var t=require("../../types");var _=require("lodash");exports.BindMemberExpression=function(node,parent,file,scope){var object=node.object;var prop=node.property;var temp;if(t.isDynamic(object)){var tempName=file.generateUid("temp",scope);temp=object=t.identifier(tempName);scope.push({key:tempName,id:temp})}var call=t.callExpression(t.memberExpression(t.memberExpression(object,prop),t.identifier("bind")),[object].concat(node.arguments));if(temp){return t.sequenceExpression([t.assignmentExpression("=",temp,node.object),call])}else{return call}};exports.BindFunctionExpression=function(node,parent,file,scope){var buildCall=function(args){var param=file.generateUidIdentifier("val",scope);return t.functionExpression(null,[param],t.blockStatement([t.returnStatement(t.callExpression(t.memberExpression(param,node.callee),args))]))};if(_.find(node.arguments,t.isDynamic)){var argsIdName=file.generateUid("args",scope);var argsId=t.identifier(argsIdName);scope.push({key:argsIdName,id:argsId});return t.sequenceExpression([t.assignmentExpression("=",argsId,t.arrayExpression(node.arguments)),buildCall(node.arguments.map(function(node,i){return t.memberExpression(argsId,t.literal(i),true)}))])}else{return buildCall(node.arguments)}}},{"../../types":74,lodash:108}],68:[function(require,module,exports){var esutils=require("esutils");var t=require("../../types");var _=require("lodash");exports.XJSIdentifier=function(node){if(esutils.keyword.isIdentifierName(node.name)){node.type="Identifier"}else{return t.literal(node.name)}};exports.XJSNamespacedName=function(node,parent,file){throw file.errorWithNode(node,"Namespace tags are not supported. ReactJSX is not XML.")};exports.XJSMemberExpression={exit:function(node){node.computed=t.isLiteral(node.property);node.type="MemberExpression"}};exports.XJSExpressionContainer=function(node){return node.expression};exports.XJSAttribute={exit:function(node){var value=node.value||t.literal(true);return t.property("init",node.name,value)}};exports.XJSOpeningElement={exit:function(node){var tagExpr=node.name;var args=[];var tagName;if(t.isIdentifier(tagExpr)){tagName=tagExpr.name}else if(t.isLiteral(tagExpr)){tagName=tagExpr.value}if(tagName&&(/[a-z]/.exec(tagName[0])||_.contains(tagName,"-"))){args.push(t.literal(tagName))}else{args.push(tagExpr)}var props=node.attributes;if(props.length){var _props=[];var objs=[];var pushProps=function(){if(!_props.length)return;objs.push(t.objectExpression(_props));_props=[]};while(props.length){var prop=props.shift();if(t.isXJSSpreadAttribute(prop)){pushProps();objs.push(prop.argument)}else{_props.push(prop)}}pushProps();if(objs.length===1){props=objs[0]}else{if(!t.isObjectExpression(objs[0])){objs.unshift(t.objectExpression([]))}props=t.callExpression(t.memberExpression(t.identifier("React"),t.identifier("__spread")),objs)}}else{props=t.literal(null)}args.push(props);tagExpr=t.memberExpression(t.identifier("React"),t.identifier("createElement"));return t.callExpression(tagExpr,args)}};exports.XJSElement={exit:function(node){var callExpr=node.openingElement;_.each(node.children,function(child){if(t.isLiteral(child)){var lines=child.value.split(/\r\n|\n|\r/);_.each(lines,function(line,i){var isFirstLine=i===0;var isLastLine=i===lines.length-1;var trimmedLine=line.replace(/\t/g," ");if(!isFirstLine){trimmedLine=trimmedLine.replace(/^[ ]+/,"")}if(!isLastLine){trimmedLine=trimmedLine.replace(/[ ]+$/,"")}if(trimmedLine){callExpr.arguments.push(t.literal(trimmedLine))}});return}else if(t.isXJSEmptyExpression(child)){return}callExpr.arguments.push(child)});return t.inherits(callExpr,node)}};var addDisplayName=function(id,call){if(!call||!t.isCallExpression(call))return;var callee=call.callee;if(!t.isMemberExpression(callee))return;var obj=callee.object;if(!t.isIdentifier(obj,{name:"React"}))return;var prop=callee.property;if(!t.isIdentifier(prop,{name:"createClass"}))return;var args=call.arguments;if(args.length!==1)return;var first=args[0];if(!t.isObjectExpression(first))return;var props=first.properties;var safe=true;_.each(props,function(prop){if(t.isIdentifier(prop.key,{name:"displayName"})){return safe=false}});if(safe){props.unshift(t.property("init",t.identifier("displayName"),t.literal(id)))}};exports.AssignmentExpression=exports.Property=exports.VariableDeclarator=function(node){var left,right;if(t.isAssignmentExpression(node)){left=node.left;right=node.right}else if(t.isProperty(node)){left=node.key;right=node.value}else if(t.isVariableDeclarator(node)){left=node.id;right=node.init}if(t.isMemberExpression(left)){left=left.property}if(t.isIdentifier(left)){addDisplayName(left.name,right)}}},{"../../types":74,esutils:107,lodash:108}],69:[function(require,module,exports){var t=require("../../types");module.exports=function(ast){var body=ast.program.body;var first=body[0];var noStrict=!first||!t.isExpressionStatement(first)||!t.isLiteral(first.expression)||first.expression.value!=="use strict";if(noStrict){body.unshift(t.expressionStatement(t.literal("use strict")))}}},{"../../types":74}],70:[function(require,module,exports){module.exports=traverse;var Scope=require("./scope");var t=require("../types");var _=require("lodash");function traverse(parent,callbacks,opts){if(!parent)return;if(_.isArray(parent)){_.each(parent,function(node){traverse(node,callbacks,opts)});return}var keys=t.VISITOR_KEYS[parent.type];if(!keys)return;opts=opts||{};if(_.isArray(opts))opts={blacklist:opts};var blacklistTypes=opts.blacklist||[];if(_.isFunction(callbacks))callbacks={enter:callbacks};for(var i in keys){var key=keys[i];var nodes=parent[key];if(!nodes)continue;var updated=false;var handle=function(obj,key){var node=obj[key];if(!node)return;if(blacklistTypes.indexOf(node.type)>-1)return;var maybeReplace=function(result){if(result===false)return;if(result!=null){updated=true;node=obj[key]=result;if(_.isArray(result)&&_.contains(t.STATEMENT_OR_BLOCK_KEYS,key)&&!t.isBlockStatement(obj)){t.ensureBlock(obj,key)}}};var opts2={scope:opts.scope,blacklist:opts.blacklist};if(t.isScope(node))opts2.scope=new Scope(node,opts.scope);if(callbacks.enter){var result=callbacks.enter(node,parent,opts2.scope);maybeReplace(result);if(result===false)return}traverse(node,callbacks,opts2);if(callbacks.exit){maybeReplace(callbacks.exit(node,parent,opts2.scope))}};if(_.isArray(nodes)){for(i in nodes){handle(nodes,i)}if(updated)parent[key]=_.flatten(parent[key])}else{handle(parent,key)}}}traverse.removeProperties=function(tree){var clear=function(node){delete node._scopeReferences;delete node._declarations;delete node.extendedRange;delete node._parent;delete node._scope;delete node.tokens;delete node.range;delete node.start;delete node.end;delete node.loc;delete node.raw;clearComments(node.trailingComments);clearComments(node.leadingComments)};var clearComments=function(comments){_.each(comments,clear)};clear(tree);traverse(tree,clear);return tree};traverse.hasType=function(tree,type,blacklistTypes){blacklistTypes=[].concat(blacklistTypes||[]);var has=false;if(_.contains(blacklistTypes,tree.type))return false;if(tree.type===type)return true;traverse(tree,function(node){if(node.type===type){has=true;return false}},{blacklist:blacklistTypes});return has}},{"../types":74,"./scope":71,lodash:108}],71:[function(require,module,exports){module.exports=Scope;var traverse=require("./index");var t=require("../types");var _=require("lodash");var FOR_KEYS=["left","init"];function Scope(block,parent){this.parent=parent;this.block=block;this.references=this.getReferences()}Scope.add=function(node,references){if(!node)return;_.merge(references,t.getIds(node,true))};Scope.prototype.getReferences=function(){var block=this.block;if(block._scopeReferences)return block._scopeReferences;var references=block._scopeReferences={};var add=function(node){Scope.add(node,references)};if(t.isFor(block)){_.each(FOR_KEYS,function(key){var node=block[key];if(t.isLet(node))add(node)});block=block.body}if(t.isBlockStatement(block)||t.isProgram(block)){_.each(block.body,function(node){if(t.isLet(node))add(node)})}if(t.isCatchClause(block)){add(block.param)}if(t.isProgram(block)||t.isFunction(block)){traverse(block,function(node,parent,scope){if(t.isFor(node)){_.each(FOR_KEYS,function(key){var declar=node[key];if(t.isVar(declar))add(declar)})}if(t.isFunction(node))return false;if(t.isIdentifier(node)&&t.isReferenced(node,parent)&&!scope.has(node.name)){add(node)}if(t.isDeclaration(node)&&!t.isLet(node)){add(node)}},{scope:this})}if(t.isFunction(block)){add(block.rest);_.each(block.params,function(param){add(param)})}return references};Scope.prototype.push=function(opts){var block=this.block;if(t.isFor(block)||t.isCatchClause(block)||t.isFunction(block)){t.ensureBlock(block);block=block.body}if(t.isBlockStatement(block)||t.isProgram(block)){block._declarations=block._declarations||{};block._declarations[opts.key]={kind:opts.kind,id:opts.id,init:opts.init}}else{throw new TypeError("cannot add a declaration here in node type "+block.type)}};Scope.prototype.add=function(node){Scope.add(node,this.references)};Scope.prototype.get=function(id){return id&&(this.getOwn(id)||this.parentGet(id))
};Scope.prototype.getOwn=function(id){return _.has(this.references,id)&&this.references[id]};Scope.prototype.parentGet=function(id){return this.parent&&this.parent.get(id)};Scope.prototype.has=function(id){return id&&(this.hasOwn(id)||this.parentHas(id))};Scope.prototype.hasOwn=function(id){return!!this.getOwn(id)};Scope.prototype.parentHas=function(id){return this.parent&&this.parent.has(id)}},{"../types":74,"./index":70,lodash:108}],72:[function(require,module,exports){module.exports={ExpressionStatement:["Statement"],BreakStatement:["Statement"],ContinueStatement:["Statement"],DebuggerStatement:["Statement"],DoWhileStatement:["Statement"],IfStatement:["Statement"],ReturnStatement:["Statement"],SwitchStatement:["Statement"],ThrowStatement:["Statement"],TryStatement:["Statement"],WhileStatement:["Statement"],WithStatement:["Statement"],EmptyStatement:["Statement"],LabeledStatement:["Statement"],VariableDeclaration:["Statement","Declaration"],ExportDeclaration:["Statement","Declaration"],ImportDeclaration:["Statement","Declaration"],ArrowFunctionExpression:["Scope","Function"],FunctionDeclaration:["Statement","Declaration","Scope","Function"],FunctionExpression:["Scope","Function"],BlockStatement:["Statement","Scope"],Program:["Scope"],CatchClause:["Scope"],LogicalExpression:["Binary"],BinaryExpression:["Binary"],UnaryExpression:["UnaryLike"],SpreadProperty:["UnaryLike"],SpreadElement:["UnaryLike"],ClassDeclaration:["Statement","Declaration","Class"],ClassExpression:["Class"],ForOfStatement:["Statement","For","Scope"],ForInStatement:["Statement","For","Scope"],ForStatement:["Statement","For","Scope"],ObjectPattern:["Pattern"],ArrayPattern:["Pattern"],Property:["UserWhitespacable"],XJSElement:["UserWhitespacable"]}},{}],73:[function(require,module,exports){module.exports={ArrayExpression:["elements"],AssignmentExpression:["operator","left","right"],BinaryExpression:["operator","left","right"],BlockStatement:["body"],CallExpression:["callee","arguments"],ConditionalExpression:["test","consequent","alternate"],ExpressionStatement:["expression"],File:["program","comments","tokens"],FunctionExpression:["id","params","body","generator"],Identifier:["name"],IfStatement:["test","consequent","alternate"],Literal:["value"],LogicalExpression:["operator","left","right"],MemberExpression:["object","property","computed"],NewExpression:["callee","arguments"],ObjectExpression:["properties"],ParenthesizedExpression:["expression"],Program:["body"],Property:["kind","key","value","computed"],ReturnStatement:["argument"],SequenceExpression:["expressions"],ThrowExpression:["argument"],UnaryExpression:["operator","argument","prefix"],VariableDeclaration:["kind","declarations"],VariableDeclarator:["id","init"],YieldExpression:["argument","delegate"]}},{}],74:[function(require,module,exports){var esutils=require("esutils");var _=require("lodash");var t=exports;var addAssert=function(type,is){t["assert"+type]=function(node,opts){opts=opts||{};if(!is(node,opts)){throw new Error("Expected type "+JSON.stringify(type)+" with option "+JSON.stringify(opts))}}};t.STATEMENT_OR_BLOCK_KEYS=["consequent","body"];t.VISITOR_KEYS=require("./visitor-keys");_.each(t.VISITOR_KEYS,function(keys,type){var is=t["is"+type]=function(node,opts){return node&&node.type===type&&t.shallowEqual(node,opts)};addAssert(type,is)});t.BUILDER_KEYS=_.defaults(require("./builder-keys"),t.VISITOR_KEYS);_.each(t.BUILDER_KEYS,function(keys,type){t[type[0].toLowerCase()+type.slice(1)]=function(){var args=arguments;var node={type:type};_.each(keys,function(key,i){node[key]=args[i]});return node}});t.ALIAS_KEYS=require("./alias-keys");var _aliases={};_.each(t.ALIAS_KEYS,function(aliases,type){_.each(aliases,function(alias){var types=_aliases[alias]=_aliases[alias]||[];types.push(type)})});_.each(_aliases,function(types,type){t[type.toUpperCase()+"_TYPES"]=types;var is=t["is"+type]=function(node,opts){return node&&_.contains(types,node.type)&&t.shallowEqual(node,opts)};addAssert(type,is)});t.isExpression=function(node){return!t.isStatement(node)};addAssert("Expression",t.isExpression);t.toSequenceExpression=function(nodes,scope){var exprs=[];_.each(nodes,function(node){if(t.isExpression(node)){exprs.push(node)}if(t.isExpressionStatement(node)){exprs.push(node.expression)}else if(t.isVariableDeclaration(node)){_.each(node.declarations,function(declar){scope.push({kind:node.kind,key:declar.id.name,id:declar.id});exprs.push(t.assignmentExpression("=",declar.id,declar.init))})}});return t.sequenceExpression(exprs)};t.shallowEqual=function(actual,expected){var same=true;if(expected){_.each(expected,function(val,key){if(actual[key]!==val){return same=false}})}return same};t.isDynamic=function(node){if(t.isParenthesizedExpression(node)||t.isExpressionStatement(node)){return t.isDynamic(node.expression)}else if(t.isIdentifier(node)||t.isLiteral(node)||t.isThisExpression(node)){return false}else if(t.isMemberExpression(node)){return t.isDynamic(node.object)||t.isDynamic(node.property)}else{return true}};t.isReferenced=function(node,parent){if(t.isProperty(parent)&&parent.key===node)return false;if(t.isVariableDeclarator(parent)&&parent.id===node)return false;var isMemberExpression=t.isMemberExpression(parent);var isComputedProperty=isMemberExpression&&parent.property===node&&parent.computed;var isObject=isMemberExpression&&parent.object===node;if(!isMemberExpression||isComputedProperty||isObject)return true;return false};t.toIdentifier=function(name){if(t.isIdentifier(name))return name.name;name=name.replace(/[^a-zA-Z0-9]/g,"-");name=name.replace(/^[-0-9]+/,"");name=name.replace(/[-_\s]+(.)?/g,function(match,c){return c?c.toUpperCase():""});return name};t.isValidIdentifier=function(name){return _.isString(name)&&esutils.keyword.isIdentifierName(name)&&!esutils.keyword.isKeywordES6(name,true)};t.ensureBlock=function(node,key){key=key||"body";node[key]=t.toBlock(node[key],node)};t.toStatement=function(node,ignore){if(t.isStatement(node)){return node}var mustHaveId=false;var newType;if(t.isClass(node)){mustHaveId=true;newType="ClassDeclaration"}else if(t.isFunction(node)){mustHaveId=true;newType="FunctionDeclaration"}if(mustHaveId&&!node.id){newType=false}if(!newType){if(ignore){return false}else{throw new Error("cannot turn "+node.type+" to a statement")}}node.type=newType;return node};t.toBlock=function(node,parent){if(t.isBlockStatement(node)){return node}if(!_.isArray(node)){if(!t.isStatement(node)){if(t.isFunction(parent)){node=t.returnStatement(node)}else{node=t.expressionStatement(node)}}node=[node]}return t.blockStatement(node)};t.getIds=function(node,map,ignoreTypes){ignoreTypes=ignoreTypes||[];var search=[].concat(node);var ids={};while(search.length){var id=search.shift();if(!id)continue;if(_.contains(ignoreTypes,id.type))continue;var nodeKey=t.getIds.nodes[id.type];var arrKey=t.getIds.arrays[id.type];if(t.isIdentifier(id)){ids[id.name]=id}else if(nodeKey){if(id[nodeKey])search.push(id[nodeKey])}else if(arrKey){search=search.concat(id[arrKey]||[])}}if(!map)ids=_.keys(ids);return ids};t.getIds.nodes={AssignmentExpression:"left",ImportSpecifier:"id",ExportSpecifier:"id",VariableDeclarator:"id",FunctionDeclaration:"id",ClassDeclaration:"id",ParenthesizedExpression:"expression",MemeberExpression:"object",SpreadElement:"argument",Property:"value"};t.getIds.arrays={ExportDeclaration:"specifiers",ImportDeclaration:"specifiers",VariableDeclaration:"declarations",ArrayPattern:"elements",ObjectPattern:"properties"};t.isLet=function(node){return t.isVariableDeclaration(node)&&(node.kind!=="var"||node._let)};t.isVar=function(node){return t.isVariableDeclaration(node,{kind:"var"})&&!node._let};t.removeComments=function(child){delete child.leadingComments;delete child.trailingComments;return child};t.inheritsComments=function(child,parent){child.leadingComments=_.compact([].concat(child.leadingComments,parent.leadingComments));child.trailingComments=_.compact([].concat(child.trailingComments,parent.trailingComments));return child};t.removeComments=function(node){delete node.leadingComments;delete node.trailingComments};t.inherits=function(child,parent){child.loc=parent.loc;child.end=parent.end;child.range=parent.range;child.start=parent.start;t.inheritsComments(child,parent);return child};t.getSpecifierName=function(specifier){return specifier.name||specifier.id}},{"./alias-keys":72,"./builder-keys":73,"./visitor-keys":75,esutils:107,lodash:108}],75:[function(require,module,exports){module.exports={ArrayExpression:["elements"],ArrayPattern:["elements"],ArrowFunctionExpression:["params","defaults","rest","body"],AssignmentExpression:["left","right"],AwaitExpression:["argument"],BinaryExpression:["left","right"],BindMemberExpression:["object","property","arguments"],BlockStatement:["body"],BreakStatement:["label"],CallExpression:["callee","arguments"],CatchClause:["param","body"],ClassBody:["body"],ClassDeclaration:["id","body","superClass"],ClassExpression:["id","body","superClass"],ComprehensionBlock:["left","right","body"],ComprehensionExpression:["filter","blocks","body"],ConditionalExpression:["test","consequent","alternate"],ContinueStatement:["label"],DebuggerStatement:[],DoWhileStatement:["body","test"],EmptyStatement:[],ExportBatchSpecifier:[],ExportDeclaration:["declaration","specifiers","source"],ExportSpecifier:["id","name"],ExpressionStatement:["expression"],File:["program"],ForInStatement:["left","right","body"],ForOfStatement:["left","right","body"],ForStatement:["init","test","update","body"],FunctionDeclaration:["id","params","defaults","rest","body"],FunctionExpression:["id","params","defaults","rest","body"],Identifier:[],IfStatement:["test","consequent","alternate"],ImportBatchSpecifier:["id"],ImportDeclaration:["specifiers","source"],ImportSpecifier:["id","name"],LabeledStatement:["label","body"],Literal:[],LogicalExpression:["left","right"],MemberExpression:["object","property"],MethodDefinition:["key","value"],NewExpression:["callee","arguments"],ObjectExpression:["properties"],ObjectPattern:["properties"],ParenthesizedExpression:["expression"],BindFunctionExpression:["callee","arguments"],Program:["body"],Property:["key","value"],ReturnStatement:["argument"],SequenceExpression:["expressions"],SpreadElement:["argument"],SpreadProperty:["argument"],SwitchCase:["test","consequent"],SwitchStatement:["discriminant","cases"],TaggedTemplateExpression:["tag","quasi"],TemplateElement:[],TemplateLiteral:["quasis","expressions"],ThisExpression:[],ThrowStatement:["argument"],TryStatement:["block","handlers","handler","guardedHandlers","finalizer"],UnaryExpression:["argument"],UpdateExpression:["argument"],VariableDeclaration:["declarations"],VariableDeclarator:["id","init"],VirtualPropertyExpression:["object","property"],WhileStatement:["test","body"],WithStatement:["object","body"],XJSAttribute:["name","value"],XJSClosingElement:["name"],XJSElement:["openingElement","closingElement","children"],XJSEmptyExpression:[],XJSExpressionContainer:["expression"],XJSIdentifier:[],XJSMemberExpression:["object","property"],XJSNamespacedName:["namespace","name"],XJSOpeningElement:["name","attributes"],XJSSpreadAttribute:["argument"],YieldExpression:["argument"]}},{}],76:[function(require,module,exports){(function(Buffer,__dirname){require("./patch");var estraverse=require("estraverse");var traverse=require("./traverse");var acorn=require("acorn-6to5");var path=require("path");var util=require("util");var fs=require("fs");var t=require("./types");var _=require("lodash");exports.inherits=util.inherits;exports.canCompile=function(filename,altExts){var exts=altExts||[".js",".jsx",".es6"];var ext=path.extname(filename);return _.contains(exts,ext)};exports.isInteger=function(i){return _.isNumber(i)&&i%1===0};exports.resolve=function(loc){try{return require.resolve(loc)}catch(err){return null}};exports.trimRight=function(str){return str.replace(/[\n\s]+$/g,"")};exports.list=function(val){return val?val.split(","):[]};exports.regexify=function(val){if(!val)return new RegExp(/.^/);if(_.isArray(val))val=val.join("|");if(_.isString(val))return new RegExp(val);if(_.isRegExp(val))return val;throw new TypeError("illegal type for regexify")};exports.arrayify=function(val){if(!val)return[];if(_.isString(val))return exports.list(val);if(_.isArray(val))return val;throw new TypeError("illegal type for arrayify")};exports.getUid=function(parent,file){var node;if(t.isAssignmentExpression(parent)){node=parent.left}else if(t.isVariableDeclarator(parent)){node=parent.id}var id="ref";if(t.isIdentifier(node))id=node.name;return file.generateUidIdentifier(id)};exports.isAbsolute=function(loc){if(!loc)return false;if(loc[0]==="/")return true;if(loc[1]===":"&&loc[2]==="\\")return true;return false};exports.sourceMapToComment=function(map){var json=JSON.stringify(map);var base64=new Buffer(json).toString("base64");return"//# sourceMappingURL=data:application/json;base64,"+base64};exports.pushMutatorMap=function(mutatorMap,key,kind,method){var alias;if(t.isIdentifier(key)){alias=key.name;if(method.computed)alias="computed:"+alias}else if(t.isLiteral(key)){alias=String(key.value)}else{alias=JSON.stringify(traverse.removeProperties(_.cloneDeep(key)))}var map;if(_.has(mutatorMap,alias)){map=mutatorMap[alias]}else{map={}}mutatorMap[alias]=map;map._key=key;if(method.computed){map._computed=true}map[kind]=method};exports.buildDefineProperties=function(mutatorMap){var objExpr=t.objectExpression([]);_.each(mutatorMap,function(map){var mapNode=t.objectExpression([]);var propNode=t.property("init",map._key,mapNode,map._computed);_.each(map,function(node,key){if(key[0]==="_")return;node=_.clone(node);var inheritNode=node;if(t.isMethodDefinition(node))node=node.value;var prop=t.property("init",t.identifier(key),node);t.inheritsComments(prop,inheritNode);t.removeComments(inheritNode);mapNode.properties.push(prop)});objExpr.properties.push(propNode)});return objExpr};exports.template=function(name,nodes,keepExpression){var template=exports.templates[name];if(!template)throw new ReferenceError("unknown template "+name);if(nodes===true){keepExpression=true;nodes=null}template=_.cloneDeep(template);if(!_.isEmpty(nodes)){traverse(template,function(node){if(t.isIdentifier(node)&&_.has(nodes,node.name)){var newNode=nodes[node.name];if(_.isString(newNode)){node.name=newNode}else{return newNode}}})}var node=template.body[0];if(!keepExpression&&t.isExpressionStatement(node)){node=node.expression;if(t.isParenthesizedExpression(node))node=node.expression}return node};exports.codeFrame=function(lines,lineNumber,colNumber){colNumber=Math.max(colNumber,0);lines=lines.split("\n");var start=Math.max(lineNumber-3,0);var end=Math.min(lines.length,lineNumber+3);var width=(end+"").length;if(!lineNumber&&!colNumber){start=0;end=lines.length}return"\n"+lines.slice(start,end).map(function(line,i){var curr=i+start+1;var gutter=curr===lineNumber?"> ":" ";var sep=curr+exports.repeat(width+1);gutter+=sep+"| ";var str=gutter+line;if(colNumber&&curr===lineNumber){str+="\n";str+=exports.repeat(gutter.length-2);str+="|"+exports.repeat(colNumber)+"^"}return str}).join("\n")};exports.repeat=function(width,cha){cha=cha||" ";return new Array(width+1).join(cha)};exports.parse=function(opts,code,callback){try{var comments=[];var tokens=[];var ast=acorn.parse(code,{allowReturnOutsideFunction:true,preserveParens:true,ecmaVersion:opts.experimental?7:6,playground:opts.playground,strictMode:true,onComment:comments,locations:true,onToken:tokens,ranges:true});estraverse.attachComments(ast,comments,tokens);ast=t.file(ast,comments,tokens);traverse(ast,function(node,parent){node._parent=parent});if(callback){return callback(ast)}else{return ast}}catch(err){if(!err._6to5){err._6to5=true;var message=opts.filename+": "+err.message;var loc=err.loc;if(loc){var frame=exports.codeFrame(code,loc.line,loc.column);message+=frame}if(err.stack)err.stack=err.stack.replace(err.message,message);err.message=message}throw err}};exports.parseTemplate=function(loc,code){var ast=exports.parse({filename:loc},code).program;return traverse.removeProperties(ast)};var loadTemplates=function(){var templates={};var templatesLoc=__dirname+"/templates";if(!fs.existsSync(templatesLoc)){throw new Error("no templates directory - this is most likely the "+"result of a broken `npm publish`. Please report to "+"https://githut.com/6to5/6to5/issues")}_.each(fs.readdirSync(templatesLoc),function(name){if(name[0]===".")return;var key=path.basename(name,path.extname(name));var loc=templatesLoc+"/"+name;var code=fs.readFileSync(loc,"utf8");templates[key]=exports.parseTemplate(loc,code)});return templates};try{exports.templates=require("../../templates.json")}catch(err){if(err.code!=="MODULE_NOT_FOUND")throw err;exports.templates=loadTemplates()}}).call(this,require("buffer").Buffer,"/lib/6to5")},{"../../templates.json":126,"./patch":22,"./traverse":70,"./types":74,"acorn-6to5":77,buffer:94,estraverse:103,fs:92,lodash:108,path:99,util:102}],77:[function(require,module,exports){(function(root,mod){if(typeof exports=="object"&&typeof module=="object")return mod(exports);if(typeof define=="function"&&define.amd)return define(["exports"],mod);mod(root.acorn||(root.acorn={}))})(this,function(exports){"use strict";exports.version="0.9.1";var options,input,inputLen,sourceFile;exports.parse=function(inpt,opts){input=String(inpt);inputLen=input.length;setOptions(opts);initTokenState();var startPos=options.locations?[tokPos,new Position]:tokPos;initParserState();return parseTopLevel(options.program||startNodeAt(startPos))};var defaultOptions=exports.defaultOptions={playground:false,ecmaVersion:5,strictSemicolons:false,allowTrailingCommas:true,forbidReserved:false,allowReturnOutsideFunction:false,locations:false,onToken:null,onComment:null,ranges:false,program:null,sourceFile:null,directSourceFile:null,preserveParens:false};exports.parseExpressionAt=function(inpt,pos,opts){input=String(inpt);inputLen=input.length;setOptions(opts);initTokenState(pos);initParserState();return parseExpression()};var isArray=function(obj){return Object.prototype.toString.call(obj)==="[object Array]"};function setOptions(opts){options={};for(var opt in defaultOptions)options[opt]=opts&&has(opts,opt)?opts[opt]:defaultOptions[opt];sourceFile=options.sourceFile||null;if(isArray(options.onToken)){var tokens=options.onToken;options.onToken=function(token){tokens.push(token)}}if(isArray(options.onComment)){var comments=options.onComment;options.onComment=function(block,text,start,end,startLoc,endLoc){var comment={type:block?"Block":"Line",value:text,start:start,end:end};if(options.locations){comment.loc=new SourceLocation;comment.loc.start=startLoc;comment.loc.end=endLoc}if(options.ranges)comment.range=[start,end];comments.push(comment)}}if(options.strictMode){strict=true}if(options.ecmaVersion>=7){isKeyword=isEcma7Keyword}else if(options.ecmaVersion===6){isKeyword=isEcma6Keyword}else{isKeyword=isEcma5AndLessKeyword}}var getLineInfo=exports.getLineInfo=function(input,offset){for(var line=1,cur=0;;){lineBreak.lastIndex=cur;var match=lineBreak.exec(input);if(match&&match.index<offset){++line;cur=match.index+match[0].length}else break}return{line:line,column:offset-cur}};function Token(){this.type=tokType;this.value=tokVal;this.start=tokStart;this.end=tokEnd;if(options.locations){this.loc=new SourceLocation;this.loc.end=tokEndLoc;this.startLoc=tokStartLoc;this.endLoc=tokEndLoc}if(options.ranges)this.range=[tokStart,tokEnd]}exports.Token=Token;exports.tokenize=function(inpt,opts){input=String(inpt);inputLen=input.length;setOptions(opts);initTokenState();skipSpace();function getToken(forceRegexp){lastEnd=tokEnd;readToken(forceRegexp);return new Token}getToken.jumpTo=function(pos,reAllowed){tokPos=pos;if(options.locations){tokCurLine=1;tokLineStart=lineBreak.lastIndex=0;var match;while((match=lineBreak.exec(input))&&match.index<pos){++tokCurLine;tokLineStart=match.index+match[0].length}}tokRegexpAllowed=reAllowed;skipSpace()};getToken.noRegexp=function(){tokRegexpAllowed=false};getToken.options=options;return getToken};var tokPos;var tokStart,tokEnd;var tokStartLoc,tokEndLoc;var tokType,tokVal;var tokRegexpAllowed;var tokCurLine,tokLineStart;var lastStart,lastEnd,lastEndLoc;var inFunction,inGenerator,inAsync,labels,strict,inXJSChild,inXJSTag,inXJSChildExpression;var metParenL;var inTemplate;function initParserState(){lastStart=lastEnd=tokPos;if(options.locations)lastEndLoc=new Position;inFunction=inGenerator=inAsync=strict=false;labels=[];skipSpace();readToken()}function raise(pos,message){var loc=getLineInfo(input,pos);message+=" ("+loc.line+":"+loc.column+")";var err=new SyntaxError(message);err.pos=pos;err.loc=loc;err.raisedAt=tokPos;throw err}var empty=[];var _num={type:"num"},_regexp={type:"regexp"},_string={type:"string"};var _name={type:"name"},_eof={type:"eof"};var _xjsName={type:"xjsName"},_xjsText={type:"xjsText"};var _break={keyword:"break"},_case={keyword:"case",beforeExpr:true},_catch={keyword:"catch"};var _continue={keyword:"continue"},_debugger={keyword:"debugger"},_default={keyword:"default"};var _do={keyword:"do",isLoop:true},_else={keyword:"else",beforeExpr:true};var _finally={keyword:"finally"},_for={keyword:"for",isLoop:true},_function={keyword:"function"};var _if={keyword:"if"},_return={keyword:"return",beforeExpr:true},_switch={keyword:"switch"};var _throw={keyword:"throw",beforeExpr:true},_try={keyword:"try"},_var={keyword:"var"};var _let={keyword:"let"},_const={keyword:"const"};var _while={keyword:"while",isLoop:true},_with={keyword:"with"},_new={keyword:"new",beforeExpr:true};var _this={keyword:"this"};var _class={keyword:"class"},_extends={keyword:"extends",beforeExpr:true};var _export={keyword:"export"},_import={keyword:"import"};var _yield={keyword:"yield",beforeExpr:true};var _async={keyword:"async"},_await={keyword:"await",beforeExpr:true};var _null={keyword:"null",atomValue:null},_true={keyword:"true",atomValue:true};var _false={keyword:"false",atomValue:false};var _in={keyword:"in",binop:7,beforeExpr:true};var keywordTypes={"break":_break,"case":_case,"catch":_catch,"continue":_continue,"debugger":_debugger,"default":_default,"do":_do,"else":_else,"finally":_finally,"for":_for,"function":_function,"if":_if,"return":_return,"switch":_switch,"throw":_throw,"try":_try,"var":_var,let:_let,"const":_const,"while":_while,"with":_with,"null":_null,"true":_true,"false":_false,"new":_new,"in":_in,"instanceof":{keyword:"instanceof",binop:7,beforeExpr:true},"this":_this,"typeof":{keyword:"typeof",prefix:true,beforeExpr:true},"void":{keyword:"void",prefix:true,beforeExpr:true},"delete":{keyword:"delete",prefix:true,beforeExpr:true},"class":_class,"extends":_extends,"export":_export,"import":_import,"yield":_yield,await:_await,async:_async};var _bracketL={type:"[",beforeExpr:true},_bracketR={type:"]"},_braceL={type:"{",beforeExpr:true};var _braceR={type:"}"},_parenL={type:"(",beforeExpr:true},_parenR={type:")"};var _comma={type:",",beforeExpr:true},_semi={type:";",beforeExpr:true};var _colon={type:":",beforeExpr:true},_dot={type:"."},_question={type:"?",beforeExpr:true};var _arrow={type:"=>",beforeExpr:true},_bquote={type:"`"},_dollarBraceL={type:"${",beforeExpr:true};var _ltSlash={type:"</"};var _ellipsis={type:"...",prefix:true,beforeExpr:true};var _doubleColon={type:"::",beforeExpr:true};var _slash={binop:10,beforeExpr:true},_eq={isAssign:true,beforeExpr:true};var _assign={isAssign:true,beforeExpr:true};var _incDec={postfix:true,prefix:true,isUpdate:true},_prefix={prefix:true,beforeExpr:true};var _logicalOR={binop:1,beforeExpr:true};var _logicalAND={binop:2,beforeExpr:true};var _bitwiseOR={binop:3,beforeExpr:true};var _bitwiseXOR={binop:4,beforeExpr:true};var _bitwiseAND={binop:5,beforeExpr:true};var _equality={binop:6,beforeExpr:true};var _relational={binop:7,beforeExpr:true};var _bitShift={binop:8,beforeExpr:true};var _plusMin={binop:9,prefix:true,beforeExpr:true};var _modulo={binop:10,beforeExpr:true};var _star={binop:10,beforeExpr:true};var _exponent={binop:10,beforeExpr:true};var _lt={binop:7,beforeExpr:true},_gt={binop:7,beforeExpr:true};exports.tokTypes={bracketL:_bracketL,bracketR:_bracketR,braceL:_braceL,braceR:_braceR,parenL:_parenL,parenR:_parenR,comma:_comma,semi:_semi,colon:_colon,dot:_dot,ellipsis:_ellipsis,question:_question,slash:_slash,eq:_eq,name:_name,eof:_eof,num:_num,regexp:_regexp,string:_string,arrow:_arrow,bquote:_bquote,dollarBraceL:_dollarBraceL,star:_star,assign:_assign,xjsName:_xjsName,xjsText:_xjsText,doubleColon:_doubleColon,exponent:_exponent};for(var kw in keywordTypes)exports.tokTypes["_"+kw]=keywordTypes[kw];function makePredicate(words){words=words.split(" ");var f="",cats=[];out:for(var i=0;i<words.length;++i){for(var j=0;j<cats.length;++j)if(cats[j][0].length==words[i].length){cats[j].push(words[i]);continue out}cats.push([words[i]])}function compareTo(arr){if(arr.length==1)return f+="return str === "+JSON.stringify(arr[0])+";";f+="switch(str){";for(var i=0;i<arr.length;++i)f+="case "+JSON.stringify(arr[i])+":";f+="return true}return false;"}if(cats.length>3){cats.sort(function(a,b){return b.length-a.length});f+="switch(str.length){";for(var i=0;i<cats.length;++i){var cat=cats[i];f+="case "+cat[0].length+":";compareTo(cat)}f+="}"}else{compareTo(words)}return new Function("str",f)}var isReservedWord3=makePredicate("abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile");var isReservedWord5=makePredicate("class enum extends super const export import");var isStrictReservedWord=makePredicate("implements interface let package private protected public static yield");var isStrictBadIdWord=makePredicate("eval arguments");var ecma5AndLessKeywords="break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this";var isEcma5AndLessKeyword=makePredicate(ecma5AndLessKeywords);var ecma6AndLessKeywords=ecma5AndLessKeywords+" let const class extends export import yield";var isEcma6Keyword=makePredicate(ecma6AndLessKeywords);var isEcma7Keyword=makePredicate(ecma6AndLessKeywords+" async await");var isKeyword=isEcma5AndLessKeyword;var nonASCIIwhitespace=/[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/;var nonASCIIidentifierStartChars="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠ-ࢲऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々-〇〡-〩〱-〵〸-〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞭꞰꞱꟷ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭟꭤꭥꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ";var nonASCIIidentifierChars="̀-ͯ҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࣤ-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ଁ-ଃ଼ା-ୄେୈୋ-୍ୖୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఃా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ഁ-ഃാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ංඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ູົຼ່-ໍ໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠐-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏ᦰ-ᧀᧈᧉ᧐-᧙ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭ᳲ-᳴᳸᳹᷀-᷵᷼-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯꘠-꘩꙯ꙴ-꙽ꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧꢀꢁꢴ-꣄꣐-꣙꣠-꣱꤀-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︭︳︴﹍-﹏0-9_";var nonASCIIidentifierStart=new RegExp("["+nonASCIIidentifierStartChars+"]");var nonASCIIidentifier=new RegExp("["+nonASCIIidentifierStartChars+nonASCIIidentifierChars+"]");var newline=/[\n\r\u2028\u2029]/;var lineBreak=/\r\n|[\n\r\u2028\u2029]/g;var isIdentifierStart=exports.isIdentifierStart=function(code){if(code<65)return code===36;if(code<91)return true;if(code<97)return code===95;if(code<123)return true;return code>=170&&nonASCIIidentifierStart.test(String.fromCharCode(code))};var isIdentifierChar=exports.isIdentifierChar=function(code){if(code<48)return code===36;if(code<58)return true;if(code<65)return false;if(code<91)return true;if(code<97)return code===95;if(code<123)return true;return code>=170&&nonASCIIidentifier.test(String.fromCharCode(code))};function Position(){this.line=tokCurLine;this.column=tokPos-tokLineStart}function initTokenState(pos){if(pos){tokPos=pos;tokLineStart=Math.max(0,input.lastIndexOf("\n",pos));tokCurLine=input.slice(0,tokLineStart).split(newline).length}else{tokCurLine=1;tokPos=tokLineStart=0}tokRegexpAllowed=true;metParenL=0;inTemplate=inXJSChild=inXJSTag=false}function finishToken(type,val,shouldSkipSpace){tokEnd=tokPos;if(options.locations)tokEndLoc=new Position;tokType=type;if(shouldSkipSpace!==false)skipSpace();tokVal=val;tokRegexpAllowed=type.beforeExpr;if(options.onToken){options.onToken(new Token)}}function skipBlockComment(){var startLoc=options.onComment&&options.locations&&new Position;var start=tokPos,end=input.indexOf("*/",tokPos+=2);if(end===-1)raise(tokPos-2,"Unterminated comment");tokPos=end+2;if(options.locations){lineBreak.lastIndex=start;var match;while((match=lineBreak.exec(input))&&match.index<tokPos){++tokCurLine;tokLineStart=match.index+match[0].length}}if(options.onComment)options.onComment(true,input.slice(start+2,end),start,tokPos,startLoc,options.locations&&new Position)}function skipLineComment(startSkip){var start=tokPos;var startLoc=options.onComment&&options.locations&&new Position;var ch=input.charCodeAt(tokPos+=startSkip);while(tokPos<inputLen&&ch!==10&&ch!==13&&ch!==8232&&ch!==8233){++tokPos;ch=input.charCodeAt(tokPos)}if(options.onComment)options.onComment(false,input.slice(start+startSkip,tokPos),start,tokPos,startLoc,options.locations&&new Position)}function skipSpace(){while(tokPos<inputLen){var ch=input.charCodeAt(tokPos);if(ch===32){++tokPos}else if(ch===13){++tokPos;var next=input.charCodeAt(tokPos);if(next===10){++tokPos}if(options.locations){++tokCurLine;tokLineStart=tokPos}}else if(ch===10||ch===8232||ch===8233){++tokPos;if(options.locations){++tokCurLine;tokLineStart=tokPos}}else if(ch>8&&ch<14){++tokPos}else if(ch===47){var next=input.charCodeAt(tokPos+1);if(next===42){skipBlockComment()}else if(next===47){skipLineComment(2)}else break}else if(ch===160){++tokPos}else if(ch>=5760&&nonASCIIwhitespace.test(String.fromCharCode(ch))){++tokPos}else{break}}}function readToken_dot(){var next=input.charCodeAt(tokPos+1);if(next>=48&&next<=57)return readNumber(true);var next2=input.charCodeAt(tokPos+2);if(options.ecmaVersion>=6&&next===46&&next2===46){tokPos+=3;return finishToken(_ellipsis)}else{++tokPos;return finishToken(_dot)}}function readToken_slash(){var next=input.charCodeAt(tokPos+1);if(tokRegexpAllowed){++tokPos;return readRegexp()}if(next===61)return finishOp(_assign,2);return finishOp(_slash,1)}function readToken_modulo(){var next=input.charCodeAt(tokPos+1);if(next===61)return finishOp(_assign,2);return finishOp(_modulo,1)}function readToken_mult(){var type=_star;var width=1;var next=input.charCodeAt(tokPos+1);if(options.ecmaVersion>=7&&next===42){width++;next=input.charCodeAt(tokPos+2);type=_exponent}if(next===61){width++;type=_assign}return finishOp(type,width)}function readToken_pipe_amp(code){var next=input.charCodeAt(tokPos+1);if(next===code)return finishOp(code===124?_logicalOR:_logicalAND,2);if(next===61)return finishOp(_assign,2);return finishOp(code===124?_bitwiseOR:_bitwiseAND,1)}function readToken_caret(){var next=input.charCodeAt(tokPos+1);if(next===61)return finishOp(_assign,2);return finishOp(_bitwiseXOR,1)}function readToken_plus_min(code){var next=input.charCodeAt(tokPos+1);
if(next===code){if(next==45&&input.charCodeAt(tokPos+2)==62&&newline.test(input.slice(lastEnd,tokPos))){skipLineComment(3);skipSpace();return readToken()}return finishOp(_incDec,2)}if(next===61)return finishOp(_assign,2);return finishOp(_plusMin,1)}function readToken_lt_gt(code){var next=input.charCodeAt(tokPos+1);var size=1;if(next===code){size=code===62&&input.charCodeAt(tokPos+2)===62?3:2;if(input.charCodeAt(tokPos+size)===61)return finishOp(_assign,size+1);return finishOp(_bitShift,size)}if(next==33&&code==60&&input.charCodeAt(tokPos+2)==45&&input.charCodeAt(tokPos+3)==45){skipLineComment(4);skipSpace();return readToken()}if(next===61){size=input.charCodeAt(tokPos+2)===61?3:2;return finishOp(_relational,size)}if(next===47){size=2;return finishOp(_ltSlash,size)}return code===60?finishOp(_lt,size):finishOp(_gt,size,!inXJSTag)}function readToken_eq_excl(code){var next=input.charCodeAt(tokPos+1);if(next===61)return finishOp(_equality,input.charCodeAt(tokPos+2)===61?3:2);if(code===61&&next===62&&options.ecmaVersion>=6){tokPos+=2;return finishToken(_arrow)}return finishOp(code===61?_eq:_prefix,1)}function getTemplateToken(code){if(tokType===_string){if(code===96){++tokPos;return finishToken(_bquote)}else if(code===36&&input.charCodeAt(tokPos+1)===123){tokPos+=2;return finishToken(_dollarBraceL)}}if(code===125){++tokPos;return finishToken(_braceR,undefined,false)}return readTmplString()}function getTokenFromCode(code){switch(code){case 46:return readToken_dot();case 40:++tokPos;return finishToken(_parenL);case 41:++tokPos;return finishToken(_parenR);case 59:++tokPos;return finishToken(_semi);case 44:++tokPos;return finishToken(_comma);case 91:++tokPos;return finishToken(_bracketL);case 93:++tokPos;return finishToken(_bracketR);case 123:++tokPos;return finishToken(_braceL);case 125:++tokPos;return finishToken(_braceR,undefined,!inXJSChild);case 63:++tokPos;return finishToken(_question);case 58:++tokPos;if(options.ecmaVersion>=7){var next=input.charCodeAt(tokPos);if(next===58){++tokPos;return finishToken(_doubleColon)}}return finishToken(_colon);case 96:if(options.ecmaVersion>=6){++tokPos;return finishToken(_bquote,undefined,false)}case 48:var next=input.charCodeAt(tokPos+1);if(next===120||next===88)return readRadixNumber(16);if(options.ecmaVersion>=6){if(next===111||next===79)return readRadixNumber(8);if(next===98||next===66)return readRadixNumber(2)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return readNumber(false);case 34:case 39:return inXJSTag?readXJSStringLiteral():readString(code);case 47:return readToken_slash();case 37:return readToken_modulo();case 42:return readToken_mult();case 124:case 38:return readToken_pipe_amp(code);case 94:return readToken_caret();case 43:case 45:return readToken_plus_min(code);case 60:case 62:return readToken_lt_gt(code);case 61:case 33:return readToken_eq_excl(code);case 126:return finishOp(_prefix,1)}return false}function readToken(forceRegexp){if(!forceRegexp)tokStart=tokPos;else tokPos=tokStart+1;if(options.locations)tokStartLoc=new Position;if(forceRegexp)return readRegexp();if(tokPos>=inputLen)return finishToken(_eof);var code=input.charCodeAt(tokPos);if(inXJSChild&&tokType!==_braceL&&code!==60&&code!==123&&code!==125){return readXJSText(["<","{"])}if(inTemplate)return getTemplateToken(code);if(isIdentifierStart(code)||code===92)return readWord();var tok=getTokenFromCode(code);if(tok===false){var ch=String.fromCharCode(code);if(ch==="\\"||nonASCIIidentifierStart.test(ch))return readWord();raise(tokPos,"Unexpected character '"+ch+"'")}return tok}function finishOp(type,size,shouldSkipSpace){var str=input.slice(tokPos,tokPos+size);tokPos+=size;finishToken(type,str,shouldSkipSpace)}var regexpUnicodeSupport=false;try{new RegExp("","u");regexpUnicodeSupport=true}catch(e){}function readRegexp(){var content="",escaped,inClass,start=tokPos;for(;;){if(tokPos>=inputLen)raise(start,"Unterminated regular expression");var ch=nextChar();if(newline.test(ch))raise(start,"Unterminated regular expression");if(!escaped){if(ch==="[")inClass=true;else if(ch==="]"&&inClass)inClass=false;else if(ch==="/"&&!inClass)break;escaped=ch==="\\"}else escaped=false;++tokPos}var content=input.slice(start,tokPos);++tokPos;var mods=readWord1();var tmp=content;if(mods){var validFlags=/^[gmsiy]*$/;if(options.ecmaVersion>=6)validFlags=/^[gmsiyu]*$/;if(!validFlags.test(mods))raise(start,"Invalid regular expression flag");if(mods.indexOf("u")>=0&&!regexpUnicodeSupport){tmp=tmp.replace(/\\u\{([0-9a-fA-F]{5,6})\}/g,"x").replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x")}}try{new RegExp(tmp)}catch(e){if(e instanceof SyntaxError)raise(start,"Error parsing regular expression: "+e.message);raise(e)}try{var value=new RegExp(content,mods)}catch(err){value=null}return finishToken(_regexp,{pattern:content,flags:mods,value:value})}function readInt(radix,len){var start=tokPos,total=0;for(var i=0,e=len==null?Infinity:len;i<e;++i){var code=input.charCodeAt(tokPos),val;if(code>=97)val=code-97+10;else if(code>=65)val=code-65+10;else if(code>=48&&code<=57)val=code-48;else val=Infinity;if(val>=radix)break;++tokPos;total=total*radix+val}if(tokPos===start||len!=null&&tokPos-start!==len)return null;return total}function readRadixNumber(radix){tokPos+=2;var val=readInt(radix);if(val==null)raise(tokStart+2,"Expected number in radix "+radix);if(isIdentifierStart(input.charCodeAt(tokPos)))raise(tokPos,"Identifier directly after number");return finishToken(_num,val)}function readNumber(startsWithDot){var start=tokPos,isFloat=false,octal=input.charCodeAt(tokPos)===48;if(!startsWithDot&&readInt(10)===null)raise(start,"Invalid number");if(input.charCodeAt(tokPos)===46){++tokPos;readInt(10);isFloat=true}var next=input.charCodeAt(tokPos);if(next===69||next===101){next=input.charCodeAt(++tokPos);if(next===43||next===45)++tokPos;if(readInt(10)===null)raise(start,"Invalid number");isFloat=true}if(isIdentifierStart(input.charCodeAt(tokPos)))raise(tokPos,"Identifier directly after number");var str=input.slice(start,tokPos),val;if(isFloat)val=parseFloat(str);else if(!octal||str.length===1)val=parseInt(str,10);else if(/[89]/.test(str)||strict)raise(start,"Invalid number");else val=parseInt(str,8);return finishToken(_num,val)}function readCodePoint(){var ch=input.charCodeAt(tokPos),code;if(ch===123){if(options.ecmaVersion<6)unexpected();++tokPos;code=readHexChar(input.indexOf("}",tokPos)-tokPos);++tokPos;if(code>1114111)unexpected()}else{code=readHexChar(4)}if(code<=65535){return String.fromCharCode(code)}var cu1=(code-65536>>10)+55296;var cu2=(code-65536&1023)+56320;return String.fromCharCode(cu1,cu2)}function readString(quote){++tokPos;var out="";for(;;){if(tokPos>=inputLen)raise(tokStart,"Unterminated string constant");var ch=input.charCodeAt(tokPos);if(ch===quote){++tokPos;return finishToken(_string,out)}if(ch===92){out+=readEscapedChar()}else{++tokPos;if(newline.test(String.fromCharCode(ch))){raise(tokStart,"Unterminated string constant")}out+=String.fromCharCode(ch)}}}function readTmplString(){var out="";for(;;){if(tokPos>=inputLen)raise(tokStart,"Unterminated string constant");var ch=input.charCodeAt(tokPos);if(ch===96||ch===36&&input.charCodeAt(tokPos+1)===123)return finishToken(_string,out);if(ch===92){out+=readEscapedChar()}else{++tokPos;if(newline.test(String.fromCharCode(ch))){if(ch===13&&input.charCodeAt(tokPos)===10){++tokPos;ch=10}if(options.locations){++tokCurLine;tokLineStart=tokPos}}out+=String.fromCharCode(ch)}}}function readEscapedChar(){var ch=input.charCodeAt(++tokPos);var octal=/^[0-7]+/.exec(input.slice(tokPos,tokPos+3));if(octal)octal=octal[0];while(octal&&parseInt(octal,8)>255)octal=octal.slice(0,-1);if(octal==="0")octal=null;++tokPos;if(octal){if(strict)raise(tokPos-2,"Octal literal in strict mode");tokPos+=octal.length-1;return String.fromCharCode(parseInt(octal,8))}else{switch(ch){case 110:return"\n";case 114:return"\r";case 120:return String.fromCharCode(readHexChar(2));case 117:return readCodePoint();case 116:return" ";case 98:return"\b";case 118:return"";case 102:return"\f";case 48:return"\x00";case 13:if(input.charCodeAt(tokPos)===10)++tokPos;case 10:if(options.locations){tokLineStart=tokPos;++tokCurLine}return"";default:return String.fromCharCode(ch)}}}var XHTMLEntities={quot:'"',amp:"&",apos:"'",lt:"<",gt:">",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",ensp:" ",emsp:" ",thinsp:" ",zwnj:"",zwj:"",lrm:"",rlm:"",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",frasl:"⁄",euro:"€",image:"ℑ",weierp:"℘",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪","int":"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦"};function readXJSEntity(){var str="",count=0,entity;var ch=nextChar();if(ch!=="&")raise(tokPos,"Entity must start with an ampersand");tokPos++;while(tokPos<inputLen&&count++<10){ch=nextChar();tokPos++;if(ch===";"){break}str+=ch}if(str[0]==="#"&&str[1]==="x"){entity=String.fromCharCode(parseInt(str.substr(2),16))}else if(str[0]==="#"){entity=String.fromCharCode(parseInt(str.substr(1),10))}else{entity=XHTMLEntities[str]}return entity}function readXJSText(stopChars){var str="";while(tokPos<inputLen){var ch=nextChar();if(stopChars.indexOf(ch)!==-1){break}if(ch==="&"){str+=readXJSEntity()}else{++tokPos;if(ch==="\r"&&nextChar()==="\n"){str+=ch;++tokPos;ch="\n"}if(ch==="\n"&&options.locations){tokLineStart=tokPos;++tokCurLine}str+=ch}}return finishToken(_xjsText,str)}function readXJSStringLiteral(){var quote=input.charCodeAt(tokPos);if(quote!==34&"e!==39){raise("String literal must starts with a quote")}++tokPos;readXJSText([String.fromCharCode(quote)]);if(quote!==input.charCodeAt(tokPos)){unexpected()}++tokPos;return finishToken(tokType,tokVal)}function readHexChar(len){var n=readInt(16,len);if(n===null)raise(tokStart,"Bad character escape sequence");return n}var containsEsc;function readWord1(){containsEsc=false;var word,first=true,start=tokPos;for(;;){var ch=input.charCodeAt(tokPos);if(isIdentifierChar(ch)||inXJSTag&&ch===45){if(containsEsc)word+=nextChar();++tokPos}else if(ch===92&&!inXJSTag){if(!containsEsc)word=input.slice(start,tokPos);containsEsc=true;if(input.charCodeAt(++tokPos)!=117)raise(tokPos,"Expecting Unicode escape sequence \\uXXXX");++tokPos;var esc=readHexChar(4);var escStr=String.fromCharCode(esc);if(!escStr)raise(tokPos-1,"Invalid Unicode escape");if(!(first?isIdentifierStart(esc):isIdentifierChar(esc)))raise(tokPos-4,"Invalid Unicode escape");word+=escStr}else{break}first=false}return containsEsc?word:input.slice(start,tokPos)}function readWord(){var word=readWord1();var type=inXJSTag?_xjsName:_name;if(!containsEsc&&isKeyword(word))type=keywordTypes[word];return finishToken(type,word)}function next(){lastStart=tokStart;lastEnd=tokEnd;lastEndLoc=tokEndLoc;readToken()}function setStrict(strct){strict=strct;tokPos=tokStart;if(options.locations){while(tokPos<tokLineStart){tokLineStart=input.lastIndexOf("\n",tokLineStart-2)+1;--tokCurLine}}skipSpace();readToken()}function Node(){this.type=null;this.start=tokStart;this.end=null}exports.Node=Node;function SourceLocation(){this.start=tokStartLoc;this.end=null;if(sourceFile!==null)this.source=sourceFile}function startNode(){var node=new Node;if(options.locations)node.loc=new SourceLocation;if(options.directSourceFile)node.sourceFile=options.directSourceFile;if(options.ranges)node.range=[tokStart,0];return node}function storeCurrentPos(){return options.locations?[tokStart,tokStartLoc]:tokStart}function startNodeAt(pos){var node=new Node,start=pos;if(options.locations){node.loc=new SourceLocation;node.loc.start=start[1];start=pos[0]}node.start=start;if(options.directSourceFile)node.sourceFile=options.directSourceFile;if(options.ranges)node.range=[start,0];return node}function finishNode(node,type){node.type=type;node.end=lastEnd;if(options.locations)node.loc.end=lastEndLoc;if(options.ranges)node.range[1]=lastEnd;return node}function isUseStrict(stmt){return options.ecmaVersion>=5&&stmt.type==="ExpressionStatement"&&stmt.expression.type==="Literal"&&stmt.expression.value==="use strict"}function eat(type){if(tokType===type){next();return true}else{return false}}function canInsertSemicolon(){return!options.strictSemicolons&&(tokType===_eof||tokType===_braceR||newline.test(input.slice(lastEnd,tokStart)))}function semicolon(){if(!eat(_semi)&&!canInsertSemicolon())unexpected()}function expect(type){eat(type)||unexpected()}function nextChar(){return input.charAt(tokPos)}function unexpected(pos){raise(pos!=null?pos:tokStart,"Unexpected token")}function has(obj,propName){return Object.prototype.hasOwnProperty.call(obj,propName)}function toAssignable(node,allowSpread,checkType){if(options.ecmaVersion>=6&&node){switch(node.type){case"Identifier":case"MemberExpression":break;case"ObjectExpression":node.type="ObjectPattern";for(var i=0;i<node.properties.length;i++){var prop=node.properties[i];if(prop.type==="Property"&&prop.kind!=="init")unexpected(prop.key.start);toAssignable(prop.value,false,checkType)}break;case"ArrayExpression":node.type="ArrayPattern";for(var i=0,lastI=node.elements.length-1;i<=lastI;i++){toAssignable(node.elements[i],i===lastI,checkType)}break;case"SpreadElement":if(allowSpread){toAssignable(node.argument,false,checkType);checkSpreadAssign(node.argument)}else{unexpected(node.start)}break;default:if(checkType)unexpected(node.start)}}return node}function checkSpreadAssign(node){if(node.type!=="Identifier"&&node.type!=="ArrayPattern")unexpected(node.start)}function checkFunctionParam(param,nameHash){switch(param.type){case"Identifier":if(isStrictReservedWord(param.name)||isStrictBadIdWord(param.name))raise(param.start,"Defining '"+param.name+"' in strict mode");if(has(nameHash,param.name))raise(param.start,"Argument name clash in strict mode");nameHash[param.name]=true;break;case"ObjectPattern":for(var i=0;i<param.properties.length;i++)checkFunctionParam(param.properties[i].value,nameHash);break;case"ArrayPattern":for(var i=0;i<param.elements.length;i++){var elem=param.elements[i];if(elem)checkFunctionParam(elem,nameHash)}break}}function checkPropClash(prop,propHash){if(options.ecmaVersion>=6)return;var key=prop.key,name;switch(key.type){case"Identifier":name=key.name;break;case"Literal":name=String(key.value);break;default:return}var kind=prop.kind||"init",other;if(has(propHash,name)){other=propHash[name];var isGetSet=kind!=="init";if((strict||isGetSet)&&other[kind]||!(isGetSet^other.init))raise(key.start,"Redefinition of property")}else{other=propHash[name]={init:false,get:false,set:false}}other[kind]=true}function checkLVal(expr,isBinding){switch(expr.type){case"Identifier":if(strict&&(isStrictBadIdWord(expr.name)||isStrictReservedWord(expr.name)))raise(expr.start,isBinding?"Binding "+expr.name+" in strict mode":"Assigning to "+expr.name+" in strict mode");break;case"MemberExpression":if(!isBinding)break;case"ObjectPattern":for(var i=0;i<expr.properties.length;i++){var prop=expr.properties[i];if(prop.type==="Property")prop=prop.value;checkLVal(prop,isBinding)}break;case"ArrayPattern":for(var i=0;i<expr.elements.length;i++){var elem=expr.elements[i];if(elem)checkLVal(elem,isBinding)}break;case"SpreadProperty":case"SpreadElement":case"VirtualPropertyExpression":break;default:raise(expr.start,"Assigning to rvalue")}}function parseTopLevel(node){var first=true;if(!node.body)node.body=[];while(tokType!==_eof){var stmt=parseStatement();node.body.push(stmt);if(first&&isUseStrict(stmt))setStrict(true);first=false}lastStart=tokStart;lastEnd=tokEnd;lastEndLoc=tokEndLoc;return finishNode(node,"Program")}var loopLabel={kind:"loop"},switchLabel={kind:"switch"};function parseStatement(){if(tokType===_slash||tokType===_assign&&tokVal=="/=")readToken(true);var starttype=tokType,node=startNode();switch(starttype){case _break:case _continue:return parseBreakContinueStatement(node,starttype.keyword);case _debugger:return parseDebuggerStatement(node);case _do:return parseDoStatement(node);case _for:return parseForStatement(node);case _async:return parseAsync(node,true);case _function:return parseFunctionStatement(node);case _class:return parseClass(node,true);case _if:return parseIfStatement(node);case _return:return parseReturnStatement(node);case _switch:return parseSwitchStatement(node);case _throw:return parseThrowStatement(node);case _try:return parseTryStatement(node);case _var:case _let:case _const:return parseVarStatement(node,starttype.keyword);case _while:return parseWhileStatement(node);case _with:return parseWithStatement(node);case _braceL:return parseBlock();case _semi:return parseEmptyStatement(node);case _export:return parseExport(node);case _import:return parseImport(node);default:var maybeName=tokVal,expr=parseExpression();if(starttype===_name&&expr.type==="Identifier"&&eat(_colon))return parseLabeledStatement(node,maybeName,expr);else return parseExpressionStatement(node,expr)}}function parseBreakContinueStatement(node,keyword){var isBreak=keyword=="break";next();if(eat(_semi)||canInsertSemicolon())node.label=null;else if(tokType!==_name)unexpected();else{node.label=parseIdent();semicolon()}for(var i=0;i<labels.length;++i){var lab=labels[i];if(node.label==null||lab.name===node.label.name){if(lab.kind!=null&&(isBreak||lab.kind==="loop"))break;if(node.label&&isBreak)break}}if(i===labels.length)raise(node.start,"Unsyntactic "+keyword);return finishNode(node,isBreak?"BreakStatement":"ContinueStatement")}function parseDebuggerStatement(node){next();semicolon();return finishNode(node,"DebuggerStatement")}function parseDoStatement(node){next();labels.push(loopLabel);node.body=parseStatement();labels.pop();expect(_while);node.test=parseParenExpression();semicolon();return finishNode(node,"DoWhileStatement")}function parseForStatement(node){next();labels.push(loopLabel);expect(_parenL);if(tokType===_semi)return parseFor(node,null);if(tokType===_var||tokType===_let){var init=startNode(),varKind=tokType.keyword,isLet=tokType===_let;next();parseVar(init,true,varKind);finishNode(init,"VariableDeclaration");if((tokType===_in||options.ecmaVersion>=6&&tokType===_name&&tokVal==="of")&&init.declarations.length===1&&!(isLet&&init.declarations[0].init))return parseForIn(node,init);return parseFor(node,init)}var init=parseExpression(false,true);if(tokType===_in||options.ecmaVersion>=6&&tokType===_name&&tokVal==="of"){checkLVal(init);return parseForIn(node,init)}return parseFor(node,init)}function parseFunctionStatement(node){next();return parseFunction(node,true,false)}function parseAsync(node,isStatement){if(options.ecmaVersion<7){unexpected()}next();switch(tokType){case _function:next();return parseFunction(node,isStatement,true);if(!isStatement)unexpected();case _name:var id=parseIdent(tokType!==_name);if(eat(_arrow)){return parseArrowExpression(node,[id],true)}case _parenL:var oldParenL=++metParenL;var exprList=[];next();if(tokType!==_parenR){var val=parseExpression();exprList=val.type==="SequenceExpression"?val.expressions:[val]}expect(_parenR);if(metParenL===oldParenL&&eat(_arrow)){return parseArrowExpression(node,exprList,true)}default:unexpected()}}function parseIfStatement(node){next();node.test=parseParenExpression();node.consequent=parseStatement();node.alternate=eat(_else)?parseStatement():null;return finishNode(node,"IfStatement")}function parseReturnStatement(node){if(!inFunction&&!options.allowReturnOutsideFunction)raise(tokStart,"'return' outside of function");next();if(eat(_semi)||canInsertSemicolon())node.argument=null;else{node.argument=parseExpression();semicolon()}return finishNode(node,"ReturnStatement")}function parseSwitchStatement(node){next();node.discriminant=parseParenExpression();node.cases=[];expect(_braceL);labels.push(switchLabel);for(var cur,sawDefault;tokType!=_braceR;){if(tokType===_case||tokType===_default){var isCase=tokType===_case;if(cur)finishNode(cur,"SwitchCase");node.cases.push(cur=startNode());cur.consequent=[];next();if(isCase)cur.test=parseExpression();else{if(sawDefault)raise(lastStart,"Multiple default clauses");sawDefault=true;cur.test=null}expect(_colon)}else{if(!cur)unexpected();cur.consequent.push(parseStatement())}}if(cur)finishNode(cur,"SwitchCase");next();labels.pop();return finishNode(node,"SwitchStatement")}function parseThrowStatement(node){next();if(newline.test(input.slice(lastEnd,tokStart)))raise(lastEnd,"Illegal newline after throw");node.argument=parseExpression();semicolon();return finishNode(node,"ThrowStatement")}function parseTryStatement(node){next();node.block=parseBlock();node.handler=null;if(tokType===_catch){var clause=startNode();next();expect(_parenL);clause.param=parseIdent();if(strict&&isStrictBadIdWord(clause.param.name))raise(clause.param.start,"Binding "+clause.param.name+" in strict mode");expect(_parenR);clause.guard=null;clause.body=parseBlock();node.handler=finishNode(clause,"CatchClause")}node.guardedHandlers=empty;node.finalizer=eat(_finally)?parseBlock():null;if(!node.handler&&!node.finalizer)raise(node.start,"Missing catch or finally clause");return finishNode(node,"TryStatement")}function parseVarStatement(node,kind){next();parseVar(node,false,kind);semicolon();return finishNode(node,"VariableDeclaration")}function parseWhileStatement(node){next();node.test=parseParenExpression();labels.push(loopLabel);node.body=parseStatement();labels.pop();return finishNode(node,"WhileStatement")}function parseWithStatement(node){if(strict)raise(tokStart,"'with' in strict mode");next();node.object=parseParenExpression();node.body=parseStatement();return finishNode(node,"WithStatement")}function parseEmptyStatement(node){next();return finishNode(node,"EmptyStatement")}function parseLabeledStatement(node,maybeName,expr){for(var i=0;i<labels.length;++i)if(labels[i].name===maybeName)raise(expr.start,"Label '"+maybeName+"' is already declared");var kind=tokType.isLoop?"loop":tokType===_switch?"switch":null;labels.push({name:maybeName,kind:kind});node.body=parseStatement();labels.pop();node.label=expr;return finishNode(node,"LabeledStatement")}function parseExpressionStatement(node,expr){node.expression=expr;semicolon();return finishNode(node,"ExpressionStatement")}function parseParenExpression(){expect(_parenL);var val=parseExpression();expect(_parenR);return val}function parseBlock(allowStrict){var node=startNode(),first=true,oldStrict;node.body=[];expect(_braceL);while(!eat(_braceR)){var stmt=parseStatement();node.body.push(stmt);if(first&&allowStrict&&isUseStrict(stmt)){oldStrict=strict;setStrict(strict=true)}first=false}if(oldStrict===false)setStrict(false);return finishNode(node,"BlockStatement")}function parseFor(node,init){node.init=init;expect(_semi);node.test=tokType===_semi?null:parseExpression();expect(_semi);node.update=tokType===_parenR?null:parseExpression();expect(_parenR);node.body=parseStatement();labels.pop();return finishNode(node,"ForStatement")}function parseForIn(node,init){var type=tokType===_in?"ForInStatement":"ForOfStatement";next();node.left=init;node.right=parseExpression();expect(_parenR);node.body=parseStatement();labels.pop();return finishNode(node,type)}function parseVar(node,noIn,kind){node.declarations=[];node.kind=kind;for(;;){var decl=startNode();decl.id=options.ecmaVersion>=6?toAssignable(parseExprAtom()):parseIdent();checkLVal(decl.id,true);decl.init=eat(_eq)?parseExpression(true,noIn):kind===_const.keyword?unexpected():null;node.declarations.push(finishNode(decl,"VariableDeclarator"));if(!eat(_comma))break}return node}function parseExpression(noComma,noIn){var start=storeCurrentPos();var expr=parseMaybeAssign(noIn);if(!noComma&&tokType===_comma){var node=startNodeAt(start);node.expressions=[expr];while(eat(_comma))node.expressions.push(parseMaybeAssign(noIn));return finishNode(node,"SequenceExpression")}return expr}function parseMaybeAssign(noIn){var start=storeCurrentPos();var left=parseMaybeConditional(noIn);if(tokType.isAssign){var node=startNodeAt(start);node.operator=tokVal;node.left=tokType===_eq?toAssignable(left):left;checkLVal(left);next();node.right=parseMaybeAssign(noIn);return finishNode(node,"AssignmentExpression")}return left}function parseMaybeConditional(noIn){var start=storeCurrentPos();var expr=parseExprOps(noIn);if(eat(_question)){var node=startNodeAt(start);if(eat(_eq)){var left=node.left=toAssignable(expr);if(left.type!=="MemberExpression")raise(left.start,"You can only use member expressions in memoization assignment");node.right=parseMaybeAssign(noIn);node.operator="?=";return finishNode(node,"AssignmentExpression")}node.test=expr;node.consequent=parseExpression(true);expect(_colon);node.alternate=parseExpression(true,noIn);return finishNode(node,"ConditionalExpression")}return expr}function parseExprOps(noIn){var start=storeCurrentPos();return parseExprOp(parseMaybeUnary(),start,-1,noIn)}function parseExprOp(left,leftStart,minPrec,noIn){var prec=tokType.binop;if(prec!=null&&(!noIn||tokType!==_in)){if(prec>minPrec){var node=startNodeAt(leftStart);node.left=left;node.operator=tokVal;var op=tokType;next();var start=storeCurrentPos();node.right=parseExprOp(parseMaybeUnary(),start,prec,noIn);finishNode(node,op===_logicalOR||op===_logicalAND?"LogicalExpression":"BinaryExpression");return parseExprOp(node,leftStart,minPrec,noIn)}}return left}function parseMaybeUnary(){if(tokType.prefix){var node=startNode(),update=tokType.isUpdate,nodeType;if(tokType===_ellipsis){nodeType="SpreadElement"}else{nodeType=update?"UpdateExpression":"UnaryExpression";node.operator=tokVal;node.prefix=true}tokRegexpAllowed=true;next();node.argument=parseMaybeUnary();if(update)checkLVal(node.argument);else if(strict&&node.operator==="delete"&&node.argument.type==="Identifier")raise(node.start,"Deleting local variable in strict mode");return finishNode(node,nodeType)}var start=storeCurrentPos();var expr=parseExprSubscripts();while(tokType.postfix&&!canInsertSemicolon()){var node=startNodeAt(start);node.operator=tokVal;node.prefix=false;node.argument=expr;checkLVal(expr);next();expr=finishNode(node,"UpdateExpression")}return expr}function parseExprSubscripts(){var start=storeCurrentPos();return parseSubscripts(parseExprAtom(),start)}function parseSubscripts(base,start,noCalls){if(options.playground&&eat(_colon)){var node=startNodeAt(start);node.object=base;node.property=parseIdent(true);if(eat(_parenL)){node.arguments=parseExprList(_parenR,false)}else{node.arguments=[]}return parseSubscripts(finishNode(node,"BindMemberExpression"),start,noCalls)}else if(eat(_doubleColon)){var node=startNodeAt(start);node.object=base;node.property=parseIdent(true);return parseSubscripts(finishNode(node,"VirtualPropertyExpression"),start,noCalls)}else if(eat(_dot)){var node=startNodeAt(start);node.object=base;node.property=parseIdent(true);node.computed=false;return parseSubscripts(finishNode(node,"MemberExpression"),start,noCalls)}else if(eat(_bracketL)){var node=startNodeAt(start);node.object=base;node.property=parseExpression();node.computed=true;expect(_bracketR);return parseSubscripts(finishNode(node,"MemberExpression"),start,noCalls)}else if(!noCalls&&eat(_parenL)){var node=startNodeAt(start);node.callee=base;node.arguments=parseExprList(_parenR,false);return parseSubscripts(finishNode(node,"CallExpression"),start,noCalls)}else if(tokType===_bquote){var node=startNodeAt(start);node.tag=base;node.quasi=parseTemplate();return parseSubscripts(finishNode(node,"TaggedTemplateExpression"),start,noCalls)}return base}function parseExprAtom(){switch(tokType){case _this:var node=startNode();next();return finishNode(node,"ThisExpression");case _yield:if(inGenerator)return parseYield();case _await:if(inAsync)return parseAwait();case _name:var start=storeCurrentPos();var id=parseIdent(tokType!==_name);if(eat(_arrow)){return parseArrowExpression(startNodeAt(start),[id])}return id;case _regexp:var node=startNode();node.regex={pattern:tokVal.pattern,flags:tokVal.flags};node.value=tokVal.value;node.raw=input.slice(tokStart,tokEnd);next();return finishNode(node,"Literal");case _num:case _string:case _xjsText:var node=startNode();node.value=tokVal;node.raw=input.slice(tokStart,tokEnd);next();return finishNode(node,"Literal");case _null:case _true:case _false:var node=startNode();node.value=tokType.atomValue;node.raw=tokType.keyword;next();return finishNode(node,"Literal");case _parenL:var start=storeCurrentPos();var val,exprList;next();if(options.ecmaVersion>=7&&tokType===_for){val=parseComprehension(startNodeAt(start),true)}else{var oldParenL=++metParenL;if(tokType!==_parenR){val=parseExpression();exprList=val.type==="SequenceExpression"?val.expressions:[val]}else{exprList=[]}expect(_parenR);if(metParenL===oldParenL&&eat(_arrow)){val=parseArrowExpression(startNodeAt(start),exprList)}else{if(!val)unexpected(lastStart);if(options.ecmaVersion>=6){for(var i=0;i<exprList.length;i++){if(exprList[i].type==="SpreadElement")unexpected()}}if(options.preserveParens){var par=startNodeAt(start);par.expression=val;val=finishNode(par,"ParenthesizedExpression")}}}return val;case _bracketL:var node=startNode();next();if(options.ecmaVersion>=7&&tokType===_for){return parseComprehension(node,false)}node.elements=parseExprList(_bracketR,true,true);return finishNode(node,"ArrayExpression");case _braceL:return parseObj();case _async:return parseAsync(startNode(),false);case _function:var node=startNode();next();return parseFunction(node,false,false);case _class:return parseClass(startNode(),false);case _new:return parseNew();case _bquote:return parseTemplate();case _lt:return parseXJSElement();case _colon:return parseBindFunctionExpression();default:unexpected()}}function parseBindFunctionExpression(){var node=startNode();next();var start=storeCurrentPos();node.callee=parseSubscripts(parseExprAtom(),start,true);if(eat(_parenL)){node.arguments=parseExprList(_parenR,false)}else{node.arguments=[]}return finishNode(node,"BindFunctionExpression")}function parseNew(){var node=startNode();next();var start=storeCurrentPos();node.callee=parseSubscripts(parseExprAtom(),start,true);if(eat(_parenL))node.arguments=parseExprList(_parenR,false);
else node.arguments=empty;return finishNode(node,"NewExpression")}function parseTemplate(){var node=startNode();node.expressions=[];node.quasis=[];inTemplate=true;next();for(;;){var elem=startNode();elem.value={cooked:tokVal,raw:input.slice(tokStart,tokEnd)};elem.tail=false;next();node.quasis.push(finishNode(elem,"TemplateElement"));if(tokType===_bquote){elem.tail=true;break}inTemplate=false;expect(_dollarBraceL);node.expressions.push(parseExpression());inTemplate=true;tokPos=tokEnd;expect(_braceR)}inTemplate=false;next();return finishNode(node,"TemplateLiteral")}function parseObj(){var node=startNode(),first=true,propHash={};node.properties=[];next();while(!eat(_braceR)){if(!first){expect(_comma);if(options.allowTrailingCommas&&eat(_braceR))break}else first=false;var prop=startNode(),isGenerator,isAsync;if(options.ecmaVersion>=7){isAsync=eat(_async);if(isAsync&&tokType===_star)unexpected()}if(options.ecmaVersion>=6){prop.method=false;prop.shorthand=false;isGenerator=eat(_star)}if(options.ecmaVersion>=7&&tokType===_ellipsis){if(isAsync||isGenerator)unexpected();prop=parseMaybeUnary();prop.type="SpreadProperty";node.properties.push(prop);continue}parsePropertyName(prop);if(eat(_colon)){prop.value=parseExpression(true);prop.kind="init"}else if(options.ecmaVersion>=6&&tokType===_parenL){prop.kind="init";prop.method=true;prop.value=parseMethod(isGenerator,isAsync)}else if(options.ecmaVersion>=5&&!prop.computed&&prop.key.type==="Identifier"&&(prop.key.name==="get"||prop.key.name==="set")){if(isGenerator||isAsync)unexpected();prop.kind=prop.key.name;parsePropertyName(prop);prop.value=parseMethod(false,false)}else if(options.ecmaVersion>=6&&!prop.computed&&prop.key.type==="Identifier"){prop.kind="init";prop.value=prop.key;prop.shorthand=true}else unexpected();checkPropClash(prop,propHash);node.properties.push(finishNode(prop,"Property"))}return finishNode(node,"ObjectExpression")}function parsePropertyName(prop){if(options.ecmaVersion>=6){if(eat(_bracketL)){prop.computed=true;prop.key=parseExpression();expect(_bracketR);return}else{prop.computed=false}}prop.key=tokType===_num||tokType===_string?parseExprAtom():parseIdent(true)}function initFunction(node,isAsync){node.id=null;node.params=[];if(options.ecmaVersion>=6){node.defaults=[];node.rest=null;node.generator=false}if(options.ecmaVersion>=7){node.async=isAsync}}function parseFunction(node,isStatement,isAsync,allowExpressionBody){initFunction(node,isAsync);if(options.ecmaVersion>=6){if(isAsync&&tokType===_star)unexpected();node.generator=eat(_star)}if(isStatement||tokType===_name){node.id=parseIdent()}parseFunctionParams(node);parseFunctionBody(node,allowExpressionBody);return finishNode(node,isStatement?"FunctionDeclaration":"FunctionExpression")}function parseMethod(isGenerator,isAsync){var node=startNode();initFunction(node,isAsync);parseFunctionParams(node);var allowExpressionBody;if(options.ecmaVersion>=6){node.generator=isGenerator;allowExpressionBody=true}else{allowExpressionBody=false}parseFunctionBody(node,allowExpressionBody);return finishNode(node,"FunctionExpression")}function parseArrowExpression(node,params,isAsync){initFunction(node,isAsync);var defaults=node.defaults,hasDefaults=false;for(var i=0,lastI=params.length-1;i<=lastI;i++){var param=params[i];if(param.type==="AssignmentExpression"&¶m.operator==="="){hasDefaults=true;params[i]=param.left;defaults.push(param.right)}else{toAssignable(param,i===lastI,true);defaults.push(null);if(param.type==="SpreadElement"){params.length--;node.rest=param.argument;break}}}node.params=params;if(!hasDefaults)node.defaults=[];parseFunctionBody(node,true);return finishNode(node,"ArrowFunctionExpression")}function parseFunctionParams(node){var defaults=[],hasDefaults=false;expect(_parenL);for(;;){if(eat(_parenR)){break}else if(options.ecmaVersion>=6&&eat(_ellipsis)){node.rest=toAssignable(parseExprAtom(),false,true);checkSpreadAssign(node.rest);expect(_parenR);defaults.push(null);break}else{node.params.push(options.ecmaVersion>=6?toAssignable(parseExprAtom(),false,true):parseIdent());if(options.ecmaVersion>=6){if(eat(_eq)){hasDefaults=true;defaults.push(parseExpression(true))}else{defaults.push(null)}}if(!eat(_comma)){expect(_parenR);break}}}if(hasDefaults)node.defaults=defaults}function parseFunctionBody(node,allowExpression){var isExpression=allowExpression&&tokType!==_braceL;var oldInAsync=inAsync;inAsync=node.async;if(isExpression){node.body=parseExpression(true);node.expression=true}else{var oldInFunc=inFunction,oldInGen=inGenerator,oldLabels=labels;inFunction=true;inGenerator=node.generator;labels=[];node.body=parseBlock(true);node.expression=false;inFunction=oldInFunc;inGenerator=oldInGen;labels=oldLabels}inAsync=oldInAsync;if(strict||!isExpression&&node.body.body.length&&isUseStrict(node.body.body[0])){var nameHash={};if(node.id)checkFunctionParam(node.id,{});for(var i=0;i<node.params.length;i++)checkFunctionParam(node.params[i],nameHash);if(node.rest)checkFunctionParam(node.rest,nameHash)}}function parseClass(node,isStatement){next();node.id=tokType===_name?parseIdent():isStatement?unexpected():null;node.superClass=eat(_extends)?parseExpression():null;var classBody=startNode();classBody.body=[];expect(_braceL);while(!eat(_braceR)){var method=startNode();if(tokType===_name&&tokVal==="static"){next();method["static"]=true}else{method["static"]=false}var isAsync=false;if(options.ecmaVersion>=7){isAsync=eat(_async);if(isAsync&&tokType===_star)unexpected()}var isGenerator=eat(_star);parsePropertyName(method);if(tokType!==_parenL&&!method.computed&&method.key.type==="Identifier"&&(method.key.name==="get"||method.key.name==="set")){if(isGenerator||isAsync)unexpected();method.kind=method.key.name;parsePropertyName(method)}else{method.kind=""}method.value=parseMethod(isGenerator,isAsync);classBody.body.push(finishNode(method,"MethodDefinition"));eat(_semi)}node.body=finishNode(classBody,"ClassBody");return finishNode(node,isStatement?"ClassDeclaration":"ClassExpression")}function parseExprList(close,allowTrailingComma,allowEmpty){var elts=[],first=true;while(!eat(close)){if(!first){expect(_comma);if(allowTrailingComma&&options.allowTrailingCommas&&eat(close))break}else first=false;if(allowEmpty&&tokType===_comma)elts.push(null);else elts.push(parseExpression(true))}return elts}function parseIdent(liberal){var node=startNode();if(liberal&&options.forbidReserved=="everywhere")liberal=false;if(tokType===_name){if(!liberal&&(options.forbidReserved&&(options.ecmaVersion===3?isReservedWord3:isReservedWord5)(tokVal)||strict&&isStrictReservedWord(tokVal))&&input.slice(tokStart,tokEnd).indexOf("\\")==-1)raise(tokStart,"The keyword '"+tokVal+"' is reserved");node.name=tokVal}else if(liberal&&tokType.keyword){node.name=tokType.keyword}else{unexpected()}tokRegexpAllowed=false;next();return finishNode(node,"Identifier")}function parseExport(node){next();if(tokType===_var||tokType===_const||tokType===_let||tokType===_function||tokType===_class||tokType===_async){node.declaration=parseStatement();node["default"]=false;node.specifiers=null;node.source=null}else if(eat(_default)){node.declaration=parseExpression(true);node["default"]=true;node.specifiers=null;node.source=null;semicolon()}else{var isBatch=tokType===_star;node.declaration=null;node["default"]=false;node.specifiers=parseExportSpecifiers();if(tokType===_name&&tokVal==="from"){next();node.source=tokType===_string?parseExprAtom():unexpected()}else{if(isBatch)unexpected();node.source=null}semicolon()}return finishNode(node,"ExportDeclaration")}function parseExportSpecifiers(){var nodes=[],first=true;if(tokType===_star){var node=startNode();next();nodes.push(finishNode(node,"ExportBatchSpecifier"))}else{expect(_braceL);while(!eat(_braceR)){if(!first){expect(_comma);if(options.allowTrailingCommas&&eat(_braceR))break}else first=false;var node=startNode();node.id=parseIdent(tokType===_default);if(tokType===_name&&tokVal==="as"){next();node.name=parseIdent(true)}else{node.name=null}nodes.push(finishNode(node,"ExportSpecifier"))}}return nodes}function parseImport(node){next();if(tokType===_string){node.specifiers=[];node.source=parseExprAtom();node.kind=""}else{node.specifiers=parseImportSpecifiers();if(tokType!==_name||tokVal!=="from")unexpected();next();node.source=tokType===_string?parseExprAtom():unexpected();node.kind=node.specifiers[0]["default"]?"default":"named"}semicolon();return finishNode(node,"ImportDeclaration")}function parseImportSpecifiers(){var nodes=[],first=true;if(tokType===_star){var node=startNode();next();if(tokType!==_name||tokVal!=="as")unexpected();next();node.name=parseIdent();checkLVal(node.name,true);nodes.push(finishNode(node,"ImportBatchSpecifier"));return nodes}if(tokType===_name){var node=startNode();node.id=parseIdent();checkLVal(node.id,true);node.name=null;node["default"]=true;nodes.push(finishNode(node,"ImportSpecifier"));if(!eat(_comma))return nodes}expect(_braceL);while(!eat(_braceR)){if(!first){expect(_comma);if(options.allowTrailingCommas&&eat(_braceR))break}else first=false;var node=startNode();node.id=parseIdent(true);if(tokType===_name&&tokVal==="as"){next();node.name=parseIdent()}else{node.name=null}checkLVal(node.name||node.id,true);node["default"]=false;nodes.push(finishNode(node,"ImportSpecifier"))}return nodes}function parseYield(){var node=startNode();next();if(eat(_semi)||canInsertSemicolon()){node.delegate=false;node.argument=null}else{node.delegate=eat(_star);node.argument=parseExpression(true)}return finishNode(node,"YieldExpression")}function parseAwait(){var node=startNode();next();if(eat(_semi)||canInsertSemicolon()){unexpected()}node.delegate=eat(_star);node.argument=parseExpression(true);return finishNode(node,"AwaitExpression")}function parseComprehension(node,isGenerator){node.blocks=[];while(tokType===_for){var block=startNode();next();expect(_parenL);block.left=toAssignable(parseExprAtom());checkLVal(block.left,true);if(tokType!==_name||tokVal!=="of")unexpected();next();block.of=true;block.right=parseExpression();expect(_parenR);node.blocks.push(finishNode(block,"ComprehensionBlock"))}node.filter=eat(_if)?parseParenExpression():null;node.body=parseExpression();expect(isGenerator?_parenR:_bracketR);node.generator=isGenerator;return finishNode(node,"ComprehensionExpression")}function getQualifiedXJSName(object){if(object.type==="XJSIdentifier"){return object.name}if(object.type==="XJSNamespacedName"){return object.namespace.name+":"+object.name.name}if(object.type==="XJSMemberExpression"){return getQualifiedXJSName(object.object)+"."+getQualifiedXJSName(object.property)}}function parseXJSIdentifier(){var node=startNode();if(tokType===_xjsName){node.name=tokVal}else if(tokType.keyword){node.name=tokType.keyword}else{unexpected()}tokRegexpAllowed=false;next();return finishNode(node,"XJSIdentifier")}function parseXJSNamespacedName(){var node=startNode();node.namespace=parseXJSIdentifier();expect(_colon);node.name=parseXJSIdentifier();return finishNode(node,"XJSNamespacedName")}function parseXJSMemberExpression(){var start=storeCurrentPos();var node=parseXJSIdentifier();while(eat(_dot)){var newNode=startNodeAt(start);newNode.object=node;newNode.property=parseXJSIdentifier();node=finishNode(newNode,"XJSMemberExpression")}return node}function parseXJSElementName(){switch(nextChar()){case":":return parseXJSNamespacedName();case".":return parseXJSMemberExpression();default:return parseXJSIdentifier()}}function parseXJSAttributeName(){if(nextChar()===":"){return parseXJSNamespacedName()}return parseXJSIdentifier()}function parseXJSAttributeValue(){switch(tokType){case _braceL:var node=parseXJSExpressionContainer();if(node.expression.type==="XJSEmptyExpression"){raise(node.start,"XJS attributes must only be assigned a non-empty "+"expression")}return node;case _lt:return parseXJSElement();case _xjsText:return parseExprAtom();default:raise(tokStart,"XJS value should be either an expression or a quoted XJS text")}}function parseXJSEmptyExpression(){if(tokType!==_braceR){unexpected()}var tmp;tmp=tokStart;tokStart=lastEnd;lastEnd=tmp;tmp=tokStartLoc;tokStartLoc=lastEndLoc;lastEndLoc=tmp;return finishNode(startNode(),"XJSEmptyExpression")}function parseXJSExpressionContainer(){var node=startNode();var origInXJSTag=inXJSTag,origInXJSChild=inXJSChild;inXJSTag=false;inXJSChild=false;next();node.expression=tokType===_braceR?parseXJSEmptyExpression():parseExpression();inXJSTag=origInXJSTag;inXJSChild=origInXJSChild;if(inXJSChild){tokPos=tokEnd}expect(_braceR);return finishNode(node,"XJSExpressionContainer")}function parseXJSAttribute(){if(tokType===_braceL){var tokStart1=tokStart,tokStartLoc1=tokStartLoc;var origInXJSTag=inXJSTag;inXJSTag=false;next();if(tokType!==_ellipsis)unexpected();var node=parseMaybeUnary();inXJSTag=origInXJSTag;expect(_braceR);node.type="XJSSpreadAttribute";node.start=tokStart1;node.end=lastEnd;if(options.locations){node.loc.start=tokStartLoc1;node.loc.end=lastEndLoc}if(options.ranges){node.range=[tokStart1,lastEnd]}return node}var node=startNode();node.name=parseXJSAttributeName();if(tokType===_eq){next();node.value=parseXJSAttributeValue()}else{node.value=null}return finishNode(node,"XJSAttribute")}function parseXJSChild(){switch(tokType){case _braceL:return parseXJSExpressionContainer();case _xjsText:return parseExprAtom();default:return parseXJSElement()}}function parseXJSOpeningElement(){var node=startNode(),attributes=node.attributes=[];var origInXJSChild=inXJSChild;var origInXJSTag=inXJSTag;inXJSChild=false;inXJSTag=true;next();node.name=parseXJSElementName();while(tokType!==_eof&&tokType!==_slash&&tokType!==_gt){attributes.push(parseXJSAttribute())}inXJSTag=false;if(node.selfClosing=!!eat(_slash)){inXJSTag=origInXJSTag;inXJSChild=origInXJSChild}else{inXJSChild=true}expect(_gt);return finishNode(node,"XJSOpeningElement")}function parseXJSClosingElement(){var node=startNode();var origInXJSChild=inXJSChild;var origInXJSTag=inXJSTag;inXJSChild=false;inXJSTag=true;tokRegexpAllowed=false;expect(_ltSlash);node.name=parseXJSElementName();skipSpace();inXJSChild=origInXJSChild;inXJSTag=origInXJSTag;tokRegexpAllowed=false;if(inXJSChild){tokPos=tokEnd}expect(_gt);return finishNode(node,"XJSClosingElement")}function parseXJSElement(){var node=startNode();var children=[];var origInXJSChild=inXJSChild;var openingElement=parseXJSOpeningElement();var closingElement=null;if(!openingElement.selfClosing){while(tokType!==_eof&&tokType!==_ltSlash){inXJSChild=true;children.push(parseXJSChild())}inXJSChild=origInXJSChild;closingElement=parseXJSClosingElement();if(getQualifiedXJSName(closingElement.name)!==getQualifiedXJSName(openingElement.name)){raise(closingElement.start,"Expected corresponding XJS closing tag for '"+getQualifiedXJSName(openingElement.name)+"'")}}if(!origInXJSChild&&tokType===_lt){raise(tokStart,"Adjacent XJS elements must be wrapped in an enclosing tag")}node.openingElement=openingElement;node.closingElement=closingElement;node.children=children;return finishNode(node,"XJSElement")}})},{}],78:[function(require,module,exports){var types=require("../lib/types");var Type=types.Type;var def=Type.def;var or=Type.or;var builtin=types.builtInTypes;var isString=builtin.string;var isNumber=builtin.number;var isBoolean=builtin.boolean;var isRegExp=builtin.RegExp;var shared=require("../lib/shared");var defaults=shared.defaults;var geq=shared.geq;def("Node").field("type",isString).field("loc",or(def("SourceLocation"),null),defaults["null"],true);def("SourceLocation").build("start","end","source").field("start",def("Position")).field("end",def("Position")).field("source",or(isString,null),defaults["null"]);def("Position").build("line","column").field("line",geq(1)).field("column",geq(0));def("Program").bases("Node").build("body").field("body",[def("Statement")]);def("Function").bases("Node").field("id",or(def("Identifier"),null),defaults["null"]).field("params",[def("Pattern")]).field("body",or(def("BlockStatement"),def("Expression")));def("Statement").bases("Node");def("EmptyStatement").bases("Statement").build();def("BlockStatement").bases("Statement").build("body").field("body",[def("Statement")]);def("ExpressionStatement").bases("Statement").build("expression").field("expression",def("Expression"));def("IfStatement").bases("Statement").build("test","consequent","alternate").field("test",def("Expression")).field("consequent",def("Statement")).field("alternate",or(def("Statement"),null),defaults["null"]);def("LabeledStatement").bases("Statement").build("label","body").field("label",def("Identifier")).field("body",def("Statement"));def("BreakStatement").bases("Statement").build("label").field("label",or(def("Identifier"),null),defaults["null"]);def("ContinueStatement").bases("Statement").build("label").field("label",or(def("Identifier"),null),defaults["null"]);def("WithStatement").bases("Statement").build("object","body").field("object",def("Expression")).field("body",def("Statement"));def("SwitchStatement").bases("Statement").build("discriminant","cases","lexical").field("discriminant",def("Expression")).field("cases",[def("SwitchCase")]).field("lexical",isBoolean,defaults["false"]);def("ReturnStatement").bases("Statement").build("argument").field("argument",or(def("Expression"),null));def("ThrowStatement").bases("Statement").build("argument").field("argument",def("Expression"));def("TryStatement").bases("Statement").build("block","handler","finalizer").field("block",def("BlockStatement")).field("handler",or(def("CatchClause"),null),function(){return this.handlers&&this.handlers[0]||null}).field("handlers",[def("CatchClause")],function(){return this.handler?[this.handler]:[]},true).field("guardedHandlers",[def("CatchClause")],defaults.emptyArray).field("finalizer",or(def("BlockStatement"),null),defaults["null"]);def("CatchClause").bases("Node").build("param","guard","body").field("param",def("Pattern")).field("guard",or(def("Expression"),null),defaults["null"]).field("body",def("BlockStatement"));def("WhileStatement").bases("Statement").build("test","body").field("test",def("Expression")).field("body",def("Statement"));def("DoWhileStatement").bases("Statement").build("body","test").field("body",def("Statement")).field("test",def("Expression"));def("ForStatement").bases("Statement").build("init","test","update","body").field("init",or(def("VariableDeclaration"),def("Expression"),null)).field("test",or(def("Expression"),null)).field("update",or(def("Expression"),null)).field("body",def("Statement"));def("ForInStatement").bases("Statement").build("left","right","body","each").field("left",or(def("VariableDeclaration"),def("Expression"))).field("right",def("Expression")).field("body",def("Statement")).field("each",isBoolean);def("DebuggerStatement").bases("Statement").build();def("Declaration").bases("Statement");def("FunctionDeclaration").bases("Function","Declaration").build("id","params","body").field("id",def("Identifier"));def("FunctionExpression").bases("Function","Expression").build("id","params","body");def("VariableDeclaration").bases("Declaration").build("kind","declarations").field("kind",or("var","let","const")).field("declarations",[or(def("VariableDeclarator"),def("Identifier"))]);def("VariableDeclarator").bases("Node").build("id","init").field("id",def("Pattern")).field("init",or(def("Expression"),null));def("Expression").bases("Node","Pattern");def("ThisExpression").bases("Expression").build();def("ArrayExpression").bases("Expression").build("elements").field("elements",[or(def("Expression"),null)]);def("ObjectExpression").bases("Expression").build("properties").field("properties",[def("Property")]);def("Property").bases("Node").build("kind","key","value").field("kind",or("init","get","set")).field("key",or(def("Literal"),def("Identifier"))).field("value",def("Expression"));def("SequenceExpression").bases("Expression").build("expressions").field("expressions",[def("Expression")]);var UnaryOperator=or("-","+","!","~","typeof","void","delete");def("UnaryExpression").bases("Expression").build("operator","argument","prefix").field("operator",UnaryOperator).field("argument",def("Expression")).field("prefix",isBoolean,defaults["true"]);var BinaryOperator=or("==","!=","===","!==","<","<=",">",">=","<<",">>",">>>","+","-","*","/","%","&","|","^","in","instanceof","..");def("BinaryExpression").bases("Expression").build("operator","left","right").field("operator",BinaryOperator).field("left",def("Expression")).field("right",def("Expression"));var AssignmentOperator=or("=","+=","-=","*=","/=","%=","<<=",">>=",">>>=","|=","^=","&=");def("AssignmentExpression").bases("Expression").build("operator","left","right").field("operator",AssignmentOperator).field("left",def("Pattern")).field("right",def("Expression"));var UpdateOperator=or("++","--");def("UpdateExpression").bases("Expression").build("operator","argument","prefix").field("operator",UpdateOperator).field("argument",def("Expression")).field("prefix",isBoolean);var LogicalOperator=or("||","&&");def("LogicalExpression").bases("Expression").build("operator","left","right").field("operator",LogicalOperator).field("left",def("Expression")).field("right",def("Expression"));def("ConditionalExpression").bases("Expression").build("test","consequent","alternate").field("test",def("Expression")).field("consequent",def("Expression")).field("alternate",def("Expression"));def("NewExpression").bases("Expression").build("callee","arguments").field("callee",def("Expression")).field("arguments",[def("Expression")]);def("CallExpression").bases("Expression").build("callee","arguments").field("callee",def("Expression")).field("arguments",[def("Expression")]);def("MemberExpression").bases("Expression").build("object","property","computed").field("object",def("Expression")).field("property",or(def("Identifier"),def("Expression"))).field("computed",isBoolean);def("Pattern").bases("Node");def("ObjectPattern").bases("Pattern").build("properties").field("properties",[def("PropertyPattern")]);def("PropertyPattern").bases("Pattern").build("key","pattern").field("key",or(def("Literal"),def("Identifier"))).field("pattern",def("Pattern"));def("ArrayPattern").bases("Pattern").build("elements").field("elements",[or(def("Pattern"),null)]);def("SwitchCase").bases("Node").build("test","consequent").field("test",or(def("Expression"),null)).field("consequent",[def("Statement")]);def("Identifier").bases("Node","Expression","Pattern").build("name").field("name",isString);def("Literal").bases("Node","Expression").build("value").field("value",or(isString,isBoolean,null,isNumber,isRegExp))},{"../lib/shared":89,"../lib/types":90}],79:[function(require,module,exports){require("./core");var types=require("../lib/types");var def=types.Type.def;var or=types.Type.or;var builtin=types.builtInTypes;var isString=builtin.string;var isBoolean=builtin.boolean;def("XMLDefaultDeclaration").bases("Declaration").field("namespace",def("Expression"));def("XMLAnyName").bases("Expression");def("XMLQualifiedIdentifier").bases("Expression").field("left",or(def("Identifier"),def("XMLAnyName"))).field("right",or(def("Identifier"),def("Expression"))).field("computed",isBoolean);def("XMLFunctionQualifiedIdentifier").bases("Expression").field("right",or(def("Identifier"),def("Expression"))).field("computed",isBoolean);def("XMLAttributeSelector").bases("Expression").field("attribute",def("Expression"));def("XMLFilterExpression").bases("Expression").field("left",def("Expression")).field("right",def("Expression"));def("XMLElement").bases("XML","Expression").field("contents",[def("XML")]);def("XMLList").bases("XML","Expression").field("contents",[def("XML")]);def("XML").bases("Node");def("XMLEscape").bases("XML").field("expression",def("Expression"));def("XMLText").bases("XML").field("text",isString);def("XMLStartTag").bases("XML").field("contents",[def("XML")]);def("XMLEndTag").bases("XML").field("contents",[def("XML")]);def("XMLPointTag").bases("XML").field("contents",[def("XML")]);def("XMLName").bases("XML").field("contents",or(isString,[def("XML")]));def("XMLAttribute").bases("XML").field("value",isString);def("XMLCdata").bases("XML").field("contents",isString);def("XMLComment").bases("XML").field("contents",isString);def("XMLProcessingInstruction").bases("XML").field("target",isString).field("contents",or(isString,null))},{"../lib/types":90,"./core":78}],80:[function(require,module,exports){require("./core");var types=require("../lib/types");var def=types.Type.def;var or=types.Type.or;var builtin=types.builtInTypes;var isBoolean=builtin.boolean;var isObject=builtin.object;var isString=builtin.string;var defaults=require("../lib/shared").defaults;def("Function").field("generator",isBoolean,defaults["false"]).field("expression",isBoolean,defaults["false"]).field("defaults",[or(def("Expression"),null)],defaults.emptyArray).field("rest",or(def("Identifier"),null),defaults["null"]);def("FunctionDeclaration").build("id","params","body","generator","expression");def("FunctionExpression").build("id","params","body","generator","expression");def("ArrowFunctionExpression").bases("Function","Expression").build("params","body","expression").field("id",null,defaults["null"]).field("generator",false);def("YieldExpression").bases("Expression").build("argument","delegate").field("argument",or(def("Expression"),null)).field("delegate",isBoolean,defaults["false"]);def("GeneratorExpression").bases("Expression").build("body","blocks","filter").field("body",def("Expression")).field("blocks",[def("ComprehensionBlock")]).field("filter",or(def("Expression"),null));def("ComprehensionExpression").bases("Expression").build("body","blocks","filter").field("body",def("Expression")).field("blocks",[def("ComprehensionBlock")]).field("filter",or(def("Expression"),null));def("ComprehensionBlock").bases("Node").build("left","right","each").field("left",def("Pattern")).field("right",def("Expression")).field("each",isBoolean);def("ModuleSpecifier").bases("Literal").build("value").field("value",isString);def("Property").field("method",isBoolean,defaults["false"]).field("shorthand",isBoolean,defaults["false"]).field("computed",isBoolean,defaults["false"]);def("MethodDefinition").bases("Declaration").build("kind","key","value").field("kind",or("init","get","set","")).field("key",or(def("Literal"),def("Identifier"))).field("value",def("Function"));def("SpreadElement").bases("Node").build("argument").field("argument",def("Expression"));def("ArrayExpression").field("elements",[or(def("Expression"),def("SpreadElement"),null)]);def("NewExpression").field("arguments",[or(def("Expression"),def("SpreadElement"))]);def("CallExpression").field("arguments",[or(def("Expression"),def("SpreadElement"))]);def("SpreadElementPattern").bases("Pattern").build("argument").field("argument",def("Pattern"));var ClassBodyElement=or(def("MethodDefinition"),def("VariableDeclarator"),def("ClassPropertyDefinition"),def("ClassProperty"));def("ClassProperty").bases("Declaration").build("id").field("id",def("Identifier"));def("ClassPropertyDefinition").bases("Declaration").build("definition").field("definition",ClassBodyElement);def("ClassBody").bases("Declaration").build("body").field("body",[ClassBodyElement]);def("ClassDeclaration").bases("Declaration").build("id","body","superClass").field("id",def("Identifier")).field("body",def("ClassBody")).field("superClass",or(def("Expression"),null),defaults["null"]);def("ClassExpression").bases("Expression").build("id","body","superClass").field("id",or(def("Identifier"),null),defaults["null"]).field("body",def("ClassBody")).field("superClass",or(def("Expression"),null),defaults["null"]);def("Specifier").bases("Node");def("NamedSpecifier").bases("Specifier").field("id",def("Identifier")).field("name",or(def("Identifier"),null),defaults["null"]);def("ExportSpecifier").bases("NamedSpecifier").build("id","name");def("ExportBatchSpecifier").bases("Specifier").build();def("ImportSpecifier").bases("NamedSpecifier").build("id","name");def("ImportNamespaceSpecifier").bases("Specifier").build("id").field("id",def("Identifier"));def("ImportDefaultSpecifier").bases("Specifier").build("id").field("id",def("Identifier"));def("ExportDeclaration").bases("Declaration").build("default","declaration","specifiers","source").field("default",isBoolean).field("declaration",or(def("Declaration"),def("Expression"),null)).field("specifiers",[or(def("ExportSpecifier"),def("ExportBatchSpecifier"))],defaults.emptyArray).field("source",or(def("ModuleSpecifier"),null),defaults["null"]);def("ImportDeclaration").bases("Declaration").build("specifiers","source").field("specifiers",[or(def("ImportSpecifier"),def("ImportNamespaceSpecifier"),def("ImportDefaultSpecifier"))],defaults.emptyArray).field("source",def("ModuleSpecifier"));def("TaggedTemplateExpression").bases("Expression").field("tag",def("Expression")).field("quasi",def("TemplateLiteral"));def("TemplateLiteral").bases("Expression").build("quasis","expressions").field("quasis",[def("TemplateElement")]).field("expressions",[def("Expression")]);def("TemplateElement").bases("Node").build("value","tail").field("value",{cooked:isString,raw:isString}).field("tail",isBoolean)},{"../lib/shared":89,"../lib/types":90,"./core":78}],81:[function(require,module,exports){require("./core");var types=require("../lib/types");var def=types.Type.def;var or=types.Type.or;var builtin=types.builtInTypes;var isBoolean=builtin.boolean;var defaults=require("../lib/shared").defaults;def("Function").field("async",isBoolean,defaults["false"]);def("SpreadProperty").bases("Node").build("argument").field("argument",def("Expression"));def("ObjectExpression").field("properties",[or(def("Property"),def("SpreadProperty"))]);def("SpreadPropertyPattern").bases("Pattern").build("argument").field("argument",def("Pattern"));def("ObjectPattern").field("properties",[or(def("PropertyPattern"),def("SpreadPropertyPattern"))]);def("AwaitExpression").bases("Expression").build("argument","all").field("argument",or(def("Expression"),null)).field("all",isBoolean,defaults["false"])},{"../lib/shared":89,"../lib/types":90,"./core":78}],82:[function(require,module,exports){require("./core");var types=require("../lib/types");var def=types.Type.def;var or=types.Type.or;var builtin=types.builtInTypes;var isString=builtin.string;var isBoolean=builtin.boolean;var defaults=require("../lib/shared").defaults;def("XJSAttribute").bases("Node").build("name","value").field("name",or(def("XJSIdentifier"),def("XJSNamespacedName"))).field("value",or(def("Literal"),def("XJSExpressionContainer"),null),defaults["null"]);def("XJSIdentifier").bases("Node").build("name").field("name",isString);def("XJSNamespacedName").bases("Node").build("namespace","name").field("namespace",def("XJSIdentifier")).field("name",def("XJSIdentifier"));def("XJSMemberExpression").bases("MemberExpression").build("object","property").field("object",or(def("XJSIdentifier"),def("XJSMemberExpression"))).field("property",def("XJSIdentifier")).field("computed",isBoolean,defaults.false);var XJSElementName=or(def("XJSIdentifier"),def("XJSNamespacedName"),def("XJSMemberExpression"));def("XJSSpreadAttribute").bases("Node").build("argument").field("argument",def("Expression"));var XJSAttributes=[or(def("XJSAttribute"),def("XJSSpreadAttribute"))];def("XJSExpressionContainer").bases("Expression").build("expression").field("expression",def("Expression"));def("XJSElement").bases("Expression").build("openingElement","closingElement","children").field("openingElement",def("XJSOpeningElement")).field("closingElement",or(def("XJSClosingElement"),null),defaults["null"]).field("children",[or(def("XJSElement"),def("XJSExpressionContainer"),def("XJSText"),def("Literal"))],defaults.emptyArray).field("name",XJSElementName,function(){return this.openingElement.name}).field("selfClosing",isBoolean,function(){return this.openingElement.selfClosing}).field("attributes",XJSAttributes,function(){return this.openingElement.attributes});def("XJSOpeningElement").bases("Node").build("name","attributes","selfClosing").field("name",XJSElementName).field("attributes",XJSAttributes,defaults.emptyArray).field("selfClosing",isBoolean,defaults["false"]);
def("XJSClosingElement").bases("Node").build("name").field("name",XJSElementName);def("XJSText").bases("Literal").build("value").field("value",isString);def("XJSEmptyExpression").bases("Expression").build();def("TypeAnnotatedIdentifier").bases("Pattern").build("annotation","identifier").field("annotation",def("TypeAnnotation")).field("identifier",def("Identifier"));def("TypeAnnotation").bases("Pattern").build("annotatedType","templateTypes","paramTypes","returnType","unionType","nullable").field("annotatedType",def("Identifier")).field("templateTypes",or([def("TypeAnnotation")],null)).field("paramTypes",or([def("TypeAnnotation")],null)).field("returnType",or(def("TypeAnnotation"),null)).field("unionType",or(def("TypeAnnotation"),null)).field("nullable",isBoolean);def("ObjectTypeAnnotation").bases("Pattern").build("properties","nullable").field("properties",[def("Property")]).field("nullable",isBoolean);def("VoidTypeAnnotation").bases("Pattern");def("ParametricTypeAnnotation").bases("Pattern").build("params").field("params",[def("Identifier")]);def("OptionalParameter").bases("Pattern").build("identifier").field("identifier",def("Identifier"));def("Identifier").field("annotation",or(def("TypeAnnotation"),def("VoidTypeAnnotation"),def("ObjectTypeAnnotation"),null),defaults["null"]);def("Function").field("returnType",or(def("TypeAnnotation"),def("VoidTypeAnnotation"),def("ObjectTypeAnnotation"),null),defaults["null"]).field("parametricType",or(def("ParametricTypeAnnotation"),null),defaults["null"]);def("ClassProperty").field("id",or(def("Identifier"),def("TypeAnnotatedIdentifier")));def("ClassDeclaration").field("parametricType",or(def("ParametricTypeAnnotation"),null),defaults["null"])},{"../lib/shared":89,"../lib/types":90,"./core":78}],83:[function(require,module,exports){require("./core");var types=require("../lib/types");var def=types.Type.def;var or=types.Type.or;var geq=require("../lib/shared").geq;def("ForOfStatement").bases("Statement").build("left","right","body").field("left",or(def("VariableDeclaration"),def("Expression"))).field("right",def("Expression")).field("body",def("Statement"));def("LetStatement").bases("Statement").build("head","body").field("head",[def("VariableDeclarator")]).field("body",def("Statement"));def("LetExpression").bases("Expression").build("head","body").field("head",[def("VariableDeclarator")]).field("body",def("Expression"));def("GraphExpression").bases("Expression").build("index","expression").field("index",geq(0)).field("expression",def("Literal"));def("GraphIndexExpression").bases("Expression").build("index").field("index",geq(0))},{"../lib/shared":89,"../lib/types":90,"./core":78}],84:[function(require,module,exports){var assert=require("assert");var types=require("../main");var getFieldNames=types.getFieldNames;var getFieldValue=types.getFieldValue;var isArray=types.builtInTypes.array;var isObject=types.builtInTypes.object;var isDate=types.builtInTypes.Date;var isRegExp=types.builtInTypes.RegExp;var hasOwn=Object.prototype.hasOwnProperty;function astNodesAreEquivalent(a,b,problemPath){if(isArray.check(problemPath)){problemPath.length=0}else{problemPath=null}return areEquivalent(a,b,problemPath)}astNodesAreEquivalent.assert=function(a,b){var problemPath=[];if(!astNodesAreEquivalent(a,b,problemPath)){if(problemPath.length===0){assert.strictEqual(a,b)}else{assert.ok(false,"Nodes differ in the following path: "+problemPath.map(subscriptForProperty).join(""))}}};function subscriptForProperty(property){if(/[_$a-z][_$a-z0-9]*/i.test(property)){return"."+property}return"["+JSON.stringify(property)+"]"}function areEquivalent(a,b,problemPath){if(a===b){return true}if(isArray.check(a)){return arraysAreEquivalent(a,b,problemPath)}if(isObject.check(a)){return objectsAreEquivalent(a,b,problemPath)}if(isDate.check(a)){return isDate.check(b)&&+a===+b}if(isRegExp.check(a)){return isRegExp.check(b)&&(a.source===b.source&&a.global===b.global&&a.multiline===b.multiline&&a.ignoreCase===b.ignoreCase)}return a==b}function arraysAreEquivalent(a,b,problemPath){isArray.assert(a);var aLength=a.length;if(!isArray.check(b)||b.length!==aLength){if(problemPath){problemPath.push("length")}return false}for(var i=0;i<aLength;++i){if(problemPath){problemPath.push(i)}if(i in a!==i in b){return false}if(!areEquivalent(a[i],b[i],problemPath)){return false}if(problemPath){assert.strictEqual(problemPath.pop(),i)}}return true}function objectsAreEquivalent(a,b,problemPath){isObject.assert(a);if(!isObject.check(b)){return false}if(a.type!==b.type){if(problemPath){problemPath.push("type")}return false}var aNames=getFieldNames(a);var aNameCount=aNames.length;var bNames=getFieldNames(b);var bNameCount=bNames.length;if(aNameCount===bNameCount){for(var i=0;i<aNameCount;++i){var name=aNames[i];var aChild=getFieldValue(a,name);var bChild=getFieldValue(b,name);if(problemPath){problemPath.push(name)}if(!areEquivalent(aChild,bChild,problemPath)){return false}if(problemPath){assert.strictEqual(problemPath.pop(),name)}}return true}if(!problemPath){return false}var seenNames=Object.create(null);for(i=0;i<aNameCount;++i){seenNames[aNames[i]]=true}for(i=0;i<bNameCount;++i){name=bNames[i];if(!hasOwn.call(seenNames,name)){problemPath.push(name);return false}delete seenNames[name]}for(name in seenNames){problemPath.push(name);break}return false}module.exports=astNodesAreEquivalent},{"../main":91,assert:93}],85:[function(require,module,exports){var assert=require("assert");var types=require("./types");var n=types.namedTypes;var b=types.builders;var isNumber=types.builtInTypes.number;var isArray=types.builtInTypes.array;var Path=require("./path");var Scope=require("./scope");function NodePath(value,parentPath,name){assert.ok(this instanceof NodePath);Path.call(this,value,parentPath,name)}require("util").inherits(NodePath,Path);var NPp=NodePath.prototype;Object.defineProperties(NPp,{node:{get:function(){Object.defineProperty(this,"node",{configurable:true,value:this._computeNode()});return this.node}},parent:{get:function(){Object.defineProperty(this,"parent",{configurable:true,value:this._computeParent()});return this.parent}},scope:{get:function(){Object.defineProperty(this,"scope",{configurable:true,value:this._computeScope()});return this.scope}}});NPp.replace=function(){delete this.node;delete this.parent;delete this.scope;return Path.prototype.replace.apply(this,arguments)};NPp.prune=function(){var remainingNodePath=this.parent;this.replace();return cleanUpNodesAfterPrune(remainingNodePath)};NPp._computeNode=function(){var value=this.value;if(n.Node.check(value)){return value}var pp=this.parentPath;return pp&&pp.node||null};NPp._computeParent=function(){var value=this.value;var pp=this.parentPath;if(!n.Node.check(value)){while(pp&&!n.Node.check(pp.value)){pp=pp.parentPath}if(pp){pp=pp.parentPath}}while(pp&&!n.Node.check(pp.value)){pp=pp.parentPath}return pp||null};NPp._computeScope=function(){var value=this.value;var pp=this.parentPath;var scope=pp&&pp.scope;if(n.Node.check(value)&&Scope.isEstablishedBy(value)){scope=new Scope(this,scope)}return scope||null};NPp.getValueProperty=function(name){return types.getFieldValue(this.value,name)};NPp.needsParens=function(assumeExpressionContext){var pp=this.parentPath;if(!pp){return false}var node=this.value;if(!n.Expression.check(node)){return false}if(node.type==="Identifier"){return false}while(!n.Node.check(pp.value)){pp=pp.parentPath;if(!pp){return false}}var parent=pp.value;switch(node.type){case"UnaryExpression":case"SpreadElement":case"SpreadProperty":return parent.type==="MemberExpression"&&this.name==="object"&&parent.object===node;case"BinaryExpression":case"LogicalExpression":switch(parent.type){case"CallExpression":return this.name==="callee"&&parent.callee===node;case"UnaryExpression":case"SpreadElement":case"SpreadProperty":return true;case"MemberExpression":return this.name==="object"&&parent.object===node;case"BinaryExpression":case"LogicalExpression":var po=parent.operator;var pp=PRECEDENCE[po];var no=node.operator;var np=PRECEDENCE[no];if(pp>np){return true}if(pp===np&&this.name==="right"){assert.strictEqual(parent.right,node);return true}default:return false}case"SequenceExpression":switch(parent.type){case"ForStatement":return false;case"ExpressionStatement":return this.name!=="expression";default:return true}case"YieldExpression":switch(parent.type){case"BinaryExpression":case"LogicalExpression":case"UnaryExpression":case"SpreadElement":case"SpreadProperty":case"CallExpression":case"MemberExpression":case"NewExpression":case"ConditionalExpression":case"YieldExpression":return true;default:return false}case"Literal":return parent.type==="MemberExpression"&&isNumber.check(node.value)&&this.name==="object"&&parent.object===node;case"AssignmentExpression":case"ConditionalExpression":switch(parent.type){case"UnaryExpression":case"SpreadElement":case"SpreadProperty":case"BinaryExpression":case"LogicalExpression":return true;case"CallExpression":return this.name==="callee"&&parent.callee===node;case"ConditionalExpression":return this.name==="test"&&parent.test===node;case"MemberExpression":return this.name==="object"&&parent.object===node;default:return false}default:if(parent.type==="NewExpression"&&this.name==="callee"&&parent.callee===node){return containsCallExpression(node)}}if(assumeExpressionContext!==true&&!this.canBeFirstInStatement()&&this.firstInStatement())return true;return false};function isBinary(node){return n.BinaryExpression.check(node)||n.LogicalExpression.check(node)}function isUnaryLike(node){return n.UnaryExpression.check(node)||n.SpreadElement&&n.SpreadElement.check(node)||n.SpreadProperty&&n.SpreadProperty.check(node)}var PRECEDENCE={};[["||"],["&&"],["|"],["^"],["&"],["==","===","!=","!=="],["<",">","<=",">=","in","instanceof"],[">>","<<",">>>"],["+","-"],["*","/","%"]].forEach(function(tier,i){tier.forEach(function(op){PRECEDENCE[op]=i})});function containsCallExpression(node){if(n.CallExpression.check(node)){return true}if(isArray.check(node)){return node.some(containsCallExpression)}if(n.Node.check(node)){return types.someField(node,function(name,child){return containsCallExpression(child)})}return false}NPp.canBeFirstInStatement=function(){var node=this.node;return!n.FunctionExpression.check(node)&&!n.ObjectExpression.check(node)};NPp.firstInStatement=function(){return firstInStatement(this)};function firstInStatement(path){for(var node,parent;path.parent;path=path.parent){node=path.node;parent=path.parent.node;if(n.BlockStatement.check(parent)&&path.parent.name==="body"&&path.name===0){assert.strictEqual(parent.body[0],node);return true}if(n.ExpressionStatement.check(parent)&&path.name==="expression"){assert.strictEqual(parent.expression,node);return true}if(n.SequenceExpression.check(parent)&&path.parent.name==="expressions"&&path.name===0){assert.strictEqual(parent.expressions[0],node);continue}if(n.CallExpression.check(parent)&&path.name==="callee"){assert.strictEqual(parent.callee,node);continue}if(n.MemberExpression.check(parent)&&path.name==="object"){assert.strictEqual(parent.object,node);continue}if(n.ConditionalExpression.check(parent)&&path.name==="test"){assert.strictEqual(parent.test,node);continue}if(isBinary(parent)&&path.name==="left"){assert.strictEqual(parent.left,node);continue}if(n.UnaryExpression.check(parent)&&!parent.prefix&&path.name==="argument"){assert.strictEqual(parent.argument,node);continue}return false}return true}function cleanUpNodesAfterPrune(remainingNodePath){if(n.VariableDeclaration.check(remainingNodePath.node)){var declarations=remainingNodePath.get("declarations").value;if(!declarations||declarations.length===0){return remainingNodePath.prune()}}else if(n.ExpressionStatement.check(remainingNodePath.node)){if(!remainingNodePath.get("expression").value){return remainingNodePath.prune()}}else if(n.IfStatement.check(remainingNodePath.node)){cleanUpIfStatementAfterPrune(remainingNodePath)}return remainingNodePath}function cleanUpIfStatementAfterPrune(ifStatement){var testExpression=ifStatement.get("test").value;var alternate=ifStatement.get("alternate").value;var consequent=ifStatement.get("consequent").value;if(!consequent&&!alternate){var testExpressionStatement=b.expressionStatement(testExpression);ifStatement.replace(testExpressionStatement)}else if(!consequent&&alternate){var negatedTestExpression=b.unaryExpression("!",testExpression,true);if(n.UnaryExpression.check(testExpression)&&testExpression.operator==="!"){negatedTestExpression=testExpression.argument}ifStatement.get("test").replace(negatedTestExpression);ifStatement.get("consequent").replace(alternate);ifStatement.get("alternate").replace()}}module.exports=NodePath},{"./path":87,"./scope":88,"./types":90,assert:93,util:102}],86:[function(require,module,exports){var assert=require("assert");var types=require("./types");var NodePath=require("./node-path");var Node=types.namedTypes.Node;var isArray=types.builtInTypes.array;var isObject=types.builtInTypes.object;var isFunction=types.builtInTypes.function;var hasOwn=Object.prototype.hasOwnProperty;var undefined;function PathVisitor(){assert.ok(this instanceof PathVisitor);this._reusableContextStack=[];this._methodNameTable=computeMethodNameTable(this);this.Context=makeContextConstructor(this)}function computeMethodNameTable(visitor){var typeNames=Object.create(null);for(var methodName in visitor){if(/^visit[A-Z]/.test(methodName)){typeNames[methodName.slice("visit".length)]=true}}var supertypeTable=types.computeSupertypeLookupTable(typeNames);var methodNameTable=Object.create(null);var typeNames=Object.keys(supertypeTable);var typeNameCount=typeNames.length;for(var i=0;i<typeNameCount;++i){var typeName=typeNames[i];methodName="visit"+supertypeTable[typeName];if(isFunction.check(visitor[methodName])){methodNameTable[typeName]=methodName}}return methodNameTable}PathVisitor.fromMethodsObject=function fromMethodsObject(methods){if(methods instanceof PathVisitor){return methods}if(!isObject.check(methods)){return new PathVisitor}function Visitor(){assert.ok(this instanceof Visitor);PathVisitor.call(this)}var Vp=Visitor.prototype=Object.create(PVp);Vp.constructor=Visitor;extend(Vp,methods);extend(Visitor,PathVisitor);isFunction.assert(Visitor.fromMethodsObject);isFunction.assert(Visitor.visit);return new Visitor};function extend(target,source){for(var property in source){if(hasOwn.call(source,property)){target[property]=source[property]}}return target}PathVisitor.visit=function visit(node,methods){var visitor=PathVisitor.fromMethodsObject(methods);if(node instanceof NodePath){visitor.visit(node);return node.value}var rootPath=new NodePath({root:node});visitor.visit(rootPath.get("root"));return rootPath.value.root};var PVp=PathVisitor.prototype;PVp.visit=function(path){if(this instanceof this.Context){return this.visitor.visit(path)}assert.ok(path instanceof NodePath);var value=path.value;var methodName=Node.check(value)&&this._methodNameTable[value.type];if(methodName){var context=this.acquireContext(path);try{context.invokeVisitorMethod(methodName)}finally{this.releaseContext(context)}}else{visitChildren(path,this)}};function visitChildren(path,visitor){assert.ok(path instanceof NodePath);assert.ok(visitor instanceof PathVisitor);var value=path.value;if(isArray.check(value)){path.each(visitor.visit,visitor)}else if(!isObject.check(value)){}else{var childNames=types.getFieldNames(value);var childCount=childNames.length;var childPaths=[];for(var i=0;i<childCount;++i){var childName=childNames[i];if(!hasOwn.call(value,childName)){value[childName]=types.getFieldValue(value,childName)}childPaths.push(path.get(childName))}for(var i=0;i<childCount;++i){visitor.visit(childPaths[i])}}}PVp.acquireContext=function(path){if(this._reusableContextStack.length===0){return new this.Context(path)}return this._reusableContextStack.pop().reset(path)};PVp.releaseContext=function(context){assert.ok(context instanceof this.Context);this._reusableContextStack.push(context);context.currentPath=null};function makeContextConstructor(visitor){function Context(path){assert.ok(this instanceof Context);assert.ok(this instanceof PathVisitor);assert.ok(path instanceof NodePath);Object.defineProperty(this,"visitor",{value:visitor,writable:false,enumerable:true,configurable:false});this.currentPath=path;this.needToCallTraverse=true;Object.seal(this)}assert.ok(visitor instanceof PathVisitor);var Cp=Context.prototype=Object.create(visitor);Cp.constructor=Context;extend(Cp,sharedContextProtoMethods);return Context}var sharedContextProtoMethods=Object.create(null);sharedContextProtoMethods.reset=function reset(path){assert.ok(this instanceof this.Context);assert.ok(path instanceof NodePath);this.currentPath=path;this.needToCallTraverse=true;return this};sharedContextProtoMethods.invokeVisitorMethod=function invokeVisitorMethod(methodName){assert.ok(this instanceof this.Context);assert.ok(this.currentPath instanceof NodePath);var result=this.visitor[methodName].call(this,this.currentPath);if(result===false){this.needToCallTraverse=false}else if(result!==undefined){this.currentPath=this.currentPath.replace(result)[0];if(this.needToCallTraverse){this.traverse(this.currentPath)}}assert.strictEqual(this.needToCallTraverse,false,"Must either call this.traverse or return false in "+methodName)};sharedContextProtoMethods.traverse=function traverse(path,newVisitor){assert.ok(this instanceof this.Context);assert.ok(path instanceof NodePath);assert.ok(this.currentPath instanceof NodePath);this.needToCallTraverse=false;visitChildren(path,PathVisitor.fromMethodsObject(newVisitor||this.visitor))};module.exports=PathVisitor},{"./node-path":85,"./types":90,assert:93}],87:[function(require,module,exports){var assert=require("assert");var Op=Object.prototype;var hasOwn=Op.hasOwnProperty;var types=require("./types");var isArray=types.builtInTypes.array;var isNumber=types.builtInTypes.number;var Ap=Array.prototype;var slice=Ap.slice;var map=Ap.map;function Path(value,parentPath,name){assert.ok(this instanceof Path);if(parentPath){assert.ok(parentPath instanceof Path)}else{parentPath=null;name=null}this.value=value;this.parentPath=parentPath;this.name=name;this.__childCache=null}var Pp=Path.prototype;function getChildCache(path){return path.__childCache||(path.__childCache=Object.create(null))}function getChildPath(path,name){var cache=getChildCache(path);var actualChildValue=path.getValueProperty(name);var childPath=cache[name];if(!hasOwn.call(cache,name)||childPath.value!==actualChildValue){childPath=cache[name]=new path.constructor(actualChildValue,path,name)}return childPath}Pp.getValueProperty=function getValueProperty(name){return this.value[name]};Pp.get=function get(name){var path=this;var names=arguments;var count=names.length;for(var i=0;i<count;++i){path=getChildPath(path,names[i])}return path};Pp.each=function each(callback,context){var childPaths=[];var len=this.value.length;var i=0;for(var i=0;i<len;++i){if(hasOwn.call(this.value,i)){childPaths[i]=this.get(i)}}context=context||this;for(i=0;i<len;++i){if(hasOwn.call(childPaths,i)){callback.call(context,childPaths[i])}}};Pp.map=function map(callback,context){var result=[];this.each(function(childPath){result.push(callback.call(this,childPath))},context);return result};Pp.filter=function filter(callback,context){var result=[];this.each(function(childPath){if(callback.call(this,childPath)){result.push(childPath)}},context);return result};function emptyMoves(){}function getMoves(path,offset,start,end){isArray.assert(path.value);if(offset===0){return emptyMoves}var length=path.value.length;if(length<1){return emptyMoves}var argc=arguments.length;if(argc===2){start=0;end=length}else if(argc===3){start=Math.max(start,0);end=length}else{start=Math.max(start,0);end=Math.min(end,length)}isNumber.assert(start);isNumber.assert(end);var moves=Object.create(null);var cache=getChildCache(path);for(var i=start;i<end;++i){if(hasOwn.call(path.value,i)){var childPath=path.get(i);assert.strictEqual(childPath.name,i);var newIndex=i+offset;childPath.name=newIndex;moves[newIndex]=childPath;delete cache[i]}}delete cache.length;return function(){for(var newIndex in moves){var childPath=moves[newIndex];assert.strictEqual(childPath.name,+newIndex);cache[newIndex]=childPath;path.value[newIndex]=childPath.value}}}Pp.shift=function shift(){var move=getMoves(this,-1);var result=this.value.shift();move();return result};Pp.unshift=function unshift(node){var move=getMoves(this,arguments.length);var result=this.value.unshift.apply(this.value,arguments);move();return result};Pp.push=function push(node){isArray.assert(this.value);delete getChildCache(this).length;return this.value.push.apply(this.value,arguments)};Pp.pop=function pop(){isArray.assert(this.value);var cache=getChildCache(this);delete cache[this.value.length-1];delete cache.length;return this.value.pop()};Pp.insertAt=function insertAt(index,node){var argc=arguments.length;var move=getMoves(this,argc-1,index);if(move===emptyMoves){return this}index=Math.max(index,0);for(var i=1;i<argc;++i){this.value[index+i-1]=arguments[i]}move();return this};Pp.insertBefore=function insertBefore(node){var pp=this.parentPath;var argc=arguments.length;var insertAtArgs=[this.name];for(var i=0;i<argc;++i){insertAtArgs.push(arguments[i])}return pp.insertAt.apply(pp,insertAtArgs)};Pp.insertAfter=function insertAfter(node){var pp=this.parentPath;var argc=arguments.length;var insertAtArgs=[this.name+1];for(var i=0;i<argc;++i){insertAtArgs.push(arguments[i])}return pp.insertAt.apply(pp,insertAtArgs)};function repairRelationshipWithParent(path){assert.ok(path instanceof Path);var pp=path.parentPath;if(!pp){return path}var parentValue=pp.value;var parentCache=getChildCache(pp);if(parentValue[path.name]===path.value){parentCache[path.name]=path}else if(isArray.check(parentValue)){var i=parentValue.indexOf(path.value);if(i>=0){parentCache[path.name=i]=path}}else{parentValue[path.name]=path.value;parentCache[path.name]=path}assert.strictEqual(parentValue[path.name],path.value);assert.strictEqual(path.parentPath.get(path.name),path);return path}Pp.replace=function replace(replacement){var results=[];var parentValue=this.parentPath.value;var parentCache=getChildCache(this.parentPath);var count=arguments.length;repairRelationshipWithParent(this);if(isArray.check(parentValue)){var originalLength=parentValue.length;var move=getMoves(this.parentPath,count-1,this.name+1);var spliceArgs=[this.name,1];for(var i=0;i<count;++i){spliceArgs.push(arguments[i])}var splicedOut=parentValue.splice.apply(parentValue,spliceArgs);assert.strictEqual(splicedOut[0],this.value);assert.strictEqual(parentValue.length,originalLength-1+count);move();if(count===0){delete this.value;delete parentCache[this.name];this.__childCache=null}else{assert.strictEqual(parentValue[this.name],replacement);if(this.value!==replacement){this.value=replacement;this.__childCache=null}for(i=0;i<count;++i){results.push(this.parentPath.get(this.name+i))}assert.strictEqual(results[0],this)}}else if(count===1){if(this.value!==replacement){this.__childCache=null}this.value=parentValue[this.name]=replacement;results.push(this)}else if(count===0){delete parentValue[this.name];delete this.value;this.__childCache=null}else{assert.ok(false,"Could not replace path")}return results};module.exports=Path},{"./types":90,assert:93}],88:[function(require,module,exports){var assert=require("assert");var types=require("./types");var Type=types.Type;var namedTypes=types.namedTypes;var Node=namedTypes.Node;var Expression=namedTypes.Expression;var isArray=types.builtInTypes.array;var hasOwn=Object.prototype.hasOwnProperty;var b=types.builders;function Scope(path,parentScope){assert.ok(this instanceof Scope);assert.ok(path instanceof require("./node-path"));ScopeType.assert(path.value);var depth;if(parentScope){assert.ok(parentScope instanceof Scope);depth=parentScope.depth+1}else{parentScope=null;depth=0}Object.defineProperties(this,{path:{value:path},node:{value:path.value},isGlobal:{value:!parentScope,enumerable:true},depth:{value:depth},parent:{value:parentScope},bindings:{value:{}}})}var scopeTypes=[namedTypes.Program,namedTypes.Function,namedTypes.CatchClause];var ScopeType=Type.or.apply(Type,scopeTypes);Scope.isEstablishedBy=function(node){return ScopeType.check(node)};var Sp=Scope.prototype;Sp.didScan=false;Sp.declares=function(name){this.scan();return hasOwn.call(this.bindings,name)};Sp.declareTemporary=function(prefix){if(prefix){assert.ok(/^[a-z$_]/i.test(prefix),prefix)}else{prefix="t$"}prefix+=this.depth.toString(36)+"$";this.scan();var index=0;while(this.declares(prefix+index)){++index}var name=prefix+index;return this.bindings[name]=types.builders.identifier(name)};Sp.injectTemporary=function(identifier,init){identifier||(identifier=this.declareTemporary());var bodyPath=this.path.get("body");if(namedTypes.BlockStatement.check(bodyPath.value)){bodyPath=bodyPath.get("body")}bodyPath.unshift(b.variableDeclaration("var",[b.variableDeclarator(identifier,init||null)]));return identifier};Sp.scan=function(force){if(force||!this.didScan){for(var name in this.bindings){delete this.bindings[name]}scanScope(this.path,this.bindings);this.didScan=true}};Sp.getBindings=function(){this.scan();return this.bindings};function scanScope(path,bindings){var node=path.value;ScopeType.assert(node);if(namedTypes.CatchClause.check(node)){addPattern(path.get("param"),bindings)}else{recursiveScanScope(path,bindings)}}function recursiveScanScope(path,bindings){var node=path.value;if(path.parent&&namedTypes.FunctionExpression.check(path.parent.node)&&path.parent.node.id){addPattern(path.parent.get("id"),bindings)}if(!node){}else if(isArray.check(node)){path.each(function(childPath){recursiveScanChild(childPath,bindings)})}else if(namedTypes.Function.check(node)){path.get("params").each(function(paramPath){addPattern(paramPath,bindings)});recursiveScanChild(path.get("body"),bindings)}else if(namedTypes.VariableDeclarator.check(node)){addPattern(path.get("id"),bindings);recursiveScanChild(path.get("init"),bindings)}else if(node.type==="ImportSpecifier"||node.type==="ImportNamespaceSpecifier"||node.type==="ImportDefaultSpecifier"){addPattern(node.name?path.get("name"):path.get("id"),bindings)}else if(Node.check(node)&&!Expression.check(node)){types.eachField(node,function(name,child){var childPath=path.get(name);assert.strictEqual(childPath.value,child);recursiveScanChild(childPath,bindings)})}}function recursiveScanChild(path,bindings){var node=path.value;if(!node||Expression.check(node)){}else if(namedTypes.FunctionDeclaration.check(node)){addPattern(path.get("id"),bindings)}else if(namedTypes.ClassDeclaration&&namedTypes.ClassDeclaration.check(node)){addPattern(path.get("id"),bindings)}else if(ScopeType.check(node)){if(namedTypes.CatchClause.check(node)){var catchParamName=node.param.name;var hadBinding=hasOwn.call(bindings,catchParamName);recursiveScanScope(path.get("body"),bindings);if(!hadBinding){delete bindings[catchParamName]}}}else{recursiveScanScope(path,bindings)}}function addPattern(patternPath,bindings){var pattern=patternPath.value;namedTypes.Pattern.assert(pattern);if(namedTypes.Identifier.check(pattern)){if(hasOwn.call(bindings,pattern.name)){bindings[pattern.name].push(patternPath)}else{bindings[pattern.name]=[patternPath]}}else if(namedTypes.SpreadElement&&namedTypes.SpreadElement.check(pattern)){addPattern(patternPath.get("argument"),bindings)}}Sp.lookup=function(name){for(var scope=this;scope;scope=scope.parent)if(scope.declares(name))break;return scope};Sp.getGlobalScope=function(){var scope=this;while(!scope.isGlobal)scope=scope.parent;return scope};module.exports=Scope},{"./node-path":85,"./types":90,assert:93}],89:[function(require,module,exports){var types=require("../lib/types");var Type=types.Type;var builtin=types.builtInTypes;var isNumber=builtin.number;exports.geq=function(than){return new Type(function(value){return isNumber.check(value)&&value>=than},isNumber+" >= "+than)};exports.defaults={"null":function(){return null},emptyArray:function(){return[]},"false":function(){return false},"true":function(){return true},undefined:function(){}};var naiveIsPrimitive=Type.or(builtin.string,builtin.number,builtin.boolean,builtin.null,builtin.undefined);exports.isPrimitive=new Type(function(value){if(value===null)return true;var type=typeof value;return!(type==="object"||type==="function")},naiveIsPrimitive.toString())},{"../lib/types":90}],90:[function(require,module,exports){var assert=require("assert");var Ap=Array.prototype;var slice=Ap.slice;var map=Ap.map;var each=Ap.forEach;var Op=Object.prototype;var objToStr=Op.toString;var funObjStr=objToStr.call(function(){});var strObjStr=objToStr.call("");var hasOwn=Op.hasOwnProperty;function Type(check,name){var self=this;assert.ok(self instanceof Type,self);assert.strictEqual(objToStr.call(check),funObjStr,check+" is not a function");var nameObjStr=objToStr.call(name);assert.ok(nameObjStr===funObjStr||nameObjStr===strObjStr,name+" is neither a function nor a string");Object.defineProperties(self,{name:{value:name},check:{value:function(value,deep){var result=check.call(self,value,deep);if(!result&&deep&&objToStr.call(deep)===funObjStr)deep(self,value);return result}}})}var Tp=Type.prototype;exports.Type=Type;Tp.assert=function(value,deep){if(!this.check(value,deep)){var str=shallowStringify(value);assert.ok(false,str+" does not match type "+this);return false}return true};function shallowStringify(value){if(isObject.check(value))return"{"+Object.keys(value).map(function(key){return key+": "+value[key]}).join(", ")+"}";if(isArray.check(value))return"["+value.map(shallowStringify).join(", ")+"]";return JSON.stringify(value)}Tp.toString=function(){var name=this.name;if(isString.check(name))return name;if(isFunction.check(name))return name.call(this)+"";return name+" type"};var builtInTypes={};exports.builtInTypes=builtInTypes;function defBuiltInType(example,name){var objStr=objToStr.call(example);Object.defineProperty(builtInTypes,name,{enumerable:true,value:new Type(function(value){return objToStr.call(value)===objStr},name)});return builtInTypes[name]}var isString=defBuiltInType("","string");var isFunction=defBuiltInType(function(){},"function");var isArray=defBuiltInType([],"array");var isObject=defBuiltInType({},"object");var isRegExp=defBuiltInType(/./,"RegExp");var isDate=defBuiltInType(new Date,"Date");var isNumber=defBuiltInType(3,"number");var isBoolean=defBuiltInType(true,"boolean");var isNull=defBuiltInType(null,"null");var isUndefined=defBuiltInType(void 0,"undefined");function toType(from,name){if(from instanceof Type)return from;if(from instanceof Def)return from.type;if(isArray.check(from))return Type.fromArray(from);if(isObject.check(from))return Type.fromObject(from);if(isFunction.check(from))return new Type(from,name);return new Type(function(value){return value===from},isUndefined.check(name)?function(){return from+""}:name)}Type.or=function(){var types=[];var len=arguments.length;for(var i=0;i<len;++i)types.push(toType(arguments[i]));return new Type(function(value,deep){for(var i=0;i<len;++i)if(types[i].check(value,deep))return true;return false},function(){return types.join(" | ")})};Type.fromArray=function(arr){assert.ok(isArray.check(arr));assert.strictEqual(arr.length,1,"only one element type is permitted for typed arrays");return toType(arr[0]).arrayOf()};Tp.arrayOf=function(){var elemType=this;return new Type(function(value,deep){return isArray.check(value)&&value.every(function(elem){return elemType.check(elem,deep)})},function(){return"["+elemType+"]"})};Type.fromObject=function(obj){var fields=Object.keys(obj).map(function(name){return new Field(name,obj[name])});return new Type(function(value,deep){return isObject.check(value)&&fields.every(function(field){return field.type.check(value[field.name],deep)})},function(){return"{ "+fields.join(", ")+" }"})};function Field(name,type,defaultFn,hidden){var self=this;assert.ok(self instanceof Field);isString.assert(name);
type=toType(type);var properties={name:{value:name},type:{value:type},hidden:{value:!!hidden}};if(isFunction.check(defaultFn)){properties.defaultFn={value:defaultFn}}Object.defineProperties(self,properties)}var Fp=Field.prototype;Fp.toString=function(){return JSON.stringify(this.name)+": "+this.type};Fp.getValue=function(obj){var value=obj[this.name];if(!isUndefined.check(value))return value;if(this.defaultFn)value=this.defaultFn.call(obj);return value};Type.def=function(typeName){isString.assert(typeName);return hasOwn.call(defCache,typeName)?defCache[typeName]:defCache[typeName]=new Def(typeName)};var defCache=Object.create(null);function Def(typeName){var self=this;assert.ok(self instanceof Def);Object.defineProperties(self,{typeName:{value:typeName},baseNames:{value:[]},ownFields:{value:Object.create(null)},allSupertypes:{value:Object.create(null)},supertypeList:{value:[]},allFields:{value:Object.create(null)},fieldNames:{value:[]},type:{value:new Type(function(value,deep){return self.check(value,deep)},typeName)}})}Def.fromValue=function(value){if(value&&typeof value==="object"){var type=value.type;if(typeof type==="string"&&hasOwn.call(defCache,type)){var d=defCache[type];if(d.finalized){return d}}}return null};var Dp=Def.prototype;Dp.isSupertypeOf=function(that){if(that instanceof Def){assert.strictEqual(this.finalized,true);assert.strictEqual(that.finalized,true);return hasOwn.call(that.allSupertypes,this.typeName)}else{assert.ok(false,that+" is not a Def")}};exports.getSupertypeNames=function(typeName){assert.ok(hasOwn.call(defCache,typeName));var d=defCache[typeName];assert.strictEqual(d.finalized,true);return d.supertypeList.slice(1)};exports.computeSupertypeLookupTable=function(candidates){var table={};var typeNames=Object.keys(defCache);var typeNameCount=typeNames.length;for(var i=0;i<typeNameCount;++i){var typeName=typeNames[i];var d=defCache[typeName];assert.strictEqual(d.finalized,true);for(var j=0;j<d.supertypeList.length;++j){var superTypeName=d.supertypeList[j];if(hasOwn.call(candidates,superTypeName)){table[typeName]=superTypeName;break}}}return table};Dp.checkAllFields=function(value,deep){var allFields=this.allFields;assert.strictEqual(this.finalized,true);function checkFieldByName(name){var field=allFields[name];var type=field.type;var child=field.getValue(value);return type.check(child,deep)}return isObject.check(value)&&Object.keys(allFields).every(checkFieldByName)};Dp.check=function(value,deep){assert.strictEqual(this.finalized,true,"prematurely checking unfinalized type "+this.typeName);if(!isObject.check(value))return false;var vDef=Def.fromValue(value);if(!vDef){if(this.typeName==="SourceLocation"||this.typeName==="Position"){return this.checkAllFields(value,deep)}return false}if(deep&&vDef===this)return this.checkAllFields(value,deep);if(!this.isSupertypeOf(vDef))return false;if(!deep)return true;return vDef.checkAllFields(value,deep)&&this.checkAllFields(value,false)};Dp.bases=function(){var bases=this.baseNames;assert.strictEqual(this.finalized,false);each.call(arguments,function(baseName){isString.assert(baseName);if(bases.indexOf(baseName)<0)bases.push(baseName)});return this};Object.defineProperty(Dp,"buildable",{value:false});var builders={};exports.builders=builders;var nodePrototype={};exports.defineMethod=function(name,func){var old=nodePrototype[name];if(isUndefined.check(func)){delete nodePrototype[name]}else{isFunction.assert(func);Object.defineProperty(nodePrototype,name,{enumerable:true,configurable:true,value:func})}return old};Dp.build=function(){var self=this;Object.defineProperty(self,"buildParams",{value:slice.call(arguments),writable:false,enumerable:false,configurable:true});assert.strictEqual(self.finalized,false);isString.arrayOf().assert(self.buildParams);if(self.buildable){return self}self.field("type",self.typeName,function(){return self.typeName});Object.defineProperty(self,"buildable",{value:true});Object.defineProperty(builders,getBuilderName(self.typeName),{enumerable:true,value:function(){var args=arguments;var argc=args.length;var built=Object.create(nodePrototype);assert.ok(self.finalized,"attempting to instantiate unfinalized type "+self.typeName);function add(param,i){if(hasOwn.call(built,param))return;var all=self.allFields;assert.ok(hasOwn.call(all,param),param);var field=all[param];var type=field.type;var value;if(isNumber.check(i)&&i<argc){value=args[i]}else if(field.defaultFn){value=field.defaultFn.call(built)}else{var message="no value or default function given for field "+JSON.stringify(param)+" of "+self.typeName+"("+self.buildParams.map(function(name){return all[name]}).join(", ")+")";assert.ok(false,message)}if(!type.check(value)){assert.ok(false,shallowStringify(value)+" does not match field "+field+" of type "+self.typeName)}built[param]=value}self.buildParams.forEach(function(param,i){add(param,i)});Object.keys(self.allFields).forEach(function(param){add(param)});assert.strictEqual(built.type,self.typeName);return built}});return self};function getBuilderName(typeName){return typeName.replace(/^[A-Z]+/,function(upperCasePrefix){var len=upperCasePrefix.length;switch(len){case 0:return"";case 1:return upperCasePrefix.toLowerCase();default:return upperCasePrefix.slice(0,len-1).toLowerCase()+upperCasePrefix.charAt(len-1)}})}Dp.field=function(name,type,defaultFn,hidden){assert.strictEqual(this.finalized,false);this.ownFields[name]=new Field(name,type,defaultFn,hidden);return this};var namedTypes={};exports.namedTypes=namedTypes;function getFieldNames(object){var d=Def.fromValue(object);if(d){return d.fieldNames.slice(0)}if("type"in object){assert.ok(false,"did not recognize object of type "+JSON.stringify(object.type))}return Object.keys(object)}exports.getFieldNames=getFieldNames;function getFieldValue(object,fieldName){var d=Def.fromValue(object);if(d){var field=d.allFields[fieldName];if(field){return field.getValue(object)}}return object[fieldName]}exports.getFieldValue=getFieldValue;exports.eachField=function(object,callback,context){getFieldNames(object).forEach(function(name){callback.call(this,name,getFieldValue(object,name))},context)};exports.someField=function(object,callback,context){return getFieldNames(object).some(function(name){return callback.call(this,name,getFieldValue(object,name))},context)};Object.defineProperty(Dp,"finalized",{value:false});Dp.finalize=function(){if(!this.finalized){var allFields=this.allFields;var allSupertypes=this.allSupertypes;this.baseNames.forEach(function(name){var def=defCache[name];def.finalize();extend(allFields,def.allFields);extend(allSupertypes,def.allSupertypes)});extend(allFields,this.ownFields);allSupertypes[this.typeName]=this;this.fieldNames.length=0;for(var fieldName in allFields){if(hasOwn.call(allFields,fieldName)&&!allFields[fieldName].hidden){this.fieldNames.push(fieldName)}}Object.defineProperty(namedTypes,this.typeName,{enumerable:true,value:this.type});Object.defineProperty(this,"finalized",{value:true});populateSupertypeList(this.typeName,this.supertypeList)}};function populateSupertypeList(typeName,list){list.length=0;list.push(typeName);var lastSeen=Object.create(null);for(var pos=0;pos<list.length;++pos){typeName=list[pos];var d=defCache[typeName];assert.strictEqual(d.finalized,true);if(hasOwn.call(lastSeen,typeName)){delete list[lastSeen[typeName]]}lastSeen[typeName]=pos;list.push.apply(list,d.baseNames)}for(var to=0,from=to,len=list.length;from<len;++from){if(hasOwn.call(list,from)){list[to++]=list[from]}}list.length=to}function extend(into,from){Object.keys(from).forEach(function(name){into[name]=from[name]});return into}exports.finalize=function(){Object.keys(defCache).forEach(function(name){defCache[name].finalize()})}},{assert:93}],91:[function(require,module,exports){var types=require("./lib/types");require("./def/core");require("./def/es6");require("./def/es7");require("./def/mozilla");require("./def/e4x");require("./def/fb-harmony");types.finalize();exports.Type=types.Type;exports.builtInTypes=types.builtInTypes;exports.namedTypes=types.namedTypes;exports.builders=types.builders;exports.defineMethod=types.defineMethod;exports.getFieldNames=types.getFieldNames;exports.getFieldValue=types.getFieldValue;exports.eachField=types.eachField;exports.someField=types.someField;exports.getSupertypeNames=types.getSupertypeNames;exports.astNodesAreEquivalent=require("./lib/equiv");exports.finalize=types.finalize;exports.NodePath=require("./lib/node-path");exports.PathVisitor=require("./lib/path-visitor");exports.visit=exports.PathVisitor.visit},{"./def/core":78,"./def/e4x":79,"./def/es6":80,"./def/es7":81,"./def/fb-harmony":82,"./def/mozilla":83,"./lib/equiv":84,"./lib/node-path":85,"./lib/path-visitor":86,"./lib/types":90}],92:[function(require,module,exports){},{}],93:[function(require,module,exports){var util=require("util/");var pSlice=Array.prototype.slice;var hasOwn=Object.prototype.hasOwnProperty;var assert=module.exports=ok;assert.AssertionError=function AssertionError(options){this.name="AssertionError";this.actual=options.actual;this.expected=options.expected;this.operator=options.operator;if(options.message){this.message=options.message;this.generatedMessage=false}else{this.message=getMessage(this);this.generatedMessage=true}var stackStartFunction=options.stackStartFunction||fail;if(Error.captureStackTrace){Error.captureStackTrace(this,stackStartFunction)}else{var err=new Error;if(err.stack){var out=err.stack;var fn_name=stackStartFunction.name;var idx=out.indexOf("\n"+fn_name);if(idx>=0){var next_line=out.indexOf("\n",idx+1);out=out.substring(next_line+1)}this.stack=out}}};util.inherits(assert.AssertionError,Error);function replacer(key,value){if(util.isUndefined(value)){return""+value}if(util.isNumber(value)&&(isNaN(value)||!isFinite(value))){return value.toString()}if(util.isFunction(value)||util.isRegExp(value)){return value.toString()}return value}function truncate(s,n){if(util.isString(s)){return s.length<n?s:s.slice(0,n)}else{return s}}function getMessage(self){return truncate(JSON.stringify(self.actual,replacer),128)+" "+self.operator+" "+truncate(JSON.stringify(self.expected,replacer),128)}function fail(actual,expected,message,operator,stackStartFunction){throw new assert.AssertionError({message:message,actual:actual,expected:expected,operator:operator,stackStartFunction:stackStartFunction})}assert.fail=fail;function ok(value,message){if(!value)fail(value,true,message,"==",assert.ok)}assert.ok=ok;assert.equal=function equal(actual,expected,message){if(actual!=expected)fail(actual,expected,message,"==",assert.equal)};assert.notEqual=function notEqual(actual,expected,message){if(actual==expected){fail(actual,expected,message,"!=",assert.notEqual)}};assert.deepEqual=function deepEqual(actual,expected,message){if(!_deepEqual(actual,expected)){fail(actual,expected,message,"deepEqual",assert.deepEqual)}};function _deepEqual(actual,expected){if(actual===expected){return true}else if(util.isBuffer(actual)&&util.isBuffer(expected)){if(actual.length!=expected.length)return false;for(var i=0;i<actual.length;i++){if(actual[i]!==expected[i])return false}return true}else if(util.isDate(actual)&&util.isDate(expected)){return actual.getTime()===expected.getTime()}else if(util.isRegExp(actual)&&util.isRegExp(expected)){return actual.source===expected.source&&actual.global===expected.global&&actual.multiline===expected.multiline&&actual.lastIndex===expected.lastIndex&&actual.ignoreCase===expected.ignoreCase}else if(!util.isObject(actual)&&!util.isObject(expected)){return actual==expected}else{return objEquiv(actual,expected)}}function isArguments(object){return Object.prototype.toString.call(object)=="[object Arguments]"}function objEquiv(a,b){if(util.isNullOrUndefined(a)||util.isNullOrUndefined(b))return false;if(a.prototype!==b.prototype)return false;if(isArguments(a)){if(!isArguments(b)){return false}a=pSlice.call(a);b=pSlice.call(b);return _deepEqual(a,b)}try{var ka=objectKeys(a),kb=objectKeys(b),key,i}catch(e){return false}if(ka.length!=kb.length)return false;ka.sort();kb.sort();for(i=ka.length-1;i>=0;i--){if(ka[i]!=kb[i])return false}for(i=ka.length-1;i>=0;i--){key=ka[i];if(!_deepEqual(a[key],b[key]))return false}return true}assert.notDeepEqual=function notDeepEqual(actual,expected,message){if(_deepEqual(actual,expected)){fail(actual,expected,message,"notDeepEqual",assert.notDeepEqual)}};assert.strictEqual=function strictEqual(actual,expected,message){if(actual!==expected){fail(actual,expected,message,"===",assert.strictEqual)}};assert.notStrictEqual=function notStrictEqual(actual,expected,message){if(actual===expected){fail(actual,expected,message,"!==",assert.notStrictEqual)}};function expectedException(actual,expected){if(!actual||!expected){return false}if(Object.prototype.toString.call(expected)=="[object RegExp]"){return expected.test(actual)}else if(actual instanceof expected){return true}else if(expected.call({},actual)===true){return true}return false}function _throws(shouldThrow,block,expected,message){var actual;if(util.isString(expected)){message=expected;expected=null}try{block()}catch(e){actual=e}message=(expected&&expected.name?" ("+expected.name+").":".")+(message?" "+message:".");if(shouldThrow&&!actual){fail(actual,expected,"Missing expected exception"+message)}if(!shouldThrow&&expectedException(actual,expected)){fail(actual,expected,"Got unwanted exception"+message)}if(shouldThrow&&actual&&expected&&!expectedException(actual,expected)||!shouldThrow&&actual){throw actual}}assert.throws=function(block,error,message){_throws.apply(this,[true].concat(pSlice.call(arguments)))};assert.doesNotThrow=function(block,message){_throws.apply(this,[false].concat(pSlice.call(arguments)))};assert.ifError=function(err){if(err){throw err}};var objectKeys=Object.keys||function(obj){var keys=[];for(var key in obj){if(hasOwn.call(obj,key))keys.push(key)}return keys}},{"util/":102}],94:[function(require,module,exports){var base64=require("base64-js");var ieee754=require("ieee754");var isArray=require("is-array");exports.Buffer=Buffer;exports.SlowBuffer=Buffer;exports.INSPECT_MAX_BYTES=50;Buffer.poolSize=8192;var kMaxLength=1073741823;Buffer.TYPED_ARRAY_SUPPORT=function(){try{var buf=new ArrayBuffer(0);var arr=new Uint8Array(buf);arr.foo=function(){return 42};return 42===arr.foo()&&typeof arr.subarray==="function"&&new Uint8Array(1).subarray(1,1).byteLength===0}catch(e){return false}}();function Buffer(subject,encoding,noZero){if(!(this instanceof Buffer))return new Buffer(subject,encoding,noZero);var type=typeof subject;var length;if(type==="number")length=subject>0?subject>>>0:0;else if(type==="string"){if(encoding==="base64")subject=base64clean(subject);length=Buffer.byteLength(subject,encoding)}else if(type==="object"&&subject!==null){if(subject.type==="Buffer"&&isArray(subject.data))subject=subject.data;length=+subject.length>0?Math.floor(+subject.length):0}else throw new TypeError("must start with number, buffer, array or string");if(this.length>kMaxLength)throw new RangeError("Attempt to allocate Buffer larger than maximum "+"size: 0x"+kMaxLength.toString(16)+" bytes");var buf;if(Buffer.TYPED_ARRAY_SUPPORT){buf=Buffer._augment(new Uint8Array(length))}else{buf=this;buf.length=length;buf._isBuffer=true}var i;if(Buffer.TYPED_ARRAY_SUPPORT&&typeof subject.byteLength==="number"){buf._set(subject)}else if(isArrayish(subject)){if(Buffer.isBuffer(subject)){for(i=0;i<length;i++)buf[i]=subject.readUInt8(i)}else{for(i=0;i<length;i++)buf[i]=(subject[i]%256+256)%256}}else if(type==="string"){buf.write(subject,0,encoding)}else if(type==="number"&&!Buffer.TYPED_ARRAY_SUPPORT&&!noZero){for(i=0;i<length;i++){buf[i]=0}}return buf}Buffer.isBuffer=function(b){return!!(b!=null&&b._isBuffer)};Buffer.compare=function(a,b){if(!Buffer.isBuffer(a)||!Buffer.isBuffer(b))throw new TypeError("Arguments must be Buffers");var x=a.length;var y=b.length;for(var i=0,len=Math.min(x,y);i<len&&a[i]===b[i];i++){}if(i!==len){x=a[i];y=b[i]}if(x<y)return-1;if(y<x)return 1;return 0};Buffer.isEncoding=function(encoding){switch(String(encoding).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return true;default:return false}};Buffer.concat=function(list,totalLength){if(!isArray(list))throw new TypeError("Usage: Buffer.concat(list[, length])");if(list.length===0){return new Buffer(0)}else if(list.length===1){return list[0]}var i;if(totalLength===undefined){totalLength=0;for(i=0;i<list.length;i++){totalLength+=list[i].length}}var buf=new Buffer(totalLength);var pos=0;for(i=0;i<list.length;i++){var item=list[i];item.copy(buf,pos);pos+=item.length}return buf};Buffer.byteLength=function(str,encoding){var ret;str=str+"";switch(encoding||"utf8"){case"ascii":case"binary":case"raw":ret=str.length;break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":ret=str.length*2;break;case"hex":ret=str.length>>>1;break;case"utf8":case"utf-8":ret=utf8ToBytes(str).length;break;case"base64":ret=base64ToBytes(str).length;break;default:ret=str.length}return ret};Buffer.prototype.length=undefined;Buffer.prototype.parent=undefined;Buffer.prototype.toString=function(encoding,start,end){var loweredCase=false;start=start>>>0;end=end===undefined||end===Infinity?this.length:end>>>0;if(!encoding)encoding="utf8";if(start<0)start=0;if(end>this.length)end=this.length;if(end<=start)return"";while(true){switch(encoding){case"hex":return hexSlice(this,start,end);case"utf8":case"utf-8":return utf8Slice(this,start,end);case"ascii":return asciiSlice(this,start,end);case"binary":return binarySlice(this,start,end);case"base64":return base64Slice(this,start,end);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return utf16leSlice(this,start,end);default:if(loweredCase)throw new TypeError("Unknown encoding: "+encoding);encoding=(encoding+"").toLowerCase();loweredCase=true}}};Buffer.prototype.equals=function(b){if(!Buffer.isBuffer(b))throw new TypeError("Argument must be a Buffer");return Buffer.compare(this,b)===0};Buffer.prototype.inspect=function(){var str="";var max=exports.INSPECT_MAX_BYTES;if(this.length>0){str=this.toString("hex",0,max).match(/.{2}/g).join(" ");if(this.length>max)str+=" ... "}return"<Buffer "+str+">"};Buffer.prototype.compare=function(b){if(!Buffer.isBuffer(b))throw new TypeError("Argument must be a Buffer");return Buffer.compare(this,b)};Buffer.prototype.get=function(offset){console.log(".get() is deprecated. Access using array indexes instead.");return this.readUInt8(offset)};Buffer.prototype.set=function(v,offset){console.log(".set() is deprecated. Access using array indexes instead.");return this.writeUInt8(v,offset)};function hexWrite(buf,string,offset,length){offset=Number(offset)||0;var remaining=buf.length-offset;if(!length){length=remaining}else{length=Number(length);if(length>remaining){length=remaining}}var strLen=string.length;if(strLen%2!==0)throw new Error("Invalid hex string");if(length>strLen/2){length=strLen/2}for(var i=0;i<length;i++){var byte=parseInt(string.substr(i*2,2),16);if(isNaN(byte))throw new Error("Invalid hex string");buf[offset+i]=byte}return i}function utf8Write(buf,string,offset,length){var charsWritten=blitBuffer(utf8ToBytes(string),buf,offset,length);return charsWritten}function asciiWrite(buf,string,offset,length){var charsWritten=blitBuffer(asciiToBytes(string),buf,offset,length);return charsWritten}function binaryWrite(buf,string,offset,length){return asciiWrite(buf,string,offset,length)}function base64Write(buf,string,offset,length){var charsWritten=blitBuffer(base64ToBytes(string),buf,offset,length);return charsWritten}function utf16leWrite(buf,string,offset,length){var charsWritten=blitBuffer(utf16leToBytes(string),buf,offset,length);return charsWritten}Buffer.prototype.write=function(string,offset,length,encoding){if(isFinite(offset)){if(!isFinite(length)){encoding=length;length=undefined}}else{var swap=encoding;encoding=offset;offset=length;length=swap}offset=Number(offset)||0;var remaining=this.length-offset;if(!length){length=remaining}else{length=Number(length);if(length>remaining){length=remaining}}encoding=String(encoding||"utf8").toLowerCase();var ret;switch(encoding){case"hex":ret=hexWrite(this,string,offset,length);break;case"utf8":case"utf-8":ret=utf8Write(this,string,offset,length);break;case"ascii":ret=asciiWrite(this,string,offset,length);break;case"binary":ret=binaryWrite(this,string,offset,length);break;case"base64":ret=base64Write(this,string,offset,length);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":ret=utf16leWrite(this,string,offset,length);break;default:throw new TypeError("Unknown encoding: "+encoding)}return ret};Buffer.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function base64Slice(buf,start,end){if(start===0&&end===buf.length){return base64.fromByteArray(buf)}else{return base64.fromByteArray(buf.slice(start,end))}}function utf8Slice(buf,start,end){var res="";var tmp="";end=Math.min(buf.length,end);for(var i=start;i<end;i++){if(buf[i]<=127){res+=decodeUtf8Char(tmp)+String.fromCharCode(buf[i]);tmp=""}else{tmp+="%"+buf[i].toString(16)}}return res+decodeUtf8Char(tmp)}function asciiSlice(buf,start,end){var ret="";end=Math.min(buf.length,end);for(var i=start;i<end;i++){ret+=String.fromCharCode(buf[i])}return ret}function binarySlice(buf,start,end){return asciiSlice(buf,start,end)}function hexSlice(buf,start,end){var len=buf.length;if(!start||start<0)start=0;if(!end||end<0||end>len)end=len;var out="";for(var i=start;i<end;i++){out+=toHex(buf[i])}return out}function utf16leSlice(buf,start,end){var bytes=buf.slice(start,end);var res="";for(var i=0;i<bytes.length;i+=2){res+=String.fromCharCode(bytes[i]+bytes[i+1]*256)}return res}Buffer.prototype.slice=function(start,end){var len=this.length;start=~~start;end=end===undefined?len:~~end;if(start<0){start+=len;if(start<0)start=0}else if(start>len){start=len}if(end<0){end+=len;if(end<0)end=0}else if(end>len){end=len}if(end<start)end=start;if(Buffer.TYPED_ARRAY_SUPPORT){return Buffer._augment(this.subarray(start,end))}else{var sliceLen=end-start;var newBuf=new Buffer(sliceLen,undefined,true);for(var i=0;i<sliceLen;i++){newBuf[i]=this[i+start]}return newBuf}};function checkOffset(offset,ext,length){if(offset%1!==0||offset<0)throw new RangeError("offset is not uint");if(offset+ext>length)throw new RangeError("Trying to access beyond buffer length")}Buffer.prototype.readUInt8=function(offset,noAssert){if(!noAssert)checkOffset(offset,1,this.length);return this[offset]};Buffer.prototype.readUInt16LE=function(offset,noAssert){if(!noAssert)checkOffset(offset,2,this.length);return this[offset]|this[offset+1]<<8};Buffer.prototype.readUInt16BE=function(offset,noAssert){if(!noAssert)checkOffset(offset,2,this.length);return this[offset]<<8|this[offset+1]};Buffer.prototype.readUInt32LE=function(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return(this[offset]|this[offset+1]<<8|this[offset+2]<<16)+this[offset+3]*16777216};Buffer.prototype.readUInt32BE=function(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return this[offset]*16777216+(this[offset+1]<<16|this[offset+2]<<8|this[offset+3])};Buffer.prototype.readInt8=function(offset,noAssert){if(!noAssert)checkOffset(offset,1,this.length);if(!(this[offset]&128))return this[offset];return(255-this[offset]+1)*-1};Buffer.prototype.readInt16LE=function(offset,noAssert){if(!noAssert)checkOffset(offset,2,this.length);var val=this[offset]|this[offset+1]<<8;return val&32768?val|4294901760:val};Buffer.prototype.readInt16BE=function(offset,noAssert){if(!noAssert)checkOffset(offset,2,this.length);var val=this[offset+1]|this[offset]<<8;return val&32768?val|4294901760:val};Buffer.prototype.readInt32LE=function(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return this[offset]|this[offset+1]<<8|this[offset+2]<<16|this[offset+3]<<24};Buffer.prototype.readInt32BE=function(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return this[offset]<<24|this[offset+1]<<16|this[offset+2]<<8|this[offset+3]};Buffer.prototype.readFloatLE=function(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return ieee754.read(this,offset,true,23,4)};Buffer.prototype.readFloatBE=function(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return ieee754.read(this,offset,false,23,4)};Buffer.prototype.readDoubleLE=function(offset,noAssert){if(!noAssert)checkOffset(offset,8,this.length);return ieee754.read(this,offset,true,52,8)};Buffer.prototype.readDoubleBE=function(offset,noAssert){if(!noAssert)checkOffset(offset,8,this.length);return ieee754.read(this,offset,false,52,8)};function checkInt(buf,value,offset,ext,max,min){if(!Buffer.isBuffer(buf))throw new TypeError("buffer must be a Buffer instance");if(value>max||value<min)throw new TypeError("value is out of bounds");if(offset+ext>buf.length)throw new TypeError("index out of range")}Buffer.prototype.writeUInt8=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,1,255,0);if(!Buffer.TYPED_ARRAY_SUPPORT)value=Math.floor(value);this[offset]=value;return offset+1};function objectWriteUInt16(buf,value,offset,littleEndian){if(value<0)value=65535+value+1;for(var i=0,j=Math.min(buf.length-offset,2);i<j;i++){buf[offset+i]=(value&255<<8*(littleEndian?i:1-i))>>>(littleEndian?i:1-i)*8}}Buffer.prototype.writeUInt16LE=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,2,65535,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value;this[offset+1]=value>>>8}else objectWriteUInt16(this,value,offset,true);return offset+2};Buffer.prototype.writeUInt16BE=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,2,65535,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value>>>8;this[offset+1]=value}else objectWriteUInt16(this,value,offset,false);return offset+2};function objectWriteUInt32(buf,value,offset,littleEndian){if(value<0)value=4294967295+value+1;for(var i=0,j=Math.min(buf.length-offset,4);i<j;i++){buf[offset+i]=value>>>(littleEndian?i:3-i)*8&255}}Buffer.prototype.writeUInt32LE=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,4,4294967295,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset+3]=value>>>24;this[offset+2]=value>>>16;this[offset+1]=value>>>8;this[offset]=value}else objectWriteUInt32(this,value,offset,true);return offset+4};Buffer.prototype.writeUInt32BE=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,4,4294967295,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value>>>24;this[offset+1]=value>>>16;this[offset+2]=value>>>8;this[offset+3]=value}else objectWriteUInt32(this,value,offset,false);return offset+4};Buffer.prototype.writeInt8=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,1,127,-128);if(!Buffer.TYPED_ARRAY_SUPPORT)value=Math.floor(value);if(value<0)value=255+value+1;this[offset]=value;return offset+1};Buffer.prototype.writeInt16LE=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,2,32767,-32768);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value;this[offset+1]=value>>>8}else objectWriteUInt16(this,value,offset,true);return offset+2};Buffer.prototype.writeInt16BE=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,2,32767,-32768);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value>>>8;this[offset+1]=value}else objectWriteUInt16(this,value,offset,false);return offset+2};Buffer.prototype.writeInt32LE=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,4,2147483647,-2147483648);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value;this[offset+1]=value>>>8;this[offset+2]=value>>>16;this[offset+3]=value>>>24}else objectWriteUInt32(this,value,offset,true);return offset+4};Buffer.prototype.writeInt32BE=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,4,2147483647,-2147483648);if(value<0)value=4294967295+value+1;if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value>>>24;this[offset+1]=value>>>16;this[offset+2]=value>>>8;this[offset+3]=value}else objectWriteUInt32(this,value,offset,false);return offset+4};function checkIEEE754(buf,value,offset,ext,max,min){if(value>max||value<min)throw new TypeError("value is out of bounds");if(offset+ext>buf.length)throw new TypeError("index out of range")}function writeFloat(buf,value,offset,littleEndian,noAssert){if(!noAssert)checkIEEE754(buf,value,offset,4,3.4028234663852886e38,-3.4028234663852886e38);ieee754.write(buf,value,offset,littleEndian,23,4);return offset+4}Buffer.prototype.writeFloatLE=function(value,offset,noAssert){return writeFloat(this,value,offset,true,noAssert)};Buffer.prototype.writeFloatBE=function(value,offset,noAssert){return writeFloat(this,value,offset,false,noAssert)};function writeDouble(buf,value,offset,littleEndian,noAssert){if(!noAssert)checkIEEE754(buf,value,offset,8,1.7976931348623157e308,-1.7976931348623157e308);ieee754.write(buf,value,offset,littleEndian,52,8);return offset+8}Buffer.prototype.writeDoubleLE=function(value,offset,noAssert){return writeDouble(this,value,offset,true,noAssert)};Buffer.prototype.writeDoubleBE=function(value,offset,noAssert){return writeDouble(this,value,offset,false,noAssert)};Buffer.prototype.copy=function(target,target_start,start,end){var source=this;if(!start)start=0;if(!end&&end!==0)end=this.length;if(!target_start)target_start=0;if(end===start)return;if(target.length===0||source.length===0)return;if(end<start)throw new TypeError("sourceEnd < sourceStart");if(target_start<0||target_start>=target.length)throw new TypeError("targetStart out of bounds");if(start<0||start>=source.length)throw new TypeError("sourceStart out of bounds");if(end<0||end>source.length)throw new TypeError("sourceEnd out of bounds");if(end>this.length)end=this.length;if(target.length-target_start<end-start)end=target.length-target_start+start;var len=end-start;if(len<1e3||!Buffer.TYPED_ARRAY_SUPPORT){for(var i=0;i<len;i++){target[i+target_start]=this[i+start]}}else{target._set(this.subarray(start,start+len),target_start)}};Buffer.prototype.fill=function(value,start,end){if(!value)value=0;if(!start)start=0;if(!end)end=this.length;if(end<start)throw new TypeError("end < start");if(end===start)return;if(this.length===0)return;if(start<0||start>=this.length)throw new TypeError("start out of bounds");if(end<0||end>this.length)throw new TypeError("end out of bounds");var i;if(typeof value==="number"){for(i=start;i<end;i++){this[i]=value}}else{var bytes=utf8ToBytes(value.toString());var len=bytes.length;for(i=start;i<end;i++){this[i]=bytes[i%len]}}return this};Buffer.prototype.toArrayBuffer=function(){if(typeof Uint8Array!=="undefined"){if(Buffer.TYPED_ARRAY_SUPPORT){return new Buffer(this).buffer}else{var buf=new Uint8Array(this.length);for(var i=0,len=buf.length;i<len;i+=1){buf[i]=this[i]}return buf.buffer}}else{throw new TypeError("Buffer.toArrayBuffer not supported in this browser")}};var BP=Buffer.prototype;Buffer._augment=function(arr){arr.constructor=Buffer;arr._isBuffer=true;arr._get=arr.get;arr._set=arr.set;arr.get=BP.get;arr.set=BP.set;arr.write=BP.write;arr.toString=BP.toString;arr.toLocaleString=BP.toString;arr.toJSON=BP.toJSON;arr.equals=BP.equals;arr.compare=BP.compare;arr.copy=BP.copy;arr.slice=BP.slice;arr.readUInt8=BP.readUInt8;arr.readUInt16LE=BP.readUInt16LE;arr.readUInt16BE=BP.readUInt16BE;arr.readUInt32LE=BP.readUInt32LE;arr.readUInt32BE=BP.readUInt32BE;arr.readInt8=BP.readInt8;arr.readInt16LE=BP.readInt16LE;arr.readInt16BE=BP.readInt16BE;arr.readInt32LE=BP.readInt32LE;arr.readInt32BE=BP.readInt32BE;arr.readFloatLE=BP.readFloatLE;arr.readFloatBE=BP.readFloatBE;arr.readDoubleLE=BP.readDoubleLE;arr.readDoubleBE=BP.readDoubleBE;
arr.writeUInt8=BP.writeUInt8;arr.writeUInt16LE=BP.writeUInt16LE;arr.writeUInt16BE=BP.writeUInt16BE;arr.writeUInt32LE=BP.writeUInt32LE;arr.writeUInt32BE=BP.writeUInt32BE;arr.writeInt8=BP.writeInt8;arr.writeInt16LE=BP.writeInt16LE;arr.writeInt16BE=BP.writeInt16BE;arr.writeInt32LE=BP.writeInt32LE;arr.writeInt32BE=BP.writeInt32BE;arr.writeFloatLE=BP.writeFloatLE;arr.writeFloatBE=BP.writeFloatBE;arr.writeDoubleLE=BP.writeDoubleLE;arr.writeDoubleBE=BP.writeDoubleBE;arr.fill=BP.fill;arr.inspect=BP.inspect;arr.toArrayBuffer=BP.toArrayBuffer;return arr};var INVALID_BASE64_RE=/[^+\/0-9A-z]/g;function base64clean(str){str=stringtrim(str).replace(INVALID_BASE64_RE,"");while(str.length%4!==0){str=str+"="}return str}function stringtrim(str){if(str.trim)return str.trim();return str.replace(/^\s+|\s+$/g,"")}function isArrayish(subject){return isArray(subject)||Buffer.isBuffer(subject)||subject&&typeof subject==="object"&&typeof subject.length==="number"}function toHex(n){if(n<16)return"0"+n.toString(16);return n.toString(16)}function utf8ToBytes(str){var byteArray=[];for(var i=0;i<str.length;i++){var b=str.charCodeAt(i);if(b<=127){byteArray.push(b)}else{var start=i;if(b>=55296&&b<=57343)i++;var h=encodeURIComponent(str.slice(start,i+1)).substr(1).split("%");for(var j=0;j<h.length;j++){byteArray.push(parseInt(h[j],16))}}}return byteArray}function asciiToBytes(str){var byteArray=[];for(var i=0;i<str.length;i++){byteArray.push(str.charCodeAt(i)&255)}return byteArray}function utf16leToBytes(str){var c,hi,lo;var byteArray=[];for(var i=0;i<str.length;i++){c=str.charCodeAt(i);hi=c>>8;lo=c%256;byteArray.push(lo);byteArray.push(hi)}return byteArray}function base64ToBytes(str){return base64.toByteArray(str)}function blitBuffer(src,dst,offset,length){for(var i=0;i<length;i++){if(i+offset>=dst.length||i>=src.length)break;dst[i+offset]=src[i]}return i}function decodeUtf8Char(str){try{return decodeURIComponent(str)}catch(err){return String.fromCharCode(65533)}}},{"base64-js":95,ieee754:96,"is-array":97}],95:[function(require,module,exports){var lookup="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";(function(exports){"use strict";var Arr=typeof Uint8Array!=="undefined"?Uint8Array:Array;var PLUS="+".charCodeAt(0);var SLASH="/".charCodeAt(0);var NUMBER="0".charCodeAt(0);var LOWER="a".charCodeAt(0);var UPPER="A".charCodeAt(0);function decode(elt){var code=elt.charCodeAt(0);if(code===PLUS)return 62;if(code===SLASH)return 63;if(code<NUMBER)return-1;if(code<NUMBER+10)return code-NUMBER+26+26;if(code<UPPER+26)return code-UPPER;if(code<LOWER+26)return code-LOWER+26}function b64ToByteArray(b64){var i,j,l,tmp,placeHolders,arr;if(b64.length%4>0){throw new Error("Invalid string. Length must be a multiple of 4")}var len=b64.length;placeHolders="="===b64.charAt(len-2)?2:"="===b64.charAt(len-1)?1:0;arr=new Arr(b64.length*3/4-placeHolders);l=placeHolders>0?b64.length-4:b64.length;var L=0;function push(v){arr[L++]=v}for(i=0,j=0;i<l;i+=4,j+=3){tmp=decode(b64.charAt(i))<<18|decode(b64.charAt(i+1))<<12|decode(b64.charAt(i+2))<<6|decode(b64.charAt(i+3));push((tmp&16711680)>>16);push((tmp&65280)>>8);push(tmp&255)}if(placeHolders===2){tmp=decode(b64.charAt(i))<<2|decode(b64.charAt(i+1))>>4;push(tmp&255)}else if(placeHolders===1){tmp=decode(b64.charAt(i))<<10|decode(b64.charAt(i+1))<<4|decode(b64.charAt(i+2))>>2;push(tmp>>8&255);push(tmp&255)}return arr}function uint8ToBase64(uint8){var i,extraBytes=uint8.length%3,output="",temp,length;function encode(num){return lookup.charAt(num)}function tripletToBase64(num){return encode(num>>18&63)+encode(num>>12&63)+encode(num>>6&63)+encode(num&63)}for(i=0,length=uint8.length-extraBytes;i<length;i+=3){temp=(uint8[i]<<16)+(uint8[i+1]<<8)+uint8[i+2];output+=tripletToBase64(temp)}switch(extraBytes){case 1:temp=uint8[uint8.length-1];output+=encode(temp>>2);output+=encode(temp<<4&63);output+="==";break;case 2:temp=(uint8[uint8.length-2]<<8)+uint8[uint8.length-1];output+=encode(temp>>10);output+=encode(temp>>4&63);output+=encode(temp<<2&63);output+="=";break}return output}exports.toByteArray=b64ToByteArray;exports.fromByteArray=uint8ToBase64})(typeof exports==="undefined"?this.base64js={}:exports)},{}],96:[function(require,module,exports){exports.read=function(buffer,offset,isLE,mLen,nBytes){var e,m,eLen=nBytes*8-mLen-1,eMax=(1<<eLen)-1,eBias=eMax>>1,nBits=-7,i=isLE?nBytes-1:0,d=isLE?-1:1,s=buffer[offset+i];i+=d;e=s&(1<<-nBits)-1;s>>=-nBits;nBits+=eLen;for(;nBits>0;e=e*256+buffer[offset+i],i+=d,nBits-=8);m=e&(1<<-nBits)-1;e>>=-nBits;nBits+=mLen;for(;nBits>0;m=m*256+buffer[offset+i],i+=d,nBits-=8);if(e===0){e=1-eBias}else if(e===eMax){return m?NaN:(s?-1:1)*Infinity}else{m=m+Math.pow(2,mLen);e=e-eBias}return(s?-1:1)*m*Math.pow(2,e-mLen)};exports.write=function(buffer,value,offset,isLE,mLen,nBytes){var e,m,c,eLen=nBytes*8-mLen-1,eMax=(1<<eLen)-1,eBias=eMax>>1,rt=mLen===23?Math.pow(2,-24)-Math.pow(2,-77):0,i=isLE?0:nBytes-1,d=isLE?1:-1,s=value<0||value===0&&1/value<0?1:0;value=Math.abs(value);if(isNaN(value)||value===Infinity){m=isNaN(value)?1:0;e=eMax}else{e=Math.floor(Math.log(value)/Math.LN2);if(value*(c=Math.pow(2,-e))<1){e--;c*=2}if(e+eBias>=1){value+=rt/c}else{value+=rt*Math.pow(2,1-eBias)}if(value*c>=2){e++;c/=2}if(e+eBias>=eMax){m=0;e=eMax}else if(e+eBias>=1){m=(value*c-1)*Math.pow(2,mLen);e=e+eBias}else{m=value*Math.pow(2,eBias-1)*Math.pow(2,mLen);e=0}}for(;mLen>=8;buffer[offset+i]=m&255,i+=d,m/=256,mLen-=8);e=e<<mLen|m;eLen+=mLen;for(;eLen>0;buffer[offset+i]=e&255,i+=d,e/=256,eLen-=8);buffer[offset+i-d]|=s*128}},{}],97:[function(require,module,exports){var isArray=Array.isArray;var str=Object.prototype.toString;module.exports=isArray||function(val){return!!val&&"[object Array]"==str.call(val)}},{}],98:[function(require,module,exports){if(typeof Object.create==="function"){module.exports=function inherits(ctor,superCtor){ctor.super_=superCtor;ctor.prototype=Object.create(superCtor.prototype,{constructor:{value:ctor,enumerable:false,writable:true,configurable:true}})}}else{module.exports=function inherits(ctor,superCtor){ctor.super_=superCtor;var TempCtor=function(){};TempCtor.prototype=superCtor.prototype;ctor.prototype=new TempCtor;ctor.prototype.constructor=ctor}}},{}],99:[function(require,module,exports){(function(process){function normalizeArray(parts,allowAboveRoot){var up=0;for(var i=parts.length-1;i>=0;i--){var last=parts[i];if(last==="."){parts.splice(i,1)}else if(last===".."){parts.splice(i,1);up++}else if(up){parts.splice(i,1);up--}}if(allowAboveRoot){for(;up--;up){parts.unshift("..")}}return parts}var splitPathRe=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;var splitPath=function(filename){return splitPathRe.exec(filename).slice(1)};exports.resolve=function(){var resolvedPath="",resolvedAbsolute=false;for(var i=arguments.length-1;i>=-1&&!resolvedAbsolute;i--){var path=i>=0?arguments[i]:process.cwd();if(typeof path!=="string"){throw new TypeError("Arguments to path.resolve must be strings")}else if(!path){continue}resolvedPath=path+"/"+resolvedPath;resolvedAbsolute=path.charAt(0)==="/"}resolvedPath=normalizeArray(filter(resolvedPath.split("/"),function(p){return!!p}),!resolvedAbsolute).join("/");return(resolvedAbsolute?"/":"")+resolvedPath||"."};exports.normalize=function(path){var isAbsolute=exports.isAbsolute(path),trailingSlash=substr(path,-1)==="/";path=normalizeArray(filter(path.split("/"),function(p){return!!p}),!isAbsolute).join("/");if(!path&&!isAbsolute){path="."}if(path&&trailingSlash){path+="/"}return(isAbsolute?"/":"")+path};exports.isAbsolute=function(path){return path.charAt(0)==="/"};exports.join=function(){var paths=Array.prototype.slice.call(arguments,0);return exports.normalize(filter(paths,function(p,index){if(typeof p!=="string"){throw new TypeError("Arguments to path.join must be strings")}return p}).join("/"))};exports.relative=function(from,to){from=exports.resolve(from).substr(1);to=exports.resolve(to).substr(1);function trim(arr){var start=0;for(;start<arr.length;start++){if(arr[start]!=="")break}var end=arr.length-1;for(;end>=0;end--){if(arr[end]!=="")break}if(start>end)return[];return arr.slice(start,end-start+1)}var fromParts=trim(from.split("/"));var toParts=trim(to.split("/"));var length=Math.min(fromParts.length,toParts.length);var samePartsLength=length;for(var i=0;i<length;i++){if(fromParts[i]!==toParts[i]){samePartsLength=i;break}}var outputParts=[];for(var i=samePartsLength;i<fromParts.length;i++){outputParts.push("..")}outputParts=outputParts.concat(toParts.slice(samePartsLength));return outputParts.join("/")};exports.sep="/";exports.delimiter=":";exports.dirname=function(path){var result=splitPath(path),root=result[0],dir=result[1];if(!root&&!dir){return"."}if(dir){dir=dir.substr(0,dir.length-1)}return root+dir};exports.basename=function(path,ext){var f=splitPath(path)[2];if(ext&&f.substr(-1*ext.length)===ext){f=f.substr(0,f.length-ext.length)}return f};exports.extname=function(path){return splitPath(path)[3]};function filter(xs,f){if(xs.filter)return xs.filter(f);var res=[];for(var i=0;i<xs.length;i++){if(f(xs[i],i,xs))res.push(xs[i])}return res}var substr="ab".substr(-1)==="b"?function(str,start,len){return str.substr(start,len)}:function(str,start,len){if(start<0)start=str.length+start;return str.substr(start,len)}}).call(this,require("_process"))},{_process:100}],100:[function(require,module,exports){var process=module.exports={};process.nextTick=function(){var canSetImmediate=typeof window!=="undefined"&&window.setImmediate;var canMutationObserver=typeof window!=="undefined"&&window.MutationObserver;var canPost=typeof window!=="undefined"&&window.postMessage&&window.addEventListener;if(canSetImmediate){return function(f){return window.setImmediate(f)}}var queue=[];if(canMutationObserver){var hiddenDiv=document.createElement("div");var observer=new MutationObserver(function(){var queueList=queue.slice();queue.length=0;queueList.forEach(function(fn){fn()})});observer.observe(hiddenDiv,{attributes:true});return function nextTick(fn){if(!queue.length){hiddenDiv.setAttribute("yes","no")}queue.push(fn)}}if(canPost){window.addEventListener("message",function(ev){var source=ev.source;if((source===window||source===null)&&ev.data==="process-tick"){ev.stopPropagation();if(queue.length>0){var fn=queue.shift();fn()}}},true);return function nextTick(fn){queue.push(fn);window.postMessage("process-tick","*")}}return function nextTick(fn){setTimeout(fn,0)}}();process.title="browser";process.browser=true;process.env={};process.argv=[];function noop(){}process.on=noop;process.addListener=noop;process.once=noop;process.off=noop;process.removeListener=noop;process.removeAllListeners=noop;process.emit=noop;process.binding=function(name){throw new Error("process.binding is not supported")};process.cwd=function(){return"/"};process.chdir=function(dir){throw new Error("process.chdir is not supported")}},{}],101:[function(require,module,exports){module.exports=function isBuffer(arg){return arg&&typeof arg==="object"&&typeof arg.copy==="function"&&typeof arg.fill==="function"&&typeof arg.readUInt8==="function"}},{}],102:[function(require,module,exports){(function(process,global){var formatRegExp=/%[sdj%]/g;exports.format=function(f){if(!isString(f)){var objects=[];for(var i=0;i<arguments.length;i++){objects.push(inspect(arguments[i]))}return objects.join(" ")}var i=1;var args=arguments;var len=args.length;var str=String(f).replace(formatRegExp,function(x){if(x==="%%")return"%";if(i>=len)return x;switch(x){case"%s":return String(args[i++]);case"%d":return Number(args[i++]);case"%j":try{return JSON.stringify(args[i++])}catch(_){return"[Circular]"}default:return x}});for(var x=args[i];i<len;x=args[++i]){if(isNull(x)||!isObject(x)){str+=" "+x}else{str+=" "+inspect(x)}}return str};exports.deprecate=function(fn,msg){if(isUndefined(global.process)){return function(){return exports.deprecate(fn,msg).apply(this,arguments)}}if(process.noDeprecation===true){return fn}var warned=false;function deprecated(){if(!warned){if(process.throwDeprecation){throw new Error(msg)}else if(process.traceDeprecation){console.trace(msg)}else{console.error(msg)}warned=true}return fn.apply(this,arguments)}return deprecated};var debugs={};var debugEnviron;exports.debuglog=function(set){if(isUndefined(debugEnviron))debugEnviron=process.env.NODE_DEBUG||"";set=set.toUpperCase();if(!debugs[set]){if(new RegExp("\\b"+set+"\\b","i").test(debugEnviron)){var pid=process.pid;debugs[set]=function(){var msg=exports.format.apply(exports,arguments);console.error("%s %d: %s",set,pid,msg)}}else{debugs[set]=function(){}}}return debugs[set]};function inspect(obj,opts){var ctx={seen:[],stylize:stylizeNoColor};if(arguments.length>=3)ctx.depth=arguments[2];if(arguments.length>=4)ctx.colors=arguments[3];if(isBoolean(opts)){ctx.showHidden=opts}else if(opts){exports._extend(ctx,opts)}if(isUndefined(ctx.showHidden))ctx.showHidden=false;if(isUndefined(ctx.depth))ctx.depth=2;if(isUndefined(ctx.colors))ctx.colors=false;if(isUndefined(ctx.customInspect))ctx.customInspect=true;if(ctx.colors)ctx.stylize=stylizeWithColor;return formatValue(ctx,obj,ctx.depth)}exports.inspect=inspect;inspect.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]};inspect.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"};function stylizeWithColor(str,styleType){var style=inspect.styles[styleType];if(style){return"["+inspect.colors[style][0]+"m"+str+"["+inspect.colors[style][1]+"m"}else{return str}}function stylizeNoColor(str,styleType){return str}function arrayToHash(array){var hash={};array.forEach(function(val,idx){hash[val]=true});return hash}function formatValue(ctx,value,recurseTimes){if(ctx.customInspect&&value&&isFunction(value.inspect)&&value.inspect!==exports.inspect&&!(value.constructor&&value.constructor.prototype===value)){var ret=value.inspect(recurseTimes,ctx);if(!isString(ret)){ret=formatValue(ctx,ret,recurseTimes)}return ret}var primitive=formatPrimitive(ctx,value);if(primitive){return primitive}var keys=Object.keys(value);var visibleKeys=arrayToHash(keys);if(ctx.showHidden){keys=Object.getOwnPropertyNames(value)}if(isError(value)&&(keys.indexOf("message")>=0||keys.indexOf("description")>=0)){return formatError(value)}if(keys.length===0){if(isFunction(value)){var name=value.name?": "+value.name:"";return ctx.stylize("[Function"+name+"]","special")}if(isRegExp(value)){return ctx.stylize(RegExp.prototype.toString.call(value),"regexp")}if(isDate(value)){return ctx.stylize(Date.prototype.toString.call(value),"date")}if(isError(value)){return formatError(value)}}var base="",array=false,braces=["{","}"];if(isArray(value)){array=true;braces=["[","]"]}if(isFunction(value)){var n=value.name?": "+value.name:"";base=" [Function"+n+"]"}if(isRegExp(value)){base=" "+RegExp.prototype.toString.call(value)}if(isDate(value)){base=" "+Date.prototype.toUTCString.call(value)}if(isError(value)){base=" "+formatError(value)}if(keys.length===0&&(!array||value.length==0)){return braces[0]+base+braces[1]}if(recurseTimes<0){if(isRegExp(value)){return ctx.stylize(RegExp.prototype.toString.call(value),"regexp")}else{return ctx.stylize("[Object]","special")}}ctx.seen.push(value);var output;if(array){output=formatArray(ctx,value,recurseTimes,visibleKeys,keys)}else{output=keys.map(function(key){return formatProperty(ctx,value,recurseTimes,visibleKeys,key,array)})}ctx.seen.pop();return reduceToSingleString(output,base,braces)}function formatPrimitive(ctx,value){if(isUndefined(value))return ctx.stylize("undefined","undefined");if(isString(value)){var simple="'"+JSON.stringify(value).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return ctx.stylize(simple,"string")}if(isNumber(value))return ctx.stylize(""+value,"number");if(isBoolean(value))return ctx.stylize(""+value,"boolean");if(isNull(value))return ctx.stylize("null","null")}function formatError(value){return"["+Error.prototype.toString.call(value)+"]"}function formatArray(ctx,value,recurseTimes,visibleKeys,keys){var output=[];for(var i=0,l=value.length;i<l;++i){if(hasOwnProperty(value,String(i))){output.push(formatProperty(ctx,value,recurseTimes,visibleKeys,String(i),true))}else{output.push("")}}keys.forEach(function(key){if(!key.match(/^\d+$/)){output.push(formatProperty(ctx,value,recurseTimes,visibleKeys,key,true))}});return output}function formatProperty(ctx,value,recurseTimes,visibleKeys,key,array){var name,str,desc;desc=Object.getOwnPropertyDescriptor(value,key)||{value:value[key]};if(desc.get){if(desc.set){str=ctx.stylize("[Getter/Setter]","special")}else{str=ctx.stylize("[Getter]","special")}}else{if(desc.set){str=ctx.stylize("[Setter]","special")}}if(!hasOwnProperty(visibleKeys,key)){name="["+key+"]"}if(!str){if(ctx.seen.indexOf(desc.value)<0){if(isNull(recurseTimes)){str=formatValue(ctx,desc.value,null)}else{str=formatValue(ctx,desc.value,recurseTimes-1)}if(str.indexOf("\n")>-1){if(array){str=str.split("\n").map(function(line){return" "+line}).join("\n").substr(2)}else{str="\n"+str.split("\n").map(function(line){return" "+line}).join("\n")}}}else{str=ctx.stylize("[Circular]","special")}}if(isUndefined(name)){if(array&&key.match(/^\d+$/)){return str}name=JSON.stringify(""+key);if(name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)){name=name.substr(1,name.length-2);name=ctx.stylize(name,"name")}else{name=name.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'");name=ctx.stylize(name,"string")}}return name+": "+str}function reduceToSingleString(output,base,braces){var numLinesEst=0;var length=output.reduce(function(prev,cur){numLinesEst++;if(cur.indexOf("\n")>=0)numLinesEst++;return prev+cur.replace(/\u001b\[\d\d?m/g,"").length+1},0);if(length>60){return braces[0]+(base===""?"":base+"\n ")+" "+output.join(",\n ")+" "+braces[1]}return braces[0]+base+" "+output.join(", ")+" "+braces[1]}function isArray(ar){return Array.isArray(ar)}exports.isArray=isArray;function isBoolean(arg){return typeof arg==="boolean"}exports.isBoolean=isBoolean;function isNull(arg){return arg===null}exports.isNull=isNull;function isNullOrUndefined(arg){return arg==null}exports.isNullOrUndefined=isNullOrUndefined;function isNumber(arg){return typeof arg==="number"}exports.isNumber=isNumber;function isString(arg){return typeof arg==="string"}exports.isString=isString;function isSymbol(arg){return typeof arg==="symbol"}exports.isSymbol=isSymbol;function isUndefined(arg){return arg===void 0}exports.isUndefined=isUndefined;function isRegExp(re){return isObject(re)&&objectToString(re)==="[object RegExp]"}exports.isRegExp=isRegExp;function isObject(arg){return typeof arg==="object"&&arg!==null}exports.isObject=isObject;function isDate(d){return isObject(d)&&objectToString(d)==="[object Date]"}exports.isDate=isDate;function isError(e){return isObject(e)&&(objectToString(e)==="[object Error]"||e instanceof Error)}exports.isError=isError;function isFunction(arg){return typeof arg==="function"}exports.isFunction=isFunction;function isPrimitive(arg){return arg===null||typeof arg==="boolean"||typeof arg==="number"||typeof arg==="string"||typeof arg==="symbol"||typeof arg==="undefined"}exports.isPrimitive=isPrimitive;exports.isBuffer=require("./support/isBuffer");function objectToString(o){return Object.prototype.toString.call(o)}function pad(n){return n<10?"0"+n.toString(10):n.toString(10)}var months=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function timestamp(){var d=new Date;var time=[pad(d.getHours()),pad(d.getMinutes()),pad(d.getSeconds())].join(":");return[d.getDate(),months[d.getMonth()],time].join(" ")}exports.log=function(){console.log("%s - %s",timestamp(),exports.format.apply(exports,arguments))};exports.inherits=require("inherits");exports._extend=function(origin,add){if(!add||!isObject(add))return origin;var keys=Object.keys(add);var i=keys.length;while(i--){origin[keys[i]]=add[keys[i]]}return origin};function hasOwnProperty(obj,prop){return Object.prototype.hasOwnProperty.call(obj,prop)}}).call(this,require("_process"),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./support/isBuffer":101,_process:100,inherits:98}],103:[function(require,module,exports){(function(root,factory){"use strict";if(typeof define==="function"&&define.amd){define(["exports"],factory)}else if(typeof exports!=="undefined"){factory(exports)}else{factory(root.estraverse={})}})(this,function(exports){"use strict";var Syntax,isArray,VisitorOption,VisitorKeys,objectCreate,objectKeys,BREAK,SKIP,REMOVE;function ignoreJSHintError(){}isArray=Array.isArray;if(!isArray){isArray=function isArray(array){return Object.prototype.toString.call(array)==="[object Array]"}}function deepCopy(obj){var ret={},key,val;for(key in obj){if(obj.hasOwnProperty(key)){val=obj[key];if(typeof val==="object"&&val!==null){ret[key]=deepCopy(val)}else{ret[key]=val}}}return ret}function shallowCopy(obj){var ret={},key;for(key in obj){if(obj.hasOwnProperty(key)){ret[key]=obj[key]}}return ret}ignoreJSHintError(shallowCopy);function upperBound(array,func){var diff,len,i,current;len=array.length;i=0;while(len){diff=len>>>1;current=i+diff;if(func(array[current])){len=diff}else{i=current+1;len-=diff+1}}return i}function lowerBound(array,func){var diff,len,i,current;len=array.length;i=0;while(len){diff=len>>>1;current=i+diff;if(func(array[current])){i=current+1;len-=diff+1}else{len=diff}}return i}ignoreJSHintError(lowerBound);objectCreate=Object.create||function(){function F(){}return function(o){F.prototype=o;return new F}}();objectKeys=Object.keys||function(o){var keys=[],key;for(key in o){keys.push(key)}return keys};function extend(to,from){objectKeys(from).forEach(function(key){to[key]=from[key]});return to}Syntax={AssignmentExpression:"AssignmentExpression",ArrayExpression:"ArrayExpression",ArrayPattern:"ArrayPattern",ArrowFunctionExpression:"ArrowFunctionExpression",BlockStatement:"BlockStatement",BinaryExpression:"BinaryExpression",BreakStatement:"BreakStatement",CallExpression:"CallExpression",CatchClause:"CatchClause",ClassBody:"ClassBody",ClassDeclaration:"ClassDeclaration",ClassExpression:"ClassExpression",ComprehensionBlock:"ComprehensionBlock",ComprehensionExpression:"ComprehensionExpression",ConditionalExpression:"ConditionalExpression",ContinueStatement:"ContinueStatement",DebuggerStatement:"DebuggerStatement",DirectiveStatement:"DirectiveStatement",DoWhileStatement:"DoWhileStatement",EmptyStatement:"EmptyStatement",ExportBatchSpecifier:"ExportBatchSpecifier",ExportDeclaration:"ExportDeclaration",ExportSpecifier:"ExportSpecifier",ExpressionStatement:"ExpressionStatement",ForStatement:"ForStatement",ForInStatement:"ForInStatement",ForOfStatement:"ForOfStatement",FunctionDeclaration:"FunctionDeclaration",FunctionExpression:"FunctionExpression",GeneratorExpression:"GeneratorExpression",Identifier:"Identifier",IfStatement:"IfStatement",ImportDeclaration:"ImportDeclaration",ImportDefaultSpecifier:"ImportDefaultSpecifier",ImportNamespaceSpecifier:"ImportNamespaceSpecifier",ImportSpecifier:"ImportSpecifier",Literal:"Literal",LabeledStatement:"LabeledStatement",LogicalExpression:"LogicalExpression",MemberExpression:"MemberExpression",MethodDefinition:"MethodDefinition",ModuleSpecifier:"ModuleSpecifier",NewExpression:"NewExpression",ObjectExpression:"ObjectExpression",ObjectPattern:"ObjectPattern",Program:"Program",Property:"Property",ReturnStatement:"ReturnStatement",SequenceExpression:"SequenceExpression",SpreadElement:"SpreadElement",SwitchStatement:"SwitchStatement",SwitchCase:"SwitchCase",TaggedTemplateExpression:"TaggedTemplateExpression",TemplateElement:"TemplateElement",TemplateLiteral:"TemplateLiteral",ThisExpression:"ThisExpression",ThrowStatement:"ThrowStatement",TryStatement:"TryStatement",UnaryExpression:"UnaryExpression",UpdateExpression:"UpdateExpression",VariableDeclaration:"VariableDeclaration",VariableDeclarator:"VariableDeclarator",WhileStatement:"WhileStatement",WithStatement:"WithStatement",YieldExpression:"YieldExpression"};VisitorKeys={AssignmentExpression:["left","right"],ArrayExpression:["elements"],ArrayPattern:["elements"],ArrowFunctionExpression:["params","defaults","rest","body"],BlockStatement:["body"],BinaryExpression:["left","right"],BreakStatement:["label"],CallExpression:["callee","arguments"],CatchClause:["param","body"],ClassBody:["body"],ClassDeclaration:["id","body","superClass"],ClassExpression:["id","body","superClass"],ComprehensionBlock:["left","right"],ComprehensionExpression:["blocks","filter","body"],ConditionalExpression:["test","consequent","alternate"],ContinueStatement:["label"],DebuggerStatement:[],DirectiveStatement:[],DoWhileStatement:["body","test"],EmptyStatement:[],ExportBatchSpecifier:[],ExportDeclaration:["declaration","specifiers","source"],ExportSpecifier:["id","name"],ExpressionStatement:["expression"],ForStatement:["init","test","update","body"],ForInStatement:["left","right","body"],ForOfStatement:["left","right","body"],FunctionDeclaration:["id","params","defaults","rest","body"],FunctionExpression:["id","params","defaults","rest","body"],GeneratorExpression:["blocks","filter","body"],Identifier:[],IfStatement:["test","consequent","alternate"],ImportDeclaration:["specifiers","source"],ImportDefaultSpecifier:["id"],ImportNamespaceSpecifier:["id"],ImportSpecifier:["id","name"],Literal:[],LabeledStatement:["label","body"],LogicalExpression:["left","right"],MemberExpression:["object","property"],MethodDefinition:["key","value"],ModuleSpecifier:[],NewExpression:["callee","arguments"],ObjectExpression:["properties"],ObjectPattern:["properties"],Program:["body"],Property:["key","value"],ReturnStatement:["argument"],SequenceExpression:["expressions"],SpreadElement:["argument"],SwitchStatement:["discriminant","cases"],SwitchCase:["test","consequent"],TaggedTemplateExpression:["tag","quasi"],TemplateElement:[],TemplateLiteral:["quasis","expressions"],ThisExpression:[],ThrowStatement:["argument"],TryStatement:["block","handlers","handler","guardedHandlers","finalizer"],UnaryExpression:["argument"],UpdateExpression:["argument"],VariableDeclaration:["declarations"],VariableDeclarator:["id","init"],WhileStatement:["test","body"],WithStatement:["object","body"],YieldExpression:["argument"]};BREAK={};SKIP={};REMOVE={};VisitorOption={Break:BREAK,Skip:SKIP,Remove:REMOVE};function Reference(parent,key){this.parent=parent;this.key=key}Reference.prototype.replace=function replace(node){this.parent[this.key]=node};Reference.prototype.remove=function remove(){if(isArray(this.parent)){this.parent.splice(this.key,1);return true}else{this.replace(null);return false}};function Element(node,path,wrap,ref){this.node=node;this.path=path;this.wrap=wrap;this.ref=ref}function Controller(){}Controller.prototype.path=function path(){var i,iz,j,jz,result,element;function addToPath(result,path){if(isArray(path)){for(j=0,jz=path.length;j<jz;++j){result.push(path[j])}}else{result.push(path)}}if(!this.__current.path){return null}result=[];for(i=2,iz=this.__leavelist.length;i<iz;++i){element=this.__leavelist[i];addToPath(result,element.path)}addToPath(result,this.__current.path);return result};Controller.prototype.type=function(){var node=this.current();return node.type||this.__current.wrap};Controller.prototype.parents=function parents(){var i,iz,result;result=[];for(i=1,iz=this.__leavelist.length;i<iz;++i){result.push(this.__leavelist[i].node)}return result};Controller.prototype.current=function current(){return this.__current.node};Controller.prototype.__execute=function __execute(callback,element){var previous,result;result=undefined;previous=this.__current;this.__current=element;this.__state=null;if(callback){result=callback.call(this,element.node,this.__leavelist[this.__leavelist.length-1].node)}this.__current=previous;return result};Controller.prototype.notify=function notify(flag){this.__state=flag};Controller.prototype.skip=function(){this.notify(SKIP)};Controller.prototype["break"]=function(){this.notify(BREAK)};Controller.prototype.remove=function(){this.notify(REMOVE)};Controller.prototype.__initialize=function(root,visitor){this.visitor=visitor;this.root=root;this.__worklist=[];this.__leavelist=[];this.__current=null;this.__state=null;this.__fallback=visitor.fallback==="iteration";this.__keys=VisitorKeys;if(visitor.keys){this.__keys=extend(objectCreate(this.__keys),visitor.keys)}};function isNode(node){if(node==null){return false}return typeof node==="object"&&typeof node.type==="string"}function isProperty(nodeType,key){return(nodeType===Syntax.ObjectExpression||nodeType===Syntax.ObjectPattern)&&"properties"===key}Controller.prototype.traverse=function traverse(root,visitor){var worklist,leavelist,element,node,nodeType,ret,key,current,current2,candidates,candidate,sentinel;this.__initialize(root,visitor);sentinel={};worklist=this.__worklist;leavelist=this.__leavelist;worklist.push(new Element(root,null,null,null));leavelist.push(new Element(null,null,null,null));while(worklist.length){element=worklist.pop();if(element===sentinel){element=leavelist.pop();ret=this.__execute(visitor.leave,element);if(this.__state===BREAK||ret===BREAK){return}continue}if(element.node){ret=this.__execute(visitor.enter,element);if(this.__state===BREAK||ret===BREAK){return}worklist.push(sentinel);leavelist.push(element);if(this.__state===SKIP||ret===SKIP){continue}node=element.node;nodeType=element.wrap||node.type;candidates=this.__keys[nodeType];if(!candidates){if(this.__fallback){candidates=objectKeys(node)}else{throw new Error("Unknown node type "+nodeType+".")}}current=candidates.length;while((current-=1)>=0){key=candidates[current];candidate=node[key];if(!candidate){continue}if(isArray(candidate)){current2=candidate.length;while((current2-=1)>=0){if(!candidate[current2]){continue}if(isProperty(nodeType,candidates[current])){element=new Element(candidate[current2],[key,current2],"Property",null)}else if(isNode(candidate[current2])){element=new Element(candidate[current2],[key,current2],null,null)}else{continue}worklist.push(element)}}else if(isNode(candidate)){worklist.push(new Element(candidate,key,null,null))}}}}};Controller.prototype.replace=function replace(root,visitor){function removeElem(element){var i,key,nextElem,parent;if(element.ref.remove()){key=element.ref.key;parent=element.ref.parent;i=worklist.length;while(i--){nextElem=worklist[i];if(nextElem.ref&&nextElem.ref.parent===parent){if(nextElem.ref.key<key){break}--nextElem.ref.key}}}}var worklist,leavelist,node,nodeType,target,element,current,current2,candidates,candidate,sentinel,outer,key;this.__initialize(root,visitor);sentinel={};worklist=this.__worklist;leavelist=this.__leavelist;outer={root:root};element=new Element(root,null,null,new Reference(outer,"root"));worklist.push(element);leavelist.push(element);while(worklist.length){element=worklist.pop();if(element===sentinel){element=leavelist.pop();target=this.__execute(visitor.leave,element);if(target!==undefined&&target!==BREAK&&target!==SKIP&&target!==REMOVE){element.ref.replace(target)}if(this.__state===REMOVE||target===REMOVE){removeElem(element)}if(this.__state===BREAK||target===BREAK){return outer.root}continue}target=this.__execute(visitor.enter,element);if(target!==undefined&&target!==BREAK&&target!==SKIP&&target!==REMOVE){element.ref.replace(target);element.node=target}if(this.__state===REMOVE||target===REMOVE){removeElem(element);element.node=null}if(this.__state===BREAK||target===BREAK){return outer.root}node=element.node;if(!node){continue}worklist.push(sentinel);leavelist.push(element);if(this.__state===SKIP||target===SKIP){continue}nodeType=element.wrap||node.type;candidates=this.__keys[nodeType];if(!candidates){if(this.__fallback){candidates=objectKeys(node)}else{throw new Error("Unknown node type "+nodeType+".")}}current=candidates.length;while((current-=1)>=0){key=candidates[current];candidate=node[key];
if(!candidate){continue}if(isArray(candidate)){current2=candidate.length;while((current2-=1)>=0){if(!candidate[current2]){continue}if(isProperty(nodeType,candidates[current])){element=new Element(candidate[current2],[key,current2],"Property",new Reference(candidate,current2))}else if(isNode(candidate[current2])){element=new Element(candidate[current2],[key,current2],null,new Reference(candidate,current2))}else{continue}worklist.push(element)}}else if(isNode(candidate)){worklist.push(new Element(candidate,key,null,new Reference(node,key)))}}}return outer.root};function traverse(root,visitor){var controller=new Controller;return controller.traverse(root,visitor)}function replace(root,visitor){var controller=new Controller;return controller.replace(root,visitor)}function extendCommentRange(comment,tokens){var target;target=upperBound(tokens,function search(token){return token.range[0]>comment.range[0]});comment.extendedRange=[comment.range[0],comment.range[1]];if(target!==tokens.length){comment.extendedRange[1]=tokens[target].range[0]}target-=1;if(target>=0){comment.extendedRange[0]=tokens[target].range[1]}return comment}function attachComments(tree,providedComments,tokens){var comments=[],comment,len,i,cursor;if(!tree.range){throw new Error("attachComments needs range information")}if(!tokens.length){if(providedComments.length){for(i=0,len=providedComments.length;i<len;i+=1){comment=deepCopy(providedComments[i]);comment.extendedRange=[0,tree.range[0]];comments.push(comment)}tree.leadingComments=comments}return tree}for(i=0,len=providedComments.length;i<len;i+=1){comments.push(extendCommentRange(deepCopy(providedComments[i]),tokens))}cursor=0;traverse(tree,{enter:function(node){var comment;while(cursor<comments.length){comment=comments[cursor];if(comment.extendedRange[1]>node.range[0]){break}if(comment.extendedRange[1]===node.range[0]){if(!node.leadingComments){node.leadingComments=[]}node.leadingComments.push(comment);comments.splice(cursor,1)}else{cursor+=1}}if(cursor===comments.length){return VisitorOption.Break}if(comments[cursor].extendedRange[0]>node.range[1]){return VisitorOption.Skip}}});cursor=0;traverse(tree,{leave:function(node){var comment;while(cursor<comments.length){comment=comments[cursor];if(node.range[1]<comment.extendedRange[0]){break}if(node.range[1]===comment.extendedRange[0]){if(!node.trailingComments){node.trailingComments=[]}node.trailingComments.push(comment);comments.splice(cursor,1)}else{cursor+=1}}if(cursor===comments.length){return VisitorOption.Break}if(comments[cursor].extendedRange[0]>node.range[1]){return VisitorOption.Skip}}});return tree}exports.version="1.8.0";exports.Syntax=Syntax;exports.traverse=traverse;exports.replace=replace;exports.attachComments=attachComments;exports.VisitorKeys=VisitorKeys;exports.VisitorOption=VisitorOption;exports.Controller=Controller})},{}],104:[function(require,module,exports){(function(){"use strict";function isExpression(node){if(node==null){return false}switch(node.type){case"ArrayExpression":case"AssignmentExpression":case"BinaryExpression":case"CallExpression":case"ConditionalExpression":case"FunctionExpression":case"Identifier":case"Literal":case"LogicalExpression":case"MemberExpression":case"NewExpression":case"ObjectExpression":case"SequenceExpression":case"ThisExpression":case"UnaryExpression":case"UpdateExpression":return true}return false}function isIterationStatement(node){if(node==null){return false}switch(node.type){case"DoWhileStatement":case"ForInStatement":case"ForStatement":case"WhileStatement":return true}return false}function isStatement(node){if(node==null){return false}switch(node.type){case"BlockStatement":case"BreakStatement":case"ContinueStatement":case"DebuggerStatement":case"DoWhileStatement":case"EmptyStatement":case"ExpressionStatement":case"ForInStatement":case"ForStatement":case"IfStatement":case"LabeledStatement":case"ReturnStatement":case"SwitchStatement":case"ThrowStatement":case"TryStatement":case"VariableDeclaration":case"WhileStatement":case"WithStatement":return true}return false}function isSourceElement(node){return isStatement(node)||node!=null&&node.type==="FunctionDeclaration"}function trailingStatement(node){switch(node.type){case"IfStatement":if(node.alternate!=null){return node.alternate}return node.consequent;case"LabeledStatement":case"ForStatement":case"ForInStatement":case"WhileStatement":case"WithStatement":return node.body}return null}function isProblematicIfStatement(node){var current;if(node.type!=="IfStatement"){return false}if(node.alternate==null){return false}current=node.consequent;do{if(current.type==="IfStatement"){if(current.alternate==null){return true}}current=trailingStatement(current)}while(current);return false}module.exports={isExpression:isExpression,isStatement:isStatement,isIterationStatement:isIterationStatement,isSourceElement:isSourceElement,isProblematicIfStatement:isProblematicIfStatement,trailingStatement:trailingStatement}})()},{}],105:[function(require,module,exports){(function(){"use strict";var Regex,NON_ASCII_WHITESPACES;Regex={NonAsciiIdentifierStart:new RegExp("[ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԧԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠࢢ-ࢬऄ-हऽॐक़-ॡॱ-ॷॹ-ॿঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-ళవ-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛰᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤜᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々-〇〡-〩〱-〵〸-〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚗꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꪀ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ]"),NonAsciiIdentifierPart:new RegExp("[ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮ̀-ʹͶͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁ҃-҇Ҋ-ԧԱ-Ֆՙա-և֑-ׇֽֿׁׂׅׄא-תװ-ײؐ-ؚؠ-٩ٮ-ۓە-ۜ۟-۪ۨ-ۼۿܐ-݊ݍ-ޱ߀-ߵߺࠀ-࠭ࡀ-࡛ࢠࢢ-ࢬࣤ-ࣾऀ-ॣ०-९ॱ-ॷॹ-ॿঁ-ঃঅ-ঌএঐও-নপ-রলশ-হ়-ৄেৈো-ৎৗড়ঢ়য়-ৣ০-ৱਁ-ਃਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹ਼ਾ-ੂੇੈੋ-੍ੑਖ਼-ੜਫ਼੦-ੵઁ-ઃઅ-ઍએ-ઑઓ-નપ-રલળવ-હ઼-ૅે-ૉો-્ૐૠ-ૣ૦-૯ଁ-ଃଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହ଼-ୄେୈୋ-୍ୖୗଡ଼ଢ଼ୟ-ୣ୦-୯ୱஂஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹா-ூெ-ைொ-்ௐௗ௦-௯ఁ-ఃఅ-ఌఎ-ఐఒ-నప-ళవ-హఽ-ౄె-ైొ-్ౕౖౘౙౠ-ౣ౦-౯ಂಃಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹ಼-ೄೆ-ೈೊ-್ೕೖೞೠ-ೣ೦-೯ೱೲംഃഅ-ഌഎ-ഐഒ-ഺഽ-ൄെ-ൈൊ-ൎൗൠ-ൣ൦-൯ൺ-ൿංඃඅ-ඖක-නඳ-රලව-ෆ්ා-ුූෘ-ෟෲෳก-ฺเ-๎๐-๙ກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ູົ-ຽເ-ໄໆ່-ໍ໐-໙ໜ-ໟༀ༘༙༠-༩༹༵༷༾-ཇཉ-ཬཱ-྄྆-ྗྙ-ྼ࿆က-၉ၐ-ႝႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚ፝-፟ᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛰᜀ-ᜌᜎ-᜔ᜠ-᜴ᝀ-ᝓᝠ-ᝬᝮ-ᝰᝲᝳក-៓ៗៜ៝០-៩᠋-᠍᠐-᠙ᠠ-ᡷᢀ-ᢪᢰ-ᣵᤀ-ᤜᤠ-ᤫᤰ-᤻᥆-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉ᧐-᧙ᨀ-ᨛᨠ-ᩞ᩠-᩿᩼-᪉᪐-᪙ᪧᬀ-ᭋ᭐-᭙᭫-᭳ᮀ-᯳ᰀ-᰷᱀-᱉ᱍ-ᱽ᳐-᳔᳒-ᳶᴀ-ᷦ᷼-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼ‿⁀⁔ⁱⁿₐ-ₜ⃐-⃥⃜⃡-⃰ℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯ⵿-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⷠ-ⷿⸯ々-〇〡-〯〱-〵〸-〼ぁ-ゖ゙゚ゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘫꙀ-꙯ꙴ-꙽ꙿ-ꚗꚟ-꛱ꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꠧꡀ-ꡳꢀ-꣄꣐-꣙꣠-ꣷꣻ꤀-꤭ꤰ-꥓ꥠ-ꥼꦀ-꧀ꧏ-꧙ꨀ-ꨶꩀ-ꩍ꩐-꩙ꩠ-ꩶꩺꩻꪀ-ꫂꫛ-ꫝꫠ-ꫯꫲ-꫶ꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯪ꯬꯭꯰-꯹가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻ︀-️︠-︦︳︴﹍-﹏ﹰ-ﹴﹶ-ﻼ0-9A-Z_a-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ]")};function isDecimalDigit(ch){return ch>=48&&ch<=57}function isHexDigit(ch){return isDecimalDigit(ch)||97<=ch&&ch<=102||65<=ch&&ch<=70}function isOctalDigit(ch){return ch>=48&&ch<=55}NON_ASCII_WHITESPACES=[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279];function isWhiteSpace(ch){return ch===32||ch===9||ch===11||ch===12||ch===160||ch>=5760&&NON_ASCII_WHITESPACES.indexOf(ch)>=0}function isLineTerminator(ch){return ch===10||ch===13||ch===8232||ch===8233}function isIdentifierStart(ch){return ch>=97&&ch<=122||ch>=65&&ch<=90||ch===36||ch===95||ch===92||ch>=128&&Regex.NonAsciiIdentifierStart.test(String.fromCharCode(ch))}function isIdentifierPart(ch){return ch>=97&&ch<=122||ch>=65&&ch<=90||ch>=48&&ch<=57||ch===36||ch===95||ch===92||ch>=128&&Regex.NonAsciiIdentifierPart.test(String.fromCharCode(ch))}module.exports={isDecimalDigit:isDecimalDigit,isHexDigit:isHexDigit,isOctalDigit:isOctalDigit,isWhiteSpace:isWhiteSpace,isLineTerminator:isLineTerminator,isIdentifierStart:isIdentifierStart,isIdentifierPart:isIdentifierPart}})()},{}],106:[function(require,module,exports){(function(){"use strict";var code=require("./code");function isStrictModeReservedWordES6(id){switch(id){case"implements":case"interface":case"package":case"private":case"protected":case"public":case"static":case"let":return true;default:return false}}function isKeywordES5(id,strict){if(!strict&&id==="yield"){return false}return isKeywordES6(id,strict)}function isKeywordES6(id,strict){if(strict&&isStrictModeReservedWordES6(id)){return true}switch(id.length){case 2:return id==="if"||id==="in"||id==="do";case 3:return id==="var"||id==="for"||id==="new"||id==="try";case 4:return id==="this"||id==="else"||id==="case"||id==="void"||id==="with"||id==="enum";case 5:return id==="while"||id==="break"||id==="catch"||id==="throw"||id==="const"||id==="yield"||id==="class"||id==="super";case 6:return id==="return"||id==="typeof"||id==="delete"||id==="switch"||id==="export"||id==="import";case 7:return id==="default"||id==="finally"||id==="extends";case 8:return id==="function"||id==="continue"||id==="debugger";case 10:return id==="instanceof";default:return false}}function isReservedWordES5(id,strict){return id==="null"||id==="true"||id==="false"||isKeywordES5(id,strict)}function isReservedWordES6(id,strict){return id==="null"||id==="true"||id==="false"||isKeywordES6(id,strict)}function isRestrictedWord(id){return id==="eval"||id==="arguments"}function isIdentifierName(id){var i,iz,ch;if(id.length===0){return false}ch=id.charCodeAt(0);if(!code.isIdentifierStart(ch)||ch===92){return false}for(i=1,iz=id.length;i<iz;++i){ch=id.charCodeAt(i);if(!code.isIdentifierPart(ch)||ch===92){return false}}return true}function isIdentifierES5(id,strict){return isIdentifierName(id)&&!isReservedWordES5(id,strict)}function isIdentifierES6(id,strict){return isIdentifierName(id)&&!isReservedWordES6(id,strict)}module.exports={isKeywordES5:isKeywordES5,isKeywordES6:isKeywordES6,isReservedWordES5:isReservedWordES5,isReservedWordES6:isReservedWordES6,isRestrictedWord:isRestrictedWord,isIdentifierName:isIdentifierName,isIdentifierES5:isIdentifierES5,isIdentifierES6:isIdentifierES6}})()},{"./code":105}],107:[function(require,module,exports){(function(){"use strict";exports.ast=require("./ast");exports.code=require("./code");exports.keyword=require("./keyword")})()},{"./ast":104,"./code":105,"./keyword":106}],108:[function(require,module,exports){(function(global){(function(){var undefined;var arrayPool=[],objectPool=[];var idCounter=0;var keyPrefix=+new Date+"";var largeArraySize=75;var maxPoolSize=40;var whitespace=" \f "+"\n\r\u2028\u2029"+" ";var reEmptyStringLeading=/\b__p \+= '';/g,reEmptyStringMiddle=/\b(__p \+=) '' \+/g,reEmptyStringTrailing=/(__e\(.*?\)|\b__t\)) \+\n'';/g;var reEsTemplate=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;var reFlags=/\w*$/;var reFuncName=/^\s*function[ \n\r\t]+\w/;var reInterpolate=/<%=([\s\S]+?)%>/g;var reLeadingSpacesAndZeros=RegExp("^["+whitespace+"]*0+(?=.$)");var reNoMatch=/($^)/;var reThis=/\bthis\b/;var reUnescapedString=/['\n\r\t\u2028\u2029\\]/g;var contextProps=["Array","Boolean","Date","Function","Math","Number","Object","RegExp","String","_","attachEvent","clearTimeout","isFinite","isNaN","parseInt","setTimeout"];var templateCounter=0;var argsClass="[object Arguments]",arrayClass="[object Array]",boolClass="[object Boolean]",dateClass="[object Date]",funcClass="[object Function]",numberClass="[object Number]",objectClass="[object Object]",regexpClass="[object RegExp]",stringClass="[object String]";var cloneableClasses={};cloneableClasses[funcClass]=false;cloneableClasses[argsClass]=cloneableClasses[arrayClass]=cloneableClasses[boolClass]=cloneableClasses[dateClass]=cloneableClasses[numberClass]=cloneableClasses[objectClass]=cloneableClasses[regexpClass]=cloneableClasses[stringClass]=true;var debounceOptions={leading:false,maxWait:0,trailing:false};var descriptor={configurable:false,enumerable:false,value:null,writable:false};var objectTypes={"boolean":false,"function":true,object:true,number:false,string:false,undefined:false};var stringEscapes={"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"};var root=objectTypes[typeof window]&&window||this;var freeExports=objectTypes[typeof exports]&&exports&&!exports.nodeType&&exports;var freeModule=objectTypes[typeof module]&&module&&!module.nodeType&&module;var moduleExports=freeModule&&freeModule.exports===freeExports&&freeExports;var freeGlobal=objectTypes[typeof global]&&global;if(freeGlobal&&(freeGlobal.global===freeGlobal||freeGlobal.window===freeGlobal)){root=freeGlobal}function baseIndexOf(array,value,fromIndex){var index=(fromIndex||0)-1,length=array?array.length:0;while(++index<length){if(array[index]===value){return index}}return-1}function cacheIndexOf(cache,value){var type=typeof value;cache=cache.cache;if(type=="boolean"||value==null){return cache[value]?0:-1}if(type!="number"&&type!="string"){type="object"}var key=type=="number"?value:keyPrefix+value;cache=(cache=cache[type])&&cache[key];return type=="object"?cache&&baseIndexOf(cache,value)>-1?0:-1:cache?0:-1}function cachePush(value){var cache=this.cache,type=typeof value;if(type=="boolean"||value==null){cache[value]=true}else{if(type!="number"&&type!="string"){type="object"}var key=type=="number"?value:keyPrefix+value,typeCache=cache[type]||(cache[type]={});if(type=="object"){(typeCache[key]||(typeCache[key]=[])).push(value)}else{typeCache[key]=true}}}function charAtCallback(value){return value.charCodeAt(0)}function compareAscending(a,b){var ac=a.criteria,bc=b.criteria,index=-1,length=ac.length;while(++index<length){var value=ac[index],other=bc[index];if(value!==other){if(value>other||typeof value=="undefined"){return 1}if(value<other||typeof other=="undefined"){return-1}}}return a.index-b.index}function createCache(array){var index=-1,length=array.length,first=array[0],mid=array[length/2|0],last=array[length-1];if(first&&typeof first=="object"&&mid&&typeof mid=="object"&&last&&typeof last=="object"){return false}var cache=getObject();cache["false"]=cache["null"]=cache["true"]=cache["undefined"]=false;var result=getObject();result.array=array;result.cache=cache;result.push=cachePush;while(++index<length){result.push(array[index])}return result}function escapeStringChar(match){return"\\"+stringEscapes[match]}function getArray(){return arrayPool.pop()||[]}function getObject(){return objectPool.pop()||{array:null,cache:null,criteria:null,"false":false,index:0,"null":false,number:null,object:null,push:null,string:null,"true":false,undefined:false,value:null}}function releaseArray(array){array.length=0;if(arrayPool.length<maxPoolSize){arrayPool.push(array)}}function releaseObject(object){var cache=object.cache;if(cache){releaseObject(cache)}object.array=object.cache=object.criteria=object.object=object.number=object.string=object.value=null;if(objectPool.length<maxPoolSize){objectPool.push(object)}}function slice(array,start,end){start||(start=0);if(typeof end=="undefined"){end=array?array.length:0}var index=-1,length=end-start||0,result=Array(length<0?0:length);while(++index<length){result[index]=array[start+index]}return result}function runInContext(context){context=context?_.defaults(root.Object(),context,_.pick(root,contextProps)):root;var Array=context.Array,Boolean=context.Boolean,Date=context.Date,Function=context.Function,Math=context.Math,Number=context.Number,Object=context.Object,RegExp=context.RegExp,String=context.String,TypeError=context.TypeError;var arrayRef=[];var objectProto=Object.prototype;var oldDash=context._;var toString=objectProto.toString;var reNative=RegExp("^"+String(toString).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$");var ceil=Math.ceil,clearTimeout=context.clearTimeout,floor=Math.floor,fnToString=Function.prototype.toString,getPrototypeOf=isNative(getPrototypeOf=Object.getPrototypeOf)&&getPrototypeOf,hasOwnProperty=objectProto.hasOwnProperty,push=arrayRef.push,setTimeout=context.setTimeout,splice=arrayRef.splice,unshift=arrayRef.unshift;var defineProperty=function(){try{var o={},func=isNative(func=Object.defineProperty)&&func,result=func(o,o,o)&&func}catch(e){}return result}();var nativeCreate=isNative(nativeCreate=Object.create)&&nativeCreate,nativeIsArray=isNative(nativeIsArray=Array.isArray)&&nativeIsArray,nativeIsFinite=context.isFinite,nativeIsNaN=context.isNaN,nativeKeys=isNative(nativeKeys=Object.keys)&&nativeKeys,nativeMax=Math.max,nativeMin=Math.min,nativeParseInt=context.parseInt,nativeRandom=Math.random;var ctorByClass={};ctorByClass[arrayClass]=Array;ctorByClass[boolClass]=Boolean;ctorByClass[dateClass]=Date;ctorByClass[funcClass]=Function;ctorByClass[objectClass]=Object;ctorByClass[numberClass]=Number;ctorByClass[regexpClass]=RegExp;ctorByClass[stringClass]=String;function lodash(value){return value&&typeof value=="object"&&!isArray(value)&&hasOwnProperty.call(value,"__wrapped__")?value:new lodashWrapper(value)}function lodashWrapper(value,chainAll){this.__chain__=!!chainAll;this.__wrapped__=value}lodashWrapper.prototype=lodash.prototype;var support=lodash.support={};support.funcDecomp=!isNative(context.WinRTError)&&reThis.test(runInContext);support.funcNames=typeof Function.name=="string";lodash.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:reInterpolate,variable:"",imports:{_:lodash}};function baseBind(bindData){var func=bindData[0],partialArgs=bindData[2],thisArg=bindData[4];function bound(){if(partialArgs){var args=slice(partialArgs);push.apply(args,arguments)}if(this instanceof bound){var thisBinding=baseCreate(func.prototype),result=func.apply(thisBinding,args||arguments);return isObject(result)?result:thisBinding}return func.apply(thisArg,args||arguments)}setBindData(bound,bindData);return bound}function baseClone(value,isDeep,callback,stackA,stackB){if(callback){var result=callback(value);if(typeof result!="undefined"){return result}}var isObj=isObject(value);if(isObj){var className=toString.call(value);if(!cloneableClasses[className]){return value}var ctor=ctorByClass[className];switch(className){case boolClass:case dateClass:return new ctor(+value);case numberClass:case stringClass:return new ctor(value);case regexpClass:result=ctor(value.source,reFlags.exec(value));result.lastIndex=value.lastIndex;return result}}else{return value}var isArr=isArray(value);if(isDeep){var initedStack=!stackA;stackA||(stackA=getArray());stackB||(stackB=getArray());var length=stackA.length;while(length--){if(stackA[length]==value){return stackB[length]}}result=isArr?ctor(value.length):{}}else{result=isArr?slice(value):assign({},value)}if(isArr){if(hasOwnProperty.call(value,"index")){result.index=value.index}if(hasOwnProperty.call(value,"input")){result.input=value.input}}if(!isDeep){return result}stackA.push(value);stackB.push(result);(isArr?forEach:forOwn)(value,function(objValue,key){result[key]=baseClone(objValue,isDeep,callback,stackA,stackB)});if(initedStack){releaseArray(stackA);releaseArray(stackB)}return result}function baseCreate(prototype,properties){return isObject(prototype)?nativeCreate(prototype):{}}if(!nativeCreate){baseCreate=function(){function Object(){}return function(prototype){if(isObject(prototype)){Object.prototype=prototype;var result=new Object;Object.prototype=null}return result||context.Object()}}()}function baseCreateCallback(func,thisArg,argCount){if(typeof func!="function"){return identity}if(typeof thisArg=="undefined"||!("prototype"in func)){return func}var bindData=func.__bindData__;if(typeof bindData=="undefined"){if(support.funcNames){bindData=!func.name}bindData=bindData||!support.funcDecomp;if(!bindData){var source=fnToString.call(func);if(!support.funcNames){bindData=!reFuncName.test(source)}if(!bindData){bindData=reThis.test(source);setBindData(func,bindData)}}}if(bindData===false||bindData!==true&&bindData[1]&1){return func}switch(argCount){case 1:return function(value){return func.call(thisArg,value)};case 2:return function(a,b){return func.call(thisArg,a,b)};case 3:return function(value,index,collection){return func.call(thisArg,value,index,collection)};case 4:return function(accumulator,value,index,collection){return func.call(thisArg,accumulator,value,index,collection)}}return bind(func,thisArg)}function baseCreateWrapper(bindData){var func=bindData[0],bitmask=bindData[1],partialArgs=bindData[2],partialRightArgs=bindData[3],thisArg=bindData[4],arity=bindData[5];var isBind=bitmask&1,isBindKey=bitmask&2,isCurry=bitmask&4,isCurryBound=bitmask&8,key=func;function bound(){var thisBinding=isBind?thisArg:this;if(partialArgs){var args=slice(partialArgs);push.apply(args,arguments)}if(partialRightArgs||isCurry){args||(args=slice(arguments));if(partialRightArgs){push.apply(args,partialRightArgs)}if(isCurry&&args.length<arity){bitmask|=16&~32;return baseCreateWrapper([func,isCurryBound?bitmask:bitmask&~3,args,null,thisArg,arity])}}args||(args=arguments);if(isBindKey){func=thisBinding[key]}if(this instanceof bound){thisBinding=baseCreate(func.prototype);var result=func.apply(thisBinding,args);return isObject(result)?result:thisBinding}return func.apply(thisBinding,args)}setBindData(bound,bindData);return bound}function baseDifference(array,values){var index=-1,indexOf=getIndexOf(),length=array?array.length:0,isLarge=length>=largeArraySize&&indexOf===baseIndexOf,result=[];if(isLarge){var cache=createCache(values);if(cache){indexOf=cacheIndexOf;values=cache}else{isLarge=false}}while(++index<length){var value=array[index];if(indexOf(values,value)<0){result.push(value)}}if(isLarge){releaseObject(values)}return result}function baseFlatten(array,isShallow,isStrict,fromIndex){var index=(fromIndex||0)-1,length=array?array.length:0,result=[];while(++index<length){var value=array[index];if(value&&typeof value=="object"&&typeof value.length=="number"&&(isArray(value)||isArguments(value))){if(!isShallow){value=baseFlatten(value,isShallow,isStrict)}var valIndex=-1,valLength=value.length,resIndex=result.length;result.length+=valLength;while(++valIndex<valLength){result[resIndex++]=value[valIndex]}}else if(!isStrict){result.push(value)}}return result}function baseIsEqual(a,b,callback,isWhere,stackA,stackB){if(callback){var result=callback(a,b);if(typeof result!="undefined"){return!!result}}if(a===b){return a!==0||1/a==1/b}var type=typeof a,otherType=typeof b;if(a===a&&!(a&&objectTypes[type])&&!(b&&objectTypes[otherType])){return false}if(a==null||b==null){return a===b}var className=toString.call(a),otherClass=toString.call(b);if(className==argsClass){className=objectClass}if(otherClass==argsClass){otherClass=objectClass}if(className!=otherClass){return false}switch(className){case boolClass:case dateClass:return+a==+b;case numberClass:return a!=+a?b!=+b:a==0?1/a==1/b:a==+b;case regexpClass:case stringClass:return a==String(b)}var isArr=className==arrayClass;if(!isArr){var aWrapped=hasOwnProperty.call(a,"__wrapped__"),bWrapped=hasOwnProperty.call(b,"__wrapped__");if(aWrapped||bWrapped){return baseIsEqual(aWrapped?a.__wrapped__:a,bWrapped?b.__wrapped__:b,callback,isWhere,stackA,stackB)}if(className!=objectClass){return false}var ctorA=a.constructor,ctorB=b.constructor;if(ctorA!=ctorB&&!(isFunction(ctorA)&&ctorA instanceof ctorA&&isFunction(ctorB)&&ctorB instanceof ctorB)&&("constructor"in a&&"constructor"in b)){return false}}var initedStack=!stackA;stackA||(stackA=getArray());stackB||(stackB=getArray());var length=stackA.length;while(length--){if(stackA[length]==a){return stackB[length]==b}}var size=0;result=true;stackA.push(a);stackB.push(b);if(isArr){length=a.length;size=b.length;result=size==length;if(result||isWhere){while(size--){var index=length,value=b[size];if(isWhere){while(index--){if(result=baseIsEqual(a[index],value,callback,isWhere,stackA,stackB)){break}}}else if(!(result=baseIsEqual(a[size],value,callback,isWhere,stackA,stackB))){break}}}}else{forIn(b,function(value,key,b){if(hasOwnProperty.call(b,key)){size++;return result=hasOwnProperty.call(a,key)&&baseIsEqual(a[key],value,callback,isWhere,stackA,stackB)}});if(result&&!isWhere){forIn(a,function(value,key,a){if(hasOwnProperty.call(a,key)){return result=--size>-1}})}}stackA.pop();stackB.pop();if(initedStack){releaseArray(stackA);releaseArray(stackB)}return result}function baseMerge(object,source,callback,stackA,stackB){(isArray(source)?forEach:forOwn)(source,function(source,key){var found,isArr,result=source,value=object[key];if(source&&((isArr=isArray(source))||isPlainObject(source))){var stackLength=stackA.length;while(stackLength--){if(found=stackA[stackLength]==source){value=stackB[stackLength];break}}if(!found){var isShallow;if(callback){result=callback(value,source);if(isShallow=typeof result!="undefined"){value=result}}if(!isShallow){value=isArr?isArray(value)?value:[]:isPlainObject(value)?value:{}}stackA.push(source);stackB.push(value);if(!isShallow){baseMerge(value,source,callback,stackA,stackB)}}}else{if(callback){result=callback(value,source);if(typeof result=="undefined"){result=source}}if(typeof result!="undefined"){value=result}}object[key]=value})}function baseRandom(min,max){return min+floor(nativeRandom()*(max-min+1))}function baseUniq(array,isSorted,callback){var index=-1,indexOf=getIndexOf(),length=array?array.length:0,result=[];var isLarge=!isSorted&&length>=largeArraySize&&indexOf===baseIndexOf,seen=callback||isLarge?getArray():result;if(isLarge){var cache=createCache(seen);indexOf=cacheIndexOf;seen=cache}while(++index<length){var value=array[index],computed=callback?callback(value,index,array):value;if(isSorted?!index||seen[seen.length-1]!==computed:indexOf(seen,computed)<0){if(callback||isLarge){seen.push(computed)}result.push(value)}}if(isLarge){releaseArray(seen.array);releaseObject(seen)}else if(callback){releaseArray(seen)}return result}function createAggregator(setter){return function(collection,callback,thisArg){var result={};callback=lodash.createCallback(callback,thisArg,3);var index=-1,length=collection?collection.length:0;if(typeof length=="number"){while(++index<length){var value=collection[index];setter(result,value,callback(value,index,collection),collection)}}else{forOwn(collection,function(value,key,collection){setter(result,value,callback(value,key,collection),collection)})}return result}}function createWrapper(func,bitmask,partialArgs,partialRightArgs,thisArg,arity){var isBind=bitmask&1,isBindKey=bitmask&2,isCurry=bitmask&4,isCurryBound=bitmask&8,isPartial=bitmask&16,isPartialRight=bitmask&32;if(!isBindKey&&!isFunction(func)){throw new TypeError}if(isPartial&&!partialArgs.length){bitmask&=~16;isPartial=partialArgs=false}if(isPartialRight&&!partialRightArgs.length){bitmask&=~32;isPartialRight=partialRightArgs=false}var bindData=func&&func.__bindData__;if(bindData&&bindData!==true){bindData=slice(bindData);if(bindData[2]){bindData[2]=slice(bindData[2])}if(bindData[3]){bindData[3]=slice(bindData[3])}if(isBind&&!(bindData[1]&1)){bindData[4]=thisArg}if(!isBind&&bindData[1]&1){bitmask|=8}if(isCurry&&!(bindData[1]&4)){bindData[5]=arity}if(isPartial){push.apply(bindData[2]||(bindData[2]=[]),partialArgs)}if(isPartialRight){unshift.apply(bindData[3]||(bindData[3]=[]),partialRightArgs)}bindData[1]|=bitmask;return createWrapper.apply(null,bindData)}var creater=bitmask==1||bitmask===17?baseBind:baseCreateWrapper;return creater([func,bitmask,partialArgs,partialRightArgs,thisArg,arity])}function escapeHtmlChar(match){return htmlEscapes[match]}function getIndexOf(){var result=(result=lodash.indexOf)===indexOf?baseIndexOf:result;return result}function isNative(value){return typeof value=="function"&&reNative.test(value)}var setBindData=!defineProperty?noop:function(func,value){descriptor.value=value;defineProperty(func,"__bindData__",descriptor)};function shimIsPlainObject(value){var ctor,result;if(!(value&&toString.call(value)==objectClass)||(ctor=value.constructor,isFunction(ctor)&&!(ctor instanceof ctor))){return false}forIn(value,function(value,key){result=key});return typeof result=="undefined"||hasOwnProperty.call(value,result)}function unescapeHtmlChar(match){return htmlUnescapes[match]}function isArguments(value){return value&&typeof value=="object"&&typeof value.length=="number"&&toString.call(value)==argsClass||false}var isArray=nativeIsArray||function(value){return value&&typeof value=="object"&&typeof value.length=="number"&&toString.call(value)==arrayClass||false};var shimKeys=function(object){var index,iterable=object,result=[];if(!iterable)return result;if(!objectTypes[typeof object])return result;for(index in iterable){if(hasOwnProperty.call(iterable,index)){result.push(index)}}return result};var keys=!nativeKeys?shimKeys:function(object){if(!isObject(object)){return[]}return nativeKeys(object)};var htmlEscapes={"&":"&","<":"<",">":">",'"':""","'":"'"};var htmlUnescapes=invert(htmlEscapes);var reEscapedHtml=RegExp("("+keys(htmlUnescapes).join("|")+")","g"),reUnescapedHtml=RegExp("["+keys(htmlEscapes).join("")+"]","g");var assign=function(object,source,guard){var index,iterable=object,result=iterable;if(!iterable)return result;var args=arguments,argsIndex=0,argsLength=typeof guard=="number"?2:args.length;if(argsLength>3&&typeof args[argsLength-2]=="function"){var callback=baseCreateCallback(args[--argsLength-1],args[argsLength--],2)}else if(argsLength>2&&typeof args[argsLength-1]=="function"){callback=args[--argsLength]}while(++argsIndex<argsLength){iterable=args[argsIndex];if(iterable&&objectTypes[typeof iterable]){var ownIndex=-1,ownProps=objectTypes[typeof iterable]&&keys(iterable),length=ownProps?ownProps.length:0;while(++ownIndex<length){index=ownProps[ownIndex];result[index]=callback?callback(result[index],iterable[index]):iterable[index]}}}return result};function clone(value,isDeep,callback,thisArg){if(typeof isDeep!="boolean"&&isDeep!=null){thisArg=callback;callback=isDeep;isDeep=false}return baseClone(value,isDeep,typeof callback=="function"&&baseCreateCallback(callback,thisArg,1))}function cloneDeep(value,callback,thisArg){return baseClone(value,true,typeof callback=="function"&&baseCreateCallback(callback,thisArg,1))}function create(prototype,properties){var result=baseCreate(prototype);return properties?assign(result,properties):result}var defaults=function(object,source,guard){var index,iterable=object,result=iterable;if(!iterable)return result;var args=arguments,argsIndex=0,argsLength=typeof guard=="number"?2:args.length;while(++argsIndex<argsLength){iterable=args[argsIndex];if(iterable&&objectTypes[typeof iterable]){var ownIndex=-1,ownProps=objectTypes[typeof iterable]&&keys(iterable),length=ownProps?ownProps.length:0;while(++ownIndex<length){index=ownProps[ownIndex];if(typeof result[index]=="undefined")result[index]=iterable[index]}}}return result};function findKey(object,callback,thisArg){var result;callback=lodash.createCallback(callback,thisArg,3);forOwn(object,function(value,key,object){if(callback(value,key,object)){result=key;return false}});return result}function findLastKey(object,callback,thisArg){var result;callback=lodash.createCallback(callback,thisArg,3);forOwnRight(object,function(value,key,object){if(callback(value,key,object)){result=key;return false}});return result}var forIn=function(collection,callback,thisArg){var index,iterable=collection,result=iterable;if(!iterable)return result;if(!objectTypes[typeof iterable])return result;callback=callback&&typeof thisArg=="undefined"?callback:baseCreateCallback(callback,thisArg,3);for(index in iterable){if(callback(iterable[index],index,collection)===false)return result}return result};function forInRight(object,callback,thisArg){var pairs=[];forIn(object,function(value,key){pairs.push(key,value)});var length=pairs.length;callback=baseCreateCallback(callback,thisArg,3);while(length--){if(callback(pairs[length--],pairs[length],object)===false){break
}}return object}var forOwn=function(collection,callback,thisArg){var index,iterable=collection,result=iterable;if(!iterable)return result;if(!objectTypes[typeof iterable])return result;callback=callback&&typeof thisArg=="undefined"?callback:baseCreateCallback(callback,thisArg,3);var ownIndex=-1,ownProps=objectTypes[typeof iterable]&&keys(iterable),length=ownProps?ownProps.length:0;while(++ownIndex<length){index=ownProps[ownIndex];if(callback(iterable[index],index,collection)===false)return result}return result};function forOwnRight(object,callback,thisArg){var props=keys(object),length=props.length;callback=baseCreateCallback(callback,thisArg,3);while(length--){var key=props[length];if(callback(object[key],key,object)===false){break}}return object}function functions(object){var result=[];forIn(object,function(value,key){if(isFunction(value)){result.push(key)}});return result.sort()}function has(object,key){return object?hasOwnProperty.call(object,key):false}function invert(object){var index=-1,props=keys(object),length=props.length,result={};while(++index<length){var key=props[index];result[object[key]]=key}return result}function isBoolean(value){return value===true||value===false||value&&typeof value=="object"&&toString.call(value)==boolClass||false}function isDate(value){return value&&typeof value=="object"&&toString.call(value)==dateClass||false}function isElement(value){return value&&value.nodeType===1||false}function isEmpty(value){var result=true;if(!value){return result}var className=toString.call(value),length=value.length;if(className==arrayClass||className==stringClass||className==argsClass||className==objectClass&&typeof length=="number"&&isFunction(value.splice)){return!length}forOwn(value,function(){return result=false});return result}function isEqual(a,b,callback,thisArg){return baseIsEqual(a,b,typeof callback=="function"&&baseCreateCallback(callback,thisArg,2))}function isFinite(value){return nativeIsFinite(value)&&!nativeIsNaN(parseFloat(value))}function isFunction(value){return typeof value=="function"}function isObject(value){return!!(value&&objectTypes[typeof value])}function isNaN(value){return isNumber(value)&&value!=+value}function isNull(value){return value===null}function isNumber(value){return typeof value=="number"||value&&typeof value=="object"&&toString.call(value)==numberClass||false}var isPlainObject=!getPrototypeOf?shimIsPlainObject:function(value){if(!(value&&toString.call(value)==objectClass)){return false}var valueOf=value.valueOf,objProto=isNative(valueOf)&&(objProto=getPrototypeOf(valueOf))&&getPrototypeOf(objProto);return objProto?value==objProto||getPrototypeOf(value)==objProto:shimIsPlainObject(value)};function isRegExp(value){return value&&typeof value=="object"&&toString.call(value)==regexpClass||false}function isString(value){return typeof value=="string"||value&&typeof value=="object"&&toString.call(value)==stringClass||false}function isUndefined(value){return typeof value=="undefined"}function mapValues(object,callback,thisArg){var result={};callback=lodash.createCallback(callback,thisArg,3);forOwn(object,function(value,key,object){result[key]=callback(value,key,object)});return result}function merge(object){var args=arguments,length=2;if(!isObject(object)){return object}if(typeof args[2]!="number"){length=args.length}if(length>3&&typeof args[length-2]=="function"){var callback=baseCreateCallback(args[--length-1],args[length--],2)}else if(length>2&&typeof args[length-1]=="function"){callback=args[--length]}var sources=slice(arguments,1,length),index=-1,stackA=getArray(),stackB=getArray();while(++index<length){baseMerge(object,sources[index],callback,stackA,stackB)}releaseArray(stackA);releaseArray(stackB);return object}function omit(object,callback,thisArg){var result={};if(typeof callback!="function"){var props=[];forIn(object,function(value,key){props.push(key)});props=baseDifference(props,baseFlatten(arguments,true,false,1));var index=-1,length=props.length;while(++index<length){var key=props[index];result[key]=object[key]}}else{callback=lodash.createCallback(callback,thisArg,3);forIn(object,function(value,key,object){if(!callback(value,key,object)){result[key]=value}})}return result}function pairs(object){var index=-1,props=keys(object),length=props.length,result=Array(length);while(++index<length){var key=props[index];result[index]=[key,object[key]]}return result}function pick(object,callback,thisArg){var result={};if(typeof callback!="function"){var index=-1,props=baseFlatten(arguments,true,false,1),length=isObject(object)?props.length:0;while(++index<length){var key=props[index];if(key in object){result[key]=object[key]}}}else{callback=lodash.createCallback(callback,thisArg,3);forIn(object,function(value,key,object){if(callback(value,key,object)){result[key]=value}})}return result}function transform(object,callback,accumulator,thisArg){var isArr=isArray(object);if(accumulator==null){if(isArr){accumulator=[]}else{var ctor=object&&object.constructor,proto=ctor&&ctor.prototype;accumulator=baseCreate(proto)}}if(callback){callback=lodash.createCallback(callback,thisArg,4);(isArr?forEach:forOwn)(object,function(value,index,object){return callback(accumulator,value,index,object)})}return accumulator}function values(object){var index=-1,props=keys(object),length=props.length,result=Array(length);while(++index<length){result[index]=object[props[index]]}return result}function at(collection){var args=arguments,index=-1,props=baseFlatten(args,true,false,1),length=args[2]&&args[2][args[1]]===collection?1:props.length,result=Array(length);while(++index<length){result[index]=collection[props[index]]}return result}function contains(collection,target,fromIndex){var index=-1,indexOf=getIndexOf(),length=collection?collection.length:0,result=false;fromIndex=(fromIndex<0?nativeMax(0,length+fromIndex):fromIndex)||0;if(isArray(collection)){result=indexOf(collection,target,fromIndex)>-1}else if(typeof length=="number"){result=(isString(collection)?collection.indexOf(target,fromIndex):indexOf(collection,target,fromIndex))>-1}else{forOwn(collection,function(value){if(++index>=fromIndex){return!(result=value===target)}})}return result}var countBy=createAggregator(function(result,value,key){hasOwnProperty.call(result,key)?result[key]++:result[key]=1});function every(collection,callback,thisArg){var result=true;callback=lodash.createCallback(callback,thisArg,3);var index=-1,length=collection?collection.length:0;if(typeof length=="number"){while(++index<length){if(!(result=!!callback(collection[index],index,collection))){break}}}else{forOwn(collection,function(value,index,collection){return result=!!callback(value,index,collection)})}return result}function filter(collection,callback,thisArg){var result=[];callback=lodash.createCallback(callback,thisArg,3);var index=-1,length=collection?collection.length:0;if(typeof length=="number"){while(++index<length){var value=collection[index];if(callback(value,index,collection)){result.push(value)}}}else{forOwn(collection,function(value,index,collection){if(callback(value,index,collection)){result.push(value)}})}return result}function find(collection,callback,thisArg){callback=lodash.createCallback(callback,thisArg,3);var index=-1,length=collection?collection.length:0;if(typeof length=="number"){while(++index<length){var value=collection[index];if(callback(value,index,collection)){return value}}}else{var result;forOwn(collection,function(value,index,collection){if(callback(value,index,collection)){result=value;return false}});return result}}function findLast(collection,callback,thisArg){var result;callback=lodash.createCallback(callback,thisArg,3);forEachRight(collection,function(value,index,collection){if(callback(value,index,collection)){result=value;return false}});return result}function forEach(collection,callback,thisArg){var index=-1,length=collection?collection.length:0;callback=callback&&typeof thisArg=="undefined"?callback:baseCreateCallback(callback,thisArg,3);if(typeof length=="number"){while(++index<length){if(callback(collection[index],index,collection)===false){break}}}else{forOwn(collection,callback)}return collection}function forEachRight(collection,callback,thisArg){var length=collection?collection.length:0;callback=callback&&typeof thisArg=="undefined"?callback:baseCreateCallback(callback,thisArg,3);if(typeof length=="number"){while(length--){if(callback(collection[length],length,collection)===false){break}}}else{var props=keys(collection);length=props.length;forOwn(collection,function(value,key,collection){key=props?props[--length]:--length;return callback(collection[key],key,collection)})}return collection}var groupBy=createAggregator(function(result,value,key){(hasOwnProperty.call(result,key)?result[key]:result[key]=[]).push(value)});var indexBy=createAggregator(function(result,value,key){result[key]=value});function invoke(collection,methodName){var args=slice(arguments,2),index=-1,isFunc=typeof methodName=="function",length=collection?collection.length:0,result=Array(typeof length=="number"?length:0);forEach(collection,function(value){result[++index]=(isFunc?methodName:value[methodName]).apply(value,args)});return result}function map(collection,callback,thisArg){var index=-1,length=collection?collection.length:0;callback=lodash.createCallback(callback,thisArg,3);if(typeof length=="number"){var result=Array(length);while(++index<length){result[index]=callback(collection[index],index,collection)}}else{result=[];forOwn(collection,function(value,key,collection){result[++index]=callback(value,key,collection)})}return result}function max(collection,callback,thisArg){var computed=-Infinity,result=computed;if(typeof callback!="function"&&thisArg&&thisArg[callback]===collection){callback=null}if(callback==null&&isArray(collection)){var index=-1,length=collection.length;while(++index<length){var value=collection[index];if(value>result){result=value}}}else{callback=callback==null&&isString(collection)?charAtCallback:lodash.createCallback(callback,thisArg,3);forEach(collection,function(value,index,collection){var current=callback(value,index,collection);if(current>computed){computed=current;result=value}})}return result}function min(collection,callback,thisArg){var computed=Infinity,result=computed;if(typeof callback!="function"&&thisArg&&thisArg[callback]===collection){callback=null}if(callback==null&&isArray(collection)){var index=-1,length=collection.length;while(++index<length){var value=collection[index];if(value<result){result=value}}}else{callback=callback==null&&isString(collection)?charAtCallback:lodash.createCallback(callback,thisArg,3);forEach(collection,function(value,index,collection){var current=callback(value,index,collection);if(current<computed){computed=current;result=value}})}return result}var pluck=map;function reduce(collection,callback,accumulator,thisArg){if(!collection)return accumulator;var noaccum=arguments.length<3;callback=lodash.createCallback(callback,thisArg,4);var index=-1,length=collection.length;if(typeof length=="number"){if(noaccum){accumulator=collection[++index]}while(++index<length){accumulator=callback(accumulator,collection[index],index,collection)}}else{forOwn(collection,function(value,index,collection){accumulator=noaccum?(noaccum=false,value):callback(accumulator,value,index,collection)})}return accumulator}function reduceRight(collection,callback,accumulator,thisArg){var noaccum=arguments.length<3;callback=lodash.createCallback(callback,thisArg,4);forEachRight(collection,function(value,index,collection){accumulator=noaccum?(noaccum=false,value):callback(accumulator,value,index,collection)});return accumulator}function reject(collection,callback,thisArg){callback=lodash.createCallback(callback,thisArg,3);return filter(collection,function(value,index,collection){return!callback(value,index,collection)})}function sample(collection,n,guard){if(collection&&typeof collection.length!="number"){collection=values(collection)}if(n==null||guard){return collection?collection[baseRandom(0,collection.length-1)]:undefined}var result=shuffle(collection);result.length=nativeMin(nativeMax(0,n),result.length);return result}function shuffle(collection){var index=-1,length=collection?collection.length:0,result=Array(typeof length=="number"?length:0);forEach(collection,function(value){var rand=baseRandom(0,++index);result[index]=result[rand];result[rand]=value});return result}function size(collection){var length=collection?collection.length:0;return typeof length=="number"?length:keys(collection).length}function some(collection,callback,thisArg){var result;callback=lodash.createCallback(callback,thisArg,3);var index=-1,length=collection?collection.length:0;if(typeof length=="number"){while(++index<length){if(result=callback(collection[index],index,collection)){break}}}else{forOwn(collection,function(value,index,collection){return!(result=callback(value,index,collection))})}return!!result}function sortBy(collection,callback,thisArg){var index=-1,isArr=isArray(callback),length=collection?collection.length:0,result=Array(typeof length=="number"?length:0);if(!isArr){callback=lodash.createCallback(callback,thisArg,3)}forEach(collection,function(value,key,collection){var object=result[++index]=getObject();if(isArr){object.criteria=map(callback,function(key){return value[key]})}else{(object.criteria=getArray())[0]=callback(value,key,collection)}object.index=index;object.value=value});length=result.length;result.sort(compareAscending);while(length--){var object=result[length];result[length]=object.value;if(!isArr){releaseArray(object.criteria)}releaseObject(object)}return result}function toArray(collection){if(collection&&typeof collection.length=="number"){return slice(collection)}return values(collection)}var where=filter;function compact(array){var index=-1,length=array?array.length:0,result=[];while(++index<length){var value=array[index];if(value){result.push(value)}}return result}function difference(array){return baseDifference(array,baseFlatten(arguments,true,true,1))}function findIndex(array,callback,thisArg){var index=-1,length=array?array.length:0;callback=lodash.createCallback(callback,thisArg,3);while(++index<length){if(callback(array[index],index,array)){return index}}return-1}function findLastIndex(array,callback,thisArg){var length=array?array.length:0;callback=lodash.createCallback(callback,thisArg,3);while(length--){if(callback(array[length],length,array)){return length}}return-1}function first(array,callback,thisArg){var n=0,length=array?array.length:0;if(typeof callback!="number"&&callback!=null){var index=-1;callback=lodash.createCallback(callback,thisArg,3);while(++index<length&&callback(array[index],index,array)){n++}}else{n=callback;if(n==null||thisArg){return array?array[0]:undefined}}return slice(array,0,nativeMin(nativeMax(0,n),length))}function flatten(array,isShallow,callback,thisArg){if(typeof isShallow!="boolean"&&isShallow!=null){thisArg=callback;callback=typeof isShallow!="function"&&thisArg&&thisArg[isShallow]===array?null:isShallow;isShallow=false}if(callback!=null){array=map(array,callback,thisArg)}return baseFlatten(array,isShallow)}function indexOf(array,value,fromIndex){if(typeof fromIndex=="number"){var length=array?array.length:0;fromIndex=fromIndex<0?nativeMax(0,length+fromIndex):fromIndex||0}else if(fromIndex){var index=sortedIndex(array,value);return array[index]===value?index:-1}return baseIndexOf(array,value,fromIndex)}function initial(array,callback,thisArg){var n=0,length=array?array.length:0;if(typeof callback!="number"&&callback!=null){var index=length;callback=lodash.createCallback(callback,thisArg,3);while(index--&&callback(array[index],index,array)){n++}}else{n=callback==null||thisArg?1:callback||n}return slice(array,0,nativeMin(nativeMax(0,length-n),length))}function intersection(){var args=[],argsIndex=-1,argsLength=arguments.length,caches=getArray(),indexOf=getIndexOf(),trustIndexOf=indexOf===baseIndexOf,seen=getArray();while(++argsIndex<argsLength){var value=arguments[argsIndex];if(isArray(value)||isArguments(value)){args.push(value);caches.push(trustIndexOf&&value.length>=largeArraySize&&createCache(argsIndex?args[argsIndex]:seen))}}var array=args[0],index=-1,length=array?array.length:0,result=[];outer:while(++index<length){var cache=caches[0];value=array[index];if((cache?cacheIndexOf(cache,value):indexOf(seen,value))<0){argsIndex=argsLength;(cache||seen).push(value);while(--argsIndex){cache=caches[argsIndex];if((cache?cacheIndexOf(cache,value):indexOf(args[argsIndex],value))<0){continue outer}}result.push(value)}}while(argsLength--){cache=caches[argsLength];if(cache){releaseObject(cache)}}releaseArray(caches);releaseArray(seen);return result}function last(array,callback,thisArg){var n=0,length=array?array.length:0;if(typeof callback!="number"&&callback!=null){var index=length;callback=lodash.createCallback(callback,thisArg,3);while(index--&&callback(array[index],index,array)){n++}}else{n=callback;if(n==null||thisArg){return array?array[length-1]:undefined}}return slice(array,nativeMax(0,length-n))}function lastIndexOf(array,value,fromIndex){var index=array?array.length:0;if(typeof fromIndex=="number"){index=(fromIndex<0?nativeMax(0,index+fromIndex):nativeMin(fromIndex,index-1))+1}while(index--){if(array[index]===value){return index}}return-1}function pull(array){var args=arguments,argsIndex=0,argsLength=args.length,length=array?array.length:0;while(++argsIndex<argsLength){var index=-1,value=args[argsIndex];while(++index<length){if(array[index]===value){splice.call(array,index--,1);length--}}}return array}function range(start,end,step){start=+start||0;step=typeof step=="number"?step:+step||1;if(end==null){end=start;start=0}var index=-1,length=nativeMax(0,ceil((end-start)/(step||1))),result=Array(length);while(++index<length){result[index]=start;start+=step}return result}function remove(array,callback,thisArg){var index=-1,length=array?array.length:0,result=[];callback=lodash.createCallback(callback,thisArg,3);while(++index<length){var value=array[index];if(callback(value,index,array)){result.push(value);splice.call(array,index--,1);length--}}return result}function rest(array,callback,thisArg){if(typeof callback!="number"&&callback!=null){var n=0,index=-1,length=array?array.length:0;callback=lodash.createCallback(callback,thisArg,3);while(++index<length&&callback(array[index],index,array)){n++}}else{n=callback==null||thisArg?1:nativeMax(0,callback)}return slice(array,n)}function sortedIndex(array,value,callback,thisArg){var low=0,high=array?array.length:low;callback=callback?lodash.createCallback(callback,thisArg,1):identity;value=callback(value);while(low<high){var mid=low+high>>>1;callback(array[mid])<value?low=mid+1:high=mid}return low}function union(){return baseUniq(baseFlatten(arguments,true,true))}function uniq(array,isSorted,callback,thisArg){if(typeof isSorted!="boolean"&&isSorted!=null){thisArg=callback;callback=typeof isSorted!="function"&&thisArg&&thisArg[isSorted]===array?null:isSorted;isSorted=false}if(callback!=null){callback=lodash.createCallback(callback,thisArg,3)}return baseUniq(array,isSorted,callback)}function without(array){return baseDifference(array,slice(arguments,1))}function xor(){var index=-1,length=arguments.length;while(++index<length){var array=arguments[index];if(isArray(array)||isArguments(array)){var result=result?baseUniq(baseDifference(result,array).concat(baseDifference(array,result))):array}}return result||[]}function zip(){var array=arguments.length>1?arguments:arguments[0],index=-1,length=array?max(pluck(array,"length")):0,result=Array(length<0?0:length);while(++index<length){result[index]=pluck(array,index)}return result}function zipObject(keys,values){var index=-1,length=keys?keys.length:0,result={};if(!values&&length&&!isArray(keys[0])){values=[]}while(++index<length){var key=keys[index];if(values){result[key]=values[index]}else if(key){result[key[0]]=key[1]}}return result}function after(n,func){if(!isFunction(func)){throw new TypeError}return function(){if(--n<1){return func.apply(this,arguments)}}}function bind(func,thisArg){return arguments.length>2?createWrapper(func,17,slice(arguments,2),null,thisArg):createWrapper(func,1,null,null,thisArg)}function bindAll(object){var funcs=arguments.length>1?baseFlatten(arguments,true,false,1):functions(object),index=-1,length=funcs.length;while(++index<length){var key=funcs[index];object[key]=createWrapper(object[key],1,null,null,object)}return object}function bindKey(object,key){return arguments.length>2?createWrapper(key,19,slice(arguments,2),null,object):createWrapper(key,3,null,null,object)}function compose(){var funcs=arguments,length=funcs.length;while(length--){if(!isFunction(funcs[length])){throw new TypeError}}return function(){var args=arguments,length=funcs.length;while(length--){args=[funcs[length].apply(this,args)]}return args[0]}}function curry(func,arity){arity=typeof arity=="number"?arity:+arity||func.length;return createWrapper(func,4,null,null,null,arity)}function debounce(func,wait,options){var args,maxTimeoutId,result,stamp,thisArg,timeoutId,trailingCall,lastCalled=0,maxWait=false,trailing=true;if(!isFunction(func)){throw new TypeError}wait=nativeMax(0,wait)||0;if(options===true){var leading=true;trailing=false}else if(isObject(options)){leading=options.leading;maxWait="maxWait"in options&&(nativeMax(wait,options.maxWait)||0);trailing="trailing"in options?options.trailing:trailing}var delayed=function(){var remaining=wait-(now()-stamp);if(remaining<=0){if(maxTimeoutId){clearTimeout(maxTimeoutId)}var isCalled=trailingCall;maxTimeoutId=timeoutId=trailingCall=undefined;if(isCalled){lastCalled=now();result=func.apply(thisArg,args);if(!timeoutId&&!maxTimeoutId){args=thisArg=null}}}else{timeoutId=setTimeout(delayed,remaining)}};var maxDelayed=function(){if(timeoutId){clearTimeout(timeoutId)}maxTimeoutId=timeoutId=trailingCall=undefined;if(trailing||maxWait!==wait){lastCalled=now();result=func.apply(thisArg,args);if(!timeoutId&&!maxTimeoutId){args=thisArg=null}}};return function(){args=arguments;stamp=now();thisArg=this;trailingCall=trailing&&(timeoutId||!leading);if(maxWait===false){var leadingCall=leading&&!timeoutId}else{if(!maxTimeoutId&&!leading){lastCalled=stamp}var remaining=maxWait-(stamp-lastCalled),isCalled=remaining<=0;if(isCalled){if(maxTimeoutId){maxTimeoutId=clearTimeout(maxTimeoutId)}lastCalled=stamp;result=func.apply(thisArg,args)}else if(!maxTimeoutId){maxTimeoutId=setTimeout(maxDelayed,remaining)}}if(isCalled&&timeoutId){timeoutId=clearTimeout(timeoutId)}else if(!timeoutId&&wait!==maxWait){timeoutId=setTimeout(delayed,wait)}if(leadingCall){isCalled=true;result=func.apply(thisArg,args)}if(isCalled&&!timeoutId&&!maxTimeoutId){args=thisArg=null}return result}}function defer(func){if(!isFunction(func)){throw new TypeError}var args=slice(arguments,1);return setTimeout(function(){func.apply(undefined,args)},1)}function delay(func,wait){if(!isFunction(func)){throw new TypeError}var args=slice(arguments,2);return setTimeout(function(){func.apply(undefined,args)},wait)}function memoize(func,resolver){if(!isFunction(func)){throw new TypeError}var memoized=function(){var cache=memoized.cache,key=resolver?resolver.apply(this,arguments):keyPrefix+arguments[0];return hasOwnProperty.call(cache,key)?cache[key]:cache[key]=func.apply(this,arguments)};memoized.cache={};return memoized}function once(func){var ran,result;if(!isFunction(func)){throw new TypeError}return function(){if(ran){return result}ran=true;result=func.apply(this,arguments);func=null;return result}}function partial(func){return createWrapper(func,16,slice(arguments,1))}function partialRight(func){return createWrapper(func,32,null,slice(arguments,1))}function throttle(func,wait,options){var leading=true,trailing=true;if(!isFunction(func)){throw new TypeError}if(options===false){leading=false}else if(isObject(options)){leading="leading"in options?options.leading:leading;trailing="trailing"in options?options.trailing:trailing}debounceOptions.leading=leading;debounceOptions.maxWait=wait;debounceOptions.trailing=trailing;return debounce(func,wait,debounceOptions)}function wrap(value,wrapper){return createWrapper(wrapper,16,[value])}function constant(value){return function(){return value}}function createCallback(func,thisArg,argCount){var type=typeof func;if(func==null||type=="function"){return baseCreateCallback(func,thisArg,argCount)}if(type!="object"){return property(func)}var props=keys(func),key=props[0],a=func[key];if(props.length==1&&a===a&&!isObject(a)){return function(object){var b=object[key];return a===b&&(a!==0||1/a==1/b)}}return function(object){var length=props.length,result=false;while(length--){if(!(result=baseIsEqual(object[props[length]],func[props[length]],null,true))){break}}return result}}function escape(string){return string==null?"":String(string).replace(reUnescapedHtml,escapeHtmlChar)}function identity(value){return value}function mixin(object,source,options){var chain=true,methodNames=source&&functions(source);if(!source||!options&&!methodNames.length){if(options==null){options=source}ctor=lodashWrapper;source=object;object=lodash;methodNames=functions(source)}if(options===false){chain=false}else if(isObject(options)&&"chain"in options){chain=options.chain}var ctor=object,isFunc=isFunction(ctor);forEach(methodNames,function(methodName){var func=object[methodName]=source[methodName];if(isFunc){ctor.prototype[methodName]=function(){var chainAll=this.__chain__,value=this.__wrapped__,args=[value];push.apply(args,arguments);var result=func.apply(object,args);if(chain||chainAll){if(value===result&&isObject(result)){return this}result=new ctor(result);result.__chain__=chainAll}return result}}})}function noConflict(){context._=oldDash;return this}function noop(){}var now=isNative(now=Date.now)&&now||function(){return(new Date).getTime()};var parseInt=nativeParseInt(whitespace+"08")==8?nativeParseInt:function(value,radix){return nativeParseInt(isString(value)?value.replace(reLeadingSpacesAndZeros,""):value,radix||0)};function property(key){return function(object){return object[key]}}function random(min,max,floating){var noMin=min==null,noMax=max==null;if(floating==null){if(typeof min=="boolean"&&noMax){floating=min;min=1}else if(!noMax&&typeof max=="boolean"){floating=max;noMax=true}}if(noMin&&noMax){max=1}min=+min||0;if(noMax){max=min;min=0}else{max=+max||0}if(floating||min%1||max%1){var rand=nativeRandom();return nativeMin(min+rand*(max-min+parseFloat("1e-"+((rand+"").length-1))),max)}return baseRandom(min,max)}function result(object,key){if(object){var value=object[key];return isFunction(value)?object[key]():value}}function template(text,data,options){var settings=lodash.templateSettings;text=String(text||"");options=defaults({},options,settings);var imports=defaults({},options.imports,settings.imports),importsKeys=keys(imports),importsValues=values(imports);var isEvaluating,index=0,interpolate=options.interpolate||reNoMatch,source="__p += '";var reDelimiters=RegExp((options.escape||reNoMatch).source+"|"+interpolate.source+"|"+(interpolate===reInterpolate?reEsTemplate:reNoMatch).source+"|"+(options.evaluate||reNoMatch).source+"|$","g");text.replace(reDelimiters,function(match,escapeValue,interpolateValue,esTemplateValue,evaluateValue,offset){interpolateValue||(interpolateValue=esTemplateValue);source+=text.slice(index,offset).replace(reUnescapedString,escapeStringChar);if(escapeValue){source+="' +\n__e("+escapeValue+") +\n'"}if(evaluateValue){isEvaluating=true;source+="';\n"+evaluateValue+";\n__p += '"}if(interpolateValue){source+="' +\n((__t = ("+interpolateValue+")) == null ? '' : __t) +\n'"}index=offset+match.length;return match});source+="';\n";var variable=options.variable,hasVariable=variable;if(!hasVariable){variable="obj";source="with ("+variable+") {\n"+source+"\n}\n"}source=(isEvaluating?source.replace(reEmptyStringLeading,""):source).replace(reEmptyStringMiddle,"$1").replace(reEmptyStringTrailing,"$1;");source="function("+variable+") {\n"+(hasVariable?"":variable+" || ("+variable+" = {});\n")+"var __t, __p = '', __e = _.escape"+(isEvaluating?", __j = Array.prototype.join;\n"+"function print() { __p += __j.call(arguments, '') }\n":";\n")+source+"return __p\n}";var sourceURL="\n/*\n//# sourceURL="+(options.sourceURL||"/lodash/template/source["+templateCounter++ +"]")+"\n*/";try{var result=Function(importsKeys,"return "+source+sourceURL).apply(undefined,importsValues)}catch(e){e.source=source;throw e}if(data){return result(data)}result.source=source;return result}function times(n,callback,thisArg){n=(n=+n)>-1?n:0;var index=-1,result=Array(n);callback=baseCreateCallback(callback,thisArg,1);while(++index<n){result[index]=callback(index)}return result}function unescape(string){return string==null?"":String(string).replace(reEscapedHtml,unescapeHtmlChar)}function uniqueId(prefix){var id=++idCounter;return String(prefix==null?"":prefix)+id}function chain(value){value=new lodashWrapper(value);value.__chain__=true;return value}function tap(value,interceptor){interceptor(value);return value}function wrapperChain(){this.__chain__=true;return this}function wrapperToString(){return String(this.__wrapped__)}function wrapperValueOf(){return this.__wrapped__}lodash.after=after;lodash.assign=assign;lodash.at=at;lodash.bind=bind;lodash.bindAll=bindAll;lodash.bindKey=bindKey;lodash.chain=chain;lodash.compact=compact;lodash.compose=compose;lodash.constant=constant;lodash.countBy=countBy;lodash.create=create;lodash.createCallback=createCallback;lodash.curry=curry;lodash.debounce=debounce;lodash.defaults=defaults;lodash.defer=defer;lodash.delay=delay;lodash.difference=difference;lodash.filter=filter;lodash.flatten=flatten;lodash.forEach=forEach;lodash.forEachRight=forEachRight;lodash.forIn=forIn;lodash.forInRight=forInRight;lodash.forOwn=forOwn;lodash.forOwnRight=forOwnRight;lodash.functions=functions;lodash.groupBy=groupBy;lodash.indexBy=indexBy;lodash.initial=initial;lodash.intersection=intersection;lodash.invert=invert;lodash.invoke=invoke;lodash.keys=keys;lodash.map=map;lodash.mapValues=mapValues;lodash.max=max;lodash.memoize=memoize;lodash.merge=merge;lodash.min=min;lodash.omit=omit;lodash.once=once;lodash.pairs=pairs;lodash.partial=partial;lodash.partialRight=partialRight;lodash.pick=pick;lodash.pluck=pluck;lodash.property=property;lodash.pull=pull;lodash.range=range;lodash.reject=reject;lodash.remove=remove;lodash.rest=rest;lodash.shuffle=shuffle;lodash.sortBy=sortBy;lodash.tap=tap;lodash.throttle=throttle;lodash.times=times;lodash.toArray=toArray;lodash.transform=transform;lodash.union=union;lodash.uniq=uniq;lodash.values=values;lodash.where=where;lodash.without=without;lodash.wrap=wrap;lodash.xor=xor;lodash.zip=zip;lodash.zipObject=zipObject;lodash.collect=map;lodash.drop=rest;lodash.each=forEach;lodash.eachRight=forEachRight;lodash.extend=assign;lodash.methods=functions;lodash.object=zipObject;lodash.select=filter;lodash.tail=rest;lodash.unique=uniq;lodash.unzip=zip;mixin(lodash);lodash.clone=clone;lodash.cloneDeep=cloneDeep;lodash.contains=contains;lodash.escape=escape;lodash.every=every;lodash.find=find;lodash.findIndex=findIndex;lodash.findKey=findKey;lodash.findLast=findLast;lodash.findLastIndex=findLastIndex;lodash.findLastKey=findLastKey;lodash.has=has;lodash.identity=identity;lodash.indexOf=indexOf;lodash.isArguments=isArguments;lodash.isArray=isArray;lodash.isBoolean=isBoolean;lodash.isDate=isDate;lodash.isElement=isElement;lodash.isEmpty=isEmpty;lodash.isEqual=isEqual;lodash.isFinite=isFinite;lodash.isFunction=isFunction;lodash.isNaN=isNaN;lodash.isNull=isNull;lodash.isNumber=isNumber;lodash.isObject=isObject;lodash.isPlainObject=isPlainObject;lodash.isRegExp=isRegExp;lodash.isString=isString;lodash.isUndefined=isUndefined;lodash.lastIndexOf=lastIndexOf;lodash.mixin=mixin;lodash.noConflict=noConflict;lodash.noop=noop;lodash.now=now;lodash.parseInt=parseInt;lodash.random=random;lodash.reduce=reduce;lodash.reduceRight=reduceRight;lodash.result=result;lodash.runInContext=runInContext;
lodash.size=size;lodash.some=some;lodash.sortedIndex=sortedIndex;lodash.template=template;lodash.unescape=unescape;lodash.uniqueId=uniqueId;lodash.all=every;lodash.any=some;lodash.detect=find;lodash.findWhere=find;lodash.foldl=reduce;lodash.foldr=reduceRight;lodash.include=contains;lodash.inject=reduce;mixin(function(){var source={};forOwn(lodash,function(func,methodName){if(!lodash.prototype[methodName]){source[methodName]=func}});return source}(),false);lodash.first=first;lodash.last=last;lodash.sample=sample;lodash.take=first;lodash.head=first;forOwn(lodash,function(func,methodName){var callbackable=methodName!=="sample";if(!lodash.prototype[methodName]){lodash.prototype[methodName]=function(n,guard){var chainAll=this.__chain__,result=func(this.__wrapped__,n,guard);return!chainAll&&(n==null||guard&&!(callbackable&&typeof n=="function"))?result:new lodashWrapper(result,chainAll)}}});lodash.VERSION="2.4.1";lodash.prototype.chain=wrapperChain;lodash.prototype.toString=wrapperToString;lodash.prototype.value=wrapperValueOf;lodash.prototype.valueOf=wrapperValueOf;forEach(["join","pop","shift"],function(methodName){var func=arrayRef[methodName];lodash.prototype[methodName]=function(){var chainAll=this.__chain__,result=func.apply(this.__wrapped__,arguments);return chainAll?new lodashWrapper(result,chainAll):result}});forEach(["push","reverse","sort","unshift"],function(methodName){var func=arrayRef[methodName];lodash.prototype[methodName]=function(){func.apply(this.__wrapped__,arguments);return this}});forEach(["concat","slice","splice"],function(methodName){var func=arrayRef[methodName];lodash.prototype[methodName]=function(){return new lodashWrapper(func.apply(this.__wrapped__,arguments),this.__chain__)}});return lodash}var _=runInContext();if(typeof define=="function"&&typeof define.amd=="object"&&define.amd){root._=_;define(function(){return _})}else if(freeExports&&freeModule){if(moduleExports){(freeModule.exports=_)._=_}else{freeExports._=_}}else{root._=_}}).call(this)}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],109:[function(require,module,exports){"use strict";var originalObject=Object;var originalDefProp=Object.defineProperty;var originalCreate=Object.create;function defProp(obj,name,value){if(originalDefProp)try{originalDefProp.call(originalObject,obj,name,{value:value})}catch(definePropertyIsBrokenInIE8){obj[name]=value}else{obj[name]=value}}function makeSafeToCall(fun){if(fun){defProp(fun,"call",fun.call);defProp(fun,"apply",fun.apply)}return fun}makeSafeToCall(originalDefProp);makeSafeToCall(originalCreate);var hasOwn=makeSafeToCall(Object.prototype.hasOwnProperty);var numToStr=makeSafeToCall(Number.prototype.toString);var strSlice=makeSafeToCall(String.prototype.slice);var cloner=function(){};function create(prototype){if(originalCreate){return originalCreate.call(originalObject,prototype)}cloner.prototype=prototype||null;return new cloner}var rand=Math.random;var uniqueKeys=create(null);function makeUniqueKey(){do var uniqueKey=internString(strSlice.call(numToStr.call(rand(),36),2));while(hasOwn.call(uniqueKeys,uniqueKey));return uniqueKeys[uniqueKey]=uniqueKey}function internString(str){var obj={};obj[str]=true;return Object.keys(obj)[0]}defProp(exports,"makeUniqueKey",makeUniqueKey);var originalGetOPNs=Object.getOwnPropertyNames;Object.getOwnPropertyNames=function getOwnPropertyNames(object){for(var names=originalGetOPNs(object),src=0,dst=0,len=names.length;src<len;++src){if(!hasOwn.call(uniqueKeys,names[src])){if(src>dst){names[dst]=names[src]}++dst}}names.length=dst;return names};function defaultCreatorFn(object){return create(null)}function makeAccessor(secretCreatorFn){var brand=makeUniqueKey();var passkey=create(null);secretCreatorFn=secretCreatorFn||defaultCreatorFn;function register(object){var secret;function vault(key,forget){if(key===passkey){return forget?secret=null:secret||(secret=secretCreatorFn(object))}}defProp(object,brand,vault)}function accessor(object){if(!hasOwn.call(object,brand))register(object);return object[brand](passkey)}accessor.forget=function(object){if(hasOwn.call(object,brand))object[brand](passkey,true)};return accessor}defProp(exports,"makeAccessor",makeAccessor)},{}],110:[function(require,module,exports){var regenerate=require("regenerate");exports.REGULAR={d:regenerate().addRange(48,57),D:regenerate().addRange(0,47).addRange(58,65535),s:regenerate(32,160,5760,6158,8239,8287,12288,65279).addRange(9,13).addRange(8192,8202).addRange(8232,8233),S:regenerate().addRange(0,8).addRange(14,31).addRange(33,159).addRange(161,5759).addRange(5761,6157).addRange(6159,8191).addRange(8203,8231).addRange(8234,8238).addRange(8240,8286).addRange(8288,12287).addRange(12289,65278).addRange(65280,65535),w:regenerate(95).addRange(48,57).addRange(65,90).addRange(97,122),W:regenerate(96).addRange(0,47).addRange(58,64).addRange(91,94).addRange(123,65535)};exports.UNICODE={d:regenerate().addRange(48,57),D:regenerate().addRange(0,47).addRange(58,1114111),s:regenerate(32,160,5760,6158,8239,8287,12288,65279).addRange(9,13).addRange(8192,8202).addRange(8232,8233),S:regenerate().addRange(0,8).addRange(14,31).addRange(33,159).addRange(161,5759).addRange(5761,6157).addRange(6159,8191).addRange(8203,8231).addRange(8234,8238).addRange(8240,8286).addRange(8288,12287).addRange(12289,65278).addRange(65280,1114111),w:regenerate(95).addRange(48,57).addRange(65,90).addRange(97,122),W:regenerate(96).addRange(0,47).addRange(58,64).addRange(91,94).addRange(123,1114111)};exports.UNICODE_IGNORE_CASE={d:regenerate().addRange(48,57),D:regenerate().addRange(0,47).addRange(58,1114111),s:regenerate(32,160,5760,6158,8239,8287,12288,65279).addRange(9,13).addRange(8192,8202).addRange(8232,8233),S:regenerate().addRange(0,8).addRange(14,31).addRange(33,159).addRange(161,5759).addRange(5761,6157).addRange(6159,8191).addRange(8203,8231).addRange(8234,8238).addRange(8240,8286).addRange(8288,12287).addRange(12289,65278).addRange(65280,1114111),w:regenerate(95,383,8490).addRange(48,57).addRange(65,90).addRange(97,122),W:regenerate(75,83,96).addRange(0,47).addRange(58,64).addRange(91,94).addRange(123,1114111)}},{regenerate:112}],111:[function(require,module,exports){module.exports={75:8490,83:383,107:8490,115:383,181:924,197:8491,383:83,452:453,453:452,455:456,456:455,458:459,459:458,497:498,498:497,837:8126,914:976,917:1013,920:1012,921:8126,922:1008,924:181,928:982,929:1009,931:962,934:981,937:8486,962:931,976:914,977:1012,981:934,982:928,1008:922,1009:929,1012:[920,977],1013:917,7776:7835,7835:7776,8126:[837,921],8486:937,8490:75,8491:197,66560:66600,66561:66601,66562:66602,66563:66603,66564:66604,66565:66605,66566:66606,66567:66607,66568:66608,66569:66609,66570:66610,66571:66611,66572:66612,66573:66613,66574:66614,66575:66615,66576:66616,66577:66617,66578:66618,66579:66619,66580:66620,66581:66621,66582:66622,66583:66623,66584:66624,66585:66625,66586:66626,66587:66627,66588:66628,66589:66629,66590:66630,66591:66631,66592:66632,66593:66633,66594:66634,66595:66635,66596:66636,66597:66637,66598:66638,66599:66639,66600:66560,66601:66561,66602:66562,66603:66563,66604:66564,66605:66565,66606:66566,66607:66567,66608:66568,66609:66569,66610:66570,66611:66571,66612:66572,66613:66573,66614:66574,66615:66575,66616:66576,66617:66577,66618:66578,66619:66579,66620:66580,66621:66581,66622:66582,66623:66583,66624:66584,66625:66585,66626:66586,66627:66587,66628:66588,66629:66589,66630:66590,66631:66591,66632:66592,66633:66593,66634:66594,66635:66595,66636:66596,66637:66597,66638:66598,66639:66599,71840:71872,71841:71873,71842:71874,71843:71875,71844:71876,71845:71877,71846:71878,71847:71879,71848:71880,71849:71881,71850:71882,71851:71883,71852:71884,71853:71885,71854:71886,71855:71887,71856:71888,71857:71889,71858:71890,71859:71891,71860:71892,71861:71893,71862:71894,71863:71895,71864:71896,71865:71897,71866:71898,71867:71899,71868:71900,71869:71901,71870:71902,71871:71903,71872:71840,71873:71841,71874:71842,71875:71843,71876:71844,71877:71845,71878:71846,71879:71847,71880:71848,71881:71849,71882:71850,71883:71851,71884:71852,71885:71853,71886:71854,71887:71855,71888:71856,71889:71857,71890:71858,71891:71859,71892:71860,71893:71861,71894:71862,71895:71863,71896:71864,71897:71865,71898:71866,71899:71867,71900:71868,71901:71869,71902:71870,71903:71871}},{}],112:[function(require,module,exports){(function(global){(function(root){var freeExports=typeof exports=="object"&&exports;var freeModule=typeof module=="object"&&module&&module.exports==freeExports&&module;var freeGlobal=typeof global=="object"&&global;if(freeGlobal.global===freeGlobal||freeGlobal.window===freeGlobal){root=freeGlobal}var ERRORS={rangeOrder:"A range’s `stop` value must be greater than or equal "+"to the `start` value.",codePointRange:"Invalid code point value. Code points range from "+"U+000000 to U+10FFFF."};var HIGH_SURROGATE_MIN=55296;var HIGH_SURROGATE_MAX=56319;var LOW_SURROGATE_MIN=56320;var LOW_SURROGATE_MAX=57343;var regexNull=/\\x00([^0123456789]|$)/g;var object={};var hasOwnProperty=object.hasOwnProperty;var extend=function(destination,source){var key;for(key in source){if(hasOwnProperty.call(source,key)){destination[key]=source[key]}}return destination};var forEach=function(array,callback){var index=-1;var length=array.length;while(++index<length){callback(array[index],index)}};var toString=object.toString;var isArray=function(value){return toString.call(value)=="[object Array]"};var isNumber=function(value){return typeof value=="number"||toString.call(value)=="[object Number]"};var zeroes="0000";var pad=function(number,totalCharacters){var string=String(number);return string.length<totalCharacters?(zeroes+string).slice(-totalCharacters):string};var hex=function(number){return Number(number).toString(16).toUpperCase()};var slice=[].slice;var dataFromCodePoints=function(codePoints){var index=-1;var length=codePoints.length;var max=length-1;var result=[];var isStart=true;var tmp;var previous=0;while(++index<length){tmp=codePoints[index];if(isStart){result.push(tmp);previous=tmp;isStart=false}else{if(tmp==previous+1){if(index!=max){previous=tmp;continue}else{isStart=true;result.push(tmp+1)}}else{result.push(previous+1,tmp);previous=tmp}}}if(!isStart){result.push(tmp+1)}return result};var dataRemove=function(data,codePoint){var index=0;var start;var end;var length=data.length;while(index<length){start=data[index];end=data[index+1];if(codePoint>=start&&codePoint<end){if(codePoint==start){if(end==start+1){data.splice(index,2);return data}else{data[index]=codePoint+1;return data}}else if(codePoint==end-1){data[index+1]=codePoint;return data}else{data.splice(index,2,start,codePoint,codePoint+1,end);return data}}index+=2}return data};var dataRemoveRange=function(data,rangeStart,rangeEnd){if(rangeEnd<rangeStart){throw Error(ERRORS.rangeOrder)}var index=0;var start;var end;while(index<data.length){start=data[index];end=data[index+1]-1;if(start>rangeEnd){return data}if(rangeStart<=start&&rangeEnd>=end){data.splice(index,2);continue}if(rangeStart>=start&&rangeEnd<end){if(rangeStart==start){data[index]=rangeEnd+1;data[index+1]=end+1;return data}data.splice(index,2,start,rangeStart,rangeEnd+1,end+1);return data}if(rangeStart>=start&&rangeStart<=end){data[index+1]=rangeStart}else if(rangeEnd>=start&&rangeEnd<=end){data[index]=rangeEnd+1;return data}index+=2}return data};var dataAdd=function(data,codePoint){var index=0;var start;var end;var lastIndex=null;var length=data.length;if(codePoint<0||codePoint>1114111){throw RangeError(ERRORS.codePointRange)}while(index<length){start=data[index];end=data[index+1];if(codePoint>=start&&codePoint<end){return data}if(codePoint==start-1){data[index]=codePoint;return data}if(start>codePoint){data.splice(lastIndex!=null?lastIndex+2:0,0,codePoint,codePoint+1);return data}if(codePoint==end){if(codePoint+1==data[index+2]){data.splice(index,4,start,data[index+3]);return data}data[index+1]=codePoint+1;return data}lastIndex=index;index+=2}data.push(codePoint,codePoint+1);return data};var dataAddData=function(dataA,dataB){var index=0;var start;var end;var data=dataA.slice();var length=dataB.length;while(index<length){start=dataB[index];end=dataB[index+1]-1;if(start==end){data=dataAdd(data,start)}else{data=dataAddRange(data,start,end)}index+=2}return data};var dataRemoveData=function(dataA,dataB){var index=0;var start;var end;var data=dataA.slice();var length=dataB.length;while(index<length){start=dataB[index];end=dataB[index+1]-1;if(start==end){data=dataRemove(data,start)}else{data=dataRemoveRange(data,start,end)}index+=2}return data};var dataAddRange=function(data,rangeStart,rangeEnd){if(rangeEnd<rangeStart){throw Error(ERRORS.rangeOrder)}if(rangeStart<0||rangeStart>1114111||rangeEnd<0||rangeEnd>1114111){throw RangeError(ERRORS.codePointRange)}var index=0;var start;var end;var added=false;var length=data.length;while(index<length){start=data[index];end=data[index+1];if(added){if(start==rangeEnd+1){data.splice(index-1,2);return data}if(start>rangeEnd){return data}if(start>=rangeStart&&start<=rangeEnd){if(end>rangeStart&&end-1<=rangeEnd){data.splice(index,2);index-=2}else{data.splice(index-1,2);index-=2}}}else if(start==rangeEnd+1){data[index]=rangeStart;return data}else if(start>rangeEnd){data.splice(index,0,rangeStart,rangeEnd+1);return data}else if(rangeStart>=start&&rangeStart<end&&rangeEnd+1<=end){return data}else if(rangeStart>=start&&rangeStart<end||end==rangeStart){data[index+1]=rangeEnd+1;added=true}else if(rangeStart<=start&&rangeEnd+1>=end){data[index]=rangeStart;data[index+1]=rangeEnd+1;added=true}index+=2}if(!added){data.push(rangeStart,rangeEnd+1)}return data};var dataContains=function(data,codePoint){var index=0;var start;var end;var length=data.length;while(index<length){start=data[index];end=data[index+1];if(codePoint>=start&&codePoint<end){return true}index+=2}return false};var dataIntersection=function(data,codePoints){var index=0;var length=codePoints.length;var codePoint;var result=[];while(index<length){codePoint=codePoints[index];if(dataContains(data,codePoint)){result.push(codePoint)}++index}return dataFromCodePoints(result)};var dataIsEmpty=function(data){return!data.length};var dataIsSingleton=function(data){return data.length==2&&data[0]+1==data[1]};var dataToArray=function(data){var index=0;var start;var end;var result=[];var length=data.length;while(index<length){start=data[index];end=data[index+1];while(start<end){result.push(start);++start}index+=2}return result};var floor=Math.floor;var highSurrogate=function(codePoint){return parseInt(floor((codePoint-65536)/1024)+HIGH_SURROGATE_MIN,10)};var lowSurrogate=function(codePoint){return parseInt((codePoint-65536)%1024+LOW_SURROGATE_MIN,10)};var stringFromCharCode=String.fromCharCode;var codePointToString=function(codePoint){var string;if(codePoint==9){string="\\t"}else if(codePoint==10){string="\\n"}else if(codePoint==12){string="\\f"}else if(codePoint==13){string="\\r"}else if(codePoint==92){string="\\\\"}else if(codePoint==36||codePoint>=40&&codePoint<=43||codePoint==45||codePoint==46||codePoint==63||codePoint>=91&&codePoint<=94||codePoint>=123&&codePoint<=125){string="\\"+stringFromCharCode(codePoint)}else if(codePoint>=32&&codePoint<=126){string=stringFromCharCode(codePoint)}else if(codePoint<=255){string="\\x"+pad(hex(codePoint),2)}else{string="\\u"+pad(hex(codePoint),4)}return string};var symbolToCodePoint=function(symbol){var length=symbol.length;var first=symbol.charCodeAt(0);var second;if(first>=HIGH_SURROGATE_MIN&&first<=HIGH_SURROGATE_MAX&&length>1){second=symbol.charCodeAt(1);return(first-HIGH_SURROGATE_MIN)*1024+second-LOW_SURROGATE_MIN+65536}return first};var createBMPCharacterClasses=function(data){var result="";var index=0;var start;var end;var length=data.length;if(dataIsSingleton(data)){return codePointToString(data[0])}while(index<length){start=data[index];end=data[index+1]-1;if(start==end){result+=codePointToString(start)}else if(start+1==end){result+=codePointToString(start)+codePointToString(end)}else{result+=codePointToString(start)+"-"+codePointToString(end)}index+=2}return"["+result+"]"};var splitAtBMP=function(data){var loneHighSurrogates=[];var bmp=[];var astral=[];var index=0;var start;var end;var length=data.length;while(index<length){start=data[index];end=data[index+1]-1;if(start<=65535&&end<=65535){if(start>=HIGH_SURROGATE_MIN&&start<=HIGH_SURROGATE_MAX){if(end<=HIGH_SURROGATE_MAX){loneHighSurrogates.push(start,end+1)}else{loneHighSurrogates.push(start,HIGH_SURROGATE_MAX+1);bmp.push(HIGH_SURROGATE_MAX+1,end+1)}}else if(end>=HIGH_SURROGATE_MIN&&end<=HIGH_SURROGATE_MAX){bmp.push(start,HIGH_SURROGATE_MIN);loneHighSurrogates.push(HIGH_SURROGATE_MIN,end+1)}else if(start<HIGH_SURROGATE_MIN&&end>HIGH_SURROGATE_MAX){bmp.push(start,HIGH_SURROGATE_MIN,HIGH_SURROGATE_MAX+1,end+1);loneHighSurrogates.push(HIGH_SURROGATE_MIN,HIGH_SURROGATE_MAX+1)}else{bmp.push(start,end+1)}}else if(start<=65535&&end>65535){if(start>=HIGH_SURROGATE_MIN&&start<=HIGH_SURROGATE_MAX){loneHighSurrogates.push(start,HIGH_SURROGATE_MAX+1);bmp.push(HIGH_SURROGATE_MAX+1,65535+1)}else if(start<HIGH_SURROGATE_MIN){bmp.push(start,HIGH_SURROGATE_MIN,HIGH_SURROGATE_MAX+1,65535+1);loneHighSurrogates.push(HIGH_SURROGATE_MIN,HIGH_SURROGATE_MAX+1)}else{bmp.push(start,65535+1)}astral.push(65535+1,end+1)}else{astral.push(start,end+1)}index+=2}return{loneHighSurrogates:loneHighSurrogates,bmp:bmp,astral:astral}};var optimizeSurrogateMappings=function(surrogateMappings){var result=[];var tmpLow=[];var addLow=false;var mapping;var nextMapping;var highSurrogates;var lowSurrogates;var nextHighSurrogates;var nextLowSurrogates;var index=-1;var length=surrogateMappings.length;while(++index<length){mapping=surrogateMappings[index];nextMapping=surrogateMappings[index+1];if(!nextMapping){result.push(mapping);continue}highSurrogates=mapping[0];lowSurrogates=mapping[1];nextHighSurrogates=nextMapping[0];nextLowSurrogates=nextMapping[1];tmpLow=lowSurrogates;while(nextHighSurrogates&&highSurrogates[0]==nextHighSurrogates[0]&&highSurrogates[1]==nextHighSurrogates[1]){if(dataIsSingleton(nextLowSurrogates)){tmpLow=dataAdd(tmpLow,nextLowSurrogates[0])}else{tmpLow=dataAddRange(tmpLow,nextLowSurrogates[0],nextLowSurrogates[1]-1)}++index;mapping=surrogateMappings[index];highSurrogates=mapping[0];lowSurrogates=mapping[1];nextMapping=surrogateMappings[index+1];nextHighSurrogates=nextMapping&&nextMapping[0];nextLowSurrogates=nextMapping&&nextMapping[1];addLow=true}result.push([highSurrogates,addLow?tmpLow:lowSurrogates]);addLow=false}return optimizeByLowSurrogates(result)};var optimizeByLowSurrogates=function(surrogateMappings){if(surrogateMappings.length==1){return surrogateMappings}var index=-1;var innerIndex=-1;while(++index<surrogateMappings.length){var mapping=surrogateMappings[index];var lowSurrogates=mapping[1];var lowSurrogateStart=lowSurrogates[0];var lowSurrogateEnd=lowSurrogates[1];innerIndex=index;while(++innerIndex<surrogateMappings.length){var otherMapping=surrogateMappings[innerIndex];var otherLowSurrogates=otherMapping[1];var otherLowSurrogateStart=otherLowSurrogates[0];var otherLowSurrogateEnd=otherLowSurrogates[1];if(lowSurrogateStart==otherLowSurrogateStart&&lowSurrogateEnd==otherLowSurrogateEnd){if(dataIsSingleton(otherMapping[0])){mapping[0]=dataAdd(mapping[0],otherMapping[0][0])}else{mapping[0]=dataAddRange(mapping[0],otherMapping[0][0],otherMapping[0][1]-1)}surrogateMappings.splice(innerIndex,1);--innerIndex}}}return surrogateMappings};var surrogateSet=function(data){if(!data.length){return[]}var index=0;var start;var end;var startHigh;var startLow;var prevStartHigh=0;var prevEndHigh=0;var tmpLow=[];var endHigh;var endLow;var surrogateMappings=[];var length=data.length;var dataHigh=[];while(index<length){start=data[index];end=data[index+1]-1;startHigh=highSurrogate(start);startLow=lowSurrogate(start);endHigh=highSurrogate(end);endLow=lowSurrogate(end);var startsWithLowestLowSurrogate=startLow==LOW_SURROGATE_MIN;var endsWithHighestLowSurrogate=endLow==LOW_SURROGATE_MAX;var complete=false;if(startHigh==endHigh||startsWithLowestLowSurrogate&&endsWithHighestLowSurrogate){surrogateMappings.push([[startHigh,endHigh+1],[startLow,endLow+1]]);complete=true}else{surrogateMappings.push([[startHigh,startHigh+1],[startLow,LOW_SURROGATE_MAX+1]])}if(!complete&&startHigh+1<endHigh){if(endsWithHighestLowSurrogate){surrogateMappings.push([[startHigh+1,endHigh+1],[LOW_SURROGATE_MIN,endLow+1]]);complete=true}else{surrogateMappings.push([[startHigh+1,endHigh],[LOW_SURROGATE_MIN,LOW_SURROGATE_MAX+1]])}}if(!complete){surrogateMappings.push([[endHigh,endHigh+1],[LOW_SURROGATE_MIN,endLow+1]])}prevStartHigh=startHigh;prevEndHigh=endHigh;index+=2}return optimizeSurrogateMappings(surrogateMappings)};var createSurrogateCharacterClasses=function(surrogateMappings){var result=[];forEach(surrogateMappings,function(surrogateMapping){var highSurrogates=surrogateMapping[0];var lowSurrogates=surrogateMapping[1];result.push(createBMPCharacterClasses(highSurrogates)+createBMPCharacterClasses(lowSurrogates))});return result.join("|")};var createCharacterClassesFromData=function(data){var result=[];var parts=splitAtBMP(data);var loneHighSurrogates=parts.loneHighSurrogates;var bmp=parts.bmp;var astral=parts.astral;var hasAstral=!dataIsEmpty(parts.astral);var hasLoneSurrogates=!dataIsEmpty(loneHighSurrogates);var surrogateMappings=surrogateSet(astral);if(!hasAstral&&hasLoneSurrogates){bmp=dataAddData(bmp,loneHighSurrogates)}if(!dataIsEmpty(bmp)){result.push(createBMPCharacterClasses(bmp))}if(surrogateMappings.length){result.push(createSurrogateCharacterClasses(surrogateMappings))}if(hasAstral&&hasLoneSurrogates){result.push(createBMPCharacterClasses(loneHighSurrogates))}return result.join("|")};var regenerate=function(value){if(arguments.length>1){value=slice.call(arguments)}if(this instanceof regenerate){this.data=[];return value?this.add(value):this}return(new regenerate).add(value)};regenerate.version="1.0.1";var proto=regenerate.prototype;extend(proto,{add:function(value){var $this=this;if(value==null){return $this}if(value instanceof regenerate){$this.data=dataAddData($this.data,value.data);return $this}if(arguments.length>1){value=slice.call(arguments)}if(isArray(value)){forEach(value,function(item){$this.add(item)});return $this}$this.data=dataAdd($this.data,isNumber(value)?value:symbolToCodePoint(value));return $this},remove:function(value){var $this=this;if(value==null){return $this}if(value instanceof regenerate){$this.data=dataRemoveData($this.data,value.data);return $this}if(arguments.length>1){value=slice.call(arguments)}if(isArray(value)){forEach(value,function(item){$this.remove(item)});return $this}$this.data=dataRemove($this.data,isNumber(value)?value:symbolToCodePoint(value));return $this},addRange:function(start,end){var $this=this;$this.data=dataAddRange($this.data,isNumber(start)?start:symbolToCodePoint(start),isNumber(end)?end:symbolToCodePoint(end));return $this},removeRange:function(start,end){var $this=this;var startCodePoint=isNumber(start)?start:symbolToCodePoint(start);var endCodePoint=isNumber(end)?end:symbolToCodePoint(end);$this.data=dataRemoveRange($this.data,startCodePoint,endCodePoint);return $this},intersection:function(argument){var $this=this;var array=argument instanceof regenerate?dataToArray(argument.data):argument;$this.data=dataIntersection($this.data,array);return $this},contains:function(codePoint){return dataContains(this.data,isNumber(codePoint)?codePoint:symbolToCodePoint(codePoint))},clone:function(){var set=new regenerate;set.data=this.data.slice(0);return set},toString:function(){var result=createCharacterClassesFromData(this.data);return result.replace(regexNull,"\\0$1")},toRegExp:function(flags){return RegExp(this.toString(),flags||"")},valueOf:function(){return dataToArray(this.data)}});proto.toArray=proto.valueOf;if(typeof define=="function"&&typeof define.amd=="object"&&define.amd){define(function(){return regenerate})}else if(freeExports&&!freeExports.nodeType){if(freeModule){freeModule.exports=regenerate}else{freeExports.regenerate=regenerate}}else{root.regenerate=regenerate}})(this)}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],113:[function(require,module,exports){(function(global){(function(){"use strict";var objectTypes={"function":true,object:true};var root=objectTypes[typeof window]&&window||this;var oldRoot=root;var freeExports=objectTypes[typeof exports]&&exports;var freeModule=objectTypes[typeof module]&&module&&!module.nodeType&&module;var freeGlobal=freeExports&&freeModule&&typeof global=="object"&&global;if(freeGlobal&&(freeGlobal.global===freeGlobal||freeGlobal.window===freeGlobal||freeGlobal.self===freeGlobal)){root=freeGlobal}var stringFromCharCode=String.fromCharCode;var floor=Math.floor;function fromCodePoint(){var MAX_SIZE=16384;var codeUnits=[];var highSurrogate;var lowSurrogate;var index=-1;var length=arguments.length;if(!length){return""}var result="";while(++index<length){var codePoint=Number(arguments[index]);if(!isFinite(codePoint)||codePoint<0||codePoint>1114111||floor(codePoint)!=codePoint){throw RangeError("Invalid code point: "+codePoint)}if(codePoint<=65535){codeUnits.push(codePoint)}else{codePoint-=65536;highSurrogate=(codePoint>>10)+55296;lowSurrogate=codePoint%1024+56320;codeUnits.push(highSurrogate,lowSurrogate)}if(index+1==length||codeUnits.length>MAX_SIZE){result+=stringFromCharCode.apply(null,codeUnits);codeUnits.length=0}}return result}function assertType(type,expected){if(expected.indexOf("|")==-1){if(type==expected){return}throw Error("Invalid node type: "+type)}expected=assertType.hasOwnProperty(expected)?assertType[expected]:assertType[expected]=RegExp("^(?:"+expected+")$");if(expected.test(type)){return}throw Error("Invalid node type: "+type)}function generate(node){var type=node.type;if(generate.hasOwnProperty(type)&&typeof generate[type]=="function"){return generate[type](node)}throw Error("Invalid node type: "+type)}function generateAlternative(node){assertType(node.type,"alternative");var terms=node.body,length=terms?terms.length:0;if(length==1){return generateTerm(terms[0])}else{var i=-1,result="";while(++i<length){result+=generateTerm(terms[i])}return result}}function generateAnchor(node){assertType(node.type,"anchor");switch(node.kind){case"start":return"^";case"end":return"$";case"boundary":return"\\b";case"not-boundary":return"\\B";default:throw Error("Invalid assertion")}}function generateAtom(node){assertType(node.type,"anchor|characterClass|characterClassEscape|dot|group|reference|value");return generate(node)}function generateCharacterClass(node){assertType(node.type,"characterClass");var classRanges=node.body,length=classRanges?classRanges.length:0;var i=-1,result="[";if(node.negative){result+="^"}while(++i<length){result+=generateClassAtom(classRanges[i])}result+="]";return result}function generateCharacterClassEscape(node){assertType(node.type,"characterClassEscape");return"\\"+node.value}function generateCharacterClassRange(node){assertType(node.type,"characterClassRange");var min=node.min,max=node.max;if(min.type=="characterClassRange"||max.type=="characterClassRange"){throw Error("Invalid character class range")}return generateClassAtom(min)+"-"+generateClassAtom(max)}function generateClassAtom(node){assertType(node.type,"anchor|characterClassEscape|characterClassRange|dot|value");return generate(node)}function generateDisjunction(node){assertType(node.type,"disjunction");var body=node.body,length=body?body.length:0;if(length==0){throw Error("No body")}else if(length==1){return generate(body[0])}else{var i=-1,result="";while(++i<length){if(i!=0){result+="|"}result+=generate(body[i])}return result}}function generateDot(node){assertType(node.type,"dot");return"."}function generateGroup(node){assertType(node.type,"group");var result="(";switch(node.behavior){case"normal":break;case"ignore":result+="?:";break;case"lookahead":result+="?=";break;case"negativeLookahead":result+="?!";break;default:throw Error("Invalid behaviour: "+node.behaviour)}var body=node.body,length=body?body.length:0;if(length==1){result+=generate(body[0])}else{var i=-1;while(++i<length){result+=generate(body[i])}}result+=")";return result}function generateQuantifier(node){assertType(node.type,"quantifier");var quantifier="",min=node.min,max=node.max;switch(max){case undefined:case null:switch(min){case 0:quantifier="*";break;case 1:quantifier="+";break;default:quantifier="{"+min+",}";break}break;default:if(min==max){quantifier="{"+min+"}"}else if(min==0&&max==1){quantifier="?"}else{quantifier="{"+min+","+max+"}"}break}if(!node.greedy){quantifier+="?"}return generateAtom(node.body[0])+quantifier}function generateReference(node){assertType(node.type,"reference");return"\\"+node.matchIndex}function generateTerm(node){assertType(node.type,"anchor|characterClass|characterClassEscape|empty|group|quantifier|reference|value");return generate(node)}function generateValue(node){assertType(node.type,"value");var kind=node.kind,codePoint=node.codePoint;switch(kind){case"controlLetter":return"\\c"+fromCodePoint(codePoint+64);case"hexadecimalEscape":return"\\x"+("00"+codePoint.toString(16).toUpperCase()).slice(-2);case"identifier":return"\\"+fromCodePoint(codePoint);case"null":return"\\"+codePoint;case"octal":return"\\"+codePoint.toString(8);case"singleEscape":switch(codePoint){case 8:return"\\b";case 9:return"\\t";case 10:return"\\n";case 11:return"\\v";case 12:return"\\f";case 13:return"\\r";default:throw Error("Invalid codepoint: "+codePoint)}case"symbol":return fromCodePoint(codePoint);case"unicodeEscape":return"\\u"+("0000"+codePoint.toString(16).toUpperCase()).slice(-4);case"unicodeCodePointEscape":return"\\u{"+codePoint.toString(16).toUpperCase()+"}";default:throw Error("Unsupported node kind: "+kind)}}generate.alternative=generateAlternative;generate.anchor=generateAnchor;generate.characterClass=generateCharacterClass;generate.characterClassEscape=generateCharacterClassEscape;generate.characterClassRange=generateCharacterClassRange;generate.disjunction=generateDisjunction;generate.dot=generateDot;generate.group=generateGroup;generate.quantifier=generateQuantifier;generate.reference=generateReference;generate.value=generateValue;if(typeof define=="function"&&typeof define.amd=="object"&&define.amd){define(function(){return{generate:generate}})}else if(freeExports&&freeModule){freeExports.generate=generate}else{root.regjsgen={generate:generate}}}).call(this)}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],114:[function(require,module,exports){(function(){function parse(str,flags){var hasUnicodeFlag=(flags||"").indexOf("u")!==-1;var pos=0;var closedCaptureCounter=0;function addRaw(node){node.raw=str.substring(node.range[0],node.range[1]);return node}function updateRawStart(node,start){node.range[0]=start;return addRaw(node)}function createAnchor(kind,rawLength){return addRaw({type:"anchor",kind:kind,range:[pos-rawLength,pos]})}function createValue(kind,codePoint,from,to){return addRaw({type:"value",kind:kind,codePoint:codePoint,range:[from,to]})}function createEscaped(kind,codePoint,value,fromOffset){fromOffset=fromOffset||0;return createValue(kind,codePoint,pos-(value.length+fromOffset),pos)}function createCharacter(matches){var _char=matches[0];var first=_char.charCodeAt(0);if(hasUnicodeFlag){var second;if(_char.length===1&&first>=55296&&first<=56319){second=lookahead().charCodeAt(0);if(second>=56320&&second<=57343){pos++;return createValue("symbol",(first-55296)*1024+second-56320+65536,pos-2,pos)}}}return createValue("symbol",first,pos-1,pos)}function createDisjunction(alternatives,from,to){return addRaw({type:"disjunction",body:alternatives,range:[from,to]})}function createDot(){return addRaw({type:"dot",range:[pos-1,pos]})}function createCharacterClassEscape(value){return addRaw({type:"characterClassEscape",value:value,range:[pos-2,pos]})
}function createReference(matchIndex){return addRaw({type:"reference",matchIndex:parseInt(matchIndex,10),range:[pos-1-matchIndex.length,pos]})}function createGroup(behavior,disjunction,from,to){return addRaw({type:"group",behavior:behavior,body:disjunction,range:[from,to]})}function createQuantifier(min,max,from,to){if(to==null){from=pos-1;to=pos}return addRaw({type:"quantifier",min:min,max:max,greedy:true,body:null,range:[from,to]})}function createAlternative(terms,from,to){return addRaw({type:"alternative",body:terms,range:[from,to]})}function createCharacterClass(classRanges,negative,from,to){return addRaw({type:"characterClass",body:classRanges,negative:negative,range:[from,to]})}function createClassRange(min,max,from,to){if(min.codePoint>max.codePoint){throw SyntaxError("invalid range in character class")}return addRaw({type:"characterClassRange",min:min,max:max,range:[from,to]})}function flattenBody(body){if(body.type==="alternative"){return body.body}else{return[body]}}function isEmpty(obj){return obj.type==="empty"}function incr(amount){amount=amount||1;var res=str.substring(pos,pos+amount);pos+=amount||1;return res}function skip(value){if(!match(value)){throw SyntaxError("character: "+value)}}function match(value){if(str.indexOf(value,pos)===pos){return incr(value.length)}}function lookahead(){return str[pos]}function current(value){return str.indexOf(value,pos)===pos}function next(value){return str[pos+1]===value}function matchReg(regExp){var subStr=str.substring(pos);var res=subStr.match(regExp);if(res){res.range=[];res.range[0]=pos;incr(res[0].length);res.range[1]=pos}return res}function parseDisjunction(){var res=[],from=pos;res.push(parseAlternative());while(match("|")){res.push(parseAlternative())}if(res.length===1){return res[0]}return createDisjunction(res,from,pos)}function parseAlternative(){var res=[],from=pos;var term;while(term=parseTerm()){res.push(term)}if(res.length===1){return res[0]}return createAlternative(res,from,pos)}function parseTerm(){if(pos>=str.length||current("|")||current(")")){return null}var anchor=parseAnchor();if(anchor){return anchor}var atom=parseAtom();if(!atom){throw SyntaxError("Expected atom")}var quantifier=parseQuantifier()||false;if(quantifier){quantifier.body=flattenBody(atom);updateRawStart(quantifier,atom.range[0]);return quantifier}return atom}function parseGroup(matchA,typeA,matchB,typeB){var type=null,from=pos;if(match(matchA)){type=typeA}else if(match(matchB)){type=typeB}else{return false}var body=parseDisjunction();if(!body){throw SyntaxError("Expected disjunction")}skip(")");var group=createGroup(type,flattenBody(body),from,pos);if(type=="normal"){closedCaptureCounter++}return group}function parseAnchor(){var res,from=pos;if(match("^")){return createAnchor("start",1)}else if(match("$")){return createAnchor("end",1)}else if(match("\\b")){return createAnchor("boundary",2)}else if(match("\\B")){return createAnchor("not-boundary",2)}else{return parseGroup("(?=","lookahead","(?!","negativeLookahead")}}function parseQuantifier(){var res;var quantifier;var min,max;if(match("*")){quantifier=createQuantifier(0)}else if(match("+")){quantifier=createQuantifier(1)}else if(match("?")){quantifier=createQuantifier(0,1)}else if(res=matchReg(/^\{([0-9]+)\}/)){min=parseInt(res[1],10);quantifier=createQuantifier(min,min,res.range[0],res.range[1])}else if(res=matchReg(/^\{([0-9]+),\}/)){min=parseInt(res[1],10);quantifier=createQuantifier(min,undefined,res.range[0],res.range[1])}else if(res=matchReg(/^\{([0-9]+),([0-9]+)\}/)){min=parseInt(res[1],10);max=parseInt(res[2],10);if(min>max){throw SyntaxError("numbers out of order in {} quantifier")}quantifier=createQuantifier(min,max,res.range[0],res.range[1])}if(quantifier){if(match("?")){quantifier.greedy=false;quantifier.range[1]+=1}}return quantifier}function parseAtom(){var res;if(res=matchReg(/^[^^$\\.*+?(){[|]/)){return createCharacter(res)}else if(match(".")){return createDot()}else if(match("\\")){res=parseAtomEscape();if(!res){throw SyntaxError("atomEscape")}return res}else if(res=parseCharacterClass()){return res}else{return parseGroup("(?:","ignore","(","normal")}}function parseUnicodeSurrogatePairEscape(firstEscape){if(hasUnicodeFlag){var first,second;if(firstEscape.kind=="unicodeEscape"&&(first=firstEscape.codePoint)>=55296&&first<=56319&¤t("\\")&&next("u")){var prevPos=pos;pos++;var secondEscape=parseClassEscape();if(secondEscape.kind=="unicodeEscape"&&(second=secondEscape.codePoint)>=56320&&second<=57343){firstEscape.range[1]=secondEscape.range[1];firstEscape.codePoint=(first-55296)*1024+second-56320+65536;firstEscape.type="value";firstEscape.kind="unicodeCodePointEscape";addRaw(firstEscape)}else{pos=prevPos}}}return firstEscape}function parseClassEscape(){return parseAtomEscape(true)}function parseAtomEscape(insideCharacterClass){var res;res=parseDecimalEscape();if(res){return res}if(insideCharacterClass){if(match("b")){return createEscaped("singleEscape",8,"\\b")}else if(match("B")){throw SyntaxError("\\B not possible inside of CharacterClass")}}res=parseCharacterEscape();return res}function parseDecimalEscape(){var res,match;if(res=matchReg(/^(?!0)\d+/)){match=res[0];var refIdx=parseInt(res[0],10);if(refIdx<=closedCaptureCounter){return createReference(res[0])}else{incr(-res[0].length);if(res=matchReg(/^[0-7]{1,3}/)){return createEscaped("octal",parseInt(res[0],8),res[0],1)}else{res=createCharacter(matchReg(/^[89]/));return updateRawStart(res,res.range[0]-1)}}}else if(res=matchReg(/^[0-7]{1,3}/)){match=res[0];if(/^0{1,3}$/.test(match)){return createEscaped("null",0,"0",match.length+1)}else{return createEscaped("octal",parseInt(match,8),match,1)}}else if(res=matchReg(/^[dDsSwW]/)){return createCharacterClassEscape(res[0])}return false}function parseCharacterEscape(){var res;if(res=matchReg(/^[fnrtv]/)){var codePoint=0;switch(res[0]){case"t":codePoint=9;break;case"n":codePoint=10;break;case"v":codePoint=11;break;case"f":codePoint=12;break;case"r":codePoint=13;break}return createEscaped("singleEscape",codePoint,"\\"+res[0])}else if(res=matchReg(/^c([a-zA-Z])/)){return createEscaped("controlLetter",res[1].charCodeAt(0)%32,res[1],2)}else if(res=matchReg(/^x([0-9a-fA-F]{2})/)){return createEscaped("hexadecimalEscape",parseInt(res[1],16),res[1],2)}else if(res=matchReg(/^u([0-9a-fA-F]{4})/)){return parseUnicodeSurrogatePairEscape(createEscaped("unicodeEscape",parseInt(res[1],16),res[1],2))}else if(hasUnicodeFlag&&(res=matchReg(/^u\{([0-9a-fA-F]{1,6})\}/))){return createEscaped("unicodeCodePointEscape",parseInt(res[1],16),res[1],4)}else{return parseIdentityEscape()}}function isIdentifierPart(ch){var NonAsciiIdentifierPart=new RegExp("[ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮ̀-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁ҃-҇Ҋ-ԯԱ-Ֆՙա-և֑-ׇֽֿׁׂׅׄא-תװ-ײؐ-ؚؠ-٩ٮ-ۓە-ۜ۟-۪ۨ-ۼۿܐ-݊ݍ-ޱ߀-ߵߺࠀ-࠭ࡀ-࡛ࢠ-ࢲࣤ-ॣ०-९ॱ-ঃঅ-ঌএঐও-নপ-রলশ-হ়-ৄেৈো-ৎৗড়ঢ়য়-ৣ০-ৱਁ-ਃਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹ਼ਾ-ੂੇੈੋ-੍ੑਖ਼-ੜਫ਼੦-ੵઁ-ઃઅ-ઍએ-ઑઓ-નપ-રલળવ-હ઼-ૅે-ૉો-્ૐૠ-ૣ૦-૯ଁ-ଃଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହ଼-ୄେୈୋ-୍ୖୗଡ଼ଢ଼ୟ-ୣ୦-୯ୱஂஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹா-ூெ-ைொ-்ௐௗ௦-௯ఀ-ఃఅ-ఌఎ-ఐఒ-నప-హఽ-ౄె-ైొ-్ౕౖౘౙౠ-ౣ౦-౯ಁ-ಃಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹ಼-ೄೆ-ೈೊ-್ೕೖೞೠ-ೣ೦-೯ೱೲഁ-ഃഅ-ഌഎ-ഐഒ-ഺഽ-ൄെ-ൈൊ-ൎൗൠ-ൣ൦-൯ൺ-ൿංඃඅ-ඖක-නඳ-රලව-ෆ්ා-ුූෘ-ෟ෦-෯ෲෳก-ฺเ-๎๐-๙ກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ູົ-ຽເ-ໄໆ່-ໍ໐-໙ໜ-ໟༀ༘༙༠-༩༹༵༷༾-ཇཉ-ཬཱ-྄྆-ྗྙ-ྼ࿆က-၉ၐ-ႝႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚ፝-፟ᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-᜔ᜠ-᜴ᝀ-ᝓᝠ-ᝬᝮ-ᝰᝲᝳក-៓ៗៜ៝០-៩᠋-᠍᠐-᠙ᠠ-ᡷᢀ-ᢪᢰ-ᣵᤀ-ᤞᤠ-ᤫᤰ-᤻᥆-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉ᧐-᧙ᨀ-ᨛᨠ-ᩞ᩠-᩿᩼-᪉᪐-᪙ᪧ᪰-᪽ᬀ-ᭋ᭐-᭙᭫-᭳ᮀ-᯳ᰀ-᰷᱀-᱉ᱍ-ᱽ᳐-᳔᳒-ᳶ᳸᳹ᴀ-᷵᷼-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼ‿⁀⁔ⁱⁿₐ-ₜ⃐-⃥⃜⃡-⃰ℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯ⵿-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⷠ-ⷿⸯ々-〇〡-〯〱-〵〸-〼ぁ-ゖ゙゚ゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘫꙀ-꙯ꙴ-꙽ꙿ-ꚝꚟ-꛱ꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞭꞰꞱꟷ-ꠧꡀ-ꡳꢀ-꣄꣐-꣙꣠-ꣷꣻ꤀-꤭ꤰ-꥓ꥠ-ꥼꦀ-꧀ꧏ-꧙ꧠ-ꧾꨀ-ꨶꩀ-ꩍ꩐-꩙ꩠ-ꩶꩺ-ꫂꫛ-ꫝꫠ-ꫯꫲ-꫶ꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭟꭤꭥꯀ-ꯪ꯬꯭꯰-꯹가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻ︀-️︠-︭︳︴﹍-﹏ﹰ-ﹴﹶ-ﻼ0-9A-Z_a-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ]");return ch===36||ch===95||ch>=65&&ch<=90||ch>=97&&ch<=122||ch>=48&&ch<=57||ch===92||ch>=128&&NonAsciiIdentifierPart.test(String.fromCharCode(ch))}function parseIdentityEscape(){var ZWJ="";var ZWNJ="";var res;var tmp;if(!isIdentifierPart(lookahead())){tmp=incr();return createEscaped("identifier",tmp.charCodeAt(0),tmp,1)}if(match(ZWJ)){return createEscaped("identifier",8204,ZWJ)}else if(match(ZWNJ)){return createEscaped("identifier",8205,ZWNJ)}return null}function parseCharacterClass(){var res,from=pos;if(res=matchReg(/^\[\^/)){res=parseClassRanges();skip("]");return createCharacterClass(res,true,from,pos)}else if(match("[")){res=parseClassRanges();skip("]");return createCharacterClass(res,false,from,pos)}return null}function parseClassRanges(){var res;if(current("]")){return[]}else{res=parseNonemptyClassRanges();if(!res){throw SyntaxError("nonEmptyClassRanges")}return res}}function parseHelperClassRanges(atom){var from,to,res;if(current("-")&&!next("]")){skip("-");res=parseClassAtom();if(!res){throw SyntaxError("classAtom")}to=pos;var classRanges=parseClassRanges();if(!classRanges){throw SyntaxError("classRanges")}from=atom.range[0];if(classRanges.type==="empty"){return[createClassRange(atom,res,from,to)]}return[createClassRange(atom,res,from,to)].concat(classRanges)}res=parseNonemptyClassRangesNoDash();if(!res){throw SyntaxError("nonEmptyClassRangesNoDash")}return[atom].concat(res)}function parseNonemptyClassRanges(){var atom=parseClassAtom();if(!atom){throw SyntaxError("classAtom")}if(current("]")){return[atom]}return parseHelperClassRanges(atom)}function parseNonemptyClassRangesNoDash(){var res=parseClassAtom();if(!res){throw SyntaxError("classAtom")}if(current("]")){return res}return parseHelperClassRanges(res)}function parseClassAtom(){if(match("-")){return createCharacter("-")}else{return parseClassAtomNoDash()}}function parseClassAtomNoDash(){var res;if(res=matchReg(/^[^\\\]-]/)){return createCharacter(res[0])}else if(match("\\")){res=parseClassEscape();if(!res){throw SyntaxError("classEscape")}return parseUnicodeSurrogatePairEscape(res)}}str=String(str);if(str===""){str="(?:)"}var result=parseDisjunction();if(result.range[1]!==str.length){throw SyntaxError("Could not parse entire input - got stuck: "+str)}return result}var regjsparser={parse:parse};if(typeof module!=="undefined"&&module.exports){module.exports=regjsparser}else{window.regjsparser=regjsparser}})()},{}],115:[function(require,module,exports){var generate=require("regjsgen").generate;var parse=require("regjsparser").parse;var regenerate=require("regenerate");var iuMappings=require("./data/iu-mappings.json");var ESCAPE_SETS=require("./data/character-class-escape-sets.js");function getCharacterClassEscapeSet(character){if(unicode){if(ignoreCase){return ESCAPE_SETS.UNICODE_IGNORE_CASE[character]}return ESCAPE_SETS.UNICODE[character]}return ESCAPE_SETS.REGULAR[character]}var object={};var hasOwnProperty=object.hasOwnProperty;function has(object,property){return hasOwnProperty.call(object,property)}var UNICODE_SET=regenerate().addRange(0,1114111);var BMP_SET=regenerate().addRange(0,65535);var DOT_SET_UNICODE=UNICODE_SET.clone().remove(10,13,8232,8233);var DOT_SET=DOT_SET_UNICODE.clone().intersection(BMP_SET);regenerate.prototype.iuAddRange=function(min,max){var $this=this;do{var folded=caseFold(min);if(folded){$this.add(folded)}}while(++min<=max);return $this};function assign(target,source){for(var key in source){target[key]=source[key]}}function update(item,pattern){var tree=parse(pattern,"");switch(tree.type){case"characterClass":case"group":case"value":break;default:tree=wrap(tree,pattern)}assign(item,tree)}function wrap(tree,pattern){return{type:"group",behavior:"ignore",body:[tree],raw:"(?:"+pattern+")"}}function caseFold(codePoint){return has(iuMappings,codePoint)?iuMappings[codePoint]:false}var ignoreCase=false;var unicode=false;function processCharacterClass(characterClassItem){var set=regenerate();var body=characterClassItem.body.forEach(function(item){switch(item.type){case"value":set.add(item.codePoint);if(ignoreCase&&unicode){var folded=caseFold(item.codePoint);if(folded){set.add(folded)}}break;case"characterClassRange":var min=item.min.codePoint;var max=item.max.codePoint;set.addRange(min,max);if(ignoreCase&&unicode){set.iuAddRange(min,max)}break;case"characterClassEscape":set.add(getCharacterClassEscapeSet(item.value));break;default:throw Error("Unknown term type: "+item.type)}});if(characterClassItem.negative){set=(unicode?UNICODE_SET:BMP_SET).clone().remove(set)}update(characterClassItem,set.toString());return characterClassItem}function processTerm(item){switch(item.type){case"dot":update(item,(unicode?DOT_SET_UNICODE:DOT_SET).toString());break;case"characterClass":item=processCharacterClass(item);break;case"characterClassEscape":update(item,getCharacterClassEscapeSet(item.value).toString());break;case"alternative":case"disjunction":case"group":case"quantifier":item.body=item.body.map(processTerm);break;case"value":var codePoint=item.codePoint;var set=regenerate(codePoint);if(ignoreCase&&unicode){var folded=caseFold(codePoint);if(folded){set.add(folded)}}update(item,set.toString());break;case"anchor":case"empty":case"group":case"reference":break;default:throw Error("Unknown term type: "+item.type)}return item}module.exports=function(pattern,flags){var tree=parse(pattern,flags);ignoreCase=flags?flags.indexOf("i")>-1:false;unicode=flags?flags.indexOf("u")>-1:false;assign(tree,processTerm(tree));return generate(tree)}},{"./data/character-class-escape-sets.js":110,"./data/iu-mappings.json":111,regenerate:112,regjsgen:113,regjsparser:114}],116:[function(require,module,exports){exports.SourceMapGenerator=require("./source-map/source-map-generator").SourceMapGenerator;exports.SourceMapConsumer=require("./source-map/source-map-consumer").SourceMapConsumer;exports.SourceNode=require("./source-map/source-node").SourceNode},{"./source-map/source-map-consumer":121,"./source-map/source-map-generator":122,"./source-map/source-node":123}],117:[function(require,module,exports){if(typeof define!=="function"){var define=require("amdefine")(module,require)}define(function(require,exports,module){var util=require("./util");function ArraySet(){this._array=[];this._set={}}ArraySet.fromArray=function ArraySet_fromArray(aArray,aAllowDuplicates){var set=new ArraySet;for(var i=0,len=aArray.length;i<len;i++){set.add(aArray[i],aAllowDuplicates)}return set};ArraySet.prototype.add=function ArraySet_add(aStr,aAllowDuplicates){var isDuplicate=this.has(aStr);var idx=this._array.length;if(!isDuplicate||aAllowDuplicates){this._array.push(aStr)}if(!isDuplicate){this._set[util.toSetString(aStr)]=idx}};ArraySet.prototype.has=function ArraySet_has(aStr){return Object.prototype.hasOwnProperty.call(this._set,util.toSetString(aStr))};ArraySet.prototype.indexOf=function ArraySet_indexOf(aStr){if(this.has(aStr)){return this._set[util.toSetString(aStr)]}throw new Error('"'+aStr+'" is not in the set.')};ArraySet.prototype.at=function ArraySet_at(aIdx){if(aIdx>=0&&aIdx<this._array.length){return this._array[aIdx]}throw new Error("No element indexed by "+aIdx)};ArraySet.prototype.toArray=function ArraySet_toArray(){return this._array.slice()};exports.ArraySet=ArraySet})},{"./util":124,amdefine:125}],118:[function(require,module,exports){if(typeof define!=="function"){var define=require("amdefine")(module,require)}define(function(require,exports,module){var base64=require("./base64");var VLQ_BASE_SHIFT=5;var VLQ_BASE=1<<VLQ_BASE_SHIFT;var VLQ_BASE_MASK=VLQ_BASE-1;var VLQ_CONTINUATION_BIT=VLQ_BASE;function toVLQSigned(aValue){return aValue<0?(-aValue<<1)+1:(aValue<<1)+0}function fromVLQSigned(aValue){var isNegative=(aValue&1)===1;var shifted=aValue>>1;return isNegative?-shifted:shifted}exports.encode=function base64VLQ_encode(aValue){var encoded="";var digit;var vlq=toVLQSigned(aValue);do{digit=vlq&VLQ_BASE_MASK;vlq>>>=VLQ_BASE_SHIFT;if(vlq>0){digit|=VLQ_CONTINUATION_BIT}encoded+=base64.encode(digit)}while(vlq>0);return encoded};exports.decode=function base64VLQ_decode(aStr,aOutParam){var i=0;var strLen=aStr.length;var result=0;var shift=0;var continuation,digit;do{if(i>=strLen){throw new Error("Expected more digits in base 64 VLQ value.")}digit=base64.decode(aStr.charAt(i++));continuation=!!(digit&VLQ_CONTINUATION_BIT);digit&=VLQ_BASE_MASK;result=result+(digit<<shift);shift+=VLQ_BASE_SHIFT}while(continuation);aOutParam.value=fromVLQSigned(result);aOutParam.rest=aStr.slice(i)}})},{"./base64":119,amdefine:125}],119:[function(require,module,exports){if(typeof define!=="function"){var define=require("amdefine")(module,require)}define(function(require,exports,module){var charToIntMap={};var intToCharMap={};"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("").forEach(function(ch,index){charToIntMap[ch]=index;intToCharMap[index]=ch});exports.encode=function base64_encode(aNumber){if(aNumber in intToCharMap){return intToCharMap[aNumber]}throw new TypeError("Must be between 0 and 63: "+aNumber)};exports.decode=function base64_decode(aChar){if(aChar in charToIntMap){return charToIntMap[aChar]}throw new TypeError("Not a valid base 64 digit: "+aChar)}})},{amdefine:125}],120:[function(require,module,exports){if(typeof define!=="function"){var define=require("amdefine")(module,require)}define(function(require,exports,module){function recursiveSearch(aLow,aHigh,aNeedle,aHaystack,aCompare){var mid=Math.floor((aHigh-aLow)/2)+aLow;var cmp=aCompare(aNeedle,aHaystack[mid],true);if(cmp===0){return aHaystack[mid]}else if(cmp>0){if(aHigh-mid>1){return recursiveSearch(mid,aHigh,aNeedle,aHaystack,aCompare)}return aHaystack[mid]}else{if(mid-aLow>1){return recursiveSearch(aLow,mid,aNeedle,aHaystack,aCompare)}return aLow<0?null:aHaystack[aLow]}}exports.search=function search(aNeedle,aHaystack,aCompare){return aHaystack.length>0?recursiveSearch(-1,aHaystack.length,aNeedle,aHaystack,aCompare):null}})},{amdefine:125}],121:[function(require,module,exports){if(typeof define!=="function"){var define=require("amdefine")(module,require)}define(function(require,exports,module){var util=require("./util");var binarySearch=require("./binary-search");var ArraySet=require("./array-set").ArraySet;var base64VLQ=require("./base64-vlq");function SourceMapConsumer(aSourceMap){var sourceMap=aSourceMap;if(typeof aSourceMap==="string"){sourceMap=JSON.parse(aSourceMap.replace(/^\)\]\}'/,""))}var version=util.getArg(sourceMap,"version");var sources=util.getArg(sourceMap,"sources");var names=util.getArg(sourceMap,"names",[]);var sourceRoot=util.getArg(sourceMap,"sourceRoot",null);var sourcesContent=util.getArg(sourceMap,"sourcesContent",null);var mappings=util.getArg(sourceMap,"mappings");var file=util.getArg(sourceMap,"file",null);if(version!=this._version){throw new Error("Unsupported version: "+version)}this._names=ArraySet.fromArray(names,true);this._sources=ArraySet.fromArray(sources,true);this.sourceRoot=sourceRoot;this.sourcesContent=sourcesContent;this._mappings=mappings;this.file=file}SourceMapConsumer.fromSourceMap=function SourceMapConsumer_fromSourceMap(aSourceMap){var smc=Object.create(SourceMapConsumer.prototype);smc._names=ArraySet.fromArray(aSourceMap._names.toArray(),true);smc._sources=ArraySet.fromArray(aSourceMap._sources.toArray(),true);smc.sourceRoot=aSourceMap._sourceRoot;smc.sourcesContent=aSourceMap._generateSourcesContent(smc._sources.toArray(),smc.sourceRoot);smc.file=aSourceMap._file;smc.__generatedMappings=aSourceMap._mappings.slice().sort(util.compareByGeneratedPositions);smc.__originalMappings=aSourceMap._mappings.slice().sort(util.compareByOriginalPositions);return smc};SourceMapConsumer.prototype._version=3;Object.defineProperty(SourceMapConsumer.prototype,"sources",{get:function(){return this._sources.toArray().map(function(s){return this.sourceRoot!=null?util.join(this.sourceRoot,s):s},this)}});SourceMapConsumer.prototype.__generatedMappings=null;Object.defineProperty(SourceMapConsumer.prototype,"_generatedMappings",{get:function(){if(!this.__generatedMappings){this.__generatedMappings=[];this.__originalMappings=[];this._parseMappings(this._mappings,this.sourceRoot)}return this.__generatedMappings}});SourceMapConsumer.prototype.__originalMappings=null;Object.defineProperty(SourceMapConsumer.prototype,"_originalMappings",{get:function(){if(!this.__originalMappings){this.__generatedMappings=[];this.__originalMappings=[];this._parseMappings(this._mappings,this.sourceRoot)}return this.__originalMappings}});SourceMapConsumer.prototype._nextCharIsMappingSeparator=function SourceMapConsumer_nextCharIsMappingSeparator(aStr){var c=aStr.charAt(0);return c===";"||c===","};SourceMapConsumer.prototype._parseMappings=function SourceMapConsumer_parseMappings(aStr,aSourceRoot){var generatedLine=1;var previousGeneratedColumn=0;var previousOriginalLine=0;var previousOriginalColumn=0;var previousSource=0;var previousName=0;var str=aStr;var temp={};var mapping;while(str.length>0){if(str.charAt(0)===";"){generatedLine++;str=str.slice(1);previousGeneratedColumn=0}else if(str.charAt(0)===","){str=str.slice(1)}else{mapping={};mapping.generatedLine=generatedLine;base64VLQ.decode(str,temp);mapping.generatedColumn=previousGeneratedColumn+temp.value;previousGeneratedColumn=mapping.generatedColumn;str=temp.rest;if(str.length>0&&!this._nextCharIsMappingSeparator(str)){base64VLQ.decode(str,temp);mapping.source=this._sources.at(previousSource+temp.value);previousSource+=temp.value;str=temp.rest;if(str.length===0||this._nextCharIsMappingSeparator(str)){throw new Error("Found a source, but no line and column")}base64VLQ.decode(str,temp);mapping.originalLine=previousOriginalLine+temp.value;previousOriginalLine=mapping.originalLine;mapping.originalLine+=1;str=temp.rest;if(str.length===0||this._nextCharIsMappingSeparator(str)){throw new Error("Found a source and line, but no column")}base64VLQ.decode(str,temp);mapping.originalColumn=previousOriginalColumn+temp.value;previousOriginalColumn=mapping.originalColumn;str=temp.rest;if(str.length>0&&!this._nextCharIsMappingSeparator(str)){base64VLQ.decode(str,temp);mapping.name=this._names.at(previousName+temp.value);previousName+=temp.value;str=temp.rest}}this.__generatedMappings.push(mapping);if(typeof mapping.originalLine==="number"){this.__originalMappings.push(mapping)}}}this.__generatedMappings.sort(util.compareByGeneratedPositions);this.__originalMappings.sort(util.compareByOriginalPositions)};SourceMapConsumer.prototype._findMapping=function SourceMapConsumer_findMapping(aNeedle,aMappings,aLineName,aColumnName,aComparator){if(aNeedle[aLineName]<=0){throw new TypeError("Line must be greater than or equal to 1, got "+aNeedle[aLineName])}if(aNeedle[aColumnName]<0){throw new TypeError("Column must be greater than or equal to 0, got "+aNeedle[aColumnName])}return binarySearch.search(aNeedle,aMappings,aComparator)};SourceMapConsumer.prototype.originalPositionFor=function SourceMapConsumer_originalPositionFor(aArgs){var needle={generatedLine:util.getArg(aArgs,"line"),generatedColumn:util.getArg(aArgs,"column")};var mapping=this._findMapping(needle,this._generatedMappings,"generatedLine","generatedColumn",util.compareByGeneratedPositions);if(mapping&&mapping.generatedLine===needle.generatedLine){var source=util.getArg(mapping,"source",null);if(source!=null&&this.sourceRoot!=null){source=util.join(this.sourceRoot,source)}return{source:source,line:util.getArg(mapping,"originalLine",null),column:util.getArg(mapping,"originalColumn",null),name:util.getArg(mapping,"name",null)}}return{source:null,line:null,column:null,name:null}};SourceMapConsumer.prototype.sourceContentFor=function SourceMapConsumer_sourceContentFor(aSource){if(!this.sourcesContent){return null}if(this.sourceRoot!=null){aSource=util.relative(this.sourceRoot,aSource)}if(this._sources.has(aSource)){return this.sourcesContent[this._sources.indexOf(aSource)]}var url;if(this.sourceRoot!=null&&(url=util.urlParse(this.sourceRoot))){var fileUriAbsPath=aSource.replace(/^file:\/\//,"");if(url.scheme=="file"&&this._sources.has(fileUriAbsPath)){return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)]}if((!url.path||url.path=="/")&&this._sources.has("/"+aSource)){return this.sourcesContent[this._sources.indexOf("/"+aSource)]}}throw new Error('"'+aSource+'" is not in the SourceMap.')};SourceMapConsumer.prototype.generatedPositionFor=function SourceMapConsumer_generatedPositionFor(aArgs){var needle={source:util.getArg(aArgs,"source"),originalLine:util.getArg(aArgs,"line"),originalColumn:util.getArg(aArgs,"column")};if(this.sourceRoot!=null){needle.source=util.relative(this.sourceRoot,needle.source)}var mapping=this._findMapping(needle,this._originalMappings,"originalLine","originalColumn",util.compareByOriginalPositions);if(mapping){return{line:util.getArg(mapping,"generatedLine",null),column:util.getArg(mapping,"generatedColumn",null)}}return{line:null,column:null}};SourceMapConsumer.GENERATED_ORDER=1;SourceMapConsumer.ORIGINAL_ORDER=2;SourceMapConsumer.prototype.eachMapping=function SourceMapConsumer_eachMapping(aCallback,aContext,aOrder){var context=aContext||null;var order=aOrder||SourceMapConsumer.GENERATED_ORDER;var mappings;switch(order){case SourceMapConsumer.GENERATED_ORDER:mappings=this._generatedMappings;break;case SourceMapConsumer.ORIGINAL_ORDER:mappings=this._originalMappings;break;default:throw new Error("Unknown order of iteration.")}var sourceRoot=this.sourceRoot;mappings.map(function(mapping){var source=mapping.source;if(source!=null&&sourceRoot!=null){source=util.join(sourceRoot,source)}return{source:source,generatedLine:mapping.generatedLine,generatedColumn:mapping.generatedColumn,originalLine:mapping.originalLine,originalColumn:mapping.originalColumn,name:mapping.name}}).forEach(aCallback,context)};exports.SourceMapConsumer=SourceMapConsumer})},{"./array-set":117,"./base64-vlq":118,"./binary-search":120,"./util":124,amdefine:125}],122:[function(require,module,exports){if(typeof define!=="function"){var define=require("amdefine")(module,require)}define(function(require,exports,module){var base64VLQ=require("./base64-vlq");var util=require("./util");var ArraySet=require("./array-set").ArraySet;function SourceMapGenerator(aArgs){if(!aArgs){aArgs={}}this._file=util.getArg(aArgs,"file",null);this._sourceRoot=util.getArg(aArgs,"sourceRoot",null);this._sources=new ArraySet;this._names=new ArraySet;this._mappings=[];this._sourcesContents=null}SourceMapGenerator.prototype._version=3;SourceMapGenerator.fromSourceMap=function SourceMapGenerator_fromSourceMap(aSourceMapConsumer){var sourceRoot=aSourceMapConsumer.sourceRoot;var generator=new SourceMapGenerator({file:aSourceMapConsumer.file,sourceRoot:sourceRoot});aSourceMapConsumer.eachMapping(function(mapping){var newMapping={generated:{line:mapping.generatedLine,column:mapping.generatedColumn}};if(mapping.source!=null){newMapping.source=mapping.source;if(sourceRoot!=null){newMapping.source=util.relative(sourceRoot,newMapping.source)}newMapping.original={line:mapping.originalLine,column:mapping.originalColumn};if(mapping.name!=null){newMapping.name=mapping.name}}generator.addMapping(newMapping)});aSourceMapConsumer.sources.forEach(function(sourceFile){var content=aSourceMapConsumer.sourceContentFor(sourceFile);if(content!=null){generator.setSourceContent(sourceFile,content)}});return generator};SourceMapGenerator.prototype.addMapping=function SourceMapGenerator_addMapping(aArgs){var generated=util.getArg(aArgs,"generated");var original=util.getArg(aArgs,"original",null);var source=util.getArg(aArgs,"source",null);var name=util.getArg(aArgs,"name",null);this._validateMapping(generated,original,source,name);if(source!=null&&!this._sources.has(source)){this._sources.add(source)}if(name!=null&&!this._names.has(name)){this._names.add(name)}this._mappings.push({generatedLine:generated.line,generatedColumn:generated.column,originalLine:original!=null&&original.line,originalColumn:original!=null&&original.column,source:source,name:name})};SourceMapGenerator.prototype.setSourceContent=function SourceMapGenerator_setSourceContent(aSourceFile,aSourceContent){var source=aSourceFile;if(this._sourceRoot!=null){source=util.relative(this._sourceRoot,source)}if(aSourceContent!=null){if(!this._sourcesContents){this._sourcesContents={}}this._sourcesContents[util.toSetString(source)]=aSourceContent}else if(this._sourcesContents){delete this._sourcesContents[util.toSetString(source)];if(Object.keys(this._sourcesContents).length===0){this._sourcesContents=null}}};SourceMapGenerator.prototype.applySourceMap=function SourceMapGenerator_applySourceMap(aSourceMapConsumer,aSourceFile,aSourceMapPath){var sourceFile=aSourceFile;if(aSourceFile==null){if(aSourceMapConsumer.file==null){throw new Error("SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, "+'or the source map\'s "file" property. Both were omitted.')}sourceFile=aSourceMapConsumer.file}var sourceRoot=this._sourceRoot;if(sourceRoot!=null){sourceFile=util.relative(sourceRoot,sourceFile)}var newSources=new ArraySet;var newNames=new ArraySet;this._mappings.forEach(function(mapping){if(mapping.source===sourceFile&&mapping.originalLine!=null){var original=aSourceMapConsumer.originalPositionFor({line:mapping.originalLine,column:mapping.originalColumn});if(original.source!=null){mapping.source=original.source;if(aSourceMapPath!=null){mapping.source=util.join(aSourceMapPath,mapping.source)}if(sourceRoot!=null){mapping.source=util.relative(sourceRoot,mapping.source)}mapping.originalLine=original.line;mapping.originalColumn=original.column;if(original.name!=null){mapping.name=original.name}}}var source=mapping.source;if(source!=null&&!newSources.has(source)){newSources.add(source)}var name=mapping.name;if(name!=null&&!newNames.has(name)){newNames.add(name)}},this);this._sources=newSources;this._names=newNames;aSourceMapConsumer.sources.forEach(function(sourceFile){var content=aSourceMapConsumer.sourceContentFor(sourceFile);if(content!=null){if(aSourceMapPath!=null){sourceFile=util.join(aSourceMapPath,sourceFile)}if(sourceRoot!=null){sourceFile=util.relative(sourceRoot,sourceFile)}this.setSourceContent(sourceFile,content)}},this)};SourceMapGenerator.prototype._validateMapping=function SourceMapGenerator_validateMapping(aGenerated,aOriginal,aSource,aName){if(aGenerated&&"line"in aGenerated&&"column"in aGenerated&&aGenerated.line>0&&aGenerated.column>=0&&!aOriginal&&!aSource&&!aName){return}else if(aGenerated&&"line"in aGenerated&&"column"in aGenerated&&aOriginal&&"line"in aOriginal&&"column"in aOriginal&&aGenerated.line>0&&aGenerated.column>=0&&aOriginal.line>0&&aOriginal.column>=0&&aSource){return}else{throw new Error("Invalid mapping: "+JSON.stringify({generated:aGenerated,source:aSource,original:aOriginal,name:aName}))}};SourceMapGenerator.prototype._serializeMappings=function SourceMapGenerator_serializeMappings(){var previousGeneratedColumn=0;var previousGeneratedLine=1;var previousOriginalColumn=0;var previousOriginalLine=0;var previousName=0;var previousSource=0;var result="";var mapping;this._mappings.sort(util.compareByGeneratedPositions);for(var i=0,len=this._mappings.length;i<len;i++){mapping=this._mappings[i];if(mapping.generatedLine!==previousGeneratedLine){previousGeneratedColumn=0;while(mapping.generatedLine!==previousGeneratedLine){result+=";";previousGeneratedLine++}}else{if(i>0){if(!util.compareByGeneratedPositions(mapping,this._mappings[i-1])){continue}result+=","}}result+=base64VLQ.encode(mapping.generatedColumn-previousGeneratedColumn);previousGeneratedColumn=mapping.generatedColumn;if(mapping.source!=null){result+=base64VLQ.encode(this._sources.indexOf(mapping.source)-previousSource);previousSource=this._sources.indexOf(mapping.source);result+=base64VLQ.encode(mapping.originalLine-1-previousOriginalLine);previousOriginalLine=mapping.originalLine-1;result+=base64VLQ.encode(mapping.originalColumn-previousOriginalColumn);previousOriginalColumn=mapping.originalColumn;if(mapping.name!=null){result+=base64VLQ.encode(this._names.indexOf(mapping.name)-previousName);previousName=this._names.indexOf(mapping.name)}}}return result};SourceMapGenerator.prototype._generateSourcesContent=function SourceMapGenerator_generateSourcesContent(aSources,aSourceRoot){return aSources.map(function(source){if(!this._sourcesContents){return null
}if(aSourceRoot!=null){source=util.relative(aSourceRoot,source)}var key=util.toSetString(source);return Object.prototype.hasOwnProperty.call(this._sourcesContents,key)?this._sourcesContents[key]:null},this)};SourceMapGenerator.prototype.toJSON=function SourceMapGenerator_toJSON(){var map={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};if(this._file!=null){map.file=this._file}if(this._sourceRoot!=null){map.sourceRoot=this._sourceRoot}if(this._sourcesContents){map.sourcesContent=this._generateSourcesContent(map.sources,map.sourceRoot)}return map};SourceMapGenerator.prototype.toString=function SourceMapGenerator_toString(){return JSON.stringify(this)};exports.SourceMapGenerator=SourceMapGenerator})},{"./array-set":117,"./base64-vlq":118,"./util":124,amdefine:125}],123:[function(require,module,exports){if(typeof define!=="function"){var define=require("amdefine")(module,require)}define(function(require,exports,module){var SourceMapGenerator=require("./source-map-generator").SourceMapGenerator;var util=require("./util");var REGEX_NEWLINE=/(\r?\n)/;var REGEX_CHARACTER=/\r\n|[\s\S]/g;function SourceNode(aLine,aColumn,aSource,aChunks,aName){this.children=[];this.sourceContents={};this.line=aLine==null?null:aLine;this.column=aColumn==null?null:aColumn;this.source=aSource==null?null:aSource;this.name=aName==null?null:aName;if(aChunks!=null)this.add(aChunks)}SourceNode.fromStringWithSourceMap=function SourceNode_fromStringWithSourceMap(aGeneratedCode,aSourceMapConsumer,aRelativePath){var node=new SourceNode;var remainingLines=aGeneratedCode.split(REGEX_NEWLINE);var shiftNextLine=function(){var lineContents=remainingLines.shift();var newLine=remainingLines.shift()||"";return lineContents+newLine};var lastGeneratedLine=1,lastGeneratedColumn=0;var lastMapping=null;aSourceMapConsumer.eachMapping(function(mapping){if(lastMapping!==null){if(lastGeneratedLine<mapping.generatedLine){var code="";addMappingWithCode(lastMapping,shiftNextLine());lastGeneratedLine++;lastGeneratedColumn=0}else{var nextLine=remainingLines[0];var code=nextLine.substr(0,mapping.generatedColumn-lastGeneratedColumn);remainingLines[0]=nextLine.substr(mapping.generatedColumn-lastGeneratedColumn);lastGeneratedColumn=mapping.generatedColumn;addMappingWithCode(lastMapping,code);lastMapping=mapping;return}}while(lastGeneratedLine<mapping.generatedLine){node.add(shiftNextLine());lastGeneratedLine++}if(lastGeneratedColumn<mapping.generatedColumn){var nextLine=remainingLines[0];node.add(nextLine.substr(0,mapping.generatedColumn));remainingLines[0]=nextLine.substr(mapping.generatedColumn);lastGeneratedColumn=mapping.generatedColumn}lastMapping=mapping},this);if(remainingLines.length>0){if(lastMapping){addMappingWithCode(lastMapping,shiftNextLine())}node.add(remainingLines.join(""))}aSourceMapConsumer.sources.forEach(function(sourceFile){var content=aSourceMapConsumer.sourceContentFor(sourceFile);if(content!=null){if(aRelativePath!=null){sourceFile=util.join(aRelativePath,sourceFile)}node.setSourceContent(sourceFile,content)}});return node;function addMappingWithCode(mapping,code){if(mapping===null||mapping.source===undefined){node.add(code)}else{var source=aRelativePath?util.join(aRelativePath,mapping.source):mapping.source;node.add(new SourceNode(mapping.originalLine,mapping.originalColumn,source,code,mapping.name))}}};SourceNode.prototype.add=function SourceNode_add(aChunk){if(Array.isArray(aChunk)){aChunk.forEach(function(chunk){this.add(chunk)},this)}else if(aChunk instanceof SourceNode||typeof aChunk==="string"){if(aChunk){this.children.push(aChunk)}}else{throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+aChunk)}return this};SourceNode.prototype.prepend=function SourceNode_prepend(aChunk){if(Array.isArray(aChunk)){for(var i=aChunk.length-1;i>=0;i--){this.prepend(aChunk[i])}}else if(aChunk instanceof SourceNode||typeof aChunk==="string"){this.children.unshift(aChunk)}else{throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+aChunk)}return this};SourceNode.prototype.walk=function SourceNode_walk(aFn){var chunk;for(var i=0,len=this.children.length;i<len;i++){chunk=this.children[i];if(chunk instanceof SourceNode){chunk.walk(aFn)}else{if(chunk!==""){aFn(chunk,{source:this.source,line:this.line,column:this.column,name:this.name})}}}};SourceNode.prototype.join=function SourceNode_join(aSep){var newChildren;var i;var len=this.children.length;if(len>0){newChildren=[];for(i=0;i<len-1;i++){newChildren.push(this.children[i]);newChildren.push(aSep)}newChildren.push(this.children[i]);this.children=newChildren}return this};SourceNode.prototype.replaceRight=function SourceNode_replaceRight(aPattern,aReplacement){var lastChild=this.children[this.children.length-1];if(lastChild instanceof SourceNode){lastChild.replaceRight(aPattern,aReplacement)}else if(typeof lastChild==="string"){this.children[this.children.length-1]=lastChild.replace(aPattern,aReplacement)}else{this.children.push("".replace(aPattern,aReplacement))}return this};SourceNode.prototype.setSourceContent=function SourceNode_setSourceContent(aSourceFile,aSourceContent){this.sourceContents[util.toSetString(aSourceFile)]=aSourceContent};SourceNode.prototype.walkSourceContents=function SourceNode_walkSourceContents(aFn){for(var i=0,len=this.children.length;i<len;i++){if(this.children[i]instanceof SourceNode){this.children[i].walkSourceContents(aFn)}}var sources=Object.keys(this.sourceContents);for(var i=0,len=sources.length;i<len;i++){aFn(util.fromSetString(sources[i]),this.sourceContents[sources[i]])}};SourceNode.prototype.toString=function SourceNode_toString(){var str="";this.walk(function(chunk){str+=chunk});return str};SourceNode.prototype.toStringWithSourceMap=function SourceNode_toStringWithSourceMap(aArgs){var generated={code:"",line:1,column:0};var map=new SourceMapGenerator(aArgs);var sourceMappingActive=false;var lastOriginalSource=null;var lastOriginalLine=null;var lastOriginalColumn=null;var lastOriginalName=null;this.walk(function(chunk,original){generated.code+=chunk;if(original.source!==null&&original.line!==null&&original.column!==null){if(lastOriginalSource!==original.source||lastOriginalLine!==original.line||lastOriginalColumn!==original.column||lastOriginalName!==original.name){map.addMapping({source:original.source,original:{line:original.line,column:original.column},generated:{line:generated.line,column:generated.column},name:original.name})}lastOriginalSource=original.source;lastOriginalLine=original.line;lastOriginalColumn=original.column;lastOriginalName=original.name;sourceMappingActive=true}else if(sourceMappingActive){map.addMapping({generated:{line:generated.line,column:generated.column}});lastOriginalSource=null;sourceMappingActive=false}chunk.match(REGEX_CHARACTER).forEach(function(ch,idx,array){if(REGEX_NEWLINE.test(ch)){generated.line++;generated.column=0;if(idx+1===array.length){lastOriginalSource=null;sourceMappingActive=false}else if(sourceMappingActive){map.addMapping({source:original.source,original:{line:original.line,column:original.column},generated:{line:generated.line,column:generated.column},name:original.name})}}else{generated.column+=ch.length}})});this.walkSourceContents(function(sourceFile,sourceContent){map.setSourceContent(sourceFile,sourceContent)});return{code:generated.code,map:map}};exports.SourceNode=SourceNode})},{"./source-map-generator":122,"./util":124,amdefine:125}],124:[function(require,module,exports){if(typeof define!=="function"){var define=require("amdefine")(module,require)}define(function(require,exports,module){function getArg(aArgs,aName,aDefaultValue){if(aName in aArgs){return aArgs[aName]}else if(arguments.length===3){return aDefaultValue}else{throw new Error('"'+aName+'" is a required argument.')}}exports.getArg=getArg;var urlRegexp=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.]*)(?::(\d+))?(\S*)$/;var dataUrlRegexp=/^data:.+\,.+$/;function urlParse(aUrl){var match=aUrl.match(urlRegexp);if(!match){return null}return{scheme:match[1],auth:match[2],host:match[3],port:match[4],path:match[5]}}exports.urlParse=urlParse;function urlGenerate(aParsedUrl){var url="";if(aParsedUrl.scheme){url+=aParsedUrl.scheme+":"}url+="//";if(aParsedUrl.auth){url+=aParsedUrl.auth+"@"}if(aParsedUrl.host){url+=aParsedUrl.host}if(aParsedUrl.port){url+=":"+aParsedUrl.port}if(aParsedUrl.path){url+=aParsedUrl.path}return url}exports.urlGenerate=urlGenerate;function normalize(aPath){var path=aPath;var url=urlParse(aPath);if(url){if(!url.path){return aPath}path=url.path}var isAbsolute=path.charAt(0)==="/";var parts=path.split(/\/+/);for(var part,up=0,i=parts.length-1;i>=0;i--){part=parts[i];if(part==="."){parts.splice(i,1)}else if(part===".."){up++}else if(up>0){if(part===""){parts.splice(i+1,up);up=0}else{parts.splice(i,2);up--}}}path=parts.join("/");if(path===""){path=isAbsolute?"/":"."}if(url){url.path=path;return urlGenerate(url)}return path}exports.normalize=normalize;function join(aRoot,aPath){if(aRoot===""){aRoot="."}if(aPath===""){aPath="."}var aPathUrl=urlParse(aPath);var aRootUrl=urlParse(aRoot);if(aRootUrl){aRoot=aRootUrl.path||"/"}if(aPathUrl&&!aPathUrl.scheme){if(aRootUrl){aPathUrl.scheme=aRootUrl.scheme}return urlGenerate(aPathUrl)}if(aPathUrl||aPath.match(dataUrlRegexp)){return aPath}if(aRootUrl&&!aRootUrl.host&&!aRootUrl.path){aRootUrl.host=aPath;return urlGenerate(aRootUrl)}var joined=aPath.charAt(0)==="/"?aPath:normalize(aRoot.replace(/\/+$/,"")+"/"+aPath);if(aRootUrl){aRootUrl.path=joined;return urlGenerate(aRootUrl)}return joined}exports.join=join;function relative(aRoot,aPath){if(aRoot===""){aRoot="."}aRoot=aRoot.replace(/\/$/,"");var url=urlParse(aRoot);if(aPath.charAt(0)=="/"&&url&&url.path=="/"){return aPath.slice(1)}return aPath.indexOf(aRoot+"/")===0?aPath.substr(aRoot.length+1):aPath}exports.relative=relative;function toSetString(aStr){return"$"+aStr}exports.toSetString=toSetString;function fromSetString(aStr){return aStr.substr(1)}exports.fromSetString=fromSetString;function strcmp(aStr1,aStr2){var s1=aStr1||"";var s2=aStr2||"";return(s1>s2)-(s1<s2)}function compareByOriginalPositions(mappingA,mappingB,onlyCompareOriginal){var cmp;cmp=strcmp(mappingA.source,mappingB.source);if(cmp){return cmp}cmp=mappingA.originalLine-mappingB.originalLine;if(cmp){return cmp}cmp=mappingA.originalColumn-mappingB.originalColumn;if(cmp||onlyCompareOriginal){return cmp}cmp=strcmp(mappingA.name,mappingB.name);if(cmp){return cmp}cmp=mappingA.generatedLine-mappingB.generatedLine;if(cmp){return cmp}return mappingA.generatedColumn-mappingB.generatedColumn}exports.compareByOriginalPositions=compareByOriginalPositions;function compareByGeneratedPositions(mappingA,mappingB,onlyCompareGenerated){var cmp;cmp=mappingA.generatedLine-mappingB.generatedLine;if(cmp){return cmp}cmp=mappingA.generatedColumn-mappingB.generatedColumn;if(cmp||onlyCompareGenerated){return cmp}cmp=strcmp(mappingA.source,mappingB.source);if(cmp){return cmp}cmp=mappingA.originalLine-mappingB.originalLine;if(cmp){return cmp}cmp=mappingA.originalColumn-mappingB.originalColumn;if(cmp){return cmp}return strcmp(mappingA.name,mappingB.name)}exports.compareByGeneratedPositions=compareByGeneratedPositions})},{amdefine:125}],125:[function(require,module,exports){(function(process,__filename){"use strict";function amdefine(module,requireFn){"use strict";var defineCache={},loaderCache={},alreadyCalled=false,path=require("path"),makeRequire,stringRequire;function trimDots(ary){var i,part;for(i=0;ary[i];i+=1){part=ary[i];if(part==="."){ary.splice(i,1);i-=1}else if(part===".."){if(i===1&&(ary[2]===".."||ary[0]==="..")){break}else if(i>0){ary.splice(i-1,2);i-=2}}}}function normalize(name,baseName){var baseParts;if(name&&name.charAt(0)==="."){if(baseName){baseParts=baseName.split("/");baseParts=baseParts.slice(0,baseParts.length-1);baseParts=baseParts.concat(name.split("/"));trimDots(baseParts);name=baseParts.join("/")}}return name}function makeNormalize(relName){return function(name){return normalize(name,relName)}}function makeLoad(id){function load(value){loaderCache[id]=value}load.fromText=function(id,text){throw new Error("amdefine does not implement load.fromText")};return load}makeRequire=function(systemRequire,exports,module,relId){function amdRequire(deps,callback){if(typeof deps==="string"){return stringRequire(systemRequire,exports,module,deps,relId)}else{deps=deps.map(function(depName){return stringRequire(systemRequire,exports,module,depName,relId)});process.nextTick(function(){callback.apply(null,deps)})}}amdRequire.toUrl=function(filePath){if(filePath.indexOf(".")===0){return normalize(filePath,path.dirname(module.filename))}else{return filePath}};return amdRequire};requireFn=requireFn||function req(){return module.require.apply(module,arguments)};function runFactory(id,deps,factory){var r,e,m,result;if(id){e=loaderCache[id]={};m={id:id,uri:__filename,exports:e};r=makeRequire(requireFn,e,m,id)}else{if(alreadyCalled){throw new Error("amdefine with no module ID cannot be called more than once per file.")}alreadyCalled=true;e=module.exports;m=module;r=makeRequire(requireFn,e,m,module.id)}if(deps){deps=deps.map(function(depName){return r(depName)})}if(typeof factory==="function"){result=factory.apply(m.exports,deps)}else{result=factory}if(result!==undefined){m.exports=result;if(id){loaderCache[id]=m.exports}}}stringRequire=function(systemRequire,exports,module,id,relId){var index=id.indexOf("!"),originalId=id,prefix,plugin;if(index===-1){id=normalize(id,relId);if(id==="require"){return makeRequire(systemRequire,exports,module,relId)}else if(id==="exports"){return exports}else if(id==="module"){return module}else if(loaderCache.hasOwnProperty(id)){return loaderCache[id]}else if(defineCache[id]){runFactory.apply(null,defineCache[id]);return loaderCache[id]}else{if(systemRequire){return systemRequire(originalId)}else{throw new Error("No module with ID: "+id)}}}else{prefix=id.substring(0,index);id=id.substring(index+1,id.length);plugin=stringRequire(systemRequire,exports,module,prefix,relId);if(plugin.normalize){id=plugin.normalize(id,makeNormalize(relId))}else{id=normalize(id,relId)}if(loaderCache[id]){return loaderCache[id]}else{plugin.load(id,makeRequire(systemRequire,exports,module,relId),makeLoad(id),{});return loaderCache[id]}}};function define(id,deps,factory){if(Array.isArray(id)){factory=deps;deps=id;id=undefined}else if(typeof id!=="string"){factory=id;id=deps=undefined}if(deps&&!Array.isArray(deps)){factory=deps;deps=undefined}if(!deps){deps=["require","exports","module"]}if(id){defineCache[id]=[id,deps,factory]}else{runFactory(id,deps,factory)}}define.require=function(id){if(loaderCache[id]){return loaderCache[id]}if(defineCache[id]){runFactory.apply(null,defineCache[id]);return loaderCache[id]}};define.amd={};return define}module.exports=amdefine}).call(this,require("_process"),"/node_modules/source-map/node_modules/amdefine/amdefine.js")},{_process:100,path:99}],126:[function(require,module,exports){module.exports={"abstract-expression-call":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"PROPERTY"},property:{type:"MemberExpression",object:{type:"Identifier",name:"Symbol"},property:{type:"Identifier",name:"referenceGet"},computed:false},computed:true},arguments:[{type:"Identifier",name:"OBJECT"}]},property:{type:"Identifier",name:"call"},computed:false},arguments:[{type:"Identifier",name:"OBJECT"}]}}]},"abstract-expression-delete":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"PROPERTY"},property:{type:"MemberExpression",object:{type:"Identifier",name:"Symbol"},property:{type:"Identifier",name:"referenceDelete"},computed:false},computed:true},arguments:[{type:"Identifier",name:"OBJECT"}]}}]},"abstract-expression-get":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"PROPERTY"},property:{type:"MemberExpression",object:{type:"Identifier",name:"Symbol"},property:{type:"Identifier",name:"referenceGet"},computed:false},computed:true},arguments:[{type:"Identifier",name:"OBJECT"}]}}]},"abstract-expression-set":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"PROPERTY"},property:{type:"MemberExpression",object:{type:"Identifier",name:"Symbol"},property:{type:"Identifier",name:"referenceSet"},computed:false},computed:true},arguments:[{type:"Identifier",name:"OBJECT"},{type:"Identifier",name:"VALUE"}]}}]},"apply-constructor":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"ParenthesizedExpression",expression:{type:"FunctionExpression",id:null,params:[{type:"Identifier",name:"Constructor"},{type:"Identifier",name:"args"}],defaults:[],rest:null,generator:false,body:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"instance"},init:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"create"},computed:false},arguments:[{type:"MemberExpression",object:{type:"Identifier",name:"Constructor"},property:{type:"Identifier",name:"prototype"},computed:false}]}}],kind:"var"},{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"result"},init:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Constructor"},property:{type:"Identifier",name:"apply"},computed:false},arguments:[{type:"Identifier",name:"instance"},{type:"Identifier",name:"args"}]}}],kind:"var"},{type:"ReturnStatement",argument:{type:"ConditionalExpression",test:{type:"LogicalExpression",left:{type:"BinaryExpression",left:{type:"Identifier",name:"result"},operator:"!=",right:{type:"Literal",value:null}},operator:"&&",right:{type:"ParenthesizedExpression",expression:{type:"LogicalExpression",left:{type:"BinaryExpression",left:{type:"UnaryExpression",operator:"typeof",prefix:true,argument:{type:"Identifier",name:"result"}},operator:"==",right:{type:"Literal",value:"object"}},operator:"||",right:{type:"BinaryExpression",left:{type:"UnaryExpression",operator:"typeof",prefix:true,argument:{type:"Identifier",name:"result"}},operator:"==",right:{type:"Literal",value:"function"}}}}},consequent:{type:"Identifier",name:"result"},alternate:{type:"Identifier",name:"instance"}}}]},expression:false}}}]},"array-comprehension-container":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"ParenthesizedExpression",expression:{type:"FunctionExpression",id:null,params:[],defaults:[],rest:null,generator:false,body:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"KEY"},init:{type:"ArrayExpression",elements:[]}}],kind:"var"},{type:"ReturnStatement",argument:{type:"Identifier",name:"KEY"}}]},expression:false}},arguments:[]}}]},"array-comprehension-for-each":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"ARRAY"},property:{type:"Identifier",name:"forEach"},computed:false},arguments:[{type:"FunctionExpression",id:null,params:[{type:"Identifier",name:"KEY"}],defaults:[],rest:null,generator:false,body:{type:"BlockStatement",body:[]},expression:false}]}}]},"array-expression-comprehension-filter":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"ARRAY"},property:{type:"Identifier",name:"filter"},computed:false},arguments:[{type:"FunctionExpression",id:null,params:[{type:"Identifier",name:"KEY"}],defaults:[],rest:null,generator:false,body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"Identifier",name:"FILTER"}}]},expression:false}]},property:{type:"Identifier",name:"map"},computed:false},arguments:[{type:"FunctionExpression",id:null,params:[{type:"Identifier",name:"KEY"}],defaults:[],rest:null,generator:false,body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"Identifier",name:"STATEMENT"}}]},expression:false}]}}]},"array-expression-comprehension-map":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"ARRAY"},property:{type:"Identifier",name:"map"},computed:false},arguments:[{type:"FunctionExpression",id:null,params:[{type:"Identifier",name:"KEY"}],defaults:[],rest:null,generator:false,body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"Identifier",name:"STATEMENT"}}]},expression:false}]}}]},"array-from":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Array"},property:{type:"Identifier",name:"from"},computed:false},arguments:[{type:"Identifier",name:"VALUE"}]}}]},"array-push":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"KEY"},property:{type:"Identifier",name:"push"},computed:false},arguments:[{type:"Identifier",name:"STATEMENT"}]}}]},call:{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"OBJECT"},property:{type:"Identifier",name:"call"},computed:false},arguments:[{type:"Identifier",name:"CONTEXT"}]}}]},"class-props":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"ParenthesizedExpression",expression:{type:"FunctionExpression",id:null,params:[{type:"Identifier",name:"child"},{type:"Identifier",name:"staticProps"},{type:"Identifier",name:"instanceProps"}],defaults:[],rest:null,generator:false,body:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"Identifier",name:"staticProps"},consequent:{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"defineProperties"},computed:false},arguments:[{type:"Identifier",name:"child"},{type:"Identifier",name:"staticProps"}]}},alternate:null},{type:"IfStatement",test:{type:"Identifier",name:"instanceProps"},consequent:{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"defineProperties"},computed:false},arguments:[{type:"MemberExpression",object:{type:"Identifier",name:"child"},property:{type:"Identifier",name:"prototype"},computed:false},{type:"Identifier",name:"instanceProps"}]}},alternate:null}]},expression:false}}}]},"class-super-constructor-call":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"SUPER_NAME"},property:{type:"Identifier",name:"apply"},computed:false},arguments:[{type:"ThisExpression"},{type:"Identifier",name:"arguments"}]}}]},"class":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"ParenthesizedExpression",expression:{type:"FunctionExpression",id:null,params:[],defaults:[],rest:null,generator:false,body:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"CLASS_NAME"},init:{type:"FunctionExpression",id:null,params:[],defaults:[],rest:null,generator:false,body:{type:"BlockStatement",body:[]},expression:false}}],kind:"var"},{type:"ReturnStatement",argument:{type:"Identifier",name:"CLASS_NAME"}}]},expression:false}},arguments:[]}}]},"exports-assign-key":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"exports"},property:{type:"Identifier",name:"VARIABLE_NAME"},computed:false},right:{type:"MemberExpression",object:{type:"Identifier",name:"OBJECT"},property:{type:"Identifier",name:"KEY"},computed:false}}}]},"exports-assign":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"exports"},property:{type:"Identifier",name:"KEY"},computed:false},right:{type:"Identifier",name:"VALUE"}}}]},"exports-default-module":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"module"},property:{type:"Identifier",name:"exports"},computed:false},right:{type:"Identifier",name:"VALUE"}}}]},"exports-default":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"exports"},property:{type:"Identifier",name:"default"},computed:false},right:{type:"Identifier",name:"VALUE"}}}]},"exports-wildcard":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"ParenthesizedExpression",expression:{type:"FunctionExpression",id:null,params:[{type:"Identifier",name:"obj"}],defaults:[],rest:null,generator:false,body:{type:"BlockStatement",body:[{type:"ForInStatement",left:{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"i"},init:null}],kind:"var"},right:{type:"Identifier",name:"obj"},body:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"exports"},property:{type:"Identifier",name:"i"},computed:true},right:{type:"MemberExpression",object:{type:"Identifier",name:"obj"},property:{type:"Identifier",name:"i"},computed:true}}}]}}]},expression:false}},arguments:[{type:"Identifier",name:"OBJECT"}]}}]},"extends":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"ParenthesizedExpression",expression:{type:"FunctionExpression",id:null,params:[{type:"Identifier",name:"child"},{type:"Identifier",name:"parent"}],defaults:[],rest:null,generator:false,body:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"child"},property:{type:"Identifier",name:"prototype"},computed:false},right:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"create"},computed:false},arguments:[{type:"MemberExpression",object:{type:"Identifier",name:"parent"},property:{type:"Identifier",name:"prototype"},computed:false},{type:"ObjectExpression",properties:[{type:"Property",method:false,shorthand:false,computed:false,key:{type:"Identifier",name:"constructor"},value:{type:"ObjectExpression",properties:[{type:"Property",method:false,shorthand:false,computed:false,key:{type:"Identifier",name:"value"},value:{type:"Identifier",name:"child"},kind:"init"},{type:"Property",method:false,shorthand:false,computed:false,key:{type:"Identifier",name:"enumerable"},value:{type:"Literal",value:false},kind:"init"},{type:"Property",method:false,shorthand:false,computed:false,key:{type:"Identifier",name:"writable"},value:{type:"Literal",value:true},kind:"init"},{type:"Property",method:false,shorthand:false,computed:false,key:{type:"Identifier",name:"configurable"},value:{type:"Literal",value:true},kind:"init"}]},kind:"init"}]}]}}},{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"child"},property:{type:"Identifier",name:"__proto__"},computed:false},right:{type:"Identifier",name:"parent"}}}]},expression:false}}}]},"for-of":{type:"Program",body:[{type:"ForStatement",init:{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"ITERATOR_KEY"},init:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"OBJECT"},property:{type:"MemberExpression",object:{type:"Identifier",name:"Symbol"},property:{type:"Identifier",name:"iterator"},computed:false},computed:true},arguments:[]}},{type:"VariableDeclarator",id:{type:"Identifier",name:"STEP_KEY"},init:null}],kind:"var"},test:{type:"UnaryExpression",operator:"!",prefix:true,argument:{type:"MemberExpression",object:{type:"ParenthesizedExpression",expression:{type:"AssignmentExpression",operator:"=",left:{type:"Identifier",name:"STEP_KEY"},right:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"ITERATOR_KEY"},property:{type:"Identifier",name:"next"},computed:false},arguments:[]}}},property:{type:"Identifier",name:"done"},computed:false}},update:null,body:{type:"BlockStatement",body:[]}}]},"function-return-obj":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"ParenthesizedExpression",expression:{type:"FunctionExpression",id:null,params:[{type:"Identifier",name:"KEY"}],defaults:[],rest:null,generator:false,body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"Identifier",name:"KEY"}}]},expression:false}},arguments:[{type:"Identifier",name:"OBJECT"}]}}]},"has-own":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"MemberExpression",object:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"prototype"},computed:false},property:{type:"Identifier",name:"hasOwnProperty"},computed:false}}]},"if-undefined-set-to":{type:"Program",body:[{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"Identifier",name:"VARIABLE"},operator:"===",right:{type:"Identifier",name:"undefined"}},consequent:{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"Identifier",name:"VARIABLE"},right:{type:"Identifier",name:"DEFAULT"}}},alternate:null}]},"interop-require":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"ParenthesizedExpression",expression:{type:"FunctionExpression",id:null,params:[{type:"Identifier",name:"obj"}],defaults:[],rest:null,generator:false,body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"LogicalExpression",left:{type:"Identifier",name:"obj"},operator:"&&",right:{type:"ParenthesizedExpression",expression:{type:"LogicalExpression",left:{type:"MemberExpression",object:{type:"Identifier",name:"obj"},property:{type:"Literal",value:"default"},computed:true},operator:"||",right:{type:"Identifier",name:"obj"}}}}}]},expression:false}}}]},"let-scoping-return":{type:"Program",body:[{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"UnaryExpression",operator:"typeof",prefix:true,argument:{type:"Identifier",name:"RETURN"}},operator:"===",right:{type:"Literal",value:"object"}},consequent:{type:"ReturnStatement",argument:{type:"MemberExpression",object:{type:"Identifier",name:"RETURN"},property:{type:"Identifier",name:"v"},computed:false}},alternate:null}]},"object-define-properties-closure":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"ParenthesizedExpression",expression:{type:"FunctionExpression",id:null,params:[{type:"Identifier",name:"KEY"}],defaults:[],rest:null,generator:false,body:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"Identifier",name:"CONTENT"}},{type:"ReturnStatement",argument:{type:"Identifier",name:"KEY"}}]},expression:false}},arguments:[{type:"Identifier",name:"OBJECT"}]}}]},"object-define-properties":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"defineProperties"},computed:false},arguments:[{type:"Identifier",name:"OBJECT"},{type:"Identifier",name:"PROPS"}]}}]},"object-spread":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"ParenthesizedExpression",expression:{type:"FunctionExpression",id:null,params:[{type:"Identifier",name:"obj"},{type:"Identifier",name:"keys"}],defaults:[],rest:null,generator:false,body:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"target"},init:{type:"ObjectExpression",properties:[]}}],kind:"var"},{type:"ForInStatement",left:{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"i"},init:null}],kind:"var"},right:{type:"Identifier",name:"obj"},body:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"keys"},property:{type:"Identifier",name:"indexOf"},computed:false},arguments:[{type:"Identifier",name:"i"}]},operator:">=",right:{type:"Literal",value:0}},consequent:{type:"ContinueStatement",label:null},alternate:null},{type:"IfStatement",test:{type:"UnaryExpression",operator:"!",prefix:true,argument:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"MemberExpression",object:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"prototype"},computed:false},property:{type:"Identifier",name:"hasOwnProperty"},computed:false},property:{type:"Identifier",name:"call"},computed:false},arguments:[{type:"Identifier",name:"obj"},{type:"Identifier",name:"i"}]}},consequent:{type:"ContinueStatement",label:null},alternate:null},{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"target"},property:{type:"Identifier",name:"i"},computed:true},right:{type:"MemberExpression",object:{type:"Identifier",name:"obj"},property:{type:"Identifier",name:"i"},computed:true}}}]}},{type:"ReturnStatement",argument:{type:"Identifier",name:"target"}}]},expression:false}}}]},"prototype-identifier":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"MemberExpression",object:{type:"Identifier",name:"CLASS_NAME"},property:{type:"Identifier",name:"prototype"},computed:false}}]},register:{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"System"},property:{type:"Identifier",name:"register"},computed:false},arguments:[{type:"Identifier",name:"MODULE_NAME"},{type:"Identifier",name:"MODULE_DEPENDENCIES"},{type:"Identifier",name:"MODULE_BODY"}]}}]},"require-assign-key":{type:"Program",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"VARIABLE_NAME"},init:{type:"MemberExpression",object:{type:"CallExpression",callee:{type:"Identifier",name:"require"},arguments:[{type:"Identifier",name:"MODULE_NAME"}]},property:{type:"Identifier",name:"KEY"},computed:false}}],kind:"var"}]},"require-assign":{type:"Program",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"VARIABLE_NAME"},init:{type:"CallExpression",callee:{type:"Identifier",name:"require"},arguments:[{type:"Identifier",name:"MODULE_NAME"}]}}],kind:"var"}]},require:{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"Identifier",name:"require"},arguments:[{type:"Identifier",name:"MODULE_NAME"}]}}]},"self-global":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"ConditionalExpression",test:{type:"BinaryExpression",left:{type:"UnaryExpression",operator:"typeof",prefix:true,argument:{type:"Identifier",name:"global"}},operator:"===",right:{type:"Literal",value:"undefined"}},consequent:{type:"Identifier",name:"self"},alternate:{type:"Identifier",name:"global"}}}]},slice:{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"MemberExpression",object:{type:"MemberExpression",object:{type:"Identifier",name:"Array"},property:{type:"Identifier",name:"prototype"},computed:false},property:{type:"Identifier",name:"slice"},computed:false}}]},"tagged-template-literal":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"ParenthesizedExpression",expression:{type:"FunctionExpression",id:null,params:[{type:"Identifier",name:"strings"},{type:"Identifier",name:"raw"}],defaults:[],rest:null,generator:false,body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"defineProperties"},computed:false},arguments:[{type:"Identifier",name:"strings"},{type:"ObjectExpression",properties:[{type:"Property",method:false,shorthand:false,computed:false,key:{type:"Identifier",name:"raw"},value:{type:"ObjectExpression",properties:[{type:"Property",method:false,shorthand:false,computed:false,key:{type:"Identifier",name:"value"},value:{type:"Identifier",name:"raw"},kind:"init"}]},kind:"init"}]}]}}]},expression:false}}}]},"to-array":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"ParenthesizedExpression",expression:{type:"FunctionExpression",id:null,params:[{type:"Identifier",name:"arr"}],defaults:[],rest:null,generator:false,body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"ConditionalExpression",test:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Array"},property:{type:"Identifier",name:"isArray"},computed:false},arguments:[{type:"Identifier",name:"arr"}]},consequent:{type:"Identifier",name:"arr"},alternate:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Array"},property:{type:"Identifier",name:"from"},computed:false},arguments:[{type:"Identifier",name:"arr"}]}}}]},expression:false}}}]},"umd-runner-body":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"ParenthesizedExpression",expression:{type:"FunctionExpression",id:null,params:[{type:"Identifier",name:"factory"}],defaults:[],rest:null,generator:false,body:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"LogicalExpression",left:{type:"BinaryExpression",left:{type:"UnaryExpression",operator:"typeof",prefix:true,argument:{type:"Identifier",name:"define"}},operator:"===",right:{type:"Literal",value:"function"}},operator:"&&",right:{type:"MemberExpression",object:{type:"Identifier",name:"define"},property:{type:"Identifier",name:"amd"},computed:false}},consequent:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"Identifier",name:"define"},arguments:[{type:"Identifier",name:"AMD_ARGUMENTS"},{type:"Identifier",name:"factory"}]}}]},alternate:{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"UnaryExpression",operator:"typeof",prefix:true,argument:{type:"Identifier",name:"exports"}},operator:"!==",right:{type:"Literal",value:"undefined"}},consequent:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"Identifier",name:"factory"},arguments:[{type:"Identifier",name:"exports"},{type:"Identifier",name:"COMMON_ARGUMENTS"}]}}]},alternate:null}}]},expression:false}}}]}}
},{}]},{},[1])(1)}); |
app/modules/header/style.js | donofkarma/react-starter | // import React from 'react';
import styled from 'styled-components';
import clearfix from 'styles/utilities/clearfix';
import { colors } from 'styles/tokens/color';
export const SiteHeader = styled.header`
${ clearfix }
padding: 10px;
background: ${ colors.grey.light };
`;
|
public/src/components/products/ProductRow.js | andy1992/react-redux-crud | import React from 'react';
import { Link } from 'react-router';
class ProductRow extends React.Component
{
constructor(props) {
super(props);
this.state = {
checked: this.props.checked
};
this.onChange = this.onChange.bind(this);
}
onChange(e) {
// TODO finish the checkbox checking methods
this.setState({
checked: e.target.checked
});
if(e.target.checked)
this.props.addSelectedProduct(this.props.product.id);
else
this.props.removeSelectedProduct(this.props.product.id);
}
componentWillReceiveProps(props) {
//console.log(props);
// You don't have to do this check first, but it can help prevent an unneeded render
if (props.checked !== this.state.checked) {
this.setState({ checked: props.checked });
}
}
render() {
const display = (this.props.isLoggedIn) ? '' : 'none';
return (
<tr>
{
(this.props.isLoggedIn)
?
<td>
<input type="checkbox"
className='checkboxes' onChange={this.onChange} checked={this.state.checked} />
</td>
: null
}
<td>{this.props.product.name}</td>
<td>{this.props.product.description}</td>
<td>${parseFloat(this.props.product.price).toFixed(2)}</td>
<td>{this.props.product.category_name}</td>
<td>
<Link to={'/view/' + this.props.product.id}
className="btn btn-info m-r-1em">
Read
</Link>
{
(this.props.isLoggedIn)
?
<Link to={'/product/edit/' + this.props.product.id}
className="btn btn-primary m-r-1em">
Edit
</Link>
: null
}
<button style={{display:display}} onClick={() => this.props.deleteSelected([this.props.product.id])} className="btn btn-danger">
Delete
</button>
</td>
</tr>
);
}
}
export default ProductRow; |
app/components/GameShow/AdditionalDetails.js | cdiezmoran/AlphaStage-2.0 | import React from 'react';
import { array, string } from 'prop-types';
import styles from './AdditionalDetails.scss';
import DetailsRow from './DetailsRow';
const AdditionalDetails = ({ languages, publisher, spaceRequired, website }) => (
<div className={styles.AdditionalDetails}>
<p className={styles.Title}>Additional Details</p>
<DetailsRow subtitle="Languages" values={languages || []} />
<DetailsRow subtitle="Publisher" values={[publisher]} />
<DetailsRow subtitle="Website" values={[website]} />
<DetailsRow subtitle="Space Required" values={[spaceRequired]} last />
</div>
);
AdditionalDetails.propTypes = {
languages: array,
publisher: string,
spaceRequired: string,
website: string
};
AdditionalDetails.defaultProps = {
languages: [],
publisher: '',
spaceRequired: '',
website: ''
};
export default AdditionalDetails;
|
docs/components/Grid/Examples/index.js | enjoylife/storybook | import React from 'react';
import PropTypes from 'prop-types';
import Grid from '../Grid';
import './style.css';
const Examples = ({ items }) =>
<div className="examples">
<div className="heading">
<h1>Storybook Examples</h1>
<a
className="edit-link"
href="https://github.com/storybooks/storybook/edit/master/docs/pages/examples/_examples.yml"
target="_blank"
rel="noopener noreferrer"
>
Edit this list
</a>
</div>
<Grid columnWidth={350} items={items} />
</div>;
Examples.propTypes = {
items: PropTypes.array, // eslint-disable-line react/forbid-prop-types
};
Examples.defaultProps = {
items: [],
};
export { Examples as default };
|
demo/2/2.js | nyakovenko/react-swiper | import React from 'react';
import ReactDom from 'react-dom';
import ReactDomServer from 'react-dom/server';
import Swiper from '../../dist/react-swiper';
const App = React.createClass({
render() {
var config = {
slidesPerView: 1,
paginationClickable: true,
spaceBetween: 30,
loop: true
};
return (
<div id="demo-slides-per-view" className="demo-wrapper">
<Swiper swiperConfig={ config }>
<img src="http://placehold.it/1000x400&text=slide1"/>
<img src="http://placehold.it/1000x400&text=slide2"/>
<img src="http://placehold.it/1000x400&text=slide3"/>
<img src="http://placehold.it/1000x400&text=slide4"/>
<img src="http://placehold.it/1000x400&text=slide5"/>
<img src="http://placehold.it/1000x400&text=slide6"/>
<img src="http://placehold.it/1000x400&text=slide7"/>
<img src="http://placehold.it/1000x400&text=slide8"/>
<img src="http://placehold.it/1000x400&text=slide9"/>
<img src="http://placehold.it/1000x400&text=slide10"/>
</Swiper>
</div>
)
}
});
const content = document.getElementById('content');
ReactDom.render(<App/>, content);
|
ajax/libs/material-ui/5.0.0-alpha.18/styles/useTheme.js | cdnjs/cdnjs | import { useTheme as useThemeWithoutDefault } from '@material-ui/styles';
import React from 'react';
import defaultTheme from './defaultTheme';
export default function useTheme() {
const theme = useThemeWithoutDefault() || defaultTheme;
if (process.env.NODE_ENV !== 'production') {
// eslint-disable-next-line react-hooks/rules-of-hooks
React.useDebugValue(theme);
}
return theme;
} |
app/containers/HomePage.js | SimpleWeek/desktop-tray-app | import React, { Component } from 'react';
import Home from '../components/Home';
export default class HomePage extends Component {
render() {
return (
<Home />
);
}
}
|
src/server.js | Romsters/react-redux-universal-hot-example | import Express from 'express';
import React from 'react';
import Location from 'react-router/lib/Location';
import config from './config';
import favicon from 'serve-favicon';
import compression from 'compression';
import httpProxy from 'http-proxy';
import path from 'path';
import createStore from './redux/create';
import ApiClient from './helpers/ApiClient';
import universalRouter from './helpers/universalRouter';
import Html from './helpers/Html';
import PrettyError from 'pretty-error';
const pretty = new PrettyError();
const app = new Express();
const proxy = httpProxy.createProxyServer({
target: 'http://localhost:' + config.apiPort
});
app.use(compression());
app.use(favicon(path.join(__dirname, '..', 'static', 'favicon.ico')));
app.use(require('serve-static')(path.join(__dirname, '..', 'static')));
// Proxy to API server
app.use('/api', (req, res) => {
proxy.web(req, res);
});
// added the error handling to avoid https://github.com/nodejitsu/node-http-proxy/issues/527
proxy.on('error', (error, req, res) => {
let json;
console.log('proxy error', error);
if (!res.headersSent) {
res.writeHead(500, {'content-type': 'application/json'});
}
json = { error: 'proxy_error', reason: error.message };
res.end(JSON.stringify(json));
});
app.use((req, res) => {
if (__DEVELOPMENT__) {
// Do not cache webpack stats: the script file would change since
// hot module replacement is enabled in the development env
webpackIsomorphicTools.refresh();
}
const client = new ApiClient(req);
const store = createStore(client);
const location = new Location(req.path, req.query);
const hydrateOnClient = function() {
res.send('<!doctype html>\n' +
React.renderToString(<Html assets={webpackIsomorphicTools.assets()} component={<div/>} store={store}/>));
}
if (__DISABLE_SSR__) {
hydrateOnClient();
return;
} else {
universalRouter(location, undefined, store)
.then(({component, transition, isRedirect}) => {
if (isRedirect) {
res.redirect(transition.redirectInfo.pathname);
return;
}
res.send('<!doctype html>\n' +
React.renderToString(<Html assets={webpackIsomorphicTools.assets()} component={component} store={store}/>));
})
.catch((error) => {
if (error.redirect) {
res.redirect(error.redirect);
return;
}
console.error('ROUTER ERROR:', pretty.render(error));
hydrateOnClient(); // let client render error page or re-request data
});
}
});
if (config.port) {
app.listen(config.port, (err) => {
if (err) {
console.error(err);
}
console.info('----\n==> ✅ %s is running, talking to API server on %s.', config.app.name, config.apiPort);
console.info('==> 💻 Open http://localhost:%s in a browser to view the app.', config.port);
});
} else {
console.error('==> ERROR: No PORT environment variable has been specified');
}
|
src/components/cards/Location.js | Cheffheid/ghibli-react | import React from 'react';
import { Link } from 'react-router-dom'
class Location extends React.Component {
render() {
return (
<li className="location">
<h2>
<Link to={`/location/${this.props.data.id}`}>
{this.props.data.name}
</Link>
</h2>
<p class="meta">
{this.props.data.climate}, {this.props.data.terrain}
</p>
</li>
)
}
}
export default Location;
|
modules/Print/NavLink.js | corbmanj/tote | // modules/NavLink.js
import React from 'react'
import { Link } from 'react-router'
export default function NavLink (props) {
return <Link {...props} activeClassName="active"/>
}
|
examples/counter/index.js | andrew-codes/redux | import React from 'react';
import App from './containers/App';
React.render(
<App />,
document.getElementById('root')
);
|
src/isomorphic/classic/element/ReactElementValidator.js | guoshencheng/react | /**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactElementValidator
*/
/**
* ReactElementValidator provides a wrapper around a element factory
* which validates the props passed to the element. This is intended to be
* used only in DEV and could be replaced by a static type checker for languages
* that support it.
*/
'use strict';
var ReactElement = require('ReactElement');
var ReactFragment = require('ReactFragment');
var ReactPropTypeLocations = require('ReactPropTypeLocations');
var ReactPropTypeLocationNames = require('ReactPropTypeLocationNames');
var ReactCurrentOwner = require('ReactCurrentOwner');
var getIteratorFn = require('getIteratorFn');
var invariant = require('invariant');
var warning = require('warning');
function getDeclarationErrorAddendum() {
if (ReactCurrentOwner.current) {
var name = ReactCurrentOwner.current.getName();
if (name) {
return ' Check the render method of `' + name + '`.';
}
}
return '';
}
/**
* Warn if there's no key explicitly set on dynamic arrays of children or
* object keys are not valid. This allows us to keep track of children between
* updates.
*/
var ownerHasKeyUseWarning = {};
var loggedTypeFailures = {};
var NUMERIC_PROPERTY_REGEX = /^\d+$/;
/**
* Gets the instance's name for use in warnings.
*
* @internal
* @return {?string} Display name or undefined
*/
function getName(instance) {
var publicInstance = instance && instance.getPublicInstance();
if (!publicInstance) {
return undefined;
}
var constructor = publicInstance.constructor;
if (!constructor) {
return undefined;
}
return constructor.displayName || constructor.name || undefined;
}
/**
* Gets the current owner's displayName for use in warnings.
*
* @internal
* @return {?string} Display name or undefined
*/
function getCurrentOwnerDisplayName() {
var current = ReactCurrentOwner.current;
return (
current && getName(current) || undefined
);
}
/**
* Warn if the element doesn't have an explicit key assigned to it.
* This element is in an array. The array could grow and shrink or be
* reordered. All children that haven't already been validated are required to
* have a "key" property assigned to it.
*
* @internal
* @param {ReactElement} element Element that requires a key.
* @param {*} parentType element's parent's type.
*/
function validateExplicitKey(element, parentType) {
if (element._store.validated || element.key != null) {
return;
}
element._store.validated = true;
var addenda = getAddendaForKeyUse('uniqueKey', element, parentType);
if (addenda === null) {
// we already showed the warning
return;
}
warning(
false,
'Each child in an array or iterator should have a unique "key" prop.' +
'%s%s%s',
addenda.parentOrOwner || '',
addenda.childOwner || '',
addenda.url || ''
);
}
/**
* Warn if the key is being defined as an object property but has an incorrect
* value.
*
* @internal
* @param {string} name Property name of the key.
* @param {ReactElement} element Component that requires a key.
* @param {*} parentType element's parent's type.
*/
function validatePropertyKey(name, element, parentType) {
if (!NUMERIC_PROPERTY_REGEX.test(name)) {
return;
}
var addenda = getAddendaForKeyUse('numericKeys', element, parentType);
if (addenda === null) {
// we already showed the warning
return;
}
warning(
false,
'Child objects should have non-numeric keys so ordering is preserved.' +
'%s%s%s',
addenda.parentOrOwner || '',
addenda.childOwner || '',
addenda.url || ''
);
}
/**
* Shared warning and monitoring code for the key warnings.
*
* @internal
* @param {string} messageType A key used for de-duping warnings.
* @param {ReactElement} element Component that requires a key.
* @param {*} parentType element's parent's type.
* @returns {?object} A set of addenda to use in the warning message, or null
* if the warning has already been shown before (and shouldn't be shown again).
*/
function getAddendaForKeyUse(messageType, element, parentType) {
var ownerName = getCurrentOwnerDisplayName();
var parentName = typeof parentType === 'string' ?
parentType : parentType.displayName || parentType.name;
var useName = ownerName || parentName;
var memoizer = ownerHasKeyUseWarning[messageType] || (
ownerHasKeyUseWarning[messageType] = {}
);
if (memoizer[useName]) {
return null;
}
memoizer[useName] = true;
var addenda = {
parentOrOwner:
ownerName ? ` Check the render method of ${ownerName}.` :
parentName ? ` Check the React.render call using <${parentName}>.` :
null,
url: ' See https://fb.me/react-warning-keys for more information.',
childOwner: null,
};
// Usually the current owner is the offender, but if it accepts children as a
// property, it may be the creator of the child that's responsible for
// assigning it a key.
if (element &&
element._owner &&
element._owner !== ReactCurrentOwner.current) {
// Give the component that originally created this child.
addenda.childOwner =
` It was passed a child from ${getName(element._owner)}.`;
}
return addenda;
}
/**
* Ensure that every element either is passed in a static location, in an
* array with an explicit keys property defined, or in an object literal
* with valid key property.
*
* @internal
* @param {ReactNode} node Statically passed child of any type.
* @param {*} parentType node's parent's type.
*/
function validateChildKeys(node, parentType) {
if (Array.isArray(node)) {
for (var i = 0; i < node.length; i++) {
var child = node[i];
if (ReactElement.isValidElement(child)) {
validateExplicitKey(child, parentType);
}
}
} else if (ReactElement.isValidElement(node)) {
// This element was passed in a valid location.
node._store.validated = true;
} else if (node) {
var iteratorFn = getIteratorFn(node);
// Entry iterators provide implicit keys.
if (iteratorFn) {
if (iteratorFn !== node.entries) {
var iterator = iteratorFn.call(node);
var step;
while (!(step = iterator.next()).done) {
if (ReactElement.isValidElement(step.value)) {
validateExplicitKey(step.value, parentType);
}
}
}
} else if (typeof node === 'object') {
var fragment = ReactFragment.extractIfFragment(node);
for (var key in fragment) {
if (fragment.hasOwnProperty(key)) {
validatePropertyKey(key, fragment[key], parentType);
}
}
}
}
}
/**
* Assert that the props are valid
*
* @param {string} componentName Name of the component for error messages.
* @param {object} propTypes Map of prop name to a ReactPropType
* @param {object} props
* @param {string} location e.g. "prop", "context", "child context"
* @private
*/
function checkPropTypes(componentName, propTypes, props, location) {
for (var propName in propTypes) {
if (propTypes.hasOwnProperty(propName)) {
var error;
// Prop type validation may throw. In case they do, we don't want to
// fail the render phase where it didn't fail before. So we log it.
// After these have been cleaned up, we'll let them throw.
try {
// This is intentionally an invariant that gets caught. It's the same
// behavior as without this statement except with a better message.
invariant(
typeof propTypes[propName] === 'function',
'%s: %s type `%s` is invalid; it must be a function, usually from ' +
'React.PropTypes.',
componentName || 'React class',
ReactPropTypeLocationNames[location],
propName
);
error = propTypes[propName](props, propName, componentName, location);
} catch (ex) {
error = ex;
}
warning(
!error || error instanceof Error,
'%s: type specification of %s `%s` is invalid; the type checker ' +
'function must return `null` or an `Error` but returned a %s. ' +
'You may have forgotten to pass an argument to the type checker ' +
'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
'shape all require an argument).',
componentName || 'React class',
ReactPropTypeLocationNames[location],
propName,
typeof error
);
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
// Only monitor this failure once because there tends to be a lot of the
// same error.
loggedTypeFailures[error.message] = true;
var addendum = getDeclarationErrorAddendum();
warning(false, 'Failed propType: %s%s', error.message, addendum);
}
}
}
}
/**
* Given an element, validate that its props follow the propTypes definition,
* provided by the type.
*
* @param {ReactElement} element
*/
function validatePropTypes(element) {
var componentClass = element.type;
if (typeof componentClass !== 'function') {
return;
}
var name = componentClass.displayName || componentClass.name;
if (componentClass.propTypes) {
checkPropTypes(
name,
componentClass.propTypes,
element.props,
ReactPropTypeLocations.prop
);
}
if (typeof componentClass.getDefaultProps === 'function') {
warning(
componentClass.getDefaultProps.isReactClassApproved,
'getDefaultProps is only used on classic React.createClass ' +
'definitions. Use a static property named `defaultProps` instead.'
);
}
}
var ReactElementValidator = {
createElement: function(type, props, children) {
// We warn in this case but don't throw. We expect the element creation to
// succeed and there will likely be errors in render.
warning(typeof type === 'string' || typeof type === 'function',
'React.createElement: type should not be null, undefined, boolean, or ' +
'number. It should be a string (for DOM elements) or a ReactClass ' +
'(for composite components).%s',
getDeclarationErrorAddendum()
);
var element = ReactElement.createElement.apply(this, arguments);
// The result can be nullish if a mock or a custom function is used.
// TODO: Drop this when these are no longer allowed as the type argument.
if (element == null) {
return element;
}
for (var i = 2; i < arguments.length; i++) {
validateChildKeys(arguments[i], type);
}
validatePropTypes(element);
return element;
},
createFactory: function(type) {
var validatedFactory = ReactElementValidator.createElement.bind(
null,
type
);
// Legacy hook TODO: Warn if this is accessed
validatedFactory.type = type;
if (__DEV__) {
try {
Object.defineProperty(
validatedFactory,
'type',
{
enumerable: false,
get: function() {
warning(
false,
'Factory.type is deprecated. Access the class directly ' +
'before passing it to createFactory.'
);
Object.defineProperty(this, 'type', {
value: type,
});
return type;
},
}
);
} catch (x) {
// IE will fail on defineProperty (es5-shim/sham too)
}
}
return validatedFactory;
},
cloneElement: function(element, props, children) {
var newElement = ReactElement.cloneElement.apply(this, arguments);
for (var i = 2; i < arguments.length; i++) {
validateChildKeys(arguments[i], newElement.type);
}
validatePropTypes(newElement);
return newElement;
},
};
module.exports = ReactElementValidator;
|
project/src/scenes/Admin/Settings/SettingForm.js | strues/boldr | // @flow
import React from 'react';
import Form, { FormField, Control, Input, Label } from '@boldr/ui/Form';
type Props = {
id: number,
value: any,
};
type State = {
value: any,
};
class SettingForm extends React.Component<Props, State> {
state = { value: this.props.value };
props: Props;
handleChange = event => {
this.setState({ value: event.target.value });
};
handleSubmit = event => {
const payload = {
id: this.props.id,
value: this.state.value,
};
console.log(payload);
// this.props.dispatch(updateBoldrSettings(payload));
event.preventDefault();
};
render() {
return (
<Form>
<FormField>
<Label>{this.props.label}</Label>
<Control>
<Input
type="text"
placeholder="Text Input"
value={this.state.value}
onChange={this.handleChange}
/>
</Control>
</FormField>
</Form>
);
}
}
export default SettingForm;
|
src/js/components/Box/stories/Border.js | grommet/grommet | import React from 'react';
import { Box, Text } from 'grommet';
export const BorderBox = () => (
// Uncomment <Grommet> lines when using outside of storybook
// <Grommet theme={...}>
<Box pad="small" gap="small" align="start">
<Box pad="small" border>
true
</Box>
<Box direction="row-responsive" gap="small">
{['horizontal', 'vertical', 'left', 'top', 'right', 'bottom'].map(
(border) => (
<Box key={border} pad="small" border={border}>
{border}
</Box>
),
)}
</Box>
<Box direction="row-responsive" gap="small" align="start">
<Box
pad="small"
border={[
{ size: 'medium', style: 'dotted', side: 'top' },
{
size: 'medium',
style: 'double',
side: 'vertical',
},
]}
>
custom top & vertical borders
</Box>
</Box>
<Box pad="small" border={{ color: 'brand' }}>
color
</Box>
<Box direction="row-responsive" gap="small" align="start">
{['small', 'medium', 'large'].map((size) => (
<Box key={size} pad="small" border={{ size }}>
{size}
</Box>
))}
</Box>
<Box direction="row-responsive" gap="small" align="start">
{['small', 'medium', 'large'].map((size) => (
<Box key={size} pad="small" responsive={false} border={{ size }}>
{size}
</Box>
))}
</Box>
<Box direction="row-responsive" gap="small" align="start">
{[
'solid',
'dashed',
'dotted',
'double',
'groove',
'ridge',
'inset',
'outset',
].map((type) => (
<Box key={type} pad="small" border={{ size: 'medium', style: type }}>
{type}
</Box>
))}
</Box>
<Box direction="row-responsive" gap="large" align="center">
{['column', 'row', 'row-responsive'].map((direction) => (
<Box
key={direction}
direction={direction}
gap="large"
border={{ side: 'between', size: 'large' }}
>
<Text>between</Text>
<Text>{direction}</Text>
</Box>
))}
</Box>
</Box>
// </Grommet>
);
BorderBox.storyName = 'Border';
export default {
title: 'Layout/Box/Border',
};
|
webapp/src/NewGame.js | erwannT/go-dart | import React, { Component } from 'react';
import NewGameButton from './NewGameButton'
import logo from './logo.svg';
class NewGame extends Component {
constructor(props) {
super(props)
this.state = {
flavors: []
}
}
componentDidMount() {
console.log("fetching flavors")
fetch('/api/styles')
.then((response) => response.json())
.then((json) => this.setState({ flavors: json.styles }))
.catch((error) => console.log(error))
$(this._collapsible).collapsible({
accordion: false // A setting that changes the collapsible behavior to expandable instead of the default accordion style
});
}
render() {
return (
<div>
<div className="row">
<h2><img src={logo} style={{'vertical-align': 'middle'}} className="App-logo" alt="logo" /><span style={{'vertical-align': 'middle'}} >Select flavor</span></h2>
</div>
<div className="row">
<ul className="collapsible popout" data-collapsible="accordion" ref={(ref) => this._collapsible = ref}>
{ this.state.flavors.map((flavor) => <NewGameButton key={flavor.Code} flavor={flavor}/>) }
</ul>
</div>
</div>
);
}
}
export default NewGame; |
dist/build/bundle.js | Hive-Team/venus | !function e(t,n,a){function r(i,s){if(!n[i]){if(!t[i]){var l="function"==typeof require&&require;if(!s&&l)return l(i,!0);if(o)return o(i,!0);throw new Error("Cannot find module '"+i+"'")}var c=n[i]={exports:{}};t[i][0].call(c.exports,function(e){var n=t[i][1][e];return r(n?n:e)},c,c.exports,e,t,n,a)}return n[i].exports}for(var o="function"==typeof require&&require,i=0;i<a.length;i++)r(a[i]);return r}({1:[function(e,t,n){"use strict";var a=e("react"),r=e("react-router-ie8"),o=e("./config/routes.js");r.run(o,function(e){a.render(a.createElement(e,null),$("#JPage")[0])})},{"./config/routes.js":67,react:263,"react-router-ie8":100}],2:[function(e,t,n){"use strict";var a=e("react"),r=(a.PropTypes,a.createClass({displayName:"AboutUs",render:function(){return a.createElement("div",{className:"with-us-box container",id:"AboutUs"},a.createElement("div",{className:"responsive-box mgb50 clearfix"},a.createElement("div",{className:"left-box mgr40"},a.createElement("h1",null,"金色百年"),a.createElement("div",{className:"line-1"}),a.createElement("div",{className:"intr"},a.createElement("span",null,"时尚"),a.createElement("b",null,"·"),a.createElement("span",null,"个性"),a.createElement("b",null,"·"),a.createElement("span",null,"品质"))),a.createElement("div",{className:"right-box"},a.createElement("a",{className:"img-box",href:"http://www.jsbn.com"},a.createElement("img",{src:"http://image.jsbn.com/static/top.jpg"})))),a.createElement("div",{className:"with-us-box responsive-box clearfix"},a.createElement("div",{className:"title-8-js"},a.createElement("h1",null,"金色百年")),a.createElement("ul",{className:"list-1-js list-1-2-js mgb50 clearfix"},a.createElement("li",{className:"column-mg20-8 mgr30"},a.createElement("a",{className:"img-box",href:"http://www.jsbn.com"},a.createElement("img",{src:"http://image.jsbn.com/static/left.png"})),a.createElement("div",{className:"title"},a.createElement("span",null,"GOLDEN WEDDING"),a.createElement("span",{className:"en"},"公司简介")),a.createElement("p",null,"金色百年婚礼服务集团是以全新的服务理念、优化的业务模式,为婚礼提供全流程高品质服务的专业性集团公司。其前身为重庆金色百年婚礼策划有限公司,是重庆极具知名度和美誉度的婚庆品牌,每年为上千对新人策划并执行了浪漫、幸福、完美的婚礼庆典。")),a.createElement("li",{className:"column-mg20-8 mgr30"},a.createElement("a",{className:"img-box",href:"http://www.jsbn.com"},a.createElement("img",{src:"http://image.jsbn.com/static/mid.png"})),a.createElement("div",{className:"title"},a.createElement("span",null,"GOLDEN WEDDING"),a.createElement("span",{className:"en"},"服务范围")),a.createElement("p",null,"我们在见证每一对新人幸福的同时,也感到无比的甜蜜和骄傲,但同时也深感歉意,因为在新人完整的婚礼筹备过程中,我们只能提供到有限的帮助和服务。大部分新人在整个婚礼过程中,都会涉及到婚纱摄影、婚戒钻石、婚宴预订、婚庆定制、婚纱礼服、婚礼用品、婚礼租车、婚礼微电影等服务与商品的购买,由于目前婚礼产业链上各商家的分散且行业服务水平整体不高,让新人本该愉悦、浪漫、幸福的婚礼旅程,时常会感到纠结、困惑、疲惫。 我们下决心要为新人提供更多更优质的服务,让婚礼变得更加时尚、浪漫、充满个性,让新人在整个婚礼旅程中感受到轻松、愉悦、幸福,在提供高品质服务的同时,还要做到消费透明和高性价比。为此,我们云集业内各专业人士组成多个专业团队,在经营模式、服务流程、资源整合等方面,积极开拓创新。")),a.createElement("li",{className:"column-mg20-8 last"},a.createElement("a",{className:"img-box",href:"http://www.jsbn.com"},a.createElement("img",{src:"http://image.jsbn.com/static/right.png"})),a.createElement("div",{className:"title"},a.createElement("span",null,"GOLDEN WEDDING"),a.createElement("span",{className:"en"},"服务团队")),a.createElement("p",null,"经一年的筹备,金色百年婚礼服务集团诞生了,我们的使命就是为婚礼提供全流程优质服务,让婚礼更加时尚、个性、高品质,也让新人更加轻松、愉悦、幸福。 为保证服务品质,我们目前暂时先开通婚纱摄影、婚庆定制线下服务和部分线上服务,其它服务项目及在线功能,将在9-10月逐步开通,敬请期待。谢谢!"))),a.createElement("div",{className:"title-8-js mgb20",id:"ContactUs"},a.createElement("h1",null,"联系我们")),a.createElement("div",{className:"map-box mgb50"},a.createElement("a",{className:"img-box",href:"http://www.jsbn.com"},a.createElement("img",{src:"http://image.jsbn.com/static/map.jpg"}))),a.createElement("div",{className:"phone-addr-box mgb30"},a.createElement("p",null,"联系电话: 400-015-9999"),a.createElement("p",null,"体验馆:重庆市渝北区龙山街道龙华大道66号北城国际中心"),a.createElement("p",null,"摄影基地:重庆市九龙坡区九滨路9号“九龙滨江”商业广场"))))}}));t.exports=r},{react:263}],3:[function(e,t,n){"use strict";var a=e("react"),r=e("../config/api.js"),o=e("react-router-ie8"),i=(a.PropTypes,e("./image-item.js")),s=(a.createClass({displayName:"PriceTag",render:function(){var e=this.state.payload.length>0&&this.state.payload[0];e.imageList||[],e.serviceList||[];return a.createElement("div",null,a.createElement("div",{className:"title-9-js mgb20"},a.createElement("h1",null,"价格")),a.createElement("div",{className:"theme-content mgb40 clearfix"},a.createElement("div",{className:"all-price"},a.createElement("span",{className:"pink-1-js"},"¥"),a.createElement("b",{className:"pink-1-js"},parseFloat(e.totalPrice).toFixed(2))),a.createElement("div",{className:"price-box"},a.createElement("p",{className:"price-detail first"},a.createElement("span",null,"场景布置费用:"),a.createElement("em",null,"¥"),a.createElement("b",null,parseFloat(e.sceneCost).toFixed(2))),a.createElement("p",{className:"price-detail"},a.createElement("span",null,"婚礼人费用:"),a.createElement("em",null,"¥"),a.createElement("b",null,parseFloat(e.hdpcCost).toFixed(2))))))}}),a.createClass({displayName:"CaseDetail",mixins:[o.State],getInitialState:function(){return{payload:[]}},componentDidUpdate:function(e,t){$("#slider_case_detail").Slider({type:"Horizontal"})},componentDidMount:function(){var e=this,t=function(e){$(document.body).trigger("ModuleChanged",["#/scheme"])},n=function(){var t=e.getPath();return r.httpGET(t,{})};window.Core&&window.Core.promises["/"]&&$.when(window.Core.promises["/"]).then(t),n().done(function(t){200===t.code&&t.data&&e.setState({payload:t.data})})},render:function(){var e=this.state.payload.length>0&&this.state.payload[0],t=e.imageList||[],n=e.serviceList||[],r={"":"",1:"主持人",2:"化妆师",3:"摄影师",4:"摄像师"},o="",s=e.standardWedding||"";return $.each(s.split(","),function(e,t){o+=" "+r[t]}),a.createElement("div",{className:"container"},a.createElement("div",{className:"case-detail-banner responsive-box mgb30",id:"slider_case_detail"},a.createElement("div",{className:"title-4-js mgb30",style:{display:"none"}},a.createElement("h1",null,"婚礼案例"),a.createElement("div",{className:"line-middle"})),a.createElement("div",{className:"slider-box-1-js mgb20"},a.createElement("div",{className:"btn-collection"},a.createElement("div",{className:"pos-box"},a.createElement("i",null,"S"),a.createElement("span",{className:"text"},"设为我的样本"),a.createElement("div",{className:"mask-bg"}))),a.createElement("div",{className:"kpxq-img-box"},a.createElement("div",{className:"lef-hover-box btn-prev"},a.createElement("div",{className:"pos-box"},a.createElement("i",{className:"ico-15-js ico-15-lef-js"}))),a.createElement("div",{className:"rig-hover-box btn-next"},a.createElement("div",{className:"pos-box"},a.createElement("i",{className:"ico-15-js ico-15-rig-js"}))),a.createElement("img",{className:"big-img",src:"http://placehold.it/1200x800"}))),a.createElement("div",{className:"gray-box gray-box-2 container"},a.createElement("div",{className:"small-img-box"},a.createElement("ul",{className:"item-box-2 clearfix"},t.length&&$.map(t,function(e,t){return a.createElement("li",{className:"item transition-margin",key:t,"data-big-img-url":"dev"===window.Core.mode?e.contentUrl:e.contentUrl+"@800h_1e_1c_0i_1o_90q_1x"},a.createElement(i,{sid:e.contentId,frameWidth:150,frameHeight:100,url:e.contentUrl,errorUrl:"http://placehold.it/150x100"}))}))),a.createElement("div",{className:"title-box transition-width"},a.createElement("div",{className:"title"},a.createElement("h1",null,e.schemeTheme))))),a.createElement("div",{className:"case-detail-box responsive-box clearfix"},a.createElement("div",{className:"left-box"},a.createElement("div",{className:"intr-box"},a.createElement("p",null,e.schemeDesc))),a.createElement("div",{className:"right-box"},a.createElement("div",{className:"line-left"}),a.createElement("div",{className:"title-9-js mgb20",style:{visibility:"hidden"}},a.createElement("h1",null,"主题属性"),a.createElement("a",{className:"btn-more transition-bg"},"查看相近风格婚礼")),a.createElement("div",{className:"theme-content mgb40 clearfix"},a.createElement("div",{className:"type-box"},a.createElement("span",null,"主题:"),a.createElement("p",null,e.schemeTheme)),a.createElement("div",{className:"type-box"},a.createElement("span",null,"风格:"),a.createElement("p",null,e.weddingCaseStyleName||"默认风格")),a.createElement("div",{className:"type-box"},a.createElement("span",null,"色系:"),a.createElement("p",null,e.schemeColor||"默认色系"),a.createElement("i",{className:"violet-bg-1-js"}),a.createElement("i",{className:"golden-bg-1-js"}))),a.createElement("div",{className:"title-9-js mgb20"},a.createElement("h1",null,"场地信息")),a.createElement("div",{className:"theme-content mgb40 clearfix"},a.createElement("p",{className:"addr-info mgb20"},"于"+e.weddingDate+(e.hotelName&&""!==e.hotelName&&e.banquetHallName&&""!==e.banquetHallName?"在"+e.hotelName+e.banquetHallName+"举办.":"在金色百年举办")),a.createElement("div",{className:"label-box clearfix",style:{display:"none"}},n.length>0&&$.map(n,function(e,t){return a.createElement("span",{key:t,className:!e.isUsed&&"unprovide"},e.serviceName)}))),0!==parseInt(e.totalPrice)&&a.createElement("div",null,a.createElement("div",{className:"title-9-js mgb20"},a.createElement("h1",null,"价格")),a.createElement("div",{className:"theme-content mgb40 clearfix"},a.createElement("div",{className:"all-price price-alxq"},a.createElement("span",{className:"words pink-1-js"},"折后价:"),a.createElement("span",{className:"pink-1-js"},"¥"),a.createElement("b",{className:"pink-1-js"},parseFloat(e.totalPrice).toFixed(2)),a.createElement("span",{className:"del-words"},"原价: ¥"),a.createElement("span",{className:"del-price"},parseFloat(e.originalPrice).toFixed(2))),a.createElement("div",{className:"price-box"},a.createElement("p",{className:"price-detail first"},a.createElement("span",null,"场景布置费用:"),a.createElement("em",null,"¥"),a.createElement("b",null,parseFloat(e.sceneCost).toFixed(2))),a.createElement("p",{className:"price-detail"},a.createElement("span",null,""===$.trim(o)?"婚礼人费用:":"婚礼人("+o+") 费用:"),a.createElement("em",null,"¥"),a.createElement("b",null,parseFloat(e.hdpcCost).toFixed(2)))))))))}}));t.exports=s},{"../config/api.js":65,"./image-item.js":21,react:263,"react-router-ie8":100}],4:[function(e,t,n){"use strict";var a=e("react"),r=e("../config/api.js"),o=e("./image-item.js"),i=a.createClass({displayName:"CaseList",getInitialState:function(){return{payload:[],baseUrl:"",totalPage:0}},componentWillReceiveProps:function(e){var t=this,n=function(e,t){return r.httpGET(e,t)},a={pageSize:e.pageSize,pageIndex:e.pageIndex};e.currentCate&&""!==e.currentCate&&(a.schemeType=e.currentCate),e.currentStyle&&""!==e.currentStyle&&(a.styleId=e.currentStyle),e.currentHotel&&""!==e.currentHotel&&(a.hotelId=e.currentHotel),e.currentPrice.max&&""!==e.currentPrice.max&&(a.maxPrice=e.currentPrice.max),e.currentPrice.min&&""!==e.currentPrice.min&&(a.minPrice=e.currentPrice.min),$.each(e.resourceLinks,function(r,o){e.tplKey.indexOf(o.split("/")[0])>-1&&n(o.split("#")[1],a).done(function(n){200===n.code&&t.setState({payload:1===e.pageIndex?n.data:t.state.payload.concat(n.data),baseUrl:o.split("#")[1],totalPage:parseInt(n.totalCount)},function(){parseInt(n.totalCount)<=parseInt(e.pageIndex)*parseInt(e.pageSize)?$("#J_MoreButton").hide():$("#J_MoreButton").show()}),console.log(n)})})},render:function(){var e=this.state.baseUrl;return a.createElement("div",{className:"case-list"},a.createElement("div",{className:"screening-results screening-results-1 mgb30 clearfix"},a.createElement("span",{className:"number"},"找到案例",a.createElement("b",null,this.state.totalPage),"套")),a.createElement("ul",{className:"list-2-js clearfix"},this.state.payload.map(function(t,n){return a.createElement("li",{className:"column-mg20-8 mgr30 mgb30",key:n},a.createElement("a",{className:"hover-box transition-opacity",href:"#/"+e+"/"+t.weddingCaseId},a.createElement("div",{className:"pos-box"},a.createElement("h3",null,t.schemeName),a.createElement("div",{className:"etc-info"},a.createElement("b",null,t.price||""),a.createElement("span",null,"(",t.weddingDate,")")),a.createElement("div",{className:"mask-bg"}))),a.createElement(o,{sid:t.weddingCaseId+"",frameWidth:380,frameHeight:250,url:t.weddingCaseImage,detailUrl:t.detailUrl,errorUrl:"http://placehold.it/380x250",detailBaseUrl:e}))})))}});t.exports=i},{"../config/api.js":65,"./image-item.js":21,react:263}],5:[function(e,t,n){"use strict";var a=e("react"),r=e("../config/api.js"),o=e("react-router-ie8"),i=(e("../config/SKMap.js"),e("./top-slider.js")),s=e("./cases-list.js"),l=a.createClass({displayName:"Cases",mixins:[o.State],getInitialState:function(){return{resourceLinks:{},pageSize:9,pageIndex:1,currentCate:1,currentStyle:"",currentHotel:"",currentPrice:{min:"",max:""},categoryFilter:[],styleFilter:[],hotelFilter:[],priceFilter:[]}},componentDidMount:function(){var e=this,t=function(e){$(document.body).trigger("ModuleChanged",["#/scheme"])},n=function(t){var n=window.Core.getResourcesLinks(e.getPathname(),"#/scheme");n&&e.setState({resourceLinks:n})},a=function(t){e.setState({categoryFilter:[{name:"实景案例",schemeType:1,selected:!0}],pageIndex:1})},o=function(e){return r.httpGET("scheme/styles",{})},i=function(e){return r.httpGET("hotel/all",{})},s=function(t){e.setState({priceFilter:[{name:"6,000-9,000",minPrice:6e3,maxPrice:9e3},{name:"9,000-12,000",minPrice:9e3,maxPrice:12e3},{name:"12,000-15,000",minPrice:12e3,maxPrice:15e3},{name:"15,000-20,000",minPrice:15e3,maxPrice:2e4},{name:"20,000-25,000",minPrice:2e4,maxPrice:25e3},{name:"25,000-30,000",minPrice:25e3,maxPrice:3e4},{name:"30,000-40,000",minPrice:3e4,maxPrice:4e4},{name:"40,000-50,000",minPrice:4e4,maxPrice:5e4},{name:"50,000-80,000",minPrice:5e4,maxPrice:8e4}]})};window.Core&&window.Core.promises["/"]&&$.when(window.Core.promises["/"]).then(t).then(n).then(a).then(s),$.when(o()).done(function(t){e.setState({styleFilter:t.data})}),$.when(i()).done(function(t){e.setState({hotelFilter:t.data})})},loadMore:function(e){e.preventDefault(),this.setState(function(e,t){return{pageIndex:e.pageIndex+1}})},filterCategory:function(e){var t=this;"SPAN"===e.target.tagName&&($(e.target).addClass("card-sel"),$(e.target).siblings().removeClass("card-sel"),t.setState({currentCate:$(e.target).attr("data-scheme-type"),pageIndex:1}))},filterFun:function(e){var t=this;"SPAN"===e.target.tagName&&$(e.target).hasClass("card")&&"J_CardStyle"===$(e.target).parent("div").attr("id")?($(".J_FilterCtrl .card").removeClass("card-sel"),$(e.target).toggleClass("card-sel"),($(e.target).attr("data-style-id")!==t.state.currentStyle||""===t.state.currentStyle)&&t.setState({currentStyle:$(e.target).attr("data-style-id"),pageIndex:1,currentPrice:{min:"",max:""}})):"SPAN"===e.target.tagName&&$(e.target).hasClass("card")&&"J_CardPrice"===$(e.target).parent("div").attr("id")&&($(".J_FilterCtrl .card").removeClass("card-sel"),$(e.target).toggleClass("card-sel"),($(e.target).attr("data-price-min")!==t.state.currentPrice.min||""===t.state.currentPrice.min)&&t.setState({currentStyle:"",currentPrice:{min:$(e.target).attr("data-price-min"),max:$(e.target).attr("data-price-max")},pageIndex:1}))},filterStyle:function(e){var t=this;"SPAN"===e.target.tagName&&($(e.target).toggleClass("card-sel"),$(e.target).siblings().removeClass("card-sel"),t.setState({currentStyle:$(e.target).attr("data-style-id")===t.state.currentStyle?"":$(e.target).attr("data-style-id"),pageIndex:1}))},filterHotel:function(e){var t=this;"SPAN"===e.target.tagName&&($(e.target).toggleClass("card-sel"),$(e.target).siblings().removeClass("card-sel"),t.setState({currentHotel:$(e.target).attr("data-hotel-id")===t.state.currentHotel?"":$(e.target).attr("data-hotel-id"),pageIndex:1}))},filterPrice:function(e){var t=this;"SPAN"===e.target.tagName&&($(e.target).toggleClass("card-sel"),$(e.target).siblings().removeClass("card-sel"),t.setState({currentPrice:$(e.target).attr("data-price-min")===t.state.currentPrice.min?{min:"",max:""}:{min:$(e.target).attr("data-price-min"),max:$(e.target).attr("data-price-max")},pageIndex:1}))},render:function(){return a.createElement("div",{className:"main responsive-box clearfix"},a.createElement("div",{className:"custom-banner responsive-box mgb30"},a.createElement("div",{id:"slider_top",className:"slider-box-1-js responsive-box"},a.createElement(i,{resourceLinks:this.state.resourceLinks,tplKey:"recommend#scheme"}))),a.createElement("div",{className:"sel-card-1-js clearfix",onClick:this.filterCategory},this.state.categoryFilter&&this.state.categoryFilter.length>0&&$.map(this.state.categoryFilter,function(e,t){return a.createElement("span",{key:t,className:e.selected?"card card-sel":"card","data-scheme-type":e.schemeType},e.name)}),a.createElement("div",{className:"line-bottom"})),a.createElement("div",{className:"J_FilterCtrl",onClick:this.filterFun},a.createElement("div",{className:"sel-card-2-js clearfix"},a.createElement("span",{className:"title"},a.createElement("i",{className:"ico-1-js ico-1-2-js"}),"风格"),a.createElement("div",{className:"card-box column-mg20-20",id:"J_CardStyle"},a.createElement("span",{className:"card","data-style-id":""},"全部"),this.state.styleFilter&&this.state.styleFilter.length>0&&$.map(this.state.styleFilter,function(e,t){return a.createElement("span",{key:t,className:"card","data-style-id":e.styleId},e.styleName)}))),a.createElement("div",{className:"sel-card-2-js clearfix",style:{display:"none"}},a.createElement("span",{className:"title"},a.createElement("i",{className:"ico-1-js ico-1-3-js"}),"酒店"),a.createElement("div",{className:"card-box column-mg20-20"},this.state.hotelFilter&&this.state.hotelFilter.length>0&&$.map(this.state.hotelFilter,function(e,t){return a.createElement("span",{key:t,className:"card","data-hotel-id":e.hotelId},e.hotelName)}))),a.createElement("div",{className:"sel-card-2-js clearfix"},a.createElement("span",{className:"title"},a.createElement("i",{className:"ico-1-js ico-1-1-js"}),"价位"),a.createElement("div",{className:"card-box column-mg20-20",id:"J_CardPrice"},a.createElement("span",{className:"card card-sel","data-price-min":"","data-price-max":""},"全部"),this.state.priceFilter&&this.state.priceFilter.length>0&&$.map(this.state.priceFilter,function(e,t){return a.createElement("span",{key:t,className:"card","data-price-min":e.minPrice,"data-price-max":e.maxPrice},e.name)})))),a.createElement(s,{resourceLinks:this.state.resourceLinks,pageIndex:this.state.pageIndex,pageSize:this.state.pageSize,currentCate:this.state.currentCate,currentStyle:this.state.currentStyle,currentHotel:this.state.currentHotel,currentPrice:this.state.currentPrice,tplKey:"list#scheme"}),a.createElement("div",{onClick:this.loadMore,id:"J_MoreButton"},a.createElement("span",{className:"btn-more-1-js all-more-1 transition-bg"},"点击查看更多",a.createElement("div",{className:"arrow-box"},a.createElement("i",{className:"arrow-2-js arrow-2-rig-js"}),a.createElement("i",{className:"arrow-2-js arrow-2-rig-js"})))))}});t.exports=l},{"../config/SKMap.js":64,"../config/api.js":65,"./cases-list.js":4,"./top-slider.js":56,react:263,"react-router-ie8":100}],6:[function(e,t,n){"use strict";var a=e("react"),r=(a.PropTypes,e("../config/api.js")),o=e("react-router-ie8"),i=e("./image-item.js"),s=a.createClass({displayName:"DressBrand",mixins:[o.State],getInitialState:function(){return{payload:[]}},componentDidMount:function(){var e=this,t=function(){var t=/^\/.*\/(\d+)/,n=e.getPath().split(t)[1];return r.httpGET("dress/brand/"+n,{})};window.Core&&window.Core.promises["/"]&&$.when(window.Core.promises["/"]).then(t).done(function(t){e.setState({payload:t.data})})},render:function(){return a.createElement("div",{className:"main-body-eav"},a.createElement("div",{className:"show-box-hslfxq"},a.createElement("div",{className:"grid"},$.map(this.state.payload,function(e,t){return a.createElement("div",{className:"item",key:t},a.createElement("div",{className:"pic-box"},a.createElement(i,{url:e.imageUrl,detailUrl:e.imageUrl,lightbox:"dresses",frameHeight:550})),a.createElement("span",null,e.weddingDressName))}))))}});t.exports=s},{"../config/api.js":65,"./image-item.js":21,react:263,"react-router-ie8":100}],7:[function(e,t,n){"use strict";var a=e("react"),r=(a.PropTypes,e("../config/api.js")),o=e("./top-slider.js"),i=e("./image-item.js"),s=e("react-router-ie8"),l=a.createClass({displayName:"DressCover",getInitialState:function(){return{payload:[]}},componentWillReceiveProps:function(e){var t=this;e.covers&&t.setState({payload:e.covers})},render:function(){return a.createElement("div",{className:"cover-box-hslf J_CateMenu"},a.createElement("div",null,a.createElement("ul",null,this.state.payload.length>0&&$.map(this.state.payload,function(e,t){return a.createElement("li",{className:"tit",key:t,"data-img":e.imageUrl,"data-desc":e.description,"data-id":e.weddingDressBrandId},e.weddingDressBrandName.length>10?e.weddingDressBrandName.slice(0,8)+"...":e.weddingDressBrandName)})),a.createElement("div",{className:"J_Pic tab"},a.createElement("a",{href:"#/dress/"+(this.state.payload[0]&&this.state.payload[0].weddingDressBrandId),className:"pos-box"},a.createElement("img",{src:this.state.payload[0]&&this.state.payload[0].imageUrl})),a.createElement("div",{className:"abstract J_Desc"},this.state.payload[0]&&this.state.payload[0].description))))}}),c=(a.createClass({displayName:"VideoMash",getInitialState:function(){return{items:[]}},componentWillReceiveProps:function(e){var t=this,n=[];e.resourceLinks&&e.tplKey&&e.resourceLinks!==this.props.resourceLinks&&$.each(e.resourceLinks,function(a,r){e.tplKey.indexOf(r.split("/")[0])>-1&&a.indexOf(t.props.nameKey)>-1&&n.push({url:r.split("#")[1],title:a,p:[]})});var a=function(e){return function(a){200===a.code&&a.data.length>0&&(e.p=a.data,t.setState({items:n}))}};$.each(n,function(e,t){r.httpGET(t.url,{pageIndex:1,pageSize:5}).done(a(t))})},render:function(){var e=this,t=0;return console.log("items:",e.state.items),a.createElement("div",{className:"movie-box-eav responsive-box"},a.createElement("div",{className:"box-l"},a.createElement(i,{klassName:"l-item",url:e.state.items[0]&&e.state.items[0].p[0]&&e.state.items[0].p[0].contentUrl||"http://placehold.it/620x375",frameWidth:620,frameHeight:375,detailUrl:e.state.items[0]&&e.state.items[0].p[0]&&e.state.items[0].p[0].detailUrl})),a.createElement("div",{className:"box-r"},$.map(e.state.items[0]&&e.state.items[0].p.slice(1)||[],function(e,n){return a.createElement(i,{klassName:"r-item",url:e.contentUrl||"http://placehold.it/270x180",frameWidth:270,frameHeight:180,detailUrl:e.detailUrl,key:t++})})))}}),a.createClass({displayName:"DressIndex",mixins:[s.State],getInitialState:function(){return{brands:[],category:[{name:"国际婚纱",en:"International Brand",weddingdressId:1,payload:[]},{name:"新娘礼服",en:"Brand for Bride",weddingdressId:2,payload:[]}]}},componentDidMount:function(){var e=this,t=function(e){$(document.body).trigger("ModuleChanged",["#/dress"])},n=e.state.category,a=function(t){r.httpGET("dress/brands",{weddingDressType:t.weddingdressId}).done(function(a){t.payload=a.data,e.setState({category:n})})},o=function(){var t=window.Core.getResourcesLinks(e.getPathname());e.setState({resourceLinks:t}),$.each(n,function(e,t){a(t)})};window.Core&&window.Core.promises["/"]&&$.when(window.Core.promises["/"]).then(t).then(o),$(".J_CateMenu").on("click","li",function(){$(this).closest(".J_CateMenu").find("img").attr("src",$(this).attr("data-img")),$(this).closest(".J_CateMenu").find("a").attr("href","#/dress/"+$(this).attr("data-id")),$(this).closest(".J_CateMenu").find("div.J_Desc").html($(this).attr("data-desc")),$(this).addClass("light").siblings().removeClass("light")})},render:function(){return a.createElement("div",{className:"main-body-eav"},a.createElement(o,{tplKey:"top#adv",resourceLinks:this.state.resourceLinks,pageIndex:1,pageSize:1}),a.createElement("div",{className:"space-70-eav"}),$.map(this.state.category,function(e,t){return a.createElement("div",{key:t},a.createElement("div",{className:"tit-box-hslf"},a.createElement("div",{className:"ch"},e.name),a.createElement("div",{className:"en"},e.en)),a.createElement(l,{covers:e.payload||[]}))}),a.createElement("div",{className:"bottom-hslf"}))}}));t.exports=c},{"../config/api.js":65,"./image-item.js":21,"./top-slider.js":56,react:263,"react-router-ie8":100}],8:[function(e,t,n){"use strict";var a=e("react"),r=e("../config/api.js"),o=(e("./image-item.js"),e("react-router-ie8")),i=e("./top-slider.js"),s=a.createClass({displayName:"ManInfo",render:function(){return a.createElement("a",{className:"figure"},a.createElement("div",{className:"avatar-box"},a.createElement("img",{src:this.props.avatar}),a.createElement("span",null)),a.createElement("h2",{style:{overflow:"visible"},className:"transition-color"},this.props.whichMan,a.createElement("b",{className:"transition-color"},this.props.name),a.createElement("br",null),a.createElement("span",null,"¥"+this.props.price)),a.createElement("p",null,this.props.info),a.createElement("div",{className:"score"},a.createElement("span",null,"评价"),a.createElement("div",{className:"box"},a.createElement("i",{className:"ico-heart ico-heart-small"}),a.createElement("i",{className:"ico-heart ico-heart-small"}),a.createElement("i",{className:"ico-heart ico-heart-small"}),a.createElement("i",{className:"ico-heart ico-heart-small"}),a.createElement("i",{className:"ico-heart ico-heart-small"}))),a.createElement("span",{style:{display:"none"},className:"btn-js btn-grayline-pink-1-js transition-bg"},"选择他"))}}),l=a.createClass({displayName:"VideoWork",render:function(){return a.createElement("li",{className:1===this.props.line?"column-6":"column-6 mgr20"},a.createElement("div",{className:"hover-box"},a.createElement("div",{className:"pos-box"},a.createElement("div",{className:"info transition-bottom"},a.createElement("h2",{className:"transition-font-size"}),a.createElement("p",null,"时间:",a.createElement("span",null,this.props.date),a.createElement("br",null),"地点:",a.createElement("span",null,this.props.address),a.createElement("br",null),"成本:",a.createElement("span",null,"¥"+this.props.price)),a.createElement("a",{href:"#/video-detail?cover="+this.props.cover+"&video="+this.props.video+"&n="+this.props.name+"&addr="+this.props.address+"&d="+this.props.date+"&info="+this.props.description,target:"_blank"},a.createElement("span",{className:"btn-js btn-blue-1-js transition-bg"},"点击观看"))),a.createElement("div",{className:"mask-bg transition-opacity"}))),a.createElement("img",{src:this.props.cover}))}}),c=a.createClass({displayName:"PicWork",render:function(){var e=this;return a.createElement("li",{className:2===this.props.line?"column-6":"column-6 mgr10"},a.createElement("a",{className:"pos-box","data-lightbox":"pic-"+this.props.row+"_"+this.props.line,href:this.props.cover},a.createElement("div",{className:"hover-box"},a.createElement("div",{className:"pos-box"},a.createElement("div",{className:"info transition-bottom"},a.createElement("h2",{className:"transition-font-size"}),a.createElement("p",null)),a.createElement("div",{className:"mask-bg transition-opacity"}))),a.createElement("img",{src:this.props.cover})),$.map(this.props.details,function(t,n){return a.createElement("a",{"data-lightbox":"pic-"+e.props.row+"_"+e.props.line,href:t,key:n})}))}}),u=a.createClass({displayName:"Host",render:function(){var e=this;return a.createElement("li",null,a.createElement(s,{whichMan:"主持人",name:this.props.name,price:this.props.price,info:this.props.info,avatar:this.props.avatar}),a.createElement("ul",{className:"list-4-js list-4-1-js"},$.map(this.props.works||[],function(t,n){return a.createElement(l,{key:n,cover:t.imageUrl,line:n,row:e.props.row,video:t.videoUrl,name:t.videoWorkName,date:t.shootingTime,address:t.shootingAdress,description:t.description,price:t.costPrice})})))}}),p=a.createClass({displayName:"Photographer",render:function(){var e=this;return a.createElement("li",null,a.createElement(s,{whichMan:"摄影师",name:this.props.name,price:this.props.price,info:this.props.info,avatar:this.props.avatar}),a.createElement("ul",{className:"list-4-js list-4-1-js"},$.map(this.props.works||[],function(t,n){return a.createElement(c,{key:n,cover:t.imageUrl,details:t.detailImages,row:e.props.row,line:n})})))}}),m=a.createClass({displayName:"Dresser",render:function(){var e=this;return a.createElement("li",null,a.createElement(s,{whichMan:"化妆师",name:this.props.name,price:this.props.price,info:this.props.info,avatar:this.props.avatar}),a.createElement("ul",{className:"list-4-js list-4-1-js"},$.map(this.props.works||[],function(t,n){return a.createElement(c,{key:n,cover:t.imageUrl,details:t.detailImages,row:e.props.row,line:n})})))}}),d=a.createClass({displayName:"Camera",render:function(){var e=this;return a.createElement("li",null,a.createElement(s,{whichMan:"摄像师",name:this.props.name,price:this.props.price,info:this.props.info,avatar:this.props.avatar}),a.createElement("ul",{className:"list-4-js list-4-1-js"},$.map(this.props.works||[],function(t,n){return a.createElement(l,{key:n,cover:t.imageUrl,row:e.props.row,line:n,video:t.videoUrl,name:t.videoWorkName,date:t.shootingTime,address:t.shootingAdress,description:t.description,price:t.costPrice})})))}}),h=a.createClass({displayName:"Tab",render:function(){return a.createElement("div",{className:"sel-card-1-js clearfix",id:"J_TabSelector"},a.createElement("span",{className:"host"===this.props.current?"card card-sel":"card","data-url":"host"},"主持人"),a.createElement("span",{className:"dresser"===this.props.current?"card card-sel":"card","data-url":"dresser"},"化妆师"),a.createElement("span",{className:"photographer"===this.props.current?"card card-sel":"card","data-url":"photographer"},"摄影师"),a.createElement("span",{className:"camera"===this.props.current?"card card-sel":"card","data-url":"camera"},"摄像师"),a.createElement("div",{className:"line-bottom"}))}}),f=a.createClass({displayName:"Filter",render:function(){return a.createElement("div",{className:"sel-card-2-js clearfix",id:"J_Filter"},a.createElement("span",{className:"title"},a.createElement("i",{className:"ico-1-js ico-1-1-js"}),"价位"),a.createElement("span",{className:"card card-sel filter-none","data-filter":"-1"},"全部"),a.createElement("div",{className:"card-box column-mg20-20"},a.createElement("span",{className:"card","data-filter":"0-1499"},"1500 以下"),a.createElement("span",{className:"card","data-filter":"1500-2000"},"1500-2000"),a.createElement("span",{className:"card","data-filter":"2000-2500"},"2000-2500"),a.createElement("span",{className:"card","data-filter":"2500-3000"},"2500-3000"),a.createElement("span",{className:"card","data-filter":"3000-99999"},"3000 以上")))}}),g=a.createClass({displayName:"F4",mixins:[o.State],getInitialState:function(){return{whichMan:"host",payload:[],totalCount:0,resourceLinks:{}}},componentDidMount:function(){var e=this;$("#slider_top").Slider();var t=e.getQuery().tab||"host",n={pageIndex:1,pageSize:100};$.when(window.Core.promises["/"]).then(function(){$(document.body).trigger("ModuleChanged",["#/scheme"])});var a=function(t,n){var a=window.Core.getResourcesLinks(e.getPathname(),"#/scheme");return console.log("resourceLinks:",a),e.setState({resourceLinks:a}),r.httpGET("f4/"+t,n)},o=function(){return a(t,n)};window.Core&&window.Core.promises["/"]&&$.when(window.Core.promises["/"]).then(o).done(function(n){e.setState({whichMan:t,payload:n.data,totalCount:n.totalCount})}),$("#J_Filter").on("click","span.card",function(){if($("#J_Filter .card").removeClass("card-sel"),$(this).addClass("card-sel"),"-1"===$(this).attr("data-filter"))n={pageIndex:1,pageSize:100};else{var t=$(this).attr("data-filter").split("-");n={minPrice:t[0],maxPrice:t[1],pageIndex:1,pageSize:100}}a(e.state.whichMan,n).done(function(t){e.setState({payload:t.data,totalCount:t.totalCount})})}),$("#J_TabSelector").on("click","span",function(){var t=this;$(this).siblings().removeClass("card-sel"),$(this).addClass("card-sel"),a($(this).attr("data-url"),n).done(function(n){e.setState({whichMan:$(t).attr("data-url"),payload:n.data,totalCount:n.totalCount})})})},render:function(){var e=this;return a.createElement("div",{className:"main planner-view responsive-box clearfix"
},a.createElement("div",{className:"custom-banner responsive-box mgb20"},a.createElement("div",{id:"slider_top",className:"slider-box-1-js responsive-box"},a.createElement(i,{tplKey:"top#adv",resourceLinks:this.state.resourceLinks,pageIndex:1,pageSize:10}))),a.createElement(h,{current:this.state.whichMan}),a.createElement(f,null),a.createElement("div",{className:"screening-results clearfix"},a.createElement("span",{className:"column-mg20-20",style:{color:"#e83c76",fontSize:"14px",fontWeight:"bold"}},"* 温馨提示:如遇节假日或者黄道吉日,预订价格或有波动,请以实际线下合同为准。 "),a.createElement("span",{className:"number"},"找到",a.createElement("b",null,e.state.totalCount),"个")),a.createElement("ul",{className:"host"===this.state.whichMan||"camera"===this.state.whichMan?"list-3-js list-3-2-js":"list-3-js list-3-2-js list-3-3-js"},this.state.payload.length>0&&$.map(this.state.payload,function(t,n){return"host"===e.state.whichMan?a.createElement(u,{key:n,row:n,name:t.personName,price:t.skillPrice,avatar:t.photoUrl,personId:t.personId,info:t.serviceInfo,works:t.hoster.slice(0,2)}):"dresser"===e.state.whichMan?a.createElement(m,{key:n,row:n,name:t.personName,price:t.skillPrice,avatar:t.photoUrl,personId:t.personId,info:t.serviceInfo,works:t.dresser.slice(0,3)}):"photographer"===e.state.whichMan?a.createElement(p,{key:n,row:n,name:t.personName,price:t.skillPrice,avatar:t.photoUrl,personId:t.personId,info:t.serviceInfo,works:t.photographer.slice(0,3)}):a.createElement(d,{key:n,row:n,name:t.personName,price:t.skillPrice,avatar:t.photoUrl,personId:t.personId,info:t.serviceInfo,works:t.cameraman.slice(0,2)})})))}});t.exports=g},{"../config/api.js":65,"./image-item.js":21,"./top-slider.js":56,react:263,"react-router-ie8":100}],9:[function(e,t,n){"use strict";var a=e("react"),r=a.createClass({displayName:"Footer",render:function(){return a.createElement("div",{className:"footer container clearfix",id:"footer","ng-cloak":!0},a.createElement("div",{className:"responsive-box"},a.createElement("div",{className:"nav-map"},a.createElement("a",{href:"#/aboutUs"},"关于金色百年"),a.createElement("a",{href:"#/aboutUs"},"联系我们")),a.createElement("div",{className:"er-wei-ma"},a.createElement("span",null,"关注金色百年"),a.createElement("img",{src:"http://image.jsbn.com/static/QR_Codes.jpg@1e_80w_80h_1c_0i_1o_90Q_1x"})),a.createElement("div",{className:"nav-map nav-map-1"},a.createElement("a",null,"渝ICP备15007161号-1"),a.createElement("a",{href:""},"版权说明"),a.createElement("a",{href:""},"服务条款"))))},componentDidMount:function(){}});t.exports=r},{react:263}],10:[function(e,t,n){"use strict";var a=e("react"),a=(a.PropTypes,e("react-router-ie8"),e("./top-slider.js"),e("../config/api.js"),e("./image-item.js"),e("react")),r=a.createClass({displayName:"GatherRequire",componentDidMount:function(){var e=function(e){$(document.body).trigger("ModuleChanged",["#/scheme"])};window.Core&&window.Core.promises["/"]&&$.when(window.Core.promises["/"]).then(e)},render:function(){return a.createElement("iframe",{height:"2206",allowTransparency:"true",frameBorder:"0",scrolling:"no",style:{width:"100%",border:"none"},src:"http://jsform.com/web/formembed/562753e10cf2b7156d082c97"})}});t.exports=r},{"../config/api.js":65,"./image-item.js":21,"./top-slider.js":56,react:263,"react-router-ie8":100}],11:[function(e,t,n){"use strict";var a=e("react"),r=(a.PropTypes,e("react-router-ie8")),o=e("./image-item.js"),i=e("../config/api.js"),s=a.createClass({displayName:"HallDetail",mixins:[r.State],getInitialState:function(){return{payload:[],baseSchemeUrl:"",schemePayload:[],recommend:[]}},componentDidUpdate:function(e,t){$("#slider_case_detail").Slider({type:"Horizontal"})},componentDidMount:function(){var e=this,t=function(t){$(document.body).trigger("ModuleChanged",["#/hotel"]);var n=window.Core.getResourcesLinks("/cases","#/scheme"),a="list#scheme";$.each(n,function(t,n){a.indexOf(n.split("/")[0]>-1)&&e.setState({baseSchemeUrl:n.split("#")[1]})})},n=function(t){var n=/^\/(\w+\/\d+)\/.*$/,a=e.getPath().split(n)[1];return i.httpGET(a,t)},a=function(){var t=e.getPath();return i.httpGET(t,{})},r=function(t){var n=t.length>5?t.slice(0,5):t;return $.each(n,function(t,n){i.httpGET(e.state.baseSchemeUrl+"/"+n).done(function(t){e.setState({schemePayload:e.state.schemePayload.concat(t.data)})})}),1};window.Core&&window.Core.promises["/"]&&$.when(window.Core.promises["/"]).then(t).then(a).done(function(t){200===t.code&&e.setState({payload:t.data},function(){t.data.length&&t.data.length>0&&r(t.data[0].schemeList)&&n({pageSize:6,pageIndex:1,minPrice:t.data[0].leastConsumption}).done(function(t){e.setState({recommend:t.data})}),e.state.payload.length&&$("#J_BanquetRequestButton").on("click",function(){window.store.get("USER")&&""!==window.store.get("USER")?i.httpPOST("hotel/submit",{banquetHallId:e.state.payload[0].banquetHallId,phone:window.store.get("USER")}).done(function(e){}):$("#login_btn").trigger("click")})})})},render:function(){var e=this,t=e.getQuery().hotelName||"",n=e.getQuery().address||"",r=e.getQuery().longitude,i=e.getQuery().latitude,s=this.state.payload.length>0?this.state.payload[0]:{detailImgList:[],banquetHallName:"",pillarNumber:0,capacity:0,area:0,shape:""},l=/^\/(\w+\/\d+)\/.*$/,c=e.getPath().split(l)[1];return a.createElement("div",{className:"main responsive-box clearfix"},a.createElement("div",{className:"hotel-detail-box mgb30 clearfix"},a.createElement("div",{className:"img-info clearfix"},a.createElement("div",{className:"slider-box-4-js"},s.detailImgList.length>0&&$.map(s.detailImgList,function(e,t){return 0===t?a.createElement("a",{className:"slider-hover-box",href:e,"data-lightbox":"roadtrip",key:t},a.createElement("div",{className:"big-img-box mgb30"},a.createElement("img",{src:e})),a.createElement("div",{className:"slider-tip-box"},a.createElement("span",null,"点击看大图"))):a.createElement("a",{href:e,"data-lightbox":"roadtrip",key:t})}))),a.createElement("div",{className:"base-info"},a.createElement("h1",{className:"mgb10"},t+" "+s.banquetHallName),a.createElement("div",{className:"p mgb30 clearfix"},a.createElement("p",null,"最大桌数",a.createElement("b",null,s.capacity)),a.createElement("p",null,"柱子",a.createElement("span",null,a.createElement("b",null,parseInt(s.pillarNumber)>0?"有":"无"))),a.createElement("p",null,"可用面积",a.createElement("span",null,a.createElement("b",null,s.area),"平方米")),a.createElement("p",null,"形状",a.createElement("span",null,a.createElement("b",null,s.shape))),a.createElement("p",null,"层高",a.createElement("span",null,a.createElement("b",null,s.height),"米")),a.createElement("p",null,"低消",a.createElement("span",null,a.createElement("b",null,"¥",parseFloat(s.leastConsumption).toFixed(2)),"/桌")),n&&a.createElement("p",null,"所在地址:",a.createElement("span",null,a.createElement("a",{href:"#/map?longitude="+r+"&latitude="+i},a.createElement("b",null,n)),a.createElement("i",{className:"ico-8-js"})))),a.createElement("div",{className:"score-info mgb40 clearfix",style:{display:"none"}},a.createElement("div",{className:"star-box"},a.createElement("div",{className:"star"},a.createElement("span",null,"服务质量"),a.createElement("div",null,a.createElement("i",{className:"ico-star-3-js ico-star-3-gray-js"}),a.createElement("i",{className:"ico-star-3-js ico-star-3-pink-js",style:{width:"45px"}}))),a.createElement("div",{className:"star"},a.createElement("span",null,"菜品质量"),a.createElement("div",null,a.createElement("i",{className:"ico-star-3-js ico-star-3-gray-js"}),a.createElement("i",{className:"ico-star-3-js ico-star-3-pink-js"}))),a.createElement("div",{className:"star"},a.createElement("span",null,"装修档次"),a.createElement("div",null,a.createElement("i",{className:"ico-star-3-js ico-star-3-gray-js"}),a.createElement("i",{className:"ico-star-3-js ico-star-3-pink-js"})))),a.createElement("div",{className:"etc"},a.createElement("div",{className:"item"},a.createElement("em",null,"礼包",a.createElement("i",{className:"arrow-5-js arrow-5-rig-2-js"})),"婚庆喜包最高10000万"),a.createElement("div",{className:"item"},a.createElement("em",null,"特惠",a.createElement("i",{className:"arrow-5-js arrow-5-rig-2-js"})),"提前3个月预订送酒水"),a.createElement("div",{className:"item"},a.createElement("em",null,"折上折",a.createElement("i",{className:"arrow-5-js arrow-5-rig-2-js"})),"购全程服务再打88折"))),a.createElement("div",{className:"func clearfix",style:{display:"none"}},a.createElement("span",{className:"viewing-field"},a.createElement("i",{className:"ico-9-js ico-9-1-js"}),"预约查看场地")),a.createElement("div",{className:"input-phone-number",style:{display:"none"}},a.createElement("i",{className:"arrow-5-js arrow-5-up-3-js"}),a.createElement("span",null,"输入手机号金色拜年统筹师会带你看场地"),a.createElement("div",{className:"input-text-box"},a.createElement("input",{id:"J_BanquetText",defaultValue:window.store.get("USER")||"",type:"text"})),a.createElement("span",{className:"sub-1-js"},a.createElement("input",{className:"sub-input",id:"J_BanquetRequestButton",type:"button"}),"发送")))),a.createElement("div",{className:"column-19 mgr30 clearfix"},a.createElement("div",{className:"hotel-detail-info banquet-detail-info clearfix"},a.createElement("h2",{className:"mgb10"},"本厅平面图"),a.createElement("div",{className:"banquet-img-box mgb30"},a.createElement("img",{src:s.planeGraphUrl})),e.state.schemePayload.length>0&&a.createElement("h2",{className:"mgb10"},"本厅婚礼实例"),e.state.schemePayload.length>0&&a.createElement("div",{className:"Case-box mgb20"},a.createElement(o,{frameWidth:720,sid:e.state.schemePayload[0]&&e.state.schemePayload[0].weddingCaseId+"",url:e.state.schemePayload[0]&&e.state.schemePayload[0].coverImageUrl||"http://placehold.it/720x480",detailBaseUrl:e.state.baseSchemeUrl}),a.createElement("div",{className:"info-box"},a.createElement("h3",null,e.state.schemePayload[0]&&e.state.schemePayload[0].schemeName),a.createElement("p",null,e.state.schemePayload[0]&&e.state.schemePayload[0].schemeDesc.slice(0,140)),a.createElement("div",{className:"theme-box clearfix"},a.createElement("span",{className:"theme"},"主题:",a.createElement("b",null,e.state.schemePayload[0]&&e.state.schemePayload[0].schemeTheme.slice(0,8))),a.createElement("span",{className:"theme"},"风格:",e.state.schemePayload[0]&&e.state.schemePayload[0].schemeStyles.length>0&&$.map(e.state.schemePayload[0].schemeStyles,function(e,t){return a.createElement("b",{key:t},e.styleName)})),a.createElement("span",{className:"theme"},"色系:",a.createElement("b",null,e.state.schemePayload[0]&&e.state.schemePayload[0].schemeColor))))),a.createElement("ul",{className:"list-2-js list-case clearfix"},e.state.schemePayload&&e.state.schemePayload.length>1&&$.map(e.state.schemePayload.slice(1),function(t,n){return a.createElement("li",{className:"item-box column-mg20-17 mg0",key:n},a.createElement("a",{className:"hover-box transition-opacity",href:"#/"+e.state.baseSchemeUrl+"/"+t.weddingCaseId},a.createElement("div",{className:"pos-box"},a.createElement("h3",null,t.schemeName),a.createElement("div",{className:"etc-info"},a.createElement("b",null,0!==parseInt(t.sceneCost)?"¥"+parseFloat(t.sceneCost).toFixed(2):""),a.createElement("span",null,"(",t.weddingDate,")")),a.createElement("div",{className:"btn-box"}),a.createElement("div",{classNameL:"mask-bg"}))),a.createElement(o,{frameWidth:465,url:t.coverImageUrl||"http://placehold.it/465x310",sid:t.weddingCaseId+"",detailBaseUrl:e.state.baseSchemeUrl}))})))),a.createElement("div",{className:"column-mg30-5 mg0"},a.createElement("div",{className:"hotel-recommend-adv-box clearfix"},a.createElement("div",{className:"title-4-js mgb20"},a.createElement("h1",null,"推荐酒店"),a.createElement("div",{className:"line-middle"})),a.createElement("div",{className:"sel-card-5-js mgb20"},a.createElement("span",{className:"item item-current"},"同价位")),a.createElement("ul",{className:"list-19-js"},e.state.recommend.length>0&&$.map(e.state.recommend,function(e,t){return a.createElement("li",{className:"item-box",key:t},a.createElement(o,{url:e.imageUrl,frameWidth:168,detailUrl:"#/"+c+"/"+e.hotelId}),a.createElement("div",{className:"title-box"},a.createElement("span",null,e.hotelName)))})))))}});t.exports=s},{"../config/api.js":65,"./image-item.js":21,react:263,"react-router-ie8":100}],12:[function(e,t,n){"use strict";var a=e("react"),r=e("../config/api.js"),o=e("./image-item.js"),i=a.createClass({displayName:"Works",render:function(){var e=this.props.personId,t=this.props.list.slice(0,this.props.pageSize);return 0===t.length&&(t=["http://placehold.it/450x300","http://placehold.it/450x300"]),a.createElement("ul",{className:"list-11-js clearfix"},t.map(function(t,n){return a.createElement("li",{key:n,className:1===n?"column-9 mg0 J_ShowPhoto":"column-9 mgr10 J_ShowPhoto","data-big-img-url":t.contentUrl,"data-person-id":e,"data-works-id":t.contentId},a.createElement(o,{frameWidth:450,url:t.contentUrl,errorUrl:"http://placehold.it/450x300"}))}))}}),s=a.createClass({displayName:"HeadStylistsList",showPhotoSwipe:function(e){window.Core.gallery&&window.Core.gallery.close();var t=document.querySelectorAll(".pswp")[0];$("#nav_fixed").hide();var n={history:!1,focus:!1,showAnimationDuration:0,hideAnimationDuration:0,tapToClose:!0},a=new PhotoSwipe(t,PhotoSwipeUI_Default,e,n);a.init(),a.goTo(0),window.Core.gallery=a},buildItems:function(e){return 0===e.length?[]:$.map(e,function(e,t){var n=/_(\d{1,4})x(\d{1,4})\.\w+g$/i,a=e.imageUrl&&e.imageUrl.match(n),r=-1,o=-1;a&&3===a.length&&(r=parseInt(a[1]),o=parseInt(a[2]));var i={src:e.imageUrl||"http://placehold.it/1200x800",w:r,h:o};return i})},getInitialState:function(){return{payload:[],baseUrl:""}},componentWillReceiveProps:function(e){var t=this,n=function(e,t){return r.httpGET(e,t)};$.each(e.resourceLinks,function(a,o){e.tplKey.indexOf(o)>-1&&n(o,{pageSize:e.pageSize,pageIndex:e.pageIndex}).done(function(e){var n=function(n){var a=$.map(e.data,function(e){return 1===e.levelId?e:null});t.setState({payload:a.concat(t.state.payload),baseUrl:n},function(){$(".J_ShowPhoto").delegate("a","click",function(){var e=$(this).parent(".J_ShowPhoto").attr("data-person-id"),n=$(this).parent(".J_ShowPhoto").attr("data-works-id");return r.httpGET("photographers/"+e+"/works/"+n,{pageIndex:1,pageSize:100}).done(function(e){var n=t.buildItems(e.data.detailedImages);t.showPhotoSwipe(n)}),!1})})};200===e.code&&e.data&&n(o)})})},render:function(){var e=this;return a.createElement("ul",{className:"list-20-js"},this.state.payload.map(function(t,n){return a.createElement("li",{key:n,className:"item-box mgb40"},a.createElement("div",{className:"info-box"},a.createElement("div",{className:"avatar-box"},a.createElement("img",{src:"dev"===window.Core.mode?t.photoUrl:t.photoUrl+"@200h_1e_1c_0i_1o_90q_1x"||"http://placehold.it/170x170"})),a.createElement("span",{className:"name"},t.personName),a.createElement("span",{className:"job"},t.level+"级造型师")),a.createElement(i,{list:t.list,personId:t.personId,pageSize:e.props.worksPageSize,pageIndex:e.props.worksPageIndex}))}))}});t.exports=s},{"../config/api.js":65,"./image-item.js":21,react:263}],13:[function(e,t,n){"use strict";var a=e("react"),r=e("../config/SKMap.js"),o=e("react-router-ie8"),i=(e("../config/api.js"),a.createClass({displayName:"LeftIcon",render:function(){return a.createElement("a",{href:"#/home"},a.createElement("img",{src:"http://image.jsbn.com/logo.jpg@90q",className:"logo"}))}})),s=(a.createClass({displayName:"CurrentModuleIndicator",render:function(){return a.createElement("div",{className:"total-bot"},"导航:"+this.props.currentMenu)}}),a.createClass({displayName:"Header",mixins:[o.State],getInitialState:function(){return{isHome:!0,menu:{name:"",submenu:[{name:"",link:""}]}}},render:function(){var e=this,t=a.createElement(i,null);return a.createElement("div",{className:"home"},a.createElement("div",{className:"header-mian-eav"},a.createElement("div",{className:"responsive-box"},a.createElement("span",{className:"word"},"全国首家婚礼全流程优质服务商 丨 时尚 · 个性 · 品质 丨 省时 · 省心 · 省钱"),a.createElement("span",{className:"num"},"400-015-9999"))),a.createElement("div",{className:"nav-main-box-eav responsive-box"},a.createElement("div",{className:"center-box-eav"},t,a.createElement("div",{className:"item-box J_Nav"},$.map(e.state.menu.submenu||[],function(t,n){return a.createElement("a",{href:t.link,target:t.link.indexOf("http")>-1?"_blank":"_self",key:n},a.createElement("div",{className:e.state.isHome?"item":("#"+e.getPathname()).indexOf(t.link)>-1?"item item-current sec-nav-ch":"item sec-nav-ch"},a.createElement("div",{className:"ch"},t.name,a.createElement("div",{className:"en"},t.en||""),a.createElement("div",{className:"arrow-5-js triangle"}))))})))))},componentDidMount:function(){e("../vendors/slider.js");var t=this;$(".J_Nav").on("click","a",function(){$(this).siblings().find(".item").removeClass("item-current"),$(this).find(".item").addClass("item-current")}),$(document.body).on("ModuleChanged",function(e,n){var a="#/home"===n?!0:!1;window.Core.menu&&t.setState({isHome:a,menu:{name:window.Core.menu[n].name,submenu:$.map(window.Core.menu[n].sub||[],function(e,t){return{name:t,en:r[t+"en"],link:e}})}})})}}));t.exports=s},{"../config/SKMap.js":64,"../config/api.js":65,"../vendors/slider.js":68,react:263,"react-router-ie8":100}],14:[function(e,t,n){"use strict";var a=e("react"),r=(a.PropTypes,e("../config/api.js")),o=e("./image-item.js"),a=(e("../config/SKMap.js"),e("react")),i=a.createClass({displayName:"NavTitle",getInitialState:function(){return{href1:"",href2:"",titleClassName:"nav-title"}},componentDidMount:function(){this.props.title.indexOf("摄影")>0?this.setState({titleClassName:this.state.titleClassName+" photography-img-home",href1:"#/shot",href2:"#/movie"}):this.props.title.indexOf("婚庆")>0?this.setState({titleClassName:this.state.titleClassName+" banquet-img-home",href1:"#/hotel",href2:"#/scheme"}):this.props.title.indexOf("礼服")>0&&this.setState({titleClassName:this.state.titleClassName+" dress-img-home",href1:"#/dress",href2:"http://www.chinad9.com"})},render:function(){var e=this;return a.createElement("div",{className:e.state.titleClassName+" cover-box-home"},a.createElement("div",{className:"cover"}),a.createElement("div",{className:"and"}),a.createElement("a",{href:e.state.href1},a.createElement("div",{className:"word-01"})),a.createElement("a",{href:e.state.href2},a.createElement("div",{className:"word-02"})))}}),s=a.createClass({displayName:"HomeMash",getInitialState:function(){return{items:[]}},componentWillReceiveProps:function(e){var t=this,n=[];e.resourceLinks&&e.tplKey&&e.resourceLinks!==this.props.resourceLinks&&$.each(e.resourceLinks,function(t,a){e.tplKey.indexOf(a.split("/")[0])>-1&&-1===t.indexOf("热区广告")&&n.push({url:a.split("#")[1],title:t,p:[]})});var a=function(e){return function(a){200===a.code&&a.data.length>0&&(e.p=a.data,t.setState({items:n}))}};$.each(n,function(e,t){r.httpGET(t.url,{pageIndex:1,pageSize:3}).done(a(t))})},render:function(){var e=this.state.items||[{},{},{}];return a.createElement("div",{className:"home-mash clearfix"},$.map(e,function(e,t){return a.createElement("ul",{key:t,className:"list-1-js list-1-1-js mgb30 clearfix"},a.createElement("li",{className:"column-mg20-8 mgr30 item-first"},a.createElement(i,{title:e.title}),a.createElement(o,{url:e.p[0]&&e.p[0].contentUrl||"http://placehold.it/380x270",frameWidth:380,detailUrl:e.p[0]&&e.p[0].detailUrl}),a.createElement("div",{className:"title"},a.createElement("span",null,e.p[0]&&e.p[0].contentName.split("#")[0]||"NO DESCRIPTION"),a.createElement("span",{className:"en"},e.p[0]&&e.p[0].contentName.split("#")[1]||"NO DESCRIPTION"," "))),a.createElement("li",{className:"column-mg20-8 mgr30"},a.createElement(o,{url:e.p[1]&&e.p[1].contentUrl||"http://placehold.it/380x570",frameWidth:380,detailUrl:e.p[1]&&e.p[1].detailUrl}),a.createElement("div",{className:"title"},a.createElement("span",null,e.p[1]&&e.p[1].contentName.split("#")[0]||"DESCRIPTION"),a.createElement("span",{className:"en"},e.p[1]&&e.p[1].contentName.split("#")[1]||"DESCRIPTION"," "))),a.createElement("li",{className:"column-mg20-8 mg0"},a.createElement(o,{url:e.p[2]&&e.p[2].contentUrl||"http://placehold.it/380x570",frameWidth:380,detailUrl:e.p[2]&&e.p[2].detailUrl}),a.createElement("div",{className:"title"},a.createElement("span",null,e.p[2]&&e.p[2].contentName.split("#")[0]||"NO DESCRIPTION"),a.createElement("span",{className:"en"}," ",e.p[2]&&e.p[2].contentName.split("#")[1]||"NO DESCRIPTION"," "))))})," ")}});t.exports=s},{"../config/SKMap.js":64,"../config/api.js":65,"./image-item.js":21,react:263}],15:[function(e,t,n){"use strict";var a=e("react"),r=e("../config/api.js"),o=e("./image-item.js"),i=a.createClass({displayName:"HomeRecommend",getInitialState:function(){return{payload:[{},{},{}]}},componentWillReceiveProps:function(e){var t=this,n=function(e,t){return r.httpGET(e,t)};e.resourceLinks&&$.each(e.resourceLinks,function(a,r){e.tplKey.indexOf(r.split("/")[0])>-1&&n(r.split("#")[1],{pageSize:3,pageIndex:1}).done(function(e){200===e.code&&t.setState({payload:e.data,baseUrl:r.split("#")[1]})})})},render:function(){var e=this;this.state.baseUrl;return a.createElement("ul",{className:"list-1-js list-1-2-js mgb30 clearfix"},e.state.payload.map(function(e,t){return a.createElement("li",{className:2===t?"column-mg20-8 mg0":"column-mg20-8 mgr30",key:t},a.createElement(o,{url:e.contentUrl||"http://placehold.it/380x250",frameWidth:380,frameHeight:250,detailUrl:e.detailUrl}),a.createElement("div",{className:"title"},a.createElement("span",null,e.contentName),a.createElement("span",{className:"en"},e.description)))}))}});t.exports=i},{"../config/api.js":65,"./image-item.js":21,react:263}],16:[function(e,t,n){"use strict";var a=e("react"),r=e("react-router-ie8"),o=e("./top-slider.js"),i=e("./home-mash.js"),s=e("../config/api.js"),l=e("./home-recommend.js"),c=e("../config/SKMap.js"),u=e("./image-item.js"),p=(a.createClass({displayName:"VideoMash",getInitialState:function(){return{items:[]}},componentWillReceiveProps:function(e){var t=this,n=[];e.resourceLinks&&e.tplKey&&e.resourceLinks!==this.props.resourceLinks&&$.each(e.resourceLinks,function(a,r){e.tplKey.indexOf(r.split("/")[0])>-1&&a.indexOf(t.props.nameKey)>-1&&n.push({url:r.split("#")[1],title:a,p:[]})});var a=function(e){return function(a){200===a.code&&a.data.length>0&&(e.p=a.data,t.setState({items:n}))}};$.each(n,function(e,t){s.httpGET(t.url,{pageIndex:1,pageSize:5}).done(a(t))})},render:function(){var e=this,t=0;return a.createElement("div",{className:"movie-box-eav responsive-box"},a.createElement("div",{className:"box-l"},a.createElement(u,{klassName:"l-item",url:e.state.items[0]&&e.state.items[0].p[0]&&e.state.items[0].p[0].contentUrl||"http://placehold.it/620x375",frameWidth:620,frameHeight:375,detailUrl:e.state.items[0]&&e.state.items[0].p[0]&&e.state.items[0].p[0].detailUrl})),a.createElement("div",{className:"box-r"},$.map(e.state.items[0]&&e.state.items[0].p.slice(1)||[],function(e,n){return a.createElement(u,{klassName:"r-item",url:e.contentUrl||"http://placehold.it/270x180",frameWidth:270,frameHeight:180,detailUrl:e.detailUrl,key:t++})})))}}),a.createClass({displayName:"Home",mixins:[r.State],getInitialState:function(){return{homeMenu:[],resourceLinks:{}}},render:function(){return a.createElement("div",{className:"home"},a.createElement("div",{className:"banna-home-eav"},a.createElement("div",{id:"slider_home",className:"slider-box-1-js banna",style:{top:"0px"}},a.createElement(o,{resourceLinks:this.state.resourceLinks,frameWidth:1920,tplKey:"top#adv"}))),a.createElement("div",{className:"space-40-eav"}),a.createElement("div",{className:"main responsive-box clearfix"},a.createElement(i,{tplKey:"mid#adv",resourceLinks:this.state.resourceLinks}),a.createElement(l,{resourceLinks:this.state.resourceLinks,tplKey:"list#adv"})))},componentDidMount:function(){var e=this;$("#J_CommonHeader").hide();var t=function(t){var n="/"===e.getPathname()?"/home":e.getPathname();$(document.body).trigger("ModuleChanged",["#"+n])},n=function(t){var n=$.map(window.Core.menu,function(e,t){return{name:e.name,en:c[e.name+"en"],link:t}}),a="/"===e.getPathname()?"/home":e.getPathname(),r=window.Core.getResourcesLinks(a);e.setState({homeMenu:n,resourceLinks:r})};window.Core&&$.when(window.Core.promises["/"]).then(t).then(n)},componentWillUnmount:function(){$("#J_CommonHeader").show()}}));t.exports=p},{"../config/SKMap.js":64,"../config/api.js":65,"./home-mash.js":14,"./home-recommend.js":15,"./image-item.js":21,"./top-slider.js":56,react:263,"react-router-ie8":100}],17:[function(e,t,n){"use strict";var a=e("react"),r=(a.PropTypes,e("react-router-ie8")),o=(r.Link,e("./image-item.js")),i=e("../config/api.js"),s=a.createClass({displayName:"HotelDetail",mixins:[r.State],getInitialState:function(){return{payload:[],recommend:[]}},componentDidMount:function(){var e=this,t=function(e){$(document.body).trigger("ModuleChanged",["#/hotel"])},n=function(){var t=e.getPath();return i.httpGET(t,{})},a=function(t){var n=/^\/(.*)\/(\d+)$/,a=e.getPath().split(n)[1];return i.httpGET(a,t)};window.Core&&window.Core.promises["/"]&&$.when(window.Core.promises["/"]).then(t),n().done(function(t){200===t.code&&e.setState({payload:t.data},function(){e.state.payload.length>0&&a({pageSize:6,pageIndex:1,minPrice:e.state.payload[0].lowestConsumption}).done(function(t){e.setState({recommend:t.data})}),e.state.payload.length&&$("#J_SendHotelRequest").on("click",function(){window.store.get("USER")&&""!==window.store.get("USER")?i.httpPOST("hotel/submit",{hotelId:e.state.payload[0].hotelId,phone:window.store.get("USER")}).done(function(e){}):$("#login_btn").trigger("click")})})});var r=$("#hotel_menu_list");r.on("click","li",function(){return $(this).hasClass("list-item-1-current-js")?void $(this).removeClass("list-item-1-current-js"):void $(this).addClass("list-item-1-current-js")})},componentDidUpdate:function(e,t){$("#slider_case_detail").Slider({type:"Horizontal"})},render:function(){var e=this,t=this.state.payload.length>0?this.state.payload[0]:{address:"",banquetHallList:[],capacityPerTable:"0",cityId:"-1",detailedIntroduction:"",highestConsumption:"",lowestConsumption:"",hotelId:"",hotelLabelList:"",hotelMealPackList:[],hotelName:"",imageUrlList:[],latitude:"",longitude:"",typeName:""},n=/^\/(.*)\/(\d+)$/,r=e.getPath().split(n)[1];return a.createElement("div",{className:"main responsive-box clearfix"},a.createElement("div",{className:"hotel-detail-box mgb30 clearfix"},a.createElement("div",{className:"img-info clearfix"},a.createElement("div",{className:"slider-box-4-js"},t.imageUrlList.length>0&&$.map(t.imageUrlList,function(e,t){return 0===t?a.createElement("a",{className:"slider-hover-box",href:e,"data-lightbox":"roadtrip",key:t},a.createElement("div",{className:"big-img-box mgb30"},a.createElement("img",{src:e})),a.createElement("div",{className:"slider-tip-box"},a.createElement("span",null,"点击看大图"))):a.createElement("a",{href:e,"data-lightbox":"roadtrip",key:t})}))),a.createElement("div",{className:"base-info"},a.createElement("h1",{className:"mgb10"},t.hotelName),a.createElement("div",{className:"p mgb30 clearfix"},a.createElement("p",null,"规格类型",a.createElement("b",null,t.typeName)),a.createElement("p",null,"价格",a.createElement("span",null,"¥",a.createElement("b",null,t.lowestConsumption),"-",a.createElement("b",null,t.highestConsumption),"/桌")),a.createElement("p",null,"场厅数量",a.createElement("span",null,a.createElement("b",null,t.banquetHallList.length),"个专用宴会厅")),a.createElement("p",null,"最大容客数",a.createElement("span",null,a.createElement("b",null,t.capacityPerTable),"桌")),a.createElement("p",{id:"J_AddressButton"},"所在地址:",a.createElement("span",null,a.createElement("a",{href:"#/map?longitude="+t.longitude+"&latitude="+t.latitude},a.createElement("b",null,t.address)),a.createElement("i",{className:"ico-8-js"})))),a.createElement("div",{id:"J_InfoContainer",className:"score-info mgb40 clearfix"},a.createElement("div",{className:"star-box"},a.createElement("div",{className:"star"},a.createElement("span",null,"服务质量"),a.createElement("div",null,a.createElement("i",{className:"ico-star-3-js ico-star-3-gray-js"}),a.createElement("i",{className:"ico-star-3-js ico-star-3-pink-js",style:{width:45}}))),a.createElement("div",{className:"star"},a.createElement("span",null,"菜品质量"),a.createElement("div",null,a.createElement("i",{className:"ico-star-3-js ico-star-3-gray-js"}),a.createElement("i",{className:"ico-star-3-js ico-star-3-pink-js"}))),a.createElement("div",{className:"star"},a.createElement("span",null,"装修档次"),a.createElement("div",null,a.createElement("i",{className:"ico-star-3-js ico-star-3-gray-js"}),a.createElement("i",{className:"ico-star-3-js ico-star-3-pink-js"})))),a.createElement("div",{className:"etc"},a.createElement("div",{className:"item"},a.createElement("em",null,"大礼包"),a.createElement("i",{className:"arrow-5-js arrow-5-rig-2-js"}),a.createElement("a",{href:"#/sale-strategy?type=libao",target:"_blank"},"通过金色百年预定婚宴,领取12999大礼包")),a.createElement("div",{className:"item"},a.createElement("em",null,"组合优惠"),a.createElement("i",{className:"arrow-5-js arrow-5-rig-2-js"}),a.createElement("a",{href:"#/sale-strategy?type=zuhe",target:"_blank"},"消费项目越多,优惠力度越大")))),a.createElement("div",{className:"func clearfix",style:{display:"none"}},a.createElement("span",{className:"viewing-field"},a.createElement("i",{className:"ico-9-js ico-9-1-js"}),"预约查看场地")),a.createElement("div",{className:"input-phone-number",style:{display:"none"}},a.createElement("i",{className:"arrow-5-js arrow-5-up-3-js"}),a.createElement("span",null,"输入手机号金色拜年统筹师会带你看场地"),a.createElement("div",{className:"input-text-box"},a.createElement("input",{defaultValue:window.store.get("USER")||"",type:"text"})),a.createElement("span",{className:"sub-1-js"},a.createElement("input",{className:"sub-input",id:"J_SendHotelRequest",type:"button"}),"发送")))),a.createElement("div",{className:"column-19 mgr30 clearfix"},a.createElement("div",{className:"hotel-detail-info clearfix"},a.createElement("h2",{className:"mgb10"},"酒店介绍"),a.createElement("div",{className:"hotel-info-box mgb30"},a.createElement("div",{className:"img-box"},a.createElement(o,{frameWidth:320,url:t.coverImageUrl||"http://placehold.it/320x240"})),a.createElement("div",{className:"p"},a.createElement("p",null,t.detailedIntroduction))),a.createElement("h2",{className:"mgb20"},t.banquetHallList.length>0?"宴会厅介绍":""),a.createElement("ul",{className:"list-16-js hotel-banquet-list mgb20 clearfix"},t.banquetHallList.length>0&&$.map(t.banquetHallList,function(n,r){return a.createElement("li",{key:r,className:r%2===1?"item-box mgb20 mg0":"item-box mgb20 mgr20"},a.createElement("div",{className:"title-box"},a.createElement("h2",null,n.banquetHallName)),a.createElement("div",{className:"img-box"},a.createElement(o,{frameHeight:310,url:n.image_url,detailUrl:"#"+e.getPath()+"/"+n.banquetHallId+"?hotelName="+t.hotelName+"&address="+t.address+"&longitude="+t.longitude+"&latitude="+t.latitude})),a.createElement("div",{className:"info-box"},a.createElement("ul",{className:"clearfix"},a.createElement("li",{style:{width:"90px"}},"桌数:",a.createElement("span",null,n.capacity||"--","桌")),a.createElement("li",{style:{width:"90px"}},"柱子:",a.createElement("span",null,"0"===n.pillarNumber?"无":"有")),a.createElement("li",{style:{width:"120px"}},"面积:",a.createElement("span",null,n.area||"--","平方米")),a.createElement("li",{style:{width:"90px"}},"形状:",a.createElement("span",null,n.shape||"--")),a.createElement("li",{style:{width:"90px"}},"层高:",a.createElement("span",null,n.height||"--","米")),a.createElement("li",{style:{width:"120px"}},"低消:",a.createElement("span",null,"¥",parseFloat(n.leastConsumption).toFixed(2),"/桌"))),a.createElement("a",{className:"btn-js btn-grayline-pink-1-js transition-bg",href:"#"+e.getPath()+"/"+n.banquetHallId+"?hotelName="+t.hotelName+"&address="+t.address+"&longitude="+t.longitude+"&latitude="+t.latitude},"查看详情")))})),a.createElement("h2",{id:"test"},t.hotelMealPackList.length>0?"婚宴套系菜单":""),a.createElement("div",{className:"package mgb30 clearfix"},a.createElement("ul",{className:"hotel-menu-list",id:"hotel_menu_list"},$.map(t.hotelMealPackList,function(e,t){
return a.createElement("li",{className:"list-item-1-js",key:t},a.createElement("div",{className:"item-box"},a.createElement("h3",{className:"transition"},a.createElement("span",null,e.mealPackName)),a.createElement("i",{className:"arrow-rig"}),a.createElement("span",{className:"pirce"},a.createElement("strong",null,"¥"),a.createElement("b",null,e.mealPackPrice),a.createElement("strong",null,"/桌")),a.createElement("i",{className:"arrow-lef"}),a.createElement("a",{className:"more transition"},"详情")),a.createElement("div",{className:"cont-menu transition"},a.createElement("dl",null,a.createElement("dt",null,e.aliasName),$.map(e.mealPackDishList,function(e,t){return a.createElement("dd",{key:t},e)}))))}))))),a.createElement("div",{className:"column-mg30-5 mg0"},a.createElement("div",{className:"hotel-recommend-adv-box clearfix"},a.createElement("div",{className:"title-4-js mgb20"},a.createElement("h1",null,"推荐酒店"),a.createElement("div",{className:"line-middle"})),a.createElement("div",{className:"sel-card-5-js mgb20"},a.createElement("span",{className:"item item-current"},"同价位")),a.createElement("ul",{className:"list-19-js"},e.state.recommend.length>0&&$.map(e.state.recommend,function(e,t){return a.createElement("li",{className:"item-box",key:t},a.createElement(o,{url:e.imageUrl,frameWidth:168,detailUrl:"#/"+r+"/"+e.hotelId,newWin:1}),a.createElement("div",{className:"title-box"},a.createElement("span",null,e.hotelName)))})))))}});t.exports=s},{"../config/api.js":65,"./image-item.js":21,react:263,"react-router-ie8":100}],18:[function(e,t,n){"use strict";var a=e("react"),r=(a.PropTypes,e("../config/api.js")),o=e("./image-item.js"),i=a.createClass({displayName:"FeatureLabel",render:function(){var e=this.props.features&&this.props.features.split(",")||[];return e=e.length>8?e.slice(0,8):e,a.createElement("div",{className:"label-box clearfix"},$.map(e,function(e,t){return a.createElement("label",{key:t},e.length>6?e.slice(0,5)+"...":e)}))}}),s=a.createClass({displayName:"HallList",render:function(){var e=this.props.baseUrl,t=this.props.halls.length>2?this.props.halls.slice(0,2):this.props.halls;return a.createElement("dl",null,a.createElement("dt",null,a.createElement("span",null,"宴会厅"),a.createElement("span",null,"桌数"),a.createElement("span",null,"层高"),a.createElement("span",null,"柱数")),0===t.length&&a.createElement("dd",null,a.createElement("span",null,"--"),a.createElement("span",null,"--"),a.createElement("span",null,"--"),a.createElement("span",null,"--")),$.map(t,function(t,n){return a.createElement("dd",{key:n},a.createElement("a",{href:e+"/"+t.banquetHallId},a.createElement("span",null,t.banquetHallName),a.createElement("span",null,a.createElement("b",null,t.capacity),"桌"),a.createElement("span",null,a.createElement("n",null,t.height),"米"),a.createElement("span",null,parseInt(t.pillarNumber)>0?"有":"无")))}))}}),l=a.createClass({displayName:"HotelList",getInitialState:function(){return{payload:[],totalPage:0}},componentWillReceiveProps:function(e){var t=this,n=function(e,t){return r.httpGET(e,t)},a={};a.pageSize=e.pageSize,a.pageIndex=e.pageIndex,$.each(e.sorter,function(e,t){a[e]=t}),$.each(e.filter,function(e,t){a[e]=t}),$.each(e.extraFilter,function(e,t){a[e]=t}),e.resourceLinks&&$.each(e.resourceLinks,function(r,o){e.tplKey.indexOf(o.split("/")[0])>-1&&n(o.split("#")[1],a).done(function(n){200===n.code&&t.setState({payload:1===parseInt(e.pageIndex)?n.data:t.state.payload.concat(n.data),baseUrl:o.split("#")[1],totalPage:parseInt(n.totalCount)},function(){parseInt(n.totalCount)<=parseInt(e.pageIndex)*parseInt(e.pageSize)?$("#J_MoreButton").hide():$("#J_MoreButton").show(),$("#J_TotalCount").find("b").html(n.totalCount)})})})},render:function(){var e=this.state.payload||[{},{}],t=this.state.baseUrl;return a.createElement("ul",{className:"list-17-js"},$.map(e,function(e,n){return a.createElement("li",{key:n,className:"item-box clearfix"},a.createElement("div",{className:"info-box"},a.createElement("div",{className:"content-box"},a.createElement(o,{detailBaseUrl:t,sid:e.hotelId,frameWidth:320,url:e.imageUrl,newWin:1}),a.createElement("div",{className:"info"},a.createElement("div",{className:"title clearfix"},a.createElement("h2",null,a.createElement("a",{href:"#/"+t+"/"+e.hotelId,target:"_blank"},e.hotelName)),!!e.isGift&&a.createElement("label",{className:"label-pink"},"礼"),!!e.isDiscount&&a.createElement("label",{className:"label-blue"},"惠")),a.createElement("div",{className:"price-box"},a.createElement("span",null,"¥"),a.createElement("span",{className:"big"},e.lowestConsumption),a.createElement("span",null,"-"),a.createElement("span",{className:"big"},e.highestConsumption)),a.createElement("div",{className:"score-box clearfix"},a.createElement("div",{className:"star-box"},a.createElement("i",{className:"ico-star-2-js ico-star-2-gray-js"}),a.createElement("i",{className:"ico-star-2-js ico-star-2-pink-js",style:{width:"72px"}})),a.createElement("span",{className:"score"},"4.9"),a.createElement("span",{className:"hotel-type"},a.createElement("b",null,e.typeName),"|",a.createElement("b",null,e.address.length>20?e.address.slice(0,18)+"...":e.address)),a.createElement("span",{className:"desk-num"},"可容纳",a.createElement("b",null,e.capacityPerTable),"桌")),a.createElement(s,{halls:e.banquetHallList,baseUrl:"#/"+t+"/"+e.hotelId}),a.createElement("a",{href:"#/"+t+"/"+e.hotelId,target:"_blank",className:"viewing-banquet transition-bg"},"查看更多宴会厅")))),a.createElement("div",{className:"reply-box"},a.createElement("div",{className:"content-box"},a.createElement(i,{features:e.featureLable}),a.createElement("div",{className:"user-box clearfix",style:{display:"none"}},a.createElement("a",{className:"avatar-box"},a.createElement("img",{src:"http://placehold.it/60x60"})),a.createElement("div",{className:"reply-content"},"“",a.createElement("p",null,"To Be or Not To Be"),"”")))),a.createElement("div",{className:"share-box",style:{display:"none"}},a.createElement("div",{className:"share"},a.createElement("i",{className:"ico-10-js ico-10-1-js"}),"分享"),a.createElement("div",{className:"collection"},a.createElement("i",{className:"ico-10-js ico-10-2-js"}),"收藏")))}))}});t.exports=l},{"../config/api.js":65,"./image-item.js":21,react:263}],19:[function(e,t,n){"use strict";var a=e("react"),r=e("react-router-ie8"),o=a.createClass({displayName:"HotelRequire",mixins:[r.State],componentDidMount:function(){var e=function(e){$(document.body).trigger("ModuleChanged",["#/hotel"])};window.Core&&window.Core.promises["/"]&&$.when(window.Core.promises["/"]).then(e)},render:function(){return a.createElement("div",{style:{width:"100%",marginTop:"0px",marginBottom:"0px",marginLeft:"auto",marginRight:"auto",position:"relative",overflow:"hidden"}},a.createElement("img",{src:"http://image.jsbn.com/static/tjbg_01.jpg",style:{display:"block"}}),a.createElement("img",{src:"http://image.jsbn.com/static/tjbg_02.jpg",style:{display:"block"}}),a.createElement("img",{src:"http://image.jsbn.com/static/tjbg_03.jpg",style:{display:"block"}}),a.createElement("div",{style:{width:"1920px",marginTop:"0px",marginBottom:"0px",marginLeft:"auto",marginRight:"auto",position:"absolute",top:"0px"}},a.createElement("div",{style:{width:"580px",position:"absolute",top:"90px",left:"920px",marginLeft:"30px",marginTop:"50px"}},a.createElement("iframe",{height:"900",allowTransparency:"true",frameBorder:"0",scrolling:"no",style:{border:"none",width:"100%"},src:"http://jsform.com/web/formembed/5630399a0cf25bb366c5ae91"}))))}});t.exports=o},{react:263,"react-router-ie8":100}],20:[function(e,t,n){"use strict";var a=e("react"),r=e("./hotel-list.js"),o=e("./top-slider.js"),i=e("react-router-ie8"),s=(e("../config/SKMap.js"),a.createClass({displayName:"Filter",render:function(){var e=this;return a.createElement("div",{className:"sel-card-2-js clearfix"},a.createElement("span",{className:"title"},a.createElement("i",{className:"ico-1-js ico-1-2-js"}),this.props.title),a.createElement("div",{className:"card-box column-mg20-20"},this.props.conditions&&this.props.conditions.length>0&&$.map(this.props.conditions,function(t,n){return a.createElement("span",{key:n,className:"card","data-key":e.props.sorterKey.length&&"object"==typeof e.props.sorterKey?e.props.sorterKey.join(","):e.props.sorterKey,"data-value":e.props.valueKey.length&&"object"==typeof e.props.valueKey?t[e.props.valueKey[0]]+","+t[e.props.valueKey[1]]:t[e.props.valueKey]},t[e.props.name])})))}})),l=a.createClass({displayName:"Hotel",mixins:[i.State],componentDidMount:function(){var e=this,t=function(e){$(document.body).trigger("ModuleChanged",["#/hotel"])},n=function(t){var n=window.Core.getResourcesLinks(e.getPathname(),"#/hotel");e.setState({resourceLinks:n})};window.Core&&window.Core.promises["/"]&&$.when(window.Core.promises["/"]).then(t).then(n);var a={};$(".card-box").on("click","span",function(){$(this).siblings().removeClass("card-sel"),$(this).toggleClass("card-sel");var t=this;$(this).hasClass("card-sel")?$.each($(this).attr("data-key").split(","),function(e,n){a[n]=$(t).attr("data-value").split(",")[e]}):$.each($(this).attr("data-key").split(","),function(e,t){delete a[t]}),e.setState({sorter:a})}),$(".J_SorterButton").on("click",function(){var t={},n=$(this).find(".J_SorterArrow");t["short"]=n.attr("data-filter"),n.hasClass("ascending")?(n.removeClass("ascending"),n.addClass("descending"),t.order="desc"):n.hasClass("descending")&&(n.removeClass("descending"),n.addClass("ascending"),t.order="asc"),e.setState({pageSize:10,pageIndex:1,filter:t})});var r={};$(".J_ExtraFilter").on("click",function(){r[$(this).attr("data-filter")]=$(this).is(":checked")?1:0,e.setState({pageSize:10,pageIndex:1,extraFilter:r})})},componentWillUnmount:function(){$("#nav_fixed").show()},getInitialState:function(){return{resourceLinks:[],pageSize:10,pageIndex:1,sorter:{},filter:{},extraFilter:{},seatsCount:[{maxTable:"10",minTable:"0",name:"10桌以下"},{minTable:"10",maxTable:"20",name:"10-20桌"},{minTable:"20",maxTable:"30",name:"20-30桌以下"},{minTable:"30",maxTable:"999",name:"30桌以上"}],prices:[{minPrice:"0",maxPrice:"2000",name:"2000元以下"},{minPrice:"2000",maxPrice:"3000",name:"2000-3000元"},{minPrice:"3000",maxPrice:"4000",name:"3000-4000元"},{minPrice:"4000",maxPrice:"99999",name:"4000元以上"}],areas:[{id:90,name:"渝中区",pid:""},{id:91,name:"大渡口区",pid:""},{id:92,name:"江北区",pid:""},{id:93,name:"沙坪坝区",pid:""},{id:94,name:"南岸区",pid:""},{id:95,name:"九龙坡区",pid:""},{id:96,name:"北碚区",pid:""},{id:99,name:"渝北区",pid:""},{id:100,name:"巴南区",pid:""},{id:101,name:"北部新区",pid:""}]}},loadMore:function(e){e.preventDefault(),this.setState(function(e,t){return{pageIndex:e.pageIndex+1}})},render:function(){return a.createElement("div",{className:"hotel-page"},a.createElement("div",{className:"container mgb10"},a.createElement("div",{className:"custom-banner responsive-box"},a.createElement("div",{id:"slider_top",className:"slider-box-1-js responsive-box"},a.createElement(o,{tplKey:"top#adv",resourceLinks:this.state.resourceLinks,pageIndex:1,pageSize:10})))),a.createElement("div",{className:"main responsive-box clearfix",style:{minHeight:"440px"}},a.createElement(s,{title:"区域",name:"name",valueKey:"id",conditions:this.state.areas,sorterKey:"cityId"}),a.createElement(s,{title:"桌数",name:"name",valueKey:["minTable","maxTable"],conditions:this.state.seatsCount,sorterKey:["minTable","maxTable"]}),a.createElement(s,{title:"价格",name:"name",valueKey:["minPrice","maxPrice"],conditions:this.state.prices,sorterKey:["minPrice","maxPrice"]}),a.createElement("div",{className:"screening-2-js"},a.createElement("div",{className:"line-1"}),a.createElement("span",{className:"item"},"默认排序"),a.createElement("span",{className:"item J_SorterButton"},"价格",a.createElement("span",{className:"arrow-box ascending J_SorterArrow","data-filter":"price"},a.createElement("i",{className:"arrow-5-js arrow-5-up-1-js"}),a.createElement("i",{className:"arrow-5-js arrow-5-down-1-js"}))),a.createElement("span",{className:"item J_SorterButton"},"桌数",a.createElement("span",{className:"arrow-box descending J_SorterArrow","data-filter":"table"},a.createElement("i",{className:"arrow-5-js arrow-5-up-1-js"}),a.createElement("i",{className:"arrow-5-js arrow-5-down-1-js"}))),a.createElement("label",{className:"item"},a.createElement("input",{type:"checkbox",className:"J_ExtraFilter","data-filter":"isGift"}),"礼包"),a.createElement("label",{className:"item"},a.createElement("input",{type:"checkbox",className:"J_ExtraFilter","data-filter":"isDisaccount"}),"优惠"),a.createElement("div",{className:"info-box"},a.createElement("span",{className:"result",id:"J_TotalCount"},"共找到婚宴酒店",a.createElement("b",null,"0"),"个"))),a.createElement(r,{resourceLinks:this.state.resourceLinks,tplKey:"list#hotel",pageSize:this.state.pageSize,pageIndex:this.state.pageIndex,sorter:this.state.sorter,filter:this.state.filter,extraFilter:this.state.extraFilter}),a.createElement("div",null,a.createElement("span",{onClick:this.loadMore,className:"btn-more-1-js all-more-1 transition-bg",id:"J_MoreButton"},"点击查看更多",a.createElement("div",{className:"arrow-box"},a.createElement("i",{className:"arrow-2-js arrow-2-rig-js"}),a.createElement("i",{className:"arrow-2-js arrow-2-rig-js"}))))))}});t.exports=l},{"../config/SKMap.js":64,"./hotel-list.js":18,"./top-slider.js":56,react:263,"react-router-ie8":100}],21:[function(e,t,n){"use strict";var a=e("react"),r=a.PropTypes,o=a.createClass({displayName:"ImageListItem",propTypes:{detailBaseUrl:r.string,url:r.string,frameWidth:r.number,frameHeight:r.number,sid:r.string,errorUrl:r.string,detailUrl:r.string,newWin:r.number},componentDidMount:function(){var e=this;$.each($(".J_Video"),function(t,n){"load"!==$(n).attr("data-loaded")&&window.videojs(n,{autoplay:!1,loop:!0},function(){var t=this;$(t).attr("data-loaded","loaded"),window.setTimeout(function(){"YES"===e.props.noplay?t.pause():(t.play(),t.muted(!0))},300)})})},render:function(){var e=/_(\d{1,4})x(\d{1,4})\.\w+g$/i,t=this.props.frameWidth?this.props.frameWidth+"w_":"",n=this.props.frameHeight?this.props.frameHeight+"h_":"",r="dev"===window.Core.mode?this.props.url:this.props.url+"@"+t+n+"90Q",o=this.props.url&&this.props.url.match(e),i=-1,s=-1;o&&3===o.length&&(i=parseInt(o[1]),s=parseInt(o[2]));var l=this.props.detailBaseUrl?"#/"+this.props.detailBaseUrl+"/"+this.props.sid:this.props.detailUrl&&""!==this.props.detailUrl?this.props.detailUrl:"javascript:void(0)",c=this.props.newWin,u=this.props.lightbox||"",p=this.props.klassName||"",m=this.props.videoDetail||"#/movie";return-1!==l.indexOf("mp4")?a.createElement("a",{href:m,className:p},a.createElement("video",{className:"video-js vjs-default-skin J_Video",preload:"auto",width:this.props.frameWidth||i,height:this.props.frameHeight||s,poster:r},a.createElement("source",{src:l,type:"video/mp4"}))):""!==u?a.createElement("a",{href:l,style:{textAlign:"center"},className:"img-box "+p,ref:"RImageItem","data-lightbox":u,"data-width":i,"data-height":s,target:1===c&&"_blank"||"_self"},a.createElement("img",{style:this.props.style,src:r,onerror:this.props.errorUrl})):a.createElement("a",{href:l,style:{textAlign:"center"},className:"img-box "+p,ref:"RImageItem","data-width":i,"data-height":s,target:1===c&&"_blank"||"_self"},a.createElement("img",{style:this.props.style,src:r,onerror:this.props.errorUrl}))}});t.exports=o},{react:263}],22:[function(e,t,n){"use strict";var a=e("react"),r=(a.PropTypes,e("react-router-ie8")),o=e("./top-slider.js"),i=e("../config/api.js"),s=(e("./image-item.js"),a.createClass({displayName:"Item",render:function(){return a.createElement("div",{className:"box-item-wdy"},a.createElement("div",{className:"cover-layer-wdy"},a.createElement("a",{href:this.props.detail,className:"pos-box"})),a.createElement("img",{src:this.props.cover,className:"img-video-wdy"}),a.createElement("a",{href:this.props.detail},a.createElement("div",{className:"title-video-wdy"},this.props.title)))}})),l=a.createClass({displayName:"LoveMicro",mixins:[r.State],getInitialState:function(){return{loveMicro:[]}},componentDidMount:function(){var e=this,t=function(e){$(document.body).trigger("ModuleChanged",["#/movie"])},n=function(){return i.httpGET("videos",{sort:"date",videoType:"5",pageSize:100,pageIndex:1})};window.Core&&window.Core.promises["/"]&&$.when(window.Core.promises["/"]).then(t).then(n).done(function(t){var n=window.Core.getResourcesLinks(e.getPathname(),"#/movie");e.setState({resourceLinks:n,loveMicro:t.data})})},render:function(){return a.createElement("div",{className:"main-body-eav"},a.createElement("div",{id:"slider_top",className:"slider-box-1-js responsive-box"},a.createElement(o,{tplKey:"top#adv",resourceLinks:this.state.resourceLinks,pageIndex:1,pageSize:1})),a.createElement("div",{className:"space-70-eav"}),a.createElement("div",{className:"title-block-wdy title-img03-wdy"}),a.createElement("div",{className:"line-e1-eav"}),a.createElement("div",{className:"space-20-eav"}),a.createElement("div",{className:"box-block-wdy"},$.map(this.state.loveMicro,function(e,t){return a.createElement(s,{title:e.name,detail:"#/movie/"+e.videoId,cover:e.coverImage.imageUrl,key:t})})))}});t.exports=l},{"../config/api.js":65,"./image-item.js":21,"./top-slider.js":56,react:263,"react-router-ie8":100}],23:[function(e,t,n){"use strict";var a=e("react"),r=(a.PropTypes,e("react-router-ie8")),o=e("./top-slider.js"),i=e("../config/api.js"),s=(e("./image-item.js"),a.createClass({displayName:"Item",render:function(){return a.createElement("div",{className:"box-item-wdy"},a.createElement("div",{className:"cover-layer-wdy"},a.createElement("a",{href:this.props.detail,className:"pos-box"})),a.createElement("img",{src:this.props.cover,className:"img-video-wdy"}),a.createElement("a",{href:this.props.detail},a.createElement("div",{className:"title-video-wdy"},this.props.title)))}})),l=a.createClass({displayName:"LoveMV",mixins:[r.State],getInitialState:function(){return{loveMV:[]}},componentDidMount:function(){var e=this,t=function(e){$(document.body).trigger("ModuleChanged",["#/movie"])},n=function(){return i.httpGET("videos",{sort:"date",videoType:"4",pageSize:100,pageIndex:1})};window.Core&&window.Core.promises["/"]&&$.when(window.Core.promises["/"]).then(t).then(n).done(function(t){var n=window.Core.getResourcesLinks(e.getPathname(),"#/movie");e.setState({resourceLinks:n,loveMV:t.data})})},render:function(){return a.createElement("div",{className:"main-body-eav"},a.createElement("div",{id:"slider_top",className:"slider-box-1-js responsive-box"},a.createElement(o,{tplKey:"top#adv",resourceLinks:this.state.resourceLinks,pageIndex:1,pageSize:1})),a.createElement("div",{className:"space-70-eav"}),a.createElement("div",{className:"title-block-wdy title-img02-wdy"}),a.createElement("div",{className:"line-e1-eav"}),a.createElement("div",{className:"space-20-eav"}),a.createElement("div",{className:"box-block-wdy"},$.map(this.state.loveMV,function(e,t){return a.createElement(s,{title:e.name,detail:"#/movie/"+e.videoId,cover:e.coverImage.imageUrl,key:t})})))}});t.exports=l},{"../config/api.js":65,"./image-item.js":21,"./top-slider.js":56,react:263,"react-router-ie8":100}],24:[function(e,t,n){"use strict";var a=e("react"),r=e("react-router-ie8"),o=r.RouteHandler,i=e("./header.js"),s=e("./footer.js"),l=e("./my-center.js");e("../config/core.js");var c=a.createClass({displayName:"Main",getInitialState:function(){return{isAuthed:!1}},render:function(){return a.createElement("div",{className:"root-view"},a.createElement(i,null),a.createElement(o,null),a.createElement(s,null),this.state.isAuthed&&a.createElement(l,null),a.createElement("div",{className:"main-rig-func-box",id:"main_rig_func_box"},a.createElement("div",{className:"disgin-box disgin-box-top transition-opacity"},a.createElement("i",{className:"rect-js rect-4-js"})),a.createElement("div",{className:"func-box transition-height clearfix",id:"func_box"},a.createElement("div",{className:"pos-box"},a.createElement("div",{className:"hover-box hover-first-box clearfix"},a.createElement("div",{className:"pos-box"},a.createElement("span",null,"统筹师"),a.createElement("i",{className:"ico-16-js ico-16-1-js"}))),a.createElement("div",{className:"hover-box clearfix"},a.createElement("div",{className:"pos-box"},a.createElement("span",null,"咨询电话"),a.createElement("i",{className:"ico-16-js ico-16-2-js"}))),a.createElement("div",{className:"hover-box clearfix"},a.createElement("div",{className:"pos-box"},a.createElement("span",null,"扫二维码"),a.createElement("i",{className:"ico-16-js ico-16-3-js"}))),a.createElement("div",{className:"hover-box clearfix",id:"pop_chat"},a.createElement("div",{className:"pos-box"},a.createElement("span",null,"在线咨询"),a.createElement("i",{className:"ico-16-js ico-16-4-js"}))),a.createElement("div",{className:"hover-box clearfix",id:"back_top"},a.createElement("div",{className:"pos-box"},a.createElement("span",null,"回到顶部"),a.createElement("i",{className:"ico-16-js ico-16-5-js"}))))),a.createElement("div",{className:"disgin-box transition-opacity",style:{display:"none"}},a.createElement("i",{className:"rect-js rect-1-js"}),a.createElement("i",{className:"rect-js rect-2-js"}),a.createElement("i",{className:"rect-js rect-3-js clearfix"}))),a.createElement("div",{className:"phone-window-pop-box transition-width",id:"phone_window"},a.createElement("span",null,"400 - 015 - 9999")),a.createElement("div",{className:"qr-code-box transition-width",id:"qr_code_box"},a.createElement("img",{src:"http://image.jsbn.com/static/QR_Codes.jpg@1e_80w_80h_1c_0i_1o_90Q_1x"})))},componentWillUnmount:function(){$(document.body).off("Auth"),$(document.body).off("UnAuth")},componentDidMount:function(){var e=this,t=function(e){},n=function(){$(document.body).on("Auth",function(t,n){e.setState({isAuthed:!0})}),$(document.body).on("UnAuth",function(t,n){e.setState({isAuthed:!1})})};window.Core&&window.Core.promises["/"]&&$.when(window.Core.promises["/"]).then(t).then(n)}});t.exports=c},{"../config/core.js":66,"./footer.js":9,"./header.js":13,"./my-center.js":28,react:263,"react-router-ie8":100}],25:[function(e,t,n){"use strict";var a=e("react"),r=(a.PropTypes,e("react-router-ie8")),o=a.createClass({displayName:"Map",mixins:[r.State],componentDidMount:function(){var e=new BMap.Map("container"),t=parseFloat(this.getQuery().longitude),n=parseFloat(this.getQuery().latitude),a=new BMap.Point(t,n);e.centerAndZoom(a,15);var r=new BMap.Marker(a);e.addOverlay(r)},render:function(){return a.createElement("div",{className:"map",id:"container",style:{height:"720px"}})}});t.exports=o},{react:263,"react-router-ie8":100}],26:[function(e,t,n){"use strict";var a=e("react"),r=(a.PropTypes,e("../config/api.js")),o=e("react-router-ie8"),i=a.createClass({displayName:"Item",render:function(){return a.createElement("div",{className:"box-item-wdyxq"},a.createElement("div",{className:"cover-layer-wdyxq"},a.createElement("a",{href:this.props.detail,className:"pos-box",target:"_blank"})),a.createElement("img",{src:this.props.cover,className:"img-item-wdyxq"}),a.createElement("a",{href:this.props.detail,target:"_blank"},a.createElement("div",{className:"title-item-wdyxq"},this.props.title)))}}),s=a.createClass({displayName:"MovieDetail",mixins:[o.State],getInitialState:function(){return{payload:{},latest:[]}},componentDidMount:function(){var e=this,t=function(e){$(document.body).trigger("ModuleChanged",["#/movie"])},n=function(){var t=/^\/.*\/(\d+)/,n=e.getPath().split(t)[1];return r.httpGET("videos/"+n,{})},a=function(){return r.httpGET("videos",{sort:"date",videoType:"4,5",pageSize:6,pageIndex:1})};window.Core&&window.Core.promises["/"]&&$.when(window.Core.promises["/"]).then(t).then(n).done(function(t){e.setState({payload:[t.data]},function(){window.videojs($(".J_Video")[0],{autoplay:!1,loop:!0},function(){})})}),a().done(function(t){e.setState({latest:t.data})})},render:function(){return a.createElement("div",{className:"main-body-eav"},a.createElement("div",{className:"box-video-wdyxq"},a.createElement("video",{className:"video-js vjs-default-skin J_Video",controls:!0,preload:"auto",width:800,height:450,poster:this.state.payload[0]&&this.state.payload[0].coverImage.imageUrl},a.createElement("source",{src:this.state.payload[0]&&this.state.payload[0].url,type:"video/mp4"})),a.createElement("div",{className:"box-info-wdyxq"},a.createElement("span",{className:"title-vidio-wdyxq"},this.state.payload[0]&&this.state.payload[0].name),a.createElement("p",{className:"title-info-wdyxq"},"世间所有的相遇,都是久别重逢,遇见你就是幸福的开始。"))),a.createElement("div",{className:"box-v-new-wdyxq"},a.createElement("div",{className:"title-v-new-wdyxq clear-b-eav"},"最新微电影"),$.map(this.state.latest,function(e,t){return a.createElement(i,{title:e.name,detail:"#/movie/"+e.videoId,cover:e.coverImage.imageUrl,key:t})})),a.createElement("div",{className:"ad-bot-wdy clearfix"}))}});t.exports=s},{"../config/api.js":65,react:263,"react-router-ie8":100}],27:[function(e,t,n){"use strict";var a=e("react"),r=(a.PropTypes,e("react-router-ie8")),o=e("./top-slider.js"),i=e("../config/api.js"),s=(e("./image-item.js"),a.createClass({displayName:"Item",render:function(){return a.createElement("div",{className:"box-item-wdy"},a.createElement("div",{className:"cover-layer-wdy"},a.createElement("a",{href:this.props.detail,className:"pos-box"})),a.createElement("img",{src:this.props.cover,className:"img-video-wdy"}),a.createElement("a",{href:this.props.detail},a.createElement("div",{className:"title-video-wdy"},this.props.title)))}})),l=a.createClass({displayName:"MovieList",mixins:[r.State],getInitialState:function(){return{payload:[],latest:[],hotest:[],loveMV:[],loveMicro:[]}},componentDidMount:function(){var e=this,t=function(e){$(document.body).trigger("ModuleChanged",["#/movie"])},n=function(){return i.httpGET("videos",{sort:"date",videoType:"4",pageSize:7,pageIndex:1})},a=function(){return i.httpGET("videos",{sort:"date",videoType:"5",pageSize:7,pageIndex:1})},r=function(){return i.httpGET("videos",{sort:"date",videoType:"4,5",pageSize:4,pageIndex:1})},o=function(){return i.httpGET("videos",{sort:"hits",videoType:"4,5",pageSize:4,pageIndex:1})};window.Core&&window.Core.promises["/"]&&$.when(window.Core.promises["/"]).then(t).then(n).done(function(t){var n=window.Core.getResourcesLinks(e.getPathname(),"#/movie");e.setState({resourceLinks:n,loveMV:t.data})}),a().done(function(t){e.setState({loveMicro:t.data})}),r().done(function(t){e.setState({latest:t.data})}),o().done(function(t){e.setState({hotest:t.data})})},render:function(){var e=this;return a.createElement("div",{className:"main-body-eav"},a.createElement("div",{id:"slider_top",className:"slider-box-1-js responsive-box"},a.createElement(o,{tplKey:"top#adv",resourceLinks:this.state.resourceLinks,pageIndex:1,pageSize:1})),a.createElement("div",{className:"space-70-eav"}),a.createElement("div",{className:"banner"},a.createElement("img",{src:"./assets/images/eavlee/wdy/wdy-banner-top.jpg"})),a.createElement("div",{className:"title-block-wdy title-img01-wdy"}),a.createElement("div",{className:"line-e1-eav"}),a.createElement("div",{className:"box-block-wdy"},a.createElement("div",{className:"title-list-wdy"},"最新微电影"),$.map(this.state.latest,function(t,n){return a.createElement(s,{title:t.name,detail:"#"+e.getPathname()+"/"+t.videoId,cover:t.coverImage.imageUrl,key:n})})),a.createElement("div",{className:"box-block-wdy"},a.createElement("div",{className:"title-list-wdy "},"最热微电影"),$.map(this.state.hotest,function(t,n){return a.createElement(s,{title:t.name,detail:"#"+e.getPathname()+"/"+t.videoId,cover:t.coverImage.imageUrl,key:n})})),a.createElement("div",{className:"space-30-eav"}),a.createElement("div",{className:"title-block-wdy title-img02-wdy"}),a.createElement("div",{className:"line-e1-eav"}),a.createElement("div",{className:"space-20-eav"}),a.createElement("div",{className:"box-block-wdy"},$.map(this.state.loveMV,function(t,n){return a.createElement(s,{title:t.name,detail:"#"+e.getPathname()+"/"+t.videoId,cover:t.coverImage.imageUrl,key:n})}),a.createElement("a",{href:"#/loveMV"},a.createElement("div",{className:"box-item-wdy"},a.createElement("div",{className:"more-box-wdy"},a.createElement("div",{className:"more-ch-wdy"},"欣赏更多"),a.createElement("p",null,"more"))))),a.createElement("div",{className:"space-30-eav"}),a.createElement("div",{className:"title-block-wdy title-img03-wdy"}),a.createElement("div",{className:"line-e1-eav"}),a.createElement("div",{className:"space-20-eav"}),a.createElement("div",{className:"box-block-wdy"},$.map(this.state.loveMicro,function(t,n){return a.createElement(s,{title:t.name,detail:"#"+e.getPathname()+"/"+t.videoId,cover:t.coverImage.imageUrl,key:n})}),a.createElement("a",{href:"#/loveMicro"},a.createElement("div",{className:"box-item-wdy"},a.createElement("div",{className:"more-box-wdy"},a.createElement("div",{className:"more-ch-wdy"},"欣赏更多"),a.createElement("p",null,"more"))))))}});t.exports=l},{"../config/api.js":65,"./image-item.js":21,"./top-slider.js":56,react:263,"react-router-ie8":100}],28:[function(e,t,n){"use strict";var a=e("react"),r=(a.PropTypes,a.createClass({displayName:"MyCenter",render:function(){return a.createElement("div",{className:"user-process-management container"},a.createElement("div",{className:"responsive-box"},a.createElement("div",{className:"mask-bg"}),a.createElement("div",{className:"overall-division-box"},a.createElement("a",{className:"avatar-box"},a.createElement("img",{src:"images/test/item_2.png"})),a.createElement("div",{className:"info"},a.createElement("b",{className:"name"},"林梦瑶"),a.createElement("br",null),a.createElement("span",{className:"mine"},"我的统筹师"),a.createElement("br",null),a.createElement("span",{className:"phone"},"13030000000")),a.createElement("div",{className:"addr-box"},a.createElement("i",null),a.createElement("span",{className:"btn"},a.createElement("b",null,"重庆"),a.createElement("i",{className:"arrow-3-js arrow-3-white-bottom-1-js"}))),a.createElement("i",{className:"ico-11-js"})),a.createElement("ul",{className:"list-21-js"},a.createElement("li",{className:"item-box item-current-box"},a.createElement("div",{className:"info-box"},a.createElement("h3",null,"出外景"),a.createElement("p",null,a.createElement("span",null,"2015-02-03"),a.createElement("br",null),a.createElement("span",null,"中央公园"),a.createElement("br",null),a.createElement("span",null,"02366738334"),a.createElement("br",null))),a.createElement("div",{className:"title-box transition-bg"},a.createElement("span",null,"婚纱摄影"))),a.createElement("li",{className:"item-box"},a.createElement("div",{className:"info-box"},a.createElement("h3",null,"尚未完成"),a.createElement("p",null,a.createElement("span",null,"建议在婚期",a.createElement("br",null),"的半年前完成"))),a.createElement("div",{className:"title-box transition-bg"},a.createElement("span",null,"婚宴预订"))),a.createElement("li",{className:"item-box"},a.createElement("div",{className:"info-box"},a.createElement("h3",null,"尚未完成"),a.createElement("p",null,a.createElement("span",null,"建议在婚期",a.createElement("br",null),"的半年前完成"))),a.createElement("div",{className:"title-box transition-bg"},a.createElement("span",null,"婚礼策划"))),a.createElement("li",{className:"item-box"},a.createElement("div",{className:"info-box"},a.createElement("h3",null,"尚未完成"),a.createElement("p",null,a.createElement("span",null,"建议在婚期",a.createElement("br",null),"的半年前完成"))),a.createElement("div",{className:"title-box transition-bg"},a.createElement("span",null,"婚礼钻戒"))),a.createElement("li",{className:"item-box"},a.createElement("div",{className:"info-box"},a.createElement("h3",null,"尚未完成"),a.createElement("p",null,a.createElement("span",null,"建议在婚期",a.createElement("br",null),"的半年前完成"))),a.createElement("div",{className:"title-box transition-bg"},a.createElement("span",null,"婚纱礼服"))),a.createElement("li",{className:"item-box"},a.createElement("div",{className:"info-box"},a.createElement("h3",null,"尚未完成"),a.createElement("p",null,a.createElement("span",null,"建议在婚期",a.createElement("br",null),"的半年前完成"))),a.createElement("div",{className:"title-box transition-bg"},a.createElement("span",null,"婚庆用品"))),a.createElement("li",{
className:"item-box item-current-box"},a.createElement("div",{className:"info-box"},a.createElement("h3",null,"已预定"),a.createElement("p",null,a.createElement("span",null,"定金400元"),a.createElement("br",null),a.createElement("span",null,"4月21日已支付"))),a.createElement("div",{className:"title-box transition-bg"},a.createElement("span",null,"婚庆用车")))),a.createElement("div",{className:"btn-box"},a.createElement("span",{className:"btn-1 transition-bg"},a.createElement("i",{className:"ico-13-js"}),"婚礼进程"),a.createElement("span",{className:"btn-1 transition-bg"},a.createElement("i",{className:"ico-14-js"}),"个人中心")),a.createElement("span",{className:"btn-close ico-12-js"})))}}));t.exports=r},{react:263}],29:[function(e,t,n){"use strict";var a=e("react"),r=e("react-router-ie8"),o=(e("../config/api.js"),e("./image-item.js")),i=a.createClass({displayName:"NotFound",mixins:[r.State],getInitialState:function(){return{notfound:[{contentUrl:"http://image.jsbn.com/static/404_01.jpg"},{contentUrl:"http://image.jsbn.com/static/404_02.jpg"},{contentUrl:"http://image.jsbn.com/static/404_03.jpg"}]}},componentDidMount:function(){var e=function(e){$(document.body).trigger("ModuleChanged",["#/shot"])};window.Core&&window.Core.promises["/"]&&$.when(window.Core.promises["/"]).then(e)},render:function(){var e=this.state.notfound;return a.createElement("div",{className:"samples-pringles-detail-view ypxq-eav"},$.map(e||[],function(e,t){return a.createElement("div",{key:t,className:"box-img"},a.createElement(o,{frameWidth:$(window).width()-20,url:e.contentUrl}))}))}});t.exports=i},{"../config/api.js":65,"./image-item.js":21,react:263,"react-router-ie8":100}],30:[function(e,t,n){"use strict";var a=e("react"),r=e("react-router-ie8"),o=e("../config/api.js"),i=e("./image-item.js"),s=a.createClass({displayName:"PhotoDetail",mixins:[r.State],getInitialState:function(){return{payload:[]}},componentDidMount:function(){var e=this,t=function(e){$(document.body).trigger("ModuleChanged",["#/shot"])},n=function(){var t=e.getPath();return o.httpGET(t,{})};window.Core&&window.Core.promises["/"]&&$.when(window.Core.promises["/"]).then(t),n().done(function(t){200===t.code&&e.setState({payload:t.data})}),$("#J_CommonHeader").hide()},render:function(){var e=this.state.payload.detailedImages||[];return e=e.length?e.reverse():e,a.createElement("div",{className:"samples-pringles-detail-view ypxq-eav"},$.map(e||[],function(e,t){return a.createElement("div",{key:t,className:"box-img"},a.createElement(i,{frameWidth:$(window).width(),url:e.imageUrl}))}))}});t.exports=s},{"../config/api.js":65,"./image-item.js":21,react:263,"react-router-ie8":100}],31:[function(e,t,n){"use strict";var a=e("react"),r=e("../config/api.js"),o=e("./image-item.js"),i=a.createClass({displayName:"Works",render:function(){var e=this.props.list.slice(0,this.props.pageSize),t=this.props.personId;return 0===e.length&&(e=[{},{}]),a.createElement("ul",{className:"list-11-js clearfix"},e.map(function(e,n){return a.createElement("li",{key:n,className:1===n?"column-9 mg0 J_ShowPhoto":"column-9 mgr10 J_ShowPhoto","data-big-img-url":e.contentUrl,"data-person-id":t,"data-works-id":e.contentId},a.createElement(o,{frameWidth:450,url:e.contentUrl,errorUrl:"http://placehold.it/450x300",newWin:1,detailUrl:"#/photographers/"+t+"/works/"+e.contentId}),"}")}))}}),s=a.createClass({displayName:"PhotographersList",getInitialState:function(){return{payload:[],baseUrl:""}},componentWillReceiveProps:function(e){var t=this,n=function(e,t){return r.httpGET(e,t)};$.each(e.resourceLinks,function(a,r){e.tplKey.indexOf(r)>-1&&n(r,{pageSize:e.pageSize,pageIndex:e.pageIndex}).done(function(e){var n=function(n){var a=$.map(e.data,function(e){return 1===e.levelId?e:null});t.setState({payload:a.concat(t.state.payload),baseUrl:n},function(){})};200===e.code&&e.data&&n(r)})})},render:function(){var e=this;return a.createElement("ul",{className:"list-20-js"},this.state.payload.map(function(t,n){return a.createElement("li",{key:n,className:"item-box"},a.createElement("div",{className:"info-box"},a.createElement("div",{className:"avatar-box"},a.createElement("img",{src:"dev"===window.Core.mode?t.photoUrl:t.photoUrl+"@200h_1e_1c_0i_1o_90q_1x"||"http://placehold.it/170x170"})),a.createElement("span",{className:"name"},t.personName),a.createElement("span",{className:"job"},t.level+"级摄影师"),a.createElement("span",{className:"btn-js btn-blue-1-js",style:{display:"none"}},"查看他的档期")),a.createElement(i,{list:t.list,personId:t.personId,pageSize:e.props.worksPageSize,pageIndex:e.props.worksPageIndex}))}))}});t.exports=s},{"../config/api.js":65,"./image-item.js":21,react:263}],32:[function(e,t,n){"use strict";var a=e("react"),r=e("react-router-ie8"),o=(e("../config/SKMap.js"),e("./top-slider.js"),e("./photographers-list.js")),i=e("./semiphotographers-list.js"),s=a.createClass({displayName:"Photographers",mixins:[r.State],getInitialState:function(){return{resourceLinks:{},pageSize:100,pageIndex:1}},componentWillUnmount:function(){window.Core.gallery&&window.Core.gallery.close(),window.Core.gallery=null,$("#nav_fixed").show()},componentDidMount:function(){var e=this,t=function(e){$(document.body).trigger("ModuleChanged",["#/shot"])},n=function(t){var n=window.Core.getResourcesLinks(e.getPathname(),"#/shot");n&&e.setState({resourceLinks:n})};window.Core&&window.Core.promises["/"]&&$.when(window.Core.promises["/"]).then(t).then(n)},render:function(){return a.createElement("div",{className:"main responsive-box clearfix"},a.createElement("div",{className:"director-photography-box"},a.createElement(o,{resourceLinks:["photographers"],tplKey:"photographers",pageIndex:this.state.pageIndex,pageSize:this.state.pageSize,worksPageIndex:"1",worksPageSize:"2"})),a.createElement(i,{resourceLinks:["photographers"],tplKey:"photographers",pageIndex:this.state.pageIndex,pageSize:this.state.pageSize,worksPageIndex:"1",worksPageSize:"4"}))}});t.exports=s},{"../config/SKMap.js":64,"./photographers-list.js":31,"./semiphotographers-list.js":45,"./top-slider.js":56,react:263,"react-router-ie8":100}],33:[function(e,t,n){"use strict";var a=e("react"),r=e("../config/api.js"),o=e("react-router-ie8"),i=e("./image-item.js"),s=e("./top-slider.js"),l=a.createClass({displayName:"ManInfo",render:function(){return a.createElement("div",{className:"figure"},a.createElement("div",{className:"avatar-box"},a.createElement(i,{url:this.props.avatar,frameWidth:120}),a.createElement("span",null)),a.createElement("h2",{className:"transition-color"},"策划师",a.createElement("b",{className:"transition-color"}," ",this.props.name," "),a.createElement("span",{style:{display:"none"}}," ","¥"+this.props.price," ")),a.createElement("p",null,this.props.description||""),a.createElement("span",{className:"btn-js btn-grayline-pink-1-js transition-bg",style:{display:"none"}}," 选择他 "))}}),c=a.createClass({displayName:"Works",render:function(){return a.createElement("ul",{className:"list-4-js list-4-1-js"},this.props.list.length>0&&$.map(this.props.list,function(e,t){return a.createElement("li",{className:"column-6 mgr20",key:t},a.createElement("a",{className:"pos-box","data-lightbox":"p"+t,href:e.imageUrl},a.createElement("div",{className:"hover-box"},a.createElement("div",{className:"pos-box"},a.createElement("div",{className:"info transition-bottom"},a.createElement("h2",{className:"transition-font-size"}),a.createElement("p",null)),a.createElement("div",{className:"mask-bg transition-opacity"}))),a.createElement("img",{src:e.imageUrl})),$.map(e.detailImages,function(e,n){return a.createElement("a",{href:e,key:n,"data-lightbox":"p"+t})}))}))}}),u=a.createClass({displayName:"Planners",mixins:[o.State],getInitialState:function(){return{payload:[],resourceLinks:{}}},componentDidMount:function(){var e=this,t=function(){return r.httpGET("planner",{pageSize:100,pageIndex:1})};$.when(window.Core.promises["/"]).then(function(){$(document.body).trigger("ModuleChanged",["#/scheme"]);var t=window.Core.getResourcesLinks(e.getPathname(),"#/scheme");e.setState({resourceLinks:t})}).then(t).done(function(t){e.setState({payload:t.data})})},render:function(){var e=this.state.payload||[];return a.createElement("div",{className:"main four-king-kong-view responsive-box clearfix"},a.createElement("div",{className:"custom-banner responsive-box"},a.createElement("div",{id:"slider_top",className:"slider-box-1-js responsive-box"},a.createElement(s,{tplKey:"top#adv",resourceLinks:this.state.resourceLinks,pageIndex:1,pageSize:10}))),a.createElement("ul",{className:"list-3-js list-3-2-js list-3-4-js"},$.map(e,function(e,t){return a.createElement("li",{key:t,style:{minHeight:"130px"}},a.createElement(l,{avatar:e.photoUrl,name:e.plannerName,description:e.description,price:e.price}),a.createElement(c,{list:e.list}))})))}});t.exports=u},{"../config/api.js":65,"./image-item.js":21,"./top-slider.js":56,react:263,"react-router-ie8":100}],34:[function(e,t,n){"use strict";var a=e("react"),r=e("react-router-ie8"),o=e("../config/api.js"),i=e("./image-item.js"),s=a.createClass({displayName:"PringlesDetail",mixins:[r.State],getInitialState:function(){return{payload:[]}},componentDidMount:function(){var e=this,t=function(e){$(document.body).trigger("ModuleChanged",["#/shot"])},n=function(){var t=e.getPath();return o.httpGET(t,{})};window.Core&&window.Core.promises["/"]&&$.when(window.Core.promises["/"]).then(t),n().done(function(t){200===t.code&&e.setState({payload:t.data})}),$("#J_CommonHeader").hide()},render:function(){var e=this.state.payload;return a.createElement("div",{className:"samples-pringles-detail-view ypxq-eav"},$.map(e||[],function(e,t){return a.createElement("div",{key:t,className:"box-img"},a.createElement(i,{frameWidth:$(window).width(),url:e.contentUrl}))}))}});t.exports=s},{"../config/api.js":65,"./image-item.js":21,react:263,"react-router-ie8":100}],35:[function(e,t,n){"use strict";var a=e("react"),r=e("./image-item.js"),o=e("../config/api.js"),i=a.createClass({displayName:"PringlesList",getInitialState:function(){return{payload:[],baseUrl:"",totalPage:0}},componentWillReceiveProps:function(e){var t=this,n=function(e,t){return o.httpGET(e,t)};$.each(e.resourceLinks,function(a,r){e.tplKey.indexOf(r.split("/")[0])>-1&&n(r.split("#")[1],{pageSize:e.pageSize,pageIndex:e.pageIndex,styleId:e.currentStyle}).done(function(n){200===n.code&&t.setState({payload:1===e.pageIndex?n.data:t.state.payload.concat(n.data),baseUrl:r.split("#")[1],totalPage:parseInt(n.totalCount)},function(){parseInt(n.totalCount)<=parseInt(e.pageIndex)*parseInt(e.pageSize)?$("#J_MoreButton").hide():$("#J_MoreButton").show()})})})},render:function(){var e=this.state.baseUrl;return a.createElement("div",{className:"pringles-list"},a.createElement("div",{className:"screening-results screening-results-1 mgb30 clearfix"},a.createElement("span",{className:"number"},"找到客片",a.createElement("b",null,this.state.totalPage),"套")),a.createElement("ul",{className:"list-6-js list-6-photoxs-1-js"},this.state.payload.map(function(t,n){return a.createElement("li",{className:"column-mg20-8 mgr30 mgb30",key:n},a.createElement(r,{detailBaseUrl:e,sid:t.contentId,frameWidth:400,frameHeight:600,url:t.contentUrl,errorUrl:"http://placehold.it/400x600"}),a.createElement("div",{className:"info transition-opacity-margin"},a.createElement("div",{className:"names flower-border"},a.createElement("h3",null,a.createElement("b",null,t.actorNameMale),a.createElement("i",{className:"ico-heart ico-heart-big"}),a.createElement("b",null,t.actorNameFemale))),a.createElement("span",{style:{display:"none"},className:"time"},t.createDate)),a.createElement("h2",{className:"transition-opacity"},t.contentName),a.createElement("a",{href:"#/"+e+"/"+t.contentId,target:"_blank",className:"mask-bg transition-height"}))})))}});t.exports=i},{"../config/api.js":65,"./image-item.js":21,react:263}],36:[function(e,t,n){"use strict";var a=e("react"),r=e("../config/api.js"),o=a.createClass({displayName:"PringlesMash",getInitialState:function(){return{payload:[{},{},{},{},{},{},{}],baseUrl:"#/"}},componentWillReceiveProps:function(e){var t=this,n=function(e,t){return r.httpGET(e,t)};$.each(e.resourceLinks,function(a,r){e.tplKey.indexOf(r.split("/")[0])>-1&&n(r.split("#")[1],{pageSize:8,pageIndex:1}).done(function(e){200===e.code&&t.setState({payload:e.data,baseUrl:r.split("#")[1]})})})},render:function(){var e=this.state.baseUrl;return a.createElement("ul",{className:"list-6-js list-6-photoxs-js clearfix",style:{display:"none"}},a.createElement("li",{className:"column-mg20-6 mgr20 mgb20"},a.createElement("div",{className:"photoxs-box-1"},a.createElement("a",{href:"#/pringles"},a.createElement("div",{className:"more clearfix"},a.createElement("span",null,"欣赏更多")),a.createElement("div",{className:"h2"},"客片欣赏")))),this.state.payload.map(function(t,n){return a.createElement("li",{key:n,className:"column-mg20-6 mgr20 mgb20"},a.createElement("a",{className:"pos-box",href:"#/"+e+"/"+t.contentId},a.createElement("div",{className:"img-box"},a.createElement("img",{src:t.contentUrl})),a.createElement("div",{className:"info transition-opacity-margin"},a.createElement("div",{className:"names flower-border"},a.createElement("h3",null,a.createElement("b",null,t.actorNameMale),a.createElement("i",{className:"ico-heart ico-heart-big"}),a.createElement("b",null,t.actorNameFemale))),a.createElement("i",{className:"circl"},"+"),a.createElement("span",{className:"time"},t.createDate)),a.createElement("h2",{className:"transition-opacity"},t.contentName),a.createElement("div",{className:"mask-bg transition-height"})))}))}});t.exports=o},{"../config/api.js":65,react:263}],37:[function(e,t,n){"use strict";var a=e("react"),r=e("react-router-ie8"),o=(e("../config/SKMap.js"),e("./top-slider.js")),i=e("./pringles-list.js"),s=e("../config/api.js"),l=a.createClass({displayName:"Pringles",mixins:[r.State],getInitialState:function(){return{resourceLinks:{},pageSize:9,pageIndex:1,stylesList:[],address:[],currentStyle:""}},loadMore:function(e){e.preventDefault(),this.setState(function(e,t){return{pageIndex:e.pageIndex+1}})},componentDidMount:function(){var e=this;$("#slider_top").Slider();var t=function(e){$(document.body).trigger("ModuleChanged",["#/shot"])},n=function(t){var n=window.Core.getResourcesLinks(e.getPathname(),"#/shot");e.setState({resourceLinks:n})},a=function(e){return s.httpGET("condition/styleAddress",{})};window.Core&&window.Core.promises["/"]&&$.when(window.Core.promises["/"]).then(t).then(n),$.when(a()).done(function(t){t.data&&t.data.style.length&&e.setState({stylesList:t.data.style,address:t.data.address})})},toggleFilter:function(e){var t=this;"SPAN"===e.target.tagName&&($(e.target).toggleClass("card-sel"),$(e.target).siblings().removeClass("card-sel"),t.setState({currentStyle:$(e.target).attr("data-style-id")===t.state.currentStyle?"":$(e.target).attr("data-style-id"),pageIndex:1}),console.log($(e.target).attr("data-style-id")===t.state.currentStyle))},toggleAddressFilter:function(e){var t=this;"SPAN"===e.target.tagName&&($(e.target).toggleClass("card-sel"),$(e.target).siblings().removeClass("card-sel"),t.setState({currentAddress:$(e.target).attr("data-address-id")===t.state.currentAddress?"":$(e.target).attr("data-address-id"),pageIndex:1}))},render:function(){this.state.stylesList,this.state.address;return a.createElement("div",{className:"pringles-page"},a.createElement("div",{className:"custom-banner responsive-box mgb30",style:{height:"514px"}},a.createElement("div",{id:"slider_top",className:"slider-box-1-js responsive-box",style:{height:"514px"}},a.createElement(o,{resourceLinks:this.state.resourceLinks,tplKey:"top#adv"}),a.createElement("div",{className:"info",style:{display:"none"}},a.createElement("div",{className:"pos-box"},a.createElement("h2",null,a.createElement("span",{className:"boy"},"TEST"),a.createElement("i",{className:"ico-heart ico-heart-normal"}),a.createElement("span",{className:"gril"},"呵呵")),a.createElement("span",{className:"time"},"2012-12-12"),a.createElement("span",{className:"hit"},"点击量:",a.createElement("b",{className:"num"},"测试123"))),a.createElement("div",{className:"mask-bg"})))),a.createElement("div",{className:"responsive-box clearfix"},a.createElement(i,{resourceLinks:this.state.resourceLinks,pageSize:this.state.pageSize,pageIndex:this.state.pageIndex,tplKey:"list#pringles"})),a.createElement("div",{onClick:this.loadMore,id:"J_MoreButton"},a.createElement("span",{className:"btn-more-1-js all-more-1 transition-bg"},"点击查看更多",a.createElement("div",{className:"arrow-box"},a.createElement("i",{className:"arrow-2-js arrow-2-rig-js"}),a.createElement("i",{className:"arrow-2-js arrow-2-rig-js"})))))}});t.exports=l},{"../config/SKMap.js":64,"../config/api.js":65,"./pringles-list.js":35,"./top-slider.js":56,react:263,"react-router-ie8":100}],38:[function(e,t,n){"use strict";var a=e("react"),r=a.createClass({displayName:"PutRequire",componentDidMount:function(){var e=function(e){$(document.body).trigger("ModuleChanged",["#/scheme"])};window.Core&&window.Core.promises["/"]&&$.when(window.Core.promises["/"]).then(e)},render:function(){return a.createElement("div",null,a.createElement("div",{className:"top-box-hqdz"},a.createElement("img",{src:"./assets/images/eavlee/hqdz/top.jpg"})),a.createElement("div",{className:"mid-box-hqdz"},a.createElement("img",{src:"./assets/images/eavlee/hqdz/mid.jpg"})),a.createElement("div",{className:"bot-box-hqdz"},a.createElement("a",{target:"_blank",href:"http://jsform.com/f/e7w5oq",className:"lef-img"},a.createElement("img",{src:"./assets/images/eavlee/hqdz/tjxq.png"})),a.createElement("a",{target:"_blank",href:"#/planners"},a.createElement("img",{src:"./assets/images/eavlee/hqdz/xchs.png"})),a.createElement("a",{target:"_blank",href:"#/f4",className:"rit-img"},a.createElement("img",{src:"./assets/images/eavlee/hqdz/xhlr.png"}))))}});t.exports=r},{react:263}],39:[function(e,t,n){"use strict";var a=e("react"),r=e("react-router-ie8"),o=(e("../config/api.js"),e("./image-item.js")),i=a.createClass({displayName:"SaleStrategy",mixins:[r.State],getInitialState:function(){return{libao:[{contentUrl:"http://image.jsbn.com/static/libao/libao_01.jpg"},{contentUrl:"http://image.jsbn.com/static/libao/libao_02.jpg"},{contentUrl:"http://image.jsbn.com/static/libao/libao_03.jpg"},{contentUrl:"http://image.jsbn.com/static/libao/libao_04.jpg"},{contentUrl:"http://image.jsbn.com/static/libao/libao_05.jpg"},{contentUrl:"http://image.jsbn.com/static/libao/libao_06.jpg"},{contentUrl:"http://image.jsbn.com/static/libao/libao_07.jpg"}],zuhe:[{contentUrl:"http://image.jsbn.com/static/youhui/youhui_01.jpg"},{contentUrl:"http://image.jsbn.com/static/youhui/youhui_02.jpg"},{contentUrl:"http://image.jsbn.com/static/youhui/youhui_03.jpg"},{contentUrl:"http://image.jsbn.com/static/youhui/youhui_04.jpg"},{contentUrl:"http://image.jsbn.com/static/youhui/youhui_05.jpg"},{contentUrl:"http://image.jsbn.com/static/youhui/youhui_06.jpg"},{contentUrl:"http://image.jsbn.com/static/youhui/youhui_07.jpg"},{contentUrl:"http://image.jsbn.com/static/youhui/youhui_08.jpg"},{contentUrl:"http://image.jsbn.com/static/youhui/youhui_09.jpg"},{contentUrl:"http://image.jsbn.com/static/youhui/youhui_10.jpg"},{contentUrl:"http://image.jsbn.com/static/youhui/youhui_11.jpg"},{contentUrl:"http://image.jsbn.com/static/youhui/youhui_12.jpg"},{contentUrl:"http://image.jsbn.com/static/youhui/youhui_13.jpg"}],taoxi:[{contentUrl:"http://image.jsbn.com/static/youhui/youhui_taoxi_01_01.jpg"},{contentUrl:"http://image.jsbn.com/static/youhui/youhui_taoxi_01_02.jpg"},{contentUrl:"http://image.jsbn.com/static/youhui/youhui_taoxi_01_03.jpg"},{contentUrl:"http://image.jsbn.com/static/youhui/youhui_taoxi_01_04.jpg"},{contentUrl:"http://image.jsbn.com/static/youhui/youhui_taoxi_01_05.jpg"},{contentUrl:"http://image.jsbn.com/static/youhui/youhui_taoxi_01_06.jpg"},{contentUrl:"http://image.jsbn.com/static/youhui/youhui_taoxi_01_07.jpg"},{contentUrl:"http://image.jsbn.com/static/youhui/youhui_taoxi_01_08.jpg"},{contentUrl:"http://image.jsbn.com/static/youhui/youhui_taoxi_01_09.jpg"},{contentUrl:"http://image.jsbn.com/static/youhui/youhui_taoxi_01_10.jpg"},{contentUrl:"http://image.jsbn.com/static/youhui/youhui_taoxi_01_11.jpg"},{contentUrl:"http://image.jsbn.com/static/youhui/youhui_taoxi_01_12.jpg"},{contentUrl:"http://image.jsbn.com/static/youhui/youhui_taoxi_01_13.jpg"},{contentUrl:"http://image.jsbn.com/static/youhui/youhui_taoxi_01_14.jpg"},{contentUrl:"http://image.jsbn.com/static/youhui/youhui_taoxi_01_15.jpg"},{contentUrl:"http://image.jsbn.com/static/youhui/youhui_taoxi_01_16.jpg"},{contentUrl:"http://image.jsbn.com/static/youhui/youhui_taoxi_01_17.jpg"},{contentUrl:"http://image.jsbn.com/static/youhui/youhui_taoxi_01_18.jpg"},{contentUrl:"http://image.jsbn.com/static/youhui/youhui_taoxi_01_19.jpg"},{contentUrl:"http://image.jsbn.com/static/youhui/youhui_taoxi_01_20.jpg"},{contentUrl:"http://image.jsbn.com/static/youhui/youhui_taoxi_01_21.jpg"},{contentUrl:"http://image.jsbn.com/static/youhui/youhui_taoxi_01_22.jpg"},{contentUrl:"http://image.jsbn.com/static/youhui/youhui_taoxi_01_23.jpg"}],hqxq:[{contentUrl:"http://image.jsbn.com/static/xqti/hqdz/xqtj-01.jpg"},{contentUrl:"http://image.jsbn.com/static/xqti/hqdz/xqtj-02.jpg"},{contentUrl:"http://image.jsbn.com/static/xqti/hqdz/xqtj-03.jpg"},{contentUrl:"http://image.jsbn.com/static/xqti/hqdz/xqtj-04.jpg"}]}},componentDidMount:function(){var e=this,t=function(t){var n=e.getQuery().type,a="libao"===n?"#/hotel":"#/home";$(document.body).trigger("ModuleChanged",[a])};window.Core&&window.Core.promises["/"]&&$.when(window.Core.promises["/"]).then(t),$("#J_CommonHeader").hide()},render:function(){var e=this.state[this.getQuery().type]||[];return a.createElement("div",{className:"samples-pringles-detail-view ypxq-eav"},$.map(e||[],function(e,t){return a.createElement("div",{key:t,className:"box-img"},a.createElement(o,{frameWidth:1920,url:e.contentUrl}))}))}});t.exports=i},{"../config/api.js":65,"./image-item.js":21,react:263,"react-router-ie8":100}],40:[function(e,t,n){"use strict";var a=e("react"),r=e("react-router-ie8"),o=e("../config/api.js"),i=e("./image-item.js"),s=a.createClass({displayName:"SamplesDetail",mixins:[r.State],getInitialState:function(){return{payload:[]}},componentDidMount:function(){var e=this,t=function(e){$(document.body).trigger("ModuleChanged",["#/shot"])},n=function(){var t=e.getPath();return o.httpGET(t,{})};window.Core&&window.Core.promises["/"]&&$.when(window.Core.promises["/"]).then(t),n().done(function(t){200===t.code&&e.setState({payload:t.data})}),$("#J_CommonHeader").hide()},render:function(){var e=this.state.payload;return a.createElement("div",{className:"samples-pringles-detail-view ypxq-eav"},$.map(e||[],function(e,t){return a.createElement("div",{key:t,className:"box-img"},a.createElement(i,{frameWidth:$(window).width(),url:e.contentUrl}))}))}});t.exports=s},{"../config/api.js":65,"./image-item.js":21,react:263,"react-router-ie8":100}],41:[function(e,t,n){"use strict";var a=e("react"),r=e("../config/api.js"),o=e("./image-item.js"),i=a.createClass({displayName:"SamplesList",getInitialState:function(){return{payload:[],baseUrl:"",totalPage:0}},componentWillReceiveProps:function(e){var t=this,n=function(e,t){return r.httpGET(e,t)},a={pageSize:e.pageSize,pageIndex:e.pageIndex};e.currentStyle&&""!==e.currentStyle&&(a.styleId=e.currentStyle),e.currentAddress&&""!==e.currentAddress&&(a.addressId=e.currentAddress),$.each(e.resourceLinks,function(r,o){e.tplKey.indexOf(o.split("/")[0])>-1&&n(o.split("#")[1],a).done(function(n){200===n.code&&t.setState({payload:1===e.pageIndex?n.data:t.state.payload.concat(n.data),baseUrl:o.split("#")[1],totalPage:parseInt(n.totalCount)},function(){parseInt(n.totalCount)<=parseInt(e.pageIndex)*parseInt(e.pageSize)?$("#J_MoreButton").hide():$("#J_MoreButton").show()})})})},render:function(){var e=this.state.baseUrl;return a.createElement("div",{className:"samples-list"},a.createElement("div",{className:"screening-results screening-results-1 mgb30 clearfix"},a.createElement("span",{className:"number"},"找到样片",a.createElement("b",null,this.state.totalPage),"套")),a.createElement("ul",{className:"list-10-js list-10-photoxs-js clearfix"},this.state.payload.map(function(t,n){return a.createElement("li",{className:"column-mg20-8 mgr30 mgb30",key:n},a.createElement(o,{detailBaseUrl:e,newWin:1,sid:t.contentId,frameWidth:400,frameHeight:600,url:t.contentUrl,errorUrl:"http://placehold.it/400x600"}),a.createElement("h2",{className:"transition-opacity"},t.contentName),a.createElement("div",{className:"mask-bg transition-opacity"}))})))}});t.exports=i},{"../config/api.js":65,"./image-item.js":21,react:263}],42:[function(e,t,n){"use strict";var a=e("react"),r=e("../config/api.js"),o=e("./image-item.js"),i=a.createClass({displayName:"SamplesMash",getInitialState:function(){return{payload:[{},{},{},{},{},{},{},{}],baseUrl:"#/"}},componentWillReceiveProps:function(e){var t=this,n=function(e,t){return r.httpGET(e,t)};$.each(e.resourceLinks,function(a,r){e.tplKey.indexOf(r.split("/")[0])>-1&&n(r.split("#")[1],{pageSize:9,pageIndex:1}).done(function(e){200===e.code&&t.setState({payload:e.data,baseUrl:r.split("#")[1]})})})},render:function(){var e=this.state.baseUrl;return a.createElement("ul",{className:"list-10-js list-10-photoxs-js clearfix"},this.state.payload.map(function(t,n){return a.createElement("li",{key:n,className:"column-mg20-8 mgr30 mgb30"},a.createElement(o,{detailBaseUrl:e,sid:t.contentId,frameHeight:550,url:t.contentUrl,newWin:1,errorUrl:"http://placehold.it/380x550"}),a.createElement("h2",{className:"transition-opacity"},t.contentName),a.createElement("div",{className:"mask-bg transition-opacity"}))}))}});t.exports=i},{"../config/api.js":65,"./image-item.js":21,react:263}],43:[function(e,t,n){"use strict";var a=e("react"),r=e("react-router-ie8"),o=(e("../config/SKMap.js"),e("./top-slider.js")),i=e("./samples-list.js"),s=e("../config/api.js"),l=a.createClass({displayName:"Samples",mixins:[r.State],getInitialState:function(){return{resourceLinks:{},pageSize:6,pageIndex:1,stylesList:[],address:[],currentStyle:"",currentAddress:""}},loadMore:function(e){e.preventDefault(),this.setState(function(e,t){return{pageIndex:e.pageIndex+1}})},componentDidMount:function(){var e=this;$("#slider_top").Slider();var t=function(e){$(document.body).trigger("ModuleChanged",["#/shot"])},n=function(t){var n=window.Core.getResourcesLinks(e.getPathname(),"#/shot");e.setState({resourceLinks:n})},a=function(e){return s.httpGET("condition/styleAddress",{})};window.Core&&window.Core.promises["/"]&&$.when(window.Core.promises["/"]).then(t).then(n),$.when(a()).done(function(t){t.data&&t.data.style.length&&e.setState({stylesList:t.data.style,address:t.data.address})})},toggleFun:function(e){var t=this;"SPAN"===e.target.tagName&&$(e.target).hasClass("card")&&"J_CardStyle"===$(e.target).parent("div").attr("id")?($(".J_FilterCtrl .card").removeClass("card-sel"),$(e.target).toggleClass("card-sel"),($(e.target).attr("data-style-id")!==t.state.currentStyle||""===t.state.currentStyle)&&t.setState({currentStyle:$(e.target).attr("data-style-id"),pageIndex:1,currentAddress:""})):"SPAN"===e.target.tagName&&$(e.target).hasClass("card")&&"J_CardAddress"===$(e.target).parent("div").attr("id")&&($(".J_FilterCtrl .card").removeClass("card-sel"),$(e.target).toggleClass("card-sel"),($(e.target).attr("data-address-id")!==t.state.currentAddress||""===t.state.currentAddress)&&t.setState({currentAddress:$(e.target).attr("data-address-id"),pageIndex:1,currentStyle:""}))},toggleFilter:function(e){var t=this;"SPAN"===e.target.tagName&&($(e.target).toggleClass("card-sel"),$(e.target).siblings().removeClass("card-sel"),t.setState({currentStyle:$(e.target).attr("data-style-id")===t.state.currentStyle?"":$(e.target).attr("data-style-id"),pageIndex:1}))},toggleAddressFilter:function(e){var t=this;"SPAN"===e.target.tagName&&($(e.target).toggleClass("card-sel"),$(e.target).siblings().removeClass("card-sel"),t.setState({currentAddress:$(e.target).attr("data-address-id")===t.state.currentAddress?"":$(e.target).attr("data-address-id"),pageIndex:1}))},render:function(){var e=this.state.stylesList,t=this.state.address;return a.createElement("div",{className:"samples-page"},a.createElement("div",{className:"custom-banner responsive-box mgb30"},a.createElement("div",{id:"slider_top",className:"slider-box-1-js responsive-box"},a.createElement(o,{resourceLinks:this.state.resourceLinks,tplKey:"top#adv"}))),a.createElement("div",{className:"main responsive-box clearfix"},a.createElement("div",{className:"sel-card-1-js clearfix"},a.createElement("span",{className:"card card-sel"},"分类查看"),a.createElement("div",{className:"line-bottom"})),a.createElement("div",{className:"J_FilterCtrl",onClick:this.toggleFun},a.createElement("div",{className:"sel-card-2-js clearfix"},a.createElement("span",{className:"title"},a.createElement("i",{className:"ico-1-js ico-1-2-js"}),a.createElement("b",null,"风格")),a.createElement("div",{className:"card-box column-mg20-20",id:"J_CardStyle"},a.createElement("span",{className:"card card-sel","data-style-id":""},"全部"),$.map(e,function(e,t){return a.createElement("span",{key:e.styleId,"data-style-id":e.styleId,className:"card"},e.styleName)}))),a.createElement("div",{className:"sel-card-2-js clearfix"},a.createElement("span",{className:"title"},a.createElement("i",{className:"ico-1-js ico-1-3-js"}),a.createElement("b",null,"地点")),a.createElement("div",{className:"card-box column-mg20-20",id:"J_CardAddress"},a.createElement("span",{className:"card","data-address-id":""},"全部"),$.map(t,function(e,t){return a.createElement("span",{key:e.addressId,"data-address-id":e.addressId,className:"card"},e.addressName)})))),a.createElement(i,{resourceLinks:this.state.resourceLinks,pageIndex:this.state.pageIndex,pageSize:this.state.pageSize,tplKey:"list#samples",currentStyle:this.state.currentStyle,currentAddress:this.state.currentAddress}),a.createElement("div",{onClick:this.loadMore,id:"J_MoreButton"},a.createElement("span",{className:"btn-more-1-js all-more-1 transition-bg"},"点击查看更多",a.createElement("div",{className:"arrow-box"},a.createElement("i",{className:"arrow-2-js arrow-2-rig-js"}),a.createElement("i",{className:"arrow-2-js arrow-2-rig-js"}))))))}});t.exports=l},{"../config/SKMap.js":64,"../config/api.js":65,"./samples-list.js":41,"./top-slider.js":56,react:263,"react-router-ie8":100}],44:[function(e,t,n){"use strict";var a=e("react"),r=e("react-router-ie8"),o=(e("../config/SKMap.js"),e("./top-slider.js")),i=e("./image-item.js"),s=e("../config/api.js"),l=a.createClass({displayName:"VideoMash",getInitialState:function(){return{items:[]}},componentWillReceiveProps:function(e){var t=this,n=[];e.resourceLinks&&e.tplKey&&e.resourceLinks!==this.props.resourceLinks&&$.each(e.resourceLinks,function(a,r){e.tplKey.indexOf(r.split("/")[0])>-1&&a.indexOf(t.props.nameKey)>-1&&n.push({url:r.split("#")[1],title:a,p:[]})});var a=function(e){return function(a){200===a.code&&a.data.length>0&&(e.p=a.data,t.setState({items:n}))}};$.each(n,function(e,t){s.httpGET(t.url,{pageIndex:1,pageSize:5}).done(a(t))})},render:function(){var e=this,t=0;return console.log("items:",e.state.items),a.createElement("div",{className:"movie-box-eav responsive-box"},a.createElement("div",{className:"box-l"},a.createElement(i,{klassName:"l-item",url:e.state.items[0]&&e.state.items[0].p[0]&&e.state.items[0].p[0].contentUrl||"http://placehold.it/620x375",frameWidth:620,frameHeight:375,detailUrl:e.state.items[0]&&e.state.items[0].p[0]&&e.state.items[0].p[0].detailUrl})),a.createElement("div",{className:"box-r"},$.map(e.state.items[0]&&e.state.items[0].p.slice(1)||[],function(e,n){return a.createElement(i,{klassName:"r-item",url:e.contentUrl||"http://placehold.it/270x180",frameWidth:270,frameHeight:180,detailUrl:e.detailUrl,key:t++})})))}}),c=a.createClass({displayName:"SchemeList",getInitialState:function(){return{payload:[],baseUrl:"",totalPage:0}},componentWillReceiveProps:function(e){var t=this,n=function(e,t){
return s.httpGET(e,t)};$.each(e.resourceLinks,function(a,r){e.tplKey.indexOf(r.split("/")[0])>-1&&n(r.split("#")[1],{pageSize:6,pageIndex:1}).done(function(e){200===e.code&&t.setState({payload:e.data,baseUrl:r.split("#")[1],totalPage:parseInt(e.totalCount)},function(){})})})},render:function(){var e=this,t=this.state.baseUrl;return a.createElement("ul",{className:"list-2-js clearfix"},$.map(e.state.payload,function(e,n){return a.createElement("li",{className:"column-mg20-8 mgr30 mgb30",key:n},a.createElement("a",{href:"#/"+t+"/"+e.weddingCaseId,className:"hover-box transition-opacity"},a.createElement("div",{className:"pos-box"},a.createElement("h3",null,e.schemeName),a.createElement("div",{className:"etc-info"},a.createElement("b",null),a.createElement("span",null,"(",e.weddingDate,")")),a.createElement("div",{className:"mask-bg"}))),a.createElement(i,{sid:e.weddingCaseId+"",frameWidth:380,frameHeight:250,url:e.weddingCaseImage,detailUrl:e.detailUrl,errorUrl:"http://placehold.it/380x250",detailBaseUrl:t}))}))}}),u=a.createClass({displayName:"Scheme",mixins:[r.State],getInitialState:function(){return{resourceLinks:{}}},componentDidMount:function(){var e=this,t=function(t){$(document.body).trigger("ModuleChanged",["#"+e.getPathname()])},n=function(t){var n=window.Core.getResourcesLinks(e.getPathname(),"#/scheme");n&&e.setState({resourceLinks:n})};window.Core&&window.Core.promises["/"]&&$.when(window.Core.promises["/"]).then(t).then(n)},render:function(){return a.createElement("div",{className:"main-body-eav"},a.createElement("div",{className:"custom-banner responsive-box mgb50"},a.createElement("div",{id:"slider_top",className:"slider-box-1-js responsive-box"},a.createElement(o,{resourceLinks:this.state.resourceLinks,tplKey:"top#adv"}))),a.createElement(l,{tplKey:"mid#adv",resourceLinks:this.state.resourceLinks,nameKey:"热区广告"}),a.createElement(c,{tplKey:"list#scheme",resourceLinks:this.state.resourceLinks}),a.createElement("div",{className:"space-70-eav"}),a.createElement("div",{className:"title-5-js mgb20"},a.createElement("h1",null,"金色百年策划师团队"),a.createElement("span",null,"汇集最策划团队 供你自由选择组合")),a.createElement("div",{className:"planner-box-hqsy clearfix",style:{display:"none"}},a.createElement("img",{src:"http://yx.jsbn.com/images/婚庆/u20739.png"}),a.createElement("div",{className:"cover"},"金色百年造型师团队")),a.createElement("div",{className:"space-70-eav"}),a.createElement("div",{className:"title-5-js mgb50"},a.createElement("h1",null,"婚礼人"),a.createElement("span",null,"汇集最优秀婚礼人 供您选择")),a.createElement("ul",{className:"list-12-js list-12-1-js mgb50 clearfix"},a.createElement("li",{className:"column-mg10-5"},a.createElement("a",{href:"#/f4?tab=host",className:"img-box"},a.createElement("img",{src:"http://image.jsbn.com/static/host.png"})),a.createElement("h2",null,"主持人")),a.createElement("li",{className:"column-mg10-5"},a.createElement("a",{href:"#/f4?tab=dresser",className:"img-box"},a.createElement("img",{src:"http://image.jsbn.com/static/stylist.png"})),a.createElement("h2",null,"化妆师")),a.createElement("li",{className:"column-mg10-5"},a.createElement("a",{href:"#/f4?tab=photographer",className:"img-box"},a.createElement("img",{src:"http://image.jsbn.com/static/photographers.png"})),a.createElement("h2",null,"摄影师")),a.createElement("li",{className:"column-mg10-5 mg0"},a.createElement("a",{href:"#/f4?tab=camera",className:"img-box"},a.createElement("img",{src:"http://image.jsbn.com/static/camora.png"})),a.createElement("h2",null,"摄像师"))))}});t.exports=u},{"../config/SKMap.js":64,"../config/api.js":65,"./image-item.js":21,"./top-slider.js":56,react:263,"react-router-ie8":100}],45:[function(e,t,n){"use strict";var a=e("react"),r=(a.PropTypes,e("../config/api.js")),o=e("./image-item.js"),i=a.createClass({displayName:"WorksList",render:function(){var e=this.props.works.splice(0,this.props.worksPageSize),t=this.props.personId;return 0===e.length&&(e=[{},{},{},{}]),a.createElement("ul",{className:"list-11-js"},e.map(function(e,n){return a.createElement("li",{key:n,className:3===n?"column-4 mg0 J_ShowPhoto ":"column-4 mgr10 J_ShowPhoto","data-big-img-url":e.contentUrl,"data-index":n,"data-works-id":e.contentId,"data-person-id":t},a.createElement(o,{frameWidth:200,url:e.contentUrl,newWin:1,detailUrl:"#/photographers/"+t+"/works/"+e.contentId,errorUrl:"http://placehold.it/200x280"}))}))}}),s=a.createClass({displayName:"SemiPhotographersList",getInitialState:function(){return{payload:[],baseUrl:""}},componentWillUnmount:function(){window.Core.gallery&&window.Core.gallery.close(),window.Core.gallery=null},componentWillReceiveProps:function(e){var t=this,n=function(e,t){return r.httpGET(e,t)};$.each(e.resourceLinks,function(a,r){e.tplKey.indexOf(r)>-1&&n(r,{pageSize:e.pageSize,pageIndex:e.pageIndex}).done(function(e){var n=function(n){var a=$.map(e.data,function(e){return 2===e.levelId?e:null});t.setState({payload:a.concat(t.state.payload),baseUrl:n},function(){})};200===e.code&&e.data&&n(r)})})},render:function(){var e=this.state.payload,t=this.props.worksPageSize;return a.createElement("div",null,e.length>0&&a.createElement("div",{className:"dividing-line-box clearfix"}," ",a.createElement("div",{className:"line-zj"})," ",a.createElement("div",{className:"line-1-js"})," ",a.createElement("div",{className:"line-gj"})," "),a.createElement("ul",{className:"list-3-js list-3-1-js mgb30 clearfix"},e.map(function(e,n){return a.createElement("li",{key:n},a.createElement("a",{className:"figure"},a.createElement("div",{className:"avatar-box"},a.createElement("img",{src:"dev"===window.Core.mode?e.photoUrl:e.photoUrl+"@120h_1e_1c_0i_1o_90q_1x"||"http://placehold.it/120x120"}),a.createElement("span",{style:{display:"none"}},"关注",a.createElement("b",null,"(0)"))),a.createElement("h2",{className:"transition-color"},e.personName),a.createElement("p",null,"职位:",a.createElement("b",null,e.level+"摄影师")),a.createElement("div",{className:"score"},a.createElement("span",null,"新人评价"),a.createElement("div",{className:"box"},a.createElement("i",{className:"ico-heart ico-heart-small"}),a.createElement("i",{className:"ico-heart ico-heart-small"}),a.createElement("i",{className:"ico-heart ico-heart-small"}),a.createElement("i",{className:"ico-heart ico-heart-small"}),a.createElement("i",{className:"ico-heart ico-heart-small"}))),a.createElement("span",{className:"btn-js btn-grayline-pink-1-js transition-bg",style:{display:"none"}},"查看他的档期")),a.createElement(i,{works:e.list,personId:e.personId,worksPageSize:t}))})))}});t.exports=s},{"../config/api.js":65,"./image-item.js":21,react:263}],46:[function(e,t,n){"use strict";var a=e("react"),r=e("react-router-ie8"),o=(r.RouteHandler,e("../config/SKMap.js"),e("./top-slider.js"),e("./samples-mash.js")),i=e("./pringles-mash.js"),s=e("./image-item.js"),l=e("../config/api.js"),c=a.createClass({displayName:"Shot",mixins:[r.State],getInitialState:function(){return{payload:[],pageSize:10,pageIndex:1,tplKey:"top#adv",baseUrl:"",resourceLinks:{}}},componentDidMount:function(){var e=this,t=function(t){$(document.body).trigger("ModuleChanged",["#"+e.getPathname()])},n=function(t){var n=window.Core.getResourcesLinks(e.getPathname(),"#/shot");e.setState({resourceLinks:n}),$.each(n,function(t,n){e.state.tplKey.indexOf(n.split("/")[0])>-1&&l.httpGET(n.split("#")[1],{pageSize:e.state.pageSize,pageIndex:e.state.pageIndex}).done(function(t){200===t.code&&t.data&&e.setState({payload:t.data,baseUrl:n.split("#")[1]},function(){$("#slider_hssy_f").length>0&&$("#slider_hssy_f").Slider(),$("#slider_hssy").length>0&&$("#slider_hssy").Slider()})})})};window.Core&&window.Core.promises["/"]&&$.when(window.Core.promises["/"]).then(t).then(n)},render:function(){var e=this.state.payload||[],t=e.length<9?"0"+e.length:""+e.length;return a.createElement("div",{className:"container"},a.createElement("div",{className:"custom-banner custom-container-banner container"},a.createElement("div",{className:"num-box"},a.createElement("div",{className:"pos-box"},a.createElement("span",{id:"img_index"},"1"),a.createElement("em",null,"/"),a.createElement("b",null,t))),a.createElement("div",{className:"custom-banner-intr-bg"},a.createElement("div",{className:"pos-box"},a.createElement("i",{className:"rect-1-js"}))),a.createElement("div",{className:"blur-box",id:"blur-box"},a.createElement("div",{className:"pos-box"},a.createElement("div",{id:"slider_hssy_f",className:"slider-box-1-js container"},a.createElement("ul",{className:"slider item-box"},e.length>0&&$.map(e,function(e,t){return a.createElement("li",{className:"item transition-opacity-1",key:t},a.createElement(s,{frameWidth:1920,frameHeight:690,url:e.contentUrl,errorUrl:"http://placehold.it/1920x690"}))}))))),a.createElement("div",{id:"slider_hssy",className:"slider-box-1-js container"},a.createElement("ul",{className:"slider item-box"},e.length>0&&$.map(e,function(e,t){return a.createElement("li",{className:"item transition-opacity-1",key:t},a.createElement(s,{detailUrl:e.detailUrl,frameWidth:1920,frameHeight:690,url:e.contentUrl,errorUrl:"http://placehold.it/1920x690"}))})))),a.createElement("div",{className:"space-30-eav"}),a.createElement("div",{className:"main responsive-box clearfix"},a.createElement("div",{className:"adv-1 shot-adv mgb30"},a.createElement("div",{className:"pos-box"},a.createElement("a",{href:"http://"+window.location.hostname+"/#/suite/10025/20060",className:"suite-link transition-opacity"}),a.createElement("a",{href:"http://"+window.location.hostname+"/#/samples",className:"samples-link transition-opacity"}),a.createElement("a",{href:"http://"+window.location.hostname+"/#/pringles",className:"pringles-link transition-opacity"}),a.createElement("a",{href:"http://"+window.location.hostname+"/#/weddingmv",className:"suite-home-link transition-opacity"}),a.createElement("a",{href:"http://"+window.location.hostname+"/#/suite",className:"weddingmv-link transition-opacity"}),a.createElement("img",{src:"http://image.jsbn.com/static/shot-hot.jpg@1200w_80q"}))),a.createElement("a",{href:"#/samples",style:{display:"block"},className:"test-title-1"}),a.createElement(o,{resourceLinks:this.state.resourceLinks,tplKey:"list#samples"}),a.createElement("div",{className:"container-ad-1 mgb30",style:{display:"none"}},a.createElement("a",{href:""},a.createElement("img",{src:"assets/images/test/ad_1.png"}))),a.createElement(i,{resourceLinks:this.state.resourceLinks,tplKey:"list#pringles"}),a.createElement("div",{className:"title-10-js mgt50 mgb30"},a.createElement("div",{className:"title-box"},a.createElement("h1",null,"选摄影师"),a.createElement("h2",null,"THE PHOTOGRAHPER")),a.createElement("div",{className:"line-middle"})),a.createElement("div",{className:"container-ad-1 mgb50"},a.createElement("a",null,a.createElement("img",{src:"dev"===window.Core.mode?"http://image.jsbn.com/static/photographer-1.jpg":"http://image.jsbn.com/static/photographer-1.jpg@1200w_1e_1c_0i_1o_90q_1x"}))),a.createElement("div",{className:"title-10-js mgb30"},a.createElement("div",{className:"title-box"},a.createElement("h1",null,"选造型师"),a.createElement("h2",null,"THE SATISFASHION")),a.createElement("div",{className:"line-middle"})),a.createElement("div",{className:"container-ad-1 mgb50"},a.createElement("a",null,a.createElement("img",{src:"dev"===window.Core.mode?"http://image.jsbn.com/static/satisfashion-1.jpg":"http://image.jsbn.com/static/satisfashion-1.jpg@1200w_1e_1c_0i_1o_90q_1x"})))))}});t.exports=c},{"../config/SKMap.js":64,"../config/api.js":65,"./image-item.js":21,"./pringles-mash.js":36,"./samples-mash.js":42,"./top-slider.js":56,react:263,"react-router-ie8":100}],47:[function(e,t,n){"use strict";var a=e("react"),r=(a.PropTypes,e("./image-item.js")),o=a.createClass({displayName:"StaticActivies",componentDidMount:function(){var e=function(e){$(document.body).trigger("ModuleChanged",["#/shot"])};window.Core&&window.Core.promises["/"]&&$.when(window.Core.promises["/"]).then(e)},render:function(){var e=["http://image.jsbn.com/static/activities/01.jpg","http://image.jsbn.com/static/activities/02.jpg","http://image.jsbn.com/static/activities/03.jpg","http://image.jsbn.com/static/activities/04.jpg","http://image.jsbn.com/static/activities/05.jpg","http://image.jsbn.com/static/activities/06.jpg","http://image.jsbn.com/static/activities/07.jpg","http://image.jsbn.com/static/activities/08.jpg","http://image.jsbn.com/static/activities/09.jpg","http://image.jsbn.com/static/activities/10.jpg","http://image.jsbn.com/static/activities/11.jpg","http://image.jsbn.com/static/activities/12.jpg","http://image.jsbn.com/static/activities/13.jpg","http://image.jsbn.com/static/activities/14.jpg","http://image.jsbn.com/static/activities/15.jpg","http://image.jsbn.com/static/activities/16.jpg","http://image.jsbn.com/static/activities/17.jpg","http://image.jsbn.com/static/activities/18.jpg","http://image.jsbn.com/static/activities/19.jpg","http://image.jsbn.com/static/activities/20.jpg"];return a.createElement("div",{className:"container mgt30 clearfix",style:{overflow:"hidden",height:"7280px",position:"relative"}},a.createElement("div",{className:"photo-box clearfix",style:{width:"1920px",position:"absolute",height:"100%",left:"50%",marginLeft:"-960px"}},$.map(e,function(e,t){return a.createElement("div",{key:t,className:"bottom",style:{height:"auto"}},a.createElement(r,{frameWidth:1920,url:e,style:{"float":"left",width:"100%"},errorUrl:"http://placehold.it/1920x450"}))})))}});t.exports=o},{"./image-item.js":21,react:263}],48:[function(e,t,n){"use strict";var a=e("react"),r=(a.PropTypes,e("./image-item.js")),o=e("../config/api.js"),i=a.createClass({displayName:"WorksList",render:function(){var e=this.props.personId,t=this.props.works.splice(0,this.props.worksPageSize);return 0===t.length&&(t=["http://placehold.it/200x280","http://placehold.it/200x280","http://placehold.it/200x280","http://placehold.it/200x280"]),a.createElement("ul",{className:"list-11-js"},t.map(function(t,n){return a.createElement("li",{key:n,className:3===n?"column-4 mg0 J_ShowPhoto":"column-4 mgr10 J_ShowPhoto","data-big-img-url":t.contentUrl,"data-index":n,"data-person-id":e,"data-works-id":t.contentId},a.createElement(r,{frameWidth:200,url:t.contentUrl,errorUrl:"http://placehold.it/200x280"}))}))}}),s=a.createClass({displayName:"StylistsList",getInitialState:function(){return{payload:[],baseUrl:""}},showPhotoSwipe:function(e){window.Core.gallery&&window.Core.gallery.close();var t=document.querySelectorAll(".pswp")[0];$("#nav_fixed").hide();var n={history:!1,focus:!1,showAnimationDuration:0,hideAnimationDuration:0,tapToClose:!0},a=new PhotoSwipe(t,PhotoSwipeUI_Default,e,n);a.init(),a.goTo(0),window.Core.gallery=a},buildItems:function(e){return 0===e.length?[]:$.map(e,function(e,t){var n=/_(\d{1,4})x(\d{1,4})\.\w+g$/i,a=e.imageUrl&&e.imageUrl.match(n),r=-1,o=-1;a&&3===a.length&&(r=parseInt(a[1]),o=parseInt(a[2]));var i={src:e.imageUrl||"http://placehold.it/1200x800",w:r,h:o};return i})},componentWillReceiveProps:function(e){var t=this,n=function(e,t){return o.httpGET(e,t)};$.each(e.resourceLinks,function(a,r){e.tplKey.indexOf(r)>-1&&n(r,{pageSize:e.pageSize,pageIndex:e.pageIndex}).done(function(e){var n=function(n){var a=$.map(e.data,function(e){return 2===e.levelId?e:null});t.setState({payload:a.concat(t.state.payload),baseUrl:n},function(){$(".J_ShowPhoto").delegate("a","click",function(){var e=$(this).parent(".J_ShowPhoto").attr("data-person-id"),n=$(this).parent(".J_ShowPhoto").attr("data-works-id");return o.httpGET("photographers/"+e+"/works/"+n,{pageIndex:1,pageSize:100}).done(function(e){var n=t.buildItems(e.data.detailedImages);t.showPhotoSwipe(n)}),!1})})};200===e.code&&e.data&&e.data.length>0&&n(r)})})},render:function(){var e=this.state.payload,t=this.props.worksPageSize;return a.createElement("div",null,e.length>0&&a.createElement("div",{className:"dividing-line-box clearfix"}," ",a.createElement("div",{className:"line-zj"})," ",a.createElement("div",{className:"line-1-js"})," ",a.createElement("div",{className:"line-gj"})," "),a.createElement("ul",{className:"list-3-js list-3-1-js mgb30 clearfix"},e.length>0&&$.map(e,function(e,n){return a.createElement("li",{key:n},a.createElement("a",{className:"figure"},a.createElement("div",{className:"avatar-box"},a.createElement("img",{src:"dev"===window.Core.mode?e.photoUrl:e.photoUrl+"@120h_1e_1c_0i_1o_90q_1x"}),a.createElement("span",null,"关注",a.createElement("b",null,"(0)"))),a.createElement("h2",{className:"transition-color"},e.personName),a.createElement("p",null,"职位:",a.createElement("b",null,e.level+"造型师"),a.createElement("br",null)),a.createElement("div",{className:"score"},a.createElement("span",null,"新人评价"),a.createElement("i",null),a.createElement("div",{className:"box"},a.createElement("i",{className:"ico-heart ico-heart-small"}),a.createElement("i",{className:"ico-heart ico-heart-small"}),a.createElement("i",{className:"ico-heart ico-heart-small"}),a.createElement("i",{className:"ico-heart ico-heart-small"}),a.createElement("i",{className:"ico-heart ico-heart-small"}))),a.createElement("span",{style:{display:"none"},className:"btn-js btn-grayline-pink-1-js transition-bg"},"选择他")),a.createElement(i,{works:e.list,personId:e.personId,worksPageSize:t}))})))}});t.exports=s},{"../config/api.js":65,"./image-item.js":21,react:263}],49:[function(e,t,n){"use strict";var a=e("react"),r=e("react-router-ie8"),o=e("./stylists-list.js"),i=e("./head-stylists-list.js"),s=a.createClass({displayName:"Stylists",mixins:[r.State],componentDidMount:function(){var e=this,t=function(){$(document.body).trigger("ModuleChanged",["#/shot"])},n=function(t){var n=window.Core.getResourcesLinks(e.getPathname(),"#/shot");n&&e.setState({resourceLinks:n})};$.when(window.Core.promises["/"]).then(t).then(n)},getInitialState:function(){return{resourceLinks:{},pageSize:100,pageIndex:1}},componentWillUnmount:function(){window.Core.gallery&&window.Core.gallery.close(),window.Core.gallery=null,$("#nav_fixed").show()},render:function(){return a.createElement("div",{className:"main responsive-box clearfix"},a.createElement("div",{className:"director-photography-box"},a.createElement(i,{resourceLinks:["stylist"],tplKey:"stylists",pageIndex:this.state.pageIndex,pageSize:this.state.pageSize,worksPageIndex:"1",worksPageSize:"2"})),a.createElement(o,{resourceLinks:["stylist"],tplKey:"stylists",pageIndex:this.state.pageIndex,pageSize:this.state.pageSize,worksPageIndex:"1",worksPageSize:"4"}))}});t.exports=s},{"./head-stylists-list.js":12,"./stylists-list.js":48,react:263,"react-router-ie8":100}],50:[function(e,t,n){"use strict";var a=e("react"),r=e("../config/api.js"),o=a.createClass({displayName:"SuitesActivity",getInitialState:function(){return{payload:[]}},componentWillReceiveProps:function(e){var t=this,n="婚纱套系活动",a=function(){var t=e.resourceLinks[n].split("#")[1];return r.httpGET(t,{pageSize:7,pageIndex:1})};e.resourceLinks[n]&&a().done(function(e){200===e.code&&t.setState({payload:e.data})})},render:function(){return a.createElement("ul",{className:"list-8-js"},this.state.payload.map(function(e,t){return a.createElement("li",{className:"transition-border mgb20",key:t},a.createElement("h2",null,a.createElement("a",{href:""},"[人气活动]")," ",e.activityName),a.createElement("a",{href:"",className:"img-box"},a.createElement("img",{src:e.imageUrl||"http://placehold.it/300x220"})),a.createElement("p",null,e.activityDesc),a.createElement("div",{className:"func clearfix"},a.createElement("span",{className:"price"},e.price),a.createElement("a",{href:"",className:"btn-js btn-violet-1-js transition-bg"},"去看看")),a.createElement("div",{className:"act-info clearfix"},a.createElement("font",{className:"status"},"本次活动已经结束"),a.createElement("font",{className:"num"},"已有156人参与")))}))}});t.exports=o},{"../config/api.js":65,react:263}],51:[function(e,t,n){"use strict";var a=e("react"),r=e("react-router-ie8"),o=e("../config/api.js"),i=e("./image-item.js"),s=(e("./suites-recommend.js"),a.createClass({displayName:"SuitesDetail",mixins:[r.State],getInitialState:function(){return{payload:[]}},componentDidMount:function(){var e=this,t=function(e){$(document.body).trigger("ModuleChanged",["#/shot"])},n=function(){var t=e.getPath();return o.httpGET(t,{})};window.Core&&window.Core.promises["/"]&&$.when(window.Core.promises["/"]).then(t),n().done(function(t){200===t.code&&e.setState({payload:t.data},function(){})})},componentDidUpdate:function(e,t){$("#slider_case_detail").Slider({type:"Horizontal"})},render:function(){var e=this,t=e.state.payload.length>0&&e.state.payload[0],n=t&&t.slidesImages||[],r=t&&$.merge($.merge($.merge($.merge($.merge(t.detailImages,t.serviceImages),t.cosmeticImages),t.clothShootImages),t.baseSampleImages),t.processImages)||[];return a.createElement("div",{className:"main responsive-box clearfix"},a.createElement("div",{className:"container wedding-detail clearfix"},a.createElement("div",{className:"base-info mgb30 clearfix",style:{display:"none"}},a.createElement("div",{className:"slider-box-2-js",id:"slider_case_detail"},a.createElement("div",{className:"kpxq-img-box"},a.createElement("img",{className:"big-img"})),a.createElement("div",{className:"sel-box"},a.createElement("div",{className:"btn-prev"},a.createElement("i",{className:"arrow-2-js arrow-2-lef-js btn-lef"})),a.createElement("div",{className:"btn-next"},a.createElement("i",{className:"arrow-2-js arrow-2-rig-js btn-rig"})),a.createElement("div",{className:"slider-box",style:{overflow:"hidden"}},a.createElement("ul",{className:"item-box sel-url"},n.map(function(e,t){return a.createElement("li",{className:"item",key:t,"data-big-img-url":e.imageUrl},a.createElement(i,{sid:e.contentId,frameWidth:90,frameHeight:60,url:e.imageUrl,errorUrl:"http://placehold.it/90x60"}))}))))),a.createElement("div",{className:"title"},a.createElement("h1",null,t.productName),a.createElement("span",null,"摄影师档期有限,提前",a.createElement("b",null,"支付定金"),"可确保",a.createElement("b",null,"预约"),"到你喜欢的摄影师")),a.createElement("div",{className:"price"},a.createElement("em",null,"¥"),a.createElement("b",null,parseFloat(t.price).toFixed(2)),a.createElement("span",null,"定金 ¥"+parseFloat(t.deposit||1e3).toFixed(2))),a.createElement("p",{className:"mgb-10"},"拍摄时间:",a.createElement("b",null,t.shootTime+"天"),a.createElement("br",null),"礼服造型:",a.createElement("b",null,t.dressModeling),a.createElement("br",null),"拍摄地点:",a.createElement("b",null,t.shootAdress),a.createElement("br",null),"拍摄样片:",a.createElement("b",null,t.shootSampless+"张以上/精选"+t.recordNum+"张入册"),a.createElement("br",null),"精修数量:",a.createElement("b",null,t.truingNum+"张/余下80张底片刻盘")),a.createElement("div",{className:"func"},a.createElement("span",{className:"btn-js btn-violet-2-js transition-bg"},"立即抢购"),a.createElement("span",{className:"collection"},a.createElement("i",null),"点击收藏"))),a.createElement("div",{className:"detail-box container mgt30 clearfix"},a.createElement("div",{className:"photo-box mgb30 clearfix"},$.map(r,function(e,t){return a.createElement("div",{key:t,className:"bottom",style:{height:"auto"}},a.createElement(i,{frameWidth:870,url:e.imageUrl,errorUrl:"http://placehold.it/870x450"}))})),a.createElement("div",{className:"content mgb30 clearfix"}))))}}));t.exports=s},{"../config/api.js":65,"./image-item.js":21,"./suites-recommend.js":54,react:263,"react-router-ie8":100}],52:[function(e,t,n){"use strict";var a=e("react"),r=(a.PropTypes,a.createClass({displayName:"SuitesInfo",getInitialState:function(){return{items:[]}},render:function(){var e=this.props.info&&this.props.info.split&&this.props.info.split("|")||[];return a.createElement("div",{className:"info"},a.createElement("div",{className:"overview"},e.length>0&&$.map(e,function(e,t){return a.createElement("p",{key:t},a.createElement("b",null,e))})))}}));t.exports=r},{react:263}],53:[function(e,t,n){"use strict";var a=e("react"),r=e("../config/api.js"),o=e("./image-item.js"),i=e("./suites-info.js"),s=a.createClass({displayName:"SuitesList",getInitialState:function(){return{payload:[],baseUrl:"",totalPage:0}},componentWillReceiveProps:function(e){var t=this,t=this,n=function(e,t){return r.httpGET(e,t)};$.each(e.resourceLinks,function(a,r){e.tplKey.indexOf(r.split("/")[0])>-1&&n(r.split("#")[1],{pageSize:e.pageSize,pageIndex:e.pageIndex}).done(function(n){200===n.code&&n.data&&t.setState({payload:n.data.concat(t.state.payload),baseUrl:r.split("#")[1],totalPage:parseInt(n.totalCount)},function(){parseInt(n.totalCount)<=parseInt(e.pageIndex)*parseInt(e.pageSize)?$("#J_MoreButton").hide():$("#J_MoreButton").show()})})})},componentDidUpdate:function(){$(".scrollbarall").length>0&&$(".scrollbarall").each(function(e,t){var n=$(this);n.tinyscrollbar(),n.find(".scrollbar").css({opacity:0}),n.bind("mouseenter",function(){$(".scrollbar",n).animate({opacity:1},300)}),n.bind("mouseleave",function(){$(".scrollbar",n).animate({opacity:0},300)})})},render:function(){var e=this.state.baseUrl,t=this.state.payload.length>0&&this.state.payload;return a.createElement("div",{className:"suites-list"},a.createElement("div",{className:"title-3-js mgb30 clearfix"},a.createElement("h1",null,"婚纱摄影套系"),a.createElement("div",{className:"subtitle"},a.createElement("span",null,"摄影师档期有限,提前"),a.createElement("b",null,"支付定金"),a.createElement("span",null,"可确保"),a.createElement("b",null,"预约"),a.createElement("span",null,"到你喜欢的摄影师!")),a.createElement("span",{className:"find-num"},"找到",a.createElement("b",null,this.state.totalPage),"个套系")),a.createElement("ul",{className:"list-7-js clearfix"},t.length&&$.map(t,function(t,n){return a.createElement("li",{className:"transition-border mgb30",key:n},a.createElement(o,{detailBaseUrl:e,sid:t.productId,frameHeight:320,url:t.imageUrl,errorUrl:"http://placehold.it/550x320"}),a.createElement("div",{className:"price"},a.createElement("em",null,"¥"),a.createElement("b",null,parseFloat(t.price).toFixed(2)),a.createElement("span",{style:{display:"none"}},"定金 ¥"+parseFloat(t.deposit).toFixed(2))),a.createElement("div",{className:"scrollbarall cur-scroll"},a.createElement("div",{className:"scrollbar"},a.createElement("div",{className:"track"},a.createElement("div",{className:"thumb"},a.createElement("div",{className:"end"})))),a.createElement("div",{className:"viewport"},a.createElement(i,{info:t.shootAdress}))),a.createElement("div",{className:"func transition-border"}))})))}});t.exports=s},{"../config/api.js":65,"./image-item.js":21,"./suites-info.js":52,react:263}],54:[function(e,t,n){"use strict";var a=e("react"),r=(a.PropTypes,a.createClass({displayName:"SuitesRecommend",render:function(){return a.createElement("li",{className:"mgb20"},a.createElement("div",{className:"pos-box"},a.createElement("a",{className:"img-box"},a.createElement("img",{src:"http://placehold.it/300x240"})),a.createElement("span",{className:"price transition-opacity"},"¥2899.00(定金300)"),a.createElement("p",{className:"transition-opacity-margin"},"拍摄时间:",a.createElement("b",null,"1天"),a.createElement("br",null),"礼服造型:",a.createElement("b",null,"自选4款高档婚纱"),a.createElement("br",null),"拍摄地点:",a.createElement("b",null,"室内+中央公园"),a.createElement("br",null),"拍摄样片:",a.createElement("b",null,"90张以上"),a.createElement("br",null),"精修数量:",a.createElement("b",null,"50张")),a.createElement("div",{className:"mask-bg transition-height"})),a.createElement("div",{className:"title"},a.createElement("h2",null,"金色百年特惠轻舞飞扬套系")))}}));t.exports=r},{react:263}],55:[function(e,t,n){"use strict";var a=e("react"),r=e("react-router-ie8"),o=(e("../config/SKMap.js"),e("./top-slider.js")),i=e("./suites-list.js"),s=(e("./suites-activity.js"),a.createClass({displayName:"Suites",mixins:[r.State],getInitialState:function(){return{resourceLinks:{},pageSize:50,pageIndex:1}},loadMore:function(e){e.preventDefault(),this.setState(function(e,t){return{pageIndex:e.pageIndex+1}})},componentDidMount:function(){var e=this;$("#slider_top").Slider();var t=function(e){$(document.body).trigger("ModuleChanged",["#/shot"])},n=function(t){var n=window.Core.getResourcesLinks(e.getPathname(),"#/shot");n&&e.setState({resourceLinks:n})};window.Core&&window.Core.promises["/"]&&$.when(window.Core.promises["/"]).then(t).then(n)},render:function(){return a.createElement("div",{className:"main responsive-box clearfix"},a.createElement("div",{className:"custom-banner responsive-box mgb30",style:{display:"none"}},a.createElement("div",{id:"slider_top",className:"slider-box-1-js responsive-box"},a.createElement(o,{resourceLinks:this.state.resourceLinks,tplKey:"top#adv/10024"}))),a.createElement("div",{className:"container clearfix"},a.createElement("div",{className:"column-mg30-18 mgr30"},a.createElement(i,{resourceLinks:this.state.resourceLinks,tplKey:"list#suite",pageSize:this.state.pageSize,pageIndex:this.state.pageIndex})),a.createElement("div",{className:"column-6 mgt60"},a.createElement("img",{src:"http://image.jsbn.com/static/dior.jpg",className:"mgb30"}),a.createElement("img",{src:"http://image.jsbn.com/static/la_sposa2.jpg"}))),a.createElement("div",{id:"J_MoreButton",onClick:this.loadMore},a.createElement("span",{className:"btn-more-1-js all-more-1 transition-bg"},"点击查看更多",a.createElement("div",{className:"arrow-box"},a.createElement("i",{className:"arrow-2-js arrow-2-rig-js"}),a.createElement("i",{className:"arrow-2-js arrow-2-rig-js"})))))}}));t.exports=s},{"../config/SKMap.js":64,"./suites-activity.js":50,"./suites-list.js":53,"./top-slider.js":56,react:263,"react-router-ie8":100}],56:[function(e,t,n){"use strict";var a=e("react"),r=e("../config/api.js"),o=e("./image-item.js"),i=a.createClass({displayName:"TopSlider",getInitialState:function(){return{payload:[],baseUrl:""}},componentWillReceiveProps:function(e){var t=this,n=function(e,t){return r.httpGET(e,t)};e.resourceLinks&&t.props.resourceLinks!==e.resourceLinks&&$.each(e.resourceLinks,function(a,r){e.tplKey.indexOf(r.split("/")[0])>-1&&n(r.split("#")[1],{pageSize:e.pageSize,pageIndex:e.pageIndex}).done(function(n){200===n.code&&n.data&&t.setState({payload:n.data,baseUrl:r.split("#")[1]},function(){0===n.data.length&&($("#slider_top").parent().hide(),$("#slider_home").parent().hide(),$("#slider_mid").parent().hide()),e.sliderB||($("#slider_top").length>0&&$("#slider_top").Slider(),$("#slider_home").length>0&&$("#slider_home").Slider(),$("#slider_mid").length>0&&$("#slider_mid").Slider())})})})},componentDidMount:function(){},componentDidUpdate:function(){},render:function(){var e=(this.state.baseUrl,this.state.payload,this);return a.createElement("ul",{className:"slider"},$.map(this.state.payload||[],function(t,n){return a.createElement("li",{className:"item transition-opacity-1",key:n},a.createElement(o,{sid:t.contentId,frameWidth:e.props.frameWidth||1200,frameHeight:680,url:t.contentUrl||t.weddingCaseImage,detailUrl:t.detailUrl,errorUrl:"http://placehold.it/1200x680"}))}))}});t.exports=i},{"../config/api.js":65,"./image-item.js":21,react:263}],57:[function(e,t,n){"use strict";var a=e("react"),r=(a.PropTypes,e("../config/api.js"),e("react-router-ie8")),o=a.createClass({displayName:"VideoDetail",mixins:[r.State],componentDidMount:function(){var e=function(e){$(document.body).trigger("ModuleChanged",["#/home"])};window.Core&&window.Core.promises["/"]&&$.when(window.Core.promises["/"]).then(e),window.videojs($(".J_Video")[0],{autoplay:!1,loop:!0},function(){})},render:function(){var e=this,t=e.getQuery().n,n=e.getQuery().info,r=e.getQuery().addr,o=e.getQuery().d,i=e.getQuery().cover,s=e.getQuery().video;return a.createElement("div",{className:"main-body-eav"},a.createElement("div",{className:"box-01-eav"},a.createElement("div",{className:"video-container",id:"J_VideoContainer"},a.createElement("video",{className:"video-js vjs-default-skin J_Video",preload:"auto",controls:!0,width:1280,height:720,poster:i},a.createElement("source",{src:s,type:"video/mp4"}))),a.createElement("div",{className:"vidio-info"},a.createElement("span",null,t),a.createElement("p",null,n),a.createElement("p",null,o),a.createElement("p",null,r))),a.createElement("div",{className:"space-40-eav"}))}});t.exports=o},{"../config/api.js":65,
react:263,"react-router-ie8":100}],58:[function(e,t,n){"use strict";var a=e("react"),r=e("react-router-ie8"),o=(e("../config/SKMap.js"),e("./top-slider.js")),i=(e("./image-item.js"),e("../config/api.js"),e("./cases-list.js")),s=(a.createClass({displayName:"Episode",render:function(){return a.createElement("div",null,a.createElement("div",{className:"title-5-js mgb30"},a.createElement("h2",null,"第一季"),a.createElement("div",{className:"middle-line"})),a.createElement("ul",{className:"list-2-js clearfix"},a.createElement("li",{className:"column-mg20-8 mgr30 mgb30"},a.createElement("a",{href:"",className:"hover-box transition-opacity"},a.createElement("div",{className:"pos-box"},a.createElement("h3",null,"梦见"),a.createElement("div",{className:"etc-info"},a.createElement("b",null),a.createElement("span",null,a.createElement("span",null,"("),a.createElement("span",null,"2015-10-04"),a.createElement("span",null,")"))),a.createElement("div",{className:"mask-bg"}))),a.createElement("a",{href:"#/scheme/10034/25028",className:"img-box"},a.createElement("img",{src:"http://image.jsbn.com/WebImage/cq/jpg/20151016/14404462846745178887/20151016105205575945_1200x800.jpg@1e_384w_256h_1c_0i_1o_90q_1x"}))),a.createElement("li",{className:"column-mg20-8 mgr30 mgb30"},a.createElement("a",{href:"",className:"hover-box transition-opacity"},a.createElement("div",{className:"pos-box"},a.createElement("h3",null,"梦见"),a.createElement("div",{className:"etc-info"},a.createElement("b",null),a.createElement("span",null,a.createElement("span",null,"("),a.createElement("span",null,"2015-10-04"),a.createElement("span",null,")"))),a.createElement("div",{className:"mask-bg"}))),a.createElement("a",{href:"#/scheme/10034/25028",className:"img-box"},a.createElement("img",{src:"http://image.jsbn.com/WebImage/cq/jpg/20151016/14404462846745178887/20151016105205575945_1200x800.jpg@1e_384w_256h_1c_0i_1o_90q_1x"}))),a.createElement("li",{className:"column-mg20-8 mgr30 mgb30"},a.createElement("a",{href:"",className:"hover-box transition-opacity"},a.createElement("div",{className:"pos-box"},a.createElement("h3",null,"梦见"),a.createElement("div",{className:"etc-info"},a.createElement("b",null),a.createElement("span",null,a.createElement("span",null,"("),a.createElement("span",null,"2015-10-04"),a.createElement("span",null,")"))),a.createElement("div",{className:"mask-bg"}))),a.createElement("a",{href:"#/scheme/10034/25028",className:"img-box"},a.createElement("img",{src:"http://image.jsbn.com/WebImage/cq/jpg/20151016/14404462846745178887/20151016105205575945_1200x800.jpg@1e_384w_256h_1c_0i_1o_90q_1x"}))),a.createElement("li",{className:"column-mg20-8 mgr30 mgb30"},a.createElement("a",{href:"",className:"hover-box transition-opacity"},a.createElement("div",{className:"pos-box"},a.createElement("h3",null,"梦见"),a.createElement("div",{className:"etc-info"},a.createElement("b",null),a.createElement("span",null,a.createElement("span",null,"("),a.createElement("span",null,"2015-10-04"),a.createElement("span",null,")"))),a.createElement("div",{className:"mask-bg"}))),a.createElement("a",{href:"#/scheme/10034/25028",className:"img-box"},a.createElement("img",{src:"http://image.jsbn.com/WebImage/cq/jpg/20151016/14404462846745178887/20151016105205575945_1200x800.jpg@1e_384w_256h_1c_0i_1o_90q_1x"}))),a.createElement("li",{className:"column-mg20-8 mgr30 mgb30"},a.createElement("a",{href:"",className:"hover-box transition-opacity"},a.createElement("div",{className:"pos-box"},a.createElement("h3",null,"梦见"),a.createElement("div",{className:"etc-info"},a.createElement("b",null),a.createElement("span",null,a.createElement("span",null,"("),a.createElement("span",null,"2015-10-04"),a.createElement("span",null,")"))),a.createElement("div",{className:"mask-bg"}))),a.createElement("a",{href:"#/scheme/10034/25028",className:"img-box"},a.createElement("img",{src:"http://image.jsbn.com/WebImage/cq/jpg/20151016/14404462846745178887/20151016105205575945_1200x800.jpg@1e_384w_256h_1c_0i_1o_90q_1x"}))),a.createElement("li",{className:"column-mg20-8 mgr30 mgb30"},a.createElement("a",{href:"",className:"hover-box transition-opacity"},a.createElement("div",{className:"pos-box"},a.createElement("h3",null,"梦见"),a.createElement("div",{className:"etc-info"},a.createElement("b",null),a.createElement("span",null,a.createElement("span",null,"("),a.createElement("span",null,"2015-10-04"),a.createElement("span",null,")"))),a.createElement("div",{className:"mask-bg"}))),a.createElement("a",{href:"#/scheme/10034/25028",className:"img-box"},a.createElement("img",{src:"http://image.jsbn.com/WebImage/cq/jpg/20151016/14404462846745178887/20151016105205575945_1200x800.jpg@1e_384w_256h_1c_0i_1o_90q_1x"})))))}}),a.createClass({displayName:"WeddingAndPat",mixins:[r.State],getInitialState:function(){return{resourceLinks:{},pageSize:9,pageIndex:1,currentCate:"",currentStyle:"",currentHotel:"",currentPrice:{min:"",max:""},categoryFilter:[],styleFilter:[],hotelFilter:[],priceFilter:[]}},componentDidMount:function(){var e=this,t=function(e){$(document.body).trigger("ModuleChanged",["#/scheme"])},n=function(t){var n=window.Core.getResourcesLinks(e.getPathname(),"#/scheme");n&&e.setState({resourceLinks:n}),console.log("resource:",n)};window.Core&&window.Core.promises["/"]&&$.when(window.Core.promises["/"]).then(t).then(n)},moreData:function(){var e=this;e.setState({pageIndex:e.state.pageIndex+1})},render:function(){return a.createElement("div",{className:"main-body-eav"},a.createElement("div",{className:"add-box"},a.createElement("div",{id:"slider_top",className:"slider-box-1-js"},a.createElement(o,{resourceLinks:this.state.resourceLinks,tplKey:"top#adv"})),a.createElement(i,{resourceLinks:this.state.resourceLinks,pageIndex:this.state.pageIndex,pageSize:this.state.pageSize,currentCate:this.state.currentCate,currentStyle:this.state.currentStyle,currentHotel:this.state.currentHotel,currentPrice:this.state.currentPrice,tplKey:"list#scheme"}),a.createElement("div",{onClick:this.moreData,id:"J_MoreButton"},a.createElement("span",{className:"btn-more-1-js all-more-1 transition-bg"},"点击查看更多",a.createElement("div",{className:"arrow-box"},a.createElement("i",{className:"arrow-2-js arrow-2-rig-js"}),a.createElement("i",{className:"arrow-2-js arrow-2-rig-js"}))))))}}));t.exports=s},{"../config/SKMap.js":64,"../config/api.js":65,"./cases-list.js":4,"./image-item.js":21,"./top-slider.js":56,react:263,"react-router-ie8":100}],59:[function(e,t,n){"use strict";var a=e("react"),r=e("../config/api.js"),o=(e("./image-item.js"),e("react-router-ie8")),i=a.createClass({displayName:"WeddingClassDetail",mixins:[o.State],getInitialState:function(){return{resourceLinks:{},pageSize:6,pageIndex:1,stylesList:[],baseUrl:"",currentStyle:"",payload:null}},loadMore:function(e){e.preventDefault(),this.setState(function(e,t){return{pageIndex:e.pageIndex+1}})},componentDidMount:function(){var e=this;$(".kt-tab a").click(function(){$(this).addClass("action").siblings("a").removeClass("action")}),r.httpGET("wenddingroom/"+e.getParams().weddingClassroomId).done(function(t){e.setState({payload:t.data,baseUrl:e.getPathname()}),$("#kt_content").html(t.data.content)})},render:function(){var e=this;e.state.payload;return e.state.payload?a.createElement("div",{className:"main ktmain-detail-view responsive-box clearfix"},a.createElement("div",{className:"ktmain-info"},a.createElement("div",{className:"content",id:"kt_content"}))):a.createElement("div",null)}});t.exports=i},{"../config/api.js":65,"./image-item.js":21,react:263,"react-router-ie8":100}],60:[function(e,t,n){"use strict";var a=e("react"),r=(e("../config/api.js"),e("./image-item.js"),a.createClass({displayName:"WeddingClassList",getInitialState:function(){return{payload:[],baseUrl:"",totalPage:0}},componentWillReceiveProps:function(e){var t=this;t.setState({payload:e.data,baseUrl:e.baseUrl})},render:function(){var e=this,t=e.state.baseUrl;return a.createElement("ul",{className:"ktlist"},$.map(e.state.payload||[],function(e,n){return a.createElement("li",{key:n},a.createElement("img",{src:e.coverImg}),a.createElement("div",{className:"inroduce"},a.createElement("h2",null,a.createElement("a",{href:"#"+t+"/"+e.weddingClassroomId},e.title)),a.createElement("p",null,e.description,a.createElement("a",{href:"#"+t+"/"+e.weddingClassroomId},"详情>>")),a.createElement("span",{className:"time"},e.publishTime)))}))}}));t.exports=r},{"../config/api.js":65,"./image-item.js":21,react:263}],61:[function(e,t,n){"use strict";var a=e("react"),r=e("../config/api.js"),o=(e("./image-item.js"),e("./top-slider.js")),i=e("react-router-ie8"),s=e("./wedding-class-list.js"),l=a.createClass({displayName:"WeddingClass",mixins:[i.State],getInitialState:function(){return{pageSize:10,pageIndex:1,baseUrl:"",payload:"",moduleTypeId:"",sliderB:!1,loadDisplay:!0,weddingClassArr:["#/shot","#/hotel","#/scheme","#/dress","#/movie"]}},componentDidMount:function(){var e=this;$(".kt-tab a").click(function(){$(this).addClass("action").siblings("a").removeClass("action")}).eq(e.getPathname().substr(-1)-1).addClass("action").siblings("a").removeClass("action"),e.fetchData()},ktSelCard:function(e){var t=this;t.fetchData(e)},fetchData:function c(e){var t,n,a=this,o=a.state.weddingClassArr;e?(n=e,a.setState({sliderB:!0}),t=o[e-1]):(n=a.getParams().moduleTypeId,t=o[a.getPathname().substr(-1)-1]),r.httpGET("wenddingroom",{pageIndex:1,pageSize:a.state.pageSize,moduleTypeId:n}).done(function(e){a.setState({pageIndex:1,payload:e.data.data,baseUrl:a.getPathname(),moduleTypeId:n,loadDisplay:e.data.totalCount<=a.state.pageIndex*a.state.pageSize?!1:!0})});var i=function(e){$(document.body).trigger("ModuleChanged",[t])},c=function(e){var t=window.Core.getResourcesLinks(a.getPathname().substr(0,a.getPathname().length-1)+n,o[n-1]);a.setState({resourceLinks:t})};window.Core&&window.Core.promises["/"]&&$.when(window.Core.promises["/"]).then(i).then(c)},moreData:function(){var e=this;r.httpGET("wenddingroom",{pageIndex:e.state.pageIndex+1,pageSize:e.state.pageSize,moduleTypeId:e.state.moduleTypeId}).done(function(t){e.setState({pageIndex:e.state.pageIndex+1,payload:e.state.payload.concat(t.data.data),loadDisplay:t.data.totalCount<=(e.state.pageIndex+1)*e.state.pageSize?!1:!0})})},render:function(){var e=this;return a.createElement("div",{className:"main ktmain-view clearfix"},a.createElement("div",{className:"ad-vedio"},a.createElement("div",{className:"adpic"},a.createElement("div",{id:"slider_top",className:"slider-box-1-js"},a.createElement(o,{resourceLinks:this.state.resourceLinks,frameWidth:1920,tplKey:"top#adv",sliderB:e.state.sliderB})))),a.createElement("div",{className:"responsive-box"},a.createElement("div",{className:"ktmain"},a.createElement("div",{className:"kt-tab"},a.createElement("a",{className:"action",onClick:function(){e.ktSelCard(1)}},"婚照技巧"),a.createElement("a",{onClick:function(){e.ktSelCard(2)}},"婚宴知识"),a.createElement("a",{onClick:function(){e.ktSelCard(3)}},"婚礼学堂"),a.createElement("a",{onClick:function(){e.ktSelCard(4)}},"礼服知识"),a.createElement("a",{onClick:function(){e.ktSelCard(5)}},"表演技巧")),a.createElement("div",{className:"kt-tab",style:{display:"none"}},a.createElement("a",{className:"action",href:"#/weddingclass/1",onClick:function(){e.ktSelCard(1)}},"婚照技巧"),a.createElement("a",{href:"#/weddingclass/2",onClick:function(){e.ktSelCard(2)}},"婚宴知识"),a.createElement("a",{href:"#/weddingclass/3",onClick:function(){e.ktSelCard(3)}},"婚礼学堂"),a.createElement("a",{href:"#/weddingclass/4",onClick:function(){e.ktSelCard(4)}},"礼服知识"),a.createElement("a",{href:"#/weddingclass/5",onClick:function(){e.ktSelCard(5)}},"表演技巧")),a.createElement("div",{id:"ktlist_box"},a.createElement(s,{baseUrl:e.getPathname(),data:e.state.payload}))),a.createElement("div",{onClick:this.moreData,id:"J_MoreButton",style:{display:0==e.state.loadDisplay&&"none"||"block"}},a.createElement("span",{className:"btn-more-1-js all-more-1 transition-bg"},"点击查看更多",a.createElement("div",{className:"arrow-box"},a.createElement("i",{className:"arrow-2-js arrow-2-rig-js"}),a.createElement("i",{className:"arrow-2-js arrow-2-rig-js"}))))))}});t.exports=l},{"../config/api.js":65,"./image-item.js":21,"./top-slider.js":56,"./wedding-class-list.js":60,react:263,"react-router-ie8":100}],62:[function(e,t,n){"use strict";var a=e("react"),r=(a.PropTypes,e("react-router-ie8")),o=e("../config/api.js"),i=(e("./image-item.js"),e("./top-slider.js")),s="videos",l=a.createClass({displayName:"Item",render:function(){return a.createElement("div",{className:"box-item-wdy"},a.createElement("div",{className:"cover-layer-wdy"},a.createElement("a",{href:"#/video-detail?video="+this.props.v.url+"&cover="+this.props.v.coverImage.imageUrl,className:"pos-box"})),a.createElement("img",{src:this.props.v.coverImage.imageUrl,className:"img-video-wdy"}),a.createElement("a",{href:"#/video-detail?video="+this.props.v.url+"&cover="+this.props.v.coverImage.imageUrl},a.createElement("div",{className:"title-video-wdy"},this.props.v.contentName)))}}),c=a.createClass({displayName:"WeddingMV",mixins:[r.State],getInitialState:function(){return{payload:[]}},componentDidMount:function(){var e=this,t=function(e){$(document.body).trigger("ModuleChanged",["#/shot"])},n=function(){return o.httpGET(s,{videoType:1})};window.Core&&window.Core.promises["/"]&&$.when(window.Core.promises["/"]).then(t).then(n).done(function(t){console.log("movie-list:",JSON.stringify(t.data,null,4));var n=window.Core.getResourcesLinks(e.getPathname(),"#/shot");e.setState({resourceLinks:n,payload:t.data},function(){})})},render:function(){return a.createElement("div",{className:"main-body-eav"},a.createElement("div",{id:"slider_top",className:"slider-box-1-js responsive-box"},a.createElement(i,{tplKey:"top#adv",resourceLinks:this.state.resourceLinks,pageIndex:1,pageSize:1})),a.createElement("div",{className:"space-40-eav"}),a.createElement("div",{className:"box-01-eav"},a.createElement("div",{className:"box-tit-wdy"},"最新MV"),a.createElement("div",{className:"line-e1-eav"}),$.map(this.state.payload,function(e,t){return a.createElement(l,{v:e,key:t})})),a.createElement("div",{className:"space-50-eav clear-b-eav"}),a.createElement("div",{className:"line-eb-eav clear-b-eav"}))}});t.exports=c},{"../config/api.js":65,"./image-item.js":21,"./top-slider.js":56,react:263,"react-router-ie8":100}],63:[function(e,t,n){"use strict";var a=e("react"),r=e("react-router-ie8"),o=(e("../config/SKMap.js"),e("./top-slider.js")),i=e("./image-item.js"),s=e("../config/api.js"),l=a.createClass({displayName:"VideoCase",render:function(){return a.createElement("ul",{className:"list-2-js clearfix"},$.map(this.props.videos||[],function(e,t){return a.createElement("li",{className:"column-mg20-8 mgr30 mgb30",key:t},a.createElement("a",{href:"#/video-detail?video="+e.url+"&cover="+e.coverImage.imageUrl,className:"hover-box transition-opacity"},a.createElement("div",{className:"pos-box"},a.createElement("h3",null,e.name),a.createElement("div",{className:"etc-info"},a.createElement("div",{className:"play-al-eav"},a.createElement("img",{src:"./assets/images/eavlee/wdy/play.png"})),a.createElement("span",null,"(",e.name,")")),a.createElement("div",{className:"mask-bg"}))),a.createElement(i,{frameWidth:380,frameHeight:250,url:e.coverImage.imageUrl}))}))}}),c=a.createClass({displayName:"WeddingVideo",mixins:[r.State],getInitialState:function(){return{resourceLinks:{},payload:[],pageSize:100,pageIndex:1,totalCount:0}},componentDidMount:function(){var e=this,t=function(e){$(document.body).trigger("ModuleChanged",["#/scheme"])},n=function(t){var n=window.Core.getResourcesLinks(e.getPathname(),"#/scheme");n&&e.setState({resourceLinks:n})},a=function(t){return s.httpGET("videos",{videoType:3,pageIndex:e.state.pageIndex,pageSize:e.state.pageSize})};window.Core&&window.Core.promises["/"]&&$.when(window.Core.promises["/"]).then(t).then(n).then(a).done(function(t){e.setState({payload:1===e.state.pageIndex?t.data:e.state.payload.concat(t.data),totalCount:t.totalCount},function(){parseInt(e.state.totalCount)<=parseInt(e.state.pageIndex)*parseInt(e.state.pageSize)?$("#J_MoreButton").hide():$("#J_MoreButton").show()})})},moreData:function(){var e=this;e.setState({pageIndex:e.state.pageIndex+1},function(){pageData().done(function(t){e.setState({payload:1===e.state.pageIndex?t.data:e.state.payload.concat(t.data),totalCount:t.totalCount},function(){parseInt(e.state.totalCount)<=parseInt(e.state.pageIndex)*parseInt(e.state.pageSize)?$("#J_MoreButton").hide():$("#J_MoreButton").show()})})})},render:function(){return a.createElement("div",{className:"main-body-eav"},a.createElement("div",{className:"add-box"},a.createElement("div",{className:"custom-banner responsive-box"},a.createElement("div",{id:"slider_top",className:"slider-box-1-js"},a.createElement(o,{resourceLinks:this.state.resourceLinks,tplKey:"top#adv"}))),a.createElement("div",{className:"space-30-eav"}),a.createElement(l,{videos:this.state.payload}),a.createElement("div",{onClick:this.moreData,id:"J_MoreButton"},a.createElement("span",{className:"btn-more-1-js all-more-1 transition-bg"},"点击查看更多",a.createElement("div",{className:"arrow-box"},a.createElement("i",{className:"arrow-2-js arrow-2-rig-js"}),a.createElement("i",{className:"arrow-2-js arrow-2-rig-js"}))))))}});t.exports=c},{"../config/SKMap.js":64,"../config/api.js":65,"./image-item.js":21,"./top-slider.js":56,react:263,"react-router-ie8":100}],64:[function(e,t,n){"use strict";t.exports={home:"全站首页","全站首页":"#/","全站首页en":"HOME",shot:"婚纱摄影","#/":"全站首页","#/home":"全站首页","婚纱摄影":"#/shot","婚纱摄影en":"PHOTO","婚纱摄影首页":"#/shot","婚纱摄影首页en":"PHOTO","#/shot":"婚纱摄影首页",scheme:"婚礼策划","婚纱纪实en":"MV","婚照技巧en":"TIPS","表演技巧en":"ACTING","婚礼策划":"#/scheme","婚庆定制":"#/scheme","婚庆定制en":"WEDDING","提交需求":"#/hotel-require","#/hotel-require":"提交需求","提交需求en":"REQUIRE",movie:"微电影","微电影":"#/movie","微电影en":"MOVIE","微电影首页en":"MOVIE","大礼包en":"GIFT","微电影首页":"#/movie","#/movie":"微电影首页","爱情MVen":"LOVE.MV","爱情微电影en":"LOVE.8MM","表演系en":"ROLLING","婚戒钻石":"http://www.chinad9.com","婚戒钻石en":"DIAMOND","婚纱礼服":"#/dress","婚纱礼服en":"DRESS","礼服知识en":"AWARE","#/dress":"婚纱礼服","婚礼用品en":"SUPPLIES","婚车租赁en":"CAR","婚庆首页":"#/scheme","婚庆首页en":"WEDDING","#/scheme":"金色百年婚庆首页","实景案例":"#/cases","实景案例en":"CASES","欣赏婚礼案例":"#/cases","欣赏婚礼案例en":"CASES","#/cases":"欣赏婚礼案例","选策划师":"#/planners","选策划师en":"PLANNERS","选婚礼人":"#/f4","选婚礼人en":"F4","预订我的婚礼人":"#/f4","预订我的婚礼人en":"F4","婚礼跟拍en":"FOLLOW","婚礼视频en":"VIDEO","婚宴预订":"#/hotel","婚宴预订en":"BANQUET","婚宴预订首页en":"BANQUET","婚宴知识en":"CLASS","#/hotel":"婚宴预订",samples:"样片欣赏","样片欣赏":"#/samples","样片欣赏en":"SAMPLES","#/samples":"样片欣赏",pringles:"客片欣赏","客片欣赏":"#/pringles","客片欣赏en":"PRINGLES","#/pringles":"客片欣赏",suites:"套系报价","#/suites":"套系报价","套系报价":"#/suites","套系报价en":"SUITES",photographers:"选摄影师","选摄影师":"#/photographers","选摄影师en":"PHOTOG","婚礼学堂en":"CLASS","#/photographers":"选摄影师",stylists:"选造型师","选造型师":"#/stylists","选造型师en":"STYL",hotel:"婚宴预订",weddingdress:"选婚纱","选婚纱":"#/weddingdress"}},{}],65:[function(e,t,n){"use strict";var a=function(){$.ajaxSetup({headers:{TICKET:window.store.get("TICKET")||"",TOKEN:window.store.get("TOKEN")||""}});var e={scheme:"http://",host:location.hostname,port:location.port,endpoint:"api"};return e.scheme+e.host+":"+e.port+"/"+e.endpoint+"/"},r={httpGET:function(e,t){return $.get(a()+e,t)},httpPOST:function(e,t){return $.post(a()+e,$.param(t))}};t.exports=r},{}],66:[function(e,t,n){"use strict";!function(t){function n(e,t){$.each(e,function(e,a){a.type===!0&&a.subModule[0]&&a.subModule[0].type===!1?(t[a.moduleName]={},n(a.subModule,t[a.moduleName])):a.subModule[0]&&a.subModule[0].type===!0&&a.type===!0?n(a.subModule,t):0==a.type&&a.menuLink&&a.menuLink[0]&&""!==a.menuLink[0].menuLinkUrl&&(t[a.moduleName]=a.blockCode+"#"+a.menuLink[0].menuLinkUrl)})}function a(){var e=this;this.mode="www"===window.location.hostname.slice(0,3)||0===window.location.hostname.indexOf("jsbn.com")||-1!==window.location.hostname.indexOf("jsbn.love")?"online":"dev",this.resource={},this.gallery=null,this.menu={"#/home":{name:"全站首页",sub:{"婚纱摄影":"#/shot","婚宴预订":"#/hotel","婚庆定制":"#/scheme","婚纱礼服":"#/dress","微电影":"#/movie","婚戒钻石":"http://www.chinad9.com","婚礼用品":"#/supplies","婚车租赁":"#/car"}},"#/shot":{name:"婚纱摄影",sub:{"全站首页":"#/home","婚纱摄影首页":"#/shot","样片欣赏":"#/samples","客片欣赏":"#/pringles","套系报价":"#/suite","选摄影师":"#/photographers","婚纱纪实":"#/weddingmv","婚照技巧":"#/weddingclass/1"}},"#/hotel":{name:"婚宴预订",sub:{"全站首页":"#/home","婚宴预订首页":"#/hotel","提交需求":"#/hotel-require","大礼包":"#/sale-strategy?type=libao","婚宴知识":"#/weddingclass/2"}},"#/scheme":{name:"婚庆定制",sub:{"全站首页":"#/home","婚庆首页":"#/scheme","实景案例":"#/cases","婚礼跟拍":"#/weddingpat","婚礼视频":"#/weddingvideo","选策划师":"#/planners","提交需求":"#/put-require","选婚礼人":"#/f4","婚礼学堂":"#/weddingclass/3"}},"#/dress":{name:"婚纱礼服首页",sub:{"全站首页":"#/home","婚纱礼服":"#/dress","礼服知识":"#/weddingclass/4"}},"http://www.chinad9.com":{name:"婚戒钻石"},"#/movie":{name:"微电影首页",sub:{"全站首页":"#/home","微电影首页":"#/movie","爱情MV":"#/loveMV","爱情微电影":"#/loveMicro","表演技巧":"#/weddingclass/5"}},"#/appliance":{name:"婚礼用品",sub:{"全站首页":"#/home","婚礼用品":"#appliance"}},"#/rent":{name:"婚车租赁",sub:{"全站首页":"#/home","婚车租赁":"#rent"}}},this.getResourcesLinks=function(t,n){var a={};return"/photographers"===t||"/stylists"===t?(a[t.slice(1)]=t.slice(1),a):(n?$.each(e.menu[n].sub,function(n,r){return r==="#"+t?(a=e.resource[n],!1):void 0}):a=e.resource[e.menu["#"+t].name],a)},this.User={},this.promises={"/":r.httpGET("global/mainModule",{applicablePlatform:"web"}).done(function(t){var a=function(t){var a={};t.data&&n(t.data,a),e.resource=a,console.log("menu:",JSON.stringify(e.resource,null,4))};200===t.code&&a(t)})}}var r=e("./api.js");t.Core=new a}(window)},{"./api.js":65}],67:[function(e,t,n){"use strict";var a=e("react"),r=e("../components/main.js"),o=e("../components/home.js"),i=e("../components/shot.js"),s=e("../components/scheme.js"),l=e("../components/hotel.js"),c=e("../components/hotel-detail.js"),u=e("../components/hall-detail.js"),p=e("../components/samples.js"),m=e("../components/samples-detail.js"),d=e("../components/pringles.js"),h=e("../components/pringles-detail.js"),f=e("../components/photo-detail.js"),g=e("../components/suites.js"),v=e("../components/suites-detail.js"),E=e("../components/photographers.js"),y=e("../components/stylists.js"),b=e("../components/dress-index.js"),N=e("../components/dress-brand.js"),x=e("../components/movie-list.js"),w=e("../components/movie-detail.js"),C=e("../components/cases.js"),_=e("../components/case-detail.js"),R=e("../components/planners.js"),I=e("../components/f4.js"),j=e("../components/wedding-mv.js"),S=e("../components/map.js"),D=(e("../components/planners.js"),e("../components/sale-strategy.js")),P=e("../components/about-us.js"),O=e("../components/not-found.js"),k=e("../components/static-activities.js"),M=e("../components/video-detail.js"),T=e("../components/wedding-class.js"),U=e("../components/wedding-class-detail.js"),L=e("../components/wedding-and-pat.js"),A=e("../components/gather-require.js"),V=e("../components/wedding-video.js"),$=e("../components/love-mv.js"),F=e("../components/love-micro.js"),B=e("../components/put-require.js"),H=e("../components/hotel-require.js"),q=e("react-router-ie8"),W=q.DefaultRoute,z=q.NotFoundRoute,K=q.Route,G=a.createElement(K,{handler:r,path:"/",name:"app"},a.createElement(K,{name:"home",path:"home",handler:o}),a.createElement(K,{name:"shot",path:"shot",handler:i}),a.createElement(K,{name:"samples",path:"samples",handler:p}),a.createElement(K,{name:"samples-detail",path:"samples/:moduleId/:contentId",handler:m}),a.createElement(K,{name:"pringles",path:"pringles",handler:d}),a.createElement(K,{name:"pringles-detail",path:"pringles/:moduleId/:contentId",handler:h}),a.createElement(K,{name:"scheme",path:"scheme",handler:s}),a.createElement(K,{name:"cases",path:"cases",handler:C}),a.createElement(K,{name:"hotel",path:"hotel",handler:l}),a.createElement(K,{name:"hotel-detail",path:"hotel/:moduleId/:contentId",handler:c}),a.createElement(K,{name:"banquet-detail",path:"hotel/:moduleId/:contentId/:banquetId",handler:u}),a.createElement(K,{name:"case-detail",path:"scheme/:moduleId/:contentId",handler:_}),a.createElement(K,{name:"suite",path:"suite",handler:g}),a.createElement(K,{name:"suites-detail",path:"suite/:moduleId/:contentId",handler:v}),a.createElement(K,{name:"photographers",path:"photographers",handler:E}),a.createElement(K,{name:"photographers-works",path:"photographers/:personId/works/:worksId",handler:f}),a.createElement(K,{name:"stylists",path:"stylists",handler:y}),a.createElement(K,{name:"promote",path:"promote",handler:k}),a.createElement(K,{name:"map",path:"map",handler:S}),a.createElement(K,{name:"sale-strategy",path:"sale-strategy",handler:D}),a.createElement(K,{name:"dress-index",path:"dress",handler:b}),a.createElement(K,{name:"dress-brand",path:"dress/:brandId",handler:N}),a.createElement(K,{name:"movie-index",path:"movie",handler:x}),a.createElement(K,{name:"movie-detail",path:"movie/:movieId",handler:w}),a.createElement(K,{name:"wedding-class",path:"weddingclass/:moduleTypeId",handler:T}),a.createElement(K,{name:"wedding-class-detail",path:"weddingclass/:moduleTypeId/:weddingClassroomId",handler:U}),a.createElement(K,{name:"f4",path:"f4",handler:I}),a.createElement(K,{name:"video",path:"video-detail",handler:M}),a.createElement(K,{name:"planners",path:"planners",handler:R}),a.createElement(K,{name:"weddingmv",path:"weddingmv",handler:j}),a.createElement(K,{name:"aboutUs",path:"aboutUs",handler:P}),a.createElement(K,{name:"weddingvideo",path:"weddingvideo",handler:V}),a.createElement(K,{name:"lovemv",path:"lovemv",handler:$}),a.createElement(K,{name:"lovemicro",path:"lovemicro",handler:F}),a.createElement(K,{name:"weddingpat",path:"weddingpat",handler:L}),a.createElement(K,{name:"gather",path:"gather",handler:A}),a.createElement(K,{name:"put-require",path:"put-require",handler:B}),a.createElement(K,{name:"hotel-require",path:"hotel-require",handler:H}),a.createElement(W,{handler:o}),a.createElement(z,{handler:O}));t.exports=G},{"../components/about-us.js":2,"../components/case-detail.js":3,"../components/cases.js":5,"../components/dress-brand.js":6,"../components/dress-index.js":7,"../components/f4.js":8,"../components/gather-require.js":10,"../components/hall-detail.js":11,"../components/home.js":16,"../components/hotel-detail.js":17,"../components/hotel-require.js":19,"../components/hotel.js":20,"../components/love-micro.js":22,"../components/love-mv.js":23,"../components/main.js":24,"../components/map.js":25,"../components/movie-detail.js":26,"../components/movie-list.js":27,"../components/not-found.js":29,"../components/photo-detail.js":30,"../components/photographers.js":32,"../components/planners.js":33,"../components/pringles-detail.js":34,"../components/pringles.js":37,"../components/put-require.js":38,"../components/sale-strategy.js":39,"../components/samples-detail.js":40,"../components/samples.js":43,"../components/scheme.js":44,"../components/shot.js":46,"../components/static-activities.js":47,"../components/stylists.js":49,"../components/suites-detail.js":51,"../components/suites.js":55,"../components/video-detail.js":57,"../components/wedding-and-pat.js":58,"../components/wedding-class-detail.js":59,"../components/wedding-class.js":61,"../components/wedding-mv.js":62,"../components/wedding-video.js":63,react:263,"react-router-ie8":100}],68:[function(e,t,n){"use strict";$.fn.Slider=function(e,t){function n(){var e=0;if("alpha"==a.type)d.text(1),l.each(function(e){$(this).css({position:"absolute",left:0,top:0})}),$(l[0]).addClass(a.changeClass),setInterval(function(){l.each(function(t){$(this).hasClass(a.changeClass)&&(e=t)}),$(l[e]).removeClass(a.changeClass),e<l.length-1?($(l[e+1]).addClass(a.changeClass),d.text(e+2)):($(l[0]).addClass(a.changeClass),d.text(1))},a.time);else if("Horizontal"==a.type){var t,n,e,r,o;!function(){var d=function(e,t){var r=t;e.addClass(a.changeClass),l.each(function(e){e!=r&&$(this).removeClass(a.changeClass)}),m.css({opacity:0}),m.attr("src",$(l[r]).attr(a.itemBigUrl)),m.attr("data-index",r);var o=e.find("a").attr("data-width"),i=e.find("a").attr("data-height");o/i>=a.proportion?(m.width("100%").height(p.width()*i/o),m.css({marginTop:(p.height()-m.height())/2,marginLeft:"auto"}),f(m[0],function(){m.animate({opacity:1},function(){n=!1})})):(m.height("100%").width(p.height()*o/i),m.css({marginLeft:(p.width()-m.width())/2,marginTop:"auto"}),f(m[0],function(){m.animate({opacity:1},function(){n=!1})}))},h=function(e){s.animate({left:e})},f=function(e,t){e&&(e.complete||"complete"==e.readyState?t():e.onload=t)};t=l.width(),n=!1,e=0,s.width(function(){return l.length*t}),l.each(function(e){$(this).css({left:t*e})}),r=s.width(),o=i.width(),d($(l[0]),e),c.bind("click",function(){if(e>0&&e<=l.length-1&&!n){e--,n=!0,d($(l[e]),e);var a=s.position().left;s.position().left<0&&h(a+t)}}),u.bind("click",function(){if(e>=0&&e<l.length-1&&!n){e++,n=!0,d($(l[e]),e);var a=s.position().left;s.position().left>o-r&&h(a-t)}}),l.each(function(t){$(this).bind("click",function(){return n?!1:(e=t,n=!0,d($(this),e),!1)})})}()}}var a={time:5e3,changeClass:"item-current",sliderBoxClass:"slider-box",itemBoxClass:"item-box",itemClass:"item",itemBigUrl:"data-big-img-url",btnPrevClass:"btn-prev",btnNextClass:"btn-next",bigImgBox:"kpxq-img-box",bigImgClass:"big-img",bigImgUrls:null,imgIndBox:"img_index",proportion:1.5,type:"alpha"};if(e)for(var r in e)a[r]=e[r];var o=$(this),i=$("."+a.sliderBoxClass,o),s=$("."+a.itemBoxClass,o),l=$("."+a.itemClass,o),c=$("."+a.btnPrevClass,o),u=$("."+a.btnNextClass,o),p=$("."+a.bigImgBox,o),m=$("."+a.bigImgClass,o);if(a.imgIndBox)var d=$("#"+a.imgIndBox);n()}},{}],69:[function(e,t,n){"use strict";function a(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}t.exports=Object.assign||function(e,t){for(var n,r,o=a(e),i=1;i<arguments.length;i++){n=arguments[i],r=Object.keys(Object(n));for(var s=0;s<r.length;s++)o[r[s]]=n[r[s]]}return o}},{}],70:[function(e,t,n){function a(){}var r=t.exports={};r.nextTick=function(){var e="undefined"!=typeof window&&window.setImmediate,t="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(e)return function(e){return window.setImmediate(e)};if(t){var n=[];return window.addEventListener("message",function(e){var t=e.source;if((t===window||null===t)&&"process-tick"===e.data&&(e.stopPropagation(),n.length>0)){var a=n.shift();a()}},!0),function(e){n.push(e),window.postMessage("process-tick","*")}}return function(e){setTimeout(e,0)}}(),r.title="browser",r.browser=!0,r.env={},r.argv=[],r.on=a,r.addListener=a,r.once=a,r.off=a,r.removeListener=a,r.removeAllListeners=a,r.emit=a,r.binding=function(e){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(e){throw new Error("process.chdir is not supported")}},{}],71:[function(e,t,n){t.exports=e("./lib/")},{"./lib/":72}],72:[function(e,t,n){var a=e("./stringify"),r=e("./parse");t.exports={stringify:a,parse:r}},{"./parse":73,"./stringify":74}],73:[function(e,t,n){var a=e("./utils"),r={delimiter:"&",depth:5,arrayLimit:20,parameterLimit:1e3};r.parseValues=function(e,t){for(var n={},r=e.split(t.delimiter,t.parameterLimit===1/0?void 0:t.parameterLimit),o=0,i=r.length;i>o;++o){var s=r[o],l=-1===s.indexOf("]=")?s.indexOf("="):s.indexOf("]=")+1;if(-1===l)n[a.decode(s)]="";else{var c=a.decode(s.slice(0,l)),u=a.decode(s.slice(l+1));if(Object.prototype.hasOwnProperty(c))continue;n.hasOwnProperty(c)?n[c]=[].concat(n[c]).concat(u):n[c]=u}}return n},r.parseObject=function(e,t,n){if(!e.length)return t;var a=e.shift(),o={};if("[]"===a)o=[],o=o.concat(r.parseObject(e,t,n));else{var i="["===a[0]&&"]"===a[a.length-1]?a.slice(1,a.length-1):a,s=parseInt(i,10),l=""+s;!isNaN(s)&&a!==i&&l===i&&s>=0&&s<=n.arrayLimit?(o=[],o[s]=r.parseObject(e,t,n)):o[i]=r.parseObject(e,t,n)}return o},r.parseKeys=function(e,t,n){if(e){var a=/^([^\[\]]*)/,o=/(\[[^\[\]]*\])/g,i=a.exec(e);if(!Object.prototype.hasOwnProperty(i[1])){var s=[];i[1]&&s.push(i[1]);
for(var l=0;null!==(i=o.exec(e))&&l<n.depth;)++l,Object.prototype.hasOwnProperty(i[1].replace(/\[|\]/g,""))||s.push(i[1]);return i&&s.push("["+e.slice(i.index)+"]"),r.parseObject(s,t,n)}}},t.exports=function(e,t){if(""===e||null===e||"undefined"==typeof e)return{};t=t||{},t.delimiter="string"==typeof t.delimiter||a.isRegExp(t.delimiter)?t.delimiter:r.delimiter,t.depth="number"==typeof t.depth?t.depth:r.depth,t.arrayLimit="number"==typeof t.arrayLimit?t.arrayLimit:r.arrayLimit,t.parameterLimit="number"==typeof t.parameterLimit?t.parameterLimit:r.parameterLimit;for(var n="string"==typeof e?r.parseValues(e,t):e,o={},i=Object.keys(n),s=0,l=i.length;l>s;++s){var c=i[s],u=r.parseKeys(c,n[c],t);o=a.merge(o,u)}return a.compact(o)}},{"./utils":75}],74:[function(e,t,n){var a=e("./utils"),r={delimiter:"&",arrayPrefixGenerators:{brackets:function(e,t){return e+"[]"},indices:function(e,t){return e+"["+t+"]"},repeat:function(e,t){return e}}};r.stringify=function(e,t,n){if(a.isBuffer(e)?e=e.toString():e instanceof Date?e=e.toISOString():null===e&&(e=""),"string"==typeof e||"number"==typeof e||"boolean"==typeof e)return[encodeURIComponent(t)+"="+encodeURIComponent(e)];var o=[];if("undefined"==typeof e)return o;for(var i=Object.keys(e),s=0,l=i.length;l>s;++s){var c=i[s];o=Array.isArray(e)?o.concat(r.stringify(e[c],n(t,c),n)):o.concat(r.stringify(e[c],t+"["+c+"]",n))}return o},t.exports=function(e,t){t=t||{};var n="undefined"==typeof t.delimiter?r.delimiter:t.delimiter,a=[];if("object"!=typeof e||null===e)return"";var o;o=t.arrayFormat in r.arrayPrefixGenerators?t.arrayFormat:"indices"in t?t.indices?"indices":"repeat":"indices";for(var i=r.arrayPrefixGenerators[o],s=Object.keys(e),l=0,c=s.length;c>l;++l){var u=s[l];a=a.concat(r.stringify(e[u],u,i))}return a.join(n)}},{"./utils":75}],75:[function(e,t,n){n.arrayToObject=function(e){for(var t={},n=0,a=e.length;a>n;++n)"undefined"!=typeof e[n]&&(t[n]=e[n]);return t},n.merge=function(e,t){if(!t)return e;if("object"!=typeof t)return Array.isArray(e)?e.push(t):e[t]=!0,e;if("object"!=typeof e)return e=[e].concat(t);Array.isArray(e)&&!Array.isArray(t)&&(e=n.arrayToObject(e));for(var a=Object.keys(t),r=0,o=a.length;o>r;++r){var i=a[r],s=t[i];e[i]?e[i]=n.merge(e[i],s):e[i]=s}return e},n.decode=function(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(t){return e}},n.compact=function(e,t){if("object"!=typeof e||null===e)return e;t=t||[];var a=t.indexOf(e);if(-1!==a)return t[a];if(t.push(e),Array.isArray(e)){for(var r=[],o=0,i=e.length;i>o;++o)"undefined"!=typeof e[o]&&r.push(e[o]);return r}var s=Object.keys(e);for(o=0,i=s.length;i>o;++o){var l=s[o];e[l]=n.compact(e[l],t)}return e},n.isRegExp=function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},n.isBuffer=function(e){return null===e||"undefined"==typeof e?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))}},{}],76:[function(e,t,n){"use strict";function a(){}t.exports=a},{}],77:[function(e,t,n){"use strict";var a=e("react/lib/invariant"),r=e("react/lib/ExecutionEnvironment").canUseDOM,o={length:1,back:function(){a(r,"Cannot use History.back without a DOM"),o.length-=1,window.history.back()}};t.exports=o},{"react/lib/ExecutionEnvironment":128,"react/lib/invariant":243}],78:[function(e,t,n){"use strict";function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t,n){var a=e.childRoutes;if(a)for(var o,l,c=0,u=a.length;u>c;++c)if(l=a[c],!l.isDefault&&!l.isNotFound&&(o=r(l,t,n)))return o.routes.unshift(e),o;var p=e.defaultRoute;if(p&&(d=i.extractParams(p.path,t)))return new s(t,d,n,[e,p]);var m=e.notFoundRoute;if(m&&(d=i.extractParams(m.path,t)))return new s(t,d,n,[e,m]);var d=i.extractParams(e.path,t);return d?new s(t,d,n,[e]):null}var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),i=e("./PathUtils"),s=function(){function e(t,n,r,o){a(this,e),this.pathname=t,this.params=n,this.query=r,this.routes=o}return o(e,null,[{key:"findMatch",value:function(e,t){for(var n=i.withoutQuery(t),a=i.extractQuery(t),o=null,s=0,l=e.length;null==o&&l>s;++s)o=r(e[s],n,a);return o}}]),e}();t.exports=s},{"./PathUtils":80}],79:[function(e,t,n){"use strict";var a=e("./PropTypes"),r={contextTypes:{router:a.router.isRequired},makePath:function(e,t,n){return this.context.router.makePath(e,t,n)},makeHref:function(e,t,n){return this.context.router.makeHref(e,t,n)},transitionTo:function(e,t,n){this.context.router.transitionTo(e,t,n)},replaceWith:function(e,t,n){this.context.router.replaceWith(e,t,n)},goBack:function(){return this.context.router.goBack()}};t.exports=r},{"./PropTypes":81}],80:[function(e,t,n){"use strict";function a(e){if(!(e in p)){var t=[],n=e.replace(s,function(e,n){return n?(t.push(n),"([^/?#]+)"):"*"===e?(t.push("splat"),"(.*?)"):"\\"+e});p[e]={matcher:new RegExp("^"+n+"$","i"),paramNames:t}}return p[e]}var r=e("react/lib/invariant"),o=e("object-assign"),i=e("qs"),s=/:([a-zA-Z_$][a-zA-Z0-9_$]*)|[*.()\[\]\\+|{}^$]/g,l=/:([a-zA-Z_$][a-zA-Z0-9_$?]*[?]?)|[*]/g,c=/\/\/\?|\/\?\/|\/\?/g,u=/\?(.*)$/,p={},m={isAbsolute:function(e){return"/"===e.charAt(0)},join:function(e,t){return e.replace(/\/*$/,"/")+t},extractParamNames:function(e){return a(e).paramNames},extractParams:function(e,t){var n=a(e),r=n.matcher,o=n.paramNames,i=t.match(r);if(!i)return null;var s={};return o.forEach(function(e,t){s[e]=i[t+1]}),s},injectParams:function(e,t){t=t||{};var n=0;return e.replace(l,function(a,o){if(o=o||"splat","?"===o.slice(-1)){if(o=o.slice(0,-1),null==t[o])return""}else r(null!=t[o],'Missing "%s" parameter for path "%s"',o,e);var i;return"splat"===o&&Array.isArray(t[o])?(i=t[o][n++],r(null!=i,'Missing splat # %s for path "%s"',n,e)):i=t[o],i}).replace(c,"/")},extractQuery:function(e){var t=e.match(u);return t&&i.parse(t[1])},withoutQuery:function(e){return e.replace(u,"")},withQuery:function(e,t){var n=m.extractQuery(e);n&&(t=t?o(n,t):n);var a=i.stringify(t,{arrayFormat:"brackets"});return a?m.withoutQuery(e)+"?"+a:m.withoutQuery(e)}};t.exports=m},{"object-assign":69,qs:71,"react/lib/invariant":243}],81:[function(e,t,n){"use strict";var a=e("react/lib/Object.assign"),r=e("react").PropTypes,o=e("./Route"),i=a({},r,{falsy:function(e,t,n){return e[t]?new Error("<"+n+'> should not have a "'+t+'" prop'):void 0},route:r.instanceOf(o),router:r.func});t.exports=i},{"./Route":83,react:263,"react/lib/Object.assign":134}],82:[function(e,t,n){"use strict";function a(e,t,n){this.to=e,this.params=t,this.query=n}t.exports=a},{}],83:[function(e,t,n){"use strict";function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var r,o=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),i=e("react/lib/Object.assign"),s=e("react/lib/invariant"),l=e("react/lib/warning"),c=e("./PathUtils"),u=function(){function e(t,n,r,o,i,s,l,u){a(this,e),this.name=t,this.path=n,this.paramNames=c.extractParamNames(this.path),this.ignoreScrollBehavior=!!r,this.isDefault=!!o,this.isNotFound=!!i,this.onEnter=s,this.onLeave=l,this.handler=u}return o(e,[{key:"appendChild",value:function(t){s(t instanceof e,"route.appendChild must use a valid Route"),this.childRoutes||(this.childRoutes=[]),this.childRoutes.push(t)}},{key:"toString",value:function(){var e="<Route";return this.name&&(e+=' name="'+this.name+'"'),e+=' path="'+this.path+'">'}}],[{key:"createRoute",value:function(t,n){t=t||{},"string"==typeof t&&(t={path:t});var a=r;a?l(null==t.parentRoute||t.parentRoute===a,"You should not use parentRoute with createRoute inside another route's child callback; it is ignored"):a=t.parentRoute;var o=t.name,i=t.path||o;!i||t.isDefault||t.isNotFound?i=a?a.path:"/":c.isAbsolute(i)?a&&s(i===a.path||0===a.paramNames.length,'You cannot nest path "%s" inside "%s"; the parent requires URL parameters',i,a.path):i=a?c.join(a.path,i):"/"+i,t.isNotFound&&!/\*$/.test(i)&&(i+="*");var u=new e(o,i,t.ignoreScrollBehavior,t.isDefault,t.isNotFound,t.onEnter,t.onLeave,t.handler);if(a&&(u.isDefault?(s(null==a.defaultRoute,"%s may not have more than one default route",a),a.defaultRoute=u):u.isNotFound&&(s(null==a.notFoundRoute,"%s may not have more than one not found route",a),a.notFoundRoute=u),a.appendChild(u)),"function"==typeof n){var p=r;r=u,n.call(u,u),r=p}return u}},{key:"createDefaultRoute",value:function(t){return e.createRoute(i({},t,{isDefault:!0}))}},{key:"createNotFoundRoute",value:function(t){return e.createRoute(i({},t,{isNotFound:!0}))}},{key:"createRedirect",value:function(t){return e.createRoute(i({},t,{path:t.path||t.from||"*",onEnter:function(e,n,a){e.redirect(t.to,t.params||n,t.query||a)}}))}}]),e}();t.exports=u},{"./PathUtils":80,"react/lib/Object.assign":134,"react/lib/invariant":243,"react/lib/warning":262}],84:[function(e,t,n){"use strict";function a(e,t){if(!t)return!0;if(e.pathname===t.pathname)return!1;var n=e.routes,a=t.routes,r=n.filter(function(e){return-1!==a.indexOf(e)});return!r.some(function(e){return e.ignoreScrollBehavior})}var r=e("react/lib/invariant"),o=e("react/lib/ExecutionEnvironment").canUseDOM,i=e("./getWindowScrollPosition"),s={statics:{recordScrollPosition:function(e){this.scrollHistory||(this.scrollHistory={}),this.scrollHistory[e]=i()},getScrollPosition:function(e){return this.scrollHistory||(this.scrollHistory={}),this.scrollHistory[e]||null}},componentWillMount:function(){r(null==this.constructor.getScrollBehavior()||o,"Cannot use scroll behavior without a DOM")},componentDidMount:function(){this._updateScroll()},componentDidUpdate:function(e,t){this._updateScroll(t)},_updateScroll:function(e){if(a(this.state,e)){var t=this.constructor.getScrollBehavior();t&&t.updateScrollPosition(this.constructor.getScrollPosition(this.state.path),this.state.action)}}};t.exports=s},{"./getWindowScrollPosition":99,"react/lib/ExecutionEnvironment":128,"react/lib/invariant":243}],85:[function(e,t,n){"use strict";var a=e("./PropTypes"),r={contextTypes:{router:a.router.isRequired},getPath:function(){return this.context.router.getCurrentPath()},getPathname:function(){return this.context.router.getCurrentPathname()},getParams:function(){return this.context.router.getCurrentParams()},getQuery:function(){return this.context.router.getCurrentQuery()},getRoutes:function(){return this.context.router.getCurrentRoutes()},isActive:function(e,t,n){return this.context.router.isActive(e,t,n)}};t.exports=r},{"./PropTypes":81}],86:[function(e,t,n){"use strict";function a(e,t){this.path=e,this.abortReason=null,this.retry=t.bind(this)}var r=e("./Cancellation"),o=e("./Redirect");a.prototype.abort=function(e){null==this.abortReason&&(this.abortReason=e||"ABORT")},a.prototype.redirect=function(e,t,n){this.abort(new o(e,t,n))},a.prototype.cancel=function(){this.abort(new r)},a.from=function(e,t,n,a){t.reduce(function(t,a,r){return function(o){if(o||e.abortReason)t(o);else if(a.onLeave)try{a.onLeave(e,n[r],t),a.onLeave.length<3&&t()}catch(i){t(i)}else t()}},a)()},a.to=function(e,t,n,a,r){t.reduceRight(function(t,r){return function(o){if(o||e.abortReason)t(o);else if(r.onEnter)try{r.onEnter(e,n,a,t),r.onEnter.length<4&&t()}catch(i){t(i)}else t()}},r)()},t.exports=a},{"./Cancellation":76,"./Redirect":82}],87:[function(e,t,n){"use strict";var a={PUSH:"push",REPLACE:"replace",POP:"pop"};t.exports=a},{}],88:[function(e,t,n){"use strict";var a=e("../actions/LocationActions"),r={updateScrollPosition:function(e,t){switch(t){case a.PUSH:case a.REPLACE:window.scrollTo(0,0);break;case a.POP:e?window.scrollTo(e.x,e.y):window.scrollTo(0,0)}}};t.exports=r},{"../actions/LocationActions":87}],89:[function(e,t,n){"use strict";var a={updateScrollPosition:function(){window.scrollTo(0,0)}};t.exports=a},{}],90:[function(e,t,n){"use strict";function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(e.__proto__=t)}var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),i=e("react"),s=function(e){function t(){a(this,t),null!=e&&e.apply(this,arguments)}return r(t,e),o(t,[{key:"render",value:function(){return this.props.children}}]),t}(i.Component);t.exports=s},{react:263}],91:[function(e,t,n){"use strict";function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(e.__proto__=t)}var o=e("../PropTypes"),i=e("./RouteHandler"),s=e("./Route"),l=function(e){function t(){a(this,t),null!=e&&e.apply(this,arguments)}return r(t,e),t}(s);l.propTypes={name:o.string,path:o.falsy,children:o.falsy,handler:o.func.isRequired},l.defaultProps={handler:i},t.exports=l},{"../PropTypes":81,"./Route":95,"./RouteHandler":96}],92:[function(e,t,n){"use strict";function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(e.__proto__=t)}function o(e){return 0===e.button}function i(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),l=e("react"),c=e("react/lib/Object.assign"),u=e("../PropTypes"),p=function(e){function t(){a(this,t),null!=e&&e.apply(this,arguments)}return r(t,e),s(t,[{key:"handleClick",value:function(e){var t,n=!0;this.props.onClick&&(t=this.props.onClick(e)),!i(e)&&o(e)&&((t===!1||e.defaultPrevented===!0)&&(n=!1),e.preventDefault(),n&&this.context.router.transitionTo(this.props.to,this.props.params,this.props.query))}},{key:"getHref",value:function(){return this.context.router.makeHref(this.props.to,this.props.params,this.props.query)}},{key:"getClassName",value:function(){var e=this.props.className;return this.getActiveState()&&(e+=" "+this.props.activeClassName),e}},{key:"getActiveState",value:function(){return this.context.router.isActive(this.props.to,this.props.params,this.props.query)}},{key:"render",value:function(){var e=c({},this.props,{href:this.getHref(),className:this.getClassName(),onClick:this.handleClick.bind(this)});return e.activeStyle&&this.getActiveState()&&(e.style=e.activeStyle),l.DOM.a(e,this.props.children)}}]),t}(l.Component);p.contextTypes={router:u.router.isRequired},p.propTypes={activeClassName:u.string.isRequired,to:u.oneOfType([u.string,u.route]).isRequired,params:u.object,query:u.object,activeStyle:u.object,onClick:u.func},p.defaultProps={activeClassName:"active",className:""},t.exports=p},{"../PropTypes":81,react:263,"react/lib/Object.assign":134}],93:[function(e,t,n){"use strict";function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(e.__proto__=t)}var o=e("../PropTypes"),i=e("./RouteHandler"),s=e("./Route"),l=function(e){function t(){a(this,t),null!=e&&e.apply(this,arguments)}return r(t,e),t}(s);l.propTypes={name:o.string,path:o.falsy,children:o.falsy,handler:o.func.isRequired},l.defaultProps={handler:i},t.exports=l},{"../PropTypes":81,"./Route":95,"./RouteHandler":96}],94:[function(e,t,n){"use strict";function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(e.__proto__=t)}var o=e("../PropTypes"),i=e("./Route"),s=function(e){function t(){a(this,t),null!=e&&e.apply(this,arguments)}return r(t,e),t}(i);s.propTypes={path:o.string,from:o.string,to:o.string,handler:o.falsy},s.defaultProps={},t.exports=s},{"../PropTypes":81,"./Route":95}],95:[function(e,t,n){"use strict";function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(e.__proto__=t)}var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),i=e("react"),s=e("react/lib/invariant"),l=e("../PropTypes"),c=e("./RouteHandler"),u=function(e){function t(){a(this,t),null!=e&&e.apply(this,arguments)}return r(t,e),o(t,[{key:"render",value:function(){s(!1,"%s elements are for router configuration only and should not be rendered",this.constructor.name)}}]),t}(i.Component);u.propTypes={name:l.string,path:l.string,handler:l.func,ignoreScrollBehavior:l.bool},u.defaultProps={handler:c},t.exports=u},{"../PropTypes":81,"./RouteHandler":96,react:263,"react/lib/invariant":243}],96:[function(e,t,n){"use strict";function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(e.__proto__=t)}var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),i=e("react"),s=e("./ContextWrapper"),l=e("react/lib/Object.assign"),c=e("../PropTypes"),u="__routeHandler__",p=function(e){function t(){a(this,t),null!=e&&e.apply(this,arguments)}return r(t,e),o(t,[{key:"getChildContext",value:function(){return{routeDepth:this.context.routeDepth+1}}},{key:"componentDidMount",value:function(){this._updateRouteComponent(this.refs[u])}},{key:"componentDidUpdate",value:function(){this._updateRouteComponent(this.refs[u])}},{key:"componentWillUnmount",value:function(){this._updateRouteComponent(null)}},{key:"_updateRouteComponent",value:function(e){this.context.router.setRouteComponentAtDepth(this.getRouteDepth(),e)}},{key:"getRouteDepth",value:function(){return this.context.routeDepth}},{key:"createChildRouteHandler",value:function(e){var t=this.context.router.getRouteAtDepth(this.getRouteDepth());if(null==t)return null;var n=l({},e||this.props,{ref:u,params:this.context.router.getCurrentParams(),query:this.context.router.getCurrentQuery()});return i.createElement(t.handler,n)}},{key:"render",value:function(){var e=this.createChildRouteHandler();return e?i.createElement(s,null,e):i.createElement("script",null)}}]),t}(i.Component);p.contextTypes={routeDepth:c.number.isRequired,router:c.router.isRequired},p.childContextTypes={routeDepth:c.number.isRequired},t.exports=p},{"../PropTypes":81,"./ContextWrapper":90,react:263,"react/lib/Object.assign":134}],97:[function(e,t,n){(function(n){"use strict";function a(e,t){for(var n in t)if(t.hasOwnProperty(n)&&e[n]!==t[n])return!1;return!0}function r(e,t,n,r,o,i){return e.some(function(e){if(e!==t)return!1;for(var s,l=t.paramNames,c=0,u=l.length;u>c;++c)if(s=l[c],r[s]!==n[s])return!1;return a(o,i)&&a(i,o)})}function o(e,t){for(var n,a=0,r=e.length;r>a;++a)n=e[a],n.name&&(m(null==t[n.name],'You may not have more than one route named "%s"',n.name),t[n.name]=n),n.childRoutes&&o(n.childRoutes,t)}function i(e,t){return e.some(function(e){return e.name===t})}function s(e,t){for(var n in t)if(String(e[n])!==String(t[n]))return!1;return!0}function l(e,t){for(var n in t)if(String(e[n])!==String(t[n]))return!1;return!0}function c(e){e=e||{},x(e)&&(e={routes:e});var t=[],a=e.location||O,c=e.scrollBehavior||k,f={},M={},T=null,U=null;"string"==typeof a&&(a=new y(a)),a instanceof y?p(!d||"test"===n.env.NODE_ENV,"You should not use a static location in a DOM environment because the router will not be kept in sync with the current URL"):m(d||a.needsDOM===!1,"You cannot use %s without a DOM",a),a!==v||D()||(a=E);var L=u.createClass({displayName:"Router",statics:{isRunning:!1,cancelPendingTransition:function(){T&&(T.cancel(),T=null)},clearAllRoutes:function(){L.cancelPendingTransition(),L.namedRoutes={},L.routes=[]},addRoutes:function(e){x(e)&&(e=N(e)),o(e,L.namedRoutes),L.routes.push.apply(L.routes,e)},replaceRoutes:function(e){L.clearAllRoutes(),L.addRoutes(e),L.refresh()},match:function(e){return j.findMatch(L.routes,e)},makePath:function(e,t,n){var a;if(P.isAbsolute(e))a=e;else{var r=e instanceof S?e:L.namedRoutes[e];m(r instanceof S,'Cannot find a route named "%s"',e),a=r.path}return P.withQuery(P.injectParams(a,t),n)},makeHref:function(e,t,n){var r=L.makePath(e,t,n);return a===g?"#"+r:r},transitionTo:function(e,t,n){var r=L.makePath(e,t,n);T?a.replace(r):a.push(r)},replaceWith:function(e,t,n){a.replace(L.makePath(e,t,n))},goBack:function(){return R.length>1||a===E?(a.pop(),!0):(p(!1,"goBack() was ignored because there is no router history"),!1)},handleAbort:e.onAbort||function(e){if(a instanceof y)throw new Error("Unhandled aborted transition! Reason: "+e);e instanceof I||(e instanceof _?a.replace(L.makePath(e.to,e.params,e.query)):a.pop())},handleError:e.onError||function(e){throw e},handleLocationChange:function(e){L.dispatch(e.path,e.type)},dispatch:function(e,n){L.cancelPendingTransition();var a=f.path,o=null==n;if(a!==e||o){a&&n===h.PUSH&&L.recordScrollPosition(a);var i=L.match(e);p(null!=i,'No route matches path "%s". Make sure you have <Route path="%s"> somewhere in your routes',e,e),null==i&&(i={});var s,l,c=f.routes||[],u=f.params||{},m=f.query||{},d=i.routes||[],g=i.params||{},v=i.query||{};c.length?(s=c.filter(function(e){return!r(d,e,u,g,m,v)}),l=d.filter(function(e){return!r(c,e,u,g,m,v)})):(s=[],l=d);var E=new w(e,L.replaceWith.bind(L,e));T=E;var y=t.slice(c.length-s.length);w.from(E,s,y,function(t){return t||E.abortReason?U.call(L,t,E):void w.to(E,l,g,v,function(t){U.call(L,t,E,{path:e,action:n,pathname:i.pathname,routes:d,params:g,query:v})})})}},run:function(e){m(!L.isRunning,"Router is already running"),U=function(t,n,a){t&&L.handleError(t),T===n&&(T=null,n.abortReason?L.handleAbort(n.abortReason):e.call(L,L,M=a))},a instanceof y||(a.addChangeListener&&a.addChangeListener(L.handleLocationChange),L.isRunning=!0),L.refresh()},refresh:function(){L.dispatch(a.getCurrentPath(),null)},stop:function(){L.cancelPendingTransition(),a.removeChangeListener&&a.removeChangeListener(L.handleLocationChange),L.isRunning=!1},getLocation:function(){return a},getScrollBehavior:function(){return c},getRouteAtDepth:function(e){var t=f.routes;return t&&t[e]},setRouteComponentAtDepth:function(e,n){t[e]=n},getCurrentPath:function(){return f.path},getCurrentPathname:function(){return f.pathname},getCurrentParams:function(){return f.params},getCurrentQuery:function(){return f.query},getCurrentRoutes:function(){return f.routes},isActive:function(e,t,n){return P.isAbsolute(e)?e===f.path:i(f.routes,e)&&s(f.params,t)&&(null==n||l(f.query,n))}},mixins:[b],propTypes:{children:C.falsy},childContextTypes:{routeDepth:C.number.isRequired,router:C.router.isRequired},getChildContext:function(){return{routeDepth:1,router:L}},getInitialState:function(){return f=M},componentWillReceiveProps:function(){this.setState(f=M)},componentWillUnmount:function(){L.stop()},render:function(){var e=L.getRouteAtDepth(0);return e?u.createElement(e.handler,this.props):null}});return L.clearAllRoutes(),e.routes&&L.addRoutes(e.routes),L}var u=e("react"),p=e("react/lib/warning"),m=e("react/lib/invariant"),d=e("react/lib/ExecutionEnvironment").canUseDOM,h=e("./actions/LocationActions"),f=e("./behaviors/ImitateBrowserBehavior"),g=e("./locations/HashLocation"),v=e("./locations/HistoryLocation"),E=e("./locations/RefreshLocation"),y=e("./locations/StaticLocation"),b=e("./ScrollHistory"),N=e("./createRoutesFromReactChildren"),x=e("./isReactChildren"),w=e("./Transition"),C=e("./PropTypes"),_=e("./Redirect"),R=e("./History"),I=e("./Cancellation"),j=e("./Match"),S=e("./Route"),D=e("./supportsHistory"),P=e("./PathUtils"),O=d?g:"/",k=d?f:null;t.exports=c}).call(this,e("g5I+bs"))},{"./Cancellation":76,"./History":77,"./Match":78,"./PathUtils":80,"./PropTypes":81,"./Redirect":82,"./Route":83,"./ScrollHistory":84,"./Transition":86,"./actions/LocationActions":87,"./behaviors/ImitateBrowserBehavior":88,"./createRoutesFromReactChildren":98,"./isReactChildren":101,"./locations/HashLocation":102,"./locations/HistoryLocation":103,"./locations/RefreshLocation":104,"./locations/StaticLocation":105,"./supportsHistory":108,"g5I+bs":70,react:263,"react/lib/ExecutionEnvironment":128,"react/lib/invariant":243,"react/lib/warning":262}],98:[function(e,t,n){"use strict";function a(e,t,n){e=e||"UnknownComponent";for(var a in t)if(t.hasOwnProperty(a)){var r=t[a](n,a,e);r instanceof Error&&c(!1,r.message)}}function r(e){var t=l({},e),n=t.handler;return n&&(t.onEnter=n.willTransitionTo,t.onLeave=n.willTransitionFrom),t}function o(e){if(s.isValidElement(e)){var t=e.type,n=l({},t.defaultProps,e.props);return t.propTypes&&a(t.displayName,t.propTypes,n),t===u?d.createDefaultRoute(r(n)):t===p?d.createNotFoundRoute(r(n)):t===m?d.createRedirect(r(n)):d.createRoute(r(n),function(){n.children&&i(n.children)})}}function i(e){var t=[];return s.Children.forEach(e,function(e){(e=o(e))&&t.push(e)}),t}var s=e("react"),l=e("react/lib/Object.assign"),c=e("react/lib/warning"),u=e("./components/DefaultRoute"),p=e("./components/NotFoundRoute"),m=e("./components/Redirect"),d=e("./Route");t.exports=i},{"./Route":83,"./components/DefaultRoute":91,"./components/NotFoundRoute":93,"./components/Redirect":94,react:263,"react/lib/Object.assign":134,"react/lib/warning":262}],99:[function(e,t,n){"use strict";function a(){return r(o,"Cannot get current scroll position without a DOM"),{x:window.pageXOffset||document.documentElement.scrollLeft,y:window.pageYOffset||document.documentElement.scrollTop}}var r=e("react/lib/invariant"),o=e("react/lib/ExecutionEnvironment").canUseDOM;t.exports=a},{"react/lib/ExecutionEnvironment":128,"react/lib/invariant":243}],100:[function(e,t,n){"use strict";n.DefaultRoute=e("./components/DefaultRoute"),n.Link=e("./components/Link"),n.NotFoundRoute=e("./components/NotFoundRoute"),n.Redirect=e("./components/Redirect"),n.Route=e("./components/Route"),n.ActiveHandler=e("./components/RouteHandler"),n.RouteHandler=n.ActiveHandler,n.HashLocation=e("./locations/HashLocation"),n.HistoryLocation=e("./locations/HistoryLocation"),n.RefreshLocation=e("./locations/RefreshLocation"),n.StaticLocation=e("./locations/StaticLocation"),n.TestLocation=e("./locations/TestLocation"),n.ImitateBrowserBehavior=e("./behaviors/ImitateBrowserBehavior"),n.ScrollToTopBehavior=e("./behaviors/ScrollToTopBehavior"),n.History=e("./History"),n.Navigation=e("./Navigation"),n.State=e("./State"),n.createRoute=e("./Route").createRoute,n.createDefaultRoute=e("./Route").createDefaultRoute,n.createNotFoundRoute=e("./Route").createNotFoundRoute,n.createRedirect=e("./Route").createRedirect,n.createRoutesFromReactChildren=e("./createRoutesFromReactChildren"),n.create=e("./createRouter"),n.run=e("./runRouter")},{"./History":77,"./Navigation":79,"./Route":83,"./State":85,"./behaviors/ImitateBrowserBehavior":88,"./behaviors/ScrollToTopBehavior":89,"./components/DefaultRoute":91,"./components/Link":92,"./components/NotFoundRoute":93,"./components/Redirect":94,"./components/Route":95,"./components/RouteHandler":96,"./createRouter":97,"./createRoutesFromReactChildren":98,"./locations/HashLocation":102,"./locations/HistoryLocation":103,"./locations/RefreshLocation":104,"./locations/StaticLocation":105,"./locations/TestLocation":106,"./runRouter":107}],101:[function(e,t,n){"use strict";function a(e){return null==e||o.isValidElement(e)}function r(e){return a(e)||Array.isArray(e)&&e.every(a)}var o=e("react");t.exports=r},{react:263}],102:[function(e,t,n){"use strict";function a(e){e===s.PUSH&&(l.length+=1);var t={path:p.getCurrentPath(),type:e};c.forEach(function(e){e.call(p,t)})}function r(){var e=p.getCurrentPath();return"/"===e.charAt(0)?!0:(p.replace("/"+e),!1)}function o(){if(r()){var e=i;i=null,a(e||s.POP)}}var i,s=e("../actions/LocationActions"),l=e("../History"),c=[],u=!1,p={addChangeListener:function(e){c.push(e),r(),u||(window.addEventListener?window.addEventListener("hashchange",o,!1):window.attachEvent("onhashchange",o),u=!0)},removeChangeListener:function(e){c=c.filter(function(t){return t!==e}),0===c.length&&(window.removeEventListener?window.removeEventListener("hashchange",o,!1):window.removeEvent("onhashchange",o),u=!1)},push:function(e){i=s.PUSH,window.location.hash=e},replace:function(e){i=s.REPLACE,window.location.replace(window.location.pathname+window.location.search+"#"+e)},pop:function(){i=s.POP,l.back()},getCurrentPath:function(){return decodeURI(window.location.href.split("#")[1]||"")},toString:function(){return"<HashLocation>"}};t.exports=p},{"../History":77,"../actions/LocationActions":87}],103:[function(e,t,n){"use strict";function a(e){var t={path:c.getCurrentPath(),type:e};s.forEach(function(e){e.call(c,t)})}function r(e){void 0!==e.state&&a(o.POP)}var o=e("../actions/LocationActions"),i=e("../History"),s=[],l=!1,c={addChangeListener:function(e){s.push(e),l||(window.addEventListener?window.addEventListener("popstate",r,!1):window.attachEvent("onpopstate",r),l=!0)},removeChangeListener:function(e){s=s.filter(function(t){return t!==e}),0===s.length&&(window.addEventListener?window.removeEventListener("popstate",r,!1):window.removeEvent("onpopstate",r),l=!1)},push:function(e){window.history.pushState({path:e},"",e),i.length+=1,a(o.PUSH)},replace:function(e){window.history.replaceState({path:e},"",e),a(o.REPLACE)},pop:i.back,getCurrentPath:function(){return decodeURI(window.location.pathname+window.location.search)},toString:function(){return"<HistoryLocation>"}};t.exports=c},{"../History":77,"../actions/LocationActions":87}],104:[function(e,t,n){"use strict";var a=e("./HistoryLocation"),r=e("../History"),o={push:function(e){window.location=e},replace:function(e){window.location.replace(e)},pop:r.back,getCurrentPath:a.getCurrentPath,toString:function(){return"<RefreshLocation>"}};t.exports=o},{"../History":77,"./HistoryLocation":103}],105:[function(e,t,n){"use strict";function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(){i(!1,"You cannot modify a static location")}var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){
return n&&e(t.prototype,n),a&&e(t,a),t}}(),i=e("react/lib/invariant"),s=function(){function e(t){a(this,e),this.path=t}return o(e,[{key:"getCurrentPath",value:function(){return this.path}},{key:"toString",value:function(){return'<StaticLocation path="'+this.path+'">'}}]),e}();s.prototype.push=r,s.prototype.replace=r,s.prototype.pop=r,t.exports=s},{"react/lib/invariant":243}],106:[function(e,t,n){"use strict";function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),o=e("react/lib/invariant"),i=e("../actions/LocationActions"),s=e("../History"),l=function(){function e(t){a(this,e),this.history=t||[],this.listeners=[],this._updateHistoryLength(),this.needsDOM=!1}return r(e,[{key:"_updateHistoryLength",value:function(){s.length=this.history.length}},{key:"_notifyChange",value:function(e){for(var t={path:this.getCurrentPath(),type:e},n=0,a=this.listeners.length;a>n;++n)this.listeners[n].call(this,t)}},{key:"addChangeListener",value:function(e){this.listeners.push(e)}},{key:"removeChangeListener",value:function(e){this.listeners=this.listeners.filter(function(t){return t!==e})}},{key:"push",value:function(e){this.history.push(e),this._updateHistoryLength(),this._notifyChange(i.PUSH)}},{key:"replace",value:function(e){o(this.history.length,"You cannot replace the current path with no history"),this.history[this.history.length-1]=e,this._notifyChange(i.REPLACE)}},{key:"pop",value:function(){this.history.pop(),this._updateHistoryLength(),this._notifyChange(i.POP)}},{key:"getCurrentPath",value:function(){return this.history[this.history.length-1]}},{key:"toString",value:function(){return"<TestLocation>"}}]),e}();t.exports=l},{"../History":77,"../actions/LocationActions":87,"react/lib/invariant":243}],107:[function(e,t,n){"use strict";function a(e,t,n){"function"==typeof t&&(n=t,t=null);var a=r({routes:e,location:t});return a.run(n),a}var r=e("./createRouter");t.exports=a},{"./createRouter":97}],108:[function(e,t,n){"use strict";function a(){var e=navigator.userAgent;return-1===e.indexOf("Android 2.")&&-1===e.indexOf("Android 4.0")||-1===e.indexOf("Mobile Safari")||-1!==e.indexOf("Chrome")||-1!==e.indexOf("Windows Phone")?window.history&&"pushState"in window.history:!1}t.exports=a},{}],109:[function(e,t,n){"use strict";var a=e("./focusNode"),r={componentDidMount:function(){this.props.autoFocus&&a(this.getDOMNode())}};t.exports=r},{"./focusNode":227}],110:[function(e,t,n){"use strict";function a(){var e=window.opera;return"object"==typeof e&&"function"==typeof e.version&&parseInt(e.version(),10)<=12}function r(e){return(e.ctrlKey||e.altKey||e.metaKey)&&!(e.ctrlKey&&e.altKey)}function o(e){switch(e){case j.topCompositionStart:return S.compositionStart;case j.topCompositionEnd:return S.compositionEnd;case j.topCompositionUpdate:return S.compositionUpdate}}function i(e,t){return e===j.topKeyDown&&t.keyCode===N}function s(e,t){switch(e){case j.topKeyUp:return-1!==b.indexOf(t.keyCode);case j.topKeyDown:return t.keyCode!==N;case j.topKeyPress:case j.topMouseDown:case j.topBlur:return!0;default:return!1}}function l(e){var t=e.detail;return"object"==typeof t&&"data"in t?t.data:null}function c(e,t,n,a){var r,c;if(x?r=o(e):P?s(e,a)&&(r=S.compositionEnd):i(e,a)&&(r=S.compositionStart),!r)return null;_&&(P||r!==S.compositionStart?r===S.compositionEnd&&P&&(c=P.getData()):P=g.getPooled(t));var u=v.getPooled(r,n,a);if(c)u.data=c;else{var p=l(a);null!==p&&(u.data=p)}return h.accumulateTwoPhaseDispatches(u),u}function u(e,t){switch(e){case j.topCompositionEnd:return l(t);case j.topKeyPress:var n=t.which;return n!==R?null:(D=!0,I);case j.topTextInput:var a=t.data;return a===I&&D?null:a;default:return null}}function p(e,t){if(P){if(e===j.topCompositionEnd||s(e,t)){var n=P.getData();return g.release(P),P=null,n}return null}switch(e){case j.topPaste:return null;case j.topKeyPress:return t.which&&!r(t)?String.fromCharCode(t.which):null;case j.topCompositionEnd:return _?null:t.data;default:return null}}function m(e,t,n,a){var r;if(r=C?u(e,a):p(e,a),!r)return null;var o=E.getPooled(S.beforeInput,n,a);return o.data=r,h.accumulateTwoPhaseDispatches(o),o}var d=e("./EventConstants"),h=e("./EventPropagators"),f=e("./ExecutionEnvironment"),g=e("./FallbackCompositionState"),v=e("./SyntheticCompositionEvent"),E=e("./SyntheticInputEvent"),y=e("./keyOf"),b=[9,13,27,32],N=229,x=f.canUseDOM&&"CompositionEvent"in window,w=null;f.canUseDOM&&"documentMode"in document&&(w=document.documentMode);var C=f.canUseDOM&&"TextEvent"in window&&!w&&!a(),_=f.canUseDOM&&(!x||w&&w>8&&11>=w),R=32,I=String.fromCharCode(R),j=d.topLevelTypes,S={beforeInput:{phasedRegistrationNames:{bubbled:y({onBeforeInput:null}),captured:y({onBeforeInputCapture:null})},dependencies:[j.topCompositionEnd,j.topKeyPress,j.topTextInput,j.topPaste]},compositionEnd:{phasedRegistrationNames:{bubbled:y({onCompositionEnd:null}),captured:y({onCompositionEndCapture:null})},dependencies:[j.topBlur,j.topCompositionEnd,j.topKeyDown,j.topKeyPress,j.topKeyUp,j.topMouseDown]},compositionStart:{phasedRegistrationNames:{bubbled:y({onCompositionStart:null}),captured:y({onCompositionStartCapture:null})},dependencies:[j.topBlur,j.topCompositionStart,j.topKeyDown,j.topKeyPress,j.topKeyUp,j.topMouseDown]},compositionUpdate:{phasedRegistrationNames:{bubbled:y({onCompositionUpdate:null}),captured:y({onCompositionUpdateCapture:null})},dependencies:[j.topBlur,j.topCompositionUpdate,j.topKeyDown,j.topKeyPress,j.topKeyUp,j.topMouseDown]}},D=!1,P=null,O={eventTypes:S,extractEvents:function(e,t,n,a){return[c(e,t,n,a),m(e,t,n,a)]}};t.exports=O},{"./EventConstants":122,"./EventPropagators":127,"./ExecutionEnvironment":128,"./FallbackCompositionState":129,"./SyntheticCompositionEvent":201,"./SyntheticInputEvent":205,"./keyOf":249}],111:[function(e,t,n){"use strict";function a(e,t){return e+t.charAt(0).toUpperCase()+t.substring(1)}var r={boxFlex:!0,boxFlexGroup:!0,columnCount:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,strokeDashoffset:!0,strokeOpacity:!0,strokeWidth:!0},o=["Webkit","ms","Moz","O"];Object.keys(r).forEach(function(e){o.forEach(function(t){r[a(t,e)]=r[e]})});var i={background:{backgroundImage:!0,backgroundPosition:!0,backgroundRepeat:!0,backgroundColor:!0},border:{borderWidth:!0,borderStyle:!0,borderColor:!0},borderBottom:{borderBottomWidth:!0,borderBottomStyle:!0,borderBottomColor:!0},borderLeft:{borderLeftWidth:!0,borderLeftStyle:!0,borderLeftColor:!0},borderRight:{borderRightWidth:!0,borderRightStyle:!0,borderRightColor:!0},borderTop:{borderTopWidth:!0,borderTopStyle:!0,borderTopColor:!0},font:{fontStyle:!0,fontVariant:!0,fontWeight:!0,fontSize:!0,lineHeight:!0,fontFamily:!0}},s={isUnitlessNumber:r,shorthandPropertyExpansions:i};t.exports=s},{}],112:[function(e,t,n){(function(n){"use strict";var a=e("./CSSProperty"),r=e("./ExecutionEnvironment"),o=e("./camelizeStyleName"),i=e("./dangerousStyleValue"),s=e("./hyphenateStyleName"),l=e("./memoizeStringOnly"),c=e("./warning"),u=l(function(e){return s(e)}),p="cssFloat";if(r.canUseDOM&&void 0===document.documentElement.style.cssFloat&&(p="styleFloat"),"production"!==n.env.NODE_ENV)var m=/^(?:webkit|moz|o)[A-Z]/,d=/;\s*$/,h={},f={},g=function(e){h.hasOwnProperty(e)&&h[e]||(h[e]=!0,"production"!==n.env.NODE_ENV?c(!1,"Unsupported style property %s. Did you mean %s?",e,o(e)):null)},v=function(e){h.hasOwnProperty(e)&&h[e]||(h[e]=!0,"production"!==n.env.NODE_ENV?c(!1,"Unsupported vendor-prefixed style property %s. Did you mean %s?",e,e.charAt(0).toUpperCase()+e.slice(1)):null)},E=function(e,t){f.hasOwnProperty(t)&&f[t]||(f[t]=!0,"production"!==n.env.NODE_ENV?c(!1,'Style property values shouldn\'t contain a semicolon. Try "%s: %s" instead.',e,t.replace(d,"")):null)},y=function(e,t){e.indexOf("-")>-1?g(e):m.test(e)?v(e):d.test(t)&&E(e,t)};var b={createMarkupForStyles:function(e){var t="";for(var a in e)if(e.hasOwnProperty(a)){var r=e[a];"production"!==n.env.NODE_ENV&&y(a,r),null!=r&&(t+=u(a)+":",t+=i(a,r)+";")}return t||null},setValueForStyles:function(e,t){var r=e.style;for(var o in t)if(t.hasOwnProperty(o)){"production"!==n.env.NODE_ENV&&y(o,t[o]);var s=i(o,t[o]);if("float"===o&&(o=p),s)r[o]=s;else{var l=a.shorthandPropertyExpansions[o];if(l)for(var c in l)r[c]="";else r[o]=""}}}};t.exports=b}).call(this,e("g5I+bs"))},{"./CSSProperty":111,"./ExecutionEnvironment":128,"./camelizeStyleName":216,"./dangerousStyleValue":221,"./hyphenateStyleName":241,"./memoizeStringOnly":251,"./warning":262,"g5I+bs":70}],113:[function(e,t,n){(function(n){"use strict";function a(){this._callbacks=null,this._contexts=null}var r=e("./PooledClass"),o=e("./Object.assign"),i=e("./invariant");o(a.prototype,{enqueue:function(e,t){this._callbacks=this._callbacks||[],this._contexts=this._contexts||[],this._callbacks.push(e),this._contexts.push(t)},notifyAll:function(){var e=this._callbacks,t=this._contexts;if(e){"production"!==n.env.NODE_ENV?i(e.length===t.length,"Mismatched list of contexts in callback queue"):i(e.length===t.length),this._callbacks=null,this._contexts=null;for(var a=0,r=e.length;r>a;a++)e[a].call(t[a]);e.length=0,t.length=0}},reset:function(){this._callbacks=null,this._contexts=null},destructor:function(){this.reset()}}),r.addPoolingTo(a),t.exports=a}).call(this,e("g5I+bs"))},{"./Object.assign":134,"./PooledClass":135,"./invariant":243,"g5I+bs":70}],114:[function(e,t,n){"use strict";function a(e){return"SELECT"===e.nodeName||"INPUT"===e.nodeName&&"file"===e.type}function r(e){var t=w.getPooled(j.change,D,e);b.accumulateTwoPhaseDispatches(t),x.batchedUpdates(o,t)}function o(e){y.enqueueEvents(e),y.processEventQueue()}function i(e,t){S=e,D=t,S.attachEvent("onchange",r)}function s(){S&&(S.detachEvent("onchange",r),S=null,D=null)}function l(e,t,n){return e===I.topChange?n:void 0}function c(e,t,n){e===I.topFocus?(s(),i(t,n)):e===I.topBlur&&s()}function u(e,t){S=e,D=t,P=e.value,O=Object.getOwnPropertyDescriptor(e.constructor.prototype,"value"),Object.defineProperty(S,"value",T),S.attachEvent("onpropertychange",m)}function p(){S&&(delete S.value,S.detachEvent("onpropertychange",m),S=null,D=null,P=null,O=null)}function m(e){if("value"===e.propertyName){var t=e.srcElement.value;t!==P&&(P=t,r(e))}}function d(e,t,n){return e===I.topInput?n:void 0}function h(e,t,n){e===I.topFocus?(p(),u(t,n)):e===I.topBlur&&p()}function f(e,t,n){return e!==I.topSelectionChange&&e!==I.topKeyUp&&e!==I.topKeyDown||!S||S.value===P?void 0:(P=S.value,D)}function g(e){return"INPUT"===e.nodeName&&("checkbox"===e.type||"radio"===e.type)}function v(e,t,n){return e===I.topClick?n:void 0}var E=e("./EventConstants"),y=e("./EventPluginHub"),b=e("./EventPropagators"),N=e("./ExecutionEnvironment"),x=e("./ReactUpdates"),w=e("./SyntheticEvent"),C=e("./isEventSupported"),_=e("./isTextInputElement"),R=e("./keyOf"),I=E.topLevelTypes,j={change:{phasedRegistrationNames:{bubbled:R({onChange:null}),captured:R({onChangeCapture:null})},dependencies:[I.topBlur,I.topChange,I.topClick,I.topFocus,I.topInput,I.topKeyDown,I.topKeyUp,I.topSelectionChange]}},S=null,D=null,P=null,O=null,k=!1;N.canUseDOM&&(k=C("change")&&(!("documentMode"in document)||document.documentMode>8));var M=!1;N.canUseDOM&&(M=C("input")&&(!("documentMode"in document)||document.documentMode>9));var T={get:function(){return O.get.call(this)},set:function(e){P=""+e,O.set.call(this,e)}},U={eventTypes:j,extractEvents:function(e,t,n,r){var o,i;if(a(t)?k?o=l:i=c:_(t)?M?o=d:(o=f,i=h):g(t)&&(o=v),o){var s=o(e,t,n);if(s){var u=w.getPooled(j.change,s,r);return b.accumulateTwoPhaseDispatches(u),u}}i&&i(e,t,n)}};t.exports=U},{"./EventConstants":122,"./EventPluginHub":124,"./EventPropagators":127,"./ExecutionEnvironment":128,"./ReactUpdates":195,"./SyntheticEvent":203,"./isEventSupported":244,"./isTextInputElement":246,"./keyOf":249}],115:[function(e,t,n){"use strict";var a=0,r={createReactRootIndex:function(){return a++}};t.exports=r},{}],116:[function(e,t,n){(function(n){"use strict";function a(e,t,n){e.insertBefore(t,e.childNodes[n]||null)}var r=e("./Danger"),o=e("./ReactMultiChildUpdateTypes"),i=e("./setTextContent"),s=e("./invariant"),l={dangerouslyReplaceNodeWithMarkup:r.dangerouslyReplaceNodeWithMarkup,updateTextContent:i,processUpdates:function(e,t){for(var l,c=null,u=null,p=0;p<e.length;p++)if(l=e[p],l.type===o.MOVE_EXISTING||l.type===o.REMOVE_NODE){var m=l.fromIndex,d=l.parentNode.childNodes[m],h=l.parentID;"production"!==n.env.NODE_ENV?s(d,"processUpdates(): Unable to find child %s of element. This probably means the DOM was unexpectedly mutated (e.g., by the browser), usually due to forgetting a <tbody> when using tables, nesting tags like <form>, <p>, or <a>, or using non-SVG elements in an <svg> parent. Try inspecting the child nodes of the element with React ID `%s`.",m,h):s(d),c=c||{},c[h]=c[h]||[],c[h][m]=d,u=u||[],u.push(d)}var f=r.dangerouslyRenderMarkup(t);if(u)for(var g=0;g<u.length;g++)u[g].parentNode.removeChild(u[g]);for(var v=0;v<e.length;v++)switch(l=e[v],l.type){case o.INSERT_MARKUP:a(l.parentNode,f[l.markupIndex],l.toIndex);break;case o.MOVE_EXISTING:a(l.parentNode,c[l.parentID][l.fromIndex],l.toIndex);break;case o.TEXT_CONTENT:i(l.parentNode,l.textContent);break;case o.REMOVE_NODE:}}};t.exports=l}).call(this,e("g5I+bs"))},{"./Danger":119,"./ReactMultiChildUpdateTypes":180,"./invariant":243,"./setTextContent":257,"g5I+bs":70}],117:[function(e,t,n){(function(n){"use strict";function a(e,t){return(e&t)===t}var r=e("./invariant"),o={MUST_USE_ATTRIBUTE:1,MUST_USE_PROPERTY:2,HAS_SIDE_EFFECTS:4,HAS_BOOLEAN_VALUE:8,HAS_NUMERIC_VALUE:16,HAS_POSITIVE_NUMERIC_VALUE:48,HAS_OVERLOADED_BOOLEAN_VALUE:64,injectDOMPropertyConfig:function(e){var t=e.Properties||{},i=e.DOMAttributeNames||{},l=e.DOMPropertyNames||{},c=e.DOMMutationMethods||{};e.isCustomAttribute&&s._isCustomAttributeFunctions.push(e.isCustomAttribute);for(var u in t){"production"!==n.env.NODE_ENV?r(!s.isStandardName.hasOwnProperty(u),"injectDOMPropertyConfig(...): You're trying to inject DOM property '%s' which has already been injected. You may be accidentally injecting the same DOM property config twice, or you may be injecting two configs that have conflicting property names.",u):r(!s.isStandardName.hasOwnProperty(u)),s.isStandardName[u]=!0;var p=u.toLowerCase();if(s.getPossibleStandardName[p]=u,i.hasOwnProperty(u)){var m=i[u];s.getPossibleStandardName[m]=u,s.getAttributeName[u]=m}else s.getAttributeName[u]=p;s.getPropertyName[u]=l.hasOwnProperty(u)?l[u]:u,c.hasOwnProperty(u)?s.getMutationMethod[u]=c[u]:s.getMutationMethod[u]=null;var d=t[u];s.mustUseAttribute[u]=a(d,o.MUST_USE_ATTRIBUTE),s.mustUseProperty[u]=a(d,o.MUST_USE_PROPERTY),s.hasSideEffects[u]=a(d,o.HAS_SIDE_EFFECTS),s.hasBooleanValue[u]=a(d,o.HAS_BOOLEAN_VALUE),s.hasNumericValue[u]=a(d,o.HAS_NUMERIC_VALUE),s.hasPositiveNumericValue[u]=a(d,o.HAS_POSITIVE_NUMERIC_VALUE),s.hasOverloadedBooleanValue[u]=a(d,o.HAS_OVERLOADED_BOOLEAN_VALUE),"production"!==n.env.NODE_ENV?r(!s.mustUseAttribute[u]||!s.mustUseProperty[u],"DOMProperty: Cannot require using both attribute and property: %s",u):r(!s.mustUseAttribute[u]||!s.mustUseProperty[u]),"production"!==n.env.NODE_ENV?r(s.mustUseProperty[u]||!s.hasSideEffects[u],"DOMProperty: Properties that have side effects must use property: %s",u):r(s.mustUseProperty[u]||!s.hasSideEffects[u]),"production"!==n.env.NODE_ENV?r(!!s.hasBooleanValue[u]+!!s.hasNumericValue[u]+!!s.hasOverloadedBooleanValue[u]<=1,"DOMProperty: Value can be one of boolean, overloaded boolean, or numeric value, but not a combination: %s",u):r(!!s.hasBooleanValue[u]+!!s.hasNumericValue[u]+!!s.hasOverloadedBooleanValue[u]<=1)}}},i={},s={ID_ATTRIBUTE_NAME:"data-reactid",isStandardName:{},getPossibleStandardName:{},getAttributeName:{},getPropertyName:{},getMutationMethod:{},mustUseAttribute:{},mustUseProperty:{},hasSideEffects:{},hasBooleanValue:{},hasNumericValue:{},hasPositiveNumericValue:{},hasOverloadedBooleanValue:{},_isCustomAttributeFunctions:[],isCustomAttribute:function(e){for(var t=0;t<s._isCustomAttributeFunctions.length;t++){var n=s._isCustomAttributeFunctions[t];if(n(e))return!0}return!1},getDefaultValueForProperty:function(e,t){var n,a=i[e];return a||(i[e]=a={}),t in a||(n=document.createElement(e),a[t]=n[t]),a[t]},injection:o};t.exports=s}).call(this,e("g5I+bs"))},{"./invariant":243,"g5I+bs":70}],118:[function(e,t,n){(function(n){"use strict";function a(e,t){return null==t||r.hasBooleanValue[e]&&!t||r.hasNumericValue[e]&&isNaN(t)||r.hasPositiveNumericValue[e]&&1>t||r.hasOverloadedBooleanValue[e]&&t===!1}var r=e("./DOMProperty"),o=e("./quoteAttributeValueForBrowser"),i=e("./warning");if("production"!==n.env.NODE_ENV)var s={children:!0,dangerouslySetInnerHTML:!0,key:!0,ref:!0},l={},c=function(e){if(!(s.hasOwnProperty(e)&&s[e]||l.hasOwnProperty(e)&&l[e])){l[e]=!0;var t=e.toLowerCase(),a=r.isCustomAttribute(t)?t:r.getPossibleStandardName.hasOwnProperty(t)?r.getPossibleStandardName[t]:null;"production"!==n.env.NODE_ENV?i(null==a,"Unknown DOM property %s. Did you mean %s?",e,a):null}};var u={createMarkupForID:function(e){return r.ID_ATTRIBUTE_NAME+"="+o(e)},createMarkupForProperty:function(e,t){if(r.isStandardName.hasOwnProperty(e)&&r.isStandardName[e]){if(a(e,t))return"";var i=r.getAttributeName[e];return r.hasBooleanValue[e]||r.hasOverloadedBooleanValue[e]&&t===!0?i:i+"="+o(t)}return r.isCustomAttribute(e)?null==t?"":e+"="+o(t):("production"!==n.env.NODE_ENV&&c(e),null)},setValueForProperty:function(e,t,o){if(r.isStandardName.hasOwnProperty(t)&&r.isStandardName[t]){var i=r.getMutationMethod[t];if(i)i(e,o);else if(a(t,o))this.deleteValueForProperty(e,t);else if(r.mustUseAttribute[t])e.setAttribute(r.getAttributeName[t],""+o);else{var s=r.getPropertyName[t];r.hasSideEffects[t]&&""+e[s]==""+o||(e[s]=o)}}else r.isCustomAttribute(t)?null==o?e.removeAttribute(t):e.setAttribute(t,""+o):"production"!==n.env.NODE_ENV&&c(t)},deleteValueForProperty:function(e,t){if(r.isStandardName.hasOwnProperty(t)&&r.isStandardName[t]){var a=r.getMutationMethod[t];if(a)a(e,void 0);else if(r.mustUseAttribute[t])e.removeAttribute(r.getAttributeName[t]);else{var o=r.getPropertyName[t],i=r.getDefaultValueForProperty(e.nodeName,o);r.hasSideEffects[t]&&""+e[o]===i||(e[o]=i)}}else r.isCustomAttribute(t)?e.removeAttribute(t):"production"!==n.env.NODE_ENV&&c(t)}};t.exports=u}).call(this,e("g5I+bs"))},{"./DOMProperty":117,"./quoteAttributeValueForBrowser":255,"./warning":262,"g5I+bs":70}],119:[function(e,t,n){(function(n){"use strict";function a(e){return e.substring(1,e.indexOf(" "))}var r=e("./ExecutionEnvironment"),o=e("./createNodesFromMarkup"),i=e("./emptyFunction"),s=e("./getMarkupWrap"),l=e("./invariant"),c=/^(<[^ \/>]+)/,u="data-danger-index",p={dangerouslyRenderMarkup:function(e){"production"!==n.env.NODE_ENV?l(r.canUseDOM,"dangerouslyRenderMarkup(...): Cannot render markup in a worker thread. Make sure `window` and `document` are available globally before requiring React when unit testing or use React.renderToString for server rendering."):l(r.canUseDOM);for(var t,p={},m=0;m<e.length;m++)"production"!==n.env.NODE_ENV?l(e[m],"dangerouslyRenderMarkup(...): Missing markup."):l(e[m]),t=a(e[m]),t=s(t)?t:"*",p[t]=p[t]||[],p[t][m]=e[m];var d=[],h=0;for(t in p)if(p.hasOwnProperty(t)){var f,g=p[t];for(f in g)if(g.hasOwnProperty(f)){var v=g[f];g[f]=v.replace(c,"$1 "+u+'="'+f+'" ')}for(var E=o(g.join(""),i),y=0;y<E.length;++y){var b=E[y];b.hasAttribute&&b.hasAttribute(u)?(f=+b.getAttribute(u),b.removeAttribute(u),"production"!==n.env.NODE_ENV?l(!d.hasOwnProperty(f),"Danger: Assigning to an already-occupied result index."):l(!d.hasOwnProperty(f)),d[f]=b,h+=1):"production"!==n.env.NODE_ENV&&console.error("Danger: Discarding unexpected node:",b)}}return"production"!==n.env.NODE_ENV?l(h===d.length,"Danger: Did not assign to every index of resultList."):l(h===d.length),"production"!==n.env.NODE_ENV?l(d.length===e.length,"Danger: Expected markup to render %s nodes, but rendered %s.",e.length,d.length):l(d.length===e.length),d},dangerouslyReplaceNodeWithMarkup:function(e,t){"production"!==n.env.NODE_ENV?l(r.canUseDOM,"dangerouslyReplaceNodeWithMarkup(...): Cannot render markup in a worker thread. Make sure `window` and `document` are available globally before requiring React when unit testing or use React.renderToString for server rendering."):l(r.canUseDOM),"production"!==n.env.NODE_ENV?l(t,"dangerouslyReplaceNodeWithMarkup(...): Missing markup."):l(t),"production"!==n.env.NODE_ENV?l("html"!==e.tagName.toLowerCase(),"dangerouslyReplaceNodeWithMarkup(...): Cannot replace markup of the <html> node. This is because browser quirks make this unreliable and/or slow. If you want to render to the root you must use server rendering. See React.renderToString()."):l("html"!==e.tagName.toLowerCase());var a=o(t,i)[0];e.parentNode.replaceChild(a,e)}};t.exports=p}).call(this,e("g5I+bs"))},{"./ExecutionEnvironment":128,"./createNodesFromMarkup":220,"./emptyFunction":222,"./getMarkupWrap":235,"./invariant":243,"g5I+bs":70}],120:[function(e,t,n){"use strict";var a=e("./keyOf"),r=[a({ResponderEventPlugin:null}),a({SimpleEventPlugin:null}),a({TapEventPlugin:null}),a({EnterLeaveEventPlugin:null}),a({ChangeEventPlugin:null}),a({SelectEventPlugin:null}),a({BeforeInputEventPlugin:null}),a({AnalyticsEventPlugin:null}),a({MobileSafariClickEventPlugin:null})];t.exports=r},{"./keyOf":249}],121:[function(e,t,n){"use strict";var a=e("./EventConstants"),r=e("./EventPropagators"),o=e("./SyntheticMouseEvent"),i=e("./ReactMount"),s=e("./keyOf"),l=a.topLevelTypes,c=i.getFirstReactDOM,u={mouseEnter:{registrationName:s({onMouseEnter:null}),dependencies:[l.topMouseOut,l.topMouseOver]},mouseLeave:{registrationName:s({onMouseLeave:null}),dependencies:[l.topMouseOut,l.topMouseOver]}},p=[null,null],m={eventTypes:u,extractEvents:function(e,t,n,a){if(e===l.topMouseOver&&(a.relatedTarget||a.fromElement))return null;if(e!==l.topMouseOut&&e!==l.topMouseOver)return null;var s;if(t.window===t)s=t;else{var m=t.ownerDocument;s=m?m.defaultView||m.parentWindow:window}var d,h;if(e===l.topMouseOut?(d=t,h=c(a.relatedTarget||a.toElement)||s):(d=s,h=t),d===h)return null;var f=d?i.getID(d):"",g=h?i.getID(h):"",v=o.getPooled(u.mouseLeave,f,a);v.type="mouseleave",v.target=d,v.relatedTarget=h;var E=o.getPooled(u.mouseEnter,g,a);return E.type="mouseenter",E.target=h,E.relatedTarget=d,r.accumulateEnterLeaveDispatches(v,E,f,g),p[0]=v,p[1]=E,p}};t.exports=m},{"./EventConstants":122,"./EventPropagators":127,"./ReactMount":178,"./SyntheticMouseEvent":207,"./keyOf":249}],122:[function(e,t,n){"use strict";var a=e("./keyMirror"),r=a({bubbled:null,captured:null}),o=a({topBlur:null,topChange:null,topClick:null,topCompositionEnd:null,topCompositionStart:null,topCompositionUpdate:null,topContextMenu:null,topCopy:null,topCut:null,topDoubleClick:null,topDrag:null,topDragEnd:null,topDragEnter:null,topDragExit:null,topDragLeave:null,topDragOver:null,topDragStart:null,topDrop:null,topError:null,topFocus:null,topInput:null,topKeyDown:null,topKeyPress:null,topKeyUp:null,topLoad:null,topMouseDown:null,topMouseMove:null,topMouseOut:null,topMouseOver:null,topMouseUp:null,topPaste:null,topReset:null,topScroll:null,topSelectionChange:null,topSubmit:null,topTextInput:null,topTouchCancel:null,topTouchEnd:null,topTouchMove:null,topTouchStart:null,topWheel:null}),i={topLevelTypes:o,PropagationPhases:r};t.exports=i},{"./keyMirror":248}],123:[function(e,t,n){(function(n){var a=e("./emptyFunction"),r={listen:function(e,t,n){return e.addEventListener?(e.addEventListener(t,n,!1),{remove:function(){e.removeEventListener(t,n,!1)}}):e.attachEvent?(e.attachEvent("on"+t,n),{remove:function(){e.detachEvent("on"+t,n)}}):void 0},capture:function(e,t,r){return e.addEventListener?(e.addEventListener(t,r,!0),{remove:function(){e.removeEventListener(t,r,!0)}}):("production"!==n.env.NODE_ENV&&console.error("Attempted to listen to events during the capture phase on a browser that does not support the capture phase. Your application will not receive some events."),{remove:a})},registerDefault:function(){}};t.exports=r}).call(this,e("g5I+bs"))},{"./emptyFunction":222,"g5I+bs":70}],124:[function(e,t,n){(function(n){"use strict";function a(){var e=m&&m.traverseTwoPhase&&m.traverseEnterLeave;"production"!==n.env.NODE_ENV?l(e,"InstanceHandle not injected before use!"):l(e)}var r=e("./EventPluginRegistry"),o=e("./EventPluginUtils"),i=e("./accumulateInto"),s=e("./forEachAccumulated"),l=e("./invariant"),c={},u=null,p=function(e){if(e){var t=o.executeDispatch,n=r.getPluginModuleForEvent(e);n&&n.executeDispatch&&(t=n.executeDispatch),o.executeDispatchesInOrder(e,t),e.isPersistent()||e.constructor.release(e)}},m=null,d={injection:{injectMount:o.injection.injectMount,injectInstanceHandle:function(e){m=e,"production"!==n.env.NODE_ENV&&a()},getInstanceHandle:function(){return"production"!==n.env.NODE_ENV&&a(),m},injectEventPluginOrder:r.injectEventPluginOrder,injectEventPluginsByName:r.injectEventPluginsByName},eventNameDispatchConfigs:r.eventNameDispatchConfigs,registrationNameModules:r.registrationNameModules,putListener:function(e,t,a){"production"!==n.env.NODE_ENV?l(!a||"function"==typeof a,"Expected %s listener to be a function, instead got type %s",t,typeof a):l(!a||"function"==typeof a);var r=c[t]||(c[t]={});r[e]=a},getListener:function(e,t){var n=c[t];return n&&n[e]},deleteListener:function(e,t){var n=c[t];n&&delete n[e]},deleteAllListeners:function(e){for(var t in c)delete c[t][e]},extractEvents:function(e,t,n,a){for(var o,s=r.plugins,l=0,c=s.length;c>l;l++){var u=s[l];if(u){var p=u.extractEvents(e,t,n,a);p&&(o=i(o,p))}}return o},enqueueEvents:function(e){e&&(u=i(u,e))},processEventQueue:function(){var e=u;u=null,s(e,p),"production"!==n.env.NODE_ENV?l(!u,"processEventQueue(): Additional events were enqueued while processing an event queue. Support for this has not yet been implemented."):l(!u)},__purge:function(){c={}},__getListenerBank:function(){return c}};t.exports=d}).call(this,e("g5I+bs"))},{"./EventPluginRegistry":125,"./EventPluginUtils":126,"./accumulateInto":213,"./forEachAccumulated":228,"./invariant":243,"g5I+bs":70}],125:[function(e,t,n){(function(n){"use strict";function a(){if(s)for(var e in l){var t=l[e],a=s.indexOf(e);if("production"!==n.env.NODE_ENV?i(a>-1,"EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `%s`.",e):i(a>-1),!c.plugins[a]){"production"!==n.env.NODE_ENV?i(t.extractEvents,"EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `%s` does not.",e):i(t.extractEvents),c.plugins[a]=t;var o=t.eventTypes;for(var u in o)"production"!==n.env.NODE_ENV?i(r(o[u],t,u),"EventPluginRegistry: Failed to publish event `%s` for plugin `%s`.",u,e):i(r(o[u],t,u))}}}function r(e,t,a){"production"!==n.env.NODE_ENV?i(!c.eventNameDispatchConfigs.hasOwnProperty(a),"EventPluginHub: More than one plugin attempted to publish the same event name, `%s`.",a):i(!c.eventNameDispatchConfigs.hasOwnProperty(a)),c.eventNameDispatchConfigs[a]=e;var r=e.phasedRegistrationNames;if(r){for(var s in r)if(r.hasOwnProperty(s)){var l=r[s];o(l,t,a)}return!0}return e.registrationName?(o(e.registrationName,t,a),!0):!1}function o(e,t,a){"production"!==n.env.NODE_ENV?i(!c.registrationNameModules[e],"EventPluginHub: More than one plugin attempted to publish the same registration name, `%s`.",e):i(!c.registrationNameModules[e]),c.registrationNameModules[e]=t,c.registrationNameDependencies[e]=t.eventTypes[a].dependencies}var i=e("./invariant"),s=null,l={},c={plugins:[],eventNameDispatchConfigs:{},registrationNameModules:{},registrationNameDependencies:{},injectEventPluginOrder:function(e){"production"!==n.env.NODE_ENV?i(!s,"EventPluginRegistry: Cannot inject event plugin ordering more than once. You are likely trying to load more than one copy of React."):i(!s),s=Array.prototype.slice.call(e),a()},injectEventPluginsByName:function(e){var t=!1;for(var r in e)if(e.hasOwnProperty(r)){var o=e[r];l.hasOwnProperty(r)&&l[r]===o||("production"!==n.env.NODE_ENV?i(!l[r],"EventPluginRegistry: Cannot inject two different event plugins using the same name, `%s`.",r):i(!l[r]),l[r]=o,t=!0)}t&&a()},getPluginModuleForEvent:function(e){var t=e.dispatchConfig;if(t.registrationName)return c.registrationNameModules[t.registrationName]||null;for(var n in t.phasedRegistrationNames)if(t.phasedRegistrationNames.hasOwnProperty(n)){var a=c.registrationNameModules[t.phasedRegistrationNames[n]];if(a)return a}return null},_resetEventPlugins:function(){s=null;for(var e in l)l.hasOwnProperty(e)&&delete l[e];c.plugins.length=0;var t=c.eventNameDispatchConfigs;for(var n in t)t.hasOwnProperty(n)&&delete t[n];var a=c.registrationNameModules;for(var r in a)a.hasOwnProperty(r)&&delete a[r]}};t.exports=c}).call(this,e("g5I+bs"))},{"./invariant":243,"g5I+bs":70}],126:[function(e,t,n){(function(n){"use strict";function a(e){return e===v.topMouseUp||e===v.topTouchEnd||e===v.topTouchCancel}function r(e){return e===v.topMouseMove||e===v.topTouchMove}function o(e){return e===v.topMouseDown||e===v.topTouchStart}function i(e,t){var a=e._dispatchListeners,r=e._dispatchIDs;if("production"!==n.env.NODE_ENV&&d(e),Array.isArray(a))for(var o=0;o<a.length&&!e.isPropagationStopped();o++)t(e,a[o],r[o]);else a&&t(e,a,r)}function s(e,t,n){e.currentTarget=g.Mount.getNode(n);var a=t(e,n);return e.currentTarget=null,a}function l(e,t){i(e,t),e._dispatchListeners=null,e._dispatchIDs=null}function c(e){var t=e._dispatchListeners,a=e._dispatchIDs;if("production"!==n.env.NODE_ENV&&d(e),Array.isArray(t)){for(var r=0;r<t.length&&!e.isPropagationStopped();r++)if(t[r](e,a[r]))return a[r]}else if(t&&t(e,a))return a;return null}function u(e){var t=c(e);return e._dispatchIDs=null,e._dispatchListeners=null,t}function p(e){"production"!==n.env.NODE_ENV&&d(e);var t=e._dispatchListeners,a=e._dispatchIDs;"production"!==n.env.NODE_ENV?f(!Array.isArray(t),"executeDirectDispatch(...): Invalid `event`."):f(!Array.isArray(t));var r=t?t(e,a):null;return e._dispatchListeners=null,e._dispatchIDs=null,r}function m(e){return!!e._dispatchListeners}var d,h=e("./EventConstants"),f=e("./invariant"),g={Mount:null,injectMount:function(e){g.Mount=e,"production"!==n.env.NODE_ENV&&("production"!==n.env.NODE_ENV?f(e&&e.getNode,"EventPluginUtils.injection.injectMount(...): Injected Mount module is missing getNode."):f(e&&e.getNode))}},v=h.topLevelTypes;"production"!==n.env.NODE_ENV&&(d=function(e){var t=e._dispatchListeners,a=e._dispatchIDs,r=Array.isArray(t),o=Array.isArray(a),i=o?a.length:a?1:0,s=r?t.length:t?1:0;"production"!==n.env.NODE_ENV?f(o===r&&i===s,"EventPluginUtils: Invalid `event`."):f(o===r&&i===s)});var E={isEndish:a,isMoveish:r,isStartish:o,executeDirectDispatch:p,executeDispatch:s,executeDispatchesInOrder:l,executeDispatchesInOrderStopAtTrue:u,hasDispatches:m,injection:g,useTouchEvents:!1};t.exports=E}).call(this,e("g5I+bs"))},{"./EventConstants":122,"./invariant":243,"g5I+bs":70}],127:[function(e,t,n){(function(n){"use strict";function a(e,t,n){var a=t.dispatchConfig.phasedRegistrationNames[n];return g(e,a)}function r(e,t,r){if("production"!==n.env.NODE_ENV&&!e)throw new Error("Dispatching id must not be null");var o=t?f.bubbled:f.captured,i=a(e,r,o);i&&(r._dispatchListeners=d(r._dispatchListeners,i),r._dispatchIDs=d(r._dispatchIDs,e))}function o(e){e&&e.dispatchConfig.phasedRegistrationNames&&m.injection.getInstanceHandle().traverseTwoPhase(e.dispatchMarker,r,e)}function i(e,t,n){if(n&&n.dispatchConfig.registrationName){var a=n.dispatchConfig.registrationName,r=g(e,a);r&&(n._dispatchListeners=d(n._dispatchListeners,r),n._dispatchIDs=d(n._dispatchIDs,e))}}function s(e){e&&e.dispatchConfig.registrationName&&i(e.dispatchMarker,null,e)}function l(e){h(e,o)}function c(e,t,n,a){m.injection.getInstanceHandle().traverseEnterLeave(n,a,i,e,t);
}function u(e){h(e,s)}var p=e("./EventConstants"),m=e("./EventPluginHub"),d=e("./accumulateInto"),h=e("./forEachAccumulated"),f=p.PropagationPhases,g=m.getListener,v={accumulateTwoPhaseDispatches:l,accumulateDirectDispatches:u,accumulateEnterLeaveDispatches:c};t.exports=v}).call(this,e("g5I+bs"))},{"./EventConstants":122,"./EventPluginHub":124,"./accumulateInto":213,"./forEachAccumulated":228,"g5I+bs":70}],128:[function(e,t,n){"use strict";var a=!("undefined"==typeof window||!window.document||!window.document.createElement),r={canUseDOM:a,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:a&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:a&&!!window.screen,isInWorker:!a};t.exports=r},{}],129:[function(e,t,n){"use strict";function a(e){this._root=e,this._startText=this.getText(),this._fallbackText=null}var r=e("./PooledClass"),o=e("./Object.assign"),i=e("./getTextContentAccessor");o(a.prototype,{getText:function(){return"value"in this._root?this._root.value:this._root[i()]},getData:function(){if(this._fallbackText)return this._fallbackText;var e,t,n=this._startText,a=n.length,r=this.getText(),o=r.length;for(e=0;a>e&&n[e]===r[e];e++);var i=a-e;for(t=1;i>=t&&n[a-t]===r[o-t];t++);var s=t>1?1-t:void 0;return this._fallbackText=r.slice(e,s),this._fallbackText}}),r.addPoolingTo(a),t.exports=a},{"./Object.assign":134,"./PooledClass":135,"./getTextContentAccessor":238}],130:[function(e,t,n){"use strict";var a,r=e("./DOMProperty"),o=e("./ExecutionEnvironment"),i=r.injection.MUST_USE_ATTRIBUTE,s=r.injection.MUST_USE_PROPERTY,l=r.injection.HAS_BOOLEAN_VALUE,c=r.injection.HAS_SIDE_EFFECTS,u=r.injection.HAS_NUMERIC_VALUE,p=r.injection.HAS_POSITIVE_NUMERIC_VALUE,m=r.injection.HAS_OVERLOADED_BOOLEAN_VALUE;if(o.canUseDOM){var d=document.implementation;a=d&&d.hasFeature&&d.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")}var h={isCustomAttribute:RegExp.prototype.test.bind(/^(data|aria)-[a-z_][a-z\d_.\-]*$/),Properties:{accept:null,acceptCharset:null,accessKey:null,action:null,allowFullScreen:i|l,allowTransparency:i,alt:null,async:l,autoComplete:null,autoPlay:l,cellPadding:null,cellSpacing:null,charSet:i,checked:s|l,classID:i,className:a?i:s,cols:i|p,colSpan:null,content:null,contentEditable:null,contextMenu:i,controls:s|l,coords:null,crossOrigin:null,data:null,dateTime:i,defer:l,dir:null,disabled:i|l,download:m,draggable:null,encType:null,form:i,formAction:i,formEncType:i,formMethod:i,formNoValidate:l,formTarget:i,frameBorder:i,headers:null,height:i,hidden:i|l,high:null,href:null,hrefLang:null,htmlFor:null,httpEquiv:null,icon:null,id:s,label:null,lang:null,list:i,loop:s|l,low:null,manifest:i,marginHeight:null,marginWidth:null,max:null,maxLength:i,media:i,mediaGroup:null,method:null,min:null,multiple:s|l,muted:s|l,name:null,noValidate:l,open:l,optimum:null,pattern:null,placeholder:null,poster:null,preload:null,radioGroup:null,readOnly:s|l,rel:null,required:l,role:i,rows:i|p,rowSpan:null,sandbox:null,scope:null,scoped:l,scrolling:null,seamless:i|l,selected:s|l,shape:null,size:i|p,sizes:i,span:p,spellCheck:null,src:null,srcDoc:s,srcSet:i,start:u,step:null,style:null,tabIndex:null,target:null,title:null,type:null,useMap:null,value:s|c,width:i,wmode:i,autoCapitalize:null,autoCorrect:null,itemProp:i,itemScope:i|l,itemType:i,itemID:i,itemRef:i,property:null,unselectable:i},DOMAttributeNames:{acceptCharset:"accept-charset",className:"class",htmlFor:"for",httpEquiv:"http-equiv"},DOMPropertyNames:{autoCapitalize:"autocapitalize",autoComplete:"autocomplete",autoCorrect:"autocorrect",autoFocus:"autofocus",autoPlay:"autoplay",encType:"encoding",hrefLang:"hreflang",radioGroup:"radiogroup",spellCheck:"spellcheck",srcDoc:"srcdoc",srcSet:"srcset"}};t.exports=h},{"./DOMProperty":117,"./ExecutionEnvironment":128}],131:[function(e,t,n){(function(n){"use strict";function a(e){"production"!==n.env.NODE_ENV?c(null==e.props.checkedLink||null==e.props.valueLink,"Cannot provide a checkedLink and a valueLink. If you want to use checkedLink, you probably don't want to use valueLink and vice versa."):c(null==e.props.checkedLink||null==e.props.valueLink)}function r(e){a(e),"production"!==n.env.NODE_ENV?c(null==e.props.value&&null==e.props.onChange,"Cannot provide a valueLink and a value or onChange event. If you want to use value or onChange, you probably don't want to use valueLink."):c(null==e.props.value&&null==e.props.onChange)}function o(e){a(e),"production"!==n.env.NODE_ENV?c(null==e.props.checked&&null==e.props.onChange,"Cannot provide a checkedLink and a checked property or onChange event. If you want to use checked or onChange, you probably don't want to use checkedLink"):c(null==e.props.checked&&null==e.props.onChange)}function i(e){this.props.valueLink.requestChange(e.target.value)}function s(e){this.props.checkedLink.requestChange(e.target.checked)}var l=e("./ReactPropTypes"),c=e("./invariant"),u={button:!0,checkbox:!0,image:!0,hidden:!0,radio:!0,reset:!0,submit:!0},p={Mixin:{propTypes:{value:function(e,t,n){return!e[t]||u[e.type]||e.onChange||e.readOnly||e.disabled?null:new Error("You provided a `value` prop to a form field without an `onChange` handler. This will render a read-only field. If the field should be mutable use `defaultValue`. Otherwise, set either `onChange` or `readOnly`.")},checked:function(e,t,n){return!e[t]||e.onChange||e.readOnly||e.disabled?null:new Error("You provided a `checked` prop to a form field without an `onChange` handler. This will render a read-only field. If the field should be mutable use `defaultChecked`. Otherwise, set either `onChange` or `readOnly`.")},onChange:l.func}},getValue:function(e){return e.props.valueLink?(r(e),e.props.valueLink.value):e.props.value},getChecked:function(e){return e.props.checkedLink?(o(e),e.props.checkedLink.value):e.props.checked},getOnChange:function(e){return e.props.valueLink?(r(e),i):e.props.checkedLink?(o(e),s):e.props.onChange}};t.exports=p}).call(this,e("g5I+bs"))},{"./ReactPropTypes":186,"./invariant":243,"g5I+bs":70}],132:[function(e,t,n){(function(n){"use strict";function a(e){e.remove()}var r=e("./ReactBrowserEventEmitter"),o=e("./accumulateInto"),i=e("./forEachAccumulated"),s=e("./invariant"),l={trapBubbledEvent:function(e,t){"production"!==n.env.NODE_ENV?s(this.isMounted(),"Must be mounted to trap events"):s(this.isMounted());var a=this.getDOMNode();"production"!==n.env.NODE_ENV?s(a,"LocalEventTrapMixin.trapBubbledEvent(...): Requires node to be rendered."):s(a);var i=r.trapBubbledEvent(e,t,a);this._localEventListeners=o(this._localEventListeners,i)},componentWillUnmount:function(){this._localEventListeners&&i(this._localEventListeners,a)}};t.exports=l}).call(this,e("g5I+bs"))},{"./ReactBrowserEventEmitter":138,"./accumulateInto":213,"./forEachAccumulated":228,"./invariant":243,"g5I+bs":70}],133:[function(e,t,n){"use strict";var a=e("./EventConstants"),r=e("./emptyFunction"),o=a.topLevelTypes,i={eventTypes:null,extractEvents:function(e,t,n,a){if(e===o.topTouchStart){var i=a.target;i&&!i.onclick&&(i.onclick=r)}}};t.exports=i},{"./EventConstants":122,"./emptyFunction":222}],134:[function(e,t,n){"use strict";function a(e,t){if(null==e)throw new TypeError("Object.assign target cannot be null or undefined");for(var n=Object(e),a=Object.prototype.hasOwnProperty,r=1;r<arguments.length;r++){var o=arguments[r];if(null!=o){var i=Object(o);for(var s in i)a.call(i,s)&&(n[s]=i[s])}}return n}t.exports=a},{}],135:[function(e,t,n){(function(n){"use strict";var a=e("./invariant"),r=function(e){var t=this;if(t.instancePool.length){var n=t.instancePool.pop();return t.call(n,e),n}return new t(e)},o=function(e,t){var n=this;if(n.instancePool.length){var a=n.instancePool.pop();return n.call(a,e,t),a}return new n(e,t)},i=function(e,t,n){var a=this;if(a.instancePool.length){var r=a.instancePool.pop();return a.call(r,e,t,n),r}return new a(e,t,n)},s=function(e,t,n,a,r){var o=this;if(o.instancePool.length){var i=o.instancePool.pop();return o.call(i,e,t,n,a,r),i}return new o(e,t,n,a,r)},l=function(e){var t=this;"production"!==n.env.NODE_ENV?a(e instanceof t,"Trying to release an instance into a pool of a different type."):a(e instanceof t),e.destructor&&e.destructor(),t.instancePool.length<t.poolSize&&t.instancePool.push(e)},c=10,u=r,p=function(e,t){var n=e;return n.instancePool=[],n.getPooled=t||u,n.poolSize||(n.poolSize=c),n.release=l,n},m={addPoolingTo:p,oneArgumentPooler:r,twoArgumentPooler:o,threeArgumentPooler:i,fiveArgumentPooler:s};t.exports=m}).call(this,e("g5I+bs"))},{"./invariant":243,"g5I+bs":70}],136:[function(e,t,n){(function(n){"use strict";var a=e("./EventPluginUtils"),r=e("./ReactChildren"),o=e("./ReactComponent"),i=e("./ReactClass"),s=e("./ReactContext"),l=e("./ReactCurrentOwner"),c=e("./ReactElement"),u=e("./ReactElementValidator"),p=e("./ReactDOM"),m=e("./ReactDOMTextComponent"),d=e("./ReactDefaultInjection"),h=e("./ReactInstanceHandles"),f=e("./ReactMount"),g=e("./ReactPerf"),v=e("./ReactPropTypes"),E=e("./ReactReconciler"),y=e("./ReactServerRendering"),b=e("./Object.assign"),N=e("./findDOMNode"),x=e("./onlyChild");d.inject();var w=c.createElement,C=c.createFactory,_=c.cloneElement;"production"!==n.env.NODE_ENV&&(w=u.createElement,C=u.createFactory,_=u.cloneElement);var R=g.measure("React","render",f.render),I={Children:{map:r.map,forEach:r.forEach,count:r.count,only:x},Component:o,DOM:p,PropTypes:v,initializeTouchEvents:function(e){a.useTouchEvents=e},createClass:i.createClass,createElement:w,cloneElement:_,createFactory:C,createMixin:function(e){return e},constructAndRenderComponent:f.constructAndRenderComponent,constructAndRenderComponentByID:f.constructAndRenderComponentByID,findDOMNode:N,render:R,renderToString:y.renderToString,renderToStaticMarkup:y.renderToStaticMarkup,unmountComponentAtNode:f.unmountComponentAtNode,isValidElement:c.isValidElement,withContext:s.withContext,__spread:b};if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject&&__REACT_DEVTOOLS_GLOBAL_HOOK__.inject({CurrentOwner:l,InstanceHandles:h,Mount:f,Reconciler:E,TextComponent:m}),"production"!==n.env.NODE_ENV){var j=e("./ExecutionEnvironment");if(j.canUseDOM&&window.top===window.self){navigator.userAgent.indexOf("Chrome")>-1&&"undefined"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&console.debug("Download the React DevTools for a better development experience: https://fb.me/react-devtools");for(var S=[Array.isArray,Array.prototype.every,Array.prototype.forEach,Array.prototype.indexOf,Array.prototype.map,Date.now,Function.prototype.bind,Object.keys,String.prototype.split,String.prototype.trim,Object.create,Object.freeze],D=0;D<S.length;D++)if(!S[D]){console.error("One or more ES5 shim/shams expected by React are not available: https://fb.me/react-warning-polyfills");break}}}I.version="0.13.3",t.exports=I}).call(this,e("g5I+bs"))},{"./EventPluginUtils":126,"./ExecutionEnvironment":128,"./Object.assign":134,"./ReactChildren":140,"./ReactClass":141,"./ReactComponent":142,"./ReactContext":146,"./ReactCurrentOwner":147,"./ReactDOM":148,"./ReactDOMTextComponent":159,"./ReactDefaultInjection":162,"./ReactElement":165,"./ReactElementValidator":166,"./ReactInstanceHandles":174,"./ReactMount":178,"./ReactPerf":183,"./ReactPropTypes":186,"./ReactReconciler":189,"./ReactServerRendering":192,"./findDOMNode":225,"./onlyChild":252,"g5I+bs":70}],137:[function(e,t,n){"use strict";var a=e("./findDOMNode"),r={getDOMNode:function(){return a(this)}};t.exports=r},{"./findDOMNode":225}],138:[function(e,t,n){"use strict";function a(e){return Object.prototype.hasOwnProperty.call(e,f)||(e[f]=d++,p[e[f]]={}),p[e[f]]}var r=e("./EventConstants"),o=e("./EventPluginHub"),i=e("./EventPluginRegistry"),s=e("./ReactEventEmitterMixin"),l=e("./ViewportMetrics"),c=e("./Object.assign"),u=e("./isEventSupported"),p={},m=!1,d=0,h={topBlur:"blur",topChange:"change",topClick:"click",topCompositionEnd:"compositionend",topCompositionStart:"compositionstart",topCompositionUpdate:"compositionupdate",topContextMenu:"contextmenu",topCopy:"copy",topCut:"cut",topDoubleClick:"dblclick",topDrag:"drag",topDragEnd:"dragend",topDragEnter:"dragenter",topDragExit:"dragexit",topDragLeave:"dragleave",topDragOver:"dragover",topDragStart:"dragstart",topDrop:"drop",topFocus:"focus",topInput:"input",topKeyDown:"keydown",topKeyPress:"keypress",topKeyUp:"keyup",topMouseDown:"mousedown",topMouseMove:"mousemove",topMouseOut:"mouseout",topMouseOver:"mouseover",topMouseUp:"mouseup",topPaste:"paste",topScroll:"scroll",topSelectionChange:"selectionchange",topTextInput:"textInput",topTouchCancel:"touchcancel",topTouchEnd:"touchend",topTouchMove:"touchmove",topTouchStart:"touchstart",topWheel:"wheel"},f="_reactListenersID"+String(Math.random()).slice(2),g=c({},s,{ReactEventListener:null,injection:{injectReactEventListener:function(e){e.setHandleTopLevel(g.handleTopLevel),g.ReactEventListener=e}},setEnabled:function(e){g.ReactEventListener&&g.ReactEventListener.setEnabled(e)},isEnabled:function(){return!(!g.ReactEventListener||!g.ReactEventListener.isEnabled())},listenTo:function(e,t){for(var n=t,o=a(n),s=i.registrationNameDependencies[e],l=r.topLevelTypes,c=0,p=s.length;p>c;c++){var m=s[c];o.hasOwnProperty(m)&&o[m]||(m===l.topWheel?u("wheel")?g.ReactEventListener.trapBubbledEvent(l.topWheel,"wheel",n):u("mousewheel")?g.ReactEventListener.trapBubbledEvent(l.topWheel,"mousewheel",n):g.ReactEventListener.trapBubbledEvent(l.topWheel,"DOMMouseScroll",n):m===l.topScroll?u("scroll",!0)?g.ReactEventListener.trapCapturedEvent(l.topScroll,"scroll",n):g.ReactEventListener.trapBubbledEvent(l.topScroll,"scroll",g.ReactEventListener.WINDOW_HANDLE):m===l.topFocus||m===l.topBlur?(u("focus",!0)?(g.ReactEventListener.trapCapturedEvent(l.topFocus,"focus",n),g.ReactEventListener.trapCapturedEvent(l.topBlur,"blur",n)):u("focusin")&&(g.ReactEventListener.trapBubbledEvent(l.topFocus,"focusin",n),g.ReactEventListener.trapBubbledEvent(l.topBlur,"focusout",n)),o[l.topBlur]=!0,o[l.topFocus]=!0):h.hasOwnProperty(m)&&g.ReactEventListener.trapBubbledEvent(m,h[m],n),o[m]=!0)}},trapBubbledEvent:function(e,t,n){return g.ReactEventListener.trapBubbledEvent(e,t,n)},trapCapturedEvent:function(e,t,n){return g.ReactEventListener.trapCapturedEvent(e,t,n)},ensureScrollValueMonitoring:function(){if(!m){var e=l.refreshScrollValues;g.ReactEventListener.monitorScrollValue(e),m=!0}},eventNameDispatchConfigs:o.eventNameDispatchConfigs,registrationNameModules:o.registrationNameModules,putListener:o.putListener,getListener:o.getListener,deleteListener:o.deleteListener,deleteAllListeners:o.deleteAllListeners});t.exports=g},{"./EventConstants":122,"./EventPluginHub":124,"./EventPluginRegistry":125,"./Object.assign":134,"./ReactEventEmitterMixin":169,"./ViewportMetrics":212,"./isEventSupported":244}],139:[function(e,t,n){"use strict";var a=e("./ReactReconciler"),r=e("./flattenChildren"),o=e("./instantiateReactComponent"),i=e("./shouldUpdateReactComponent"),s={instantiateChildren:function(e,t,n){var a=r(e);for(var i in a)if(a.hasOwnProperty(i)){var s=a[i],l=o(s,null);a[i]=l}return a},updateChildren:function(e,t,n,s){var l=r(t);if(!l&&!e)return null;var c;for(c in l)if(l.hasOwnProperty(c)){var u=e&&e[c],p=u&&u._currentElement,m=l[c];if(i(p,m))a.receiveComponent(u,m,n,s),l[c]=u;else{u&&a.unmountComponent(u,c);var d=o(m,null);l[c]=d}}for(c in e)!e.hasOwnProperty(c)||l&&l.hasOwnProperty(c)||a.unmountComponent(e[c]);return l},unmountChildren:function(e){for(var t in e){var n=e[t];a.unmountComponent(n)}}};t.exports=s},{"./ReactReconciler":189,"./flattenChildren":226,"./instantiateReactComponent":242,"./shouldUpdateReactComponent":259}],140:[function(e,t,n){(function(n){"use strict";function a(e,t){this.forEachFunction=e,this.forEachContext=t}function r(e,t,n,a){var r=e;r.forEachFunction.call(r.forEachContext,t,a)}function o(e,t,n){if(null==e)return e;var o=a.getPooled(t,n);d(e,r,o),a.release(o)}function i(e,t,n){this.mapResult=e,this.mapFunction=t,this.mapContext=n}function s(e,t,a,r){var o=e,i=o.mapResult,s=!i.hasOwnProperty(a);if("production"!==n.env.NODE_ENV&&("production"!==n.env.NODE_ENV?h(s,"ReactChildren.map(...): Encountered two children with the same key, `%s`. Child keys must be unique; when two children share a key, only the first child will be used.",a):null),s){var l=o.mapFunction.call(o.mapContext,t,r);i[a]=l}}function l(e,t,n){if(null==e)return e;var a={},r=i.getPooled(a,t,n);return d(e,s,r),i.release(r),m.create(a)}function c(e,t,n,a){return null}function u(e,t){return d(e,c,null)}var p=e("./PooledClass"),m=e("./ReactFragment"),d=e("./traverseAllChildren"),h=e("./warning"),f=p.twoArgumentPooler,g=p.threeArgumentPooler;p.addPoolingTo(a,f),p.addPoolingTo(i,g);var v={forEach:o,map:l,count:u};t.exports=v}).call(this,e("g5I+bs"))},{"./PooledClass":135,"./ReactFragment":171,"./traverseAllChildren":261,"./warning":262,"g5I+bs":70}],141:[function(e,t,n){(function(n){"use strict";function a(e,t,a){for(var r in t)t.hasOwnProperty(r)&&("production"!==n.env.NODE_ENV?_("function"==typeof t[r],"%s: %s type `%s` is invalid; it must be a function, usually from React.PropTypes.",e.displayName||"ReactClass",y[a],r):null)}function r(e,t){var a=S.hasOwnProperty(t)?S[t]:null;O.hasOwnProperty(t)&&("production"!==n.env.NODE_ENV?x(a===I.OVERRIDE_BASE,"ReactClassInterface: You are attempting to override `%s` from your class specification. Ensure that your method names do not overlap with React methods.",t):x(a===I.OVERRIDE_BASE)),e.hasOwnProperty(t)&&("production"!==n.env.NODE_ENV?x(a===I.DEFINE_MANY||a===I.DEFINE_MANY_MERGED,"ReactClassInterface: You are attempting to define `%s` on your component more than once. This conflict may be due to a mixin.",t):x(a===I.DEFINE_MANY||a===I.DEFINE_MANY_MERGED))}function o(e,t){if(t){"production"!==n.env.NODE_ENV?x("function"!=typeof t,"ReactClass: You're attempting to use a component class as a mixin. Instead, just use a regular object."):x("function"!=typeof t),"production"!==n.env.NODE_ENV?x(!h.isValidElement(t),"ReactClass: You're attempting to use a component as a mixin. Instead, just use a regular object."):x(!h.isValidElement(t));var a=e.prototype;t.hasOwnProperty(R)&&D.mixins(e,t.mixins);for(var o in t)if(t.hasOwnProperty(o)&&o!==R){var i=t[o];if(r(a,o),D.hasOwnProperty(o))D[o](e,i);else{var s=S.hasOwnProperty(o),u=a.hasOwnProperty(o),p=i&&i.__reactDontBind,m="function"==typeof i,d=m&&!s&&!u&&!p;if(d)a.__reactAutoBindMap||(a.__reactAutoBindMap={}),a.__reactAutoBindMap[o]=i,a[o]=i;else if(u){var f=S[o];"production"!==n.env.NODE_ENV?x(s&&(f===I.DEFINE_MANY_MERGED||f===I.DEFINE_MANY),"ReactClass: Unexpected spec policy %s for key %s when mixing in component specs.",f,o):x(s&&(f===I.DEFINE_MANY_MERGED||f===I.DEFINE_MANY)),f===I.DEFINE_MANY_MERGED?a[o]=l(a[o],i):f===I.DEFINE_MANY&&(a[o]=c(a[o],i))}else a[o]=i,"production"!==n.env.NODE_ENV&&"function"==typeof i&&t.displayName&&(a[o].displayName=t.displayName+"_"+o)}}}}function i(e,t){if(t)for(var a in t){var r=t[a];if(t.hasOwnProperty(a)){var o=a in D;"production"!==n.env.NODE_ENV?x(!o,'ReactClass: You are attempting to define a reserved property, `%s`, that shouldn\'t be on the "statics" key. Define it as an instance property instead; it will still be accessible on the constructor.',a):x(!o);var i=a in e;"production"!==n.env.NODE_ENV?x(!i,"ReactClass: You are attempting to define `%s` on your component more than once. This conflict may be due to a mixin.",a):x(!i),e[a]=r}}}function s(e,t){"production"!==n.env.NODE_ENV?x(e&&t&&"object"==typeof e&&"object"==typeof t,"mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects."):x(e&&t&&"object"==typeof e&&"object"==typeof t);for(var a in t)t.hasOwnProperty(a)&&("production"!==n.env.NODE_ENV?x(void 0===e[a],"mergeIntoWithNoDuplicateKeys(): Tried to merge two objects with the same key: `%s`. This conflict may be due to a mixin; in particular, this may be caused by two getInitialState() or getDefaultProps() methods returning objects with clashing keys.",a):x(void 0===e[a]),e[a]=t[a]);return e}function l(e,t){return function(){var n=e.apply(this,arguments),a=t.apply(this,arguments);if(null==n)return a;if(null==a)return n;var r={};return s(r,n),s(r,a),r}}function c(e,t){return function(){e.apply(this,arguments),t.apply(this,arguments)}}function u(e,t){var a=t.bind(e);if("production"!==n.env.NODE_ENV){a.__reactBoundContext=e,a.__reactBoundMethod=t,a.__reactBoundArguments=null;var r=e.constructor.displayName,o=a.bind;a.bind=function(i){for(var s=[],l=1,c=arguments.length;c>l;l++)s.push(arguments[l]);if(i!==e&&null!==i)"production"!==n.env.NODE_ENV?_(!1,"bind(): React component methods may only be bound to the component instance. See %s",r):null;else if(!s.length)return"production"!==n.env.NODE_ENV?_(!1,"bind(): You are binding a component method to the component. React does this for you automatically in a high-performance way, so you can safely remove this call. See %s",r):null,a;var u=o.apply(a,arguments);return u.__reactBoundContext=e,u.__reactBoundMethod=t,u.__reactBoundArguments=s,u}}return a}function p(e){for(var t in e.__reactAutoBindMap)if(e.__reactAutoBindMap.hasOwnProperty(t)){var n=e.__reactAutoBindMap[t];e[t]=u(e,f.guard(n,e.constructor.displayName+"."+t))}}var m=e("./ReactComponent"),d=e("./ReactCurrentOwner"),h=e("./ReactElement"),f=e("./ReactErrorUtils"),g=e("./ReactInstanceMap"),v=e("./ReactLifeCycle"),E=e("./ReactPropTypeLocations"),y=e("./ReactPropTypeLocationNames"),b=e("./ReactUpdateQueue"),N=e("./Object.assign"),x=e("./invariant"),w=e("./keyMirror"),C=e("./keyOf"),_=e("./warning"),R=C({mixins:null}),I=w({DEFINE_ONCE:null,DEFINE_MANY:null,OVERRIDE_BASE:null,DEFINE_MANY_MERGED:null}),j=[],S={mixins:I.DEFINE_MANY,statics:I.DEFINE_MANY,propTypes:I.DEFINE_MANY,contextTypes:I.DEFINE_MANY,childContextTypes:I.DEFINE_MANY,getDefaultProps:I.DEFINE_MANY_MERGED,getInitialState:I.DEFINE_MANY_MERGED,getChildContext:I.DEFINE_MANY_MERGED,render:I.DEFINE_ONCE,componentWillMount:I.DEFINE_MANY,componentDidMount:I.DEFINE_MANY,componentWillReceiveProps:I.DEFINE_MANY,shouldComponentUpdate:I.DEFINE_ONCE,componentWillUpdate:I.DEFINE_MANY,componentDidUpdate:I.DEFINE_MANY,componentWillUnmount:I.DEFINE_MANY,updateComponent:I.OVERRIDE_BASE},D={displayName:function(e,t){e.displayName=t},mixins:function(e,t){if(t)for(var n=0;n<t.length;n++)o(e,t[n])},childContextTypes:function(e,t){"production"!==n.env.NODE_ENV&&a(e,t,E.childContext),e.childContextTypes=N({},e.childContextTypes,t)},contextTypes:function(e,t){"production"!==n.env.NODE_ENV&&a(e,t,E.context),e.contextTypes=N({},e.contextTypes,t)},getDefaultProps:function(e,t){e.getDefaultProps?e.getDefaultProps=l(e.getDefaultProps,t):e.getDefaultProps=t},propTypes:function(e,t){"production"!==n.env.NODE_ENV&&a(e,t,E.prop),e.propTypes=N({},e.propTypes,t)},statics:function(e,t){i(e,t)}},P={enumerable:!1,get:function(){var e=this.displayName||this.name||"Component";return"production"!==n.env.NODE_ENV?_(!1,"%s.type is deprecated. Use %s directly to access the class.",e,e):null,Object.defineProperty(this,"type",{value:this}),this}},O={replaceState:function(e,t){b.enqueueReplaceState(this,e),t&&b.enqueueCallback(this,t)},isMounted:function(){if("production"!==n.env.NODE_ENV){var e=d.current;null!==e&&("production"!==n.env.NODE_ENV?_(e._warnedAboutRefsInRender,"%s is accessing isMounted inside its render() function. render() should be a pure function of props and state. It should never access something that requires stale data from the previous render, such as refs. Move this logic to componentDidMount and componentDidUpdate instead.",e.getName()||"A component"):null,e._warnedAboutRefsInRender=!0)}var t=g.get(this);return t&&t!==v.currentlyMountingInstance},setProps:function(e,t){b.enqueueSetProps(this,e),t&&b.enqueueCallback(this,t)},replaceProps:function(e,t){b.enqueueReplaceProps(this,e),t&&b.enqueueCallback(this,t)}},k=function(){};N(k.prototype,m.prototype,O);var M={createClass:function(e){var t=function(e,a){"production"!==n.env.NODE_ENV&&("production"!==n.env.NODE_ENV?_(this instanceof t,"Something is calling a React component directly. Use a factory or JSX instead. See: https://fb.me/react-legacyfactory"):null),this.__reactAutoBindMap&&p(this),this.props=e,this.context=a,this.state=null;var r=this.getInitialState?this.getInitialState():null;"production"!==n.env.NODE_ENV&&"undefined"==typeof r&&this.getInitialState._isMockFunction&&(r=null),"production"!==n.env.NODE_ENV?x("object"==typeof r&&!Array.isArray(r),"%s.getInitialState(): must return an object or null",t.displayName||"ReactCompositeComponent"):x("object"==typeof r&&!Array.isArray(r)),this.state=r};t.prototype=new k,t.prototype.constructor=t,j.forEach(o.bind(null,t)),o(t,e),t.getDefaultProps&&(t.defaultProps=t.getDefaultProps()),"production"!==n.env.NODE_ENV&&(t.getDefaultProps&&(t.getDefaultProps.isReactClassApproved={}),t.prototype.getInitialState&&(t.prototype.getInitialState.isReactClassApproved={})),"production"!==n.env.NODE_ENV?x(t.prototype.render,"createClass(...): Class specification must implement a `render` method."):x(t.prototype.render),"production"!==n.env.NODE_ENV&&("production"!==n.env.NODE_ENV?_(!t.prototype.componentShouldUpdate,"%s has a method called componentShouldUpdate(). Did you mean shouldComponentUpdate()? The name is phrased as a question because the function is expected to return a value.",e.displayName||"A component"):null);for(var a in S)t.prototype[a]||(t.prototype[a]=null);if(t.type=t,"production"!==n.env.NODE_ENV)try{Object.defineProperty(t,"type",P)}catch(r){}return t},injection:{injectMixin:function(e){j.push(e)}}};t.exports=M}).call(this,e("g5I+bs"))},{"./Object.assign":134,"./ReactComponent":142,"./ReactCurrentOwner":147,"./ReactElement":165,"./ReactErrorUtils":168,"./ReactInstanceMap":175,"./ReactLifeCycle":176,"./ReactPropTypeLocationNames":184,"./ReactPropTypeLocations":185,"./ReactUpdateQueue":194,"./invariant":243,"./keyMirror":248,"./keyOf":249,"./warning":262,"g5I+bs":70}],142:[function(e,t,n){(function(n){"use strict";function a(e,t){this.props=e,this.context=t}var r=e("./ReactUpdateQueue"),o=e("./invariant"),i=e("./warning");if(a.prototype.setState=function(e,t){"production"!==n.env.NODE_ENV?o("object"==typeof e||"function"==typeof e||null==e,"setState(...): takes an object of state variables to update or a function which returns an object of state variables."):o("object"==typeof e||"function"==typeof e||null==e),"production"!==n.env.NODE_ENV&&("production"!==n.env.NODE_ENV?i(null!=e,"setState(...): You passed an undefined or null state object; instead, use forceUpdate()."):null),r.enqueueSetState(this,e),t&&r.enqueueCallback(this,t)},a.prototype.forceUpdate=function(e){r.enqueueForceUpdate(this),e&&r.enqueueCallback(this,e)},"production"!==n.env.NODE_ENV){var s={getDOMNode:["getDOMNode","Use React.findDOMNode(component) instead."],isMounted:["isMounted","Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."],replaceProps:["replaceProps","Instead, call React.render again at the top level."],replaceState:["replaceState","Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."],setProps:["setProps","Instead, call React.render again at the top level."]},l=function(e,t){try{Object.defineProperty(a.prototype,e,{get:function(){return void("production"!==n.env.NODE_ENV?i(!1,"%s(...) is deprecated in plain JavaScript React classes. %s",t[0],t[1]):null)}})}catch(r){}};for(var c in s)s.hasOwnProperty(c)&&l(c,s[c])}t.exports=a}).call(this,e("g5I+bs"))},{"./ReactUpdateQueue":194,"./invariant":243,"./warning":262,"g5I+bs":70}],143:[function(e,t,n){"use strict";var a=e("./ReactDOMIDOperations"),r=e("./ReactMount"),o={processChildrenUpdates:a.dangerouslyProcessChildrenUpdates,replaceNodeWithMarkupByID:a.dangerouslyReplaceNodeWithMarkupByID,unmountIDFromEnvironment:function(e){r.purgeID(e)}};t.exports=o},{"./ReactDOMIDOperations":152,"./ReactMount":178}],144:[function(e,t,n){(function(n){"use strict";var a=e("./invariant"),r=!1,o={unmountIDFromEnvironment:null,replaceNodeWithMarkupByID:null,processChildrenUpdates:null,injection:{injectEnvironment:function(e){"production"!==n.env.NODE_ENV?a(!r,"ReactCompositeComponent: injectEnvironment() can only be called once."):a(!r),o.unmountIDFromEnvironment=e.unmountIDFromEnvironment,o.replaceNodeWithMarkupByID=e.replaceNodeWithMarkupByID,o.processChildrenUpdates=e.processChildrenUpdates,r=!0}}};t.exports=o}).call(this,e("g5I+bs"))},{"./invariant":243,"g5I+bs":70}],145:[function(e,t,n){(function(n){"use strict";function a(e){var t=e._currentElement._owner||null;if(t){var n=t.getName();if(n)return" Check the render method of `"+n+"`."}return""}var r=e("./ReactComponentEnvironment"),o=e("./ReactContext"),i=e("./ReactCurrentOwner"),s=e("./ReactElement"),l=e("./ReactElementValidator"),c=e("./ReactInstanceMap"),u=e("./ReactLifeCycle"),p=e("./ReactNativeComponent"),m=e("./ReactPerf"),d=e("./ReactPropTypeLocations"),h=e("./ReactPropTypeLocationNames"),f=e("./ReactReconciler"),g=e("./ReactUpdates"),v=e("./Object.assign"),E=e("./emptyObject"),y=e("./invariant"),b=e("./shouldUpdateReactComponent"),N=e("./warning"),x=1,w={construct:function(e){this._currentElement=e,this._rootNodeID=null,this._instance=null,this._pendingElement=null,this._pendingStateQueue=null,this._pendingReplaceState=!1,this._pendingForceUpdate=!1,this._renderedComponent=null,this._context=null,this._mountOrder=0,this._isTopLevel=!1,this._pendingCallbacks=null},mountComponent:function(e,t,a){this._context=a,this._mountOrder=x++,this._rootNodeID=e;var r=this._processProps(this._currentElement.props),o=this._processContext(this._currentElement._context),i=p.getComponentClassForElement(this._currentElement),s=new i(r,o);"production"!==n.env.NODE_ENV&&("production"!==n.env.NODE_ENV?N(null!=s.render,"%s(...): No `render` method found on the returned component instance: you may have forgotten to define `render` in your component or you may have accidentally tried to render an element whose type is a function that isn't a React component.",i.displayName||i.name||"Component"):null),s.props=r,s.context=o,s.refs=E,this._instance=s,c.set(s,this),"production"!==n.env.NODE_ENV&&this._warnIfContextsDiffer(this._currentElement._context,a),"production"!==n.env.NODE_ENV&&("production"!==n.env.NODE_ENV?N(!s.getInitialState||s.getInitialState.isReactClassApproved,"getInitialState was defined on %s, a plain JavaScript class. This is only supported for classes created using React.createClass. Did you mean to define a state property instead?",this.getName()||"a component"):null,"production"!==n.env.NODE_ENV?N(!s.getDefaultProps||s.getDefaultProps.isReactClassApproved,"getDefaultProps was defined on %s, a plain JavaScript class. This is only supported for classes created using React.createClass. Use a static property to define defaultProps instead.",this.getName()||"a component"):null,"production"!==n.env.NODE_ENV?N(!s.propTypes,"propTypes was defined as an instance property on %s. Use a static property to define propTypes instead.",this.getName()||"a component"):null,"production"!==n.env.NODE_ENV?N(!s.contextTypes,"contextTypes was defined as an instance property on %s. Use a static property to define contextTypes instead.",this.getName()||"a component"):null,"production"!==n.env.NODE_ENV?N("function"!=typeof s.componentShouldUpdate,"%s has a method called componentShouldUpdate(). Did you mean shouldComponentUpdate()? The name is phrased as a question because the function is expected to return a value.",this.getName()||"A component"):null);var l=s.state;void 0===l&&(s.state=l=null),"production"!==n.env.NODE_ENV?y("object"==typeof l&&!Array.isArray(l),"%s.state: must be set to an object or null",this.getName()||"ReactCompositeComponent"):y("object"==typeof l&&!Array.isArray(l)),this._pendingStateQueue=null,this._pendingReplaceState=!1,this._pendingForceUpdate=!1;var m,d,h=u.currentlyMountingInstance;u.currentlyMountingInstance=this;try{s.componentWillMount&&(s.componentWillMount(),
this._pendingStateQueue&&(s.state=this._processPendingState(s.props,s.context))),m=this._getValidatedChildContext(a),d=this._renderValidatedComponent(m)}finally{u.currentlyMountingInstance=h}this._renderedComponent=this._instantiateReactComponent(d,this._currentElement.type);var g=f.mountComponent(this._renderedComponent,e,t,this._mergeChildContext(a,m));return s.componentDidMount&&t.getReactMountReady().enqueue(s.componentDidMount,s),g},unmountComponent:function(){var e=this._instance;if(e.componentWillUnmount){var t=u.currentlyUnmountingInstance;u.currentlyUnmountingInstance=this;try{e.componentWillUnmount()}finally{u.currentlyUnmountingInstance=t}}f.unmountComponent(this._renderedComponent),this._renderedComponent=null,this._pendingStateQueue=null,this._pendingReplaceState=!1,this._pendingForceUpdate=!1,this._pendingCallbacks=null,this._pendingElement=null,this._context=null,this._rootNodeID=null,c.remove(e)},_setPropsInternal:function(e,t){var n=this._pendingElement||this._currentElement;this._pendingElement=s.cloneAndReplaceProps(n,v({},n.props,e)),g.enqueueUpdate(this,t)},_maskContext:function(e){var t=null;if("string"==typeof this._currentElement.type)return E;var n=this._currentElement.type.contextTypes;if(!n)return E;t={};for(var a in n)t[a]=e[a];return t},_processContext:function(e){var t=this._maskContext(e);if("production"!==n.env.NODE_ENV){var a=p.getComponentClassForElement(this._currentElement);a.contextTypes&&this._checkPropTypes(a.contextTypes,t,d.context)}return t},_getValidatedChildContext:function(e){var t=this._instance,a=t.getChildContext&&t.getChildContext();if(a){"production"!==n.env.NODE_ENV?y("object"==typeof t.constructor.childContextTypes,"%s.getChildContext(): childContextTypes must be defined in order to use getChildContext().",this.getName()||"ReactCompositeComponent"):y("object"==typeof t.constructor.childContextTypes),"production"!==n.env.NODE_ENV&&this._checkPropTypes(t.constructor.childContextTypes,a,d.childContext);for(var r in a)"production"!==n.env.NODE_ENV?y(r in t.constructor.childContextTypes,'%s.getChildContext(): key "%s" is not defined in childContextTypes.',this.getName()||"ReactCompositeComponent",r):y(r in t.constructor.childContextTypes);return a}return null},_mergeChildContext:function(e,t){return t?v({},e,t):e},_processProps:function(e){if("production"!==n.env.NODE_ENV){var t=p.getComponentClassForElement(this._currentElement);t.propTypes&&this._checkPropTypes(t.propTypes,e,d.prop)}return e},_checkPropTypes:function(e,t,r){var o=this.getName();for(var i in e)if(e.hasOwnProperty(i)){var s;try{"production"!==n.env.NODE_ENV?y("function"==typeof e[i],"%s: %s type `%s` is invalid; it must be a function, usually from React.PropTypes.",o||"React class",h[r],i):y("function"==typeof e[i]),s=e[i](t,i,o,r)}catch(l){s=l}if(s instanceof Error){var c=a(this);r===d.prop?"production"!==n.env.NODE_ENV?N(!1,"Failed Composite propType: %s%s",s.message,c):null:"production"!==n.env.NODE_ENV?N(!1,"Failed Context Types: %s%s",s.message,c):null}}},receiveComponent:function(e,t,n){var a=this._currentElement,r=this._context;this._pendingElement=null,this.updateComponent(t,a,e,r,n)},performUpdateIfNecessary:function(e){null!=this._pendingElement&&f.receiveComponent(this,this._pendingElement||this._currentElement,e,this._context),(null!==this._pendingStateQueue||this._pendingForceUpdate)&&("production"!==n.env.NODE_ENV&&l.checkAndWarnForMutatedProps(this._currentElement),this.updateComponent(e,this._currentElement,this._currentElement,this._context,this._context))},_warnIfContextsDiffer:function(e,t){e=this._maskContext(e),t=this._maskContext(t);for(var a=Object.keys(t).sort(),r=this.getName()||"ReactCompositeComponent",o=0;o<a.length;o++){var i=a[o];"production"!==n.env.NODE_ENV?N(e[i]===t[i],"owner-based and parent-based contexts differ (values: `%s` vs `%s`) for key (%s) while mounting %s (see: http://fb.me/react-context-by-parent)",e[i],t[i],i,r):null}},updateComponent:function(e,t,a,r,o){var i=this._instance,s=i.context,l=i.props;t!==a&&(s=this._processContext(a._context),l=this._processProps(a.props),"production"!==n.env.NODE_ENV&&null!=o&&this._warnIfContextsDiffer(a._context,o),i.componentWillReceiveProps&&i.componentWillReceiveProps(l,s));var c=this._processPendingState(l,s),u=this._pendingForceUpdate||!i.shouldComponentUpdate||i.shouldComponentUpdate(l,c,s);"production"!==n.env.NODE_ENV&&("production"!==n.env.NODE_ENV?N("undefined"!=typeof u,"%s.shouldComponentUpdate(): Returned undefined instead of a boolean value. Make sure to return true or false.",this.getName()||"ReactCompositeComponent"):null),u?(this._pendingForceUpdate=!1,this._performComponentUpdate(a,l,c,s,e,o)):(this._currentElement=a,this._context=o,i.props=l,i.state=c,i.context=s)},_processPendingState:function(e,t){var n=this._instance,a=this._pendingStateQueue,r=this._pendingReplaceState;if(this._pendingReplaceState=!1,this._pendingStateQueue=null,!a)return n.state;if(r&&1===a.length)return a[0];for(var o=v({},r?a[0]:n.state),i=r?1:0;i<a.length;i++){var s=a[i];v(o,"function"==typeof s?s.call(n,o,e,t):s)}return o},_performComponentUpdate:function(e,t,n,a,r,o){var i=this._instance,s=i.props,l=i.state,c=i.context;i.componentWillUpdate&&i.componentWillUpdate(t,n,a),this._currentElement=e,this._context=o,i.props=t,i.state=n,i.context=a,this._updateRenderedComponent(r,o),i.componentDidUpdate&&r.getReactMountReady().enqueue(i.componentDidUpdate.bind(i,s,l,c),i)},_updateRenderedComponent:function(e,t){var n=this._renderedComponent,a=n._currentElement,r=this._getValidatedChildContext(),o=this._renderValidatedComponent(r);if(b(a,o))f.receiveComponent(n,o,e,this._mergeChildContext(t,r));else{var i=this._rootNodeID,s=n._rootNodeID;f.unmountComponent(n),this._renderedComponent=this._instantiateReactComponent(o,this._currentElement.type);var l=f.mountComponent(this._renderedComponent,i,e,this._mergeChildContext(t,r));this._replaceNodeWithMarkupByID(s,l)}},_replaceNodeWithMarkupByID:function(e,t){r.replaceNodeWithMarkupByID(e,t)},_renderValidatedComponentWithoutOwnerOrContext:function(){var e=this._instance,t=e.render();return"production"!==n.env.NODE_ENV&&"undefined"==typeof t&&e.render._isMockFunction&&(t=null),t},_renderValidatedComponent:function(e){var t,a=o.current;o.current=this._mergeChildContext(this._currentElement._context,e),i.current=this;try{t=this._renderValidatedComponentWithoutOwnerOrContext()}finally{o.current=a,i.current=null}return"production"!==n.env.NODE_ENV?y(null===t||t===!1||s.isValidElement(t),"%s.render(): A valid ReactComponent must be returned. You may have returned undefined, an array or some other invalid object.",this.getName()||"ReactCompositeComponent"):y(null===t||t===!1||s.isValidElement(t)),t},attachRef:function(e,t){var n=this.getPublicInstance(),a=n.refs===E?n.refs={}:n.refs;a[e]=t.getPublicInstance()},detachRef:function(e){var t=this.getPublicInstance().refs;delete t[e]},getName:function(){var e=this._currentElement.type,t=this._instance&&this._instance.constructor;return e.displayName||t&&t.displayName||e.name||t&&t.name||null},getPublicInstance:function(){return this._instance},_instantiateReactComponent:null};m.measureMethods(w,"ReactCompositeComponent",{mountComponent:"mountComponent",updateComponent:"updateComponent",_renderValidatedComponent:"_renderValidatedComponent"});var C={Mixin:w};t.exports=C}).call(this,e("g5I+bs"))},{"./Object.assign":134,"./ReactComponentEnvironment":144,"./ReactContext":146,"./ReactCurrentOwner":147,"./ReactElement":165,"./ReactElementValidator":166,"./ReactInstanceMap":175,"./ReactLifeCycle":176,"./ReactNativeComponent":181,"./ReactPerf":183,"./ReactPropTypeLocationNames":184,"./ReactPropTypeLocations":185,"./ReactReconciler":189,"./ReactUpdates":195,"./emptyObject":223,"./invariant":243,"./shouldUpdateReactComponent":259,"./warning":262,"g5I+bs":70}],146:[function(e,t,n){(function(n){"use strict";var a=e("./Object.assign"),r=e("./emptyObject"),o=e("./warning"),i=!1,s={current:r,withContext:function(e,t){"production"!==n.env.NODE_ENV&&("production"!==n.env.NODE_ENV?o(i,"withContext is deprecated and will be removed in a future version. Use a wrapper component with getChildContext instead."):null,i=!0);var r,l=s.current;s.current=a({},l,e);try{r=t()}finally{s.current=l}return r}};t.exports=s}).call(this,e("g5I+bs"))},{"./Object.assign":134,"./emptyObject":223,"./warning":262,"g5I+bs":70}],147:[function(e,t,n){"use strict";var a={current:null};t.exports=a},{}],148:[function(e,t,n){(function(n){"use strict";function a(e){return"production"!==n.env.NODE_ENV?o.createFactory(e):r.createFactory(e)}var r=e("./ReactElement"),o=e("./ReactElementValidator"),i=e("./mapObject"),s=i({a:"a",abbr:"abbr",address:"address",area:"area",article:"article",aside:"aside",audio:"audio",b:"b",base:"base",bdi:"bdi",bdo:"bdo",big:"big",blockquote:"blockquote",body:"body",br:"br",button:"button",canvas:"canvas",caption:"caption",cite:"cite",code:"code",col:"col",colgroup:"colgroup",data:"data",datalist:"datalist",dd:"dd",del:"del",details:"details",dfn:"dfn",dialog:"dialog",div:"div",dl:"dl",dt:"dt",em:"em",embed:"embed",fieldset:"fieldset",figcaption:"figcaption",figure:"figure",footer:"footer",form:"form",h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",head:"head",header:"header",hr:"hr",html:"html",i:"i",iframe:"iframe",img:"img",input:"input",ins:"ins",kbd:"kbd",keygen:"keygen",label:"label",legend:"legend",li:"li",link:"link",main:"main",map:"map",mark:"mark",menu:"menu",menuitem:"menuitem",meta:"meta",meter:"meter",nav:"nav",noscript:"noscript",object:"object",ol:"ol",optgroup:"optgroup",option:"option",output:"output",p:"p",param:"param",picture:"picture",pre:"pre",progress:"progress",q:"q",rp:"rp",rt:"rt",ruby:"ruby",s:"s",samp:"samp",script:"script",section:"section",select:"select",small:"small",source:"source",span:"span",strong:"strong",style:"style",sub:"sub",summary:"summary",sup:"sup",table:"table",tbody:"tbody",td:"td",textarea:"textarea",tfoot:"tfoot",th:"th",thead:"thead",time:"time",title:"title",tr:"tr",track:"track",u:"u",ul:"ul","var":"var",video:"video",wbr:"wbr",circle:"circle",clipPath:"clipPath",defs:"defs",ellipse:"ellipse",g:"g",line:"line",linearGradient:"linearGradient",mask:"mask",path:"path",pattern:"pattern",polygon:"polygon",polyline:"polyline",radialGradient:"radialGradient",rect:"rect",stop:"stop",svg:"svg",text:"text",tspan:"tspan"},a);t.exports=s}).call(this,e("g5I+bs"))},{"./ReactElement":165,"./ReactElementValidator":166,"./mapObject":250,"g5I+bs":70}],149:[function(e,t,n){"use strict";var a=e("./AutoFocusMixin"),r=e("./ReactBrowserComponentMixin"),o=e("./ReactClass"),i=e("./ReactElement"),s=e("./keyMirror"),l=i.createFactory("button"),c=s({onClick:!0,onDoubleClick:!0,onMouseDown:!0,onMouseMove:!0,onMouseUp:!0,onClickCapture:!0,onDoubleClickCapture:!0,onMouseDownCapture:!0,onMouseMoveCapture:!0,onMouseUpCapture:!0}),u=o.createClass({displayName:"ReactDOMButton",tagName:"BUTTON",mixins:[a,r],render:function(){var e={};for(var t in this.props)!this.props.hasOwnProperty(t)||this.props.disabled&&c[t]||(e[t]=this.props[t]);return l(e,this.props.children)}});t.exports=u},{"./AutoFocusMixin":109,"./ReactBrowserComponentMixin":137,"./ReactClass":141,"./ReactElement":165,"./keyMirror":248}],150:[function(e,t,n){(function(n){"use strict";function a(e){e&&(null!=e.dangerouslySetInnerHTML&&("production"!==n.env.NODE_ENV?v(null==e.children,"Can only set one of `children` or `props.dangerouslySetInnerHTML`."):v(null==e.children),"production"!==n.env.NODE_ENV?v("object"==typeof e.dangerouslySetInnerHTML&&"__html"in e.dangerouslySetInnerHTML,"`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. Please visit https://fb.me/react-invariant-dangerously-set-inner-html for more information."):v("object"==typeof e.dangerouslySetInnerHTML&&"__html"in e.dangerouslySetInnerHTML)),"production"!==n.env.NODE_ENV&&("production"!==n.env.NODE_ENV?b(null==e.innerHTML,"Directly setting property `innerHTML` is not permitted. For more information, lookup documentation on `dangerouslySetInnerHTML`."):null,"production"!==n.env.NODE_ENV?b(!e.contentEditable||null==e.children,"A component is `contentEditable` and contains `children` managed by React. It is now your responsibility to guarantee that none of those nodes are unexpectedly modified or duplicated. This is probably not intentional."):null),"production"!==n.env.NODE_ENV?v(null==e.style||"object"==typeof e.style,"The `style` prop expects a mapping from style properties to values, not a string. For example, style={{marginRight: spacing + 'em'}} when using JSX."):v(null==e.style||"object"==typeof e.style))}function r(e,t,a,r){"production"!==n.env.NODE_ENV&&("production"!==n.env.NODE_ENV?b("onScroll"!==t||E("scroll",!0),"This browser doesn't support the `onScroll` event"):null);var o=m.findReactContainerForID(e);if(o){var i=o.nodeType===R?o.ownerDocument:o;x(t,i)}r.getPutListenerQueue().enqueuePutListener(e,t,a)}function o(e){P.call(D,e)||("production"!==n.env.NODE_ENV?v(S.test(e),"Invalid tag: %s",e):v(S.test(e)),D[e]=!0)}function i(e){o(e),this._tag=e,this._renderedChildren=null,this._previousStyleCopy=null,this._rootNodeID=null}var s=e("./CSSPropertyOperations"),l=e("./DOMProperty"),c=e("./DOMPropertyOperations"),u=e("./ReactBrowserEventEmitter"),p=e("./ReactComponentBrowserEnvironment"),m=e("./ReactMount"),d=e("./ReactMultiChild"),h=e("./ReactPerf"),f=e("./Object.assign"),g=e("./escapeTextContentForBrowser"),v=e("./invariant"),E=e("./isEventSupported"),y=e("./keyOf"),b=e("./warning"),N=u.deleteListener,x=u.listenTo,w=u.registrationNameModules,C={string:!0,number:!0},_=y({style:null}),R=1,I=null,j={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},S=/^[a-zA-Z][a-zA-Z:_\.\-\d]*$/,D={},P={}.hasOwnProperty;i.displayName="ReactDOMComponent",i.Mixin={construct:function(e){this._currentElement=e},mountComponent:function(e,t,n){this._rootNodeID=e,a(this._currentElement.props);var r=j[this._tag]?"":"</"+this._tag+">";return this._createOpenTagMarkupAndPutListeners(t)+this._createContentMarkup(t,n)+r},_createOpenTagMarkupAndPutListeners:function(e){var t=this._currentElement.props,n="<"+this._tag;for(var a in t)if(t.hasOwnProperty(a)){var o=t[a];if(null!=o)if(w.hasOwnProperty(a))r(this._rootNodeID,a,o,e);else{a===_&&(o&&(o=this._previousStyleCopy=f({},t.style)),o=s.createMarkupForStyles(o));var i=c.createMarkupForProperty(a,o);i&&(n+=" "+i)}}if(e.renderToStaticMarkup)return n+">";var l=c.createMarkupForID(this._rootNodeID);return n+" "+l+">"},_createContentMarkup:function(e,t){var n="";("listing"===this._tag||"pre"===this._tag||"textarea"===this._tag)&&(n="\n");var a=this._currentElement.props,r=a.dangerouslySetInnerHTML;if(null!=r){if(null!=r.__html)return n+r.__html}else{var o=C[typeof a.children]?a.children:null,i=null!=o?null:a.children;if(null!=o)return n+g(o);if(null!=i){var s=this.mountChildren(i,e,t);return n+s.join("")}}return n},receiveComponent:function(e,t,n){var a=this._currentElement;this._currentElement=e,this.updateComponent(t,a,e,n)},updateComponent:function(e,t,n,r){a(this._currentElement.props),this._updateDOMProperties(t.props,e),this._updateDOMChildren(t.props,e,r)},_updateDOMProperties:function(e,t){var n,a,o,i=this._currentElement.props;for(n in e)if(!i.hasOwnProperty(n)&&e.hasOwnProperty(n))if(n===_){var s=this._previousStyleCopy;for(a in s)s.hasOwnProperty(a)&&(o=o||{},o[a]="");this._previousStyleCopy=null}else w.hasOwnProperty(n)?N(this._rootNodeID,n):(l.isStandardName[n]||l.isCustomAttribute(n))&&I.deletePropertyByID(this._rootNodeID,n);for(n in i){var c=i[n],u=n===_?this._previousStyleCopy:e[n];if(i.hasOwnProperty(n)&&c!==u)if(n===_)if(c?c=this._previousStyleCopy=f({},c):this._previousStyleCopy=null,u){for(a in u)!u.hasOwnProperty(a)||c&&c.hasOwnProperty(a)||(o=o||{},o[a]="");for(a in c)c.hasOwnProperty(a)&&u[a]!==c[a]&&(o=o||{},o[a]=c[a])}else o=c;else w.hasOwnProperty(n)?r(this._rootNodeID,n,c,t):(l.isStandardName[n]||l.isCustomAttribute(n))&&I.updatePropertyByID(this._rootNodeID,n,c)}o&&I.updateStylesByID(this._rootNodeID,o)},_updateDOMChildren:function(e,t,n){var a=this._currentElement.props,r=C[typeof e.children]?e.children:null,o=C[typeof a.children]?a.children:null,i=e.dangerouslySetInnerHTML&&e.dangerouslySetInnerHTML.__html,s=a.dangerouslySetInnerHTML&&a.dangerouslySetInnerHTML.__html,l=null!=r?null:e.children,c=null!=o?null:a.children,u=null!=r||null!=i,p=null!=o||null!=s;null!=l&&null==c?this.updateChildren(null,t,n):u&&!p&&this.updateTextContent(""),null!=o?r!==o&&this.updateTextContent(""+o):null!=s?i!==s&&I.updateInnerHTMLByID(this._rootNodeID,s):null!=c&&this.updateChildren(c,t,n)},unmountComponent:function(){this.unmountChildren(),u.deleteAllListeners(this._rootNodeID),p.unmountIDFromEnvironment(this._rootNodeID),this._rootNodeID=null}},h.measureMethods(i,"ReactDOMComponent",{mountComponent:"mountComponent",updateComponent:"updateComponent"}),f(i.prototype,i.Mixin,d.Mixin),i.injection={injectIDOperations:function(e){i.BackendIDOperations=I=e}},t.exports=i}).call(this,e("g5I+bs"))},{"./CSSPropertyOperations":112,"./DOMProperty":117,"./DOMPropertyOperations":118,"./Object.assign":134,"./ReactBrowserEventEmitter":138,"./ReactComponentBrowserEnvironment":143,"./ReactMount":178,"./ReactMultiChild":179,"./ReactPerf":183,"./escapeTextContentForBrowser":224,"./invariant":243,"./isEventSupported":244,"./keyOf":249,"./warning":262,"g5I+bs":70}],151:[function(e,t,n){"use strict";var a=e("./EventConstants"),r=e("./LocalEventTrapMixin"),o=e("./ReactBrowserComponentMixin"),i=e("./ReactClass"),s=e("./ReactElement"),l=s.createFactory("form"),c=i.createClass({displayName:"ReactDOMForm",tagName:"FORM",mixins:[o,r],render:function(){return l(this.props)},componentDidMount:function(){this.trapBubbledEvent(a.topLevelTypes.topReset,"reset"),this.trapBubbledEvent(a.topLevelTypes.topSubmit,"submit")}});t.exports=c},{"./EventConstants":122,"./LocalEventTrapMixin":132,"./ReactBrowserComponentMixin":137,"./ReactClass":141,"./ReactElement":165}],152:[function(e,t,n){(function(n){"use strict";var a=e("./CSSPropertyOperations"),r=e("./DOMChildrenOperations"),o=e("./DOMPropertyOperations"),i=e("./ReactMount"),s=e("./ReactPerf"),l=e("./invariant"),c=e("./setInnerHTML"),u={dangerouslySetInnerHTML:"`dangerouslySetInnerHTML` must be set using `updateInnerHTMLByID()`.",style:"`style` must be set using `updateStylesByID()`."},p={updatePropertyByID:function(e,t,a){var r=i.getNode(e);"production"!==n.env.NODE_ENV?l(!u.hasOwnProperty(t),"updatePropertyByID(...): %s",u[t]):l(!u.hasOwnProperty(t)),null!=a?o.setValueForProperty(r,t,a):o.deleteValueForProperty(r,t)},deletePropertyByID:function(e,t,a){var r=i.getNode(e);"production"!==n.env.NODE_ENV?l(!u.hasOwnProperty(t),"updatePropertyByID(...): %s",u[t]):l(!u.hasOwnProperty(t)),o.deleteValueForProperty(r,t,a)},updateStylesByID:function(e,t){var n=i.getNode(e);a.setValueForStyles(n,t)},updateInnerHTMLByID:function(e,t){var n=i.getNode(e);c(n,t)},updateTextContentByID:function(e,t){var n=i.getNode(e);r.updateTextContent(n,t)},dangerouslyReplaceNodeWithMarkupByID:function(e,t){var n=i.getNode(e);r.dangerouslyReplaceNodeWithMarkup(n,t)},dangerouslyProcessChildrenUpdates:function(e,t){for(var n=0;n<e.length;n++)e[n].parentNode=i.getNode(e[n].parentID);r.processUpdates(e,t)}};s.measureMethods(p,"ReactDOMIDOperations",{updatePropertyByID:"updatePropertyByID",deletePropertyByID:"deletePropertyByID",updateStylesByID:"updateStylesByID",updateInnerHTMLByID:"updateInnerHTMLByID",updateTextContentByID:"updateTextContentByID",dangerouslyReplaceNodeWithMarkupByID:"dangerouslyReplaceNodeWithMarkupByID",dangerouslyProcessChildrenUpdates:"dangerouslyProcessChildrenUpdates"}),t.exports=p}).call(this,e("g5I+bs"))},{"./CSSPropertyOperations":112,"./DOMChildrenOperations":116,"./DOMPropertyOperations":118,"./ReactMount":178,"./ReactPerf":183,"./invariant":243,"./setInnerHTML":256,"g5I+bs":70}],153:[function(e,t,n){"use strict";var a=e("./EventConstants"),r=e("./LocalEventTrapMixin"),o=e("./ReactBrowserComponentMixin"),i=e("./ReactClass"),s=e("./ReactElement"),l=s.createFactory("iframe"),c=i.createClass({displayName:"ReactDOMIframe",tagName:"IFRAME",mixins:[o,r],render:function(){return l(this.props)},componentDidMount:function(){this.trapBubbledEvent(a.topLevelTypes.topLoad,"load")}});t.exports=c},{"./EventConstants":122,"./LocalEventTrapMixin":132,"./ReactBrowserComponentMixin":137,"./ReactClass":141,"./ReactElement":165}],154:[function(e,t,n){"use strict";var a=e("./EventConstants"),r=e("./LocalEventTrapMixin"),o=e("./ReactBrowserComponentMixin"),i=e("./ReactClass"),s=e("./ReactElement"),l=s.createFactory("img"),c=i.createClass({displayName:"ReactDOMImg",tagName:"IMG",mixins:[o,r],render:function(){return l(this.props)},componentDidMount:function(){this.trapBubbledEvent(a.topLevelTypes.topLoad,"load"),this.trapBubbledEvent(a.topLevelTypes.topError,"error")}});t.exports=c},{"./EventConstants":122,"./LocalEventTrapMixin":132,"./ReactBrowserComponentMixin":137,"./ReactClass":141,"./ReactElement":165}],155:[function(e,t,n){(function(n){"use strict";function a(){this.isMounted()&&this.forceUpdate()}var r=e("./AutoFocusMixin"),o=e("./DOMPropertyOperations"),i=e("./LinkedValueUtils"),s=e("./ReactBrowserComponentMixin"),l=e("./ReactClass"),c=e("./ReactElement"),u=e("./ReactMount"),p=e("./ReactUpdates"),m=e("./Object.assign"),d=e("./invariant"),h=c.createFactory("input"),f={},g=l.createClass({displayName:"ReactDOMInput",tagName:"INPUT",mixins:[r,i.Mixin,s],getInitialState:function(){var e=this.props.defaultValue;return{initialChecked:this.props.defaultChecked||!1,initialValue:null!=e?e:null}},render:function(){var e=m({},this.props);e.defaultChecked=null,e.defaultValue=null;var t=i.getValue(this);e.value=null!=t?t:this.state.initialValue;var n=i.getChecked(this);return e.checked=null!=n?n:this.state.initialChecked,e.onChange=this._handleChange,h(e,this.props.children)},componentDidMount:function(){var e=u.getID(this.getDOMNode());f[e]=this},componentWillUnmount:function(){var e=this.getDOMNode(),t=u.getID(e);delete f[t]},componentDidUpdate:function(e,t,n){var a=this.getDOMNode();null!=this.props.checked&&o.setValueForProperty(a,"checked",this.props.checked||!1);var r=i.getValue(this);null!=r&&o.setValueForProperty(a,"value",""+r)},_handleChange:function(e){var t,r=i.getOnChange(this);r&&(t=r.call(this,e)),p.asap(a,this);var o=this.props.name;if("radio"===this.props.type&&null!=o){for(var s=this.getDOMNode(),l=s;l.parentNode;)l=l.parentNode;for(var c=l.querySelectorAll("input[name="+JSON.stringify(""+o)+'][type="radio"]'),m=0,h=c.length;h>m;m++){var g=c[m];if(g!==s&&g.form===s.form){var v=u.getID(g);"production"!==n.env.NODE_ENV?d(v,"ReactDOMInput: Mixing React and non-React radio inputs with the same `name` is not supported."):d(v);var E=f[v];"production"!==n.env.NODE_ENV?d(E,"ReactDOMInput: Unknown radio button ID %s.",v):d(E),p.asap(a,E)}}}return t}});t.exports=g}).call(this,e("g5I+bs"))},{"./AutoFocusMixin":109,"./DOMPropertyOperations":118,"./LinkedValueUtils":131,"./Object.assign":134,"./ReactBrowserComponentMixin":137,"./ReactClass":141,"./ReactElement":165,"./ReactMount":178,"./ReactUpdates":195,"./invariant":243,"g5I+bs":70}],156:[function(e,t,n){(function(n){"use strict";var a=e("./ReactBrowserComponentMixin"),r=e("./ReactClass"),o=e("./ReactElement"),i=e("./warning"),s=o.createFactory("option"),l=r.createClass({displayName:"ReactDOMOption",tagName:"OPTION",mixins:[a],componentWillMount:function(){"production"!==n.env.NODE_ENV&&("production"!==n.env.NODE_ENV?i(null==this.props.selected,"Use the `defaultValue` or `value` props on <select> instead of setting `selected` on <option>."):null)},render:function(){return s(this.props,this.props.children)}});t.exports=l}).call(this,e("g5I+bs"))},{"./ReactBrowserComponentMixin":137,"./ReactClass":141,"./ReactElement":165,"./warning":262,"g5I+bs":70}],157:[function(e,t,n){"use strict";function a(){if(this._pendingUpdate){this._pendingUpdate=!1;var e=s.getValue(this);null!=e&&this.isMounted()&&o(this,e)}}function r(e,t,n){if(null==e[t])return null;if(e.multiple){if(!Array.isArray(e[t]))return new Error("The `"+t+"` prop supplied to <select> must be an array if `multiple` is true.")}else if(Array.isArray(e[t]))return new Error("The `"+t+"` prop supplied to <select> must be a scalar value if `multiple` is false.")}function o(e,t){var n,a,r,o=e.getDOMNode().options;if(e.props.multiple){for(n={},a=0,r=t.length;r>a;a++)n[""+t[a]]=!0;for(a=0,r=o.length;r>a;a++){var i=n.hasOwnProperty(o[a].value);o[a].selected!==i&&(o[a].selected=i)}}else{for(n=""+t,a=0,r=o.length;r>a;a++)if(o[a].value===n)return void(o[a].selected=!0);o.length&&(o[0].selected=!0)}}var i=e("./AutoFocusMixin"),s=e("./LinkedValueUtils"),l=e("./ReactBrowserComponentMixin"),c=e("./ReactClass"),u=e("./ReactElement"),p=e("./ReactUpdates"),m=e("./Object.assign"),d=u.createFactory("select"),h=c.createClass({displayName:"ReactDOMSelect",tagName:"SELECT",mixins:[i,s.Mixin,l],propTypes:{defaultValue:r,value:r},render:function(){var e=m({},this.props);return e.onChange=this._handleChange,e.value=null,d(e,this.props.children)},componentWillMount:function(){this._pendingUpdate=!1},componentDidMount:function(){var e=s.getValue(this);null!=e?o(this,e):null!=this.props.defaultValue&&o(this,this.props.defaultValue)},componentDidUpdate:function(e){var t=s.getValue(this);null!=t?(this._pendingUpdate=!1,o(this,t)):!e.multiple!=!this.props.multiple&&(null!=this.props.defaultValue?o(this,this.props.defaultValue):o(this,this.props.multiple?[]:""))},_handleChange:function(e){var t,n=s.getOnChange(this);return n&&(t=n.call(this,e)),this._pendingUpdate=!0,p.asap(a,this),t}});t.exports=h},{"./AutoFocusMixin":109,"./LinkedValueUtils":131,"./Object.assign":134,"./ReactBrowserComponentMixin":137,"./ReactClass":141,"./ReactElement":165,"./ReactUpdates":195}],158:[function(e,t,n){"use strict";function a(e,t,n,a){return e===n&&t===a}function r(e){var t=document.selection,n=t.createRange(),a=n.text.length,r=n.duplicate();r.moveToElementText(e),r.setEndPoint("EndToStart",n);var o=r.text.length,i=o+a;return{start:o,end:i}}function o(e){var t=window.getSelection&&window.getSelection();if(!t||0===t.rangeCount)return null;var n=t.anchorNode,r=t.anchorOffset,o=t.focusNode,i=t.focusOffset,s=t.getRangeAt(0),l=a(t.anchorNode,t.anchorOffset,t.focusNode,t.focusOffset),c=l?0:s.toString().length,u=s.cloneRange();u.selectNodeContents(e),u.setEnd(s.startContainer,s.startOffset);var p=a(u.startContainer,u.startOffset,u.endContainer,u.endOffset),m=p?0:u.toString().length,d=m+c,h=document.createRange();h.setStart(n,r),h.setEnd(o,i);var f=h.collapsed;return{start:f?d:m,end:f?m:d}}function i(e,t){var n,a,r=document.selection.createRange().duplicate();"undefined"==typeof t.end?(n=t.start,a=n):t.start>t.end?(n=t.end,a=t.start):(n=t.start,a=t.end),r.moveToElementText(e),r.moveStart("character",n),r.setEndPoint("EndToStart",r),r.moveEnd("character",a-n),r.select()}function s(e,t){if(window.getSelection){var n=window.getSelection(),a=e[u()].length,r=Math.min(t.start,a),o="undefined"==typeof t.end?r:Math.min(t.end,a);if(!n.extend&&r>o){var i=o;o=r,r=i}var s=c(e,r),l=c(e,o);if(s&&l){var p=document.createRange();p.setStart(s.node,s.offset),n.removeAllRanges(),r>o?(n.addRange(p),n.extend(l.node,l.offset)):(p.setEnd(l.node,l.offset),n.addRange(p))}}}var l=e("./ExecutionEnvironment"),c=e("./getNodeForCharacterOffset"),u=e("./getTextContentAccessor"),p=l.canUseDOM&&"selection"in document&&!("getSelection"in window),m={getOffsets:p?r:o,setOffsets:p?i:s};t.exports=m},{"./ExecutionEnvironment":128,"./getNodeForCharacterOffset":236,"./getTextContentAccessor":238}],159:[function(e,t,n){"use strict";var a=e("./DOMPropertyOperations"),r=e("./ReactComponentBrowserEnvironment"),o=e("./ReactDOMComponent"),i=e("./Object.assign"),s=e("./escapeTextContentForBrowser"),l=function(e){};i(l.prototype,{construct:function(e){this._currentElement=e,this._stringText=""+e,this._rootNodeID=null,this._mountIndex=0},mountComponent:function(e,t,n){this._rootNodeID=e;var r=s(this._stringText);return t.renderToStaticMarkup?r:"<span "+a.createMarkupForID(e)+">"+r+"</span>"},receiveComponent:function(e,t){if(e!==this._currentElement){this._currentElement=e;var n=""+e;n!==this._stringText&&(this._stringText=n,o.BackendIDOperations.updateTextContentByID(this._rootNodeID,n))}},unmountComponent:function(){r.unmountIDFromEnvironment(this._rootNodeID)}}),t.exports=l},{"./DOMPropertyOperations":118,"./Object.assign":134,"./ReactComponentBrowserEnvironment":143,"./ReactDOMComponent":150,"./escapeTextContentForBrowser":224}],160:[function(e,t,n){(function(n){"use strict";function a(){this.isMounted()&&this.forceUpdate()}var r=e("./AutoFocusMixin"),o=e("./DOMPropertyOperations"),i=e("./LinkedValueUtils"),s=e("./ReactBrowserComponentMixin"),l=e("./ReactClass"),c=e("./ReactElement"),u=e("./ReactUpdates"),p=e("./Object.assign"),m=e("./invariant"),d=e("./warning"),h=c.createFactory("textarea"),f=l.createClass({displayName:"ReactDOMTextarea",tagName:"TEXTAREA",mixins:[r,i.Mixin,s],getInitialState:function(){var e=this.props.defaultValue,t=this.props.children;null!=t&&("production"!==n.env.NODE_ENV&&("production"!==n.env.NODE_ENV?d(!1,"Use the `defaultValue` or `value` props instead of setting children on <textarea>."):null),"production"!==n.env.NODE_ENV?m(null==e,"If you supply `defaultValue` on a <textarea>, do not pass children."):m(null==e),Array.isArray(t)&&("production"!==n.env.NODE_ENV?m(t.length<=1,"<textarea> can only have at most one child."):m(t.length<=1),t=t[0]),e=""+t),null==e&&(e="");var a=i.getValue(this);return{initialValue:""+(null!=a?a:e)}},render:function(){var e=p({},this.props);return"production"!==n.env.NODE_ENV?m(null==e.dangerouslySetInnerHTML,"`dangerouslySetInnerHTML` does not make sense on <textarea>."):m(null==e.dangerouslySetInnerHTML),e.defaultValue=null,e.value=null,e.onChange=this._handleChange,h(e,this.state.initialValue)},componentDidUpdate:function(e,t,n){var a=i.getValue(this);if(null!=a){var r=this.getDOMNode();o.setValueForProperty(r,"value",""+a)}},_handleChange:function(e){var t,n=i.getOnChange(this);return n&&(t=n.call(this,e)),u.asap(a,this),t}});t.exports=f}).call(this,e("g5I+bs"))},{"./AutoFocusMixin":109,"./DOMPropertyOperations":118,"./LinkedValueUtils":131,"./Object.assign":134,"./ReactBrowserComponentMixin":137,"./ReactClass":141,"./ReactElement":165,"./ReactUpdates":195,"./invariant":243,"./warning":262,"g5I+bs":70}],161:[function(e,t,n){"use strict";function a(){this.reinitializeTransaction()}var r=e("./ReactUpdates"),o=e("./Transaction"),i=e("./Object.assign"),s=e("./emptyFunction"),l={initialize:s,close:function(){m.isBatchingUpdates=!1}},c={initialize:s,close:r.flushBatchedUpdates.bind(r)},u=[c,l];i(a.prototype,o.Mixin,{getTransactionWrappers:function(){return u}});var p=new a,m={isBatchingUpdates:!1,batchedUpdates:function(e,t,n,a,r){var o=m.isBatchingUpdates;m.isBatchingUpdates=!0,o?e(t,n,a,r):p.perform(e,null,t,n,a,r)}};t.exports=m},{"./Object.assign":134,"./ReactUpdates":195,"./Transaction":211,"./emptyFunction":222}],162:[function(e,t,n){(function(n){"use strict";function a(e){return h.createClass({tagName:e.toUpperCase(),render:function(){return new j(e,null,null,null,null,this.props)}})}function r(){if(D.EventEmitter.injectReactEventListener(S),D.EventPluginHub.injectEventPluginOrder(l),D.EventPluginHub.injectInstanceHandle(P),D.EventPluginHub.injectMount(O),D.EventPluginHub.injectEventPluginsByName({SimpleEventPlugin:U,EnterLeaveEventPlugin:c,ChangeEventPlugin:i,MobileSafariClickEventPlugin:m,SelectEventPlugin:M,BeforeInputEventPlugin:o}),D.NativeComponent.injectGenericComponentClass(v),D.NativeComponent.injectTextComponentClass(I),D.NativeComponent.injectAutoWrapper(a),D.Class.injectMixin(d),D.NativeComponent.injectComponentClasses({button:E,form:y,iframe:x,img:b,input:w,option:C,select:_,textarea:R,html:A("html"),head:A("head"),body:A("body")
}),D.DOMProperty.injectDOMPropertyConfig(p),D.DOMProperty.injectDOMPropertyConfig(L),D.EmptyComponent.injectEmptyComponent("noscript"),D.Updates.injectReconcileTransaction(k),D.Updates.injectBatchingStrategy(g),D.RootIndex.injectCreateReactRootIndex(u.canUseDOM?s.createReactRootIndex:T.createReactRootIndex),D.Component.injectEnvironment(f),D.DOMComponent.injectIDOperations(N),"production"!==n.env.NODE_ENV){var t=u.canUseDOM&&window.location.href||"";if(/[?&]react_perf\b/.test(t)){var r=e("./ReactDefaultPerf");r.start()}}}var o=e("./BeforeInputEventPlugin"),i=e("./ChangeEventPlugin"),s=e("./ClientReactRootIndex"),l=e("./DefaultEventPluginOrder"),c=e("./EnterLeaveEventPlugin"),u=e("./ExecutionEnvironment"),p=e("./HTMLDOMPropertyConfig"),m=e("./MobileSafariClickEventPlugin"),d=e("./ReactBrowserComponentMixin"),h=e("./ReactClass"),f=e("./ReactComponentBrowserEnvironment"),g=e("./ReactDefaultBatchingStrategy"),v=e("./ReactDOMComponent"),E=e("./ReactDOMButton"),y=e("./ReactDOMForm"),b=e("./ReactDOMImg"),N=e("./ReactDOMIDOperations"),x=e("./ReactDOMIframe"),w=e("./ReactDOMInput"),C=e("./ReactDOMOption"),_=e("./ReactDOMSelect"),R=e("./ReactDOMTextarea"),I=e("./ReactDOMTextComponent"),j=e("./ReactElement"),S=e("./ReactEventListener"),D=e("./ReactInjection"),P=e("./ReactInstanceHandles"),O=e("./ReactMount"),k=e("./ReactReconcileTransaction"),M=e("./SelectEventPlugin"),T=e("./ServerReactRootIndex"),U=e("./SimpleEventPlugin"),L=e("./SVGDOMPropertyConfig"),A=e("./createFullPageComponent");t.exports={inject:r}}).call(this,e("g5I+bs"))},{"./BeforeInputEventPlugin":110,"./ChangeEventPlugin":114,"./ClientReactRootIndex":115,"./DefaultEventPluginOrder":120,"./EnterLeaveEventPlugin":121,"./ExecutionEnvironment":128,"./HTMLDOMPropertyConfig":130,"./MobileSafariClickEventPlugin":133,"./ReactBrowserComponentMixin":137,"./ReactClass":141,"./ReactComponentBrowserEnvironment":143,"./ReactDOMButton":149,"./ReactDOMComponent":150,"./ReactDOMForm":151,"./ReactDOMIDOperations":152,"./ReactDOMIframe":153,"./ReactDOMImg":154,"./ReactDOMInput":155,"./ReactDOMOption":156,"./ReactDOMSelect":157,"./ReactDOMTextComponent":159,"./ReactDOMTextarea":160,"./ReactDefaultBatchingStrategy":161,"./ReactDefaultPerf":163,"./ReactElement":165,"./ReactEventListener":170,"./ReactInjection":172,"./ReactInstanceHandles":174,"./ReactMount":178,"./ReactReconcileTransaction":188,"./SVGDOMPropertyConfig":196,"./SelectEventPlugin":197,"./ServerReactRootIndex":198,"./SimpleEventPlugin":199,"./createFullPageComponent":219,"g5I+bs":70}],163:[function(e,t,n){"use strict";function a(e){return Math.floor(100*e)/100}function r(e,t,n){e[t]=(e[t]||0)+n}var o=e("./DOMProperty"),i=e("./ReactDefaultPerfAnalysis"),s=e("./ReactMount"),l=e("./ReactPerf"),c=e("./performanceNow"),u={_allMeasurements:[],_mountStack:[0],_injected:!1,start:function(){u._injected||l.injection.injectMeasure(u.measure),u._allMeasurements.length=0,l.enableMeasure=!0},stop:function(){l.enableMeasure=!1},getLastMeasurements:function(){return u._allMeasurements},printExclusive:function(e){e=e||u._allMeasurements;var t=i.getExclusiveSummary(e);console.table(t.map(function(e){return{"Component class name":e.componentName,"Total inclusive time (ms)":a(e.inclusive),"Exclusive mount time (ms)":a(e.exclusive),"Exclusive render time (ms)":a(e.render),"Mount time per instance (ms)":a(e.exclusive/e.count),"Render time per instance (ms)":a(e.render/e.count),Instances:e.count}}))},printInclusive:function(e){e=e||u._allMeasurements;var t=i.getInclusiveSummary(e);console.table(t.map(function(e){return{"Owner > component":e.componentName,"Inclusive time (ms)":a(e.time),Instances:e.count}})),console.log("Total time:",i.getTotalTime(e).toFixed(2)+" ms")},getMeasurementsSummaryMap:function(e){var t=i.getInclusiveSummary(e,!0);return t.map(function(e){return{"Owner > component":e.componentName,"Wasted time (ms)":e.time,Instances:e.count}})},printWasted:function(e){e=e||u._allMeasurements,console.table(u.getMeasurementsSummaryMap(e)),console.log("Total time:",i.getTotalTime(e).toFixed(2)+" ms")},printDOM:function(e){e=e||u._allMeasurements;var t=i.getDOMSummary(e);console.table(t.map(function(e){var t={};return t[o.ID_ATTRIBUTE_NAME]=e.id,t.type=e.type,t.args=JSON.stringify(e.args),t})),console.log("Total time:",i.getTotalTime(e).toFixed(2)+" ms")},_recordWrite:function(e,t,n,a){var r=u._allMeasurements[u._allMeasurements.length-1].writes;r[e]=r[e]||[],r[e].push({type:t,time:n,args:a})},measure:function(e,t,n){return function(){for(var a=[],o=0,i=arguments.length;i>o;o++)a.push(arguments[o]);var l,p,m;if("_renderNewRootComponent"===t||"flushBatchedUpdates"===t)return u._allMeasurements.push({exclusive:{},inclusive:{},render:{},counts:{},writes:{},displayNames:{},totalTime:0}),m=c(),p=n.apply(this,a),u._allMeasurements[u._allMeasurements.length-1].totalTime=c()-m,p;if("_mountImageIntoNode"===t||"ReactDOMIDOperations"===e){if(m=c(),p=n.apply(this,a),l=c()-m,"_mountImageIntoNode"===t){var d=s.getID(a[1]);u._recordWrite(d,t,l,a[0])}else"dangerouslyProcessChildrenUpdates"===t?a[0].forEach(function(e){var t={};null!==e.fromIndex&&(t.fromIndex=e.fromIndex),null!==e.toIndex&&(t.toIndex=e.toIndex),null!==e.textContent&&(t.textContent=e.textContent),null!==e.markupIndex&&(t.markup=a[1][e.markupIndex]),u._recordWrite(e.parentID,e.type,l,t)}):u._recordWrite(a[0],t,l,Array.prototype.slice.call(a,1));return p}if("ReactCompositeComponent"!==e||"mountComponent"!==t&&"updateComponent"!==t&&"_renderValidatedComponent"!==t)return n.apply(this,a);if("string"==typeof this._currentElement.type)return n.apply(this,a);var h="mountComponent"===t?a[0]:this._rootNodeID,f="_renderValidatedComponent"===t,g="mountComponent"===t,v=u._mountStack,E=u._allMeasurements[u._allMeasurements.length-1];if(f?r(E.counts,h,1):g&&v.push(0),m=c(),p=n.apply(this,a),l=c()-m,f)r(E.render,h,l);else if(g){var y=v.pop();v[v.length-1]+=l,r(E.exclusive,h,l-y),r(E.inclusive,h,l)}else r(E.inclusive,h,l);return E.displayNames[h]={current:this.getName(),owner:this._currentElement._owner?this._currentElement._owner.getName():"<root>"},p}}};t.exports=u},{"./DOMProperty":117,"./ReactDefaultPerfAnalysis":164,"./ReactMount":178,"./ReactPerf":183,"./performanceNow":254}],164:[function(e,t,n){function a(e){for(var t=0,n=0;n<e.length;n++){var a=e[n];t+=a.totalTime}return t}function r(e){for(var t=[],n=0;n<e.length;n++){var a,r=e[n];for(a in r.writes)r.writes[a].forEach(function(e){t.push({id:a,type:u[e.type]||e.type,args:e.args})})}return t}function o(e){for(var t,n={},a=0;a<e.length;a++){var r=e[a],o=l({},r.exclusive,r.inclusive);for(var i in o)t=r.displayNames[i].current,n[t]=n[t]||{componentName:t,inclusive:0,exclusive:0,render:0,count:0},r.render[i]&&(n[t].render+=r.render[i]),r.exclusive[i]&&(n[t].exclusive+=r.exclusive[i]),r.inclusive[i]&&(n[t].inclusive+=r.inclusive[i]),r.counts[i]&&(n[t].count+=r.counts[i])}var s=[];for(t in n)n[t].exclusive>=c&&s.push(n[t]);return s.sort(function(e,t){return t.exclusive-e.exclusive}),s}function i(e,t){for(var n,a={},r=0;r<e.length;r++){var o,i=e[r],u=l({},i.exclusive,i.inclusive);t&&(o=s(i));for(var p in u)if(!t||o[p]){var m=i.displayNames[p];n=m.owner+" > "+m.current,a[n]=a[n]||{componentName:n,time:0,count:0},i.inclusive[p]&&(a[n].time+=i.inclusive[p]),i.counts[p]&&(a[n].count+=i.counts[p])}}var d=[];for(n in a)a[n].time>=c&&d.push(a[n]);return d.sort(function(e,t){return t.time-e.time}),d}function s(e){var t={},n=Object.keys(e.writes),a=l({},e.exclusive,e.inclusive);for(var r in a){for(var o=!1,i=0;i<n.length;i++)if(0===n[i].indexOf(r)){o=!0;break}!o&&e.counts[r]>0&&(t[r]=!0)}return t}var l=e("./Object.assign"),c=1.2,u={_mountImageIntoNode:"set innerHTML",INSERT_MARKUP:"set innerHTML",MOVE_EXISTING:"move",REMOVE_NODE:"remove",TEXT_CONTENT:"set textContent",updatePropertyByID:"update attribute",deletePropertyByID:"delete attribute",updateStylesByID:"update styles",updateInnerHTMLByID:"set innerHTML",dangerouslyReplaceNodeWithMarkupByID:"replace"},p={getExclusiveSummary:o,getInclusiveSummary:i,getDOMSummary:r,getTotalTime:a};t.exports=p},{"./Object.assign":134}],165:[function(e,t,n){(function(n){"use strict";function a(e,t){Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:function(){return this._store?this._store[t]:null},set:function(e){"production"!==n.env.NODE_ENV?l(!1,"Don't set the %s property of the React element. Instead, specify the correct value when initially creating the element.",t):null,this._store[t]=e}})}function r(e){try{var t={props:!0};for(var n in t)a(e,n);u=!0}catch(r){}}var o=e("./ReactContext"),i=e("./ReactCurrentOwner"),s=e("./Object.assign"),l=e("./warning"),c={key:!0,ref:!0},u=!1,p=function(e,t,a,r,o,i){if(this.type=e,this.key=t,this.ref=a,this._owner=r,this._context=o,"production"!==n.env.NODE_ENV){this._store={props:i,originalProps:s({},i)};try{Object.defineProperty(this._store,"validated",{configurable:!1,enumerable:!1,writable:!0})}catch(l){}if(this._store.validated=!1,u)return void Object.freeze(this)}this.props=i};p.prototype={_isReactElement:!0},"production"!==n.env.NODE_ENV&&r(p.prototype),p.createElement=function(e,t,n){var a,r={},s=null,l=null;if(null!=t){l=void 0===t.ref?null:t.ref,s=void 0===t.key?null:""+t.key;for(a in t)t.hasOwnProperty(a)&&!c.hasOwnProperty(a)&&(r[a]=t[a])}var u=arguments.length-2;if(1===u)r.children=n;else if(u>1){for(var m=Array(u),d=0;u>d;d++)m[d]=arguments[d+2];r.children=m}if(e&&e.defaultProps){var h=e.defaultProps;for(a in h)"undefined"==typeof r[a]&&(r[a]=h[a])}return new p(e,s,l,i.current,o.current,r)},p.createFactory=function(e){var t=p.createElement.bind(null,e);return t.type=e,t},p.cloneAndReplaceProps=function(e,t){var a=new p(e.type,e.key,e.ref,e._owner,e._context,t);return"production"!==n.env.NODE_ENV&&(a._store.validated=e._store.validated),a},p.cloneElement=function(e,t,n){var a,r=s({},e.props),o=e.key,l=e.ref,u=e._owner;if(null!=t){void 0!==t.ref&&(l=t.ref,u=i.current),void 0!==t.key&&(o=""+t.key);for(a in t)t.hasOwnProperty(a)&&!c.hasOwnProperty(a)&&(r[a]=t[a])}var m=arguments.length-2;if(1===m)r.children=n;else if(m>1){for(var d=Array(m),h=0;m>h;h++)d[h]=arguments[h+2];r.children=d}return new p(e.type,o,l,u,e._context,r)},p.isValidElement=function(e){var t=!(!e||!e._isReactElement);return t},t.exports=p}).call(this,e("g5I+bs"))},{"./Object.assign":134,"./ReactContext":146,"./ReactCurrentOwner":147,"./warning":262,"g5I+bs":70}],166:[function(e,t,n){(function(n){"use strict";function a(){if(y.current){var e=y.current.getName();if(e)return" Check the render method of `"+e+"`."}return""}function r(e){var t=e&&e.getPublicInstance();if(!t)return void 0;var n=t.constructor;return n?n.displayName||n.name||void 0:void 0}function o(){var e=y.current;return e&&r(e)||void 0}function i(e,t){e._store.validated||null!=e.key||(e._store.validated=!0,l('Each child in an array or iterator should have a unique "key" prop.',e,t))}function s(e,t,n){R.test(e)&&l("Child objects should have non-numeric keys so ordering is preserved.",t,n)}function l(e,t,a){var i=o(),s="string"==typeof a?a:a.displayName||a.name,l=i||s,c=C[e]||(C[e]={});if(!c.hasOwnProperty(l)){c[l]=!0;var u=i?" Check the render method of "+i+".":s?" Check the React.render call using <"+s+">.":"",p="";if(t&&t._owner&&t._owner!==y.current){var m=r(t._owner);p=" It was passed a child from "+m+"."}"production"!==n.env.NODE_ENV?w(!1,e+"%s%s See https://fb.me/react-warning-keys for more information.",u,p):null}}function c(e,t){if(Array.isArray(e))for(var n=0;n<e.length;n++){var a=e[n];f.isValidElement(a)&&i(a,t)}else if(f.isValidElement(e))e._store.validated=!0;else if(e){var r=N(e);if(r){if(r!==e.entries)for(var o,l=r.call(e);!(o=l.next()).done;)f.isValidElement(o.value)&&i(o.value,t)}else if("object"==typeof e){var c=g.extractIfFragment(e);for(var u in c)c.hasOwnProperty(u)&&s(u,c[u],t)}}}function u(e,t,r,o){for(var i in t)if(t.hasOwnProperty(i)){var s;try{"production"!==n.env.NODE_ENV?x("function"==typeof t[i],"%s: %s type `%s` is invalid; it must be a function, usually from React.PropTypes.",e||"React class",E[o],i):x("function"==typeof t[i]),s=t[i](r,i,e,o)}catch(l){s=l}if(s instanceof Error&&!(s.message in _)){_[s.message]=!0;var c=a(this);"production"!==n.env.NODE_ENV?w(!1,"Failed propType: %s%s",s.message,c):null}}}function p(e,t){var a=t.type,r="string"==typeof a?a:a.displayName,o=t._owner?t._owner.getPublicInstance().constructor.displayName:null,i=e+"|"+r+"|"+o;if(!I.hasOwnProperty(i)){I[i]=!0;var s="";r&&(s=" <"+r+" />");var l="";o&&(l=" The element was created by "+o+"."),"production"!==n.env.NODE_ENV?w(!1,"Don't set .props.%s of the React component%s. Instead, specify the correct value when initially creating the element or use React.cloneElement to make a new element with updated props.%s",e,s,l):null}}function m(e,t){return e!==e?t!==t:0===e&&0===t?1/e===1/t:e===t}function d(e){if(e._store){var t=e._store.originalProps,n=e.props;for(var a in n)n.hasOwnProperty(a)&&(t.hasOwnProperty(a)&&m(t[a],n[a])||(p(a,e),t[a]=n[a]))}}function h(e){if(null!=e.type){var t=b.getComponentClassForElement(e),a=t.displayName||t.name;t.propTypes&&u(a,t.propTypes,e.props,v.prop),"function"==typeof t.getDefaultProps&&("production"!==n.env.NODE_ENV?w(t.getDefaultProps.isReactClassApproved,"getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead."):null)}}var f=e("./ReactElement"),g=e("./ReactFragment"),v=e("./ReactPropTypeLocations"),E=e("./ReactPropTypeLocationNames"),y=e("./ReactCurrentOwner"),b=e("./ReactNativeComponent"),N=e("./getIteratorFn"),x=e("./invariant"),w=e("./warning"),C={},_={},R=/^\d+$/,I={},j={checkAndWarnForMutatedProps:d,createElement:function(e,t,a){"production"!==n.env.NODE_ENV?w(null!=e,"React.createElement: type should not be null or undefined. It should be a string (for DOM elements) or a ReactClass (for composite components)."):null;var r=f.createElement.apply(this,arguments);if(null==r)return r;for(var o=2;o<arguments.length;o++)c(arguments[o],e);return h(r),r},createFactory:function(e){var t=j.createElement.bind(null,e);if(t.type=e,"production"!==n.env.NODE_ENV)try{Object.defineProperty(t,"type",{enumerable:!1,get:function(){return"production"!==n.env.NODE_ENV?w(!1,"Factory.type is deprecated. Access the class directly before passing it to createFactory."):null,Object.defineProperty(this,"type",{value:e}),e}})}catch(a){}return t},cloneElement:function(e,t,n){for(var a=f.cloneElement.apply(this,arguments),r=2;r<arguments.length;r++)c(arguments[r],a.type);return h(a),a}};t.exports=j}).call(this,e("g5I+bs"))},{"./ReactCurrentOwner":147,"./ReactElement":165,"./ReactFragment":171,"./ReactNativeComponent":181,"./ReactPropTypeLocationNames":184,"./ReactPropTypeLocations":185,"./getIteratorFn":234,"./invariant":243,"./warning":262,"g5I+bs":70}],167:[function(e,t,n){(function(n){"use strict";function a(e){u[e]=!0}function r(e){delete u[e]}function o(e){return!!u[e]}var i,s=e("./ReactElement"),l=e("./ReactInstanceMap"),c=e("./invariant"),u={},p={injectEmptyComponent:function(e){i=s.createFactory(e)}},m=function(){};m.prototype.componentDidMount=function(){var e=l.get(this);e&&a(e._rootNodeID)},m.prototype.componentWillUnmount=function(){var e=l.get(this);e&&r(e._rootNodeID)},m.prototype.render=function(){return"production"!==n.env.NODE_ENV?c(i,"Trying to return null from a render, but no null placeholder component was injected."):c(i),i()};var d=s.createElement(m),h={emptyElement:d,injection:p,isNullComponentID:o};t.exports=h}).call(this,e("g5I+bs"))},{"./ReactElement":165,"./ReactInstanceMap":175,"./invariant":243,"g5I+bs":70}],168:[function(e,t,n){"use strict";var a={guard:function(e,t){return e}};t.exports=a},{}],169:[function(e,t,n){"use strict";function a(e){r.enqueueEvents(e),r.processEventQueue()}var r=e("./EventPluginHub"),o={handleTopLevel:function(e,t,n,o){var i=r.extractEvents(e,t,n,o);a(i)}};t.exports=o},{"./EventPluginHub":124}],170:[function(e,t,n){"use strict";function a(e){var t=p.getID(e),n=u.getReactRootIDFromNodeID(t),a=p.findReactContainerForID(n),r=p.getFirstReactDOM(a);return r}function r(e,t){this.topLevelType=e,this.nativeEvent=t,this.ancestors=[]}function o(e){for(var t=p.getFirstReactDOM(h(e.nativeEvent))||window,n=t;n;)e.ancestors.push(n),n=a(n);for(var r=0,o=e.ancestors.length;o>r;r++){t=e.ancestors[r];var i=p.getID(t)||"";g._handleTopLevel(e.topLevelType,t,i,e.nativeEvent)}}function i(e){var t=f(window);e(t)}var s=e("./EventListener"),l=e("./ExecutionEnvironment"),c=e("./PooledClass"),u=e("./ReactInstanceHandles"),p=e("./ReactMount"),m=e("./ReactUpdates"),d=e("./Object.assign"),h=e("./getEventTarget"),f=e("./getUnboundedScrollPosition");d(r.prototype,{destructor:function(){this.topLevelType=null,this.nativeEvent=null,this.ancestors.length=0}}),c.addPoolingTo(r,c.twoArgumentPooler);var g={_enabled:!0,_handleTopLevel:null,WINDOW_HANDLE:l.canUseDOM?window:null,setHandleTopLevel:function(e){g._handleTopLevel=e},setEnabled:function(e){g._enabled=!!e},isEnabled:function(){return g._enabled},trapBubbledEvent:function(e,t,n){var a=n;return a?s.listen(a,t,g.dispatchEvent.bind(null,e)):null},trapCapturedEvent:function(e,t,n){var a=n;return a?s.capture(a,t,g.dispatchEvent.bind(null,e)):null},monitorScrollValue:function(e){var t=i.bind(null,e);s.listen(window,"scroll",t)},dispatchEvent:function(e,t){if(g._enabled){var n=r.getPooled(e,t);try{m.batchedUpdates(o,n)}finally{r.release(n)}}}};t.exports=g},{"./EventListener":123,"./ExecutionEnvironment":128,"./Object.assign":134,"./PooledClass":135,"./ReactInstanceHandles":174,"./ReactMount":178,"./ReactUpdates":195,"./getEventTarget":233,"./getUnboundedScrollPosition":239}],171:[function(e,t,n){(function(n){"use strict";var a=e("./ReactElement"),r=e("./warning");if("production"!==n.env.NODE_ENV){var o="_reactFragment",i="_reactDidWarn",s=!1;try{var l=function(){return 1};Object.defineProperty({},o,{enumerable:!1,value:!0}),Object.defineProperty({},"key",{enumerable:!0,get:l}),s=!0}catch(c){}var u=function(e,t){Object.defineProperty(e,t,{enumerable:!0,get:function(){return"production"!==n.env.NODE_ENV?r(this[i],"A ReactFragment is an opaque type. Accessing any of its properties is deprecated. Pass it to one of the React.Children helpers."):null,this[i]=!0,this[o][t]},set:function(e){"production"!==n.env.NODE_ENV?r(this[i],"A ReactFragment is an immutable opaque type. Mutating its properties is deprecated."):null,this[i]=!0,this[o][t]=e}})},p={},m=function(e){var t="";for(var n in e)t+=n+":"+typeof e[n]+",";var a=!!p[t];return p[t]=!0,a}}var d={create:function(e){if("production"!==n.env.NODE_ENV){if("object"!=typeof e||!e||Array.isArray(e))return"production"!==n.env.NODE_ENV?r(!1,"React.addons.createFragment only accepts a single object.",e):null,e;if(a.isValidElement(e))return"production"!==n.env.NODE_ENV?r(!1,"React.addons.createFragment does not accept a ReactElement without a wrapper object."):null,e;if(s){var t={};Object.defineProperty(t,o,{enumerable:!1,value:e}),Object.defineProperty(t,i,{writable:!0,enumerable:!1,value:!1});for(var l in e)u(t,l);return Object.preventExtensions(t),t}}return e},extract:function(e){return"production"!==n.env.NODE_ENV&&s?e[o]?e[o]:("production"!==n.env.NODE_ENV?r(m(e),"Any use of a keyed object should be wrapped in React.addons.createFragment(object) before being passed as a child."):null,e):e},extractIfFragment:function(e){if("production"!==n.env.NODE_ENV&&s){if(e[o])return e[o];for(var t in e)if(e.hasOwnProperty(t)&&a.isValidElement(e[t]))return d.extract(e)}return e}};t.exports=d}).call(this,e("g5I+bs"))},{"./ReactElement":165,"./warning":262,"g5I+bs":70}],172:[function(e,t,n){"use strict";var a=e("./DOMProperty"),r=e("./EventPluginHub"),o=e("./ReactComponentEnvironment"),i=e("./ReactClass"),s=e("./ReactEmptyComponent"),l=e("./ReactBrowserEventEmitter"),c=e("./ReactNativeComponent"),u=e("./ReactDOMComponent"),p=e("./ReactPerf"),m=e("./ReactRootIndex"),d=e("./ReactUpdates"),h={Component:o.injection,Class:i.injection,DOMComponent:u.injection,DOMProperty:a.injection,EmptyComponent:s.injection,EventPluginHub:r.injection,EventEmitter:l.injection,NativeComponent:c.injection,Perf:p.injection,RootIndex:m.injection,Updates:d.injection};t.exports=h},{"./DOMProperty":117,"./EventPluginHub":124,"./ReactBrowserEventEmitter":138,"./ReactClass":141,"./ReactComponentEnvironment":144,"./ReactDOMComponent":150,"./ReactEmptyComponent":167,"./ReactNativeComponent":181,"./ReactPerf":183,"./ReactRootIndex":191,"./ReactUpdates":195}],173:[function(e,t,n){"use strict";function a(e){return o(document.documentElement,e)}var r=e("./ReactDOMSelection"),o=e("./containsNode"),i=e("./focusNode"),s=e("./getActiveElement"),l={hasSelectionCapabilities:function(e){return e&&("INPUT"===e.nodeName&&"text"===e.type||"TEXTAREA"===e.nodeName||"true"===e.contentEditable)},getSelectionInformation:function(){var e=s();return{focusedElem:e,selectionRange:l.hasSelectionCapabilities(e)?l.getSelection(e):null}},restoreSelection:function(e){var t=s(),n=e.focusedElem,r=e.selectionRange;t!==n&&a(n)&&(l.hasSelectionCapabilities(n)&&l.setSelection(n,r),i(n))},getSelection:function(e){var t;if("selectionStart"in e)t={start:e.selectionStart,end:e.selectionEnd};else if(document.selection&&"INPUT"===e.nodeName){var n=document.selection.createRange();n.parentElement()===e&&(t={start:-n.moveStart("character",-e.value.length),end:-n.moveEnd("character",-e.value.length)})}else t=r.getOffsets(e);return t||{start:0,end:0}},setSelection:function(e,t){var n=t.start,a=t.end;if("undefined"==typeof a&&(a=n),"selectionStart"in e)e.selectionStart=n,e.selectionEnd=Math.min(a,e.value.length);else if(document.selection&&"INPUT"===e.nodeName){var o=e.createTextRange();o.collapse(!0),o.moveStart("character",n),o.moveEnd("character",a-n),o.select()}else r.setOffsets(e,t)}};t.exports=l},{"./ReactDOMSelection":158,"./containsNode":217,"./focusNode":227,"./getActiveElement":229}],174:[function(e,t,n){(function(n){"use strict";function a(e){return d+e.toString(36)}function r(e,t){return e.charAt(t)===d||t===e.length}function o(e){return""===e||e.charAt(0)===d&&e.charAt(e.length-1)!==d}function i(e,t){return 0===t.indexOf(e)&&r(t,e.length)}function s(e){return e?e.substr(0,e.lastIndexOf(d)):""}function l(e,t){if("production"!==n.env.NODE_ENV?m(o(e)&&o(t),"getNextDescendantID(%s, %s): Received an invalid React DOM ID.",e,t):m(o(e)&&o(t)),"production"!==n.env.NODE_ENV?m(i(e,t),"getNextDescendantID(...): React has made an invalid assumption about the DOM hierarchy. Expected `%s` to be an ancestor of `%s`.",e,t):m(i(e,t)),e===t)return e;var a,s=e.length+h;for(a=s;a<t.length&&!r(t,a);a++);return t.substr(0,a)}function c(e,t){var a=Math.min(e.length,t.length);if(0===a)return"";for(var i=0,s=0;a>=s;s++)if(r(e,s)&&r(t,s))i=s;else if(e.charAt(s)!==t.charAt(s))break;var l=e.substr(0,i);return"production"!==n.env.NODE_ENV?m(o(l),"getFirstCommonAncestorID(%s, %s): Expected a valid React DOM ID: %s",e,t,l):m(o(l)),l}function u(e,t,a,r,o,c){e=e||"",t=t||"","production"!==n.env.NODE_ENV?m(e!==t,"traverseParentPath(...): Cannot traverse from and to the same ID, `%s`.",e):m(e!==t);var u=i(t,e);"production"!==n.env.NODE_ENV?m(u||i(e,t),"traverseParentPath(%s, %s, ...): Cannot traverse from two IDs that do not have a parent path.",e,t):m(u||i(e,t));for(var p=0,d=u?s:l,h=e;;h=d(h,t)){var g;if(o&&h===e||c&&h===t||(g=a(h,u,r)),g===!1||h===t)break;"production"!==n.env.NODE_ENV?m(p++<f,"traverseParentPath(%s, %s, ...): Detected an infinite loop while traversing the React DOM ID tree. This may be due to malformed IDs: %s",e,t):m(p++<f)}}var p=e("./ReactRootIndex"),m=e("./invariant"),d=".",h=d.length,f=100,g={createReactRootID:function(){return a(p.createReactRootIndex())},createReactID:function(e,t){return e+t},getReactRootIDFromNodeID:function(e){if(e&&e.charAt(0)===d&&e.length>1){var t=e.indexOf(d,1);return t>-1?e.substr(0,t):e}return null},traverseEnterLeave:function(e,t,n,a,r){var o=c(e,t);o!==e&&u(e,o,n,a,!1,!0),o!==t&&u(o,t,n,r,!0,!1)},traverseTwoPhase:function(e,t,n){e&&(u("",e,t,n,!0,!1),u(e,"",t,n,!1,!0))},traverseAncestors:function(e,t,n){u("",e,t,n,!0,!1)},_getFirstCommonAncestorID:c,_getNextDescendantID:l,isAncestorIDOf:i,SEPARATOR:d};t.exports=g}).call(this,e("g5I+bs"))},{"./ReactRootIndex":191,"./invariant":243,"g5I+bs":70}],175:[function(e,t,n){"use strict";var a={remove:function(e){e._reactInternalInstance=void 0},get:function(e){return e._reactInternalInstance},has:function(e){return void 0!==e._reactInternalInstance},set:function(e,t){e._reactInternalInstance=t}};t.exports=a},{}],176:[function(e,t,n){"use strict";var a={currentlyMountingInstance:null,currentlyUnmountingInstance:null};t.exports=a},{}],177:[function(e,t,n){"use strict";var a=e("./adler32"),r={CHECKSUM_ATTR_NAME:"data-react-checksum",addChecksumToMarkup:function(e){var t=a(e);return e.replace(">"," "+r.CHECKSUM_ATTR_NAME+'="'+t+'">')},canReuseMarkup:function(e,t){var n=t.getAttribute(r.CHECKSUM_ATTR_NAME);n=n&&parseInt(n,10);var o=a(e);return o===n}};t.exports=r},{"./adler32":214}],178:[function(e,t,n){(function(n){"use strict";function a(e,t){for(var n=Math.min(e.length,t.length),a=0;n>a;a++)if(e.charAt(a)!==t.charAt(a))return a;return e.length===t.length?-1:n}function r(e){var t=P(e);return t&&K.getID(t)}function o(e){var t=i(e);if(t)if(V.hasOwnProperty(t)){var a=V[t];a!==e&&("production"!==n.env.NODE_ENV?k(!u(a,t),"ReactMount: Two valid but unequal nodes with the same `%s`: %s",A,t):k(!u(a,t)),V[t]=e)}else V[t]=e;return t}function i(e){return e&&e.getAttribute&&e.getAttribute(A)||""}function s(e,t){var n=i(e);n!==t&&delete V[n],e.setAttribute(A,t),V[t]=e}function l(e){return V.hasOwnProperty(e)&&u(V[e],e)||(V[e]=K.findReactNodeByID(e)),V[e]}function c(e){var t=w.get(e)._rootNodeID;return N.isNullComponentID(t)?null:(V.hasOwnProperty(t)&&u(V[t],t)||(V[t]=K.findReactNodeByID(t)),V[t])}function u(e,t){if(e){"production"!==n.env.NODE_ENV?k(i(e)===t,"ReactMount: Unexpected modification of `%s`",A):k(i(e)===t);var a=K.findReactContainerForID(t);if(a&&D(a,e))return!0}return!1}function p(e){delete V[e]}function m(e){var t=V[e];return t&&u(t,e)?void(z=t):!1}function d(e){z=null,x.traverseAncestors(e,m);var t=z;return z=null,t}function h(e,t,n,a,r){var o=R.mountComponent(e,t,a,S);e._isTopLevel=!0,K._mountImageIntoNode(o,n,r)}function f(e,t,n,a){var r=j.ReactReconcileTransaction.getPooled();r.perform(h,null,e,t,n,r,a),j.ReactReconcileTransaction.release(r)}var g=e("./DOMProperty"),v=e("./ReactBrowserEventEmitter"),E=e("./ReactCurrentOwner"),y=e("./ReactElement"),b=e("./ReactElementValidator"),N=e("./ReactEmptyComponent"),x=e("./ReactInstanceHandles"),w=e("./ReactInstanceMap"),C=e("./ReactMarkupChecksum"),_=e("./ReactPerf"),R=e("./ReactReconciler"),I=e("./ReactUpdateQueue"),j=e("./ReactUpdates"),S=e("./emptyObject"),D=e("./containsNode"),P=e("./getReactRootElementInContainer"),O=e("./instantiateReactComponent"),k=e("./invariant"),M=e("./setInnerHTML"),T=e("./shouldUpdateReactComponent"),U=e("./warning"),L=x.SEPARATOR,A=g.ID_ATTRIBUTE_NAME,V={},$=1,F=9,B={},H={};if("production"!==n.env.NODE_ENV)var q={};var W=[],z=null,K={_instancesByReactRootID:B,scrollMonitor:function(e,t){t()},_updateRootComponent:function(e,t,a,o){return"production"!==n.env.NODE_ENV&&b.checkAndWarnForMutatedProps(t),K.scrollMonitor(a,function(){I.enqueueElementInternal(e,t),o&&I.enqueueCallbackInternal(e,o)}),"production"!==n.env.NODE_ENV&&(q[r(a)]=P(a)),e},_registerComponent:function(e,t){"production"!==n.env.NODE_ENV?k(t&&(t.nodeType===$||t.nodeType===F),"_registerComponent(...): Target container is not a DOM element."):k(t&&(t.nodeType===$||t.nodeType===F)),v.ensureScrollValueMonitoring();var a=K.registerContainer(t);return B[a]=e,a},_renderNewRootComponent:function(e,t,a){"production"!==n.env.NODE_ENV?U(null==E.current,"_renderNewRootComponent(): Render methods should be a pure function of props and state; triggering nested component updates from render is not allowed. If necessary, trigger nested updates in componentDidUpdate."):null;var r=O(e,null),o=K._registerComponent(r,t);return j.batchedUpdates(f,r,o,t,a),"production"!==n.env.NODE_ENV&&(q[o]=P(t)),r},render:function(e,t,a){"production"!==n.env.NODE_ENV?k(y.isValidElement(e),"React.render(): Invalid component element.%s","string"==typeof e?" Instead of passing an element string, make sure to instantiate it by passing it to React.createElement.":"function"==typeof e?" Instead of passing a component class, make sure to instantiate it by passing it to React.createElement.":null!=e&&void 0!==e.props?" This may be caused by unintentionally loading two independent copies of React.":""):k(y.isValidElement(e));var o=B[r(t)];if(o){var i=o._currentElement;if(T(i,e))return K._updateRootComponent(o,e,t,a).getPublicInstance();K.unmountComponentAtNode(t)}var s=P(t),l=s&&K.isRenderedByReact(s);if("production"!==n.env.NODE_ENV&&(!l||s.nextSibling))for(var c=s;c;){if(K.isRenderedByReact(c)){"production"!==n.env.NODE_ENV?U(!1,"render(): Target node has markup rendered by React, but there are unrelated nodes as well. This is most commonly caused by white-space inserted around server-rendered markup."):null;break}c=c.nextSibling}var u=l&&!o,p=K._renderNewRootComponent(e,t,u).getPublicInstance();return a&&a.call(p),p},constructAndRenderComponent:function(e,t,n){var a=y.createElement(e,t);return K.render(a,n)},constructAndRenderComponentByID:function(e,t,a){var r=document.getElementById(a);return"production"!==n.env.NODE_ENV?k(r,'Tried to get element with id of "%s" but it is not present on the page.',a):k(r),K.constructAndRenderComponent(e,t,r)},registerContainer:function(e){var t=r(e);return t&&(t=x.getReactRootIDFromNodeID(t)),t||(t=x.createReactRootID()),H[t]=e,t},unmountComponentAtNode:function(e){"production"!==n.env.NODE_ENV?U(null==E.current,"unmountComponentAtNode(): Render methods should be a pure function of props and state; triggering nested component updates from render is not allowed. If necessary, trigger nested updates in componentDidUpdate."):null,"production"!==n.env.NODE_ENV?k(e&&(e.nodeType===$||e.nodeType===F),"unmountComponentAtNode(...): Target container is not a DOM element."):k(e&&(e.nodeType===$||e.nodeType===F));var t=r(e),a=B[t];return a?(K.unmountComponentFromNode(a,e),delete B[t],delete H[t],"production"!==n.env.NODE_ENV&&delete q[t],!0):!1},unmountComponentFromNode:function(e,t){for(R.unmountComponent(e),t.nodeType===F&&(t=t.documentElement);t.lastChild;)t.removeChild(t.lastChild)},findReactContainerForID:function(e){var t=x.getReactRootIDFromNodeID(e),a=H[t];if("production"!==n.env.NODE_ENV){var r=q[t];if(r&&r.parentNode!==a){"production"!==n.env.NODE_ENV?k(i(r)===t,"ReactMount: Root element ID differed from reactRootID."):k(i(r)===t);var o=a.firstChild;o&&t===i(o)?q[t]=o:"production"!==n.env.NODE_ENV?U(!1,"ReactMount: Root element has been removed from its original container. New container:",r.parentNode):null}}return a},findReactNodeByID:function(e){var t=K.findReactContainerForID(e);return K.findComponentRoot(t,e)},isRenderedByReact:function(e){if(1!==e.nodeType)return!1;var t=K.getID(e);return t?t.charAt(0)===L:!1},getFirstReactDOM:function(e){for(var t=e;t&&t.parentNode!==t;){if(K.isRenderedByReact(t))return t;t=t.parentNode}return null},findComponentRoot:function(e,t){var a=W,r=0,o=d(t)||e;for(a[0]=o.firstChild,a.length=1;r<a.length;){for(var i,s=a[r++];s;){var l=K.getID(s);l?t===l?i=s:x.isAncestorIDOf(l,t)&&(a.length=r=0,a.push(s.firstChild)):a.push(s.firstChild),s=s.nextSibling}if(i)return a.length=0,i}a.length=0,"production"!==n.env.NODE_ENV?k(!1,"findComponentRoot(..., %s): Unable to find element. This probably means the DOM was unexpectedly mutated (e.g., by the browser), usually due to forgetting a <tbody> when using tables, nesting tags like <form>, <p>, or <a>, or using non-SVG elements in an <svg> parent. Try inspecting the child nodes of the element with React ID `%s`.",t,K.getID(e)):k(!1)},_mountImageIntoNode:function(e,t,r){if("production"!==n.env.NODE_ENV?k(t&&(t.nodeType===$||t.nodeType===F),"mountComponentIntoNode(...): Target container is not valid."):k(t&&(t.nodeType===$||t.nodeType===F)),
r){var o=P(t);if(C.canReuseMarkup(e,o))return;var i=o.getAttribute(C.CHECKSUM_ATTR_NAME);o.removeAttribute(C.CHECKSUM_ATTR_NAME);var s=o.outerHTML;o.setAttribute(C.CHECKSUM_ATTR_NAME,i);var l=a(e,s),c=" (client) "+e.substring(l-20,l+20)+"\n (server) "+s.substring(l-20,l+20);"production"!==n.env.NODE_ENV?k(t.nodeType!==F,"You're trying to render a component to the document using server rendering but the checksum was invalid. This usually means you rendered a different component type or props on the client from the one on the server, or your render() methods are impure. React cannot handle this case due to cross-browser quirks by rendering at the document root. You should look for environment dependent code in your components and ensure the props are the same client and server side:\n%s",c):k(t.nodeType!==F),"production"!==n.env.NODE_ENV&&("production"!==n.env.NODE_ENV?U(!1,"React attempted to reuse markup in a container but the checksum was invalid. This generally means that you are using server rendering and the markup generated on the server was not what the client was expecting. React injected new markup to compensate which works but you have lost many of the benefits of server rendering. Instead, figure out why the markup being generated is different on the client or server:\n%s",c):null)}"production"!==n.env.NODE_ENV?k(t.nodeType!==F,"You're trying to render a component to the document but you didn't use server rendering. We can't do this without using server rendering due to cross-browser quirks. See React.renderToString() for server rendering."):k(t.nodeType!==F),M(t,e)},getReactRootID:r,getID:o,setID:s,getNode:l,getNodeFromInstance:c,purgeID:p};_.measureMethods(K,"ReactMount",{_renderNewRootComponent:"_renderNewRootComponent",_mountImageIntoNode:"_mountImageIntoNode"}),t.exports=K}).call(this,e("g5I+bs"))},{"./DOMProperty":117,"./ReactBrowserEventEmitter":138,"./ReactCurrentOwner":147,"./ReactElement":165,"./ReactElementValidator":166,"./ReactEmptyComponent":167,"./ReactInstanceHandles":174,"./ReactInstanceMap":175,"./ReactMarkupChecksum":177,"./ReactPerf":183,"./ReactReconciler":189,"./ReactUpdateQueue":194,"./ReactUpdates":195,"./containsNode":217,"./emptyObject":223,"./getReactRootElementInContainer":237,"./instantiateReactComponent":242,"./invariant":243,"./setInnerHTML":256,"./shouldUpdateReactComponent":259,"./warning":262,"g5I+bs":70}],179:[function(e,t,n){"use strict";function a(e,t,n){h.push({parentID:e,parentNode:null,type:u.INSERT_MARKUP,markupIndex:f.push(t)-1,textContent:null,fromIndex:null,toIndex:n})}function r(e,t,n){h.push({parentID:e,parentNode:null,type:u.MOVE_EXISTING,markupIndex:null,textContent:null,fromIndex:t,toIndex:n})}function o(e,t){h.push({parentID:e,parentNode:null,type:u.REMOVE_NODE,markupIndex:null,textContent:null,fromIndex:t,toIndex:null})}function i(e,t){h.push({parentID:e,parentNode:null,type:u.TEXT_CONTENT,markupIndex:null,textContent:t,fromIndex:null,toIndex:null})}function s(){h.length&&(c.processChildrenUpdates(h,f),l())}function l(){h.length=0,f.length=0}var c=e("./ReactComponentEnvironment"),u=e("./ReactMultiChildUpdateTypes"),p=e("./ReactReconciler"),m=e("./ReactChildReconciler"),d=0,h=[],f=[],g={Mixin:{mountChildren:function(e,t,n){var a=m.instantiateChildren(e,t,n);this._renderedChildren=a;var r=[],o=0;for(var i in a)if(a.hasOwnProperty(i)){var s=a[i],l=this._rootNodeID+i,c=p.mountComponent(s,l,t,n);s._mountIndex=o,r.push(c),o++}return r},updateTextContent:function(e){d++;var t=!0;try{var n=this._renderedChildren;m.unmountChildren(n);for(var a in n)n.hasOwnProperty(a)&&this._unmountChildByName(n[a],a);this.setTextContent(e),t=!1}finally{d--,d||(t?l():s())}},updateChildren:function(e,t,n){d++;var a=!0;try{this._updateChildren(e,t,n),a=!1}finally{d--,d||(a?l():s())}},_updateChildren:function(e,t,n){var a=this._renderedChildren,r=m.updateChildren(a,e,t,n);if(this._renderedChildren=r,r||a){var o,i=0,s=0;for(o in r)if(r.hasOwnProperty(o)){var l=a&&a[o],c=r[o];l===c?(this.moveChild(l,s,i),i=Math.max(l._mountIndex,i),l._mountIndex=s):(l&&(i=Math.max(l._mountIndex,i),this._unmountChildByName(l,o)),this._mountChildByNameAtIndex(c,o,s,t,n)),s++}for(o in a)!a.hasOwnProperty(o)||r&&r.hasOwnProperty(o)||this._unmountChildByName(a[o],o)}},unmountChildren:function(){var e=this._renderedChildren;m.unmountChildren(e),this._renderedChildren=null},moveChild:function(e,t,n){e._mountIndex<n&&r(this._rootNodeID,e._mountIndex,t)},createChild:function(e,t){a(this._rootNodeID,t,e._mountIndex)},removeChild:function(e){o(this._rootNodeID,e._mountIndex)},setTextContent:function(e){i(this._rootNodeID,e)},_mountChildByNameAtIndex:function(e,t,n,a,r){var o=this._rootNodeID+t,i=p.mountComponent(e,o,a,r);e._mountIndex=n,this.createChild(e,i)},_unmountChildByName:function(e,t){this.removeChild(e),e._mountIndex=null}}};t.exports=g},{"./ReactChildReconciler":139,"./ReactComponentEnvironment":144,"./ReactMultiChildUpdateTypes":180,"./ReactReconciler":189}],180:[function(e,t,n){"use strict";var a=e("./keyMirror"),r=a({INSERT_MARKUP:null,MOVE_EXISTING:null,REMOVE_NODE:null,TEXT_CONTENT:null});t.exports=r},{"./keyMirror":248}],181:[function(e,t,n){(function(n){"use strict";function a(e){if("function"==typeof e.type)return e.type;var t=e.type,n=p[t];return null==n&&(p[t]=n=c(t)),n}function r(e){return"production"!==n.env.NODE_ENV?l(u,"There is no registered component for the tag %s",e.type):l(u),new u(e.type,e.props)}function o(e){return new m(e)}function i(e){return e instanceof m}var s=e("./Object.assign"),l=e("./invariant"),c=null,u=null,p={},m=null,d={injectGenericComponentClass:function(e){u=e},injectTextComponentClass:function(e){m=e},injectComponentClasses:function(e){s(p,e)},injectAutoWrapper:function(e){c=e}},h={getComponentClassForElement:a,createInternalComponent:r,createInstanceForText:o,isTextComponent:i,injection:d};t.exports=h}).call(this,e("g5I+bs"))},{"./Object.assign":134,"./invariant":243,"g5I+bs":70}],182:[function(e,t,n){(function(n){"use strict";var a=e("./invariant"),r={isValidOwner:function(e){return!(!e||"function"!=typeof e.attachRef||"function"!=typeof e.detachRef)},addComponentAsRefTo:function(e,t,o){"production"!==n.env.NODE_ENV?a(r.isValidOwner(o),"addComponentAsRefTo(...): Only a ReactOwner can have refs. This usually means that you're trying to add a ref to a component that doesn't have an owner (that is, was not created inside of another component's `render` method). Try rendering this component inside of a new top-level component which will hold the ref."):a(r.isValidOwner(o)),o.attachRef(t,e)},removeComponentAsRefFrom:function(e,t,o){"production"!==n.env.NODE_ENV?a(r.isValidOwner(o),"removeComponentAsRefFrom(...): Only a ReactOwner can have refs. This usually means that you're trying to remove a ref to a component that doesn't have an owner (that is, was not created inside of another component's `render` method). Try rendering this component inside of a new top-level component which will hold the ref."):a(r.isValidOwner(o)),o.getPublicInstance().refs[t]===e.getPublicInstance()&&o.detachRef(t)}};t.exports=r}).call(this,e("g5I+bs"))},{"./invariant":243,"g5I+bs":70}],183:[function(e,t,n){(function(e){"use strict";function n(e,t,n){return n}var a={enableMeasure:!1,storedMeasure:n,measureMethods:function(t,n,r){if("production"!==e.env.NODE_ENV)for(var o in r)r.hasOwnProperty(o)&&(t[o]=a.measure(n,r[o],t[o]))},measure:function(t,n,r){if("production"!==e.env.NODE_ENV){var o=null,i=function(){return a.enableMeasure?(o||(o=a.storedMeasure(t,n,r)),o.apply(this,arguments)):r.apply(this,arguments)};return i.displayName=t+"_"+n,i}return r},injection:{injectMeasure:function(e){a.storedMeasure=e}}};t.exports=a}).call(this,e("g5I+bs"))},{"g5I+bs":70}],184:[function(e,t,n){(function(e){"use strict";var n={};"production"!==e.env.NODE_ENV&&(n={prop:"prop",context:"context",childContext:"child context"}),t.exports=n}).call(this,e("g5I+bs"))},{"g5I+bs":70}],185:[function(e,t,n){"use strict";var a=e("./keyMirror"),r=a({prop:null,context:null,childContext:null});t.exports=r},{"./keyMirror":248}],186:[function(e,t,n){"use strict";function a(e){function t(t,n,a,r,o){if(r=r||N,null==n[a]){var i=y[o];return t?new Error("Required "+i+" `"+a+"` was not specified in "+("`"+r+"`.")):null}return e(n,a,r,o)}var n=t.bind(null,!1);return n.isRequired=t.bind(null,!0),n}function r(e){function t(t,n,a,r){var o=t[n],i=f(o);if(i!==e){var s=y[r],l=g(o);return new Error("Invalid "+s+" `"+n+"` of type `"+l+"` "+("supplied to `"+a+"`, expected `"+e+"`."))}return null}return a(t)}function o(){return a(b.thatReturns(null))}function i(e){function t(t,n,a,r){var o=t[n];if(!Array.isArray(o)){var i=y[r],s=f(o);return new Error("Invalid "+i+" `"+n+"` of type "+("`"+s+"` supplied to `"+a+"`, expected an array."))}for(var l=0;l<o.length;l++){var c=e(o,l,a,r);if(c instanceof Error)return c}return null}return a(t)}function s(){function e(e,t,n,a){if(!v.isValidElement(e[t])){var r=y[a];return new Error("Invalid "+r+" `"+t+"` supplied to "+("`"+n+"`, expected a ReactElement."))}return null}return a(e)}function l(e){function t(t,n,a,r){if(!(t[n]instanceof e)){var o=y[r],i=e.name||N;return new Error("Invalid "+o+" `"+n+"` supplied to "+("`"+a+"`, expected instance of `"+i+"`."))}return null}return a(t)}function c(e){function t(t,n,a,r){for(var o=t[n],i=0;i<e.length;i++)if(o===e[i])return null;var s=y[r],l=JSON.stringify(e);return new Error("Invalid "+s+" `"+n+"` of value `"+o+"` "+("supplied to `"+a+"`, expected one of "+l+"."))}return a(t)}function u(e){function t(t,n,a,r){var o=t[n],i=f(o);if("object"!==i){var s=y[r];return new Error("Invalid "+s+" `"+n+"` of type "+("`"+i+"` supplied to `"+a+"`, expected an object."))}for(var l in o)if(o.hasOwnProperty(l)){var c=e(o,l,a,r);if(c instanceof Error)return c}return null}return a(t)}function p(e){function t(t,n,a,r){for(var o=0;o<e.length;o++){var i=e[o];if(null==i(t,n,a,r))return null}var s=y[r];return new Error("Invalid "+s+" `"+n+"` supplied to "+("`"+a+"`."))}return a(t)}function m(){function e(e,t,n,a){if(!h(e[t])){var r=y[a];return new Error("Invalid "+r+" `"+t+"` supplied to "+("`"+n+"`, expected a ReactNode."))}return null}return a(e)}function d(e){function t(t,n,a,r){var o=t[n],i=f(o);if("object"!==i){var s=y[r];return new Error("Invalid "+s+" `"+n+"` of type `"+i+"` "+("supplied to `"+a+"`, expected `object`."))}for(var l in e){var c=e[l];if(c){var u=c(o,l,a,r);if(u)return u}}return null}return a(t)}function h(e){switch(typeof e){case"number":case"string":case"undefined":return!0;case"boolean":return!e;case"object":if(Array.isArray(e))return e.every(h);if(null===e||v.isValidElement(e))return!0;e=E.extractIfFragment(e);for(var t in e)if(!h(e[t]))return!1;return!0;default:return!1}}function f(e){var t=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":t}function g(e){var t=f(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}var v=e("./ReactElement"),E=e("./ReactFragment"),y=e("./ReactPropTypeLocationNames"),b=e("./emptyFunction"),N="<<anonymous>>",x=s(),w=m(),C={array:r("array"),bool:r("boolean"),func:r("function"),number:r("number"),object:r("object"),string:r("string"),any:o(),arrayOf:i,element:x,instanceOf:l,node:w,objectOf:u,oneOf:c,oneOfType:p,shape:d};t.exports=C},{"./ReactElement":165,"./ReactFragment":171,"./ReactPropTypeLocationNames":184,"./emptyFunction":222}],187:[function(e,t,n){"use strict";function a(){this.listenersToPut=[]}var r=e("./PooledClass"),o=e("./ReactBrowserEventEmitter"),i=e("./Object.assign");i(a.prototype,{enqueuePutListener:function(e,t,n){this.listenersToPut.push({rootNodeID:e,propKey:t,propValue:n})},putListeners:function(){for(var e=0;e<this.listenersToPut.length;e++){var t=this.listenersToPut[e];o.putListener(t.rootNodeID,t.propKey,t.propValue)}},reset:function(){this.listenersToPut.length=0},destructor:function(){this.reset()}}),r.addPoolingTo(a),t.exports=a},{"./Object.assign":134,"./PooledClass":135,"./ReactBrowserEventEmitter":138}],188:[function(e,t,n){"use strict";function a(){this.reinitializeTransaction(),this.renderToStaticMarkup=!1,this.reactMountReady=r.getPooled(null),this.putListenerQueue=l.getPooled()}var r=e("./CallbackQueue"),o=e("./PooledClass"),i=e("./ReactBrowserEventEmitter"),s=e("./ReactInputSelection"),l=e("./ReactPutListenerQueue"),c=e("./Transaction"),u=e("./Object.assign"),p={initialize:s.getSelectionInformation,close:s.restoreSelection},m={initialize:function(){var e=i.isEnabled();return i.setEnabled(!1),e},close:function(e){i.setEnabled(e)}},d={initialize:function(){this.reactMountReady.reset()},close:function(){this.reactMountReady.notifyAll()}},h={initialize:function(){this.putListenerQueue.reset()},close:function(){this.putListenerQueue.putListeners()}},f=[h,p,m,d],g={getTransactionWrappers:function(){return f},getReactMountReady:function(){return this.reactMountReady},getPutListenerQueue:function(){return this.putListenerQueue},destructor:function(){r.release(this.reactMountReady),this.reactMountReady=null,l.release(this.putListenerQueue),this.putListenerQueue=null}};u(a.prototype,c.Mixin,g),o.addPoolingTo(a),t.exports=a},{"./CallbackQueue":113,"./Object.assign":134,"./PooledClass":135,"./ReactBrowserEventEmitter":138,"./ReactInputSelection":173,"./ReactPutListenerQueue":187,"./Transaction":211}],189:[function(e,t,n){(function(n){"use strict";function a(){r.attachRefs(this,this._currentElement)}var r=e("./ReactRef"),o=e("./ReactElementValidator"),i={mountComponent:function(e,t,r,i){var s=e.mountComponent(t,r,i);return"production"!==n.env.NODE_ENV&&o.checkAndWarnForMutatedProps(e._currentElement),r.getReactMountReady().enqueue(a,e),s},unmountComponent:function(e){r.detachRefs(e,e._currentElement),e.unmountComponent()},receiveComponent:function(e,t,i,s){var l=e._currentElement;if(t!==l||null==t._owner){"production"!==n.env.NODE_ENV&&o.checkAndWarnForMutatedProps(t);var c=r.shouldUpdateRefs(l,t);c&&r.detachRefs(e,l),e.receiveComponent(t,i,s),c&&i.getReactMountReady().enqueue(a,e)}},performUpdateIfNecessary:function(e,t){e.performUpdateIfNecessary(t)}};t.exports=i}).call(this,e("g5I+bs"))},{"./ReactElementValidator":166,"./ReactRef":190,"g5I+bs":70}],190:[function(e,t,n){"use strict";function a(e,t,n){"function"==typeof e?e(t.getPublicInstance()):o.addComponentAsRefTo(t,e,n)}function r(e,t,n){"function"==typeof e?e(null):o.removeComponentAsRefFrom(t,e,n)}var o=e("./ReactOwner"),i={};i.attachRefs=function(e,t){var n=t.ref;null!=n&&a(n,e,t._owner)},i.shouldUpdateRefs=function(e,t){return t._owner!==e._owner||t.ref!==e.ref},i.detachRefs=function(e,t){var n=t.ref;null!=n&&r(n,e,t._owner)},t.exports=i},{"./ReactOwner":182}],191:[function(e,t,n){"use strict";var a={injectCreateReactRootIndex:function(e){r.createReactRootIndex=e}},r={createReactRootIndex:null,injection:a};t.exports=r},{}],192:[function(e,t,n){(function(n){"use strict";function a(e){"production"!==n.env.NODE_ENV?p(o.isValidElement(e),"renderToString(): You must pass a valid ReactElement."):p(o.isValidElement(e));var t;try{var a=i.createReactRootID();return t=l.getPooled(!1),t.perform(function(){var n=u(e,null),r=n.mountComponent(a,t,c);return s.addChecksumToMarkup(r)},null)}finally{l.release(t)}}function r(e){"production"!==n.env.NODE_ENV?p(o.isValidElement(e),"renderToStaticMarkup(): You must pass a valid ReactElement."):p(o.isValidElement(e));var t;try{var a=i.createReactRootID();return t=l.getPooled(!0),t.perform(function(){var n=u(e,null);return n.mountComponent(a,t,c)},null)}finally{l.release(t)}}var o=e("./ReactElement"),i=e("./ReactInstanceHandles"),s=e("./ReactMarkupChecksum"),l=e("./ReactServerRenderingTransaction"),c=e("./emptyObject"),u=e("./instantiateReactComponent"),p=e("./invariant");t.exports={renderToString:a,renderToStaticMarkup:r}}).call(this,e("g5I+bs"))},{"./ReactElement":165,"./ReactInstanceHandles":174,"./ReactMarkupChecksum":177,"./ReactServerRenderingTransaction":193,"./emptyObject":223,"./instantiateReactComponent":242,"./invariant":243,"g5I+bs":70}],193:[function(e,t,n){"use strict";function a(e){this.reinitializeTransaction(),this.renderToStaticMarkup=e,this.reactMountReady=o.getPooled(null),this.putListenerQueue=i.getPooled()}var r=e("./PooledClass"),o=e("./CallbackQueue"),i=e("./ReactPutListenerQueue"),s=e("./Transaction"),l=e("./Object.assign"),c=e("./emptyFunction"),u={initialize:function(){this.reactMountReady.reset()},close:c},p={initialize:function(){this.putListenerQueue.reset()},close:c},m=[p,u],d={getTransactionWrappers:function(){return m},getReactMountReady:function(){return this.reactMountReady},getPutListenerQueue:function(){return this.putListenerQueue},destructor:function(){o.release(this.reactMountReady),this.reactMountReady=null,i.release(this.putListenerQueue),this.putListenerQueue=null}};l(a.prototype,s.Mixin,d),r.addPoolingTo(a),t.exports=a},{"./CallbackQueue":113,"./Object.assign":134,"./PooledClass":135,"./ReactPutListenerQueue":187,"./Transaction":211,"./emptyFunction":222}],194:[function(e,t,n){(function(n){"use strict";function a(e){e!==o.currentlyMountingInstance&&c.enqueueUpdate(e)}function r(e,t){"production"!==n.env.NODE_ENV?p(null==i.current,"%s(...): Cannot update during an existing state transition (such as within `render`). Render methods should be a pure function of props and state.",t):p(null==i.current);var a=l.get(e);return a?a===o.currentlyUnmountingInstance?null:a:("production"!==n.env.NODE_ENV&&("production"!==n.env.NODE_ENV?m(!t,"%s(...): Can only update a mounted or mounting component. This usually means you called %s() on an unmounted component. This is a no-op.",t,t):null),null)}var o=e("./ReactLifeCycle"),i=e("./ReactCurrentOwner"),s=e("./ReactElement"),l=e("./ReactInstanceMap"),c=e("./ReactUpdates"),u=e("./Object.assign"),p=e("./invariant"),m=e("./warning"),d={enqueueCallback:function(e,t){"production"!==n.env.NODE_ENV?p("function"==typeof t,"enqueueCallback(...): You called `setProps`, `replaceProps`, `setState`, `replaceState`, or `forceUpdate` with a callback that isn't callable."):p("function"==typeof t);var i=r(e);return i&&i!==o.currentlyMountingInstance?(i._pendingCallbacks?i._pendingCallbacks.push(t):i._pendingCallbacks=[t],void a(i)):null},enqueueCallbackInternal:function(e,t){"production"!==n.env.NODE_ENV?p("function"==typeof t,"enqueueCallback(...): You called `setProps`, `replaceProps`, `setState`, `replaceState`, or `forceUpdate` with a callback that isn't callable."):p("function"==typeof t),e._pendingCallbacks?e._pendingCallbacks.push(t):e._pendingCallbacks=[t],a(e)},enqueueForceUpdate:function(e){var t=r(e,"forceUpdate");t&&(t._pendingForceUpdate=!0,a(t))},enqueueReplaceState:function(e,t){var n=r(e,"replaceState");n&&(n._pendingStateQueue=[t],n._pendingReplaceState=!0,a(n))},enqueueSetState:function(e,t){var n=r(e,"setState");if(n){var o=n._pendingStateQueue||(n._pendingStateQueue=[]);o.push(t),a(n)}},enqueueSetProps:function(e,t){var o=r(e,"setProps");if(o){"production"!==n.env.NODE_ENV?p(o._isTopLevel,"setProps(...): You called `setProps` on a component with a parent. This is an anti-pattern since props will get reactively updated when rendered. Instead, change the owner's `render` method to pass the correct value as props to the component where it is created."):p(o._isTopLevel);var i=o._pendingElement||o._currentElement,l=u({},i.props,t);o._pendingElement=s.cloneAndReplaceProps(i,l),a(o)}},enqueueReplaceProps:function(e,t){var o=r(e,"replaceProps");if(o){"production"!==n.env.NODE_ENV?p(o._isTopLevel,"replaceProps(...): You called `replaceProps` on a component with a parent. This is an anti-pattern since props will get reactively updated when rendered. Instead, change the owner's `render` method to pass the correct value as props to the component where it is created."):p(o._isTopLevel);var i=o._pendingElement||o._currentElement;o._pendingElement=s.cloneAndReplaceProps(i,t),a(o)}},enqueueElementInternal:function(e,t){e._pendingElement=t,a(e)}};t.exports=d}).call(this,e("g5I+bs"))},{"./Object.assign":134,"./ReactCurrentOwner":147,"./ReactElement":165,"./ReactInstanceMap":175,"./ReactLifeCycle":176,"./ReactUpdates":195,"./invariant":243,"./warning":262,"g5I+bs":70}],195:[function(e,t,n){(function(n){"use strict";function a(){"production"!==n.env.NODE_ENV?v(j.ReactReconcileTransaction&&x,"ReactUpdates: must inject a reconcile transaction class and batching strategy"):v(j.ReactReconcileTransaction&&x)}function r(){this.reinitializeTransaction(),this.dirtyComponentsLength=null,this.callbackQueue=u.getPooled(),this.reconcileTransaction=j.ReactReconcileTransaction.getPooled()}function o(e,t,n,r,o){a(),x.batchedUpdates(e,t,n,r,o)}function i(e,t){return e._mountOrder-t._mountOrder}function s(e){var t=e.dirtyComponentsLength;"production"!==n.env.NODE_ENV?v(t===y.length,"Expected flush transaction's stored dirty-components length (%s) to match dirty-components array length (%s).",t,y.length):v(t===y.length),y.sort(i);for(var a=0;t>a;a++){var r=y[a],o=r._pendingCallbacks;if(r._pendingCallbacks=null,h.performUpdateIfNecessary(r,e.reconcileTransaction),o)for(var s=0;s<o.length;s++)e.callbackQueue.enqueue(o[s],r.getPublicInstance())}}function l(e){return a(),"production"!==n.env.NODE_ENV?E(null==m.current,"enqueueUpdate(): Render methods should be a pure function of props and state; triggering nested component updates from render is not allowed. If necessary, trigger nested updates in componentDidUpdate."):null,x.isBatchingUpdates?void y.push(e):void x.batchedUpdates(l,e)}function c(e,t){"production"!==n.env.NODE_ENV?v(x.isBatchingUpdates,"ReactUpdates.asap: Can't enqueue an asap callback in a context whereupdates are not being batched."):v(x.isBatchingUpdates),b.enqueue(e,t),N=!0}var u=e("./CallbackQueue"),p=e("./PooledClass"),m=e("./ReactCurrentOwner"),d=e("./ReactPerf"),h=e("./ReactReconciler"),f=e("./Transaction"),g=e("./Object.assign"),v=e("./invariant"),E=e("./warning"),y=[],b=u.getPooled(),N=!1,x=null,w={initialize:function(){this.dirtyComponentsLength=y.length},close:function(){this.dirtyComponentsLength!==y.length?(y.splice(0,this.dirtyComponentsLength),R()):y.length=0}},C={initialize:function(){this.callbackQueue.reset()},close:function(){this.callbackQueue.notifyAll()}},_=[w,C];g(r.prototype,f.Mixin,{getTransactionWrappers:function(){return _},destructor:function(){this.dirtyComponentsLength=null,u.release(this.callbackQueue),this.callbackQueue=null,j.ReactReconcileTransaction.release(this.reconcileTransaction),this.reconcileTransaction=null},perform:function(e,t,n){return f.Mixin.perform.call(this,this.reconcileTransaction.perform,this.reconcileTransaction,e,t,n)}}),p.addPoolingTo(r);var R=function(){for(;y.length||N;){if(y.length){var e=r.getPooled();e.perform(s,null,e),r.release(e)}if(N){N=!1;var t=b;b=u.getPooled(),t.notifyAll(),u.release(t)}}};R=d.measure("ReactUpdates","flushBatchedUpdates",R);var I={injectReconcileTransaction:function(e){"production"!==n.env.NODE_ENV?v(e,"ReactUpdates: must provide a reconcile transaction class"):v(e),j.ReactReconcileTransaction=e},injectBatchingStrategy:function(e){"production"!==n.env.NODE_ENV?v(e,"ReactUpdates: must provide a batching strategy"):v(e),"production"!==n.env.NODE_ENV?v("function"==typeof e.batchedUpdates,"ReactUpdates: must provide a batchedUpdates() function"):v("function"==typeof e.batchedUpdates),"production"!==n.env.NODE_ENV?v("boolean"==typeof e.isBatchingUpdates,"ReactUpdates: must provide an isBatchingUpdates boolean attribute"):v("boolean"==typeof e.isBatchingUpdates),x=e}},j={ReactReconcileTransaction:null,batchedUpdates:o,enqueueUpdate:l,flushBatchedUpdates:R,injection:I,asap:c};t.exports=j}).call(this,e("g5I+bs"))},{"./CallbackQueue":113,"./Object.assign":134,"./PooledClass":135,"./ReactCurrentOwner":147,"./ReactPerf":183,"./ReactReconciler":189,"./Transaction":211,"./invariant":243,"./warning":262,"g5I+bs":70}],196:[function(e,t,n){"use strict";var a=e("./DOMProperty"),r=a.injection.MUST_USE_ATTRIBUTE,o={Properties:{clipPath:r,cx:r,cy:r,d:r,dx:r,dy:r,fill:r,fillOpacity:r,fontFamily:r,fontSize:r,fx:r,fy:r,gradientTransform:r,gradientUnits:r,markerEnd:r,markerMid:r,markerStart:r,offset:r,opacity:r,patternContentUnits:r,patternUnits:r,points:r,preserveAspectRatio:r,r:r,rx:r,ry:r,spreadMethod:r,stopColor:r,stopOpacity:r,stroke:r,strokeDasharray:r,strokeLinecap:r,strokeOpacity:r,strokeWidth:r,textAnchor:r,transform:r,version:r,viewBox:r,x1:r,x2:r,x:r,y1:r,y2:r,y:r},DOMAttributeNames:{clipPath:"clip-path",fillOpacity:"fill-opacity",fontFamily:"font-family",fontSize:"font-size",gradientTransform:"gradientTransform",gradientUnits:"gradientUnits",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",patternContentUnits:"patternContentUnits",patternUnits:"patternUnits",preserveAspectRatio:"preserveAspectRatio",spreadMethod:"spreadMethod",stopColor:"stop-color",stopOpacity:"stop-opacity",strokeDasharray:"stroke-dasharray",strokeLinecap:"stroke-linecap",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",textAnchor:"text-anchor",viewBox:"viewBox"}};t.exports=o},{"./DOMProperty":117}],197:[function(e,t,n){"use strict";function a(e){if("selectionStart"in e&&s.hasSelectionCapabilities(e))return{start:e.selectionStart,end:e.selectionEnd};if(window.getSelection){var t=window.getSelection();return{anchorNode:t.anchorNode,anchorOffset:t.anchorOffset,focusNode:t.focusNode,focusOffset:t.focusOffset}}if(document.selection){var n=document.selection.createRange();return{parentElement:n.parentElement(),text:n.text,top:n.boundingTop,left:n.boundingLeft}}}function r(e){if(E||null==f||f!==c())return null;var t=a(f);if(!v||!m(v,t)){v=t;var n=l.getPooled(h.select,g,e);return n.type="select",n.target=f,i.accumulateTwoPhaseDispatches(n),n}}var o=e("./EventConstants"),i=e("./EventPropagators"),s=e("./ReactInputSelection"),l=e("./SyntheticEvent"),c=e("./getActiveElement"),u=e("./isTextInputElement"),p=e("./keyOf"),m=e("./shallowEqual"),d=o.topLevelTypes,h={select:{phasedRegistrationNames:{bubbled:p({onSelect:null}),captured:p({onSelectCapture:null})},dependencies:[d.topBlur,d.topContextMenu,d.topFocus,d.topKeyDown,d.topMouseDown,d.topMouseUp,d.topSelectionChange]}},f=null,g=null,v=null,E=!1,y={eventTypes:h,extractEvents:function(e,t,n,a){switch(e){case d.topFocus:(u(t)||"true"===t.contentEditable)&&(f=t,g=n,v=null);break;case d.topBlur:f=null,g=null,v=null;break;case d.topMouseDown:E=!0;break;case d.topContextMenu:case d.topMouseUp:return E=!1,r(a);case d.topSelectionChange:case d.topKeyDown:case d.topKeyUp:return r(a)}}};t.exports=y},{"./EventConstants":122,"./EventPropagators":127,"./ReactInputSelection":173,"./SyntheticEvent":203,"./getActiveElement":229,"./isTextInputElement":246,"./keyOf":249,"./shallowEqual":258}],198:[function(e,t,n){"use strict";var a=Math.pow(2,53),r={createReactRootIndex:function(){return Math.ceil(Math.random()*a)}};t.exports=r},{}],199:[function(e,t,n){(function(n){"use strict";var a=e("./EventConstants"),r=e("./EventPluginUtils"),o=e("./EventPropagators"),i=e("./SyntheticClipboardEvent"),s=e("./SyntheticEvent"),l=e("./SyntheticFocusEvent"),c=e("./SyntheticKeyboardEvent"),u=e("./SyntheticMouseEvent"),p=e("./SyntheticDragEvent"),m=e("./SyntheticTouchEvent"),d=e("./SyntheticUIEvent"),h=e("./SyntheticWheelEvent"),f=e("./getEventCharCode"),g=e("./invariant"),v=e("./keyOf"),E=e("./warning"),y=a.topLevelTypes,b={blur:{phasedRegistrationNames:{bubbled:v({onBlur:!0}),captured:v({onBlurCapture:!0})}},click:{phasedRegistrationNames:{bubbled:v({onClick:!0}),captured:v({onClickCapture:!0})}},contextMenu:{phasedRegistrationNames:{bubbled:v({onContextMenu:!0}),captured:v({onContextMenuCapture:!0})}},copy:{phasedRegistrationNames:{bubbled:v({onCopy:!0}),captured:v({onCopyCapture:!0})}},cut:{phasedRegistrationNames:{bubbled:v({onCut:!0}),captured:v({onCutCapture:!0})}},doubleClick:{phasedRegistrationNames:{bubbled:v({onDoubleClick:!0}),captured:v({onDoubleClickCapture:!0})}},drag:{phasedRegistrationNames:{bubbled:v({onDrag:!0}),captured:v({onDragCapture:!0})}},dragEnd:{phasedRegistrationNames:{bubbled:v({onDragEnd:!0}),captured:v({onDragEndCapture:!0})}},dragEnter:{phasedRegistrationNames:{bubbled:v({onDragEnter:!0}),captured:v({onDragEnterCapture:!0})}},dragExit:{phasedRegistrationNames:{bubbled:v({onDragExit:!0}),captured:v({onDragExitCapture:!0})}},dragLeave:{phasedRegistrationNames:{bubbled:v({onDragLeave:!0}),captured:v({onDragLeaveCapture:!0})}},dragOver:{phasedRegistrationNames:{bubbled:v({onDragOver:!0}),captured:v({onDragOverCapture:!0})}},dragStart:{phasedRegistrationNames:{bubbled:v({onDragStart:!0}),captured:v({onDragStartCapture:!0})}},drop:{phasedRegistrationNames:{bubbled:v({onDrop:!0}),captured:v({onDropCapture:!0})}},focus:{phasedRegistrationNames:{bubbled:v({onFocus:!0}),captured:v({onFocusCapture:!0})}},input:{phasedRegistrationNames:{bubbled:v({onInput:!0}),captured:v({onInputCapture:!0})}},keyDown:{phasedRegistrationNames:{bubbled:v({onKeyDown:!0}),captured:v({onKeyDownCapture:!0})}},keyPress:{phasedRegistrationNames:{bubbled:v({onKeyPress:!0}),captured:v({onKeyPressCapture:!0})}},keyUp:{phasedRegistrationNames:{bubbled:v({onKeyUp:!0}),captured:v({onKeyUpCapture:!0})}},load:{phasedRegistrationNames:{bubbled:v({onLoad:!0}),captured:v({onLoadCapture:!0})}},error:{phasedRegistrationNames:{bubbled:v({onError:!0}),captured:v({onErrorCapture:!0})}},mouseDown:{phasedRegistrationNames:{bubbled:v({onMouseDown:!0}),captured:v({onMouseDownCapture:!0})}},mouseMove:{phasedRegistrationNames:{bubbled:v({onMouseMove:!0}),captured:v({onMouseMoveCapture:!0})}},mouseOut:{phasedRegistrationNames:{bubbled:v({onMouseOut:!0}),captured:v({onMouseOutCapture:!0})}},mouseOver:{phasedRegistrationNames:{bubbled:v({onMouseOver:!0}),captured:v({onMouseOverCapture:!0})}},mouseUp:{phasedRegistrationNames:{bubbled:v({onMouseUp:!0}),captured:v({onMouseUpCapture:!0})}},paste:{phasedRegistrationNames:{bubbled:v({onPaste:!0}),captured:v({onPasteCapture:!0})}},reset:{phasedRegistrationNames:{bubbled:v({onReset:!0}),captured:v({onResetCapture:!0})}},scroll:{phasedRegistrationNames:{bubbled:v({onScroll:!0}),captured:v({onScrollCapture:!0})}},submit:{phasedRegistrationNames:{bubbled:v({onSubmit:!0}),captured:v({onSubmitCapture:!0})}},touchCancel:{phasedRegistrationNames:{bubbled:v({onTouchCancel:!0}),captured:v({onTouchCancelCapture:!0})}},touchEnd:{phasedRegistrationNames:{bubbled:v({onTouchEnd:!0}),captured:v({onTouchEndCapture:!0})}},touchMove:{phasedRegistrationNames:{bubbled:v({onTouchMove:!0}),captured:v({onTouchMoveCapture:!0})}},touchStart:{phasedRegistrationNames:{bubbled:v({onTouchStart:!0}),captured:v({onTouchStartCapture:!0})}},wheel:{phasedRegistrationNames:{bubbled:v({onWheel:!0}),captured:v({onWheelCapture:!0})}}},N={topBlur:b.blur,topClick:b.click,topContextMenu:b.contextMenu,topCopy:b.copy,topCut:b.cut,topDoubleClick:b.doubleClick,topDrag:b.drag,topDragEnd:b.dragEnd,topDragEnter:b.dragEnter,topDragExit:b.dragExit,topDragLeave:b.dragLeave,topDragOver:b.dragOver,topDragStart:b.dragStart,topDrop:b.drop,topError:b.error,topFocus:b.focus,topInput:b.input,topKeyDown:b.keyDown,topKeyPress:b.keyPress,topKeyUp:b.keyUp,topLoad:b.load,topMouseDown:b.mouseDown,topMouseMove:b.mouseMove,topMouseOut:b.mouseOut,topMouseOver:b.mouseOver,topMouseUp:b.mouseUp,topPaste:b.paste,topReset:b.reset,topScroll:b.scroll,topSubmit:b.submit,topTouchCancel:b.touchCancel,topTouchEnd:b.touchEnd,topTouchMove:b.touchMove,topTouchStart:b.touchStart,topWheel:b.wheel};for(var x in N)N[x].dependencies=[x];var w={eventTypes:b,executeDispatch:function(e,t,a){var o=r.executeDispatch(e,t,a);"production"!==n.env.NODE_ENV?E("boolean"!=typeof o,"Returning `false` from an event handler is deprecated and will be ignored in a future release. Instead, manually call e.stopPropagation() or e.preventDefault(), as appropriate."):null,o===!1&&(e.stopPropagation(),e.preventDefault())},extractEvents:function(e,t,a,r){var v=N[e];if(!v)return null;var E;switch(e){case y.topInput:case y.topLoad:case y.topError:case y.topReset:case y.topSubmit:E=s;break;case y.topKeyPress:
if(0===f(r))return null;case y.topKeyDown:case y.topKeyUp:E=c;break;case y.topBlur:case y.topFocus:E=l;break;case y.topClick:if(2===r.button)return null;case y.topContextMenu:case y.topDoubleClick:case y.topMouseDown:case y.topMouseMove:case y.topMouseOut:case y.topMouseOver:case y.topMouseUp:E=u;break;case y.topDrag:case y.topDragEnd:case y.topDragEnter:case y.topDragExit:case y.topDragLeave:case y.topDragOver:case y.topDragStart:case y.topDrop:E=p;break;case y.topTouchCancel:case y.topTouchEnd:case y.topTouchMove:case y.topTouchStart:E=m;break;case y.topScroll:E=d;break;case y.topWheel:E=h;break;case y.topCopy:case y.topCut:case y.topPaste:E=i}"production"!==n.env.NODE_ENV?g(E,"SimpleEventPlugin: Unhandled event type, `%s`.",e):g(E);var b=E.getPooled(v,a,r);return o.accumulateTwoPhaseDispatches(b),b}};t.exports=w}).call(this,e("g5I+bs"))},{"./EventConstants":122,"./EventPluginUtils":126,"./EventPropagators":127,"./SyntheticClipboardEvent":200,"./SyntheticDragEvent":202,"./SyntheticEvent":203,"./SyntheticFocusEvent":204,"./SyntheticKeyboardEvent":206,"./SyntheticMouseEvent":207,"./SyntheticTouchEvent":208,"./SyntheticUIEvent":209,"./SyntheticWheelEvent":210,"./getEventCharCode":230,"./invariant":243,"./keyOf":249,"./warning":262,"g5I+bs":70}],200:[function(e,t,n){"use strict";function a(e,t,n){r.call(this,e,t,n)}var r=e("./SyntheticEvent"),o={clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}};r.augmentClass(a,o),t.exports=a},{"./SyntheticEvent":203}],201:[function(e,t,n){"use strict";function a(e,t,n){r.call(this,e,t,n)}var r=e("./SyntheticEvent"),o={data:null};r.augmentClass(a,o),t.exports=a},{"./SyntheticEvent":203}],202:[function(e,t,n){"use strict";function a(e,t,n){r.call(this,e,t,n)}var r=e("./SyntheticMouseEvent"),o={dataTransfer:null};r.augmentClass(a,o),t.exports=a},{"./SyntheticMouseEvent":207}],203:[function(e,t,n){"use strict";function a(e,t,n){this.dispatchConfig=e,this.dispatchMarker=t,this.nativeEvent=n;var a=this.constructor.Interface;for(var r in a)if(a.hasOwnProperty(r)){var o=a[r];o?this[r]=o(n):this[r]=n[r]}var s=null!=n.defaultPrevented?n.defaultPrevented:n.returnValue===!1;s?this.isDefaultPrevented=i.thatReturnsTrue:this.isDefaultPrevented=i.thatReturnsFalse,this.isPropagationStopped=i.thatReturnsFalse}var r=e("./PooledClass"),o=e("./Object.assign"),i=e("./emptyFunction"),s=e("./getEventTarget"),l={type:null,target:s,currentTarget:i.thatReturnsNull,eventPhase:null,bubbles:null,cancelable:null,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:null,isTrusted:null};o(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e.preventDefault?e.preventDefault():e.returnValue=!1,this.isDefaultPrevented=i.thatReturnsTrue},stopPropagation:function(){var e=this.nativeEvent;e.stopPropagation?e.stopPropagation():e.cancelBubble=!0,this.isPropagationStopped=i.thatReturnsTrue},persist:function(){this.isPersistent=i.thatReturnsTrue},isPersistent:i.thatReturnsFalse,destructor:function(){var e=this.constructor.Interface;for(var t in e)this[t]=null;this.dispatchConfig=null,this.dispatchMarker=null,this.nativeEvent=null}}),a.Interface=l,a.augmentClass=function(e,t){var n=this,a=Object.create(n.prototype);o(a,e.prototype),e.prototype=a,e.prototype.constructor=e,e.Interface=o({},n.Interface,t),e.augmentClass=n.augmentClass,r.addPoolingTo(e,r.threeArgumentPooler)},r.addPoolingTo(a,r.threeArgumentPooler),t.exports=a},{"./Object.assign":134,"./PooledClass":135,"./emptyFunction":222,"./getEventTarget":233}],204:[function(e,t,n){"use strict";function a(e,t,n){r.call(this,e,t,n)}var r=e("./SyntheticUIEvent"),o={relatedTarget:null};r.augmentClass(a,o),t.exports=a},{"./SyntheticUIEvent":209}],205:[function(e,t,n){"use strict";function a(e,t,n){r.call(this,e,t,n)}var r=e("./SyntheticEvent"),o={data:null};r.augmentClass(a,o),t.exports=a},{"./SyntheticEvent":203}],206:[function(e,t,n){"use strict";function a(e,t,n){r.call(this,e,t,n)}var r=e("./SyntheticUIEvent"),o=e("./getEventCharCode"),i=e("./getEventKey"),s=e("./getEventModifierState"),l={key:i,location:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,repeat:null,locale:null,getModifierState:s,charCode:function(e){return"keypress"===e.type?o(e):0},keyCode:function(e){return"keydown"===e.type||"keyup"===e.type?e.keyCode:0},which:function(e){return"keypress"===e.type?o(e):"keydown"===e.type||"keyup"===e.type?e.keyCode:0}};r.augmentClass(a,l),t.exports=a},{"./SyntheticUIEvent":209,"./getEventCharCode":230,"./getEventKey":231,"./getEventModifierState":232}],207:[function(e,t,n){"use strict";function a(e,t,n){r.call(this,e,t,n)}var r=e("./SyntheticUIEvent"),o=e("./ViewportMetrics"),i=e("./getEventModifierState"),s={screenX:null,screenY:null,clientX:null,clientY:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,getModifierState:i,button:function(e){var t=e.button;return"which"in e?t:2===t?2:4===t?1:0},buttons:null,relatedTarget:function(e){return e.relatedTarget||(e.fromElement===e.srcElement?e.toElement:e.fromElement)},pageX:function(e){return"pageX"in e?e.pageX:e.clientX+o.currentScrollLeft},pageY:function(e){return"pageY"in e?e.pageY:e.clientY+o.currentScrollTop}};r.augmentClass(a,s),t.exports=a},{"./SyntheticUIEvent":209,"./ViewportMetrics":212,"./getEventModifierState":232}],208:[function(e,t,n){"use strict";function a(e,t,n){r.call(this,e,t,n)}var r=e("./SyntheticUIEvent"),o=e("./getEventModifierState"),i={touches:null,targetTouches:null,changedTouches:null,altKey:null,metaKey:null,ctrlKey:null,shiftKey:null,getModifierState:o};r.augmentClass(a,i),t.exports=a},{"./SyntheticUIEvent":209,"./getEventModifierState":232}],209:[function(e,t,n){"use strict";function a(e,t,n){r.call(this,e,t,n)}var r=e("./SyntheticEvent"),o=e("./getEventTarget"),i={view:function(e){if(e.view)return e.view;var t=o(e);if(null!=t&&t.window===t)return t;var n=t.ownerDocument;return n?n.defaultView||n.parentWindow:window},detail:function(e){return e.detail||0}};r.augmentClass(a,i),t.exports=a},{"./SyntheticEvent":203,"./getEventTarget":233}],210:[function(e,t,n){"use strict";function a(e,t,n){r.call(this,e,t,n)}var r=e("./SyntheticMouseEvent"),o={deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:null,deltaMode:null};r.augmentClass(a,o),t.exports=a},{"./SyntheticMouseEvent":207}],211:[function(e,t,n){(function(n){"use strict";var a=e("./invariant"),r={reinitializeTransaction:function(){this.transactionWrappers=this.getTransactionWrappers(),this.wrapperInitData?this.wrapperInitData.length=0:this.wrapperInitData=[],this._isInTransaction=!1},_isInTransaction:!1,getTransactionWrappers:null,isInTransaction:function(){return!!this._isInTransaction},perform:function(e,t,r,o,i,s,l,c){"production"!==n.env.NODE_ENV?a(!this.isInTransaction(),"Transaction.perform(...): Cannot initialize a transaction when there is already an outstanding transaction."):a(!this.isInTransaction());var u,p;try{this._isInTransaction=!0,u=!0,this.initializeAll(0),p=e.call(t,r,o,i,s,l,c),u=!1}finally{try{if(u)try{this.closeAll(0)}catch(m){}else this.closeAll(0)}finally{this._isInTransaction=!1}}return p},initializeAll:function(e){for(var t=this.transactionWrappers,n=e;n<t.length;n++){var a=t[n];try{this.wrapperInitData[n]=o.OBSERVED_ERROR,this.wrapperInitData[n]=a.initialize?a.initialize.call(this):null}finally{if(this.wrapperInitData[n]===o.OBSERVED_ERROR)try{this.initializeAll(n+1)}catch(r){}}}},closeAll:function(e){"production"!==n.env.NODE_ENV?a(this.isInTransaction(),"Transaction.closeAll(): Cannot close transaction when none are open."):a(this.isInTransaction());for(var t=this.transactionWrappers,r=e;r<t.length;r++){var i,s=t[r],l=this.wrapperInitData[r];try{i=!0,l!==o.OBSERVED_ERROR&&s.close&&s.close.call(this,l),i=!1}finally{if(i)try{this.closeAll(r+1)}catch(c){}}}this.wrapperInitData.length=0}},o={Mixin:r,OBSERVED_ERROR:{}};t.exports=o}).call(this,e("g5I+bs"))},{"./invariant":243,"g5I+bs":70}],212:[function(e,t,n){"use strict";var a={currentScrollLeft:0,currentScrollTop:0,refreshScrollValues:function(e){a.currentScrollLeft=e.x,a.currentScrollTop=e.y}};t.exports=a},{}],213:[function(e,t,n){(function(n){"use strict";function a(e,t){if("production"!==n.env.NODE_ENV?r(null!=t,"accumulateInto(...): Accumulated items must not be null or undefined."):r(null!=t),null==e)return t;var a=Array.isArray(e),o=Array.isArray(t);return a&&o?(e.push.apply(e,t),e):a?(e.push(t),e):o?[e].concat(t):[e,t]}var r=e("./invariant");t.exports=a}).call(this,e("g5I+bs"))},{"./invariant":243,"g5I+bs":70}],214:[function(e,t,n){"use strict";function a(e){for(var t=1,n=0,a=0;a<e.length;a++)t=(t+e.charCodeAt(a))%r,n=(n+t)%r;return t|n<<16}var r=65521;t.exports=a},{}],215:[function(e,t,n){function a(e){return e.replace(r,function(e,t){return t.toUpperCase()})}var r=/-(.)/g;t.exports=a},{}],216:[function(e,t,n){"use strict";function a(e){return r(e.replace(o,"ms-"))}var r=e("./camelize"),o=/^-ms-/;t.exports=a},{"./camelize":215}],217:[function(e,t,n){function a(e,t){return e&&t?e===t?!0:r(e)?!1:r(t)?a(e,t.parentNode):e.contains?e.contains(t):e.compareDocumentPosition?!!(16&e.compareDocumentPosition(t)):!1:!1}var r=e("./isTextNode");t.exports=a},{"./isTextNode":247}],218:[function(e,t,n){function a(e){return!!e&&("object"==typeof e||"function"==typeof e)&&"length"in e&&!("setInterval"in e)&&"number"!=typeof e.nodeType&&(Array.isArray(e)||"callee"in e||"item"in e)}function r(e){return a(e)?Array.isArray(e)?e.slice():o(e):[e]}var o=e("./toArray");t.exports=r},{"./toArray":260}],219:[function(e,t,n){(function(n){"use strict";function a(e){var t=o.createFactory(e),a=r.createClass({tagName:e.toUpperCase(),displayName:"ReactFullPageComponent"+e,componentWillUnmount:function(){"production"!==n.env.NODE_ENV?i(!1,"%s tried to unmount. Because of cross-browser quirks it is impossible to unmount some top-level components (eg <html>, <head>, and <body>) reliably and efficiently. To fix this, have a single top-level component that never unmounts render these elements.",this.constructor.displayName):i(!1)},render:function(){return t(this.props)}});return a}var r=e("./ReactClass"),o=e("./ReactElement"),i=e("./invariant");t.exports=a}).call(this,e("g5I+bs"))},{"./ReactClass":141,"./ReactElement":165,"./invariant":243,"g5I+bs":70}],220:[function(e,t,n){(function(n){function a(e){var t=e.match(u);return t&&t[1].toLowerCase()}function r(e,t){var r=c;"production"!==n.env.NODE_ENV?l(!!c,"createNodesFromMarkup dummy not initialized"):l(!!c);var o=a(e),u=o&&s(o);if(u){r.innerHTML=u[1]+e+u[2];for(var p=u[0];p--;)r=r.lastChild}else r.innerHTML=e;var m=r.getElementsByTagName("script");m.length&&("production"!==n.env.NODE_ENV?l(t,"createNodesFromMarkup(...): Unexpected <script> element rendered."):l(t),i(m).forEach(t));for(var d=i(r.childNodes);r.lastChild;)r.removeChild(r.lastChild);return d}var o=e("./ExecutionEnvironment"),i=e("./createArrayFromMixed"),s=e("./getMarkupWrap"),l=e("./invariant"),c=o.canUseDOM?document.createElement("div"):null,u=/^\s*<(\w+)/;t.exports=r}).call(this,e("g5I+bs"))},{"./ExecutionEnvironment":128,"./createArrayFromMixed":218,"./getMarkupWrap":235,"./invariant":243,"g5I+bs":70}],221:[function(e,t,n){"use strict";function a(e,t){var n=null==t||"boolean"==typeof t||""===t;if(n)return"";var a=isNaN(t);return a||0===t||o.hasOwnProperty(e)&&o[e]?""+t:("string"==typeof t&&(t=t.trim()),t+"px")}var r=e("./CSSProperty"),o=r.isUnitlessNumber;t.exports=a},{"./CSSProperty":111}],222:[function(e,t,n){function a(e){return function(){return e}}function r(){}r.thatReturns=a,r.thatReturnsFalse=a(!1),r.thatReturnsTrue=a(!0),r.thatReturnsNull=a(null),r.thatReturnsThis=function(){return this},r.thatReturnsArgument=function(e){return e},t.exports=r},{}],223:[function(e,t,n){(function(e){"use strict";var n={};"production"!==e.env.NODE_ENV&&Object.freeze(n),t.exports=n}).call(this,e("g5I+bs"))},{"g5I+bs":70}],224:[function(e,t,n){"use strict";function a(e){return o[e]}function r(e){return(""+e).replace(i,a)}var o={"&":"&",">":">","<":"<",'"':""","'":"'"},i=/[&><"']/g;t.exports=r},{}],225:[function(e,t,n){(function(n){"use strict";function a(e){if("production"!==n.env.NODE_ENV){var t=r.current;null!==t&&("production"!==n.env.NODE_ENV?c(t._warnedAboutRefsInRender,"%s is accessing getDOMNode or findDOMNode inside its render(). render() should be a pure function of props and state. It should never access something that requires stale data from the previous render, such as refs. Move this logic to componentDidMount and componentDidUpdate instead.",t.getName()||"A component"):null,t._warnedAboutRefsInRender=!0)}return null==e?null:l(e)?e:o.has(e)?i.getNodeFromInstance(e):("production"!==n.env.NODE_ENV?s(null==e.render||"function"!=typeof e.render,"Component (with keys: %s) contains `render` method but is not mounted in the DOM",Object.keys(e)):s(null==e.render||"function"!=typeof e.render),void("production"!==n.env.NODE_ENV?s(!1,"Element appears to be neither ReactComponent nor DOMNode (keys: %s)",Object.keys(e)):s(!1)))}var r=e("./ReactCurrentOwner"),o=e("./ReactInstanceMap"),i=e("./ReactMount"),s=e("./invariant"),l=e("./isNode"),c=e("./warning");t.exports=a}).call(this,e("g5I+bs"))},{"./ReactCurrentOwner":147,"./ReactInstanceMap":175,"./ReactMount":178,"./invariant":243,"./isNode":245,"./warning":262,"g5I+bs":70}],226:[function(e,t,n){(function(n){"use strict";function a(e,t,a){var r=e,o=!r.hasOwnProperty(a);"production"!==n.env.NODE_ENV&&("production"!==n.env.NODE_ENV?i(o,"flattenChildren(...): Encountered two children with the same key, `%s`. Child keys must be unique; when two children share a key, only the first child will be used.",a):null),o&&null!=t&&(r[a]=t)}function r(e){if(null==e)return e;var t={};return o(e,a,t),t}var o=e("./traverseAllChildren"),i=e("./warning");t.exports=r}).call(this,e("g5I+bs"))},{"./traverseAllChildren":261,"./warning":262,"g5I+bs":70}],227:[function(e,t,n){"use strict";function a(e){try{e.focus()}catch(t){}}t.exports=a},{}],228:[function(e,t,n){"use strict";var a=function(e,t,n){Array.isArray(e)?e.forEach(t,n):e&&t.call(n,e)};t.exports=a},{}],229:[function(e,t,n){function a(){try{return document.activeElement||document.body}catch(e){return document.body}}t.exports=a},{}],230:[function(e,t,n){"use strict";function a(e){var t,n=e.keyCode;return"charCode"in e?(t=e.charCode,0===t&&13===n&&(t=13)):t=n,t>=32||13===t?t:0}t.exports=a},{}],231:[function(e,t,n){"use strict";function a(e){if(e.key){var t=o[e.key]||e.key;if("Unidentified"!==t)return t}if("keypress"===e.type){var n=r(e);return 13===n?"Enter":String.fromCharCode(n)}return"keydown"===e.type||"keyup"===e.type?i[e.keyCode]||"Unidentified":""}var r=e("./getEventCharCode"),o={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},i={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"};t.exports=a},{"./getEventCharCode":230}],232:[function(e,t,n){"use strict";function a(e){var t=this,n=t.nativeEvent;if(n.getModifierState)return n.getModifierState(e);var a=o[e];return a?!!n[a]:!1}function r(e){return a}var o={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};t.exports=r},{}],233:[function(e,t,n){"use strict";function a(e){var t=e.target||e.srcElement||window;return 3===t.nodeType?t.parentNode:t}t.exports=a},{}],234:[function(e,t,n){"use strict";function a(e){var t=e&&(r&&e[r]||e[o]);return"function"==typeof t?t:void 0}var r="function"==typeof Symbol&&Symbol.iterator,o="@@iterator";t.exports=a},{}],235:[function(e,t,n){(function(n){function a(e){return"production"!==n.env.NODE_ENV?o(!!i,"Markup wrapping node not initialized"):o(!!i),m.hasOwnProperty(e)||(e="*"),s.hasOwnProperty(e)||("*"===e?i.innerHTML="<link />":i.innerHTML="<"+e+"></"+e+">",s[e]=!i.firstChild),s[e]?m[e]:null}var r=e("./ExecutionEnvironment"),o=e("./invariant"),i=r.canUseDOM?document.createElement("div"):null,s={circle:!0,clipPath:!0,defs:!0,ellipse:!0,g:!0,line:!0,linearGradient:!0,path:!0,polygon:!0,polyline:!0,radialGradient:!0,rect:!0,stop:!0,text:!0},l=[1,'<select multiple="true">',"</select>"],c=[1,"<table>","</table>"],u=[3,"<table><tbody><tr>","</tr></tbody></table>"],p=[1,"<svg>","</svg>"],m={"*":[1,"?<div>","</div>"],area:[1,"<map>","</map>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],legend:[1,"<fieldset>","</fieldset>"],param:[1,"<object>","</object>"],tr:[2,"<table><tbody>","</tbody></table>"],optgroup:l,option:l,caption:c,colgroup:c,tbody:c,tfoot:c,thead:c,td:u,th:u,circle:p,clipPath:p,defs:p,ellipse:p,g:p,line:p,linearGradient:p,path:p,polygon:p,polyline:p,radialGradient:p,rect:p,stop:p,text:p};t.exports=a}).call(this,e("g5I+bs"))},{"./ExecutionEnvironment":128,"./invariant":243,"g5I+bs":70}],236:[function(e,t,n){"use strict";function a(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function r(e){for(;e;){if(e.nextSibling)return e.nextSibling;e=e.parentNode}}function o(e,t){for(var n=a(e),o=0,i=0;n;){if(3===n.nodeType){if(i=o+n.textContent.length,t>=o&&i>=t)return{node:n,offset:t-o};o=i}n=a(r(n))}}t.exports=o},{}],237:[function(e,t,n){"use strict";function a(e){return e?e.nodeType===r?e.documentElement:e.firstChild:null}var r=9;t.exports=a},{}],238:[function(e,t,n){"use strict";function a(){return!o&&r.canUseDOM&&(o="textContent"in document.documentElement?"textContent":"innerText"),o}var r=e("./ExecutionEnvironment"),o=null;t.exports=a},{"./ExecutionEnvironment":128}],239:[function(e,t,n){"use strict";function a(e){return e===window?{x:window.pageXOffset||document.documentElement.scrollLeft,y:window.pageYOffset||document.documentElement.scrollTop}:{x:e.scrollLeft,y:e.scrollTop}}t.exports=a},{}],240:[function(e,t,n){function a(e){return e.replace(r,"-$1").toLowerCase()}var r=/([A-Z])/g;t.exports=a},{}],241:[function(e,t,n){"use strict";function a(e){return r(e).replace(o,"-ms-")}var r=e("./hyphenate"),o=/^ms-/;t.exports=a},{"./hyphenate":240}],242:[function(e,t,n){(function(n){"use strict";function a(e){return"function"==typeof e&&"undefined"!=typeof e.prototype&&"function"==typeof e.prototype.mountComponent&&"function"==typeof e.prototype.receiveComponent}function r(e,t){var r;if((null===e||e===!1)&&(e=i.emptyElement),"object"==typeof e){var o=e;"production"!==n.env.NODE_ENV&&("production"!==n.env.NODE_ENV?u(o&&("function"==typeof o.type||"string"==typeof o.type),"Only functions or strings can be mounted as React components."):null),r=t===o.type&&"string"==typeof o.type?s.createInternalComponent(o):a(o.type)?new o.type(o):new p}else"string"==typeof e||"number"==typeof e?r=s.createInstanceForText(e):"production"!==n.env.NODE_ENV?c(!1,"Encountered invalid React node of type %s",typeof e):c(!1);return"production"!==n.env.NODE_ENV&&("production"!==n.env.NODE_ENV?u("function"==typeof r.construct&&"function"==typeof r.mountComponent&&"function"==typeof r.receiveComponent&&"function"==typeof r.unmountComponent,"Only React Components can be mounted."):null),r.construct(e),r._mountIndex=0,r._mountImage=null,"production"!==n.env.NODE_ENV&&(r._isOwnerNecessary=!1,r._warnedAboutRefsInRender=!1),"production"!==n.env.NODE_ENV&&Object.preventExtensions&&Object.preventExtensions(r),r}var o=e("./ReactCompositeComponent"),i=e("./ReactEmptyComponent"),s=e("./ReactNativeComponent"),l=e("./Object.assign"),c=e("./invariant"),u=e("./warning"),p=function(){};l(p.prototype,o.Mixin,{_instantiateReactComponent:r}),t.exports=r}).call(this,e("g5I+bs"))},{"./Object.assign":134,"./ReactCompositeComponent":145,"./ReactEmptyComponent":167,"./ReactNativeComponent":181,"./invariant":243,"./warning":262,"g5I+bs":70}],243:[function(e,t,n){(function(e){"use strict";var n=function(t,n,a,r,o,i,s,l){if("production"!==e.env.NODE_ENV&&void 0===n)throw new Error("invariant requires an error message argument");if(!t){var c;if(void 0===n)c=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var u=[a,r,o,i,s,l],p=0;c=new Error("Invariant Violation: "+n.replace(/%s/g,function(){return u[p++]}))}throw c.framesToPop=1,c}};t.exports=n}).call(this,e("g5I+bs"))},{"g5I+bs":70}],244:[function(e,t,n){"use strict";function a(e,t){if(!o.canUseDOM||t&&!("addEventListener"in document))return!1;var n="on"+e,a=n in document;if(!a){var i=document.createElement("div");i.setAttribute(n,"return;"),a="function"==typeof i[n]}return!a&&r&&"wheel"===e&&(a=document.implementation.hasFeature("Events.wheel","3.0")),a}var r,o=e("./ExecutionEnvironment");o.canUseDOM&&(r=document.implementation&&document.implementation.hasFeature&&document.implementation.hasFeature("","")!==!0),t.exports=a},{"./ExecutionEnvironment":128}],245:[function(e,t,n){function a(e){return!(!e||!("function"==typeof Node?e instanceof Node:"object"==typeof e&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName))}t.exports=a},{}],246:[function(e,t,n){"use strict";function a(e){return e&&("INPUT"===e.nodeName&&r[e.type]||"TEXTAREA"===e.nodeName)}var r={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};t.exports=a},{}],247:[function(e,t,n){function a(e){return r(e)&&3==e.nodeType}var r=e("./isNode");t.exports=a},{"./isNode":245}],248:[function(e,t,n){(function(n){"use strict";var a=e("./invariant"),r=function(e){var t,r={};"production"!==n.env.NODE_ENV?a(e instanceof Object&&!Array.isArray(e),"keyMirror(...): Argument must be an object."):a(e instanceof Object&&!Array.isArray(e));for(t in e)e.hasOwnProperty(t)&&(r[t]=t);return r};t.exports=r}).call(this,e("g5I+bs"))},{"./invariant":243,"g5I+bs":70}],249:[function(e,t,n){var a=function(e){var t;for(t in e)if(e.hasOwnProperty(t))return t;return null};t.exports=a},{}],250:[function(e,t,n){"use strict";function a(e,t,n){if(!e)return null;var a={};for(var o in e)r.call(e,o)&&(a[o]=t.call(n,e[o],o,e));return a}var r=Object.prototype.hasOwnProperty;t.exports=a},{}],251:[function(e,t,n){"use strict";function a(e){var t={};return function(n){return t.hasOwnProperty(n)||(t[n]=e.call(this,n)),t[n]}}t.exports=a},{}],252:[function(e,t,n){(function(n){"use strict";function a(e){return"production"!==n.env.NODE_ENV?o(r.isValidElement(e),"onlyChild must be passed a children with exactly one child."):o(r.isValidElement(e)),e}var r=e("./ReactElement"),o=e("./invariant");t.exports=a}).call(this,e("g5I+bs"))},{"./ReactElement":165,"./invariant":243,"g5I+bs":70}],253:[function(e,t,n){"use strict";var a,r=e("./ExecutionEnvironment");r.canUseDOM&&(a=window.performance||window.msPerformance||window.webkitPerformance),t.exports=a||{}},{"./ExecutionEnvironment":128}],254:[function(e,t,n){var a=e("./performance");a&&a.now||(a=Date);var r=a.now.bind(a);t.exports=r},{"./performance":253}],255:[function(e,t,n){"use strict";function a(e){return'"'+r(e)+'"'}var r=e("./escapeTextContentForBrowser");t.exports=a},{"./escapeTextContentForBrowser":224}],256:[function(e,t,n){"use strict";var a=e("./ExecutionEnvironment"),r=/^[ \r\n\t\f]/,o=/<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/,i=function(e,t){e.innerHTML=t};if("undefined"!=typeof MSApp&&MSApp.execUnsafeLocalFunction&&(i=function(e,t){MSApp.execUnsafeLocalFunction(function(){e.innerHTML=t})}),a.canUseDOM){var s=document.createElement("div");s.innerHTML=" ",""===s.innerHTML&&(i=function(e,t){if(e.parentNode&&e.parentNode.replaceChild(e,e),r.test(t)||"<"===t[0]&&o.test(t)){e.innerHTML="\ufeff"+t;var n=e.firstChild;1===n.data.length?e.removeChild(n):n.deleteData(0,1)}else e.innerHTML=t})}t.exports=i},{"./ExecutionEnvironment":128}],257:[function(e,t,n){"use strict";var a=e("./ExecutionEnvironment"),r=e("./escapeTextContentForBrowser"),o=e("./setInnerHTML"),i=function(e,t){e.textContent=t};a.canUseDOM&&("textContent"in document.documentElement||(i=function(e,t){o(e,r(t))})),t.exports=i},{"./ExecutionEnvironment":128,"./escapeTextContentForBrowser":224,"./setInnerHTML":256}],258:[function(e,t,n){"use strict";function a(e,t){if(e===t)return!0;var n;for(n in e)if(e.hasOwnProperty(n)&&(!t.hasOwnProperty(n)||e[n]!==t[n]))return!1;for(n in t)if(t.hasOwnProperty(n)&&!e.hasOwnProperty(n))return!1;return!0}t.exports=a},{}],259:[function(e,t,n){(function(n){"use strict";function a(e,t){if(null!=e&&null!=t){var a=typeof e,o=typeof t;if("string"===a||"number"===a)return"string"===o||"number"===o;if("object"===o&&e.type===t.type&&e.key===t.key){var i=e._owner===t._owner,s=null,l=null,c=null;return"production"!==n.env.NODE_ENV&&(i||(null!=e._owner&&null!=e._owner.getPublicInstance()&&null!=e._owner.getPublicInstance().constructor&&(s=e._owner.getPublicInstance().constructor.displayName),null!=t._owner&&null!=t._owner.getPublicInstance()&&null!=t._owner.getPublicInstance().constructor&&(l=t._owner.getPublicInstance().constructor.displayName),null!=t.type&&null!=t.type.displayName&&(c=t.type.displayName),null!=t.type&&"string"==typeof t.type&&(c=t.type),("string"!=typeof t.type||"input"===t.type||"textarea"===t.type)&&(null!=e._owner&&e._owner._isOwnerNecessary===!1||null!=t._owner&&t._owner._isOwnerNecessary===!1)&&(null!=e._owner&&(e._owner._isOwnerNecessary=!0),null!=t._owner&&(t._owner._isOwnerNecessary=!0),"production"!==n.env.NODE_ENV?r(!1,"<%s /> is being rendered by both %s and %s using the same key (%s) in the same place. Currently, this means that they don't preserve state. This behavior should be very rare so we're considering deprecating it. Please contact the React team and explain your use case so that we can take that into consideration.",c||"Unknown Component",s||"[Unknown]",l||"[Unknown]",e.key):null))),i}}return!1}var r=e("./warning");t.exports=a}).call(this,e("g5I+bs"))},{"./warning":262,"g5I+bs":70}],260:[function(e,t,n){(function(n){function a(e){var t=e.length;if("production"!==n.env.NODE_ENV?r(!Array.isArray(e)&&("object"==typeof e||"function"==typeof e),"toArray: Array-like object expected"):r(!Array.isArray(e)&&("object"==typeof e||"function"==typeof e)),"production"!==n.env.NODE_ENV?r("number"==typeof t,"toArray: Object needs a length property"):r("number"==typeof t),"production"!==n.env.NODE_ENV?r(0===t||t-1 in e,"toArray: Object should have keys for indices"):r(0===t||t-1 in e),e.hasOwnProperty)try{return Array.prototype.slice.call(e)}catch(a){}for(var o=Array(t),i=0;t>i;i++)o[i]=e[i];return o}var r=e("./invariant");t.exports=a}).call(this,e("g5I+bs"))},{"./invariant":243,"g5I+bs":70}],261:[function(e,t,n){(function(n){"use strict";function a(e){return v[e]}function r(e,t){return e&&null!=e.key?i(e.key):t.toString(36)}function o(e){return(""+e).replace(E,a)}function i(e){return"$"+o(e)}function s(e,t,a,o,l){var p=typeof e;if(("undefined"===p||"boolean"===p)&&(e=null),null===e||"string"===p||"number"===p||c.isValidElement(e))return o(l,e,""===t?f+r(e,0):t,a),1;var v,E,b,N=0;if(Array.isArray(e))for(var x=0;x<e.length;x++)v=e[x],E=(""!==t?t+g:f)+r(v,x),b=a+N,N+=s(v,E,b,o,l);else{var w=m(e);if(w){var C,_=w.call(e);if(w!==e.entries)for(var R=0;!(C=_.next()).done;)v=C.value,E=(""!==t?t+g:f)+r(v,R++),b=a+N,N+=s(v,E,b,o,l);else for("production"!==n.env.NODE_ENV&&("production"!==n.env.NODE_ENV?h(y,"Using Maps as children is not yet fully supported. It is an experimental feature that might be removed. Convert it to a sequence / iterable of keyed ReactElements instead."):null,y=!0);!(C=_.next()).done;){var I=C.value;I&&(v=I[1],E=(""!==t?t+g:f)+i(I[0])+g+r(v,0),b=a+N,N+=s(v,E,b,o,l))}}else if("object"===p){"production"!==n.env.NODE_ENV?d(1!==e.nodeType,"traverseAllChildren(...): Encountered an invalid child; DOM elements are not valid children of React components."):d(1!==e.nodeType);var j=u.extract(e);for(var S in j)j.hasOwnProperty(S)&&(v=j[S],E=(""!==t?t+g:f)+i(S)+g+r(v,0),b=a+N,N+=s(v,E,b,o,l))}}return N}function l(e,t,n){return null==e?0:s(e,"",0,t,n)}var c=e("./ReactElement"),u=e("./ReactFragment"),p=e("./ReactInstanceHandles"),m=e("./getIteratorFn"),d=e("./invariant"),h=e("./warning"),f=p.SEPARATOR,g=":",v={"=":"=0",".":"=1",":":"=2"},E=/[=.:]/g,y=!1;t.exports=l}).call(this,e("g5I+bs"))},{"./ReactElement":165,"./ReactFragment":171,"./ReactInstanceHandles":174,"./getIteratorFn":234,"./invariant":243,"./warning":262,"g5I+bs":70}],262:[function(e,t,n){(function(n){"use strict";var a=e("./emptyFunction"),r=a;"production"!==n.env.NODE_ENV&&(r=function(e,t){for(var n=[],a=2,r=arguments.length;r>a;a++)n.push(arguments[a]);if(void 0===t)throw new Error("`warning(condition, format, ...args)` requires a warning message argument");if(t.length<10||/^[s\W]*$/.test(t))throw new Error("The warning format should be able to uniquely identify this warning. Please, use a more descriptive format than: "+t);if(0!==t.indexOf("Failed Composite propType: ")&&!e){var o=0,i="Warning: "+t.replace(/%s/g,function(){return n[o++]});console.warn(i);try{throw new Error(i)}catch(s){}}}),t.exports=r}).call(this,e("g5I+bs"))},{"./emptyFunction":222,"g5I+bs":70}],263:[function(e,t,n){t.exports=e("./lib/React")},{"./lib/React":136}]},{},[1]); |
Public/cdn/zeroclipboard/2.0.0/ZeroClipboard.js | h136799711/API01 | /*!
* ZeroClipboard
* The ZeroClipboard library provides an easy way to copy text to the clipboard using an invisible Adobe Flash movie and a JavaScript interface.
* Copyright (c) 2014 Jon Rohan, James M. Greene
* Licensed MIT
* http://zeroclipboard.org/
* v2.0.0
*/
(function(window, undefined) {
"use strict";
/**
* Store references to critically important global functions that may be
* overridden on certain web pages.
*/
var _window = window, _document = _window.document, _navigator = _window.navigator, _setTimeout = _window.setTimeout, _parseInt = _window.Number.parseInt || _window.parseInt, _parseFloat = _window.Number.parseFloat || _window.parseFloat, _isNaN = _window.Number.isNaN || _window.isNaN, _encodeURIComponent = _window.encodeURIComponent, _Math = _window.Math, _Date = _window.Date, _ActiveXObject = _window.ActiveXObject, _slice = _window.Array.prototype.slice, _keys = _window.Object.keys, _hasOwn = _window.Object.prototype.hasOwnProperty, _defineProperty = function() {
if (typeof _window.Object.defineProperty === "function" && function() {
try {
var x = {};
_window.Object.defineProperty(x, "y", {
value: "z"
});
return x.y === "z";
} catch (e) {
return false;
}
}()) {
return _window.Object.defineProperty;
}
}();
/**
* Convert an `arguments` object into an Array.
*
* @returns The arguments as an Array
* @private
*/
var _args = function(argumentsObj) {
return _slice.call(argumentsObj, 0);
};
/**
* Get the index of an item in an Array.
*
* @returns The index of an item in the Array, or `-1` if not found.
* @private
*/
var _inArray = function(item, array, fromIndex) {
if (typeof array.indexOf === "function") {
return array.indexOf(item, fromIndex);
}
var i, len = array.length;
if (typeof fromIndex === "undefined") {
fromIndex = 0;
} else if (fromIndex < 0) {
fromIndex = len + fromIndex;
}
for (i = fromIndex; i < len; i++) {
if (_hasOwn.call(array, i) && array[i] === item) {
return i;
}
}
return -1;
};
/**
* Shallow-copy the owned, enumerable properties of one object over to another, similar to jQuery's `$.extend`.
*
* @returns The target object, augmented
* @private
*/
var _extend = function() {
var i, len, arg, prop, src, copy, args = _args(arguments), target = args[0] || {};
for (i = 1, len = args.length; i < len; i++) {
if ((arg = args[i]) != null) {
for (prop in arg) {
if (_hasOwn.call(arg, prop)) {
src = target[prop];
copy = arg[prop];
if (target === copy) {
continue;
}
if (copy !== undefined) {
target[prop] = copy;
}
}
}
}
}
return target;
};
/**
* Return a deep copy of the source object or array.
*
* @returns Object or Array
* @private
*/
var _deepCopy = function(source) {
var copy, i, len, prop;
if (typeof source !== "object" || source == null) {
copy = source;
} else if (typeof source.length === "number") {
copy = [];
for (i = 0, len = source.length; i < len; i++) {
if (_hasOwn.call(source, i)) {
copy[i] = _deepCopy(source[i]);
}
}
} else {
copy = {};
for (prop in source) {
if (_hasOwn.call(source, prop)) {
copy[prop] = _deepCopy(source[prop]);
}
}
}
return copy;
};
/**
* Makes a shallow copy of `obj` (like `_extend`) but filters its properties based on a list of `keys` to keep.
* The inverse of `_omit`, mostly. The big difference is that these properties do NOT need to be enumerable to
* be kept.
*
* @returns A new filtered object.
* @private
*/
var _pick = function(obj, keys) {
var newObj = {};
for (var i = 0, len = keys.length; i < len; i++) {
if (keys[i] in obj) {
newObj[keys[i]] = obj[keys[i]];
}
}
return newObj;
};
/**
* Makes a shallow copy of `obj` (like `_extend`) but filters its properties based on a list of `keys` to omit.
* The inverse of `_pick`.
*
* @returns A new filtered object.
* @private
*/
var _omit = function(obj, keys) {
var newObj = {};
for (var prop in obj) {
if (_inArray(prop, keys) === -1) {
newObj[prop] = obj[prop];
}
}
return newObj;
};
/**
* Get all of an object's owned, enumerable property names. Does NOT include prototype properties.
*
* @returns An Array of property names.
* @private
*/
var _objectKeys = function(obj) {
if (obj == null) {
return [];
}
if (_keys) {
return _keys(obj);
}
var keys = [];
for (var prop in obj) {
if (_hasOwn.call(obj, prop)) {
keys.push(prop);
}
}
return keys;
};
/**
* Remove all owned, enumerable properties from an object.
*
* @returns The original object without its owned, enumerable properties.
* @private
*/
var _deleteOwnProperties = function(obj) {
if (obj) {
for (var prop in obj) {
if (_hasOwn.call(obj, prop)) {
delete obj[prop];
}
}
}
return obj;
};
/**
* Mark an existing property as read-only.
* @private
*/
var _makeReadOnly = function(obj, prop) {
if (prop in obj && typeof _defineProperty === "function") {
_defineProperty(obj, prop, {
value: obj[prop],
writable: false,
configurable: true,
enumerable: true
});
}
};
/**
* Get the current time in milliseconds since the epoch.
*
* @returns Number
* @private
*/
var _now = function(Date) {
return function() {
var time;
if (Date.now) {
time = Date.now();
} else {
time = new Date().getTime();
}
return time;
};
}(_Date);
/**
* Keep track of the state of the Flash object.
* @private
*/
var _flashState = {
bridge: null,
version: "0.0.0",
pluginType: "unknown",
disabled: null,
outdated: null,
unavailable: null,
deactivated: null,
overdue: null,
ready: null
};
/**
* The minimum Flash Player version required to use ZeroClipboard completely.
* @readonly
* @private
*/
var _minimumFlashVersion = "11.0.0";
/**
* Keep track of all event listener registrations.
* @private
*/
var _handlers = {};
/**
* Keep track of the currently activated element.
* @private
*/
var _currentElement;
/**
* Keep track of data for the pending clipboard transaction.
* @private
*/
var _clipData = {};
/**
* Keep track of data formats for the pending clipboard transaction.
* @private
*/
var _clipDataFormatMap = null;
/**
* The `message` store for events
* @private
*/
var _eventMessages = {
ready: "Flash communication is established",
error: {
"flash-disabled": "Flash is disabled or not installed",
"flash-outdated": "Flash is too outdated to support ZeroClipboard",
"flash-unavailable": "Flash is unable to communicate bidirectionally with JavaScript",
"flash-deactivated": "Flash is too outdated for your browser and/or is configured as click-to-activate",
"flash-overdue": "Flash communication was established but NOT within the acceptable time limit"
}
};
/**
* The presumed location of the "ZeroClipboard.swf" file, based on the location
* of the executing JavaScript file (e.g. "ZeroClipboard.js", etc.).
* @private
*/
var _swfPath = function() {
var i, jsDir, tmpJsPath, jsPath, swfPath = "ZeroClipboard.swf";
if (!(_document.currentScript && (jsPath = _document.currentScript.src))) {
var scripts = _document.getElementsByTagName("script");
if ("readyState" in scripts[0]) {
for (i = scripts.length; i--; ) {
if (scripts[i].readyState === "interactive" && (jsPath = scripts[i].src)) {
break;
}
}
} else if (_document.readyState === "loading") {
jsPath = scripts[scripts.length - 1].src;
} else {
for (i = scripts.length; i--; ) {
tmpJsPath = scripts[i].src;
if (!tmpJsPath) {
jsDir = null;
break;
}
tmpJsPath = tmpJsPath.split("#")[0].split("?")[0];
tmpJsPath = tmpJsPath.slice(0, tmpJsPath.lastIndexOf("/") + 1);
if (jsDir == null) {
jsDir = tmpJsPath;
} else if (jsDir !== tmpJsPath) {
jsDir = null;
break;
}
}
if (jsDir !== null) {
jsPath = jsDir;
}
}
}
if (jsPath) {
jsPath = jsPath.split("#")[0].split("?")[0];
swfPath = jsPath.slice(0, jsPath.lastIndexOf("/") + 1) + swfPath;
}
return swfPath;
}();
/**
* ZeroClipboard configuration defaults for the Core module.
* @private
*/
var _globalConfig = {
swfPath: _swfPath,
trustedDomains: window.location.host ? [ window.location.host ] : [],
cacheBust: true,
forceEnhancedClipboard: false,
flashLoadTimeout: 3e4,
autoActivate: true,
bubbleEvents: true,
containerId: "global-zeroclipboard-html-bridge",
containerClass: "global-zeroclipboard-container",
swfObjectId: "global-zeroclipboard-flash-bridge",
hoverClass: "zeroclipboard-is-hover",
activeClass: "zeroclipboard-is-active",
forceHandCursor: false,
title: null,
zIndex: 999999999
};
/**
* The underlying implementation of `ZeroClipboard.config`.
* @private
*/
var _config = function(options) {
if (typeof options === "object" && options !== null) {
for (var prop in options) {
if (_hasOwn.call(options, prop)) {
if (/^(?:forceHandCursor|title|zIndex|bubbleEvents)$/.test(prop)) {
_globalConfig[prop] = options[prop];
} else if (_flashState.bridge == null) {
if (prop === "containerId" || prop === "swfObjectId") {
if (_isValidHtml4Id(options[prop])) {
_globalConfig[prop] = options[prop];
} else {
throw new Error("The specified `" + prop + "` value is not valid as an HTML4 Element ID");
}
} else {
_globalConfig[prop] = options[prop];
}
}
}
}
}
if (typeof options === "string" && options) {
if (_hasOwn.call(_globalConfig, options)) {
return _globalConfig[options];
}
return;
}
return _deepCopy(_globalConfig);
};
/**
* The underlying implementation of `ZeroClipboard.state`.
* @private
*/
var _state = function() {
return {
browser: _pick(_navigator, [ "userAgent", "platform", "appName" ]),
flash: _omit(_flashState, [ "bridge" ]),
zeroclipboard: {
version: ZeroClipboard.version,
config: ZeroClipboard.config()
}
};
};
/**
* The underlying implementation of `ZeroClipboard.isFlashUnusable`.
* @private
*/
var _isFlashUnusable = function() {
return !!(_flashState.disabled || _flashState.outdated || _flashState.unavailable || _flashState.deactivated);
};
/**
* The underlying implementation of `ZeroClipboard.on`.
* @private
*/
var _on = function(eventType, listener) {
var i, len, events, added = {};
if (typeof eventType === "string" && eventType) {
events = eventType.toLowerCase().split(/\s+/);
} else if (typeof eventType === "object" && eventType && typeof listener === "undefined") {
for (i in eventType) {
if (_hasOwn.call(eventType, i) && typeof i === "string" && i && typeof eventType[i] === "function") {
ZeroClipboard.on(i, eventType[i]);
}
}
}
if (events && events.length) {
for (i = 0, len = events.length; i < len; i++) {
eventType = events[i].replace(/^on/, "");
added[eventType] = true;
if (!_handlers[eventType]) {
_handlers[eventType] = [];
}
_handlers[eventType].push(listener);
}
if (added.ready && _flashState.ready) {
ZeroClipboard.emit({
type: "ready"
});
}
if (added.error) {
var errorTypes = [ "disabled", "outdated", "unavailable", "deactivated", "overdue" ];
for (i = 0, len = errorTypes.length; i < len; i++) {
if (_flashState[errorTypes[i]] === true) {
ZeroClipboard.emit({
type: "error",
name: "flash-" + errorTypes[i]
});
break;
}
}
}
}
return ZeroClipboard;
};
/**
* The underlying implementation of `ZeroClipboard.off`.
* @private
*/
var _off = function(eventType, listener) {
var i, len, foundIndex, events, perEventHandlers;
if (arguments.length === 0) {
events = _objectKeys(_handlers);
} else if (typeof eventType === "string" && eventType) {
events = eventType.split(/\s+/);
} else if (typeof eventType === "object" && eventType && typeof listener === "undefined") {
for (i in eventType) {
if (_hasOwn.call(eventType, i) && typeof i === "string" && i && typeof eventType[i] === "function") {
ZeroClipboard.off(i, eventType[i]);
}
}
}
if (events && events.length) {
for (i = 0, len = events.length; i < len; i++) {
eventType = events[i].toLowerCase().replace(/^on/, "");
perEventHandlers = _handlers[eventType];
if (perEventHandlers && perEventHandlers.length) {
if (listener) {
foundIndex = _inArray(listener, perEventHandlers);
while (foundIndex !== -1) {
perEventHandlers.splice(foundIndex, 1);
foundIndex = _inArray(listener, perEventHandlers, foundIndex);
}
} else {
perEventHandlers.length = 0;
}
}
}
}
return ZeroClipboard;
};
/**
* The underlying implementation of `ZeroClipboard.handlers`.
* @private
*/
var _listeners = function(eventType) {
var copy;
if (typeof eventType === "string" && eventType) {
copy = _deepCopy(_handlers[eventType]) || null;
} else {
copy = _deepCopy(_handlers);
}
return copy;
};
/**
* The underlying implementation of `ZeroClipboard.emit`.
* @private
*/
var _emit = function(event) {
var eventCopy, returnVal, tmp;
event = _createEvent(event);
if (!event) {
return;
}
if (_preprocessEvent(event)) {
return;
}
if (event.type === "ready" && _flashState.overdue === true) {
return ZeroClipboard.emit({
type: "error",
name: "flash-overdue"
});
}
eventCopy = _extend({}, event);
_dispatchCallbacks.call(this, eventCopy);
if (event.type === "copy") {
tmp = _mapClipDataToFlash(_clipData);
returnVal = tmp.data;
_clipDataFormatMap = tmp.formatMap;
}
return returnVal;
};
/**
* The underlying implementation of `ZeroClipboard.create`.
* @private
*/
var _create = function() {
if (typeof _flashState.ready !== "boolean") {
_flashState.ready = false;
}
if (!ZeroClipboard.isFlashUnusable() && _flashState.bridge === null) {
var maxWait = _globalConfig.flashLoadTimeout;
if (typeof maxWait === "number" && maxWait >= 0) {
_setTimeout(function() {
if (typeof _flashState.deactivated !== "boolean") {
_flashState.deactivated = true;
}
if (_flashState.deactivated === true) {
ZeroClipboard.emit({
type: "error",
name: "flash-deactivated"
});
}
}, maxWait);
}
_flashState.overdue = false;
_embedSwf();
}
};
/**
* The underlying implementation of `ZeroClipboard.destroy`.
* @private
*/
var _destroy = function() {
ZeroClipboard.clearData();
ZeroClipboard.deactivate();
ZeroClipboard.emit("destroy");
_unembedSwf();
ZeroClipboard.off();
};
/**
* The underlying implementation of `ZeroClipboard.setData`.
* @private
*/
var _setData = function(format, data) {
var dataObj;
if (typeof format === "object" && format && typeof data === "undefined") {
dataObj = format;
ZeroClipboard.clearData();
} else if (typeof format === "string" && format) {
dataObj = {};
dataObj[format] = data;
} else {
return;
}
for (var dataFormat in dataObj) {
if (typeof dataFormat === "string" && dataFormat && _hasOwn.call(dataObj, dataFormat) && typeof dataObj[dataFormat] === "string" && dataObj[dataFormat]) {
_clipData[dataFormat] = dataObj[dataFormat];
}
}
};
/**
* The underlying implementation of `ZeroClipboard.clearData`.
* @private
*/
var _clearData = function(format) {
if (typeof format === "undefined") {
_deleteOwnProperties(_clipData);
_clipDataFormatMap = null;
} else if (typeof format === "string" && _hasOwn.call(_clipData, format)) {
delete _clipData[format];
}
};
/**
* The underlying implementation of `ZeroClipboard.activate`.
* @private
*/
var _activate = function(element) {
if (!(element && element.nodeType === 1)) {
return;
}
if (_currentElement) {
_removeClass(_currentElement, _globalConfig.activeClass);
if (_currentElement !== element) {
_removeClass(_currentElement, _globalConfig.hoverClass);
}
}
_currentElement = element;
_addClass(element, _globalConfig.hoverClass);
var newTitle = element.getAttribute("title") || _globalConfig.title;
if (typeof newTitle === "string" && newTitle) {
var htmlBridge = _getHtmlBridge(_flashState.bridge);
if (htmlBridge) {
htmlBridge.setAttribute("title", newTitle);
}
}
var useHandCursor = _globalConfig.forceHandCursor === true || _getStyle(element, "cursor") === "pointer";
_setHandCursor(useHandCursor);
_reposition();
};
/**
* The underlying implementation of `ZeroClipboard.deactivate`.
* @private
*/
var _deactivate = function() {
var htmlBridge = _getHtmlBridge(_flashState.bridge);
if (htmlBridge) {
htmlBridge.removeAttribute("title");
htmlBridge.style.left = "0px";
htmlBridge.style.top = "-9999px";
htmlBridge.style.width = "1px";
htmlBridge.style.top = "1px";
}
if (_currentElement) {
_removeClass(_currentElement, _globalConfig.hoverClass);
_removeClass(_currentElement, _globalConfig.activeClass);
_currentElement = null;
}
};
/**
* Check if a value is a valid HTML4 `ID` or `Name` token.
* @private
*/
var _isValidHtml4Id = function(id) {
return typeof id === "string" && id && /^[A-Za-z][A-Za-z0-9_:\-\.]*$/.test(id);
};
/**
* Create or update an `event` object, based on the `eventType`.
* @private
*/
var _createEvent = function(event) {
var eventType;
if (typeof event === "string" && event) {
eventType = event;
event = {};
} else if (typeof event === "object" && event && typeof event.type === "string" && event.type) {
eventType = event.type;
}
if (!eventType) {
return;
}
_extend(event, {
type: eventType.toLowerCase(),
target: event.target || _currentElement || null,
relatedTarget: event.relatedTarget || null,
currentTarget: _flashState && _flashState.bridge || null,
timeStamp: event.timeStamp || _now() || null
});
var msg = _eventMessages[event.type];
if (event.type === "error" && event.name && msg) {
msg = msg[event.name];
}
if (msg) {
event.message = msg;
}
if (event.type === "ready") {
_extend(event, {
target: null,
version: _flashState.version
});
}
if (event.type === "error") {
if (/^flash-(disabled|outdated|unavailable|deactivated|overdue)$/.test(event.name)) {
_extend(event, {
target: null,
minimumVersion: _minimumFlashVersion
});
}
if (/^flash-(outdated|unavailable|deactivated|overdue)$/.test(event.name)) {
_extend(event, {
version: _flashState.version
});
}
}
if (event.type === "copy") {
event.clipboardData = {
setData: ZeroClipboard.setData,
clearData: ZeroClipboard.clearData
};
}
if (event.type === "aftercopy") {
event = _mapClipResultsFromFlash(event, _clipDataFormatMap);
}
if (event.target && !event.relatedTarget) {
event.relatedTarget = _getRelatedTarget(event.target);
}
event = _addMouseData(event);
return event;
};
/**
* Get a relatedTarget from the target's `data-clipboard-target` attribute
* @private
*/
var _getRelatedTarget = function(targetEl) {
var relatedTargetId = targetEl && targetEl.getAttribute && targetEl.getAttribute("data-clipboard-target");
return relatedTargetId ? _document.getElementById(relatedTargetId) : null;
};
/**
* Add element and position data to `MouseEvent` instances
* @private
*/
var _addMouseData = function(event) {
if (event && /^_(?:click|mouse(?:over|out|down|up|move))$/.test(event.type)) {
var srcElement = event.target;
var fromElement = event.type === "_mouseover" && event.relatedTarget ? event.relatedTarget : undefined;
var toElement = event.type === "_mouseout" && event.relatedTarget ? event.relatedTarget : undefined;
var pos = _getDOMObjectPosition(srcElement);
var screenLeft = _window.screenLeft || _window.screenX || 0;
var screenTop = _window.screenTop || _window.screenY || 0;
var scrollLeft = _document.body.scrollLeft + _document.documentElement.scrollLeft;
var scrollTop = _document.body.scrollTop + _document.documentElement.scrollTop;
var pageX = pos.left + (typeof event._stageX === "number" ? event._stageX : 0);
var pageY = pos.top + (typeof event._stageY === "number" ? event._stageY : 0);
var clientX = pageX - scrollLeft;
var clientY = pageY - scrollTop;
var screenX = screenLeft + clientX;
var screenY = screenTop + clientY;
var moveX = typeof event.movementX === "number" ? event.movementX : 0;
var moveY = typeof event.movementY === "number" ? event.movementY : 0;
delete event._stageX;
delete event._stageY;
_extend(event, {
srcElement: srcElement,
fromElement: fromElement,
toElement: toElement,
screenX: screenX,
screenY: screenY,
pageX: pageX,
pageY: pageY,
clientX: clientX,
clientY: clientY,
x: clientX,
y: clientY,
movementX: moveX,
movementY: moveY,
offsetX: 0,
offsetY: 0,
layerX: 0,
layerY: 0
});
}
return event;
};
/**
* Determine if an event's registered handlers should be execute synchronously or asynchronously.
*
* @returns {boolean}
* @private
*/
var _shouldPerformAsync = function(event) {
var eventType = event && typeof event.type === "string" && event.type || "";
return !/^(?:(?:before)?copy|destroy)$/.test(eventType);
};
/**
* Control if a callback should be executed asynchronously or not.
*
* @returns `undefined`
* @private
*/
var _dispatchCallback = function(func, context, args, async) {
if (async) {
_setTimeout(function() {
func.apply(context, args);
}, 0);
} else {
func.apply(context, args);
}
};
/**
* Handle the actual dispatching of events to client instances.
*
* @returns `undefined`
* @private
*/
var _dispatchCallbacks = function(event) {
if (!(typeof event === "object" && event && event.type)) {
return;
}
var async = _shouldPerformAsync(event);
var wildcardTypeHandlers = _handlers["*"] || [];
var specificTypeHandlers = _handlers[event.type] || [];
var handlers = wildcardTypeHandlers.concat(specificTypeHandlers);
if (handlers && handlers.length) {
var i, len, func, context, eventCopy, originalContext = this;
for (i = 0, len = handlers.length; i < len; i++) {
func = handlers[i];
context = originalContext;
if (typeof func === "string" && typeof _window[func] === "function") {
func = _window[func];
}
if (typeof func === "object" && func && typeof func.handleEvent === "function") {
context = func;
func = func.handleEvent;
}
if (typeof func === "function") {
eventCopy = _extend({}, event);
_dispatchCallback(func, context, [ eventCopy ], async);
}
}
}
return this;
};
/**
* Preprocess any special behaviors, reactions, or state changes after receiving this event.
* Executes only once per event emitted, NOT once per client.
* @private
*/
var _preprocessEvent = function(event) {
var element = event.target || _currentElement || null;
var sourceIsSwf = event._source === "swf";
delete event._source;
switch (event.type) {
case "error":
if (_inArray(event.name, [ "flash-disabled", "flash-outdated", "flash-deactivated", "flash-overdue" ])) {
_extend(_flashState, {
disabled: event.name === "flash-disabled",
outdated: event.name === "flash-outdated",
unavailable: event.name === "flash-unavailable",
deactivated: event.name === "flash-deactivated",
overdue: event.name === "flash-overdue",
ready: false
});
}
break;
case "ready":
var wasDeactivated = _flashState.deactivated === true;
_extend(_flashState, {
disabled: false,
outdated: false,
unavailable: false,
deactivated: false,
overdue: wasDeactivated,
ready: !wasDeactivated
});
break;
case "copy":
var textContent, htmlContent, targetEl = event.relatedTarget;
if (!(_clipData["text/html"] || _clipData["text/plain"]) && targetEl && (htmlContent = targetEl.value || targetEl.outerHTML || targetEl.innerHTML) && (textContent = targetEl.value || targetEl.textContent || targetEl.innerText)) {
event.clipboardData.clearData();
event.clipboardData.setData("text/plain", textContent);
if (htmlContent !== textContent) {
event.clipboardData.setData("text/html", htmlContent);
}
} else if (!_clipData["text/plain"] && event.target && (textContent = event.target.getAttribute("data-clipboard-text"))) {
event.clipboardData.clearData();
event.clipboardData.setData("text/plain", textContent);
}
break;
case "aftercopy":
ZeroClipboard.clearData();
if (element && element !== _safeActiveElement() && element.focus) {
element.focus();
}
break;
case "_mouseover":
ZeroClipboard.activate(element);
if (_globalConfig.bubbleEvents === true && sourceIsSwf) {
_fireMouseEvent(_extend({}, event, {
type: "mouseover"
}));
_fireMouseEvent(_extend({}, event, {
type: "mouseenter",
bubbles: false
}));
}
break;
case "_mouseout":
ZeroClipboard.deactivate();
if (_globalConfig.bubbleEvents === true && sourceIsSwf) {
_fireMouseEvent(_extend({}, event, {
type: "mouseout"
}));
_fireMouseEvent(_extend({}, event, {
type: "mouseleave",
bubbles: false
}));
}
break;
case "_mousedown":
_addClass(element, _globalConfig.activeClass);
if (_globalConfig.bubbleEvents === true && sourceIsSwf) {
_fireMouseEvent(_extend({}, event, {
type: event.type.slice(1)
}));
}
break;
case "_mouseup":
_removeClass(element, _globalConfig.activeClass);
if (_globalConfig.bubbleEvents === true && sourceIsSwf) {
_fireMouseEvent(_extend({}, event, {
type: event.type.slice(1)
}));
}
break;
case "_click":
case "_mousemove":
if (_globalConfig.bubbleEvents === true && sourceIsSwf) {
_fireMouseEvent(_extend({}, event, {
type: event.type.slice(1)
}));
}
break;
}
if (/^_(?:click|mouse(?:over|out|down|up|move))$/.test(event.type)) {
return true;
}
};
/**
* Dispatch a synthetic MouseEvent.
*
* @returns `undefined`
* @private
*/
var _fireMouseEvent = function(event) {
if (!(event && typeof event.type === "string" && event)) {
return;
}
var e, target = event.target || event.srcElement || null, doc = target && target.ownerDocument || _document, defaults = {
view: doc.defaultView || _window,
canBubble: true,
cancelable: true,
detail: event.type === "click" ? 1 : 0,
button: typeof event.which === "number" ? event.which - 1 : typeof event.button === "number" ? event.button : doc.createEvent ? 0 : 1
}, args = _extend(defaults, event);
if (!target) {
return;
}
if (doc.createEvent && target.dispatchEvent) {
args = [ args.type, args.canBubble, args.cancelable, args.view, args.detail, args.screenX, args.screenY, args.clientX, args.clientY, args.ctrlKey, args.altKey, args.shiftKey, args.metaKey, args.button, args.relatedTarget ];
e = doc.createEvent("MouseEvents");
if (e.initMouseEvent) {
e.initMouseEvent.apply(e, args);
target.dispatchEvent(e);
}
} else if (doc.createEventObject && target.fireEvent) {
e = doc.createEventObject(args);
target.fireEvent("on" + args.type, e);
}
};
/**
* Create the HTML bridge element to embed the Flash object into.
* @private
*/
var _createHtmlBridge = function() {
var container = _document.createElement("div");
container.id = _globalConfig.containerId;
container.className = _globalConfig.containerClass;
container.style.position = "absolute";
container.style.left = "0px";
container.style.top = "-9999px";
container.style.width = "1px";
container.style.height = "1px";
container.style.zIndex = "" + _getSafeZIndex(_globalConfig.zIndex);
return container;
};
/**
* Get the HTML element container that wraps the Flash bridge object/element.
* @private
*/
var _getHtmlBridge = function(flashBridge) {
var htmlBridge = flashBridge && flashBridge.parentNode;
while (htmlBridge && htmlBridge.nodeName === "OBJECT" && htmlBridge.parentNode) {
htmlBridge = htmlBridge.parentNode;
}
return htmlBridge || null;
};
/**
* Create the SWF object.
*
* @returns The SWF object reference.
* @private
*/
var _embedSwf = function() {
var len, flashBridge = _flashState.bridge, container = _getHtmlBridge(flashBridge);
if (!flashBridge) {
var allowScriptAccess = _determineScriptAccess(_window.location.host, _globalConfig);
var allowNetworking = allowScriptAccess === "never" ? "none" : "all";
var flashvars = _vars(_globalConfig);
var swfUrl = _globalConfig.swfPath + _cacheBust(_globalConfig.swfPath, _globalConfig);
container = _createHtmlBridge();
var divToBeReplaced = _document.createElement("div");
container.appendChild(divToBeReplaced);
_document.body.appendChild(container);
var tmpDiv = _document.createElement("div");
var oldIE = _flashState.pluginType === "activex";
tmpDiv.innerHTML = '<object id="' + _globalConfig.swfObjectId + '" name="' + _globalConfig.swfObjectId + '" ' + 'width="100%" height="100%" ' + (oldIE ? 'classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"' : 'type="application/x-shockwave-flash" data="' + swfUrl + '"') + ">" + (oldIE ? '<param name="movie" value="' + swfUrl + '"/>' : "") + '<param name="allowScriptAccess" value="' + allowScriptAccess + '"/>' + '<param name="allowNetworking" value="' + allowNetworking + '"/>' + '<param name="menu" value="false"/>' + '<param name="wmode" value="transparent"/>' + '<param name="flashvars" value="' + flashvars + '"/>' + "</object>";
flashBridge = tmpDiv.firstChild;
tmpDiv = null;
flashBridge.ZeroClipboard = ZeroClipboard;
container.replaceChild(flashBridge, divToBeReplaced);
}
if (!flashBridge) {
flashBridge = _document[_globalConfig.swfObjectId];
if (flashBridge && (len = flashBridge.length)) {
flashBridge = flashBridge[len - 1];
}
if (!flashBridge && container) {
flashBridge = container.firstChild;
}
}
_flashState.bridge = flashBridge || null;
return flashBridge;
};
/**
* Destroy the SWF object.
* @private
*/
var _unembedSwf = function() {
var flashBridge = _flashState.bridge;
if (flashBridge) {
var htmlBridge = _getHtmlBridge(flashBridge);
if (htmlBridge) {
if (_flashState.pluginType === "activex" && "readyState" in flashBridge) {
flashBridge.style.display = "none";
(function removeSwfFromIE() {
if (flashBridge.readyState === 4) {
for (var prop in flashBridge) {
if (typeof flashBridge[prop] === "function") {
flashBridge[prop] = null;
}
}
if (flashBridge.parentNode) {
flashBridge.parentNode.removeChild(flashBridge);
}
if (htmlBridge.parentNode) {
htmlBridge.parentNode.removeChild(htmlBridge);
}
} else {
_setTimeout(removeSwfFromIE, 10);
}
})();
} else {
if (flashBridge.parentNode) {
flashBridge.parentNode.removeChild(flashBridge);
}
if (htmlBridge.parentNode) {
htmlBridge.parentNode.removeChild(htmlBridge);
}
}
}
_flashState.ready = null;
_flashState.bridge = null;
_flashState.deactivated = null;
}
};
/**
* Map the data format names of the "clipData" to Flash-friendly names.
*
* @returns A new transformed object.
* @private
*/
var _mapClipDataToFlash = function(clipData) {
var newClipData = {}, formatMap = {};
if (!(typeof clipData === "object" && clipData)) {
return;
}
for (var dataFormat in clipData) {
if (dataFormat && _hasOwn.call(clipData, dataFormat) && typeof clipData[dataFormat] === "string" && clipData[dataFormat]) {
switch (dataFormat.toLowerCase()) {
case "text/plain":
case "text":
case "air:text":
case "flash:text":
newClipData.text = clipData[dataFormat];
formatMap.text = dataFormat;
break;
case "text/html":
case "html":
case "air:html":
case "flash:html":
newClipData.html = clipData[dataFormat];
formatMap.html = dataFormat;
break;
case "application/rtf":
case "text/rtf":
case "rtf":
case "richtext":
case "air:rtf":
case "flash:rtf":
newClipData.rtf = clipData[dataFormat];
formatMap.rtf = dataFormat;
break;
default:
break;
}
}
}
return {
data: newClipData,
formatMap: formatMap
};
};
/**
* Map the data format names from Flash-friendly names back to their original "clipData" names (via a format mapping).
*
* @returns A new transformed object.
* @private
*/
var _mapClipResultsFromFlash = function(clipResults, formatMap) {
if (!(typeof clipResults === "object" && clipResults && typeof formatMap === "object" && formatMap)) {
return clipResults;
}
var newResults = {};
for (var prop in clipResults) {
if (_hasOwn.call(clipResults, prop)) {
if (prop !== "success" && prop !== "data") {
newResults[prop] = clipResults[prop];
continue;
}
newResults[prop] = {};
var tmpHash = clipResults[prop];
for (var dataFormat in tmpHash) {
if (dataFormat && _hasOwn.call(tmpHash, dataFormat) && _hasOwn.call(formatMap, dataFormat)) {
newResults[prop][formatMap[dataFormat]] = tmpHash[dataFormat];
}
}
}
}
return newResults;
};
/**
* Will look at a path, and will create a "?noCache={time}" or "&noCache={time}"
* query param string to return. Does NOT append that string to the original path.
* This is useful because ExternalInterface often breaks when a Flash SWF is cached.
*
* @returns The `noCache` query param with necessary "?"/"&" prefix.
* @private
*/
var _cacheBust = function(path, options) {
var cacheBust = options == null || options && options.cacheBust === true;
if (cacheBust) {
return (path.indexOf("?") === -1 ? "?" : "&") + "noCache=" + _now();
} else {
return "";
}
};
/**
* Creates a query string for the FlashVars param.
* Does NOT include the cache-busting query param.
*
* @returns FlashVars query string
* @private
*/
var _vars = function(options) {
var i, len, domain, domains, str = "", trustedOriginsExpanded = [];
if (options.trustedDomains) {
if (typeof options.trustedDomains === "string") {
domains = [ options.trustedDomains ];
} else if (typeof options.trustedDomains === "object" && "length" in options.trustedDomains) {
domains = options.trustedDomains;
}
}
if (domains && domains.length) {
for (i = 0, len = domains.length; i < len; i++) {
if (_hasOwn.call(domains, i) && domains[i] && typeof domains[i] === "string") {
domain = _extractDomain(domains[i]);
if (!domain) {
continue;
}
if (domain === "*") {
trustedOriginsExpanded = [ domain ];
break;
}
trustedOriginsExpanded.push.apply(trustedOriginsExpanded, [ domain, "//" + domain, _window.location.protocol + "//" + domain ]);
}
}
}
if (trustedOriginsExpanded.length) {
str += "trustedOrigins=" + _encodeURIComponent(trustedOriginsExpanded.join(","));
}
if (options.forceEnhancedClipboard === true) {
str += (str ? "&" : "") + "forceEnhancedClipboard=true";
}
if (typeof options.swfObjectId === "string" && options.swfObjectId) {
str += (str ? "&" : "") + "swfObjectId=" + _encodeURIComponent(options.swfObjectId);
}
return str;
};
/**
* Extract the domain (e.g. "github.com") from an origin (e.g. "https://github.com") or
* URL (e.g. "https://github.com/zeroclipboard/zeroclipboard/").
*
* @returns the domain
* @private
*/
var _extractDomain = function(originOrUrl) {
if (originOrUrl == null || originOrUrl === "") {
return null;
}
originOrUrl = originOrUrl.replace(/^\s+|\s+$/g, "");
if (originOrUrl === "") {
return null;
}
var protocolIndex = originOrUrl.indexOf("//");
originOrUrl = protocolIndex === -1 ? originOrUrl : originOrUrl.slice(protocolIndex + 2);
var pathIndex = originOrUrl.indexOf("/");
originOrUrl = pathIndex === -1 ? originOrUrl : protocolIndex === -1 || pathIndex === 0 ? null : originOrUrl.slice(0, pathIndex);
if (originOrUrl && originOrUrl.slice(-4).toLowerCase() === ".swf") {
return null;
}
return originOrUrl || null;
};
/**
* Set `allowScriptAccess` based on `trustedDomains` and `window.location.host` vs. `swfPath`.
*
* @returns The appropriate script access level.
* @private
*/
var _determineScriptAccess = function() {
var _extractAllDomains = function(origins, resultsArray) {
var i, len, tmp;
if (origins == null || resultsArray[0] === "*") {
return;
}
if (typeof origins === "string") {
origins = [ origins ];
}
if (!(typeof origins === "object" && typeof origins.length === "number")) {
return;
}
for (i = 0, len = origins.length; i < len; i++) {
if (_hasOwn.call(origins, i) && (tmp = _extractDomain(origins[i]))) {
if (tmp === "*") {
resultsArray.length = 0;
resultsArray.push("*");
break;
}
if (_inArray(tmp, resultsArray) === -1) {
resultsArray.push(tmp);
}
}
}
};
return function(currentDomain, configOptions) {
var swfDomain = _extractDomain(configOptions.swfPath);
if (swfDomain === null) {
swfDomain = currentDomain;
}
var trustedDomains = [];
_extractAllDomains(configOptions.trustedOrigins, trustedDomains);
_extractAllDomains(configOptions.trustedDomains, trustedDomains);
var len = trustedDomains.length;
if (len > 0) {
if (len === 1 && trustedDomains[0] === "*") {
return "always";
}
if (_inArray(currentDomain, trustedDomains) !== -1) {
if (len === 1 && currentDomain === swfDomain) {
return "sameDomain";
}
return "always";
}
}
return "never";
};
}();
/**
* Get the currently active/focused DOM element.
*
* @returns the currently active/focused element, or `null`
* @private
*/
var _safeActiveElement = function() {
try {
return _document.activeElement;
} catch (err) {
return null;
}
};
/**
* Add a class to an element, if it doesn't already have it.
*
* @returns The element, with its new class added.
* @private
*/
var _addClass = function(element, value) {
if (!element || element.nodeType !== 1) {
return element;
}
if (element.classList) {
if (!element.classList.contains(value)) {
element.classList.add(value);
}
return element;
}
if (value && typeof value === "string") {
var classNames = (value || "").split(/\s+/);
if (element.nodeType === 1) {
if (!element.className) {
element.className = value;
} else {
var className = " " + element.className + " ", setClass = element.className;
for (var c = 0, cl = classNames.length; c < cl; c++) {
if (className.indexOf(" " + classNames[c] + " ") < 0) {
setClass += " " + classNames[c];
}
}
element.className = setClass.replace(/^\s+|\s+$/g, "");
}
}
}
return element;
};
/**
* Remove a class from an element, if it has it.
*
* @returns The element, with its class removed.
* @private
*/
var _removeClass = function(element, value) {
if (!element || element.nodeType !== 1) {
return element;
}
if (element.classList) {
if (element.classList.contains(value)) {
element.classList.remove(value);
}
return element;
}
if (typeof value === "string" && value) {
var classNames = value.split(/\s+/);
if (element.nodeType === 1 && element.className) {
var className = (" " + element.className + " ").replace(/[\n\t]/g, " ");
for (var c = 0, cl = classNames.length; c < cl; c++) {
className = className.replace(" " + classNames[c] + " ", " ");
}
element.className = className.replace(/^\s+|\s+$/g, "");
}
}
return element;
};
/**
* Convert standard CSS property names into the equivalent CSS property names
* for use by oldIE and/or `el.style.{prop}`.
*
* NOTE: oldIE has other special cases that are not accounted for here,
* e.g. "float" -> "styleFloat"
*
* @example _camelizeCssPropName("z-index") -> "zIndex"
*
* @returns The CSS property name for oldIE and/or `el.style.{prop}`
* @private
*/
var _camelizeCssPropName = function() {
var matcherRegex = /\-([a-z])/g, replacerFn = function(match, group) {
return group.toUpperCase();
};
return function(prop) {
return prop.replace(matcherRegex, replacerFn);
};
}();
/**
* Attempt to interpret the element's CSS styling. If `prop` is `"cursor"`,
* then we assume that it should be a hand ("pointer") cursor if the element
* is an anchor element ("a" tag).
*
* @returns The computed style property.
* @private
*/
var _getStyle = function(el, prop) {
var value, camelProp, tagName;
if (_window.getComputedStyle) {
value = _window.getComputedStyle(el, null).getPropertyValue(prop);
} else {
camelProp = _camelizeCssPropName(prop);
if (el.currentStyle) {
value = el.currentStyle[camelProp];
} else {
value = el.style[camelProp];
}
}
if (prop === "cursor") {
if (!value || value === "auto") {
tagName = el.tagName.toLowerCase();
if (tagName === "a") {
return "pointer";
}
}
}
return value;
};
/**
* Get the zoom factor of the browser. Always returns `1.0`, except at
* non-default zoom levels in IE<8 and some older versions of WebKit.
*
* @returns Floating unit percentage of the zoom factor (e.g. 150% = `1.5`).
* @private
*/
var _getZoomFactor = function() {
var rect, physicalWidth, logicalWidth, zoomFactor = 1;
if (typeof _document.body.getBoundingClientRect === "function") {
rect = _document.body.getBoundingClientRect();
physicalWidth = rect.right - rect.left;
logicalWidth = _document.body.offsetWidth;
zoomFactor = _Math.round(physicalWidth / logicalWidth * 100) / 100;
}
return zoomFactor;
};
/**
* Get the DOM positioning info of an element.
*
* @returns Object containing the element's position, width, and height.
* @private
*/
var _getDOMObjectPosition = function(obj) {
var info = {
left: 0,
top: 0,
width: 0,
height: 0
};
if (obj.getBoundingClientRect) {
var rect = obj.getBoundingClientRect();
var pageXOffset, pageYOffset, zoomFactor;
if ("pageXOffset" in _window && "pageYOffset" in _window) {
pageXOffset = _window.pageXOffset;
pageYOffset = _window.pageYOffset;
} else {
zoomFactor = _getZoomFactor();
pageXOffset = _Math.round(_document.documentElement.scrollLeft / zoomFactor);
pageYOffset = _Math.round(_document.documentElement.scrollTop / zoomFactor);
}
var leftBorderWidth = _document.documentElement.clientLeft || 0;
var topBorderWidth = _document.documentElement.clientTop || 0;
info.left = rect.left + pageXOffset - leftBorderWidth;
info.top = rect.top + pageYOffset - topBorderWidth;
info.width = "width" in rect ? rect.width : rect.right - rect.left;
info.height = "height" in rect ? rect.height : rect.bottom - rect.top;
}
return info;
};
/**
* Reposition the Flash object to cover the currently activated element.
*
* @returns `undefined`
* @private
*/
var _reposition = function() {
var htmlBridge;
if (_currentElement && (htmlBridge = _getHtmlBridge(_flashState.bridge))) {
var pos = _getDOMObjectPosition(_currentElement);
_extend(htmlBridge.style, {
width: pos.width + "px",
height: pos.height + "px",
top: pos.top + "px",
left: pos.left + "px",
zIndex: "" + _getSafeZIndex(_globalConfig.zIndex)
});
}
};
/**
* Sends a signal to the Flash object to display the hand cursor if `true`.
*
* @returns `undefined`
* @private
*/
var _setHandCursor = function(enabled) {
if (_flashState.ready === true) {
if (_flashState.bridge && typeof _flashState.bridge.setHandCursor === "function") {
_flashState.bridge.setHandCursor(enabled);
} else {
_flashState.ready = false;
}
}
};
/**
* Get a safe value for `zIndex`
*
* @returns an integer, or "auto"
* @private
*/
var _getSafeZIndex = function(val) {
if (/^(?:auto|inherit)$/.test(val)) {
return val;
}
var zIndex;
if (typeof val === "number" && !_isNaN(val)) {
zIndex = val;
} else if (typeof val === "string") {
zIndex = _getSafeZIndex(_parseInt(val, 10));
}
return typeof zIndex === "number" ? zIndex : "auto";
};
/**
* Detect the Flash Player status, version, and plugin type.
*
* @see {@link https://code.google.com/p/doctype-mirror/wiki/ArticleDetectFlash#The_code}
* @see {@link http://stackoverflow.com/questions/12866060/detecting-pepper-ppapi-flash-with-javascript}
*
* @returns `undefined`
* @private
*/
var _detectFlashSupport = function(ActiveXObject) {
var plugin, ax, mimeType, hasFlash = false, isActiveX = false, isPPAPI = false, flashVersion = "";
/**
* Derived from Apple's suggested sniffer.
* @param {String} desc e.g. "Shockwave Flash 7.0 r61"
* @returns {String} "7.0.61"
* @private
*/
function parseFlashVersion(desc) {
var matches = desc.match(/[\d]+/g);
matches.length = 3;
return matches.join(".");
}
function isPepperFlash(flashPlayerFileName) {
return !!flashPlayerFileName && (flashPlayerFileName = flashPlayerFileName.toLowerCase()) && (/^(pepflashplayer\.dll|libpepflashplayer\.so|pepperflashplayer\.plugin)$/.test(flashPlayerFileName) || flashPlayerFileName.slice(-13) === "chrome.plugin");
}
function inspectPlugin(plugin) {
if (plugin) {
hasFlash = true;
if (plugin.version) {
flashVersion = parseFlashVersion(plugin.version);
}
if (!flashVersion && plugin.description) {
flashVersion = parseFlashVersion(plugin.description);
}
if (plugin.filename) {
isPPAPI = isPepperFlash(plugin.filename);
}
}
}
if (_navigator.plugins && _navigator.plugins.length) {
plugin = _navigator.plugins["Shockwave Flash"];
inspectPlugin(plugin);
if (_navigator.plugins["Shockwave Flash 2.0"]) {
hasFlash = true;
flashVersion = "2.0.0.11";
}
} else if (_navigator.mimeTypes && _navigator.mimeTypes.length) {
mimeType = _navigator.mimeTypes["application/x-shockwave-flash"];
plugin = mimeType && mimeType.enabledPlugin;
inspectPlugin(plugin);
} else if (typeof ActiveXObject !== "undefined") {
isActiveX = true;
try {
ax = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
hasFlash = true;
flashVersion = parseFlashVersion(ax.GetVariable("$version"));
} catch (e1) {
try {
ax = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
hasFlash = true;
flashVersion = "6.0.21";
} catch (e2) {
try {
ax = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
hasFlash = true;
flashVersion = parseFlashVersion(ax.GetVariable("$version"));
} catch (e3) {
isActiveX = false;
}
}
}
}
_flashState.disabled = hasFlash !== true;
_flashState.outdated = flashVersion && _parseFloat(flashVersion) < _parseFloat(_minimumFlashVersion);
_flashState.version = flashVersion || "0.0.0";
_flashState.pluginType = isPPAPI ? "pepper" : isActiveX ? "activex" : hasFlash ? "netscape" : "unknown";
};
/**
* Invoke the Flash detection algorithms immediately upon inclusion so we're not waiting later.
*/
_detectFlashSupport(_ActiveXObject);
/**
* A shell constructor for `ZeroClipboard` client instances.
*
* @constructor
*/
var ZeroClipboard = function() {
if (!(this instanceof ZeroClipboard)) {
return new ZeroClipboard();
}
if (typeof ZeroClipboard._createClient === "function") {
ZeroClipboard._createClient.apply(this, _args(arguments));
}
};
/**
* The ZeroClipboard library's version number.
*
* @static
* @readonly
* @property {string}
*/
ZeroClipboard.version = "2.0.0";
_makeReadOnly(ZeroClipboard, "version");
/**
* Update or get a copy of the ZeroClipboard global configuration.
* Returns a copy of the current/updated configuration.
*
* @returns Object
* @static
*/
ZeroClipboard.config = function() {
return _config.apply(this, _args(arguments));
};
/**
* Diagnostic method that describes the state of the browser, Flash Player, and ZeroClipboard.
*
* @returns Object
* @static
*/
ZeroClipboard.state = function() {
return _state.apply(this, _args(arguments));
};
/**
* Check if Flash is unusable for any reason: disabled, outdated, deactivated, etc.
*
* @returns Boolean
* @static
*/
ZeroClipboard.isFlashUnusable = function() {
return _isFlashUnusable.apply(this, _args(arguments));
};
/**
* Register an event listener.
*
* @returns `ZeroClipboard`
* @static
*/
ZeroClipboard.on = function() {
return _on.apply(this, _args(arguments));
};
/**
* Unregister an event listener.
* If no `listener` function/object is provided, it will unregister all listeners for the provided `eventType`.
* If no `eventType` is provided, it will unregister all listeners for every event type.
*
* @returns `ZeroClipboard`
* @static
*/
ZeroClipboard.off = function() {
return _off.apply(this, _args(arguments));
};
/**
* Retrieve event listeners for an `eventType`.
* If no `eventType` is provided, it will retrieve all listeners for every event type.
*
* @returns array of listeners for the `eventType`; if no `eventType`, then a map/hash object of listeners for all event types; or `null`
*/
ZeroClipboard.handlers = function() {
return _listeners.apply(this, _args(arguments));
};
/**
* Event emission receiver from the Flash object, forwarding to any registered JavaScript event listeners.
*
* @returns For the "copy" event, returns the Flash-friendly "clipData" object; otherwise `undefined`.
* @static
*/
ZeroClipboard.emit = function() {
return _emit.apply(this, _args(arguments));
};
/**
* Create and embed the Flash object.
*
* @returns The Flash object
* @static
*/
ZeroClipboard.create = function() {
return _create.apply(this, _args(arguments));
};
/**
* Self-destruct and clean up everything, including the embedded Flash object.
*
* @returns `undefined`
* @static
*/
ZeroClipboard.destroy = function() {
return _destroy.apply(this, _args(arguments));
};
/**
* Set the pending data for clipboard injection.
*
* @returns `undefined`
* @static
*/
ZeroClipboard.setData = function() {
return _setData.apply(this, _args(arguments));
};
/**
* Clear the pending data for clipboard injection.
* If no `format` is provided, all pending data formats will be cleared.
*
* @returns `undefined`
* @static
*/
ZeroClipboard.clearData = function() {
return _clearData.apply(this, _args(arguments));
};
/**
* Sets the current HTML object that the Flash object should overlay. This will put the global
* Flash object on top of the current element; depending on the setup, this may also set the
* pending clipboard text data as well as the Flash object's wrapping element's title attribute
* based on the underlying HTML element and ZeroClipboard configuration.
*
* @returns `undefined`
* @static
*/
ZeroClipboard.activate = function() {
return _activate.apply(this, _args(arguments));
};
/**
* Un-overlays the Flash object. This will put the global Flash object off-screen; depending on
* the setup, this may also unset the Flash object's wrapping element's title attribute based on
* the underlying HTML element and ZeroClipboard configuration.
*
* @returns `undefined`
* @static
*/
ZeroClipboard.deactivate = function() {
return _deactivate.apply(this, _args(arguments));
};
/**
* Keep track of the ZeroClipboard client instance counter.
*/
var _clientIdCounter = 0;
/**
* Keep track of the state of the client instances.
*
* Entry structure:
* _clientMeta[client.id] = {
* instance: client,
* elements: [],
* handlers: {}
* };
*/
var _clientMeta = {};
/**
* Keep track of the ZeroClipboard clipped elements counter.
*/
var _elementIdCounter = 0;
/**
* Keep track of the state of the clipped element relationships to clients.
*
* Entry structure:
* _elementMeta[element.zcClippingId] = [client1.id, client2.id];
*/
var _elementMeta = {};
/**
* Keep track of the state of the mouse event handlers for clipped elements.
*
* Entry structure:
* _mouseHandlers[element.zcClippingId] = {
* mouseover: function(event) {},
* mouseout: function(event) {},
* mousedown: function(event) {},
* mouseup: function(event) {}
* };
*/
var _mouseHandlers = {};
/**
* Extending the ZeroClipboard configuration defaults for the Client module.
*/
_extend(_globalConfig, {
autoActivate: true
});
/**
* The real constructor for `ZeroClipboard` client instances.
* @private
*/
var _clientConstructor = function(elements) {
var client = this;
client.id = "" + _clientIdCounter++;
_clientMeta[client.id] = {
instance: client,
elements: [],
handlers: {}
};
if (elements) {
client.clip(elements);
}
ZeroClipboard.on("*", function(event) {
return client.emit(event);
});
ZeroClipboard.on("destroy", function() {
client.destroy();
});
ZeroClipboard.create();
};
/**
* The underlying implementation of `ZeroClipboard.Client.prototype.on`.
* @private
*/
var _clientOn = function(eventType, listener) {
var i, len, events, added = {}, handlers = _clientMeta[this.id] && _clientMeta[this.id].handlers;
if (typeof eventType === "string" && eventType) {
events = eventType.toLowerCase().split(/\s+/);
} else if (typeof eventType === "object" && eventType && typeof listener === "undefined") {
for (i in eventType) {
if (_hasOwn.call(eventType, i) && typeof i === "string" && i && typeof eventType[i] === "function") {
this.on(i, eventType[i]);
}
}
}
if (events && events.length) {
for (i = 0, len = events.length; i < len; i++) {
eventType = events[i].replace(/^on/, "");
added[eventType] = true;
if (!handlers[eventType]) {
handlers[eventType] = [];
}
handlers[eventType].push(listener);
}
if (added.ready && _flashState.ready) {
this.emit({
type: "ready",
client: this
});
}
if (added.error) {
var errorTypes = [ "disabled", "outdated", "unavailable", "deactivated", "overdue" ];
for (i = 0, len = errorTypes.length; i < len; i++) {
if (_flashState[errorTypes[i]]) {
this.emit({
type: "error",
name: "flash-" + errorTypes[i],
client: this
});
break;
}
}
}
}
return this;
};
/**
* The underlying implementation of `ZeroClipboard.Client.prototype.off`.
* @private
*/
var _clientOff = function(eventType, listener) {
var i, len, foundIndex, events, perEventHandlers, handlers = _clientMeta[this.id] && _clientMeta[this.id].handlers;
if (arguments.length === 0) {
events = _objectKeys(handlers);
} else if (typeof eventType === "string" && eventType) {
events = eventType.split(/\s+/);
} else if (typeof eventType === "object" && eventType && typeof listener === "undefined") {
for (i in eventType) {
if (_hasOwn.call(eventType, i) && typeof i === "string" && i && typeof eventType[i] === "function") {
this.off(i, eventType[i]);
}
}
}
if (events && events.length) {
for (i = 0, len = events.length; i < len; i++) {
eventType = events[i].toLowerCase().replace(/^on/, "");
perEventHandlers = handlers[eventType];
if (perEventHandlers && perEventHandlers.length) {
if (listener) {
foundIndex = _inArray(listener, perEventHandlers);
while (foundIndex !== -1) {
perEventHandlers.splice(foundIndex, 1);
foundIndex = _inArray(listener, perEventHandlers, foundIndex);
}
} else {
perEventHandlers.length = 0;
}
}
}
}
return this;
};
/**
* The underlying implementation of `ZeroClipboard.Client.prototype.handlers`.
* @private
*/
var _clientListeners = function(eventType) {
var copy = null, handlers = _clientMeta[this.id] && _clientMeta[this.id].handlers;
if (handlers) {
if (typeof eventType === "string" && eventType) {
copy = handlers[eventType] ? handlers[eventType].slice(0) : [];
} else {
copy = _deepCopy(handlers);
}
}
return copy;
};
/**
* The underlying implementation of `ZeroClipboard.Client.prototype.emit`.
* @private
*/
var _clientEmit = function(event) {
if (_clientShouldEmit.call(this, event)) {
if (typeof event === "object" && event && typeof event.type === "string" && event.type) {
event = _extend({}, event);
}
var eventCopy = _extend({}, _createEvent(event), {
client: this
});
_clientDispatchCallbacks.call(this, eventCopy);
}
return this;
};
/**
* The underlying implementation of `ZeroClipboard.Client.prototype.clip`.
* @private
*/
var _clientClip = function(elements) {
elements = _prepClip(elements);
for (var i = 0; i < elements.length; i++) {
if (_hasOwn.call(elements, i) && elements[i] && elements[i].nodeType === 1) {
if (!elements[i].zcClippingId) {
elements[i].zcClippingId = "zcClippingId_" + _elementIdCounter++;
_elementMeta[elements[i].zcClippingId] = [ this.id ];
if (_globalConfig.autoActivate === true) {
_addMouseHandlers(elements[i]);
}
} else if (_inArray(this.id, _elementMeta[elements[i].zcClippingId]) === -1) {
_elementMeta[elements[i].zcClippingId].push(this.id);
}
var clippedElements = _clientMeta[this.id] && _clientMeta[this.id].elements;
if (_inArray(elements[i], clippedElements) === -1) {
clippedElements.push(elements[i]);
}
}
}
return this;
};
/**
* The underlying implementation of `ZeroClipboard.Client.prototype.unclip`.
* @private
*/
var _clientUnclip = function(elements) {
var meta = _clientMeta[this.id];
if (!meta) {
return this;
}
var clippedElements = meta.elements;
var arrayIndex;
if (typeof elements === "undefined") {
elements = clippedElements.slice(0);
} else {
elements = _prepClip(elements);
}
for (var i = elements.length; i--; ) {
if (_hasOwn.call(elements, i) && elements[i] && elements[i].nodeType === 1) {
arrayIndex = 0;
while ((arrayIndex = _inArray(elements[i], clippedElements, arrayIndex)) !== -1) {
clippedElements.splice(arrayIndex, 1);
}
var clientIds = _elementMeta[elements[i].zcClippingId];
if (clientIds) {
arrayIndex = 0;
while ((arrayIndex = _inArray(this.id, clientIds, arrayIndex)) !== -1) {
clientIds.splice(arrayIndex, 1);
}
if (clientIds.length === 0) {
if (_globalConfig.autoActivate === true) {
_removeMouseHandlers(elements[i]);
}
delete elements[i].zcClippingId;
}
}
}
}
return this;
};
/**
* The underlying implementation of `ZeroClipboard.Client.prototype.elements`.
* @private
*/
var _clientElements = function() {
var meta = _clientMeta[this.id];
return meta && meta.elements ? meta.elements.slice(0) : [];
};
/**
* The underlying implementation of `ZeroClipboard.Client.prototype.destroy`.
* @private
*/
var _clientDestroy = function() {
this.unclip();
this.off();
delete _clientMeta[this.id];
};
/**
* Inspect an Event to see if the Client (`this`) should honor it for emission.
* @private
*/
var _clientShouldEmit = function(event) {
if (!(event && event.type)) {
return false;
}
if (event.client && event.client !== this) {
return false;
}
var clippedEls = _clientMeta[this.id] && _clientMeta[this.id].elements;
var hasClippedEls = !!clippedEls && clippedEls.length > 0;
var goodTarget = !event.target || hasClippedEls && _inArray(event.target, clippedEls) !== -1;
var goodRelTarget = event.relatedTarget && hasClippedEls && _inArray(event.relatedTarget, clippedEls) !== -1;
var goodClient = event.client && event.client === this;
if (!(goodTarget || goodRelTarget || goodClient)) {
return false;
}
return true;
};
/**
* Handle the actual dispatching of events to a client instance.
*
* @returns `this`
* @private
*/
var _clientDispatchCallbacks = function(event) {
if (!(typeof event === "object" && event && event.type)) {
return;
}
var async = _shouldPerformAsync(event);
var wildcardTypeHandlers = _clientMeta[this.id] && _clientMeta[this.id].handlers["*"] || [];
var specificTypeHandlers = _clientMeta[this.id] && _clientMeta[this.id].handlers[event.type] || [];
var handlers = wildcardTypeHandlers.concat(specificTypeHandlers);
if (handlers && handlers.length) {
var i, len, func, context, eventCopy, originalContext = this;
for (i = 0, len = handlers.length; i < len; i++) {
func = handlers[i];
context = originalContext;
if (typeof func === "string" && typeof _window[func] === "function") {
func = _window[func];
}
if (typeof func === "object" && func && typeof func.handleEvent === "function") {
context = func;
func = func.handleEvent;
}
if (typeof func === "function") {
eventCopy = _extend({}, event);
_dispatchCallback(func, context, [ eventCopy ], async);
}
}
}
return this;
};
/**
* Prepares the elements for clipping/unclipping.
*
* @returns An Array of elements.
* @private
*/
var _prepClip = function(elements) {
if (typeof elements === "string") {
elements = [];
}
return typeof elements.length !== "number" ? [ elements ] : elements;
};
/**
* Add an event listener to a DOM element (because IE<9 sucks).
*
* @returns The element.
* @private
*/
var _addEventHandler = function(element, method, func) {
if (!element || element.nodeType !== 1) {
return element;
}
if (element.addEventListener) {
element.addEventListener(method, func, false);
} else if (element.attachEvent) {
element.attachEvent("on" + method, func);
}
return element;
};
/**
* Remove an event listener from a DOM element (because IE<9 sucks).
*
* @returns The element.
* @private
*/
var _removeEventHandler = function(element, method, func) {
if (!element || element.nodeType !== 1) {
return element;
}
if (element.removeEventListener) {
element.removeEventListener(method, func, false);
} else if (element.detachEvent) {
element.detachEvent("on" + method, func);
}
return element;
};
/**
* Add a `mouseover` handler function for a clipped element.
*
* @returns `undefined`
* @private
*/
var _addMouseHandlers = function(element) {
if (!(element && element.nodeType === 1)) {
return;
}
var _elementMouseOver = function(event) {
if (!(event || _window.event)) {
return;
}
ZeroClipboard.activate(element);
};
_addEventHandler(element, "mouseover", _elementMouseOver);
_mouseHandlers[element.zcClippingId] = {
mouseover: _elementMouseOver
};
};
/**
* Remove a `mouseover` handler function for a clipped element.
*
* @returns `undefined`
* @private
*/
var _removeMouseHandlers = function(element) {
if (!(element && element.nodeType === 1)) {
return;
}
var mouseHandlers = _mouseHandlers[element.zcClippingId];
if (!(typeof mouseHandlers === "object" && mouseHandlers)) {
return;
}
if (typeof mouseHandlers.mouseover === "function") {
_removeEventHandler(element, "mouseover", mouseHandlers.mouseover);
}
delete _mouseHandlers[element.zcClippingId];
};
/**
* Creates a new ZeroClipboard client instance.
* Optionally, auto-`clip` an element or collection of elements.
*
* @constructor
*/
ZeroClipboard._createClient = function() {
_clientConstructor.apply(this, _args(arguments));
};
/**
* Register an event listener to the client.
*
* @returns `this`
*/
ZeroClipboard.prototype.on = function() {
return _clientOn.apply(this, _args(arguments));
};
/**
* Unregister an event handler from the client.
* If no `listener` function/object is provided, it will unregister all handlers for the provided `eventType`.
* If no `eventType` is provided, it will unregister all handlers for every event type.
*
* @returns `this`
*/
ZeroClipboard.prototype.off = function() {
return _clientOff.apply(this, _args(arguments));
};
/**
* Retrieve event listeners for an `eventType` from the client.
* If no `eventType` is provided, it will retrieve all listeners for every event type.
*
* @returns array of listeners for the `eventType`; if no `eventType`, then a map/hash object of listeners for all event types; or `null`
*/
ZeroClipboard.prototype.handlers = function() {
return _clientListeners.apply(this, _args(arguments));
};
/**
* Event emission receiver from the Flash object for this client's registered JavaScript event listeners.
*
* @returns For the "copy" event, returns the Flash-friendly "clipData" object; otherwise `undefined`.
*/
ZeroClipboard.prototype.emit = function() {
return _clientEmit.apply(this, _args(arguments));
};
/**
* Register clipboard actions for new element(s) to the client.
*
* @returns `this`
*/
ZeroClipboard.prototype.clip = function() {
return _clientClip.apply(this, _args(arguments));
};
/**
* Unregister the clipboard actions of previously registered element(s) on the page.
* If no elements are provided, ALL registered elements will be unregistered.
*
* @returns `this`
*/
ZeroClipboard.prototype.unclip = function() {
return _clientUnclip.apply(this, _args(arguments));
};
/**
* Get all of the elements to which this client is clipped.
*
* @returns array of clipped elements
*/
ZeroClipboard.prototype.elements = function() {
return _clientElements.apply(this, _args(arguments));
};
/**
* Self-destruct and clean up everything for a single client.
* This will NOT destroy the embedded Flash object.
*
* @returns `undefined`
*/
ZeroClipboard.prototype.destroy = function() {
return _clientDestroy.apply(this, _args(arguments));
};
/**
* Stores the pending plain text to inject into the clipboard.
*
* @returns `this`
*/
ZeroClipboard.prototype.setText = function(text) {
ZeroClipboard.setData("text/plain", text);
return this;
};
/**
* Stores the pending HTML text to inject into the clipboard.
*
* @returns `this`
*/
ZeroClipboard.prototype.setHtml = function(html) {
ZeroClipboard.setData("text/html", html);
return this;
};
/**
* Stores the pending rich text (RTF) to inject into the clipboard.
*
* @returns `this`
*/
ZeroClipboard.prototype.setRichText = function(richText) {
ZeroClipboard.setData("application/rtf", richText);
return this;
};
/**
* Stores the pending data to inject into the clipboard.
*
* @returns `this`
*/
ZeroClipboard.prototype.setData = function() {
ZeroClipboard.setData.apply(this, _args(arguments));
return this;
};
/**
* Clears the pending data to inject into the clipboard.
* If no `format` is provided, all pending data formats will be cleared.
*
* @returns `this`
*/
ZeroClipboard.prototype.clearData = function() {
ZeroClipboard.clearData.apply(this, _args(arguments));
return this;
};
if (typeof define === "function" && define.amd) {
define(function() {
return ZeroClipboard;
});
} else if (typeof module === "object" && module && typeof module.exports === "object" && module.exports) {
module.exports = ZeroClipboard;
} else {
window.ZeroClipboard = ZeroClipboard;
}
})(function() {
return this;
}()); |
files/rxjs/2.2.10/rx.lite.js | ramda/jsdelivr | // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
;(function (undefined) {
var objectTypes = {
'boolean': false,
'function': true,
'object': true,
'number': false,
'string': false,
'undefined': false
};
var root = (objectTypes[typeof window] && window) || this,
freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports,
freeModule = objectTypes[typeof module] && module && !module.nodeType && module,
moduleExports = freeModule && freeModule.exports === freeExports && freeExports,
freeGlobal = objectTypes[typeof global] && global;
if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) {
root = freeGlobal;
}
var Rx = { Internals: {} };
// Defaults
function noop() { }
function identity(x) { return x; }
var defaultNow = Date.now;
function defaultComparer(x, y) { return isEqual(x, y); }
function defaultSubComparer(x, y) { return x - y; }
function defaultKeySerializer(x) { return x.toString(); }
function defaultError(err) { throw err; }
// Errors
var sequenceContainsNoElements = 'Sequence contains no elements.';
var argumentOutOfRange = 'Argument out of range';
var objectDisposed = 'Object has been disposed';
function checkDisposed() {
if (this.isDisposed) {
throw new Error(objectDisposed);
}
}
/** `Object#toString` result shortcuts */
var argsClass = '[object Arguments]',
arrayClass = '[object Array]',
boolClass = '[object Boolean]',
dateClass = '[object Date]',
errorClass = '[object Error]',
funcClass = '[object Function]',
numberClass = '[object Number]',
objectClass = '[object Object]',
regexpClass = '[object RegExp]',
stringClass = '[object String]';
var toString = Object.prototype.toString,
hasOwnProperty = Object.prototype.hasOwnProperty,
supportsArgsClass = toString.call(arguments) == argsClass, // For less <IE9 && FF<4
suportNodeClass;
try {
suportNodeClass = !(toString.call(document) == objectClass && !({ 'toString': 0 } + ''));
} catch(e) {
suportNodeClass = true;
}
function isNode(value) {
// IE < 9 presents DOM nodes as `Object` objects except they have `toString`
// methods that are `typeof` "string" and still can coerce nodes to strings
return typeof value.toString != 'function' && typeof (value + '') == 'string';
}
function isArguments(value) {
return (value && typeof value == 'object') ? toString.call(value) == argsClass : false;
}
// fallback for browsers that can't detect `arguments` objects by [[Class]]
if (!supportsArgsClass) {
isArguments = function(value) {
return (value && typeof value == 'object') ? hasOwnProperty.call(value, 'callee') : false;
};
}
function isFunction(value) {
return typeof value == 'function';
}
// fallback for older versions of Chrome and Safari
if (isFunction(/x/)) {
isFunction = function(value) {
return typeof value == 'function' && toString.call(value) == funcClass;
};
}
var isEqual = Rx.Internals.isEqual = function (x, y) {
return deepEquals(x, y, [], []);
};
/** @private
* Used for deep comparison
**/
function deepEquals(a, b, stackA, stackB) {
var result;
// exit early for identical values
if (a === b) {
// treat `+0` vs. `-0` as not equal
return a !== 0 || (1 / a == 1 / b);
}
var type = typeof a,
otherType = typeof b;
// exit early for unlike primitive values
if (a === a &&
!(a && objectTypes[type]) &&
!(b && objectTypes[otherType])) {
return false;
}
// exit early for `null` and `undefined`, avoiding ES3's Function#call behavior
// http://es5.github.io/#x15.3.4.4
if (a == null || b == null) {
return a === b;
}
// compare [[Class]] names
var className = toString.call(a),
otherClass = toString.call(b);
if (className == argsClass) {
className = objectClass;
}
if (otherClass == argsClass) {
otherClass = objectClass;
}
if (className != otherClass) {
return false;
}
switch (className) {
case boolClass:
case dateClass:
// coerce dates and booleans to numbers, dates to milliseconds and booleans
// to `1` or `0`, treating invalid dates coerced to `NaN` as not equal
return +a == +b;
case numberClass:
// treat `NaN` vs. `NaN` as equal
return (a != +a)
? b != +b
// but treat `+0` vs. `-0` as not equal
: (a == 0 ? (1 / a == 1 / b) : a == +b);
case regexpClass:
case stringClass:
// coerce regexes to strings (http://es5.github.io/#x15.10.6.4)
// treat string primitives and their corresponding object instances as equal
return a == String(b);
}
var isArr = className == arrayClass;
if (!isArr) {
// exit for functions and DOM nodes
if (className != objectClass || (!suportNodeClass && (isNode(a) || isNode(b)))) {
return false;
}
// in older versions of Opera, `arguments` objects have `Array` constructors
var ctorA = !supportsArgsClass && isArguments(a) ? Object : a.constructor,
ctorB = !supportsArgsClass && isArguments(b) ? Object : b.constructor;
// non `Object` object instances with different constructors are not equal
if (ctorA != ctorB && !(
isFunction(ctorA) && ctorA instanceof ctorA &&
isFunction(ctorB) && ctorB instanceof ctorB
)) {
return false;
}
}
// assume cyclic structures are equal
// the algorithm for detecting cyclic structures is adapted from ES 5.1
// section 15.12.3, abstract operation `JO` (http://es5.github.io/#x15.12.3)
var length = stackA.length;
while (length--) {
if (stackA[length] == a) {
return stackB[length] == b;
}
}
var size = 0;
result = true;
// add `a` and `b` to the stack of traversed objects
stackA.push(a);
stackB.push(b);
// recursively compare objects and arrays (susceptible to call stack limits)
if (isArr) {
length = a.length;
size = b.length;
// compare lengths to determine if a deep comparison is necessary
result = size == a.length;
// deep compare the contents, ignoring non-numeric properties
while (size--) {
var index = length,
value = b[size];
if (!(result = deepEquals(a[size], value, stackA, stackB))) {
break;
}
}
return result;
}
// deep compare each object
for(var key in b) {
if (hasOwnProperty.call(b, key)) {
// count properties and deep compare each property value
size++;
return (result = hasOwnProperty.call(a, key) && deepEquals(a[key], b[key], stackA, stackB));
}
}
if (result) {
// ensure both objects have the same number of properties
for (var key in a) {
if (hasOwnProperty.call(a, key)) {
// `size` will be `-1` if `a` has more properties than `b`
return (result = --size > -1);
}
}
}
stackA.pop();
stackB.pop();
return result;
}
var slice = Array.prototype.slice;
function argsOrArray(args, idx) {
return args.length === 1 && Array.isArray(args[idx]) ?
args[idx] :
slice.call(args);
}
var hasProp = {}.hasOwnProperty;
/** @private */
var inherits = this.inherits = Rx.Internals.inherits = function (child, parent) {
function __() { this.constructor = child; }
__.prototype = parent.prototype;
child.prototype = new __();
};
/** @private */
var addProperties = Rx.Internals.addProperties = function (obj) {
var sources = slice.call(arguments, 1);
for (var i = 0, len = sources.length; i < len; i++) {
var source = sources[i];
for (var prop in source) {
obj[prop] = source[prop];
}
}
};
// Rx Utils
var addRef = Rx.Internals.addRef = function (xs, r) {
return new AnonymousObservable(function (observer) {
return new CompositeDisposable(r.getDisposable(), xs.subscribe(observer));
});
};
// Collection polyfills
function arrayInitialize(count, factory) {
var a = new Array(count);
for (var i = 0; i < count; i++) {
a[i] = factory();
}
return a;
}
// Collections
var IndexedItem = function (id, value) {
this.id = id;
this.value = value;
};
IndexedItem.prototype.compareTo = function (other) {
var c = this.value.compareTo(other.value);
if (c === 0) {
c = this.id - other.id;
}
return c;
};
// Priority Queue for Scheduling
var PriorityQueue = Rx.Internals.PriorityQueue = function (capacity) {
this.items = new Array(capacity);
this.length = 0;
};
var priorityProto = PriorityQueue.prototype;
priorityProto.isHigherPriority = function (left, right) {
return this.items[left].compareTo(this.items[right]) < 0;
};
priorityProto.percolate = function (index) {
if (index >= this.length || index < 0) {
return;
}
var parent = index - 1 >> 1;
if (parent < 0 || parent === index) {
return;
}
if (this.isHigherPriority(index, parent)) {
var temp = this.items[index];
this.items[index] = this.items[parent];
this.items[parent] = temp;
this.percolate(parent);
}
};
priorityProto.heapify = function (index) {
if (index === undefined) {
index = 0;
}
if (index >= this.length || index < 0) {
return;
}
var left = 2 * index + 1,
right = 2 * index + 2,
first = index;
if (left < this.length && this.isHigherPriority(left, first)) {
first = left;
}
if (right < this.length && this.isHigherPriority(right, first)) {
first = right;
}
if (first !== index) {
var temp = this.items[index];
this.items[index] = this.items[first];
this.items[first] = temp;
this.heapify(first);
}
};
priorityProto.peek = function () { return this.items[0].value; };
priorityProto.removeAt = function (index) {
this.items[index] = this.items[--this.length];
delete this.items[this.length];
this.heapify();
};
priorityProto.dequeue = function () {
var result = this.peek();
this.removeAt(0);
return result;
};
priorityProto.enqueue = function (item) {
var index = this.length++;
this.items[index] = new IndexedItem(PriorityQueue.count++, item);
this.percolate(index);
};
priorityProto.remove = function (item) {
for (var i = 0; i < this.length; i++) {
if (this.items[i].value === item) {
this.removeAt(i);
return true;
}
}
return false;
};
PriorityQueue.count = 0;
/**
* Represents a group of disposable resources that are disposed together.
* @constructor
*/
var CompositeDisposable = Rx.CompositeDisposable = function () {
this.disposables = argsOrArray(arguments, 0);
this.isDisposed = false;
this.length = this.disposables.length;
};
var CompositeDisposablePrototype = CompositeDisposable.prototype;
/**
* Adds a disposable to the CompositeDisposable or disposes the disposable if the CompositeDisposable is disposed.
* @param {Mixed} item Disposable to add.
*/
CompositeDisposablePrototype.add = function (item) {
if (this.isDisposed) {
item.dispose();
} else {
this.disposables.push(item);
this.length++;
}
};
/**
* Removes and disposes the first occurrence of a disposable from the CompositeDisposable.
* @param {Mixed} item Disposable to remove.
* @returns {Boolean} true if found; false otherwise.
*/
CompositeDisposablePrototype.remove = function (item) {
var shouldDispose = false;
if (!this.isDisposed) {
var idx = this.disposables.indexOf(item);
if (idx !== -1) {
shouldDispose = true;
this.disposables.splice(idx, 1);
this.length--;
item.dispose();
}
}
return shouldDispose;
};
/**
* Disposes all disposables in the group and removes them from the group.
*/
CompositeDisposablePrototype.dispose = function () {
if (!this.isDisposed) {
this.isDisposed = true;
var currentDisposables = this.disposables.slice(0);
this.disposables = [];
this.length = 0;
for (var i = 0, len = currentDisposables.length; i < len; i++) {
currentDisposables[i].dispose();
}
}
};
/**
* Removes and disposes all disposables from the CompositeDisposable, but does not dispose the CompositeDisposable.
*/
CompositeDisposablePrototype.clear = function () {
var currentDisposables = this.disposables.slice(0);
this.disposables = [];
this.length = 0;
for (var i = 0, len = currentDisposables.length; i < len; i++) {
currentDisposables[i].dispose();
}
};
/**
* Determines whether the CompositeDisposable contains a specific disposable.
* @param {Mixed} item Disposable to search for.
* @returns {Boolean} true if the disposable was found; otherwise, false.
*/
CompositeDisposablePrototype.contains = function (item) {
return this.disposables.indexOf(item) !== -1;
};
/**
* Converts the existing CompositeDisposable to an array of disposables
* @returns {Array} An array of disposable objects.
*/
CompositeDisposablePrototype.toArray = function () {
return this.disposables.slice(0);
};
/**
* Provides a set of static methods for creating Disposables.
*
* @constructor
* @param {Function} dispose Action to run during the first call to dispose. The action is guaranteed to be run at most once.
*/
var Disposable = Rx.Disposable = function (action) {
this.isDisposed = false;
this.action = action || noop;
};
/** Performs the task of cleaning up resources. */
Disposable.prototype.dispose = function () {
if (!this.isDisposed) {
this.action();
this.isDisposed = true;
}
};
/**
* Creates a disposable object that invokes the specified action when disposed.
* @param {Function} dispose Action to run during the first call to dispose. The action is guaranteed to be run at most once.
* @return {Disposable} The disposable object that runs the given action upon disposal.
*/
var disposableCreate = Disposable.create = function (action) { return new Disposable(action); };
/**
* Gets the disposable that does nothing when disposed.
*/
var disposableEmpty = Disposable.empty = { dispose: noop };
var BooleanDisposable = (function () {
function BooleanDisposable (isSingle) {
this.isSingle = isSingle;
this.isDisposed = false;
this.current = null;
}
var booleanDisposablePrototype = BooleanDisposable.prototype;
/**
* Gets the underlying disposable.
* @return The underlying disposable.
*/
booleanDisposablePrototype.getDisposable = function () {
return this.current;
};
/**
* Sets the underlying disposable.
* @param {Disposable} value The new underlying disposable.
*/
booleanDisposablePrototype.setDisposable = function (value) {
if (this.current && this.isSingle) {
throw new Error('Disposable has already been assigned');
}
var shouldDispose = this.isDisposed, old;
if (!shouldDispose) {
old = this.current;
this.current = value;
}
if (old) {
old.dispose();
}
if (shouldDispose && value) {
value.dispose();
}
};
/**
* Disposes the underlying disposable as well as all future replacements.
*/
booleanDisposablePrototype.dispose = function () {
var old;
if (!this.isDisposed) {
this.isDisposed = true;
old = this.current;
this.current = null;
}
if (old) {
old.dispose();
}
};
return BooleanDisposable;
}());
/**
* Represents a disposable resource which only allows a single assignment of its underlying disposable resource.
* If an underlying disposable resource has already been set, future attempts to set the underlying disposable resource will throw an Error.
*/
var SingleAssignmentDisposable = Rx.SingleAssignmentDisposable = (function (super_) {
inherits(SingleAssignmentDisposable, super_);
function SingleAssignmentDisposable() {
super_.call(this, true);
}
return SingleAssignmentDisposable;
}(BooleanDisposable));
/**
* Represents a disposable resource whose underlying disposable resource can be replaced by another disposable resource, causing automatic disposal of the previous underlying disposable resource.
*/
var SerialDisposable = Rx.SerialDisposable = (function (super_) {
inherits(SerialDisposable, super_);
function SerialDisposable() {
super_.call(this, false);
}
return SerialDisposable;
}(BooleanDisposable));
/**
* Represents a disposable resource that only disposes its underlying disposable resource when all dependent disposable objects have been disposed.
*/
var RefCountDisposable = Rx.RefCountDisposable = (function () {
function InnerDisposable(disposable) {
this.disposable = disposable;
this.disposable.count++;
this.isInnerDisposed = false;
}
InnerDisposable.prototype.dispose = function () {
if (!this.disposable.isDisposed) {
if (!this.isInnerDisposed) {
this.isInnerDisposed = true;
this.disposable.count--;
if (this.disposable.count === 0 && this.disposable.isPrimaryDisposed) {
this.disposable.isDisposed = true;
this.disposable.underlyingDisposable.dispose();
}
}
}
};
/**
* Initializes a new instance of the RefCountDisposable with the specified disposable.
* @constructor
* @param {Disposable} disposable Underlying disposable.
*/
function RefCountDisposable(disposable) {
this.underlyingDisposable = disposable;
this.isDisposed = false;
this.isPrimaryDisposed = false;
this.count = 0;
}
/**
* Disposes the underlying disposable only when all dependent disposables have been disposed
*/
RefCountDisposable.prototype.dispose = function () {
if (!this.isDisposed) {
if (!this.isPrimaryDisposed) {
this.isPrimaryDisposed = true;
if (this.count === 0) {
this.isDisposed = true;
this.underlyingDisposable.dispose();
}
}
}
};
/**
* Returns a dependent disposable that when disposed decreases the refcount on the underlying disposable.
* @returns {Disposable} A dependent disposable contributing to the reference count that manages the underlying disposable's lifetime.
*/
RefCountDisposable.prototype.getDisposable = function () {
return this.isDisposed ? disposableEmpty : new InnerDisposable(this);
};
return RefCountDisposable;
})();
var ScheduledItem = Rx.Internals.ScheduledItem = function (scheduler, state, action, dueTime, comparer) {
this.scheduler = scheduler;
this.state = state;
this.action = action;
this.dueTime = dueTime;
this.comparer = comparer || defaultSubComparer;
this.disposable = new SingleAssignmentDisposable();
}
ScheduledItem.prototype.invoke = function () {
this.disposable.setDisposable(this.invokeCore());
};
ScheduledItem.prototype.compareTo = function (other) {
return this.comparer(this.dueTime, other.dueTime);
};
ScheduledItem.prototype.isCancelled = function () {
return this.disposable.isDisposed;
};
ScheduledItem.prototype.invokeCore = function () {
return this.action(this.scheduler, this.state);
};
/** Provides a set of static properties to access commonly used schedulers. */
var Scheduler = Rx.Scheduler = (function () {
function Scheduler(now, schedule, scheduleRelative, scheduleAbsolute) {
this.now = now;
this._schedule = schedule;
this._scheduleRelative = scheduleRelative;
this._scheduleAbsolute = scheduleAbsolute;
}
function invokeRecImmediate(scheduler, pair) {
var state = pair.first, action = pair.second, group = new CompositeDisposable(),
recursiveAction = function (state1) {
action(state1, function (state2) {
var isAdded = false, isDone = false,
d = scheduler.scheduleWithState(state2, function (scheduler1, state3) {
if (isAdded) {
group.remove(d);
} else {
isDone = true;
}
recursiveAction(state3);
return disposableEmpty;
});
if (!isDone) {
group.add(d);
isAdded = true;
}
});
};
recursiveAction(state);
return group;
}
function invokeRecDate(scheduler, pair, method) {
var state = pair.first, action = pair.second, group = new CompositeDisposable(),
recursiveAction = function (state1) {
action(state1, function (state2, dueTime1) {
var isAdded = false, isDone = false,
d = scheduler[method].call(scheduler, state2, dueTime1, function (scheduler1, state3) {
if (isAdded) {
group.remove(d);
} else {
isDone = true;
}
recursiveAction(state3);
return disposableEmpty;
});
if (!isDone) {
group.add(d);
isAdded = true;
}
});
};
recursiveAction(state);
return group;
}
function invokeAction(scheduler, action) {
action();
return disposableEmpty;
}
var schedulerProto = Scheduler.prototype;
/**
* Schedules a periodic piece of work by dynamically discovering the scheduler's capabilities. The periodic task will be scheduled using window.setInterval for the base implementation.
* @param {Number} period Period for running the work periodically.
* @param {Function} action Action to be executed.
* @returns {Disposable} The disposable object used to cancel the scheduled recurring action (best effort).
*/
schedulerProto.schedulePeriodic = function (period, action) {
return this.schedulePeriodicWithState(null, period, function () {
action();
});
};
/**
* Schedules a periodic piece of work by dynamically discovering the scheduler's capabilities. The periodic task will be scheduled using window.setInterval for the base implementation.
* @param {Mixed} state Initial state passed to the action upon the first iteration.
* @param {Number} period Period for running the work periodically.
* @param {Function} action Action to be executed, potentially updating the state.
* @returns {Disposable} The disposable object used to cancel the scheduled recurring action (best effort).
*/
schedulerProto.schedulePeriodicWithState = function (state, period, action) {
var s = state, id = setInterval(function () {
s = action(s);
}, period);
return disposableCreate(function () {
clearInterval(id);
});
};
/**
* Schedules an action to be executed.
* @param {Function} action Action to execute.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.schedule = function (action) {
return this._schedule(action, invokeAction);
};
/**
* Schedules an action to be executed.
* @param state State passed to the action to be executed.
* @param {Function} action Action to be executed.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleWithState = function (state, action) {
return this._schedule(state, action);
};
/**
* Schedules an action to be executed after the specified relative due time.
* @param {Function} action Action to execute.
* @param {Number} dueTime Relative time after which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleWithRelative = function (dueTime, action) {
return this._scheduleRelative(action, dueTime, invokeAction);
};
/**
* Schedules an action to be executed after dueTime.
* @param {Mixed} state State passed to the action to be executed.
* @param {Function} action Action to be executed.
* @param {Number} dueTime Relative time after which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleWithRelativeAndState = function (state, dueTime, action) {
return this._scheduleRelative(state, dueTime, action);
};
/**
* Schedules an action to be executed at the specified absolute due time.
* @param {Function} action Action to execute.
* @param {Number} dueTime Absolute time at which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleWithAbsolute = function (dueTime, action) {
return this._scheduleAbsolute(action, dueTime, invokeAction);
};
/**
* Schedules an action to be executed at dueTime.
* @param {Mixed} state State passed to the action to be executed.
* @param {Function} action Action to be executed.
* @param {Number}dueTime Absolute time at which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleWithAbsoluteAndState = function (state, dueTime, action) {
return this._scheduleAbsolute(state, dueTime, action);
};
/**
* Schedules an action to be executed recursively.
* @param {Function} action Action to execute recursively. The parameter passed to the action is used to trigger recursive scheduling of the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursive = function (action) {
return this.scheduleRecursiveWithState(action, function (_action, self) {
_action(function () {
self(_action);
});
});
};
/**
* Schedules an action to be executed recursively.
* @param {Mixed} state State passed to the action to be executed.
* @param {Function} action Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in recursive invocation state.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursiveWithState = function (state, action) {
return this.scheduleWithState({ first: state, second: action }, function (s, p) {
return invokeRecImmediate(s, p);
});
};
/**
* Schedules an action to be executed recursively after a specified relative due time.
* @param {Function} action Action to execute recursively. The parameter passed to the action is used to trigger recursive scheduling of the action at the specified relative time.
* @param {Number}dueTime Relative time after which to execute the action for the first time.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursiveWithRelative = function (dueTime, action) {
return this.scheduleRecursiveWithRelativeAndState(action, dueTime, function (_action, self) {
_action(function (dt) {
self(_action, dt);
});
});
};
/**
* Schedules an action to be executed recursively after a specified relative due time.
* @param {Mixed} state State passed to the action to be executed.
* @param {Function} action Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in the recursive due time and invocation state.
* @param {Number}dueTime Relative time after which to execute the action for the first time.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursiveWithRelativeAndState = function (state, dueTime, action) {
return this._scheduleRelative({ first: state, second: action }, dueTime, function (s, p) {
return invokeRecDate(s, p, 'scheduleWithRelativeAndState');
});
};
/**
* Schedules an action to be executed recursively at a specified absolute due time.
* @param {Function} action Action to execute recursively. The parameter passed to the action is used to trigger recursive scheduling of the action at the specified absolute time.
* @param {Number}dueTime Absolute time at which to execute the action for the first time.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursiveWithAbsolute = function (dueTime, action) {
return this.scheduleRecursiveWithAbsoluteAndState(action, dueTime, function (_action, self) {
_action(function (dt) {
self(_action, dt);
});
});
};
/**
* Schedules an action to be executed recursively at a specified absolute due time.
* @param {Mixed} state State passed to the action to be executed.
* @param {Function} action Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in the recursive due time and invocation state.
* @param {Number}dueTime Absolute time at which to execute the action for the first time.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursiveWithAbsoluteAndState = function (state, dueTime, action) {
return this._scheduleAbsolute({ first: state, second: action }, dueTime, function (s, p) {
return invokeRecDate(s, p, 'scheduleWithAbsoluteAndState');
});
};
/** Gets the current time according to the local machine's system clock. */
Scheduler.now = defaultNow;
/**
* Normalizes the specified TimeSpan value to a positive value.
* @param {Number} timeSpan The time span value to normalize.
* @returns {Number} The specified TimeSpan value if it is zero or positive; otherwise, 0
*/
Scheduler.normalize = function (timeSpan) {
if (timeSpan < 0) {
timeSpan = 0;
}
return timeSpan;
};
return Scheduler;
}());
var normalizeTime = Scheduler.normalize;
/**
* Gets a scheduler that schedules work immediately on the current thread.
*/
var immediateScheduler = Scheduler.immediate = (function () {
function scheduleNow(state, action) { return action(this, state); }
function scheduleRelative(state, dueTime, action) {
var dt = normalizeTime(dt);
while (dt - this.now() > 0) { }
return action(this, state);
}
function scheduleAbsolute(state, dueTime, action) {
return this.scheduleWithRelativeAndState(state, dueTime - this.now(), action);
}
return new Scheduler(defaultNow, scheduleNow, scheduleRelative, scheduleAbsolute);
}());
/**
* Gets a scheduler that schedules work as soon as possible on the current thread.
*/
var currentThreadScheduler = Scheduler.currentThread = (function () {
var queue;
function Trampoline() {
queue = new PriorityQueue(4);
}
Trampoline.prototype.dispose = function () {
queue = null;
};
Trampoline.prototype.run = function () {
var item;
while (queue.length > 0) {
item = queue.dequeue();
if (!item.isCancelled()) {
while (item.dueTime - Scheduler.now() > 0) { }
if (!item.isCancelled()) {
item.invoke();
}
}
}
};
function scheduleNow(state, action) {
return this.scheduleWithRelativeAndState(state, 0, action);
}
function scheduleRelative(state, dueTime, action) {
var dt = this.now() + normalizeTime(dueTime),
si = new ScheduledItem(this, state, action, dt),
t;
if (!queue) {
t = new Trampoline();
try {
queue.enqueue(si);
t.run();
} catch (e) {
throw e;
} finally {
t.dispose();
}
} else {
queue.enqueue(si);
}
return si.disposable;
}
function scheduleAbsolute(state, dueTime, action) {
return this.scheduleWithRelativeAndState(state, dueTime - this.now(), action);
}
var currentScheduler = new Scheduler(defaultNow, scheduleNow, scheduleRelative, scheduleAbsolute);
currentScheduler.scheduleRequired = function () { return queue === null; };
currentScheduler.ensureTrampoline = function (action) {
if (queue === null) {
return this.schedule(action);
} else {
return action();
}
};
return currentScheduler;
}());
var SchedulePeriodicRecursive = Rx.Internals.SchedulePeriodicRecursive = (function () {
function tick(command, recurse) {
recurse(0, this._period);
try {
this._state = this._action(this._state);
} catch (e) {
this._cancel.dispose();
throw e;
}
}
function SchedulePeriodicRecursive(scheduler, state, period, action) {
this._scheduler = scheduler;
this._state = state;
this._period = period;
this._action = action;
}
SchedulePeriodicRecursive.prototype.start = function () {
var d = new SingleAssignmentDisposable();
this._cancel = d;
d.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0, this._period, tick.bind(this)));
return d;
};
return SchedulePeriodicRecursive;
}());
var reNative = RegExp('^' +
String(toString)
.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
.replace(/toString| for [^\]]+/g, '.*?') + '$'
);
var setImmediate = typeof (setImmediate = freeGlobal && moduleExports && freeGlobal.setImmediate) == 'function' &&
!reNative.test(setImmediate) && setImmediate,
clearImmediate = typeof (clearImmediate = freeGlobal && moduleExports && freeGlobal.clearImmediate) == 'function' &&
!reNative.test(clearImmediate) && clearImmediate;
var scheduleMethod, clearMethod = noop;
(function () {
function postMessageSupported () {
// Ensure not in a worker
if (!root.postMessage || root.importScripts) { return false; }
var isAsync = false,
oldHandler = root.onmessage;
// Test for async
root.onmessage = function () { isAsync = true; };
root.postMessage('','*');
root.onmessage = oldHandler;
return isAsync;
}
// Check for setImmediate first for Node v0.11+
if (typeof setImmediate === 'function') {
scheduleMethod = setImmediate;
clearMethod = clearImmediate;
} else if (typeof process !== 'undefined' && {}.toString.call(process) === '[object process]') {
scheduleMethod = process.nextTick;
} else if (postMessageSupported()) {
var MSG_PREFIX = 'ms.rx.schedule' + Math.random(),
tasks = {},
taskId = 0;
function onGlobalPostMessage(event) {
// Only if we're a match to avoid any other global events
if (typeof event.data === 'string' && event.data.substring(0, MSG_PREFIX.length) === MSG_PREFIX) {
var handleId = event.data.substring(MSG_PREFIX.length),
action = tasks[handleId];
action();
delete tasks[handleId];
}
}
if (root.addEventListener) {
root.addEventListener('message', onGlobalPostMessage, false);
} else {
root.attachEvent('onmessage', onGlobalPostMessage, false);
}
scheduleMethod = function (action) {
var currentId = taskId++;
tasks[currentId] = action;
root.postMessage(MSG_PREFIX + currentId, '*');
};
} else if (!!root.MessageChannel) {
var channel = new root.MessageChannel(),
channelTasks = {},
channelTaskId = 0;
channel.port1.onmessage = function (event) {
var id = event.data,
action = channelTasks[id];
action();
delete channelTasks[id];
};
scheduleMethod = function (action) {
var id = channelTaskId++;
channelTasks[id] = action;
channel.port2.postMessage(id);
};
} else if ('document' in root && 'onreadystatechange' in root.document.createElement('script')) {
scheduleMethod = function (action) {
var scriptElement = root.document.createElement('script');
scriptElement.onreadystatechange = function () {
action();
scriptElement.onreadystatechange = null;
scriptElement.parentNode.removeChild(scriptElement);
scriptElement = null;
};
root.document.documentElement.appendChild(scriptElement);
};
} else {
scheduleMethod = function (action) { return setTimeout(action, 0); };
clearMethod = clearTimeout;
}
}());
/**
* Gets a scheduler that schedules work via a timed callback based upon platform.
*/
var timeoutScheduler = Scheduler.timeout = (function () {
function scheduleNow(state, action) {
var scheduler = this,
disposable = new SingleAssignmentDisposable();
var id = scheduleMethod(function () {
if (!disposable.isDisposed) {
disposable.setDisposable(action(scheduler, state));
}
});
return new CompositeDisposable(disposable, disposableCreate(function () {
clearMethod(id);
}));
}
function scheduleRelative(state, dueTime, action) {
var scheduler = this,
dt = Scheduler.normalize(dueTime);
if (dt === 0) {
return scheduler.scheduleWithState(state, action);
}
var disposable = new SingleAssignmentDisposable();
var id = setTimeout(function () {
if (!disposable.isDisposed) {
disposable.setDisposable(action(scheduler, state));
}
}, dt);
return new CompositeDisposable(disposable, disposableCreate(function () {
clearTimeout(id);
}));
}
function scheduleAbsolute(state, dueTime, action) {
return this.scheduleWithRelativeAndState(state, dueTime - this.now(), action);
}
return new Scheduler(defaultNow, scheduleNow, scheduleRelative, scheduleAbsolute);
})();
/**
* Represents a notification to an observer.
*/
var Notification = Rx.Notification = (function () {
function Notification(kind, hasValue) {
this.hasValue = hasValue == null ? false : hasValue;
this.kind = kind;
}
var NotificationPrototype = Notification.prototype;
/**
* Invokes the delegate corresponding to the notification or the observer's method corresponding to the notification and returns the produced result.
*
* @memberOf Notification
* @param {Any} observerOrOnNext Delegate to invoke for an OnNext notification or Observer to invoke the notification on..
* @param {Function} onError Delegate to invoke for an OnError notification.
* @param {Function} onCompleted Delegate to invoke for an OnCompleted notification.
* @returns {Any} Result produced by the observation.
*/
NotificationPrototype.accept = function (observerOrOnNext, onError, onCompleted) {
if (arguments.length === 1 && typeof observerOrOnNext === 'object') {
return this._acceptObservable(observerOrOnNext);
}
return this._accept(observerOrOnNext, onError, onCompleted);
};
/**
* Returns an observable sequence with a single notification.
*
* @memberOf Notification
* @param {Scheduler} [scheduler] Scheduler to send out the notification calls on.
* @returns {Observable} The observable sequence that surfaces the behavior of the notification upon subscription.
*/
NotificationPrototype.toObservable = function (scheduler) {
var notification = this;
scheduler || (scheduler = immediateScheduler);
return new AnonymousObservable(function (observer) {
return scheduler.schedule(function () {
notification._acceptObservable(observer);
if (notification.kind === 'N') {
observer.onCompleted();
}
});
});
};
return Notification;
})();
/**
* Creates an object that represents an OnNext notification to an observer.
* @param {Any} value The value contained in the notification.
* @returns {Notification} The OnNext notification containing the value.
*/
var notificationCreateOnNext = Notification.createOnNext = (function () {
function _accept (onNext) {
return onNext(this.value);
}
function _acceptObservable(observer) {
return observer.onNext(this.value);
}
function toString () {
return 'OnNext(' + this.value + ')';
}
return function (value) {
var notification = new Notification('N', true);
notification.value = value;
notification._accept = _accept;
notification._acceptObservable = _acceptObservable;
notification.toString = toString;
return notification;
};
}());
/**
* Creates an object that represents an OnError notification to an observer.
* @param {Any} error The exception contained in the notification.
* @returns {Notification} The OnError notification containing the exception.
*/
var notificationCreateOnError = Notification.createOnError = (function () {
function _accept (onNext, onError) {
return onError(this.exception);
}
function _acceptObservable(observer) {
return observer.onError(this.exception);
}
function toString () {
return 'OnError(' + this.exception + ')';
}
return function (exception) {
var notification = new Notification('E');
notification.exception = exception;
notification._accept = _accept;
notification._acceptObservable = _acceptObservable;
notification.toString = toString;
return notification;
};
}());
/**
* Creates an object that represents an OnCompleted notification to an observer.
* @returns {Notification} The OnCompleted notification.
*/
var notificationCreateOnCompleted = Notification.createOnCompleted = (function () {
function _accept (onNext, onError, onCompleted) {
return onCompleted();
}
function _acceptObservable(observer) {
return observer.onCompleted();
}
function toString () {
return 'OnCompleted()';
}
return function () {
var notification = new Notification('C');
notification._accept = _accept;
notification._acceptObservable = _acceptObservable;
notification.toString = toString;
return notification;
};
}());
/**
* @constructor
* @private
*/
var Enumerator = Rx.Internals.Enumerator = function (moveNext, getCurrent) {
this.moveNext = moveNext;
this.getCurrent = getCurrent;
};
/**
* @static
* @memberOf Enumerator
* @private
*/
var enumeratorCreate = Enumerator.create = function (moveNext, getCurrent) {
var done = false;
return new Enumerator(function () {
if (done) {
return false;
}
var result = moveNext();
if (!result) {
done = true;
}
return result;
}, function () { return getCurrent(); });
};
var Enumerable = Rx.Internals.Enumerable = function (getEnumerator) {
this.getEnumerator = getEnumerator;
};
Enumerable.prototype.concat = function () {
var sources = this;
return new AnonymousObservable(function (observer) {
var e = sources.getEnumerator(), isDisposed, subscription = new SerialDisposable();
var cancelable = immediateScheduler.scheduleRecursive(function (self) {
var current, hasNext;
if (isDisposed) { return; }
try {
hasNext = e.moveNext();
if (hasNext) {
current = e.getCurrent();
}
} catch (ex) {
observer.onError(ex);
return;
}
if (!hasNext) {
observer.onCompleted();
return;
}
var d = new SingleAssignmentDisposable();
subscription.setDisposable(d);
d.setDisposable(current.subscribe(
observer.onNext.bind(observer),
observer.onError.bind(observer),
function () { self(); })
);
});
return new CompositeDisposable(subscription, cancelable, disposableCreate(function () {
isDisposed = true;
}));
});
};
Enumerable.prototype.catchException = function () {
var sources = this;
return new AnonymousObservable(function (observer) {
var e = sources.getEnumerator(), isDisposed, lastException;
var subscription = new SerialDisposable();
var cancelable = immediateScheduler.scheduleRecursive(function (self) {
var current, hasNext;
if (isDisposed) { return; }
try {
hasNext = e.moveNext();
if (hasNext) {
current = e.getCurrent();
}
} catch (ex) {
observer.onError(ex);
return;
}
if (!hasNext) {
if (lastException) {
observer.onError(lastException);
} else {
observer.onCompleted();
}
return;
}
var d = new SingleAssignmentDisposable();
subscription.setDisposable(d);
d.setDisposable(current.subscribe(
observer.onNext.bind(observer),
function (exn) {
lastException = exn;
self();
},
observer.onCompleted.bind(observer)));
});
return new CompositeDisposable(subscription, cancelable, disposableCreate(function () {
isDisposed = true;
}));
});
};
var enumerableRepeat = Enumerable.repeat = function (value, repeatCount) {
if (arguments.length === 1) {
repeatCount = -1;
}
return new Enumerable(function () {
var current, left = repeatCount;
return enumeratorCreate(function () {
if (left === 0) {
return false;
}
if (left > 0) {
left--;
}
current = value;
return true;
}, function () { return current; });
});
};
var enumerableFor = Enumerable.forEach = function (source, selector, thisArg) {
selector || (selector = identity);
return new Enumerable(function () {
var current, index = -1;
return enumeratorCreate(
function () {
if (++index < source.length) {
current = selector.call(thisArg, source[index], index, source);
return true;
}
return false;
},
function () { return current; }
);
});
};
/**
* Supports push-style iteration over an observable sequence.
*/
var Observer = Rx.Observer = function () { };
/**
* Creates a notification callback from an observer.
*
* @param observer Observer object.
* @returns The action that forwards its input notification to the underlying observer.
*/
Observer.prototype.toNotifier = function () {
var observer = this;
return function (n) {
return n.accept(observer);
};
};
/**
* Hides the identity of an observer.
* @returns An observer that hides the identity of the specified observer.
*/
Observer.prototype.asObserver = function () {
return new AnonymousObserver(this.onNext.bind(this), this.onError.bind(this), this.onCompleted.bind(this));
};
/**
* Creates an observer from the specified OnNext, along with optional OnError, and OnCompleted actions.
*
* @static
* @memberOf Observer
* @param {Function} [onNext] Observer's OnNext action implementation.
* @param {Function} [onError] Observer's OnError action implementation.
* @param {Function} [onCompleted] Observer's OnCompleted action implementation.
* @returns {Observer} The observer object implemented using the given actions.
*/
var observerCreate = Observer.create = function (onNext, onError, onCompleted) {
onNext || (onNext = noop);
onError || (onError = defaultError);
onCompleted || (onCompleted = noop);
return new AnonymousObserver(onNext, onError, onCompleted);
};
/**
* Creates an observer from a notification callback.
*
* @static
* @memberOf Observer
* @param {Function} handler Action that handles a notification.
* @returns The observer object that invokes the specified handler using a notification corresponding to each message it receives.
*/
Observer.fromNotifier = function (handler) {
return new AnonymousObserver(function (x) {
return handler(notificationCreateOnNext(x));
}, function (exception) {
return handler(notificationCreateOnError(exception));
}, function () {
return handler(notificationCreateOnCompleted());
});
};
/**
* Abstract base class for implementations of the Observer class.
* This base class enforces the grammar of observers where OnError and OnCompleted are terminal messages.
*/
var AbstractObserver = Rx.Internals.AbstractObserver = (function (_super) {
inherits(AbstractObserver, _super);
/**
* Creates a new observer in a non-stopped state.
*
* @constructor
*/
function AbstractObserver() {
this.isStopped = false;
_super.call(this);
}
/**
* Notifies the observer of a new element in the sequence.
*
* @memberOf AbstractObserver
* @param {Any} value Next element in the sequence.
*/
AbstractObserver.prototype.onNext = function (value) {
if (!this.isStopped) {
this.next(value);
}
};
/**
* Notifies the observer that an exception has occurred.
*
* @memberOf AbstractObserver
* @param {Any} error The error that has occurred.
*/
AbstractObserver.prototype.onError = function (error) {
if (!this.isStopped) {
this.isStopped = true;
this.error(error);
}
};
/**
* Notifies the observer of the end of the sequence.
*/
AbstractObserver.prototype.onCompleted = function () {
if (!this.isStopped) {
this.isStopped = true;
this.completed();
}
};
/**
* Disposes the observer, causing it to transition to the stopped state.
*/
AbstractObserver.prototype.dispose = function () {
this.isStopped = true;
};
AbstractObserver.prototype.fail = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.error(e);
return true;
}
return false;
};
return AbstractObserver;
}(Observer));
/**
* Class to create an Observer instance from delegate-based implementations of the on* methods.
*/
var AnonymousObserver = Rx.AnonymousObserver = (function (_super) {
inherits(AnonymousObserver, _super);
/**
* Creates an observer from the specified OnNext, OnError, and OnCompleted actions.
*
* @constructor
* @param {Any} onNext Observer's OnNext action implementation.
* @param {Any} onError Observer's OnError action implementation.
* @param {Any} onCompleted Observer's OnCompleted action implementation.
*/
function AnonymousObserver(onNext, onError, onCompleted) {
_super.call(this);
this._onNext = onNext;
this._onError = onError;
this._onCompleted = onCompleted;
}
/**
* Calls the onNext action.
*
* @memberOf AnonymousObserver
* @param {Any} value Next element in the sequence.
*/
AnonymousObserver.prototype.next = function (value) {
this._onNext(value);
};
/**
* Calls the onError action.
*
* @memberOf AnonymousObserver
* @param {Any{ error The error that has occurred.
*/
AnonymousObserver.prototype.error = function (exception) {
this._onError(exception);
};
/**
* Calls the onCompleted action.
*
* @memberOf AnonymousObserver
*/
AnonymousObserver.prototype.completed = function () {
this._onCompleted();
};
return AnonymousObserver;
}(AbstractObserver));
var observableProto;
/**
* Represents a push-style collection.
*/
var Observable = Rx.Observable = (function () {
/**
* @constructor
* @private
*/
function Observable(subscribe) {
this._subscribe = subscribe;
}
observableProto = Observable.prototype;
observableProto.finalValue = function () {
var source = this;
return new AnonymousObservable(function (observer) {
var hasValue = false, value;
return source.subscribe(function (x) {
hasValue = true;
value = x;
}, observer.onError.bind(observer), function () {
if (!hasValue) {
observer.onError(new Error(sequenceContainsNoElements));
} else {
observer.onNext(value);
observer.onCompleted();
}
});
});
};
/**
* Subscribes an observer to the observable sequence.
*
* @example
* 1 - source.subscribe();
* 2 - source.subscribe(observer);
* 3 - source.subscribe(function (x) { console.log(x); });
* 4 - source.subscribe(function (x) { console.log(x); }, function (err) { console.log(err); });
* 5 - source.subscribe(function (x) { console.log(x); }, function (err) { console.log(err); }, function () { console.log('done'); });
* @param {Mixed} [observerOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence.
* @returns {Diposable} The source sequence whose subscriptions and unsubscriptions happen on the specified scheduler.
*/
observableProto.subscribe = observableProto.forEach = function (observerOrOnNext, onError, onCompleted) {
var subscriber;
if (typeof observerOrOnNext === 'object') {
subscriber = observerOrOnNext;
} else {
subscriber = observerCreate(observerOrOnNext, onError, onCompleted);
}
return this._subscribe(subscriber);
};
/**
* Creates a list from an observable sequence.
*
* @memberOf Observable
* @returns An observable sequence containing a single element with a list containing all the elements of the source sequence.
*/
observableProto.toArray = function () {
function accumulator(list, i) {
var newList = list.slice(0);
newList.push(i);
return newList;
}
return this.scan([], accumulator).startWith([]).finalValue();
};
return Observable;
})();
/** @private */
var ScheduledObserver = Rx.Internals.ScheduledObserver = (function (_super) {
inherits(ScheduledObserver, _super);
function ScheduledObserver(scheduler, observer) {
_super.call(this);
this.scheduler = scheduler;
this.observer = observer;
this.isAcquired = false;
this.hasFaulted = false;
this.queue = [];
this.disposable = new SerialDisposable();
}
/** @private */
ScheduledObserver.prototype.next = function (value) {
var self = this;
this.queue.push(function () {
self.observer.onNext(value);
});
};
/** @private */
ScheduledObserver.prototype.error = function (exception) {
var self = this;
this.queue.push(function () {
self.observer.onError(exception);
});
};
/** @private */
ScheduledObserver.prototype.completed = function () {
var self = this;
this.queue.push(function () {
self.observer.onCompleted();
});
};
/** @private */
ScheduledObserver.prototype.ensureActive = function () {
var isOwner = false, parent = this;
if (!this.hasFaulted && this.queue.length > 0) {
isOwner = !this.isAcquired;
this.isAcquired = true;
}
if (isOwner) {
this.disposable.setDisposable(this.scheduler.scheduleRecursive(function (self) {
var work;
if (parent.queue.length > 0) {
work = parent.queue.shift();
} else {
parent.isAcquired = false;
return;
}
try {
work();
} catch (ex) {
parent.queue = [];
parent.hasFaulted = true;
throw ex;
}
self();
}));
}
};
/** @private */
ScheduledObserver.prototype.dispose = function () {
_super.prototype.dispose.call(this);
this.disposable.dispose();
};
return ScheduledObserver;
}(AbstractObserver));
/**
* Creates an observable sequence from a specified subscribe method implementation.
*
* @example
* var res = Rx.Observable.create(function (observer) { return function () { } );
* var res = Rx.Observable.create(function (observer) { return Rx.Disposable.empty; } );
* var res = Rx.Observable.create(function (observer) { } );
*
* @param {Function} subscribe Implementation of the resulting observable sequence's subscribe method, returning a function that will be wrapped in a Disposable.
* @returns {Observable} The observable sequence with the specified implementation for the Subscribe method.
*/
Observable.create = Observable.createWithDisposable = function (subscribe) {
return new AnonymousObservable(subscribe);
};
/**
* Returns an observable sequence that invokes the specified factory function whenever a new observer subscribes.
*
* @example
* var res = Rx.Observable.defer(function () { return Rx.Observable.fromArray([1,2,3]); });
* @param {Function} observableFactory Observable factory function to invoke for each observer that subscribes to the resulting sequence.
* @returns {Observable} An observable sequence whose observers trigger an invocation of the given observable factory function.
*/
var observableDefer = Observable.defer = function (observableFactory) {
return new AnonymousObservable(function (observer) {
var result;
try {
result = observableFactory();
} catch (e) {
return observableThrow(e).subscribe(observer);
}
return result.subscribe(observer);
});
};
/**
* Returns an empty observable sequence, using the specified scheduler to send out the single OnCompleted message.
*
* @example
* var res = Rx.Observable.empty();
* var res = Rx.Observable.empty(Rx.Scheduler.timeout);
* @param {Scheduler} [scheduler] Scheduler to send the termination call on.
* @returns {Observable} An observable sequence with no elements.
*/
var observableEmpty = Observable.empty = function (scheduler) {
scheduler || (scheduler = immediateScheduler);
return new AnonymousObservable(function (observer) {
return scheduler.schedule(function () {
observer.onCompleted();
});
});
};
/**
* Converts an array to an observable sequence, using an optional scheduler to enumerate the array.
*
* @example
* var res = Rx.Observable.fromArray([1,2,3]);
* var res = Rx.Observable.fromArray([1,2,3], Rx.Scheduler.timeout);
* @param {Scheduler} [scheduler] Scheduler to run the enumeration of the input sequence on.
* @returns {Observable} The observable sequence whose elements are pulled from the given enumerable sequence.
*/
var observableFromArray = Observable.fromArray = function (array, scheduler) {
scheduler || (scheduler = currentThreadScheduler);
return new AnonymousObservable(function (observer) {
var count = 0;
return scheduler.scheduleRecursive(function (self) {
if (count < array.length) {
observer.onNext(array[count++]);
self();
} else {
observer.onCompleted();
}
});
});
};
/**
* Generates an observable sequence by running a state-driven loop producing the sequence's elements, using the specified scheduler to send out observer messages.
*
* @example
* var res = Rx.Observable.generate(0, function (x) { return x < 10; }, function (x) { return x + 1; }, function (x) { return x; });
* var res = Rx.Observable.generate(0, function (x) { return x < 10; }, function (x) { return x + 1; }, function (x) { return x; }, Rx.Scheduler.timeout);
* @param {Mixed} initialState Initial state.
* @param {Function} condition Condition to terminate generation (upon returning false).
* @param {Function} iterate Iteration step function.
* @param {Function} resultSelector Selector function for results produced in the sequence.
* @param {Scheduler} [scheduler] Scheduler on which to run the generator loop. If not provided, defaults to Scheduler.currentThread.
* @returns {Observable} The generated sequence.
*/
Observable.generate = function (initialState, condition, iterate, resultSelector, scheduler) {
scheduler || (scheduler = currentThreadScheduler);
return new AnonymousObservable(function (observer) {
var first = true, state = initialState;
return scheduler.scheduleRecursive(function (self) {
var hasResult, result;
try {
if (first) {
first = false;
} else {
state = iterate(state);
}
hasResult = condition(state);
if (hasResult) {
result = resultSelector(state);
}
} catch (exception) {
observer.onError(exception);
return;
}
if (hasResult) {
observer.onNext(result);
self();
} else {
observer.onCompleted();
}
});
});
};
/**
* Returns a non-terminating observable sequence, which can be used to denote an infinite duration (e.g. when using reactive joins).
* @returns {Observable} An observable sequence whose observers will never get called.
*/
var observableNever = Observable.never = function () {
return new AnonymousObservable(function () {
return disposableEmpty;
});
};
/**
* Generates an observable sequence of integral numbers within a specified range, using the specified scheduler to send out observer messages.
*
* @example
* var res = Rx.Observable.range(0, 10);
* var res = Rx.Observable.range(0, 10, Rx.Scheduler.timeout);
* @param {Number} start The value of the first integer in the sequence.
* @param {Number} count The number of sequential integers to generate.
* @param {Scheduler} [scheduler] Scheduler to run the generator loop on. If not specified, defaults to Scheduler.currentThread.
* @returns {Observable} An observable sequence that contains a range of sequential integral numbers.
*/
Observable.range = function (start, count, scheduler) {
scheduler || (scheduler = currentThreadScheduler);
return new AnonymousObservable(function (observer) {
return scheduler.scheduleRecursiveWithState(0, function (i, self) {
if (i < count) {
observer.onNext(start + i);
self(i + 1);
} else {
observer.onCompleted();
}
});
});
};
/**
* Generates an observable sequence that repeats the given element the specified number of times, using the specified scheduler to send out observer messages.
*
* @example
* var res = Rx.Observable.repeat(42);
* var res = Rx.Observable.repeat(42, 4);
* 3 - res = Rx.Observable.repeat(42, 4, Rx.Scheduler.timeout);
* 4 - res = Rx.Observable.repeat(42, null, Rx.Scheduler.timeout);
* @param {Mixed} value Element to repeat.
* @param {Number} repeatCount [Optiona] Number of times to repeat the element. If not specified, repeats indefinitely.
* @param {Scheduler} scheduler Scheduler to run the producer loop on. If not specified, defaults to Scheduler.immediate.
* @returns {Observable} An observable sequence that repeats the given element the specified number of times.
*/
Observable.repeat = function (value, repeatCount, scheduler) {
scheduler || (scheduler = currentThreadScheduler);
if (repeatCount == null) {
repeatCount = -1;
}
return observableReturn(value, scheduler).repeat(repeatCount);
};
/**
* Returns an observable sequence that contains a single element, using the specified scheduler to send out observer messages.
* There is an alias called 'returnValue' for browsers <IE9.
*
* @example
* var res = Rx.Observable.return(42);
* var res = Rx.Observable.return(42, Rx.Scheduler.timeout);
* @param {Mixed} value Single element in the resulting observable sequence.
* @param {Scheduler} scheduler Scheduler to send the single element on. If not specified, defaults to Scheduler.immediate.
* @returns {Observable} An observable sequence containing the single specified element.
*/
var observableReturn = Observable['return'] = Observable.returnValue = function (value, scheduler) {
scheduler || (scheduler = immediateScheduler);
return new AnonymousObservable(function (observer) {
return scheduler.schedule(function () {
observer.onNext(value);
observer.onCompleted();
});
});
};
/**
* Returns an observable sequence that terminates with an exception, using the specified scheduler to send out the single onError message.
* There is an alias to this method called 'throwException' for browsers <IE9.
*
* @example
* var res = Rx.Observable.throwException(new Error('Error'));
* var res = Rx.Observable.throwException(new Error('Error'), Rx.Scheduler.timeout);
* @param {Mixed} exception An object used for the sequence's termination.
* @param {Scheduler} scheduler Scheduler to send the exceptional termination call on. If not specified, defaults to Scheduler.immediate.
* @returns {Observable} The observable sequence that terminates exceptionally with the specified exception object.
*/
var observableThrow = Observable['throw'] = Observable.throwException = function (exception, scheduler) {
scheduler || (scheduler = immediateScheduler);
return new AnonymousObservable(function (observer) {
return scheduler.schedule(function () {
observer.onError(exception);
});
});
};
function observableCatchHandler(source, handler) {
return new AnonymousObservable(function (observer) {
var d1 = new SingleAssignmentDisposable(), subscription = new SerialDisposable();
subscription.setDisposable(d1);
d1.setDisposable(source.subscribe(observer.onNext.bind(observer), function (exception) {
var d, result;
try {
result = handler(exception);
} catch (ex) {
observer.onError(ex);
return;
}
d = new SingleAssignmentDisposable();
subscription.setDisposable(d);
d.setDisposable(result.subscribe(observer));
}, observer.onCompleted.bind(observer)));
return subscription;
});
}
/**
* Continues an observable sequence that is terminated by an exception with the next observable sequence.
* @example
* 1 - xs.catchException(ys)
* 2 - xs.catchException(function (ex) { return ys(ex); })
* @param {Mixed} handlerOrSecond Exception handler function that returns an observable sequence given the error that occurred in the first sequence, or a second observable sequence used to produce results when an error occurred in the first sequence.
* @returns {Observable} An observable sequence containing the first sequence's elements, followed by the elements of the handler sequence in case an exception occurred.
*/
observableProto['catch'] = observableProto.catchException = function (handlerOrSecond) {
if (typeof handlerOrSecond === 'function') {
return observableCatchHandler(this, handlerOrSecond);
}
return observableCatch([this, handlerOrSecond]);
};
/**
* Continues an observable sequence that is terminated by an exception with the next observable sequence.
*
* @example
* 1 - res = Rx.Observable.catchException(xs, ys, zs);
* 2 - res = Rx.Observable.catchException([xs, ys, zs]);
* @returns {Observable} An observable sequence containing elements from consecutive source sequences until a source sequence terminates successfully.
*/
var observableCatch = Observable.catchException = Observable['catch'] = function () {
var items = argsOrArray(arguments, 0);
return enumerableFor(items).catchException();
};
/**
* Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.
* This can be in the form of an argument list of observables or an array.
*
* @example
* 1 - obs = observable.combineLatest(obs1, obs2, obs3, function (o1, o2, o3) { return o1 + o2 + o3; });
* 2 - obs = observable.combineLatest([obs1, obs2, obs3], function (o1, o2, o3) { return o1 + o2 + o3; });
* @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.
*/
observableProto.combineLatest = function () {
var args = slice.call(arguments);
if (Array.isArray(args[0])) {
args[0].unshift(this);
} else {
args.unshift(this);
}
return combineLatest.apply(this, args);
};
/**
* Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.
*
* @example
* 1 - obs = Rx.Observable.combineLatest(obs1, obs2, obs3, function (o1, o2, o3) { return o1 + o2 + o3; });
* 2 - obs = Rx.Observable.combineLatest([obs1, obs2, obs3], function (o1, o2, o3) { return o1 + o2 + o3; });
* @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.
*/
var combineLatest = Observable.combineLatest = function () {
var args = slice.call(arguments), resultSelector = args.pop();
if (Array.isArray(args[0])) {
args = args[0];
}
return new AnonymousObservable(function (observer) {
var falseFactory = function () { return false; },
n = args.length,
hasValue = arrayInitialize(n, falseFactory),
hasValueAll = false,
isDone = arrayInitialize(n, falseFactory),
values = new Array(n);
function next(i) {
var res;
hasValue[i] = true;
if (hasValueAll || (hasValueAll = hasValue.every(identity))) {
try {
res = resultSelector.apply(null, values);
} catch (ex) {
observer.onError(ex);
return;
}
observer.onNext(res);
} else if (isDone.filter(function (x, j) { return j !== i; }).every(identity)) {
observer.onCompleted();
}
}
function done (i) {
isDone[i] = true;
if (isDone.every(identity)) {
observer.onCompleted();
}
}
var subscriptions = new Array(n);
for (var idx = 0; idx < n; idx++) {
(function (i) {
subscriptions[i] = new SingleAssignmentDisposable();
subscriptions[i].setDisposable(args[i].subscribe(function (x) {
values[i] = x;
next(i);
}, observer.onError.bind(observer), function () {
done(i);
}));
}(idx));
}
return new CompositeDisposable(subscriptions);
});
};
/**
* Concatenates all the observable sequences. This takes in either an array or variable arguments to concatenate.
*
* @example
* 1 - concatenated = xs.concat(ys, zs);
* 2 - concatenated = xs.concat([ys, zs]);
* @returns {Observable} An observable sequence that contains the elements of each given sequence, in sequential order.
*/
observableProto.concat = function () {
var items = slice.call(arguments, 0);
items.unshift(this);
return observableConcat.apply(this, items);
};
/**
* Concatenates all the observable sequences.
*
* @example
* 1 - res = Rx.Observable.concat(xs, ys, zs);
* 2 - res = Rx.Observable.concat([xs, ys, zs]);
* @returns {Observable} An observable sequence that contains the elements of each given sequence, in sequential order.
*/
var observableConcat = Observable.concat = function () {
var sources = argsOrArray(arguments, 0);
return enumerableFor(sources).concat();
};
/**
* Concatenates an observable sequence of observable sequences.
* @returns {Observable} An observable sequence that contains the elements of each observed inner sequence, in sequential order.
*/
observableProto.concatObservable = observableProto.concatAll =function () {
return this.merge(1);
};
/**
* Merges an observable sequence of observable sequences into an observable sequence, limiting the number of concurrent subscriptions to inner sequences.
* Or merges two observable sequences into a single observable sequence.
*
* @example
* 1 - merged = sources.merge(1);
* 2 - merged = source.merge(otherSource);
* @param {Mixed} [maxConcurrentOrOther] Maximum number of inner observable sequences being subscribed to concurrently or the second observable sequence.
* @returns {Observable} The observable sequence that merges the elements of the inner sequences.
*/
observableProto.merge = function (maxConcurrentOrOther) {
if (typeof maxConcurrentOrOther !== 'number') {
return observableMerge(this, maxConcurrentOrOther);
}
var sources = this;
return new AnonymousObservable(function (observer) {
var activeCount = 0,
group = new CompositeDisposable(),
isStopped = false,
q = [],
subscribe = function (xs) {
var subscription = new SingleAssignmentDisposable();
group.add(subscription);
subscription.setDisposable(xs.subscribe(observer.onNext.bind(observer), observer.onError.bind(observer), function () {
var s;
group.remove(subscription);
if (q.length > 0) {
s = q.shift();
subscribe(s);
} else {
activeCount--;
if (isStopped && activeCount === 0) {
observer.onCompleted();
}
}
}));
};
group.add(sources.subscribe(function (innerSource) {
if (activeCount < maxConcurrentOrOther) {
activeCount++;
subscribe(innerSource);
} else {
q.push(innerSource);
}
}, observer.onError.bind(observer), function () {
isStopped = true;
if (activeCount === 0) {
observer.onCompleted();
}
}));
return group;
});
};
/**
* Merges all the observable sequences into a single observable sequence.
* The scheduler is optional and if not specified, the immediate scheduler is used.
*
* @example
* 1 - merged = Rx.Observable.merge(xs, ys, zs);
* 2 - merged = Rx.Observable.merge([xs, ys, zs]);
* 3 - merged = Rx.Observable.merge(scheduler, xs, ys, zs);
* 4 - merged = Rx.Observable.merge(scheduler, [xs, ys, zs]);
* @returns {Observable} The observable sequence that merges the elements of the observable sequences.
*/
var observableMerge = Observable.merge = function () {
var scheduler, sources;
if (!arguments[0]) {
scheduler = immediateScheduler;
sources = slice.call(arguments, 1);
} else if (arguments[0].now) {
scheduler = arguments[0];
sources = slice.call(arguments, 1);
} else {
scheduler = immediateScheduler;
sources = slice.call(arguments, 0);
}
if (Array.isArray(sources[0])) {
sources = sources[0];
}
return observableFromArray(sources, scheduler).mergeObservable();
};
/**
* Merges an observable sequence of observable sequences into an observable sequence.
* @returns {Observable} The observable sequence that merges the elements of the inner sequences.
*/
observableProto.mergeObservable = observableProto.mergeAll =function () {
var sources = this;
return new AnonymousObservable(function (observer) {
var group = new CompositeDisposable(),
isStopped = false,
m = new SingleAssignmentDisposable();
group.add(m);
m.setDisposable(sources.subscribe(function (innerSource) {
var innerSubscription = new SingleAssignmentDisposable();
group.add(innerSubscription);
innerSubscription.setDisposable(innerSource.subscribe(function (x) {
observer.onNext(x);
}, observer.onError.bind(observer), function () {
group.remove(innerSubscription);
if (isStopped && group.length === 1) {
observer.onCompleted();
}
}));
}, observer.onError.bind(observer), function () {
isStopped = true;
if (group.length === 1) {
observer.onCompleted();
}
}));
return group;
});
};
/**
* Returns the values from the source observable sequence only after the other observable sequence produces a value.
* @param {Observable} other The observable sequence that triggers propagation of elements of the source sequence.
* @returns {Observable} An observable sequence containing the elements of the source sequence starting from the point the other sequence triggered propagation.
*/
observableProto.skipUntil = function (other) {
var source = this;
return new AnonymousObservable(function (observer) {
var isOpen = false;
var disposables = new CompositeDisposable(source.subscribe(function (left) {
if (isOpen) {
observer.onNext(left);
}
}, observer.onError.bind(observer), function () {
if (isOpen) {
observer.onCompleted();
}
}));
var rightSubscription = new SingleAssignmentDisposable();
disposables.add(rightSubscription);
rightSubscription.setDisposable(other.subscribe(function () {
isOpen = true;
rightSubscription.dispose();
}, observer.onError.bind(observer), function () {
rightSubscription.dispose();
}));
return disposables;
});
};
/**
* Transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.
* @returns {Observable} The observable sequence that at any point in time produces the elements of the most recent inner observable sequence that has been received.
*/
observableProto['switch'] = observableProto.switchLatest = function () {
var sources = this;
return new AnonymousObservable(function (observer) {
var hasLatest = false,
innerSubscription = new SerialDisposable(),
isStopped = false,
latest = 0,
subscription = sources.subscribe(function (innerSource) {
var d = new SingleAssignmentDisposable(), id = ++latest;
hasLatest = true;
innerSubscription.setDisposable(d);
d.setDisposable(innerSource.subscribe(function (x) {
if (latest === id) {
observer.onNext(x);
}
}, function (e) {
if (latest === id) {
observer.onError(e);
}
}, function () {
if (latest === id) {
hasLatest = false;
if (isStopped) {
observer.onCompleted();
}
}
}));
}, observer.onError.bind(observer), function () {
isStopped = true;
if (!hasLatest) {
observer.onCompleted();
}
});
return new CompositeDisposable(subscription, innerSubscription);
});
};
/**
* Returns the values from the source observable sequence until the other observable sequence produces a value.
* @param {Observable} other Observable sequence that terminates propagation of elements of the source sequence.
* @returns {Observable} An observable sequence containing the elements of the source sequence up to the point the other sequence interrupted further propagation.
*/
observableProto.takeUntil = function (other) {
var source = this;
return new AnonymousObservable(function (observer) {
return new CompositeDisposable(
source.subscribe(observer),
other.subscribe(observer.onCompleted.bind(observer), observer.onError.bind(observer), noop)
);
});
};
function zipArray(second, resultSelector) {
var first = this;
return new AnonymousObservable(function (observer) {
var index = 0, len = second.length;
return first.subscribe(function (left) {
if (index < len) {
var right = second[index++], result;
try {
result = resultSelector(left, right);
} catch (e) {
observer.onError(e);
return;
}
observer.onNext(result);
} else {
observer.onCompleted();
}
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
}
/**
* Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences or an array have produced an element at a corresponding index.
* The last element in the arguments must be a function to invoke for each series of elements at corresponding indexes in the sources.
*
* @example
* 1 - res = obs1.zip(obs2, fn);
* 1 - res = x1.zip([1,2,3], fn);
* @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.
*/
observableProto.zip = function () {
if (Array.isArray(arguments[0])) {
return zipArray.apply(this, arguments);
}
var parent = this, sources = slice.call(arguments), resultSelector = sources.pop();
sources.unshift(parent);
return new AnonymousObservable(function (observer) {
var n = sources.length,
queues = arrayInitialize(n, function () { return []; }),
isDone = arrayInitialize(n, function () { return false; });
var next = function (i) {
var res, queuedValues;
if (queues.every(function (x) { return x.length > 0; })) {
try {
queuedValues = queues.map(function (x) { return x.shift(); });
res = resultSelector.apply(parent, queuedValues);
} catch (ex) {
observer.onError(ex);
return;
}
observer.onNext(res);
} else if (isDone.filter(function (x, j) { return j !== i; }).every(identity)) {
observer.onCompleted();
}
};
function done(i) {
isDone[i] = true;
if (isDone.every(function (x) { return x; })) {
observer.onCompleted();
}
}
var subscriptions = new Array(n);
for (var idx = 0; idx < n; idx++) {
(function (i) {
subscriptions[i] = new SingleAssignmentDisposable();
subscriptions[i].setDisposable(sources[i].subscribe(function (x) {
queues[i].push(x);
next(i);
}, observer.onError.bind(observer), function () {
done(i);
}));
})(idx);
}
return new CompositeDisposable(subscriptions);
});
};
/**
* Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.
* @param arguments Observable sources.
* @param {Function} resultSelector Function to invoke for each series of elements at corresponding indexes in the sources.
* @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.
*/
Observable.zip = function () {
var args = slice.call(arguments, 0),
first = args.shift();
return first.zip.apply(first, args);
};
/**
* Merges the specified observable sequences into one observable sequence by emitting a list with the elements of the observable sequences at corresponding indexes.
* @param arguments Observable sources.
* @returns {Observable} An observable sequence containing lists of elements at corresponding indexes.
*/
Observable.zipArray = function () {
var sources = argsOrArray(arguments, 0);
return new AnonymousObservable(function (observer) {
var n = sources.length,
queues = arrayInitialize(n, function () { return []; }),
isDone = arrayInitialize(n, function () { return false; });
function next(i) {
if (queues.every(function (x) { return x.length > 0; })) {
var res = queues.map(function (x) { return x.shift(); });
observer.onNext(res);
} else if (isDone.filter(function (x, j) { return j !== i; }).every(identity)) {
observer.onCompleted();
return;
}
};
function done(i) {
isDone[i] = true;
if (isDone.every(identity)) {
observer.onCompleted();
return;
}
}
var subscriptions = new Array(n);
for (var idx = 0; idx < n; idx++) {
(function (i) {
subscriptions[i] = new SingleAssignmentDisposable();
subscriptions[i].setDisposable(sources[i].subscribe(function (x) {
queues[i].push(x);
next(i);
}, observer.onError.bind(observer), function () {
done(i);
}));
})(idx);
}
var compositeDisposable = new CompositeDisposable(subscriptions);
compositeDisposable.add(disposableCreate(function () {
for (var qIdx = 0, qLen = queues.length; qIdx < qLen; qIdx++) {
queues[qIdx] = [];
}
}));
return compositeDisposable;
});
};
/**
* Hides the identity of an observable sequence.
* @returns {Observable} An observable sequence that hides the identity of the source sequence.
*/
observableProto.asObservable = function () {
var source = this;
return new AnonymousObservable(function (observer) {
return source.subscribe(observer);
});
};
/**
* Dematerializes the explicit notification values of an observable sequence as implicit notifications.
* @returns {Observable} An observable sequence exhibiting the behavior corresponding to the source sequence's notification values.
*/
observableProto.dematerialize = function () {
var source = this;
return new AnonymousObservable(function (observer) {
return source.subscribe(function (x) {
return x.accept(observer);
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Returns an observable sequence that contains only distinct contiguous elements according to the keySelector and the comparer.
*
* var obs = observable.distinctUntilChanged();
* var obs = observable.distinctUntilChanged(function (x) { return x.id; });
* var obs = observable.distinctUntilChanged(function (x) { return x.id; }, function (x, y) { return x === y; });
*
* @param {Function} [keySelector] A function to compute the comparison key for each element. If not provided, it projects the value.
* @param {Function} [comparer] Equality comparer for computed key values. If not provided, defaults to an equality comparer function.
* @returns {Observable} An observable sequence only containing the distinct contiguous elements, based on a computed key value, from the source sequence.
*/
observableProto.distinctUntilChanged = function (keySelector, comparer) {
var source = this;
keySelector || (keySelector = identity);
comparer || (comparer = defaultComparer);
return new AnonymousObservable(function (observer) {
var hasCurrentKey = false, currentKey;
return source.subscribe(function (value) {
var comparerEquals = false, key;
try {
key = keySelector(value);
} catch (exception) {
observer.onError(exception);
return;
}
if (hasCurrentKey) {
try {
comparerEquals = comparer(currentKey, key);
} catch (exception) {
observer.onError(exception);
return;
}
}
if (!hasCurrentKey || !comparerEquals) {
hasCurrentKey = true;
currentKey = key;
observer.onNext(value);
}
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Invokes an action for each element in the observable sequence and invokes an action upon graceful or exceptional termination of the observable sequence.
* This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.
*
* @example
* var res = observable.doAction(observer);
* var res = observable.doAction(onNext);
* var res = observable.doAction(onNext, onError);
* var res = observable.doAction(onNext, onError, onCompleted);
* @param {Mixed} observerOrOnNext Action to invoke for each element in the observable sequence or an observer.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence. Used if only the observerOrOnNext parameter is also a function.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence. Used if only the observerOrOnNext parameter is also a function.
* @returns {Observable} The source sequence with the side-effecting behavior applied.
*/
observableProto['do'] = observableProto.doAction = function (observerOrOnNext, onError, onCompleted) {
var source = this, onNextFunc;
if (typeof observerOrOnNext === 'function') {
onNextFunc = observerOrOnNext;
} else {
onNextFunc = observerOrOnNext.onNext.bind(observerOrOnNext);
onError = observerOrOnNext.onError.bind(observerOrOnNext);
onCompleted = observerOrOnNext.onCompleted.bind(observerOrOnNext);
}
return new AnonymousObservable(function (observer) {
return source.subscribe(function (x) {
try {
onNextFunc(x);
} catch (e) {
observer.onError(e);
}
observer.onNext(x);
}, function (exception) {
if (!onError) {
observer.onError(exception);
} else {
try {
onError(exception);
} catch (e) {
observer.onError(e);
}
observer.onError(exception);
}
}, function () {
if (!onCompleted) {
observer.onCompleted();
} else {
try {
onCompleted();
} catch (e) {
observer.onError(e);
}
observer.onCompleted();
}
});
});
};
/**
* Invokes a specified action after the source observable sequence terminates gracefully or exceptionally.
*
* @example
* var res = observable.finallyAction(function () { console.log('sequence ended'; });
* @param {Function} finallyAction Action to invoke after the source observable sequence terminates.
* @returns {Observable} Source sequence with the action-invoking termination behavior applied.
*/
observableProto['finally'] = observableProto.finallyAction = function (action) {
var source = this;
return new AnonymousObservable(function (observer) {
var subscription = source.subscribe(observer);
return disposableCreate(function () {
try {
subscription.dispose();
} catch (e) {
throw e;
} finally {
action();
}
});
});
};
/**
* Ignores all elements in an observable sequence leaving only the termination messages.
* @returns {Observable} An empty observable sequence that signals termination, successful or exceptional, of the source sequence.
*/
observableProto.ignoreElements = function () {
var source = this;
return new AnonymousObservable(function (observer) {
return source.subscribe(noop, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Materializes the implicit notifications of an observable sequence as explicit notification values.
* @returns {Observable} An observable sequence containing the materialized notification values from the source sequence.
*/
observableProto.materialize = function () {
var source = this;
return new AnonymousObservable(function (observer) {
return source.subscribe(function (value) {
observer.onNext(notificationCreateOnNext(value));
}, function (e) {
observer.onNext(notificationCreateOnError(e));
observer.onCompleted();
}, function () {
observer.onNext(notificationCreateOnCompleted());
observer.onCompleted();
});
});
};
/**
* Repeats the observable sequence a specified number of times. If the repeat count is not specified, the sequence repeats indefinitely.
*
* @example
* var res = repeated = source.repeat();
* var res = repeated = source.repeat(42);
* @param {Number} [repeatCount] Number of times to repeat the sequence. If not provided, repeats the sequence indefinitely.
* @returns {Observable} The observable sequence producing the elements of the given sequence repeatedly.
*/
observableProto.repeat = function (repeatCount) {
return enumerableRepeat(this, repeatCount).concat();
};
/**
* Repeats the source observable sequence the specified number of times or until it successfully terminates. If the retry count is not specified, it retries indefinitely.
*
* @example
* var res = retried = retry.repeat();
* var res = retried = retry.repeat(42);
* @param {Number} [retryCount] Number of times to retry the sequence. If not provided, retry the sequence indefinitely.
* @returns {Observable} An observable sequence producing the elements of the given sequence repeatedly until it terminates successfully.
*/
observableProto.retry = function (retryCount) {
return enumerableRepeat(this, retryCount).catchException();
};
/**
* Applies an accumulator function over an observable sequence and returns each intermediate result. The optional seed value is used as the initial accumulator value.
* For aggregation behavior with no intermediate results, see Observable.aggregate.
* @example
* var res = source.scan(function (acc, x) { return acc + x; });
* var res = source.scan(0, function (acc, x) { return acc + x; });
* @param {Mixed} [seed] The initial accumulator value.
* @param {Function} accumulator An accumulator function to be invoked on each element.
* @returns {Observable} An observable sequence containing the accumulated values.
*/
observableProto.scan = function () {
var hasSeed = false, seed, accumulator, source = this;
if (arguments.length === 2) {
hasSeed = true;
seed = arguments[0];
accumulator = arguments[1];
} else {
accumulator = arguments[0];
}
return new AnonymousObservable(function (observer) {
var hasAccumulation, accumulation, hasValue;
return source.subscribe (
function (x) {
try {
if (!hasValue) {
hasValue = true;
}
if (hasAccumulation) {
accumulation = accumulator(accumulation, x);
} else {
accumulation = hasSeed ? accumulator(seed, x) : x;
hasAccumulation = true;
}
} catch (e) {
observer.onError(e);
return;
}
observer.onNext(accumulation);
},
observer.onError.bind(observer),
function () {
if (!hasValue && hasSeed) {
observer.onNext(seed);
}
observer.onCompleted();
}
);
});
};
/**
* Bypasses a specified number of elements at the end of an observable sequence.
* @description
* This operator accumulates a queue with a length enough to store the first `count` elements. As more elements are
* received, elements are taken from the front of the queue and produced on the result sequence. This causes elements to be delayed.
* @param count Number of elements to bypass at the end of the source sequence.
* @returns {Observable} An observable sequence containing the source sequence elements except for the bypassed ones at the end.
*/
observableProto.skipLast = function (count) {
var source = this;
return new AnonymousObservable(function (observer) {
var q = [];
return source.subscribe(function (x) {
q.push(x);
if (q.length > count) {
observer.onNext(q.shift());
}
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Prepends a sequence of values to an observable sequence with an optional scheduler and an argument list of values to prepend.
*
* var res = source.startWith(1, 2, 3);
* var res = source.startWith(Rx.Scheduler.timeout, 1, 2, 3);
*
* @memberOf Observable#
* @returns {Observable} The source sequence prepended with the specified values.
*/
observableProto.startWith = function () {
var values, scheduler, start = 0;
if (!!arguments.length && 'now' in Object(arguments[0])) {
scheduler = arguments[0];
start = 1;
} else {
scheduler = immediateScheduler;
}
values = slice.call(arguments, start);
return enumerableFor([observableFromArray(values, scheduler), this]).concat();
};
/**
* Returns a specified number of contiguous elements from the end of an observable sequence, using an optional scheduler to drain the queue.
*
* @example
* var res = source.takeLast(5);
* var res = source.takeLast(5, Rx.Scheduler.timeout);
*
* @description
* This operator accumulates a buffer with a length enough to store elements count elements. Upon completion of
* the source sequence, this buffer is drained on the result sequence. This causes the elements to be delayed.
* @param {Number} count Number of elements to take from the end of the source sequence.
* @param {Scheduler} [scheduler] Scheduler used to drain the queue upon completion of the source sequence.
* @returns {Observable} An observable sequence containing the specified number of elements from the end of the source sequence.
*/
observableProto.takeLast = function (count, scheduler) {
return this.takeLastBuffer(count).selectMany(function (xs) { return observableFromArray(xs, scheduler); });
};
/**
* Returns an array with the specified number of contiguous elements from the end of an observable sequence.
*
* @description
* This operator accumulates a buffer with a length enough to store count elements. Upon completion of the
* source sequence, this buffer is produced on the result sequence.
* @param {Number} count Number of elements to take from the end of the source sequence.
* @returns {Observable} An observable sequence containing a single array with the specified number of elements from the end of the source sequence.
*/
observableProto.takeLastBuffer = function (count) {
var source = this;
return new AnonymousObservable(function (observer) {
var q = [];
return source.subscribe(function (x) {
q.push(x);
if (q.length > count) {
q.shift();
}
}, observer.onError.bind(observer), function () {
observer.onNext(q);
observer.onCompleted();
});
});
};
/**
* Projects each element of an observable sequence into a new form by incorporating the element's index.
* @param {Function} selector A transform function to apply to each source element; the second parameter of the function represents the index of the source element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence whose elements are the result of invoking the transform function on each element of source.
*/
observableProto.select = observableProto.map = function (selector, thisArg) {
var parent = this;
return new AnonymousObservable(function (observer) {
var count = 0;
return parent.subscribe(function (value) {
var result;
try {
result = selector.call(thisArg, value, count++, parent);
} catch (exception) {
observer.onError(exception);
return;
}
observer.onNext(result);
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
function selectMany(selector) {
return this.select(selector).mergeObservable();
}
/**
* One of the Following:
* Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.
*
* @example
* var res = source.selectMany(function (x) { return Rx.Observable.range(0, x); });
* Or:
* Projects each element of an observable sequence to an observable sequence, invokes the result selector for the source element and each of the corresponding inner sequence's elements, and merges the results into one observable sequence.
*
* var res = source.selectMany(function (x) { return Rx.Observable.range(0, x); }, function (x, y) { return x + y; });
* Or:
* Projects each element of the source observable sequence to the other observable sequence and merges the resulting observable sequences into one observable sequence.
*
* var res = source.selectMany(Rx.Observable.fromArray([1,2,3]));
* @param selector A transform function to apply to each element or an observable sequence to project each element from the source sequence onto.
* @param {Function} [resultSelector] A transform function to apply to each element of the intermediate sequence.
* @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of the input sequence and then mapping each of those sequence elements and their corresponding source element to a result element.
*/
observableProto.selectMany = observableProto.flatMap = function (selector, resultSelector) {
if (resultSelector) {
return this.selectMany(function (x) {
return selector(x).select(function (y) {
return resultSelector(x, y);
});
});
}
if (typeof selector === 'function') {
return selectMany.call(this, selector);
}
return selectMany.call(this, function () {
return selector;
});
};
/**
* Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then
* transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.
* @param {Function} selector A transform function to apply to each source element; the second parameter of the function represents the index of the source element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence whose elements are the result of invoking the transform function on each element of source producing an Observable of Observable sequences
* and that at any point in time produces the elements of the most recent inner observable sequence that has been received.
*/
observableProto.selectSwitch = observableProto.flatMapLatest = function (selector, thisArg) {
return this.select(selector, thisArg).switchLatest();
};
/**
* Bypasses a specified number of elements in an observable sequence and then returns the remaining elements.
* @param {Number} count The number of elements to skip before returning the remaining elements.
* @returns {Observable} An observable sequence that contains the elements that occur after the specified index in the input sequence.
*/
observableProto.skip = function (count) {
if (count < 0) {
throw new Error(argumentOutOfRange);
}
var observable = this;
return new AnonymousObservable(function (observer) {
var remaining = count;
return observable.subscribe(function (x) {
if (remaining <= 0) {
observer.onNext(x);
} else {
remaining--;
}
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Bypasses elements in an observable sequence as long as a specified condition is true and then returns the remaining elements.
* The element's index is used in the logic of the predicate function.
*
* var res = source.skipWhile(function (value) { return value < 10; });
* var res = source.skipWhile(function (value, index) { return value < 10 || index < 10; });
* @param {Function} predicate A function to test each element for a condition; the second parameter of the function represents the index of the source element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence that contains the elements from the input sequence starting at the first element in the linear series that does not pass the test specified by predicate.
*/
observableProto.skipWhile = function (predicate, thisArg) {
var source = this;
return new AnonymousObservable(function (observer) {
var i = 0, running = false;
return source.subscribe(function (x) {
if (!running) {
try {
running = !predicate.call(thisArg, x, i++, source);
} catch (e) {
observer.onError(e);
return;
}
}
if (running) {
observer.onNext(x);
}
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Returns a specified number of contiguous elements from the start of an observable sequence, using the specified scheduler for the edge case of take(0).
*
* var res = source.take(5);
* var res = source.take(0, Rx.Scheduler.timeout);
* @param {Number} count The number of elements to return.
* @param {Scheduler} [scheduler] Scheduler used to produce an OnCompleted message in case <paramref name="count count</paramref> is set to 0.
* @returns {Observable} An observable sequence that contains the specified number of elements from the start of the input sequence.
*/
observableProto.take = function (count, scheduler) {
if (count < 0) {
throw new Error(argumentOutOfRange);
}
if (count === 0) {
return observableEmpty(scheduler);
}
var observable = this;
return new AnonymousObservable(function (observer) {
var remaining = count;
return observable.subscribe(function (x) {
if (remaining > 0) {
remaining--;
observer.onNext(x);
if (remaining === 0) {
observer.onCompleted();
}
}
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Returns elements from an observable sequence as long as a specified condition is true.
* The element's index is used in the logic of the predicate function.
*
* @example
* var res = source.takeWhile(function (value) { return value < 10; });
* var res = source.takeWhile(function (value, index) { return value < 10 || index < 10; });
* @param {Function} predicate A function to test each element for a condition; the second parameter of the function represents the index of the source element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence that contains the elements from the input sequence that occur before the element at which the test no longer passes.
*/
observableProto.takeWhile = function (predicate, thisArg) {
var observable = this;
return new AnonymousObservable(function (observer) {
var i = 0, running = true;
return observable.subscribe(function (x) {
if (running) {
try {
running = predicate.call(thisArg, x, i++, observable);
} catch (e) {
observer.onError(e);
return;
}
if (running) {
observer.onNext(x);
} else {
observer.onCompleted();
}
}
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Filters the elements of an observable sequence based on a predicate by incorporating the element's index.
*
* @example
* var res = source.where(function (value) { return value < 10; });
* var res = source.where(function (value, index) { return value < 10 || index < 10; });
* @param {Function} predicate A function to test each source element for a condition; the second parameter of the function represents the index of the source element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence that contains elements from the input sequence that satisfy the condition.
*/
observableProto.where = observableProto.filter = function (predicate, thisArg) {
var parent = this;
return new AnonymousObservable(function (observer) {
var count = 0;
return parent.subscribe(function (value) {
var shouldRun;
try {
shouldRun = predicate.call(thisArg, value, count++, parent);
} catch (exception) {
observer.onError(exception);
return;
}
if (shouldRun) {
observer.onNext(value);
}
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Converts a callback function to an observable sequence.
*
* @param {Function} function Function with a callback as the last parameter to convert to an Observable sequence.
* @param {Scheduler} [scheduler] Scheduler to run the function on. If not specified, defaults to Scheduler.timeout.
* @param {Mixed} [context] The context for the func parameter to be executed. If not specified, defaults to undefined.
* @param {Function} [selector] A selector which takes the arguments from the callback to produce a single item to yield on next.
* @returns {Function} A function, when executed with the required parameters minus the callback, produces an Observable sequence with a single value of the arguments to the callback as an array.
*/
Observable.fromCallback = function (func, scheduler, context, selector) {
scheduler || (scheduler = timeoutScheduler);
return function () {
var args = slice.call(arguments, 0);
return new AnonymousObservable(function (observer) {
return scheduler.schedule(function () {
function handler(e) {
var results = e;
if (selector) {
try {
results = selector(arguments);
} catch (err) {
observer.onError(err);
return;
}
} else {
if (results.length === 1) {
results = results[0];
}
}
observer.onNext(results);
observer.onCompleted();
}
args.push(handler);
func.apply(context, args);
});
});
};
};
/**
* Converts a Node.js callback style function to an observable sequence. This must be in function (err, ...) format.
* @param {Function} func The function to call
* @param {Scheduler} [scheduler] Scheduler to run the function on. If not specified, defaults to Scheduler.timeout.
* @param {Mixed} [context] The context for the func parameter to be executed. If not specified, defaults to undefined.
* @param {Function} [selector] A selector which takes the arguments from the callback minus the error to produce a single item to yield on next.
* @returns {Function} An async function which when applied, returns an observable sequence with the callback arguments as an array.
*/
Observable.fromNodeCallback = function (func, scheduler, context, selector) {
scheduler || (scheduler = timeoutScheduler);
return function () {
var args = slice.call(arguments, 0);
return new AnonymousObservable(function (observer) {
return scheduler.schedule(function () {
function handler(err) {
if (err) {
observer.onError(err);
return;
}
var results = slice.call(arguments, 1);
if (selector) {
try {
results = selector(results);
} catch (e) {
observer.onError(e);
return;
}
} else {
if (results.length === 1) {
results = results[0];
}
}
observer.onNext(results);
observer.onCompleted();
}
args.push(handler);
func.apply(context, args);
});
});
};
};
function createListener (element, name, handler) {
// Node.js specific
if (element.addListener) {
element.addListener(name, handler);
return disposableCreate(function () {
element.removeListener(name, handler);
});
} else if (element.addEventListener) {
element.addEventListener(name, handler, false);
return disposableCreate(function () {
element.removeEventListener(name, handler, false);
});
}
}
function createEventListener (el, eventName, handler) {
var disposables = new CompositeDisposable();
// Asume NodeList
if (el && el.length) {
for (var i = 0, len = el.length; i < len; i++) {
disposables.add(createEventListener(el[i], eventName, handler));
}
} else if (el) {
disposables.add(createListener(el, eventName, handler));
}
return disposables;
}
/**
* Creates an observable sequence by adding an event listener to the matching DOMElement or each item in the NodeList.
*
* @example
* var source = Rx.Observable.fromEvent(element, 'mouseup');
*
* @param {Object} element The DOMElement or NodeList to attach a listener.
* @param {String} eventName The event name to attach the observable sequence.
* @param {Function} [selector] A selector which takes the arguments from the event handler to produce a single item to yield on next.
* @returns {Observable} An observable sequence of events from the specified element and the specified event.
*/
Observable.fromEvent = function (element, eventName, selector) {
return new AnonymousObservable(function (observer) {
return createEventListener(
element,
eventName,
function handler (e) {
var results = e;
if (selector) {
try {
results = selector(arguments);
} catch (err) {
observer.onError(err);
return
}
}
observer.onNext(results);
});
}).publish().refCount();
};
/**
* Creates an observable sequence from an event emitter via an addHandler/removeHandler pair.
* @param {Function} addHandler The function to add a handler to the emitter.
* @param {Function} [removeHandler] The optional function to remove a handler from an emitter.
* @param {Function} [selector] A selector which takes the arguments from the event handler to produce a single item to yield on next.
* @returns {Observable} An observable sequence which wraps an event from an event emitter
*/
Observable.fromEventPattern = function (addHandler, removeHandler, selector) {
return new AnonymousObservable(function (observer) {
function innerHandler (e) {
var result = e;
if (selector) {
try {
result = selector(arguments);
} catch (err) {
observer.onError(err);
return;
}
}
observer.onNext(result);
}
var returnValue = addHandler(innerHandler);
return disposableCreate(function () {
if (removeHandler) {
removeHandler(innerHandler, returnValue);
}
});
}).publish().refCount();
};
/**
* Converts a Promise to an Observable sequence
* @param {Promise} A Promises A+ implementation instance.
* @returns {Observable} An Observable sequence which wraps the existing promise success and failure.
*/
Observable.fromPromise = function (promise) {
return new AnonymousObservable(function (observer) {
promise.then(
function (value) {
observer.onNext(value);
observer.onCompleted();
},
function (reason) {
observer.onError(reason);
});
});
};
/**
* Multicasts the source sequence notifications through an instantiated subject into all uses of the sequence within a selector function. Each
* subscription to the resulting sequence causes a separate multicast invocation, exposing the sequence resulting from the selector function's
* invocation. For specializations with fixed subject types, see Publish, PublishLast, and Replay.
*
* @example
* 1 - res = source.multicast(observable);
* 2 - res = source.multicast(function () { return new Subject(); }, function (x) { return x; });
*
* @param {Function|Subject} subjectOrSubjectSelector
* Factory function to create an intermediate subject through which the source sequence's elements will be multicast to the selector function.
* Or:
* Subject to push source elements into.
*
* @param {Function} [selector] Optional selector function which can use the multicasted source sequence subject to the policies enforced by the created subject. Specified only if <paramref name="subjectOrSubjectSelector" is a factory function.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
*/
observableProto.multicast = function (subjectOrSubjectSelector, selector) {
var source = this;
return typeof subjectOrSubjectSelector === 'function' ?
new AnonymousObservable(function (observer) {
var connectable = source.multicast(subjectOrSubjectSelector());
return new CompositeDisposable(selector(connectable).subscribe(observer), connectable.connect());
}) :
new ConnectableObservable(source, subjectOrSubjectSelector);
};
/**
* Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence.
* This operator is a specialization of Multicast using a regular Subject.
*
* @example
* var resres = source.publish();
* var res = source.publish(function (x) { return x; });
*
* @param {Function} [selector] Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive all notifications of the source from the time of the subscription on.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
*/
observableProto.publish = function (selector) {
return !selector ?
this.multicast(new Subject()) :
this.multicast(function () {
return new Subject();
}, selector);
};
/**
* Returns an observable sequence that shares a single subscription to the underlying sequence.
* This operator is a specialization of publish which creates a subscription when the number of observers goes from zero to one, then shares that subscription with all subsequent observers until the number of observers returns to zero, at which point the subscription is disposed.
*
* @example
* var res = source.share();
*
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence.
*/
observableProto.share = function () {
return this.publish(null).refCount();
};
/**
* Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence containing only the last notification.
* This operator is a specialization of Multicast using a AsyncSubject.
*
* @example
* var res = source.publishLast();
* var res = source.publishLast(function (x) { return x; });
*
* @param selector [Optional] Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will only receive the last notification of the source.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
*/
observableProto.publishLast = function (selector) {
return !selector ?
this.multicast(new AsyncSubject()) :
this.multicast(function () {
return new AsyncSubject();
}, selector);
};
/**
* Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence and starts with initialValue.
* This operator is a specialization of Multicast using a BehaviorSubject.
*
* @example
* var res = source.publishValue(42);
* var res = source.publishValue(function (x) { return x.select(function (y) { return y * y; }) }, 42);
*
* @param {Function} [selector] Optional selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive immediately receive the initial value, followed by all notifications of the source from the time of the subscription on.
* @param {Mixed} initialValue Initial value received by observers upon subscription.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
*/
observableProto.publishValue = function (initialValueOrSelector, initialValue) {
return arguments.length === 2 ?
this.multicast(function () {
return new BehaviorSubject(initialValue);
}, initialValueOrSelector) :
this.multicast(new BehaviorSubject(initialValueOrSelector));
};
/**
* Returns an observable sequence that shares a single subscription to the underlying sequence and starts with an initialValue.
* This operator is a specialization of publishValue which creates a subscription when the number of observers goes from zero to one, then shares that subscription with all subsequent observers until the number of observers returns to zero, at which point the subscription is disposed.
*
* @example
* var res = source.shareValue(42);
*
* @param {Mixed} initialValue Initial value received by observers upon subscription.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence.
*/
observableProto.shareValue = function (initialValue) {
return this.publishValue(initialValue).
refCount();
};
/**
* Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence replaying notifications subject to a maximum time length for the replay buffer.
* This operator is a specialization of Multicast using a ReplaySubject.
*
* @example
* var res = source.replay(null, 3);
* var res = source.replay(null, 3, 500);
* var res = source.replay(null, 3, 500, scheduler);
* var res = source.replay(function (x) { return x.take(6).repeat(); }, 3, 500, scheduler);
*
* @param selector [Optional] Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive all the notifications of the source subject to the specified replay buffer trimming policy.
* @param bufferSize [Optional] Maximum element count of the replay buffer.
* @param window [Optional] Maximum time length of the replay buffer.
* @param scheduler [Optional] Scheduler where connected observers within the selector function will be invoked on.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
*/
observableProto.replay = function (selector, bufferSize, window, scheduler) {
return !selector ?
this.multicast(new ReplaySubject(bufferSize, window, scheduler)) :
this.multicast(function () {
return new ReplaySubject(bufferSize, window, scheduler);
}, selector);
};
/**
* Returns an observable sequence that shares a single subscription to the underlying sequence replaying notifications subject to a maximum time length for the replay buffer.
* This operator is a specialization of replay which creates a subscription when the number of observers goes from zero to one, then shares that subscription with all subsequent observers until the number of observers returns to zero, at which point the subscription is disposed.
*
* @example
* var res = source.shareReplay(3);
* var res = source.shareReplay(3, 500);
* var res = source.shareReplay(3, 500, scheduler);
*
* @param bufferSize [Optional] Maximum element count of the replay buffer.
* @param window [Optional] Maximum time length of the replay buffer.
* @param scheduler [Optional] Scheduler where connected observers within the selector function will be invoked on.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence.
*/
observableProto.shareReplay = function (bufferSize, window, scheduler) {
return this.replay(null, bufferSize, window, scheduler).refCount();
};
/** @private */
var ConnectableObservable = Rx.ConnectableObservable = (function (_super) {
inherits(ConnectableObservable, _super);
/**
* @constructor
* @private
*/
function ConnectableObservable(source, subject) {
var state = {
subject: subject,
source: source.asObservable(),
hasSubscription: false,
subscription: null
};
this.connect = function () {
if (!state.hasSubscription) {
state.hasSubscription = true;
state.subscription = new CompositeDisposable(state.source.subscribe(state.subject), disposableCreate(function () {
state.hasSubscription = false;
}));
}
return state.subscription;
};
function subscribe(observer) {
return state.subject.subscribe(observer);
}
_super.call(this, subscribe);
}
/**
* @private
* @memberOf ConnectableObservable
*/
ConnectableObservable.prototype.connect = function () { return this.connect(); };
/**
* @private
* @memberOf ConnectableObservable
*/
ConnectableObservable.prototype.refCount = function () {
var connectableSubscription = null, count = 0, source = this;
return new AnonymousObservable(function (observer) {
var shouldConnect, subscription;
count++;
shouldConnect = count === 1;
subscription = source.subscribe(observer);
if (shouldConnect) {
connectableSubscription = source.connect();
}
return disposableCreate(function () {
subscription.dispose();
count--;
if (count === 0) {
connectableSubscription.dispose();
}
});
});
};
return ConnectableObservable;
}(Observable));
function observableTimerTimeSpan(dueTime, scheduler) {
var d = normalizeTime(dueTime);
return new AnonymousObservable(function (observer) {
return scheduler.scheduleWithRelative(d, function () {
observer.onNext(0);
observer.onCompleted();
});
});
}
function observableTimerTimeSpanAndPeriod(dueTime, period, scheduler) {
if (dueTime === period) {
return new AnonymousObservable(function (observer) {
return scheduler.schedulePeriodicWithState(0, period, function (count) {
observer.onNext(count);
return count + 1;
});
});
}
return observableDefer(function () {
return observableTimerDateAndPeriod(scheduler.now() + dueTime, period, scheduler);
});
}
/**
* Returns an observable sequence that produces a value after each period.
*
* @example
* 1 - res = Rx.Observable.interval(1000);
* 2 - res = Rx.Observable.interval(1000, Rx.Scheduler.timeout);
*
* @param {Number} period Period for producing the values in the resulting sequence (specified as an integer denoting milliseconds).
* @param {Scheduler} [scheduler] Scheduler to run the timer on. If not specified, Rx.Scheduler.timeout is used.
* @returns {Observable} An observable sequence that produces a value after each period.
*/
var observableinterval = Observable.interval = function (period, scheduler) {
scheduler || (scheduler = timeoutScheduler);
return observableTimerTimeSpanAndPeriod(period, period, scheduler);
};
/**
* Returns an observable sequence that produces a value after dueTime has elapsed and then after each period.
*
* @example
* var res = Rx.Observable.timer(5000);
* var res = Rx.Observable.timer(5000, 1000);
* var res = Rx.Observable.timer(5000, Rx.Scheduler.timeout);
* var res = Rx.Observable.timer(5000, 1000, Rx.Scheduler.timeout);
*
* @param {Number} dueTime Relative time (specified as an integer denoting milliseconds) at which to produce the first value.
* @param {Mixed} [periodOrScheduler] Period to produce subsequent values (specified as an integer denoting milliseconds), or the scheduler to run the timer on. If not specified, the resulting timer is not recurring.
* @param {Scheduler} [scheduler] Scheduler to run the timer on. If not specified, the timeout scheduler is used.
* @returns {Observable} An observable sequence that produces a value after due time has elapsed and then each period.
*/
var observableTimer = Observable.timer = function (dueTime, periodOrScheduler, scheduler) {
var period;
scheduler || (scheduler = timeoutScheduler);
if (typeof periodOrScheduler === 'number') {
period = periodOrScheduler;
} else if (typeof periodOrScheduler === 'object' && 'now' in periodOrScheduler) {
scheduler = periodOrScheduler;
}
return period === undefined ?
observableTimerTimeSpan(dueTime, scheduler) :
observableTimerTimeSpanAndPeriod(dueTime, period, scheduler);
};
/**
* Time shifts the observable sequence by dueTime. The relative time intervals between the values are preserved.
*
* @example
* var res = Rx.Observable.delay(5000);
* var res = Rx.Observable.delay(5000, 1000, Rx.Scheduler.timeout);
* @memberOf Observable#
* @param {Number} dueTime Absolute (specified as a Date object) or relative time (specified as an integer denoting milliseconds) by which to shift the observable sequence.
* @param {Scheduler} [scheduler] Scheduler to run the delay timers on. If not specified, the timeout scheduler is used.
* @returns {Observable} Time-shifted sequence.
*/
observableProto.delay = function (dueTime, scheduler) {
scheduler || (scheduler = timeoutScheduler);
var source = this;
return new AnonymousObservable(function (observer) {
var active = false,
cancelable = new SerialDisposable(),
exception = null,
q = [],
running = false,
subscription;
subscription = source.materialize().timestamp(scheduler).subscribe(function (notification) {
var d, shouldRun;
if (notification.value.kind === 'E') {
q = [];
q.push(notification);
exception = notification.value.exception;
shouldRun = !running;
} else {
q.push({ value: notification.value, timestamp: notification.timestamp + dueTime });
shouldRun = !active;
active = true;
}
if (shouldRun) {
if (exception !== null) {
observer.onError(exception);
} else {
d = new SingleAssignmentDisposable();
cancelable.setDisposable(d);
d.setDisposable(scheduler.scheduleRecursiveWithRelative(dueTime, function (self) {
var e, recurseDueTime, result, shouldRecurse;
if (exception !== null) {
return;
}
running = true;
do {
result = null;
if (q.length > 0 && q[0].timestamp - scheduler.now() <= 0) {
result = q.shift().value;
}
if (result !== null) {
result.accept(observer);
}
} while (result !== null);
shouldRecurse = false;
recurseDueTime = 0;
if (q.length > 0) {
shouldRecurse = true;
recurseDueTime = Math.max(0, q[0].timestamp - scheduler.now());
} else {
active = false;
}
e = exception;
running = false;
if (e !== null) {
observer.onError(e);
} else if (shouldRecurse) {
self(recurseDueTime);
}
}));
}
}
});
return new CompositeDisposable(subscription, cancelable);
});
};
/**
* Ignores values from an observable sequence which are followed by another value before dueTime.
*
* @example
* 1 - res = source.throttle(5000); // 5 seconds
* 2 - res = source.throttle(5000, scheduler);
*
* @param {Number} dueTime Duration of the throttle period for each value (specified as an integer denoting milliseconds).
* @param {Scheduler} [scheduler] Scheduler to run the throttle timers on. If not specified, the timeout scheduler is used.
* @returns {Observable} The throttled sequence.
*/
observableProto.throttle = function (dueTime, scheduler) {
scheduler || (scheduler = timeoutScheduler);
var source = this;
return this.throttleWithSelector(function () { return observableTimer(dueTime, scheduler); })
};
/**
* Records the time interval between consecutive values in an observable sequence.
*
* @example
* 1 - res = source.timeInterval();
* 2 - res = source.timeInterval(Rx.Scheduler.timeout);
*
* @param [scheduler] Scheduler used to compute time intervals. If not specified, the timeout scheduler is used.
* @returns {Observable} An observable sequence with time interval information on values.
*/
observableProto.timeInterval = function (scheduler) {
var source = this;
scheduler || (scheduler = timeoutScheduler);
return observableDefer(function () {
var last = scheduler.now();
return source.select(function (x) {
var now = scheduler.now(), span = now - last;
last = now;
return {
value: x,
interval: span
};
});
});
};
/**
* Records the timestamp for each value in an observable sequence.
*
* @example
* 1 - res = source.timestamp(); // produces { value: x, timestamp: ts }
* 2 - res = source.timestamp(Rx.Scheduler.timeout);
*
* @param {Scheduler} [scheduler] Scheduler used to compute timestamps. If not specified, the timeout scheduler is used.
* @returns {Observable} An observable sequence with timestamp information on values.
*/
observableProto.timestamp = function (scheduler) {
scheduler || (scheduler = timeoutScheduler);
return this.select(function (x) {
return {
value: x,
timestamp: scheduler.now()
};
});
};
function sampleObservable(source, sampler) {
return new AnonymousObservable(function (observer) {
var atEnd, value, hasValue;
function sampleSubscribe() {
if (hasValue) {
hasValue = false;
observer.onNext(value);
}
if (atEnd) {
observer.onCompleted();
}
}
return new CompositeDisposable(
source.subscribe(function (newValue) {
hasValue = true;
value = newValue;
}, observer.onError.bind(observer), function () {
atEnd = true;
}),
sampler.subscribe(sampleSubscribe, observer.onError.bind(observer), sampleSubscribe)
);
});
}
/**
* Samples the observable sequence at each interval.
*
* @example
* 1 - res = source.sample(sampleObservable); // Sampler tick sequence
* 2 - res = source.sample(5000); // 5 seconds
* 2 - res = source.sample(5000, Rx.Scheduler.timeout); // 5 seconds
*
* @param {Mixed} intervalOrSampler Interval at which to sample (specified as an integer denoting milliseconds) or Sampler Observable.
* @param {Scheduler} [scheduler] Scheduler to run the sampling timer on. If not specified, the timeout scheduler is used.
* @returns {Observable} Sampled observable sequence.
*/
observableProto.sample = function (intervalOrSampler, scheduler) {
scheduler || (scheduler = timeoutScheduler);
if (typeof intervalOrSampler === 'number') {
return sampleObservable(this, observableinterval(intervalOrSampler, scheduler));
}
return sampleObservable(this, intervalOrSampler);
};
/**
* Returns the source observable sequence or the other observable sequence if dueTime elapses.
*
* @example
* 1 - res = source.timeout(new Date()); // As a date
* 2 - res = source.timeout(5000); // 5 seconds
* 3 - res = source.timeout(new Date(), Rx.Observable.returnValue(42)); // As a date and timeout observable
* 4 - res = source.timeout(5000, Rx.Observable.returnValue(42)); // 5 seconds and timeout observable
* 5 - res = source.timeout(new Date(), Rx.Observable.returnValue(42), Rx.Scheduler.timeout); // As a date and timeout observable
* 6 - res = source.timeout(5000, Rx.Observable.returnValue(42), Rx.Scheduler.timeout); // 5 seconds and timeout observable
*
* @param {Number} dueTime Absolute (specified as a Date object) or relative time (specified as an integer denoting milliseconds) when a timeout occurs.
* @param {Observable} [other] Sequence to return in case of a timeout. If not specified, a timeout error throwing sequence will be used.
* @param {Scheduler} [scheduler] Scheduler to run the timeout timers on. If not specified, the timeout scheduler is used.
* @returns {Observable} The source sequence switching to the other sequence in case of a timeout.
*/
observableProto.timeout = function (dueTime, other, scheduler) {
var schedulerMethod, source = this;
other || (other = observableThrow(new Error('Timeout')));
scheduler || (scheduler = timeoutScheduler);
if (dueTime instanceof Date) {
schedulerMethod = function (dt, action) {
scheduler.scheduleWithAbsolute(dt, action);
};
} else {
schedulerMethod = function (dt, action) {
scheduler.scheduleWithRelative(dt, action);
};
}
return new AnonymousObservable(function (observer) {
var createTimer,
id = 0,
original = new SingleAssignmentDisposable(),
subscription = new SerialDisposable(),
switched = false,
timer = new SerialDisposable();
subscription.setDisposable(original);
createTimer = function () {
var myId = id;
timer.setDisposable(schedulerMethod(dueTime, function () {
switched = id === myId;
var timerWins = switched;
if (timerWins) {
subscription.setDisposable(other.subscribe(observer));
}
}));
};
createTimer();
original.setDisposable(source.subscribe(function (x) {
var onNextWins = !switched;
if (onNextWins) {
id++;
observer.onNext(x);
createTimer();
}
}, function (e) {
var onErrorWins = !switched;
if (onErrorWins) {
id++;
observer.onError(e);
}
}, function () {
var onCompletedWins = !switched;
if (onCompletedWins) {
id++;
observer.onCompleted();
}
}));
return new CompositeDisposable(subscription, timer);
});
};
/**
* Generates an observable sequence by iterating a state from an initial state until the condition fails.
*
* @example
* res = source.generateWithRelativeTime(0,
* function (x) { return return true; },
* function (x) { return x + 1; },
* function (x) { return x; },
* function (x) { return 500; }
* );
*
* @param {Mixed} initialState Initial state.
* @param {Function} condition Condition to terminate generation (upon returning false).
* @param {Function} iterate Iteration step function.
* @param {Function} resultSelector Selector function for results produced in the sequence.
* @param {Function} timeSelector Time selector function to control the speed of values being produced each iteration, returning integer values denoting milliseconds.
* @param {Scheduler} [scheduler] Scheduler on which to run the generator loop. If not specified, the timeout scheduler is used.
* @returns {Observable} The generated sequence.
*/
Observable.generateWithTime = function (initialState, condition, iterate, resultSelector, timeSelector, scheduler) {
scheduler || (scheduler = timeoutScheduler);
return new AnonymousObservable(function (observer) {
var first = true,
hasResult = false,
result,
state = initialState,
time;
return scheduler.scheduleRecursiveWithRelative(0, function (self) {
if (hasResult) {
observer.onNext(result);
}
try {
if (first) {
first = false;
} else {
state = iterate(state);
}
hasResult = condition(state);
if (hasResult) {
result = resultSelector(state);
time = timeSelector(state);
}
} catch (e) {
observer.onError(e);
return;
}
if (hasResult) {
self(time);
} else {
observer.onCompleted();
}
});
});
};
/**
* Time shifts the observable sequence by delaying the subscription.
*
* @example
* 1 - res = source.delaySubscription(5000); // 5s
* 2 - res = source.delaySubscription(5000, Rx.Scheduler.timeout); // 5 seconds
*
* @param {Number} dueTime Absolute or relative time to perform the subscription at.
* @param {Scheduler} [scheduler] Scheduler to run the subscription delay timer on. If not specified, the timeout scheduler is used.
* @returns {Observable} Time-shifted sequence.
*/
observableProto.delaySubscription = function (dueTime, scheduler) {
scheduler || (scheduler = timeoutScheduler);
return this.delayWithSelector(observableTimer(dueTime, scheduler), function () { return observableEmpty(); });
};
/**
* Time shifts the observable sequence based on a subscription delay and a delay selector function for each element.
*
* @example
* 1 - res = source.delayWithSelector(function (x) { return Rx.Scheduler.timer(5000); }); // with selector only
* 1 - res = source.delayWithSelector(Rx.Observable.timer(2000), function (x) { return Rx.Observable.timer(x); }); // with delay and selector
*
* @param {Observable} [subscriptionDelay] Sequence indicating the delay for the subscription to the source.
* @param {Function} delayDurationSelector Selector function to retrieve a sequence indicating the delay for each given element.
* @returns {Observable} Time-shifted sequence.
*/
observableProto.delayWithSelector = function (subscriptionDelay, delayDurationSelector) {
var source = this, subDelay, selector;
if (typeof subscriptionDelay === 'function') {
selector = subscriptionDelay;
} else {
subDelay = subscriptionDelay;
selector = delayDurationSelector;
}
return new AnonymousObservable(function (observer) {
var delays = new CompositeDisposable(), atEnd = false, done = function () {
if (atEnd && delays.length === 0) {
observer.onCompleted();
}
}, subscription = new SerialDisposable(), start = function () {
subscription.setDisposable(source.subscribe(function (x) {
var delay;
try {
delay = selector(x);
} catch (error) {
observer.onError(error);
return;
}
var d = new SingleAssignmentDisposable();
delays.add(d);
d.setDisposable(delay.subscribe(function () {
observer.onNext(x);
delays.remove(d);
done();
}, observer.onError.bind(observer), function () {
observer.onNext(x);
delays.remove(d);
done();
}));
}, observer.onError.bind(observer), function () {
atEnd = true;
subscription.dispose();
done();
}));
};
if (!subDelay) {
start();
} else {
subscription.setDisposable(subDelay.subscribe(function () {
start();
}, observer.onError.bind(observer), function () { start(); }));
}
return new CompositeDisposable(subscription, delays);
});
};
/**
* Returns the source observable sequence, switching to the other observable sequence if a timeout is signaled.
*
* @example
* 1 - res = source.timeoutWithSelector(Rx.Observable.timer(500));
* 2 - res = source.timeoutWithSelector(Rx.Observable.timer(500), function (x) { return Rx.Observable.timer(200); });
* 3 - res = source.timeoutWithSelector(Rx.Observable.timer(500), function (x) { return Rx.Observable.timer(200); }, Rx.Observable.returnValue(42));
*
* @param {Observable} [firstTimeout] Observable sequence that represents the timeout for the first element. If not provided, this defaults to Observable.never().
* @param {Function} [timeoutDurationSelector] Selector to retrieve an observable sequence that represents the timeout between the current element and the next element.
* @param {Observable} [other] Sequence to return in case of a timeout. If not provided, this is set to Observable.throwException().
* @returns {Observable} The source sequence switching to the other sequence in case of a timeout.
*/
observableProto.timeoutWithSelector = function (firstTimeout, timeoutdurationSelector, other) {
if (arguments.length === 1) {
timeoutdurationSelector = firstTimeout;
var firstTimeout = observableNever();
}
other || (other = observableThrow(new Error('Timeout')));
var source = this;
return new AnonymousObservable(function (observer) {
var subscription = new SerialDisposable(), timer = new SerialDisposable(), original = new SingleAssignmentDisposable();
subscription.setDisposable(original);
var id = 0, switched = false, setTimer = function (timeout) {
var myId = id, timerWins = function () {
return id === myId;
};
var d = new SingleAssignmentDisposable();
timer.setDisposable(d);
d.setDisposable(timeout.subscribe(function () {
if (timerWins()) {
subscription.setDisposable(other.subscribe(observer));
}
d.dispose();
}, function (e) {
if (timerWins()) {
observer.onError(e);
}
}, function () {
if (timerWins()) {
subscription.setDisposable(other.subscribe(observer));
}
}));
};
setTimer(firstTimeout);
var observerWins = function () {
var res = !switched;
if (res) {
id++;
}
return res;
};
original.setDisposable(source.subscribe(function (x) {
if (observerWins()) {
observer.onNext(x);
var timeout;
try {
timeout = timeoutdurationSelector(x);
} catch (e) {
observer.onError(e);
return;
}
setTimer(timeout);
}
}, function (e) {
if (observerWins()) {
observer.onError(e);
}
}, function () {
if (observerWins()) {
observer.onCompleted();
}
}));
return new CompositeDisposable(subscription, timer);
});
};
/**
* Ignores values from an observable sequence which are followed by another value within a computed throttle duration.
*
* @example
* 1 - res = source.delayWithSelector(function (x) { return Rx.Scheduler.timer(x + x); });
*
* @param {Function} throttleDurationSelector Selector function to retrieve a sequence indicating the throttle duration for each given element.
* @returns {Observable} The throttled sequence.
*/
observableProto.throttleWithSelector = function (throttleDurationSelector) {
var source = this;
return new AnonymousObservable(function (observer) {
var value, hasValue = false, cancelable = new SerialDisposable(), id = 0, subscription = source.subscribe(function (x) {
var throttle;
try {
throttle = throttleDurationSelector(x);
} catch (e) {
observer.onError(e);
return;
}
hasValue = true;
value = x;
id++;
var currentid = id, d = new SingleAssignmentDisposable();
cancelable.setDisposable(d);
d.setDisposable(throttle.subscribe(function () {
if (hasValue && id === currentid) {
observer.onNext(value);
}
hasValue = false;
d.dispose();
}, observer.onError.bind(observer), function () {
if (hasValue && id === currentid) {
observer.onNext(value);
}
hasValue = false;
d.dispose();
}));
}, function (e) {
cancelable.dispose();
observer.onError(e);
hasValue = false;
id++;
}, function () {
cancelable.dispose();
if (hasValue) {
observer.onNext(value);
}
observer.onCompleted();
hasValue = false;
id++;
});
return new CompositeDisposable(subscription, cancelable);
});
};
/**
* Skips elements for the specified duration from the end of the observable source sequence, using the specified scheduler to run timers.
*
* 1 - res = source.skipLastWithTime(5000);
* 2 - res = source.skipLastWithTime(5000, scheduler);
*
* @description
* This operator accumulates a queue with a length enough to store elements received during the initial duration window.
* As more elements are received, elements older than the specified duration are taken from the queue and produced on the
* result sequence. This causes elements to be delayed with duration.
* @param {Number} duration Duration for skipping elements from the end of the sequence.
* @param {Scheduler} [scheduler] Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout
* @returns {Observable} An observable sequence with the elements skipped during the specified duration from the end of the source sequence.
*/
observableProto.skipLastWithTime = function (duration, scheduler) {
scheduler || (scheduler = timeoutScheduler);
var source = this;
return new AnonymousObservable(function (observer) {
var q = [];
return source.subscribe(function (x) {
var now = scheduler.now();
q.push({ interval: now, value: x });
while (q.length > 0 && now - q[0].interval >= duration) {
observer.onNext(q.shift().value);
}
}, observer.onError.bind(observer), function () {
var now = scheduler.now();
while (q.length > 0 && now - q[0].interval >= duration) {
observer.onNext(q.shift().value);
}
observer.onCompleted();
});
});
};
/**
* Returns elements within the specified duration from the end of the observable source sequence, using the specified schedulers to run timers and to drain the collected elements.
*
* @example
* 1 - res = source.takeLastWithTime(5000, [optional timer scheduler], [optional loop scheduler]);
* @description
* This operator accumulates a queue with a length enough to store elements received during the initial duration window.
* As more elements are received, elements older than the specified duration are taken from the queue and produced on the
* result sequence. This causes elements to be delayed with duration.
* @param {Number} duration Duration for taking elements from the end of the sequence.
* @param {Scheduler} [timerScheduler] Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.
* @param {Scheduler} [loopScheduler] Scheduler to drain the collected elements. If not specified, defaults to Rx.Scheduler.immediate.
* @returns {Observable} An observable sequence with the elements taken during the specified duration from the end of the source sequence.
*/
observableProto.takeLastWithTime = function (duration, timerScheduler, loopScheduler) {
return this.takeLastBufferWithTime(duration, timerScheduler).selectMany(function (xs) { return observableFromArray(xs, loopScheduler); });
};
/**
* Returns an array with the elements within the specified duration from the end of the observable source sequence, using the specified scheduler to run timers.
*
* @example
* 1 - res = source.takeLastBufferWithTime(5000, [optional scheduler]);
* @description
* This operator accumulates a queue with a length enough to store elements received during the initial duration window.
* As more elements are received, elements older than the specified duration are taken from the queue and produced on the
* result sequence. This causes elements to be delayed with duration.
* @param {Number} duration Duration for taking elements from the end of the sequence.
* @param {Scheduler} scheduler Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.
* @returns {Observable} An observable sequence containing a single array with the elements taken during the specified duration from the end of the source sequence.
*/
observableProto.takeLastBufferWithTime = function (duration, scheduler) {
var source = this;
scheduler || (scheduler = timeoutScheduler);
return new AnonymousObservable(function (observer) {
var q = [];
return source.subscribe(function (x) {
var now = scheduler.now();
q.push({ interval: now, value: x });
while (q.length > 0 && now - q[0].interval >= duration) {
q.shift();
}
}, observer.onError.bind(observer), function () {
var now = scheduler.now(), res = [];
while (q.length > 0) {
var next = q.shift();
if (now - next.interval <= duration) {
res.push(next.value);
}
}
observer.onNext(res);
observer.onCompleted();
});
});
};
/**
* Takes elements for the specified duration from the start of the observable source sequence, using the specified scheduler to run timers.
*
* @example
* 1 - res = source.takeWithTime(5000, [optional scheduler]);
* @description
* This operator accumulates a queue with a length enough to store elements received during the initial duration window.
* As more elements are received, elements older than the specified duration are taken from the queue and produced on the
* result sequence. This causes elements to be delayed with duration.
* @param {Number} duration Duration for taking elements from the start of the sequence.
* @param {Scheduler} scheduler Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.
* @returns {Observable} An observable sequence with the elements taken during the specified duration from the start of the source sequence.
*/
observableProto.takeWithTime = function (duration, scheduler) {
var source = this;
scheduler || (scheduler = timeoutScheduler);
return new AnonymousObservable(function (observer) {
var t = scheduler.scheduleWithRelative(duration, function () {
observer.onCompleted();
});
return new CompositeDisposable(t, source.subscribe(observer));
});
};
/**
* Skips elements for the specified duration from the start of the observable source sequence, using the specified scheduler to run timers.
*
* @example
* 1 - res = source.skipWithTime(5000, [optional scheduler]);
*
* @description
* Specifying a zero value for duration doesn't guarantee no elements will be dropped from the start of the source sequence.
* This is a side-effect of the asynchrony introduced by the scheduler, where the action that causes callbacks from the source sequence to be forwarded
* may not execute immediately, despite the zero due time.
*
* Errors produced by the source sequence are always forwarded to the result sequence, even if the error occurs before the duration.
* @param {Number} duration Duration for skipping elements from the start of the sequence.
* @param {Scheduler} scheduler Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.
* @returns {Observable} An observable sequence with the elements skipped during the specified duration from the start of the source sequence.
*/
observableProto.skipWithTime = function (duration, scheduler) {
var source = this;
scheduler || (scheduler = timeoutScheduler);
return new AnonymousObservable(function (observer) {
var open = false,
t = scheduler.scheduleWithRelative(duration, function () { open = true; }),
d = source.subscribe(function (x) {
if (open) {
observer.onNext(x);
}
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
return new CompositeDisposable(t, d);
});
};
/**
* Skips elements from the observable source sequence until the specified start time, using the specified scheduler to run timers.
* Errors produced by the source sequence are always forwarded to the result sequence, even if the error occurs before the start time>.
*
* @examples
* 1 - res = source.skipUntilWithTime(new Date(), [optional scheduler]);
* @param startTime Time to start taking elements from the source sequence. If this value is less than or equal to Date(), no elements will be skipped.
* @param scheduler Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.
* @returns {Observable} An observable sequence with the elements skipped until the specified start time.
*/
observableProto.skipUntilWithTime = function (startTime, scheduler) {
scheduler || (scheduler = timeoutScheduler);
var source = this;
return new AnonymousObservable(function (observer) {
var open = false,
t = scheduler.scheduleWithAbsolute(startTime, function () { open = true; }),
d = source.subscribe(function (x) {
if (open) {
observer.onNext(x);
}
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
return new CompositeDisposable(t, d);
});
};
/**
* Takes elements for the specified duration until the specified end time, using the specified scheduler to run timers.
*
* @example
* 1 - res = source.takeUntilWithTime(new Date(), [optional scheduler]);
* @param {Number} endTime Time to stop taking elements from the source sequence. If this value is less than or equal to new Date(), the result stream will complete immediately.
* @param {Scheduler} scheduler Scheduler to run the timer on.
* @returns {Observable} An observable sequence with the elements taken until the specified end time.
*/
observableProto.takeUntilWithTime = function (endTime, scheduler) {
scheduler || (scheduler = timeoutScheduler);
var source = this;
return new AnonymousObservable(function (observer) {
return new CompositeDisposable(scheduler.scheduleWithAbsolute(endTime, function () {
observer.onCompleted();
}), source.subscribe(observer));
});
};
var AnonymousObservable = Rx.Internals.AnonymousObservable = (function (_super) {
inherits(AnonymousObservable, _super);
// Fix subscriber to check for undefined or function returned to decorate as Disposable
function fixSubscriber(subscriber) {
if (typeof subscriber === 'undefined') {
subscriber = disposableEmpty;
} else if (typeof subscriber === 'function') {
subscriber = disposableCreate(subscriber);
}
return subscriber;
}
function AnonymousObservable(subscribe) {
if (!(this instanceof AnonymousObservable)) {
return new AnonymousObservable(subscribe);
}
function s(observer) {
var autoDetachObserver = new AutoDetachObserver(observer);
if (currentThreadScheduler.scheduleRequired()) {
currentThreadScheduler.schedule(function () {
try {
autoDetachObserver.setDisposable(fixSubscriber(subscribe(autoDetachObserver)));
} catch (e) {
if (!autoDetachObserver.fail(e)) {
throw e;
}
}
});
} else {
try {
autoDetachObserver.setDisposable(fixSubscriber(subscribe(autoDetachObserver)));
} catch (e) {
if (!autoDetachObserver.fail(e)) {
throw e;
}
}
}
return autoDetachObserver;
}
_super.call(this, s);
}
return AnonymousObservable;
}(Observable));
/** @private */
var AutoDetachObserver = (function (_super) {
inherits(AutoDetachObserver, _super);
function AutoDetachObserver(observer) {
_super.call(this);
this.observer = observer;
this.m = new SingleAssignmentDisposable();
}
var AutoDetachObserverPrototype = AutoDetachObserver.prototype;
AutoDetachObserverPrototype.next = function (value) {
var noError = false;
try {
this.observer.onNext(value);
noError = true;
} catch (e) {
throw e;
} finally {
if (!noError) {
this.dispose();
}
}
};
AutoDetachObserverPrototype.error = function (exn) {
try {
this.observer.onError(exn);
} catch (e) {
throw e;
} finally {
this.dispose();
}
};
AutoDetachObserverPrototype.completed = function () {
try {
this.observer.onCompleted();
} catch (e) {
throw e;
} finally {
this.dispose();
}
};
AutoDetachObserverPrototype.setDisposable = function (value) { this.m.setDisposable(value); };
AutoDetachObserverPrototype.getDisposable = function (value) { return this.m.getDisposable(); };
/* @private */
AutoDetachObserverPrototype.disposable = function (value) {
return arguments.length ? this.getDisposable() : setDisposable(value);
};
AutoDetachObserverPrototype.dispose = function () {
_super.prototype.dispose.call(this);
this.m.dispose();
};
return AutoDetachObserver;
}(AbstractObserver));
/** @private */
var InnerSubscription = function (subject, observer) {
this.subject = subject;
this.observer = observer;
};
/**
* @private
* @memberOf InnerSubscription
*/
InnerSubscription.prototype.dispose = function () {
if (!this.subject.isDisposed && this.observer !== null) {
var idx = this.subject.observers.indexOf(this.observer);
this.subject.observers.splice(idx, 1);
this.observer = null;
}
};
/**
* Represents an object that is both an observable sequence as well as an observer.
* Each notification is broadcasted to all subscribed observers.
*/
var Subject = Rx.Subject = (function (_super) {
function subscribe(observer) {
checkDisposed.call(this);
if (!this.isStopped) {
this.observers.push(observer);
return new InnerSubscription(this, observer);
}
if (this.exception) {
observer.onError(this.exception);
return disposableEmpty;
}
observer.onCompleted();
return disposableEmpty;
}
inherits(Subject, _super);
/**
* Creates a subject.
* @constructor
*/
function Subject() {
_super.call(this, subscribe);
this.isDisposed = false,
this.isStopped = false,
this.observers = [];
}
addProperties(Subject.prototype, Observer, {
/**
* Indicates whether the subject has observers subscribed to it.
* @returns {Boolean} Indicates whether the subject has observers subscribed to it.
*/
hasObservers: function () {
return this.observers.length > 0;
},
/**
* Notifies all subscribed observers about the end of the sequence.
*/
onCompleted: function () {
checkDisposed.call(this);
if (!this.isStopped) {
var os = this.observers.slice(0);
this.isStopped = true;
for (var i = 0, len = os.length; i < len; i++) {
os[i].onCompleted();
}
this.observers = [];
}
},
/**
* Notifies all subscribed observers about the exception.
* @param {Mixed} error The exception to send to all observers.
*/
onError: function (exception) {
checkDisposed.call(this);
if (!this.isStopped) {
var os = this.observers.slice(0);
this.isStopped = true;
this.exception = exception;
for (var i = 0, len = os.length; i < len; i++) {
os[i].onError(exception);
}
this.observers = [];
}
},
/**
* Notifies all subscribed observers about the arrival of the specified element in the sequence.
* @param {Mixed} value The value to send to all observers.
*/
onNext: function (value) {
checkDisposed.call(this);
if (!this.isStopped) {
var os = this.observers.slice(0);
for (var i = 0, len = os.length; i < len; i++) {
os[i].onNext(value);
}
}
},
/**
* Unsubscribe all observers and release resources.
*/
dispose: function () {
this.isDisposed = true;
this.observers = null;
}
});
/**
* Creates a subject from the specified observer and observable.
* @param {Observer} observer The observer used to send messages to the subject.
* @param {Observable} observable The observable used to subscribe to messages sent from the subject.
* @returns {Subject} Subject implemented using the given observer and observable.
*/
Subject.create = function (observer, observable) {
return new AnonymousSubject(observer, observable);
};
return Subject;
}(Observable));
/**
* Represents the result of an asynchronous operation.
* The last value before the OnCompleted notification, or the error received through OnError, is sent to all subscribed observers.
*/
var AsyncSubject = Rx.AsyncSubject = (function (_super) {
function subscribe(observer) {
checkDisposed.call(this);
if (!this.isStopped) {
this.observers.push(observer);
return new InnerSubscription(this, observer);
}
var ex = this.exception;
hv = this.hasValue,
v = this.value;
if (ex) {
observer.onError(ex);
} else if (hv) {
observer.onNext(v);
observer.onCompleted();
} else {
observer.onCompleted();
}
return disposableEmpty;
}
inherits(AsyncSubject, _super);
/**
* Creates a subject that can only receive one value and that value is cached for all future observations.
* @constructor
*/
function AsyncSubject() {
_super.call(this, subscribe);
this.isDisposed = false;
this.isStopped = false;
this.value = null;
this.hasValue = false;
this.observers = [];
this.exception = null;
}
addProperties(AsyncSubject.prototype, Observer, {
/**
* Indicates whether the subject has observers subscribed to it.
* @returns {Boolean} Indicates whether the subject has observers subscribed to it.
*/
hasObservers: function () {
checkDisposed.call(this);
return this.observers.length > 0;
},
/**
* Notifies all subscribed observers about the end of the sequence, also causing the last received value to be sent out (if any).
*/
onCompleted: function () {
var o, i, len;
checkDisposed.call(this);
if (!this.isStopped) {
var os = this.observers.slice(0);
this.isStopped = true;
var v = this.value;
var hv = this.hasValue;
if (hv) {
for (i = 0, len = os.length; i < len; i++) {
o = os[i];
o.onNext(v);
o.onCompleted();
}
} else {
for (i = 0, len = os.length; i < len; i++) {
os[i].onCompleted();
}
}
this.observers = [];
}
},
/**
* Notifies all subscribed observers about the exception.
* @param {Mixed} error The exception to send to all observers.
*/
onError: function (exception) {
checkDisposed.call(this);
if (!this.isStopped) {
var os = this.observers.slice(0);
this.isStopped = true;
this.exception = exception;
for (var i = 0, len = os.length; i < len; i++) {
os[i].onError(exception);
}
this.observers = [];
}
},
/**
* Sends a value to the subject. The last value received before successful termination will be sent to all subscribed and future observers.
* @param {Mixed} value The value to store in the subject.
*/
onNext: function (value) {
checkDisposed.call(this);
if (!this.isStopped) {
this.value = value;
this.hasValue = true;
}
},
/**
* Unsubscribe all observers and release resources.
*/
dispose: function () {
this.isDisposed = true;
this.observers = null;
this.exception = null;
this.value = null;
}
});
return AsyncSubject;
}(Observable));
/** @private */
var AnonymousSubject = (function (_super) {
inherits(AnonymousSubject, _super);
function subscribe(observer) {
return this.observable.subscribe(observer);
}
/**
* @private
* @constructor
*/
function AnonymousSubject(observer, observable) {
_super.call(this, subscribe);
this.observer = observer;
this.observable = observable;
}
addProperties(AnonymousSubject.prototype, Observer, {
/**
* @private
* @memberOf AnonymousSubject#
*/
onCompleted: function () {
this.observer.onCompleted();
},
/**
* @private
* @memberOf AnonymousSubject#
*/
onError: function (exception) {
this.observer.onError(exception);
},
/**
* @private
* @memberOf AnonymousSubject#
*/
onNext: function (value) {
this.observer.onNext(value);
}
});
return AnonymousSubject;
}(Observable));
/**
* Represents a value that changes over time.
* Observers can subscribe to the subject to receive the last (or initial) value and all subsequent notifications.
*/
var BehaviorSubject = Rx.BehaviorSubject = (function (_super) {
function subscribe(observer) {
checkDisposed.call(this);
if (!this.isStopped) {
this.observers.push(observer);
observer.onNext(this.value);
return new InnerSubscription(this, observer);
}
var ex = this.exception;
if (ex) {
observer.onError(ex);
} else {
observer.onCompleted();
}
return disposableEmpty;
}
inherits(BehaviorSubject, _super);
/**
* @constructor
* Initializes a new instance of the BehaviorSubject class which creates a subject that caches its last value and starts with the specified value.
* @param {Mixed} value Initial value sent to observers when no other value has been received by the subject yet.
*/
function BehaviorSubject(value) {
_super.call(this, subscribe);
this.value = value,
this.observers = [],
this.isDisposed = false,
this.isStopped = false,
this.exception = null;
}
addProperties(BehaviorSubject.prototype, Observer, {
/**
* Indicates whether the subject has observers subscribed to it.
* @returns {Boolean} Indicates whether the subject has observers subscribed to it.
*/
hasObservers: function () {
return this.observers.length > 0;
},
/**
* Notifies all subscribed observers about the end of the sequence.
*/
onCompleted: function () {
checkDisposed.call(this);
if (!this.isStopped) {
var os = this.observers.slice(0);
this.isStopped = true;
for (var i = 0, len = os.length; i < len; i++) {
os[i].onCompleted();
}
this.observers = [];
}
},
/**
* Notifies all subscribed observers about the exception.
* @param {Mixed} error The exception to send to all observers.
*/
onError: function (error) {
checkDisposed.call(this);
if (!this.isStopped) {
var os = this.observers.slice(0);
this.isStopped = true;
this.exception = error;
for (var i = 0, len = os.length; i < len; i++) {
os[i].onError(error);
}
this.observers = [];
}
},
/**
* Notifies all subscribed observers about the arrival of the specified element in the sequence.
* @param {Mixed} value The value to send to all observers.
*/
onNext: function (value) {
checkDisposed.call(this);
if (!this.isStopped) {
this.value = value;
var os = this.observers.slice(0);
for (var i = 0, len = os.length; i < len; i++) {
os[i].onNext(value);
}
}
},
/**
* Unsubscribe all observers and release resources.
*/
dispose: function () {
this.isDisposed = true;
this.observers = null;
this.value = null;
this.exception = null;
}
});
return BehaviorSubject;
}(Observable));
/**
* Represents an object that is both an observable sequence as well as an observer.
* Each notification is broadcasted to all subscribed and future observers, subject to buffer trimming policies.
*/
var ReplaySubject = Rx.ReplaySubject = (function (_super) {
function RemovableDisposable (subject, observer) {
this.subject = subject;
this.observer = observer;
};
RemovableDisposable.prototype.dispose = function () {
this.observer.dispose();
if (!this.subject.isDisposed) {
var idx = this.subject.observers.indexOf(this.observer);
this.subject.observers.splice(idx, 1);
}
};
function subscribe(observer) {
var so = new ScheduledObserver(this.scheduler, observer),
subscription = new RemovableDisposable(this, so);
checkDisposed.call(this);
this._trim(this.scheduler.now());
this.observers.push(so);
var n = this.q.length;
for (var i = 0, len = this.q.length; i < len; i++) {
so.onNext(this.q[i].value);
}
if (this.hasError) {
n++;
so.onError(this.error);
} else if (this.isStopped) {
n++;
so.onCompleted();
}
so.ensureActive(n);
return subscription;
}
inherits(ReplaySubject, _super);
/**
* Initializes a new instance of the ReplaySubject class with the specified buffer size, window size and scheduler.
* @param {Number} [bufferSize] Maximum element count of the replay buffer.
* @param {Number} [windowSize] Maximum time length of the replay buffer.
* @param {Scheduler} [scheduler] Scheduler the observers are invoked on.
*/
function ReplaySubject(bufferSize, windowSize, scheduler) {
this.bufferSize = bufferSize == null ? Number.MAX_VALUE : bufferSize;
this.windowSize = windowSize == null ? Number.MAX_VALUE : windowSize;
this.scheduler = scheduler || currentThreadScheduler;
this.q = [];
this.observers = [];
this.isStopped = false;
this.isDisposed = false;
this.hasError = false;
this.error = null;
_super.call(this, subscribe);
}
addProperties(ReplaySubject.prototype, Observer, {
/**
* Indicates whether the subject has observers subscribed to it.
* @returns {Boolean} Indicates whether the subject has observers subscribed to it.
*/
hasObservers: function () {
return this.observers.length > 0;
},
/* @private */
_trim: function (now) {
while (this.q.length > this.bufferSize) {
this.q.shift();
}
while (this.q.length > 0 && (now - this.q[0].interval) > this.windowSize) {
this.q.shift();
}
},
/**
* Notifies all subscribed observers about the arrival of the specified element in the sequence.
* @param {Mixed} value The value to send to all observers.
*/
onNext: function (value) {
var observer;
checkDisposed.call(this);
if (!this.isStopped) {
var now = this.scheduler.now();
this.q.push({ interval: now, value: value });
this._trim(now);
var o = this.observers.slice(0);
for (var i = 0, len = o.length; i < len; i++) {
observer = o[i];
observer.onNext(value);
observer.ensureActive();
}
}
},
/**
* Notifies all subscribed observers about the exception.
* @param {Mixed} error The exception to send to all observers.
*/
onError: function (error) {
var observer;
checkDisposed.call(this);
if (!this.isStopped) {
this.isStopped = true;
this.error = error;
this.hasError = true;
var now = this.scheduler.now();
this._trim(now);
var o = this.observers.slice(0);
for (var i = 0, len = o.length; i < len; i++) {
observer = o[i];
observer.onError(error);
observer.ensureActive();
}
this.observers = [];
}
},
/**
* Notifies all subscribed observers about the end of the sequence.
*/
onCompleted: function () {
var observer;
checkDisposed.call(this);
if (!this.isStopped) {
this.isStopped = true;
var now = this.scheduler.now();
this._trim(now);
var o = this.observers.slice(0);
for (var i = 0, len = o.length; i < len; i++) {
observer = o[i];
observer.onCompleted();
observer.ensureActive();
}
this.observers = [];
}
},
/**
* Unsubscribe all observers and release resources.
*/
dispose: function () {
this.isDisposed = true;
this.observers = null;
}
});
return ReplaySubject;
}(Observable));
if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {
root.Rx = Rx;
define(function() {
return Rx;
});
} else if (freeExports && freeModule) {
// in Node.js or RingoJS
if (moduleExports) {
(freeModule.exports = Rx).Rx = Rx;
} else {
freeExports.Rx = Rx;
}
} else {
// in a browser or Rhino
root.Rx = Rx;
}
}.call(this)); |
web/src/components/public/detail/Action.js | caicloud/cyclone | import React from 'react';
import PropTypes from 'prop-types';
const Action = props => {
return <div className="action">{props.children}</div>;
};
Action.propTypes = {
children: PropTypes.node,
};
export default Action;
|
__tests__/components/Table-test.js | linde12/grommet | // (C) Copyright 2014-2016 Hewlett Packard Enterprise Development LP
import React from 'react';
import renderer from 'react-test-renderer';
import Table from '../../src/js/components/Table';
import TableHeader from '../../src/js/components/Table';
import TableRow from '../../src/js/components/Table';
// needed because this:
// https://github.com/facebook/jest/issues/1353
jest.mock('react-dom');
describe('Table', () => {
it('has correct default options', () => {
const component = renderer.create(
<Table>
<tbody>
<tr>
<td>
first
</td>
<td>
note 1
</td>
</tr>
<tr>
<td>
second
</td>
<td>
note 2
</td>
</tr>
<tr>
<td>
third
</td>
<td>
note 3
</td>
</tr>
</tbody>
</Table>
);
let tree = component.toJSON();
expect(tree).toMatchSnapshot();
});
it('has mismatched headers and body columns', () => {
// Test covers case with one headerCell, but two row cells. Console logs
// error message, but nothing to assert.
const component = renderer.create(
<Table>
<TableHeader labels={['one']} />
<tbody>
<tr>
<td>
one
</td>
<td>
two - one too many
</td>
</tr>
</tbody>
</Table>
);
let tree = component.toJSON();
expect(tree).toMatchSnapshot();
});
});
|
test/regressions/site/src/tests/RadioGroup/SimpleRadioGroup.js | und3fined/material-ui | // @flow weak
import React from 'react';
import { RadioGroup, LabelRadio as Radio } from 'material-ui/Radio';
export default function SimpleRadioGroup() {
return (
<div style={{ width: 100 }}>
<RadioGroup selectedValue="home">
<Radio label="Home" value="home" />
<Radio label="Work" value="work" />
</RadioGroup>
</div>
);
}
|
Tests/Components/RoundedButtonTest.js | friskipr/Ignite_MyApp | import 'react-native'
import React from 'react'
import RoundedButton from '../../App/Components/RoundedButton'
import { shallow } from 'enzyme'
import renderer from 'react-test-renderer'
test('RoundedButton component renders correctly', () => {
const tree = renderer.create(<RoundedButton onPress={() => {}} text='howdy' />).toJSON()
expect(tree).toMatchSnapshot()
})
test('RoundedButton component with children renders correctly', () => {
const tree = renderer.create(<RoundedButton onPress={() => {}}>Howdy</RoundedButton>).toJSON()
expect(tree).toMatchSnapshot()
})
test('onPress', () => {
let i = 0 // i guess i could have used sinon here too... less is more i guess
const onPress = () => i++
const wrapperPress = shallow(<RoundedButton onPress={onPress} text='hi' />)
expect(wrapperPress.prop('onPress')).toBe(onPress) // uses the right handler
expect(i).toBe(0)
wrapperPress.simulate('press')
expect(i).toBe(1)
})
|
4.5/src/SoundBoard/bower_components/jquery-validation/lib/jquery-1.6.4.js | tutsplus/get-started-with-aspnet | /*!
* jQuery JavaScript Library v1.6.4
* http://jquery.com/
*
* Copyright 2011, John Resig
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* Includes Sizzle.js
* http://sizzlejs.com/
* Copyright 2011, The Dojo Foundation
* Released under the MIT, BSD, and GPL Licenses.
*
* Date: Mon Sep 12 18:54:48 2011 -0400
*/
(function( window, undefined ) {
// Use the correct document accordingly with window argument (sandbox)
var document = window.document,
navigator = window.navigator,
location = window.location;
var jQuery = (function() {
// Define a local copy of jQuery
var jQuery = function( selector, context ) {
// The jQuery object is actually just the init constructor 'enhanced'
return new jQuery.fn.init( selector, context, rootjQuery );
},
// Map over jQuery in case of overwrite
_jQuery = window.jQuery,
// Map over the $ in case of overwrite
_$ = window.$,
// A central reference to the root jQuery(document)
rootjQuery,
// A simple way to check for HTML strings or ID strings
// Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
quickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,
// Check if a string has a non-whitespace character in it
rnotwhite = /\S/,
// Used for trimming whitespace
trimLeft = /^\s+/,
trimRight = /\s+$/,
// Check for digits
rdigit = /\d/,
// Match a standalone tag
rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/,
// JSON RegExp
rvalidchars = /^[\],:{}\s]*$/,
rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,
rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,
// Useragent RegExp
rwebkit = /(webkit)[ \/]([\w.]+)/,
ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/,
rmsie = /(msie) ([\w.]+)/,
rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/,
// Matches dashed string for camelizing
rdashAlpha = /-([a-z]|[0-9])/ig,
rmsPrefix = /^-ms-/,
// Used by jQuery.camelCase as callback to replace()
fcamelCase = function( all, letter ) {
return ( letter + "" ).toUpperCase();
},
// Keep a UserAgent string for use with jQuery.browser
userAgent = navigator.userAgent,
// For matching the engine and version of the browser
browserMatch,
// The deferred used on DOM ready
readyList,
// The ready event handler
DOMContentLoaded,
// Save a reference to some core methods
toString = Object.prototype.toString,
hasOwn = Object.prototype.hasOwnProperty,
push = Array.prototype.push,
slice = Array.prototype.slice,
trim = String.prototype.trim,
indexOf = Array.prototype.indexOf,
// [[Class]] -> type pairs
class2type = {};
jQuery.fn = jQuery.prototype = {
constructor: jQuery,
init: function( selector, context, rootjQuery ) {
var match, elem, ret, doc;
// Handle $(""), $(null), or $(undefined)
if ( !selector ) {
return this;
}
// Handle $(DOMElement)
if ( selector.nodeType ) {
this.context = this[0] = selector;
this.length = 1;
return this;
}
// The body element only exists once, optimize finding it
if ( selector === "body" && !context && document.body ) {
this.context = document;
this[0] = document.body;
this.selector = selector;
this.length = 1;
return this;
}
// Handle HTML strings
if ( typeof selector === "string" ) {
// Are we dealing with HTML string or an ID?
if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) {
// Assume that strings that start and end with <> are HTML and skip the regex check
match = [ null, selector, null ];
} else {
match = quickExpr.exec( selector );
}
// Verify a match, and that no context was specified for #id
if ( match && (match[1] || !context) ) {
// HANDLE: $(html) -> $(array)
if ( match[1] ) {
context = context instanceof jQuery ? context[0] : context;
doc = (context ? context.ownerDocument || context : document);
// If a single string is passed in and it's a single tag
// just do a createElement and skip the rest
ret = rsingleTag.exec( selector );
if ( ret ) {
if ( jQuery.isPlainObject( context ) ) {
selector = [ document.createElement( ret[1] ) ];
jQuery.fn.attr.call( selector, context, true );
} else {
selector = [ doc.createElement( ret[1] ) ];
}
} else {
ret = jQuery.buildFragment( [ match[1] ], [ doc ] );
selector = (ret.cacheable ? jQuery.clone(ret.fragment) : ret.fragment).childNodes;
}
return jQuery.merge( this, selector );
// HANDLE: $("#id")
} else {
elem = document.getElementById( match[2] );
// Check parentNode to catch when Blackberry 4.6 returns
// nodes that are no longer in the document #6963
if ( elem && elem.parentNode ) {
// Handle the case where IE and Opera return items
// by name instead of ID
if ( elem.id !== match[2] ) {
return rootjQuery.find( selector );
}
// Otherwise, we inject the element directly into the jQuery object
this.length = 1;
this[0] = elem;
}
this.context = document;
this.selector = selector;
return this;
}
// HANDLE: $(expr, $(...))
} else if ( !context || context.jquery ) {
return (context || rootjQuery).find( selector );
// HANDLE: $(expr, context)
// (which is just equivalent to: $(context).find(expr)
} else {
return this.constructor( context ).find( selector );
}
// HANDLE: $(function)
// Shortcut for document ready
} else if ( jQuery.isFunction( selector ) ) {
return rootjQuery.ready( selector );
}
if (selector.selector !== undefined) {
this.selector = selector.selector;
this.context = selector.context;
}
return jQuery.makeArray( selector, this );
},
// Start with an empty selector
selector: "",
// The current version of jQuery being used
jquery: "1.6.4",
// The default length of a jQuery object is 0
length: 0,
// The number of elements contained in the matched element set
size: function() {
return this.length;
},
toArray: function() {
return slice.call( this, 0 );
},
// Get the Nth element in the matched element set OR
// Get the whole matched element set as a clean array
get: function( num ) {
return num == null ?
// Return a 'clean' array
this.toArray() :
// Return just the object
( num < 0 ? this[ this.length + num ] : this[ num ] );
},
// Take an array of elements and push it onto the stack
// (returning the new matched element set)
pushStack: function( elems, name, selector ) {
// Build a new jQuery matched element set
var ret = this.constructor();
if ( jQuery.isArray( elems ) ) {
push.apply( ret, elems );
} else {
jQuery.merge( ret, elems );
}
// Add the old object onto the stack (as a reference)
ret.prevObject = this;
ret.context = this.context;
if ( name === "find" ) {
ret.selector = this.selector + (this.selector ? " " : "") + selector;
} else if ( name ) {
ret.selector = this.selector + "." + name + "(" + selector + ")";
}
// Return the newly-formed element set
return ret;
},
// Execute a callback for every element in the matched set.
// (You can seed the arguments with an array of args, but this is
// only used internally.)
each: function( callback, args ) {
return jQuery.each( this, callback, args );
},
ready: function( fn ) {
// Attach the listeners
jQuery.bindReady();
// Add the callback
readyList.done( fn );
return this;
},
eq: function( i ) {
return i === -1 ?
this.slice( i ) :
this.slice( i, +i + 1 );
},
first: function() {
return this.eq( 0 );
},
last: function() {
return this.eq( -1 );
},
slice: function() {
return this.pushStack( slice.apply( this, arguments ),
"slice", slice.call(arguments).join(",") );
},
map: function( callback ) {
return this.pushStack( jQuery.map(this, function( elem, i ) {
return callback.call( elem, i, elem );
}));
},
end: function() {
return this.prevObject || this.constructor(null);
},
// For internal use only.
// Behaves like an Array's method, not like a jQuery method.
push: push,
sort: [].sort,
splice: [].splice
};
// Give the init function the jQuery prototype for later instantiation
jQuery.fn.init.prototype = jQuery.fn;
jQuery.extend = jQuery.fn.extend = function() {
var options, name, src, copy, copyIsArray, clone,
target = arguments[0] || {},
i = 1,
length = arguments.length,
deep = false;
// Handle a deep copy situation
if ( typeof target === "boolean" ) {
deep = target;
target = arguments[1] || {};
// skip the boolean and the target
i = 2;
}
// Handle case when target is a string or something (possible in deep copy)
if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
target = {};
}
// extend jQuery itself if only one argument is passed
if ( length === i ) {
target = this;
--i;
}
for ( ; i < length; i++ ) {
// Only deal with non-null/undefined values
if ( (options = arguments[ i ]) != null ) {
// Extend the base object
for ( name in options ) {
src = target[ name ];
copy = options[ name ];
// Prevent never-ending loop
if ( target === copy ) {
continue;
}
// Recurse if we're merging plain objects or arrays
if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
if ( copyIsArray ) {
copyIsArray = false;
clone = src && jQuery.isArray(src) ? src : [];
} else {
clone = src && jQuery.isPlainObject(src) ? src : {};
}
// Never move original objects, clone them
target[ name ] = jQuery.extend( deep, clone, copy );
// Don't bring in undefined values
} else if ( copy !== undefined ) {
target[ name ] = copy;
}
}
}
}
// Return the modified object
return target;
};
jQuery.extend({
noConflict: function( deep ) {
if ( window.$ === jQuery ) {
window.$ = _$;
}
if ( deep && window.jQuery === jQuery ) {
window.jQuery = _jQuery;
}
return jQuery;
},
// Is the DOM ready to be used? Set to true once it occurs.
isReady: false,
// A counter to track how many items to wait for before
// the ready event fires. See #6781
readyWait: 1,
// Hold (or release) the ready event
holdReady: function( hold ) {
if ( hold ) {
jQuery.readyWait++;
} else {
jQuery.ready( true );
}
},
// Handle when the DOM is ready
ready: function( wait ) {
// Either a released hold or an DOMready/load event and not yet ready
if ( (wait === true && !--jQuery.readyWait) || (wait !== true && !jQuery.isReady) ) {
// Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
if ( !document.body ) {
return setTimeout( jQuery.ready, 1 );
}
// Remember that the DOM is ready
jQuery.isReady = true;
// If a normal DOM Ready event fired, decrement, and wait if need be
if ( wait !== true && --jQuery.readyWait > 0 ) {
return;
}
// If there are functions bound, to execute
readyList.resolveWith( document, [ jQuery ] );
// Trigger any bound ready events
if ( jQuery.fn.trigger ) {
jQuery( document ).trigger( "ready" ).unbind( "ready" );
}
}
},
bindReady: function() {
if ( readyList ) {
return;
}
readyList = jQuery._Deferred();
// Catch cases where $(document).ready() is called after the
// browser event has already occurred.
if ( document.readyState === "complete" ) {
// Handle it asynchronously to allow scripts the opportunity to delay ready
return setTimeout( jQuery.ready, 1 );
}
// Mozilla, Opera and webkit nightlies currently support this event
if ( document.addEventListener ) {
// Use the handy event callback
document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false );
// A fallback to window.onload, that will always work
window.addEventListener( "load", jQuery.ready, false );
// If IE event model is used
} else if ( document.attachEvent ) {
// ensure firing before onload,
// maybe late but safe also for iframes
document.attachEvent( "onreadystatechange", DOMContentLoaded );
// A fallback to window.onload, that will always work
window.attachEvent( "onload", jQuery.ready );
// If IE and not a frame
// continually check to see if the document is ready
var toplevel = false;
try {
toplevel = window.frameElement == null;
} catch(e) {}
if ( document.documentElement.doScroll && toplevel ) {
doScrollCheck();
}
}
},
// See test/unit/core.js for details concerning isFunction.
// Since version 1.3, DOM methods and functions like alert
// aren't supported. They return false on IE (#2968).
isFunction: function( obj ) {
return jQuery.type(obj) === "function";
},
isArray: Array.isArray || function( obj ) {
return jQuery.type(obj) === "array";
},
// A crude way of determining if an object is a window
isWindow: function( obj ) {
return obj && typeof obj === "object" && "setInterval" in obj;
},
isNaN: function( obj ) {
return obj == null || !rdigit.test( obj ) || isNaN( obj );
},
type: function( obj ) {
return obj == null ?
String( obj ) :
class2type[ toString.call(obj) ] || "object";
},
isPlainObject: function( obj ) {
// Must be an Object.
// Because of IE, we also have to check the presence of the constructor property.
// Make sure that DOM nodes and window objects don't pass through, as well
if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
return false;
}
try {
// Not own constructor property must be Object
if ( obj.constructor &&
!hasOwn.call(obj, "constructor") &&
!hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
return false;
}
} catch ( e ) {
// IE8,9 Will throw exceptions on certain host objects #9897
return false;
}
// Own properties are enumerated firstly, so to speed up,
// if last one is own, then all properties are own.
var key;
for ( key in obj ) {}
return key === undefined || hasOwn.call( obj, key );
},
isEmptyObject: function( obj ) {
for ( var name in obj ) {
return false;
}
return true;
},
error: function( msg ) {
throw msg;
},
parseJSON: function( data ) {
if ( typeof data !== "string" || !data ) {
return null;
}
// Make sure leading/trailing whitespace is removed (IE can't handle it)
data = jQuery.trim( data );
// Attempt to parse using the native JSON parser first
if ( window.JSON && window.JSON.parse ) {
return window.JSON.parse( data );
}
// Make sure the incoming data is actual JSON
// Logic borrowed from http://json.org/json2.js
if ( rvalidchars.test( data.replace( rvalidescape, "@" )
.replace( rvalidtokens, "]" )
.replace( rvalidbraces, "")) ) {
return (new Function( "return " + data ))();
}
jQuery.error( "Invalid JSON: " + data );
},
// Cross-browser xml parsing
parseXML: function( data ) {
var xml, tmp;
try {
if ( window.DOMParser ) { // Standard
tmp = new DOMParser();
xml = tmp.parseFromString( data , "text/xml" );
} else { // IE
xml = new ActiveXObject( "Microsoft.XMLDOM" );
xml.async = "false";
xml.loadXML( data );
}
} catch( e ) {
xml = undefined;
}
if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) {
jQuery.error( "Invalid XML: " + data );
}
return xml;
},
noop: function() {},
// Evaluates a script in a global context
// Workarounds based on findings by Jim Driscoll
// http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
globalEval: function( data ) {
if ( data && rnotwhite.test( data ) ) {
// We use execScript on Internet Explorer
// We use an anonymous function so that context is window
// rather than jQuery in Firefox
( window.execScript || function( data ) {
window[ "eval" ].call( window, data );
} )( data );
}
},
// Convert dashed to camelCase; used by the css and data modules
// Microsoft forgot to hump their vendor prefix (#9572)
camelCase: function( string ) {
return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
},
nodeName: function( elem, name ) {
return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase();
},
// args is for internal usage only
each: function( object, callback, args ) {
var name, i = 0,
length = object.length,
isObj = length === undefined || jQuery.isFunction( object );
if ( args ) {
if ( isObj ) {
for ( name in object ) {
if ( callback.apply( object[ name ], args ) === false ) {
break;
}
}
} else {
for ( ; i < length; ) {
if ( callback.apply( object[ i++ ], args ) === false ) {
break;
}
}
}
// A special, fast, case for the most common use of each
} else {
if ( isObj ) {
for ( name in object ) {
if ( callback.call( object[ name ], name, object[ name ] ) === false ) {
break;
}
}
} else {
for ( ; i < length; ) {
if ( callback.call( object[ i ], i, object[ i++ ] ) === false ) {
break;
}
}
}
}
return object;
},
// Use native String.trim function wherever possible
trim: trim ?
function( text ) {
return text == null ?
"" :
trim.call( text );
} :
// Otherwise use our own trimming functionality
function( text ) {
return text == null ?
"" :
text.toString().replace( trimLeft, "" ).replace( trimRight, "" );
},
// results is for internal usage only
makeArray: function( array, results ) {
var ret = results || [];
if ( array != null ) {
// The window, strings (and functions) also have 'length'
// The extra typeof function check is to prevent crashes
// in Safari 2 (See: #3039)
// Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930
var type = jQuery.type( array );
if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) {
push.call( ret, array );
} else {
jQuery.merge( ret, array );
}
}
return ret;
},
inArray: function( elem, array ) {
if ( !array ) {
return -1;
}
if ( indexOf ) {
return indexOf.call( array, elem );
}
for ( var i = 0, length = array.length; i < length; i++ ) {
if ( array[ i ] === elem ) {
return i;
}
}
return -1;
},
merge: function( first, second ) {
var i = first.length,
j = 0;
if ( typeof second.length === "number" ) {
for ( var l = second.length; j < l; j++ ) {
first[ i++ ] = second[ j ];
}
} else {
while ( second[j] !== undefined ) {
first[ i++ ] = second[ j++ ];
}
}
first.length = i;
return first;
},
grep: function( elems, callback, inv ) {
var ret = [], retVal;
inv = !!inv;
// Go through the array, only saving the items
// that pass the validator function
for ( var i = 0, length = elems.length; i < length; i++ ) {
retVal = !!callback( elems[ i ], i );
if ( inv !== retVal ) {
ret.push( elems[ i ] );
}
}
return ret;
},
// arg is for internal usage only
map: function( elems, callback, arg ) {
var value, key, ret = [],
i = 0,
length = elems.length,
// jquery objects are treated as arrays
isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ;
// Go through the array, translating each of the items to their
if ( isArray ) {
for ( ; i < length; i++ ) {
value = callback( elems[ i ], i, arg );
if ( value != null ) {
ret[ ret.length ] = value;
}
}
// Go through every key on the object,
} else {
for ( key in elems ) {
value = callback( elems[ key ], key, arg );
if ( value != null ) {
ret[ ret.length ] = value;
}
}
}
// Flatten any nested arrays
return ret.concat.apply( [], ret );
},
// A global GUID counter for objects
guid: 1,
// Bind a function to a context, optionally partially applying any
// arguments.
proxy: function( fn, context ) {
if ( typeof context === "string" ) {
var tmp = fn[ context ];
context = fn;
fn = tmp;
}
// Quick check to determine if target is callable, in the spec
// this throws a TypeError, but we will just return undefined.
if ( !jQuery.isFunction( fn ) ) {
return undefined;
}
// Simulated bind
var args = slice.call( arguments, 2 ),
proxy = function() {
return fn.apply( context, args.concat( slice.call( arguments ) ) );
};
// Set the guid of unique handler to the same of original handler, so it can be removed
proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++;
return proxy;
},
// Mutifunctional method to get and set values to a collection
// The value/s can optionally be executed if it's a function
access: function( elems, key, value, exec, fn, pass ) {
var length = elems.length;
// Setting many attributes
if ( typeof key === "object" ) {
for ( var k in key ) {
jQuery.access( elems, k, key[k], exec, fn, value );
}
return elems;
}
// Setting one attribute
if ( value !== undefined ) {
// Optionally, function values get executed if exec is true
exec = !pass && exec && jQuery.isFunction(value);
for ( var i = 0; i < length; i++ ) {
fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass );
}
return elems;
}
// Getting an attribute
return length ? fn( elems[0], key ) : undefined;
},
now: function() {
return (new Date()).getTime();
},
// Use of jQuery.browser is frowned upon.
// More details: http://docs.jquery.com/Utilities/jQuery.browser
uaMatch: function( ua ) {
ua = ua.toLowerCase();
var match = rwebkit.exec( ua ) ||
ropera.exec( ua ) ||
rmsie.exec( ua ) ||
ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) ||
[];
return { browser: match[1] || "", version: match[2] || "0" };
},
sub: function() {
function jQuerySub( selector, context ) {
return new jQuerySub.fn.init( selector, context );
}
jQuery.extend( true, jQuerySub, this );
jQuerySub.superclass = this;
jQuerySub.fn = jQuerySub.prototype = this();
jQuerySub.fn.constructor = jQuerySub;
jQuerySub.sub = this.sub;
jQuerySub.fn.init = function init( selector, context ) {
if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) {
context = jQuerySub( context );
}
return jQuery.fn.init.call( this, selector, context, rootjQuerySub );
};
jQuerySub.fn.init.prototype = jQuerySub.fn;
var rootjQuerySub = jQuerySub(document);
return jQuerySub;
},
browser: {}
});
// Populate the class2type map
jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) {
class2type[ "[object " + name + "]" ] = name.toLowerCase();
});
browserMatch = jQuery.uaMatch( userAgent );
if ( browserMatch.browser ) {
jQuery.browser[ browserMatch.browser ] = true;
jQuery.browser.version = browserMatch.version;
}
// Deprecated, use jQuery.browser.webkit instead
if ( jQuery.browser.webkit ) {
jQuery.browser.safari = true;
}
// IE doesn't match non-breaking spaces with \s
if ( rnotwhite.test( "\xA0" ) ) {
trimLeft = /^[\s\xA0]+/;
trimRight = /[\s\xA0]+$/;
}
// All jQuery objects should point back to these
rootjQuery = jQuery(document);
// Cleanup functions for the document ready method
if ( document.addEventListener ) {
DOMContentLoaded = function() {
document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false );
jQuery.ready();
};
} else if ( document.attachEvent ) {
DOMContentLoaded = function() {
// Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
if ( document.readyState === "complete" ) {
document.detachEvent( "onreadystatechange", DOMContentLoaded );
jQuery.ready();
}
};
}
// The DOM ready check for Internet Explorer
function doScrollCheck() {
if ( jQuery.isReady ) {
return;
}
try {
// If IE is used, use the trick by Diego Perini
// http://javascript.nwbox.com/IEContentLoaded/
document.documentElement.doScroll("left");
} catch(e) {
setTimeout( doScrollCheck, 1 );
return;
}
// and execute any waiting functions
jQuery.ready();
}
return jQuery;
})();
var // Promise methods
promiseMethods = "done fail isResolved isRejected promise then always pipe".split( " " ),
// Static reference to slice
sliceDeferred = [].slice;
jQuery.extend({
// Create a simple deferred (one callbacks list)
_Deferred: function() {
var // callbacks list
callbacks = [],
// stored [ context , args ]
fired,
// to avoid firing when already doing so
firing,
// flag to know if the deferred has been cancelled
cancelled,
// the deferred itself
deferred = {
// done( f1, f2, ...)
done: function() {
if ( !cancelled ) {
var args = arguments,
i,
length,
elem,
type,
_fired;
if ( fired ) {
_fired = fired;
fired = 0;
}
for ( i = 0, length = args.length; i < length; i++ ) {
elem = args[ i ];
type = jQuery.type( elem );
if ( type === "array" ) {
deferred.done.apply( deferred, elem );
} else if ( type === "function" ) {
callbacks.push( elem );
}
}
if ( _fired ) {
deferred.resolveWith( _fired[ 0 ], _fired[ 1 ] );
}
}
return this;
},
// resolve with given context and args
resolveWith: function( context, args ) {
if ( !cancelled && !fired && !firing ) {
// make sure args are available (#8421)
args = args || [];
firing = 1;
try {
while( callbacks[ 0 ] ) {
callbacks.shift().apply( context, args );
}
}
finally {
fired = [ context, args ];
firing = 0;
}
}
return this;
},
// resolve with this as context and given arguments
resolve: function() {
deferred.resolveWith( this, arguments );
return this;
},
// Has this deferred been resolved?
isResolved: function() {
return !!( firing || fired );
},
// Cancel
cancel: function() {
cancelled = 1;
callbacks = [];
return this;
}
};
return deferred;
},
// Full fledged deferred (two callbacks list)
Deferred: function( func ) {
var deferred = jQuery._Deferred(),
failDeferred = jQuery._Deferred(),
promise;
// Add errorDeferred methods, then and promise
jQuery.extend( deferred, {
then: function( doneCallbacks, failCallbacks ) {
deferred.done( doneCallbacks ).fail( failCallbacks );
return this;
},
always: function() {
return deferred.done.apply( deferred, arguments ).fail.apply( this, arguments );
},
fail: failDeferred.done,
rejectWith: failDeferred.resolveWith,
reject: failDeferred.resolve,
isRejected: failDeferred.isResolved,
pipe: function( fnDone, fnFail ) {
return jQuery.Deferred(function( newDefer ) {
jQuery.each( {
done: [ fnDone, "resolve" ],
fail: [ fnFail, "reject" ]
}, function( handler, data ) {
var fn = data[ 0 ],
action = data[ 1 ],
returned;
if ( jQuery.isFunction( fn ) ) {
deferred[ handler ](function() {
returned = fn.apply( this, arguments );
if ( returned && jQuery.isFunction( returned.promise ) ) {
returned.promise().then( newDefer.resolve, newDefer.reject );
} else {
newDefer[ action + "With" ]( this === deferred ? newDefer : this, [ returned ] );
}
});
} else {
deferred[ handler ]( newDefer[ action ] );
}
});
}).promise();
},
// Get a promise for this deferred
// If obj is provided, the promise aspect is added to the object
promise: function( obj ) {
if ( obj == null ) {
if ( promise ) {
return promise;
}
promise = obj = {};
}
var i = promiseMethods.length;
while( i-- ) {
obj[ promiseMethods[i] ] = deferred[ promiseMethods[i] ];
}
return obj;
}
});
// Make sure only one callback list will be used
deferred.done( failDeferred.cancel ).fail( deferred.cancel );
// Unexpose cancel
delete deferred.cancel;
// Call given func if any
if ( func ) {
func.call( deferred, deferred );
}
return deferred;
},
// Deferred helper
when: function( firstParam ) {
var args = arguments,
i = 0,
length = args.length,
count = length,
deferred = length <= 1 && firstParam && jQuery.isFunction( firstParam.promise ) ?
firstParam :
jQuery.Deferred();
function resolveFunc( i ) {
return function( value ) {
args[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value;
if ( !( --count ) ) {
// Strange bug in FF4:
// Values changed onto the arguments object sometimes end up as undefined values
// outside the $.when method. Cloning the object into a fresh array solves the issue
deferred.resolveWith( deferred, sliceDeferred.call( args, 0 ) );
}
};
}
if ( length > 1 ) {
for( ; i < length; i++ ) {
if ( args[ i ] && jQuery.isFunction( args[ i ].promise ) ) {
args[ i ].promise().then( resolveFunc(i), deferred.reject );
} else {
--count;
}
}
if ( !count ) {
deferred.resolveWith( deferred, args );
}
} else if ( deferred !== firstParam ) {
deferred.resolveWith( deferred, length ? [ firstParam ] : [] );
}
return deferred.promise();
}
});
jQuery.support = (function() {
var div = document.createElement( "div" ),
documentElement = document.documentElement,
all,
a,
select,
opt,
input,
marginDiv,
support,
fragment,
body,
testElementParent,
testElement,
testElementStyle,
tds,
events,
eventName,
i,
isSupported;
// Preliminary tests
div.setAttribute("className", "t");
div.innerHTML = " <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>";
all = div.getElementsByTagName( "*" );
a = div.getElementsByTagName( "a" )[ 0 ];
// Can't get basic test support
if ( !all || !all.length || !a ) {
return {};
}
// First batch of supports tests
select = document.createElement( "select" );
opt = select.appendChild( document.createElement("option") );
input = div.getElementsByTagName( "input" )[ 0 ];
support = {
// IE strips leading whitespace when .innerHTML is used
leadingWhitespace: ( div.firstChild.nodeType === 3 ),
// Make sure that tbody elements aren't automatically inserted
// IE will insert them into empty tables
tbody: !div.getElementsByTagName( "tbody" ).length,
// Make sure that link elements get serialized correctly by innerHTML
// This requires a wrapper element in IE
htmlSerialize: !!div.getElementsByTagName( "link" ).length,
// Get the style information from getAttribute
// (IE uses .cssText instead)
style: /top/.test( a.getAttribute("style") ),
// Make sure that URLs aren't manipulated
// (IE normalizes it by default)
hrefNormalized: ( a.getAttribute( "href" ) === "/a" ),
// Make sure that element opacity exists
// (IE uses filter instead)
// Use a regex to work around a WebKit issue. See #5145
opacity: /^0.55$/.test( a.style.opacity ),
// Verify style float existence
// (IE uses styleFloat instead of cssFloat)
cssFloat: !!a.style.cssFloat,
// Make sure that if no value is specified for a checkbox
// that it defaults to "on".
// (WebKit defaults to "" instead)
checkOn: ( input.value === "on" ),
// Make sure that a selected-by-default option has a working selected property.
// (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
optSelected: opt.selected,
// Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
getSetAttribute: div.className !== "t",
// Will be defined later
submitBubbles: true,
changeBubbles: true,
focusinBubbles: false,
deleteExpando: true,
noCloneEvent: true,
inlineBlockNeedsLayout: false,
shrinkWrapBlocks: false,
reliableMarginRight: true
};
// Make sure checked status is properly cloned
input.checked = true;
support.noCloneChecked = input.cloneNode( true ).checked;
// Make sure that the options inside disabled selects aren't marked as disabled
// (WebKit marks them as disabled)
select.disabled = true;
support.optDisabled = !opt.disabled;
// Test to see if it's possible to delete an expando from an element
// Fails in Internet Explorer
try {
delete div.test;
} catch( e ) {
support.deleteExpando = false;
}
if ( !div.addEventListener && div.attachEvent && div.fireEvent ) {
div.attachEvent( "onclick", function() {
// Cloning a node shouldn't copy over any
// bound event handlers (IE does this)
support.noCloneEvent = false;
});
div.cloneNode( true ).fireEvent( "onclick" );
}
// Check if a radio maintains it's value
// after being appended to the DOM
input = document.createElement("input");
input.value = "t";
input.setAttribute("type", "radio");
support.radioValue = input.value === "t";
input.setAttribute("checked", "checked");
div.appendChild( input );
fragment = document.createDocumentFragment();
fragment.appendChild( div.firstChild );
// WebKit doesn't clone checked state correctly in fragments
support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;
div.innerHTML = "";
// Figure out if the W3C box model works as expected
div.style.width = div.style.paddingLeft = "1px";
body = document.getElementsByTagName( "body" )[ 0 ];
// We use our own, invisible, body unless the body is already present
// in which case we use a div (#9239)
testElement = document.createElement( body ? "div" : "body" );
testElementStyle = {
visibility: "hidden",
width: 0,
height: 0,
border: 0,
margin: 0,
background: "none"
};
if ( body ) {
jQuery.extend( testElementStyle, {
position: "absolute",
left: "-1000px",
top: "-1000px"
});
}
for ( i in testElementStyle ) {
testElement.style[ i ] = testElementStyle[ i ];
}
testElement.appendChild( div );
testElementParent = body || documentElement;
testElementParent.insertBefore( testElement, testElementParent.firstChild );
// Check if a disconnected checkbox will retain its checked
// value of true after appended to the DOM (IE6/7)
support.appendChecked = input.checked;
support.boxModel = div.offsetWidth === 2;
if ( "zoom" in div.style ) {
// Check if natively block-level elements act like inline-block
// elements when setting their display to 'inline' and giving
// them layout
// (IE < 8 does this)
div.style.display = "inline";
div.style.zoom = 1;
support.inlineBlockNeedsLayout = ( div.offsetWidth === 2 );
// Check if elements with layout shrink-wrap their children
// (IE 6 does this)
div.style.display = "";
div.innerHTML = "<div style='width:4px;'></div>";
support.shrinkWrapBlocks = ( div.offsetWidth !== 2 );
}
div.innerHTML = "<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>";
tds = div.getElementsByTagName( "td" );
// Check if table cells still have offsetWidth/Height when they are set
// to display:none and there are still other visible table cells in a
// table row; if so, offsetWidth/Height are not reliable for use when
// determining if an element has been hidden directly using
// display:none (it is still safe to use offsets if a parent element is
// hidden; don safety goggles and see bug #4512 for more information).
// (only IE 8 fails this test)
isSupported = ( tds[ 0 ].offsetHeight === 0 );
tds[ 0 ].style.display = "";
tds[ 1 ].style.display = "none";
// Check if empty table cells still have offsetWidth/Height
// (IE < 8 fail this test)
support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 );
div.innerHTML = "";
// Check if div with explicit width and no margin-right incorrectly
// gets computed margin-right based on width of container. For more
// info see bug #3333
// Fails in WebKit before Feb 2011 nightlies
// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
if ( document.defaultView && document.defaultView.getComputedStyle ) {
marginDiv = document.createElement( "div" );
marginDiv.style.width = "0";
marginDiv.style.marginRight = "0";
div.appendChild( marginDiv );
support.reliableMarginRight =
( parseInt( ( document.defaultView.getComputedStyle( marginDiv, null ) || { marginRight: 0 } ).marginRight, 10 ) || 0 ) === 0;
}
// Remove the body element we added
testElement.innerHTML = "";
testElementParent.removeChild( testElement );
// Technique from Juriy Zaytsev
// http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/
// We only care about the case where non-standard event systems
// are used, namely in IE. Short-circuiting here helps us to
// avoid an eval call (in setAttribute) which can cause CSP
// to go haywire. See: https://developer.mozilla.org/en/Security/CSP
if ( div.attachEvent ) {
for( i in {
submit: 1,
change: 1,
focusin: 1
} ) {
eventName = "on" + i;
isSupported = ( eventName in div );
if ( !isSupported ) {
div.setAttribute( eventName, "return;" );
isSupported = ( typeof div[ eventName ] === "function" );
}
support[ i + "Bubbles" ] = isSupported;
}
}
// Null connected elements to avoid leaks in IE
testElement = fragment = select = opt = body = marginDiv = div = input = null;
return support;
})();
// Keep track of boxModel
jQuery.boxModel = jQuery.support.boxModel;
var rbrace = /^(?:\{.*\}|\[.*\])$/,
rmultiDash = /([A-Z])/g;
jQuery.extend({
cache: {},
// Please use with caution
uuid: 0,
// Unique for each copy of jQuery on the page
// Non-digits removed to match rinlinejQuery
expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ),
// The following elements throw uncatchable exceptions if you
// attempt to add expando properties to them.
noData: {
"embed": true,
// Ban all objects except for Flash (which handle expandos)
"object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
"applet": true
},
hasData: function( elem ) {
elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ];
return !!elem && !isEmptyDataObject( elem );
},
data: function( elem, name, data, pvt /* Internal Use Only */ ) {
if ( !jQuery.acceptData( elem ) ) {
return;
}
var thisCache, ret,
internalKey = jQuery.expando,
getByName = typeof name === "string",
// We have to handle DOM nodes and JS objects differently because IE6-7
// can't GC object references properly across the DOM-JS boundary
isNode = elem.nodeType,
// Only DOM nodes need the global jQuery cache; JS object data is
// attached directly to the object so GC can occur automatically
cache = isNode ? jQuery.cache : elem,
// Only defining an ID for JS objects if its cache already exists allows
// the code to shortcut on the same path as a DOM node with no cache
id = isNode ? elem[ jQuery.expando ] : elem[ jQuery.expando ] && jQuery.expando;
// Avoid doing any more work than we need to when trying to get data on an
// object that has no data at all
if ( (!id || (pvt && id && (cache[ id ] && !cache[ id ][ internalKey ]))) && getByName && data === undefined ) {
return;
}
if ( !id ) {
// Only DOM nodes need a new unique ID for each element since their data
// ends up in the global cache
if ( isNode ) {
elem[ jQuery.expando ] = id = ++jQuery.uuid;
} else {
id = jQuery.expando;
}
}
if ( !cache[ id ] ) {
cache[ id ] = {};
// TODO: This is a hack for 1.5 ONLY. Avoids exposing jQuery
// metadata on plain JS objects when the object is serialized using
// JSON.stringify
if ( !isNode ) {
cache[ id ].toJSON = jQuery.noop;
}
}
// An object can be passed to jQuery.data instead of a key/value pair; this gets
// shallow copied over onto the existing cache
if ( typeof name === "object" || typeof name === "function" ) {
if ( pvt ) {
cache[ id ][ internalKey ] = jQuery.extend(cache[ id ][ internalKey ], name);
} else {
cache[ id ] = jQuery.extend(cache[ id ], name);
}
}
thisCache = cache[ id ];
// Internal jQuery data is stored in a separate object inside the object's data
// cache in order to avoid key collisions between internal data and user-defined
// data
if ( pvt ) {
if ( !thisCache[ internalKey ] ) {
thisCache[ internalKey ] = {};
}
thisCache = thisCache[ internalKey ];
}
if ( data !== undefined ) {
thisCache[ jQuery.camelCase( name ) ] = data;
}
// TODO: This is a hack for 1.5 ONLY. It will be removed in 1.6. Users should
// not attempt to inspect the internal events object using jQuery.data, as this
// internal data object is undocumented and subject to change.
if ( name === "events" && !thisCache[name] ) {
return thisCache[ internalKey ] && thisCache[ internalKey ].events;
}
// Check for both converted-to-camel and non-converted data property names
// If a data property was specified
if ( getByName ) {
// First Try to find as-is property data
ret = thisCache[ name ];
// Test for null|undefined property data
if ( ret == null ) {
// Try to find the camelCased property
ret = thisCache[ jQuery.camelCase( name ) ];
}
} else {
ret = thisCache;
}
return ret;
},
removeData: function( elem, name, pvt /* Internal Use Only */ ) {
if ( !jQuery.acceptData( elem ) ) {
return;
}
var thisCache,
// Reference to internal data cache key
internalKey = jQuery.expando,
isNode = elem.nodeType,
// See jQuery.data for more information
cache = isNode ? jQuery.cache : elem,
// See jQuery.data for more information
id = isNode ? elem[ jQuery.expando ] : jQuery.expando;
// If there is already no cache entry for this object, there is no
// purpose in continuing
if ( !cache[ id ] ) {
return;
}
if ( name ) {
thisCache = pvt ? cache[ id ][ internalKey ] : cache[ id ];
if ( thisCache ) {
// Support interoperable removal of hyphenated or camelcased keys
if ( !thisCache[ name ] ) {
name = jQuery.camelCase( name );
}
delete thisCache[ name ];
// If there is no data left in the cache, we want to continue
// and let the cache object itself get destroyed
if ( !isEmptyDataObject(thisCache) ) {
return;
}
}
}
// See jQuery.data for more information
if ( pvt ) {
delete cache[ id ][ internalKey ];
// Don't destroy the parent cache unless the internal data object
// had been the only thing left in it
if ( !isEmptyDataObject(cache[ id ]) ) {
return;
}
}
var internalCache = cache[ id ][ internalKey ];
// Browsers that fail expando deletion also refuse to delete expandos on
// the window, but it will allow it on all other JS objects; other browsers
// don't care
// Ensure that `cache` is not a window object #10080
if ( jQuery.support.deleteExpando || !cache.setInterval ) {
delete cache[ id ];
} else {
cache[ id ] = null;
}
// We destroyed the entire user cache at once because it's faster than
// iterating through each key, but we need to continue to persist internal
// data if it existed
if ( internalCache ) {
cache[ id ] = {};
// TODO: This is a hack for 1.5 ONLY. Avoids exposing jQuery
// metadata on plain JS objects when the object is serialized using
// JSON.stringify
if ( !isNode ) {
cache[ id ].toJSON = jQuery.noop;
}
cache[ id ][ internalKey ] = internalCache;
// Otherwise, we need to eliminate the expando on the node to avoid
// false lookups in the cache for entries that no longer exist
} else if ( isNode ) {
// IE does not allow us to delete expando properties from nodes,
// nor does it have a removeAttribute function on Document nodes;
// we must handle all of these cases
if ( jQuery.support.deleteExpando ) {
delete elem[ jQuery.expando ];
} else if ( elem.removeAttribute ) {
elem.removeAttribute( jQuery.expando );
} else {
elem[ jQuery.expando ] = null;
}
}
},
// For internal use only.
_data: function( elem, name, data ) {
return jQuery.data( elem, name, data, true );
},
// A method for determining if a DOM node can handle the data expando
acceptData: function( elem ) {
if ( elem.nodeName ) {
var match = jQuery.noData[ elem.nodeName.toLowerCase() ];
if ( match ) {
return !(match === true || elem.getAttribute("classid") !== match);
}
}
return true;
}
});
jQuery.fn.extend({
data: function( key, value ) {
var data = null;
if ( typeof key === "undefined" ) {
if ( this.length ) {
data = jQuery.data( this[0] );
if ( this[0].nodeType === 1 ) {
var attr = this[0].attributes, name;
for ( var i = 0, l = attr.length; i < l; i++ ) {
name = attr[i].name;
if ( name.indexOf( "data-" ) === 0 ) {
name = jQuery.camelCase( name.substring(5) );
dataAttr( this[0], name, data[ name ] );
}
}
}
}
return data;
} else if ( typeof key === "object" ) {
return this.each(function() {
jQuery.data( this, key );
});
}
var parts = key.split(".");
parts[1] = parts[1] ? "." + parts[1] : "";
if ( value === undefined ) {
data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);
// Try to fetch any internally stored data first
if ( data === undefined && this.length ) {
data = jQuery.data( this[0], key );
data = dataAttr( this[0], key, data );
}
return data === undefined && parts[1] ?
this.data( parts[0] ) :
data;
} else {
return this.each(function() {
var $this = jQuery( this ),
args = [ parts[0], value ];
$this.triggerHandler( "setData" + parts[1] + "!", args );
jQuery.data( this, key, value );
$this.triggerHandler( "changeData" + parts[1] + "!", args );
});
}
},
removeData: function( key ) {
return this.each(function() {
jQuery.removeData( this, key );
});
}
});
function dataAttr( elem, key, data ) {
// If nothing was found internally, try to fetch any
// data from the HTML5 data-* attribute
if ( data === undefined && elem.nodeType === 1 ) {
var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();
data = elem.getAttribute( name );
if ( typeof data === "string" ) {
try {
data = data === "true" ? true :
data === "false" ? false :
data === "null" ? null :
!jQuery.isNaN( data ) ? parseFloat( data ) :
rbrace.test( data ) ? jQuery.parseJSON( data ) :
data;
} catch( e ) {}
// Make sure we set the data so it isn't changed later
jQuery.data( elem, key, data );
} else {
data = undefined;
}
}
return data;
}
// TODO: This is a hack for 1.5 ONLY to allow objects with a single toJSON
// property to be considered empty objects; this property always exists in
// order to make sure JSON.stringify does not expose internal metadata
function isEmptyDataObject( obj ) {
for ( var name in obj ) {
if ( name !== "toJSON" ) {
return false;
}
}
return true;
}
function handleQueueMarkDefer( elem, type, src ) {
var deferDataKey = type + "defer",
queueDataKey = type + "queue",
markDataKey = type + "mark",
defer = jQuery.data( elem, deferDataKey, undefined, true );
if ( defer &&
( src === "queue" || !jQuery.data( elem, queueDataKey, undefined, true ) ) &&
( src === "mark" || !jQuery.data( elem, markDataKey, undefined, true ) ) ) {
// Give room for hard-coded callbacks to fire first
// and eventually mark/queue something else on the element
setTimeout( function() {
if ( !jQuery.data( elem, queueDataKey, undefined, true ) &&
!jQuery.data( elem, markDataKey, undefined, true ) ) {
jQuery.removeData( elem, deferDataKey, true );
defer.resolve();
}
}, 0 );
}
}
jQuery.extend({
_mark: function( elem, type ) {
if ( elem ) {
type = (type || "fx") + "mark";
jQuery.data( elem, type, (jQuery.data(elem,type,undefined,true) || 0) + 1, true );
}
},
_unmark: function( force, elem, type ) {
if ( force !== true ) {
type = elem;
elem = force;
force = false;
}
if ( elem ) {
type = type || "fx";
var key = type + "mark",
count = force ? 0 : ( (jQuery.data( elem, key, undefined, true) || 1 ) - 1 );
if ( count ) {
jQuery.data( elem, key, count, true );
} else {
jQuery.removeData( elem, key, true );
handleQueueMarkDefer( elem, type, "mark" );
}
}
},
queue: function( elem, type, data ) {
if ( elem ) {
type = (type || "fx") + "queue";
var q = jQuery.data( elem, type, undefined, true );
// Speed up dequeue by getting out quickly if this is just a lookup
if ( data ) {
if ( !q || jQuery.isArray(data) ) {
q = jQuery.data( elem, type, jQuery.makeArray(data), true );
} else {
q.push( data );
}
}
return q || [];
}
},
dequeue: function( elem, type ) {
type = type || "fx";
var queue = jQuery.queue( elem, type ),
fn = queue.shift(),
defer;
// If the fx queue is dequeued, always remove the progress sentinel
if ( fn === "inprogress" ) {
fn = queue.shift();
}
if ( fn ) {
// Add a progress sentinel to prevent the fx queue from being
// automatically dequeued
if ( type === "fx" ) {
queue.unshift("inprogress");
}
fn.call(elem, function() {
jQuery.dequeue(elem, type);
});
}
if ( !queue.length ) {
jQuery.removeData( elem, type + "queue", true );
handleQueueMarkDefer( elem, type, "queue" );
}
}
});
jQuery.fn.extend({
queue: function( type, data ) {
if ( typeof type !== "string" ) {
data = type;
type = "fx";
}
if ( data === undefined ) {
return jQuery.queue( this[0], type );
}
return this.each(function() {
var queue = jQuery.queue( this, type, data );
if ( type === "fx" && queue[0] !== "inprogress" ) {
jQuery.dequeue( this, type );
}
});
},
dequeue: function( type ) {
return this.each(function() {
jQuery.dequeue( this, type );
});
},
// Based off of the plugin by Clint Helfers, with permission.
// http://blindsignals.com/index.php/2009/07/jquery-delay/
delay: function( time, type ) {
time = jQuery.fx ? jQuery.fx.speeds[time] || time : time;
type = type || "fx";
return this.queue( type, function() {
var elem = this;
setTimeout(function() {
jQuery.dequeue( elem, type );
}, time );
});
},
clearQueue: function( type ) {
return this.queue( type || "fx", [] );
},
// Get a promise resolved when queues of a certain type
// are emptied (fx is the type by default)
promise: function( type, object ) {
if ( typeof type !== "string" ) {
object = type;
type = undefined;
}
type = type || "fx";
var defer = jQuery.Deferred(),
elements = this,
i = elements.length,
count = 1,
deferDataKey = type + "defer",
queueDataKey = type + "queue",
markDataKey = type + "mark",
tmp;
function resolve() {
if ( !( --count ) ) {
defer.resolveWith( elements, [ elements ] );
}
}
while( i-- ) {
if (( tmp = jQuery.data( elements[ i ], deferDataKey, undefined, true ) ||
( jQuery.data( elements[ i ], queueDataKey, undefined, true ) ||
jQuery.data( elements[ i ], markDataKey, undefined, true ) ) &&
jQuery.data( elements[ i ], deferDataKey, jQuery._Deferred(), true ) )) {
count++;
tmp.done( resolve );
}
}
resolve();
return defer.promise();
}
});
var rclass = /[\n\t\r]/g,
rspace = /\s+/,
rreturn = /\r/g,
rtype = /^(?:button|input)$/i,
rfocusable = /^(?:button|input|object|select|textarea)$/i,
rclickable = /^a(?:rea)?$/i,
rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,
nodeHook, boolHook;
jQuery.fn.extend({
attr: function( name, value ) {
return jQuery.access( this, name, value, true, jQuery.attr );
},
removeAttr: function( name ) {
return this.each(function() {
jQuery.removeAttr( this, name );
});
},
prop: function( name, value ) {
return jQuery.access( this, name, value, true, jQuery.prop );
},
removeProp: function( name ) {
name = jQuery.propFix[ name ] || name;
return this.each(function() {
// try/catch handles cases where IE balks (such as removing a property on window)
try {
this[ name ] = undefined;
delete this[ name ];
} catch( e ) {}
});
},
addClass: function( value ) {
var classNames, i, l, elem,
setClass, c, cl;
if ( jQuery.isFunction( value ) ) {
return this.each(function( j ) {
jQuery( this ).addClass( value.call(this, j, this.className) );
});
}
if ( value && typeof value === "string" ) {
classNames = value.split( rspace );
for ( i = 0, l = this.length; i < l; i++ ) {
elem = this[ i ];
if ( elem.nodeType === 1 ) {
if ( !elem.className && classNames.length === 1 ) {
elem.className = value;
} else {
setClass = " " + elem.className + " ";
for ( c = 0, cl = classNames.length; c < cl; c++ ) {
if ( !~setClass.indexOf( " " + classNames[ c ] + " " ) ) {
setClass += classNames[ c ] + " ";
}
}
elem.className = jQuery.trim( setClass );
}
}
}
}
return this;
},
removeClass: function( value ) {
var classNames, i, l, elem, className, c, cl;
if ( jQuery.isFunction( value ) ) {
return this.each(function( j ) {
jQuery( this ).removeClass( value.call(this, j, this.className) );
});
}
if ( (value && typeof value === "string") || value === undefined ) {
classNames = (value || "").split( rspace );
for ( i = 0, l = this.length; i < l; i++ ) {
elem = this[ i ];
if ( elem.nodeType === 1 && elem.className ) {
if ( value ) {
className = (" " + elem.className + " ").replace( rclass, " " );
for ( c = 0, cl = classNames.length; c < cl; c++ ) {
className = className.replace(" " + classNames[ c ] + " ", " ");
}
elem.className = jQuery.trim( className );
} else {
elem.className = "";
}
}
}
}
return this;
},
toggleClass: function( value, stateVal ) {
var type = typeof value,
isBool = typeof stateVal === "boolean";
if ( jQuery.isFunction( value ) ) {
return this.each(function( i ) {
jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );
});
}
return this.each(function() {
if ( type === "string" ) {
// toggle individual class names
var className,
i = 0,
self = jQuery( this ),
state = stateVal,
classNames = value.split( rspace );
while ( (className = classNames[ i++ ]) ) {
// check each className given, space seperated list
state = isBool ? state : !self.hasClass( className );
self[ state ? "addClass" : "removeClass" ]( className );
}
} else if ( type === "undefined" || type === "boolean" ) {
if ( this.className ) {
// store className if set
jQuery._data( this, "__className__", this.className );
}
// toggle whole className
this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || "";
}
});
},
hasClass: function( selector ) {
var className = " " + selector + " ";
for ( var i = 0, l = this.length; i < l; i++ ) {
if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) {
return true;
}
}
return false;
},
val: function( value ) {
var hooks, ret,
elem = this[0];
if ( !arguments.length ) {
if ( elem ) {
hooks = jQuery.valHooks[ elem.nodeName.toLowerCase() ] || jQuery.valHooks[ elem.type ];
if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {
return ret;
}
ret = elem.value;
return typeof ret === "string" ?
// handle most common string cases
ret.replace(rreturn, "") :
// handle cases where value is null/undef or number
ret == null ? "" : ret;
}
return undefined;
}
var isFunction = jQuery.isFunction( value );
return this.each(function( i ) {
var self = jQuery(this), val;
if ( this.nodeType !== 1 ) {
return;
}
if ( isFunction ) {
val = value.call( this, i, self.val() );
} else {
val = value;
}
// Treat null/undefined as ""; convert numbers to string
if ( val == null ) {
val = "";
} else if ( typeof val === "number" ) {
val += "";
} else if ( jQuery.isArray( val ) ) {
val = jQuery.map(val, function ( value ) {
return value == null ? "" : value + "";
});
}
hooks = jQuery.valHooks[ this.nodeName.toLowerCase() ] || jQuery.valHooks[ this.type ];
// If set returns undefined, fall back to normal setting
if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {
this.value = val;
}
});
}
});
jQuery.extend({
valHooks: {
option: {
get: function( elem ) {
// attributes.value is undefined in Blackberry 4.7 but
// uses .value. See #6932
var val = elem.attributes.value;
return !val || val.specified ? elem.value : elem.text;
}
},
select: {
get: function( elem ) {
var value,
index = elem.selectedIndex,
values = [],
options = elem.options,
one = elem.type === "select-one";
// Nothing was selected
if ( index < 0 ) {
return null;
}
// Loop through all the selected options
for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) {
var option = options[ i ];
// Don't return options that are disabled or in a disabled optgroup
if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) &&
(!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) {
// Get the specific value for the option
value = jQuery( option ).val();
// We don't need an array for one selects
if ( one ) {
return value;
}
// Multi-Selects return an array
values.push( value );
}
}
// Fixes Bug #2551 -- select.val() broken in IE after form.reset()
if ( one && !values.length && options.length ) {
return jQuery( options[ index ] ).val();
}
return values;
},
set: function( elem, value ) {
var values = jQuery.makeArray( value );
jQuery(elem).find("option").each(function() {
this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0;
});
if ( !values.length ) {
elem.selectedIndex = -1;
}
return values;
}
}
},
attrFn: {
val: true,
css: true,
html: true,
text: true,
data: true,
width: true,
height: true,
offset: true
},
attrFix: {
// Always normalize to ensure hook usage
tabindex: "tabIndex"
},
attr: function( elem, name, value, pass ) {
var nType = elem.nodeType;
// don't get/set attributes on text, comment and attribute nodes
if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
return undefined;
}
if ( pass && name in jQuery.attrFn ) {
return jQuery( elem )[ name ]( value );
}
// Fallback to prop when attributes are not supported
if ( !("getAttribute" in elem) ) {
return jQuery.prop( elem, name, value );
}
var ret, hooks,
notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
// Normalize the name if needed
if ( notxml ) {
name = jQuery.attrFix[ name ] || name;
hooks = jQuery.attrHooks[ name ];
if ( !hooks ) {
// Use boolHook for boolean attributes
if ( rboolean.test( name ) ) {
hooks = boolHook;
// Use nodeHook if available( IE6/7 )
} else if ( nodeHook ) {
hooks = nodeHook;
}
}
}
if ( value !== undefined ) {
if ( value === null ) {
jQuery.removeAttr( elem, name );
return undefined;
} else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) {
return ret;
} else {
elem.setAttribute( name, "" + value );
return value;
}
} else if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) {
return ret;
} else {
ret = elem.getAttribute( name );
// Non-existent attributes return null, we normalize to undefined
return ret === null ?
undefined :
ret;
}
},
removeAttr: function( elem, name ) {
var propName;
if ( elem.nodeType === 1 ) {
name = jQuery.attrFix[ name ] || name;
jQuery.attr( elem, name, "" );
elem.removeAttribute( name );
// Set corresponding property to false for boolean attributes
if ( rboolean.test( name ) && (propName = jQuery.propFix[ name ] || name) in elem ) {
elem[ propName ] = false;
}
}
},
attrHooks: {
type: {
set: function( elem, value ) {
// We can't allow the type property to be changed (since it causes problems in IE)
if ( rtype.test( elem.nodeName ) && elem.parentNode ) {
jQuery.error( "type property can't be changed" );
} else if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) {
// Setting the type on a radio button after the value resets the value in IE6-9
// Reset value to it's default in case type is set after value
// This is for element creation
var val = elem.value;
elem.setAttribute( "type", value );
if ( val ) {
elem.value = val;
}
return value;
}
}
},
// Use the value property for back compat
// Use the nodeHook for button elements in IE6/7 (#1954)
value: {
get: function( elem, name ) {
if ( nodeHook && jQuery.nodeName( elem, "button" ) ) {
return nodeHook.get( elem, name );
}
return name in elem ?
elem.value :
null;
},
set: function( elem, value, name ) {
if ( nodeHook && jQuery.nodeName( elem, "button" ) ) {
return nodeHook.set( elem, value, name );
}
// Does not return so that setAttribute is also used
elem.value = value;
}
}
},
propFix: {
tabindex: "tabIndex",
readonly: "readOnly",
"for": "htmlFor",
"class": "className",
maxlength: "maxLength",
cellspacing: "cellSpacing",
cellpadding: "cellPadding",
rowspan: "rowSpan",
colspan: "colSpan",
usemap: "useMap",
frameborder: "frameBorder",
contenteditable: "contentEditable"
},
prop: function( elem, name, value ) {
var nType = elem.nodeType;
// don't get/set properties on text, comment and attribute nodes
if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
return undefined;
}
var ret, hooks,
notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
if ( notxml ) {
// Fix name and attach hooks
name = jQuery.propFix[ name ] || name;
hooks = jQuery.propHooks[ name ];
}
if ( value !== undefined ) {
if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
return ret;
} else {
return (elem[ name ] = value);
}
} else {
if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
return ret;
} else {
return elem[ name ];
}
}
},
propHooks: {
tabIndex: {
get: function( elem ) {
// elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
// http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
var attributeNode = elem.getAttributeNode("tabindex");
return attributeNode && attributeNode.specified ?
parseInt( attributeNode.value, 10 ) :
rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
0 :
undefined;
}
}
}
});
// Add the tabindex propHook to attrHooks for back-compat
jQuery.attrHooks.tabIndex = jQuery.propHooks.tabIndex;
// Hook for boolean attributes
boolHook = {
get: function( elem, name ) {
// Align boolean attributes with corresponding properties
// Fall back to attribute presence where some booleans are not supported
var attrNode;
return jQuery.prop( elem, name ) === true || ( attrNode = elem.getAttributeNode( name ) ) && attrNode.nodeValue !== false ?
name.toLowerCase() :
undefined;
},
set: function( elem, value, name ) {
var propName;
if ( value === false ) {
// Remove boolean attributes when set to false
jQuery.removeAttr( elem, name );
} else {
// value is true since we know at this point it's type boolean and not false
// Set boolean attributes to the same name and set the DOM property
propName = jQuery.propFix[ name ] || name;
if ( propName in elem ) {
// Only set the IDL specifically if it already exists on the element
elem[ propName ] = true;
}
elem.setAttribute( name, name.toLowerCase() );
}
return name;
}
};
// IE6/7 do not support getting/setting some attributes with get/setAttribute
if ( !jQuery.support.getSetAttribute ) {
// Use this for any attribute in IE6/7
// This fixes almost every IE6/7 issue
nodeHook = jQuery.valHooks.button = {
get: function( elem, name ) {
var ret;
ret = elem.getAttributeNode( name );
// Return undefined if nodeValue is empty string
return ret && ret.nodeValue !== "" ?
ret.nodeValue :
undefined;
},
set: function( elem, value, name ) {
// Set the existing or create a new attribute node
var ret = elem.getAttributeNode( name );
if ( !ret ) {
ret = document.createAttribute( name );
elem.setAttributeNode( ret );
}
return (ret.nodeValue = value + "");
}
};
// Set width and height to auto instead of 0 on empty string( Bug #8150 )
// This is for removals
jQuery.each([ "width", "height" ], function( i, name ) {
jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
set: function( elem, value ) {
if ( value === "" ) {
elem.setAttribute( name, "auto" );
return value;
}
}
});
});
}
// Some attributes require a special call on IE
if ( !jQuery.support.hrefNormalized ) {
jQuery.each([ "href", "src", "width", "height" ], function( i, name ) {
jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
get: function( elem ) {
var ret = elem.getAttribute( name, 2 );
return ret === null ? undefined : ret;
}
});
});
}
if ( !jQuery.support.style ) {
jQuery.attrHooks.style = {
get: function( elem ) {
// Return undefined in the case of empty string
// Normalize to lowercase since IE uppercases css property names
return elem.style.cssText.toLowerCase() || undefined;
},
set: function( elem, value ) {
return (elem.style.cssText = "" + value);
}
};
}
// Safari mis-reports the default selected property of an option
// Accessing the parent's selectedIndex property fixes it
if ( !jQuery.support.optSelected ) {
jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, {
get: function( elem ) {
var parent = elem.parentNode;
if ( parent ) {
parent.selectedIndex;
// Make sure that it also works with optgroups, see #5701
if ( parent.parentNode ) {
parent.parentNode.selectedIndex;
}
}
return null;
}
});
}
// Radios and checkboxes getter/setter
if ( !jQuery.support.checkOn ) {
jQuery.each([ "radio", "checkbox" ], function() {
jQuery.valHooks[ this ] = {
get: function( elem ) {
// Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified
return elem.getAttribute("value") === null ? "on" : elem.value;
}
};
});
}
jQuery.each([ "radio", "checkbox" ], function() {
jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], {
set: function( elem, value ) {
if ( jQuery.isArray( value ) ) {
return (elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0);
}
}
});
});
var rnamespaces = /\.(.*)$/,
rformElems = /^(?:textarea|input|select)$/i,
rperiod = /\./g,
rspaces = / /g,
rescape = /[^\w\s.|`]/g,
fcleanup = function( nm ) {
return nm.replace(rescape, "\\$&");
};
/*
* A number of helper functions used for managing events.
* Many of the ideas behind this code originated from
* Dean Edwards' addEvent library.
*/
jQuery.event = {
// Bind an event to an element
// Original by Dean Edwards
add: function( elem, types, handler, data ) {
if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
return;
}
if ( handler === false ) {
handler = returnFalse;
} else if ( !handler ) {
// Fixes bug #7229. Fix recommended by jdalton
return;
}
var handleObjIn, handleObj;
if ( handler.handler ) {
handleObjIn = handler;
handler = handleObjIn.handler;
}
// Make sure that the function being executed has a unique ID
if ( !handler.guid ) {
handler.guid = jQuery.guid++;
}
// Init the element's event structure
var elemData = jQuery._data( elem );
// If no elemData is found then we must be trying to bind to one of the
// banned noData elements
if ( !elemData ) {
return;
}
var events = elemData.events,
eventHandle = elemData.handle;
if ( !events ) {
elemData.events = events = {};
}
if ( !eventHandle ) {
elemData.handle = eventHandle = function( e ) {
// Discard the second event of a jQuery.event.trigger() and
// when an event is called after a page has unloaded
return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ?
jQuery.event.handle.apply( eventHandle.elem, arguments ) :
undefined;
};
}
// Add elem as a property of the handle function
// This is to prevent a memory leak with non-native events in IE.
eventHandle.elem = elem;
// Handle multiple events separated by a space
// jQuery(...).bind("mouseover mouseout", fn);
types = types.split(" ");
var type, i = 0, namespaces;
while ( (type = types[ i++ ]) ) {
handleObj = handleObjIn ?
jQuery.extend({}, handleObjIn) :
{ handler: handler, data: data };
// Namespaced event handlers
if ( type.indexOf(".") > -1 ) {
namespaces = type.split(".");
type = namespaces.shift();
handleObj.namespace = namespaces.slice(0).sort().join(".");
} else {
namespaces = [];
handleObj.namespace = "";
}
handleObj.type = type;
if ( !handleObj.guid ) {
handleObj.guid = handler.guid;
}
// Get the current list of functions bound to this event
var handlers = events[ type ],
special = jQuery.event.special[ type ] || {};
// Init the event handler queue
if ( !handlers ) {
handlers = events[ type ] = [];
// Check for a special event handler
// Only use addEventListener/attachEvent if the special
// events handler returns false
if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
// Bind the global event handler to the element
if ( elem.addEventListener ) {
elem.addEventListener( type, eventHandle, false );
} else if ( elem.attachEvent ) {
elem.attachEvent( "on" + type, eventHandle );
}
}
}
if ( special.add ) {
special.add.call( elem, handleObj );
if ( !handleObj.handler.guid ) {
handleObj.handler.guid = handler.guid;
}
}
// Add the function to the element's handler list
handlers.push( handleObj );
// Keep track of which events have been used, for event optimization
jQuery.event.global[ type ] = true;
}
// Nullify elem to prevent memory leaks in IE
elem = null;
},
global: {},
// Detach an event or set of events from an element
remove: function( elem, types, handler, pos ) {
// don't do events on text and comment nodes
if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
return;
}
if ( handler === false ) {
handler = returnFalse;
}
var ret, type, fn, j, i = 0, all, namespaces, namespace, special, eventType, handleObj, origType,
elemData = jQuery.hasData( elem ) && jQuery._data( elem ),
events = elemData && elemData.events;
if ( !elemData || !events ) {
return;
}
// types is actually an event object here
if ( types && types.type ) {
handler = types.handler;
types = types.type;
}
// Unbind all events for the element
if ( !types || typeof types === "string" && types.charAt(0) === "." ) {
types = types || "";
for ( type in events ) {
jQuery.event.remove( elem, type + types );
}
return;
}
// Handle multiple events separated by a space
// jQuery(...).unbind("mouseover mouseout", fn);
types = types.split(" ");
while ( (type = types[ i++ ]) ) {
origType = type;
handleObj = null;
all = type.indexOf(".") < 0;
namespaces = [];
if ( !all ) {
// Namespaced event handlers
namespaces = type.split(".");
type = namespaces.shift();
namespace = new RegExp("(^|\\.)" +
jQuery.map( namespaces.slice(0).sort(), fcleanup ).join("\\.(?:.*\\.)?") + "(\\.|$)");
}
eventType = events[ type ];
if ( !eventType ) {
continue;
}
if ( !handler ) {
for ( j = 0; j < eventType.length; j++ ) {
handleObj = eventType[ j ];
if ( all || namespace.test( handleObj.namespace ) ) {
jQuery.event.remove( elem, origType, handleObj.handler, j );
eventType.splice( j--, 1 );
}
}
continue;
}
special = jQuery.event.special[ type ] || {};
for ( j = pos || 0; j < eventType.length; j++ ) {
handleObj = eventType[ j ];
if ( handler.guid === handleObj.guid ) {
// remove the given handler for the given type
if ( all || namespace.test( handleObj.namespace ) ) {
if ( pos == null ) {
eventType.splice( j--, 1 );
}
if ( special.remove ) {
special.remove.call( elem, handleObj );
}
}
if ( pos != null ) {
break;
}
}
}
// remove generic event handler if no more handlers exist
if ( eventType.length === 0 || pos != null && eventType.length === 1 ) {
if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) {
jQuery.removeEvent( elem, type, elemData.handle );
}
ret = null;
delete events[ type ];
}
}
// Remove the expando if it's no longer used
if ( jQuery.isEmptyObject( events ) ) {
var handle = elemData.handle;
if ( handle ) {
handle.elem = null;
}
delete elemData.events;
delete elemData.handle;
if ( jQuery.isEmptyObject( elemData ) ) {
jQuery.removeData( elem, undefined, true );
}
}
},
// Events that are safe to short-circuit if no handlers are attached.
// Native DOM events should not be added, they may have inline handlers.
customEvent: {
"getData": true,
"setData": true,
"changeData": true
},
trigger: function( event, data, elem, onlyHandlers ) {
// Event object or event type
var type = event.type || event,
namespaces = [],
exclusive;
if ( type.indexOf("!") >= 0 ) {
// Exclusive events trigger only for the exact event (no namespaces)
type = type.slice(0, -1);
exclusive = true;
}
if ( type.indexOf(".") >= 0 ) {
// Namespaced trigger; create a regexp to match event type in handle()
namespaces = type.split(".");
type = namespaces.shift();
namespaces.sort();
}
if ( (!elem || jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ] ) {
// No jQuery handlers for this event type, and it can't have inline handlers
return;
}
// Caller can pass in an Event, Object, or just an event type string
event = typeof event === "object" ?
// jQuery.Event object
event[ jQuery.expando ] ? event :
// Object literal
new jQuery.Event( type, event ) :
// Just the event type (string)
new jQuery.Event( type );
event.type = type;
event.exclusive = exclusive;
event.namespace = namespaces.join(".");
event.namespace_re = new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.)?") + "(\\.|$)");
// triggerHandler() and global events don't bubble or run the default action
if ( onlyHandlers || !elem ) {
event.preventDefault();
event.stopPropagation();
}
// Handle a global trigger
if ( !elem ) {
// TODO: Stop taunting the data cache; remove global events and always attach to document
jQuery.each( jQuery.cache, function() {
// internalKey variable is just used to make it easier to find
// and potentially change this stuff later; currently it just
// points to jQuery.expando
var internalKey = jQuery.expando,
internalCache = this[ internalKey ];
if ( internalCache && internalCache.events && internalCache.events[ type ] ) {
jQuery.event.trigger( event, data, internalCache.handle.elem );
}
});
return;
}
// Don't do events on text and comment nodes
if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
return;
}
// Clean up the event in case it is being reused
event.result = undefined;
event.target = elem;
// Clone any incoming data and prepend the event, creating the handler arg list
data = data != null ? jQuery.makeArray( data ) : [];
data.unshift( event );
var cur = elem,
// IE doesn't like method names with a colon (#3533, #8272)
ontype = type.indexOf(":") < 0 ? "on" + type : "";
// Fire event on the current element, then bubble up the DOM tree
do {
var handle = jQuery._data( cur, "handle" );
event.currentTarget = cur;
if ( handle ) {
handle.apply( cur, data );
}
// Trigger an inline bound script
if ( ontype && jQuery.acceptData( cur ) && cur[ ontype ] && cur[ ontype ].apply( cur, data ) === false ) {
event.result = false;
event.preventDefault();
}
// Bubble up to document, then to window
cur = cur.parentNode || cur.ownerDocument || cur === event.target.ownerDocument && window;
} while ( cur && !event.isPropagationStopped() );
// If nobody prevented the default action, do it now
if ( !event.isDefaultPrevented() ) {
var old,
special = jQuery.event.special[ type ] || {};
if ( (!special._default || special._default.call( elem.ownerDocument, event ) === false) &&
!(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) {
// Call a native DOM method on the target with the same name name as the event.
// Can't use an .isFunction)() check here because IE6/7 fails that test.
// IE<9 dies on focus to hidden element (#1486), may want to revisit a try/catch.
try {
if ( ontype && elem[ type ] ) {
// Don't re-trigger an onFOO event when we call its FOO() method
old = elem[ ontype ];
if ( old ) {
elem[ ontype ] = null;
}
jQuery.event.triggered = type;
elem[ type ]();
}
} catch ( ieError ) {}
if ( old ) {
elem[ ontype ] = old;
}
jQuery.event.triggered = undefined;
}
}
return event.result;
},
handle: function( event ) {
event = jQuery.event.fix( event || window.event );
// Snapshot the handlers list since a called handler may add/remove events.
var handlers = ((jQuery._data( this, "events" ) || {})[ event.type ] || []).slice(0),
run_all = !event.exclusive && !event.namespace,
args = Array.prototype.slice.call( arguments, 0 );
// Use the fix-ed Event rather than the (read-only) native event
args[0] = event;
event.currentTarget = this;
for ( var j = 0, l = handlers.length; j < l; j++ ) {
var handleObj = handlers[ j ];
// Triggered event must 1) be non-exclusive and have no namespace, or
// 2) have namespace(s) a subset or equal to those in the bound event.
if ( run_all || event.namespace_re.test( handleObj.namespace ) ) {
// Pass in a reference to the handler function itself
// So that we can later remove it
event.handler = handleObj.handler;
event.data = handleObj.data;
event.handleObj = handleObj;
var ret = handleObj.handler.apply( this, args );
if ( ret !== undefined ) {
event.result = ret;
if ( ret === false ) {
event.preventDefault();
event.stopPropagation();
}
}
if ( event.isImmediatePropagationStopped() ) {
break;
}
}
}
return event.result;
},
props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),
fix: function( event ) {
if ( event[ jQuery.expando ] ) {
return event;
}
// store a copy of the original event object
// and "clone" to set read-only properties
var originalEvent = event;
event = jQuery.Event( originalEvent );
for ( var i = this.props.length, prop; i; ) {
prop = this.props[ --i ];
event[ prop ] = originalEvent[ prop ];
}
// Fix target property, if necessary
if ( !event.target ) {
// Fixes #1925 where srcElement might not be defined either
event.target = event.srcElement || document;
}
// check if target is a textnode (safari)
if ( event.target.nodeType === 3 ) {
event.target = event.target.parentNode;
}
// Add relatedTarget, if necessary
if ( !event.relatedTarget && event.fromElement ) {
event.relatedTarget = event.fromElement === event.target ? event.toElement : event.fromElement;
}
// Calculate pageX/Y if missing and clientX/Y available
if ( event.pageX == null && event.clientX != null ) {
var eventDocument = event.target.ownerDocument || document,
doc = eventDocument.documentElement,
body = eventDocument.body;
event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0);
event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0);
}
// Add which for key events
if ( event.which == null && (event.charCode != null || event.keyCode != null) ) {
event.which = event.charCode != null ? event.charCode : event.keyCode;
}
// Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs)
if ( !event.metaKey && event.ctrlKey ) {
event.metaKey = event.ctrlKey;
}
// Add which for click: 1 === left; 2 === middle; 3 === right
// Note: button is not normalized, so don't use it
if ( !event.which && event.button !== undefined ) {
event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) ));
}
return event;
},
// Deprecated, use jQuery.guid instead
guid: 1E8,
// Deprecated, use jQuery.proxy instead
proxy: jQuery.proxy,
special: {
ready: {
// Make sure the ready event is setup
setup: jQuery.bindReady,
teardown: jQuery.noop
},
live: {
add: function( handleObj ) {
jQuery.event.add( this,
liveConvert( handleObj.origType, handleObj.selector ),
jQuery.extend({}, handleObj, {handler: liveHandler, guid: handleObj.handler.guid}) );
},
remove: function( handleObj ) {
jQuery.event.remove( this, liveConvert( handleObj.origType, handleObj.selector ), handleObj );
}
},
beforeunload: {
setup: function( data, namespaces, eventHandle ) {
// We only want to do this special case on windows
if ( jQuery.isWindow( this ) ) {
this.onbeforeunload = eventHandle;
}
},
teardown: function( namespaces, eventHandle ) {
if ( this.onbeforeunload === eventHandle ) {
this.onbeforeunload = null;
}
}
}
}
};
jQuery.removeEvent = document.removeEventListener ?
function( elem, type, handle ) {
if ( elem.removeEventListener ) {
elem.removeEventListener( type, handle, false );
}
} :
function( elem, type, handle ) {
if ( elem.detachEvent ) {
elem.detachEvent( "on" + type, handle );
}
};
jQuery.Event = function( src, props ) {
// Allow instantiation without the 'new' keyword
if ( !this.preventDefault ) {
return new jQuery.Event( src, props );
}
// Event object
if ( src && src.type ) {
this.originalEvent = src;
this.type = src.type;
// Events bubbling up the document may have been marked as prevented
// by a handler lower down the tree; reflect the correct value.
this.isDefaultPrevented = (src.defaultPrevented || src.returnValue === false ||
src.getPreventDefault && src.getPreventDefault()) ? returnTrue : returnFalse;
// Event type
} else {
this.type = src;
}
// Put explicitly provided properties onto the event object
if ( props ) {
jQuery.extend( this, props );
}
// timeStamp is buggy for some events on Firefox(#3843)
// So we won't rely on the native value
this.timeStamp = jQuery.now();
// Mark it as fixed
this[ jQuery.expando ] = true;
};
function returnFalse() {
return false;
}
function returnTrue() {
return true;
}
// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
jQuery.Event.prototype = {
preventDefault: function() {
this.isDefaultPrevented = returnTrue;
var e = this.originalEvent;
if ( !e ) {
return;
}
// if preventDefault exists run it on the original event
if ( e.preventDefault ) {
e.preventDefault();
// otherwise set the returnValue property of the original event to false (IE)
} else {
e.returnValue = false;
}
},
stopPropagation: function() {
this.isPropagationStopped = returnTrue;
var e = this.originalEvent;
if ( !e ) {
return;
}
// if stopPropagation exists run it on the original event
if ( e.stopPropagation ) {
e.stopPropagation();
}
// otherwise set the cancelBubble property of the original event to true (IE)
e.cancelBubble = true;
},
stopImmediatePropagation: function() {
this.isImmediatePropagationStopped = returnTrue;
this.stopPropagation();
},
isDefaultPrevented: returnFalse,
isPropagationStopped: returnFalse,
isImmediatePropagationStopped: returnFalse
};
// Checks if an event happened on an element within another element
// Used in jQuery.event.special.mouseenter and mouseleave handlers
var withinElement = function( event ) {
// Check if mouse(over|out) are still within the same parent element
var related = event.relatedTarget,
inside = false,
eventType = event.type;
event.type = event.data;
if ( related !== this ) {
if ( related ) {
inside = jQuery.contains( this, related );
}
if ( !inside ) {
jQuery.event.handle.apply( this, arguments );
event.type = eventType;
}
}
},
// In case of event delegation, we only need to rename the event.type,
// liveHandler will take care of the rest.
delegate = function( event ) {
event.type = event.data;
jQuery.event.handle.apply( this, arguments );
};
// Create mouseenter and mouseleave events
jQuery.each({
mouseenter: "mouseover",
mouseleave: "mouseout"
}, function( orig, fix ) {
jQuery.event.special[ orig ] = {
setup: function( data ) {
jQuery.event.add( this, fix, data && data.selector ? delegate : withinElement, orig );
},
teardown: function( data ) {
jQuery.event.remove( this, fix, data && data.selector ? delegate : withinElement );
}
};
});
// submit delegation
if ( !jQuery.support.submitBubbles ) {
jQuery.event.special.submit = {
setup: function( data, namespaces ) {
if ( !jQuery.nodeName( this, "form" ) ) {
jQuery.event.add(this, "click.specialSubmit", function( e ) {
// Avoid triggering error on non-existent type attribute in IE VML (#7071)
var elem = e.target,
type = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.type : "";
if ( (type === "submit" || type === "image") && jQuery( elem ).closest("form").length ) {
trigger( "submit", this, arguments );
}
});
jQuery.event.add(this, "keypress.specialSubmit", function( e ) {
var elem = e.target,
type = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.type : "";
if ( (type === "text" || type === "password") && jQuery( elem ).closest("form").length && e.keyCode === 13 ) {
trigger( "submit", this, arguments );
}
});
} else {
return false;
}
},
teardown: function( namespaces ) {
jQuery.event.remove( this, ".specialSubmit" );
}
};
}
// change delegation, happens here so we have bind.
if ( !jQuery.support.changeBubbles ) {
var changeFilters,
getVal = function( elem ) {
var type = jQuery.nodeName( elem, "input" ) ? elem.type : "",
val = elem.value;
if ( type === "radio" || type === "checkbox" ) {
val = elem.checked;
} else if ( type === "select-multiple" ) {
val = elem.selectedIndex > -1 ?
jQuery.map( elem.options, function( elem ) {
return elem.selected;
}).join("-") :
"";
} else if ( jQuery.nodeName( elem, "select" ) ) {
val = elem.selectedIndex;
}
return val;
},
testChange = function testChange( e ) {
var elem = e.target, data, val;
if ( !rformElems.test( elem.nodeName ) || elem.readOnly ) {
return;
}
data = jQuery._data( elem, "_change_data" );
val = getVal(elem);
// the current data will be also retrieved by beforeactivate
if ( e.type !== "focusout" || elem.type !== "radio" ) {
jQuery._data( elem, "_change_data", val );
}
if ( data === undefined || val === data ) {
return;
}
if ( data != null || val ) {
e.type = "change";
e.liveFired = undefined;
jQuery.event.trigger( e, arguments[1], elem );
}
};
jQuery.event.special.change = {
filters: {
focusout: testChange,
beforedeactivate: testChange,
click: function( e ) {
var elem = e.target, type = jQuery.nodeName( elem, "input" ) ? elem.type : "";
if ( type === "radio" || type === "checkbox" || jQuery.nodeName( elem, "select" ) ) {
testChange.call( this, e );
}
},
// Change has to be called before submit
// Keydown will be called before keypress, which is used in submit-event delegation
keydown: function( e ) {
var elem = e.target, type = jQuery.nodeName( elem, "input" ) ? elem.type : "";
if ( (e.keyCode === 13 && !jQuery.nodeName( elem, "textarea" ) ) ||
(e.keyCode === 32 && (type === "checkbox" || type === "radio")) ||
type === "select-multiple" ) {
testChange.call( this, e );
}
},
// Beforeactivate happens also before the previous element is blurred
// with this event you can't trigger a change event, but you can store
// information
beforeactivate: function( e ) {
var elem = e.target;
jQuery._data( elem, "_change_data", getVal(elem) );
}
},
setup: function( data, namespaces ) {
if ( this.type === "file" ) {
return false;
}
for ( var type in changeFilters ) {
jQuery.event.add( this, type + ".specialChange", changeFilters[type] );
}
return rformElems.test( this.nodeName );
},
teardown: function( namespaces ) {
jQuery.event.remove( this, ".specialChange" );
return rformElems.test( this.nodeName );
}
};
changeFilters = jQuery.event.special.change.filters;
// Handle when the input is .focus()'d
changeFilters.focus = changeFilters.beforeactivate;
}
function trigger( type, elem, args ) {
// Piggyback on a donor event to simulate a different one.
// Fake originalEvent to avoid donor's stopPropagation, but if the
// simulated event prevents default then we do the same on the donor.
// Don't pass args or remember liveFired; they apply to the donor event.
var event = jQuery.extend( {}, args[ 0 ] );
event.type = type;
event.originalEvent = {};
event.liveFired = undefined;
jQuery.event.handle.call( elem, event );
if ( event.isDefaultPrevented() ) {
args[ 0 ].preventDefault();
}
}
// Create "bubbling" focus and blur events
if ( !jQuery.support.focusinBubbles ) {
jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
// Attach a single capturing handler while someone wants focusin/focusout
var attaches = 0;
jQuery.event.special[ fix ] = {
setup: function() {
if ( attaches++ === 0 ) {
document.addEventListener( orig, handler, true );
}
},
teardown: function() {
if ( --attaches === 0 ) {
document.removeEventListener( orig, handler, true );
}
}
};
function handler( donor ) {
// Donor event is always a native one; fix it and switch its type.
// Let focusin/out handler cancel the donor focus/blur event.
var e = jQuery.event.fix( donor );
e.type = fix;
e.originalEvent = {};
jQuery.event.trigger( e, null, e.target );
if ( e.isDefaultPrevented() ) {
donor.preventDefault();
}
}
});
}
jQuery.each(["bind", "one"], function( i, name ) {
jQuery.fn[ name ] = function( type, data, fn ) {
var handler;
// Handle object literals
if ( typeof type === "object" ) {
for ( var key in type ) {
this[ name ](key, data, type[key], fn);
}
return this;
}
if ( arguments.length === 2 || data === false ) {
fn = data;
data = undefined;
}
if ( name === "one" ) {
handler = function( event ) {
jQuery( this ).unbind( event, handler );
return fn.apply( this, arguments );
};
handler.guid = fn.guid || jQuery.guid++;
} else {
handler = fn;
}
if ( type === "unload" && name !== "one" ) {
this.one( type, data, fn );
} else {
for ( var i = 0, l = this.length; i < l; i++ ) {
jQuery.event.add( this[i], type, handler, data );
}
}
return this;
};
});
jQuery.fn.extend({
unbind: function( type, fn ) {
// Handle object literals
if ( typeof type === "object" && !type.preventDefault ) {
for ( var key in type ) {
this.unbind(key, type[key]);
}
} else {
for ( var i = 0, l = this.length; i < l; i++ ) {
jQuery.event.remove( this[i], type, fn );
}
}
return this;
},
delegate: function( selector, types, data, fn ) {
return this.live( types, data, fn, selector );
},
undelegate: function( selector, types, fn ) {
if ( arguments.length === 0 ) {
return this.unbind( "live" );
} else {
return this.die( types, null, fn, selector );
}
},
trigger: function( type, data ) {
return this.each(function() {
jQuery.event.trigger( type, data, this );
});
},
triggerHandler: function( type, data ) {
if ( this[0] ) {
return jQuery.event.trigger( type, data, this[0], true );
}
},
toggle: function( fn ) {
// Save reference to arguments for access in closure
var args = arguments,
guid = fn.guid || jQuery.guid++,
i = 0,
toggler = function( event ) {
// Figure out which function to execute
var lastToggle = ( jQuery.data( this, "lastToggle" + fn.guid ) || 0 ) % i;
jQuery.data( this, "lastToggle" + fn.guid, lastToggle + 1 );
// Make sure that clicks stop
event.preventDefault();
// and execute the function
return args[ lastToggle ].apply( this, arguments ) || false;
};
// link all the functions, so any of them can unbind this click handler
toggler.guid = guid;
while ( i < args.length ) {
args[ i++ ].guid = guid;
}
return this.click( toggler );
},
hover: function( fnOver, fnOut ) {
return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
}
});
var liveMap = {
focus: "focusin",
blur: "focusout",
mouseenter: "mouseover",
mouseleave: "mouseout"
};
jQuery.each(["live", "die"], function( i, name ) {
jQuery.fn[ name ] = function( types, data, fn, origSelector /* Internal Use Only */ ) {
var type, i = 0, match, namespaces, preType,
selector = origSelector || this.selector,
context = origSelector ? this : jQuery( this.context );
if ( typeof types === "object" && !types.preventDefault ) {
for ( var key in types ) {
context[ name ]( key, data, types[key], selector );
}
return this;
}
if ( name === "die" && !types &&
origSelector && origSelector.charAt(0) === "." ) {
context.unbind( origSelector );
return this;
}
if ( data === false || jQuery.isFunction( data ) ) {
fn = data || returnFalse;
data = undefined;
}
types = (types || "").split(" ");
while ( (type = types[ i++ ]) != null ) {
match = rnamespaces.exec( type );
namespaces = "";
if ( match ) {
namespaces = match[0];
type = type.replace( rnamespaces, "" );
}
if ( type === "hover" ) {
types.push( "mouseenter" + namespaces, "mouseleave" + namespaces );
continue;
}
preType = type;
if ( liveMap[ type ] ) {
types.push( liveMap[ type ] + namespaces );
type = type + namespaces;
} else {
type = (liveMap[ type ] || type) + namespaces;
}
if ( name === "live" ) {
// bind live handler
for ( var j = 0, l = context.length; j < l; j++ ) {
jQuery.event.add( context[j], "live." + liveConvert( type, selector ),
{ data: data, selector: selector, handler: fn, origType: type, origHandler: fn, preType: preType } );
}
} else {
// unbind live handler
context.unbind( "live." + liveConvert( type, selector ), fn );
}
}
return this;
};
});
function liveHandler( event ) {
var stop, maxLevel, related, match, handleObj, elem, j, i, l, data, close, namespace, ret,
elems = [],
selectors = [],
events = jQuery._data( this, "events" );
// Make sure we avoid non-left-click bubbling in Firefox (#3861) and disabled elements in IE (#6911)
if ( event.liveFired === this || !events || !events.live || event.target.disabled || event.button && event.type === "click" ) {
return;
}
if ( event.namespace ) {
namespace = new RegExp("(^|\\.)" + event.namespace.split(".").join("\\.(?:.*\\.)?") + "(\\.|$)");
}
event.liveFired = this;
var live = events.live.slice(0);
for ( j = 0; j < live.length; j++ ) {
handleObj = live[j];
if ( handleObj.origType.replace( rnamespaces, "" ) === event.type ) {
selectors.push( handleObj.selector );
} else {
live.splice( j--, 1 );
}
}
match = jQuery( event.target ).closest( selectors, event.currentTarget );
for ( i = 0, l = match.length; i < l; i++ ) {
close = match[i];
for ( j = 0; j < live.length; j++ ) {
handleObj = live[j];
if ( close.selector === handleObj.selector && (!namespace || namespace.test( handleObj.namespace )) && !close.elem.disabled ) {
elem = close.elem;
related = null;
// Those two events require additional checking
if ( handleObj.preType === "mouseenter" || handleObj.preType === "mouseleave" ) {
event.type = handleObj.preType;
related = jQuery( event.relatedTarget ).closest( handleObj.selector )[0];
// Make sure not to accidentally match a child element with the same selector
if ( related && jQuery.contains( elem, related ) ) {
related = elem;
}
}
if ( !related || related !== elem ) {
elems.push({ elem: elem, handleObj: handleObj, level: close.level });
}
}
}
}
for ( i = 0, l = elems.length; i < l; i++ ) {
match = elems[i];
if ( maxLevel && match.level > maxLevel ) {
break;
}
event.currentTarget = match.elem;
event.data = match.handleObj.data;
event.handleObj = match.handleObj;
ret = match.handleObj.origHandler.apply( match.elem, arguments );
if ( ret === false || event.isPropagationStopped() ) {
maxLevel = match.level;
if ( ret === false ) {
stop = false;
}
if ( event.isImmediatePropagationStopped() ) {
break;
}
}
}
return stop;
}
function liveConvert( type, selector ) {
return (type && type !== "*" ? type + "." : "") + selector.replace(rperiod, "`").replace(rspaces, "&");
}
jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
"change select submit keydown keypress keyup error").split(" "), function( i, name ) {
// Handle event binding
jQuery.fn[ name ] = function( data, fn ) {
if ( fn == null ) {
fn = data;
data = null;
}
return arguments.length > 0 ?
this.bind( name, data, fn ) :
this.trigger( name );
};
if ( jQuery.attrFn ) {
jQuery.attrFn[ name ] = true;
}
});
/*!
* Sizzle CSS Selector Engine
* Copyright 2011, The Dojo Foundation
* Released under the MIT, BSD, and GPL Licenses.
* More information: http://sizzlejs.com/
*/
(function(){
var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,
done = 0,
toString = Object.prototype.toString,
hasDuplicate = false,
baseHasDuplicate = true,
rBackslash = /\\/g,
rNonWord = /\W/;
// Here we check if the JavaScript engine is using some sort of
// optimization where it does not always call our comparision
// function. If that is the case, discard the hasDuplicate value.
// Thus far that includes Google Chrome.
[0, 0].sort(function() {
baseHasDuplicate = false;
return 0;
});
var Sizzle = function( selector, context, results, seed ) {
results = results || [];
context = context || document;
var origContext = context;
if ( context.nodeType !== 1 && context.nodeType !== 9 ) {
return [];
}
if ( !selector || typeof selector !== "string" ) {
return results;
}
var m, set, checkSet, extra, ret, cur, pop, i,
prune = true,
contextXML = Sizzle.isXML( context ),
parts = [],
soFar = selector;
// Reset the position of the chunker regexp (start from head)
do {
chunker.exec( "" );
m = chunker.exec( soFar );
if ( m ) {
soFar = m[3];
parts.push( m[1] );
if ( m[2] ) {
extra = m[3];
break;
}
}
} while ( m );
if ( parts.length > 1 && origPOS.exec( selector ) ) {
if ( parts.length === 2 && Expr.relative[ parts[0] ] ) {
set = posProcess( parts[0] + parts[1], context );
} else {
set = Expr.relative[ parts[0] ] ?
[ context ] :
Sizzle( parts.shift(), context );
while ( parts.length ) {
selector = parts.shift();
if ( Expr.relative[ selector ] ) {
selector += parts.shift();
}
set = posProcess( selector, set );
}
}
} else {
// Take a shortcut and set the context if the root selector is an ID
// (but not if it'll be faster if the inner selector is an ID)
if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML &&
Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) {
ret = Sizzle.find( parts.shift(), context, contextXML );
context = ret.expr ?
Sizzle.filter( ret.expr, ret.set )[0] :
ret.set[0];
}
if ( context ) {
ret = seed ?
{ expr: parts.pop(), set: makeArray(seed) } :
Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML );
set = ret.expr ?
Sizzle.filter( ret.expr, ret.set ) :
ret.set;
if ( parts.length > 0 ) {
checkSet = makeArray( set );
} else {
prune = false;
}
while ( parts.length ) {
cur = parts.pop();
pop = cur;
if ( !Expr.relative[ cur ] ) {
cur = "";
} else {
pop = parts.pop();
}
if ( pop == null ) {
pop = context;
}
Expr.relative[ cur ]( checkSet, pop, contextXML );
}
} else {
checkSet = parts = [];
}
}
if ( !checkSet ) {
checkSet = set;
}
if ( !checkSet ) {
Sizzle.error( cur || selector );
}
if ( toString.call(checkSet) === "[object Array]" ) {
if ( !prune ) {
results.push.apply( results, checkSet );
} else if ( context && context.nodeType === 1 ) {
for ( i = 0; checkSet[i] != null; i++ ) {
if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) {
results.push( set[i] );
}
}
} else {
for ( i = 0; checkSet[i] != null; i++ ) {
if ( checkSet[i] && checkSet[i].nodeType === 1 ) {
results.push( set[i] );
}
}
}
} else {
makeArray( checkSet, results );
}
if ( extra ) {
Sizzle( extra, origContext, results, seed );
Sizzle.uniqueSort( results );
}
return results;
};
Sizzle.uniqueSort = function( results ) {
if ( sortOrder ) {
hasDuplicate = baseHasDuplicate;
results.sort( sortOrder );
if ( hasDuplicate ) {
for ( var i = 1; i < results.length; i++ ) {
if ( results[i] === results[ i - 1 ] ) {
results.splice( i--, 1 );
}
}
}
}
return results;
};
Sizzle.matches = function( expr, set ) {
return Sizzle( expr, null, null, set );
};
Sizzle.matchesSelector = function( node, expr ) {
return Sizzle( expr, null, null, [node] ).length > 0;
};
Sizzle.find = function( expr, context, isXML ) {
var set;
if ( !expr ) {
return [];
}
for ( var i = 0, l = Expr.order.length; i < l; i++ ) {
var match,
type = Expr.order[i];
if ( (match = Expr.leftMatch[ type ].exec( expr )) ) {
var left = match[1];
match.splice( 1, 1 );
if ( left.substr( left.length - 1 ) !== "\\" ) {
match[1] = (match[1] || "").replace( rBackslash, "" );
set = Expr.find[ type ]( match, context, isXML );
if ( set != null ) {
expr = expr.replace( Expr.match[ type ], "" );
break;
}
}
}
}
if ( !set ) {
set = typeof context.getElementsByTagName !== "undefined" ?
context.getElementsByTagName( "*" ) :
[];
}
return { set: set, expr: expr };
};
Sizzle.filter = function( expr, set, inplace, not ) {
var match, anyFound,
old = expr,
result = [],
curLoop = set,
isXMLFilter = set && set[0] && Sizzle.isXML( set[0] );
while ( expr && set.length ) {
for ( var type in Expr.filter ) {
if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) {
var found, item,
filter = Expr.filter[ type ],
left = match[1];
anyFound = false;
match.splice(1,1);
if ( left.substr( left.length - 1 ) === "\\" ) {
continue;
}
if ( curLoop === result ) {
result = [];
}
if ( Expr.preFilter[ type ] ) {
match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter );
if ( !match ) {
anyFound = found = true;
} else if ( match === true ) {
continue;
}
}
if ( match ) {
for ( var i = 0; (item = curLoop[i]) != null; i++ ) {
if ( item ) {
found = filter( item, match, i, curLoop );
var pass = not ^ !!found;
if ( inplace && found != null ) {
if ( pass ) {
anyFound = true;
} else {
curLoop[i] = false;
}
} else if ( pass ) {
result.push( item );
anyFound = true;
}
}
}
}
if ( found !== undefined ) {
if ( !inplace ) {
curLoop = result;
}
expr = expr.replace( Expr.match[ type ], "" );
if ( !anyFound ) {
return [];
}
break;
}
}
}
// Improper expression
if ( expr === old ) {
if ( anyFound == null ) {
Sizzle.error( expr );
} else {
break;
}
}
old = expr;
}
return curLoop;
};
Sizzle.error = function( msg ) {
throw "Syntax error, unrecognized expression: " + msg;
};
var Expr = Sizzle.selectors = {
order: [ "ID", "NAME", "TAG" ],
match: {
ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,
ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,
TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,
CHILD: /:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,
POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,
PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/
},
leftMatch: {},
attrMap: {
"class": "className",
"for": "htmlFor"
},
attrHandle: {
href: function( elem ) {
return elem.getAttribute( "href" );
},
type: function( elem ) {
return elem.getAttribute( "type" );
}
},
relative: {
"+": function(checkSet, part){
var isPartStr = typeof part === "string",
isTag = isPartStr && !rNonWord.test( part ),
isPartStrNotTag = isPartStr && !isTag;
if ( isTag ) {
part = part.toLowerCase();
}
for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) {
if ( (elem = checkSet[i]) ) {
while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {}
checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ?
elem || false :
elem === part;
}
}
if ( isPartStrNotTag ) {
Sizzle.filter( part, checkSet, true );
}
},
">": function( checkSet, part ) {
var elem,
isPartStr = typeof part === "string",
i = 0,
l = checkSet.length;
if ( isPartStr && !rNonWord.test( part ) ) {
part = part.toLowerCase();
for ( ; i < l; i++ ) {
elem = checkSet[i];
if ( elem ) {
var parent = elem.parentNode;
checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false;
}
}
} else {
for ( ; i < l; i++ ) {
elem = checkSet[i];
if ( elem ) {
checkSet[i] = isPartStr ?
elem.parentNode :
elem.parentNode === part;
}
}
if ( isPartStr ) {
Sizzle.filter( part, checkSet, true );
}
}
},
"": function(checkSet, part, isXML){
var nodeCheck,
doneName = done++,
checkFn = dirCheck;
if ( typeof part === "string" && !rNonWord.test( part ) ) {
part = part.toLowerCase();
nodeCheck = part;
checkFn = dirNodeCheck;
}
checkFn( "parentNode", part, doneName, checkSet, nodeCheck, isXML );
},
"~": function( checkSet, part, isXML ) {
var nodeCheck,
doneName = done++,
checkFn = dirCheck;
if ( typeof part === "string" && !rNonWord.test( part ) ) {
part = part.toLowerCase();
nodeCheck = part;
checkFn = dirNodeCheck;
}
checkFn( "previousSibling", part, doneName, checkSet, nodeCheck, isXML );
}
},
find: {
ID: function( match, context, isXML ) {
if ( typeof context.getElementById !== "undefined" && !isXML ) {
var m = context.getElementById(match[1]);
// Check parentNode to catch when Blackberry 4.6 returns
// nodes that are no longer in the document #6963
return m && m.parentNode ? [m] : [];
}
},
NAME: function( match, context ) {
if ( typeof context.getElementsByName !== "undefined" ) {
var ret = [],
results = context.getElementsByName( match[1] );
for ( var i = 0, l = results.length; i < l; i++ ) {
if ( results[i].getAttribute("name") === match[1] ) {
ret.push( results[i] );
}
}
return ret.length === 0 ? null : ret;
}
},
TAG: function( match, context ) {
if ( typeof context.getElementsByTagName !== "undefined" ) {
return context.getElementsByTagName( match[1] );
}
}
},
preFilter: {
CLASS: function( match, curLoop, inplace, result, not, isXML ) {
match = " " + match[1].replace( rBackslash, "" ) + " ";
if ( isXML ) {
return match;
}
for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) {
if ( elem ) {
if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n\r]/g, " ").indexOf(match) >= 0) ) {
if ( !inplace ) {
result.push( elem );
}
} else if ( inplace ) {
curLoop[i] = false;
}
}
}
return false;
},
ID: function( match ) {
return match[1].replace( rBackslash, "" );
},
TAG: function( match, curLoop ) {
return match[1].replace( rBackslash, "" ).toLowerCase();
},
CHILD: function( match ) {
if ( match[1] === "nth" ) {
if ( !match[2] ) {
Sizzle.error( match[0] );
}
match[2] = match[2].replace(/^\+|\s*/g, '');
// parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
var test = /(-?)(\d*)(?:n([+\-]?\d*))?/.exec(
match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" ||
!/\D/.test( match[2] ) && "0n+" + match[2] || match[2]);
// calculate the numbers (first)n+(last) including if they are negative
match[2] = (test[1] + (test[2] || 1)) - 0;
match[3] = test[3] - 0;
}
else if ( match[2] ) {
Sizzle.error( match[0] );
}
// TODO: Move to normal caching system
match[0] = done++;
return match;
},
ATTR: function( match, curLoop, inplace, result, not, isXML ) {
var name = match[1] = match[1].replace( rBackslash, "" );
if ( !isXML && Expr.attrMap[name] ) {
match[1] = Expr.attrMap[name];
}
// Handle if an un-quoted value was used
match[4] = ( match[4] || match[5] || "" ).replace( rBackslash, "" );
if ( match[2] === "~=" ) {
match[4] = " " + match[4] + " ";
}
return match;
},
PSEUDO: function( match, curLoop, inplace, result, not ) {
if ( match[1] === "not" ) {
// If we're dealing with a complex expression, or a simple one
if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) {
match[3] = Sizzle(match[3], null, null, curLoop);
} else {
var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not);
if ( !inplace ) {
result.push.apply( result, ret );
}
return false;
}
} else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) {
return true;
}
return match;
},
POS: function( match ) {
match.unshift( true );
return match;
}
},
filters: {
enabled: function( elem ) {
return elem.disabled === false && elem.type !== "hidden";
},
disabled: function( elem ) {
return elem.disabled === true;
},
checked: function( elem ) {
return elem.checked === true;
},
selected: function( elem ) {
// Accessing this property makes selected-by-default
// options in Safari work properly
if ( elem.parentNode ) {
elem.parentNode.selectedIndex;
}
return elem.selected === true;
},
parent: function( elem ) {
return !!elem.firstChild;
},
empty: function( elem ) {
return !elem.firstChild;
},
has: function( elem, i, match ) {
return !!Sizzle( match[3], elem ).length;
},
header: function( elem ) {
return (/h\d/i).test( elem.nodeName );
},
text: function( elem ) {
var attr = elem.getAttribute( "type" ), type = elem.type;
// IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc)
// use getAttribute instead to test this case
return elem.nodeName.toLowerCase() === "input" && "text" === type && ( attr === type || attr === null );
},
radio: function( elem ) {
return elem.nodeName.toLowerCase() === "input" && "radio" === elem.type;
},
checkbox: function( elem ) {
return elem.nodeName.toLowerCase() === "input" && "checkbox" === elem.type;
},
file: function( elem ) {
return elem.nodeName.toLowerCase() === "input" && "file" === elem.type;
},
password: function( elem ) {
return elem.nodeName.toLowerCase() === "input" && "password" === elem.type;
},
submit: function( elem ) {
var name = elem.nodeName.toLowerCase();
return (name === "input" || name === "button") && "submit" === elem.type;
},
image: function( elem ) {
return elem.nodeName.toLowerCase() === "input" && "image" === elem.type;
},
reset: function( elem ) {
var name = elem.nodeName.toLowerCase();
return (name === "input" || name === "button") && "reset" === elem.type;
},
button: function( elem ) {
var name = elem.nodeName.toLowerCase();
return name === "input" && "button" === elem.type || name === "button";
},
input: function( elem ) {
return (/input|select|textarea|button/i).test( elem.nodeName );
},
focus: function( elem ) {
return elem === elem.ownerDocument.activeElement;
}
},
setFilters: {
first: function( elem, i ) {
return i === 0;
},
last: function( elem, i, match, array ) {
return i === array.length - 1;
},
even: function( elem, i ) {
return i % 2 === 0;
},
odd: function( elem, i ) {
return i % 2 === 1;
},
lt: function( elem, i, match ) {
return i < match[3] - 0;
},
gt: function( elem, i, match ) {
return i > match[3] - 0;
},
nth: function( elem, i, match ) {
return match[3] - 0 === i;
},
eq: function( elem, i, match ) {
return match[3] - 0 === i;
}
},
filter: {
PSEUDO: function( elem, match, i, array ) {
var name = match[1],
filter = Expr.filters[ name ];
if ( filter ) {
return filter( elem, i, match, array );
} else if ( name === "contains" ) {
return (elem.textContent || elem.innerText || Sizzle.getText([ elem ]) || "").indexOf(match[3]) >= 0;
} else if ( name === "not" ) {
var not = match[3];
for ( var j = 0, l = not.length; j < l; j++ ) {
if ( not[j] === elem ) {
return false;
}
}
return true;
} else {
Sizzle.error( name );
}
},
CHILD: function( elem, match ) {
var type = match[1],
node = elem;
switch ( type ) {
case "only":
case "first":
while ( (node = node.previousSibling) ) {
if ( node.nodeType === 1 ) {
return false;
}
}
if ( type === "first" ) {
return true;
}
node = elem;
case "last":
while ( (node = node.nextSibling) ) {
if ( node.nodeType === 1 ) {
return false;
}
}
return true;
case "nth":
var first = match[2],
last = match[3];
if ( first === 1 && last === 0 ) {
return true;
}
var doneName = match[0],
parent = elem.parentNode;
if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) {
var count = 0;
for ( node = parent.firstChild; node; node = node.nextSibling ) {
if ( node.nodeType === 1 ) {
node.nodeIndex = ++count;
}
}
parent.sizcache = doneName;
}
var diff = elem.nodeIndex - last;
if ( first === 0 ) {
return diff === 0;
} else {
return ( diff % first === 0 && diff / first >= 0 );
}
}
},
ID: function( elem, match ) {
return elem.nodeType === 1 && elem.getAttribute("id") === match;
},
TAG: function( elem, match ) {
return (match === "*" && elem.nodeType === 1) || elem.nodeName.toLowerCase() === match;
},
CLASS: function( elem, match ) {
return (" " + (elem.className || elem.getAttribute("class")) + " ")
.indexOf( match ) > -1;
},
ATTR: function( elem, match ) {
var name = match[1],
result = Expr.attrHandle[ name ] ?
Expr.attrHandle[ name ]( elem ) :
elem[ name ] != null ?
elem[ name ] :
elem.getAttribute( name ),
value = result + "",
type = match[2],
check = match[4];
return result == null ?
type === "!=" :
type === "=" ?
value === check :
type === "*=" ?
value.indexOf(check) >= 0 :
type === "~=" ?
(" " + value + " ").indexOf(check) >= 0 :
!check ?
value && result !== false :
type === "!=" ?
value !== check :
type === "^=" ?
value.indexOf(check) === 0 :
type === "$=" ?
value.substr(value.length - check.length) === check :
type === "|=" ?
value === check || value.substr(0, check.length + 1) === check + "-" :
false;
},
POS: function( elem, match, i, array ) {
var name = match[2],
filter = Expr.setFilters[ name ];
if ( filter ) {
return filter( elem, i, match, array );
}
}
}
};
var origPOS = Expr.match.POS,
fescape = function(all, num){
return "\\" + (num - 0 + 1);
};
for ( var type in Expr.match ) {
Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) );
Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, fescape) );
}
var makeArray = function( array, results ) {
array = Array.prototype.slice.call( array, 0 );
if ( results ) {
results.push.apply( results, array );
return results;
}
return array;
};
// Perform a simple check to determine if the browser is capable of
// converting a NodeList to an array using builtin methods.
// Also verifies that the returned array holds DOM nodes
// (which is not the case in the Blackberry browser)
try {
Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType;
// Provide a fallback method if it does not work
} catch( e ) {
makeArray = function( array, results ) {
var i = 0,
ret = results || [];
if ( toString.call(array) === "[object Array]" ) {
Array.prototype.push.apply( ret, array );
} else {
if ( typeof array.length === "number" ) {
for ( var l = array.length; i < l; i++ ) {
ret.push( array[i] );
}
} else {
for ( ; array[i]; i++ ) {
ret.push( array[i] );
}
}
}
return ret;
};
}
var sortOrder, siblingCheck;
if ( document.documentElement.compareDocumentPosition ) {
sortOrder = function( a, b ) {
if ( a === b ) {
hasDuplicate = true;
return 0;
}
if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) {
return a.compareDocumentPosition ? -1 : 1;
}
return a.compareDocumentPosition(b) & 4 ? -1 : 1;
};
} else {
sortOrder = function( a, b ) {
// The nodes are identical, we can exit early
if ( a === b ) {
hasDuplicate = true;
return 0;
// Fallback to using sourceIndex (in IE) if it's available on both nodes
} else if ( a.sourceIndex && b.sourceIndex ) {
return a.sourceIndex - b.sourceIndex;
}
var al, bl,
ap = [],
bp = [],
aup = a.parentNode,
bup = b.parentNode,
cur = aup;
// If the nodes are siblings (or identical) we can do a quick check
if ( aup === bup ) {
return siblingCheck( a, b );
// If no parents were found then the nodes are disconnected
} else if ( !aup ) {
return -1;
} else if ( !bup ) {
return 1;
}
// Otherwise they're somewhere else in the tree so we need
// to build up a full list of the parentNodes for comparison
while ( cur ) {
ap.unshift( cur );
cur = cur.parentNode;
}
cur = bup;
while ( cur ) {
bp.unshift( cur );
cur = cur.parentNode;
}
al = ap.length;
bl = bp.length;
// Start walking down the tree looking for a discrepancy
for ( var i = 0; i < al && i < bl; i++ ) {
if ( ap[i] !== bp[i] ) {
return siblingCheck( ap[i], bp[i] );
}
}
// We ended someplace up the tree so do a sibling check
return i === al ?
siblingCheck( a, bp[i], -1 ) :
siblingCheck( ap[i], b, 1 );
};
siblingCheck = function( a, b, ret ) {
if ( a === b ) {
return ret;
}
var cur = a.nextSibling;
while ( cur ) {
if ( cur === b ) {
return -1;
}
cur = cur.nextSibling;
}
return 1;
};
}
// Utility function for retreiving the text value of an array of DOM nodes
Sizzle.getText = function( elems ) {
var ret = "", elem;
for ( var i = 0; elems[i]; i++ ) {
elem = elems[i];
// Get the text from text nodes and CDATA nodes
if ( elem.nodeType === 3 || elem.nodeType === 4 ) {
ret += elem.nodeValue;
// Traverse everything else, except comment nodes
} else if ( elem.nodeType !== 8 ) {
ret += Sizzle.getText( elem.childNodes );
}
}
return ret;
};
// Check to see if the browser returns elements by name when
// querying by getElementById (and provide a workaround)
(function(){
// We're going to inject a fake input element with a specified name
var form = document.createElement("div"),
id = "script" + (new Date()).getTime(),
root = document.documentElement;
form.innerHTML = "<a name='" + id + "'/>";
// Inject it into the root element, check its status, and remove it quickly
root.insertBefore( form, root.firstChild );
// The workaround has to do additional checks after a getElementById
// Which slows things down for other browsers (hence the branching)
if ( document.getElementById( id ) ) {
Expr.find.ID = function( match, context, isXML ) {
if ( typeof context.getElementById !== "undefined" && !isXML ) {
var m = context.getElementById(match[1]);
return m ?
m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ?
[m] :
undefined :
[];
}
};
Expr.filter.ID = function( elem, match ) {
var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
return elem.nodeType === 1 && node && node.nodeValue === match;
};
}
root.removeChild( form );
// release memory in IE
root = form = null;
})();
(function(){
// Check to see if the browser returns only elements
// when doing getElementsByTagName("*")
// Create a fake element
var div = document.createElement("div");
div.appendChild( document.createComment("") );
// Make sure no comments are found
if ( div.getElementsByTagName("*").length > 0 ) {
Expr.find.TAG = function( match, context ) {
var results = context.getElementsByTagName( match[1] );
// Filter out possible comments
if ( match[1] === "*" ) {
var tmp = [];
for ( var i = 0; results[i]; i++ ) {
if ( results[i].nodeType === 1 ) {
tmp.push( results[i] );
}
}
results = tmp;
}
return results;
};
}
// Check to see if an attribute returns normalized href attributes
div.innerHTML = "<a href='#'></a>";
if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" &&
div.firstChild.getAttribute("href") !== "#" ) {
Expr.attrHandle.href = function( elem ) {
return elem.getAttribute( "href", 2 );
};
}
// release memory in IE
div = null;
})();
if ( document.querySelectorAll ) {
(function(){
var oldSizzle = Sizzle,
div = document.createElement("div"),
id = "__sizzle__";
div.innerHTML = "<p class='TEST'></p>";
// Safari can't handle uppercase or unicode characters when
// in quirks mode.
if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) {
return;
}
Sizzle = function( query, context, extra, seed ) {
context = context || document;
// Only use querySelectorAll on non-XML documents
// (ID selectors don't work in non-HTML documents)
if ( !seed && !Sizzle.isXML(context) ) {
// See if we find a selector to speed up
var match = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec( query );
if ( match && (context.nodeType === 1 || context.nodeType === 9) ) {
// Speed-up: Sizzle("TAG")
if ( match[1] ) {
return makeArray( context.getElementsByTagName( query ), extra );
// Speed-up: Sizzle(".CLASS")
} else if ( match[2] && Expr.find.CLASS && context.getElementsByClassName ) {
return makeArray( context.getElementsByClassName( match[2] ), extra );
}
}
if ( context.nodeType === 9 ) {
// Speed-up: Sizzle("body")
// The body element only exists once, optimize finding it
if ( query === "body" && context.body ) {
return makeArray( [ context.body ], extra );
// Speed-up: Sizzle("#ID")
} else if ( match && match[3] ) {
var elem = context.getElementById( match[3] );
// Check parentNode to catch when Blackberry 4.6 returns
// nodes that are no longer in the document #6963
if ( elem && elem.parentNode ) {
// Handle the case where IE and Opera return items
// by name instead of ID
if ( elem.id === match[3] ) {
return makeArray( [ elem ], extra );
}
} else {
return makeArray( [], extra );
}
}
try {
return makeArray( context.querySelectorAll(query), extra );
} catch(qsaError) {}
// qSA works strangely on Element-rooted queries
// We can work around this by specifying an extra ID on the root
// and working up from there (Thanks to Andrew Dupont for the technique)
// IE 8 doesn't work on object elements
} else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
var oldContext = context,
old = context.getAttribute( "id" ),
nid = old || id,
hasParent = context.parentNode,
relativeHierarchySelector = /^\s*[+~]/.test( query );
if ( !old ) {
context.setAttribute( "id", nid );
} else {
nid = nid.replace( /'/g, "\\$&" );
}
if ( relativeHierarchySelector && hasParent ) {
context = context.parentNode;
}
try {
if ( !relativeHierarchySelector || hasParent ) {
return makeArray( context.querySelectorAll( "[id='" + nid + "'] " + query ), extra );
}
} catch(pseudoError) {
} finally {
if ( !old ) {
oldContext.removeAttribute( "id" );
}
}
}
}
return oldSizzle(query, context, extra, seed);
};
for ( var prop in oldSizzle ) {
Sizzle[ prop ] = oldSizzle[ prop ];
}
// release memory in IE
div = null;
})();
}
(function(){
var html = document.documentElement,
matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector;
if ( matches ) {
// Check to see if it's possible to do matchesSelector
// on a disconnected node (IE 9 fails this)
var disconnectedMatch = !matches.call( document.createElement( "div" ), "div" ),
pseudoWorks = false;
try {
// This should fail with an exception
// Gecko does not error, returns false instead
matches.call( document.documentElement, "[test!='']:sizzle" );
} catch( pseudoError ) {
pseudoWorks = true;
}
Sizzle.matchesSelector = function( node, expr ) {
// Make sure that attribute selectors are quoted
expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']");
if ( !Sizzle.isXML( node ) ) {
try {
if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) {
var ret = matches.call( node, expr );
// IE 9's matchesSelector returns false on disconnected nodes
if ( ret || !disconnectedMatch ||
// As well, disconnected nodes are said to be in a document
// fragment in IE 9, so check for that
node.document && node.document.nodeType !== 11 ) {
return ret;
}
}
} catch(e) {}
}
return Sizzle(expr, null, null, [node]).length > 0;
};
}
})();
(function(){
var div = document.createElement("div");
div.innerHTML = "<div class='test e'></div><div class='test'></div>";
// Opera can't find a second classname (in 9.6)
// Also, make sure that getElementsByClassName actually exists
if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) {
return;
}
// Safari caches class attributes, doesn't catch changes (in 3.2)
div.lastChild.className = "e";
if ( div.getElementsByClassName("e").length === 1 ) {
return;
}
Expr.order.splice(1, 0, "CLASS");
Expr.find.CLASS = function( match, context, isXML ) {
if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) {
return context.getElementsByClassName(match[1]);
}
};
// release memory in IE
div = null;
})();
function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
for ( var i = 0, l = checkSet.length; i < l; i++ ) {
var elem = checkSet[i];
if ( elem ) {
var match = false;
elem = elem[dir];
while ( elem ) {
if ( elem.sizcache === doneName ) {
match = checkSet[elem.sizset];
break;
}
if ( elem.nodeType === 1 && !isXML ){
elem.sizcache = doneName;
elem.sizset = i;
}
if ( elem.nodeName.toLowerCase() === cur ) {
match = elem;
break;
}
elem = elem[dir];
}
checkSet[i] = match;
}
}
}
function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
for ( var i = 0, l = checkSet.length; i < l; i++ ) {
var elem = checkSet[i];
if ( elem ) {
var match = false;
elem = elem[dir];
while ( elem ) {
if ( elem.sizcache === doneName ) {
match = checkSet[elem.sizset];
break;
}
if ( elem.nodeType === 1 ) {
if ( !isXML ) {
elem.sizcache = doneName;
elem.sizset = i;
}
if ( typeof cur !== "string" ) {
if ( elem === cur ) {
match = true;
break;
}
} else if ( Sizzle.filter( cur, [elem] ).length > 0 ) {
match = elem;
break;
}
}
elem = elem[dir];
}
checkSet[i] = match;
}
}
}
if ( document.documentElement.contains ) {
Sizzle.contains = function( a, b ) {
return a !== b && (a.contains ? a.contains(b) : true);
};
} else if ( document.documentElement.compareDocumentPosition ) {
Sizzle.contains = function( a, b ) {
return !!(a.compareDocumentPosition(b) & 16);
};
} else {
Sizzle.contains = function() {
return false;
};
}
Sizzle.isXML = function( elem ) {
// documentElement is verified for cases where it doesn't yet exist
// (such as loading iframes in IE - #4833)
var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement;
return documentElement ? documentElement.nodeName !== "HTML" : false;
};
var posProcess = function( selector, context ) {
var match,
tmpSet = [],
later = "",
root = context.nodeType ? [context] : context;
// Position selectors must be done after the filter
// And so must :not(positional) so we move all PSEUDOs to the end
while ( (match = Expr.match.PSEUDO.exec( selector )) ) {
later += match[0];
selector = selector.replace( Expr.match.PSEUDO, "" );
}
selector = Expr.relative[selector] ? selector + "*" : selector;
for ( var i = 0, l = root.length; i < l; i++ ) {
Sizzle( selector, root[i], tmpSet );
}
return Sizzle.filter( later, tmpSet );
};
// EXPOSE
jQuery.find = Sizzle;
jQuery.expr = Sizzle.selectors;
jQuery.expr[":"] = jQuery.expr.filters;
jQuery.unique = Sizzle.uniqueSort;
jQuery.text = Sizzle.getText;
jQuery.isXMLDoc = Sizzle.isXML;
jQuery.contains = Sizzle.contains;
})();
var runtil = /Until$/,
rparentsprev = /^(?:parents|prevUntil|prevAll)/,
// Note: This RegExp should be improved, or likely pulled from Sizzle
rmultiselector = /,/,
isSimple = /^.[^:#\[\.,]*$/,
slice = Array.prototype.slice,
POS = jQuery.expr.match.POS,
// methods guaranteed to produce a unique set when starting from a unique set
guaranteedUnique = {
children: true,
contents: true,
next: true,
prev: true
};
jQuery.fn.extend({
find: function( selector ) {
var self = this,
i, l;
if ( typeof selector !== "string" ) {
return jQuery( selector ).filter(function() {
for ( i = 0, l = self.length; i < l; i++ ) {
if ( jQuery.contains( self[ i ], this ) ) {
return true;
}
}
});
}
var ret = this.pushStack( "", "find", selector ),
length, n, r;
for ( i = 0, l = this.length; i < l; i++ ) {
length = ret.length;
jQuery.find( selector, this[i], ret );
if ( i > 0 ) {
// Make sure that the results are unique
for ( n = length; n < ret.length; n++ ) {
for ( r = 0; r < length; r++ ) {
if ( ret[r] === ret[n] ) {
ret.splice(n--, 1);
break;
}
}
}
}
}
return ret;
},
has: function( target ) {
var targets = jQuery( target );
return this.filter(function() {
for ( var i = 0, l = targets.length; i < l; i++ ) {
if ( jQuery.contains( this, targets[i] ) ) {
return true;
}
}
});
},
not: function( selector ) {
return this.pushStack( winnow(this, selector, false), "not", selector);
},
filter: function( selector ) {
return this.pushStack( winnow(this, selector, true), "filter", selector );
},
is: function( selector ) {
return !!selector && ( typeof selector === "string" ?
jQuery.filter( selector, this ).length > 0 :
this.filter( selector ).length > 0 );
},
closest: function( selectors, context ) {
var ret = [], i, l, cur = this[0];
// Array
if ( jQuery.isArray( selectors ) ) {
var match, selector,
matches = {},
level = 1;
if ( cur && selectors.length ) {
for ( i = 0, l = selectors.length; i < l; i++ ) {
selector = selectors[i];
if ( !matches[ selector ] ) {
matches[ selector ] = POS.test( selector ) ?
jQuery( selector, context || this.context ) :
selector;
}
}
while ( cur && cur.ownerDocument && cur !== context ) {
for ( selector in matches ) {
match = matches[ selector ];
if ( match.jquery ? match.index( cur ) > -1 : jQuery( cur ).is( match ) ) {
ret.push({ selector: selector, elem: cur, level: level });
}
}
cur = cur.parentNode;
level++;
}
}
return ret;
}
// String
var pos = POS.test( selectors ) || typeof selectors !== "string" ?
jQuery( selectors, context || this.context ) :
0;
for ( i = 0, l = this.length; i < l; i++ ) {
cur = this[i];
while ( cur ) {
if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) {
ret.push( cur );
break;
} else {
cur = cur.parentNode;
if ( !cur || !cur.ownerDocument || cur === context || cur.nodeType === 11 ) {
break;
}
}
}
}
ret = ret.length > 1 ? jQuery.unique( ret ) : ret;
return this.pushStack( ret, "closest", selectors );
},
// Determine the position of an element within
// the matched set of elements
index: function( elem ) {
// No argument, return index in parent
if ( !elem ) {
return ( this[0] && this[0].parentNode ) ? this.prevAll().length : -1;
}
// index in selector
if ( typeof elem === "string" ) {
return jQuery.inArray( this[0], jQuery( elem ) );
}
// Locate the position of the desired element
return jQuery.inArray(
// If it receives a jQuery object, the first element is used
elem.jquery ? elem[0] : elem, this );
},
add: function( selector, context ) {
var set = typeof selector === "string" ?
jQuery( selector, context ) :
jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ),
all = jQuery.merge( this.get(), set );
return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ?
all :
jQuery.unique( all ) );
},
andSelf: function() {
return this.add( this.prevObject );
}
});
// A painfully simple check to see if an element is disconnected
// from a document (should be improved, where feasible).
function isDisconnected( node ) {
return !node || !node.parentNode || node.parentNode.nodeType === 11;
}
jQuery.each({
parent: function( elem ) {
var parent = elem.parentNode;
return parent && parent.nodeType !== 11 ? parent : null;
},
parents: function( elem ) {
return jQuery.dir( elem, "parentNode" );
},
parentsUntil: function( elem, i, until ) {
return jQuery.dir( elem, "parentNode", until );
},
next: function( elem ) {
return jQuery.nth( elem, 2, "nextSibling" );
},
prev: function( elem ) {
return jQuery.nth( elem, 2, "previousSibling" );
},
nextAll: function( elem ) {
return jQuery.dir( elem, "nextSibling" );
},
prevAll: function( elem ) {
return jQuery.dir( elem, "previousSibling" );
},
nextUntil: function( elem, i, until ) {
return jQuery.dir( elem, "nextSibling", until );
},
prevUntil: function( elem, i, until ) {
return jQuery.dir( elem, "previousSibling", until );
},
siblings: function( elem ) {
return jQuery.sibling( elem.parentNode.firstChild, elem );
},
children: function( elem ) {
return jQuery.sibling( elem.firstChild );
},
contents: function( elem ) {
return jQuery.nodeName( elem, "iframe" ) ?
elem.contentDocument || elem.contentWindow.document :
jQuery.makeArray( elem.childNodes );
}
}, function( name, fn ) {
jQuery.fn[ name ] = function( until, selector ) {
var ret = jQuery.map( this, fn, until ),
// The variable 'args' was introduced in
// https://github.com/jquery/jquery/commit/52a0238
// to work around a bug in Chrome 10 (Dev) and should be removed when the bug is fixed.
// http://code.google.com/p/v8/issues/detail?id=1050
args = slice.call(arguments);
if ( !runtil.test( name ) ) {
selector = until;
}
if ( selector && typeof selector === "string" ) {
ret = jQuery.filter( selector, ret );
}
ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret;
if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) {
ret = ret.reverse();
}
return this.pushStack( ret, name, args.join(",") );
};
});
jQuery.extend({
filter: function( expr, elems, not ) {
if ( not ) {
expr = ":not(" + expr + ")";
}
return elems.length === 1 ?
jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] :
jQuery.find.matches(expr, elems);
},
dir: function( elem, dir, until ) {
var matched = [],
cur = elem[ dir ];
while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {
if ( cur.nodeType === 1 ) {
matched.push( cur );
}
cur = cur[dir];
}
return matched;
},
nth: function( cur, result, dir, elem ) {
result = result || 1;
var num = 0;
for ( ; cur; cur = cur[dir] ) {
if ( cur.nodeType === 1 && ++num === result ) {
break;
}
}
return cur;
},
sibling: function( n, elem ) {
var r = [];
for ( ; n; n = n.nextSibling ) {
if ( n.nodeType === 1 && n !== elem ) {
r.push( n );
}
}
return r;
}
});
// Implement the identical functionality for filter and not
function winnow( elements, qualifier, keep ) {
// Can't pass null or undefined to indexOf in Firefox 4
// Set to 0 to skip string check
qualifier = qualifier || 0;
if ( jQuery.isFunction( qualifier ) ) {
return jQuery.grep(elements, function( elem, i ) {
var retVal = !!qualifier.call( elem, i, elem );
return retVal === keep;
});
} else if ( qualifier.nodeType ) {
return jQuery.grep(elements, function( elem, i ) {
return (elem === qualifier) === keep;
});
} else if ( typeof qualifier === "string" ) {
var filtered = jQuery.grep(elements, function( elem ) {
return elem.nodeType === 1;
});
if ( isSimple.test( qualifier ) ) {
return jQuery.filter(qualifier, filtered, !keep);
} else {
qualifier = jQuery.filter( qualifier, filtered );
}
}
return jQuery.grep(elements, function( elem, i ) {
return (jQuery.inArray( elem, qualifier ) >= 0) === keep;
});
}
var rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g,
rleadingWhitespace = /^\s+/,
rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,
rtagName = /<([\w:]+)/,
rtbody = /<tbody/i,
rhtml = /<|&#?\w+;/,
rnocache = /<(?:script|object|embed|option|style)/i,
// checked="checked" or checked
rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
rscriptType = /\/(java|ecma)script/i,
rcleanScript = /^\s*<!(?:\[CDATA\[|\-\-)/,
wrapMap = {
option: [ 1, "<select multiple='multiple'>", "</select>" ],
legend: [ 1, "<fieldset>", "</fieldset>" ],
thead: [ 1, "<table>", "</table>" ],
tr: [ 2, "<table><tbody>", "</tbody></table>" ],
td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],
area: [ 1, "<map>", "</map>" ],
_default: [ 0, "", "" ]
};
wrapMap.optgroup = wrapMap.option;
wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
wrapMap.th = wrapMap.td;
// IE can't serialize <link> and <script> tags normally
if ( !jQuery.support.htmlSerialize ) {
wrapMap._default = [ 1, "div<div>", "</div>" ];
}
jQuery.fn.extend({
text: function( text ) {
if ( jQuery.isFunction(text) ) {
return this.each(function(i) {
var self = jQuery( this );
self.text( text.call(this, i, self.text()) );
});
}
if ( typeof text !== "object" && text !== undefined ) {
return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) );
}
return jQuery.text( this );
},
wrapAll: function( html ) {
if ( jQuery.isFunction( html ) ) {
return this.each(function(i) {
jQuery(this).wrapAll( html.call(this, i) );
});
}
if ( this[0] ) {
// The elements to wrap the target around
var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true);
if ( this[0].parentNode ) {
wrap.insertBefore( this[0] );
}
wrap.map(function() {
var elem = this;
while ( elem.firstChild && elem.firstChild.nodeType === 1 ) {
elem = elem.firstChild;
}
return elem;
}).append( this );
}
return this;
},
wrapInner: function( html ) {
if ( jQuery.isFunction( html ) ) {
return this.each(function(i) {
jQuery(this).wrapInner( html.call(this, i) );
});
}
return this.each(function() {
var self = jQuery( this ),
contents = self.contents();
if ( contents.length ) {
contents.wrapAll( html );
} else {
self.append( html );
}
});
},
wrap: function( html ) {
return this.each(function() {
jQuery( this ).wrapAll( html );
});
},
unwrap: function() {
return this.parent().each(function() {
if ( !jQuery.nodeName( this, "body" ) ) {
jQuery( this ).replaceWith( this.childNodes );
}
}).end();
},
append: function() {
return this.domManip(arguments, true, function( elem ) {
if ( this.nodeType === 1 ) {
this.appendChild( elem );
}
});
},
prepend: function() {
return this.domManip(arguments, true, function( elem ) {
if ( this.nodeType === 1 ) {
this.insertBefore( elem, this.firstChild );
}
});
},
before: function() {
if ( this[0] && this[0].parentNode ) {
return this.domManip(arguments, false, function( elem ) {
this.parentNode.insertBefore( elem, this );
});
} else if ( arguments.length ) {
var set = jQuery(arguments[0]);
set.push.apply( set, this.toArray() );
return this.pushStack( set, "before", arguments );
}
},
after: function() {
if ( this[0] && this[0].parentNode ) {
return this.domManip(arguments, false, function( elem ) {
this.parentNode.insertBefore( elem, this.nextSibling );
});
} else if ( arguments.length ) {
var set = this.pushStack( this, "after", arguments );
set.push.apply( set, jQuery(arguments[0]).toArray() );
return set;
}
},
// keepData is for internal use only--do not document
remove: function( selector, keepData ) {
for ( var i = 0, elem; (elem = this[i]) != null; i++ ) {
if ( !selector || jQuery.filter( selector, [ elem ] ).length ) {
if ( !keepData && elem.nodeType === 1 ) {
jQuery.cleanData( elem.getElementsByTagName("*") );
jQuery.cleanData( [ elem ] );
}
if ( elem.parentNode ) {
elem.parentNode.removeChild( elem );
}
}
}
return this;
},
empty: function() {
for ( var i = 0, elem; (elem = this[i]) != null; i++ ) {
// Remove element nodes and prevent memory leaks
if ( elem.nodeType === 1 ) {
jQuery.cleanData( elem.getElementsByTagName("*") );
}
// Remove any remaining nodes
while ( elem.firstChild ) {
elem.removeChild( elem.firstChild );
}
}
return this;
},
clone: function( dataAndEvents, deepDataAndEvents ) {
dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
return this.map( function () {
return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
});
},
html: function( value ) {
if ( value === undefined ) {
return this[0] && this[0].nodeType === 1 ?
this[0].innerHTML.replace(rinlinejQuery, "") :
null;
// See if we can take a shortcut and just use innerHTML
} else if ( typeof value === "string" && !rnocache.test( value ) &&
(jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value )) &&
!wrapMap[ (rtagName.exec( value ) || ["", ""])[1].toLowerCase() ] ) {
value = value.replace(rxhtmlTag, "<$1></$2>");
try {
for ( var i = 0, l = this.length; i < l; i++ ) {
// Remove element nodes and prevent memory leaks
if ( this[i].nodeType === 1 ) {
jQuery.cleanData( this[i].getElementsByTagName("*") );
this[i].innerHTML = value;
}
}
// If using innerHTML throws an exception, use the fallback method
} catch(e) {
this.empty().append( value );
}
} else if ( jQuery.isFunction( value ) ) {
this.each(function(i){
var self = jQuery( this );
self.html( value.call(this, i, self.html()) );
});
} else {
this.empty().append( value );
}
return this;
},
replaceWith: function( value ) {
if ( this[0] && this[0].parentNode ) {
// Make sure that the elements are removed from the DOM before they are inserted
// this can help fix replacing a parent with child elements
if ( jQuery.isFunction( value ) ) {
return this.each(function(i) {
var self = jQuery(this), old = self.html();
self.replaceWith( value.call( this, i, old ) );
});
}
if ( typeof value !== "string" ) {
value = jQuery( value ).detach();
}
return this.each(function() {
var next = this.nextSibling,
parent = this.parentNode;
jQuery( this ).remove();
if ( next ) {
jQuery(next).before( value );
} else {
jQuery(parent).append( value );
}
});
} else {
return this.length ?
this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value ) :
this;
}
},
detach: function( selector ) {
return this.remove( selector, true );
},
domManip: function( args, table, callback ) {
var results, first, fragment, parent,
value = args[0],
scripts = [];
// We can't cloneNode fragments that contain checked, in WebKit
if ( !jQuery.support.checkClone && arguments.length === 3 && typeof value === "string" && rchecked.test( value ) ) {
return this.each(function() {
jQuery(this).domManip( args, table, callback, true );
});
}
if ( jQuery.isFunction(value) ) {
return this.each(function(i) {
var self = jQuery(this);
args[0] = value.call(this, i, table ? self.html() : undefined);
self.domManip( args, table, callback );
});
}
if ( this[0] ) {
parent = value && value.parentNode;
// If we're in a fragment, just use that instead of building a new one
if ( jQuery.support.parentNode && parent && parent.nodeType === 11 && parent.childNodes.length === this.length ) {
results = { fragment: parent };
} else {
results = jQuery.buildFragment( args, this, scripts );
}
fragment = results.fragment;
if ( fragment.childNodes.length === 1 ) {
first = fragment = fragment.firstChild;
} else {
first = fragment.firstChild;
}
if ( first ) {
table = table && jQuery.nodeName( first, "tr" );
for ( var i = 0, l = this.length, lastIndex = l - 1; i < l; i++ ) {
callback.call(
table ?
root(this[i], first) :
this[i],
// Make sure that we do not leak memory by inadvertently discarding
// the original fragment (which might have attached data) instead of
// using it; in addition, use the original fragment object for the last
// item instead of first because it can end up being emptied incorrectly
// in certain situations (Bug #8070).
// Fragments from the fragment cache must always be cloned and never used
// in place.
results.cacheable || (l > 1 && i < lastIndex) ?
jQuery.clone( fragment, true, true ) :
fragment
);
}
}
if ( scripts.length ) {
jQuery.each( scripts, evalScript );
}
}
return this;
}
});
function root( elem, cur ) {
return jQuery.nodeName(elem, "table") ?
(elem.getElementsByTagName("tbody")[0] ||
elem.appendChild(elem.ownerDocument.createElement("tbody"))) :
elem;
}
function cloneCopyEvent( src, dest ) {
if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) {
return;
}
var internalKey = jQuery.expando,
oldData = jQuery.data( src ),
curData = jQuery.data( dest, oldData );
// Switch to use the internal data object, if it exists, for the next
// stage of data copying
if ( (oldData = oldData[ internalKey ]) ) {
var events = oldData.events;
curData = curData[ internalKey ] = jQuery.extend({}, oldData);
if ( events ) {
delete curData.handle;
curData.events = {};
for ( var type in events ) {
for ( var i = 0, l = events[ type ].length; i < l; i++ ) {
jQuery.event.add( dest, type + ( events[ type ][ i ].namespace ? "." : "" ) + events[ type ][ i ].namespace, events[ type ][ i ], events[ type ][ i ].data );
}
}
}
}
}
function cloneFixAttributes( src, dest ) {
var nodeName;
// We do not need to do anything for non-Elements
if ( dest.nodeType !== 1 ) {
return;
}
// clearAttributes removes the attributes, which we don't want,
// but also removes the attachEvent events, which we *do* want
if ( dest.clearAttributes ) {
dest.clearAttributes();
}
// mergeAttributes, in contrast, only merges back on the
// original attributes, not the events
if ( dest.mergeAttributes ) {
dest.mergeAttributes( src );
}
nodeName = dest.nodeName.toLowerCase();
// IE6-8 fail to clone children inside object elements that use
// the proprietary classid attribute value (rather than the type
// attribute) to identify the type of content to display
if ( nodeName === "object" ) {
dest.outerHTML = src.outerHTML;
} else if ( nodeName === "input" && (src.type === "checkbox" || src.type === "radio") ) {
// IE6-8 fails to persist the checked state of a cloned checkbox
// or radio button. Worse, IE6-7 fail to give the cloned element
// a checked appearance if the defaultChecked value isn't also set
if ( src.checked ) {
dest.defaultChecked = dest.checked = src.checked;
}
// IE6-7 get confused and end up setting the value of a cloned
// checkbox/radio button to an empty string instead of "on"
if ( dest.value !== src.value ) {
dest.value = src.value;
}
// IE6-8 fails to return the selected option to the default selected
// state when cloning options
} else if ( nodeName === "option" ) {
dest.selected = src.defaultSelected;
// IE6-8 fails to set the defaultValue to the correct value when
// cloning other types of input fields
} else if ( nodeName === "input" || nodeName === "textarea" ) {
dest.defaultValue = src.defaultValue;
}
// Event data gets referenced instead of copied if the expando
// gets copied too
dest.removeAttribute( jQuery.expando );
}
jQuery.buildFragment = function( args, nodes, scripts ) {
var fragment, cacheable, cacheresults, doc;
// nodes may contain either an explicit document object,
// a jQuery collection or context object.
// If nodes[0] contains a valid object to assign to doc
if ( nodes && nodes[0] ) {
doc = nodes[0].ownerDocument || nodes[0];
}
// Ensure that an attr object doesn't incorrectly stand in as a document object
// Chrome and Firefox seem to allow this to occur and will throw exception
// Fixes #8950
if ( !doc.createDocumentFragment ) {
doc = document;
}
// Only cache "small" (1/2 KB) HTML strings that are associated with the main document
// Cloning options loses the selected state, so don't cache them
// IE 6 doesn't like it when you put <object> or <embed> elements in a fragment
// Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache
if ( args.length === 1 && typeof args[0] === "string" && args[0].length < 512 && doc === document &&
args[0].charAt(0) === "<" && !rnocache.test( args[0] ) && (jQuery.support.checkClone || !rchecked.test( args[0] )) ) {
cacheable = true;
cacheresults = jQuery.fragments[ args[0] ];
if ( cacheresults && cacheresults !== 1 ) {
fragment = cacheresults;
}
}
if ( !fragment ) {
fragment = doc.createDocumentFragment();
jQuery.clean( args, doc, fragment, scripts );
}
if ( cacheable ) {
jQuery.fragments[ args[0] ] = cacheresults ? fragment : 1;
}
return { fragment: fragment, cacheable: cacheable };
};
jQuery.fragments = {};
jQuery.each({
appendTo: "append",
prependTo: "prepend",
insertBefore: "before",
insertAfter: "after",
replaceAll: "replaceWith"
}, function( name, original ) {
jQuery.fn[ name ] = function( selector ) {
var ret = [],
insert = jQuery( selector ),
parent = this.length === 1 && this[0].parentNode;
if ( parent && parent.nodeType === 11 && parent.childNodes.length === 1 && insert.length === 1 ) {
insert[ original ]( this[0] );
return this;
} else {
for ( var i = 0, l = insert.length; i < l; i++ ) {
var elems = (i > 0 ? this.clone(true) : this).get();
jQuery( insert[i] )[ original ]( elems );
ret = ret.concat( elems );
}
return this.pushStack( ret, name, insert.selector );
}
};
});
function getAll( elem ) {
if ( "getElementsByTagName" in elem ) {
return elem.getElementsByTagName( "*" );
} else if ( "querySelectorAll" in elem ) {
return elem.querySelectorAll( "*" );
} else {
return [];
}
}
// Used in clean, fixes the defaultChecked property
function fixDefaultChecked( elem ) {
if ( elem.type === "checkbox" || elem.type === "radio" ) {
elem.defaultChecked = elem.checked;
}
}
// Finds all inputs and passes them to fixDefaultChecked
function findInputs( elem ) {
if ( jQuery.nodeName( elem, "input" ) ) {
fixDefaultChecked( elem );
} else if ( "getElementsByTagName" in elem ) {
jQuery.grep( elem.getElementsByTagName("input"), fixDefaultChecked );
}
}
jQuery.extend({
clone: function( elem, dataAndEvents, deepDataAndEvents ) {
var clone = elem.cloneNode(true),
srcElements,
destElements,
i;
if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) &&
(elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) {
// IE copies events bound via attachEvent when using cloneNode.
// Calling detachEvent on the clone will also remove the events
// from the original. In order to get around this, we use some
// proprietary methods to clear the events. Thanks to MooTools
// guys for this hotness.
cloneFixAttributes( elem, clone );
// Using Sizzle here is crazy slow, so we use getElementsByTagName
// instead
srcElements = getAll( elem );
destElements = getAll( clone );
// Weird iteration because IE will replace the length property
// with an element if you are cloning the body and one of the
// elements on the page has a name or id of "length"
for ( i = 0; srcElements[i]; ++i ) {
// Ensure that the destination node is not null; Fixes #9587
if ( destElements[i] ) {
cloneFixAttributes( srcElements[i], destElements[i] );
}
}
}
// Copy the events from the original to the clone
if ( dataAndEvents ) {
cloneCopyEvent( elem, clone );
if ( deepDataAndEvents ) {
srcElements = getAll( elem );
destElements = getAll( clone );
for ( i = 0; srcElements[i]; ++i ) {
cloneCopyEvent( srcElements[i], destElements[i] );
}
}
}
srcElements = destElements = null;
// Return the cloned set
return clone;
},
clean: function( elems, context, fragment, scripts ) {
var checkScriptType;
context = context || document;
// !context.createElement fails in IE with an error but returns typeof 'object'
if ( typeof context.createElement === "undefined" ) {
context = context.ownerDocument || context[0] && context[0].ownerDocument || document;
}
var ret = [], j;
for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
if ( typeof elem === "number" ) {
elem += "";
}
if ( !elem ) {
continue;
}
// Convert html string into DOM nodes
if ( typeof elem === "string" ) {
if ( !rhtml.test( elem ) ) {
elem = context.createTextNode( elem );
} else {
// Fix "XHTML"-style tags in all browsers
elem = elem.replace(rxhtmlTag, "<$1></$2>");
// Trim whitespace, otherwise indexOf won't work as expected
var tag = (rtagName.exec( elem ) || ["", ""])[1].toLowerCase(),
wrap = wrapMap[ tag ] || wrapMap._default,
depth = wrap[0],
div = context.createElement("div");
// Go to html and back, then peel off extra wrappers
div.innerHTML = wrap[1] + elem + wrap[2];
// Move to the right depth
while ( depth-- ) {
div = div.lastChild;
}
// Remove IE's autoinserted <tbody> from table fragments
if ( !jQuery.support.tbody ) {
// String was a <table>, *may* have spurious <tbody>
var hasBody = rtbody.test(elem),
tbody = tag === "table" && !hasBody ?
div.firstChild && div.firstChild.childNodes :
// String was a bare <thead> or <tfoot>
wrap[1] === "<table>" && !hasBody ?
div.childNodes :
[];
for ( j = tbody.length - 1; j >= 0 ; --j ) {
if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) {
tbody[ j ].parentNode.removeChild( tbody[ j ] );
}
}
}
// IE completely kills leading whitespace when innerHTML is used
if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {
div.insertBefore( context.createTextNode( rleadingWhitespace.exec(elem)[0] ), div.firstChild );
}
elem = div.childNodes;
}
}
// Resets defaultChecked for any radios and checkboxes
// about to be appended to the DOM in IE 6/7 (#8060)
var len;
if ( !jQuery.support.appendChecked ) {
if ( elem[0] && typeof (len = elem.length) === "number" ) {
for ( j = 0; j < len; j++ ) {
findInputs( elem[j] );
}
} else {
findInputs( elem );
}
}
if ( elem.nodeType ) {
ret.push( elem );
} else {
ret = jQuery.merge( ret, elem );
}
}
if ( fragment ) {
checkScriptType = function( elem ) {
return !elem.type || rscriptType.test( elem.type );
};
for ( i = 0; ret[i]; i++ ) {
if ( scripts && jQuery.nodeName( ret[i], "script" ) && (!ret[i].type || ret[i].type.toLowerCase() === "text/javascript") ) {
scripts.push( ret[i].parentNode ? ret[i].parentNode.removeChild( ret[i] ) : ret[i] );
} else {
if ( ret[i].nodeType === 1 ) {
var jsTags = jQuery.grep( ret[i].getElementsByTagName( "script" ), checkScriptType );
ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) );
}
fragment.appendChild( ret[i] );
}
}
}
return ret;
},
cleanData: function( elems ) {
var data, id, cache = jQuery.cache, internalKey = jQuery.expando, special = jQuery.event.special,
deleteExpando = jQuery.support.deleteExpando;
for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) {
continue;
}
id = elem[ jQuery.expando ];
if ( id ) {
data = cache[ id ] && cache[ id ][ internalKey ];
if ( data && data.events ) {
for ( var type in data.events ) {
if ( special[ type ] ) {
jQuery.event.remove( elem, type );
// This is a shortcut to avoid jQuery.event.remove's overhead
} else {
jQuery.removeEvent( elem, type, data.handle );
}
}
// Null the DOM reference to avoid IE6/7/8 leak (#7054)
if ( data.handle ) {
data.handle.elem = null;
}
}
if ( deleteExpando ) {
delete elem[ jQuery.expando ];
} else if ( elem.removeAttribute ) {
elem.removeAttribute( jQuery.expando );
}
delete cache[ id ];
}
}
}
});
function evalScript( i, elem ) {
if ( elem.src ) {
jQuery.ajax({
url: elem.src,
async: false,
dataType: "script"
});
} else {
jQuery.globalEval( ( elem.text || elem.textContent || elem.innerHTML || "" ).replace( rcleanScript, "/*$0*/" ) );
}
if ( elem.parentNode ) {
elem.parentNode.removeChild( elem );
}
}
var ralpha = /alpha\([^)]*\)/i,
ropacity = /opacity=([^)]*)/,
// fixed for IE9, see #8346
rupper = /([A-Z]|^ms)/g,
rnumpx = /^-?\d+(?:px)?$/i,
rnum = /^-?\d/,
rrelNum = /^([\-+])=([\-+.\de]+)/,
cssShow = { position: "absolute", visibility: "hidden", display: "block" },
cssWidth = [ "Left", "Right" ],
cssHeight = [ "Top", "Bottom" ],
curCSS,
getComputedStyle,
currentStyle;
jQuery.fn.css = function( name, value ) {
// Setting 'undefined' is a no-op
if ( arguments.length === 2 && value === undefined ) {
return this;
}
return jQuery.access( this, name, value, true, function( elem, name, value ) {
return value !== undefined ?
jQuery.style( elem, name, value ) :
jQuery.css( elem, name );
});
};
jQuery.extend({
// Add in style property hooks for overriding the default
// behavior of getting and setting a style property
cssHooks: {
opacity: {
get: function( elem, computed ) {
if ( computed ) {
// We should always get a number back from opacity
var ret = curCSS( elem, "opacity", "opacity" );
return ret === "" ? "1" : ret;
} else {
return elem.style.opacity;
}
}
}
},
// Exclude the following css properties to add px
cssNumber: {
"fillOpacity": true,
"fontWeight": true,
"lineHeight": true,
"opacity": true,
"orphans": true,
"widows": true,
"zIndex": true,
"zoom": true
},
// Add in properties whose names you wish to fix before
// setting or getting the value
cssProps: {
// normalize float css property
"float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat"
},
// Get and set the style property on a DOM Node
style: function( elem, name, value, extra ) {
// Don't set styles on text and comment nodes
if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
return;
}
// Make sure that we're working with the right name
var ret, type, origName = jQuery.camelCase( name ),
style = elem.style, hooks = jQuery.cssHooks[ origName ];
name = jQuery.cssProps[ origName ] || origName;
// Check if we're setting a value
if ( value !== undefined ) {
type = typeof value;
// convert relative number strings (+= or -=) to relative numbers. #7345
if ( type === "string" && (ret = rrelNum.exec( value )) ) {
value = ( +( ret[1] + 1) * +ret[2] ) + parseFloat( jQuery.css( elem, name ) );
// Fixes bug #9237
type = "number";
}
// Make sure that NaN and null values aren't set. See: #7116
if ( value == null || type === "number" && isNaN( value ) ) {
return;
}
// If a number was passed in, add 'px' to the (except for certain CSS properties)
if ( type === "number" && !jQuery.cssNumber[ origName ] ) {
value += "px";
}
// If a hook was provided, use that value, otherwise just set the specified value
if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value )) !== undefined ) {
// Wrapped to prevent IE from throwing errors when 'invalid' values are provided
// Fixes bug #5509
try {
style[ name ] = value;
} catch(e) {}
}
} else {
// If a hook was provided get the non-computed value from there
if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {
return ret;
}
// Otherwise just get the value from the style object
return style[ name ];
}
},
css: function( elem, name, extra ) {
var ret, hooks;
// Make sure that we're working with the right name
name = jQuery.camelCase( name );
hooks = jQuery.cssHooks[ name ];
name = jQuery.cssProps[ name ] || name;
// cssFloat needs a special treatment
if ( name === "cssFloat" ) {
name = "float";
}
// If a hook was provided get the computed value from there
if ( hooks && "get" in hooks && (ret = hooks.get( elem, true, extra )) !== undefined ) {
return ret;
// Otherwise, if a way to get the computed value exists, use that
} else if ( curCSS ) {
return curCSS( elem, name );
}
},
// A method for quickly swapping in/out CSS properties to get correct calculations
swap: function( elem, options, callback ) {
var old = {};
// Remember the old values, and insert the new ones
for ( var name in options ) {
old[ name ] = elem.style[ name ];
elem.style[ name ] = options[ name ];
}
callback.call( elem );
// Revert the old values
for ( name in options ) {
elem.style[ name ] = old[ name ];
}
}
});
// DEPRECATED, Use jQuery.css() instead
jQuery.curCSS = jQuery.css;
jQuery.each(["height", "width"], function( i, name ) {
jQuery.cssHooks[ name ] = {
get: function( elem, computed, extra ) {
var val;
if ( computed ) {
if ( elem.offsetWidth !== 0 ) {
return getWH( elem, name, extra );
} else {
jQuery.swap( elem, cssShow, function() {
val = getWH( elem, name, extra );
});
}
return val;
}
},
set: function( elem, value ) {
if ( rnumpx.test( value ) ) {
// ignore negative width and height values #1599
value = parseFloat( value );
if ( value >= 0 ) {
return value + "px";
}
} else {
return value;
}
}
};
});
if ( !jQuery.support.opacity ) {
jQuery.cssHooks.opacity = {
get: function( elem, computed ) {
// IE uses filters for opacity
return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ?
( parseFloat( RegExp.$1 ) / 100 ) + "" :
computed ? "1" : "";
},
set: function( elem, value ) {
var style = elem.style,
currentStyle = elem.currentStyle,
opacity = jQuery.isNaN( value ) ? "" : "alpha(opacity=" + value * 100 + ")",
filter = currentStyle && currentStyle.filter || style.filter || "";
// IE has trouble with opacity if it does not have layout
// Force it by setting the zoom level
style.zoom = 1;
// if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652
if ( value >= 1 && jQuery.trim( filter.replace( ralpha, "" ) ) === "" ) {
// Setting style.filter to null, "" & " " still leave "filter:" in the cssText
// if "filter:" is present at all, clearType is disabled, we want to avoid this
// style.removeAttribute is IE Only, but so apparently is this code path...
style.removeAttribute( "filter" );
// if there there is no filter style applied in a css rule, we are done
if ( currentStyle && !currentStyle.filter ) {
return;
}
}
// otherwise, set new filter values
style.filter = ralpha.test( filter ) ?
filter.replace( ralpha, opacity ) :
filter + " " + opacity;
}
};
}
jQuery(function() {
// This hook cannot be added until DOM ready because the support test
// for it is not run until after DOM ready
if ( !jQuery.support.reliableMarginRight ) {
jQuery.cssHooks.marginRight = {
get: function( elem, computed ) {
// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
// Work around by temporarily setting element display to inline-block
var ret;
jQuery.swap( elem, { "display": "inline-block" }, function() {
if ( computed ) {
ret = curCSS( elem, "margin-right", "marginRight" );
} else {
ret = elem.style.marginRight;
}
});
return ret;
}
};
}
});
if ( document.defaultView && document.defaultView.getComputedStyle ) {
getComputedStyle = function( elem, name ) {
var ret, defaultView, computedStyle;
name = name.replace( rupper, "-$1" ).toLowerCase();
if ( !(defaultView = elem.ownerDocument.defaultView) ) {
return undefined;
}
if ( (computedStyle = defaultView.getComputedStyle( elem, null )) ) {
ret = computedStyle.getPropertyValue( name );
if ( ret === "" && !jQuery.contains( elem.ownerDocument.documentElement, elem ) ) {
ret = jQuery.style( elem, name );
}
}
return ret;
};
}
if ( document.documentElement.currentStyle ) {
currentStyle = function( elem, name ) {
var left,
ret = elem.currentStyle && elem.currentStyle[ name ],
rsLeft = elem.runtimeStyle && elem.runtimeStyle[ name ],
style = elem.style;
// From the awesome hack by Dean Edwards
// http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
// If we're not dealing with a regular pixel number
// but a number that has a weird ending, we need to convert it to pixels
if ( !rnumpx.test( ret ) && rnum.test( ret ) ) {
// Remember the original values
left = style.left;
// Put in the new values to get a computed value out
if ( rsLeft ) {
elem.runtimeStyle.left = elem.currentStyle.left;
}
style.left = name === "fontSize" ? "1em" : (ret || 0);
ret = style.pixelLeft + "px";
// Revert the changed values
style.left = left;
if ( rsLeft ) {
elem.runtimeStyle.left = rsLeft;
}
}
return ret === "" ? "auto" : ret;
};
}
curCSS = getComputedStyle || currentStyle;
function getWH( elem, name, extra ) {
// Start with offset property
var val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
which = name === "width" ? cssWidth : cssHeight;
if ( val > 0 ) {
if ( extra !== "border" ) {
jQuery.each( which, function() {
if ( !extra ) {
val -= parseFloat( jQuery.css( elem, "padding" + this ) ) || 0;
}
if ( extra === "margin" ) {
val += parseFloat( jQuery.css( elem, extra + this ) ) || 0;
} else {
val -= parseFloat( jQuery.css( elem, "border" + this + "Width" ) ) || 0;
}
});
}
return val + "px";
}
// Fall back to computed then uncomputed css if necessary
val = curCSS( elem, name, name );
if ( val < 0 || val == null ) {
val = elem.style[ name ] || 0;
}
// Normalize "", auto, and prepare for extra
val = parseFloat( val ) || 0;
// Add padding, border, margin
if ( extra ) {
jQuery.each( which, function() {
val += parseFloat( jQuery.css( elem, "padding" + this ) ) || 0;
if ( extra !== "padding" ) {
val += parseFloat( jQuery.css( elem, "border" + this + "Width" ) ) || 0;
}
if ( extra === "margin" ) {
val += parseFloat( jQuery.css( elem, extra + this ) ) || 0;
}
});
}
return val + "px";
}
if ( jQuery.expr && jQuery.expr.filters ) {
jQuery.expr.filters.hidden = function( elem ) {
var width = elem.offsetWidth,
height = elem.offsetHeight;
return (width === 0 && height === 0) || (!jQuery.support.reliableHiddenOffsets && (elem.style.display || jQuery.css( elem, "display" )) === "none");
};
jQuery.expr.filters.visible = function( elem ) {
return !jQuery.expr.filters.hidden( elem );
};
}
var r20 = /%20/g,
rbracket = /\[\]$/,
rCRLF = /\r?\n/g,
rhash = /#.*$/,
rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL
rinput = /^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,
// #7653, #8125, #8152: local protocol detection
rlocalProtocol = /^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,
rnoContent = /^(?:GET|HEAD)$/,
rprotocol = /^\/\//,
rquery = /\?/,
rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
rselectTextarea = /^(?:select|textarea)/i,
rspacesAjax = /\s+/,
rts = /([?&])_=[^&]*/,
rurl = /^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,
// Keep a copy of the old load method
_load = jQuery.fn.load,
/* Prefilters
* 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
* 2) These are called:
* - BEFORE asking for a transport
* - AFTER param serialization (s.data is a string if s.processData is true)
* 3) key is the dataType
* 4) the catchall symbol "*" can be used
* 5) execution will start with transport dataType and THEN continue down to "*" if needed
*/
prefilters = {},
/* Transports bindings
* 1) key is the dataType
* 2) the catchall symbol "*" can be used
* 3) selection will start with transport dataType and THEN go to "*" if needed
*/
transports = {},
// Document location
ajaxLocation,
// Document location segments
ajaxLocParts,
// Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
allTypes = ["*/"] + ["*"];
// #8138, IE may throw an exception when accessing
// a field from window.location if document.domain has been set
try {
ajaxLocation = location.href;
} catch( e ) {
// Use the href attribute of an A element
// since IE will modify it given document.location
ajaxLocation = document.createElement( "a" );
ajaxLocation.href = "";
ajaxLocation = ajaxLocation.href;
}
// Segment location into parts
ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];
// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
function addToPrefiltersOrTransports( structure ) {
// dataTypeExpression is optional and defaults to "*"
return function( dataTypeExpression, func ) {
if ( typeof dataTypeExpression !== "string" ) {
func = dataTypeExpression;
dataTypeExpression = "*";
}
if ( jQuery.isFunction( func ) ) {
var dataTypes = dataTypeExpression.toLowerCase().split( rspacesAjax ),
i = 0,
length = dataTypes.length,
dataType,
list,
placeBefore;
// For each dataType in the dataTypeExpression
for(; i < length; i++ ) {
dataType = dataTypes[ i ];
// We control if we're asked to add before
// any existing element
placeBefore = /^\+/.test( dataType );
if ( placeBefore ) {
dataType = dataType.substr( 1 ) || "*";
}
list = structure[ dataType ] = structure[ dataType ] || [];
// then we add to the structure accordingly
list[ placeBefore ? "unshift" : "push" ]( func );
}
}
};
}
// Base inspection function for prefilters and transports
function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR,
dataType /* internal */, inspected /* internal */ ) {
dataType = dataType || options.dataTypes[ 0 ];
inspected = inspected || {};
inspected[ dataType ] = true;
var list = structure[ dataType ],
i = 0,
length = list ? list.length : 0,
executeOnly = ( structure === prefilters ),
selection;
for(; i < length && ( executeOnly || !selection ); i++ ) {
selection = list[ i ]( options, originalOptions, jqXHR );
// If we got redirected to another dataType
// we try there if executing only and not done already
if ( typeof selection === "string" ) {
if ( !executeOnly || inspected[ selection ] ) {
selection = undefined;
} else {
options.dataTypes.unshift( selection );
selection = inspectPrefiltersOrTransports(
structure, options, originalOptions, jqXHR, selection, inspected );
}
}
}
// If we're only executing or nothing was selected
// we try the catchall dataType if not done already
if ( ( executeOnly || !selection ) && !inspected[ "*" ] ) {
selection = inspectPrefiltersOrTransports(
structure, options, originalOptions, jqXHR, "*", inspected );
}
// unnecessary when only executing (prefilters)
// but it'll be ignored by the caller in that case
return selection;
}
// A special extend for ajax options
// that takes "flat" options (not to be deep extended)
// Fixes #9887
function ajaxExtend( target, src ) {
var key, deep,
flatOptions = jQuery.ajaxSettings.flatOptions || {};
for( key in src ) {
if ( src[ key ] !== undefined ) {
( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
}
}
if ( deep ) {
jQuery.extend( true, target, deep );
}
}
jQuery.fn.extend({
load: function( url, params, callback ) {
if ( typeof url !== "string" && _load ) {
return _load.apply( this, arguments );
// Don't do a request if no elements are being requested
} else if ( !this.length ) {
return this;
}
var off = url.indexOf( " " );
if ( off >= 0 ) {
var selector = url.slice( off, url.length );
url = url.slice( 0, off );
}
// Default to a GET request
var type = "GET";
// If the second parameter was provided
if ( params ) {
// If it's a function
if ( jQuery.isFunction( params ) ) {
// We assume that it's the callback
callback = params;
params = undefined;
// Otherwise, build a param string
} else if ( typeof params === "object" ) {
params = jQuery.param( params, jQuery.ajaxSettings.traditional );
type = "POST";
}
}
var self = this;
// Request the remote document
jQuery.ajax({
url: url,
type: type,
dataType: "html",
data: params,
// Complete callback (responseText is used internally)
complete: function( jqXHR, status, responseText ) {
// Store the response as specified by the jqXHR object
responseText = jqXHR.responseText;
// If successful, inject the HTML into all the matched elements
if ( jqXHR.isResolved() ) {
// #4825: Get the actual response in case
// a dataFilter is present in ajaxSettings
jqXHR.done(function( r ) {
responseText = r;
});
// See if a selector was specified
self.html( selector ?
// Create a dummy div to hold the results
jQuery("<div>")
// inject the contents of the document in, removing the scripts
// to avoid any 'Permission Denied' errors in IE
.append(responseText.replace(rscript, ""))
// Locate the specified elements
.find(selector) :
// If not, just inject the full result
responseText );
}
if ( callback ) {
self.each( callback, [ responseText, status, jqXHR ] );
}
}
});
return this;
},
serialize: function() {
return jQuery.param( this.serializeArray() );
},
serializeArray: function() {
return this.map(function(){
return this.elements ? jQuery.makeArray( this.elements ) : this;
})
.filter(function(){
return this.name && !this.disabled &&
( this.checked || rselectTextarea.test( this.nodeName ) ||
rinput.test( this.type ) );
})
.map(function( i, elem ){
var val = jQuery( this ).val();
return val == null ?
null :
jQuery.isArray( val ) ?
jQuery.map( val, function( val, i ){
return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
}) :
{ name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
}).get();
}
});
// Attach a bunch of functions for handling common AJAX events
jQuery.each( "ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split( " " ), function( i, o ){
jQuery.fn[ o ] = function( f ){
return this.bind( o, f );
};
});
jQuery.each( [ "get", "post" ], function( i, method ) {
jQuery[ method ] = function( url, data, callback, type ) {
// shift arguments if data argument was omitted
if ( jQuery.isFunction( data ) ) {
type = type || callback;
callback = data;
data = undefined;
}
return jQuery.ajax({
type: method,
url: url,
data: data,
success: callback,
dataType: type
});
};
});
jQuery.extend({
getScript: function( url, callback ) {
return jQuery.get( url, undefined, callback, "script" );
},
getJSON: function( url, data, callback ) {
return jQuery.get( url, data, callback, "json" );
},
// Creates a full fledged settings object into target
// with both ajaxSettings and settings fields.
// If target is omitted, writes into ajaxSettings.
ajaxSetup: function( target, settings ) {
if ( settings ) {
// Building a settings object
ajaxExtend( target, jQuery.ajaxSettings );
} else {
// Extending ajaxSettings
settings = target;
target = jQuery.ajaxSettings;
}
ajaxExtend( target, settings );
return target;
},
ajaxSettings: {
url: ajaxLocation,
isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),
global: true,
type: "GET",
contentType: "application/x-www-form-urlencoded",
processData: true,
async: true,
/*
timeout: 0,
data: null,
dataType: null,
username: null,
password: null,
cache: null,
traditional: false,
headers: {},
*/
accepts: {
xml: "application/xml, text/xml",
html: "text/html",
text: "text/plain",
json: "application/json, text/javascript",
"*": allTypes
},
contents: {
xml: /xml/,
html: /html/,
json: /json/
},
responseFields: {
xml: "responseXML",
text: "responseText"
},
// List of data converters
// 1) key format is "source_type destination_type" (a single space in-between)
// 2) the catchall symbol "*" can be used for source_type
converters: {
// Convert anything to text
"* text": window.String,
// Text to html (true = no transformation)
"text html": true,
// Evaluate text as a json expression
"text json": jQuery.parseJSON,
// Parse text as xml
"text xml": jQuery.parseXML
},
// For options that shouldn't be deep extended:
// you can add your own custom options here if
// and when you create one that shouldn't be
// deep extended (see ajaxExtend)
flatOptions: {
context: true,
url: true
}
},
ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
ajaxTransport: addToPrefiltersOrTransports( transports ),
// Main method
ajax: function( url, options ) {
// If url is an object, simulate pre-1.5 signature
if ( typeof url === "object" ) {
options = url;
url = undefined;
}
// Force options to be an object
options = options || {};
var // Create the final options object
s = jQuery.ajaxSetup( {}, options ),
// Callbacks context
callbackContext = s.context || s,
// Context for global events
// It's the callbackContext if one was provided in the options
// and if it's a DOM node or a jQuery collection
globalEventContext = callbackContext !== s &&
( callbackContext.nodeType || callbackContext instanceof jQuery ) ?
jQuery( callbackContext ) : jQuery.event,
// Deferreds
deferred = jQuery.Deferred(),
completeDeferred = jQuery._Deferred(),
// Status-dependent callbacks
statusCode = s.statusCode || {},
// ifModified key
ifModifiedKey,
// Headers (they are sent all at once)
requestHeaders = {},
requestHeadersNames = {},
// Response headers
responseHeadersString,
responseHeaders,
// transport
transport,
// timeout handle
timeoutTimer,
// Cross-domain detection vars
parts,
// The jqXHR state
state = 0,
// To know if global events are to be dispatched
fireGlobals,
// Loop variable
i,
// Fake xhr
jqXHR = {
readyState: 0,
// Caches the header
setRequestHeader: function( name, value ) {
if ( !state ) {
var lname = name.toLowerCase();
name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;
requestHeaders[ name ] = value;
}
return this;
},
// Raw string
getAllResponseHeaders: function() {
return state === 2 ? responseHeadersString : null;
},
// Builds headers hashtable if needed
getResponseHeader: function( key ) {
var match;
if ( state === 2 ) {
if ( !responseHeaders ) {
responseHeaders = {};
while( ( match = rheaders.exec( responseHeadersString ) ) ) {
responseHeaders[ match[1].toLowerCase() ] = match[ 2 ];
}
}
match = responseHeaders[ key.toLowerCase() ];
}
return match === undefined ? null : match;
},
// Overrides response content-type header
overrideMimeType: function( type ) {
if ( !state ) {
s.mimeType = type;
}
return this;
},
// Cancel the request
abort: function( statusText ) {
statusText = statusText || "abort";
if ( transport ) {
transport.abort( statusText );
}
done( 0, statusText );
return this;
}
};
// Callback for when everything is done
// It is defined here because jslint complains if it is declared
// at the end of the function (which would be more logical and readable)
function done( status, nativeStatusText, responses, headers ) {
// Called once
if ( state === 2 ) {
return;
}
// State is "done" now
state = 2;
// Clear timeout if it exists
if ( timeoutTimer ) {
clearTimeout( timeoutTimer );
}
// Dereference transport for early garbage collection
// (no matter how long the jqXHR object will be used)
transport = undefined;
// Cache response headers
responseHeadersString = headers || "";
// Set readyState
jqXHR.readyState = status > 0 ? 4 : 0;
var isSuccess,
success,
error,
statusText = nativeStatusText,
response = responses ? ajaxHandleResponses( s, jqXHR, responses ) : undefined,
lastModified,
etag;
// If successful, handle type chaining
if ( status >= 200 && status < 300 || status === 304 ) {
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
if ( s.ifModified ) {
if ( ( lastModified = jqXHR.getResponseHeader( "Last-Modified" ) ) ) {
jQuery.lastModified[ ifModifiedKey ] = lastModified;
}
if ( ( etag = jqXHR.getResponseHeader( "Etag" ) ) ) {
jQuery.etag[ ifModifiedKey ] = etag;
}
}
// If not modified
if ( status === 304 ) {
statusText = "notmodified";
isSuccess = true;
// If we have data
} else {
try {
success = ajaxConvert( s, response );
statusText = "success";
isSuccess = true;
} catch(e) {
// We have a parsererror
statusText = "parsererror";
error = e;
}
}
} else {
// We extract error from statusText
// then normalize statusText and status for non-aborts
error = statusText;
if( !statusText || status ) {
statusText = "error";
if ( status < 0 ) {
status = 0;
}
}
}
// Set data for the fake xhr object
jqXHR.status = status;
jqXHR.statusText = "" + ( nativeStatusText || statusText );
// Success/Error
if ( isSuccess ) {
deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
} else {
deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
}
// Status-dependent callbacks
jqXHR.statusCode( statusCode );
statusCode = undefined;
if ( fireGlobals ) {
globalEventContext.trigger( "ajax" + ( isSuccess ? "Success" : "Error" ),
[ jqXHR, s, isSuccess ? success : error ] );
}
// Complete
completeDeferred.resolveWith( callbackContext, [ jqXHR, statusText ] );
if ( fireGlobals ) {
globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
// Handle the global AJAX counter
if ( !( --jQuery.active ) ) {
jQuery.event.trigger( "ajaxStop" );
}
}
}
// Attach deferreds
deferred.promise( jqXHR );
jqXHR.success = jqXHR.done;
jqXHR.error = jqXHR.fail;
jqXHR.complete = completeDeferred.done;
// Status-dependent callbacks
jqXHR.statusCode = function( map ) {
if ( map ) {
var tmp;
if ( state < 2 ) {
for( tmp in map ) {
statusCode[ tmp ] = [ statusCode[tmp], map[tmp] ];
}
} else {
tmp = map[ jqXHR.status ];
jqXHR.then( tmp, tmp );
}
}
return this;
};
// Remove hash character (#7531: and string promotion)
// Add protocol if not provided (#5866: IE7 issue with protocol-less urls)
// We also use the url parameter if available
s.url = ( ( url || s.url ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
// Extract dataTypes list
s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().split( rspacesAjax );
// Determine if a cross-domain request is in order
if ( s.crossDomain == null ) {
parts = rurl.exec( s.url.toLowerCase() );
s.crossDomain = !!( parts &&
( parts[ 1 ] != ajaxLocParts[ 1 ] || parts[ 2 ] != ajaxLocParts[ 2 ] ||
( parts[ 3 ] || ( parts[ 1 ] === "http:" ? 80 : 443 ) ) !=
( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) ) )
);
}
// Convert data if not already a string
if ( s.data && s.processData && typeof s.data !== "string" ) {
s.data = jQuery.param( s.data, s.traditional );
}
// Apply prefilters
inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
// If request was aborted inside a prefiler, stop there
if ( state === 2 ) {
return false;
}
// We can fire global events as of now if asked to
fireGlobals = s.global;
// Uppercase the type
s.type = s.type.toUpperCase();
// Determine if request has content
s.hasContent = !rnoContent.test( s.type );
// Watch for a new set of requests
if ( fireGlobals && jQuery.active++ === 0 ) {
jQuery.event.trigger( "ajaxStart" );
}
// More options handling for requests with no content
if ( !s.hasContent ) {
// If data is available, append data to url
if ( s.data ) {
s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.data;
// #9682: remove data so that it's not used in an eventual retry
delete s.data;
}
// Get ifModifiedKey before adding the anti-cache parameter
ifModifiedKey = s.url;
// Add anti-cache in url if needed
if ( s.cache === false ) {
var ts = jQuery.now(),
// try replacing _= if it is there
ret = s.url.replace( rts, "$1_=" + ts );
// if nothing was replaced, add timestamp to the end
s.url = ret + ( (ret === s.url ) ? ( rquery.test( s.url ) ? "&" : "?" ) + "_=" + ts : "" );
}
}
// Set the correct header, if data is being sent
if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
jqXHR.setRequestHeader( "Content-Type", s.contentType );
}
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
if ( s.ifModified ) {
ifModifiedKey = ifModifiedKey || s.url;
if ( jQuery.lastModified[ ifModifiedKey ] ) {
jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ ifModifiedKey ] );
}
if ( jQuery.etag[ ifModifiedKey ] ) {
jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ ifModifiedKey ] );
}
}
// Set the Accepts header for the server, depending on the dataType
jqXHR.setRequestHeader(
"Accept",
s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?
s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
s.accepts[ "*" ]
);
// Check for headers option
for ( i in s.headers ) {
jqXHR.setRequestHeader( i, s.headers[ i ] );
}
// Allow custom headers/mimetypes and early abort
if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
// Abort if not done already
jqXHR.abort();
return false;
}
// Install callbacks on deferreds
for ( i in { success: 1, error: 1, complete: 1 } ) {
jqXHR[ i ]( s[ i ] );
}
// Get transport
transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
// If no transport, we auto-abort
if ( !transport ) {
done( -1, "No Transport" );
} else {
jqXHR.readyState = 1;
// Send global event
if ( fireGlobals ) {
globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
}
// Timeout
if ( s.async && s.timeout > 0 ) {
timeoutTimer = setTimeout( function(){
jqXHR.abort( "timeout" );
}, s.timeout );
}
try {
state = 1;
transport.send( requestHeaders, done );
} catch (e) {
// Propagate exception as error if not done
if ( state < 2 ) {
done( -1, e );
// Simply rethrow otherwise
} else {
jQuery.error( e );
}
}
}
return jqXHR;
},
// Serialize an array of form elements or a set of
// key/values into a query string
param: function( a, traditional ) {
var s = [],
add = function( key, value ) {
// If value is a function, invoke it and return its value
value = jQuery.isFunction( value ) ? value() : value;
s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
};
// Set traditional to true for jQuery <= 1.3.2 behavior.
if ( traditional === undefined ) {
traditional = jQuery.ajaxSettings.traditional;
}
// If an array was passed in, assume that it is an array of form elements.
if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
// Serialize the form elements
jQuery.each( a, function() {
add( this.name, this.value );
});
} else {
// If traditional, encode the "old" way (the way 1.3.2 or older
// did it), otherwise encode params recursively.
for ( var prefix in a ) {
buildParams( prefix, a[ prefix ], traditional, add );
}
}
// Return the resulting serialization
return s.join( "&" ).replace( r20, "+" );
}
});
function buildParams( prefix, obj, traditional, add ) {
if ( jQuery.isArray( obj ) ) {
// Serialize array item.
jQuery.each( obj, function( i, v ) {
if ( traditional || rbracket.test( prefix ) ) {
// Treat each array item as a scalar.
add( prefix, v );
} else {
// If array item is non-scalar (array or object), encode its
// numeric index to resolve deserialization ambiguity issues.
// Note that rack (as of 1.0.0) can't currently deserialize
// nested arrays properly, and attempting to do so may cause
// a server error. Possible fixes are to modify rack's
// deserialization algorithm or to provide an option or flag
// to force array serialization to be shallow.
buildParams( prefix + "[" + ( typeof v === "object" || jQuery.isArray(v) ? i : "" ) + "]", v, traditional, add );
}
});
} else if ( !traditional && obj != null && typeof obj === "object" ) {
// Serialize object item.
for ( var name in obj ) {
buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
}
} else {
// Serialize scalar item.
add( prefix, obj );
}
}
// This is still on the jQuery object... for now
// Want to move this to jQuery.ajax some day
jQuery.extend({
// Counter for holding the number of active queries
active: 0,
// Last-Modified header cache for next request
lastModified: {},
etag: {}
});
/* Handles responses to an ajax request:
* - sets all responseXXX fields accordingly
* - finds the right dataType (mediates between content-type and expected dataType)
* - returns the corresponding response
*/
function ajaxHandleResponses( s, jqXHR, responses ) {
var contents = s.contents,
dataTypes = s.dataTypes,
responseFields = s.responseFields,
ct,
type,
finalDataType,
firstDataType;
// Fill responseXXX fields
for( type in responseFields ) {
if ( type in responses ) {
jqXHR[ responseFields[type] ] = responses[ type ];
}
}
// Remove auto dataType and get content-type in the process
while( dataTypes[ 0 ] === "*" ) {
dataTypes.shift();
if ( ct === undefined ) {
ct = s.mimeType || jqXHR.getResponseHeader( "content-type" );
}
}
// Check if we're dealing with a known content-type
if ( ct ) {
for ( type in contents ) {
if ( contents[ type ] && contents[ type ].test( ct ) ) {
dataTypes.unshift( type );
break;
}
}
}
// Check to see if we have a response for the expected dataType
if ( dataTypes[ 0 ] in responses ) {
finalDataType = dataTypes[ 0 ];
} else {
// Try convertible dataTypes
for ( type in responses ) {
if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) {
finalDataType = type;
break;
}
if ( !firstDataType ) {
firstDataType = type;
}
}
// Or just use first one
finalDataType = finalDataType || firstDataType;
}
// If we found a dataType
// We add the dataType to the list if needed
// and return the corresponding response
if ( finalDataType ) {
if ( finalDataType !== dataTypes[ 0 ] ) {
dataTypes.unshift( finalDataType );
}
return responses[ finalDataType ];
}
}
// Chain conversions given the request and the original response
function ajaxConvert( s, response ) {
// Apply the dataFilter if provided
if ( s.dataFilter ) {
response = s.dataFilter( response, s.dataType );
}
var dataTypes = s.dataTypes,
converters = {},
i,
key,
length = dataTypes.length,
tmp,
// Current and previous dataTypes
current = dataTypes[ 0 ],
prev,
// Conversion expression
conversion,
// Conversion function
conv,
// Conversion functions (transitive conversion)
conv1,
conv2;
// For each dataType in the chain
for( i = 1; i < length; i++ ) {
// Create converters map
// with lowercased keys
if ( i === 1 ) {
for( key in s.converters ) {
if( typeof key === "string" ) {
converters[ key.toLowerCase() ] = s.converters[ key ];
}
}
}
// Get the dataTypes
prev = current;
current = dataTypes[ i ];
// If current is auto dataType, update it to prev
if( current === "*" ) {
current = prev;
// If no auto and dataTypes are actually different
} else if ( prev !== "*" && prev !== current ) {
// Get the converter
conversion = prev + " " + current;
conv = converters[ conversion ] || converters[ "* " + current ];
// If there is no direct converter, search transitively
if ( !conv ) {
conv2 = undefined;
for( conv1 in converters ) {
tmp = conv1.split( " " );
if ( tmp[ 0 ] === prev || tmp[ 0 ] === "*" ) {
conv2 = converters[ tmp[1] + " " + current ];
if ( conv2 ) {
conv1 = converters[ conv1 ];
if ( conv1 === true ) {
conv = conv2;
} else if ( conv2 === true ) {
conv = conv1;
}
break;
}
}
}
}
// If we found no converter, dispatch an error
if ( !( conv || conv2 ) ) {
jQuery.error( "No conversion from " + conversion.replace(" "," to ") );
}
// If found converter is not an equivalence
if ( conv !== true ) {
// Convert with 1 or 2 converters accordingly
response = conv ? conv( response ) : conv2( conv1(response) );
}
}
}
return response;
}
var jsc = jQuery.now(),
jsre = /(\=)\?(&|$)|\?\?/i;
// Default jsonp settings
jQuery.ajaxSetup({
jsonp: "callback",
jsonpCallback: function() {
return jQuery.expando + "_" + ( jsc++ );
}
});
// Detect, normalize options and install callbacks for jsonp requests
jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
var inspectData = s.contentType === "application/x-www-form-urlencoded" &&
( typeof s.data === "string" );
if ( s.dataTypes[ 0 ] === "jsonp" ||
s.jsonp !== false && ( jsre.test( s.url ) ||
inspectData && jsre.test( s.data ) ) ) {
var responseContainer,
jsonpCallback = s.jsonpCallback =
jQuery.isFunction( s.jsonpCallback ) ? s.jsonpCallback() : s.jsonpCallback,
previous = window[ jsonpCallback ],
url = s.url,
data = s.data,
replace = "$1" + jsonpCallback + "$2";
if ( s.jsonp !== false ) {
url = url.replace( jsre, replace );
if ( s.url === url ) {
if ( inspectData ) {
data = data.replace( jsre, replace );
}
if ( s.data === data ) {
// Add callback manually
url += (/\?/.test( url ) ? "&" : "?") + s.jsonp + "=" + jsonpCallback;
}
}
}
s.url = url;
s.data = data;
// Install callback
window[ jsonpCallback ] = function( response ) {
responseContainer = [ response ];
};
// Clean-up function
jqXHR.always(function() {
// Set callback back to previous value
window[ jsonpCallback ] = previous;
// Call if it was a function and we have a response
if ( responseContainer && jQuery.isFunction( previous ) ) {
window[ jsonpCallback ]( responseContainer[ 0 ] );
}
});
// Use data converter to retrieve json after script execution
s.converters["script json"] = function() {
if ( !responseContainer ) {
jQuery.error( jsonpCallback + " was not called" );
}
return responseContainer[ 0 ];
};
// force json dataType
s.dataTypes[ 0 ] = "json";
// Delegate to script
return "script";
}
});
// Install script dataType
jQuery.ajaxSetup({
accepts: {
script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
},
contents: {
script: /javascript|ecmascript/
},
converters: {
"text script": function( text ) {
jQuery.globalEval( text );
return text;
}
}
});
// Handle cache's special case and global
jQuery.ajaxPrefilter( "script", function( s ) {
if ( s.cache === undefined ) {
s.cache = false;
}
if ( s.crossDomain ) {
s.type = "GET";
s.global = false;
}
});
// Bind script tag hack transport
jQuery.ajaxTransport( "script", function(s) {
// This transport only deals with cross domain requests
if ( s.crossDomain ) {
var script,
head = document.head || document.getElementsByTagName( "head" )[0] || document.documentElement;
return {
send: function( _, callback ) {
script = document.createElement( "script" );
script.async = "async";
if ( s.scriptCharset ) {
script.charset = s.scriptCharset;
}
script.src = s.url;
// Attach handlers for all browsers
script.onload = script.onreadystatechange = function( _, isAbort ) {
if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) {
// Handle memory leak in IE
script.onload = script.onreadystatechange = null;
// Remove the script
if ( head && script.parentNode ) {
head.removeChild( script );
}
// Dereference the script
script = undefined;
// Callback if not abort
if ( !isAbort ) {
callback( 200, "success" );
}
}
};
// Use insertBefore instead of appendChild to circumvent an IE6 bug.
// This arises when a base node is used (#2709 and #4378).
head.insertBefore( script, head.firstChild );
},
abort: function() {
if ( script ) {
script.onload( 0, 1 );
}
}
};
}
});
var // #5280: Internet Explorer will keep connections alive if we don't abort on unload
xhrOnUnloadAbort = window.ActiveXObject ? function() {
// Abort all pending requests
for ( var key in xhrCallbacks ) {
xhrCallbacks[ key ]( 0, 1 );
}
} : false,
xhrId = 0,
xhrCallbacks;
// Functions to create xhrs
function createStandardXHR() {
try {
return new window.XMLHttpRequest();
} catch( e ) {}
}
function createActiveXHR() {
try {
return new window.ActiveXObject( "Microsoft.XMLHTTP" );
} catch( e ) {}
}
// Create the request object
// (This is still attached to ajaxSettings for backward compatibility)
jQuery.ajaxSettings.xhr = window.ActiveXObject ?
/* Microsoft failed to properly
* implement the XMLHttpRequest in IE7 (can't request local files),
* so we use the ActiveXObject when it is available
* Additionally XMLHttpRequest can be disabled in IE7/IE8 so
* we need a fallback.
*/
function() {
return !this.isLocal && createStandardXHR() || createActiveXHR();
} :
// For all other browsers, use the standard XMLHttpRequest object
createStandardXHR;
// Determine support properties
(function( xhr ) {
jQuery.extend( jQuery.support, {
ajax: !!xhr,
cors: !!xhr && ( "withCredentials" in xhr )
});
})( jQuery.ajaxSettings.xhr() );
// Create transport if the browser can provide an xhr
if ( jQuery.support.ajax ) {
jQuery.ajaxTransport(function( s ) {
// Cross domain only allowed if supported through XMLHttpRequest
if ( !s.crossDomain || jQuery.support.cors ) {
var callback;
return {
send: function( headers, complete ) {
// Get a new xhr
var xhr = s.xhr(),
handle,
i;
// Open the socket
// Passing null username, generates a login popup on Opera (#2865)
if ( s.username ) {
xhr.open( s.type, s.url, s.async, s.username, s.password );
} else {
xhr.open( s.type, s.url, s.async );
}
// Apply custom fields if provided
if ( s.xhrFields ) {
for ( i in s.xhrFields ) {
xhr[ i ] = s.xhrFields[ i ];
}
}
// Override mime type if needed
if ( s.mimeType && xhr.overrideMimeType ) {
xhr.overrideMimeType( s.mimeType );
}
// X-Requested-With header
// For cross-domain requests, seeing as conditions for a preflight are
// akin to a jigsaw puzzle, we simply never set it to be sure.
// (it can always be set on a per-request basis or even using ajaxSetup)
// For same-domain requests, won't change header if already provided.
if ( !s.crossDomain && !headers["X-Requested-With"] ) {
headers[ "X-Requested-With" ] = "XMLHttpRequest";
}
// Need an extra try/catch for cross domain requests in Firefox 3
try {
for ( i in headers ) {
xhr.setRequestHeader( i, headers[ i ] );
}
} catch( _ ) {}
// Do send the request
// This may raise an exception which is actually
// handled in jQuery.ajax (so no try/catch here)
xhr.send( ( s.hasContent && s.data ) || null );
// Listener
callback = function( _, isAbort ) {
var status,
statusText,
responseHeaders,
responses,
xml;
// Firefox throws exceptions when accessing properties
// of an xhr when a network error occured
// http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE)
try {
// Was never called and is aborted or complete
if ( callback && ( isAbort || xhr.readyState === 4 ) ) {
// Only called once
callback = undefined;
// Do not keep as active anymore
if ( handle ) {
xhr.onreadystatechange = jQuery.noop;
if ( xhrOnUnloadAbort ) {
delete xhrCallbacks[ handle ];
}
}
// If it's an abort
if ( isAbort ) {
// Abort it manually if needed
if ( xhr.readyState !== 4 ) {
xhr.abort();
}
} else {
status = xhr.status;
responseHeaders = xhr.getAllResponseHeaders();
responses = {};
xml = xhr.responseXML;
// Construct response list
if ( xml && xml.documentElement /* #4958 */ ) {
responses.xml = xml;
}
responses.text = xhr.responseText;
// Firefox throws an exception when accessing
// statusText for faulty cross-domain requests
try {
statusText = xhr.statusText;
} catch( e ) {
// We normalize with Webkit giving an empty statusText
statusText = "";
}
// Filter status for non standard behaviors
// If the request is local and we have data: assume a success
// (success with no data won't get notified, that's the best we
// can do given current implementations)
if ( !status && s.isLocal && !s.crossDomain ) {
status = responses.text ? 200 : 404;
// IE - #1450: sometimes returns 1223 when it should be 204
} else if ( status === 1223 ) {
status = 204;
}
}
}
} catch( firefoxAccessException ) {
if ( !isAbort ) {
complete( -1, firefoxAccessException );
}
}
// Call complete if needed
if ( responses ) {
complete( status, statusText, responses, responseHeaders );
}
};
// if we're in sync mode or it's in cache
// and has been retrieved directly (IE6 & IE7)
// we need to manually fire the callback
if ( !s.async || xhr.readyState === 4 ) {
callback();
} else {
handle = ++xhrId;
if ( xhrOnUnloadAbort ) {
// Create the active xhrs callbacks list if needed
// and attach the unload handler
if ( !xhrCallbacks ) {
xhrCallbacks = {};
jQuery( window ).unload( xhrOnUnloadAbort );
}
// Add to list of active xhrs callbacks
xhrCallbacks[ handle ] = callback;
}
xhr.onreadystatechange = callback;
}
},
abort: function() {
if ( callback ) {
callback(0,1);
}
}
};
}
});
}
var elemdisplay = {},
iframe, iframeDoc,
rfxtypes = /^(?:toggle|show|hide)$/,
rfxnum = /^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,
timerId,
fxAttrs = [
// height animations
[ "height", "marginTop", "marginBottom", "paddingTop", "paddingBottom" ],
// width animations
[ "width", "marginLeft", "marginRight", "paddingLeft", "paddingRight" ],
// opacity animations
[ "opacity" ]
],
fxNow;
jQuery.fn.extend({
show: function( speed, easing, callback ) {
var elem, display;
if ( speed || speed === 0 ) {
return this.animate( genFx("show", 3), speed, easing, callback);
} else {
for ( var i = 0, j = this.length; i < j; i++ ) {
elem = this[i];
if ( elem.style ) {
display = elem.style.display;
// Reset the inline display of this element to learn if it is
// being hidden by cascaded rules or not
if ( !jQuery._data(elem, "olddisplay") && display === "none" ) {
display = elem.style.display = "";
}
// Set elements which have been overridden with display: none
// in a stylesheet to whatever the default browser style is
// for such an element
if ( display === "" && jQuery.css( elem, "display" ) === "none" ) {
jQuery._data(elem, "olddisplay", defaultDisplay(elem.nodeName));
}
}
}
// Set the display of most of the elements in a second loop
// to avoid the constant reflow
for ( i = 0; i < j; i++ ) {
elem = this[i];
if ( elem.style ) {
display = elem.style.display;
if ( display === "" || display === "none" ) {
elem.style.display = jQuery._data(elem, "olddisplay") || "";
}
}
}
return this;
}
},
hide: function( speed, easing, callback ) {
if ( speed || speed === 0 ) {
return this.animate( genFx("hide", 3), speed, easing, callback);
} else {
for ( var i = 0, j = this.length; i < j; i++ ) {
if ( this[i].style ) {
var display = jQuery.css( this[i], "display" );
if ( display !== "none" && !jQuery._data( this[i], "olddisplay" ) ) {
jQuery._data( this[i], "olddisplay", display );
}
}
}
// Set the display of the elements in a second loop
// to avoid the constant reflow
for ( i = 0; i < j; i++ ) {
if ( this[i].style ) {
this[i].style.display = "none";
}
}
return this;
}
},
// Save the old toggle function
_toggle: jQuery.fn.toggle,
toggle: function( fn, fn2, callback ) {
var bool = typeof fn === "boolean";
if ( jQuery.isFunction(fn) && jQuery.isFunction(fn2) ) {
this._toggle.apply( this, arguments );
} else if ( fn == null || bool ) {
this.each(function() {
var state = bool ? fn : jQuery(this).is(":hidden");
jQuery(this)[ state ? "show" : "hide" ]();
});
} else {
this.animate(genFx("toggle", 3), fn, fn2, callback);
}
return this;
},
fadeTo: function( speed, to, easing, callback ) {
return this.filter(":hidden").css("opacity", 0).show().end()
.animate({opacity: to}, speed, easing, callback);
},
animate: function( prop, speed, easing, callback ) {
var optall = jQuery.speed(speed, easing, callback);
if ( jQuery.isEmptyObject( prop ) ) {
return this.each( optall.complete, [ false ] );
}
// Do not change referenced properties as per-property easing will be lost
prop = jQuery.extend( {}, prop );
return this[ optall.queue === false ? "each" : "queue" ](function() {
// XXX 'this' does not always have a nodeName when running the
// test suite
if ( optall.queue === false ) {
jQuery._mark( this );
}
var opt = jQuery.extend( {}, optall ),
isElement = this.nodeType === 1,
hidden = isElement && jQuery(this).is(":hidden"),
name, val, p,
display, e,
parts, start, end, unit;
// will store per property easing and be used to determine when an animation is complete
opt.animatedProperties = {};
for ( p in prop ) {
// property name normalization
name = jQuery.camelCase( p );
if ( p !== name ) {
prop[ name ] = prop[ p ];
delete prop[ p ];
}
val = prop[ name ];
// easing resolution: per property > opt.specialEasing > opt.easing > 'swing' (default)
if ( jQuery.isArray( val ) ) {
opt.animatedProperties[ name ] = val[ 1 ];
val = prop[ name ] = val[ 0 ];
} else {
opt.animatedProperties[ name ] = opt.specialEasing && opt.specialEasing[ name ] || opt.easing || 'swing';
}
if ( val === "hide" && hidden || val === "show" && !hidden ) {
return opt.complete.call( this );
}
if ( isElement && ( name === "height" || name === "width" ) ) {
// Make sure that nothing sneaks out
// Record all 3 overflow attributes because IE does not
// change the overflow attribute when overflowX and
// overflowY are set to the same value
opt.overflow = [ this.style.overflow, this.style.overflowX, this.style.overflowY ];
// Set display property to inline-block for height/width
// animations on inline elements that are having width/height
// animated
if ( jQuery.css( this, "display" ) === "inline" &&
jQuery.css( this, "float" ) === "none" ) {
if ( !jQuery.support.inlineBlockNeedsLayout ) {
this.style.display = "inline-block";
} else {
display = defaultDisplay( this.nodeName );
// inline-level elements accept inline-block;
// block-level elements need to be inline with layout
if ( display === "inline" ) {
this.style.display = "inline-block";
} else {
this.style.display = "inline";
this.style.zoom = 1;
}
}
}
}
}
if ( opt.overflow != null ) {
this.style.overflow = "hidden";
}
for ( p in prop ) {
e = new jQuery.fx( this, opt, p );
val = prop[ p ];
if ( rfxtypes.test(val) ) {
e[ val === "toggle" ? hidden ? "show" : "hide" : val ]();
} else {
parts = rfxnum.exec( val );
start = e.cur();
if ( parts ) {
end = parseFloat( parts[2] );
unit = parts[3] || ( jQuery.cssNumber[ p ] ? "" : "px" );
// We need to compute starting value
if ( unit !== "px" ) {
jQuery.style( this, p, (end || 1) + unit);
start = ((end || 1) / e.cur()) * start;
jQuery.style( this, p, start + unit);
}
// If a +=/-= token was provided, we're doing a relative animation
if ( parts[1] ) {
end = ( (parts[ 1 ] === "-=" ? -1 : 1) * end ) + start;
}
e.custom( start, end, unit );
} else {
e.custom( start, val, "" );
}
}
}
// For JS strict compliance
return true;
});
},
stop: function( clearQueue, gotoEnd ) {
if ( clearQueue ) {
this.queue([]);
}
this.each(function() {
var timers = jQuery.timers,
i = timers.length;
// clear marker counters if we know they won't be
if ( !gotoEnd ) {
jQuery._unmark( true, this );
}
while ( i-- ) {
if ( timers[i].elem === this ) {
if (gotoEnd) {
// force the next step to be the last
timers[i](true);
}
timers.splice(i, 1);
}
}
});
// start the next in the queue if the last step wasn't forced
if ( !gotoEnd ) {
this.dequeue();
}
return this;
}
});
// Animations created synchronously will run synchronously
function createFxNow() {
setTimeout( clearFxNow, 0 );
return ( fxNow = jQuery.now() );
}
function clearFxNow() {
fxNow = undefined;
}
// Generate parameters to create a standard animation
function genFx( type, num ) {
var obj = {};
jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice(0,num)), function() {
obj[ this ] = type;
});
return obj;
}
// Generate shortcuts for custom animations
jQuery.each({
slideDown: genFx("show", 1),
slideUp: genFx("hide", 1),
slideToggle: genFx("toggle", 1),
fadeIn: { opacity: "show" },
fadeOut: { opacity: "hide" },
fadeToggle: { opacity: "toggle" }
}, function( name, props ) {
jQuery.fn[ name ] = function( speed, easing, callback ) {
return this.animate( props, speed, easing, callback );
};
});
jQuery.extend({
speed: function( speed, easing, fn ) {
var opt = speed && typeof speed === "object" ? jQuery.extend({}, speed) : {
complete: fn || !fn && easing ||
jQuery.isFunction( speed ) && speed,
duration: speed,
easing: fn && easing || easing && !jQuery.isFunction(easing) && easing
};
opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[opt.duration] : jQuery.fx.speeds._default;
// Queueing
opt.old = opt.complete;
opt.complete = function( noUnmark ) {
if ( jQuery.isFunction( opt.old ) ) {
opt.old.call( this );
}
if ( opt.queue !== false ) {
jQuery.dequeue( this );
} else if ( noUnmark !== false ) {
jQuery._unmark( this );
}
};
return opt;
},
easing: {
linear: function( p, n, firstNum, diff ) {
return firstNum + diff * p;
},
swing: function( p, n, firstNum, diff ) {
return ((-Math.cos(p*Math.PI)/2) + 0.5) * diff + firstNum;
}
},
timers: [],
fx: function( elem, options, prop ) {
this.options = options;
this.elem = elem;
this.prop = prop;
options.orig = options.orig || {};
}
});
jQuery.fx.prototype = {
// Simple function for setting a style value
update: function() {
if ( this.options.step ) {
this.options.step.call( this.elem, this.now, this );
}
(jQuery.fx.step[this.prop] || jQuery.fx.step._default)( this );
},
// Get the current size
cur: function() {
if ( this.elem[this.prop] != null && (!this.elem.style || this.elem.style[this.prop] == null) ) {
return this.elem[ this.prop ];
}
var parsed,
r = jQuery.css( this.elem, this.prop );
// Empty strings, null, undefined and "auto" are converted to 0,
// complex values such as "rotate(1rad)" are returned as is,
// simple values such as "10px" are parsed to Float.
return isNaN( parsed = parseFloat( r ) ) ? !r || r === "auto" ? 0 : r : parsed;
},
// Start an animation from one number to another
custom: function( from, to, unit ) {
var self = this,
fx = jQuery.fx;
this.startTime = fxNow || createFxNow();
this.start = from;
this.end = to;
this.unit = unit || this.unit || ( jQuery.cssNumber[ this.prop ] ? "" : "px" );
this.now = this.start;
this.pos = this.state = 0;
function t( gotoEnd ) {
return self.step(gotoEnd);
}
t.elem = this.elem;
if ( t() && jQuery.timers.push(t) && !timerId ) {
timerId = setInterval( fx.tick, fx.interval );
}
},
// Simple 'show' function
show: function() {
// Remember where we started, so that we can go back to it later
this.options.orig[this.prop] = jQuery.style( this.elem, this.prop );
this.options.show = true;
// Begin the animation
// Make sure that we start at a small width/height to avoid any
// flash of content
this.custom(this.prop === "width" || this.prop === "height" ? 1 : 0, this.cur());
// Start by showing the element
jQuery( this.elem ).show();
},
// Simple 'hide' function
hide: function() {
// Remember where we started, so that we can go back to it later
this.options.orig[this.prop] = jQuery.style( this.elem, this.prop );
this.options.hide = true;
// Begin the animation
this.custom(this.cur(), 0);
},
// Each step of an animation
step: function( gotoEnd ) {
var t = fxNow || createFxNow(),
done = true,
elem = this.elem,
options = this.options,
i, n;
if ( gotoEnd || t >= options.duration + this.startTime ) {
this.now = this.end;
this.pos = this.state = 1;
this.update();
options.animatedProperties[ this.prop ] = true;
for ( i in options.animatedProperties ) {
if ( options.animatedProperties[i] !== true ) {
done = false;
}
}
if ( done ) {
// Reset the overflow
if ( options.overflow != null && !jQuery.support.shrinkWrapBlocks ) {
jQuery.each( [ "", "X", "Y" ], function (index, value) {
elem.style[ "overflow" + value ] = options.overflow[index];
});
}
// Hide the element if the "hide" operation was done
if ( options.hide ) {
jQuery(elem).hide();
}
// Reset the properties, if the item has been hidden or shown
if ( options.hide || options.show ) {
for ( var p in options.animatedProperties ) {
jQuery.style( elem, p, options.orig[p] );
}
}
// Execute the complete function
options.complete.call( elem );
}
return false;
} else {
// classical easing cannot be used with an Infinity duration
if ( options.duration == Infinity ) {
this.now = t;
} else {
n = t - this.startTime;
this.state = n / options.duration;
// Perform the easing function, defaults to swing
this.pos = jQuery.easing[ options.animatedProperties[ this.prop ] ]( this.state, n, 0, 1, options.duration );
this.now = this.start + ((this.end - this.start) * this.pos);
}
// Perform the next step of the animation
this.update();
}
return true;
}
};
jQuery.extend( jQuery.fx, {
tick: function() {
for ( var timers = jQuery.timers, i = 0 ; i < timers.length ; ++i ) {
if ( !timers[i]() ) {
timers.splice(i--, 1);
}
}
if ( !timers.length ) {
jQuery.fx.stop();
}
},
interval: 13,
stop: function() {
clearInterval( timerId );
timerId = null;
},
speeds: {
slow: 600,
fast: 200,
// Default speed
_default: 400
},
step: {
opacity: function( fx ) {
jQuery.style( fx.elem, "opacity", fx.now );
},
_default: function( fx ) {
if ( fx.elem.style && fx.elem.style[ fx.prop ] != null ) {
fx.elem.style[ fx.prop ] = (fx.prop === "width" || fx.prop === "height" ? Math.max(0, fx.now) : fx.now) + fx.unit;
} else {
fx.elem[ fx.prop ] = fx.now;
}
}
}
});
if ( jQuery.expr && jQuery.expr.filters ) {
jQuery.expr.filters.animated = function( elem ) {
return jQuery.grep(jQuery.timers, function( fn ) {
return elem === fn.elem;
}).length;
};
}
// Try to restore the default display value of an element
function defaultDisplay( nodeName ) {
if ( !elemdisplay[ nodeName ] ) {
var body = document.body,
elem = jQuery( "<" + nodeName + ">" ).appendTo( body ),
display = elem.css( "display" );
elem.remove();
// If the simple way fails,
// get element's real default display by attaching it to a temp iframe
if ( display === "none" || display === "" ) {
// No iframe to use yet, so create it
if ( !iframe ) {
iframe = document.createElement( "iframe" );
iframe.frameBorder = iframe.width = iframe.height = 0;
}
body.appendChild( iframe );
// Create a cacheable copy of the iframe document on first call.
// IE and Opera will allow us to reuse the iframeDoc without re-writing the fake HTML
// document to it; WebKit & Firefox won't allow reusing the iframe document.
if ( !iframeDoc || !iframe.createElement ) {
iframeDoc = ( iframe.contentWindow || iframe.contentDocument ).document;
iframeDoc.write( ( document.compatMode === "CSS1Compat" ? "<!doctype html>" : "" ) + "<html><body>" );
iframeDoc.close();
}
elem = iframeDoc.createElement( nodeName );
iframeDoc.body.appendChild( elem );
display = jQuery.css( elem, "display" );
body.removeChild( iframe );
}
// Store the correct default display
elemdisplay[ nodeName ] = display;
}
return elemdisplay[ nodeName ];
}
var rtable = /^t(?:able|d|h)$/i,
rroot = /^(?:body|html)$/i;
if ( "getBoundingClientRect" in document.documentElement ) {
jQuery.fn.offset = function( options ) {
var elem = this[0], box;
if ( options ) {
return this.each(function( i ) {
jQuery.offset.setOffset( this, options, i );
});
}
if ( !elem || !elem.ownerDocument ) {
return null;
}
if ( elem === elem.ownerDocument.body ) {
return jQuery.offset.bodyOffset( elem );
}
try {
box = elem.getBoundingClientRect();
} catch(e) {}
var doc = elem.ownerDocument,
docElem = doc.documentElement;
// Make sure we're not dealing with a disconnected DOM node
if ( !box || !jQuery.contains( docElem, elem ) ) {
return box ? { top: box.top, left: box.left } : { top: 0, left: 0 };
}
var body = doc.body,
win = getWindow(doc),
clientTop = docElem.clientTop || body.clientTop || 0,
clientLeft = docElem.clientLeft || body.clientLeft || 0,
scrollTop = win.pageYOffset || jQuery.support.boxModel && docElem.scrollTop || body.scrollTop,
scrollLeft = win.pageXOffset || jQuery.support.boxModel && docElem.scrollLeft || body.scrollLeft,
top = box.top + scrollTop - clientTop,
left = box.left + scrollLeft - clientLeft;
return { top: top, left: left };
};
} else {
jQuery.fn.offset = function( options ) {
var elem = this[0];
if ( options ) {
return this.each(function( i ) {
jQuery.offset.setOffset( this, options, i );
});
}
if ( !elem || !elem.ownerDocument ) {
return null;
}
if ( elem === elem.ownerDocument.body ) {
return jQuery.offset.bodyOffset( elem );
}
jQuery.offset.initialize();
var computedStyle,
offsetParent = elem.offsetParent,
prevOffsetParent = elem,
doc = elem.ownerDocument,
docElem = doc.documentElement,
body = doc.body,
defaultView = doc.defaultView,
prevComputedStyle = defaultView ? defaultView.getComputedStyle( elem, null ) : elem.currentStyle,
top = elem.offsetTop,
left = elem.offsetLeft;
while ( (elem = elem.parentNode) && elem !== body && elem !== docElem ) {
if ( jQuery.offset.supportsFixedPosition && prevComputedStyle.position === "fixed" ) {
break;
}
computedStyle = defaultView ? defaultView.getComputedStyle(elem, null) : elem.currentStyle;
top -= elem.scrollTop;
left -= elem.scrollLeft;
if ( elem === offsetParent ) {
top += elem.offsetTop;
left += elem.offsetLeft;
if ( jQuery.offset.doesNotAddBorder && !(jQuery.offset.doesAddBorderForTableAndCells && rtable.test(elem.nodeName)) ) {
top += parseFloat( computedStyle.borderTopWidth ) || 0;
left += parseFloat( computedStyle.borderLeftWidth ) || 0;
}
prevOffsetParent = offsetParent;
offsetParent = elem.offsetParent;
}
if ( jQuery.offset.subtractsBorderForOverflowNotVisible && computedStyle.overflow !== "visible" ) {
top += parseFloat( computedStyle.borderTopWidth ) || 0;
left += parseFloat( computedStyle.borderLeftWidth ) || 0;
}
prevComputedStyle = computedStyle;
}
if ( prevComputedStyle.position === "relative" || prevComputedStyle.position === "static" ) {
top += body.offsetTop;
left += body.offsetLeft;
}
if ( jQuery.offset.supportsFixedPosition && prevComputedStyle.position === "fixed" ) {
top += Math.max( docElem.scrollTop, body.scrollTop );
left += Math.max( docElem.scrollLeft, body.scrollLeft );
}
return { top: top, left: left };
};
}
jQuery.offset = {
initialize: function() {
var body = document.body, container = document.createElement("div"), innerDiv, checkDiv, table, td, bodyMarginTop = parseFloat( jQuery.css(body, "marginTop") ) || 0,
html = "<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";
jQuery.extend( container.style, { position: "absolute", top: 0, left: 0, margin: 0, border: 0, width: "1px", height: "1px", visibility: "hidden" } );
container.innerHTML = html;
body.insertBefore( container, body.firstChild );
innerDiv = container.firstChild;
checkDiv = innerDiv.firstChild;
td = innerDiv.nextSibling.firstChild.firstChild;
this.doesNotAddBorder = (checkDiv.offsetTop !== 5);
this.doesAddBorderForTableAndCells = (td.offsetTop === 5);
checkDiv.style.position = "fixed";
checkDiv.style.top = "20px";
// safari subtracts parent border width here which is 5px
this.supportsFixedPosition = (checkDiv.offsetTop === 20 || checkDiv.offsetTop === 15);
checkDiv.style.position = checkDiv.style.top = "";
innerDiv.style.overflow = "hidden";
innerDiv.style.position = "relative";
this.subtractsBorderForOverflowNotVisible = (checkDiv.offsetTop === -5);
this.doesNotIncludeMarginInBodyOffset = (body.offsetTop !== bodyMarginTop);
body.removeChild( container );
jQuery.offset.initialize = jQuery.noop;
},
bodyOffset: function( body ) {
var top = body.offsetTop,
left = body.offsetLeft;
jQuery.offset.initialize();
if ( jQuery.offset.doesNotIncludeMarginInBodyOffset ) {
top += parseFloat( jQuery.css(body, "marginTop") ) || 0;
left += parseFloat( jQuery.css(body, "marginLeft") ) || 0;
}
return { top: top, left: left };
},
setOffset: function( elem, options, i ) {
var position = jQuery.css( elem, "position" );
// set position first, in-case top/left are set even on static elem
if ( position === "static" ) {
elem.style.position = "relative";
}
var curElem = jQuery( elem ),
curOffset = curElem.offset(),
curCSSTop = jQuery.css( elem, "top" ),
curCSSLeft = jQuery.css( elem, "left" ),
calculatePosition = (position === "absolute" || position === "fixed") && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1,
props = {}, curPosition = {}, curTop, curLeft;
// need to be able to calculate position if either top or left is auto and position is either absolute or fixed
if ( calculatePosition ) {
curPosition = curElem.position();
curTop = curPosition.top;
curLeft = curPosition.left;
} else {
curTop = parseFloat( curCSSTop ) || 0;
curLeft = parseFloat( curCSSLeft ) || 0;
}
if ( jQuery.isFunction( options ) ) {
options = options.call( elem, i, curOffset );
}
if (options.top != null) {
props.top = (options.top - curOffset.top) + curTop;
}
if (options.left != null) {
props.left = (options.left - curOffset.left) + curLeft;
}
if ( "using" in options ) {
options.using.call( elem, props );
} else {
curElem.css( props );
}
}
};
jQuery.fn.extend({
position: function() {
if ( !this[0] ) {
return null;
}
var elem = this[0],
// Get *real* offsetParent
offsetParent = this.offsetParent(),
// Get correct offsets
offset = this.offset(),
parentOffset = rroot.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset();
// Subtract element margins
// note: when an element has margin: auto the offsetLeft and marginLeft
// are the same in Safari causing offset.left to incorrectly be 0
offset.top -= parseFloat( jQuery.css(elem, "marginTop") ) || 0;
offset.left -= parseFloat( jQuery.css(elem, "marginLeft") ) || 0;
// Add offsetParent borders
parentOffset.top += parseFloat( jQuery.css(offsetParent[0], "borderTopWidth") ) || 0;
parentOffset.left += parseFloat( jQuery.css(offsetParent[0], "borderLeftWidth") ) || 0;
// Subtract the two offsets
return {
top: offset.top - parentOffset.top,
left: offset.left - parentOffset.left
};
},
offsetParent: function() {
return this.map(function() {
var offsetParent = this.offsetParent || document.body;
while ( offsetParent && (!rroot.test(offsetParent.nodeName) && jQuery.css(offsetParent, "position") === "static") ) {
offsetParent = offsetParent.offsetParent;
}
return offsetParent;
});
}
});
// Create scrollLeft and scrollTop methods
jQuery.each( ["Left", "Top"], function( i, name ) {
var method = "scroll" + name;
jQuery.fn[ method ] = function( val ) {
var elem, win;
if ( val === undefined ) {
elem = this[ 0 ];
if ( !elem ) {
return null;
}
win = getWindow( elem );
// Return the scroll offset
return win ? ("pageXOffset" in win) ? win[ i ? "pageYOffset" : "pageXOffset" ] :
jQuery.support.boxModel && win.document.documentElement[ method ] ||
win.document.body[ method ] :
elem[ method ];
}
// Set the scroll offset
return this.each(function() {
win = getWindow( this );
if ( win ) {
win.scrollTo(
!i ? val : jQuery( win ).scrollLeft(),
i ? val : jQuery( win ).scrollTop()
);
} else {
this[ method ] = val;
}
});
};
});
function getWindow( elem ) {
return jQuery.isWindow( elem ) ?
elem :
elem.nodeType === 9 ?
elem.defaultView || elem.parentWindow :
false;
}
// Create width, height, innerHeight, innerWidth, outerHeight and outerWidth methods
jQuery.each([ "Height", "Width" ], function( i, name ) {
var type = name.toLowerCase();
// innerHeight and innerWidth
jQuery.fn[ "inner" + name ] = function() {
var elem = this[0];
return elem && elem.style ?
parseFloat( jQuery.css( elem, type, "padding" ) ) :
null;
};
// outerHeight and outerWidth
jQuery.fn[ "outer" + name ] = function( margin ) {
var elem = this[0];
return elem && elem.style ?
parseFloat( jQuery.css( elem, type, margin ? "margin" : "border" ) ) :
null;
};
jQuery.fn[ type ] = function( size ) {
// Get window width or height
var elem = this[0];
if ( !elem ) {
return size == null ? null : this;
}
if ( jQuery.isFunction( size ) ) {
return this.each(function( i ) {
var self = jQuery( this );
self[ type ]( size.call( this, i, self[ type ]() ) );
});
}
if ( jQuery.isWindow( elem ) ) {
// Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode
// 3rd condition allows Nokia support, as it supports the docElem prop but not CSS1Compat
var docElemProp = elem.document.documentElement[ "client" + name ],
body = elem.document.body;
return elem.document.compatMode === "CSS1Compat" && docElemProp ||
body && body[ "client" + name ] || docElemProp;
// Get document width or height
} else if ( elem.nodeType === 9 ) {
// Either scroll[Width/Height] or offset[Width/Height], whichever is greater
return Math.max(
elem.documentElement["client" + name],
elem.body["scroll" + name], elem.documentElement["scroll" + name],
elem.body["offset" + name], elem.documentElement["offset" + name]
);
// Get or set width or height on the element
} else if ( size === undefined ) {
var orig = jQuery.css( elem, type ),
ret = parseFloat( orig );
return jQuery.isNaN( ret ) ? orig : ret;
// Set the width or height on the element (default to pixels if value is unitless)
} else {
return this.css( type, typeof size === "string" ? size : size + "px" );
}
};
});
// Expose jQuery to the global object
window.jQuery = window.$ = jQuery;
})(window); |
app/containers/App/index.js | bhefty/react-redux-boilerplate | import React from 'react'
import Helmet from 'react-helmet'
import styled, { ThemeProvider } from 'styled-components'
import { Switch, Route } from 'react-router-dom'
import Header from 'components/Header'
import Footer from 'components/Footer'
import HomePage from 'containers/HomePage/Loadable'
import FeaturePage from 'containers/FeaturePage/Loadable'
import NotFoundPage from 'containers/NotFoundPage/Loadable'
const theme = {
primary: '#434C5E',
lightShade: '#E9E6D9',
lightAccent: '#77938D',
darkAccent: '#5472A1',
darkShade: '#1B1720',
whiteMain: '#FAFAFA'
}
const AppWrapper = styled.div`
max-width: calc(768px + 16px * 2);
margin: 0 auto;
display: flex;
min-height: calc(100vh - 150px); // min height for App wrapper should account for nav and footer
padding: 0 16px;
flex-direction: column;
`
export default function App () {
return (
<ThemeProvider theme={theme}>
<div>
<Helmet
titleTemplate='%s - React.js Boilerplate'
defaultTitle='React.js Boilerplate'
>
<meta name='description' content='A React.js Boierlplate application with Redux' />
</Helmet>
<Header />
<AppWrapper>
<Switch>
<Route exact path='/' component={HomePage} />
<Route path='/features' component={FeaturePage} />
<Route path='' component={NotFoundPage} />
</Switch>
</AppWrapper>
<Footer />
</div>
</ThemeProvider>
)
}
|
webpack/components/shared_show/GroupLookUp.js | CDCgov/SDP-Vocabulary-Service | import React, { Component } from 'react';
import PropTypes from 'prop-types';
import currentUserProps from '../../prop-types/current_user_props';
class GroupLookUp extends Component {
render() {
let groups = this.props.item.groups || [];
return (
<div className="btn-group">
<button className="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span className="fa fa-users"></span> Groups <span className="caret"></span>
</button>
<ul className="group-dropdown-menu">
<li key="header" className="dropdown-header">Current Groups:</li>
{groups.length > 0 ? (
groups.map((g) => {
return (
<li className='current-group-menu-item' key={g.id}><span className="fa fa-check-square-o" aria-hidden="true"></span> {g.name}
<button id={`remove_${g.name}`} onClick={() => this.props.removeFunc(this.props.item.id, g.id)} className="btn btn-default pull-right">
<i className="fa fa-ban search-btn-icon" aria-hidden="true"></i><text className="sr-only">{`Click to remove content from ${g.name} group`}</text>
</button>
</li>
);
})
) : (
<li className='current-group-menu-item'>None</li>
)
}
<li key="add-header" className="dropdown-header">Add to Group:</li>
{this.props.currentUser.groups.filter((group) => !groups.map(g => g.id).includes(group.id)).map((g) => {
return (
<li className='current-group-menu-item' key={g.id}>{g.name}
<button id={`add_${g.name}`} onClick={() => this.props.addFunc(this.props.item.id, g.id)} className="btn btn-default pull-right">
<i className="fa fa-plus search-btn-icon" aria-hidden="true"></i><text className="sr-only">{`Click to add content to the ${g.name} group`}</text>
</button>
</li>
);
})}
</ul>
</div>
);
}
}
GroupLookUp.propTypes = {
addFunc: PropTypes.func,
removeFunc: PropTypes.func,
item: PropTypes.object,
currentUser: currentUserProps
};
export default GroupLookUp;
|
src/svg-icons/av/branding-watermark.js | verdan/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let AvBrandingWatermark = (props) => (
<SvgIcon {...props}>
<path d="M21 3H3c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16h-9v-6h9v6z"/>
</SvgIcon>
);
AvBrandingWatermark = pure(AvBrandingWatermark);
AvBrandingWatermark.displayName = 'AvBrandingWatermark';
AvBrandingWatermark.muiName = 'SvgIcon';
export default AvBrandingWatermark;
|
stories/Alert.js | Bandwidth/shared-components | import React from 'react';
import { storiesOf } from '@storybook/react';
import { action } from '@storybook/addon-actions';
import Alert from 'components/Alert';
import Grid from 'layouts/Grid';
import ipsum from 'lorem-ipsum';
class DismissState extends React.PureComponent {
state = { show: true };
handleClose = () => this.setState({ show: false });
handleShow = () => this.setState({ show: true });
render() {
const { show } = this.state;
if (show) {
return React.cloneElement(this.props.children, {
onClose: this.handleClose,
});
}
return (
<button style={{ margin: 'auto' }} onClick={this.handleShow}>
Restore
</button>
);
}
}
class RotatingAlerts extends React.PureComponent {
state = { alerts: [] };
intervalRef = null;
componentDidMount() {
this.addAlert();
setTimeout(() => {
this.addAlert();
this.intervalRef = setInterval(this.addAlert, 1000);
}, 1000);
}
componentWillUnmount() {
if (this.intervalRef) {
clearInterval(this.intervalRef);
}
}
randomType = () => {
switch (Math.floor(Math.random() * 3)) {
case 1:
return 'success';
case 2:
return 'error';
default:
return 'info';
}
};
addAlert = () => {
const alert = {
message: ipsum({ count: Math.floor(Math.random() * 4) }),
type: this.randomType(),
id: Math.random(),
};
this.setState(({ alerts }) => ({
alerts: [alert, ...alerts],
}));
};
removeAlert = id => {
this.setState(({ alerts }) => ({
alerts: alerts.filter(al => al.id !== id),
}));
};
render() {
return (
<React.Fragment>
{Object.values(this.state.alerts).map(alert => (
<Alert
key={alert.id}
type={alert.type}
onClose={() => this.removeAlert(alert.id)}
closeTimeout={5000}
>
{alert.message}
</Alert>
))}
</React.Fragment>
);
}
}
storiesOf('Alert', module)
.add('types', () => (
<Grid columns={1}>
<h2>Standard</h2>
<Alert type="info">Info</Alert>
<Alert type="success">Success</Alert>
<Alert type="error">Error</Alert>
<h2>Small</h2>
<Alert.Small type="info">Info</Alert.Small>
<Alert.Small type="success">Success</Alert.Small>
<Alert.Small type="error">Error</Alert.Small>
</Grid>
))
.add('textOnly', () => (
<Grid columns={1}>
<h2>Text Only</h2>
<Alert textOnly type="info">
Info
</Alert>
<Alert textOnly type="success">
Success
</Alert>
<Alert textOnly type="error">
Error
</Alert>
</Grid>
))
.add('dismissable', () => (
<Grid columns={1}>
<DismissState>
<Alert type="info">Close me!</Alert>
</DismissState>
<DismissState>
<Alert type="error">{ipsum({ count: 5 })}</Alert>
</DismissState>
<DismissState>
<Alert.Small type="success">{ipsum({ count: 5 })}</Alert.Small>
</DismissState>
<h2>Auto-dismiss</h2>
<DismissState>
<Alert type="error" closeTimeout={4000}>
Wait 4 seconds
</Alert>
</DismissState>
</Grid>
))
.add('grouped', () => (
<Alert.Group>
<RotatingAlerts />
</Alert.Group>
))
.add('global', () => (
<Alert.Group.Global>
<RotatingAlerts />
</Alert.Group.Global>
));
|
ajax/libs/oojs-ui/0.17.7/oojs-ui-windows.js | ahocevar/cdnjs | /*!
* OOjs UI v0.17.7
* https://www.mediawiki.org/wiki/OOjs_UI
*
* Copyright 2011–2016 OOjs UI Team and other contributors.
* Released under the MIT license
* http://oojs.mit-license.org
*
* Date: 2016-08-03T16:38:22Z
*/
( function ( OO ) {
'use strict';
/**
* An ActionWidget is a {@link OO.ui.ButtonWidget button widget} that executes an action.
* Action widgets are used with OO.ui.ActionSet, which manages the behavior and availability
* of the actions.
*
* Both actions and action sets are primarily used with {@link OO.ui.Dialog Dialogs}.
* Please see the [OOjs UI documentation on MediaWiki] [1] for more information
* and examples.
*
* [1]: https://www.mediawiki.org/wiki/OOjs_UI/Windows/Process_Dialogs#Action_sets
*
* @class
* @extends OO.ui.ButtonWidget
* @mixins OO.ui.mixin.PendingElement
*
* @constructor
* @param {Object} [config] Configuration options
* @cfg {string} [action] Symbolic name of the action (e.g., ‘continue’ or ‘cancel’).
* @cfg {string[]} [modes] Symbolic names of the modes (e.g., ‘edit’ or ‘read’) in which the action
* should be made available. See the action set's {@link OO.ui.ActionSet#setMode setMode} method
* for more information about setting modes.
* @cfg {boolean} [framed=false] Render the action button with a frame
*/
OO.ui.ActionWidget = function OoUiActionWidget( config ) {
// Configuration initialization
config = $.extend( { framed: false }, config );
// Parent constructor
OO.ui.ActionWidget.parent.call( this, config );
// Mixin constructors
OO.ui.mixin.PendingElement.call( this, config );
// Properties
this.action = config.action || '';
this.modes = config.modes || [];
this.width = 0;
this.height = 0;
// Initialization
this.$element.addClass( 'oo-ui-actionWidget' );
};
/* Setup */
OO.inheritClass( OO.ui.ActionWidget, OO.ui.ButtonWidget );
OO.mixinClass( OO.ui.ActionWidget, OO.ui.mixin.PendingElement );
/* Events */
/**
* A resize event is emitted when the size of the widget changes.
*
* @event resize
*/
/* Methods */
/**
* Check if the action is configured to be available in the specified `mode`.
*
* @param {string} mode Name of mode
* @return {boolean} The action is configured with the mode
*/
OO.ui.ActionWidget.prototype.hasMode = function ( mode ) {
return this.modes.indexOf( mode ) !== -1;
};
/**
* Get the symbolic name of the action (e.g., ‘continue’ or ‘cancel’).
*
* @return {string}
*/
OO.ui.ActionWidget.prototype.getAction = function () {
return this.action;
};
/**
* Get the symbolic name of the mode or modes for which the action is configured to be available.
*
* The current mode is set with the action set's {@link OO.ui.ActionSet#setMode setMode} method.
* Only actions that are configured to be avaiable in the current mode will be visible. All other actions
* are hidden.
*
* @return {string[]}
*/
OO.ui.ActionWidget.prototype.getModes = function () {
return this.modes.slice();
};
/**
* Emit a resize event if the size has changed.
*
* @private
* @chainable
*/
OO.ui.ActionWidget.prototype.propagateResize = function () {
var width, height;
if ( this.isElementAttached() ) {
width = this.$element.width();
height = this.$element.height();
if ( width !== this.width || height !== this.height ) {
this.width = width;
this.height = height;
this.emit( 'resize' );
}
}
return this;
};
/**
* @inheritdoc
*/
OO.ui.ActionWidget.prototype.setIcon = function () {
// Mixin method
OO.ui.mixin.IconElement.prototype.setIcon.apply( this, arguments );
this.propagateResize();
return this;
};
/**
* @inheritdoc
*/
OO.ui.ActionWidget.prototype.setLabel = function () {
// Mixin method
OO.ui.mixin.LabelElement.prototype.setLabel.apply( this, arguments );
this.propagateResize();
return this;
};
/**
* @inheritdoc
*/
OO.ui.ActionWidget.prototype.setFlags = function () {
// Mixin method
OO.ui.mixin.FlaggedElement.prototype.setFlags.apply( this, arguments );
this.propagateResize();
return this;
};
/**
* @inheritdoc
*/
OO.ui.ActionWidget.prototype.clearFlags = function () {
// Mixin method
OO.ui.mixin.FlaggedElement.prototype.clearFlags.apply( this, arguments );
this.propagateResize();
return this;
};
/**
* Toggle the visibility of the action button.
*
* @param {boolean} [show] Show button, omit to toggle visibility
* @chainable
*/
OO.ui.ActionWidget.prototype.toggle = function () {
// Parent method
OO.ui.ActionWidget.parent.prototype.toggle.apply( this, arguments );
this.propagateResize();
return this;
};
/**
* ActionSets manage the behavior of the {@link OO.ui.ActionWidget action widgets} that comprise them.
* Actions can be made available for specific contexts (modes) and circumstances
* (abilities). Action sets are primarily used with {@link OO.ui.Dialog Dialogs}.
*
* ActionSets contain two types of actions:
*
* - Special: Special actions are the first visible actions with special flags, such as 'safe' and 'primary', the default special flags. Additional special flags can be configured in subclasses with the static #specialFlags property.
* - Other: Other actions include all non-special visible actions.
*
* Please see the [OOjs UI documentation on MediaWiki][1] for more information.
*
* @example
* // Example: An action set used in a process dialog
* function MyProcessDialog( config ) {
* MyProcessDialog.parent.call( this, config );
* }
* OO.inheritClass( MyProcessDialog, OO.ui.ProcessDialog );
* MyProcessDialog.static.title = 'An action set in a process dialog';
* // An action set that uses modes ('edit' and 'help' mode, in this example).
* MyProcessDialog.static.actions = [
* { action: 'continue', modes: 'edit', label: 'Continue', flags: [ 'primary', 'constructive' ] },
* { action: 'help', modes: 'edit', label: 'Help' },
* { modes: 'edit', label: 'Cancel', flags: 'safe' },
* { action: 'back', modes: 'help', label: 'Back', flags: 'safe' }
* ];
*
* MyProcessDialog.prototype.initialize = function () {
* MyProcessDialog.parent.prototype.initialize.apply( this, arguments );
* this.panel1 = new OO.ui.PanelLayout( { padded: true, expanded: false } );
* this.panel1.$element.append( '<p>This dialog uses an action set (continue, help, cancel, back) configured with modes. This is edit mode. Click \'help\' to see help mode.</p>' );
* this.panel2 = new OO.ui.PanelLayout( { padded: true, expanded: false } );
* this.panel2.$element.append( '<p>This is help mode. Only the \'back\' action widget is configured to be visible here. Click \'back\' to return to \'edit\' mode.</p>' );
* this.stackLayout = new OO.ui.StackLayout( {
* items: [ this.panel1, this.panel2 ]
* } );
* this.$body.append( this.stackLayout.$element );
* };
* MyProcessDialog.prototype.getSetupProcess = function ( data ) {
* return MyProcessDialog.parent.prototype.getSetupProcess.call( this, data )
* .next( function () {
* this.actions.setMode( 'edit' );
* }, this );
* };
* MyProcessDialog.prototype.getActionProcess = function ( action ) {
* if ( action === 'help' ) {
* this.actions.setMode( 'help' );
* this.stackLayout.setItem( this.panel2 );
* } else if ( action === 'back' ) {
* this.actions.setMode( 'edit' );
* this.stackLayout.setItem( this.panel1 );
* } else if ( action === 'continue' ) {
* var dialog = this;
* return new OO.ui.Process( function () {
* dialog.close();
* } );
* }
* return MyProcessDialog.parent.prototype.getActionProcess.call( this, action );
* };
* MyProcessDialog.prototype.getBodyHeight = function () {
* return this.panel1.$element.outerHeight( true );
* };
* var windowManager = new OO.ui.WindowManager();
* $( 'body' ).append( windowManager.$element );
* var dialog = new MyProcessDialog( {
* size: 'medium'
* } );
* windowManager.addWindows( [ dialog ] );
* windowManager.openWindow( dialog );
*
* [1]: https://www.mediawiki.org/wiki/OOjs_UI/Windows/Process_Dialogs#Action_sets
*
* @abstract
* @class
* @mixins OO.EventEmitter
*
* @constructor
* @param {Object} [config] Configuration options
*/
OO.ui.ActionSet = function OoUiActionSet( config ) {
// Configuration initialization
config = config || {};
// Mixin constructors
OO.EventEmitter.call( this );
// Properties
this.list = [];
this.categories = {
actions: 'getAction',
flags: 'getFlags',
modes: 'getModes'
};
this.categorized = {};
this.special = {};
this.others = [];
this.organized = false;
this.changing = false;
this.changed = false;
};
/* Setup */
OO.mixinClass( OO.ui.ActionSet, OO.EventEmitter );
/* Static Properties */
/**
* Symbolic name of the flags used to identify special actions. Special actions are displayed in the
* header of a {@link OO.ui.ProcessDialog process dialog}.
* See the [OOjs UI documentation on MediaWiki][2] for more information and examples.
*
* [2]:https://www.mediawiki.org/wiki/OOjs_UI/Windows/Process_Dialogs
*
* @abstract
* @static
* @inheritable
* @property {string}
*/
OO.ui.ActionSet.static.specialFlags = [ 'safe', 'primary' ];
/* Events */
/**
* @event click
*
* A 'click' event is emitted when an action is clicked.
*
* @param {OO.ui.ActionWidget} action Action that was clicked
*/
/**
* @event resize
*
* A 'resize' event is emitted when an action widget is resized.
*
* @param {OO.ui.ActionWidget} action Action that was resized
*/
/**
* @event add
*
* An 'add' event is emitted when actions are {@link #method-add added} to the action set.
*
* @param {OO.ui.ActionWidget[]} added Actions added
*/
/**
* @event remove
*
* A 'remove' event is emitted when actions are {@link #method-remove removed}
* or {@link #clear cleared}.
*
* @param {OO.ui.ActionWidget[]} added Actions removed
*/
/**
* @event change
*
* A 'change' event is emitted when actions are {@link #method-add added}, {@link #clear cleared},
* or {@link #method-remove removed} from the action set or when the {@link #setMode mode} is changed.
*
*/
/* Methods */
/**
* Handle action change events.
*
* @private
* @fires change
*/
OO.ui.ActionSet.prototype.onActionChange = function () {
this.organized = false;
if ( this.changing ) {
this.changed = true;
} else {
this.emit( 'change' );
}
};
/**
* Check if an action is one of the special actions.
*
* @param {OO.ui.ActionWidget} action Action to check
* @return {boolean} Action is special
*/
OO.ui.ActionSet.prototype.isSpecial = function ( action ) {
var flag;
for ( flag in this.special ) {
if ( action === this.special[ flag ] ) {
return true;
}
}
return false;
};
/**
* Get action widgets based on the specified filter: ‘actions’, ‘flags’, ‘modes’, ‘visible’,
* or ‘disabled’.
*
* @param {Object} [filters] Filters to use, omit to get all actions
* @param {string|string[]} [filters.actions] Actions that action widgets must have
* @param {string|string[]} [filters.flags] Flags that action widgets must have (e.g., 'safe')
* @param {string|string[]} [filters.modes] Modes that action widgets must have
* @param {boolean} [filters.visible] Action widgets must be visible
* @param {boolean} [filters.disabled] Action widgets must be disabled
* @return {OO.ui.ActionWidget[]} Action widgets matching all criteria
*/
OO.ui.ActionSet.prototype.get = function ( filters ) {
var i, len, list, category, actions, index, match, matches;
if ( filters ) {
this.organize();
// Collect category candidates
matches = [];
for ( category in this.categorized ) {
list = filters[ category ];
if ( list ) {
if ( !Array.isArray( list ) ) {
list = [ list ];
}
for ( i = 0, len = list.length; i < len; i++ ) {
actions = this.categorized[ category ][ list[ i ] ];
if ( Array.isArray( actions ) ) {
matches.push.apply( matches, actions );
}
}
}
}
// Remove by boolean filters
for ( i = 0, len = matches.length; i < len; i++ ) {
match = matches[ i ];
if (
( filters.visible !== undefined && match.isVisible() !== filters.visible ) ||
( filters.disabled !== undefined && match.isDisabled() !== filters.disabled )
) {
matches.splice( i, 1 );
len--;
i--;
}
}
// Remove duplicates
for ( i = 0, len = matches.length; i < len; i++ ) {
match = matches[ i ];
index = matches.lastIndexOf( match );
while ( index !== i ) {
matches.splice( index, 1 );
len--;
index = matches.lastIndexOf( match );
}
}
return matches;
}
return this.list.slice();
};
/**
* Get 'special' actions.
*
* Special actions are the first visible action widgets with special flags, such as 'safe' and 'primary'.
* Special flags can be configured in subclasses by changing the static #specialFlags property.
*
* @return {OO.ui.ActionWidget[]|null} 'Special' action widgets.
*/
OO.ui.ActionSet.prototype.getSpecial = function () {
this.organize();
return $.extend( {}, this.special );
};
/**
* Get 'other' actions.
*
* Other actions include all non-special visible action widgets.
*
* @return {OO.ui.ActionWidget[]} 'Other' action widgets
*/
OO.ui.ActionSet.prototype.getOthers = function () {
this.organize();
return this.others.slice();
};
/**
* Set the mode (e.g., ‘edit’ or ‘view’). Only {@link OO.ui.ActionWidget#modes actions} configured
* to be available in the specified mode will be made visible. All other actions will be hidden.
*
* @param {string} mode The mode. Only actions configured to be available in the specified
* mode will be made visible.
* @chainable
* @fires toggle
* @fires change
*/
OO.ui.ActionSet.prototype.setMode = function ( mode ) {
var i, len, action;
this.changing = true;
for ( i = 0, len = this.list.length; i < len; i++ ) {
action = this.list[ i ];
action.toggle( action.hasMode( mode ) );
}
this.organized = false;
this.changing = false;
this.emit( 'change' );
return this;
};
/**
* Set the abilities of the specified actions.
*
* Action widgets that are configured with the specified actions will be enabled
* or disabled based on the boolean values specified in the `actions`
* parameter.
*
* @param {Object.<string,boolean>} actions A list keyed by action name with boolean
* values that indicate whether or not the action should be enabled.
* @chainable
*/
OO.ui.ActionSet.prototype.setAbilities = function ( actions ) {
var i, len, action, item;
for ( i = 0, len = this.list.length; i < len; i++ ) {
item = this.list[ i ];
action = item.getAction();
if ( actions[ action ] !== undefined ) {
item.setDisabled( !actions[ action ] );
}
}
return this;
};
/**
* Executes a function once per action.
*
* When making changes to multiple actions, use this method instead of iterating over the actions
* manually to defer emitting a #change event until after all actions have been changed.
*
* @param {Object|null} filter Filters to use to determine which actions to iterate over; see #get
* @param {Function} callback Callback to run for each action; callback is invoked with three
* arguments: the action, the action's index, the list of actions being iterated over
* @chainable
*/
OO.ui.ActionSet.prototype.forEach = function ( filter, callback ) {
this.changed = false;
this.changing = true;
this.get( filter ).forEach( callback );
this.changing = false;
if ( this.changed ) {
this.emit( 'change' );
}
return this;
};
/**
* Add action widgets to the action set.
*
* @param {OO.ui.ActionWidget[]} actions Action widgets to add
* @chainable
* @fires add
* @fires change
*/
OO.ui.ActionSet.prototype.add = function ( actions ) {
var i, len, action;
this.changing = true;
for ( i = 0, len = actions.length; i < len; i++ ) {
action = actions[ i ];
action.connect( this, {
click: [ 'emit', 'click', action ],
resize: [ 'emit', 'resize', action ],
toggle: [ 'onActionChange' ]
} );
this.list.push( action );
}
this.organized = false;
this.emit( 'add', actions );
this.changing = false;
this.emit( 'change' );
return this;
};
/**
* Remove action widgets from the set.
*
* To remove all actions, you may wish to use the #clear method instead.
*
* @param {OO.ui.ActionWidget[]} actions Action widgets to remove
* @chainable
* @fires remove
* @fires change
*/
OO.ui.ActionSet.prototype.remove = function ( actions ) {
var i, len, index, action;
this.changing = true;
for ( i = 0, len = actions.length; i < len; i++ ) {
action = actions[ i ];
index = this.list.indexOf( action );
if ( index !== -1 ) {
action.disconnect( this );
this.list.splice( index, 1 );
}
}
this.organized = false;
this.emit( 'remove', actions );
this.changing = false;
this.emit( 'change' );
return this;
};
/**
* Remove all action widets from the set.
*
* To remove only specified actions, use the {@link #method-remove remove} method instead.
*
* @chainable
* @fires remove
* @fires change
*/
OO.ui.ActionSet.prototype.clear = function () {
var i, len, action,
removed = this.list.slice();
this.changing = true;
for ( i = 0, len = this.list.length; i < len; i++ ) {
action = this.list[ i ];
action.disconnect( this );
}
this.list = [];
this.organized = false;
this.emit( 'remove', removed );
this.changing = false;
this.emit( 'change' );
return this;
};
/**
* Organize actions.
*
* This is called whenever organized information is requested. It will only reorganize the actions
* if something has changed since the last time it ran.
*
* @private
* @chainable
*/
OO.ui.ActionSet.prototype.organize = function () {
var i, iLen, j, jLen, flag, action, category, list, item, special,
specialFlags = this.constructor.static.specialFlags;
if ( !this.organized ) {
this.categorized = {};
this.special = {};
this.others = [];
for ( i = 0, iLen = this.list.length; i < iLen; i++ ) {
action = this.list[ i ];
if ( action.isVisible() ) {
// Populate categories
for ( category in this.categories ) {
if ( !this.categorized[ category ] ) {
this.categorized[ category ] = {};
}
list = action[ this.categories[ category ] ]();
if ( !Array.isArray( list ) ) {
list = [ list ];
}
for ( j = 0, jLen = list.length; j < jLen; j++ ) {
item = list[ j ];
if ( !this.categorized[ category ][ item ] ) {
this.categorized[ category ][ item ] = [];
}
this.categorized[ category ][ item ].push( action );
}
}
// Populate special/others
special = false;
for ( j = 0, jLen = specialFlags.length; j < jLen; j++ ) {
flag = specialFlags[ j ];
if ( !this.special[ flag ] && action.hasFlag( flag ) ) {
this.special[ flag ] = action;
special = true;
break;
}
}
if ( !special ) {
this.others.push( action );
}
}
}
this.organized = true;
}
return this;
};
/**
* Errors contain a required message (either a string or jQuery selection) that is used to describe what went wrong
* in a {@link OO.ui.Process process}. The error's #recoverable and #warning configurations are used to customize the
* appearance and functionality of the error interface.
*
* The basic error interface contains a formatted error message as well as two buttons: 'Dismiss' and 'Try again' (i.e., the error
* is 'recoverable' by default). If the error is not recoverable, the 'Try again' button will not be rendered and the widget
* that initiated the failed process will be disabled.
*
* If the error is a warning, the error interface will include a 'Dismiss' and a 'Continue' button, which will try the
* process again.
*
* For an example of error interfaces, please see the [OOjs UI documentation on MediaWiki][1].
*
* [1]: https://www.mediawiki.org/wiki/OOjs_UI/Windows/Process_Dialogs#Processes_and_errors
*
* @class
*
* @constructor
* @param {string|jQuery} message Description of error
* @param {Object} [config] Configuration options
* @cfg {boolean} [recoverable=true] Error is recoverable.
* By default, errors are recoverable, and users can try the process again.
* @cfg {boolean} [warning=false] Error is a warning.
* If the error is a warning, the error interface will include a
* 'Dismiss' and a 'Continue' button. It is the responsibility of the developer to ensure that the warning
* is not triggered a second time if the user chooses to continue.
*/
OO.ui.Error = function OoUiError( message, config ) {
// Allow passing positional parameters inside the config object
if ( OO.isPlainObject( message ) && config === undefined ) {
config = message;
message = config.message;
}
// Configuration initialization
config = config || {};
// Properties
this.message = message instanceof jQuery ? message : String( message );
this.recoverable = config.recoverable === undefined || !!config.recoverable;
this.warning = !!config.warning;
};
/* Setup */
OO.initClass( OO.ui.Error );
/* Methods */
/**
* Check if the error is recoverable.
*
* If the error is recoverable, users are able to try the process again.
*
* @return {boolean} Error is recoverable
*/
OO.ui.Error.prototype.isRecoverable = function () {
return this.recoverable;
};
/**
* Check if the error is a warning.
*
* If the error is a warning, the error interface will include a 'Dismiss' and a 'Continue' button.
*
* @return {boolean} Error is warning
*/
OO.ui.Error.prototype.isWarning = function () {
return this.warning;
};
/**
* Get error message as DOM nodes.
*
* @return {jQuery} Error message in DOM nodes
*/
OO.ui.Error.prototype.getMessage = function () {
return this.message instanceof jQuery ?
this.message.clone() :
$( '<div>' ).text( this.message ).contents();
};
/**
* Get the error message text.
*
* @return {string} Error message
*/
OO.ui.Error.prototype.getMessageText = function () {
return this.message instanceof jQuery ? this.message.text() : this.message;
};
/**
* A Process is a list of steps that are called in sequence. The step can be a number, a jQuery promise,
* or a function:
*
* - **number**: the process will wait for the specified number of milliseconds before proceeding.
* - **promise**: the process will continue to the next step when the promise is successfully resolved
* or stop if the promise is rejected.
* - **function**: the process will execute the function. The process will stop if the function returns
* either a boolean `false` or a promise that is rejected; if the function returns a number, the process
* will wait for that number of milliseconds before proceeding.
*
* If the process fails, an {@link OO.ui.Error error} is generated. Depending on how the error is
* configured, users can dismiss the error and try the process again, or not. If a process is stopped,
* its remaining steps will not be performed.
*
* @class
*
* @constructor
* @param {number|jQuery.Promise|Function} step Number of miliseconds to wait before proceeding, promise
* that must be resolved before proceeding, or a function to execute. See #createStep for more information. see #createStep for more information
* @param {Object} [context=null] Execution context of the function. The context is ignored if the step is
* a number or promise.
* @return {Object} Step object, with `callback` and `context` properties
*/
OO.ui.Process = function ( step, context ) {
// Properties
this.steps = [];
// Initialization
if ( step !== undefined ) {
this.next( step, context );
}
};
/* Setup */
OO.initClass( OO.ui.Process );
/* Methods */
/**
* Start the process.
*
* @return {jQuery.Promise} Promise that is resolved when all steps have successfully completed.
* If any of the steps return a promise that is rejected or a boolean false, this promise is rejected
* and any remaining steps are not performed.
*/
OO.ui.Process.prototype.execute = function () {
var i, len, promise;
/**
* Continue execution.
*
* @ignore
* @param {Array} step A function and the context it should be called in
* @return {Function} Function that continues the process
*/
function proceed( step ) {
return function () {
// Execute step in the correct context
var deferred,
result = step.callback.call( step.context );
if ( result === false ) {
// Use rejected promise for boolean false results
return $.Deferred().reject( [] ).promise();
}
if ( typeof result === 'number' ) {
if ( result < 0 ) {
throw new Error( 'Cannot go back in time: flux capacitor is out of service' );
}
// Use a delayed promise for numbers, expecting them to be in milliseconds
deferred = $.Deferred();
setTimeout( deferred.resolve, result );
return deferred.promise();
}
if ( result instanceof OO.ui.Error ) {
// Use rejected promise for error
return $.Deferred().reject( [ result ] ).promise();
}
if ( Array.isArray( result ) && result.length && result[ 0 ] instanceof OO.ui.Error ) {
// Use rejected promise for list of errors
return $.Deferred().reject( result ).promise();
}
// Duck-type the object to see if it can produce a promise
if ( result && $.isFunction( result.promise ) ) {
// Use a promise generated from the result
return result.promise();
}
// Use resolved promise for other results
return $.Deferred().resolve().promise();
};
}
if ( this.steps.length ) {
// Generate a chain reaction of promises
promise = proceed( this.steps[ 0 ] )();
for ( i = 1, len = this.steps.length; i < len; i++ ) {
promise = promise.then( proceed( this.steps[ i ] ) );
}
} else {
promise = $.Deferred().resolve().promise();
}
return promise;
};
/**
* Create a process step.
*
* @private
* @param {number|jQuery.Promise|Function} step
*
* - Number of milliseconds to wait before proceeding
* - Promise that must be resolved before proceeding
* - Function to execute
* - If the function returns a boolean false the process will stop
* - If the function returns a promise, the process will continue to the next
* step when the promise is resolved or stop if the promise is rejected
* - If the function returns a number, the process will wait for that number of
* milliseconds before proceeding
* @param {Object} [context=null] Execution context of the function. The context is
* ignored if the step is a number or promise.
* @return {Object} Step object, with `callback` and `context` properties
*/
OO.ui.Process.prototype.createStep = function ( step, context ) {
if ( typeof step === 'number' || $.isFunction( step.promise ) ) {
return {
callback: function () {
return step;
},
context: null
};
}
if ( $.isFunction( step ) ) {
return {
callback: step,
context: context
};
}
throw new Error( 'Cannot create process step: number, promise or function expected' );
};
/**
* Add step to the beginning of the process.
*
* @inheritdoc #createStep
* @return {OO.ui.Process} this
* @chainable
*/
OO.ui.Process.prototype.first = function ( step, context ) {
this.steps.unshift( this.createStep( step, context ) );
return this;
};
/**
* Add step to the end of the process.
*
* @inheritdoc #createStep
* @return {OO.ui.Process} this
* @chainable
*/
OO.ui.Process.prototype.next = function ( step, context ) {
this.steps.push( this.createStep( step, context ) );
return this;
};
/**
* Window managers are used to open and close {@link OO.ui.Window windows} and control their presentation.
* Managed windows are mutually exclusive. If a new window is opened while a current window is opening
* or is opened, the current window will be closed and any ongoing {@link OO.ui.Process process} will be cancelled. Windows
* themselves are persistent and—rather than being torn down when closed—can be repopulated with the
* pertinent data and reused.
*
* Over the lifecycle of a window, the window manager makes available three promises: `opening`,
* `opened`, and `closing`, which represent the primary stages of the cycle:
*
* **Opening**: the opening stage begins when the window manager’s #openWindow or a window’s
* {@link OO.ui.Window#open open} method is used, and the window manager begins to open the window.
*
* - an `opening` event is emitted with an `opening` promise
* - the #getSetupDelay method is called and the returned value is used to time a pause in execution before
* the window’s {@link OO.ui.Window#getSetupProcess getSetupProcess} method is called on the
* window and its result executed
* - a `setup` progress notification is emitted from the `opening` promise
* - the #getReadyDelay method is called the returned value is used to time a pause in execution before
* the window’s {@link OO.ui.Window#getReadyProcess getReadyProcess} method is called on the
* window and its result executed
* - a `ready` progress notification is emitted from the `opening` promise
* - the `opening` promise is resolved with an `opened` promise
*
* **Opened**: the window is now open.
*
* **Closing**: the closing stage begins when the window manager's #closeWindow or the
* window's {@link OO.ui.Window#close close} methods is used, and the window manager begins
* to close the window.
*
* - the `opened` promise is resolved with `closing` promise and a `closing` event is emitted
* - the #getHoldDelay method is called and the returned value is used to time a pause in execution before
* the window's {@link OO.ui.Window#getHoldProcess getHoldProces} method is called on the
* window and its result executed
* - a `hold` progress notification is emitted from the `closing` promise
* - the #getTeardownDelay() method is called and the returned value is used to time a pause in execution before
* the window's {@link OO.ui.Window#getTeardownProcess getTeardownProcess} method is called on the
* window and its result executed
* - a `teardown` progress notification is emitted from the `closing` promise
* - the `closing` promise is resolved. The window is now closed
*
* See the [OOjs UI documentation on MediaWiki][1] for more information.
*
* [1]: https://www.mediawiki.org/wiki/OOjs_UI/Windows/Window_managers
*
* @class
* @extends OO.ui.Element
* @mixins OO.EventEmitter
*
* @constructor
* @param {Object} [config] Configuration options
* @cfg {OO.Factory} [factory] Window factory to use for automatic instantiation
* Note that window classes that are instantiated with a factory must have
* a {@link OO.ui.Dialog#static-name static name} property that specifies a symbolic name.
* @cfg {boolean} [modal=true] Prevent interaction outside the dialog
*/
OO.ui.WindowManager = function OoUiWindowManager( config ) {
// Configuration initialization
config = config || {};
// Parent constructor
OO.ui.WindowManager.parent.call( this, config );
// Mixin constructors
OO.EventEmitter.call( this );
// Properties
this.factory = config.factory;
this.modal = config.modal === undefined || !!config.modal;
this.windows = {};
this.opening = null;
this.opened = null;
this.closing = null;
this.preparingToOpen = null;
this.preparingToClose = null;
this.currentWindow = null;
this.globalEvents = false;
this.$ariaHidden = null;
this.onWindowResizeTimeout = null;
this.onWindowResizeHandler = this.onWindowResize.bind( this );
this.afterWindowResizeHandler = this.afterWindowResize.bind( this );
// Initialization
this.$element
.addClass( 'oo-ui-windowManager' )
.toggleClass( 'oo-ui-windowManager-modal', this.modal );
};
/* Setup */
OO.inheritClass( OO.ui.WindowManager, OO.ui.Element );
OO.mixinClass( OO.ui.WindowManager, OO.EventEmitter );
/* Events */
/**
* An 'opening' event is emitted when the window begins to be opened.
*
* @event opening
* @param {OO.ui.Window} win Window that's being opened
* @param {jQuery.Promise} opening An `opening` promise resolved with a value when the window is opened successfully.
* When the `opening` promise is resolved, the first argument of the value is an 'opened' promise, the second argument
* is the opening data. The `opening` promise emits `setup` and `ready` notifications when those processes are complete.
* @param {Object} data Window opening data
*/
/**
* A 'closing' event is emitted when the window begins to be closed.
*
* @event closing
* @param {OO.ui.Window} win Window that's being closed
* @param {jQuery.Promise} closing A `closing` promise is resolved with a value when the window
* is closed successfully. The promise emits `hold` and `teardown` notifications when those
* processes are complete. When the `closing` promise is resolved, the first argument of its value
* is the closing data.
* @param {Object} data Window closing data
*/
/**
* A 'resize' event is emitted when a window is resized.
*
* @event resize
* @param {OO.ui.Window} win Window that was resized
*/
/* Static Properties */
/**
* Map of the symbolic name of each window size and its CSS properties.
*
* @static
* @inheritable
* @property {Object}
*/
OO.ui.WindowManager.static.sizes = {
small: {
width: 300
},
medium: {
width: 500
},
large: {
width: 700
},
larger: {
width: 900
},
full: {
// These can be non-numeric because they are never used in calculations
width: '100%',
height: '100%'
}
};
/**
* Symbolic name of the default window size.
*
* The default size is used if the window's requested size is not recognized.
*
* @static
* @inheritable
* @property {string}
*/
OO.ui.WindowManager.static.defaultSize = 'medium';
/* Methods */
/**
* Handle window resize events.
*
* @private
* @param {jQuery.Event} e Window resize event
*/
OO.ui.WindowManager.prototype.onWindowResize = function () {
clearTimeout( this.onWindowResizeTimeout );
this.onWindowResizeTimeout = setTimeout( this.afterWindowResizeHandler, 200 );
};
/**
* Handle window resize events.
*
* @private
* @param {jQuery.Event} e Window resize event
*/
OO.ui.WindowManager.prototype.afterWindowResize = function () {
if ( this.currentWindow ) {
this.updateWindowSize( this.currentWindow );
}
};
/**
* Check if window is opening.
*
* @return {boolean} Window is opening
*/
OO.ui.WindowManager.prototype.isOpening = function ( win ) {
return win === this.currentWindow && !!this.opening && this.opening.state() === 'pending';
};
/**
* Check if window is closing.
*
* @return {boolean} Window is closing
*/
OO.ui.WindowManager.prototype.isClosing = function ( win ) {
return win === this.currentWindow && !!this.closing && this.closing.state() === 'pending';
};
/**
* Check if window is opened.
*
* @return {boolean} Window is opened
*/
OO.ui.WindowManager.prototype.isOpened = function ( win ) {
return win === this.currentWindow && !!this.opened && this.opened.state() === 'pending';
};
/**
* Check if a window is being managed.
*
* @param {OO.ui.Window} win Window to check
* @return {boolean} Window is being managed
*/
OO.ui.WindowManager.prototype.hasWindow = function ( win ) {
var name;
for ( name in this.windows ) {
if ( this.windows[ name ] === win ) {
return true;
}
}
return false;
};
/**
* Get the number of milliseconds to wait after opening begins before executing the ‘setup’ process.
*
* @param {OO.ui.Window} win Window being opened
* @param {Object} [data] Window opening data
* @return {number} Milliseconds to wait
*/
OO.ui.WindowManager.prototype.getSetupDelay = function () {
return 0;
};
/**
* Get the number of milliseconds to wait after setup has finished before executing the ‘ready’ process.
*
* @param {OO.ui.Window} win Window being opened
* @param {Object} [data] Window opening data
* @return {number} Milliseconds to wait
*/
OO.ui.WindowManager.prototype.getReadyDelay = function () {
return 0;
};
/**
* Get the number of milliseconds to wait after closing has begun before executing the 'hold' process.
*
* @param {OO.ui.Window} win Window being closed
* @param {Object} [data] Window closing data
* @return {number} Milliseconds to wait
*/
OO.ui.WindowManager.prototype.getHoldDelay = function () {
return 0;
};
/**
* Get the number of milliseconds to wait after the ‘hold’ process has finished before
* executing the ‘teardown’ process.
*
* @param {OO.ui.Window} win Window being closed
* @param {Object} [data] Window closing data
* @return {number} Milliseconds to wait
*/
OO.ui.WindowManager.prototype.getTeardownDelay = function () {
return this.modal ? 250 : 0;
};
/**
* Get a window by its symbolic name.
*
* If the window is not yet instantiated and its symbolic name is recognized by a factory, it will be
* instantiated and added to the window manager automatically. Please see the [OOjs UI documentation on MediaWiki][3]
* for more information about using factories.
* [3]: https://www.mediawiki.org/wiki/OOjs_UI/Windows/Window_managers
*
* @param {string} name Symbolic name of the window
* @return {jQuery.Promise} Promise resolved with matching window, or rejected with an OO.ui.Error
* @throws {Error} An error is thrown if the symbolic name is not recognized by the factory.
* @throws {Error} An error is thrown if the named window is not recognized as a managed window.
*/
OO.ui.WindowManager.prototype.getWindow = function ( name ) {
var deferred = $.Deferred(),
win = this.windows[ name ];
if ( !( win instanceof OO.ui.Window ) ) {
if ( this.factory ) {
if ( !this.factory.lookup( name ) ) {
deferred.reject( new OO.ui.Error(
'Cannot auto-instantiate window: symbolic name is unrecognized by the factory'
) );
} else {
win = this.factory.create( name );
this.addWindows( [ win ] );
deferred.resolve( win );
}
} else {
deferred.reject( new OO.ui.Error(
'Cannot get unmanaged window: symbolic name unrecognized as a managed window'
) );
}
} else {
deferred.resolve( win );
}
return deferred.promise();
};
/**
* Get current window.
*
* @return {OO.ui.Window|null} Currently opening/opened/closing window
*/
OO.ui.WindowManager.prototype.getCurrentWindow = function () {
return this.currentWindow;
};
/**
* Open a window.
*
* @param {OO.ui.Window|string} win Window object or symbolic name of window to open
* @param {Object} [data] Window opening data
* @return {jQuery.Promise} An `opening` promise resolved when the window is done opening.
* See {@link #event-opening 'opening' event} for more information about `opening` promises.
* @fires opening
*/
OO.ui.WindowManager.prototype.openWindow = function ( win, data ) {
var manager = this,
opening = $.Deferred();
// Argument handling
if ( typeof win === 'string' ) {
return this.getWindow( win ).then( function ( win ) {
return manager.openWindow( win, data );
} );
}
// Error handling
if ( !this.hasWindow( win ) ) {
opening.reject( new OO.ui.Error(
'Cannot open window: window is not attached to manager'
) );
} else if ( this.preparingToOpen || this.opening || this.opened ) {
opening.reject( new OO.ui.Error(
'Cannot open window: another window is opening or open'
) );
}
// Window opening
if ( opening.state() !== 'rejected' ) {
// If a window is currently closing, wait for it to complete
this.preparingToOpen = $.when( this.closing );
// Ensure handlers get called after preparingToOpen is set
this.preparingToOpen.done( function () {
if ( manager.modal ) {
manager.toggleGlobalEvents( true );
manager.toggleAriaIsolation( true );
}
manager.currentWindow = win;
manager.opening = opening;
manager.preparingToOpen = null;
manager.emit( 'opening', win, opening, data );
setTimeout( function () {
win.setup( data ).then( function () {
manager.updateWindowSize( win );
manager.opening.notify( { state: 'setup' } );
setTimeout( function () {
win.ready( data ).then( function () {
manager.opening.notify( { state: 'ready' } );
manager.opening = null;
manager.opened = $.Deferred();
opening.resolve( manager.opened.promise(), data );
}, function () {
manager.opening = null;
manager.opened = $.Deferred();
opening.reject();
manager.closeWindow( win );
} );
}, manager.getReadyDelay() );
}, function () {
manager.opening = null;
manager.opened = $.Deferred();
opening.reject();
manager.closeWindow( win );
} );
}, manager.getSetupDelay() );
} );
}
return opening.promise();
};
/**
* Close a window.
*
* @param {OO.ui.Window|string} win Window object or symbolic name of window to close
* @param {Object} [data] Window closing data
* @return {jQuery.Promise} A `closing` promise resolved when the window is done closing.
* See {@link #event-closing 'closing' event} for more information about closing promises.
* @throws {Error} An error is thrown if the window is not managed by the window manager.
* @fires closing
*/
OO.ui.WindowManager.prototype.closeWindow = function ( win, data ) {
var manager = this,
closing = $.Deferred(),
opened;
// Argument handling
if ( typeof win === 'string' ) {
win = this.windows[ win ];
} else if ( !this.hasWindow( win ) ) {
win = null;
}
// Error handling
if ( !win ) {
closing.reject( new OO.ui.Error(
'Cannot close window: window is not attached to manager'
) );
} else if ( win !== this.currentWindow ) {
closing.reject( new OO.ui.Error(
'Cannot close window: window already closed with different data'
) );
} else if ( this.preparingToClose || this.closing ) {
closing.reject( new OO.ui.Error(
'Cannot close window: window already closing with different data'
) );
}
// Window closing
if ( closing.state() !== 'rejected' ) {
// If the window is currently opening, close it when it's done
this.preparingToClose = $.when( this.opening );
// Ensure handlers get called after preparingToClose is set
this.preparingToClose.always( function () {
manager.closing = closing;
manager.preparingToClose = null;
manager.emit( 'closing', win, closing, data );
opened = manager.opened;
manager.opened = null;
opened.resolve( closing.promise(), data );
setTimeout( function () {
win.hold( data ).then( function () {
closing.notify( { state: 'hold' } );
setTimeout( function () {
win.teardown( data ).then( function () {
closing.notify( { state: 'teardown' } );
if ( manager.modal ) {
manager.toggleGlobalEvents( false );
manager.toggleAriaIsolation( false );
}
manager.closing = null;
manager.currentWindow = null;
closing.resolve( data );
} );
}, manager.getTeardownDelay() );
} );
}, manager.getHoldDelay() );
} );
}
return closing.promise();
};
/**
* Add windows to the window manager.
*
* Windows can be added by reference, symbolic name, or explicitly defined symbolic names.
* See the [OOjs ui documentation on MediaWiki] [2] for examples.
* [2]: https://www.mediawiki.org/wiki/OOjs_UI/Windows/Window_managers
*
* @param {Object.<string,OO.ui.Window>|OO.ui.Window[]} windows An array of window objects specified
* by reference, symbolic name, or explicitly defined symbolic names.
* @throws {Error} An error is thrown if a window is added by symbolic name, but has neither an
* explicit nor a statically configured symbolic name.
*/
OO.ui.WindowManager.prototype.addWindows = function ( windows ) {
var i, len, win, name, list;
if ( Array.isArray( windows ) ) {
// Convert to map of windows by looking up symbolic names from static configuration
list = {};
for ( i = 0, len = windows.length; i < len; i++ ) {
name = windows[ i ].constructor.static.name;
if ( typeof name !== 'string' ) {
throw new Error( 'Cannot add window' );
}
list[ name ] = windows[ i ];
}
} else if ( OO.isPlainObject( windows ) ) {
list = windows;
}
// Add windows
for ( name in list ) {
win = list[ name ];
this.windows[ name ] = win.toggle( false );
this.$element.append( win.$element );
win.setManager( this );
}
};
/**
* Remove the specified windows from the windows manager.
*
* Windows will be closed before they are removed. If you wish to remove all windows, you may wish to use
* the #clearWindows method instead. If you no longer need the window manager and want to ensure that it no
* longer listens to events, use the #destroy method.
*
* @param {string[]} names Symbolic names of windows to remove
* @return {jQuery.Promise} Promise resolved when window is closed and removed
* @throws {Error} An error is thrown if the named windows are not managed by the window manager.
*/
OO.ui.WindowManager.prototype.removeWindows = function ( names ) {
var i, len, win, name, cleanupWindow,
manager = this,
promises = [],
cleanup = function ( name, win ) {
delete manager.windows[ name ];
win.$element.detach();
};
for ( i = 0, len = names.length; i < len; i++ ) {
name = names[ i ];
win = this.windows[ name ];
if ( !win ) {
throw new Error( 'Cannot remove window' );
}
cleanupWindow = cleanup.bind( null, name, win );
promises.push( this.closeWindow( name ).then( cleanupWindow, cleanupWindow ) );
}
return $.when.apply( $, promises );
};
/**
* Remove all windows from the window manager.
*
* Windows will be closed before they are removed. Note that the window manager, though not in use, will still
* listen to events. If the window manager will not be used again, you may wish to use the #destroy method instead.
* To remove just a subset of windows, use the #removeWindows method.
*
* @return {jQuery.Promise} Promise resolved when all windows are closed and removed
*/
OO.ui.WindowManager.prototype.clearWindows = function () {
return this.removeWindows( Object.keys( this.windows ) );
};
/**
* Set dialog size. In general, this method should not be called directly.
*
* Fullscreen mode will be used if the dialog is too wide to fit in the screen.
*
* @chainable
*/
OO.ui.WindowManager.prototype.updateWindowSize = function ( win ) {
var isFullscreen;
// Bypass for non-current, and thus invisible, windows
if ( win !== this.currentWindow ) {
return;
}
isFullscreen = win.getSize() === 'full';
this.$element.toggleClass( 'oo-ui-windowManager-fullscreen', isFullscreen );
this.$element.toggleClass( 'oo-ui-windowManager-floating', !isFullscreen );
win.setDimensions( win.getSizeProperties() );
this.emit( 'resize', win );
return this;
};
/**
* Bind or unbind global events for scrolling.
*
* @private
* @param {boolean} [on] Bind global events
* @chainable
*/
OO.ui.WindowManager.prototype.toggleGlobalEvents = function ( on ) {
var scrollWidth, bodyMargin,
$body = $( this.getElementDocument().body ),
// We could have multiple window managers open so only modify
// the body css at the bottom of the stack
stackDepth = $body.data( 'windowManagerGlobalEvents' ) || 0 ;
on = on === undefined ? !!this.globalEvents : !!on;
if ( on ) {
if ( !this.globalEvents ) {
$( this.getElementWindow() ).on( {
// Start listening for top-level window dimension changes
'orientationchange resize': this.onWindowResizeHandler
} );
if ( stackDepth === 0 ) {
scrollWidth = window.innerWidth - document.documentElement.clientWidth;
bodyMargin = parseFloat( $body.css( 'margin-right' ) ) || 0;
$body.css( {
overflow: 'hidden',
'margin-right': bodyMargin + scrollWidth
} );
}
stackDepth++;
this.globalEvents = true;
}
} else if ( this.globalEvents ) {
$( this.getElementWindow() ).off( {
// Stop listening for top-level window dimension changes
'orientationchange resize': this.onWindowResizeHandler
} );
stackDepth--;
if ( stackDepth === 0 ) {
$body.css( {
overflow: '',
'margin-right': ''
} );
}
this.globalEvents = false;
}
$body.data( 'windowManagerGlobalEvents', stackDepth );
return this;
};
/**
* Toggle screen reader visibility of content other than the window manager.
*
* @private
* @param {boolean} [isolate] Make only the window manager visible to screen readers
* @chainable
*/
OO.ui.WindowManager.prototype.toggleAriaIsolation = function ( isolate ) {
isolate = isolate === undefined ? !this.$ariaHidden : !!isolate;
if ( isolate ) {
if ( !this.$ariaHidden ) {
// Hide everything other than the window manager from screen readers
this.$ariaHidden = $( 'body' )
.children()
.not( this.$element.parentsUntil( 'body' ).last() )
.attr( 'aria-hidden', '' );
}
} else if ( this.$ariaHidden ) {
// Restore screen reader visibility
this.$ariaHidden.removeAttr( 'aria-hidden' );
this.$ariaHidden = null;
}
return this;
};
/**
* Destroy the window manager.
*
* Destroying the window manager ensures that it will no longer listen to events. If you would like to
* continue using the window manager, but wish to remove all windows from it, use the #clearWindows method
* instead.
*/
OO.ui.WindowManager.prototype.destroy = function () {
this.toggleGlobalEvents( false );
this.toggleAriaIsolation( false );
this.clearWindows();
this.$element.remove();
};
/**
* A window is a container for elements that are in a child frame. They are used with
* a window manager (OO.ui.WindowManager), which is used to open and close the window and control
* its presentation. The size of a window is specified using a symbolic name (e.g., ‘small’, ‘medium’,
* ‘large’), which is interpreted by the window manager. If the requested size is not recognized,
* the window manager will choose a sensible fallback.
*
* The lifecycle of a window has three primary stages (opening, opened, and closing) in which
* different processes are executed:
*
* **opening**: The opening stage begins when the window manager's {@link OO.ui.WindowManager#openWindow
* openWindow} or the window's {@link #open open} methods are used, and the window manager begins to open
* the window.
*
* - {@link #getSetupProcess} method is called and its result executed
* - {@link #getReadyProcess} method is called and its result executed
*
* **opened**: The window is now open
*
* **closing**: The closing stage begins when the window manager's
* {@link OO.ui.WindowManager#closeWindow closeWindow}
* or the window's {@link #close} methods are used, and the window manager begins to close the window.
*
* - {@link #getHoldProcess} method is called and its result executed
* - {@link #getTeardownProcess} method is called and its result executed. The window is now closed
*
* Each of the window's processes (setup, ready, hold, and teardown) can be extended in subclasses
* by overriding the window's #getSetupProcess, #getReadyProcess, #getHoldProcess and #getTeardownProcess
* methods. Note that each {@link OO.ui.Process process} is executed in series, so asynchronous
* processing can complete. Always assume window processes are executed asynchronously.
*
* For more information, please see the [OOjs UI documentation on MediaWiki] [1].
*
* [1]: https://www.mediawiki.org/wiki/OOjs_UI/Windows
*
* @abstract
* @class
* @extends OO.ui.Element
* @mixins OO.EventEmitter
*
* @constructor
* @param {Object} [config] Configuration options
* @cfg {string} [size] Symbolic name of the dialog size: `small`, `medium`, `large`, `larger` or
* `full`. If omitted, the value of the {@link #static-size static size} property will be used.
*/
OO.ui.Window = function OoUiWindow( config ) {
// Configuration initialization
config = config || {};
// Parent constructor
OO.ui.Window.parent.call( this, config );
// Mixin constructors
OO.EventEmitter.call( this );
// Properties
this.manager = null;
this.size = config.size || this.constructor.static.size;
this.$frame = $( '<div>' );
this.$overlay = $( '<div>' );
this.$content = $( '<div>' );
this.$focusTrapBefore = $( '<div>' ).prop( 'tabIndex', 0 );
this.$focusTrapAfter = $( '<div>' ).prop( 'tabIndex', 0 );
this.$focusTraps = this.$focusTrapBefore.add( this.$focusTrapAfter );
// Initialization
this.$overlay.addClass( 'oo-ui-window-overlay' );
this.$content
.addClass( 'oo-ui-window-content' )
.attr( 'tabindex', 0 );
this.$frame
.addClass( 'oo-ui-window-frame' )
.append( this.$focusTrapBefore, this.$content, this.$focusTrapAfter );
this.$element
.addClass( 'oo-ui-window' )
.append( this.$frame, this.$overlay );
// Initially hidden - using #toggle may cause errors if subclasses override toggle with methods
// that reference properties not initialized at that time of parent class construction
// TODO: Find a better way to handle post-constructor setup
this.visible = false;
this.$element.addClass( 'oo-ui-element-hidden' );
};
/* Setup */
OO.inheritClass( OO.ui.Window, OO.ui.Element );
OO.mixinClass( OO.ui.Window, OO.EventEmitter );
/* Static Properties */
/**
* Symbolic name of the window size: `small`, `medium`, `large`, `larger` or `full`.
*
* The static size is used if no #size is configured during construction.
*
* @static
* @inheritable
* @property {string}
*/
OO.ui.Window.static.size = 'medium';
/* Methods */
/**
* Handle mouse down events.
*
* @private
* @param {jQuery.Event} e Mouse down event
*/
OO.ui.Window.prototype.onMouseDown = function ( e ) {
// Prevent clicking on the click-block from stealing focus
if ( e.target === this.$element[ 0 ] ) {
return false;
}
};
/**
* Check if the window has been initialized.
*
* Initialization occurs when a window is added to a manager.
*
* @return {boolean} Window has been initialized
*/
OO.ui.Window.prototype.isInitialized = function () {
return !!this.manager;
};
/**
* Check if the window is visible.
*
* @return {boolean} Window is visible
*/
OO.ui.Window.prototype.isVisible = function () {
return this.visible;
};
/**
* Check if the window is opening.
*
* This method is a wrapper around the window manager's {@link OO.ui.WindowManager#isOpening isOpening}
* method.
*
* @return {boolean} Window is opening
*/
OO.ui.Window.prototype.isOpening = function () {
return this.manager.isOpening( this );
};
/**
* Check if the window is closing.
*
* This method is a wrapper around the window manager's {@link OO.ui.WindowManager#isClosing isClosing} method.
*
* @return {boolean} Window is closing
*/
OO.ui.Window.prototype.isClosing = function () {
return this.manager.isClosing( this );
};
/**
* Check if the window is opened.
*
* This method is a wrapper around the window manager's {@link OO.ui.WindowManager#isOpened isOpened} method.
*
* @return {boolean} Window is opened
*/
OO.ui.Window.prototype.isOpened = function () {
return this.manager.isOpened( this );
};
/**
* Get the window manager.
*
* All windows must be attached to a window manager, which is used to open
* and close the window and control its presentation.
*
* @return {OO.ui.WindowManager} Manager of window
*/
OO.ui.Window.prototype.getManager = function () {
return this.manager;
};
/**
* Get the symbolic name of the window size (e.g., `small` or `medium`).
*
* @return {string} Symbolic name of the size: `small`, `medium`, `large`, `larger`, `full`
*/
OO.ui.Window.prototype.getSize = function () {
var viewport = OO.ui.Element.static.getDimensions( this.getElementWindow() ),
sizes = this.manager.constructor.static.sizes,
size = this.size;
if ( !sizes[ size ] ) {
size = this.manager.constructor.static.defaultSize;
}
if ( size !== 'full' && viewport.rect.right - viewport.rect.left < sizes[ size ].width ) {
size = 'full';
}
return size;
};
/**
* Get the size properties associated with the current window size
*
* @return {Object} Size properties
*/
OO.ui.Window.prototype.getSizeProperties = function () {
return this.manager.constructor.static.sizes[ this.getSize() ];
};
/**
* Disable transitions on window's frame for the duration of the callback function, then enable them
* back.
*
* @private
* @param {Function} callback Function to call while transitions are disabled
*/
OO.ui.Window.prototype.withoutSizeTransitions = function ( callback ) {
// Temporarily resize the frame so getBodyHeight() can use scrollHeight measurements.
// Disable transitions first, otherwise we'll get values from when the window was animating.
var oldTransition,
styleObj = this.$frame[ 0 ].style;
oldTransition = styleObj.transition || styleObj.OTransition || styleObj.MsTransition ||
styleObj.MozTransition || styleObj.WebkitTransition;
styleObj.transition = styleObj.OTransition = styleObj.MsTransition =
styleObj.MozTransition = styleObj.WebkitTransition = 'none';
callback();
// Force reflow to make sure the style changes done inside callback really are not transitioned
this.$frame.height();
styleObj.transition = styleObj.OTransition = styleObj.MsTransition =
styleObj.MozTransition = styleObj.WebkitTransition = oldTransition;
};
/**
* Get the height of the full window contents (i.e., the window head, body and foot together).
*
* What consistitutes the head, body, and foot varies depending on the window type.
* A {@link OO.ui.MessageDialog message dialog} displays a title and message in its body,
* and any actions in the foot. A {@link OO.ui.ProcessDialog process dialog} displays a title
* and special actions in the head, and dialog content in the body.
*
* To get just the height of the dialog body, use the #getBodyHeight method.
*
* @return {number} The height of the window contents (the dialog head, body and foot) in pixels
*/
OO.ui.Window.prototype.getContentHeight = function () {
var bodyHeight,
win = this,
bodyStyleObj = this.$body[ 0 ].style,
frameStyleObj = this.$frame[ 0 ].style;
// Temporarily resize the frame so getBodyHeight() can use scrollHeight measurements.
// Disable transitions first, otherwise we'll get values from when the window was animating.
this.withoutSizeTransitions( function () {
var oldHeight = frameStyleObj.height,
oldPosition = bodyStyleObj.position;
frameStyleObj.height = '1px';
// Force body to resize to new width
bodyStyleObj.position = 'relative';
bodyHeight = win.getBodyHeight();
frameStyleObj.height = oldHeight;
bodyStyleObj.position = oldPosition;
} );
return (
// Add buffer for border
( this.$frame.outerHeight() - this.$frame.innerHeight() ) +
// Use combined heights of children
( this.$head.outerHeight( true ) + bodyHeight + this.$foot.outerHeight( true ) )
);
};
/**
* Get the height of the window body.
*
* To get the height of the full window contents (the window body, head, and foot together),
* use #getContentHeight.
*
* When this function is called, the window will temporarily have been resized
* to height=1px, so .scrollHeight measurements can be taken accurately.
*
* @return {number} Height of the window body in pixels
*/
OO.ui.Window.prototype.getBodyHeight = function () {
return this.$body[ 0 ].scrollHeight;
};
/**
* Get the directionality of the frame (right-to-left or left-to-right).
*
* @return {string} Directionality: `'ltr'` or `'rtl'`
*/
OO.ui.Window.prototype.getDir = function () {
return OO.ui.Element.static.getDir( this.$content ) || 'ltr';
};
/**
* Get the 'setup' process.
*
* The setup process is used to set up a window for use in a particular context,
* based on the `data` argument. This method is called during the opening phase of the window’s
* lifecycle.
*
* Override this method to add additional steps to the ‘setup’ process the parent method provides
* using the {@link OO.ui.Process#first first} and {@link OO.ui.Process#next next} methods
* of OO.ui.Process.
*
* To add window content that persists between openings, you may wish to use the #initialize method
* instead.
*
* @param {Object} [data] Window opening data
* @return {OO.ui.Process} Setup process
*/
OO.ui.Window.prototype.getSetupProcess = function () {
return new OO.ui.Process();
};
/**
* Get the ‘ready’ process.
*
* The ready process is used to ready a window for use in a particular
* context, based on the `data` argument. This method is called during the opening phase of
* the window’s lifecycle, after the window has been {@link #getSetupProcess setup}.
*
* Override this method to add additional steps to the ‘ready’ process the parent method
* provides using the {@link OO.ui.Process#first first} and {@link OO.ui.Process#next next}
* methods of OO.ui.Process.
*
* @param {Object} [data] Window opening data
* @return {OO.ui.Process} Ready process
*/
OO.ui.Window.prototype.getReadyProcess = function () {
return new OO.ui.Process();
};
/**
* Get the 'hold' process.
*
* The hold proccess is used to keep a window from being used in a particular context,
* based on the `data` argument. This method is called during the closing phase of the window’s
* lifecycle.
*
* Override this method to add additional steps to the 'hold' process the parent method provides
* using the {@link OO.ui.Process#first first} and {@link OO.ui.Process#next next} methods
* of OO.ui.Process.
*
* @param {Object} [data] Window closing data
* @return {OO.ui.Process} Hold process
*/
OO.ui.Window.prototype.getHoldProcess = function () {
return new OO.ui.Process();
};
/**
* Get the ‘teardown’ process.
*
* The teardown process is used to teardown a window after use. During teardown,
* user interactions within the window are conveyed and the window is closed, based on the `data`
* argument. This method is called during the closing phase of the window’s lifecycle.
*
* Override this method to add additional steps to the ‘teardown’ process the parent method provides
* using the {@link OO.ui.Process#first first} and {@link OO.ui.Process#next next} methods
* of OO.ui.Process.
*
* @param {Object} [data] Window closing data
* @return {OO.ui.Process} Teardown process
*/
OO.ui.Window.prototype.getTeardownProcess = function () {
return new OO.ui.Process();
};
/**
* Set the window manager.
*
* This will cause the window to initialize. Calling it more than once will cause an error.
*
* @param {OO.ui.WindowManager} manager Manager for this window
* @throws {Error} An error is thrown if the method is called more than once
* @chainable
*/
OO.ui.Window.prototype.setManager = function ( manager ) {
if ( this.manager ) {
throw new Error( 'Cannot set window manager, window already has a manager' );
}
this.manager = manager;
this.initialize();
return this;
};
/**
* Set the window size by symbolic name (e.g., 'small' or 'medium')
*
* @param {string} size Symbolic name of size: `small`, `medium`, `large`, `larger` or
* `full`
* @chainable
*/
OO.ui.Window.prototype.setSize = function ( size ) {
this.size = size;
this.updateSize();
return this;
};
/**
* Update the window size.
*
* @throws {Error} An error is thrown if the window is not attached to a window manager
* @chainable
*/
OO.ui.Window.prototype.updateSize = function () {
if ( !this.manager ) {
throw new Error( 'Cannot update window size, must be attached to a manager' );
}
this.manager.updateWindowSize( this );
return this;
};
/**
* Set window dimensions. This method is called by the {@link OO.ui.WindowManager window manager}
* when the window is opening. In general, setDimensions should not be called directly.
*
* To set the size of the window, use the #setSize method.
*
* @param {Object} dim CSS dimension properties
* @param {string|number} [dim.width] Width
* @param {string|number} [dim.minWidth] Minimum width
* @param {string|number} [dim.maxWidth] Maximum width
* @param {string|number} [dim.height] Height, omit to set based on height of contents
* @param {string|number} [dim.minHeight] Minimum height
* @param {string|number} [dim.maxHeight] Maximum height
* @chainable
*/
OO.ui.Window.prototype.setDimensions = function ( dim ) {
var height,
win = this,
styleObj = this.$frame[ 0 ].style;
// Calculate the height we need to set using the correct width
if ( dim.height === undefined ) {
this.withoutSizeTransitions( function () {
var oldWidth = styleObj.width;
win.$frame.css( 'width', dim.width || '' );
height = win.getContentHeight();
styleObj.width = oldWidth;
} );
} else {
height = dim.height;
}
this.$frame.css( {
width: dim.width || '',
minWidth: dim.minWidth || '',
maxWidth: dim.maxWidth || '',
height: height || '',
minHeight: dim.minHeight || '',
maxHeight: dim.maxHeight || ''
} );
return this;
};
/**
* Initialize window contents.
*
* Before the window is opened for the first time, #initialize is called so that content that
* persists between openings can be added to the window.
*
* To set up a window with new content each time the window opens, use #getSetupProcess.
*
* @throws {Error} An error is thrown if the window is not attached to a window manager
* @chainable
*/
OO.ui.Window.prototype.initialize = function () {
if ( !this.manager ) {
throw new Error( 'Cannot initialize window, must be attached to a manager' );
}
// Properties
this.$head = $( '<div>' );
this.$body = $( '<div>' );
this.$foot = $( '<div>' );
this.$document = $( this.getElementDocument() );
// Events
this.$element.on( 'mousedown', this.onMouseDown.bind( this ) );
// Initialization
this.$head.addClass( 'oo-ui-window-head' );
this.$body.addClass( 'oo-ui-window-body' );
this.$foot.addClass( 'oo-ui-window-foot' );
this.$content.append( this.$head, this.$body, this.$foot );
return this;
};
/**
* Called when someone tries to focus the hidden element at the end of the dialog.
* Sends focus back to the start of the dialog.
*
* @param {jQuery.Event} event Focus event
*/
OO.ui.Window.prototype.onFocusTrapFocused = function ( event ) {
var backwards = this.$focusTrapBefore.is( event.target ),
element = OO.ui.findFocusable( this.$content, backwards );
if ( element ) {
// There's a focusable element inside the content, at the front or
// back depending on which focus trap we hit; select it.
element.focus();
} else {
// There's nothing focusable inside the content. As a fallback,
// this.$content is focusable, and focusing it will keep our focus
// properly trapped. It's not a *meaningful* focus, since it's just
// the content-div for the Window, but it's better than letting focus
// escape into the page.
this.$content.focus();
}
};
/**
* Open the window.
*
* This method is a wrapper around a call to the window manager’s {@link OO.ui.WindowManager#openWindow openWindow}
* method, which returns a promise resolved when the window is done opening.
*
* To customize the window each time it opens, use #getSetupProcess or #getReadyProcess.
*
* @param {Object} [data] Window opening data
* @return {jQuery.Promise} Promise resolved with a value when the window is opened, or rejected
* if the window fails to open. When the promise is resolved successfully, the first argument of the
* value is a new promise, which is resolved when the window begins closing.
* @throws {Error} An error is thrown if the window is not attached to a window manager
*/
OO.ui.Window.prototype.open = function ( data ) {
if ( !this.manager ) {
throw new Error( 'Cannot open window, must be attached to a manager' );
}
return this.manager.openWindow( this, data );
};
/**
* Close the window.
*
* This method is a wrapper around a call to the window
* manager’s {@link OO.ui.WindowManager#closeWindow closeWindow} method,
* which returns a closing promise resolved when the window is done closing.
*
* The window's #getHoldProcess and #getTeardownProcess methods are called during the closing
* phase of the window’s lifecycle and can be used to specify closing behavior each time
* the window closes.
*
* @param {Object} [data] Window closing data
* @return {jQuery.Promise} Promise resolved when window is closed
* @throws {Error} An error is thrown if the window is not attached to a window manager
*/
OO.ui.Window.prototype.close = function ( data ) {
if ( !this.manager ) {
throw new Error( 'Cannot close window, must be attached to a manager' );
}
return this.manager.closeWindow( this, data );
};
/**
* Setup window.
*
* This is called by OO.ui.WindowManager during window opening, and should not be called directly
* by other systems.
*
* @param {Object} [data] Window opening data
* @return {jQuery.Promise} Promise resolved when window is setup
*/
OO.ui.Window.prototype.setup = function ( data ) {
var win = this;
this.toggle( true );
this.focusTrapHandler = OO.ui.bind( this.onFocusTrapFocused, this );
this.$focusTraps.on( 'focus', this.focusTrapHandler );
return this.getSetupProcess( data ).execute().then( function () {
// Force redraw by asking the browser to measure the elements' widths
win.$element.addClass( 'oo-ui-window-active oo-ui-window-setup' ).width();
win.$content.addClass( 'oo-ui-window-content-setup' ).width();
} );
};
/**
* Ready window.
*
* This is called by OO.ui.WindowManager during window opening, and should not be called directly
* by other systems.
*
* @param {Object} [data] Window opening data
* @return {jQuery.Promise} Promise resolved when window is ready
*/
OO.ui.Window.prototype.ready = function ( data ) {
var win = this;
this.$content.focus();
return this.getReadyProcess( data ).execute().then( function () {
// Force redraw by asking the browser to measure the elements' widths
win.$element.addClass( 'oo-ui-window-ready' ).width();
win.$content.addClass( 'oo-ui-window-content-ready' ).width();
} );
};
/**
* Hold window.
*
* This is called by OO.ui.WindowManager during window closing, and should not be called directly
* by other systems.
*
* @param {Object} [data] Window closing data
* @return {jQuery.Promise} Promise resolved when window is held
*/
OO.ui.Window.prototype.hold = function ( data ) {
var win = this;
return this.getHoldProcess( data ).execute().then( function () {
// Get the focused element within the window's content
var $focus = win.$content.find( OO.ui.Element.static.getDocument( win.$content ).activeElement );
// Blur the focused element
if ( $focus.length ) {
$focus[ 0 ].blur();
}
// Force redraw by asking the browser to measure the elements' widths
win.$element.removeClass( 'oo-ui-window-ready' ).width();
win.$content.removeClass( 'oo-ui-window-content-ready' ).width();
} );
};
/**
* Teardown window.
*
* This is called by OO.ui.WindowManager during window closing, and should not be called directly
* by other systems.
*
* @param {Object} [data] Window closing data
* @return {jQuery.Promise} Promise resolved when window is torn down
*/
OO.ui.Window.prototype.teardown = function ( data ) {
var win = this;
return this.getTeardownProcess( data ).execute().then( function () {
// Force redraw by asking the browser to measure the elements' widths
win.$element.removeClass( 'oo-ui-window-active oo-ui-window-setup' ).width();
win.$content.removeClass( 'oo-ui-window-content-setup' ).width();
win.$focusTraps.off( 'focus', win.focusTrapHandler );
win.toggle( false );
} );
};
/**
* The Dialog class serves as the base class for the other types of dialogs.
* Unless extended to include controls, the rendered dialog box is a simple window
* that users can close by hitting the ‘Esc’ key. Dialog windows are used with OO.ui.WindowManager,
* which opens, closes, and controls the presentation of the window. See the
* [OOjs UI documentation on MediaWiki] [1] for more information.
*
* @example
* // A simple dialog window.
* function MyDialog( config ) {
* MyDialog.parent.call( this, config );
* }
* OO.inheritClass( MyDialog, OO.ui.Dialog );
* MyDialog.prototype.initialize = function () {
* MyDialog.parent.prototype.initialize.call( this );
* this.content = new OO.ui.PanelLayout( { padded: true, expanded: false } );
* this.content.$element.append( '<p>A simple dialog window. Press \'Esc\' to close.</p>' );
* this.$body.append( this.content.$element );
* };
* MyDialog.prototype.getBodyHeight = function () {
* return this.content.$element.outerHeight( true );
* };
* var myDialog = new MyDialog( {
* size: 'medium'
* } );
* // Create and append a window manager, which opens and closes the window.
* var windowManager = new OO.ui.WindowManager();
* $( 'body' ).append( windowManager.$element );
* windowManager.addWindows( [ myDialog ] );
* // Open the window!
* windowManager.openWindow( myDialog );
*
* [1]: https://www.mediawiki.org/wiki/OOjs_UI/Windows/Dialogs
*
* @abstract
* @class
* @extends OO.ui.Window
* @mixins OO.ui.mixin.PendingElement
*
* @constructor
* @param {Object} [config] Configuration options
*/
OO.ui.Dialog = function OoUiDialog( config ) {
// Parent constructor
OO.ui.Dialog.parent.call( this, config );
// Mixin constructors
OO.ui.mixin.PendingElement.call( this );
// Properties
this.actions = new OO.ui.ActionSet();
this.attachedActions = [];
this.currentAction = null;
this.onDialogKeyDownHandler = this.onDialogKeyDown.bind( this );
// Events
this.actions.connect( this, {
click: 'onActionClick',
resize: 'onActionResize',
change: 'onActionsChange'
} );
// Initialization
this.$element
.addClass( 'oo-ui-dialog' )
.attr( 'role', 'dialog' );
};
/* Setup */
OO.inheritClass( OO.ui.Dialog, OO.ui.Window );
OO.mixinClass( OO.ui.Dialog, OO.ui.mixin.PendingElement );
/* Static Properties */
/**
* Symbolic name of dialog.
*
* The dialog class must have a symbolic name in order to be registered with OO.Factory.
* Please see the [OOjs UI documentation on MediaWiki] [3] for more information.
*
* [3]: https://www.mediawiki.org/wiki/OOjs_UI/Windows/Window_managers
*
* @abstract
* @static
* @inheritable
* @property {string}
*/
OO.ui.Dialog.static.name = '';
/**
* The dialog title.
*
* The title can be specified as a plaintext string, a {@link OO.ui.mixin.LabelElement Label} node, or a function
* that will produce a Label node or string. The title can also be specified with data passed to the
* constructor (see #getSetupProcess). In this case, the static value will be overridden.
*
* @abstract
* @static
* @inheritable
* @property {jQuery|string|Function}
*/
OO.ui.Dialog.static.title = '';
/**
* An array of configured {@link OO.ui.ActionWidget action widgets}.
*
* Actions can also be specified with data passed to the constructor (see #getSetupProcess). In this case, the static
* value will be overridden.
*
* [2]: https://www.mediawiki.org/wiki/OOjs_UI/Windows/Process_Dialogs#Action_sets
*
* @static
* @inheritable
* @property {Object[]}
*/
OO.ui.Dialog.static.actions = [];
/**
* Close the dialog when the 'Esc' key is pressed.
*
* @static
* @abstract
* @inheritable
* @property {boolean}
*/
OO.ui.Dialog.static.escapable = true;
/* Methods */
/**
* Handle frame document key down events.
*
* @private
* @param {jQuery.Event} e Key down event
*/
OO.ui.Dialog.prototype.onDialogKeyDown = function ( e ) {
var actions;
if ( e.which === OO.ui.Keys.ESCAPE && this.constructor.static.escapable ) {
this.executeAction( '' );
e.preventDefault();
e.stopPropagation();
} else if ( e.which === OO.ui.Keys.ENTER && e.ctrlKey ) {
actions = this.actions.get( { flags: 'primary', visible: true, disabled: false } );
if ( actions.length > 0 ) {
this.executeAction( actions[ 0 ].getAction() );
e.preventDefault();
e.stopPropagation();
}
}
};
/**
* Handle action resized events.
*
* @private
* @param {OO.ui.ActionWidget} action Action that was resized
*/
OO.ui.Dialog.prototype.onActionResize = function () {
// Override in subclass
};
/**
* Handle action click events.
*
* @private
* @param {OO.ui.ActionWidget} action Action that was clicked
*/
OO.ui.Dialog.prototype.onActionClick = function ( action ) {
if ( !this.isPending() ) {
this.executeAction( action.getAction() );
}
};
/**
* Handle actions change event.
*
* @private
*/
OO.ui.Dialog.prototype.onActionsChange = function () {
this.detachActions();
if ( !this.isClosing() ) {
this.attachActions();
}
};
/**
* Get the set of actions used by the dialog.
*
* @return {OO.ui.ActionSet}
*/
OO.ui.Dialog.prototype.getActions = function () {
return this.actions;
};
/**
* Get a process for taking action.
*
* When you override this method, you can create a new OO.ui.Process and return it, or add additional
* accept steps to the process the parent method provides using the {@link OO.ui.Process#first 'first'}
* and {@link OO.ui.Process#next 'next'} methods of OO.ui.Process.
*
* @param {string} [action] Symbolic name of action
* @return {OO.ui.Process} Action process
*/
OO.ui.Dialog.prototype.getActionProcess = function ( action ) {
return new OO.ui.Process()
.next( function () {
if ( !action ) {
// An empty action always closes the dialog without data, which should always be
// safe and make no changes
this.close();
}
}, this );
};
/**
* @inheritdoc
*
* @param {Object} [data] Dialog opening data
* @param {jQuery|string|Function|null} [data.title] Dialog title, omit to use
* the {@link #static-title static title}
* @param {Object[]} [data.actions] List of configuration options for each
* {@link OO.ui.ActionWidget action widget}, omit to use {@link #static-actions static actions}.
*/
OO.ui.Dialog.prototype.getSetupProcess = function ( data ) {
data = data || {};
// Parent method
return OO.ui.Dialog.parent.prototype.getSetupProcess.call( this, data )
.next( function () {
var config = this.constructor.static,
actions = data.actions !== undefined ? data.actions : config.actions,
title = data.title !== undefined ? data.title : config.title;
this.title.setLabel( title ).setTitle( title );
this.actions.add( this.getActionWidgets( actions ) );
this.$element.on( 'keydown', this.onDialogKeyDownHandler );
}, this );
};
/**
* @inheritdoc
*/
OO.ui.Dialog.prototype.getTeardownProcess = function ( data ) {
// Parent method
return OO.ui.Dialog.parent.prototype.getTeardownProcess.call( this, data )
.first( function () {
this.$element.off( 'keydown', this.onDialogKeyDownHandler );
this.actions.clear();
this.currentAction = null;
}, this );
};
/**
* @inheritdoc
*/
OO.ui.Dialog.prototype.initialize = function () {
var titleId;
// Parent method
OO.ui.Dialog.parent.prototype.initialize.call( this );
titleId = OO.ui.generateElementId();
// Properties
this.title = new OO.ui.LabelWidget( {
id: titleId
} );
// Initialization
this.$content.addClass( 'oo-ui-dialog-content' );
this.$element.attr( 'aria-labelledby', titleId );
this.setPendingElement( this.$head );
};
/**
* Get action widgets from a list of configs
*
* @param {Object[]} actions Action widget configs
* @return {OO.ui.ActionWidget[]} Action widgets
*/
OO.ui.Dialog.prototype.getActionWidgets = function ( actions ) {
var i, len, widgets = [];
for ( i = 0, len = actions.length; i < len; i++ ) {
widgets.push(
new OO.ui.ActionWidget( actions[ i ] )
);
}
return widgets;
};
/**
* Attach action actions.
*
* @protected
*/
OO.ui.Dialog.prototype.attachActions = function () {
// Remember the list of potentially attached actions
this.attachedActions = this.actions.get();
};
/**
* Detach action actions.
*
* @protected
* @chainable
*/
OO.ui.Dialog.prototype.detachActions = function () {
var i, len;
// Detach all actions that may have been previously attached
for ( i = 0, len = this.attachedActions.length; i < len; i++ ) {
this.attachedActions[ i ].$element.detach();
}
this.attachedActions = [];
};
/**
* Execute an action.
*
* @param {string} action Symbolic name of action to execute
* @return {jQuery.Promise} Promise resolved when action completes, rejected if it fails
*/
OO.ui.Dialog.prototype.executeAction = function ( action ) {
this.pushPending();
this.currentAction = action;
return this.getActionProcess( action ).execute()
.always( this.popPending.bind( this ) );
};
/**
* MessageDialogs display a confirmation or alert message. By default, the rendered dialog box
* consists of a header that contains the dialog title, a body with the message, and a footer that
* contains any {@link OO.ui.ActionWidget action widgets}. The MessageDialog class is the only type
* of {@link OO.ui.Dialog dialog} that is usually instantiated directly.
*
* There are two basic types of message dialogs, confirmation and alert:
*
* - **confirmation**: the dialog title describes what a progressive action will do and the message provides
* more details about the consequences.
* - **alert**: the dialog title describes which event occurred and the message provides more information
* about why the event occurred.
*
* The MessageDialog class specifies two actions: ‘accept’, the primary
* action (e.g., ‘ok’) and ‘reject,’ the safe action (e.g., ‘cancel’). Both will close the window,
* passing along the selected action.
*
* For more information and examples, please see the [OOjs UI documentation on MediaWiki][1].
*
* @example
* // Example: Creating and opening a message dialog window.
* var messageDialog = new OO.ui.MessageDialog();
*
* // Create and append a window manager.
* var windowManager = new OO.ui.WindowManager();
* $( 'body' ).append( windowManager.$element );
* windowManager.addWindows( [ messageDialog ] );
* // Open the window.
* windowManager.openWindow( messageDialog, {
* title: 'Basic message dialog',
* message: 'This is the message'
* } );
*
* [1]: https://www.mediawiki.org/wiki/OOjs_UI/Windows/Message_Dialogs
*
* @class
* @extends OO.ui.Dialog
*
* @constructor
* @param {Object} [config] Configuration options
*/
OO.ui.MessageDialog = function OoUiMessageDialog( config ) {
// Parent constructor
OO.ui.MessageDialog.parent.call( this, config );
// Properties
this.verticalActionLayout = null;
// Initialization
this.$element.addClass( 'oo-ui-messageDialog' );
};
/* Setup */
OO.inheritClass( OO.ui.MessageDialog, OO.ui.Dialog );
/* Static Properties */
OO.ui.MessageDialog.static.name = 'message';
OO.ui.MessageDialog.static.size = 'small';
OO.ui.MessageDialog.static.verbose = false;
/**
* Dialog title.
*
* The title of a confirmation dialog describes what a progressive action will do. The
* title of an alert dialog describes which event occurred.
*
* @static
* @inheritable
* @property {jQuery|string|Function|null}
*/
OO.ui.MessageDialog.static.title = null;
/**
* The message displayed in the dialog body.
*
* A confirmation message describes the consequences of a progressive action. An alert
* message describes why an event occurred.
*
* @static
* @inheritable
* @property {jQuery|string|Function|null}
*/
OO.ui.MessageDialog.static.message = null;
// Note that OO.ui.alert() and OO.ui.confirm() rely on these.
OO.ui.MessageDialog.static.actions = [
{ action: 'accept', label: OO.ui.deferMsg( 'ooui-dialog-message-accept' ), flags: 'primary' },
{ action: 'reject', label: OO.ui.deferMsg( 'ooui-dialog-message-reject' ), flags: 'safe' }
];
/* Methods */
/**
* @inheritdoc
*/
OO.ui.MessageDialog.prototype.setManager = function ( manager ) {
OO.ui.MessageDialog.parent.prototype.setManager.call( this, manager );
// Events
this.manager.connect( this, {
resize: 'onResize'
} );
return this;
};
/**
* @inheritdoc
*/
OO.ui.MessageDialog.prototype.onActionResize = function ( action ) {
this.fitActions();
return OO.ui.MessageDialog.parent.prototype.onActionResize.call( this, action );
};
/**
* Handle window resized events.
*
* @private
*/
OO.ui.MessageDialog.prototype.onResize = function () {
var dialog = this;
dialog.fitActions();
// Wait for CSS transition to finish and do it again :(
setTimeout( function () {
dialog.fitActions();
}, 300 );
};
/**
* Toggle action layout between vertical and horizontal.
*
* @private
* @param {boolean} [value] Layout actions vertically, omit to toggle
* @chainable
*/
OO.ui.MessageDialog.prototype.toggleVerticalActionLayout = function ( value ) {
value = value === undefined ? !this.verticalActionLayout : !!value;
if ( value !== this.verticalActionLayout ) {
this.verticalActionLayout = value;
this.$actions
.toggleClass( 'oo-ui-messageDialog-actions-vertical', value )
.toggleClass( 'oo-ui-messageDialog-actions-horizontal', !value );
}
return this;
};
/**
* @inheritdoc
*/
OO.ui.MessageDialog.prototype.getActionProcess = function ( action ) {
if ( action ) {
return new OO.ui.Process( function () {
this.close( { action: action } );
}, this );
}
return OO.ui.MessageDialog.parent.prototype.getActionProcess.call( this, action );
};
/**
* @inheritdoc
*
* @param {Object} [data] Dialog opening data
* @param {jQuery|string|Function|null} [data.title] Description of the action being confirmed
* @param {jQuery|string|Function|null} [data.message] Description of the action's consequence
* @param {boolean} [data.verbose] Message is verbose and should be styled as a long message
* @param {Object[]} [data.actions] List of OO.ui.ActionOptionWidget configuration options for each
* action item
*/
OO.ui.MessageDialog.prototype.getSetupProcess = function ( data ) {
data = data || {};
// Parent method
return OO.ui.MessageDialog.parent.prototype.getSetupProcess.call( this, data )
.next( function () {
this.title.setLabel(
data.title !== undefined ? data.title : this.constructor.static.title
);
this.message.setLabel(
data.message !== undefined ? data.message : this.constructor.static.message
);
this.message.$element.toggleClass(
'oo-ui-messageDialog-message-verbose',
data.verbose !== undefined ? data.verbose : this.constructor.static.verbose
);
}, this );
};
/**
* @inheritdoc
*/
OO.ui.MessageDialog.prototype.getReadyProcess = function ( data ) {
data = data || {};
// Parent method
return OO.ui.MessageDialog.parent.prototype.getReadyProcess.call( this, data )
.next( function () {
// Focus the primary action button
var actions = this.actions.get();
actions = actions.filter( function ( action ) {
return action.getFlags().indexOf( 'primary' ) > -1;
} );
if ( actions.length > 0 ) {
actions[ 0 ].$button.focus();
}
}, this );
};
/**
* @inheritdoc
*/
OO.ui.MessageDialog.prototype.getBodyHeight = function () {
var bodyHeight, oldOverflow,
$scrollable = this.container.$element;
oldOverflow = $scrollable[ 0 ].style.overflow;
$scrollable[ 0 ].style.overflow = 'hidden';
OO.ui.Element.static.reconsiderScrollbars( $scrollable[ 0 ] );
bodyHeight = this.text.$element.outerHeight( true );
$scrollable[ 0 ].style.overflow = oldOverflow;
return bodyHeight;
};
/**
* @inheritdoc
*/
OO.ui.MessageDialog.prototype.setDimensions = function ( dim ) {
var $scrollable = this.container.$element;
OO.ui.MessageDialog.parent.prototype.setDimensions.call( this, dim );
// Twiddle the overflow property, otherwise an unnecessary scrollbar will be produced.
// Need to do it after transition completes (250ms), add 50ms just in case.
setTimeout( function () {
var oldOverflow = $scrollable[ 0 ].style.overflow;
$scrollable[ 0 ].style.overflow = 'hidden';
OO.ui.Element.static.reconsiderScrollbars( $scrollable[ 0 ] );
$scrollable[ 0 ].style.overflow = oldOverflow;
}, 300 );
return this;
};
/**
* @inheritdoc
*/
OO.ui.MessageDialog.prototype.initialize = function () {
// Parent method
OO.ui.MessageDialog.parent.prototype.initialize.call( this );
// Properties
this.$actions = $( '<div>' );
this.container = new OO.ui.PanelLayout( {
scrollable: true, classes: [ 'oo-ui-messageDialog-container' ]
} );
this.text = new OO.ui.PanelLayout( {
padded: true, expanded: false, classes: [ 'oo-ui-messageDialog-text' ]
} );
this.message = new OO.ui.LabelWidget( {
classes: [ 'oo-ui-messageDialog-message' ]
} );
// Initialization
this.title.$element.addClass( 'oo-ui-messageDialog-title' );
this.$content.addClass( 'oo-ui-messageDialog-content' );
this.container.$element.append( this.text.$element );
this.text.$element.append( this.title.$element, this.message.$element );
this.$body.append( this.container.$element );
this.$actions.addClass( 'oo-ui-messageDialog-actions' );
this.$foot.append( this.$actions );
};
/**
* @inheritdoc
*/
OO.ui.MessageDialog.prototype.attachActions = function () {
var i, len, other, special, others;
// Parent method
OO.ui.MessageDialog.parent.prototype.attachActions.call( this );
special = this.actions.getSpecial();
others = this.actions.getOthers();
if ( special.safe ) {
this.$actions.append( special.safe.$element );
special.safe.toggleFramed( false );
}
if ( others.length ) {
for ( i = 0, len = others.length; i < len; i++ ) {
other = others[ i ];
this.$actions.append( other.$element );
other.toggleFramed( false );
}
}
if ( special.primary ) {
this.$actions.append( special.primary.$element );
special.primary.toggleFramed( false );
}
if ( !this.isOpening() ) {
// If the dialog is currently opening, this will be called automatically soon.
// This also calls #fitActions.
this.updateSize();
}
};
/**
* Fit action actions into columns or rows.
*
* Columns will be used if all labels can fit without overflow, otherwise rows will be used.
*
* @private
*/
OO.ui.MessageDialog.prototype.fitActions = function () {
var i, len, action,
previous = this.verticalActionLayout,
actions = this.actions.get();
// Detect clipping
this.toggleVerticalActionLayout( false );
for ( i = 0, len = actions.length; i < len; i++ ) {
action = actions[ i ];
if ( action.$element.innerWidth() < action.$label.outerWidth( true ) ) {
this.toggleVerticalActionLayout( true );
break;
}
}
// Move the body out of the way of the foot
this.$body.css( 'bottom', this.$foot.outerHeight( true ) );
if ( this.verticalActionLayout !== previous ) {
// We changed the layout, window height might need to be updated.
this.updateSize();
}
};
/**
* ProcessDialog windows encapsulate a {@link OO.ui.Process process} and all of the code necessary
* to complete it. If the process terminates with an error, a customizable {@link OO.ui.Error error
* interface} alerts users to the trouble, permitting the user to dismiss the error and try again when
* relevant. The ProcessDialog class is always extended and customized with the actions and content
* required for each process.
*
* The process dialog box consists of a header that visually represents the ‘working’ state of long
* processes with an animation. The header contains the dialog title as well as
* two {@link OO.ui.ActionWidget action widgets}: a ‘safe’ action on the left (e.g., ‘Cancel’) and
* a ‘primary’ action on the right (e.g., ‘Done’).
*
* Like other windows, the process dialog is managed by a {@link OO.ui.WindowManager window manager}.
* Please see the [OOjs UI documentation on MediaWiki][1] for more information and examples.
*
* @example
* // Example: Creating and opening a process dialog window.
* function MyProcessDialog( config ) {
* MyProcessDialog.parent.call( this, config );
* }
* OO.inheritClass( MyProcessDialog, OO.ui.ProcessDialog );
*
* MyProcessDialog.static.title = 'Process dialog';
* MyProcessDialog.static.actions = [
* { action: 'save', label: 'Done', flags: 'primary' },
* { label: 'Cancel', flags: 'safe' }
* ];
*
* MyProcessDialog.prototype.initialize = function () {
* MyProcessDialog.parent.prototype.initialize.apply( this, arguments );
* this.content = new OO.ui.PanelLayout( { padded: true, expanded: false } );
* this.content.$element.append( '<p>This is a process dialog window. The header contains the title and two buttons: \'Cancel\' (a safe action) on the left and \'Done\' (a primary action) on the right.</p>' );
* this.$body.append( this.content.$element );
* };
* MyProcessDialog.prototype.getActionProcess = function ( action ) {
* var dialog = this;
* if ( action ) {
* return new OO.ui.Process( function () {
* dialog.close( { action: action } );
* } );
* }
* return MyProcessDialog.parent.prototype.getActionProcess.call( this, action );
* };
*
* var windowManager = new OO.ui.WindowManager();
* $( 'body' ).append( windowManager.$element );
*
* var dialog = new MyProcessDialog();
* windowManager.addWindows( [ dialog ] );
* windowManager.openWindow( dialog );
*
* [1]: https://www.mediawiki.org/wiki/OOjs_UI/Windows/Process_Dialogs
*
* @abstract
* @class
* @extends OO.ui.Dialog
*
* @constructor
* @param {Object} [config] Configuration options
*/
OO.ui.ProcessDialog = function OoUiProcessDialog( config ) {
// Parent constructor
OO.ui.ProcessDialog.parent.call( this, config );
// Properties
this.fitOnOpen = false;
// Initialization
this.$element.addClass( 'oo-ui-processDialog' );
};
/* Setup */
OO.inheritClass( OO.ui.ProcessDialog, OO.ui.Dialog );
/* Methods */
/**
* Handle dismiss button click events.
*
* Hides errors.
*
* @private
*/
OO.ui.ProcessDialog.prototype.onDismissErrorButtonClick = function () {
this.hideErrors();
};
/**
* Handle retry button click events.
*
* Hides errors and then tries again.
*
* @private
*/
OO.ui.ProcessDialog.prototype.onRetryButtonClick = function () {
this.hideErrors();
this.executeAction( this.currentAction );
};
/**
* @inheritdoc
*/
OO.ui.ProcessDialog.prototype.onActionResize = function ( action ) {
if ( this.actions.isSpecial( action ) ) {
this.fitLabel();
}
return OO.ui.ProcessDialog.parent.prototype.onActionResize.call( this, action );
};
/**
* @inheritdoc
*/
OO.ui.ProcessDialog.prototype.initialize = function () {
// Parent method
OO.ui.ProcessDialog.parent.prototype.initialize.call( this );
// Properties
this.$navigation = $( '<div>' );
this.$location = $( '<div>' );
this.$safeActions = $( '<div>' );
this.$primaryActions = $( '<div>' );
this.$otherActions = $( '<div>' );
this.dismissButton = new OO.ui.ButtonWidget( {
label: OO.ui.msg( 'ooui-dialog-process-dismiss' )
} );
this.retryButton = new OO.ui.ButtonWidget();
this.$errors = $( '<div>' );
this.$errorsTitle = $( '<div>' );
// Events
this.dismissButton.connect( this, { click: 'onDismissErrorButtonClick' } );
this.retryButton.connect( this, { click: 'onRetryButtonClick' } );
// Initialization
this.title.$element.addClass( 'oo-ui-processDialog-title' );
this.$location
.append( this.title.$element )
.addClass( 'oo-ui-processDialog-location' );
this.$safeActions.addClass( 'oo-ui-processDialog-actions-safe' );
this.$primaryActions.addClass( 'oo-ui-processDialog-actions-primary' );
this.$otherActions.addClass( 'oo-ui-processDialog-actions-other' );
this.$errorsTitle
.addClass( 'oo-ui-processDialog-errors-title' )
.text( OO.ui.msg( 'ooui-dialog-process-error' ) );
this.$errors
.addClass( 'oo-ui-processDialog-errors oo-ui-element-hidden' )
.append( this.$errorsTitle, this.dismissButton.$element, this.retryButton.$element );
this.$content
.addClass( 'oo-ui-processDialog-content' )
.append( this.$errors );
this.$navigation
.addClass( 'oo-ui-processDialog-navigation' )
// Note: Order of appends below is important. These are in the order
// we want tab to go through them. Display-order is handled entirely
// by CSS absolute-positioning. As such, primary actions like "done"
// should go first.
.append( this.$primaryActions, this.$location, this.$safeActions );
this.$head.append( this.$navigation );
this.$foot.append( this.$otherActions );
};
/**
* @inheritdoc
*/
OO.ui.ProcessDialog.prototype.getActionWidgets = function ( actions ) {
var i, len, widgets = [];
for ( i = 0, len = actions.length; i < len; i++ ) {
widgets.push(
new OO.ui.ActionWidget( $.extend( { framed: true }, actions[ i ] ) )
);
}
return widgets;
};
/**
* @inheritdoc
*/
OO.ui.ProcessDialog.prototype.attachActions = function () {
var i, len, other, special, others;
// Parent method
OO.ui.ProcessDialog.parent.prototype.attachActions.call( this );
special = this.actions.getSpecial();
others = this.actions.getOthers();
if ( special.primary ) {
this.$primaryActions.append( special.primary.$element );
}
for ( i = 0, len = others.length; i < len; i++ ) {
other = others[ i ];
this.$otherActions.append( other.$element );
}
if ( special.safe ) {
this.$safeActions.append( special.safe.$element );
}
this.fitLabel();
this.$body.css( 'bottom', this.$foot.outerHeight( true ) );
};
/**
* @inheritdoc
*/
OO.ui.ProcessDialog.prototype.executeAction = function ( action ) {
var process = this;
return OO.ui.ProcessDialog.parent.prototype.executeAction.call( this, action )
.fail( function ( errors ) {
process.showErrors( errors || [] );
} );
};
/**
* @inheritdoc
*/
OO.ui.ProcessDialog.prototype.setDimensions = function () {
// Parent method
OO.ui.ProcessDialog.parent.prototype.setDimensions.apply( this, arguments );
this.fitLabel();
};
/**
* Fit label between actions.
*
* @private
* @chainable
*/
OO.ui.ProcessDialog.prototype.fitLabel = function () {
var safeWidth, primaryWidth, biggerWidth, labelWidth, navigationWidth, leftWidth, rightWidth,
size = this.getSizeProperties();
if ( typeof size.width !== 'number' ) {
if ( this.isOpened() ) {
navigationWidth = this.$head.width() - 20;
} else if ( this.isOpening() ) {
if ( !this.fitOnOpen ) {
// Size is relative and the dialog isn't open yet, so wait.
this.manager.opening.done( this.fitLabel.bind( this ) );
this.fitOnOpen = true;
}
return;
} else {
return;
}
} else {
navigationWidth = size.width - 20;
}
safeWidth = this.$safeActions.is( ':visible' ) ? this.$safeActions.width() : 0;
primaryWidth = this.$primaryActions.is( ':visible' ) ? this.$primaryActions.width() : 0;
biggerWidth = Math.max( safeWidth, primaryWidth );
labelWidth = this.title.$element.width();
if ( 2 * biggerWidth + labelWidth < navigationWidth ) {
// We have enough space to center the label
leftWidth = rightWidth = biggerWidth;
} else {
// Let's hope we at least have enough space not to overlap, because we can't wrap the label…
if ( this.getDir() === 'ltr' ) {
leftWidth = safeWidth;
rightWidth = primaryWidth;
} else {
leftWidth = primaryWidth;
rightWidth = safeWidth;
}
}
this.$location.css( { paddingLeft: leftWidth, paddingRight: rightWidth } );
return this;
};
/**
* Handle errors that occurred during accept or reject processes.
*
* @private
* @param {OO.ui.Error[]|OO.ui.Error} errors Errors to be handled
*/
OO.ui.ProcessDialog.prototype.showErrors = function ( errors ) {
var i, len, $item, actions,
items = [],
abilities = {},
recoverable = true,
warning = false;
if ( errors instanceof OO.ui.Error ) {
errors = [ errors ];
}
for ( i = 0, len = errors.length; i < len; i++ ) {
if ( !errors[ i ].isRecoverable() ) {
recoverable = false;
}
if ( errors[ i ].isWarning() ) {
warning = true;
}
$item = $( '<div>' )
.addClass( 'oo-ui-processDialog-error' )
.append( errors[ i ].getMessage() );
items.push( $item[ 0 ] );
}
this.$errorItems = $( items );
if ( recoverable ) {
abilities[ this.currentAction ] = true;
// Copy the flags from the first matching action
actions = this.actions.get( { actions: this.currentAction } );
if ( actions.length ) {
this.retryButton.clearFlags().setFlags( actions[ 0 ].getFlags() );
}
} else {
abilities[ this.currentAction ] = false;
this.actions.setAbilities( abilities );
}
if ( warning ) {
this.retryButton.setLabel( OO.ui.msg( 'ooui-dialog-process-continue' ) );
} else {
this.retryButton.setLabel( OO.ui.msg( 'ooui-dialog-process-retry' ) );
}
this.retryButton.toggle( recoverable );
this.$errorsTitle.after( this.$errorItems );
this.$errors.removeClass( 'oo-ui-element-hidden' ).scrollTop( 0 );
};
/**
* Hide errors.
*
* @private
*/
OO.ui.ProcessDialog.prototype.hideErrors = function () {
this.$errors.addClass( 'oo-ui-element-hidden' );
if ( this.$errorItems ) {
this.$errorItems.remove();
this.$errorItems = null;
}
};
/**
* @inheritdoc
*/
OO.ui.ProcessDialog.prototype.getTeardownProcess = function ( data ) {
// Parent method
return OO.ui.ProcessDialog.parent.prototype.getTeardownProcess.call( this, data )
.first( function () {
// Make sure to hide errors
this.hideErrors();
this.fitOnOpen = false;
}, this );
};
/**
* @class OO.ui
*/
/**
* Lazy-initialize and return a global OO.ui.WindowManager instance, used by OO.ui.alert and
* OO.ui.confirm.
*
* @private
* @return {OO.ui.WindowManager}
*/
OO.ui.getWindowManager = function () {
if ( !OO.ui.windowManager ) {
OO.ui.windowManager = new OO.ui.WindowManager();
$( 'body' ).append( OO.ui.windowManager.$element );
OO.ui.windowManager.addWindows( {
messageDialog: new OO.ui.MessageDialog()
} );
}
return OO.ui.windowManager;
};
/**
* Display a quick modal alert dialog, using a OO.ui.MessageDialog. While the dialog is open, the
* rest of the page will be dimmed out and the user won't be able to interact with it. The dialog
* has only one action button, labelled "OK", clicking it will simply close the dialog.
*
* A window manager is created automatically when this function is called for the first time.
*
* @example
* OO.ui.alert( 'Something happened!' ).done( function () {
* console.log( 'User closed the dialog.' );
* } );
*
* @param {jQuery|string} text Message text to display
* @param {Object} [options] Additional options, see OO.ui.MessageDialog#getSetupProcess
* @return {jQuery.Promise} Promise resolved when the user closes the dialog
*/
OO.ui.alert = function ( text, options ) {
return OO.ui.getWindowManager().openWindow( 'messageDialog', $.extend( {
message: text,
verbose: true,
actions: [ OO.ui.MessageDialog.static.actions[ 0 ] ]
}, options ) ).then( function ( opened ) {
return opened.then( function ( closing ) {
return closing.then( function () {
return $.Deferred().resolve();
} );
} );
} );
};
/**
* Display a quick modal confirmation dialog, using a OO.ui.MessageDialog. While the dialog is open,
* the rest of the page will be dimmed out and the user won't be able to interact with it. The
* dialog has two action buttons, one to confirm an operation (labelled "OK") and one to cancel it
* (labelled "Cancel").
*
* A window manager is created automatically when this function is called for the first time.
*
* @example
* OO.ui.confirm( 'Are you sure?' ).done( function ( confirmed ) {
* if ( confirmed ) {
* console.log( 'User clicked "OK"!' );
* } else {
* console.log( 'User clicked "Cancel" or closed the dialog.' );
* }
* } );
*
* @param {jQuery|string} text Message text to display
* @param {Object} [options] Additional options, see OO.ui.MessageDialog#getSetupProcess
* @return {jQuery.Promise} Promise resolved when the user closes the dialog. If the user chose to
* confirm, the promise will resolve to boolean `true`; otherwise, it will resolve to boolean
* `false`.
*/
OO.ui.confirm = function ( text, options ) {
return OO.ui.getWindowManager().openWindow( 'messageDialog', $.extend( {
message: text,
verbose: true
}, options ) ).then( function ( opened ) {
return opened.then( function ( closing ) {
return closing.then( function ( data ) {
return $.Deferred().resolve( !!( data && data.action === 'accept' ) );
} );
} );
} );
};
}( OO ) );
|
server/sonar-web/src/main/js/apps/background-tasks/components/Header.js | lbndev/sonarqube | /*
* SonarQube
* Copyright (C) 2009-2017 SonarSource SA
* mailto:info AT sonarsource DOT com
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
/* @flow */
import React from 'react';
import { translate } from '../../../helpers/l10n';
const Header = () => {
return (
<header className="page-header">
<h1 className="page-title">
{translate('background_tasks.page')}
</h1>
<p className="page-description">
{translate('background_tasks.page.description')}
</p>
</header>
);
};
export default Header;
|
app/javascript/mastodon/containers/media_gallery_container.js | increments/mastodon | import React from 'react';
import PropTypes from 'prop-types';
import { IntlProvider, addLocaleData } from 'react-intl';
import { getLocale } from '../locales';
import MediaGallery from '../components/media_gallery';
import { fromJS } from 'immutable';
const { localeData, messages } = getLocale();
addLocaleData(localeData);
export default class MediaGalleryContainer extends React.PureComponent {
static propTypes = {
locale: PropTypes.string.isRequired,
media: PropTypes.array.isRequired,
};
handleOpenMedia = () => {}
render () {
const { locale, media, ...props } = this.props;
return (
<IntlProvider locale={locale} messages={messages}>
<MediaGallery
{...props}
media={fromJS(media)}
onOpenMedia={this.handleOpenMedia}
/>
</IntlProvider>
);
}
}
|
src/Components/DatePicker/MonthsView.js | sqhtiamo/zaro | import React from 'react';
import createClass from 'create-react-class';
import onClickOutside from 'react-onclickoutside';
/* eslint-disable */
function capitalize(str) {
return str.charAt(0).toUpperCase() + str.slice(1);
}
const DOM = React.DOM;
const DateTimePickerMonths = onClickOutside(createClass({
renderMonths() {
const date = this.props.selectedDate;
const month = this.props.viewDate.month();
const year = this.props.viewDate.year();
const rows = [];
const irrelevantDate = 1;
const renderer = this.props.renderMonth || this.renderMonth;
const isValid = this.props.isValidDate || this.alwaysValidDate;
let classes;
let props;
let currentMonth;
let isDisabled;
let noOfDaysInMonth;
let daysInMonth;
let validDay;
let i = 0;
let months = [];
while (i < 12) {
classes = 'rdtMonth';
currentMonth =
this.props.viewDate.clone().set({ year, month: i, date: irrelevantDate });
noOfDaysInMonth = currentMonth.endOf('month').format('D');
daysInMonth = Array.from({ length: noOfDaysInMonth }, (e, i) => i + 1);
validDay = daysInMonth.find((d) => {
const day = currentMonth.clone().set('date', d);
return isValid(day);
});
isDisabled = (validDay === undefined);
if (isDisabled) { classes += ' rdtDisabled'; }
if (date && i === date.month() && year === date.year()) { classes += ' rdtActive'; }
props = {
key: i,
'data-value': i,
className: classes
};
if (!isDisabled) {
props.onClick = (this.props.updateOn === 'months' ?
this.updateSelectedMonth : this.props.setDate('month'));
}
months.push(renderer(props, i, year, date && date.clone()));
if (months.length === 4) {
rows.push(DOM.tr({ key: `${month}_${rows.length}` }, months));
months = [];
}
i += 1;
}
return rows;
},
updateSelectedMonth(event) {
this.props.updateSelectedDate(event);
},
renderMonth(props, month) {
const localMoment = this.props.viewDate;
const monthStr = localMoment.localeData().monthsShort(localMoment.month(month));
const strLength = 3;
// Because some months are up to 5 characters long, we want to
// use a fixed string length for consistency
const monthStrFixedLength = monthStr.substring(0, strLength);
return DOM.td(props, capitalize(monthStrFixedLength));
},
render() {
return DOM.div({ className: 'rdtMonths' }, [
DOM.table({ key: 'a' }, DOM.thead({}, DOM.tr({}, [
DOM.th({ key: 'prev', className: 'rdtPrev', onClick: this.props.subtractTime(1, 'years') }, DOM.span({}, '‹')),
DOM.th({ key: 'year', className: 'rdtSwitch', onClick: this.props.showView('years'), colSpan: 2, 'data-value': this.props.viewDate.year() }, this.props.viewDate.year()),
DOM.th({ key: 'next', className: 'rdtNext', onClick: this.props.addTime(1, 'years') }, DOM.span({}, '›'))
]))),
DOM.table({ key: 'months' }, DOM.tbody({ key: 'b' }, this.renderMonths()))
]);
},
alwaysValidDate() {
return 1;
},
handleClickOutside() {
this.props.handleClickOutside();
}
}));
/* eslint-enable */
export default DateTimePickerMonths;
|
packages/showcase/misc/2d-dragable-plot.js | uber-common/react-vis | // Copyright (c) 2016 - 2017 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
import React from 'react';
import {
XYPlot,
XAxis,
YAxis,
VerticalGridLines,
HorizontalGridLines,
MarkSeries,
Highlight,
Hint
} from 'react-vis';
import {generateSeededRandom} from '../showcase-utils';
const seededRandom = generateSeededRandom(3);
// randomly generated data
const data = [...new Array(30)].map(() => ({
x: seededRandom() * 5,
y: seededRandom() * 10
}));
export default class BidirectionDragChart extends React.Component {
state = {
filter: null,
hovered: null,
highlighting: false
};
render() {
const {filter, hovered, highlighting} = this.state;
const highlightPoint = d => {
if (!filter) {
return false;
}
const leftRight = d.x <= filter.right && d.x >= filter.left;
const upDown = d.y <= filter.top && d.y >= filter.bottom;
return leftRight && upDown;
};
const numSelectedPoints = filter ? data.filter(highlightPoint).length : 0;
return (
<div>
<XYPlot width={300} height={300}>
<VerticalGridLines />
<HorizontalGridLines />
<XAxis />
<YAxis />
<Highlight
drag
onBrushStart={() => this.setState({highlighting: true})}
onBrush={area => this.setState({filter: area})}
onBrushEnd={area =>
this.setState({highlighting: false, filter: area})
}
onDragStart={() => this.setState({highlighting: true})}
onDrag={area => this.setState({filter: area})}
onDragEnd={area =>
this.setState({highlighting: false, filter: area})
}
/>
<MarkSeries
className="mark-series-example"
strokeWidth={2}
opacity="0.8"
sizeRange={[5, 15]}
style={{pointerEvents: highlighting ? 'none' : ''}}
colorType="literal"
getColor={d => (highlightPoint(d) ? '#EF5D28' : '#12939A')}
onValueMouseOver={d => this.setState({hovered: d})}
onValueMouseOut={() => this.setState({hovered: false})}
data={data}
/>
{hovered && <Hint value={hovered} />}
</XYPlot>
<p>{`There are ${numSelectedPoints} selected points`}</p>
</div>
);
}
}
|
packages/react-widgets/test/CalendarMonth-test.js | haneev/react-widgets | import React from 'react'
import tsp from 'teaspoon';
import Month from '../src/Month'
describe('Month Component', function(){
it('should use the right format', () => {
var date = new Date(2015, 1, 16, 0, 0, 0)
, formatter = sinon.spy(() => 'hi')
tsp(
<Month
value={date}
focused={date}
onChange={()=>{}}
dateFormat='dd'
dayFormat='d'
activeId='month'
/>
)
.render()
.tap(inst =>
expect(inst.first('td').text()).to.equal('01')
)
.props({ dateFormat: '-d' })
.tap(inst =>
expect(inst.first('td').text()).to.equal('-1')
)
.props({ dateFormat: formatter, culture: 'en' })
.tap(inst =>
expect(inst.first('td').text()).to.equal('hi'))
expect(formatter.called).to.equal(true);
expect(formatter.args[0].length).to.equal(3);
expect(formatter.args[0][0]).to.be.a('Date');
expect(formatter.args[0][1]).to.be.a('string').and.to.equal('en');
})
})
|
packages/material-ui-icons/src/Feedback.js | AndriusBil/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from 'material-ui/SvgIcon';
let Feedback = props =>
<SvgIcon {...props}>
<path d="M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-7 12h-2v-2h2v2zm0-4h-2V6h2v4z" />
</SvgIcon>;
Feedback = pure(Feedback);
Feedback.muiName = 'SvgIcon';
export default Feedback;
|
common/components/App.js | BostonGlobe/elections-2017 | import React from 'react'
import PropTypes from 'prop-types'
const App = ({ children }) => (
<div className='App'>
{ children }
</div>
)
App.propTypes = {
children: PropTypes.object.isRequired,
}
export default App
|
packages/material-ui-icons/src/OpacityTwoTone.js | Kagami/material-ui | import React from 'react';
import createSvgIcon from './utils/createSvgIcon';
export default createSvgIcon(
<React.Fragment><path fill="none" d="M24 0H0v24h24V0zm0 0H0v24h24V0zM0 24h24V0H0v24z" /><path d="M16.24 9.65L12 5.27 7.76 9.6C6.62 10.73 6.01 12 6 14h12c-.01-2-.62-3.23-1.76-4.35z" opacity=".3" /><path d="M17.66 8L12 2.35 6.34 8C4.78 9.56 4 11.64 4 13.64s.78 4.11 2.34 5.67 3.61 2.35 5.66 2.35 4.1-.79 5.66-2.35S20 15.64 20 13.64 19.22 9.56 17.66 8zM6 14c.01-2 .62-3.27 1.76-4.4L12 5.27l4.24 4.38C17.38 10.77 17.99 12 18 14H6z" /></React.Fragment>
, 'OpacityTwoTone');
|
ajax/libs/yui/3.18.0/scrollview-base/scrollview-base-debug.js | aashish24/cdnjs | YUI.add('scrollview-base', function (Y, NAME) {
/**
* The scrollview-base module provides a basic ScrollView Widget, without scrollbar indicators
*
* @module scrollview
* @submodule scrollview-base
*/
// Local vars
var getClassName = Y.ClassNameManager.getClassName,
DOCUMENT = Y.config.doc,
IE = Y.UA.ie,
NATIVE_TRANSITIONS = Y.Transition.useNative,
vendorPrefix = Y.Transition._VENDOR_PREFIX, // Todo: This is a private property, and alternative approaches should be investigated
SCROLLVIEW = 'scrollview',
CLASS_NAMES = {
vertical: getClassName(SCROLLVIEW, 'vert'),
horizontal: getClassName(SCROLLVIEW, 'horiz')
},
EV_SCROLL_END = 'scrollEnd',
FLICK = 'flick',
DRAG = 'drag',
MOUSEWHEEL = 'mousewheel',
UI = 'ui',
TOP = 'top',
LEFT = 'left',
PX = 'px',
AXIS = 'axis',
SCROLL_Y = 'scrollY',
SCROLL_X = 'scrollX',
BOUNCE = 'bounce',
DISABLED = 'disabled',
DECELERATION = 'deceleration',
DIM_X = 'x',
DIM_Y = 'y',
BOUNDING_BOX = 'boundingBox',
CONTENT_BOX = 'contentBox',
GESTURE_MOVE = 'gesturemove',
START = 'start',
END = 'end',
EMPTY = '',
ZERO = '0s',
SNAP_DURATION = 'snapDuration',
SNAP_EASING = 'snapEasing',
EASING = 'easing',
FRAME_DURATION = 'frameDuration',
BOUNCE_RANGE = 'bounceRange',
_constrain = function (val, min, max) {
return Math.min(Math.max(val, min), max);
};
/**
* ScrollView provides a scrollable widget, supporting flick gestures,
* across both touch and mouse based devices.
*
* @class ScrollView
* @param config {Object} Object literal with initial attribute values
* @extends Widget
* @constructor
*/
function ScrollView() {
ScrollView.superclass.constructor.apply(this, arguments);
}
Y.ScrollView = Y.extend(ScrollView, Y.Widget, {
// *** Y.ScrollView prototype
/**
* Flag driving whether or not we should try and force H/W acceleration when transforming. Currently enabled by default for Webkit.
* Used by the _transform method.
*
* @property _forceHWTransforms
* @type boolean
* @protected
*/
_forceHWTransforms: Y.UA.webkit ? true : false,
/**
* <p>Used to control whether or not ScrollView's internal
* gesturemovestart, gesturemove and gesturemoveend
* event listeners should preventDefault. The value is an
* object, with "start", "move" and "end" properties used to
* specify which events should preventDefault and which shouldn't:</p>
*
* <pre>
* {
* start: false,
* move: true,
* end: false
* }
* </pre>
*
* <p>The default values are set up in order to prevent panning,
* on touch devices, while allowing click listeners on elements inside
* the ScrollView to be notified as expected.</p>
*
* @property _prevent
* @type Object
* @protected
*/
_prevent: {
start: false,
move: true,
end: false
},
/**
* Contains the distance (postive or negative) in pixels by which
* the scrollview was last scrolled. This is useful when setting up
* click listeners on the scrollview content, which on mouse based
* devices are always fired, even after a drag/flick.
*
* <p>Touch based devices don't currently fire a click event,
* if the finger has been moved (beyond a threshold) so this
* check isn't required, if working in a purely touch based environment</p>
*
* @property lastScrolledAmt
* @type Number
* @public
* @default 0
*/
lastScrolledAmt: 0,
/**
* Internal state, defines the minimum amount that the scrollview can be scrolled along the X axis
*
* @property _minScrollX
* @type number
* @protected
*/
_minScrollX: null,
/**
* Internal state, defines the maximum amount that the scrollview can be scrolled along the X axis
*
* @property _maxScrollX
* @type number
* @protected
*/
_maxScrollX: null,
/**
* Internal state, defines the minimum amount that the scrollview can be scrolled along the Y axis
*
* @property _minScrollY
* @type number
* @protected
*/
_minScrollY: null,
/**
* Internal state, defines the maximum amount that the scrollview can be scrolled along the Y axis
*
* @property _maxScrollY
* @type number
* @protected
*/
_maxScrollY: null,
/**
* Designated initializer
*
* @method initializer
* @param {Object} Configuration object for the plugin
*/
initializer: function () {
var sv = this;
// Cache these values, since they aren't going to change.
sv._bb = sv.get(BOUNDING_BOX);
sv._cb = sv.get(CONTENT_BOX);
// Cache some attributes
sv._cAxis = sv.get(AXIS);
sv._cBounce = sv.get(BOUNCE);
sv._cBounceRange = sv.get(BOUNCE_RANGE);
sv._cDeceleration = sv.get(DECELERATION);
sv._cFrameDuration = sv.get(FRAME_DURATION);
},
/**
* bindUI implementation
*
* Hooks up events for the widget
* @method bindUI
*/
bindUI: function () {
var sv = this;
// Bind interaction listers
sv._bindFlick(sv.get(FLICK));
sv._bindDrag(sv.get(DRAG));
sv._bindMousewheel(true);
// Bind change events
sv._bindAttrs();
// IE SELECT HACK. See if we can do this non-natively and in the gesture for a future release.
if (IE) {
sv._fixIESelect(sv._bb, sv._cb);
}
// Set any deprecated static properties
if (ScrollView.SNAP_DURATION) {
sv.set(SNAP_DURATION, ScrollView.SNAP_DURATION);
}
if (ScrollView.SNAP_EASING) {
sv.set(SNAP_EASING, ScrollView.SNAP_EASING);
}
if (ScrollView.EASING) {
sv.set(EASING, ScrollView.EASING);
}
if (ScrollView.FRAME_STEP) {
sv.set(FRAME_DURATION, ScrollView.FRAME_STEP);
}
if (ScrollView.BOUNCE_RANGE) {
sv.set(BOUNCE_RANGE, ScrollView.BOUNCE_RANGE);
}
// Recalculate dimension properties
// TODO: This should be throttled.
// Y.one(WINDOW).after('resize', sv._afterDimChange, sv);
},
/**
* Bind event listeners
*
* @method _bindAttrs
* @private
*/
_bindAttrs: function () {
var sv = this,
scrollChangeHandler = sv._afterScrollChange,
dimChangeHandler = sv._afterDimChange;
// Bind any change event listeners
sv.after({
'scrollEnd': sv._afterScrollEnd,
'disabledChange': sv._afterDisabledChange,
'flickChange': sv._afterFlickChange,
'dragChange': sv._afterDragChange,
'axisChange': sv._afterAxisChange,
'scrollYChange': scrollChangeHandler,
'scrollXChange': scrollChangeHandler,
'heightChange': dimChangeHandler,
'widthChange': dimChangeHandler
});
},
/**
* Bind (or unbind) gesture move listeners required for drag support
*
* @method _bindDrag
* @param drag {boolean} If true, the method binds listener to enable
* drag (gesturemovestart). If false, the method unbinds gesturemove
* listeners for drag support.
* @private
*/
_bindDrag: function (drag) {
var sv = this,
bb = sv._bb;
// Unbind any previous 'drag' listeners
bb.detach(DRAG + '|*');
if (drag) {
bb.on(DRAG + '|' + GESTURE_MOVE + START, Y.bind(sv._onGestureMoveStart, sv));
}
},
/**
* Bind (or unbind) flick listeners.
*
* @method _bindFlick
* @param flick {Object|boolean} If truthy, the method binds listeners for
* flick support. If false, the method unbinds flick listeners.
* @private
*/
_bindFlick: function (flick) {
var sv = this,
bb = sv._bb;
// Unbind any previous 'flick' listeners
bb.detach(FLICK + '|*');
if (flick) {
bb.on(FLICK + '|' + FLICK, Y.bind(sv._flick, sv), flick);
// Rebind Drag, becuase _onGestureMoveEnd always has to fire -after- _flick
sv._bindDrag(sv.get(DRAG));
}
},
/**
* Bind (or unbind) mousewheel listeners.
*
* @method _bindMousewheel
* @param mousewheel {Object|boolean} If truthy, the method binds listeners for
* mousewheel support. If false, the method unbinds mousewheel listeners.
* @private
*/
_bindMousewheel: function (mousewheel) {
var sv = this,
bb = sv._bb;
// Unbind any previous 'mousewheel' listeners
// TODO: This doesn't actually appear to work properly. Fix. #2532743
bb.detach(MOUSEWHEEL + '|*');
// Only enable for vertical scrollviews
if (mousewheel) {
// Bound to document, because that's where mousewheel events fire off of.
Y.one(DOCUMENT).on(MOUSEWHEEL, Y.bind(sv._mousewheel, sv));
}
},
/**
* syncUI implementation.
*
* Update the scroll position, based on the current value of scrollX/scrollY.
*
* @method syncUI
*/
syncUI: function () {
var sv = this,
scrollDims = sv._getScrollDims(),
width = scrollDims.offsetWidth,
height = scrollDims.offsetHeight,
scrollWidth = scrollDims.scrollWidth,
scrollHeight = scrollDims.scrollHeight;
// If the axis is undefined, auto-calculate it
if (sv._cAxis === undefined) {
// This should only ever be run once (for now).
// In the future SV might post-load axis changes
sv._cAxis = {
x: (scrollWidth > width),
y: (scrollHeight > height)
};
sv._set(AXIS, sv._cAxis);
}
// get text direction on or inherited by scrollview node
sv.rtl = (sv._cb.getComputedStyle('direction') === 'rtl');
// Cache the disabled value
sv._cDisabled = sv.get(DISABLED);
// Run this to set initial values
sv._uiDimensionsChange();
// If we're out-of-bounds, snap back.
if (sv._isOutOfBounds()) {
sv._snapBack();
}
},
/**
* Utility method to obtain widget dimensions
*
* @method _getScrollDims
* @return {Object} The offsetWidth, offsetHeight, scrollWidth and
* scrollHeight as an array: [offsetWidth, offsetHeight, scrollWidth,
* scrollHeight]
* @private
*/
_getScrollDims: function () {
var sv = this,
cb = sv._cb,
bb = sv._bb,
TRANS = ScrollView._TRANSITION,
// Ideally using CSSMatrix - don't think we have it normalized yet though.
// origX = (new WebKitCSSMatrix(cb.getComputedStyle("transform"))).e,
// origY = (new WebKitCSSMatrix(cb.getComputedStyle("transform"))).f,
origX = sv.get(SCROLL_X),
origY = sv.get(SCROLL_Y),
origHWTransform,
dims;
// TODO: Is this OK? Just in case it's called 'during' a transition.
if (NATIVE_TRANSITIONS) {
cb.setStyle(TRANS.DURATION, ZERO);
cb.setStyle(TRANS.PROPERTY, EMPTY);
}
origHWTransform = sv._forceHWTransforms;
sv._forceHWTransforms = false; // the z translation was causing issues with picking up accurate scrollWidths in Chrome/Mac.
sv._moveTo(cb, 0, 0);
dims = {
'offsetWidth': bb.get('offsetWidth'),
'offsetHeight': bb.get('offsetHeight'),
'scrollWidth': bb.get('scrollWidth'),
'scrollHeight': bb.get('scrollHeight')
};
sv._moveTo(cb, -(origX), -(origY));
sv._forceHWTransforms = origHWTransform;
return dims;
},
/**
* This method gets invoked whenever the height or width attributes change,
* allowing us to determine which scrolling axes need to be enabled.
*
* @method _uiDimensionsChange
* @protected
*/
_uiDimensionsChange: function () {
var sv = this,
bb = sv._bb,
scrollDims = sv._getScrollDims(),
width = scrollDims.offsetWidth,
height = scrollDims.offsetHeight,
scrollWidth = scrollDims.scrollWidth,
scrollHeight = scrollDims.scrollHeight,
rtl = sv.rtl,
svAxis = sv._cAxis,
minScrollX = (rtl ? Math.min(0, -(scrollWidth - width)) : 0),
maxScrollX = (rtl ? 0 : Math.max(0, scrollWidth - width)),
minScrollY = 0,
maxScrollY = Math.max(0, scrollHeight - height);
if (svAxis && svAxis.x) {
bb.addClass(CLASS_NAMES.horizontal);
}
if (svAxis && svAxis.y) {
bb.addClass(CLASS_NAMES.vertical);
}
sv._setBounds({
minScrollX: minScrollX,
maxScrollX: maxScrollX,
minScrollY: minScrollY,
maxScrollY: maxScrollY
});
},
/**
* Set the bounding dimensions of the ScrollView
*
* @method _setBounds
* @protected
* @param bounds {Object} [duration] ms of the scroll animation. (default is 0)
* @param {Number} [bounds.minScrollX] The minimum scroll X value
* @param {Number} [bounds.maxScrollX] The maximum scroll X value
* @param {Number} [bounds.minScrollY] The minimum scroll Y value
* @param {Number} [bounds.maxScrollY] The maximum scroll Y value
*/
_setBounds: function (bounds) {
var sv = this;
// TODO: Do a check to log if the bounds are invalid
sv._minScrollX = bounds.minScrollX;
sv._maxScrollX = bounds.maxScrollX;
sv._minScrollY = bounds.minScrollY;
sv._maxScrollY = bounds.maxScrollY;
},
/**
* Get the bounding dimensions of the ScrollView
*
* @method _getBounds
* @protected
*/
_getBounds: function () {
var sv = this;
return {
minScrollX: sv._minScrollX,
maxScrollX: sv._maxScrollX,
minScrollY: sv._minScrollY,
maxScrollY: sv._maxScrollY
};
},
/**
* Scroll the element to a given xy coordinate
*
* @method scrollTo
* @param x {Number} The x-position to scroll to. (null for no movement)
* @param y {Number} The y-position to scroll to. (null for no movement)
* @param {Number} [duration] ms of the scroll animation. (default is 0)
* @param {String} [easing] An easing equation if duration is set. (default is `easing` attribute)
* @param {String} [node] The node to transform. Setting this can be useful in
* dual-axis paginated instances. (default is the instance's contentBox)
*/
scrollTo: function (x, y, duration, easing, node) {
// Check to see if widget is disabled
if (this._cDisabled) {
return;
}
var sv = this,
cb = sv._cb,
TRANS = ScrollView._TRANSITION,
callback = Y.bind(sv._onTransEnd, sv), // @Todo : cache this
newX = 0,
newY = 0,
transition = {},
transform;
// default the optional arguments
duration = duration || 0;
easing = easing || sv.get(EASING); // @TODO: Cache this
node = node || cb;
if (x !== null) {
sv.set(SCROLL_X, x, {src:UI});
newX = -(x);
}
if (y !== null) {
sv.set(SCROLL_Y, y, {src:UI});
newY = -(y);
}
transform = sv._transform(newX, newY);
if (NATIVE_TRANSITIONS) {
// ANDROID WORKAROUND - try and stop existing transition, before kicking off new one.
node.setStyle(TRANS.DURATION, ZERO).setStyle(TRANS.PROPERTY, EMPTY);
}
// Move
if (duration === 0) {
if (NATIVE_TRANSITIONS) {
node.setStyle('transform', transform);
}
else {
// TODO: If both set, batch them in the same update
// Update: Nope, setStyles() just loops through each property and applies it.
if (x !== null) {
node.setStyle(LEFT, newX + PX);
}
if (y !== null) {
node.setStyle(TOP, newY + PX);
}
}
}
// Animate
else {
transition.easing = easing;
transition.duration = duration / 1000;
if (NATIVE_TRANSITIONS) {
transition.transform = transform;
}
else {
transition.left = newX + PX;
transition.top = newY + PX;
}
node.transition(transition, callback);
}
},
/**
* Utility method, to create the translate transform string with the
* x, y translation amounts provided.
*
* @method _transform
* @param {Number} x Number of pixels to translate along the x axis
* @param {Number} y Number of pixels to translate along the y axis
* @private
*/
_transform: function (x, y) {
// TODO: Would we be better off using a Matrix for this?
var prop = 'translate(' + x + 'px, ' + y + 'px)';
if (this._forceHWTransforms) {
prop += ' translateZ(0)';
}
return prop;
},
/**
* Utility method, to move the given element to the given xy position
*
* @method _moveTo
* @param node {Node} The node to move
* @param x {Number} The x-position to move to
* @param y {Number} The y-position to move to
* @private
*/
_moveTo : function(node, x, y) {
if (NATIVE_TRANSITIONS) {
node.setStyle('transform', this._transform(x, y));
} else {
node.setStyle(LEFT, x + PX);
node.setStyle(TOP, y + PX);
}
},
/**
* Content box transition callback
*
* @method _onTransEnd
* @param {EventFacade} e The event facade
* @private
*/
_onTransEnd: function () {
var sv = this;
// If for some reason we're OOB, snapback
if (sv._isOutOfBounds()) {
sv._snapBack();
}
else {
/**
* Notification event fired at the end of a scroll transition
*
* @event scrollEnd
* @param e {EventFacade} The default event facade.
*/
sv.fire(EV_SCROLL_END);
}
},
/**
* gesturemovestart event handler
*
* @method _onGestureMoveStart
* @param e {EventFacade} The gesturemovestart event facade
* @private
*/
_onGestureMoveStart: function (e) {
if (this._cDisabled) {
return false;
}
var sv = this,
bb = sv._bb,
currentX = sv.get(SCROLL_X),
currentY = sv.get(SCROLL_Y),
clientX = e.clientX,
clientY = e.clientY;
if (sv._prevent.start) {
e.preventDefault();
}
// if a flick animation is in progress, cancel it
if (sv._flickAnim) {
sv._cancelFlick();
sv._onTransEnd();
}
// Reset lastScrolledAmt
sv.lastScrolledAmt = 0;
// Stores data for this gesture cycle. Cleaned up later
sv._gesture = {
// Will hold the axis value
axis: null,
// The current attribute values
startX: currentX,
startY: currentY,
// The X/Y coordinates where the event began
startClientX: clientX,
startClientY: clientY,
// The X/Y coordinates where the event will end
endClientX: null,
endClientY: null,
// The current delta of the event
deltaX: null,
deltaY: null,
// Will be populated for flicks
flick: null,
// Create some listeners for the rest of the gesture cycle
onGestureMove: bb.on(DRAG + '|' + GESTURE_MOVE, Y.bind(sv._onGestureMove, sv)),
// @TODO: Don't bind gestureMoveEnd if it's a Flick?
onGestureMoveEnd: bb.on(DRAG + '|' + GESTURE_MOVE + END, Y.bind(sv._onGestureMoveEnd, sv))
};
},
/**
* gesturemove event handler
*
* @method _onGestureMove
* @param e {EventFacade} The gesturemove event facade
* @private
*/
_onGestureMove: function (e) {
var sv = this,
gesture = sv._gesture,
svAxis = sv._cAxis,
svAxisX = svAxis.x,
svAxisY = svAxis.y,
startX = gesture.startX,
startY = gesture.startY,
startClientX = gesture.startClientX,
startClientY = gesture.startClientY,
clientX = e.clientX,
clientY = e.clientY;
if (sv._prevent.move) {
e.preventDefault();
}
gesture.deltaX = startClientX - clientX;
gesture.deltaY = startClientY - clientY;
// Determine if this is a vertical or horizontal movement
// @TODO: This is crude, but it works. Investigate more intelligent ways to detect intent
if (gesture.axis === null) {
gesture.axis = (Math.abs(gesture.deltaX) > Math.abs(gesture.deltaY)) ? DIM_X : DIM_Y;
}
// Move X or Y. @TODO: Move both if dualaxis.
if (gesture.axis === DIM_X && svAxisX) {
sv.set(SCROLL_X, startX + gesture.deltaX);
}
else if (gesture.axis === DIM_Y && svAxisY) {
sv.set(SCROLL_Y, startY + gesture.deltaY);
}
},
/**
* gesturemoveend event handler
*
* @method _onGestureMoveEnd
* @param e {EventFacade} The gesturemoveend event facade
* @private
*/
_onGestureMoveEnd: function (e) {
var sv = this,
gesture = sv._gesture,
flick = gesture.flick,
clientX = e.clientX,
clientY = e.clientY,
isOOB;
if (sv._prevent.end) {
e.preventDefault();
}
// Store the end X/Y coordinates
gesture.endClientX = clientX;
gesture.endClientY = clientY;
// Cleanup the event handlers
gesture.onGestureMove.detach();
gesture.onGestureMoveEnd.detach();
// If this wasn't a flick, wrap up the gesture cycle
if (!flick) {
// @TODO: Be more intelligent about this. Look at the Flick attribute to see
// if it is safe to assume _flick did or didn't fire.
// Then, the order _flick and _onGestureMoveEnd fire doesn't matter?
// If there was movement (_onGestureMove fired)
if (gesture.deltaX !== null && gesture.deltaY !== null) {
isOOB = sv._isOutOfBounds();
// If we're out-out-bounds, then snapback
if (isOOB) {
sv._snapBack();
}
// Inbounds
else {
// Fire scrollEnd unless this is a paginated instance and the gesture axis is the same as paginator's
// Not totally confident this is ideal to access a plugin's properties from a host, @TODO revisit
if (!sv.pages || (sv.pages && !sv.pages.get(AXIS)[gesture.axis])) {
sv._onTransEnd();
}
}
}
}
},
/**
* Execute a flick at the end of a scroll action
*
* @method _flick
* @param e {EventFacade} The Flick event facade
* @private
*/
_flick: function (e) {
if (this._cDisabled) {
return false;
}
var sv = this,
svAxis = sv._cAxis,
flick = e.flick,
flickAxis = flick.axis,
flickVelocity = flick.velocity,
axisAttr = flickAxis === DIM_X ? SCROLL_X : SCROLL_Y,
startPosition = sv.get(axisAttr);
// Sometimes flick is enabled, but drag is disabled
if (sv._gesture) {
sv._gesture.flick = flick;
}
// Prevent unneccesary firing of _flickFrame if we can't scroll on the flick axis
if (svAxis[flickAxis]) {
sv._flickFrame(flickVelocity, flickAxis, startPosition);
}
},
/**
* Execute a single frame in the flick animation
*
* @method _flickFrame
* @param velocity {Number} The velocity of this animated frame
* @param flickAxis {String} The axis on which to animate
* @param startPosition {Number} The starting X/Y point to flick from
* @protected
*/
_flickFrame: function (velocity, flickAxis, startPosition) {
var sv = this,
axisAttr = flickAxis === DIM_X ? SCROLL_X : SCROLL_Y,
bounds = sv._getBounds(),
// Localize cached values
bounce = sv._cBounce,
bounceRange = sv._cBounceRange,
deceleration = sv._cDeceleration,
frameDuration = sv._cFrameDuration,
// Calculate
newVelocity = velocity * deceleration,
newPosition = startPosition - (frameDuration * newVelocity),
// Some convinience conditions
min = flickAxis === DIM_X ? bounds.minScrollX : bounds.minScrollY,
max = flickAxis === DIM_X ? bounds.maxScrollX : bounds.maxScrollY,
belowMin = (newPosition < min),
belowMax = (newPosition < max),
aboveMin = (newPosition > min),
aboveMax = (newPosition > max),
belowMinRange = (newPosition < (min - bounceRange)),
withinMinRange = (belowMin && (newPosition > (min - bounceRange))),
withinMaxRange = (aboveMax && (newPosition < (max + bounceRange))),
aboveMaxRange = (newPosition > (max + bounceRange)),
tooSlow;
// If we're within the range but outside min/max, dampen the velocity
if (withinMinRange || withinMaxRange) {
newVelocity *= bounce;
}
// Is the velocity too slow to bother?
tooSlow = (Math.abs(newVelocity).toFixed(4) < 0.015);
// If the velocity is too slow or we're outside the range
if (tooSlow || belowMinRange || aboveMaxRange) {
// Cancel and delete sv._flickAnim
if (sv._flickAnim) {
sv._cancelFlick();
}
// If we're inside the scroll area, just end
if (aboveMin && belowMax) {
sv._onTransEnd();
}
// We're outside the scroll area, so we need to snap back
else {
sv._snapBack();
}
}
// Otherwise, animate to the next frame
else {
// @TODO: maybe use requestAnimationFrame instead
sv._flickAnim = Y.later(frameDuration, sv, '_flickFrame', [newVelocity, flickAxis, newPosition]);
sv.set(axisAttr, newPosition);
}
},
_cancelFlick: function () {
var sv = this;
if (sv._flickAnim) {
// Cancel the flick (if it exists)
sv._flickAnim.cancel();
// Also delete it, otherwise _onGestureMoveStart will think we're still flicking
delete sv._flickAnim;
}
},
/**
* Handle mousewheel events on the widget
*
* @method _mousewheel
* @param e {EventFacade} The mousewheel event facade
* @private
*/
_mousewheel: function (e) {
var sv = this,
scrollY = sv.get(SCROLL_Y),
bounds = sv._getBounds(),
bb = sv._bb,
scrollOffset = 10, // 10px
isForward = (e.wheelDelta > 0),
scrollToY = scrollY - ((isForward ? 1 : -1) * scrollOffset);
scrollToY = _constrain(scrollToY, bounds.minScrollY, bounds.maxScrollY);
// Because Mousewheel events fire off 'document', every ScrollView widget will react
// to any mousewheel anywhere on the page. This check will ensure that the mouse is currently
// over this specific ScrollView. Also, only allow mousewheel scrolling on Y-axis,
// becuase otherwise the 'prevent' will block page scrolling.
if (bb.contains(e.target) && sv._cAxis[DIM_Y]) {
// Reset lastScrolledAmt
sv.lastScrolledAmt = 0;
// Jump to the new offset
sv.set(SCROLL_Y, scrollToY);
// if we have scrollbars plugin, update & set the flash timer on the scrollbar
// @TODO: This probably shouldn't be in this module
if (sv.scrollbars) {
// @TODO: The scrollbars should handle this themselves
sv.scrollbars._update();
sv.scrollbars.flash();
// or just this
// sv.scrollbars._hostDimensionsChange();
}
// Fire the 'scrollEnd' event
sv._onTransEnd();
// prevent browser default behavior on mouse scroll
e.preventDefault();
}
},
/**
* Checks to see the current scrollX/scrollY position beyond the min/max boundary
*
* @method _isOutOfBounds
* @param x {Number} [optional] The X position to check
* @param y {Number} [optional] The Y position to check
* @return {Boolean} Whether the current X/Y position is out of bounds (true) or not (false)
* @private
*/
_isOutOfBounds: function (x, y) {
var sv = this,
svAxis = sv._cAxis,
svAxisX = svAxis.x,
svAxisY = svAxis.y,
currentX = x || sv.get(SCROLL_X),
currentY = y || sv.get(SCROLL_Y),
bounds = sv._getBounds(),
minX = bounds.minScrollX,
minY = bounds.minScrollY,
maxX = bounds.maxScrollX,
maxY = bounds.maxScrollY;
return (svAxisX && (currentX < minX || currentX > maxX)) || (svAxisY && (currentY < minY || currentY > maxY));
},
/**
* Bounces back
* @TODO: Should be more generalized and support both X and Y detection
*
* @method _snapBack
* @private
*/
_snapBack: function () {
var sv = this,
currentX = sv.get(SCROLL_X),
currentY = sv.get(SCROLL_Y),
bounds = sv._getBounds(),
minX = bounds.minScrollX,
minY = bounds.minScrollY,
maxX = bounds.maxScrollX,
maxY = bounds.maxScrollY,
newY = _constrain(currentY, minY, maxY),
newX = _constrain(currentX, minX, maxX),
duration = sv.get(SNAP_DURATION),
easing = sv.get(SNAP_EASING);
if (newX !== currentX) {
sv.set(SCROLL_X, newX, {duration:duration, easing:easing});
}
else if (newY !== currentY) {
sv.set(SCROLL_Y, newY, {duration:duration, easing:easing});
}
else {
sv._onTransEnd();
}
},
/**
* After listener for changes to the scrollX or scrollY attribute
*
* @method _afterScrollChange
* @param e {EventFacade} The event facade
* @protected
*/
_afterScrollChange: function (e) {
if (e.src === ScrollView.UI_SRC) {
return false;
}
var sv = this,
duration = e.duration,
easing = e.easing,
val = e.newVal,
scrollToArgs = [];
// Set the scrolled value
sv.lastScrolledAmt = sv.lastScrolledAmt + (e.newVal - e.prevVal);
// Generate the array of args to pass to scrollTo()
if (e.attrName === SCROLL_X) {
scrollToArgs.push(val);
scrollToArgs.push(sv.get(SCROLL_Y));
}
else {
scrollToArgs.push(sv.get(SCROLL_X));
scrollToArgs.push(val);
}
scrollToArgs.push(duration);
scrollToArgs.push(easing);
sv.scrollTo.apply(sv, scrollToArgs);
},
/**
* After listener for changes to the flick attribute
*
* @method _afterFlickChange
* @param e {EventFacade} The event facade
* @protected
*/
_afterFlickChange: function (e) {
this._bindFlick(e.newVal);
},
/**
* After listener for changes to the disabled attribute
*
* @method _afterDisabledChange
* @param e {EventFacade} The event facade
* @protected
*/
_afterDisabledChange: function (e) {
// Cache for performance - we check during move
this._cDisabled = e.newVal;
},
/**
* After listener for the axis attribute
*
* @method _afterAxisChange
* @param e {EventFacade} The event facade
* @protected
*/
_afterAxisChange: function (e) {
this._cAxis = e.newVal;
},
/**
* After listener for changes to the drag attribute
*
* @method _afterDragChange
* @param e {EventFacade} The event facade
* @protected
*/
_afterDragChange: function (e) {
this._bindDrag(e.newVal);
},
/**
* After listener for the height or width attribute
*
* @method _afterDimChange
* @param e {EventFacade} The event facade
* @protected
*/
_afterDimChange: function () {
this._uiDimensionsChange();
},
/**
* After listener for scrollEnd, for cleanup
*
* @method _afterScrollEnd
* @param e {EventFacade} The event facade
* @protected
*/
_afterScrollEnd: function () {
var sv = this;
if (sv._flickAnim) {
sv._cancelFlick();
}
// Ideally this should be removed, but doing so causing some JS errors with fast swiping
// because _gesture is being deleted after the previous one has been overwritten
// delete sv._gesture; // TODO: Move to sv.prevGesture?
},
/**
* Setter for 'axis' attribute
*
* @method _axisSetter
* @param val {Mixed} A string ('x', 'y', 'xy') to specify which axis/axes to allow scrolling on
* @param name {String} The attribute name
* @return {Object} An object to specify scrollability on the x & y axes
*
* @protected
*/
_axisSetter: function (val) {
// Turn a string into an axis object
if (Y.Lang.isString(val)) {
return {
x: val.match(/x/i) ? true : false,
y: val.match(/y/i) ? true : false
};
}
},
/**
* The scrollX, scrollY setter implementation
*
* @method _setScroll
* @private
* @param {Number} val
* @param {String} dim
*
* @return {Number} The value
*/
_setScroll : function(val) {
// Just ensure the widget is not disabled
if (this._cDisabled) {
val = Y.Attribute.INVALID_VALUE;
}
return val;
},
/**
* Setter for the scrollX attribute
*
* @method _setScrollX
* @param val {Number} The new scrollX value
* @return {Number} The normalized value
* @protected
*/
_setScrollX: function(val) {
return this._setScroll(val, DIM_X);
},
/**
* Setter for the scrollY ATTR
*
* @method _setScrollY
* @param val {Number} The new scrollY value
* @return {Number} The normalized value
* @protected
*/
_setScrollY: function(val) {
return this._setScroll(val, DIM_Y);
}
// End prototype properties
}, {
// Static properties
/**
* The identity of the widget.
*
* @property NAME
* @type String
* @default 'scrollview'
* @readOnly
* @protected
* @static
*/
NAME: 'scrollview',
/**
* Static property used to define the default attribute configuration of
* the Widget.
*
* @property ATTRS
* @type {Object}
* @protected
* @static
*/
ATTRS: {
/**
* Specifies ability to scroll on x, y, or x and y axis/axes.
*
* @attribute axis
* @type String
*/
axis: {
setter: '_axisSetter',
writeOnce: 'initOnly'
},
/**
* The current scroll position in the x-axis
*
* @attribute scrollX
* @type Number
* @default 0
*/
scrollX: {
value: 0,
setter: '_setScrollX'
},
/**
* The current scroll position in the y-axis
*
* @attribute scrollY
* @type Number
* @default 0
*/
scrollY: {
value: 0,
setter: '_setScrollY'
},
/**
* Drag coefficent for inertial scrolling. The closer to 1 this
* value is, the less friction during scrolling.
*
* @attribute deceleration
* @default 0.93
*/
deceleration: {
value: 0.93
},
/**
* Drag coefficient for intertial scrolling at the upper
* and lower boundaries of the scrollview. Set to 0 to
* disable "rubber-banding".
*
* @attribute bounce
* @type Number
* @default 0.1
*/
bounce: {
value: 0.1
},
/**
* The minimum distance and/or velocity which define a flick. Can be set to false,
* to disable flick support (note: drag support is enabled/disabled separately)
*
* @attribute flick
* @type Object
* @default Object with properties minDistance = 10, minVelocity = 0.3.
*/
flick: {
value: {
minDistance: 10,
minVelocity: 0.3
}
},
/**
* Enable/Disable dragging the ScrollView content (note: flick support is enabled/disabled separately)
* @attribute drag
* @type boolean
* @default true
*/
drag: {
value: true
},
/**
* The default duration to use when animating the bounce snap back.
*
* @attribute snapDuration
* @type Number
* @default 400
*/
snapDuration: {
value: 400
},
/**
* The default easing to use when animating the bounce snap back.
*
* @attribute snapEasing
* @type String
* @default 'ease-out'
*/
snapEasing: {
value: 'ease-out'
},
/**
* The default easing used when animating the flick
*
* @attribute easing
* @type String
* @default 'cubic-bezier(0, 0.1, 0, 1.0)'
*/
easing: {
value: 'cubic-bezier(0, 0.1, 0, 1.0)'
},
/**
* The interval (ms) used when animating the flick for JS-timer animations
*
* @attribute frameDuration
* @type Number
* @default 15
*/
frameDuration: {
value: 15
},
/**
* The default bounce distance in pixels
*
* @attribute bounceRange
* @type Number
* @default 150
*/
bounceRange: {
value: 150
}
},
/**
* List of class names used in the scrollview's DOM
*
* @property CLASS_NAMES
* @type Object
* @static
*/
CLASS_NAMES: CLASS_NAMES,
/**
* Flag used to source property changes initiated from the DOM
*
* @property UI_SRC
* @type String
* @static
* @default 'ui'
*/
UI_SRC: UI,
/**
* Object map of style property names used to set transition properties.
* Defaults to the vendor prefix established by the Transition module.
* The configured property names are `_TRANSITION.DURATION` (e.g. "WebkitTransitionDuration") and
* `_TRANSITION.PROPERTY (e.g. "WebkitTransitionProperty").
*
* @property _TRANSITION
* @private
*/
_TRANSITION: {
DURATION: (vendorPrefix ? vendorPrefix + 'TransitionDuration' : 'transitionDuration'),
PROPERTY: (vendorPrefix ? vendorPrefix + 'TransitionProperty' : 'transitionProperty')
},
/**
* The default bounce distance in pixels
*
* @property BOUNCE_RANGE
* @type Number
* @static
* @default false
* @deprecated (in 3.7.0)
*/
BOUNCE_RANGE: false,
/**
* The interval (ms) used when animating the flick
*
* @property FRAME_STEP
* @type Number
* @static
* @default false
* @deprecated (in 3.7.0)
*/
FRAME_STEP: false,
/**
* The default easing used when animating the flick
*
* @property EASING
* @type String
* @static
* @default false
* @deprecated (in 3.7.0)
*/
EASING: false,
/**
* The default easing to use when animating the bounce snap back.
*
* @property SNAP_EASING
* @type String
* @static
* @default false
* @deprecated (in 3.7.0)
*/
SNAP_EASING: false,
/**
* The default duration to use when animating the bounce snap back.
*
* @property SNAP_DURATION
* @type Number
* @static
* @default false
* @deprecated (in 3.7.0)
*/
SNAP_DURATION: false
// End static properties
});
}, '3.18.0', {"requires": ["widget", "event-gestures", "event-mousewheel", "transition"], "skinnable": true});
|
ajax/libs/webshim/1.14.0/dev/shims/moxie/js/moxie.js | jacoborus/cdnjs | /**
* mOxie - multi-runtime File API & XMLHttpRequest L2 Polyfill
* v1.2.1
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*
* Date: 2014-05-14
*/
/**
* Compiled inline version. (Library mode)
*/
/*jshint smarttabs:true, undef:true, latedef:true, curly:true, bitwise:true, camelcase:true */
/*globals $code */
(function(exports, undefined) {
"use strict";
var modules = {};
function require(ids, callback) {
var module, defs = [];
for (var i = 0; i < ids.length; ++i) {
module = modules[ids[i]] || resolve(ids[i]);
if (!module) {
throw 'module definition dependecy not found: ' + ids[i];
}
defs.push(module);
}
callback.apply(null, defs);
}
function define(id, dependencies, definition) {
if (typeof id !== 'string') {
throw 'invalid module definition, module id must be defined and be a string';
}
if (dependencies === undefined) {
throw 'invalid module definition, dependencies must be specified';
}
if (definition === undefined) {
throw 'invalid module definition, definition function must be specified';
}
require(dependencies, function() {
modules[id] = definition.apply(null, arguments);
});
}
function defined(id) {
return !!modules[id];
}
function resolve(id) {
var target = exports;
var fragments = id.split(/[.\/]/);
for (var fi = 0; fi < fragments.length; ++fi) {
if (!target[fragments[fi]]) {
return;
}
target = target[fragments[fi]];
}
return target;
}
function expose(ids) {
for (var i = 0; i < ids.length; i++) {
var target = exports;
var id = ids[i];
var fragments = id.split(/[.\/]/);
for (var fi = 0; fi < fragments.length - 1; ++fi) {
if (target[fragments[fi]] === undefined) {
target[fragments[fi]] = {};
}
target = target[fragments[fi]];
}
target[fragments[fragments.length - 1]] = modules[id];
}
}
// Included from: src/javascript/core/utils/Basic.js
/**
* Basic.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define('moxie/core/utils/Basic', [], function() {
/**
Gets the true type of the built-in object (better version of typeof).
@author Angus Croll (http://javascriptweblog.wordpress.com/)
@method typeOf
@for Utils
@static
@param {Object} o Object to check.
@return {String} Object [[Class]]
*/
var typeOf = function(o) {
var undef;
if (o === undef) {
return 'undefined';
} else if (o === null) {
return 'null';
} else if (o.nodeType) {
return 'node';
}
// the snippet below is awesome, however it fails to detect null, undefined and arguments types in IE lte 8
return ({}).toString.call(o).match(/\s([a-z|A-Z]+)/)[1].toLowerCase();
};
/**
Extends the specified object with another object.
@method extend
@static
@param {Object} target Object to extend.
@param {Object} [obj]* Multiple objects to extend with.
@return {Object} Same as target, the extended object.
*/
var extend = function(target) {
var undef;
each(arguments, function(arg, i) {
if (i > 0) {
each(arg, function(value, key) {
if (value !== undef) {
if (typeOf(target[key]) === typeOf(value) && !!~inArray(typeOf(value), ['array', 'object'])) {
extend(target[key], value);
} else {
target[key] = value;
}
}
});
}
});
return target;
};
/**
Executes the callback function for each item in array/object. If you return false in the
callback it will break the loop.
@method each
@static
@param {Object} obj Object to iterate.
@param {function} callback Callback function to execute for each item.
*/
var each = function(obj, callback) {
var length, key, i, undef;
if (obj) {
try {
length = obj.length;
} catch(ex) {
length = undef;
}
if (length === undef) {
// Loop object items
for (key in obj) {
if (obj.hasOwnProperty(key)) {
if (callback(obj[key], key) === false) {
return;
}
}
}
} else {
// Loop array items
for (i = 0; i < length; i++) {
if (callback(obj[i], i) === false) {
return;
}
}
}
}
};
/**
Checks if object is empty.
@method isEmptyObj
@static
@param {Object} o Object to check.
@return {Boolean}
*/
var isEmptyObj = function(obj) {
var prop;
if (!obj || typeOf(obj) !== 'object') {
return true;
}
for (prop in obj) {
return false;
}
return true;
};
/**
Recieve an array of functions (usually async) to call in sequence, each function
receives a callback as first argument that it should call, when it completes. Finally,
after everything is complete, main callback is called. Passing truthy value to the
callback as a first argument will interrupt the sequence and invoke main callback
immediately.
@method inSeries
@static
@param {Array} queue Array of functions to call in sequence
@param {Function} cb Main callback that is called in the end, or in case of error
*/
var inSeries = function(queue, cb) {
var i = 0, length = queue.length;
if (typeOf(cb) !== 'function') {
cb = function() {};
}
if (!queue || !queue.length) {
cb();
}
function callNext(i) {
if (typeOf(queue[i]) === 'function') {
queue[i](function(error) {
/*jshint expr:true */
++i < length && !error ? callNext(i) : cb(error);
});
}
}
callNext(i);
};
/**
Recieve an array of functions (usually async) to call in parallel, each function
receives a callback as first argument that it should call, when it completes. After
everything is complete, main callback is called. Passing truthy value to the
callback as a first argument will interrupt the process and invoke main callback
immediately.
@method inParallel
@static
@param {Array} queue Array of functions to call in sequence
@param {Function} cb Main callback that is called in the end, or in case of erro
*/
var inParallel = function(queue, cb) {
var count = 0, num = queue.length, cbArgs = new Array(num);
each(queue, function(fn, i) {
fn(function(error) {
if (error) {
return cb(error);
}
var args = [].slice.call(arguments);
args.shift(); // strip error - undefined or not
cbArgs[i] = args;
count++;
if (count === num) {
cbArgs.unshift(null);
cb.apply(this, cbArgs);
}
});
});
};
/**
Find an element in array and return it's index if present, otherwise return -1.
@method inArray
@static
@param {Mixed} needle Element to find
@param {Array} array
@return {Int} Index of the element, or -1 if not found
*/
var inArray = function(needle, array) {
if (array) {
if (Array.prototype.indexOf) {
return Array.prototype.indexOf.call(array, needle);
}
for (var i = 0, length = array.length; i < length; i++) {
if (array[i] === needle) {
return i;
}
}
}
return -1;
};
/**
Returns elements of first array if they are not present in second. And false - otherwise.
@private
@method arrayDiff
@param {Array} needles
@param {Array} array
@return {Array|Boolean}
*/
var arrayDiff = function(needles, array) {
var diff = [];
if (typeOf(needles) !== 'array') {
needles = [needles];
}
if (typeOf(array) !== 'array') {
array = [array];
}
for (var i in needles) {
if (inArray(needles[i], array) === -1) {
diff.push(needles[i]);
}
}
return diff.length ? diff : false;
};
/**
Find intersection of two arrays.
@private
@method arrayIntersect
@param {Array} array1
@param {Array} array2
@return {Array} Intersection of two arrays or null if there is none
*/
var arrayIntersect = function(array1, array2) {
var result = [];
each(array1, function(item) {
if (inArray(item, array2) !== -1) {
result.push(item);
}
});
return result.length ? result : null;
};
/**
Forces anything into an array.
@method toArray
@static
@param {Object} obj Object with length field.
@return {Array} Array object containing all items.
*/
var toArray = function(obj) {
var i, arr = [];
for (i = 0; i < obj.length; i++) {
arr[i] = obj[i];
}
return arr;
};
/**
Generates an unique ID. This is 99.99% unique since it takes the current time and 5 random numbers.
The only way a user would be able to get the same ID is if the two persons at the same exact milisecond manages
to get 5 the same random numbers between 0-65535 it also uses a counter so each call will be guaranteed to be page unique.
It's more probable for the earth to be hit with an ansteriod. Y
@method guid
@static
@param {String} prefix to prepend (by default 'o' will be prepended).
@method guid
@return {String} Virtually unique id.
*/
var guid = (function() {
var counter = 0;
return function(prefix) {
var guid = new Date().getTime().toString(32), i;
for (i = 0; i < 5; i++) {
guid += Math.floor(Math.random() * 65535).toString(32);
}
return (prefix || 'o_') + guid + (counter++).toString(32);
};
}());
/**
Trims white spaces around the string
@method trim
@static
@param {String} str
@return {String}
*/
var trim = function(str) {
if (!str) {
return str;
}
return String.prototype.trim ? String.prototype.trim.call(str) : str.toString().replace(/^\s*/, '').replace(/\s*$/, '');
};
/**
Parses the specified size string into a byte value. For example 10kb becomes 10240.
@method parseSizeStr
@static
@param {String/Number} size String to parse or number to just pass through.
@return {Number} Size in bytes.
*/
var parseSizeStr = function(size) {
if (typeof(size) !== 'string') {
return size;
}
var muls = {
t: 1099511627776,
g: 1073741824,
m: 1048576,
k: 1024
},
mul;
size = /^([0-9]+)([mgk]?)$/.exec(size.toLowerCase().replace(/[^0-9mkg]/g, ''));
mul = size[2];
size = +size[1];
if (muls.hasOwnProperty(mul)) {
size *= muls[mul];
}
return size;
};
return {
guid: guid,
typeOf: typeOf,
extend: extend,
each: each,
isEmptyObj: isEmptyObj,
inSeries: inSeries,
inParallel: inParallel,
inArray: inArray,
arrayDiff: arrayDiff,
arrayIntersect: arrayIntersect,
toArray: toArray,
trim: trim,
parseSizeStr: parseSizeStr
};
});
// Included from: src/javascript/core/I18n.js
/**
* I18n.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define("moxie/core/I18n", [
"moxie/core/utils/Basic"
], function(Basic) {
var i18n = {};
return {
/**
* Extends the language pack object with new items.
*
* @param {Object} pack Language pack items to add.
* @return {Object} Extended language pack object.
*/
addI18n: function(pack) {
return Basic.extend(i18n, pack);
},
/**
* Translates the specified string by checking for the english string in the language pack lookup.
*
* @param {String} str String to look for.
* @return {String} Translated string or the input string if it wasn't found.
*/
translate: function(str) {
return i18n[str] || str;
},
/**
* Shortcut for translate function
*
* @param {String} str String to look for.
* @return {String} Translated string or the input string if it wasn't found.
*/
_: function(str) {
return this.translate(str);
},
/**
* Pseudo sprintf implementation - simple way to replace tokens with specified values.
*
* @param {String} str String with tokens
* @return {String} String with replaced tokens
*/
sprintf: function(str) {
var args = [].slice.call(arguments, 1);
return str.replace(/%[a-z]/g, function() {
var value = args.shift();
return Basic.typeOf(value) !== 'undefined' ? value : '';
});
}
};
});
// Included from: src/javascript/core/utils/Mime.js
/**
* Mime.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define("moxie/core/utils/Mime", [
"moxie/core/utils/Basic",
"moxie/core/I18n"
], function(Basic, I18n) {
var mimeData = "" +
"application/msword,doc dot," +
"application/pdf,pdf," +
"application/pgp-signature,pgp," +
"application/postscript,ps ai eps," +
"application/rtf,rtf," +
"application/vnd.ms-excel,xls xlb," +
"application/vnd.ms-powerpoint,ppt pps pot," +
"application/zip,zip," +
"application/x-shockwave-flash,swf swfl," +
"application/vnd.openxmlformats-officedocument.wordprocessingml.document,docx," +
"application/vnd.openxmlformats-officedocument.wordprocessingml.template,dotx," +
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,xlsx," +
"application/vnd.openxmlformats-officedocument.presentationml.presentation,pptx," +
"application/vnd.openxmlformats-officedocument.presentationml.template,potx," +
"application/vnd.openxmlformats-officedocument.presentationml.slideshow,ppsx," +
"application/x-javascript,js," +
"application/json,json," +
"audio/mpeg,mp3 mpga mpega mp2," +
"audio/x-wav,wav," +
"audio/x-m4a,m4a," +
"audio/ogg,oga ogg," +
"audio/aiff,aiff aif," +
"audio/flac,flac," +
"audio/aac,aac," +
"audio/ac3,ac3," +
"audio/x-ms-wma,wma," +
"image/bmp,bmp," +
"image/gif,gif," +
"image/jpeg,jpg jpeg jpe," +
"image/photoshop,psd," +
"image/png,png," +
"image/svg+xml,svg svgz," +
"image/tiff,tiff tif," +
"text/plain,asc txt text diff log," +
"text/html,htm html xhtml," +
"text/css,css," +
"text/csv,csv," +
"text/rtf,rtf," +
"video/mpeg,mpeg mpg mpe m2v," +
"video/quicktime,qt mov," +
"video/mp4,mp4," +
"video/x-m4v,m4v," +
"video/x-flv,flv," +
"video/x-ms-wmv,wmv," +
"video/avi,avi," +
"video/webm,webm," +
"video/3gpp,3gpp 3gp," +
"video/3gpp2,3g2," +
"video/vnd.rn-realvideo,rv," +
"video/ogg,ogv," +
"video/x-matroska,mkv," +
"application/vnd.oasis.opendocument.formula-template,otf," +
"application/octet-stream,exe";
var Mime = {
mimes: {},
extensions: {},
// Parses the default mime types string into a mimes and extensions lookup maps
addMimeType: function (mimeData) {
var items = mimeData.split(/,/), i, ii, ext;
for (i = 0; i < items.length; i += 2) {
ext = items[i + 1].split(/ /);
// extension to mime lookup
for (ii = 0; ii < ext.length; ii++) {
this.mimes[ext[ii]] = items[i];
}
// mime to extension lookup
this.extensions[items[i]] = ext;
}
},
extList2mimes: function (filters, addMissingExtensions) {
var self = this, ext, i, ii, type, mimes = [];
// convert extensions to mime types list
for (i = 0; i < filters.length; i++) {
ext = filters[i].extensions.split(/\s*,\s*/);
for (ii = 0; ii < ext.length; ii++) {
// if there's an asterisk in the list, then accept attribute is not required
if (ext[ii] === '*') {
return [];
}
type = self.mimes[ext[ii]];
if (!type) {
if (addMissingExtensions && /^\w+$/.test(ext[ii])) {
mimes.push('.' + ext[ii]);
} else {
return []; // accept all
}
} else if (Basic.inArray(type, mimes) === -1) {
mimes.push(type);
}
}
}
return mimes;
},
mimes2exts: function(mimes) {
var self = this, exts = [];
Basic.each(mimes, function(mime) {
if (mime === '*') {
exts = [];
return false;
}
// check if this thing looks like mime type
var m = mime.match(/^(\w+)\/(\*|\w+)$/);
if (m) {
if (m[2] === '*') {
// wildcard mime type detected
Basic.each(self.extensions, function(arr, mime) {
if ((new RegExp('^' + m[1] + '/')).test(mime)) {
[].push.apply(exts, self.extensions[mime]);
}
});
} else if (self.extensions[mime]) {
[].push.apply(exts, self.extensions[mime]);
}
}
});
return exts;
},
mimes2extList: function(mimes) {
var accept = [], exts = [];
if (Basic.typeOf(mimes) === 'string') {
mimes = Basic.trim(mimes).split(/\s*,\s*/);
}
exts = this.mimes2exts(mimes);
accept.push({
title: I18n.translate('Files'),
extensions: exts.length ? exts.join(',') : '*'
});
// save original mimes string
accept.mimes = mimes;
return accept;
},
getFileExtension: function(fileName) {
var matches = fileName && fileName.match(/\.([^.]+)$/);
if (matches) {
return matches[1].toLowerCase();
}
return '';
},
getFileMime: function(fileName) {
return this.mimes[this.getFileExtension(fileName)] || '';
}
};
Mime.addMimeType(mimeData);
return Mime;
});
// Included from: src/javascript/core/utils/Env.js
/**
* Env.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define("moxie/core/utils/Env", [
"moxie/core/utils/Basic"
], function(Basic) {
// UAParser.js v0.6.2
// Lightweight JavaScript-based User-Agent string parser
// https://github.com/faisalman/ua-parser-js
//
// Copyright © 2012-2013 Faisalman <fyzlman@gmail.com>
// Dual licensed under GPLv2 & MIT
var UAParser = (function (undefined) {
//////////////
// Constants
/////////////
var EMPTY = '',
UNKNOWN = '?',
FUNC_TYPE = 'function',
UNDEF_TYPE = 'undefined',
OBJ_TYPE = 'object',
MAJOR = 'major',
MODEL = 'model',
NAME = 'name',
TYPE = 'type',
VENDOR = 'vendor',
VERSION = 'version',
ARCHITECTURE= 'architecture',
CONSOLE = 'console',
MOBILE = 'mobile',
TABLET = 'tablet';
///////////
// Helper
//////////
var util = {
has : function (str1, str2) {
return str2.toLowerCase().indexOf(str1.toLowerCase()) !== -1;
},
lowerize : function (str) {
return str.toLowerCase();
}
};
///////////////
// Map helper
//////////////
var mapper = {
rgx : function () {
// loop through all regexes maps
for (var result, i = 0, j, k, p, q, matches, match, args = arguments; i < args.length; i += 2) {
var regex = args[i], // even sequence (0,2,4,..)
props = args[i + 1]; // odd sequence (1,3,5,..)
// construct object barebones
if (typeof(result) === UNDEF_TYPE) {
result = {};
for (p in props) {
q = props[p];
if (typeof(q) === OBJ_TYPE) {
result[q[0]] = undefined;
} else {
result[q] = undefined;
}
}
}
// try matching uastring with regexes
for (j = k = 0; j < regex.length; j++) {
matches = regex[j].exec(this.getUA());
if (!!matches) {
for (p = 0; p < props.length; p++) {
match = matches[++k];
q = props[p];
// check if given property is actually array
if (typeof(q) === OBJ_TYPE && q.length > 0) {
if (q.length == 2) {
if (typeof(q[1]) == FUNC_TYPE) {
// assign modified match
result[q[0]] = q[1].call(this, match);
} else {
// assign given value, ignore regex match
result[q[0]] = q[1];
}
} else if (q.length == 3) {
// check whether function or regex
if (typeof(q[1]) === FUNC_TYPE && !(q[1].exec && q[1].test)) {
// call function (usually string mapper)
result[q[0]] = match ? q[1].call(this, match, q[2]) : undefined;
} else {
// sanitize match using given regex
result[q[0]] = match ? match.replace(q[1], q[2]) : undefined;
}
} else if (q.length == 4) {
result[q[0]] = match ? q[3].call(this, match.replace(q[1], q[2])) : undefined;
}
} else {
result[q] = match ? match : undefined;
}
}
break;
}
}
if(!!matches) break; // break the loop immediately if match found
}
return result;
},
str : function (str, map) {
for (var i in map) {
// check if array
if (typeof(map[i]) === OBJ_TYPE && map[i].length > 0) {
for (var j = 0; j < map[i].length; j++) {
if (util.has(map[i][j], str)) {
return (i === UNKNOWN) ? undefined : i;
}
}
} else if (util.has(map[i], str)) {
return (i === UNKNOWN) ? undefined : i;
}
}
return str;
}
};
///////////////
// String map
//////////////
var maps = {
browser : {
oldsafari : {
major : {
'1' : ['/8', '/1', '/3'],
'2' : '/4',
'?' : '/'
},
version : {
'1.0' : '/8',
'1.2' : '/1',
'1.3' : '/3',
'2.0' : '/412',
'2.0.2' : '/416',
'2.0.3' : '/417',
'2.0.4' : '/419',
'?' : '/'
}
}
},
device : {
sprint : {
model : {
'Evo Shift 4G' : '7373KT'
},
vendor : {
'HTC' : 'APA',
'Sprint' : 'Sprint'
}
}
},
os : {
windows : {
version : {
'ME' : '4.90',
'NT 3.11' : 'NT3.51',
'NT 4.0' : 'NT4.0',
'2000' : 'NT 5.0',
'XP' : ['NT 5.1', 'NT 5.2'],
'Vista' : 'NT 6.0',
'7' : 'NT 6.1',
'8' : 'NT 6.2',
'8.1' : 'NT 6.3',
'RT' : 'ARM'
}
}
}
};
//////////////
// Regex map
/////////////
var regexes = {
browser : [[
// Presto based
/(opera\smini)\/((\d+)?[\w\.-]+)/i, // Opera Mini
/(opera\s[mobiletab]+).+version\/((\d+)?[\w\.-]+)/i, // Opera Mobi/Tablet
/(opera).+version\/((\d+)?[\w\.]+)/i, // Opera > 9.80
/(opera)[\/\s]+((\d+)?[\w\.]+)/i // Opera < 9.80
], [NAME, VERSION, MAJOR], [
/\s(opr)\/((\d+)?[\w\.]+)/i // Opera Webkit
], [[NAME, 'Opera'], VERSION, MAJOR], [
// Mixed
/(kindle)\/((\d+)?[\w\.]+)/i, // Kindle
/(lunascape|maxthon|netfront|jasmine|blazer)[\/\s]?((\d+)?[\w\.]+)*/i,
// Lunascape/Maxthon/Netfront/Jasmine/Blazer
// Trident based
/(avant\s|iemobile|slim|baidu)(?:browser)?[\/\s]?((\d+)?[\w\.]*)/i,
// Avant/IEMobile/SlimBrowser/Baidu
/(?:ms|\()(ie)\s((\d+)?[\w\.]+)/i, // Internet Explorer
// Webkit/KHTML based
/(rekonq)((?:\/)[\w\.]+)*/i, // Rekonq
/(chromium|flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron)\/((\d+)?[\w\.-]+)/i
// Chromium/Flock/RockMelt/Midori/Epiphany/Silk/Skyfire/Bolt/Iron
], [NAME, VERSION, MAJOR], [
/(trident).+rv[:\s]((\d+)?[\w\.]+).+like\sgecko/i // IE11
], [[NAME, 'IE'], VERSION, MAJOR], [
/(yabrowser)\/((\d+)?[\w\.]+)/i // Yandex
], [[NAME, 'Yandex'], VERSION, MAJOR], [
/(comodo_dragon)\/((\d+)?[\w\.]+)/i // Comodo Dragon
], [[NAME, /_/g, ' '], VERSION, MAJOR], [
/(chrome|omniweb|arora|[tizenoka]{5}\s?browser)\/v?((\d+)?[\w\.]+)/i
// Chrome/OmniWeb/Arora/Tizen/Nokia
], [NAME, VERSION, MAJOR], [
/(dolfin)\/((\d+)?[\w\.]+)/i // Dolphin
], [[NAME, 'Dolphin'], VERSION, MAJOR], [
/((?:android.+)crmo|crios)\/((\d+)?[\w\.]+)/i // Chrome for Android/iOS
], [[NAME, 'Chrome'], VERSION, MAJOR], [
/((?:android.+))version\/((\d+)?[\w\.]+)\smobile\ssafari/i // Android Browser
], [[NAME, 'Android Browser'], VERSION, MAJOR], [
/version\/((\d+)?[\w\.]+).+?mobile\/\w+\s(safari)/i // Mobile Safari
], [VERSION, MAJOR, [NAME, 'Mobile Safari']], [
/version\/((\d+)?[\w\.]+).+?(mobile\s?safari|safari)/i // Safari & Safari Mobile
], [VERSION, MAJOR, NAME], [
/webkit.+?(mobile\s?safari|safari)((\/[\w\.]+))/i // Safari < 3.0
], [NAME, [MAJOR, mapper.str, maps.browser.oldsafari.major], [VERSION, mapper.str, maps.browser.oldsafari.version]], [
/(konqueror)\/((\d+)?[\w\.]+)/i, // Konqueror
/(webkit|khtml)\/((\d+)?[\w\.]+)/i
], [NAME, VERSION, MAJOR], [
// Gecko based
/(navigator|netscape)\/((\d+)?[\w\.-]+)/i // Netscape
], [[NAME, 'Netscape'], VERSION, MAJOR], [
/(swiftfox)/i, // Swiftfox
/(icedragon|iceweasel|camino|chimera|fennec|maemo\sbrowser|minimo|conkeror)[\/\s]?((\d+)?[\w\.\+]+)/i,
// IceDragon/Iceweasel/Camino/Chimera/Fennec/Maemo/Minimo/Conkeror
/(firefox|seamonkey|k-meleon|icecat|iceape|firebird|phoenix)\/((\d+)?[\w\.-]+)/i,
// Firefox/SeaMonkey/K-Meleon/IceCat/IceApe/Firebird/Phoenix
/(mozilla)\/((\d+)?[\w\.]+).+rv\:.+gecko\/\d+/i, // Mozilla
// Other
/(uc\s?browser|polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|qqbrowser)[\/\s]?((\d+)?[\w\.]+)/i,
// UCBrowser/Polaris/Lynx/Dillo/iCab/Doris/Amaya/w3m/NetSurf/QQBrowser
/(links)\s\(((\d+)?[\w\.]+)/i, // Links
/(gobrowser)\/?((\d+)?[\w\.]+)*/i, // GoBrowser
/(ice\s?browser)\/v?((\d+)?[\w\._]+)/i, // ICE Browser
/(mosaic)[\/\s]((\d+)?[\w\.]+)/i // Mosaic
], [NAME, VERSION, MAJOR]
],
engine : [[
/(presto)\/([\w\.]+)/i, // Presto
/(webkit|trident|netfront|netsurf|amaya|lynx|w3m)\/([\w\.]+)/i, // WebKit/Trident/NetFront/NetSurf/Amaya/Lynx/w3m
/(khtml|tasman|links)[\/\s]\(?([\w\.]+)/i, // KHTML/Tasman/Links
/(icab)[\/\s]([23]\.[\d\.]+)/i // iCab
], [NAME, VERSION], [
/rv\:([\w\.]+).*(gecko)/i // Gecko
], [VERSION, NAME]
],
os : [[
// Windows based
/(windows)\snt\s6\.2;\s(arm)/i, // Windows RT
/(windows\sphone(?:\sos)*|windows\smobile|windows)[\s\/]?([ntce\d\.\s]+\w)/i
], [NAME, [VERSION, mapper.str, maps.os.windows.version]], [
/(win(?=3|9|n)|win\s9x\s)([nt\d\.]+)/i
], [[NAME, 'Windows'], [VERSION, mapper.str, maps.os.windows.version]], [
// Mobile/Embedded OS
/\((bb)(10);/i // BlackBerry 10
], [[NAME, 'BlackBerry'], VERSION], [
/(blackberry)\w*\/?([\w\.]+)*/i, // Blackberry
/(tizen)\/([\w\.]+)/i, // Tizen
/(android|webos|palm\os|qnx|bada|rim\stablet\sos|meego)[\/\s-]?([\w\.]+)*/i
// Android/WebOS/Palm/QNX/Bada/RIM/MeeGo
], [NAME, VERSION], [
/(symbian\s?os|symbos|s60(?=;))[\/\s-]?([\w\.]+)*/i // Symbian
], [[NAME, 'Symbian'], VERSION],[
/mozilla.+\(mobile;.+gecko.+firefox/i // Firefox OS
], [[NAME, 'Firefox OS'], VERSION], [
// Console
/(nintendo|playstation)\s([wids3portablevu]+)/i, // Nintendo/Playstation
// GNU/Linux based
/(mint)[\/\s\(]?(\w+)*/i, // Mint
/(joli|[kxln]?ubuntu|debian|[open]*suse|gentoo|arch|slackware|fedora|mandriva|centos|pclinuxos|redhat|zenwalk)[\/\s-]?([\w\.-]+)*/i,
// Joli/Ubuntu/Debian/SUSE/Gentoo/Arch/Slackware
// Fedora/Mandriva/CentOS/PCLinuxOS/RedHat/Zenwalk
/(hurd|linux)\s?([\w\.]+)*/i, // Hurd/Linux
/(gnu)\s?([\w\.]+)*/i // GNU
], [NAME, VERSION], [
/(cros)\s[\w]+\s([\w\.]+\w)/i // Chromium OS
], [[NAME, 'Chromium OS'], VERSION],[
// Solaris
/(sunos)\s?([\w\.]+\d)*/i // Solaris
], [[NAME, 'Solaris'], VERSION], [
// BSD based
/\s([frentopc-]{0,4}bsd|dragonfly)\s?([\w\.]+)*/i // FreeBSD/NetBSD/OpenBSD/PC-BSD/DragonFly
], [NAME, VERSION],[
/(ip[honead]+)(?:.*os\s*([\w]+)*\slike\smac|;\sopera)/i // iOS
], [[NAME, 'iOS'], [VERSION, /_/g, '.']], [
/(mac\sos\sx)\s?([\w\s\.]+\w)*/i // Mac OS
], [NAME, [VERSION, /_/g, '.']], [
// Other
/(haiku)\s(\w+)/i, // Haiku
/(aix)\s((\d)(?=\.|\)|\s)[\w\.]*)*/i, // AIX
/(macintosh|mac(?=_powerpc)|plan\s9|minix|beos|os\/2|amigaos|morphos|risc\sos)/i,
// Plan9/Minix/BeOS/OS2/AmigaOS/MorphOS/RISCOS
/(unix)\s?([\w\.]+)*/i // UNIX
], [NAME, VERSION]
]
};
/////////////////
// Constructor
////////////////
var UAParser = function (uastring) {
var ua = uastring || ((window && window.navigator && window.navigator.userAgent) ? window.navigator.userAgent : EMPTY);
this.getBrowser = function () {
return mapper.rgx.apply(this, regexes.browser);
};
this.getEngine = function () {
return mapper.rgx.apply(this, regexes.engine);
};
this.getOS = function () {
return mapper.rgx.apply(this, regexes.os);
};
this.getResult = function() {
return {
ua : this.getUA(),
browser : this.getBrowser(),
engine : this.getEngine(),
os : this.getOS()
};
};
this.getUA = function () {
return ua;
};
this.setUA = function (uastring) {
ua = uastring;
return this;
};
this.setUA(ua);
};
return new UAParser().getResult();
})();
function version_compare(v1, v2, operator) {
// From: http://phpjs.org/functions
// + original by: Philippe Jausions (http://pear.php.net/user/jausions)
// + original by: Aidan Lister (http://aidanlister.com/)
// + reimplemented by: Kankrelune (http://www.webfaktory.info/)
// + improved by: Brett Zamir (http://brett-zamir.me)
// + improved by: Scott Baker
// + improved by: Theriault
// * example 1: version_compare('8.2.5rc', '8.2.5a');
// * returns 1: 1
// * example 2: version_compare('8.2.50', '8.2.52', '<');
// * returns 2: true
// * example 3: version_compare('5.3.0-dev', '5.3.0');
// * returns 3: -1
// * example 4: version_compare('4.1.0.52','4.01.0.51');
// * returns 4: 1
// Important: compare must be initialized at 0.
var i = 0,
x = 0,
compare = 0,
// vm maps textual PHP versions to negatives so they're less than 0.
// PHP currently defines these as CASE-SENSITIVE. It is important to
// leave these as negatives so that they can come before numerical versions
// and as if no letters were there to begin with.
// (1alpha is < 1 and < 1.1 but > 1dev1)
// If a non-numerical value can't be mapped to this table, it receives
// -7 as its value.
vm = {
'dev': -6,
'alpha': -5,
'a': -5,
'beta': -4,
'b': -4,
'RC': -3,
'rc': -3,
'#': -2,
'p': 1,
'pl': 1
},
// This function will be called to prepare each version argument.
// It replaces every _, -, and + with a dot.
// It surrounds any nonsequence of numbers/dots with dots.
// It replaces sequences of dots with a single dot.
// version_compare('4..0', '4.0') == 0
// Important: A string of 0 length needs to be converted into a value
// even less than an unexisting value in vm (-7), hence [-8].
// It's also important to not strip spaces because of this.
// version_compare('', ' ') == 1
prepVersion = function (v) {
v = ('' + v).replace(/[_\-+]/g, '.');
v = v.replace(/([^.\d]+)/g, '.$1.').replace(/\.{2,}/g, '.');
return (!v.length ? [-8] : v.split('.'));
},
// This converts a version component to a number.
// Empty component becomes 0.
// Non-numerical component becomes a negative number.
// Numerical component becomes itself as an integer.
numVersion = function (v) {
return !v ? 0 : (isNaN(v) ? vm[v] || -7 : parseInt(v, 10));
};
v1 = prepVersion(v1);
v2 = prepVersion(v2);
x = Math.max(v1.length, v2.length);
for (i = 0; i < x; i++) {
if (v1[i] == v2[i]) {
continue;
}
v1[i] = numVersion(v1[i]);
v2[i] = numVersion(v2[i]);
if (v1[i] < v2[i]) {
compare = -1;
break;
} else if (v1[i] > v2[i]) {
compare = 1;
break;
}
}
if (!operator) {
return compare;
}
// Important: operator is CASE-SENSITIVE.
// "No operator" seems to be treated as "<."
// Any other values seem to make the function return null.
switch (operator) {
case '>':
case 'gt':
return (compare > 0);
case '>=':
case 'ge':
return (compare >= 0);
case '<=':
case 'le':
return (compare <= 0);
case '==':
case '=':
case 'eq':
return (compare === 0);
case '<>':
case '!=':
case 'ne':
return (compare !== 0);
case '':
case '<':
case 'lt':
return (compare < 0);
default:
return null;
}
}
var can = (function() {
var caps = {
define_property: (function() {
/* // currently too much extra code required, not exactly worth it
try { // as of IE8, getters/setters are supported only on DOM elements
var obj = {};
if (Object.defineProperty) {
Object.defineProperty(obj, 'prop', {
enumerable: true,
configurable: true
});
return true;
}
} catch(ex) {}
if (Object.prototype.__defineGetter__ && Object.prototype.__defineSetter__) {
return true;
}*/
return false;
}()),
create_canvas: (function() {
// On the S60 and BB Storm, getContext exists, but always returns undefined
// so we actually have to call getContext() to verify
// github.com/Modernizr/Modernizr/issues/issue/97/
var el = document.createElement('canvas');
return !!(el.getContext && el.getContext('2d'));
}()),
return_response_type: function(responseType) {
try {
if (Basic.inArray(responseType, ['', 'text', 'document']) !== -1) {
return true;
} else if (window.XMLHttpRequest) {
var xhr = new XMLHttpRequest();
xhr.open('get', '/'); // otherwise Gecko throws an exception
if ('responseType' in xhr) {
xhr.responseType = responseType;
// as of 23.0.1271.64, Chrome switched from throwing exception to merely logging it to the console (why? o why?)
if (xhr.responseType !== responseType) {
return false;
}
return true;
}
}
} catch (ex) {}
return false;
},
// ideas for this heavily come from Modernizr (http://modernizr.com/)
use_data_uri: (function() {
var du = new Image();
du.onload = function() {
caps.use_data_uri = (du.width === 1 && du.height === 1);
};
setTimeout(function() {
du.src = "data:image/gif;base64,R0lGODlhAQABAIAAAP8AAAAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==";
}, 1);
return false;
}()),
use_data_uri_over32kb: function() { // IE8
return caps.use_data_uri && (Env.browser !== 'IE' || Env.version >= 9);
},
use_data_uri_of: function(bytes) {
return (caps.use_data_uri && bytes < 33000 || caps.use_data_uri_over32kb());
},
use_fileinput: function() {
var el = document.createElement('input');
el.setAttribute('type', 'file');
return !el.disabled;
}
};
return function(cap) {
var args = [].slice.call(arguments);
args.shift(); // shift of cap
return Basic.typeOf(caps[cap]) === 'function' ? caps[cap].apply(this, args) : !!caps[cap];
};
}());
var Env = {
can: can,
browser: UAParser.browser.name,
version: parseFloat(UAParser.browser.major),
os: UAParser.os.name, // everybody intuitively types it in a lowercase for some reason
osVersion: UAParser.os.version,
verComp: version_compare,
swf_url: "../flash/Moxie.swf",
xap_url: "../silverlight/Moxie.xap",
global_event_dispatcher: "moxie.core.EventTarget.instance.dispatchEvent"
};
// for backward compatibility
// @deprecated Use `Env.os` instead
Env.OS = Env.os;
return Env;
});
// Included from: src/javascript/core/utils/Dom.js
/**
* Dom.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define('moxie/core/utils/Dom', ['moxie/core/utils/Env'], function(Env) {
/**
Get DOM Element by it's id.
@method get
@for Utils
@param {String} id Identifier of the DOM Element
@return {DOMElement}
*/
var get = function(id) {
if (typeof id !== 'string') {
return id;
}
return document.getElementById(id);
};
/**
Checks if specified DOM element has specified class.
@method hasClass
@static
@param {Object} obj DOM element like object to add handler to.
@param {String} name Class name
*/
var hasClass = function(obj, name) {
if (!obj.className) {
return false;
}
var regExp = new RegExp("(^|\\s+)"+name+"(\\s+|$)");
return regExp.test(obj.className);
};
/**
Adds specified className to specified DOM element.
@method addClass
@static
@param {Object} obj DOM element like object to add handler to.
@param {String} name Class name
*/
var addClass = function(obj, name) {
if (!hasClass(obj, name)) {
obj.className = !obj.className ? name : obj.className.replace(/\s+$/, '') + ' ' + name;
}
};
/**
Removes specified className from specified DOM element.
@method removeClass
@static
@param {Object} obj DOM element like object to add handler to.
@param {String} name Class name
*/
var removeClass = function(obj, name) {
if (obj.className) {
var regExp = new RegExp("(^|\\s+)"+name+"(\\s+|$)");
obj.className = obj.className.replace(regExp, function($0, $1, $2) {
return $1 === ' ' && $2 === ' ' ? ' ' : '';
});
}
};
/**
Returns a given computed style of a DOM element.
@method getStyle
@static
@param {Object} obj DOM element like object.
@param {String} name Style you want to get from the DOM element
*/
var getStyle = function(obj, name) {
if (obj.currentStyle) {
return obj.currentStyle[name];
} else if (window.getComputedStyle) {
return window.getComputedStyle(obj, null)[name];
}
};
/**
Returns the absolute x, y position of an Element. The position will be returned in a object with x, y fields.
@method getPos
@static
@param {Element} node HTML element or element id to get x, y position from.
@param {Element} root Optional root element to stop calculations at.
@return {object} Absolute position of the specified element object with x, y fields.
*/
var getPos = function(node, root) {
var x = 0, y = 0, parent, doc = document, nodeRect, rootRect;
node = node;
root = root || doc.body;
// Returns the x, y cordinate for an element on IE 6 and IE 7
function getIEPos(node) {
var bodyElm, rect, x = 0, y = 0;
if (node) {
rect = node.getBoundingClientRect();
bodyElm = doc.compatMode === "CSS1Compat" ? doc.documentElement : doc.body;
x = rect.left + bodyElm.scrollLeft;
y = rect.top + bodyElm.scrollTop;
}
return {
x : x,
y : y
};
}
// Use getBoundingClientRect on IE 6 and IE 7 but not on IE 8 in standards mode
if (node && node.getBoundingClientRect && Env.browser === 'IE' && (!doc.documentMode || doc.documentMode < 8)) {
nodeRect = getIEPos(node);
rootRect = getIEPos(root);
return {
x : nodeRect.x - rootRect.x,
y : nodeRect.y - rootRect.y
};
}
parent = node;
while (parent && parent != root && parent.nodeType) {
x += parent.offsetLeft || 0;
y += parent.offsetTop || 0;
parent = parent.offsetParent;
}
parent = node.parentNode;
while (parent && parent != root && parent.nodeType) {
x -= parent.scrollLeft || 0;
y -= parent.scrollTop || 0;
parent = parent.parentNode;
}
return {
x : x,
y : y
};
};
/**
Returns the size of the specified node in pixels.
@method getSize
@static
@param {Node} node Node to get the size of.
@return {Object} Object with a w and h property.
*/
var getSize = function(node) {
return {
w : node.offsetWidth || node.clientWidth,
h : node.offsetHeight || node.clientHeight
};
};
return {
get: get,
hasClass: hasClass,
addClass: addClass,
removeClass: removeClass,
getStyle: getStyle,
getPos: getPos,
getSize: getSize
};
});
// Included from: src/javascript/core/Exceptions.js
/**
* Exceptions.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define('moxie/core/Exceptions', [
'moxie/core/utils/Basic'
], function(Basic) {
function _findKey(obj, value) {
var key;
for (key in obj) {
if (obj[key] === value) {
return key;
}
}
return null;
}
return {
RuntimeError: (function() {
var namecodes = {
NOT_INIT_ERR: 1,
NOT_SUPPORTED_ERR: 9,
JS_ERR: 4
};
function RuntimeError(code) {
this.code = code;
this.name = _findKey(namecodes, code);
this.message = this.name + ": RuntimeError " + this.code;
}
Basic.extend(RuntimeError, namecodes);
RuntimeError.prototype = Error.prototype;
return RuntimeError;
}()),
OperationNotAllowedException: (function() {
function OperationNotAllowedException(code) {
this.code = code;
this.name = 'OperationNotAllowedException';
}
Basic.extend(OperationNotAllowedException, {
NOT_ALLOWED_ERR: 1
});
OperationNotAllowedException.prototype = Error.prototype;
return OperationNotAllowedException;
}()),
ImageError: (function() {
var namecodes = {
WRONG_FORMAT: 1,
MAX_RESOLUTION_ERR: 2
};
function ImageError(code) {
this.code = code;
this.name = _findKey(namecodes, code);
this.message = this.name + ": ImageError " + this.code;
}
Basic.extend(ImageError, namecodes);
ImageError.prototype = Error.prototype;
return ImageError;
}()),
FileException: (function() {
var namecodes = {
NOT_FOUND_ERR: 1,
SECURITY_ERR: 2,
ABORT_ERR: 3,
NOT_READABLE_ERR: 4,
ENCODING_ERR: 5,
NO_MODIFICATION_ALLOWED_ERR: 6,
INVALID_STATE_ERR: 7,
SYNTAX_ERR: 8
};
function FileException(code) {
this.code = code;
this.name = _findKey(namecodes, code);
this.message = this.name + ": FileException " + this.code;
}
Basic.extend(FileException, namecodes);
FileException.prototype = Error.prototype;
return FileException;
}()),
DOMException: (function() {
var namecodes = {
INDEX_SIZE_ERR: 1,
DOMSTRING_SIZE_ERR: 2,
HIERARCHY_REQUEST_ERR: 3,
WRONG_DOCUMENT_ERR: 4,
INVALID_CHARACTER_ERR: 5,
NO_DATA_ALLOWED_ERR: 6,
NO_MODIFICATION_ALLOWED_ERR: 7,
NOT_FOUND_ERR: 8,
NOT_SUPPORTED_ERR: 9,
INUSE_ATTRIBUTE_ERR: 10,
INVALID_STATE_ERR: 11,
SYNTAX_ERR: 12,
INVALID_MODIFICATION_ERR: 13,
NAMESPACE_ERR: 14,
INVALID_ACCESS_ERR: 15,
VALIDATION_ERR: 16,
TYPE_MISMATCH_ERR: 17,
SECURITY_ERR: 18,
NETWORK_ERR: 19,
ABORT_ERR: 20,
URL_MISMATCH_ERR: 21,
QUOTA_EXCEEDED_ERR: 22,
TIMEOUT_ERR: 23,
INVALID_NODE_TYPE_ERR: 24,
DATA_CLONE_ERR: 25
};
function DOMException(code) {
this.code = code;
this.name = _findKey(namecodes, code);
this.message = this.name + ": DOMException " + this.code;
}
Basic.extend(DOMException, namecodes);
DOMException.prototype = Error.prototype;
return DOMException;
}()),
EventException: (function() {
function EventException(code) {
this.code = code;
this.name = 'EventException';
}
Basic.extend(EventException, {
UNSPECIFIED_EVENT_TYPE_ERR: 0
});
EventException.prototype = Error.prototype;
return EventException;
}())
};
});
// Included from: src/javascript/core/EventTarget.js
/**
* EventTarget.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define('moxie/core/EventTarget', [
'moxie/core/Exceptions',
'moxie/core/utils/Basic'
], function(x, Basic) {
/**
Parent object for all event dispatching components and objects
@class EventTarget
@constructor EventTarget
*/
function EventTarget() {
// hash of event listeners by object uid
var eventpool = {};
Basic.extend(this, {
/**
Unique id of the event dispatcher, usually overriden by children
@property uid
@type String
*/
uid: null,
/**
Can be called from within a child in order to acquire uniqie id in automated manner
@method init
*/
init: function() {
if (!this.uid) {
this.uid = Basic.guid('uid_');
}
},
/**
Register a handler to a specific event dispatched by the object
@method addEventListener
@param {String} type Type or basically a name of the event to subscribe to
@param {Function} fn Callback function that will be called when event happens
@param {Number} [priority=0] Priority of the event handler - handlers with higher priorities will be called first
@param {Object} [scope=this] A scope to invoke event handler in
*/
addEventListener: function(type, fn, priority, scope) {
var self = this, list;
type = Basic.trim(type);
if (/\s/.test(type)) {
// multiple event types were passed for one handler
Basic.each(type.split(/\s+/), function(type) {
self.addEventListener(type, fn, priority, scope);
});
return;
}
type = type.toLowerCase();
priority = parseInt(priority, 10) || 0;
list = eventpool[this.uid] && eventpool[this.uid][type] || [];
list.push({fn : fn, priority : priority, scope : scope || this});
if (!eventpool[this.uid]) {
eventpool[this.uid] = {};
}
eventpool[this.uid][type] = list;
},
/**
Check if any handlers were registered to the specified event
@method hasEventListener
@param {String} type Type or basically a name of the event to check
@return {Mixed} Returns a handler if it was found and false, if - not
*/
hasEventListener: function(type) {
return type ? !!(eventpool[this.uid] && eventpool[this.uid][type]) : !!eventpool[this.uid];
},
/**
Unregister the handler from the event, or if former was not specified - unregister all handlers
@method removeEventListener
@param {String} type Type or basically a name of the event
@param {Function} [fn] Handler to unregister
*/
removeEventListener: function(type, fn) {
type = type.toLowerCase();
var list = eventpool[this.uid] && eventpool[this.uid][type], i;
if (list) {
if (fn) {
for (i = list.length - 1; i >= 0; i--) {
if (list[i].fn === fn) {
list.splice(i, 1);
break;
}
}
} else {
list = [];
}
// delete event list if it has become empty
if (!list.length) {
delete eventpool[this.uid][type];
// and object specific entry in a hash if it has no more listeners attached
if (Basic.isEmptyObj(eventpool[this.uid])) {
delete eventpool[this.uid];
}
}
}
},
/**
Remove all event handlers from the object
@method removeAllEventListeners
*/
removeAllEventListeners: function() {
if (eventpool[this.uid]) {
delete eventpool[this.uid];
}
},
/**
Dispatch the event
@method dispatchEvent
@param {String/Object} Type of event or event object to dispatch
@param {Mixed} [...] Variable number of arguments to be passed to a handlers
@return {Boolean} true by default and false if any handler returned false
*/
dispatchEvent: function(type) {
var uid, list, args, tmpEvt, evt = {}, result = true, undef;
if (Basic.typeOf(type) !== 'string') {
// we can't use original object directly (because of Silverlight)
tmpEvt = type;
if (Basic.typeOf(tmpEvt.type) === 'string') {
type = tmpEvt.type;
if (tmpEvt.total !== undef && tmpEvt.loaded !== undef) { // progress event
evt.total = tmpEvt.total;
evt.loaded = tmpEvt.loaded;
}
evt.async = tmpEvt.async || false;
} else {
throw new x.EventException(x.EventException.UNSPECIFIED_EVENT_TYPE_ERR);
}
}
// check if event is meant to be dispatched on an object having specific uid
if (type.indexOf('::') !== -1) {
(function(arr) {
uid = arr[0];
type = arr[1];
}(type.split('::')));
} else {
uid = this.uid;
}
type = type.toLowerCase();
list = eventpool[uid] && eventpool[uid][type];
if (list) {
// sort event list by prority
list.sort(function(a, b) { return b.priority - a.priority; });
args = [].slice.call(arguments);
// first argument will be pseudo-event object
args.shift();
evt.type = type;
args.unshift(evt);
// Dispatch event to all listeners
var queue = [];
Basic.each(list, function(handler) {
// explicitly set the target, otherwise events fired from shims do not get it
args[0].target = handler.scope;
// if event is marked as async, detach the handler
if (evt.async) {
queue.push(function(cb) {
setTimeout(function() {
cb(handler.fn.apply(handler.scope, args) === false);
}, 1);
});
} else {
queue.push(function(cb) {
cb(handler.fn.apply(handler.scope, args) === false); // if handler returns false stop propagation
});
}
});
if (queue.length) {
Basic.inSeries(queue, function(err) {
result = !err;
});
}
}
return result;
},
/**
Alias for addEventListener
@method bind
@protected
*/
bind: function() {
this.addEventListener.apply(this, arguments);
},
/**
Alias for removeEventListener
@method unbind
@protected
*/
unbind: function() {
this.removeEventListener.apply(this, arguments);
},
/**
Alias for removeAllEventListeners
@method unbindAll
@protected
*/
unbindAll: function() {
this.removeAllEventListeners.apply(this, arguments);
},
/**
Alias for dispatchEvent
@method trigger
@protected
*/
trigger: function() {
return this.dispatchEvent.apply(this, arguments);
},
/**
Converts properties of on[event] type to corresponding event handlers,
is used to avoid extra hassle around the process of calling them back
@method convertEventPropsToHandlers
@private
*/
convertEventPropsToHandlers: function(handlers) {
var h;
if (Basic.typeOf(handlers) !== 'array') {
handlers = [handlers];
}
for (var i = 0; i < handlers.length; i++) {
h = 'on' + handlers[i];
if (Basic.typeOf(this[h]) === 'function') {
this.addEventListener(handlers[i], this[h]);
} else if (Basic.typeOf(this[h]) === 'undefined') {
this[h] = null; // object must have defined event properties, even if it doesn't make use of them
}
}
}
});
}
EventTarget.instance = new EventTarget();
return EventTarget;
});
// Included from: src/javascript/core/utils/Encode.js
/**
* Encode.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define('moxie/core/utils/Encode', [], function() {
/**
Encode string with UTF-8
@method utf8_encode
@for Utils
@static
@param {String} str String to encode
@return {String} UTF-8 encoded string
*/
var utf8_encode = function(str) {
return unescape(encodeURIComponent(str));
};
/**
Decode UTF-8 encoded string
@method utf8_decode
@static
@param {String} str String to decode
@return {String} Decoded string
*/
var utf8_decode = function(str_data) {
return decodeURIComponent(escape(str_data));
};
/**
Decode Base64 encoded string (uses browser's default method if available),
from: https://raw.github.com/kvz/phpjs/master/functions/url/base64_decode.js
@method atob
@static
@param {String} data String to decode
@return {String} Decoded string
*/
var atob = function(data, utf8) {
if (typeof(window.atob) === 'function') {
return utf8 ? utf8_decode(window.atob(data)) : window.atob(data);
}
// http://kevin.vanzonneveld.net
// + original by: Tyler Akins (http://rumkin.com)
// + improved by: Thunder.m
// + input by: Aman Gupta
// + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// + bugfixed by: Onno Marsman
// + bugfixed by: Pellentesque Malesuada
// + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// + input by: Brett Zamir (http://brett-zamir.me)
// + bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// * example 1: base64_decode('S2V2aW4gdmFuIFpvbm5ldmVsZA==');
// * returns 1: 'Kevin van Zonneveld'
// mozilla has this native
// - but breaks in 2.0.0.12!
//if (typeof this.window.atob == 'function') {
// return atob(data);
//}
var b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
var o1, o2, o3, h1, h2, h3, h4, bits, i = 0,
ac = 0,
dec = "",
tmp_arr = [];
if (!data) {
return data;
}
data += '';
do { // unpack four hexets into three octets using index points in b64
h1 = b64.indexOf(data.charAt(i++));
h2 = b64.indexOf(data.charAt(i++));
h3 = b64.indexOf(data.charAt(i++));
h4 = b64.indexOf(data.charAt(i++));
bits = h1 << 18 | h2 << 12 | h3 << 6 | h4;
o1 = bits >> 16 & 0xff;
o2 = bits >> 8 & 0xff;
o3 = bits & 0xff;
if (h3 == 64) {
tmp_arr[ac++] = String.fromCharCode(o1);
} else if (h4 == 64) {
tmp_arr[ac++] = String.fromCharCode(o1, o2);
} else {
tmp_arr[ac++] = String.fromCharCode(o1, o2, o3);
}
} while (i < data.length);
dec = tmp_arr.join('');
return utf8 ? utf8_decode(dec) : dec;
};
/**
Base64 encode string (uses browser's default method if available),
from: https://raw.github.com/kvz/phpjs/master/functions/url/base64_encode.js
@method btoa
@static
@param {String} data String to encode
@return {String} Base64 encoded string
*/
var btoa = function(data, utf8) {
if (utf8) {
utf8_encode(data);
}
if (typeof(window.btoa) === 'function') {
return window.btoa(data);
}
// http://kevin.vanzonneveld.net
// + original by: Tyler Akins (http://rumkin.com)
// + improved by: Bayron Guevara
// + improved by: Thunder.m
// + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// + bugfixed by: Pellentesque Malesuada
// + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// + improved by: Rafał Kukawski (http://kukawski.pl)
// * example 1: base64_encode('Kevin van Zonneveld');
// * returns 1: 'S2V2aW4gdmFuIFpvbm5ldmVsZA=='
// mozilla has this native
// - but breaks in 2.0.0.12!
var b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
var o1, o2, o3, h1, h2, h3, h4, bits, i = 0,
ac = 0,
enc = "",
tmp_arr = [];
if (!data) {
return data;
}
do { // pack three octets into four hexets
o1 = data.charCodeAt(i++);
o2 = data.charCodeAt(i++);
o3 = data.charCodeAt(i++);
bits = o1 << 16 | o2 << 8 | o3;
h1 = bits >> 18 & 0x3f;
h2 = bits >> 12 & 0x3f;
h3 = bits >> 6 & 0x3f;
h4 = bits & 0x3f;
// use hexets to index into b64, and append result to encoded string
tmp_arr[ac++] = b64.charAt(h1) + b64.charAt(h2) + b64.charAt(h3) + b64.charAt(h4);
} while (i < data.length);
enc = tmp_arr.join('');
var r = data.length % 3;
return (r ? enc.slice(0, r - 3) : enc) + '==='.slice(r || 3);
};
return {
utf8_encode: utf8_encode,
utf8_decode: utf8_decode,
atob: atob,
btoa: btoa
};
});
// Included from: src/javascript/runtime/Runtime.js
/**
* Runtime.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define('moxie/runtime/Runtime', [
"moxie/core/utils/Basic",
"moxie/core/utils/Dom",
"moxie/core/EventTarget"
], function(Basic, Dom, EventTarget) {
var runtimeConstructors = {}, runtimes = {};
/**
Common set of methods and properties for every runtime instance
@class Runtime
@param {Object} options
@param {String} type Sanitized name of the runtime
@param {Object} [caps] Set of capabilities that differentiate specified runtime
@param {Object} [modeCaps] Set of capabilities that do require specific operational mode
@param {String} [preferredMode='browser'] Preferred operational mode to choose if no required capabilities were requested
*/
function Runtime(options, type, caps, modeCaps, preferredMode) {
/**
Dispatched when runtime is initialized and ready.
Results in RuntimeInit on a connected component.
@event Init
*/
/**
Dispatched when runtime fails to initialize.
Results in RuntimeError on a connected component.
@event Error
*/
var self = this
, _shim
, _uid = Basic.guid(type + '_')
, defaultMode = preferredMode || 'browser'
;
options = options || {};
// register runtime in private hash
runtimes[_uid] = this;
/**
Default set of capabilities, which can be redifined later by specific runtime
@private
@property caps
@type Object
*/
caps = Basic.extend({
// Runtime can:
// provide access to raw binary data of the file
access_binary: false,
// provide access to raw binary data of the image (image extension is optional)
access_image_binary: false,
// display binary data as thumbs for example
display_media: false,
// make cross-domain requests
do_cors: false,
// accept files dragged and dropped from the desktop
drag_and_drop: false,
// filter files in selection dialog by their extensions
filter_by_extension: true,
// resize image (and manipulate it raw data of any file in general)
resize_image: false,
// periodically report how many bytes of total in the file were uploaded (loaded)
report_upload_progress: false,
// provide access to the headers of http response
return_response_headers: false,
// support response of specific type, which should be passed as an argument
// e.g. runtime.can('return_response_type', 'blob')
return_response_type: false,
// return http status code of the response
return_status_code: true,
// send custom http header with the request
send_custom_headers: false,
// pick up the files from a dialog
select_file: false,
// select whole folder in file browse dialog
select_folder: false,
// select multiple files at once in file browse dialog
select_multiple: true,
// send raw binary data, that is generated after image resizing or manipulation of other kind
send_binary_string: false,
// send cookies with http request and therefore retain session
send_browser_cookies: true,
// send data formatted as multipart/form-data
send_multipart: true,
// slice the file or blob to smaller parts
slice_blob: false,
// upload file without preloading it to memory, stream it out directly from disk
stream_upload: false,
// programmatically trigger file browse dialog
summon_file_dialog: false,
// upload file of specific size, size should be passed as argument
// e.g. runtime.can('upload_filesize', '500mb')
upload_filesize: true,
// initiate http request with specific http method, method should be passed as argument
// e.g. runtime.can('use_http_method', 'put')
use_http_method: true
}, caps);
// default to the mode that is compatible with preferred caps
if (options.preferred_caps) {
defaultMode = Runtime.getMode(modeCaps, options.preferred_caps, defaultMode);
}
// small extension factory here (is meant to be extended with actual extensions constructors)
_shim = (function() {
var objpool = {};
return {
exec: function(uid, comp, fn, args) {
if (_shim[comp]) {
if (!objpool[uid]) {
objpool[uid] = {
context: this,
instance: new _shim[comp]()
};
}
if (objpool[uid].instance[fn]) {
return objpool[uid].instance[fn].apply(this, args);
}
}
},
removeInstance: function(uid) {
delete objpool[uid];
},
removeAllInstances: function() {
var self = this;
Basic.each(objpool, function(obj, uid) {
if (Basic.typeOf(obj.instance.destroy) === 'function') {
obj.instance.destroy.call(obj.context);
}
self.removeInstance(uid);
});
}
};
}());
// public methods
Basic.extend(this, {
/**
Specifies whether runtime instance was initialized or not
@property initialized
@type {Boolean}
@default false
*/
initialized: false, // shims require this flag to stop initialization retries
/**
Unique ID of the runtime
@property uid
@type {String}
*/
uid: _uid,
/**
Runtime type (e.g. flash, html5, etc)
@property type
@type {String}
*/
type: type,
/**
Runtime (not native one) may operate in browser or client mode.
@property mode
@private
@type {String|Boolean} current mode or false, if none possible
*/
mode: Runtime.getMode(modeCaps, (options.required_caps), defaultMode),
/**
id of the DOM container for the runtime (if available)
@property shimid
@type {String}
*/
shimid: _uid + '_container',
/**
Number of connected clients. If equal to zero, runtime can be destroyed
@property clients
@type {Number}
*/
clients: 0,
/**
Runtime initialization options
@property options
@type {Object}
*/
options: options,
/**
Checks if the runtime has specific capability
@method can
@param {String} cap Name of capability to check
@param {Mixed} [value] If passed, capability should somehow correlate to the value
@param {Object} [refCaps] Set of capabilities to check the specified cap against (defaults to internal set)
@return {Boolean} true if runtime has such capability and false, if - not
*/
can: function(cap, value) {
var refCaps = arguments[2] || caps;
// if cap var is a comma-separated list of caps, convert it to object (key/value)
if (Basic.typeOf(cap) === 'string' && Basic.typeOf(value) === 'undefined') {
cap = Runtime.parseCaps(cap);
}
if (Basic.typeOf(cap) === 'object') {
for (var key in cap) {
if (!this.can(key, cap[key], refCaps)) {
return false;
}
}
return true;
}
// check the individual cap
if (Basic.typeOf(refCaps[cap]) === 'function') {
return refCaps[cap].call(this, value);
} else {
return (value === refCaps[cap]);
}
},
/**
Returns container for the runtime as DOM element
@method getShimContainer
@return {DOMElement}
*/
getShimContainer: function() {
var container, shimContainer = Dom.get(this.shimid);
// if no container for shim, create one
if (!shimContainer) {
container = this.options.container ? Dom.get(this.options.container) : document.body;
// create shim container and insert it at an absolute position into the outer container
shimContainer = document.createElement('div');
shimContainer.id = this.shimid;
shimContainer.className = 'moxie-shim moxie-shim-' + this.type;
Basic.extend(shimContainer.style, {
position: 'absolute',
top: '0px',
left: '0px',
width: '1px',
height: '1px',
overflow: 'hidden'
});
container.appendChild(shimContainer);
container = null;
}
return shimContainer;
},
/**
Returns runtime as DOM element (if appropriate)
@method getShim
@return {DOMElement}
*/
getShim: function() {
return _shim;
},
/**
Invokes a method within the runtime itself (might differ across the runtimes)
@method shimExec
@param {Mixed} []
@protected
@return {Mixed} Depends on the action and component
*/
shimExec: function(component, action) {
var args = [].slice.call(arguments, 2);
return self.getShim().exec.call(this, this.uid, component, action, args);
},
/**
Operaional interface that is used by components to invoke specific actions on the runtime
(is invoked in the scope of component)
@method exec
@param {Mixed} []*
@protected
@return {Mixed} Depends on the action and component
*/
exec: function(component, action) { // this is called in the context of component, not runtime
var args = [].slice.call(arguments, 2);
if (self[component] && self[component][action]) {
return self[component][action].apply(this, args);
}
return self.shimExec.apply(this, arguments);
},
/**
Destroys the runtime (removes all events and deletes DOM structures)
@method destroy
*/
destroy: function() {
if (!self) {
return; // obviously already destroyed
}
var shimContainer = Dom.get(this.shimid);
if (shimContainer) {
shimContainer.parentNode.removeChild(shimContainer);
}
if (_shim) {
_shim.removeAllInstances();
}
this.unbindAll();
delete runtimes[this.uid];
this.uid = null; // mark this runtime as destroyed
_uid = self = _shim = shimContainer = null;
}
});
// once we got the mode, test against all caps
if (this.mode && options.required_caps && !this.can(options.required_caps)) {
this.mode = false;
}
}
/**
Default order to try different runtime types
@property order
@type String
@static
*/
Runtime.order = 'html5,flash,silverlight,html4';
/**
Retrieves runtime from private hash by it's uid
@method getRuntime
@private
@static
@param {String} uid Unique identifier of the runtime
@return {Runtime|Boolean} Returns runtime, if it exists and false, if - not
*/
Runtime.getRuntime = function(uid) {
return runtimes[uid] ? runtimes[uid] : false;
};
/**
Register constructor for the Runtime of new (or perhaps modified) type
@method addConstructor
@static
@param {String} type Runtime type (e.g. flash, html5, etc)
@param {Function} construct Constructor for the Runtime type
*/
Runtime.addConstructor = function(type, constructor) {
constructor.prototype = EventTarget.instance;
runtimeConstructors[type] = constructor;
};
/**
Get the constructor for the specified type.
method getConstructor
@static
@param {String} type Runtime type (e.g. flash, html5, etc)
@return {Function} Constructor for the Runtime type
*/
Runtime.getConstructor = function(type) {
return runtimeConstructors[type] || null;
};
/**
Get info about the runtime (uid, type, capabilities)
@method getInfo
@static
@param {String} uid Unique identifier of the runtime
@return {Mixed} Info object or null if runtime doesn't exist
*/
Runtime.getInfo = function(uid) {
var runtime = Runtime.getRuntime(uid);
if (runtime) {
return {
uid: runtime.uid,
type: runtime.type,
mode: runtime.mode,
can: function() {
return runtime.can.apply(runtime, arguments);
}
};
}
return null;
};
/**
Convert caps represented by a comma-separated string to the object representation.
@method parseCaps
@static
@param {String} capStr Comma-separated list of capabilities
@return {Object}
*/
Runtime.parseCaps = function(capStr) {
var capObj = {};
if (Basic.typeOf(capStr) !== 'string') {
return capStr || {};
}
Basic.each(capStr.split(','), function(key) {
capObj[key] = true; // we assume it to be - true
});
return capObj;
};
/**
Test the specified runtime for specific capabilities.
@method can
@static
@param {String} type Runtime type (e.g. flash, html5, etc)
@param {String|Object} caps Set of capabilities to check
@return {Boolean} Result of the test
*/
Runtime.can = function(type, caps) {
var runtime
, constructor = Runtime.getConstructor(type)
, mode
;
if (constructor) {
runtime = new constructor({
required_caps: caps
});
mode = runtime.mode;
runtime.destroy();
return !!mode;
}
return false;
};
/**
Figure out a runtime that supports specified capabilities.
@method thatCan
@static
@param {String|Object} caps Set of capabilities to check
@param {String} [runtimeOrder] Comma-separated list of runtimes to check against
@return {String} Usable runtime identifier or null
*/
Runtime.thatCan = function(caps, runtimeOrder) {
var types = (runtimeOrder || Runtime.order).split(/\s*,\s*/);
for (var i in types) {
if (Runtime.can(types[i], caps)) {
return types[i];
}
}
return null;
};
/**
Figure out an operational mode for the specified set of capabilities.
@method getMode
@static
@param {Object} modeCaps Set of capabilities that depend on particular runtime mode
@param {Object} [requiredCaps] Supplied set of capabilities to find operational mode for
@param {String|Boolean} [defaultMode='browser'] Default mode to use
@return {String|Boolean} Compatible operational mode
*/
Runtime.getMode = function(modeCaps, requiredCaps, defaultMode) {
var mode = null;
if (Basic.typeOf(defaultMode) === 'undefined') { // only if not specified
defaultMode = 'browser';
}
if (requiredCaps && !Basic.isEmptyObj(modeCaps)) {
// loop over required caps and check if they do require the same mode
Basic.each(requiredCaps, function(value, cap) {
if (modeCaps.hasOwnProperty(cap)) {
var capMode = modeCaps[cap](value);
// make sure we always have an array
if (typeof(capMode) === 'string') {
capMode = [capMode];
}
if (!mode) {
mode = capMode;
} else if (!(mode = Basic.arrayIntersect(mode, capMode))) {
// if cap requires conflicting mode - runtime cannot fulfill required caps
return (mode = false);
}
}
});
if (mode) {
return Basic.inArray(defaultMode, mode) !== -1 ? defaultMode : mode[0];
} else if (mode === false) {
return false;
}
}
return defaultMode;
};
/**
Capability check that always returns true
@private
@static
@return {True}
*/
Runtime.capTrue = function() {
return true;
};
/**
Capability check that always returns false
@private
@static
@return {False}
*/
Runtime.capFalse = function() {
return false;
};
/**
Evaluate the expression to boolean value and create a function that always returns it.
@private
@static
@param {Mixed} expr Expression to evaluate
@return {Function} Function returning the result of evaluation
*/
Runtime.capTest = function(expr) {
return function() {
return !!expr;
};
};
return Runtime;
});
// Included from: src/javascript/runtime/RuntimeClient.js
/**
* RuntimeClient.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define('moxie/runtime/RuntimeClient', [
'moxie/core/Exceptions',
'moxie/core/utils/Basic',
'moxie/runtime/Runtime'
], function(x, Basic, Runtime) {
/**
Set of methods and properties, required by a component to acquire ability to connect to a runtime
@class RuntimeClient
*/
return function RuntimeClient() {
var runtime;
Basic.extend(this, {
/**
Connects to the runtime specified by the options. Will either connect to existing runtime or create a new one.
Increments number of clients connected to the specified runtime.
@method connectRuntime
@param {Mixed} options Can be a runtme uid or a set of key-value pairs defining requirements and pre-requisites
*/
connectRuntime: function(options) {
var comp = this, ruid;
function initialize(items) {
var type, constructor;
// if we ran out of runtimes
if (!items.length) {
comp.trigger('RuntimeError', new x.RuntimeError(x.RuntimeError.NOT_INIT_ERR));
runtime = null;
return;
}
type = items.shift();
constructor = Runtime.getConstructor(type);
if (!constructor) {
initialize(items);
return;
}
// try initializing the runtime
runtime = new constructor(options);
runtime.bind('Init', function() {
// mark runtime as initialized
runtime.initialized = true;
// jailbreak ...
setTimeout(function() {
runtime.clients++;
// this will be triggered on component
comp.trigger('RuntimeInit', runtime);
}, 1);
});
runtime.bind('Error', function() {
runtime.destroy(); // runtime cannot destroy itself from inside at a right moment, thus we do it here
initialize(items);
});
/*runtime.bind('Exception', function() { });*/
// check if runtime managed to pick-up operational mode
if (!runtime.mode) {
runtime.trigger('Error');
return;
}
runtime.init();
}
// check if a particular runtime was requested
if (Basic.typeOf(options) === 'string') {
ruid = options;
} else if (Basic.typeOf(options.ruid) === 'string') {
ruid = options.ruid;
}
if (ruid) {
runtime = Runtime.getRuntime(ruid);
if (runtime) {
runtime.clients++;
return runtime;
} else {
// there should be a runtime and there's none - weird case
throw new x.RuntimeError(x.RuntimeError.NOT_INIT_ERR);
}
}
// initialize a fresh one, that fits runtime list and required features best
initialize((options.runtime_order || Runtime.order).split(/\s*,\s*/));
},
/**
Returns the runtime to which the client is currently connected.
@method getRuntime
@return {Runtime} Runtime or null if client is not connected
*/
getRuntime: function() {
if (runtime && runtime.uid) {
return runtime;
}
runtime = null; // make sure we do not leave zombies rambling around
return null;
},
/**
Disconnects from the runtime. Decrements number of clients connected to the specified runtime.
@method disconnectRuntime
*/
disconnectRuntime: function() {
if (runtime && --runtime.clients <= 0) {
runtime.destroy();
runtime = null;
}
}
});
};
});
// Included from: src/javascript/file/Blob.js
/**
* Blob.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define('moxie/file/Blob', [
'moxie/core/utils/Basic',
'moxie/core/utils/Encode',
'moxie/runtime/RuntimeClient'
], function(Basic, Encode, RuntimeClient) {
var blobpool = {};
/**
@class Blob
@constructor
@param {String} ruid Unique id of the runtime, to which this blob belongs to
@param {Object} blob Object "Native" blob object, as it is represented in the runtime
*/
function Blob(ruid, blob) {
function _sliceDetached(start, end, type) {
var blob, data = blobpool[this.uid];
if (Basic.typeOf(data) !== 'string' || !data.length) {
return null; // or throw exception
}
blob = new Blob(null, {
type: type,
size: end - start
});
blob.detach(data.substr(start, blob.size));
return blob;
}
RuntimeClient.call(this);
if (ruid) {
this.connectRuntime(ruid);
}
if (!blob) {
blob = {};
} else if (Basic.typeOf(blob) === 'string') { // dataUrl or binary string
blob = { data: blob };
}
Basic.extend(this, {
/**
Unique id of the component
@property uid
@type {String}
*/
uid: blob.uid || Basic.guid('uid_'),
/**
Unique id of the connected runtime, if falsy, then runtime will have to be initialized
before this Blob can be used, modified or sent
@property ruid
@type {String}
*/
ruid: ruid,
/**
Size of blob
@property size
@type {Number}
@default 0
*/
size: blob.size || 0,
/**
Mime type of blob
@property type
@type {String}
@default ''
*/
type: blob.type || '',
/**
@method slice
@param {Number} [start=0]
*/
slice: function(start, end, type) {
if (this.isDetached()) {
return _sliceDetached.apply(this, arguments);
}
return this.getRuntime().exec.call(this, 'Blob', 'slice', this.getSource(), start, end, type);
},
/**
Returns "native" blob object (as it is represented in connected runtime) or null if not found
@method getSource
@return {Blob} Returns "native" blob object or null if not found
*/
getSource: function() {
if (!blobpool[this.uid]) {
return null;
}
return blobpool[this.uid];
},
/**
Detaches blob from any runtime that it depends on and initialize with standalone value
@method detach
@protected
@param {DOMString} [data=''] Standalone value
*/
detach: function(data) {
if (this.ruid) {
this.getRuntime().exec.call(this, 'Blob', 'destroy');
this.disconnectRuntime();
this.ruid = null;
}
data = data || '';
// if dataUrl, convert to binary string
var matches = data.match(/^data:([^;]*);base64,/);
if (matches) {
this.type = matches[1];
data = Encode.atob(data.substring(data.indexOf('base64,') + 7));
}
this.size = data.length;
blobpool[this.uid] = data;
},
/**
Checks if blob is standalone (detached of any runtime)
@method isDetached
@protected
@return {Boolean}
*/
isDetached: function() {
return !this.ruid && Basic.typeOf(blobpool[this.uid]) === 'string';
},
/**
Destroy Blob and free any resources it was using
@method destroy
*/
destroy: function() {
this.detach();
delete blobpool[this.uid];
}
});
if (blob.data) {
this.detach(blob.data); // auto-detach if payload has been passed
} else {
blobpool[this.uid] = blob;
}
}
return Blob;
});
// Included from: src/javascript/file/File.js
/**
* File.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define('moxie/file/File', [
'moxie/core/utils/Basic',
'moxie/core/utils/Mime',
'moxie/file/Blob'
], function(Basic, Mime, Blob) {
/**
@class File
@extends Blob
@constructor
@param {String} ruid Unique id of the runtime, to which this blob belongs to
@param {Object} file Object "Native" file object, as it is represented in the runtime
*/
function File(ruid, file) {
var name, type;
if (!file) { // avoid extra errors in case we overlooked something
file = {};
}
// figure out the type
if (file.type && file.type !== '') {
type = file.type;
} else {
type = Mime.getFileMime(file.name);
}
// sanitize file name or generate new one
if (file.name) {
name = file.name.replace(/\\/g, '/');
name = name.substr(name.lastIndexOf('/') + 1);
} else {
var prefix = type.split('/')[0];
name = Basic.guid((prefix !== '' ? prefix : 'file') + '_');
if (Mime.extensions[type]) {
name += '.' + Mime.extensions[type][0]; // append proper extension if possible
}
}
Blob.apply(this, arguments);
Basic.extend(this, {
/**
File mime type
@property type
@type {String}
@default ''
*/
type: type || '',
/**
File name
@property name
@type {String}
@default UID
*/
name: name || Basic.guid('file_'),
/**
Date of last modification
@property lastModifiedDate
@type {String}
@default now
*/
lastModifiedDate: file.lastModifiedDate || (new Date()).toLocaleString() // Thu Aug 23 2012 19:40:00 GMT+0400 (GET)
});
}
File.prototype = Blob.prototype;
return File;
});
// Included from: src/javascript/file/FileInput.js
/**
* FileInput.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define('moxie/file/FileInput', [
'moxie/core/utils/Basic',
'moxie/core/utils/Mime',
'moxie/core/utils/Dom',
'moxie/core/Exceptions',
'moxie/core/EventTarget',
'moxie/core/I18n',
'moxie/file/File',
'moxie/runtime/Runtime',
'moxie/runtime/RuntimeClient'
], function(Basic, Mime, Dom, x, EventTarget, I18n, File, Runtime, RuntimeClient) {
/**
Provides a convenient way to create cross-browser file-picker. Generates file selection dialog on click,
converts selected files to _File_ objects, to be used in conjunction with _Image_, preloaded in memory
with _FileReader_ or uploaded to a server through _XMLHttpRequest_.
@class FileInput
@constructor
@extends EventTarget
@uses RuntimeClient
@param {Object|String|DOMElement} options If options is string or node, argument is considered as _browse\_button_.
@param {String|DOMElement} options.browse_button DOM Element to turn into file picker.
@param {Array} [options.accept] Array of mime types to accept. By default accepts all.
@param {String} [options.file='file'] Name of the file field (not the filename).
@param {Boolean} [options.multiple=false] Enable selection of multiple files.
@param {Boolean} [options.directory=false] Turn file input into the folder input (cannot be both at the same time).
@param {String|DOMElement} [options.container] DOM Element to use as a container for file-picker. Defaults to parentNode
for _browse\_button_.
@param {Object|String} [options.required_caps] Set of required capabilities, that chosen runtime must support.
@example
<div id="container">
<a id="file-picker" href="javascript:;">Browse...</a>
</div>
<script>
var fileInput = new mOxie.FileInput({
browse_button: 'file-picker', // or document.getElementById('file-picker')
container: 'container',
accept: [
{title: "Image files", extensions: "jpg,gif,png"} // accept only images
],
multiple: true // allow multiple file selection
});
fileInput.onchange = function(e) {
// do something to files array
console.info(e.target.files); // or this.files or fileInput.files
};
fileInput.init(); // initialize
</script>
*/
var dispatches = [
/**
Dispatched when runtime is connected and file-picker is ready to be used.
@event ready
@param {Object} event
*/
'ready',
/**
Dispatched right after [ready](#event_ready) event, and whenever [refresh()](#method_refresh) is invoked.
Check [corresponding documentation entry](#method_refresh) for more info.
@event refresh
@param {Object} event
*/
/**
Dispatched when selection of files in the dialog is complete.
@event change
@param {Object} event
*/
'change',
'cancel', // TODO: might be useful
/**
Dispatched when mouse cursor enters file-picker area. Can be used to style element
accordingly.
@event mouseenter
@param {Object} event
*/
'mouseenter',
/**
Dispatched when mouse cursor leaves file-picker area. Can be used to style element
accordingly.
@event mouseleave
@param {Object} event
*/
'mouseleave',
/**
Dispatched when functional mouse button is pressed on top of file-picker area.
@event mousedown
@param {Object} event
*/
'mousedown',
/**
Dispatched when functional mouse button is released on top of file-picker area.
@event mouseup
@param {Object} event
*/
'mouseup'
];
function FileInput(options) {
var self = this,
container, browseButton, defaults;
// if flat argument passed it should be browse_button id
if (Basic.inArray(Basic.typeOf(options), ['string', 'node']) !== -1) {
options = { browse_button : options };
}
// this will help us to find proper default container
browseButton = Dom.get(options.browse_button);
if (!browseButton) {
// browse button is required
throw new x.DOMException(x.DOMException.NOT_FOUND_ERR);
}
// figure out the options
defaults = {
accept: [{
title: I18n.translate('All Files'),
extensions: '*'
}],
name: 'file',
multiple: false,
required_caps: false,
container: browseButton.parentNode || document.body
};
options = Basic.extend({}, defaults, options);
// convert to object representation
if (typeof(options.required_caps) === 'string') {
options.required_caps = Runtime.parseCaps(options.required_caps);
}
// normalize accept option (could be list of mime types or array of title/extensions pairs)
if (typeof(options.accept) === 'string') {
options.accept = Mime.mimes2extList(options.accept);
}
container = Dom.get(options.container);
// make sure we have container
if (!container) {
container = document.body;
}
// make container relative, if it's not
if (Dom.getStyle(container, 'position') === 'static') {
container.style.position = 'relative';
}
container = browseButton = null; // IE
RuntimeClient.call(self);
Basic.extend(self, {
/**
Unique id of the component
@property uid
@protected
@readOnly
@type {String}
@default UID
*/
uid: Basic.guid('uid_'),
/**
Unique id of the connected runtime, if any.
@property ruid
@protected
@type {String}
*/
ruid: null,
/**
Unique id of the runtime container. Useful to get hold of it for various manipulations.
@property shimid
@protected
@type {String}
*/
shimid: null,
/**
Array of selected mOxie.File objects
@property files
@type {Array}
@default null
*/
files: null,
/**
Initializes the file-picker, connects it to runtime and dispatches event ready when done.
@method init
*/
init: function() {
self.convertEventPropsToHandlers(dispatches);
self.bind('RuntimeInit', function(e, runtime) {
self.ruid = runtime.uid;
self.shimid = runtime.shimid;
self.bind("Ready", function() {
self.trigger("Refresh");
}, 999);
self.bind("Change", function() {
var files = runtime.exec.call(self, 'FileInput', 'getFiles');
self.files = [];
Basic.each(files, function(file) {
// ignore empty files (IE10 for example hangs if you try to send them via XHR)
if (file.size === 0) {
return true;
}
self.files.push(new File(self.ruid, file));
});
}, 999);
// re-position and resize shim container
self.bind('Refresh', function() {
var pos, size, browseButton, shimContainer;
browseButton = Dom.get(options.browse_button);
shimContainer = Dom.get(runtime.shimid); // do not use runtime.getShimContainer(), since it will create container if it doesn't exist
if (browseButton) {
pos = Dom.getPos(browseButton, Dom.get(options.container));
size = Dom.getSize(browseButton);
if (shimContainer) {
Basic.extend(shimContainer.style, {
top : pos.y + 'px',
left : pos.x + 'px',
width : size.w + 'px',
height : size.h + 'px'
});
}
}
shimContainer = browseButton = null;
});
runtime.exec.call(self, 'FileInput', 'init', options);
});
// runtime needs: options.required_features, options.runtime_order and options.container
self.connectRuntime(Basic.extend({}, options, {
required_caps: {
select_file: true
}
}));
},
/**
Disables file-picker element, so that it doesn't react to mouse clicks.
@method disable
@param {Boolean} [state=true] Disable component if - true, enable if - false
*/
disable: function(state) {
var runtime = this.getRuntime();
if (runtime) {
runtime.exec.call(this, 'FileInput', 'disable', Basic.typeOf(state) === 'undefined' ? true : state);
}
},
/**
Reposition and resize dialog trigger to match the position and size of browse_button element.
@method refresh
*/
refresh: function() {
self.trigger("Refresh");
},
/**
Destroy component.
@method destroy
*/
destroy: function() {
var runtime = this.getRuntime();
if (runtime) {
runtime.exec.call(this, 'FileInput', 'destroy');
this.disconnectRuntime();
}
if (Basic.typeOf(this.files) === 'array') {
// no sense in leaving associated files behind
Basic.each(this.files, function(file) {
file.destroy();
});
}
this.files = null;
}
});
}
FileInput.prototype = EventTarget.instance;
return FileInput;
});
// Included from: src/javascript/runtime/RuntimeTarget.js
/**
* RuntimeTarget.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define('moxie/runtime/RuntimeTarget', [
'moxie/core/utils/Basic',
'moxie/runtime/RuntimeClient',
"moxie/core/EventTarget"
], function(Basic, RuntimeClient, EventTarget) {
/**
Instance of this class can be used as a target for the events dispatched by shims,
when allowing them onto components is for either reason inappropriate
@class RuntimeTarget
@constructor
@protected
@extends EventTarget
*/
function RuntimeTarget() {
this.uid = Basic.guid('uid_');
RuntimeClient.call(this);
this.destroy = function() {
this.disconnectRuntime();
this.unbindAll();
};
}
RuntimeTarget.prototype = EventTarget.instance;
return RuntimeTarget;
});
// Included from: src/javascript/file/FileReader.js
/**
* FileReader.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define('moxie/file/FileReader', [
'moxie/core/utils/Basic',
'moxie/core/utils/Encode',
'moxie/core/Exceptions',
'moxie/core/EventTarget',
'moxie/file/Blob',
'moxie/file/File',
'moxie/runtime/RuntimeTarget'
], function(Basic, Encode, x, EventTarget, Blob, File, RuntimeTarget) {
/**
Utility for preloading o.Blob/o.File objects in memory. By design closely follows [W3C FileReader](http://www.w3.org/TR/FileAPI/#dfn-filereader)
interface. Where possible uses native FileReader, where - not falls back to shims.
@class FileReader
@constructor FileReader
@extends EventTarget
@uses RuntimeClient
*/
var dispatches = [
/**
Dispatched when the read starts.
@event loadstart
@param {Object} event
*/
'loadstart',
/**
Dispatched while reading (and decoding) blob, and reporting partial Blob data (progess.loaded/progress.total).
@event progress
@param {Object} event
*/
'progress',
/**
Dispatched when the read has successfully completed.
@event load
@param {Object} event
*/
'load',
/**
Dispatched when the read has been aborted. For instance, by invoking the abort() method.
@event abort
@param {Object} event
*/
'abort',
/**
Dispatched when the read has failed.
@event error
@param {Object} event
*/
'error',
/**
Dispatched when the request has completed (either in success or failure).
@event loadend
@param {Object} event
*/
'loadend'
];
function FileReader() {
var self = this, _fr;
Basic.extend(this, {
/**
UID of the component instance.
@property uid
@type {String}
*/
uid: Basic.guid('uid_'),
/**
Contains current state of FileReader object. Can take values of FileReader.EMPTY, FileReader.LOADING
and FileReader.DONE.
@property readyState
@type {Number}
@default FileReader.EMPTY
*/
readyState: FileReader.EMPTY,
/**
Result of the successful read operation.
@property result
@type {String}
*/
result: null,
/**
Stores the error of failed asynchronous read operation.
@property error
@type {DOMError}
*/
error: null,
/**
Initiates reading of File/Blob object contents to binary string.
@method readAsBinaryString
@param {Blob|File} blob Object to preload
*/
readAsBinaryString: function(blob) {
_read.call(this, 'readAsBinaryString', blob);
},
/**
Initiates reading of File/Blob object contents to dataURL string.
@method readAsDataURL
@param {Blob|File} blob Object to preload
*/
readAsDataURL: function(blob) {
_read.call(this, 'readAsDataURL', blob);
},
/**
Initiates reading of File/Blob object contents to string.
@method readAsText
@param {Blob|File} blob Object to preload
*/
readAsText: function(blob) {
_read.call(this, 'readAsText', blob);
},
/**
Aborts preloading process.
@method abort
*/
abort: function() {
this.result = null;
if (Basic.inArray(this.readyState, [FileReader.EMPTY, FileReader.DONE]) !== -1) {
return;
} else if (this.readyState === FileReader.LOADING) {
this.readyState = FileReader.DONE;
}
if (_fr) {
_fr.getRuntime().exec.call(this, 'FileReader', 'abort');
}
this.trigger('abort');
this.trigger('loadend');
},
/**
Destroy component and release resources.
@method destroy
*/
destroy: function() {
this.abort();
if (_fr) {
_fr.getRuntime().exec.call(this, 'FileReader', 'destroy');
_fr.disconnectRuntime();
}
self = _fr = null;
}
});
function _read(op, blob) {
_fr = new RuntimeTarget();
function error(err) {
self.readyState = FileReader.DONE;
self.error = err;
self.trigger('error');
loadEnd();
}
function loadEnd() {
_fr.destroy();
_fr = null;
self.trigger('loadend');
}
function exec(runtime) {
_fr.bind('Error', function(e, err) {
error(err);
});
_fr.bind('Progress', function(e) {
self.result = runtime.exec.call(_fr, 'FileReader', 'getResult');
self.trigger(e);
});
_fr.bind('Load', function(e) {
self.readyState = FileReader.DONE;
self.result = runtime.exec.call(_fr, 'FileReader', 'getResult');
self.trigger(e);
loadEnd();
});
runtime.exec.call(_fr, 'FileReader', 'read', op, blob);
}
this.convertEventPropsToHandlers(dispatches);
if (this.readyState === FileReader.LOADING) {
return error(new x.DOMException(x.DOMException.INVALID_STATE_ERR));
}
this.readyState = FileReader.LOADING;
this.trigger('loadstart');
// if source is o.Blob/o.File
if (blob instanceof Blob) {
if (blob.isDetached()) {
var src = blob.getSource();
switch (op) {
case 'readAsText':
case 'readAsBinaryString':
this.result = src;
break;
case 'readAsDataURL':
this.result = 'data:' + blob.type + ';base64,' + Encode.btoa(src);
break;
}
this.readyState = FileReader.DONE;
this.trigger('load');
loadEnd();
} else {
exec(_fr.connectRuntime(blob.ruid));
}
} else {
error(new x.DOMException(x.DOMException.NOT_FOUND_ERR));
}
}
}
/**
Initial FileReader state
@property EMPTY
@type {Number}
@final
@static
@default 0
*/
FileReader.EMPTY = 0;
/**
FileReader switches to this state when it is preloading the source
@property LOADING
@type {Number}
@final
@static
@default 1
*/
FileReader.LOADING = 1;
/**
Preloading is complete, this is a final state
@property DONE
@type {Number}
@final
@static
@default 2
*/
FileReader.DONE = 2;
FileReader.prototype = EventTarget.instance;
return FileReader;
});
// Included from: src/javascript/core/utils/Url.js
/**
* Url.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define('moxie/core/utils/Url', [], function() {
/**
Parse url into separate components and fill in absent parts with parts from current url,
based on https://raw.github.com/kvz/phpjs/master/functions/url/parse_url.js
@method parseUrl
@for Utils
@static
@param {String} url Url to parse (defaults to empty string if undefined)
@return {Object} Hash containing extracted uri components
*/
var parseUrl = function(url, currentUrl) {
var key = ['source', 'scheme', 'authority', 'userInfo', 'user', 'pass', 'host', 'port', 'relative', 'path', 'directory', 'file', 'query', 'fragment']
, i = key.length
, ports = {
http: 80,
https: 443
}
, uri = {}
, regex = /^(?:([^:\/?#]+):)?(?:\/\/()(?:(?:()(?:([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?))?()(?:(()(?:(?:[^?#\/]*\/)*)()(?:[^?#]*))(?:\\?([^#]*))?(?:#(.*))?)/
, m = regex.exec(url || '')
;
while (i--) {
if (m[i]) {
uri[key[i]] = m[i];
}
}
// when url is relative, we set the origin and the path ourselves
if (!uri.scheme) {
// come up with defaults
if (!currentUrl || typeof(currentUrl) === 'string') {
currentUrl = parseUrl(currentUrl || document.location.href);
}
uri.scheme = currentUrl.scheme;
uri.host = currentUrl.host;
uri.port = currentUrl.port;
var path = '';
// for urls without trailing slash we need to figure out the path
if (/^[^\/]/.test(uri.path)) {
path = currentUrl.path;
// if path ends with a filename, strip it
if (!/(\/|\/[^\.]+)$/.test(path)) {
path = path.replace(/\/[^\/]+$/, '/');
} else {
path += '/';
}
}
uri.path = path + (uri.path || ''); // site may reside at domain.com or domain.com/subdir
}
if (!uri.port) {
uri.port = ports[uri.scheme] || 80;
}
uri.port = parseInt(uri.port, 10);
if (!uri.path) {
uri.path = "/";
}
delete uri.source;
return uri;
};
/**
Resolve url - among other things will turn relative url to absolute
@method resolveUrl
@static
@param {String} url Either absolute or relative
@return {String} Resolved, absolute url
*/
var resolveUrl = function(url) {
var ports = { // we ignore default ports
http: 80,
https: 443
}
, urlp = parseUrl(url)
;
return urlp.scheme + '://' + urlp.host + (urlp.port !== ports[urlp.scheme] ? ':' + urlp.port : '') + urlp.path + (urlp.query ? urlp.query : '');
};
/**
Check if specified url has the same origin as the current document
@method hasSameOrigin
@param {String|Object} url
@return {Boolean}
*/
var hasSameOrigin = function(url) {
function origin(url) {
return [url.scheme, url.host, url.port].join('/');
}
if (typeof url === 'string') {
url = parseUrl(url);
}
return origin(parseUrl()) === origin(url);
};
return {
parseUrl: parseUrl,
resolveUrl: resolveUrl,
hasSameOrigin: hasSameOrigin
};
});
// Included from: src/javascript/file/FileReaderSync.js
/**
* FileReaderSync.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define('moxie/file/FileReaderSync', [
'moxie/core/utils/Basic',
'moxie/runtime/RuntimeClient',
'moxie/core/utils/Encode'
], function(Basic, RuntimeClient, Encode) {
/**
Synchronous FileReader implementation. Something like this is available in WebWorkers environment, here
it can be used to read only preloaded blobs/files and only below certain size (not yet sure what that'd be,
but probably < 1mb). Not meant to be used directly by user.
@class FileReaderSync
@private
@constructor
*/
return function() {
RuntimeClient.call(this);
Basic.extend(this, {
uid: Basic.guid('uid_'),
readAsBinaryString: function(blob) {
return _read.call(this, 'readAsBinaryString', blob);
},
readAsDataURL: function(blob) {
return _read.call(this, 'readAsDataURL', blob);
},
/*readAsArrayBuffer: function(blob) {
return _read.call(this, 'readAsArrayBuffer', blob);
},*/
readAsText: function(blob) {
return _read.call(this, 'readAsText', blob);
}
});
function _read(op, blob) {
if (blob.isDetached()) {
var src = blob.getSource();
switch (op) {
case 'readAsBinaryString':
return src;
case 'readAsDataURL':
return 'data:' + blob.type + ';base64,' + Encode.btoa(src);
case 'readAsText':
var txt = '';
for (var i = 0, length = src.length; i < length; i++) {
txt += String.fromCharCode(src[i]);
}
return txt;
}
} else {
var result = this.connectRuntime(blob.ruid).exec.call(this, 'FileReaderSync', 'read', op, blob);
this.disconnectRuntime();
return result;
}
}
};
});
// Included from: src/javascript/xhr/FormData.js
/**
* FormData.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define("moxie/xhr/FormData", [
"moxie/core/Exceptions",
"moxie/core/utils/Basic",
"moxie/file/Blob"
], function(x, Basic, Blob) {
/**
FormData
@class FormData
@constructor
*/
function FormData() {
var _blob, _fields = [];
Basic.extend(this, {
/**
Append another key-value pair to the FormData object
@method append
@param {String} name Name for the new field
@param {String|Blob|Array|Object} value Value for the field
*/
append: function(name, value) {
var self = this, valueType = Basic.typeOf(value);
// according to specs value might be either Blob or String
if (value instanceof Blob) {
_blob = {
name: name,
value: value // unfortunately we can only send single Blob in one FormData
};
} else if ('array' === valueType) {
name += '[]';
Basic.each(value, function(value) {
self.append(name, value);
});
} else if ('object' === valueType) {
Basic.each(value, function(value, key) {
self.append(name + '[' + key + ']', value);
});
} else if ('null' === valueType || 'undefined' === valueType || 'number' === valueType && isNaN(value)) {
self.append(name, "false");
} else {
_fields.push({
name: name,
value: value.toString()
});
}
},
/**
Checks if FormData contains Blob.
@method hasBlob
@return {Boolean}
*/
hasBlob: function() {
return !!this.getBlob();
},
/**
Retrieves blob.
@method getBlob
@return {Object} Either Blob if found or null
*/
getBlob: function() {
return _blob && _blob.value || null;
},
/**
Retrieves blob field name.
@method getBlobName
@return {String} Either Blob field name or null
*/
getBlobName: function() {
return _blob && _blob.name || null;
},
/**
Loop over the fields in FormData and invoke the callback for each of them.
@method each
@param {Function} cb Callback to call for each field
*/
each: function(cb) {
Basic.each(_fields, function(field) {
cb(field.value, field.name);
});
if (_blob) {
cb(_blob.value, _blob.name);
}
},
destroy: function() {
_blob = null;
_fields = [];
}
});
}
return FormData;
});
// Included from: src/javascript/xhr/XMLHttpRequest.js
/**
* XMLHttpRequest.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define("moxie/xhr/XMLHttpRequest", [
"moxie/core/utils/Basic",
"moxie/core/Exceptions",
"moxie/core/EventTarget",
"moxie/core/utils/Encode",
"moxie/core/utils/Url",
"moxie/runtime/Runtime",
"moxie/runtime/RuntimeTarget",
"moxie/file/Blob",
"moxie/file/FileReaderSync",
"moxie/xhr/FormData",
"moxie/core/utils/Env",
"moxie/core/utils/Mime"
], function(Basic, x, EventTarget, Encode, Url, Runtime, RuntimeTarget, Blob, FileReaderSync, FormData, Env, Mime) {
var httpCode = {
100: 'Continue',
101: 'Switching Protocols',
102: 'Processing',
200: 'OK',
201: 'Created',
202: 'Accepted',
203: 'Non-Authoritative Information',
204: 'No Content',
205: 'Reset Content',
206: 'Partial Content',
207: 'Multi-Status',
226: 'IM Used',
300: 'Multiple Choices',
301: 'Moved Permanently',
302: 'Found',
303: 'See Other',
304: 'Not Modified',
305: 'Use Proxy',
306: 'Reserved',
307: 'Temporary Redirect',
400: 'Bad Request',
401: 'Unauthorized',
402: 'Payment Required',
403: 'Forbidden',
404: 'Not Found',
405: 'Method Not Allowed',
406: 'Not Acceptable',
407: 'Proxy Authentication Required',
408: 'Request Timeout',
409: 'Conflict',
410: 'Gone',
411: 'Length Required',
412: 'Precondition Failed',
413: 'Request Entity Too Large',
414: 'Request-URI Too Long',
415: 'Unsupported Media Type',
416: 'Requested Range Not Satisfiable',
417: 'Expectation Failed',
422: 'Unprocessable Entity',
423: 'Locked',
424: 'Failed Dependency',
426: 'Upgrade Required',
500: 'Internal Server Error',
501: 'Not Implemented',
502: 'Bad Gateway',
503: 'Service Unavailable',
504: 'Gateway Timeout',
505: 'HTTP Version Not Supported',
506: 'Variant Also Negotiates',
507: 'Insufficient Storage',
510: 'Not Extended'
};
function XMLHttpRequestUpload() {
this.uid = Basic.guid('uid_');
}
XMLHttpRequestUpload.prototype = EventTarget.instance;
/**
Implementation of XMLHttpRequest
@class XMLHttpRequest
@constructor
@uses RuntimeClient
@extends EventTarget
*/
var dispatches = ['loadstart', 'progress', 'abort', 'error', 'load', 'timeout', 'loadend']; // & readystatechange (for historical reasons)
var NATIVE = 1, RUNTIME = 2;
function XMLHttpRequest() {
var self = this,
// this (together with _p() @see below) is here to gracefully upgrade to setter/getter syntax where possible
props = {
/**
The amount of milliseconds a request can take before being terminated. Initially zero. Zero means there is no timeout.
@property timeout
@type Number
@default 0
*/
timeout: 0,
/**
Current state, can take following values:
UNSENT (numeric value 0)
The object has been constructed.
OPENED (numeric value 1)
The open() method has been successfully invoked. During this state request headers can be set using setRequestHeader() and the request can be made using the send() method.
HEADERS_RECEIVED (numeric value 2)
All redirects (if any) have been followed and all HTTP headers of the final response have been received. Several response members of the object are now available.
LOADING (numeric value 3)
The response entity body is being received.
DONE (numeric value 4)
@property readyState
@type Number
@default 0 (UNSENT)
*/
readyState: XMLHttpRequest.UNSENT,
/**
True when user credentials are to be included in a cross-origin request. False when they are to be excluded
in a cross-origin request and when cookies are to be ignored in its response. Initially false.
@property withCredentials
@type Boolean
@default false
*/
withCredentials: false,
/**
Returns the HTTP status code.
@property status
@type Number
@default 0
*/
status: 0,
/**
Returns the HTTP status text.
@property statusText
@type String
*/
statusText: "",
/**
Returns the response type. Can be set to change the response type. Values are:
the empty string (default), "arraybuffer", "blob", "document", "json", and "text".
@property responseType
@type String
*/
responseType: "",
/**
Returns the document response entity body.
Throws an "InvalidStateError" exception if responseType is not the empty string or "document".
@property responseXML
@type Document
*/
responseXML: null,
/**
Returns the text response entity body.
Throws an "InvalidStateError" exception if responseType is not the empty string or "text".
@property responseText
@type String
*/
responseText: null,
/**
Returns the response entity body (http://www.w3.org/TR/XMLHttpRequest/#response-entity-body).
Can become: ArrayBuffer, Blob, Document, JSON, Text
@property response
@type Mixed
*/
response: null
},
_async = true,
_url,
_method,
_headers = {},
_user,
_password,
_encoding = null,
_mimeType = null,
// flags
_sync_flag = false,
_send_flag = false,
_upload_events_flag = false,
_upload_complete_flag = false,
_error_flag = false,
_same_origin_flag = false,
// times
_start_time,
_timeoutset_time,
_finalMime = null,
_finalCharset = null,
_options = {},
_xhr,
_responseHeaders = '',
_responseHeadersBag
;
Basic.extend(this, props, {
/**
Unique id of the component
@property uid
@type String
*/
uid: Basic.guid('uid_'),
/**
Target for Upload events
@property upload
@type XMLHttpRequestUpload
*/
upload: new XMLHttpRequestUpload(),
/**
Sets the request method, request URL, synchronous flag, request username, and request password.
Throws a "SyntaxError" exception if one of the following is true:
method is not a valid HTTP method.
url cannot be resolved.
url contains the "user:password" format in the userinfo production.
Throws a "SecurityError" exception if method is a case-insensitive match for CONNECT, TRACE or TRACK.
Throws an "InvalidAccessError" exception if one of the following is true:
Either user or password is passed as argument and the origin of url does not match the XMLHttpRequest origin.
There is an associated XMLHttpRequest document and either the timeout attribute is not zero,
the withCredentials attribute is true, or the responseType attribute is not the empty string.
@method open
@param {String} method HTTP method to use on request
@param {String} url URL to request
@param {Boolean} [async=true] If false request will be done in synchronous manner. Asynchronous by default.
@param {String} [user] Username to use in HTTP authentication process on server-side
@param {String} [password] Password to use in HTTP authentication process on server-side
*/
open: function(method, url, async, user, password) {
var urlp;
// first two arguments are required
if (!method || !url) {
throw new x.DOMException(x.DOMException.SYNTAX_ERR);
}
// 2 - check if any code point in method is higher than U+00FF or after deflating method it does not match the method
if (/[\u0100-\uffff]/.test(method) || Encode.utf8_encode(method) !== method) {
throw new x.DOMException(x.DOMException.SYNTAX_ERR);
}
// 3
if (!!~Basic.inArray(method.toUpperCase(), ['CONNECT', 'DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT', 'TRACE', 'TRACK'])) {
_method = method.toUpperCase();
}
// 4 - allowing these methods poses a security risk
if (!!~Basic.inArray(_method, ['CONNECT', 'TRACE', 'TRACK'])) {
throw new x.DOMException(x.DOMException.SECURITY_ERR);
}
// 5
url = Encode.utf8_encode(url);
// 6 - Resolve url relative to the XMLHttpRequest base URL. If the algorithm returns an error, throw a "SyntaxError".
urlp = Url.parseUrl(url);
_same_origin_flag = Url.hasSameOrigin(urlp);
// 7 - manually build up absolute url
_url = Url.resolveUrl(url);
// 9-10, 12-13
if ((user || password) && !_same_origin_flag) {
throw new x.DOMException(x.DOMException.INVALID_ACCESS_ERR);
}
_user = user || urlp.user;
_password = password || urlp.pass;
// 11
_async = async || true;
if (_async === false && (_p('timeout') || _p('withCredentials') || _p('responseType') !== "")) {
throw new x.DOMException(x.DOMException.INVALID_ACCESS_ERR);
}
// 14 - terminate abort()
// 15 - terminate send()
// 18
_sync_flag = !_async;
_send_flag = false;
_headers = {};
_reset.call(this);
// 19
_p('readyState', XMLHttpRequest.OPENED);
// 20
this.convertEventPropsToHandlers(['readystatechange']); // unify event handlers
this.dispatchEvent('readystatechange');
},
/**
Appends an header to the list of author request headers, or if header is already
in the list of author request headers, combines its value with value.
Throws an "InvalidStateError" exception if the state is not OPENED or if the send() flag is set.
Throws a "SyntaxError" exception if header is not a valid HTTP header field name or if value
is not a valid HTTP header field value.
@method setRequestHeader
@param {String} header
@param {String|Number} value
*/
setRequestHeader: function(header, value) {
var uaHeaders = [ // these headers are controlled by the user agent
"accept-charset",
"accept-encoding",
"access-control-request-headers",
"access-control-request-method",
"connection",
"content-length",
"cookie",
"cookie2",
"content-transfer-encoding",
"date",
"expect",
"host",
"keep-alive",
"origin",
"referer",
"te",
"trailer",
"transfer-encoding",
"upgrade",
"user-agent",
"via"
];
// 1-2
if (_p('readyState') !== XMLHttpRequest.OPENED || _send_flag) {
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
}
// 3
if (/[\u0100-\uffff]/.test(header) || Encode.utf8_encode(header) !== header) {
throw new x.DOMException(x.DOMException.SYNTAX_ERR);
}
// 4
/* this step is seemingly bypassed in browsers, probably to allow various unicode characters in header values
if (/[\u0100-\uffff]/.test(value) || Encode.utf8_encode(value) !== value) {
throw new x.DOMException(x.DOMException.SYNTAX_ERR);
}*/
header = Basic.trim(header).toLowerCase();
// setting of proxy-* and sec-* headers is prohibited by spec
if (!!~Basic.inArray(header, uaHeaders) || /^(proxy\-|sec\-)/.test(header)) {
return false;
}
// camelize
// browsers lowercase header names (at least for custom ones)
// header = header.replace(/\b\w/g, function($1) { return $1.toUpperCase(); });
if (!_headers[header]) {
_headers[header] = value;
} else {
// http://tools.ietf.org/html/rfc2616#section-4.2 (last paragraph)
_headers[header] += ', ' + value;
}
return true;
},
/**
Returns all headers from the response, with the exception of those whose field name is Set-Cookie or Set-Cookie2.
@method getAllResponseHeaders
@return {String} reponse headers or empty string
*/
getAllResponseHeaders: function() {
return _responseHeaders || '';
},
/**
Returns the header field value from the response of which the field name matches header,
unless the field name is Set-Cookie or Set-Cookie2.
@method getResponseHeader
@param {String} header
@return {String} value(s) for the specified header or null
*/
getResponseHeader: function(header) {
header = header.toLowerCase();
if (_error_flag || !!~Basic.inArray(header, ['set-cookie', 'set-cookie2'])) {
return null;
}
if (_responseHeaders && _responseHeaders !== '') {
// if we didn't parse response headers until now, do it and keep for later
if (!_responseHeadersBag) {
_responseHeadersBag = {};
Basic.each(_responseHeaders.split(/\r\n/), function(line) {
var pair = line.split(/:\s+/);
if (pair.length === 2) { // last line might be empty, omit
pair[0] = Basic.trim(pair[0]); // just in case
_responseHeadersBag[pair[0].toLowerCase()] = { // simply to retain header name in original form
header: pair[0],
value: Basic.trim(pair[1])
};
}
});
}
if (_responseHeadersBag.hasOwnProperty(header)) {
return _responseHeadersBag[header].header + ': ' + _responseHeadersBag[header].value;
}
}
return null;
},
/**
Sets the Content-Type header for the response to mime.
Throws an "InvalidStateError" exception if the state is LOADING or DONE.
Throws a "SyntaxError" exception if mime is not a valid media type.
@method overrideMimeType
@param String mime Mime type to set
*/
overrideMimeType: function(mime) {
var matches, charset;
// 1
if (!!~Basic.inArray(_p('readyState'), [XMLHttpRequest.LOADING, XMLHttpRequest.DONE])) {
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
}
// 2
mime = Basic.trim(mime.toLowerCase());
if (/;/.test(mime) && (matches = mime.match(/^([^;]+)(?:;\scharset\=)?(.*)$/))) {
mime = matches[1];
if (matches[2]) {
charset = matches[2];
}
}
if (!Mime.mimes[mime]) {
throw new x.DOMException(x.DOMException.SYNTAX_ERR);
}
// 3-4
_finalMime = mime;
_finalCharset = charset;
},
/**
Initiates the request. The optional argument provides the request entity body.
The argument is ignored if request method is GET or HEAD.
Throws an "InvalidStateError" exception if the state is not OPENED or if the send() flag is set.
@method send
@param {Blob|Document|String|FormData} [data] Request entity body
@param {Object} [options] Set of requirements and pre-requisities for runtime initialization
*/
send: function(data, options) {
if (Basic.typeOf(options) === 'string') {
_options = { ruid: options };
} else if (!options) {
_options = {};
} else {
_options = options;
}
this.convertEventPropsToHandlers(dispatches);
this.upload.convertEventPropsToHandlers(dispatches);
// 1-2
if (this.readyState !== XMLHttpRequest.OPENED || _send_flag) {
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
}
// 3
// sending Blob
if (data instanceof Blob) {
_options.ruid = data.ruid;
_mimeType = data.type || 'application/octet-stream';
}
// FormData
else if (data instanceof FormData) {
if (data.hasBlob()) {
var blob = data.getBlob();
_options.ruid = blob.ruid;
_mimeType = blob.type || 'application/octet-stream';
}
}
// DOMString
else if (typeof data === 'string') {
_encoding = 'UTF-8';
_mimeType = 'text/plain;charset=UTF-8';
// data should be converted to Unicode and encoded as UTF-8
data = Encode.utf8_encode(data);
}
// if withCredentials not set, but requested, set it automatically
if (!this.withCredentials) {
this.withCredentials = (_options.required_caps && _options.required_caps.send_browser_cookies) && !_same_origin_flag;
}
// 4 - storage mutex
// 5
_upload_events_flag = (!_sync_flag && this.upload.hasEventListener()); // DSAP
// 6
_error_flag = false;
// 7
_upload_complete_flag = !data;
// 8 - Asynchronous steps
if (!_sync_flag) {
// 8.1
_send_flag = true;
// 8.2
// this.dispatchEvent('loadstart'); // will be dispatched either by native or runtime xhr
// 8.3
//if (!_upload_complete_flag) {
// this.upload.dispatchEvent('loadstart'); // will be dispatched either by native or runtime xhr
//}
}
// 8.5 - Return the send() method call, but continue running the steps in this algorithm.
_doXHR.call(this, data);
},
/**
Cancels any network activity.
@method abort
*/
abort: function() {
_error_flag = true;
_sync_flag = false;
if (!~Basic.inArray(_p('readyState'), [XMLHttpRequest.UNSENT, XMLHttpRequest.OPENED, XMLHttpRequest.DONE])) {
_p('readyState', XMLHttpRequest.DONE);
_send_flag = false;
if (_xhr) {
_xhr.getRuntime().exec.call(_xhr, 'XMLHttpRequest', 'abort', _upload_complete_flag);
} else {
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
}
_upload_complete_flag = true;
} else {
_p('readyState', XMLHttpRequest.UNSENT);
}
},
destroy: function() {
if (_xhr) {
if (Basic.typeOf(_xhr.destroy) === 'function') {
_xhr.destroy();
}
_xhr = null;
}
this.unbindAll();
if (this.upload) {
this.upload.unbindAll();
this.upload = null;
}
}
});
/* this is nice, but maybe too lengthy
// if supported by JS version, set getters/setters for specific properties
o.defineProperty(this, 'readyState', {
configurable: false,
get: function() {
return _p('readyState');
}
});
o.defineProperty(this, 'timeout', {
configurable: false,
get: function() {
return _p('timeout');
},
set: function(value) {
if (_sync_flag) {
throw new x.DOMException(x.DOMException.INVALID_ACCESS_ERR);
}
// timeout still should be measured relative to the start time of request
_timeoutset_time = (new Date).getTime();
_p('timeout', value);
}
});
// the withCredentials attribute has no effect when fetching same-origin resources
o.defineProperty(this, 'withCredentials', {
configurable: false,
get: function() {
return _p('withCredentials');
},
set: function(value) {
// 1-2
if (!~o.inArray(_p('readyState'), [XMLHttpRequest.UNSENT, XMLHttpRequest.OPENED]) || _send_flag) {
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
}
// 3-4
if (_anonymous_flag || _sync_flag) {
throw new x.DOMException(x.DOMException.INVALID_ACCESS_ERR);
}
// 5
_p('withCredentials', value);
}
});
o.defineProperty(this, 'status', {
configurable: false,
get: function() {
return _p('status');
}
});
o.defineProperty(this, 'statusText', {
configurable: false,
get: function() {
return _p('statusText');
}
});
o.defineProperty(this, 'responseType', {
configurable: false,
get: function() {
return _p('responseType');
},
set: function(value) {
// 1
if (!!~o.inArray(_p('readyState'), [XMLHttpRequest.LOADING, XMLHttpRequest.DONE])) {
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
}
// 2
if (_sync_flag) {
throw new x.DOMException(x.DOMException.INVALID_ACCESS_ERR);
}
// 3
_p('responseType', value.toLowerCase());
}
});
o.defineProperty(this, 'responseText', {
configurable: false,
get: function() {
// 1
if (!~o.inArray(_p('responseType'), ['', 'text'])) {
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
}
// 2-3
if (_p('readyState') !== XMLHttpRequest.DONE && _p('readyState') !== XMLHttpRequest.LOADING || _error_flag) {
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
}
return _p('responseText');
}
});
o.defineProperty(this, 'responseXML', {
configurable: false,
get: function() {
// 1
if (!~o.inArray(_p('responseType'), ['', 'document'])) {
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
}
// 2-3
if (_p('readyState') !== XMLHttpRequest.DONE || _error_flag) {
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
}
return _p('responseXML');
}
});
o.defineProperty(this, 'response', {
configurable: false,
get: function() {
if (!!~o.inArray(_p('responseType'), ['', 'text'])) {
if (_p('readyState') !== XMLHttpRequest.DONE && _p('readyState') !== XMLHttpRequest.LOADING || _error_flag) {
return '';
}
}
if (_p('readyState') !== XMLHttpRequest.DONE || _error_flag) {
return null;
}
return _p('response');
}
});
*/
function _p(prop, value) {
if (!props.hasOwnProperty(prop)) {
return;
}
if (arguments.length === 1) { // get
return Env.can('define_property') ? props[prop] : self[prop];
} else { // set
if (Env.can('define_property')) {
props[prop] = value;
} else {
self[prop] = value;
}
}
}
/*
function _toASCII(str, AllowUnassigned, UseSTD3ASCIIRules) {
// TODO: http://tools.ietf.org/html/rfc3490#section-4.1
return str.toLowerCase();
}
*/
function _doXHR(data) {
var self = this;
_start_time = new Date().getTime();
_xhr = new RuntimeTarget();
function loadEnd() {
if (_xhr) { // it could have been destroyed by now
_xhr.destroy();
_xhr = null;
}
self.dispatchEvent('loadend');
self = null;
}
function exec(runtime) {
_xhr.bind('LoadStart', function(e) {
_p('readyState', XMLHttpRequest.LOADING);
self.dispatchEvent('readystatechange');
self.dispatchEvent(e);
if (_upload_events_flag) {
self.upload.dispatchEvent(e);
}
});
_xhr.bind('Progress', function(e) {
if (_p('readyState') !== XMLHttpRequest.LOADING) {
_p('readyState', XMLHttpRequest.LOADING); // LoadStart unreliable (in Flash for example)
self.dispatchEvent('readystatechange');
}
self.dispatchEvent(e);
});
_xhr.bind('UploadProgress', function(e) {
if (_upload_events_flag) {
self.upload.dispatchEvent({
type: 'progress',
lengthComputable: false,
total: e.total,
loaded: e.loaded
});
}
});
_xhr.bind('Load', function(e) {
_p('readyState', XMLHttpRequest.DONE);
_p('status', Number(runtime.exec.call(_xhr, 'XMLHttpRequest', 'getStatus') || 0));
_p('statusText', httpCode[_p('status')] || "");
_p('response', runtime.exec.call(_xhr, 'XMLHttpRequest', 'getResponse', _p('responseType')));
if (!!~Basic.inArray(_p('responseType'), ['text', ''])) {
_p('responseText', _p('response'));
} else if (_p('responseType') === 'document') {
_p('responseXML', _p('response'));
}
_responseHeaders = runtime.exec.call(_xhr, 'XMLHttpRequest', 'getAllResponseHeaders');
self.dispatchEvent('readystatechange');
if (_p('status') > 0) { // status 0 usually means that server is unreachable
if (_upload_events_flag) {
self.upload.dispatchEvent(e);
}
self.dispatchEvent(e);
} else {
_error_flag = true;
self.dispatchEvent('error');
}
loadEnd();
});
_xhr.bind('Abort', function(e) {
self.dispatchEvent(e);
loadEnd();
});
_xhr.bind('Error', function(e) {
_error_flag = true;
_p('readyState', XMLHttpRequest.DONE);
self.dispatchEvent('readystatechange');
_upload_complete_flag = true;
self.dispatchEvent(e);
loadEnd();
});
runtime.exec.call(_xhr, 'XMLHttpRequest', 'send', {
url: _url,
method: _method,
async: _async,
user: _user,
password: _password,
headers: _headers,
mimeType: _mimeType,
encoding: _encoding,
responseType: self.responseType,
withCredentials: self.withCredentials,
options: _options
}, data);
}
// clarify our requirements
if (typeof(_options.required_caps) === 'string') {
_options.required_caps = Runtime.parseCaps(_options.required_caps);
}
_options.required_caps = Basic.extend({}, _options.required_caps, {
return_response_type: self.responseType
});
if (data instanceof FormData) {
_options.required_caps.send_multipart = true;
}
if (!_same_origin_flag) {
_options.required_caps.do_cors = true;
}
if (_options.ruid) { // we do not need to wait if we can connect directly
exec(_xhr.connectRuntime(_options));
} else {
_xhr.bind('RuntimeInit', function(e, runtime) {
exec(runtime);
});
_xhr.bind('RuntimeError', function(e, err) {
self.dispatchEvent('RuntimeError', err);
});
_xhr.connectRuntime(_options);
}
}
function _reset() {
_p('responseText', "");
_p('responseXML', null);
_p('response', null);
_p('status', 0);
_p('statusText', "");
_start_time = _timeoutset_time = null;
}
}
XMLHttpRequest.UNSENT = 0;
XMLHttpRequest.OPENED = 1;
XMLHttpRequest.HEADERS_RECEIVED = 2;
XMLHttpRequest.LOADING = 3;
XMLHttpRequest.DONE = 4;
XMLHttpRequest.prototype = EventTarget.instance;
return XMLHttpRequest;
});
// Included from: src/javascript/runtime/Transporter.js
/**
* Transporter.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define("moxie/runtime/Transporter", [
"moxie/core/utils/Basic",
"moxie/core/utils/Encode",
"moxie/runtime/RuntimeClient",
"moxie/core/EventTarget"
], function(Basic, Encode, RuntimeClient, EventTarget) {
function Transporter() {
var mod, _runtime, _data, _size, _pos, _chunk_size;
RuntimeClient.call(this);
Basic.extend(this, {
uid: Basic.guid('uid_'),
state: Transporter.IDLE,
result: null,
transport: function(data, type, options) {
var self = this;
options = Basic.extend({
chunk_size: 204798
}, options);
// should divide by three, base64 requires this
if ((mod = options.chunk_size % 3)) {
options.chunk_size += 3 - mod;
}
_chunk_size = options.chunk_size;
_reset.call(this);
_data = data;
_size = data.length;
if (Basic.typeOf(options) === 'string' || options.ruid) {
_run.call(self, type, this.connectRuntime(options));
} else {
// we require this to run only once
var cb = function(e, runtime) {
self.unbind("RuntimeInit", cb);
_run.call(self, type, runtime);
};
this.bind("RuntimeInit", cb);
this.connectRuntime(options);
}
},
abort: function() {
var self = this;
self.state = Transporter.IDLE;
if (_runtime) {
_runtime.exec.call(self, 'Transporter', 'clear');
self.trigger("TransportingAborted");
}
_reset.call(self);
},
destroy: function() {
this.unbindAll();
_runtime = null;
this.disconnectRuntime();
_reset.call(this);
}
});
function _reset() {
_size = _pos = 0;
_data = this.result = null;
}
function _run(type, runtime) {
var self = this;
_runtime = runtime;
//self.unbind("RuntimeInit");
self.bind("TransportingProgress", function(e) {
_pos = e.loaded;
if (_pos < _size && Basic.inArray(self.state, [Transporter.IDLE, Transporter.DONE]) === -1) {
_transport.call(self);
}
}, 999);
self.bind("TransportingComplete", function() {
_pos = _size;
self.state = Transporter.DONE;
_data = null; // clean a bit
self.result = _runtime.exec.call(self, 'Transporter', 'getAsBlob', type || '');
}, 999);
self.state = Transporter.BUSY;
self.trigger("TransportingStarted");
_transport.call(self);
}
function _transport() {
var self = this,
chunk,
bytesLeft = _size - _pos;
if (_chunk_size > bytesLeft) {
_chunk_size = bytesLeft;
}
chunk = Encode.btoa(_data.substr(_pos, _chunk_size));
_runtime.exec.call(self, 'Transporter', 'receive', chunk, _size);
}
}
Transporter.IDLE = 0;
Transporter.BUSY = 1;
Transporter.DONE = 2;
Transporter.prototype = EventTarget.instance;
return Transporter;
});
// Included from: src/javascript/runtime/html5/Runtime.js
/**
* Runtime.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/*global File:true */
/**
Defines constructor for HTML5 runtime.
@class moxie/runtime/html5/Runtime
@private
*/
define("moxie/runtime/html5/Runtime", [
"moxie/core/utils/Basic",
"moxie/core/Exceptions",
"moxie/runtime/Runtime",
"moxie/core/utils/Env"
], function(Basic, x, Runtime, Env) {
var type = "html5", extensions = {};
function Html5Runtime(options) {
var I = this
, Test = Runtime.capTest
, True = Runtime.capTrue
;
var caps = Basic.extend({
access_binary: Test(window.FileReader || window.File && window.File.getAsDataURL),
access_image_binary: function() {
return I.can('access_binary') && !!extensions.Image;
},
display_media: Test(Env.can('create_canvas') || Env.can('use_data_uri_over32kb')),
do_cors: Test(window.XMLHttpRequest && 'withCredentials' in new XMLHttpRequest()),
drag_and_drop: Test(function() {
// this comes directly from Modernizr: http://www.modernizr.com/
var div = document.createElement('div');
// IE has support for drag and drop since version 5, but doesn't support dropping files from desktop
return (('draggable' in div) || ('ondragstart' in div && 'ondrop' in div)) && (Env.browser !== 'IE' || Env.version > 9);
}()),
filter_by_extension: Test(function() { // if you know how to feature-detect this, please suggest
return (Env.browser === 'Chrome' && Env.version >= 28) || (Env.browser === 'IE' && Env.version >= 10);
}()),
return_response_headers: True,
return_response_type: function(responseType) {
if (responseType === 'json' && !!window.JSON) { // we can fake this one even if it's not supported
return true;
}
return Env.can('return_response_type', responseType);
},
return_status_code: True,
report_upload_progress: Test(window.XMLHttpRequest && new XMLHttpRequest().upload),
resize_image: function() {
return I.can('access_binary') && Env.can('create_canvas');
},
select_file: function() {
return Env.can('use_fileinput') && window.File;
},
select_folder: function() {
return I.can('select_file') && Env.browser === 'Chrome' && Env.version >= 21;
},
select_multiple: function() {
// it is buggy on Safari Windows and iOS
return I.can('select_file') &&
!(Env.browser === 'Safari' && Env.os === 'Windows') &&
!(Env.os === 'iOS' && Env.verComp(Env.osVersion, "7.0.4", '<'));
},
send_binary_string: Test(window.XMLHttpRequest && (new XMLHttpRequest().sendAsBinary || (window.Uint8Array && window.ArrayBuffer))),
send_custom_headers: Test(window.XMLHttpRequest),
send_multipart: function() {
return !!(window.XMLHttpRequest && new XMLHttpRequest().upload && window.FormData) || I.can('send_binary_string');
},
slice_blob: Test(window.File && (File.prototype.mozSlice || File.prototype.webkitSlice || File.prototype.slice)),
stream_upload: function(){
return I.can('slice_blob') && I.can('send_multipart');
},
summon_file_dialog: Test(function() { // yeah... some dirty sniffing here...
return (Env.browser === 'Firefox' && Env.version >= 4) ||
(Env.browser === 'Opera' && Env.version >= 12) ||
(Env.browser === 'IE' && Env.version >= 10) ||
!!~Basic.inArray(Env.browser, ['Chrome', 'Safari']);
}()),
upload_filesize: True
},
arguments[2]
);
Runtime.call(this, options, (arguments[1] || type), caps);
Basic.extend(this, {
init : function() {
this.trigger("Init");
},
destroy: (function(destroy) { // extend default destroy method
return function() {
destroy.call(I);
destroy = I = null;
};
}(this.destroy))
});
Basic.extend(this.getShim(), extensions);
}
Runtime.addConstructor(type, Html5Runtime);
return extensions;
});
// Included from: src/javascript/runtime/html5/file/Blob.js
/**
* Blob.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/**
@class moxie/runtime/html5/file/Blob
@private
*/
define("moxie/runtime/html5/file/Blob", [
"moxie/runtime/html5/Runtime",
"moxie/file/Blob"
], function(extensions, Blob) {
function HTML5Blob() {
function w3cBlobSlice(blob, start, end) {
var blobSlice;
if (window.File.prototype.slice) {
try {
blob.slice(); // depricated version will throw WRONG_ARGUMENTS_ERR exception
return blob.slice(start, end);
} catch (e) {
// depricated slice method
return blob.slice(start, end - start);
}
// slice method got prefixed: https://bugzilla.mozilla.org/show_bug.cgi?id=649672
} else if ((blobSlice = window.File.prototype.webkitSlice || window.File.prototype.mozSlice)) {
return blobSlice.call(blob, start, end);
} else {
return null; // or throw some exception
}
}
this.slice = function() {
return new Blob(this.getRuntime().uid, w3cBlobSlice.apply(this, arguments));
};
}
return (extensions.Blob = HTML5Blob);
});
// Included from: src/javascript/core/utils/Events.js
/**
* Events.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define('moxie/core/utils/Events', [
'moxie/core/utils/Basic'
], function(Basic) {
var eventhash = {}, uid = 'moxie_' + Basic.guid();
// IE W3C like event funcs
function preventDefault() {
this.returnValue = false;
}
function stopPropagation() {
this.cancelBubble = true;
}
/**
Adds an event handler to the specified object and store reference to the handler
in objects internal Plupload registry (@see removeEvent).
@method addEvent
@for Utils
@static
@param {Object} obj DOM element like object to add handler to.
@param {String} name Name to add event listener to.
@param {Function} callback Function to call when event occurs.
@param {String} [key] that might be used to add specifity to the event record.
*/
var addEvent = function(obj, name, callback, key) {
var func, events;
name = name.toLowerCase();
// Add event listener
if (obj.addEventListener) {
func = callback;
obj.addEventListener(name, func, false);
} else if (obj.attachEvent) {
func = function() {
var evt = window.event;
if (!evt.target) {
evt.target = evt.srcElement;
}
evt.preventDefault = preventDefault;
evt.stopPropagation = stopPropagation;
callback(evt);
};
obj.attachEvent('on' + name, func);
}
// Log event handler to objects internal mOxie registry
if (!obj[uid]) {
obj[uid] = Basic.guid();
}
if (!eventhash.hasOwnProperty(obj[uid])) {
eventhash[obj[uid]] = {};
}
events = eventhash[obj[uid]];
if (!events.hasOwnProperty(name)) {
events[name] = [];
}
events[name].push({
func: func,
orig: callback, // store original callback for IE
key: key
});
};
/**
Remove event handler from the specified object. If third argument (callback)
is not specified remove all events with the specified name.
@method removeEvent
@static
@param {Object} obj DOM element to remove event listener(s) from.
@param {String} name Name of event listener to remove.
@param {Function|String} [callback] might be a callback or unique key to match.
*/
var removeEvent = function(obj, name, callback) {
var type, undef;
name = name.toLowerCase();
if (obj[uid] && eventhash[obj[uid]] && eventhash[obj[uid]][name]) {
type = eventhash[obj[uid]][name];
} else {
return;
}
for (var i = type.length - 1; i >= 0; i--) {
// undefined or not, key should match
if (type[i].orig === callback || type[i].key === callback) {
if (obj.removeEventListener) {
obj.removeEventListener(name, type[i].func, false);
} else if (obj.detachEvent) {
obj.detachEvent('on'+name, type[i].func);
}
type[i].orig = null;
type[i].func = null;
type.splice(i, 1);
// If callback was passed we are done here, otherwise proceed
if (callback !== undef) {
break;
}
}
}
// If event array got empty, remove it
if (!type.length) {
delete eventhash[obj[uid]][name];
}
// If mOxie registry has become empty, remove it
if (Basic.isEmptyObj(eventhash[obj[uid]])) {
delete eventhash[obj[uid]];
// IE doesn't let you remove DOM object property with - delete
try {
delete obj[uid];
} catch(e) {
obj[uid] = undef;
}
}
};
/**
Remove all kind of events from the specified object
@method removeAllEvents
@static
@param {Object} obj DOM element to remove event listeners from.
@param {String} [key] unique key to match, when removing events.
*/
var removeAllEvents = function(obj, key) {
if (!obj || !obj[uid]) {
return;
}
Basic.each(eventhash[obj[uid]], function(events, name) {
removeEvent(obj, name, key);
});
};
return {
addEvent: addEvent,
removeEvent: removeEvent,
removeAllEvents: removeAllEvents
};
});
// Included from: src/javascript/runtime/html5/file/FileInput.js
/**
* FileInput.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/**
@class moxie/runtime/html5/file/FileInput
@private
*/
define("moxie/runtime/html5/file/FileInput", [
"moxie/runtime/html5/Runtime",
"moxie/core/utils/Basic",
"moxie/core/utils/Dom",
"moxie/core/utils/Events",
"moxie/core/utils/Mime",
"moxie/core/utils/Env"
], function(extensions, Basic, Dom, Events, Mime, Env) {
function FileInput() {
var _files = [], _options;
Basic.extend(this, {
init: function(options) {
var comp = this, I = comp.getRuntime(), input, shimContainer, mimes, browseButton, zIndex, top;
_options = options;
_files = [];
// figure out accept string
mimes = _options.accept.mimes || Mime.extList2mimes(_options.accept, I.can('filter_by_extension'));
shimContainer = I.getShimContainer();
shimContainer.innerHTML = '<input id="' + I.uid +'" type="file" style="font-size:999px;opacity:0;"' +
(_options.multiple && I.can('select_multiple') ? 'multiple' : '') +
(_options.directory && I.can('select_folder') ? 'webkitdirectory directory' : '') + // Chrome 11+
(mimes ? ' accept="' + mimes.join(',') + '"' : '') + ' />';
input = Dom.get(I.uid);
// prepare file input to be placed underneath the browse_button element
Basic.extend(input.style, {
position: 'absolute',
top: 0,
left: 0,
width: '100%',
height: '100%'
});
browseButton = Dom.get(_options.browse_button);
// Route click event to the input[type=file] element for browsers that support such behavior
if (I.can('summon_file_dialog')) {
if (Dom.getStyle(browseButton, 'position') === 'static') {
browseButton.style.position = 'relative';
}
zIndex = parseInt(Dom.getStyle(browseButton, 'z-index'), 10) || 1;
browseButton.style.zIndex = zIndex;
shimContainer.style.zIndex = zIndex - 1;
Events.addEvent(browseButton, 'click', function(e) {
var input = Dom.get(I.uid);
if (input && !input.disabled) { // for some reason FF (up to 8.0.1 so far) lets to click disabled input[type=file]
input.click();
}
e.preventDefault();
}, comp.uid);
}
/* Since we have to place input[type=file] on top of the browse_button for some browsers,
browse_button loses interactivity, so we restore it here */
top = I.can('summon_file_dialog') ? browseButton : shimContainer;
Events.addEvent(top, 'mouseover', function() {
comp.trigger('mouseenter');
}, comp.uid);
Events.addEvent(top, 'mouseout', function() {
comp.trigger('mouseleave');
}, comp.uid);
Events.addEvent(top, 'mousedown', function() {
comp.trigger('mousedown');
}, comp.uid);
Events.addEvent(Dom.get(_options.container), 'mouseup', function() {
comp.trigger('mouseup');
}, comp.uid);
input.onchange = function onChange() { // there should be only one handler for this
_files = [];
if (_options.directory) {
// folders are represented by dots, filter them out (Chrome 11+)
Basic.each(this.files, function(file) {
if (file.name !== ".") { // if it doesn't looks like a folder
_files.push(file);
}
});
} else {
_files = [].slice.call(this.files);
}
// clearing the value enables the user to select the same file again if they want to
if (Env.browser !== 'IE' && Env.browser !== 'IEMobile') {
this.value = '';
} else {
// in IE input[type="file"] is read-only so the only way to reset it is to re-insert it
var clone = this.cloneNode(true);
this.parentNode.replaceChild(clone, this);
clone.onchange = onChange;
}
comp.trigger('change');
};
// ready event is perfectly asynchronous
comp.trigger({
type: 'ready',
async: true
});
shimContainer = null;
},
getFiles: function() {
return _files;
},
disable: function(state) {
var I = this.getRuntime(), input;
if ((input = Dom.get(I.uid))) {
input.disabled = !!state;
}
},
destroy: function() {
var I = this.getRuntime()
, shim = I.getShim()
, shimContainer = I.getShimContainer()
;
Events.removeAllEvents(shimContainer, this.uid);
Events.removeAllEvents(_options && Dom.get(_options.container), this.uid);
Events.removeAllEvents(_options && Dom.get(_options.browse_button), this.uid);
if (shimContainer) {
shimContainer.innerHTML = '';
}
shim.removeInstance(this.uid);
_files = _options = shimContainer = shim = null;
}
});
}
return (extensions.FileInput = FileInput);
});
// Included from: src/javascript/runtime/html5/file/FileReader.js
/**
* FileReader.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/**
@class moxie/runtime/html5/file/FileReader
@private
*/
define("moxie/runtime/html5/file/FileReader", [
"moxie/runtime/html5/Runtime",
"moxie/core/utils/Encode",
"moxie/core/utils/Basic"
], function(extensions, Encode, Basic) {
function FileReader() {
var _fr, _convertToBinary = false;
Basic.extend(this, {
read: function(op, blob) {
var target = this;
_fr = new window.FileReader();
_fr.addEventListener('progress', function(e) {
target.trigger(e);
});
_fr.addEventListener('load', function(e) {
target.trigger(e);
});
_fr.addEventListener('error', function(e) {
target.trigger(e, _fr.error);
});
_fr.addEventListener('loadend', function() {
_fr = null;
});
if (Basic.typeOf(_fr[op]) === 'function') {
_convertToBinary = false;
_fr[op](blob.getSource());
} else if (op === 'readAsBinaryString') { // readAsBinaryString is depricated in general and never existed in IE10+
_convertToBinary = true;
_fr.readAsDataURL(blob.getSource());
}
},
getResult: function() {
return _fr && _fr.result ? (_convertToBinary ? _toBinary(_fr.result) : _fr.result) : null;
},
abort: function() {
if (_fr) {
_fr.abort();
}
},
destroy: function() {
_fr = null;
}
});
function _toBinary(str) {
return Encode.atob(str.substring(str.indexOf('base64,') + 7));
}
}
return (extensions.FileReader = FileReader);
});
// Included from: src/javascript/runtime/html5/xhr/XMLHttpRequest.js
/**
* XMLHttpRequest.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/*global ActiveXObject:true */
/**
@class moxie/runtime/html5/xhr/XMLHttpRequest
@private
*/
define("moxie/runtime/html5/xhr/XMLHttpRequest", [
"moxie/runtime/html5/Runtime",
"moxie/core/utils/Basic",
"moxie/core/utils/Mime",
"moxie/core/utils/Url",
"moxie/file/File",
"moxie/file/Blob",
"moxie/xhr/FormData",
"moxie/core/Exceptions",
"moxie/core/utils/Env"
], function(extensions, Basic, Mime, Url, File, Blob, FormData, x, Env) {
function XMLHttpRequest() {
var self = this
, _xhr
, _filename
;
Basic.extend(this, {
send: function(meta, data) {
var target = this
, isGecko2_5_6 = (Env.browser === 'Mozilla' && Env.version >= 4 && Env.version < 7)
, isAndroidBrowser = Env.browser === 'Android Browser'
, mustSendAsBinary = false
;
// extract file name
_filename = meta.url.replace(/^.+?\/([\w\-\.]+)$/, '$1').toLowerCase();
_xhr = _getNativeXHR();
_xhr.open(meta.method, meta.url, meta.async, meta.user, meta.password);
// prepare data to be sent
if (data instanceof Blob) {
if (data.isDetached()) {
mustSendAsBinary = true;
}
data = data.getSource();
} else if (data instanceof FormData) {
if (data.hasBlob()) {
if (data.getBlob().isDetached()) {
data = _prepareMultipart.call(target, data); // _xhr must be instantiated and be in OPENED state
mustSendAsBinary = true;
} else if ((isGecko2_5_6 || isAndroidBrowser) && Basic.typeOf(data.getBlob().getSource()) === 'blob' && window.FileReader) {
// Gecko 2/5/6 can't send blob in FormData: https://bugzilla.mozilla.org/show_bug.cgi?id=649150
// Android browsers (default one and Dolphin) seem to have the same issue, see: #613
_preloadAndSend.call(target, meta, data);
return; // _preloadAndSend will reinvoke send() with transmutated FormData =%D
}
}
// transfer fields to real FormData
if (data instanceof FormData) { // if still a FormData, e.g. not mangled by _prepareMultipart()
var fd = new window.FormData();
data.each(function(value, name) {
if (value instanceof Blob) {
fd.append(name, value.getSource());
} else {
fd.append(name, value);
}
});
data = fd;
}
}
// if XHR L2
if (_xhr.upload) {
if (meta.withCredentials) {
_xhr.withCredentials = true;
}
_xhr.addEventListener('load', function(e) {
target.trigger(e);
});
_xhr.addEventListener('error', function(e) {
target.trigger(e);
});
// additionally listen to progress events
_xhr.addEventListener('progress', function(e) {
target.trigger(e);
});
_xhr.upload.addEventListener('progress', function(e) {
target.trigger({
type: 'UploadProgress',
loaded: e.loaded,
total: e.total
});
});
// ... otherwise simulate XHR L2
} else {
_xhr.onreadystatechange = function onReadyStateChange() {
// fake Level 2 events
switch (_xhr.readyState) {
case 1: // XMLHttpRequest.OPENED
// readystatechanged is fired twice for OPENED state (in IE and Mozilla) - neu
break;
// looks like HEADERS_RECEIVED (state 2) is not reported in Opera (or it's old versions) - neu
case 2: // XMLHttpRequest.HEADERS_RECEIVED
break;
case 3: // XMLHttpRequest.LOADING
// try to fire progress event for not XHR L2
var total, loaded;
try {
if (Url.hasSameOrigin(meta.url)) { // Content-Length not accessible for cross-domain on some browsers
total = _xhr.getResponseHeader('Content-Length') || 0; // old Safari throws an exception here
}
if (_xhr.responseText) { // responseText was introduced in IE7
loaded = _xhr.responseText.length;
}
} catch(ex) {
total = loaded = 0;
}
target.trigger({
type: 'progress',
lengthComputable: !!total,
total: parseInt(total, 10),
loaded: loaded
});
break;
case 4: // XMLHttpRequest.DONE
// release readystatechange handler (mostly for IE)
_xhr.onreadystatechange = function() {};
// usually status 0 is returned when server is unreachable, but FF also fails to status 0 for 408 timeout
if (_xhr.status === 0) {
target.trigger('error');
} else {
target.trigger('load');
}
break;
}
};
}
// set request headers
if (!Basic.isEmptyObj(meta.headers)) {
Basic.each(meta.headers, function(value, header) {
_xhr.setRequestHeader(header, value);
});
}
// request response type
if ("" !== meta.responseType && 'responseType' in _xhr) {
if ('json' === meta.responseType && !Env.can('return_response_type', 'json')) { // we can fake this one
_xhr.responseType = 'text';
} else {
_xhr.responseType = meta.responseType;
}
}
// send ...
if (!mustSendAsBinary) {
_xhr.send(data);
} else {
if (_xhr.sendAsBinary) { // Gecko
_xhr.sendAsBinary(data);
} else { // other browsers having support for typed arrays
(function() {
// mimic Gecko's sendAsBinary
var ui8a = new Uint8Array(data.length);
for (var i = 0; i < data.length; i++) {
ui8a[i] = (data.charCodeAt(i) & 0xff);
}
_xhr.send(ui8a.buffer);
}());
}
}
target.trigger('loadstart');
},
getStatus: function() {
// according to W3C spec it should return 0 for readyState < 3, but instead it throws an exception
try {
if (_xhr) {
return _xhr.status;
}
} catch(ex) {}
return 0;
},
getResponse: function(responseType) {
var I = this.getRuntime();
try {
switch (responseType) {
case 'blob':
var file = new File(I.uid, _xhr.response);
// try to extract file name from content-disposition if possible (might be - not, if CORS for example)
var disposition = _xhr.getResponseHeader('Content-Disposition');
if (disposition) {
// extract filename from response header if available
var match = disposition.match(/filename=([\'\"'])([^\1]+)\1/);
if (match) {
_filename = match[2];
}
}
file.name = _filename;
// pre-webkit Opera doesn't set type property on the blob response
if (!file.type) {
file.type = Mime.getFileMime(_filename);
}
return file;
case 'json':
if (!Env.can('return_response_type', 'json')) {
return _xhr.status === 200 && !!window.JSON ? JSON.parse(_xhr.responseText) : null;
}
return _xhr.response;
case 'document':
return _getDocument(_xhr);
default:
return _xhr.responseText !== '' ? _xhr.responseText : null; // against the specs, but for consistency across the runtimes
}
} catch(ex) {
return null;
}
},
getAllResponseHeaders: function() {
try {
return _xhr.getAllResponseHeaders();
} catch(ex) {}
return '';
},
abort: function() {
if (_xhr) {
_xhr.abort();
}
},
destroy: function() {
self = _filename = null;
}
});
// here we go... ugly fix for ugly bug
function _preloadAndSend(meta, data) {
var target = this, blob, fr;
// get original blob
blob = data.getBlob().getSource();
// preload blob in memory to be sent as binary string
fr = new window.FileReader();
fr.onload = function() {
// overwrite original blob
data.append(data.getBlobName(), new Blob(null, {
type: blob.type,
data: fr.result
}));
// invoke send operation again
self.send.call(target, meta, data);
};
fr.readAsBinaryString(blob);
}
function _getNativeXHR() {
if (window.XMLHttpRequest && !(Env.browser === 'IE' && Env.version < 8)) { // IE7 has native XHR but it's buggy
return new window.XMLHttpRequest();
} else {
return (function() {
var progIDs = ['Msxml2.XMLHTTP.6.0', 'Microsoft.XMLHTTP']; // if 6.0 available, use it, otherwise failback to default 3.0
for (var i = 0; i < progIDs.length; i++) {
try {
return new ActiveXObject(progIDs[i]);
} catch (ex) {}
}
})();
}
}
// @credits Sergey Ilinsky (http://www.ilinsky.com/)
function _getDocument(xhr) {
var rXML = xhr.responseXML;
var rText = xhr.responseText;
// Try parsing responseText (@see: http://www.ilinsky.com/articles/XMLHttpRequest/#bugs-ie-responseXML-content-type)
if (Env.browser === 'IE' && rText && rXML && !rXML.documentElement && /[^\/]+\/[^\+]+\+xml/.test(xhr.getResponseHeader("Content-Type"))) {
rXML = new window.ActiveXObject("Microsoft.XMLDOM");
rXML.async = false;
rXML.validateOnParse = false;
rXML.loadXML(rText);
}
// Check if there is no error in document
if (rXML) {
if ((Env.browser === 'IE' && rXML.parseError !== 0) || !rXML.documentElement || rXML.documentElement.tagName === "parsererror") {
return null;
}
}
return rXML;
}
function _prepareMultipart(fd) {
var boundary = '----moxieboundary' + new Date().getTime()
, dashdash = '--'
, crlf = '\r\n'
, multipart = ''
, I = this.getRuntime()
;
if (!I.can('send_binary_string')) {
throw new x.RuntimeError(x.RuntimeError.NOT_SUPPORTED_ERR);
}
_xhr.setRequestHeader('Content-Type', 'multipart/form-data; boundary=' + boundary);
// append multipart parameters
fd.each(function(value, name) {
// Firefox 3.6 failed to convert multibyte characters to UTF-8 in sendAsBinary(),
// so we try it here ourselves with: unescape(encodeURIComponent(value))
if (value instanceof Blob) {
// Build RFC2388 blob
multipart += dashdash + boundary + crlf +
'Content-Disposition: form-data; name="' + name + '"; filename="' + unescape(encodeURIComponent(value.name || 'blob')) + '"' + crlf +
'Content-Type: ' + (value.type || 'application/octet-stream') + crlf + crlf +
value.getSource() + crlf;
} else {
multipart += dashdash + boundary + crlf +
'Content-Disposition: form-data; name="' + name + '"' + crlf + crlf +
unescape(encodeURIComponent(value)) + crlf;
}
});
multipart += dashdash + boundary + dashdash + crlf;
return multipart;
}
}
return (extensions.XMLHttpRequest = XMLHttpRequest);
});
// Included from: src/javascript/runtime/html5/utils/BinaryReader.js
/**
* BinaryReader.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/**
@class moxie/runtime/html5/utils/BinaryReader
@private
*/
define("moxie/runtime/html5/utils/BinaryReader", [], function() {
return function() {
var II = false, bin;
// Private functions
function read(idx, size) {
var mv = II ? 0 : -8 * (size - 1), sum = 0, i;
for (i = 0; i < size; i++) {
sum |= (bin.charCodeAt(idx + i) << Math.abs(mv + i*8));
}
return sum;
}
function putstr(segment, idx, length) {
length = arguments.length === 3 ? length : bin.length - idx - 1;
bin = bin.substr(0, idx) + segment + bin.substr(length + idx);
}
function write(idx, num, size) {
var str = '', mv = II ? 0 : -8 * (size - 1), i;
for (i = 0; i < size; i++) {
str += String.fromCharCode((num >> Math.abs(mv + i*8)) & 255);
}
putstr(str, idx, size);
}
// Public functions
return {
II: function(order) {
if (order === undefined) {
return II;
} else {
II = order;
}
},
init: function(binData) {
II = false;
bin = binData;
},
SEGMENT: function(idx, length, segment) {
switch (arguments.length) {
case 1:
return bin.substr(idx, bin.length - idx - 1);
case 2:
return bin.substr(idx, length);
case 3:
putstr(segment, idx, length);
break;
default: return bin;
}
},
BYTE: function(idx) {
return read(idx, 1);
},
SHORT: function(idx) {
return read(idx, 2);
},
LONG: function(idx, num) {
if (num === undefined) {
return read(idx, 4);
} else {
write(idx, num, 4);
}
},
SLONG: function(idx) { // 2's complement notation
var num = read(idx, 4);
return (num > 2147483647 ? num - 4294967296 : num);
},
STRING: function(idx, size) {
var str = '';
for (size += idx; idx < size; idx++) {
str += String.fromCharCode(read(idx, 1));
}
return str;
}
};
};
});
// Included from: src/javascript/runtime/flash/Runtime.js
/**
* Runtime.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/*global ActiveXObject:true */
/**
Defines constructor for Flash runtime.
@class moxie/runtime/flash/Runtime
@private
*/
define("moxie/runtime/flash/Runtime", [
"moxie/core/utils/Basic",
"moxie/core/utils/Env",
"moxie/core/utils/Dom",
"moxie/core/Exceptions",
"moxie/runtime/Runtime"
], function(Basic, Env, Dom, x, Runtime) {
var type = 'flash', extensions = {};
/**
Get the version of the Flash Player
@method getShimVersion
@private
@return {Number} Flash Player version
*/
function getShimVersion() {
var version;
try {
version = navigator.plugins['Shockwave Flash'];
version = version.description;
} catch (e1) {
try {
version = new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version');
} catch (e2) {
version = '0.0';
}
}
version = version.match(/\d+/g);
return parseFloat(version[0] + '.' + version[1]);
}
/**
Constructor for the Flash Runtime
@class FlashRuntime
@extends Runtime
*/
function FlashRuntime(options) {
var I = this, initTimer;
options = Basic.extend({ swf_url: Env.swf_url }, options);
Runtime.call(this, options, type, {
access_binary: function(value) {
return value && I.mode === 'browser';
},
access_image_binary: function(value) {
return value && I.mode === 'browser';
},
display_media: Runtime.capTrue,
do_cors: Runtime.capTrue,
drag_and_drop: false,
report_upload_progress: function() {
return I.mode === 'client';
},
resize_image: Runtime.capTrue,
return_response_headers: false,
return_response_type: function(responseType) {
if (responseType === 'json' && !!window.JSON) {
return true;
}
return !Basic.arrayDiff(responseType, ['', 'text', 'document']) || I.mode === 'browser';
},
return_status_code: function(code) {
return I.mode === 'browser' || !Basic.arrayDiff(code, [200, 404]);
},
select_file: Runtime.capTrue,
select_multiple: Runtime.capTrue,
send_binary_string: function(value) {
return value && I.mode === 'browser';
},
send_browser_cookies: function(value) {
return value && I.mode === 'browser';
},
send_custom_headers: function(value) {
return value && I.mode === 'browser';
},
send_multipart: Runtime.capTrue,
slice_blob: function(value) {
return value && I.mode === 'browser';
},
stream_upload: function(value) {
return value && I.mode === 'browser';
},
summon_file_dialog: false,
upload_filesize: function(size) {
return Basic.parseSizeStr(size) <= 2097152 || I.mode === 'client';
},
use_http_method: function(methods) {
return !Basic.arrayDiff(methods, ['GET', 'POST']);
}
}, {
// capabilities that require specific mode
access_binary: function(value) {
return value ? 'browser' : 'client';
},
access_image_binary: function(value) {
return value ? 'browser' : 'client';
},
report_upload_progress: function(value) {
return value ? 'browser' : 'client';
},
return_response_type: function(responseType) {
return Basic.arrayDiff(responseType, ['', 'text', 'json', 'document']) ? 'browser' : ['client', 'browser'];
},
return_status_code: function(code) {
return Basic.arrayDiff(code, [200, 404]) ? 'browser' : ['client', 'browser'];
},
send_binary_string: function(value) {
return value ? 'browser' : 'client';
},
send_browser_cookies: function(value) {
return value ? 'browser' : 'client';
},
send_custom_headers: function(value) {
return value ? 'browser' : 'client';
},
stream_upload: function(value) {
return value ? 'client' : 'browser';
},
upload_filesize: function(size) {
return Basic.parseSizeStr(size) >= 2097152 ? 'client' : 'browser';
}
}, 'client');
// minimal requirement for Flash Player version
if (getShimVersion() < 10) {
this.mode = false; // with falsy mode, runtime won't operable, no matter what the mode was before
}
Basic.extend(this, {
getShim: function() {
return Dom.get(this.uid);
},
shimExec: function(component, action) {
var args = [].slice.call(arguments, 2);
return I.getShim().exec(this.uid, component, action, args);
},
init: function() {
var html, el, container;
container = this.getShimContainer();
// if not the minimal height, shims are not initialized in older browsers (e.g FF3.6, IE6,7,8, Safari 4.0,5.0, etc)
Basic.extend(container.style, {
position: 'absolute',
top: '-8px',
left: '-8px',
width: '9px',
height: '9px',
overflow: 'hidden'
});
// insert flash object
html = '<object id="' + this.uid + '" type="application/x-shockwave-flash" data="' + options.swf_url + '" ';
if (Env.browser === 'IE') {
html += 'classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" ';
}
html += 'width="100%" height="100%" style="outline:0">' +
'<param name="movie" value="' + options.swf_url + '" />' +
'<param name="flashvars" value="uid=' + escape(this.uid) + '&target=' + Env.global_event_dispatcher + '" />' +
'<param name="wmode" value="transparent" />' +
'<param name="allowscriptaccess" value="always" />' +
'</object>';
if (Env.browser === 'IE') {
el = document.createElement('div');
container.appendChild(el);
el.outerHTML = html;
el = container = null; // just in case
} else {
container.innerHTML = html;
}
// Init is dispatched by the shim
initTimer = setTimeout(function() {
if (I && !I.initialized) { // runtime might be already destroyed by this moment
I.trigger("Error", new x.RuntimeError(x.RuntimeError.NOT_INIT_ERR));
}
}, 5000);
},
destroy: (function(destroy) { // extend default destroy method
return function() {
destroy.call(I);
clearTimeout(initTimer); // initialization check might be still onwait
options = initTimer = destroy = I = null;
};
}(this.destroy))
}, extensions);
}
Runtime.addConstructor(type, FlashRuntime);
return extensions;
});
// Included from: src/javascript/runtime/flash/file/Blob.js
/**
* Blob.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/**
@class moxie/runtime/flash/file/Blob
@private
*/
define("moxie/runtime/flash/file/Blob", [
"moxie/runtime/flash/Runtime",
"moxie/file/Blob"
], function(extensions, Blob) {
var FlashBlob = {
slice: function(blob, start, end, type) {
var self = this.getRuntime();
if (start < 0) {
start = Math.max(blob.size + start, 0);
} else if (start > 0) {
start = Math.min(start, blob.size);
}
if (end < 0) {
end = Math.max(blob.size + end, 0);
} else if (end > 0) {
end = Math.min(end, blob.size);
}
blob = self.shimExec.call(this, 'Blob', 'slice', start, end, type || '');
if (blob) {
blob = new Blob(self.uid, blob);
}
return blob;
}
};
return (extensions.Blob = FlashBlob);
});
// Included from: src/javascript/runtime/flash/file/FileInput.js
/**
* FileInput.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/**
@class moxie/runtime/flash/file/FileInput
@private
*/
define("moxie/runtime/flash/file/FileInput", [
"moxie/runtime/flash/Runtime"
], function(extensions) {
var FileInput = {
init: function(options) {
this.getRuntime().shimExec.call(this, 'FileInput', 'init', {
name: options.name,
accept: options.accept,
multiple: options.multiple
});
this.trigger('ready');
}
};
return (extensions.FileInput = FileInput);
});
// Included from: src/javascript/runtime/flash/file/FileReader.js
/**
* FileReader.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/**
@class moxie/runtime/flash/file/FileReader
@private
*/
define("moxie/runtime/flash/file/FileReader", [
"moxie/runtime/flash/Runtime",
"moxie/core/utils/Encode"
], function(extensions, Encode) {
var _result = '';
function _formatData(data, op) {
switch (op) {
case 'readAsText':
return Encode.atob(data, 'utf8');
case 'readAsBinaryString':
return Encode.atob(data);
case 'readAsDataURL':
return data;
}
return null;
}
var FileReader = {
read: function(op, blob) {
var target = this, self = target.getRuntime();
// special prefix for DataURL read mode
if (op === 'readAsDataURL') {
_result = 'data:' + (blob.type || '') + ';base64,';
}
target.bind('Progress', function(e, data) {
if (data) {
_result += _formatData(data, op);
}
});
return self.shimExec.call(this, 'FileReader', 'readAsBase64', blob.uid);
},
getResult: function() {
return _result;
},
destroy: function() {
_result = null;
}
};
return (extensions.FileReader = FileReader);
});
// Included from: src/javascript/runtime/flash/file/FileReaderSync.js
/**
* FileReaderSync.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/**
@class moxie/runtime/flash/file/FileReaderSync
@private
*/
define("moxie/runtime/flash/file/FileReaderSync", [
"moxie/runtime/flash/Runtime",
"moxie/core/utils/Encode"
], function(extensions, Encode) {
function _formatData(data, op) {
switch (op) {
case 'readAsText':
return Encode.atob(data, 'utf8');
case 'readAsBinaryString':
return Encode.atob(data);
case 'readAsDataURL':
return data;
}
return null;
}
var FileReaderSync = {
read: function(op, blob) {
var result, self = this.getRuntime();
result = self.shimExec.call(this, 'FileReaderSync', 'readAsBase64', blob.uid);
if (!result) {
return null; // or throw ex
}
// special prefix for DataURL read mode
if (op === 'readAsDataURL') {
result = 'data:' + (blob.type || '') + ';base64,' + result;
}
return _formatData(result, op, blob.type);
}
};
return (extensions.FileReaderSync = FileReaderSync);
});
// Included from: src/javascript/runtime/flash/xhr/XMLHttpRequest.js
/**
* XMLHttpRequest.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/**
@class moxie/runtime/flash/xhr/XMLHttpRequest
@private
*/
define("moxie/runtime/flash/xhr/XMLHttpRequest", [
"moxie/runtime/flash/Runtime",
"moxie/core/utils/Basic",
"moxie/file/Blob",
"moxie/file/File",
"moxie/file/FileReaderSync",
"moxie/xhr/FormData",
"moxie/runtime/Transporter"
], function(extensions, Basic, Blob, File, FileReaderSync, FormData, Transporter) {
var XMLHttpRequest = {
send: function(meta, data) {
var target = this, self = target.getRuntime();
function send() {
meta.transport = self.mode;
self.shimExec.call(target, 'XMLHttpRequest', 'send', meta, data);
}
function appendBlob(name, blob) {
self.shimExec.call(target, 'XMLHttpRequest', 'appendBlob', name, blob.uid);
data = null;
send();
}
function attachBlob(blob, cb) {
var tr = new Transporter();
tr.bind("TransportingComplete", function() {
cb(this.result);
});
tr.transport(blob.getSource(), blob.type, {
ruid: self.uid
});
}
// copy over the headers if any
if (!Basic.isEmptyObj(meta.headers)) {
Basic.each(meta.headers, function(value, header) {
self.shimExec.call(target, 'XMLHttpRequest', 'setRequestHeader', header, value.toString()); // Silverlight doesn't accept integers into the arguments of type object
});
}
// transfer over multipart params and blob itself
if (data instanceof FormData) {
var blobField;
data.each(function(value, name) {
if (value instanceof Blob) {
blobField = name;
} else {
self.shimExec.call(target, 'XMLHttpRequest', 'append', name, value);
}
});
if (!data.hasBlob()) {
data = null;
send();
} else {
var blob = data.getBlob();
if (blob.isDetached()) {
attachBlob(blob, function(attachedBlob) {
blob.destroy();
appendBlob(blobField, attachedBlob);
});
} else {
appendBlob(blobField, blob);
}
}
} else if (data instanceof Blob) {
if (data.isDetached()) {
attachBlob(data, function(attachedBlob) {
data.destroy();
data = attachedBlob.uid;
send();
});
} else {
data = data.uid;
send();
}
} else {
send();
}
},
getResponse: function(responseType) {
var frs, blob, self = this.getRuntime();
blob = self.shimExec.call(this, 'XMLHttpRequest', 'getResponseAsBlob');
if (blob) {
blob = new File(self.uid, blob);
if ('blob' === responseType) {
return blob;
}
try {
frs = new FileReaderSync();
if (!!~Basic.inArray(responseType, ["", "text"])) {
return frs.readAsText(blob);
} else if ('json' === responseType && !!window.JSON) {
return JSON.parse(frs.readAsText(blob));
}
} finally {
blob.destroy();
}
}
return null;
},
abort: function(upload_complete_flag) {
var self = this.getRuntime();
self.shimExec.call(this, 'XMLHttpRequest', 'abort');
this.dispatchEvent('readystatechange');
// this.dispatchEvent('progress');
this.dispatchEvent('abort');
//if (!upload_complete_flag) {
// this.dispatchEvent('uploadprogress');
//}
}
};
return (extensions.XMLHttpRequest = XMLHttpRequest);
});
// Included from: src/javascript/runtime/flash/runtime/Transporter.js
/**
* Transporter.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/**
@class moxie/runtime/flash/runtime/Transporter
@private
*/
define("moxie/runtime/flash/runtime/Transporter", [
"moxie/runtime/flash/Runtime",
"moxie/file/Blob"
], function(extensions, Blob) {
var Transporter = {
getAsBlob: function(type) {
var self = this.getRuntime()
, blob = self.shimExec.call(this, 'Transporter', 'getAsBlob', type)
;
if (blob) {
return new Blob(self.uid, blob);
}
return null;
}
};
return (extensions.Transporter = Transporter);
});
// Included from: src/javascript/runtime/silverlight/Runtime.js
/**
* RunTime.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/*global ActiveXObject:true */
/**
Defines constructor for Silverlight runtime.
@class moxie/runtime/silverlight/Runtime
@private
*/
define("moxie/runtime/silverlight/Runtime", [
"moxie/core/utils/Basic",
"moxie/core/utils/Env",
"moxie/core/utils/Dom",
"moxie/core/Exceptions",
"moxie/runtime/Runtime"
], function(Basic, Env, Dom, x, Runtime) {
var type = "silverlight", extensions = {};
function isInstalled(version) {
var isVersionSupported = false, control = null, actualVer,
actualVerArray, reqVerArray, requiredVersionPart, actualVersionPart, index = 0;
try {
try {
control = new ActiveXObject('AgControl.AgControl');
if (control.IsVersionSupported(version)) {
isVersionSupported = true;
}
control = null;
} catch (e) {
var plugin = navigator.plugins["Silverlight Plug-In"];
if (plugin) {
actualVer = plugin.description;
if (actualVer === "1.0.30226.2") {
actualVer = "2.0.30226.2";
}
actualVerArray = actualVer.split(".");
while (actualVerArray.length > 3) {
actualVerArray.pop();
}
while ( actualVerArray.length < 4) {
actualVerArray.push(0);
}
reqVerArray = version.split(".");
while (reqVerArray.length > 4) {
reqVerArray.pop();
}
do {
requiredVersionPart = parseInt(reqVerArray[index], 10);
actualVersionPart = parseInt(actualVerArray[index], 10);
index++;
} while (index < reqVerArray.length && requiredVersionPart === actualVersionPart);
if (requiredVersionPart <= actualVersionPart && !isNaN(requiredVersionPart)) {
isVersionSupported = true;
}
}
}
} catch (e2) {
isVersionSupported = false;
}
return isVersionSupported;
}
/**
Constructor for the Silverlight Runtime
@class SilverlightRuntime
@extends Runtime
*/
function SilverlightRuntime(options) {
var I = this, initTimer;
options = Basic.extend({ xap_url: Env.xap_url }, options);
Runtime.call(this, options, type, {
access_binary: Runtime.capTrue,
access_image_binary: Runtime.capTrue,
display_media: Runtime.capTrue,
do_cors: Runtime.capTrue,
drag_and_drop: false,
report_upload_progress: Runtime.capTrue,
resize_image: Runtime.capTrue,
return_response_headers: function(value) {
return value && I.mode === 'client';
},
return_response_type: function(responseType) {
if (responseType !== 'json') {
return true;
} else {
return !!window.JSON;
}
},
return_status_code: function(code) {
return I.mode === 'client' || !Basic.arrayDiff(code, [200, 404]);
},
select_file: Runtime.capTrue,
select_multiple: Runtime.capTrue,
send_binary_string: Runtime.capTrue,
send_browser_cookies: function(value) {
return value && I.mode === 'browser';
},
send_custom_headers: function(value) {
return value && I.mode === 'client';
},
send_multipart: Runtime.capTrue,
slice_blob: Runtime.capTrue,
stream_upload: true,
summon_file_dialog: false,
upload_filesize: Runtime.capTrue,
use_http_method: function(methods) {
return I.mode === 'client' || !Basic.arrayDiff(methods, ['GET', 'POST']);
}
}, {
// capabilities that require specific mode
return_response_headers: function(value) {
return value ? 'client' : 'browser';
},
return_status_code: function(code) {
return Basic.arrayDiff(code, [200, 404]) ? 'client' : ['client', 'browser'];
},
send_browser_cookies: function(value) {
return value ? 'browser' : 'client';
},
send_custom_headers: function(value) {
return value ? 'client' : 'browser';
},
use_http_method: function(methods) {
return Basic.arrayDiff(methods, ['GET', 'POST']) ? 'client' : ['client', 'browser'];
}
});
// minimal requirement
if (!isInstalled('2.0.31005.0') || Env.browser === 'Opera') {
this.mode = false;
}
Basic.extend(this, {
getShim: function() {
return Dom.get(this.uid).content.Moxie;
},
shimExec: function(component, action) {
var args = [].slice.call(arguments, 2);
return I.getShim().exec(this.uid, component, action, args);
},
init : function() {
var container;
container = this.getShimContainer();
container.innerHTML = '<object id="' + this.uid + '" data="data:application/x-silverlight," type="application/x-silverlight-2" width="100%" height="100%" style="outline:none;">' +
'<param name="source" value="' + options.xap_url + '"/>' +
'<param name="background" value="Transparent"/>' +
'<param name="windowless" value="true"/>' +
'<param name="enablehtmlaccess" value="true"/>' +
'<param name="initParams" value="uid=' + this.uid + ',target=' + Env.global_event_dispatcher + '"/>' +
'</object>';
// Init is dispatched by the shim
initTimer = setTimeout(function() {
if (I && !I.initialized) { // runtime might be already destroyed by this moment
I.trigger("Error", new x.RuntimeError(x.RuntimeError.NOT_INIT_ERR));
}
}, Env.OS !== 'Windows'? 10000 : 5000); // give it more time to initialize in non Windows OS (like Mac)
},
destroy: (function(destroy) { // extend default destroy method
return function() {
destroy.call(I);
clearTimeout(initTimer); // initialization check might be still onwait
options = initTimer = destroy = I = null;
};
}(this.destroy))
}, extensions);
}
Runtime.addConstructor(type, SilverlightRuntime);
return extensions;
});
// Included from: src/javascript/runtime/silverlight/file/Blob.js
/**
* Blob.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/**
@class moxie/runtime/silverlight/file/Blob
@private
*/
define("moxie/runtime/silverlight/file/Blob", [
"moxie/runtime/silverlight/Runtime",
"moxie/core/utils/Basic",
"moxie/runtime/flash/file/Blob"
], function(extensions, Basic, Blob) {
return (extensions.Blob = Basic.extend({}, Blob));
});
// Included from: src/javascript/runtime/silverlight/file/FileInput.js
/**
* FileInput.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/**
@class moxie/runtime/silverlight/file/FileInput
@private
*/
define("moxie/runtime/silverlight/file/FileInput", [
"moxie/runtime/silverlight/Runtime"
], function(extensions) {
var FileInput = {
init: function(options) {
function toFilters(accept) {
var filter = '';
for (var i = 0; i < accept.length; i++) {
filter += (filter !== '' ? '|' : '') + accept[i].title + " | *." + accept[i].extensions.replace(/,/g, ';*.');
}
return filter;
}
this.getRuntime().shimExec.call(this, 'FileInput', 'init', toFilters(options.accept), options.name, options.multiple);
this.trigger('ready');
}
};
return (extensions.FileInput = FileInput);
});
// Included from: src/javascript/runtime/silverlight/file/FileReader.js
/**
* FileReader.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/**
@class moxie/runtime/silverlight/file/FileReader
@private
*/
define("moxie/runtime/silverlight/file/FileReader", [
"moxie/runtime/silverlight/Runtime",
"moxie/core/utils/Basic",
"moxie/runtime/flash/file/FileReader"
], function(extensions, Basic, FileReader) {
return (extensions.FileReader = Basic.extend({}, FileReader));
});
// Included from: src/javascript/runtime/silverlight/file/FileReaderSync.js
/**
* FileReaderSync.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/**
@class moxie/runtime/silverlight/file/FileReaderSync
@private
*/
define("moxie/runtime/silverlight/file/FileReaderSync", [
"moxie/runtime/silverlight/Runtime",
"moxie/core/utils/Basic",
"moxie/runtime/flash/file/FileReaderSync"
], function(extensions, Basic, FileReaderSync) {
return (extensions.FileReaderSync = Basic.extend({}, FileReaderSync));
});
// Included from: src/javascript/runtime/silverlight/xhr/XMLHttpRequest.js
/**
* XMLHttpRequest.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/**
@class moxie/runtime/silverlight/xhr/XMLHttpRequest
@private
*/
define("moxie/runtime/silverlight/xhr/XMLHttpRequest", [
"moxie/runtime/silverlight/Runtime",
"moxie/core/utils/Basic",
"moxie/runtime/flash/xhr/XMLHttpRequest"
], function(extensions, Basic, XMLHttpRequest) {
return (extensions.XMLHttpRequest = Basic.extend({}, XMLHttpRequest));
});
// Included from: src/javascript/runtime/silverlight/runtime/Transporter.js
/**
* Transporter.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/**
@class moxie/runtime/silverlight/runtime/Transporter
@private
*/
define("moxie/runtime/silverlight/runtime/Transporter", [
"moxie/runtime/silverlight/Runtime",
"moxie/core/utils/Basic",
"moxie/runtime/flash/runtime/Transporter"
], function(extensions, Basic, Transporter) {
return (extensions.Transporter = Basic.extend({}, Transporter));
});
// Included from: src/javascript/runtime/html4/Runtime.js
/**
* Runtime.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/*global File:true */
/**
Defines constructor for HTML4 runtime.
@class moxie/runtime/html4/Runtime
@private
*/
define("moxie/runtime/html4/Runtime", [
"moxie/core/utils/Basic",
"moxie/core/Exceptions",
"moxie/runtime/Runtime",
"moxie/core/utils/Env"
], function(Basic, x, Runtime, Env) {
var type = 'html4', extensions = {};
function Html4Runtime(options) {
var I = this
, Test = Runtime.capTest
, True = Runtime.capTrue
;
Runtime.call(this, options, type, {
access_binary: Test(window.FileReader || window.File && File.getAsDataURL),
access_image_binary: false,
display_media: Test(extensions.Image && (Env.can('create_canvas') || Env.can('use_data_uri_over32kb'))),
do_cors: false,
drag_and_drop: false,
filter_by_extension: Test(function() { // if you know how to feature-detect this, please suggest
return (Env.browser === 'Chrome' && Env.version >= 28) || (Env.browser === 'IE' && Env.version >= 10);
}()),
resize_image: function() {
return extensions.Image && I.can('access_binary') && Env.can('create_canvas');
},
report_upload_progress: false,
return_response_headers: false,
return_response_type: function(responseType) {
if (responseType === 'json' && !!window.JSON) {
return true;
}
return !!~Basic.inArray(responseType, ['text', 'document', '']);
},
return_status_code: function(code) {
return !Basic.arrayDiff(code, [200, 404]);
},
select_file: function() {
return Env.can('use_fileinput');
},
select_multiple: false,
send_binary_string: false,
send_custom_headers: false,
send_multipart: true,
slice_blob: false,
stream_upload: function() {
return I.can('select_file');
},
summon_file_dialog: Test(function() { // yeah... some dirty sniffing here...
return (Env.browser === 'Firefox' && Env.version >= 4) ||
(Env.browser === 'Opera' && Env.version >= 12) ||
!!~Basic.inArray(Env.browser, ['Chrome', 'Safari']);
}()),
upload_filesize: True,
use_http_method: function(methods) {
return !Basic.arrayDiff(methods, ['GET', 'POST']);
}
});
Basic.extend(this, {
init : function() {
this.trigger("Init");
},
destroy: (function(destroy) { // extend default destroy method
return function() {
destroy.call(I);
destroy = I = null;
};
}(this.destroy))
});
Basic.extend(this.getShim(), extensions);
}
Runtime.addConstructor(type, Html4Runtime);
return extensions;
});
// Included from: src/javascript/runtime/html4/file/FileInput.js
/**
* FileInput.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/**
@class moxie/runtime/html4/file/FileInput
@private
*/
define("moxie/runtime/html4/file/FileInput", [
"moxie/runtime/html4/Runtime",
"moxie/core/utils/Basic",
"moxie/core/utils/Dom",
"moxie/core/utils/Events",
"moxie/core/utils/Mime",
"moxie/core/utils/Env"
], function(extensions, Basic, Dom, Events, Mime, Env) {
function FileInput() {
var _uid, _files = [], _mimes = [], _options;
function addInput() {
var comp = this, I = comp.getRuntime(), shimContainer, browseButton, currForm, form, input, uid;
uid = Basic.guid('uid_');
shimContainer = I.getShimContainer(); // we get new ref everytime to avoid memory leaks in IE
if (_uid) { // move previous form out of the view
currForm = Dom.get(_uid + '_form');
if (currForm) {
Basic.extend(currForm.style, { top: '100%' });
}
}
// build form in DOM, since innerHTML version not able to submit file for some reason
form = document.createElement('form');
form.setAttribute('id', uid + '_form');
form.setAttribute('method', 'post');
form.setAttribute('enctype', 'multipart/form-data');
form.setAttribute('encoding', 'multipart/form-data');
Basic.extend(form.style, {
overflow: 'hidden',
position: 'absolute',
top: 0,
left: 0,
width: '100%',
height: '100%'
});
input = document.createElement('input');
input.setAttribute('id', uid);
input.setAttribute('type', 'file');
input.setAttribute('name', _options.name || 'Filedata');
input.setAttribute('accept', _mimes.join(','));
Basic.extend(input.style, {
fontSize: '999px',
opacity: 0
});
form.appendChild(input);
shimContainer.appendChild(form);
// prepare file input to be placed underneath the browse_button element
Basic.extend(input.style, {
position: 'absolute',
top: 0,
left: 0,
width: '100%',
height: '100%'
});
if (Env.browser === 'IE' && Env.version < 10) {
Basic.extend(input.style, {
filter : "progid:DXImageTransform.Microsoft.Alpha(opacity=0)"
});
}
input.onchange = function() { // there should be only one handler for this
var file;
if (!this.value) {
return;
}
if (this.files) {
file = this.files[0];
} else {
file = {
name: this.value
};
}
_files = [file];
this.onchange = function() {}; // clear event handler
addInput.call(comp);
// after file is initialized as o.File, we need to update form and input ids
comp.bind('change', function onChange() {
var input = Dom.get(uid), form = Dom.get(uid + '_form'), file;
comp.unbind('change', onChange);
if (comp.files.length && input && form) {
file = comp.files[0];
input.setAttribute('id', file.uid);
form.setAttribute('id', file.uid + '_form');
// set upload target
form.setAttribute('target', file.uid + '_iframe');
}
input = form = null;
}, 998);
input = form = null;
comp.trigger('change');
};
// route click event to the input
if (I.can('summon_file_dialog')) {
browseButton = Dom.get(_options.browse_button);
Events.removeEvent(browseButton, 'click', comp.uid);
Events.addEvent(browseButton, 'click', function(e) {
if (input && !input.disabled) { // for some reason FF (up to 8.0.1 so far) lets to click disabled input[type=file]
input.click();
}
e.preventDefault();
}, comp.uid);
}
_uid = uid;
shimContainer = currForm = browseButton = null;
}
Basic.extend(this, {
init: function(options) {
var comp = this, I = comp.getRuntime(), shimContainer;
// figure out accept string
_options = options;
_mimes = options.accept.mimes || Mime.extList2mimes(options.accept, I.can('filter_by_extension'));
shimContainer = I.getShimContainer();
(function() {
var browseButton, zIndex, top;
browseButton = Dom.get(options.browse_button);
// Route click event to the input[type=file] element for browsers that support such behavior
if (I.can('summon_file_dialog')) {
if (Dom.getStyle(browseButton, 'position') === 'static') {
browseButton.style.position = 'relative';
}
zIndex = parseInt(Dom.getStyle(browseButton, 'z-index'), 10) || 1;
browseButton.style.zIndex = zIndex;
shimContainer.style.zIndex = zIndex - 1;
}
/* Since we have to place input[type=file] on top of the browse_button for some browsers,
browse_button loses interactivity, so we restore it here */
top = I.can('summon_file_dialog') ? browseButton : shimContainer;
Events.addEvent(top, 'mouseover', function() {
comp.trigger('mouseenter');
}, comp.uid);
Events.addEvent(top, 'mouseout', function() {
comp.trigger('mouseleave');
}, comp.uid);
Events.addEvent(top, 'mousedown', function() {
comp.trigger('mousedown');
}, comp.uid);
Events.addEvent(Dom.get(options.container), 'mouseup', function() {
comp.trigger('mouseup');
}, comp.uid);
browseButton = null;
}());
addInput.call(this);
shimContainer = null;
// trigger ready event asynchronously
comp.trigger({
type: 'ready',
async: true
});
},
getFiles: function() {
return _files;
},
disable: function(state) {
var input;
if ((input = Dom.get(_uid))) {
input.disabled = !!state;
}
},
destroy: function() {
var I = this.getRuntime()
, shim = I.getShim()
, shimContainer = I.getShimContainer()
;
Events.removeAllEvents(shimContainer, this.uid);
Events.removeAllEvents(_options && Dom.get(_options.container), this.uid);
Events.removeAllEvents(_options && Dom.get(_options.browse_button), this.uid);
if (shimContainer) {
shimContainer.innerHTML = '';
}
shim.removeInstance(this.uid);
_uid = _files = _mimes = _options = shimContainer = shim = null;
}
});
}
return (extensions.FileInput = FileInput);
});
// Included from: src/javascript/runtime/html4/file/FileReader.js
/**
* FileReader.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/**
@class moxie/runtime/html4/file/FileReader
@private
*/
define("moxie/runtime/html4/file/FileReader", [
"moxie/runtime/html4/Runtime",
"moxie/runtime/html5/file/FileReader"
], function(extensions, FileReader) {
return (extensions.FileReader = FileReader);
});
// Included from: src/javascript/runtime/html4/xhr/XMLHttpRequest.js
/**
* XMLHttpRequest.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/**
@class moxie/runtime/html4/xhr/XMLHttpRequest
@private
*/
define("moxie/runtime/html4/xhr/XMLHttpRequest", [
"moxie/runtime/html4/Runtime",
"moxie/core/utils/Basic",
"moxie/core/utils/Dom",
"moxie/core/utils/Url",
"moxie/core/Exceptions",
"moxie/core/utils/Events",
"moxie/file/Blob",
"moxie/xhr/FormData"
], function(extensions, Basic, Dom, Url, x, Events, Blob, FormData) {
function XMLHttpRequest() {
var _status, _response, _iframe;
function cleanup(cb) {
var target = this, uid, form, inputs, i, hasFile = false;
if (!_iframe) {
return;
}
uid = _iframe.id.replace(/_iframe$/, '');
form = Dom.get(uid + '_form');
if (form) {
inputs = form.getElementsByTagName('input');
i = inputs.length;
while (i--) {
switch (inputs[i].getAttribute('type')) {
case 'hidden':
inputs[i].parentNode.removeChild(inputs[i]);
break;
case 'file':
hasFile = true; // flag the case for later
break;
}
}
inputs = [];
if (!hasFile) { // we need to keep the form for sake of possible retries
form.parentNode.removeChild(form);
}
form = null;
}
// without timeout, request is marked as canceled (in console)
setTimeout(function() {
Events.removeEvent(_iframe, 'load', target.uid);
if (_iframe.parentNode) { // #382
_iframe.parentNode.removeChild(_iframe);
}
// check if shim container has any other children, if - not, remove it as well
var shimContainer = target.getRuntime().getShimContainer();
if (!shimContainer.children.length) {
shimContainer.parentNode.removeChild(shimContainer);
}
shimContainer = _iframe = null;
cb();
}, 1);
}
Basic.extend(this, {
send: function(meta, data) {
var target = this, I = target.getRuntime(), uid, form, input, blob;
_status = _response = null;
function createIframe() {
var container = I.getShimContainer() || document.body
, temp = document.createElement('div')
;
// IE 6 won't be able to set the name using setAttribute or iframe.name
temp.innerHTML = '<iframe id="' + uid + '_iframe" name="' + uid + '_iframe" src="javascript:""" style="display:none"></iframe>';
_iframe = temp.firstChild;
container.appendChild(_iframe);
/* _iframe.onreadystatechange = function() {
console.info(_iframe.readyState);
};*/
Events.addEvent(_iframe, 'load', function() { // _iframe.onload doesn't work in IE lte 8
var el;
try {
el = _iframe.contentWindow.document || _iframe.contentDocument || window.frames[_iframe.id].document;
// try to detect some standard error pages
if (/^4(0[0-9]|1[0-7]|2[2346])\s/.test(el.title)) { // test if title starts with 4xx HTTP error
_status = el.title.replace(/^(\d+).*$/, '$1');
} else {
_status = 200;
// get result
_response = Basic.trim(el.body.innerHTML);
// we need to fire these at least once
target.trigger({
type: 'progress',
loaded: _response.length,
total: _response.length
});
if (blob) { // if we were uploading a file
target.trigger({
type: 'uploadprogress',
loaded: blob.size || 1025,
total: blob.size || 1025
});
}
}
} catch (ex) {
if (Url.hasSameOrigin(meta.url)) {
// if response is sent with error code, iframe in IE gets redirected to res://ieframe.dll/http_x.htm
// which obviously results to cross domain error (wtf?)
_status = 404;
} else {
cleanup.call(target, function() {
target.trigger('error');
});
return;
}
}
cleanup.call(target, function() {
target.trigger('load');
});
}, target.uid);
} // end createIframe
// prepare data to be sent and convert if required
if (data instanceof FormData && data.hasBlob()) {
blob = data.getBlob();
uid = blob.uid;
input = Dom.get(uid);
form = Dom.get(uid + '_form');
if (!form) {
throw new x.DOMException(x.DOMException.NOT_FOUND_ERR);
}
} else {
uid = Basic.guid('uid_');
form = document.createElement('form');
form.setAttribute('id', uid + '_form');
form.setAttribute('method', meta.method);
form.setAttribute('enctype', 'multipart/form-data');
form.setAttribute('encoding', 'multipart/form-data');
form.setAttribute('target', uid + '_iframe');
I.getShimContainer().appendChild(form);
}
if (data instanceof FormData) {
data.each(function(value, name) {
if (value instanceof Blob) {
if (input) {
input.setAttribute('name', name);
}
} else {
var hidden = document.createElement('input');
Basic.extend(hidden, {
type : 'hidden',
name : name,
value : value
});
// make sure that input[type="file"], if it's there, comes last
if (input) {
form.insertBefore(hidden, input);
} else {
form.appendChild(hidden);
}
}
});
}
// set destination url
form.setAttribute("action", meta.url);
createIframe();
form.submit();
target.trigger('loadstart');
},
getStatus: function() {
return _status;
},
getResponse: function(responseType) {
if ('json' === responseType) {
// strip off <pre>..</pre> tags that might be enclosing the response
if (Basic.typeOf(_response) === 'string' && !!window.JSON) {
try {
return JSON.parse(_response.replace(/^\s*<pre[^>]*>/, '').replace(/<\/pre>\s*$/, ''));
} catch (ex) {
return null;
}
}
} else if ('document' === responseType) {
}
return _response;
},
abort: function() {
var target = this;
if (_iframe && _iframe.contentWindow) {
if (_iframe.contentWindow.stop) { // FireFox/Safari/Chrome
_iframe.contentWindow.stop();
} else if (_iframe.contentWindow.document.execCommand) { // IE
_iframe.contentWindow.document.execCommand('Stop');
} else {
_iframe.src = "about:blank";
}
}
cleanup.call(this, function() {
// target.dispatchEvent('readystatechange');
target.dispatchEvent('abort');
});
}
});
}
return (extensions.XMLHttpRequest = XMLHttpRequest);
});
expose(["moxie/core/utils/Basic","moxie/core/I18n","moxie/core/utils/Mime","moxie/core/utils/Env","moxie/core/utils/Dom","moxie/core/Exceptions","moxie/core/EventTarget","moxie/core/utils/Encode","moxie/runtime/Runtime","moxie/runtime/RuntimeClient","moxie/file/Blob","moxie/file/File","moxie/file/FileInput","moxie/runtime/RuntimeTarget","moxie/file/FileReader","moxie/core/utils/Url","moxie/file/FileReaderSync","moxie/xhr/FormData","moxie/xhr/XMLHttpRequest","moxie/runtime/Transporter","moxie/core/utils/Events"]);
})(this);/**
* o.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/*global moxie:true */
/**
Globally exposed namespace with the most frequently used public classes and handy methods.
@class o
@static
@private
*/
(function(exports) {
"use strict";
var o = {}, inArray = exports.moxie.core.utils.Basic.inArray;
// directly add some public classes
// (we do it dynamically here, since for custom builds we cannot know beforehand what modules were included)
(function addAlias(ns) {
var name, itemType;
for (name in ns) {
itemType = typeof(ns[name]);
if (itemType === 'object' && !~inArray(name, ['Exceptions', 'Env', 'Mime'])) {
addAlias(ns[name]);
} else if (itemType === 'function') {
o[name] = ns[name];
}
}
})(exports.moxie);
// add some manually
o.Env = exports.moxie.core.utils.Env;
o.Mime = exports.moxie.core.utils.Mime;
o.Exceptions = exports.moxie.core.Exceptions;
// expose globally
exports.mOxie = o;
if (!exports.o) {
exports.o = o;
}
return o;
})(this);
|
src/components/layout.js | openregister/specification | import React from 'react';
import PropTypes from 'prop-types';
import { StaticQuery, graphql } from 'gatsby';
import 'prismjs/themes/prism.css';
const Layout = ({children}) => (
<StaticQuery
query={graphql`
query LayoutQuery {
core: coreToml {
title
}
}`}
render={() => {
return (
<React.Fragment>
{children}
</React.Fragment>
);}}
/>
);
Layout.propTypes = {
children: PropTypes.any.isRequired
};
export default Layout;
|
js/vendor/jquery-1.9.1.min.js | JonathanMatthey/ogglpro | /*! jQuery v1.9.1 | (c) 2005, 2012 jQuery Foundation, Inc. | jquery.org/license
//@ sourceMappingURL=jquery.min.map
*/(function(e,t){var n,r,i=typeof t,o=e.document,a=e.location,s=e.jQuery,u=e.$,l={},c=[],p="1.9.1",f=c.concat,d=c.push,h=c.slice,g=c.indexOf,m=l.toString,y=l.hasOwnProperty,v=p.trim,b=function(e,t){return new b.fn.init(e,t,r)},x=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,w=/\S+/g,T=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,N=/^(?:(<[\w\W]+>)[^>]*|#([\w-]*))$/,C=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,k=/^[\],:{}\s]*$/,E=/(?:^|:|,)(?:\s*\[)+/g,S=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,A=/"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,j=/^-ms-/,D=/-([\da-z])/gi,L=function(e,t){return t.toUpperCase()},H=function(e){(o.addEventListener||"load"===e.type||"complete"===o.readyState)&&(q(),b.ready())},q=function(){o.addEventListener?(o.removeEventListener("DOMContentLoaded",H,!1),e.removeEventListener("load",H,!1)):(o.detachEvent("onreadystatechange",H),e.detachEvent("onload",H))};b.fn=b.prototype={jquery:p,constructor:b,init:function(e,n,r){var i,a;if(!e)return this;if("string"==typeof e){if(i="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:N.exec(e),!i||!i[1]&&n)return!n||n.jquery?(n||r).find(e):this.constructor(n).find(e);if(i[1]){if(n=n instanceof b?n[0]:n,b.merge(this,b.parseHTML(i[1],n&&n.nodeType?n.ownerDocument||n:o,!0)),C.test(i[1])&&b.isPlainObject(n))for(i in n)b.isFunction(this[i])?this[i](n[i]):this.attr(i,n[i]);return this}if(a=o.getElementById(i[2]),a&&a.parentNode){if(a.id!==i[2])return r.find(e);this.length=1,this[0]=a}return this.context=o,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):b.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),b.makeArray(e,this))},selector:"",length:0,size:function(){return this.length},toArray:function(){return h.call(this)},get:function(e){return null==e?this.toArray():0>e?this[this.length+e]:this[e]},pushStack:function(e){var t=b.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return b.each(this,e,t)},ready:function(e){return b.ready.promise().done(e),this},slice:function(){return this.pushStack(h.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(0>e?t:0);return this.pushStack(n>=0&&t>n?[this[n]]:[])},map:function(e){return this.pushStack(b.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:d,sort:[].sort,splice:[].splice},b.fn.init.prototype=b.fn,b.extend=b.fn.extend=function(){var e,n,r,i,o,a,s=arguments[0]||{},u=1,l=arguments.length,c=!1;for("boolean"==typeof s&&(c=s,s=arguments[1]||{},u=2),"object"==typeof s||b.isFunction(s)||(s={}),l===u&&(s=this,--u);l>u;u++)if(null!=(o=arguments[u]))for(i in o)e=s[i],r=o[i],s!==r&&(c&&r&&(b.isPlainObject(r)||(n=b.isArray(r)))?(n?(n=!1,a=e&&b.isArray(e)?e:[]):a=e&&b.isPlainObject(e)?e:{},s[i]=b.extend(c,a,r)):r!==t&&(s[i]=r));return s},b.extend({noConflict:function(t){return e.$===b&&(e.$=u),t&&e.jQuery===b&&(e.jQuery=s),b},isReady:!1,readyWait:1,holdReady:function(e){e?b.readyWait++:b.ready(!0)},ready:function(e){if(e===!0?!--b.readyWait:!b.isReady){if(!o.body)return setTimeout(b.ready);b.isReady=!0,e!==!0&&--b.readyWait>0||(n.resolveWith(o,[b]),b.fn.trigger&&b(o).trigger("ready").off("ready"))}},isFunction:function(e){return"function"===b.type(e)},isArray:Array.isArray||function(e){return"array"===b.type(e)},isWindow:function(e){return null!=e&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?l[m.call(e)]||"object":typeof e},isPlainObject:function(e){if(!e||"object"!==b.type(e)||e.nodeType||b.isWindow(e))return!1;try{if(e.constructor&&!y.call(e,"constructor")&&!y.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(n){return!1}var r;for(r in e);return r===t||y.call(e,r)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw Error(e)},parseHTML:function(e,t,n){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(n=t,t=!1),t=t||o;var r=C.exec(e),i=!n&&[];return r?[t.createElement(r[1])]:(r=b.buildFragment([e],t,i),i&&b(i).remove(),b.merge([],r.childNodes))},parseJSON:function(n){return e.JSON&&e.JSON.parse?e.JSON.parse(n):null===n?n:"string"==typeof n&&(n=b.trim(n),n&&k.test(n.replace(S,"@").replace(A,"]").replace(E,"")))?Function("return "+n)():(b.error("Invalid JSON: "+n),t)},parseXML:function(n){var r,i;if(!n||"string"!=typeof n)return null;try{e.DOMParser?(i=new DOMParser,r=i.parseFromString(n,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(n))}catch(o){r=t}return r&&r.documentElement&&!r.getElementsByTagName("parsererror").length||b.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&b.trim(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(j,"ms-").replace(D,L)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t,n){var r,i=0,o=e.length,a=M(e);if(n){if(a){for(;o>i;i++)if(r=t.apply(e[i],n),r===!1)break}else for(i in e)if(r=t.apply(e[i],n),r===!1)break}else if(a){for(;o>i;i++)if(r=t.call(e[i],i,e[i]),r===!1)break}else for(i in e)if(r=t.call(e[i],i,e[i]),r===!1)break;return e},trim:v&&!v.call("\ufeff\u00a0")?function(e){return null==e?"":v.call(e)}:function(e){return null==e?"":(e+"").replace(T,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(M(Object(e))?b.merge(n,"string"==typeof e?[e]:e):d.call(n,e)),n},inArray:function(e,t,n){var r;if(t){if(g)return g.call(t,e,n);for(r=t.length,n=n?0>n?Math.max(0,r+n):n:0;r>n;n++)if(n in t&&t[n]===e)return n}return-1},merge:function(e,n){var r=n.length,i=e.length,o=0;if("number"==typeof r)for(;r>o;o++)e[i++]=n[o];else while(n[o]!==t)e[i++]=n[o++];return e.length=i,e},grep:function(e,t,n){var r,i=[],o=0,a=e.length;for(n=!!n;a>o;o++)r=!!t(e[o],o),n!==r&&i.push(e[o]);return i},map:function(e,t,n){var r,i=0,o=e.length,a=M(e),s=[];if(a)for(;o>i;i++)r=t(e[i],i,n),null!=r&&(s[s.length]=r);else for(i in e)r=t(e[i],i,n),null!=r&&(s[s.length]=r);return f.apply([],s)},guid:1,proxy:function(e,n){var r,i,o;return"string"==typeof n&&(o=e[n],n=e,e=o),b.isFunction(e)?(r=h.call(arguments,2),i=function(){return e.apply(n||this,r.concat(h.call(arguments)))},i.guid=e.guid=e.guid||b.guid++,i):t},access:function(e,n,r,i,o,a,s){var u=0,l=e.length,c=null==r;if("object"===b.type(r)){o=!0;for(u in r)b.access(e,n,u,r[u],!0,a,s)}else if(i!==t&&(o=!0,b.isFunction(i)||(s=!0),c&&(s?(n.call(e,i),n=null):(c=n,n=function(e,t,n){return c.call(b(e),n)})),n))for(;l>u;u++)n(e[u],r,s?i:i.call(e[u],u,n(e[u],r)));return o?e:c?n.call(e):l?n(e[0],r):a},now:function(){return(new Date).getTime()}}),b.ready.promise=function(t){if(!n)if(n=b.Deferred(),"complete"===o.readyState)setTimeout(b.ready);else if(o.addEventListener)o.addEventListener("DOMContentLoaded",H,!1),e.addEventListener("load",H,!1);else{o.attachEvent("onreadystatechange",H),e.attachEvent("onload",H);var r=!1;try{r=null==e.frameElement&&o.documentElement}catch(i){}r&&r.doScroll&&function a(){if(!b.isReady){try{r.doScroll("left")}catch(e){return setTimeout(a,50)}q(),b.ready()}}()}return n.promise(t)},b.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(e,t){l["[object "+t+"]"]=t.toLowerCase()});function M(e){var t=e.length,n=b.type(e);return b.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||"function"!==n&&(0===t||"number"==typeof t&&t>0&&t-1 in e)}r=b(o);var _={};function F(e){var t=_[e]={};return b.each(e.match(w)||[],function(e,n){t[n]=!0}),t}b.Callbacks=function(e){e="string"==typeof e?_[e]||F(e):b.extend({},e);var n,r,i,o,a,s,u=[],l=!e.once&&[],c=function(t){for(r=e.memory&&t,i=!0,a=s||0,s=0,o=u.length,n=!0;u&&o>a;a++)if(u[a].apply(t[0],t[1])===!1&&e.stopOnFalse){r=!1;break}n=!1,u&&(l?l.length&&c(l.shift()):r?u=[]:p.disable())},p={add:function(){if(u){var t=u.length;(function i(t){b.each(t,function(t,n){var r=b.type(n);"function"===r?e.unique&&p.has(n)||u.push(n):n&&n.length&&"string"!==r&&i(n)})})(arguments),n?o=u.length:r&&(s=t,c(r))}return this},remove:function(){return u&&b.each(arguments,function(e,t){var r;while((r=b.inArray(t,u,r))>-1)u.splice(r,1),n&&(o>=r&&o--,a>=r&&a--)}),this},has:function(e){return e?b.inArray(e,u)>-1:!(!u||!u.length)},empty:function(){return u=[],this},disable:function(){return u=l=r=t,this},disabled:function(){return!u},lock:function(){return l=t,r||p.disable(),this},locked:function(){return!l},fireWith:function(e,t){return t=t||[],t=[e,t.slice?t.slice():t],!u||i&&!l||(n?l.push(t):c(t)),this},fire:function(){return p.fireWith(this,arguments),this},fired:function(){return!!i}};return p},b.extend({Deferred:function(e){var t=[["resolve","done",b.Callbacks("once memory"),"resolved"],["reject","fail",b.Callbacks("once memory"),"rejected"],["notify","progress",b.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return b.Deferred(function(n){b.each(t,function(t,o){var a=o[0],s=b.isFunction(e[t])&&e[t];i[o[1]](function(){var e=s&&s.apply(this,arguments);e&&b.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[a+"With"](this===r?n.promise():this,s?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?b.extend(e,r):r}},i={};return r.pipe=r.then,b.each(t,function(e,o){var a=o[2],s=o[3];r[o[1]]=a.add,s&&a.add(function(){n=s},t[1^e][2].disable,t[2][2].lock),i[o[0]]=function(){return i[o[0]+"With"](this===i?r:this,arguments),this},i[o[0]+"With"]=a.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=h.call(arguments),r=n.length,i=1!==r||e&&b.isFunction(e.promise)?r:0,o=1===i?e:b.Deferred(),a=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?h.call(arguments):r,n===s?o.notifyWith(t,n):--i||o.resolveWith(t,n)}},s,u,l;if(r>1)for(s=Array(r),u=Array(r),l=Array(r);r>t;t++)n[t]&&b.isFunction(n[t].promise)?n[t].promise().done(a(t,l,n)).fail(o.reject).progress(a(t,u,s)):--i;return i||o.resolveWith(l,n),o.promise()}}),b.support=function(){var t,n,r,a,s,u,l,c,p,f,d=o.createElement("div");if(d.setAttribute("className","t"),d.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",n=d.getElementsByTagName("*"),r=d.getElementsByTagName("a")[0],!n||!r||!n.length)return{};s=o.createElement("select"),l=s.appendChild(o.createElement("option")),a=d.getElementsByTagName("input")[0],r.style.cssText="top:1px;float:left;opacity:.5",t={getSetAttribute:"t"!==d.className,leadingWhitespace:3===d.firstChild.nodeType,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/top/.test(r.getAttribute("style")),hrefNormalized:"/a"===r.getAttribute("href"),opacity:/^0.5/.test(r.style.opacity),cssFloat:!!r.style.cssFloat,checkOn:!!a.value,optSelected:l.selected,enctype:!!o.createElement("form").enctype,html5Clone:"<:nav></:nav>"!==o.createElement("nav").cloneNode(!0).outerHTML,boxModel:"CSS1Compat"===o.compatMode,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},a.checked=!0,t.noCloneChecked=a.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!l.disabled;try{delete d.test}catch(h){t.deleteExpando=!1}a=o.createElement("input"),a.setAttribute("value",""),t.input=""===a.getAttribute("value"),a.value="t",a.setAttribute("type","radio"),t.radioValue="t"===a.value,a.setAttribute("checked","t"),a.setAttribute("name","t"),u=o.createDocumentFragment(),u.appendChild(a),t.appendChecked=a.checked,t.checkClone=u.cloneNode(!0).cloneNode(!0).lastChild.checked,d.attachEvent&&(d.attachEvent("onclick",function(){t.noCloneEvent=!1}),d.cloneNode(!0).click());for(f in{submit:!0,change:!0,focusin:!0})d.setAttribute(c="on"+f,"t"),t[f+"Bubbles"]=c in e||d.attributes[c].expando===!1;return d.style.backgroundClip="content-box",d.cloneNode(!0).style.backgroundClip="",t.clearCloneStyle="content-box"===d.style.backgroundClip,b(function(){var n,r,a,s="padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",u=o.getElementsByTagName("body")[0];u&&(n=o.createElement("div"),n.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",u.appendChild(n).appendChild(d),d.innerHTML="<table><tr><td></td><td>t</td></tr></table>",a=d.getElementsByTagName("td"),a[0].style.cssText="padding:0;margin:0;border:0;display:none",p=0===a[0].offsetHeight,a[0].style.display="",a[1].style.display="none",t.reliableHiddenOffsets=p&&0===a[0].offsetHeight,d.innerHTML="",d.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",t.boxSizing=4===d.offsetWidth,t.doesNotIncludeMarginInBodyOffset=1!==u.offsetTop,e.getComputedStyle&&(t.pixelPosition="1%"!==(e.getComputedStyle(d,null)||{}).top,t.boxSizingReliable="4px"===(e.getComputedStyle(d,null)||{width:"4px"}).width,r=d.appendChild(o.createElement("div")),r.style.cssText=d.style.cssText=s,r.style.marginRight=r.style.width="0",d.style.width="1px",t.reliableMarginRight=!parseFloat((e.getComputedStyle(r,null)||{}).marginRight)),typeof d.style.zoom!==i&&(d.innerHTML="",d.style.cssText=s+"width:1px;padding:1px;display:inline;zoom:1",t.inlineBlockNeedsLayout=3===d.offsetWidth,d.style.display="block",d.innerHTML="<div></div>",d.firstChild.style.width="5px",t.shrinkWrapBlocks=3!==d.offsetWidth,t.inlineBlockNeedsLayout&&(u.style.zoom=1)),u.removeChild(n),n=d=a=r=null)}),n=s=u=l=r=a=null,t}();var O=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,B=/([A-Z])/g;function P(e,n,r,i){if(b.acceptData(e)){var o,a,s=b.expando,u="string"==typeof n,l=e.nodeType,p=l?b.cache:e,f=l?e[s]:e[s]&&s;if(f&&p[f]&&(i||p[f].data)||!u||r!==t)return f||(l?e[s]=f=c.pop()||b.guid++:f=s),p[f]||(p[f]={},l||(p[f].toJSON=b.noop)),("object"==typeof n||"function"==typeof n)&&(i?p[f]=b.extend(p[f],n):p[f].data=b.extend(p[f].data,n)),o=p[f],i||(o.data||(o.data={}),o=o.data),r!==t&&(o[b.camelCase(n)]=r),u?(a=o[n],null==a&&(a=o[b.camelCase(n)])):a=o,a}}function R(e,t,n){if(b.acceptData(e)){var r,i,o,a=e.nodeType,s=a?b.cache:e,u=a?e[b.expando]:b.expando;if(s[u]){if(t&&(o=n?s[u]:s[u].data)){b.isArray(t)?t=t.concat(b.map(t,b.camelCase)):t in o?t=[t]:(t=b.camelCase(t),t=t in o?[t]:t.split(" "));for(r=0,i=t.length;i>r;r++)delete o[t[r]];if(!(n?$:b.isEmptyObject)(o))return}(n||(delete s[u].data,$(s[u])))&&(a?b.cleanData([e],!0):b.support.deleteExpando||s!=s.window?delete s[u]:s[u]=null)}}}b.extend({cache:{},expando:"jQuery"+(p+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(e){return e=e.nodeType?b.cache[e[b.expando]]:e[b.expando],!!e&&!$(e)},data:function(e,t,n){return P(e,t,n)},removeData:function(e,t){return R(e,t)},_data:function(e,t,n){return P(e,t,n,!0)},_removeData:function(e,t){return R(e,t,!0)},acceptData:function(e){if(e.nodeType&&1!==e.nodeType&&9!==e.nodeType)return!1;var t=e.nodeName&&b.noData[e.nodeName.toLowerCase()];return!t||t!==!0&&e.getAttribute("classid")===t}}),b.fn.extend({data:function(e,n){var r,i,o=this[0],a=0,s=null;if(e===t){if(this.length&&(s=b.data(o),1===o.nodeType&&!b._data(o,"parsedAttrs"))){for(r=o.attributes;r.length>a;a++)i=r[a].name,i.indexOf("data-")||(i=b.camelCase(i.slice(5)),W(o,i,s[i]));b._data(o,"parsedAttrs",!0)}return s}return"object"==typeof e?this.each(function(){b.data(this,e)}):b.access(this,function(n){return n===t?o?W(o,e,b.data(o,e)):null:(this.each(function(){b.data(this,e,n)}),t)},null,n,arguments.length>1,null,!0)},removeData:function(e){return this.each(function(){b.removeData(this,e)})}});function W(e,n,r){if(r===t&&1===e.nodeType){var i="data-"+n.replace(B,"-$1").toLowerCase();if(r=e.getAttribute(i),"string"==typeof r){try{r="true"===r?!0:"false"===r?!1:"null"===r?null:+r+""===r?+r:O.test(r)?b.parseJSON(r):r}catch(o){}b.data(e,n,r)}else r=t}return r}function $(e){var t;for(t in e)if(("data"!==t||!b.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}b.extend({queue:function(e,n,r){var i;return e?(n=(n||"fx")+"queue",i=b._data(e,n),r&&(!i||b.isArray(r)?i=b._data(e,n,b.makeArray(r)):i.push(r)),i||[]):t},dequeue:function(e,t){t=t||"fx";var n=b.queue(e,t),r=n.length,i=n.shift(),o=b._queueHooks(e,t),a=function(){b.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),o.cur=i,i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,a,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return b._data(e,n)||b._data(e,n,{empty:b.Callbacks("once memory").add(function(){b._removeData(e,t+"queue"),b._removeData(e,n)})})}}),b.fn.extend({queue:function(e,n){var r=2;return"string"!=typeof e&&(n=e,e="fx",r--),r>arguments.length?b.queue(this[0],e):n===t?this:this.each(function(){var t=b.queue(this,e,n);b._queueHooks(this,e),"fx"===e&&"inprogress"!==t[0]&&b.dequeue(this,e)})},dequeue:function(e){return this.each(function(){b.dequeue(this,e)})},delay:function(e,t){return e=b.fx?b.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,n){var r,i=1,o=b.Deferred(),a=this,s=this.length,u=function(){--i||o.resolveWith(a,[a])};"string"!=typeof e&&(n=e,e=t),e=e||"fx";while(s--)r=b._data(a[s],e+"queueHooks"),r&&r.empty&&(i++,r.empty.add(u));return u(),o.promise(n)}});var I,z,X=/[\t\r\n]/g,U=/\r/g,V=/^(?:input|select|textarea|button|object)$/i,Y=/^(?:a|area)$/i,J=/^(?:checked|selected|autofocus|autoplay|async|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped)$/i,G=/^(?:checked|selected)$/i,Q=b.support.getSetAttribute,K=b.support.input;b.fn.extend({attr:function(e,t){return b.access(this,b.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){b.removeAttr(this,e)})},prop:function(e,t){return b.access(this,b.prop,e,t,arguments.length>1)},removeProp:function(e){return e=b.propFix[e]||e,this.each(function(){try{this[e]=t,delete this[e]}catch(n){}})},addClass:function(e){var t,n,r,i,o,a=0,s=this.length,u="string"==typeof e&&e;if(b.isFunction(e))return this.each(function(t){b(this).addClass(e.call(this,t,this.className))});if(u)for(t=(e||"").match(w)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(X," "):" ")){o=0;while(i=t[o++])0>r.indexOf(" "+i+" ")&&(r+=i+" ");n.className=b.trim(r)}return this},removeClass:function(e){var t,n,r,i,o,a=0,s=this.length,u=0===arguments.length||"string"==typeof e&&e;if(b.isFunction(e))return this.each(function(t){b(this).removeClass(e.call(this,t,this.className))});if(u)for(t=(e||"").match(w)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(X," "):"")){o=0;while(i=t[o++])while(r.indexOf(" "+i+" ")>=0)r=r.replace(" "+i+" "," ");n.className=e?b.trim(r):""}return this},toggleClass:function(e,t){var n=typeof e,r="boolean"==typeof t;return b.isFunction(e)?this.each(function(n){b(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if("string"===n){var o,a=0,s=b(this),u=t,l=e.match(w)||[];while(o=l[a++])u=r?u:!s.hasClass(o),s[u?"addClass":"removeClass"](o)}else(n===i||"boolean"===n)&&(this.className&&b._data(this,"__className__",this.className),this.className=this.className||e===!1?"":b._data(this,"__className__")||"")})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;r>n;n++)if(1===this[n].nodeType&&(" "+this[n].className+" ").replace(X," ").indexOf(t)>=0)return!0;return!1},val:function(e){var n,r,i,o=this[0];{if(arguments.length)return i=b.isFunction(e),this.each(function(n){var o,a=b(this);1===this.nodeType&&(o=i?e.call(this,n,a.val()):e,null==o?o="":"number"==typeof o?o+="":b.isArray(o)&&(o=b.map(o,function(e){return null==e?"":e+""})),r=b.valHooks[this.type]||b.valHooks[this.nodeName.toLowerCase()],r&&"set"in r&&r.set(this,o,"value")!==t||(this.value=o))});if(o)return r=b.valHooks[o.type]||b.valHooks[o.nodeName.toLowerCase()],r&&"get"in r&&(n=r.get(o,"value"))!==t?n:(n=o.value,"string"==typeof n?n.replace(U,""):null==n?"":n)}}}),b.extend({valHooks:{option:{get:function(e){var t=e.attributes.value;return!t||t.specified?e.value:e.text}},select:{get:function(e){var t,n,r=e.options,i=e.selectedIndex,o="select-one"===e.type||0>i,a=o?null:[],s=o?i+1:r.length,u=0>i?s:o?i:0;for(;s>u;u++)if(n=r[u],!(!n.selected&&u!==i||(b.support.optDisabled?n.disabled:null!==n.getAttribute("disabled"))||n.parentNode.disabled&&b.nodeName(n.parentNode,"optgroup"))){if(t=b(n).val(),o)return t;a.push(t)}return a},set:function(e,t){var n=b.makeArray(t);return b(e).find("option").each(function(){this.selected=b.inArray(b(this).val(),n)>=0}),n.length||(e.selectedIndex=-1),n}}},attr:function(e,n,r){var o,a,s,u=e.nodeType;if(e&&3!==u&&8!==u&&2!==u)return typeof e.getAttribute===i?b.prop(e,n,r):(a=1!==u||!b.isXMLDoc(e),a&&(n=n.toLowerCase(),o=b.attrHooks[n]||(J.test(n)?z:I)),r===t?o&&a&&"get"in o&&null!==(s=o.get(e,n))?s:(typeof e.getAttribute!==i&&(s=e.getAttribute(n)),null==s?t:s):null!==r?o&&a&&"set"in o&&(s=o.set(e,r,n))!==t?s:(e.setAttribute(n,r+""),r):(b.removeAttr(e,n),t))},removeAttr:function(e,t){var n,r,i=0,o=t&&t.match(w);if(o&&1===e.nodeType)while(n=o[i++])r=b.propFix[n]||n,J.test(n)?!Q&&G.test(n)?e[b.camelCase("default-"+n)]=e[r]=!1:e[r]=!1:b.attr(e,n,""),e.removeAttribute(Q?n:r)},attrHooks:{type:{set:function(e,t){if(!b.support.radioValue&&"radio"===t&&b.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(e,n,r){var i,o,a,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return a=1!==s||!b.isXMLDoc(e),a&&(n=b.propFix[n]||n,o=b.propHooks[n]),r!==t?o&&"set"in o&&(i=o.set(e,r,n))!==t?i:e[n]=r:o&&"get"in o&&null!==(i=o.get(e,n))?i:e[n]},propHooks:{tabIndex:{get:function(e){var n=e.getAttributeNode("tabindex");return n&&n.specified?parseInt(n.value,10):V.test(e.nodeName)||Y.test(e.nodeName)&&e.href?0:t}}}}),z={get:function(e,n){var r=b.prop(e,n),i="boolean"==typeof r&&e.getAttribute(n),o="boolean"==typeof r?K&&Q?null!=i:G.test(n)?e[b.camelCase("default-"+n)]:!!i:e.getAttributeNode(n);return o&&o.value!==!1?n.toLowerCase():t},set:function(e,t,n){return t===!1?b.removeAttr(e,n):K&&Q||!G.test(n)?e.setAttribute(!Q&&b.propFix[n]||n,n):e[b.camelCase("default-"+n)]=e[n]=!0,n}},K&&Q||(b.attrHooks.value={get:function(e,n){var r=e.getAttributeNode(n);return b.nodeName(e,"input")?e.defaultValue:r&&r.specified?r.value:t},set:function(e,n,r){return b.nodeName(e,"input")?(e.defaultValue=n,t):I&&I.set(e,n,r)}}),Q||(I=b.valHooks.button={get:function(e,n){var r=e.getAttributeNode(n);return r&&("id"===n||"name"===n||"coords"===n?""!==r.value:r.specified)?r.value:t},set:function(e,n,r){var i=e.getAttributeNode(r);return i||e.setAttributeNode(i=e.ownerDocument.createAttribute(r)),i.value=n+="","value"===r||n===e.getAttribute(r)?n:t}},b.attrHooks.contenteditable={get:I.get,set:function(e,t,n){I.set(e,""===t?!1:t,n)}},b.each(["width","height"],function(e,n){b.attrHooks[n]=b.extend(b.attrHooks[n],{set:function(e,r){return""===r?(e.setAttribute(n,"auto"),r):t}})})),b.support.hrefNormalized||(b.each(["href","src","width","height"],function(e,n){b.attrHooks[n]=b.extend(b.attrHooks[n],{get:function(e){var r=e.getAttribute(n,2);return null==r?t:r}})}),b.each(["href","src"],function(e,t){b.propHooks[t]={get:function(e){return e.getAttribute(t,4)}}})),b.support.style||(b.attrHooks.style={get:function(e){return e.style.cssText||t},set:function(e,t){return e.style.cssText=t+""}}),b.support.optSelected||(b.propHooks.selected=b.extend(b.propHooks.selected,{get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}})),b.support.enctype||(b.propFix.enctype="encoding"),b.support.checkOn||b.each(["radio","checkbox"],function(){b.valHooks[this]={get:function(e){return null===e.getAttribute("value")?"on":e.value}}}),b.each(["radio","checkbox"],function(){b.valHooks[this]=b.extend(b.valHooks[this],{set:function(e,n){return b.isArray(n)?e.checked=b.inArray(b(e).val(),n)>=0:t}})});var Z=/^(?:input|select|textarea)$/i,et=/^key/,tt=/^(?:mouse|contextmenu)|click/,nt=/^(?:focusinfocus|focusoutblur)$/,rt=/^([^.]*)(?:\.(.+)|)$/;function it(){return!0}function ot(){return!1}b.event={global:{},add:function(e,n,r,o,a){var s,u,l,c,p,f,d,h,g,m,y,v=b._data(e);if(v){r.handler&&(c=r,r=c.handler,a=c.selector),r.guid||(r.guid=b.guid++),(u=v.events)||(u=v.events={}),(f=v.handle)||(f=v.handle=function(e){return typeof b===i||e&&b.event.triggered===e.type?t:b.event.dispatch.apply(f.elem,arguments)},f.elem=e),n=(n||"").match(w)||[""],l=n.length;while(l--)s=rt.exec(n[l])||[],g=y=s[1],m=(s[2]||"").split(".").sort(),p=b.event.special[g]||{},g=(a?p.delegateType:p.bindType)||g,p=b.event.special[g]||{},d=b.extend({type:g,origType:y,data:o,handler:r,guid:r.guid,selector:a,needsContext:a&&b.expr.match.needsContext.test(a),namespace:m.join(".")},c),(h=u[g])||(h=u[g]=[],h.delegateCount=0,p.setup&&p.setup.call(e,o,m,f)!==!1||(e.addEventListener?e.addEventListener(g,f,!1):e.attachEvent&&e.attachEvent("on"+g,f))),p.add&&(p.add.call(e,d),d.handler.guid||(d.handler.guid=r.guid)),a?h.splice(h.delegateCount++,0,d):h.push(d),b.event.global[g]=!0;e=null}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,p,f,d,h,g,m=b.hasData(e)&&b._data(e);if(m&&(c=m.events)){t=(t||"").match(w)||[""],l=t.length;while(l--)if(s=rt.exec(t[l])||[],d=g=s[1],h=(s[2]||"").split(".").sort(),d){p=b.event.special[d]||{},d=(r?p.delegateType:p.bindType)||d,f=c[d]||[],s=s[2]&&RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),u=o=f.length;while(o--)a=f[o],!i&&g!==a.origType||n&&n.guid!==a.guid||s&&!s.test(a.namespace)||r&&r!==a.selector&&("**"!==r||!a.selector)||(f.splice(o,1),a.selector&&f.delegateCount--,p.remove&&p.remove.call(e,a));u&&!f.length&&(p.teardown&&p.teardown.call(e,h,m.handle)!==!1||b.removeEvent(e,d,m.handle),delete c[d])}else for(d in c)b.event.remove(e,d+t[l],n,r,!0);b.isEmptyObject(c)&&(delete m.handle,b._removeData(e,"events"))}},trigger:function(n,r,i,a){var s,u,l,c,p,f,d,h=[i||o],g=y.call(n,"type")?n.type:n,m=y.call(n,"namespace")?n.namespace.split("."):[];if(l=f=i=i||o,3!==i.nodeType&&8!==i.nodeType&&!nt.test(g+b.event.triggered)&&(g.indexOf(".")>=0&&(m=g.split("."),g=m.shift(),m.sort()),u=0>g.indexOf(":")&&"on"+g,n=n[b.expando]?n:new b.Event(g,"object"==typeof n&&n),n.isTrigger=!0,n.namespace=m.join("."),n.namespace_re=n.namespace?RegExp("(^|\\.)"+m.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,n.result=t,n.target||(n.target=i),r=null==r?[n]:b.makeArray(r,[n]),p=b.event.special[g]||{},a||!p.trigger||p.trigger.apply(i,r)!==!1)){if(!a&&!p.noBubble&&!b.isWindow(i)){for(c=p.delegateType||g,nt.test(c+g)||(l=l.parentNode);l;l=l.parentNode)h.push(l),f=l;f===(i.ownerDocument||o)&&h.push(f.defaultView||f.parentWindow||e)}d=0;while((l=h[d++])&&!n.isPropagationStopped())n.type=d>1?c:p.bindType||g,s=(b._data(l,"events")||{})[n.type]&&b._data(l,"handle"),s&&s.apply(l,r),s=u&&l[u],s&&b.acceptData(l)&&s.apply&&s.apply(l,r)===!1&&n.preventDefault();if(n.type=g,!(a||n.isDefaultPrevented()||p._default&&p._default.apply(i.ownerDocument,r)!==!1||"click"===g&&b.nodeName(i,"a")||!b.acceptData(i)||!u||!i[g]||b.isWindow(i))){f=i[u],f&&(i[u]=null),b.event.triggered=g;try{i[g]()}catch(v){}b.event.triggered=t,f&&(i[u]=f)}return n.result}},dispatch:function(e){e=b.event.fix(e);var n,r,i,o,a,s=[],u=h.call(arguments),l=(b._data(this,"events")||{})[e.type]||[],c=b.event.special[e.type]||{};if(u[0]=e,e.delegateTarget=this,!c.preDispatch||c.preDispatch.call(this,e)!==!1){s=b.event.handlers.call(this,e,l),n=0;while((o=s[n++])&&!e.isPropagationStopped()){e.currentTarget=o.elem,a=0;while((i=o.handlers[a++])&&!e.isImmediatePropagationStopped())(!e.namespace_re||e.namespace_re.test(i.namespace))&&(e.handleObj=i,e.data=i.data,r=((b.event.special[i.origType]||{}).handle||i.handler).apply(o.elem,u),r!==t&&(e.result=r)===!1&&(e.preventDefault(),e.stopPropagation()))}return c.postDispatch&&c.postDispatch.call(this,e),e.result}},handlers:function(e,n){var r,i,o,a,s=[],u=n.delegateCount,l=e.target;if(u&&l.nodeType&&(!e.button||"click"!==e.type))for(;l!=this;l=l.parentNode||this)if(1===l.nodeType&&(l.disabled!==!0||"click"!==e.type)){for(o=[],a=0;u>a;a++)i=n[a],r=i.selector+" ",o[r]===t&&(o[r]=i.needsContext?b(r,this).index(l)>=0:b.find(r,this,null,[l]).length),o[r]&&o.push(i);o.length&&s.push({elem:l,handlers:o})}return n.length>u&&s.push({elem:this,handlers:n.slice(u)}),s},fix:function(e){if(e[b.expando])return e;var t,n,r,i=e.type,a=e,s=this.fixHooks[i];s||(this.fixHooks[i]=s=tt.test(i)?this.mouseHooks:et.test(i)?this.keyHooks:{}),r=s.props?this.props.concat(s.props):this.props,e=new b.Event(a),t=r.length;while(t--)n=r[t],e[n]=a[n];return e.target||(e.target=a.srcElement||o),3===e.target.nodeType&&(e.target=e.target.parentNode),e.metaKey=!!e.metaKey,s.filter?s.filter(e,a):e},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return null==e.which&&(e.which=null!=t.charCode?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,n){var r,i,a,s=n.button,u=n.fromElement;return null==e.pageX&&null!=n.clientX&&(i=e.target.ownerDocument||o,a=i.documentElement,r=i.body,e.pageX=n.clientX+(a&&a.scrollLeft||r&&r.scrollLeft||0)-(a&&a.clientLeft||r&&r.clientLeft||0),e.pageY=n.clientY+(a&&a.scrollTop||r&&r.scrollTop||0)-(a&&a.clientTop||r&&r.clientTop||0)),!e.relatedTarget&&u&&(e.relatedTarget=u===e.target?n.toElement:u),e.which||s===t||(e.which=1&s?1:2&s?3:4&s?2:0),e}},special:{load:{noBubble:!0},click:{trigger:function(){return b.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):t}},focus:{trigger:function(){if(this!==o.activeElement&&this.focus)try{return this.focus(),!1}catch(e){}},delegateType:"focusin"},blur:{trigger:function(){return this===o.activeElement&&this.blur?(this.blur(),!1):t},delegateType:"focusout"},beforeunload:{postDispatch:function(e){e.result!==t&&(e.originalEvent.returnValue=e.result)}}},simulate:function(e,t,n,r){var i=b.extend(new b.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?b.event.trigger(i,null,t):b.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},b.removeEvent=o.removeEventListener?function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)}:function(e,t,n){var r="on"+t;e.detachEvent&&(typeof e[r]===i&&(e[r]=null),e.detachEvent(r,n))},b.Event=function(e,n){return this instanceof b.Event?(e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.returnValue===!1||e.getPreventDefault&&e.getPreventDefault()?it:ot):this.type=e,n&&b.extend(this,n),this.timeStamp=e&&e.timeStamp||b.now(),this[b.expando]=!0,t):new b.Event(e,n)},b.Event.prototype={isDefaultPrevented:ot,isPropagationStopped:ot,isImmediatePropagationStopped:ot,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=it,e&&(e.preventDefault?e.preventDefault():e.returnValue=!1)},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=it,e&&(e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=it,this.stopPropagation()}},b.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){b.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,o=e.handleObj;
return(!i||i!==r&&!b.contains(r,i))&&(e.type=o.origType,n=o.handler.apply(this,arguments),e.type=t),n}}}),b.support.submitBubbles||(b.event.special.submit={setup:function(){return b.nodeName(this,"form")?!1:(b.event.add(this,"click._submit keypress._submit",function(e){var n=e.target,r=b.nodeName(n,"input")||b.nodeName(n,"button")?n.form:t;r&&!b._data(r,"submitBubbles")&&(b.event.add(r,"submit._submit",function(e){e._submit_bubble=!0}),b._data(r,"submitBubbles",!0))}),t)},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&b.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){return b.nodeName(this,"form")?!1:(b.event.remove(this,"._submit"),t)}}),b.support.changeBubbles||(b.event.special.change={setup:function(){return Z.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(b.event.add(this,"propertychange._change",function(e){"checked"===e.originalEvent.propertyName&&(this._just_changed=!0)}),b.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1),b.event.simulate("change",this,e,!0)})),!1):(b.event.add(this,"beforeactivate._change",function(e){var t=e.target;Z.test(t.nodeName)&&!b._data(t,"changeBubbles")&&(b.event.add(t,"change._change",function(e){!this.parentNode||e.isSimulated||e.isTrigger||b.event.simulate("change",this.parentNode,e,!0)}),b._data(t,"changeBubbles",!0))}),t)},handle:function(e){var n=e.target;return this!==n||e.isSimulated||e.isTrigger||"radio"!==n.type&&"checkbox"!==n.type?e.handleObj.handler.apply(this,arguments):t},teardown:function(){return b.event.remove(this,"._change"),!Z.test(this.nodeName)}}),b.support.focusinBubbles||b.each({focus:"focusin",blur:"focusout"},function(e,t){var n=0,r=function(e){b.event.simulate(t,e.target,b.event.fix(e),!0)};b.event.special[t]={setup:function(){0===n++&&o.addEventListener(e,r,!0)},teardown:function(){0===--n&&o.removeEventListener(e,r,!0)}}}),b.fn.extend({on:function(e,n,r,i,o){var a,s;if("object"==typeof e){"string"!=typeof n&&(r=r||n,n=t);for(a in e)this.on(a,n,r,e[a],o);return this}if(null==r&&null==i?(i=n,r=n=t):null==i&&("string"==typeof n?(i=r,r=t):(i=r,r=n,n=t)),i===!1)i=ot;else if(!i)return this;return 1===o&&(s=i,i=function(e){return b().off(e),s.apply(this,arguments)},i.guid=s.guid||(s.guid=b.guid++)),this.each(function(){b.event.add(this,e,i,r,n)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,n,r){var i,o;if(e&&e.preventDefault&&e.handleObj)return i=e.handleObj,b(e.delegateTarget).off(i.namespace?i.origType+"."+i.namespace:i.origType,i.selector,i.handler),this;if("object"==typeof e){for(o in e)this.off(o,n,e[o]);return this}return(n===!1||"function"==typeof n)&&(r=n,n=t),r===!1&&(r=ot),this.each(function(){b.event.remove(this,e,r,n)})},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},trigger:function(e,t){return this.each(function(){b.event.trigger(e,t,this)})},triggerHandler:function(e,n){var r=this[0];return r?b.event.trigger(e,n,r,!0):t}}),function(e,t){var n,r,i,o,a,s,u,l,c,p,f,d,h,g,m,y,v,x="sizzle"+-new Date,w=e.document,T={},N=0,C=0,k=it(),E=it(),S=it(),A=typeof t,j=1<<31,D=[],L=D.pop,H=D.push,q=D.slice,M=D.indexOf||function(e){var t=0,n=this.length;for(;n>t;t++)if(this[t]===e)return t;return-1},_="[\\x20\\t\\r\\n\\f]",F="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",O=F.replace("w","w#"),B="([*^$|!~]?=)",P="\\["+_+"*("+F+")"+_+"*(?:"+B+_+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+O+")|)|)"+_+"*\\]",R=":("+F+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+P.replace(3,8)+")*)|.*)\\)|)",W=RegExp("^"+_+"+|((?:^|[^\\\\])(?:\\\\.)*)"+_+"+$","g"),$=RegExp("^"+_+"*,"+_+"*"),I=RegExp("^"+_+"*([\\x20\\t\\r\\n\\f>+~])"+_+"*"),z=RegExp(R),X=RegExp("^"+O+"$"),U={ID:RegExp("^#("+F+")"),CLASS:RegExp("^\\.("+F+")"),NAME:RegExp("^\\[name=['\"]?("+F+")['\"]?\\]"),TAG:RegExp("^("+F.replace("w","w*")+")"),ATTR:RegExp("^"+P),PSEUDO:RegExp("^"+R),CHILD:RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+_+"*(even|odd|(([+-]|)(\\d*)n|)"+_+"*(?:([+-]|)"+_+"*(\\d+)|))"+_+"*\\)|)","i"),needsContext:RegExp("^"+_+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+_+"*((?:-\\d)?\\d*)"+_+"*\\)|)(?=[^-]|$)","i")},V=/[\x20\t\r\n\f]*[+~]/,Y=/^[^{]+\{\s*\[native code/,J=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,G=/^(?:input|select|textarea|button)$/i,Q=/^h\d$/i,K=/'|\\/g,Z=/\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,et=/\\([\da-fA-F]{1,6}[\x20\t\r\n\f]?|.)/g,tt=function(e,t){var n="0x"+t-65536;return n!==n?t:0>n?String.fromCharCode(n+65536):String.fromCharCode(55296|n>>10,56320|1023&n)};try{q.call(w.documentElement.childNodes,0)[0].nodeType}catch(nt){q=function(e){var t,n=[];while(t=this[e++])n.push(t);return n}}function rt(e){return Y.test(e+"")}function it(){var e,t=[];return e=function(n,r){return t.push(n+=" ")>i.cacheLength&&delete e[t.shift()],e[n]=r}}function ot(e){return e[x]=!0,e}function at(e){var t=p.createElement("div");try{return e(t)}catch(n){return!1}finally{t=null}}function st(e,t,n,r){var i,o,a,s,u,l,f,g,m,v;if((t?t.ownerDocument||t:w)!==p&&c(t),t=t||p,n=n||[],!e||"string"!=typeof e)return n;if(1!==(s=t.nodeType)&&9!==s)return[];if(!d&&!r){if(i=J.exec(e))if(a=i[1]){if(9===s){if(o=t.getElementById(a),!o||!o.parentNode)return n;if(o.id===a)return n.push(o),n}else if(t.ownerDocument&&(o=t.ownerDocument.getElementById(a))&&y(t,o)&&o.id===a)return n.push(o),n}else{if(i[2])return H.apply(n,q.call(t.getElementsByTagName(e),0)),n;if((a=i[3])&&T.getByClassName&&t.getElementsByClassName)return H.apply(n,q.call(t.getElementsByClassName(a),0)),n}if(T.qsa&&!h.test(e)){if(f=!0,g=x,m=t,v=9===s&&e,1===s&&"object"!==t.nodeName.toLowerCase()){l=ft(e),(f=t.getAttribute("id"))?g=f.replace(K,"\\$&"):t.setAttribute("id",g),g="[id='"+g+"'] ",u=l.length;while(u--)l[u]=g+dt(l[u]);m=V.test(e)&&t.parentNode||t,v=l.join(",")}if(v)try{return H.apply(n,q.call(m.querySelectorAll(v),0)),n}catch(b){}finally{f||t.removeAttribute("id")}}}return wt(e.replace(W,"$1"),t,n,r)}a=st.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?"HTML"!==t.nodeName:!1},c=st.setDocument=function(e){var n=e?e.ownerDocument||e:w;return n!==p&&9===n.nodeType&&n.documentElement?(p=n,f=n.documentElement,d=a(n),T.tagNameNoComments=at(function(e){return e.appendChild(n.createComment("")),!e.getElementsByTagName("*").length}),T.attributes=at(function(e){e.innerHTML="<select></select>";var t=typeof e.lastChild.getAttribute("multiple");return"boolean"!==t&&"string"!==t}),T.getByClassName=at(function(e){return e.innerHTML="<div class='hidden e'></div><div class='hidden'></div>",e.getElementsByClassName&&e.getElementsByClassName("e").length?(e.lastChild.className="e",2===e.getElementsByClassName("e").length):!1}),T.getByName=at(function(e){e.id=x+0,e.innerHTML="<a name='"+x+"'></a><div name='"+x+"'></div>",f.insertBefore(e,f.firstChild);var t=n.getElementsByName&&n.getElementsByName(x).length===2+n.getElementsByName(x+0).length;return T.getIdNotName=!n.getElementById(x),f.removeChild(e),t}),i.attrHandle=at(function(e){return e.innerHTML="<a href='#'></a>",e.firstChild&&typeof e.firstChild.getAttribute!==A&&"#"===e.firstChild.getAttribute("href")})?{}:{href:function(e){return e.getAttribute("href",2)},type:function(e){return e.getAttribute("type")}},T.getIdNotName?(i.find.ID=function(e,t){if(typeof t.getElementById!==A&&!d){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},i.filter.ID=function(e){var t=e.replace(et,tt);return function(e){return e.getAttribute("id")===t}}):(i.find.ID=function(e,n){if(typeof n.getElementById!==A&&!d){var r=n.getElementById(e);return r?r.id===e||typeof r.getAttributeNode!==A&&r.getAttributeNode("id").value===e?[r]:t:[]}},i.filter.ID=function(e){var t=e.replace(et,tt);return function(e){var n=typeof e.getAttributeNode!==A&&e.getAttributeNode("id");return n&&n.value===t}}),i.find.TAG=T.tagNameNoComments?function(e,n){return typeof n.getElementsByTagName!==A?n.getElementsByTagName(e):t}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},i.find.NAME=T.getByName&&function(e,n){return typeof n.getElementsByName!==A?n.getElementsByName(name):t},i.find.CLASS=T.getByClassName&&function(e,n){return typeof n.getElementsByClassName===A||d?t:n.getElementsByClassName(e)},g=[],h=[":focus"],(T.qsa=rt(n.querySelectorAll))&&(at(function(e){e.innerHTML="<select><option selected=''></option></select>",e.querySelectorAll("[selected]").length||h.push("\\["+_+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),e.querySelectorAll(":checked").length||h.push(":checked")}),at(function(e){e.innerHTML="<input type='hidden' i=''/>",e.querySelectorAll("[i^='']").length&&h.push("[*^$]="+_+"*(?:\"\"|'')"),e.querySelectorAll(":enabled").length||h.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),h.push(",.*:")})),(T.matchesSelector=rt(m=f.matchesSelector||f.mozMatchesSelector||f.webkitMatchesSelector||f.oMatchesSelector||f.msMatchesSelector))&&at(function(e){T.disconnectedMatch=m.call(e,"div"),m.call(e,"[s!='']:x"),g.push("!=",R)}),h=RegExp(h.join("|")),g=RegExp(g.join("|")),y=rt(f.contains)||f.compareDocumentPosition?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},v=f.compareDocumentPosition?function(e,t){var r;return e===t?(u=!0,0):(r=t.compareDocumentPosition&&e.compareDocumentPosition&&e.compareDocumentPosition(t))?1&r||e.parentNode&&11===e.parentNode.nodeType?e===n||y(w,e)?-1:t===n||y(w,t)?1:0:4&r?-1:1:e.compareDocumentPosition?-1:1}:function(e,t){var r,i=0,o=e.parentNode,a=t.parentNode,s=[e],l=[t];if(e===t)return u=!0,0;if(!o||!a)return e===n?-1:t===n?1:o?-1:a?1:0;if(o===a)return ut(e,t);r=e;while(r=r.parentNode)s.unshift(r);r=t;while(r=r.parentNode)l.unshift(r);while(s[i]===l[i])i++;return i?ut(s[i],l[i]):s[i]===w?-1:l[i]===w?1:0},u=!1,[0,0].sort(v),T.detectDuplicates=u,p):p},st.matches=function(e,t){return st(e,null,null,t)},st.matchesSelector=function(e,t){if((e.ownerDocument||e)!==p&&c(e),t=t.replace(Z,"='$1']"),!(!T.matchesSelector||d||g&&g.test(t)||h.test(t)))try{var n=m.call(e,t);if(n||T.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(r){}return st(t,p,null,[e]).length>0},st.contains=function(e,t){return(e.ownerDocument||e)!==p&&c(e),y(e,t)},st.attr=function(e,t){var n;return(e.ownerDocument||e)!==p&&c(e),d||(t=t.toLowerCase()),(n=i.attrHandle[t])?n(e):d||T.attributes?e.getAttribute(t):((n=e.getAttributeNode(t))||e.getAttribute(t))&&e[t]===!0?t:n&&n.specified?n.value:null},st.error=function(e){throw Error("Syntax error, unrecognized expression: "+e)},st.uniqueSort=function(e){var t,n=[],r=1,i=0;if(u=!T.detectDuplicates,e.sort(v),u){for(;t=e[r];r++)t===e[r-1]&&(i=n.push(r));while(i--)e.splice(n[i],1)}return e};function ut(e,t){var n=t&&e,r=n&&(~t.sourceIndex||j)-(~e.sourceIndex||j);if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function lt(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function ct(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function pt(e){return ot(function(t){return t=+t,ot(function(n,r){var i,o=e([],n.length,t),a=o.length;while(a--)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))})})}o=st.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=o(e)}else if(3===i||4===i)return e.nodeValue}else for(;t=e[r];r++)n+=o(t);return n},i=st.selectors={cacheLength:50,createPseudo:ot,match:U,find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(et,tt),e[3]=(e[4]||e[5]||"").replace(et,tt),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||st.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&st.error(e[0]),e},PSEUDO:function(e){var t,n=!e[5]&&e[2];return U.CHILD.test(e[0])?null:(e[4]?e[2]=e[4]:n&&z.test(n)&&(t=ft(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){return"*"===e?function(){return!0}:(e=e.replace(et,tt).toLowerCase(),function(t){return t.nodeName&&t.nodeName.toLowerCase()===e})},CLASS:function(e){var t=k[e+" "];return t||(t=RegExp("(^|"+_+")"+e+"("+_+"|$)"))&&k(e,function(e){return t.test(e.className||typeof e.getAttribute!==A&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=st.attr(r,e);return null==i?"!="===t:t?(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i+" ").indexOf(n)>-1:"|="===t?i===n||i.slice(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,u){var l,c,p,f,d,h,g=o!==a?"nextSibling":"previousSibling",m=t.parentNode,y=s&&t.nodeName.toLowerCase(),v=!u&&!s;if(m){if(o){while(g){p=t;while(p=p[g])if(s?p.nodeName.toLowerCase()===y:1===p.nodeType)return!1;h=g="only"===e&&!h&&"nextSibling"}return!0}if(h=[a?m.firstChild:m.lastChild],a&&v){c=m[x]||(m[x]={}),l=c[e]||[],d=l[0]===N&&l[1],f=l[0]===N&&l[2],p=d&&m.childNodes[d];while(p=++d&&p&&p[g]||(f=d=0)||h.pop())if(1===p.nodeType&&++f&&p===t){c[e]=[N,d,f];break}}else if(v&&(l=(t[x]||(t[x]={}))[e])&&l[0]===N)f=l[1];else while(p=++d&&p&&p[g]||(f=d=0)||h.pop())if((s?p.nodeName.toLowerCase()===y:1===p.nodeType)&&++f&&(v&&((p[x]||(p[x]={}))[e]=[N,f]),p===t))break;return f-=i,f===r||0===f%r&&f/r>=0}}},PSEUDO:function(e,t){var n,r=i.pseudos[e]||i.setFilters[e.toLowerCase()]||st.error("unsupported pseudo: "+e);return r[x]?r(t):r.length>1?(n=[e,e,"",t],i.setFilters.hasOwnProperty(e.toLowerCase())?ot(function(e,n){var i,o=r(e,t),a=o.length;while(a--)i=M.call(e,o[a]),e[i]=!(n[i]=o[a])}):function(e){return r(e,0,n)}):r}},pseudos:{not:ot(function(e){var t=[],n=[],r=s(e.replace(W,"$1"));return r[x]?ot(function(e,t,n,i){var o,a=r(e,null,i,[]),s=e.length;while(s--)(o=a[s])&&(e[s]=!(t[s]=o))}):function(e,i,o){return t[0]=e,r(t,null,o,n),!n.pop()}}),has:ot(function(e){return function(t){return st(e,t).length>0}}),contains:ot(function(e){return function(t){return(t.textContent||t.innerText||o(t)).indexOf(e)>-1}}),lang:ot(function(e){return X.test(e||"")||st.error("unsupported lang: "+e),e=e.replace(et,tt).toLowerCase(),function(t){var n;do if(n=d?t.getAttribute("xml:lang")||t.getAttribute("lang"):t.lang)return n=n.toLowerCase(),n===e||0===n.indexOf(e+"-");while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===f},focus:function(e){return e===p.activeElement&&(!p.hasFocus||p.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeName>"@"||3===e.nodeType||4===e.nodeType)return!1;return!0},parent:function(e){return!i.pseudos.empty(e)},header:function(e){return Q.test(e.nodeName)},input:function(e){return G.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||t.toLowerCase()===e.type)},first:pt(function(){return[0]}),last:pt(function(e,t){return[t-1]}),eq:pt(function(e,t,n){return[0>n?n+t:n]}),even:pt(function(e,t){var n=0;for(;t>n;n+=2)e.push(n);return e}),odd:pt(function(e,t){var n=1;for(;t>n;n+=2)e.push(n);return e}),lt:pt(function(e,t,n){var r=0>n?n+t:n;for(;--r>=0;)e.push(r);return e}),gt:pt(function(e,t,n){var r=0>n?n+t:n;for(;t>++r;)e.push(r);return e})}};for(n in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})i.pseudos[n]=lt(n);for(n in{submit:!0,reset:!0})i.pseudos[n]=ct(n);function ft(e,t){var n,r,o,a,s,u,l,c=E[e+" "];if(c)return t?0:c.slice(0);s=e,u=[],l=i.preFilter;while(s){(!n||(r=$.exec(s)))&&(r&&(s=s.slice(r[0].length)||s),u.push(o=[])),n=!1,(r=I.exec(s))&&(n=r.shift(),o.push({value:n,type:r[0].replace(W," ")}),s=s.slice(n.length));for(a in i.filter)!(r=U[a].exec(s))||l[a]&&!(r=l[a](r))||(n=r.shift(),o.push({value:n,type:a,matches:r}),s=s.slice(n.length));if(!n)break}return t?s.length:s?st.error(e):E(e,u).slice(0)}function dt(e){var t=0,n=e.length,r="";for(;n>t;t++)r+=e[t].value;return r}function ht(e,t,n){var i=t.dir,o=n&&"parentNode"===i,a=C++;return t.first?function(t,n,r){while(t=t[i])if(1===t.nodeType||o)return e(t,n,r)}:function(t,n,s){var u,l,c,p=N+" "+a;if(s){while(t=t[i])if((1===t.nodeType||o)&&e(t,n,s))return!0}else while(t=t[i])if(1===t.nodeType||o)if(c=t[x]||(t[x]={}),(l=c[i])&&l[0]===p){if((u=l[1])===!0||u===r)return u===!0}else if(l=c[i]=[p],l[1]=e(t,n,s)||r,l[1]===!0)return!0}}function gt(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function mt(e,t,n,r,i){var o,a=[],s=0,u=e.length,l=null!=t;for(;u>s;s++)(o=e[s])&&(!n||n(o,r,i))&&(a.push(o),l&&t.push(s));return a}function yt(e,t,n,r,i,o){return r&&!r[x]&&(r=yt(r)),i&&!i[x]&&(i=yt(i,o)),ot(function(o,a,s,u){var l,c,p,f=[],d=[],h=a.length,g=o||xt(t||"*",s.nodeType?[s]:s,[]),m=!e||!o&&t?g:mt(g,f,e,s,u),y=n?i||(o?e:h||r)?[]:a:m;if(n&&n(m,y,s,u),r){l=mt(y,d),r(l,[],s,u),c=l.length;while(c--)(p=l[c])&&(y[d[c]]=!(m[d[c]]=p))}if(o){if(i||e){if(i){l=[],c=y.length;while(c--)(p=y[c])&&l.push(m[c]=p);i(null,y=[],l,u)}c=y.length;while(c--)(p=y[c])&&(l=i?M.call(o,p):f[c])>-1&&(o[l]=!(a[l]=p))}}else y=mt(y===a?y.splice(h,y.length):y),i?i(null,a,y,u):H.apply(a,y)})}function vt(e){var t,n,r,o=e.length,a=i.relative[e[0].type],s=a||i.relative[" "],u=a?1:0,c=ht(function(e){return e===t},s,!0),p=ht(function(e){return M.call(t,e)>-1},s,!0),f=[function(e,n,r){return!a&&(r||n!==l)||((t=n).nodeType?c(e,n,r):p(e,n,r))}];for(;o>u;u++)if(n=i.relative[e[u].type])f=[ht(gt(f),n)];else{if(n=i.filter[e[u].type].apply(null,e[u].matches),n[x]){for(r=++u;o>r;r++)if(i.relative[e[r].type])break;return yt(u>1&>(f),u>1&&dt(e.slice(0,u-1)).replace(W,"$1"),n,r>u&&vt(e.slice(u,r)),o>r&&vt(e=e.slice(r)),o>r&&dt(e))}f.push(n)}return gt(f)}function bt(e,t){var n=0,o=t.length>0,a=e.length>0,s=function(s,u,c,f,d){var h,g,m,y=[],v=0,b="0",x=s&&[],w=null!=d,T=l,C=s||a&&i.find.TAG("*",d&&u.parentNode||u),k=N+=null==T?1:Math.random()||.1;for(w&&(l=u!==p&&u,r=n);null!=(h=C[b]);b++){if(a&&h){g=0;while(m=e[g++])if(m(h,u,c)){f.push(h);break}w&&(N=k,r=++n)}o&&((h=!m&&h)&&v--,s&&x.push(h))}if(v+=b,o&&b!==v){g=0;while(m=t[g++])m(x,y,u,c);if(s){if(v>0)while(b--)x[b]||y[b]||(y[b]=L.call(f));y=mt(y)}H.apply(f,y),w&&!s&&y.length>0&&v+t.length>1&&st.uniqueSort(f)}return w&&(N=k,l=T),x};return o?ot(s):s}s=st.compile=function(e,t){var n,r=[],i=[],o=S[e+" "];if(!o){t||(t=ft(e)),n=t.length;while(n--)o=vt(t[n]),o[x]?r.push(o):i.push(o);o=S(e,bt(i,r))}return o};function xt(e,t,n){var r=0,i=t.length;for(;i>r;r++)st(e,t[r],n);return n}function wt(e,t,n,r){var o,a,u,l,c,p=ft(e);if(!r&&1===p.length){if(a=p[0]=p[0].slice(0),a.length>2&&"ID"===(u=a[0]).type&&9===t.nodeType&&!d&&i.relative[a[1].type]){if(t=i.find.ID(u.matches[0].replace(et,tt),t)[0],!t)return n;e=e.slice(a.shift().value.length)}o=U.needsContext.test(e)?0:a.length;while(o--){if(u=a[o],i.relative[l=u.type])break;if((c=i.find[l])&&(r=c(u.matches[0].replace(et,tt),V.test(a[0].type)&&t.parentNode||t))){if(a.splice(o,1),e=r.length&&dt(a),!e)return H.apply(n,q.call(r,0)),n;break}}}return s(e,p)(r,t,d,n,V.test(e)),n}i.pseudos.nth=i.pseudos.eq;function Tt(){}i.filters=Tt.prototype=i.pseudos,i.setFilters=new Tt,c(),st.attr=b.attr,b.find=st,b.expr=st.selectors,b.expr[":"]=b.expr.pseudos,b.unique=st.uniqueSort,b.text=st.getText,b.isXMLDoc=st.isXML,b.contains=st.contains}(e);var at=/Until$/,st=/^(?:parents|prev(?:Until|All))/,ut=/^.[^:#\[\.,]*$/,lt=b.expr.match.needsContext,ct={children:!0,contents:!0,next:!0,prev:!0};b.fn.extend({find:function(e){var t,n,r,i=this.length;if("string"!=typeof e)return r=this,this.pushStack(b(e).filter(function(){for(t=0;i>t;t++)if(b.contains(r[t],this))return!0}));for(n=[],t=0;i>t;t++)b.find(e,this[t],n);return n=this.pushStack(i>1?b.unique(n):n),n.selector=(this.selector?this.selector+" ":"")+e,n},has:function(e){var t,n=b(e,this),r=n.length;return this.filter(function(){for(t=0;r>t;t++)if(b.contains(this,n[t]))return!0})},not:function(e){return this.pushStack(ft(this,e,!1))},filter:function(e){return this.pushStack(ft(this,e,!0))},is:function(e){return!!e&&("string"==typeof e?lt.test(e)?b(e,this.context).index(this[0])>=0:b.filter(e,this).length>0:this.filter(e).length>0)},closest:function(e,t){var n,r=0,i=this.length,o=[],a=lt.test(e)||"string"!=typeof e?b(e,t||this.context):0;for(;i>r;r++){n=this[r];while(n&&n.ownerDocument&&n!==t&&11!==n.nodeType){if(a?a.index(n)>-1:b.find.matchesSelector(n,e)){o.push(n);break}n=n.parentNode}}return this.pushStack(o.length>1?b.unique(o):o)},index:function(e){return e?"string"==typeof e?b.inArray(this[0],b(e)):b.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){var n="string"==typeof e?b(e,t):b.makeArray(e&&e.nodeType?[e]:e),r=b.merge(this.get(),n);return this.pushStack(b.unique(r))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),b.fn.andSelf=b.fn.addBack;function pt(e,t){do e=e[t];while(e&&1!==e.nodeType);return e}b.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return b.dir(e,"parentNode")},parentsUntil:function(e,t,n){return b.dir(e,"parentNode",n)},next:function(e){return pt(e,"nextSibling")},prev:function(e){return pt(e,"previousSibling")},nextAll:function(e){return b.dir(e,"nextSibling")},prevAll:function(e){return b.dir(e,"previousSibling")},nextUntil:function(e,t,n){return b.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return b.dir(e,"previousSibling",n)},siblings:function(e){return b.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return b.sibling(e.firstChild)},contents:function(e){return b.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:b.merge([],e.childNodes)}},function(e,t){b.fn[e]=function(n,r){var i=b.map(this,t,n);return at.test(e)||(r=n),r&&"string"==typeof r&&(i=b.filter(r,i)),i=this.length>1&&!ct[e]?b.unique(i):i,this.length>1&&st.test(e)&&(i=i.reverse()),this.pushStack(i)}}),b.extend({filter:function(e,t,n){return n&&(e=":not("+e+")"),1===t.length?b.find.matchesSelector(t[0],e)?[t[0]]:[]:b.find.matches(e,t)},dir:function(e,n,r){var i=[],o=e[n];while(o&&9!==o.nodeType&&(r===t||1!==o.nodeType||!b(o).is(r)))1===o.nodeType&&i.push(o),o=o[n];return i},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n}});function ft(e,t,n){if(t=t||0,b.isFunction(t))return b.grep(e,function(e,r){var i=!!t.call(e,r,e);return i===n});if(t.nodeType)return b.grep(e,function(e){return e===t===n});if("string"==typeof t){var r=b.grep(e,function(e){return 1===e.nodeType});if(ut.test(t))return b.filter(t,r,!n);t=b.filter(t,r)}return b.grep(e,function(e){return b.inArray(e,t)>=0===n})}function dt(e){var t=ht.split("|"),n=e.createDocumentFragment();if(n.createElement)while(t.length)n.createElement(t.pop());return n}var ht="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",gt=/ jQuery\d+="(?:null|\d+)"/g,mt=RegExp("<(?:"+ht+")[\\s/>]","i"),yt=/^\s+/,vt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,bt=/<([\w:]+)/,xt=/<tbody/i,wt=/<|&#?\w+;/,Tt=/<(?:script|style|link)/i,Nt=/^(?:checkbox|radio)$/i,Ct=/checked\s*(?:[^=]|=\s*.checked.)/i,kt=/^$|\/(?:java|ecma)script/i,Et=/^true\/(.*)/,St=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,At={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:b.support.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},jt=dt(o),Dt=jt.appendChild(o.createElement("div"));At.optgroup=At.option,At.tbody=At.tfoot=At.colgroup=At.caption=At.thead,At.th=At.td,b.fn.extend({text:function(e){return b.access(this,function(e){return e===t?b.text(this):this.empty().append((this[0]&&this[0].ownerDocument||o).createTextNode(e))},null,e,arguments.length)},wrapAll:function(e){if(b.isFunction(e))return this.each(function(t){b(this).wrapAll(e.call(this,t))});if(this[0]){var t=b(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstChild&&1===e.firstChild.nodeType)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return b.isFunction(e)?this.each(function(t){b(this).wrapInner(e.call(this,t))}):this.each(function(){var t=b(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=b.isFunction(e);return this.each(function(n){b(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){b.nodeName(this,"body")||b(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(e){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&this.appendChild(e)})},prepend:function(){return this.domManip(arguments,!0,function(e){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&this.insertBefore(e,this.firstChild)})},before:function(){return this.domManip(arguments,!1,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return this.domManip(arguments,!1,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},remove:function(e,t){var n,r=0;for(;null!=(n=this[r]);r++)(!e||b.filter(e,[n]).length>0)&&(t||1!==n.nodeType||b.cleanData(Ot(n)),n.parentNode&&(t&&b.contains(n.ownerDocument,n)&&Mt(Ot(n,"script")),n.parentNode.removeChild(n)));return this},empty:function(){var e,t=0;for(;null!=(e=this[t]);t++){1===e.nodeType&&b.cleanData(Ot(e,!1));while(e.firstChild)e.removeChild(e.firstChild);e.options&&b.nodeName(e,"select")&&(e.options.length=0)}return this},clone:function(e,t){return e=null==e?!1:e,t=null==t?e:t,this.map(function(){return b.clone(this,e,t)})},html:function(e){return b.access(this,function(e){var n=this[0]||{},r=0,i=this.length;if(e===t)return 1===n.nodeType?n.innerHTML.replace(gt,""):t;if(!("string"!=typeof e||Tt.test(e)||!b.support.htmlSerialize&&mt.test(e)||!b.support.leadingWhitespace&&yt.test(e)||At[(bt.exec(e)||["",""])[1].toLowerCase()])){e=e.replace(vt,"<$1></$2>");try{for(;i>r;r++)n=this[r]||{},1===n.nodeType&&(b.cleanData(Ot(n,!1)),n.innerHTML=e);n=0}catch(o){}}n&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(e){var t=b.isFunction(e);return t||"string"==typeof e||(e=b(e).not(this).detach()),this.domManip([e],!0,function(e){var t=this.nextSibling,n=this.parentNode;n&&(b(this).remove(),n.insertBefore(e,t))})},detach:function(e){return this.remove(e,!0)},domManip:function(e,n,r){e=f.apply([],e);var i,o,a,s,u,l,c=0,p=this.length,d=this,h=p-1,g=e[0],m=b.isFunction(g);if(m||!(1>=p||"string"!=typeof g||b.support.checkClone)&&Ct.test(g))return this.each(function(i){var o=d.eq(i);m&&(e[0]=g.call(this,i,n?o.html():t)),o.domManip(e,n,r)});if(p&&(l=b.buildFragment(e,this[0].ownerDocument,!1,this),i=l.firstChild,1===l.childNodes.length&&(l=i),i)){for(n=n&&b.nodeName(i,"tr"),s=b.map(Ot(l,"script"),Ht),a=s.length;p>c;c++)o=l,c!==h&&(o=b.clone(o,!0,!0),a&&b.merge(s,Ot(o,"script"))),r.call(n&&b.nodeName(this[c],"table")?Lt(this[c],"tbody"):this[c],o,c);if(a)for(u=s[s.length-1].ownerDocument,b.map(s,qt),c=0;a>c;c++)o=s[c],kt.test(o.type||"")&&!b._data(o,"globalEval")&&b.contains(u,o)&&(o.src?b.ajax({url:o.src,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0}):b.globalEval((o.text||o.textContent||o.innerHTML||"").replace(St,"")));l=i=null}return this}});function Lt(e,t){return e.getElementsByTagName(t)[0]||e.appendChild(e.ownerDocument.createElement(t))}function Ht(e){var t=e.getAttributeNode("type");return e.type=(t&&t.specified)+"/"+e.type,e}function qt(e){var t=Et.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function Mt(e,t){var n,r=0;for(;null!=(n=e[r]);r++)b._data(n,"globalEval",!t||b._data(t[r],"globalEval"))}function _t(e,t){if(1===t.nodeType&&b.hasData(e)){var n,r,i,o=b._data(e),a=b._data(t,o),s=o.events;if(s){delete a.handle,a.events={};for(n in s)for(r=0,i=s[n].length;i>r;r++)b.event.add(t,n,s[n][r])}a.data&&(a.data=b.extend({},a.data))}}function Ft(e,t){var n,r,i;if(1===t.nodeType){if(n=t.nodeName.toLowerCase(),!b.support.noCloneEvent&&t[b.expando]){i=b._data(t);for(r in i.events)b.removeEvent(t,r,i.handle);t.removeAttribute(b.expando)}"script"===n&&t.text!==e.text?(Ht(t).text=e.text,qt(t)):"object"===n?(t.parentNode&&(t.outerHTML=e.outerHTML),b.support.html5Clone&&e.innerHTML&&!b.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):"input"===n&&Nt.test(e.type)?(t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value)):"option"===n?t.defaultSelected=t.selected=e.defaultSelected:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}}b.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){b.fn[e]=function(e){var n,r=0,i=[],o=b(e),a=o.length-1;for(;a>=r;r++)n=r===a?this:this.clone(!0),b(o[r])[t](n),d.apply(i,n.get());return this.pushStack(i)}});function Ot(e,n){var r,o,a=0,s=typeof e.getElementsByTagName!==i?e.getElementsByTagName(n||"*"):typeof e.querySelectorAll!==i?e.querySelectorAll(n||"*"):t;if(!s)for(s=[],r=e.childNodes||e;null!=(o=r[a]);a++)!n||b.nodeName(o,n)?s.push(o):b.merge(s,Ot(o,n));return n===t||n&&b.nodeName(e,n)?b.merge([e],s):s}function Bt(e){Nt.test(e.type)&&(e.defaultChecked=e.checked)}b.extend({clone:function(e,t,n){var r,i,o,a,s,u=b.contains(e.ownerDocument,e);if(b.support.html5Clone||b.isXMLDoc(e)||!mt.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(Dt.innerHTML=e.outerHTML,Dt.removeChild(o=Dt.firstChild)),!(b.support.noCloneEvent&&b.support.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||b.isXMLDoc(e)))for(r=Ot(o),s=Ot(e),a=0;null!=(i=s[a]);++a)r[a]&&Ft(i,r[a]);if(t)if(n)for(s=s||Ot(e),r=r||Ot(o),a=0;null!=(i=s[a]);a++)_t(i,r[a]);else _t(e,o);return r=Ot(o,"script"),r.length>0&&Mt(r,!u&&Ot(e,"script")),r=s=i=null,o},buildFragment:function(e,t,n,r){var i,o,a,s,u,l,c,p=e.length,f=dt(t),d=[],h=0;for(;p>h;h++)if(o=e[h],o||0===o)if("object"===b.type(o))b.merge(d,o.nodeType?[o]:o);else if(wt.test(o)){s=s||f.appendChild(t.createElement("div")),u=(bt.exec(o)||["",""])[1].toLowerCase(),c=At[u]||At._default,s.innerHTML=c[1]+o.replace(vt,"<$1></$2>")+c[2],i=c[0];while(i--)s=s.lastChild;if(!b.support.leadingWhitespace&&yt.test(o)&&d.push(t.createTextNode(yt.exec(o)[0])),!b.support.tbody){o="table"!==u||xt.test(o)?"<table>"!==c[1]||xt.test(o)?0:s:s.firstChild,i=o&&o.childNodes.length;while(i--)b.nodeName(l=o.childNodes[i],"tbody")&&!l.childNodes.length&&o.removeChild(l)
}b.merge(d,s.childNodes),s.textContent="";while(s.firstChild)s.removeChild(s.firstChild);s=f.lastChild}else d.push(t.createTextNode(o));s&&f.removeChild(s),b.support.appendChecked||b.grep(Ot(d,"input"),Bt),h=0;while(o=d[h++])if((!r||-1===b.inArray(o,r))&&(a=b.contains(o.ownerDocument,o),s=Ot(f.appendChild(o),"script"),a&&Mt(s),n)){i=0;while(o=s[i++])kt.test(o.type||"")&&n.push(o)}return s=null,f},cleanData:function(e,t){var n,r,o,a,s=0,u=b.expando,l=b.cache,p=b.support.deleteExpando,f=b.event.special;for(;null!=(n=e[s]);s++)if((t||b.acceptData(n))&&(o=n[u],a=o&&l[o])){if(a.events)for(r in a.events)f[r]?b.event.remove(n,r):b.removeEvent(n,r,a.handle);l[o]&&(delete l[o],p?delete n[u]:typeof n.removeAttribute!==i?n.removeAttribute(u):n[u]=null,c.push(o))}}});var Pt,Rt,Wt,$t=/alpha\([^)]*\)/i,It=/opacity\s*=\s*([^)]*)/,zt=/^(top|right|bottom|left)$/,Xt=/^(none|table(?!-c[ea]).+)/,Ut=/^margin/,Vt=RegExp("^("+x+")(.*)$","i"),Yt=RegExp("^("+x+")(?!px)[a-z%]+$","i"),Jt=RegExp("^([+-])=("+x+")","i"),Gt={BODY:"block"},Qt={position:"absolute",visibility:"hidden",display:"block"},Kt={letterSpacing:0,fontWeight:400},Zt=["Top","Right","Bottom","Left"],en=["Webkit","O","Moz","ms"];function tn(e,t){if(t in e)return t;var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,i=en.length;while(i--)if(t=en[i]+n,t in e)return t;return r}function nn(e,t){return e=t||e,"none"===b.css(e,"display")||!b.contains(e.ownerDocument,e)}function rn(e,t){var n,r,i,o=[],a=0,s=e.length;for(;s>a;a++)r=e[a],r.style&&(o[a]=b._data(r,"olddisplay"),n=r.style.display,t?(o[a]||"none"!==n||(r.style.display=""),""===r.style.display&&nn(r)&&(o[a]=b._data(r,"olddisplay",un(r.nodeName)))):o[a]||(i=nn(r),(n&&"none"!==n||!i)&&b._data(r,"olddisplay",i?n:b.css(r,"display"))));for(a=0;s>a;a++)r=e[a],r.style&&(t&&"none"!==r.style.display&&""!==r.style.display||(r.style.display=t?o[a]||"":"none"));return e}b.fn.extend({css:function(e,n){return b.access(this,function(e,n,r){var i,o,a={},s=0;if(b.isArray(n)){for(o=Rt(e),i=n.length;i>s;s++)a[n[s]]=b.css(e,n[s],!1,o);return a}return r!==t?b.style(e,n,r):b.css(e,n)},e,n,arguments.length>1)},show:function(){return rn(this,!0)},hide:function(){return rn(this)},toggle:function(e){var t="boolean"==typeof e;return this.each(function(){(t?e:nn(this))?b(this).show():b(this).hide()})}}),b.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Wt(e,"opacity");return""===n?"1":n}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":b.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,r,i){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var o,a,s,u=b.camelCase(n),l=e.style;if(n=b.cssProps[u]||(b.cssProps[u]=tn(l,u)),s=b.cssHooks[n]||b.cssHooks[u],r===t)return s&&"get"in s&&(o=s.get(e,!1,i))!==t?o:l[n];if(a=typeof r,"string"===a&&(o=Jt.exec(r))&&(r=(o[1]+1)*o[2]+parseFloat(b.css(e,n)),a="number"),!(null==r||"number"===a&&isNaN(r)||("number"!==a||b.cssNumber[u]||(r+="px"),b.support.clearCloneStyle||""!==r||0!==n.indexOf("background")||(l[n]="inherit"),s&&"set"in s&&(r=s.set(e,r,i))===t)))try{l[n]=r}catch(c){}}},css:function(e,n,r,i){var o,a,s,u=b.camelCase(n);return n=b.cssProps[u]||(b.cssProps[u]=tn(e.style,u)),s=b.cssHooks[n]||b.cssHooks[u],s&&"get"in s&&(a=s.get(e,!0,r)),a===t&&(a=Wt(e,n,i)),"normal"===a&&n in Kt&&(a=Kt[n]),""===r||r?(o=parseFloat(a),r===!0||b.isNumeric(o)?o||0:a):a},swap:function(e,t,n,r){var i,o,a={};for(o in t)a[o]=e.style[o],e.style[o]=t[o];i=n.apply(e,r||[]);for(o in t)e.style[o]=a[o];return i}}),e.getComputedStyle?(Rt=function(t){return e.getComputedStyle(t,null)},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),u=s?s.getPropertyValue(n)||s[n]:t,l=e.style;return s&&(""!==u||b.contains(e.ownerDocument,e)||(u=b.style(e,n)),Yt.test(u)&&Ut.test(n)&&(i=l.width,o=l.minWidth,a=l.maxWidth,l.minWidth=l.maxWidth=l.width=u,u=s.width,l.width=i,l.minWidth=o,l.maxWidth=a)),u}):o.documentElement.currentStyle&&(Rt=function(e){return e.currentStyle},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),u=s?s[n]:t,l=e.style;return null==u&&l&&l[n]&&(u=l[n]),Yt.test(u)&&!zt.test(n)&&(i=l.left,o=e.runtimeStyle,a=o&&o.left,a&&(o.left=e.currentStyle.left),l.left="fontSize"===n?"1em":u,u=l.pixelLeft+"px",l.left=i,a&&(o.left=a)),""===u?"auto":u});function on(e,t,n){var r=Vt.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function an(e,t,n,r,i){var o=n===(r?"border":"content")?4:"width"===t?1:0,a=0;for(;4>o;o+=2)"margin"===n&&(a+=b.css(e,n+Zt[o],!0,i)),r?("content"===n&&(a-=b.css(e,"padding"+Zt[o],!0,i)),"margin"!==n&&(a-=b.css(e,"border"+Zt[o]+"Width",!0,i))):(a+=b.css(e,"padding"+Zt[o],!0,i),"padding"!==n&&(a+=b.css(e,"border"+Zt[o]+"Width",!0,i)));return a}function sn(e,t,n){var r=!0,i="width"===t?e.offsetWidth:e.offsetHeight,o=Rt(e),a=b.support.boxSizing&&"border-box"===b.css(e,"boxSizing",!1,o);if(0>=i||null==i){if(i=Wt(e,t,o),(0>i||null==i)&&(i=e.style[t]),Yt.test(i))return i;r=a&&(b.support.boxSizingReliable||i===e.style[t]),i=parseFloat(i)||0}return i+an(e,t,n||(a?"border":"content"),r,o)+"px"}function un(e){var t=o,n=Gt[e];return n||(n=ln(e,t),"none"!==n&&n||(Pt=(Pt||b("<iframe frameborder='0' width='0' height='0'/>").css("cssText","display:block !important")).appendTo(t.documentElement),t=(Pt[0].contentWindow||Pt[0].contentDocument).document,t.write("<!doctype html><html><body>"),t.close(),n=ln(e,t),Pt.detach()),Gt[e]=n),n}function ln(e,t){var n=b(t.createElement(e)).appendTo(t.body),r=b.css(n[0],"display");return n.remove(),r}b.each(["height","width"],function(e,n){b.cssHooks[n]={get:function(e,r,i){return r?0===e.offsetWidth&&Xt.test(b.css(e,"display"))?b.swap(e,Qt,function(){return sn(e,n,i)}):sn(e,n,i):t},set:function(e,t,r){var i=r&&Rt(e);return on(e,t,r?an(e,n,r,b.support.boxSizing&&"border-box"===b.css(e,"boxSizing",!1,i),i):0)}}}),b.support.opacity||(b.cssHooks.opacity={get:function(e,t){return It.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var n=e.style,r=e.currentStyle,i=b.isNumeric(t)?"alpha(opacity="+100*t+")":"",o=r&&r.filter||n.filter||"";n.zoom=1,(t>=1||""===t)&&""===b.trim(o.replace($t,""))&&n.removeAttribute&&(n.removeAttribute("filter"),""===t||r&&!r.filter)||(n.filter=$t.test(o)?o.replace($t,i):o+" "+i)}}),b(function(){b.support.reliableMarginRight||(b.cssHooks.marginRight={get:function(e,n){return n?b.swap(e,{display:"inline-block"},Wt,[e,"marginRight"]):t}}),!b.support.pixelPosition&&b.fn.position&&b.each(["top","left"],function(e,n){b.cssHooks[n]={get:function(e,r){return r?(r=Wt(e,n),Yt.test(r)?b(e).position()[n]+"px":r):t}}})}),b.expr&&b.expr.filters&&(b.expr.filters.hidden=function(e){return 0>=e.offsetWidth&&0>=e.offsetHeight||!b.support.reliableHiddenOffsets&&"none"===(e.style&&e.style.display||b.css(e,"display"))},b.expr.filters.visible=function(e){return!b.expr.filters.hidden(e)}),b.each({margin:"",padding:"",border:"Width"},function(e,t){b.cssHooks[e+t]={expand:function(n){var r=0,i={},o="string"==typeof n?n.split(" "):[n];for(;4>r;r++)i[e+Zt[r]+t]=o[r]||o[r-2]||o[0];return i}},Ut.test(e)||(b.cssHooks[e+t].set=on)});var cn=/%20/g,pn=/\[\]$/,fn=/\r?\n/g,dn=/^(?:submit|button|image|reset|file)$/i,hn=/^(?:input|select|textarea|keygen)/i;b.fn.extend({serialize:function(){return b.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=b.prop(this,"elements");return e?b.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!b(this).is(":disabled")&&hn.test(this.nodeName)&&!dn.test(e)&&(this.checked||!Nt.test(e))}).map(function(e,t){var n=b(this).val();return null==n?null:b.isArray(n)?b.map(n,function(e){return{name:t.name,value:e.replace(fn,"\r\n")}}):{name:t.name,value:n.replace(fn,"\r\n")}}).get()}}),b.param=function(e,n){var r,i=[],o=function(e,t){t=b.isFunction(t)?t():null==t?"":t,i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(n===t&&(n=b.ajaxSettings&&b.ajaxSettings.traditional),b.isArray(e)||e.jquery&&!b.isPlainObject(e))b.each(e,function(){o(this.name,this.value)});else for(r in e)gn(r,e[r],n,o);return i.join("&").replace(cn,"+")};function gn(e,t,n,r){var i;if(b.isArray(t))b.each(t,function(t,i){n||pn.test(e)?r(e,i):gn(e+"["+("object"==typeof i?t:"")+"]",i,n,r)});else if(n||"object"!==b.type(t))r(e,t);else for(i in t)gn(e+"["+i+"]",t[i],n,r)}b.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){b.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),b.fn.hover=function(e,t){return this.mouseenter(e).mouseleave(t||e)};var mn,yn,vn=b.now(),bn=/\?/,xn=/#.*$/,wn=/([?&])_=[^&]*/,Tn=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Nn=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Cn=/^(?:GET|HEAD)$/,kn=/^\/\//,En=/^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,Sn=b.fn.load,An={},jn={},Dn="*/".concat("*");try{yn=a.href}catch(Ln){yn=o.createElement("a"),yn.href="",yn=yn.href}mn=En.exec(yn.toLowerCase())||[];function Hn(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,i=0,o=t.toLowerCase().match(w)||[];if(b.isFunction(n))while(r=o[i++])"+"===r[0]?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function qn(e,n,r,i){var o={},a=e===jn;function s(u){var l;return o[u]=!0,b.each(e[u]||[],function(e,u){var c=u(n,r,i);return"string"!=typeof c||a||o[c]?a?!(l=c):t:(n.dataTypes.unshift(c),s(c),!1)}),l}return s(n.dataTypes[0])||!o["*"]&&s("*")}function Mn(e,n){var r,i,o=b.ajaxSettings.flatOptions||{};for(i in n)n[i]!==t&&((o[i]?e:r||(r={}))[i]=n[i]);return r&&b.extend(!0,e,r),e}b.fn.load=function(e,n,r){if("string"!=typeof e&&Sn)return Sn.apply(this,arguments);var i,o,a,s=this,u=e.indexOf(" ");return u>=0&&(i=e.slice(u,e.length),e=e.slice(0,u)),b.isFunction(n)?(r=n,n=t):n&&"object"==typeof n&&(a="POST"),s.length>0&&b.ajax({url:e,type:a,dataType:"html",data:n}).done(function(e){o=arguments,s.html(i?b("<div>").append(b.parseHTML(e)).find(i):e)}).complete(r&&function(e,t){s.each(r,o||[e.responseText,t,e])}),this},b.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){b.fn[t]=function(e){return this.on(t,e)}}),b.each(["get","post"],function(e,n){b[n]=function(e,r,i,o){return b.isFunction(r)&&(o=o||i,i=r,r=t),b.ajax({url:e,type:n,dataType:o,data:r,success:i})}}),b.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:yn,type:"GET",isLocal:Nn.test(mn[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Dn,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":e.String,"text html":!0,"text json":b.parseJSON,"text xml":b.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?Mn(Mn(e,b.ajaxSettings),t):Mn(b.ajaxSettings,e)},ajaxPrefilter:Hn(An),ajaxTransport:Hn(jn),ajax:function(e,n){"object"==typeof e&&(n=e,e=t),n=n||{};var r,i,o,a,s,u,l,c,p=b.ajaxSetup({},n),f=p.context||p,d=p.context&&(f.nodeType||f.jquery)?b(f):b.event,h=b.Deferred(),g=b.Callbacks("once memory"),m=p.statusCode||{},y={},v={},x=0,T="canceled",N={readyState:0,getResponseHeader:function(e){var t;if(2===x){if(!c){c={};while(t=Tn.exec(a))c[t[1].toLowerCase()]=t[2]}t=c[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===x?a:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return x||(e=v[n]=v[n]||e,y[e]=t),this},overrideMimeType:function(e){return x||(p.mimeType=e),this},statusCode:function(e){var t;if(e)if(2>x)for(t in e)m[t]=[m[t],e[t]];else N.always(e[N.status]);return this},abort:function(e){var t=e||T;return l&&l.abort(t),k(0,t),this}};if(h.promise(N).complete=g.add,N.success=N.done,N.error=N.fail,p.url=((e||p.url||yn)+"").replace(xn,"").replace(kn,mn[1]+"//"),p.type=n.method||n.type||p.method||p.type,p.dataTypes=b.trim(p.dataType||"*").toLowerCase().match(w)||[""],null==p.crossDomain&&(r=En.exec(p.url.toLowerCase()),p.crossDomain=!(!r||r[1]===mn[1]&&r[2]===mn[2]&&(r[3]||("http:"===r[1]?80:443))==(mn[3]||("http:"===mn[1]?80:443)))),p.data&&p.processData&&"string"!=typeof p.data&&(p.data=b.param(p.data,p.traditional)),qn(An,p,n,N),2===x)return N;u=p.global,u&&0===b.active++&&b.event.trigger("ajaxStart"),p.type=p.type.toUpperCase(),p.hasContent=!Cn.test(p.type),o=p.url,p.hasContent||(p.data&&(o=p.url+=(bn.test(o)?"&":"?")+p.data,delete p.data),p.cache===!1&&(p.url=wn.test(o)?o.replace(wn,"$1_="+vn++):o+(bn.test(o)?"&":"?")+"_="+vn++)),p.ifModified&&(b.lastModified[o]&&N.setRequestHeader("If-Modified-Since",b.lastModified[o]),b.etag[o]&&N.setRequestHeader("If-None-Match",b.etag[o])),(p.data&&p.hasContent&&p.contentType!==!1||n.contentType)&&N.setRequestHeader("Content-Type",p.contentType),N.setRequestHeader("Accept",p.dataTypes[0]&&p.accepts[p.dataTypes[0]]?p.accepts[p.dataTypes[0]]+("*"!==p.dataTypes[0]?", "+Dn+"; q=0.01":""):p.accepts["*"]);for(i in p.headers)N.setRequestHeader(i,p.headers[i]);if(p.beforeSend&&(p.beforeSend.call(f,N,p)===!1||2===x))return N.abort();T="abort";for(i in{success:1,error:1,complete:1})N[i](p[i]);if(l=qn(jn,p,n,N)){N.readyState=1,u&&d.trigger("ajaxSend",[N,p]),p.async&&p.timeout>0&&(s=setTimeout(function(){N.abort("timeout")},p.timeout));try{x=1,l.send(y,k)}catch(C){if(!(2>x))throw C;k(-1,C)}}else k(-1,"No Transport");function k(e,n,r,i){var c,y,v,w,T,C=n;2!==x&&(x=2,s&&clearTimeout(s),l=t,a=i||"",N.readyState=e>0?4:0,r&&(w=_n(p,N,r)),e>=200&&300>e||304===e?(p.ifModified&&(T=N.getResponseHeader("Last-Modified"),T&&(b.lastModified[o]=T),T=N.getResponseHeader("etag"),T&&(b.etag[o]=T)),204===e?(c=!0,C="nocontent"):304===e?(c=!0,C="notmodified"):(c=Fn(p,w),C=c.state,y=c.data,v=c.error,c=!v)):(v=C,(e||!C)&&(C="error",0>e&&(e=0))),N.status=e,N.statusText=(n||C)+"",c?h.resolveWith(f,[y,C,N]):h.rejectWith(f,[N,C,v]),N.statusCode(m),m=t,u&&d.trigger(c?"ajaxSuccess":"ajaxError",[N,p,c?y:v]),g.fireWith(f,[N,C]),u&&(d.trigger("ajaxComplete",[N,p]),--b.active||b.event.trigger("ajaxStop")))}return N},getScript:function(e,n){return b.get(e,t,n,"script")},getJSON:function(e,t,n){return b.get(e,t,n,"json")}});function _n(e,n,r){var i,o,a,s,u=e.contents,l=e.dataTypes,c=e.responseFields;for(s in c)s in r&&(n[c[s]]=r[s]);while("*"===l[0])l.shift(),o===t&&(o=e.mimeType||n.getResponseHeader("Content-Type"));if(o)for(s in u)if(u[s]&&u[s].test(o)){l.unshift(s);break}if(l[0]in r)a=l[0];else{for(s in r){if(!l[0]||e.converters[s+" "+l[0]]){a=s;break}i||(i=s)}a=a||i}return a?(a!==l[0]&&l.unshift(a),r[a]):t}function Fn(e,t){var n,r,i,o,a={},s=0,u=e.dataTypes.slice(),l=u[0];if(e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u[1])for(i in e.converters)a[i.toLowerCase()]=e.converters[i];for(;r=u[++s];)if("*"!==r){if("*"!==l&&l!==r){if(i=a[l+" "+r]||a["* "+r],!i)for(n in a)if(o=n.split(" "),o[1]===r&&(i=a[l+" "+o[0]]||a["* "+o[0]])){i===!0?i=a[n]:a[n]!==!0&&(r=o[0],u.splice(s--,0,r));break}if(i!==!0)if(i&&e["throws"])t=i(t);else try{t=i(t)}catch(c){return{state:"parsererror",error:i?c:"No conversion from "+l+" to "+r}}}l=r}return{state:"success",data:t}}b.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){return b.globalEval(e),e}}}),b.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),b.ajaxTransport("script",function(e){if(e.crossDomain){var n,r=o.head||b("head")[0]||o.documentElement;return{send:function(t,i){n=o.createElement("script"),n.async=!0,e.scriptCharset&&(n.charset=e.scriptCharset),n.src=e.url,n.onload=n.onreadystatechange=function(e,t){(t||!n.readyState||/loaded|complete/.test(n.readyState))&&(n.onload=n.onreadystatechange=null,n.parentNode&&n.parentNode.removeChild(n),n=null,t||i(200,"success"))},r.insertBefore(n,r.firstChild)},abort:function(){n&&n.onload(t,!0)}}}});var On=[],Bn=/(=)\?(?=&|$)|\?\?/;b.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=On.pop()||b.expando+"_"+vn++;return this[e]=!0,e}}),b.ajaxPrefilter("json jsonp",function(n,r,i){var o,a,s,u=n.jsonp!==!1&&(Bn.test(n.url)?"url":"string"==typeof n.data&&!(n.contentType||"").indexOf("application/x-www-form-urlencoded")&&Bn.test(n.data)&&"data");return u||"jsonp"===n.dataTypes[0]?(o=n.jsonpCallback=b.isFunction(n.jsonpCallback)?n.jsonpCallback():n.jsonpCallback,u?n[u]=n[u].replace(Bn,"$1"+o):n.jsonp!==!1&&(n.url+=(bn.test(n.url)?"&":"?")+n.jsonp+"="+o),n.converters["script json"]=function(){return s||b.error(o+" was not called"),s[0]},n.dataTypes[0]="json",a=e[o],e[o]=function(){s=arguments},i.always(function(){e[o]=a,n[o]&&(n.jsonpCallback=r.jsonpCallback,On.push(o)),s&&b.isFunction(a)&&a(s[0]),s=a=t}),"script"):t});var Pn,Rn,Wn=0,$n=e.ActiveXObject&&function(){var e;for(e in Pn)Pn[e](t,!0)};function In(){try{return new e.XMLHttpRequest}catch(t){}}function zn(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}b.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&In()||zn()}:In,Rn=b.ajaxSettings.xhr(),b.support.cors=!!Rn&&"withCredentials"in Rn,Rn=b.support.ajax=!!Rn,Rn&&b.ajaxTransport(function(n){if(!n.crossDomain||b.support.cors){var r;return{send:function(i,o){var a,s,u=n.xhr();if(n.username?u.open(n.type,n.url,n.async,n.username,n.password):u.open(n.type,n.url,n.async),n.xhrFields)for(s in n.xhrFields)u[s]=n.xhrFields[s];n.mimeType&&u.overrideMimeType&&u.overrideMimeType(n.mimeType),n.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest");try{for(s in i)u.setRequestHeader(s,i[s])}catch(l){}u.send(n.hasContent&&n.data||null),r=function(e,i){var s,l,c,p;try{if(r&&(i||4===u.readyState))if(r=t,a&&(u.onreadystatechange=b.noop,$n&&delete Pn[a]),i)4!==u.readyState&&u.abort();else{p={},s=u.status,l=u.getAllResponseHeaders(),"string"==typeof u.responseText&&(p.text=u.responseText);try{c=u.statusText}catch(f){c=""}s||!n.isLocal||n.crossDomain?1223===s&&(s=204):s=p.text?200:404}}catch(d){i||o(-1,d)}p&&o(s,c,p,l)},n.async?4===u.readyState?setTimeout(r):(a=++Wn,$n&&(Pn||(Pn={},b(e).unload($n)),Pn[a]=r),u.onreadystatechange=r):r()},abort:function(){r&&r(t,!0)}}}});var Xn,Un,Vn=/^(?:toggle|show|hide)$/,Yn=RegExp("^(?:([+-])=|)("+x+")([a-z%]*)$","i"),Jn=/queueHooks$/,Gn=[nr],Qn={"*":[function(e,t){var n,r,i=this.createTween(e,t),o=Yn.exec(t),a=i.cur(),s=+a||0,u=1,l=20;if(o){if(n=+o[2],r=o[3]||(b.cssNumber[e]?"":"px"),"px"!==r&&s){s=b.css(i.elem,e,!0)||n||1;do u=u||".5",s/=u,b.style(i.elem,e,s+r);while(u!==(u=i.cur()/a)&&1!==u&&--l)}i.unit=r,i.start=s,i.end=o[1]?s+(o[1]+1)*n:n}return i}]};function Kn(){return setTimeout(function(){Xn=t}),Xn=b.now()}function Zn(e,t){b.each(t,function(t,n){var r=(Qn[t]||[]).concat(Qn["*"]),i=0,o=r.length;for(;o>i;i++)if(r[i].call(e,t,n))return})}function er(e,t,n){var r,i,o=0,a=Gn.length,s=b.Deferred().always(function(){delete u.elem}),u=function(){if(i)return!1;var t=Xn||Kn(),n=Math.max(0,l.startTime+l.duration-t),r=n/l.duration||0,o=1-r,a=0,u=l.tweens.length;for(;u>a;a++)l.tweens[a].run(o);return s.notifyWith(e,[l,o,n]),1>o&&u?n:(s.resolveWith(e,[l]),!1)},l=s.promise({elem:e,props:b.extend({},t),opts:b.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:Xn||Kn(),duration:n.duration,tweens:[],createTween:function(t,n){var r=b.Tween(e,l.opts,t,n,l.opts.specialEasing[t]||l.opts.easing);return l.tweens.push(r),r},stop:function(t){var n=0,r=t?l.tweens.length:0;if(i)return this;for(i=!0;r>n;n++)l.tweens[n].run(1);return t?s.resolveWith(e,[l,t]):s.rejectWith(e,[l,t]),this}}),c=l.props;for(tr(c,l.opts.specialEasing);a>o;o++)if(r=Gn[o].call(l,e,c,l.opts))return r;return Zn(l,c),b.isFunction(l.opts.start)&&l.opts.start.call(e,l),b.fx.timer(b.extend(u,{elem:e,anim:l,queue:l.opts.queue})),l.progress(l.opts.progress).done(l.opts.done,l.opts.complete).fail(l.opts.fail).always(l.opts.always)}function tr(e,t){var n,r,i,o,a;for(i in e)if(r=b.camelCase(i),o=t[r],n=e[i],b.isArray(n)&&(o=n[1],n=e[i]=n[0]),i!==r&&(e[r]=n,delete e[i]),a=b.cssHooks[r],a&&"expand"in a){n=a.expand(n),delete e[r];for(i in n)i in e||(e[i]=n[i],t[i]=o)}else t[r]=o}b.Animation=b.extend(er,{tweener:function(e,t){b.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");var n,r=0,i=e.length;for(;i>r;r++)n=e[r],Qn[n]=Qn[n]||[],Qn[n].unshift(t)},prefilter:function(e,t){t?Gn.unshift(e):Gn.push(e)}});function nr(e,t,n){var r,i,o,a,s,u,l,c,p,f=this,d=e.style,h={},g=[],m=e.nodeType&&nn(e);n.queue||(c=b._queueHooks(e,"fx"),null==c.unqueued&&(c.unqueued=0,p=c.empty.fire,c.empty.fire=function(){c.unqueued||p()}),c.unqueued++,f.always(function(){f.always(function(){c.unqueued--,b.queue(e,"fx").length||c.empty.fire()})})),1===e.nodeType&&("height"in t||"width"in t)&&(n.overflow=[d.overflow,d.overflowX,d.overflowY],"inline"===b.css(e,"display")&&"none"===b.css(e,"float")&&(b.support.inlineBlockNeedsLayout&&"inline"!==un(e.nodeName)?d.zoom=1:d.display="inline-block")),n.overflow&&(d.overflow="hidden",b.support.shrinkWrapBlocks||f.always(function(){d.overflow=n.overflow[0],d.overflowX=n.overflow[1],d.overflowY=n.overflow[2]}));for(i in t)if(a=t[i],Vn.exec(a)){if(delete t[i],u=u||"toggle"===a,a===(m?"hide":"show"))continue;g.push(i)}if(o=g.length){s=b._data(e,"fxshow")||b._data(e,"fxshow",{}),"hidden"in s&&(m=s.hidden),u&&(s.hidden=!m),m?b(e).show():f.done(function(){b(e).hide()}),f.done(function(){var t;b._removeData(e,"fxshow");for(t in h)b.style(e,t,h[t])});for(i=0;o>i;i++)r=g[i],l=f.createTween(r,m?s[r]:0),h[r]=s[r]||b.style(e,r),r in s||(s[r]=l.start,m&&(l.end=l.start,l.start="width"===r||"height"===r?1:0))}}function rr(e,t,n,r,i){return new rr.prototype.init(e,t,n,r,i)}b.Tween=rr,rr.prototype={constructor:rr,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(b.cssNumber[n]?"":"px")},cur:function(){var e=rr.propHooks[this.prop];return e&&e.get?e.get(this):rr.propHooks._default.get(this)},run:function(e){var t,n=rr.propHooks[this.prop];return this.pos=t=this.options.duration?b.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):rr.propHooks._default.set(this),this}},rr.prototype.init.prototype=rr.prototype,rr.propHooks={_default:{get:function(e){var t;return null==e.elem[e.prop]||e.elem.style&&null!=e.elem.style[e.prop]?(t=b.css(e.elem,e.prop,""),t&&"auto"!==t?t:0):e.elem[e.prop]},set:function(e){b.fx.step[e.prop]?b.fx.step[e.prop](e):e.elem.style&&(null!=e.elem.style[b.cssProps[e.prop]]||b.cssHooks[e.prop])?b.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},rr.propHooks.scrollTop=rr.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},b.each(["toggle","show","hide"],function(e,t){var n=b.fn[t];b.fn[t]=function(e,r,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(ir(t,!0),e,r,i)}}),b.fn.extend({fadeTo:function(e,t,n,r){return this.filter(nn).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=b.isEmptyObject(e),o=b.speed(t,n,r),a=function(){var t=er(this,b.extend({},e),o);a.finish=function(){t.stop(!0)},(i||b._data(this,"finish"))&&t.stop(!0)};return a.finish=a,i||o.queue===!1?this.each(a):this.queue(o.queue,a)},stop:function(e,n,r){var i=function(e){var t=e.stop;delete e.stop,t(r)};return"string"!=typeof e&&(r=n,n=e,e=t),n&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,n=null!=e&&e+"queueHooks",o=b.timers,a=b._data(this);if(n)a[n]&&a[n].stop&&i(a[n]);else for(n in a)a[n]&&a[n].stop&&Jn.test(n)&&i(a[n]);for(n=o.length;n--;)o[n].elem!==this||null!=e&&o[n].queue!==e||(o[n].anim.stop(r),t=!1,o.splice(n,1));(t||!r)&&b.dequeue(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var t,n=b._data(this),r=n[e+"queue"],i=n[e+"queueHooks"],o=b.timers,a=r?r.length:0;for(n.finish=!0,b.queue(this,e,[]),i&&i.cur&&i.cur.finish&&i.cur.finish.call(this),t=o.length;t--;)o[t].elem===this&&o[t].queue===e&&(o[t].anim.stop(!0),o.splice(t,1));for(t=0;a>t;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish})}});function ir(e,t){var n,r={height:e},i=0;for(t=t?1:0;4>i;i+=2-t)n=Zt[i],r["margin"+n]=r["padding"+n]=e;return t&&(r.opacity=r.width=e),r}b.each({slideDown:ir("show"),slideUp:ir("hide"),slideToggle:ir("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){b.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),b.speed=function(e,t,n){var r=e&&"object"==typeof e?b.extend({},e):{complete:n||!n&&t||b.isFunction(e)&&e,duration:e,easing:n&&t||t&&!b.isFunction(t)&&t};return r.duration=b.fx.off?0:"number"==typeof r.duration?r.duration:r.duration in b.fx.speeds?b.fx.speeds[r.duration]:b.fx.speeds._default,(null==r.queue||r.queue===!0)&&(r.queue="fx"),r.old=r.complete,r.complete=function(){b.isFunction(r.old)&&r.old.call(this),r.queue&&b.dequeue(this,r.queue)},r},b.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},b.timers=[],b.fx=rr.prototype.init,b.fx.tick=function(){var e,n=b.timers,r=0;for(Xn=b.now();n.length>r;r++)e=n[r],e()||n[r]!==e||n.splice(r--,1);n.length||b.fx.stop(),Xn=t},b.fx.timer=function(e){e()&&b.timers.push(e)&&b.fx.start()},b.fx.interval=13,b.fx.start=function(){Un||(Un=setInterval(b.fx.tick,b.fx.interval))},b.fx.stop=function(){clearInterval(Un),Un=null},b.fx.speeds={slow:600,fast:200,_default:400},b.fx.step={},b.expr&&b.expr.filters&&(b.expr.filters.animated=function(e){return b.grep(b.timers,function(t){return e===t.elem}).length}),b.fn.offset=function(e){if(arguments.length)return e===t?this:this.each(function(t){b.offset.setOffset(this,e,t)});var n,r,o={top:0,left:0},a=this[0],s=a&&a.ownerDocument;if(s)return n=s.documentElement,b.contains(n,a)?(typeof a.getBoundingClientRect!==i&&(o=a.getBoundingClientRect()),r=or(s),{top:o.top+(r.pageYOffset||n.scrollTop)-(n.clientTop||0),left:o.left+(r.pageXOffset||n.scrollLeft)-(n.clientLeft||0)}):o},b.offset={setOffset:function(e,t,n){var r=b.css(e,"position");"static"===r&&(e.style.position="relative");var i=b(e),o=i.offset(),a=b.css(e,"top"),s=b.css(e,"left"),u=("absolute"===r||"fixed"===r)&&b.inArray("auto",[a,s])>-1,l={},c={},p,f;u?(c=i.position(),p=c.top,f=c.left):(p=parseFloat(a)||0,f=parseFloat(s)||0),b.isFunction(t)&&(t=t.call(e,n,o)),null!=t.top&&(l.top=t.top-o.top+p),null!=t.left&&(l.left=t.left-o.left+f),"using"in t?t.using.call(e,l):i.css(l)}},b.fn.extend({position:function(){if(this[0]){var e,t,n={top:0,left:0},r=this[0];return"fixed"===b.css(r,"position")?t=r.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),b.nodeName(e[0],"html")||(n=e.offset()),n.top+=b.css(e[0],"borderTopWidth",!0),n.left+=b.css(e[0],"borderLeftWidth",!0)),{top:t.top-n.top-b.css(r,"marginTop",!0),left:t.left-n.left-b.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||o.documentElement;while(e&&!b.nodeName(e,"html")&&"static"===b.css(e,"position"))e=e.offsetParent;return e||o.documentElement})}}),b.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var r=/Y/.test(n);b.fn[e]=function(i){return b.access(this,function(e,i,o){var a=or(e);return o===t?a?n in a?a[n]:a.document.documentElement[i]:e[i]:(a?a.scrollTo(r?b(a).scrollLeft():o,r?o:b(a).scrollTop()):e[i]=o,t)},e,i,arguments.length,null)}});function or(e){return b.isWindow(e)?e:9===e.nodeType?e.defaultView||e.parentWindow:!1}b.each({Height:"height",Width:"width"},function(e,n){b.each({padding:"inner"+e,content:n,"":"outer"+e},function(r,i){b.fn[i]=function(i,o){var a=arguments.length&&(r||"boolean"!=typeof i),s=r||(i===!0||o===!0?"margin":"border");return b.access(this,function(n,r,i){var o;return b.isWindow(n)?n.document.documentElement["client"+e]:9===n.nodeType?(o=n.documentElement,Math.max(n.body["scroll"+e],o["scroll"+e],n.body["offset"+e],o["offset"+e],o["client"+e])):i===t?b.css(n,r,s):b.style(n,r,i,s)},n,a?i:t,a,null)}})}),e.jQuery=e.$=b,"function"==typeof define&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return b})})(window);
|
packages/mui-icons-material/lib/esm/KeyboardDoubleArrowDown.js | oliviertassinari/material-ui | import createSvgIcon from './utils/createSvgIcon';
import { jsx as _jsx } from "react/jsx-runtime";
export default createSvgIcon([/*#__PURE__*/_jsx("path", {
d: "M18 6.41 16.59 5 12 9.58 7.41 5 6 6.41l6 6z"
}, "0"), /*#__PURE__*/_jsx("path", {
d: "m18 13-1.41-1.41L12 16.17l-4.59-4.58L6 13l6 6z"
}, "1")], 'KeyboardDoubleArrowDown'); |
ajax/libs/choices.js/2.8.9/choices.js | jdh8/cdnjs | /*! choices.js v2.8.9 | (c) 2017 Josh Johnson | https://github.com/jshjohnson/Choices#readme */
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define([], factory);
else if(typeof exports === 'object')
exports["Choices"] = factory();
else
root["Choices"] = factory();
})(this, function() {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "/assets/scripts/dist/";
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(1);
/***/ }),
/* 1 */
/***/ (function(module, exports, __webpack_require__) {
'use strict';
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _fuse = __webpack_require__(2);
var _fuse2 = _interopRequireDefault(_fuse);
var _classnames = __webpack_require__(3);
var _classnames2 = _interopRequireDefault(_classnames);
var _index = __webpack_require__(4);
var _index2 = _interopRequireDefault(_index);
var _index3 = __webpack_require__(30);
var _utils = __webpack_require__(31);
__webpack_require__(32);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
/**
* Choices
*/
var Choices = function () {
function Choices() {
var element = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '[data-choice]';
var userConfig = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
_classCallCheck(this, Choices);
// If there are multiple elements, create a new instance
// for each element besides the first one (as that already has an instance)
if ((0, _utils.isType)('String', element)) {
var elements = document.querySelectorAll(element);
if (elements.length > 1) {
for (var i = 1; i < elements.length; i++) {
var el = elements[i];
new Choices(el, userConfig);
}
}
}
var defaultConfig = {
silent: false,
items: [],
choices: [],
maxItemCount: -1,
addItems: true,
removeItems: true,
removeItemButton: false,
editItems: false,
duplicateItems: true,
delimiter: ',',
paste: true,
searchEnabled: true,
searchChoices: true,
searchFloor: 1,
searchResultLimit: 4,
searchFields: ['label', 'value'],
position: 'auto',
resetScrollPosition: true,
regexFilter: null,
shouldSort: true,
shouldSortItems: false,
sortFilter: _utils.sortByAlpha,
placeholder: true,
placeholderValue: null,
prependValue: null,
appendValue: null,
renderSelectedChoices: 'auto',
loadingText: 'Loading...',
noResultsText: 'No results found',
noChoicesText: 'No choices to choose from',
itemSelectText: 'Press to select',
addItemText: function addItemText(value) {
return 'Press Enter to add <b>"' + value + '"</b>';
},
maxItemText: function maxItemText(maxItemCount) {
return 'Only ' + maxItemCount + ' values can be added.';
},
uniqueItemText: 'Only unique values can be added.',
classNames: {
containerOuter: 'choices',
containerInner: 'choices__inner',
input: 'choices__input',
inputCloned: 'choices__input--cloned',
list: 'choices__list',
listItems: 'choices__list--multiple',
listSingle: 'choices__list--single',
listDropdown: 'choices__list--dropdown',
item: 'choices__item',
itemSelectable: 'choices__item--selectable',
itemDisabled: 'choices__item--disabled',
itemChoice: 'choices__item--choice',
placeholder: 'choices__placeholder',
group: 'choices__group',
groupHeading: 'choices__heading',
button: 'choices__button',
activeState: 'is-active',
focusState: 'is-focused',
openState: 'is-open',
disabledState: 'is-disabled',
highlightedState: 'is-highlighted',
hiddenState: 'is-hidden',
flippedState: 'is-flipped',
loadingState: 'is-loading'
},
fuseOptions: {
include: 'score'
},
callbackOnInit: null,
callbackOnCreateTemplates: null
};
this.idNames = {
itemChoice: 'item-choice'
};
// Merge options with user options
this.config = (0, _utils.extend)(defaultConfig, userConfig);
if (this.config.renderSelectedChoices !== 'auto' && this.config.renderSelectedChoices !== 'always') {
if (!this.config.silent) {
console.warn('renderSelectedChoices: Possible values are \'auto\' and \'always\'. Falling back to \'auto\'.');
}
this.config.renderSelectedChoices = 'auto';
}
// Create data store
this.store = new _index2.default(this.render);
// State tracking
this.initialised = false;
this.currentState = {};
this.prevState = {};
this.currentValue = '';
// Retrieve triggering element (i.e. element with 'data-choice' trigger)
this.element = element;
this.passedElement = (0, _utils.isType)('String', element) ? document.querySelector(element) : element;
this.isTextElement = this.passedElement.type === 'text';
this.isSelectOneElement = this.passedElement.type === 'select-one';
this.isSelectMultipleElement = this.passedElement.type === 'select-multiple';
this.isSelectElement = this.isSelectOneElement || this.isSelectMultipleElement;
this.isValidElementType = this.isTextElement || this.isSelectElement;
if (!this.passedElement) {
if (!this.config.silent) {
console.error('Passed element not found');
}
return;
}
if (this.config.shouldSortItems === true && this.isSelectOneElement) {
if (!this.config.silent) {
console.warn('shouldSortElements: Type of passed element is \'select-one\', falling back to false.');
}
}
this.highlightPosition = 0;
this.canSearch = this.config.searchEnabled;
// Assign preset choices from passed object
this.presetChoices = this.config.choices;
// Assign preset items from passed object first
this.presetItems = this.config.items;
// Then add any values passed from attribute
if (this.passedElement.value) {
this.presetItems = this.presetItems.concat(this.passedElement.value.split(this.config.delimiter));
}
// Set unique base Id
this.baseId = (0, _utils.generateId)(this.passedElement, 'choices-');
// Bind methods
this.render = this.render.bind(this);
// Bind event handlers
this._onFocus = this._onFocus.bind(this);
this._onBlur = this._onBlur.bind(this);
this._onKeyUp = this._onKeyUp.bind(this);
this._onKeyDown = this._onKeyDown.bind(this);
this._onClick = this._onClick.bind(this);
this._onTouchMove = this._onTouchMove.bind(this);
this._onTouchEnd = this._onTouchEnd.bind(this);
this._onMouseDown = this._onMouseDown.bind(this);
this._onMouseOver = this._onMouseOver.bind(this);
this._onPaste = this._onPaste.bind(this);
this._onInput = this._onInput.bind(this);
// Monitor touch taps/scrolls
this.wasTap = true;
// Cutting the mustard
var cuttingTheMustard = 'classList' in document.documentElement;
if (!cuttingTheMustard && !this.config.silent) {
console.error('Choices: Your browser doesn\'t support Choices');
}
var canInit = (0, _utils.isElement)(this.passedElement) && this.isValidElementType;
if (canInit) {
// If element has already been initalised with Choices
if (this.passedElement.getAttribute('data-choice') === 'active') {
return;
}
// Let's go
this.init();
} else if (!this.config.silent) {
console.error('Incompatible input passed');
}
}
/*========================================
= Public functions =
========================================*/
/**
* Initialise Choices
* @return
* @public
*/
_createClass(Choices, [{
key: 'init',
value: function init() {
if (this.initialised === true) {
return;
}
var callback = this.config.callbackOnInit;
// Set initialise flag
this.initialised = true;
// Create required elements
this._createTemplates();
// Generate input markup
this._createInput();
// Subscribe store to render method
this.store.subscribe(this.render);
// Render any items
this.render();
// Trigger event listeners
this._addEventListeners();
// Run callback if it is a function
if (callback) {
if ((0, _utils.isType)('Function', callback)) {
callback.call(this);
}
}
}
/**
* Destroy Choices and nullify values
* @return
* @public
*/
}, {
key: 'destroy',
value: function destroy() {
if (this.initialised === false) {
return;
}
// Remove all event listeners
this._removeEventListeners();
// Reinstate passed element
this.passedElement.classList.remove(this.config.classNames.input, this.config.classNames.hiddenState);
this.passedElement.removeAttribute('tabindex');
// Recover original styles if any
var origStyle = this.passedElement.getAttribute('data-choice-orig-style');
if (Boolean(origStyle)) {
this.passedElement.removeAttribute('data-choice-orig-style');
this.passedElement.setAttribute('style', origStyle);
} else {
this.passedElement.removeAttribute('style');
}
this.passedElement.removeAttribute('aria-hidden');
this.passedElement.removeAttribute('data-choice');
// Re-assign values - this is weird, I know
this.passedElement.value = this.passedElement.value;
// Move passed element back to original position
this.containerOuter.parentNode.insertBefore(this.passedElement, this.containerOuter);
// Remove added elements
this.containerOuter.parentNode.removeChild(this.containerOuter);
// Clear data store
this.clearStore();
// Nullify instance-specific data
this.config.templates = null;
// Uninitialise
this.initialised = false;
}
/**
* Render group choices into a DOM fragment and append to choice list
* @param {Array} groups Groups to add to list
* @param {Array} choices Choices to add to groups
* @param {DocumentFragment} fragment Fragment to add groups and options to (optional)
* @return {DocumentFragment} Populated options fragment
* @private
*/
}, {
key: 'renderGroups',
value: function renderGroups(groups, choices, fragment) {
var _this = this;
var groupFragment = fragment || document.createDocumentFragment();
var filter = this.config.sortFilter;
// If sorting is enabled, filter groups
if (this.config.shouldSort) {
groups.sort(filter);
}
groups.forEach(function (group) {
// Grab options that are children of this group
var groupChoices = choices.filter(function (choice) {
if (_this.isSelectOneElement) {
return choice.groupId === group.id;
}
return choice.groupId === group.id && !choice.selected;
});
if (groupChoices.length >= 1) {
var dropdownGroup = _this._getTemplate('choiceGroup', group);
groupFragment.appendChild(dropdownGroup);
_this.renderChoices(groupChoices, groupFragment);
}
});
return groupFragment;
}
/**
* Render choices into a DOM fragment and append to choice list
* @param {Array} choices Choices to add to list
* @param {DocumentFragment} fragment Fragment to add choices to (optional)
* @return {DocumentFragment} Populated choices fragment
* @private
*/
}, {
key: 'renderChoices',
value: function renderChoices(choices, fragment) {
var _this2 = this;
// Create a fragment to store our list items (so we don't have to update the DOM for each item)
var choicesFragment = fragment || document.createDocumentFragment();
var filter = this.isSearching ? _utils.sortByScore : this.config.sortFilter;
var renderSelectedChoices = this.config.renderSelectedChoices;
var appendChoice = function appendChoice(choice) {
var shouldRender = renderSelectedChoices === 'auto' ? _this2.isSelectOneElement || !choice.selected : true;
if (shouldRender) {
var dropdownItem = _this2._getTemplate('choice', choice);
choicesFragment.appendChild(dropdownItem);
}
};
// If sorting is enabled or the user is searching, filter choices
if (this.config.shouldSort || this.isSearching) {
choices.sort(filter);
}
if (this.isSearching) {
for (var i = 0; i < this.config.searchResultLimit; i++) {
var choice = choices[i];
if (choice) {
appendChoice(choice);
}
}
} else {
choices.forEach(function (choice) {
return appendChoice(choice);
});
}
return choicesFragment;
}
/**
* Render items into a DOM fragment and append to items list
* @param {Array} items Items to add to list
* @param {DocumentFragment} [fragment] Fragment to add items to (optional)
* @return
* @private
*/
}, {
key: 'renderItems',
value: function renderItems(items) {
var _this3 = this;
var fragment = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
// Create fragment to add elements to
var itemListFragment = fragment || document.createDocumentFragment();
// If sorting is enabled, filter items
if (this.config.shouldSortItems && !this.isSelectOneElement) {
items.sort(this.config.sortFilter);
}
if (this.isTextElement) {
// Simplify store data to just values
var itemsFiltered = this.store.getItemsReducedToValues(items);
var itemsFilteredString = itemsFiltered.join(this.config.delimiter);
// Update the value of the hidden input
this.passedElement.setAttribute('value', itemsFilteredString);
this.passedElement.value = itemsFilteredString;
} else {
var selectedOptionsFragment = document.createDocumentFragment();
// Add each list item to list
items.forEach(function (item) {
// Create a standard select option
var option = _this3._getTemplate('option', item);
// Append it to fragment
selectedOptionsFragment.appendChild(option);
});
// Update selected choices
this.passedElement.innerHTML = '';
this.passedElement.appendChild(selectedOptionsFragment);
}
// Add each list item to list
items.forEach(function (item) {
// Create new list element
var listItem = _this3._getTemplate('item', item);
// Append it to list
itemListFragment.appendChild(listItem);
});
return itemListFragment;
}
/**
* Render DOM with values
* @return
* @private
*/
}, {
key: 'render',
value: function render() {
this.currentState = this.store.getState();
// Only render if our state has actually changed
if (this.currentState !== this.prevState) {
// Choices
if (this.currentState.choices !== this.prevState.choices || this.currentState.groups !== this.prevState.groups) {
if (this.isSelectElement) {
// Get active groups/choices
var activeGroups = this.store.getGroupsFilteredByActive();
var activeChoices = this.store.getChoicesFilteredByActive();
var choiceListFragment = document.createDocumentFragment();
// Clear choices
this.choiceList.innerHTML = '';
// Scroll back to top of choices list
if (this.config.resetScrollPosition) {
this.choiceList.scrollTop = 0;
}
// If we have grouped options
if (activeGroups.length >= 1 && this.isSearching !== true) {
choiceListFragment = this.renderGroups(activeGroups, activeChoices, choiceListFragment);
} else if (activeChoices.length >= 1) {
choiceListFragment = this.renderChoices(activeChoices, choiceListFragment);
}
var activeItems = this.store.getItemsFilteredByActive();
var canAddItem = this._canAddItem(activeItems, this.input.value);
// If we have choices to show
if (choiceListFragment.childNodes && choiceListFragment.childNodes.length > 0) {
// ...and we can select them
if (canAddItem.response) {
// ...append them and highlight the first choice
this.choiceList.appendChild(choiceListFragment);
this._highlightChoice();
} else {
// ...otherwise show a notice
this.choiceList.appendChild(this._getTemplate('notice', canAddItem.notice));
}
} else {
// Otherwise show a notice
var dropdownItem = void 0;
var notice = void 0;
if (this.isSearching) {
notice = (0, _utils.isType)('Function', this.config.noResultsText) ? this.config.noResultsText() : this.config.noResultsText;
dropdownItem = this._getTemplate('notice', notice);
} else {
notice = (0, _utils.isType)('Function', this.config.noChoicesText) ? this.config.noChoicesText() : this.config.noChoicesText;
dropdownItem = this._getTemplate('notice', notice);
}
this.choiceList.appendChild(dropdownItem);
}
}
}
// Items
if (this.currentState.items !== this.prevState.items) {
var _activeItems = this.store.getItemsFilteredByActive();
if (_activeItems) {
// Create a fragment to store our list items
// (so we don't have to update the DOM for each item)
var itemListFragment = this.renderItems(_activeItems);
// Clear list
this.itemList.innerHTML = '';
// If we have items to add
if (itemListFragment.childNodes) {
// Update list
this.itemList.appendChild(itemListFragment);
}
}
}
this.prevState = this.currentState;
}
}
/**
* Select item (a selected item can be deleted)
* @param {Element} item Element to select
* @param {Boolean} [runEvent=true] Whether to trigger 'highlightItem' event
* @return {Object} Class instance
* @public
*/
}, {
key: 'highlightItem',
value: function highlightItem(item) {
var runEvent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
if (!item) {
return this;
}
var id = item.id;
var groupId = item.groupId;
var group = groupId >= 0 ? this.store.getGroupById(groupId) : null;
this.store.dispatch((0, _index3.highlightItem)(id, true));
if (runEvent) {
if (group && group.value) {
(0, _utils.triggerEvent)(this.passedElement, 'highlightItem', {
id: id,
value: item.value,
label: item.label,
groupValue: group.value
});
} else {
(0, _utils.triggerEvent)(this.passedElement, 'highlightItem', {
id: id,
value: item.value,
label: item.label
});
}
}
return this;
}
/**
* Deselect item
* @param {Element} item Element to de-select
* @return {Object} Class instance
* @public
*/
}, {
key: 'unhighlightItem',
value: function unhighlightItem(item) {
if (!item) {
return this;
}
var id = item.id;
var groupId = item.groupId;
var group = groupId >= 0 ? this.store.getGroupById(groupId) : null;
this.store.dispatch((0, _index3.highlightItem)(id, false));
if (group && group.value) {
(0, _utils.triggerEvent)(this.passedElement, 'unhighlightItem', {
id: id,
value: item.value,
label: item.label,
groupValue: group.value
});
} else {
(0, _utils.triggerEvent)(this.passedElement, 'unhighlightItem', {
id: id,
value: item.value,
label: item.label
});
}
return this;
}
/**
* Highlight items within store
* @return {Object} Class instance
* @public
*/
}, {
key: 'highlightAll',
value: function highlightAll() {
var _this4 = this;
var items = this.store.getItems();
items.forEach(function (item) {
_this4.highlightItem(item);
});
return this;
}
/**
* Deselect items within store
* @return {Object} Class instance
* @public
*/
}, {
key: 'unhighlightAll',
value: function unhighlightAll() {
var _this5 = this;
var items = this.store.getItems();
items.forEach(function (item) {
_this5.unhighlightItem(item);
});
return this;
}
/**
* Remove an item from the store by its value
* @param {String} value Value to search for
* @return {Object} Class instance
* @public
*/
}, {
key: 'removeItemsByValue',
value: function removeItemsByValue(value) {
var _this6 = this;
if (!value || !(0, _utils.isType)('String', value)) {
return this;
}
var items = this.store.getItemsFilteredByActive();
items.forEach(function (item) {
if (item.value === value) {
_this6._removeItem(item);
}
});
return this;
}
/**
* Remove all items from store array
* @note Removed items are soft deleted
* @param {Number} excludedId Optionally exclude item by ID
* @return {Object} Class instance
* @public
*/
}, {
key: 'removeActiveItems',
value: function removeActiveItems(excludedId) {
var _this7 = this;
var items = this.store.getItemsFilteredByActive();
items.forEach(function (item) {
if (item.active && excludedId !== item.id) {
_this7._removeItem(item);
}
});
return this;
}
/**
* Remove all selected items from store
* @note Removed items are soft deleted
* @return {Object} Class instance
* @public
*/
}, {
key: 'removeHighlightedItems',
value: function removeHighlightedItems() {
var _this8 = this;
var runEvent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
var items = this.store.getItemsFilteredByActive();
items.forEach(function (item) {
if (item.highlighted && item.active) {
_this8._removeItem(item);
// If this action was performed by the user
// trigger the event
if (runEvent) {
_this8._triggerChange(item.value);
}
}
});
return this;
}
/**
* Show dropdown to user by adding active state class
* @return {Object} Class instance
* @public
*/
}, {
key: 'showDropdown',
value: function showDropdown() {
var focusInput = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
var body = document.body;
var html = document.documentElement;
var winHeight = Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight);
this.containerOuter.classList.add(this.config.classNames.openState);
this.containerOuter.setAttribute('aria-expanded', 'true');
this.dropdown.classList.add(this.config.classNames.activeState);
this.dropdown.setAttribute('aria-expanded', 'true');
var dimensions = this.dropdown.getBoundingClientRect();
var dropdownPos = Math.ceil(dimensions.top + window.scrollY + this.dropdown.offsetHeight);
// If flip is enabled and the dropdown bottom position is greater than the window height flip the dropdown.
var shouldFlip = false;
if (this.config.position === 'auto') {
shouldFlip = dropdownPos >= winHeight;
} else if (this.config.position === 'top') {
shouldFlip = true;
}
if (shouldFlip) {
this.containerOuter.classList.add(this.config.classNames.flippedState);
}
// Optionally focus the input if we have a search input
if (focusInput && this.canSearch && document.activeElement !== this.input) {
this.input.focus();
}
(0, _utils.triggerEvent)(this.passedElement, 'showDropdown', {});
return this;
}
/**
* Hide dropdown from user
* @return {Object} Class instance
* @public
*/
}, {
key: 'hideDropdown',
value: function hideDropdown() {
var blurInput = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
// A dropdown flips if it does not have space within the page
var isFlipped = this.containerOuter.classList.contains(this.config.classNames.flippedState);
this.containerOuter.classList.remove(this.config.classNames.openState);
this.containerOuter.setAttribute('aria-expanded', 'false');
this.dropdown.classList.remove(this.config.classNames.activeState);
this.dropdown.setAttribute('aria-expanded', 'false');
if (isFlipped) {
this.containerOuter.classList.remove(this.config.classNames.flippedState);
}
// Optionally blur the input if we have a search input
if (blurInput && this.canSearch && document.activeElement === this.input) {
this.input.blur();
}
(0, _utils.triggerEvent)(this.passedElement, 'hideDropdown', {});
return this;
}
/**
* Determine whether to hide or show dropdown based on its current state
* @return {Object} Class instance
* @public
*/
}, {
key: 'toggleDropdown',
value: function toggleDropdown() {
var hasActiveDropdown = this.dropdown.classList.contains(this.config.classNames.activeState);
if (hasActiveDropdown) {
this.hideDropdown();
} else {
this.showDropdown(true);
}
return this;
}
/**
* Get value(s) of input (i.e. inputted items (text) or selected choices (select))
* @param {Boolean} valueOnly Get only values of selected items, otherwise return selected items
* @return {Array/String} selected value (select-one) or array of selected items (inputs & select-multiple)
* @public
*/
}, {
key: 'getValue',
value: function getValue() {
var _this9 = this;
var valueOnly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
var items = this.store.getItemsFilteredByActive();
var selectedItems = [];
items.forEach(function (item) {
if (_this9.isTextElement) {
selectedItems.push(valueOnly ? item.value : item);
} else if (item.active) {
selectedItems.push(valueOnly ? item.value : item);
}
});
if (this.isSelectOneElement) {
return selectedItems[0];
}
return selectedItems;
}
/**
* Set value of input. If the input is a select box, a choice will be created and selected otherwise
* an item will created directly.
* @param {Array} args Array of value objects or value strings
* @return {Object} Class instance
* @public
*/
}, {
key: 'setValue',
value: function setValue(args) {
var _this10 = this;
if (this.initialised === true) {
// Convert args to an iterable array
var values = [].concat(_toConsumableArray(args)),
handleValue = function handleValue(item) {
var itemType = (0, _utils.getType)(item);
if (itemType === 'Object') {
if (!item.value) {
return;
}
// If we are dealing with a select input, we need to create an option first
// that is then selected. For text inputs we can just add items normally.
if (!_this10.isTextElement) {
_this10._addChoice(item.value, item.label, true, false, -1, item.customProperties, null);
} else {
_this10._addItem(item.value, item.label, item.id, undefined, item.customProperties, null);
}
} else if (itemType === 'String') {
if (!_this10.isTextElement) {
_this10._addChoice(item, item, true, false, -1, null);
} else {
_this10._addItem(item);
}
}
};
if (values.length > 1) {
values.forEach(function (value) {
handleValue(value);
});
} else {
handleValue(values[0]);
}
}
return this;
}
/**
* Select value of select box via the value of an existing choice
* @param {Array/String} value An array of strings of a single string
* @return {Object} Class instance
* @public
*/
}, {
key: 'setValueByChoice',
value: function setValueByChoice(value) {
var _this11 = this;
if (!this.isTextElement) {
var choices = this.store.getChoices();
// If only one value has been passed, convert to array
var choiceValue = (0, _utils.isType)('Array', value) ? value : [value];
// Loop through each value and
choiceValue.forEach(function (val) {
var foundChoice = choices.find(function (choice) {
// Check 'value' property exists and the choice isn't already selected
return choice.value === val;
});
if (foundChoice) {
if (!foundChoice.selected) {
_this11._addItem(foundChoice.value, foundChoice.label, foundChoice.id, foundChoice.groupId, foundChoice.customProperties, foundChoice.keyCode);
} else if (!_this11.config.silent) {
console.warn('Attempting to select choice already selected');
}
} else if (!_this11.config.silent) {
console.warn('Attempting to select choice that does not exist');
}
});
}
return this;
}
/**
* Direct populate choices
* @param {Array} choices - Choices to insert
* @param {String} value - Name of 'value' property
* @param {String} label - Name of 'label' property
* @param {Boolean} replaceChoices Whether existing choices should be removed
* @return {Object} Class instance
* @public
*/
}, {
key: 'setChoices',
value: function setChoices(choices, value, label) {
var _this12 = this;
var replaceChoices = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
if (this.initialised === true) {
if (this.isSelectElement) {
if (!(0, _utils.isType)('Array', choices) || !value) {
return this;
}
// Clear choices if needed
if (replaceChoices) {
this._clearChoices();
}
// Add choices if passed
if (choices && choices.length) {
this.containerOuter.classList.remove(this.config.classNames.loadingState);
choices.forEach(function (result) {
if (result.choices) {
_this12._addGroup(result, result.id || null, value, label);
} else {
_this12._addChoice(result[value], result[label], result.selected, result.disabled, undefined, result['customProperties'], null);
}
});
}
}
}
return this;
}
/**
* Clear items,choices and groups
* @note Hard delete
* @return {Object} Class instance
* @public
*/
}, {
key: 'clearStore',
value: function clearStore() {
this.store.dispatch((0, _index3.clearAll)());
return this;
}
/**
* Set value of input to blank
* @return {Object} Class instance
* @public
*/
}, {
key: 'clearInput',
value: function clearInput() {
if (this.input.value) {
this.input.value = '';
}
if (!this.isSelectOneElement) {
this._setInputWidth();
}
if (!this.isTextElement && this.config.searchEnabled) {
this.isSearching = false;
this.store.dispatch((0, _index3.activateChoices)(true));
}
return this;
}
/**
* Enable interaction with Choices
* @return {Object} Class instance
*/
}, {
key: 'enable',
value: function enable() {
this.passedElement.disabled = false;
var isDisabled = this.containerOuter.classList.contains(this.config.classNames.disabledState);
if (this.initialised && isDisabled) {
this._addEventListeners();
this.passedElement.removeAttribute('disabled');
this.input.removeAttribute('disabled');
this.containerOuter.classList.remove(this.config.classNames.disabledState);
this.containerOuter.removeAttribute('aria-disabled');
if (this.isSelectOneElement) {
this.containerOuter.setAttribute('tabindex', '0');
}
}
return this;
}
/**
* Disable interaction with Choices
* @return {Object} Class instance
* @public
*/
}, {
key: 'disable',
value: function disable() {
this.passedElement.disabled = true;
var isEnabled = !this.containerOuter.classList.contains(this.config.classNames.disabledState);
if (this.initialised && isEnabled) {
this._removeEventListeners();
this.passedElement.setAttribute('disabled', '');
this.input.setAttribute('disabled', '');
this.containerOuter.classList.add(this.config.classNames.disabledState);
this.containerOuter.setAttribute('aria-disabled', 'true');
if (this.isSelectOneElement) {
this.containerOuter.setAttribute('tabindex', '-1');
}
}
return this;
}
/**
* Populate options via ajax callback
* @param {Function} fn Function that actually makes an AJAX request
* @return {Object} Class instance
* @public
*/
}, {
key: 'ajax',
value: function ajax(fn) {
var _this13 = this;
if (this.initialised === true) {
if (this.isSelectElement) {
// Show loading text
requestAnimationFrame(function () {
_this13._handleLoadingState(true);
});
// Run callback
fn(this._ajaxCallback());
}
}
return this;
}
/*===== End of Public functions ======*/
/*=============================================
= Private functions =
=============================================*/
/**
* Call change callback
* @param {String} value - last added/deleted/selected value
* @return
* @private
*/
}, {
key: '_triggerChange',
value: function _triggerChange(value) {
if (!value) {
return;
}
(0, _utils.triggerEvent)(this.passedElement, 'change', {
value: value
});
}
/**
* Process enter/click of an item button
* @param {Array} activeItems The currently active items
* @param {Element} element Button being interacted with
* @return
* @private
*/
}, {
key: '_handleButtonAction',
value: function _handleButtonAction(activeItems, element) {
if (!activeItems || !element) {
return;
}
// If we are clicking on a button
if (this.config.removeItems && this.config.removeItemButton) {
var itemId = element.parentNode.getAttribute('data-id');
var itemToRemove = activeItems.find(function (item) {
return item.id === parseInt(itemId, 10);
});
// Remove item associated with button
this._removeItem(itemToRemove);
this._triggerChange(itemToRemove.value);
if (this.isSelectOneElement) {
var placeholder = this.config.placeholder ? this.config.placeholderValue || this.passedElement.getAttribute('placeholder') : false;
if (placeholder) {
var placeholderItem = this._getTemplate('placeholder', placeholder);
this.itemList.appendChild(placeholderItem);
}
}
}
}
/**
* Process click of an item
* @param {Array} activeItems The currently active items
* @param {Element} element Item being interacted with
* @param {Boolean} hasShiftKey Whether the user has the shift key active
* @return
* @private
*/
}, {
key: '_handleItemAction',
value: function _handleItemAction(activeItems, element) {
var _this14 = this;
var hasShiftKey = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
if (!activeItems || !element) {
return;
}
// If we are clicking on an item
if (this.config.removeItems && !this.isSelectOneElement) {
var passedId = element.getAttribute('data-id');
// We only want to select one item with a click
// so we deselect any items that aren't the target
// unless shift is being pressed
activeItems.forEach(function (item) {
if (item.id === parseInt(passedId, 10) && !item.highlighted) {
_this14.highlightItem(item);
} else if (!hasShiftKey) {
if (item.highlighted) {
_this14.unhighlightItem(item);
}
}
});
// Focus input as without focus, a user cannot do anything with a
// highlighted item
if (document.activeElement !== this.input) {
this.input.focus();
}
}
}
/**
* Process click of a choice
* @param {Array} activeItems The currently active items
* @param {Element} element Choice being interacted with
* @return
*/
}, {
key: '_handleChoiceAction',
value: function _handleChoiceAction(activeItems, element) {
if (!activeItems || !element) {
return;
}
// If we are clicking on an option
var id = element.getAttribute('data-id');
var choice = this.store.getChoiceById(id);
var passedKeyCode = activeItems[0].keyCode !== null ? activeItems[0].keyCode : null;
var hasActiveDropdown = this.dropdown.classList.contains(this.config.classNames.activeState);
// Update choice keyCode
choice.keyCode = passedKeyCode;
(0, _utils.triggerEvent)(this.passedElement, 'choice', {
choice: choice
});
if (choice && !choice.selected && !choice.disabled) {
var canAddItem = this._canAddItem(activeItems, choice.value);
if (canAddItem.response) {
this._addItem(choice.value, choice.label, choice.id, choice.groupId, choice.customProperties, choice.keyCode);
this._triggerChange(choice.value);
}
}
this.clearInput();
// We wont to close the dropdown if we are dealing with a single select box
if (hasActiveDropdown && this.isSelectOneElement) {
this.hideDropdown();
this.containerOuter.focus();
}
}
/**
* Process back space event
* @param {Array} activeItems items
* @return
* @private
*/
}, {
key: '_handleBackspace',
value: function _handleBackspace(activeItems) {
if (this.config.removeItems && activeItems) {
var lastItem = activeItems[activeItems.length - 1];
var hasHighlightedItems = activeItems.some(function (item) {
return item.highlighted;
});
// If editing the last item is allowed and there are not other selected items,
// we can edit the item value. Otherwise if we can remove items, remove all selected items
if (this.config.editItems && !hasHighlightedItems && lastItem) {
this.input.value = lastItem.value;
this._setInputWidth();
this._removeItem(lastItem);
this._triggerChange(lastItem.value);
} else {
if (!hasHighlightedItems) {
this.highlightItem(lastItem, false);
}
this.removeHighlightedItems(true);
}
}
}
/**
* Validates whether an item can be added by a user
* @param {Array} activeItems The currently active items
* @param {String} value Value of item to add
* @return {Object} Response: Whether user can add item
* Notice: Notice show in dropdown
*/
}, {
key: '_canAddItem',
value: function _canAddItem(activeItems, value) {
var canAddItem = true;
var notice = (0, _utils.isType)('Function', this.config.addItemText) ? this.config.addItemText(value) : this.config.addItemText;
if (this.isSelectMultipleElement || this.isTextElement) {
if (this.config.maxItemCount > 0 && this.config.maxItemCount <= activeItems.length) {
// If there is a max entry limit and we have reached that limit
// don't update
canAddItem = false;
notice = (0, _utils.isType)('Function', this.config.maxItemText) ? this.config.maxItemText(this.config.maxItemCount) : this.config.maxItemText;
}
}
if (this.isTextElement && this.config.addItems && canAddItem) {
// If a user has supplied a regular expression filter
if (this.config.regexFilter) {
// Determine whether we can update based on whether
// our regular expression passes
canAddItem = this._regexFilter(value);
}
}
// If no duplicates are allowed, and the value already exists
// in the array
var isUnique = !activeItems.some(function (item) {
if ((0, _utils.isType)('String', value)) {
return item.value === value.trim();
}
return item.value === value;
});
if (!isUnique && !this.config.duplicateItems && !this.isSelectOneElement && canAddItem) {
canAddItem = false;
notice = (0, _utils.isType)('Function', this.config.uniqueItemText) ? this.config.uniqueItemText(value) : this.config.uniqueItemText;
}
return {
response: canAddItem,
notice: notice
};
}
/**
* Apply or remove a loading state to the component.
* @param {Boolean} isLoading default value set to 'true'.
* @return
* @private
*/
}, {
key: '_handleLoadingState',
value: function _handleLoadingState() {
var isLoading = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
var placeholderItem = this.itemList.querySelector('.' + this.config.classNames.placeholder);
if (isLoading) {
this.containerOuter.classList.add(this.config.classNames.loadingState);
this.containerOuter.setAttribute('aria-busy', 'true');
if (this.isSelectOneElement) {
if (!placeholderItem) {
placeholderItem = this._getTemplate('placeholder', this.config.loadingText);
this.itemList.appendChild(placeholderItem);
} else {
placeholderItem.innerHTML = this.config.loadingText;
}
} else {
this.input.placeholder = this.config.loadingText;
}
} else {
// Remove loading states/text
this.containerOuter.classList.remove(this.config.classNames.loadingState);
var placeholder = this.config.placeholder ? this.config.placeholderValue || this.passedElement.getAttribute('placeholder') : false;
if (this.isSelectOneElement) {
placeholderItem.innerHTML = placeholder || '';
} else {
this.input.placeholder = placeholder || '';
}
}
}
/**
* Retrieve the callback used to populate component's choices in an async way.
* @returns {Function} The callback as a function.
* @private
*/
}, {
key: '_ajaxCallback',
value: function _ajaxCallback() {
var _this15 = this;
return function (results, value, label) {
if (!results || !value) {
return;
}
var parsedResults = (0, _utils.isType)('Object', results) ? [results] : results;
if (parsedResults && (0, _utils.isType)('Array', parsedResults) && parsedResults.length) {
// Remove loading states/text
_this15._handleLoadingState(false);
// Add each result as a choice
parsedResults.forEach(function (result) {
if (result.choices) {
var groupId = result.id || null;
_this15._addGroup(result, groupId, value, label);
} else {
_this15._addChoice(result[value], result[label], result.selected, result.disabled, undefined, result['customProperties'], null);
}
});
} else {
// No results, remove loading state
_this15._handleLoadingState(false);
}
_this15.containerOuter.removeAttribute('aria-busy');
};
}
/**
* Filter choices based on search value
* @param {String} value Value to filter by
* @return
* @private
*/
}, {
key: '_searchChoices',
value: function _searchChoices(value) {
var newValue = (0, _utils.isType)('String', value) ? value.trim() : value;
var currentValue = (0, _utils.isType)('String', this.currentValue) ? this.currentValue.trim() : this.currentValue;
// If new value matches the desired length and is not the same as the current value with a space
if (newValue.length >= 1 && newValue !== currentValue + ' ') {
var haystack = this.store.getChoicesFilteredBySelectable();
var needle = newValue;
var keys = (0, _utils.isType)('Array', this.config.searchFields) ? this.config.searchFields : [this.config.searchFields];
var options = Object.assign(this.config.fuseOptions, { keys: keys });
var fuse = new _fuse2.default(haystack, options);
var results = fuse.search(needle);
this.currentValue = newValue;
this.highlightPosition = 0;
this.isSearching = true;
this.store.dispatch((0, _index3.filterChoices)(results));
}
}
/**
* Determine the action when a user is searching
* @param {String} value Value entered by user
* @return
* @private
*/
}, {
key: '_handleSearch',
value: function _handleSearch(value) {
if (!value) {
return;
}
var choices = this.store.getChoices();
var hasUnactiveChoices = choices.some(function (option) {
return !option.active;
});
// Run callback if it is a function
if (this.input === document.activeElement) {
// Check that we have a value to search and the input was an alphanumeric character
if (value && value.length >= this.config.searchFloor) {
// Check flag to filter search input
if (this.config.searchChoices) {
// Filter available choices
this._searchChoices(value);
}
// Trigger search event
(0, _utils.triggerEvent)(this.passedElement, 'search', {
value: value
});
} else if (hasUnactiveChoices) {
// Otherwise reset choices to active
this.isSearching = false;
this.store.dispatch((0, _index3.activateChoices)(true));
}
}
}
/**
* Trigger event listeners
* @return
* @private
*/
}, {
key: '_addEventListeners',
value: function _addEventListeners() {
document.addEventListener('keyup', this._onKeyUp);
document.addEventListener('keydown', this._onKeyDown);
document.addEventListener('click', this._onClick);
document.addEventListener('touchmove', this._onTouchMove);
document.addEventListener('touchend', this._onTouchEnd);
document.addEventListener('mousedown', this._onMouseDown);
document.addEventListener('mouseover', this._onMouseOver);
if (this.isSelectOneElement) {
this.containerOuter.addEventListener('focus', this._onFocus);
this.containerOuter.addEventListener('blur', this._onBlur);
}
this.input.addEventListener('input', this._onInput);
this.input.addEventListener('paste', this._onPaste);
this.input.addEventListener('focus', this._onFocus);
this.input.addEventListener('blur', this._onBlur);
}
/**
* Remove event listeners
* @return
* @private
*/
}, {
key: '_removeEventListeners',
value: function _removeEventListeners() {
document.removeEventListener('keyup', this._onKeyUp);
document.removeEventListener('keydown', this._onKeyDown);
document.removeEventListener('click', this._onClick);
document.removeEventListener('touchmove', this._onTouchMove);
document.removeEventListener('touchend', this._onTouchEnd);
document.removeEventListener('mousedown', this._onMouseDown);
document.removeEventListener('mouseover', this._onMouseOver);
if (this.isSelectOneElement) {
this.containerOuter.removeEventListener('focus', this._onFocus);
this.containerOuter.removeEventListener('blur', this._onBlur);
}
this.input.removeEventListener('input', this._onInput);
this.input.removeEventListener('paste', this._onPaste);
this.input.removeEventListener('focus', this._onFocus);
this.input.removeEventListener('blur', this._onBlur);
}
/**
* Set the correct input width based on placeholder
* value or input value
* @return
*/
}, {
key: '_setInputWidth',
value: function _setInputWidth() {
if (this.config.placeholderValue || this.passedElement.getAttribute('placeholder') && this.config.placeholder) {
// If there is a placeholder, we only want to set the width of the input when it is a greater
// length than 75% of the placeholder. This stops the input jumping around.
var placeholder = this.config.placeholder ? this.config.placeholderValue || this.passedElement.getAttribute('placeholder') : false;
if (this.input.value && this.input.value.length >= placeholder.length / 1.25) {
this.input.style.width = (0, _utils.getWidthOfInput)(this.input);
}
} else {
// If there is no placeholder, resize input to contents
this.input.style.width = (0, _utils.getWidthOfInput)(this.input);
}
}
/**
* Key down event
* @param {Object} e Event
* @return
*/
}, {
key: '_onKeyDown',
value: function _onKeyDown(e) {
var _this16 = this,
_keyDownActions;
if (e.target !== this.input && !this.containerOuter.contains(e.target)) {
return;
}
var target = e.target;
var activeItems = this.store.getItemsFilteredByActive();
var hasFocusedInput = this.input === document.activeElement;
var hasActiveDropdown = this.dropdown.classList.contains(this.config.classNames.activeState);
var hasItems = this.itemList && this.itemList.children;
var keyString = String.fromCharCode(e.keyCode);
var backKey = 46;
var deleteKey = 8;
var enterKey = 13;
var aKey = 65;
var escapeKey = 27;
var upKey = 38;
var downKey = 40;
var pageUpKey = 33;
var pageDownKey = 34;
var ctrlDownKey = e.ctrlKey || e.metaKey;
// If a user is typing and the dropdown is not active
if (!this.isTextElement && /[a-zA-Z0-9-_ ]/.test(keyString) && !hasActiveDropdown) {
this.showDropdown(true);
}
this.canSearch = this.config.searchEnabled;
var onAKey = function onAKey() {
// If CTRL + A or CMD + A have been pressed and there are items to select
if (ctrlDownKey && hasItems) {
_this16.canSearch = false;
if (_this16.config.removeItems && !_this16.input.value && _this16.input === document.activeElement) {
// Highlight items
_this16.highlightAll();
}
}
};
var onEnterKey = function onEnterKey() {
// If enter key is pressed and the input has a value
if (_this16.isTextElement && target.value) {
var value = _this16.input.value;
var canAddItem = _this16._canAddItem(activeItems, value);
// All is good, add
if (canAddItem.response) {
if (hasActiveDropdown) {
_this16.hideDropdown();
}
_this16._addItem(value);
_this16._triggerChange(value);
_this16.clearInput();
}
}
if (target.hasAttribute('data-button')) {
_this16._handleButtonAction(activeItems, target);
e.preventDefault();
}
if (hasActiveDropdown) {
e.preventDefault();
var highlighted = _this16.dropdown.querySelector('.' + _this16.config.classNames.highlightedState);
// If we have a highlighted choice
if (highlighted) {
// add enter keyCode value
activeItems[0].keyCode = enterKey;
_this16._handleChoiceAction(activeItems, highlighted);
}
} else if (_this16.isSelectOneElement) {
// Open single select dropdown if it's not active
if (!hasActiveDropdown) {
_this16.showDropdown(true);
e.preventDefault();
}
}
};
var onEscapeKey = function onEscapeKey() {
if (hasActiveDropdown) {
_this16.toggleDropdown();
_this16.containerOuter.focus();
}
};
var onDirectionKey = function onDirectionKey() {
// If up or down key is pressed, traverse through options
if (hasActiveDropdown || _this16.isSelectOneElement) {
// Show dropdown if focus
if (!hasActiveDropdown) {
_this16.showDropdown(true);
}
_this16.canSearch = false;
var directionInt = e.keyCode === downKey || e.keyCode === pageDownKey ? 1 : -1;
var skipKey = e.metaKey || e.keyCode === pageDownKey || e.keyCode === pageUpKey;
var nextEl = void 0;
if (skipKey) {
if (directionInt > 0) {
nextEl = Array.from(_this16.dropdown.querySelectorAll('[data-choice-selectable]')).pop();
} else {
nextEl = _this16.dropdown.querySelector('[data-choice-selectable]');
}
} else {
var currentEl = _this16.dropdown.querySelector('.' + _this16.config.classNames.highlightedState);
if (currentEl) {
nextEl = (0, _utils.getAdjacentEl)(currentEl, '[data-choice-selectable]', directionInt);
} else {
nextEl = _this16.dropdown.querySelector('[data-choice-selectable]');
}
}
if (nextEl) {
// We prevent default to stop the cursor moving
// when pressing the arrow
if (!(0, _utils.isScrolledIntoView)(nextEl, _this16.choiceList, directionInt)) {
_this16._scrollToChoice(nextEl, directionInt);
}
_this16._highlightChoice(nextEl);
}
// Prevent default to maintain cursor position whilst
// traversing dropdown options
e.preventDefault();
}
};
var onDeleteKey = function onDeleteKey() {
// If backspace or delete key is pressed and the input has no value
if (hasFocusedInput && !e.target.value && !_this16.isSelectOneElement) {
_this16._handleBackspace(activeItems);
e.preventDefault();
}
};
// Map keys to key actions
var keyDownActions = (_keyDownActions = {}, _defineProperty(_keyDownActions, aKey, onAKey), _defineProperty(_keyDownActions, enterKey, onEnterKey), _defineProperty(_keyDownActions, escapeKey, onEscapeKey), _defineProperty(_keyDownActions, upKey, onDirectionKey), _defineProperty(_keyDownActions, pageUpKey, onDirectionKey), _defineProperty(_keyDownActions, downKey, onDirectionKey), _defineProperty(_keyDownActions, pageDownKey, onDirectionKey), _defineProperty(_keyDownActions, deleteKey, onDeleteKey), _defineProperty(_keyDownActions, backKey, onDeleteKey), _keyDownActions);
// If keycode has a function, run it
if (keyDownActions[e.keyCode]) {
keyDownActions[e.keyCode]();
}
}
/**
* Key up event
* @param {Object} e Event
* @return
* @private
*/
}, {
key: '_onKeyUp',
value: function _onKeyUp(e) {
if (e.target !== this.input) {
return;
}
var value = this.input.value;
var activeItems = this.store.getItemsFilteredByActive();
var canAddItem = this._canAddItem(activeItems, value);
// We are typing into a text input and have a value, we want to show a dropdown
// notice. Otherwise hide the dropdown
if (this.isTextElement) {
var hasActiveDropdown = this.dropdown.classList.contains(this.config.classNames.activeState);
if (value) {
if (canAddItem.notice) {
var dropdownItem = this._getTemplate('notice', canAddItem.notice);
this.dropdown.innerHTML = dropdownItem.outerHTML;
}
if (canAddItem.response === true) {
if (!hasActiveDropdown) {
this.showDropdown();
}
} else if (!canAddItem.notice && hasActiveDropdown) {
this.hideDropdown();
}
} else if (hasActiveDropdown) {
this.hideDropdown();
}
} else {
var backKey = 46;
var deleteKey = 8;
// If user has removed value...
if ((e.keyCode === backKey || e.keyCode === deleteKey) && !e.target.value) {
// ...and it is a multiple select input, activate choices (if searching)
if (!this.isTextElement && this.isSearching) {
this.isSearching = false;
this.store.dispatch((0, _index3.activateChoices)(true));
}
} else if (this.canSearch && canAddItem.response) {
this._handleSearch(this.input.value);
}
}
// Re-establish canSearch value from changes in _onKeyDown
this.canSearch = this.config.searchEnabled;
}
/**
* Input event
* @return
* @private
*/
}, {
key: '_onInput',
value: function _onInput() {
if (!this.isSelectOneElement) {
this._setInputWidth();
}
}
/**
* Touch move event
* @return
* @private
*/
}, {
key: '_onTouchMove',
value: function _onTouchMove() {
if (this.wasTap === true) {
this.wasTap = false;
}
}
/**
* Touch end event
* @param {Object} e Event
* @return
* @private
*/
}, {
key: '_onTouchEnd',
value: function _onTouchEnd(e) {
var target = e.target || e.touches[0].target;
var hasActiveDropdown = this.dropdown.classList.contains(this.config.classNames.activeState);
// If a user tapped within our container...
if (this.wasTap === true && this.containerOuter.contains(target)) {
// ...and we aren't dealing with a single select box, show dropdown/focus input
if ((target === this.containerOuter || target === this.containerInner) && !this.isSelectOneElement) {
if (this.isTextElement) {
// If text element, we only want to focus the input (if it isn't already)
if (document.activeElement !== this.input) {
this.input.focus();
}
} else {
if (!hasActiveDropdown) {
// If a select box, we want to show the dropdown
this.showDropdown(true);
}
}
}
// Prevents focus event firing
e.stopPropagation();
}
this.wasTap = true;
}
/**
* Mouse down event
* @param {Object} e Event
* @return
* @private
*/
}, {
key: '_onMouseDown',
value: function _onMouseDown(e) {
var target = e.target;
if (this.containerOuter.contains(target) && target !== this.input) {
var foundTarget = void 0;
var activeItems = this.store.getItemsFilteredByActive();
var hasShiftKey = e.shiftKey;
if (foundTarget = (0, _utils.findAncestorByAttrName)(target, 'data-button')) {
this._handleButtonAction(activeItems, foundTarget);
} else if (foundTarget = (0, _utils.findAncestorByAttrName)(target, 'data-item')) {
this._handleItemAction(activeItems, foundTarget, hasShiftKey);
} else if (foundTarget = (0, _utils.findAncestorByAttrName)(target, 'data-choice')) {
this._handleChoiceAction(activeItems, foundTarget);
}
e.preventDefault();
}
}
/**
* Click event
* @param {Object} e Event
* @return
* @private
*/
}, {
key: '_onClick',
value: function _onClick(e) {
var target = e.target;
var hasActiveDropdown = this.dropdown.classList.contains(this.config.classNames.activeState);
var activeItems = this.store.getItemsFilteredByActive();
// If target is something that concerns us
if (this.containerOuter.contains(target)) {
// Handle button delete
if (target.hasAttribute('data-button')) {
this._handleButtonAction(activeItems, target);
}
if (!hasActiveDropdown) {
if (this.isTextElement) {
if (document.activeElement !== this.input) {
this.input.focus();
}
} else {
if (this.canSearch) {
this.showDropdown(true);
} else {
this.showDropdown();
this.containerOuter.focus();
}
}
} else if (this.isSelectOneElement && target !== this.input && !this.dropdown.contains(target)) {
this.hideDropdown(true);
}
} else {
var hasHighlightedItems = activeItems.some(function (item) {
return item.highlighted;
});
// De-select any highlighted items
if (hasHighlightedItems) {
this.unhighlightAll();
}
// Remove focus state
this.containerOuter.classList.remove(this.config.classNames.focusState);
// Close all other dropdowns
if (hasActiveDropdown) {
this.hideDropdown();
}
}
}
/**
* Mouse over (hover) event
* @param {Object} e Event
* @return
* @private
*/
}, {
key: '_onMouseOver',
value: function _onMouseOver(e) {
// If the dropdown is either the target or one of its children is the target
if (e.target === this.dropdown || this.dropdown.contains(e.target)) {
if (e.target.hasAttribute('data-choice')) this._highlightChoice(e.target);
}
}
/**
* Paste event
* @param {Object} e Event
* @return
* @private
*/
}, {
key: '_onPaste',
value: function _onPaste(e) {
// Disable pasting into the input if option has been set
if (e.target === this.input && !this.config.paste) {
e.preventDefault();
}
}
/**
* Focus event
* @param {Object} e Event
* @return
* @private
*/
}, {
key: '_onFocus',
value: function _onFocus(e) {
var _this17 = this;
var target = e.target;
// If target is something that concerns us
if (this.containerOuter.contains(target)) {
var hasActiveDropdown = this.dropdown.classList.contains(this.config.classNames.activeState);
var focusActions = {
text: function text() {
if (target === _this17.input) {
_this17.containerOuter.classList.add(_this17.config.classNames.focusState);
}
},
'select-one': function selectOne() {
_this17.containerOuter.classList.add(_this17.config.classNames.focusState);
if (target === _this17.input) {
// Show dropdown if it isn't already showing
if (!hasActiveDropdown) {
_this17.showDropdown();
}
}
},
'select-multiple': function selectMultiple() {
if (target === _this17.input) {
// If element is a select box, the focused element is the container and the dropdown
// isn't already open, focus and show dropdown
_this17.containerOuter.classList.add(_this17.config.classNames.focusState);
if (!hasActiveDropdown) {
_this17.showDropdown(true);
}
}
}
};
focusActions[this.passedElement.type]();
}
}
/**
* Blur event
* @param {Object} e Event
* @return
* @private
*/
}, {
key: '_onBlur',
value: function _onBlur(e) {
var _this18 = this;
var target = e.target;
// If target is something that concerns us
if (this.containerOuter.contains(target)) {
var activeItems = this.store.getItemsFilteredByActive();
var hasActiveDropdown = this.dropdown.classList.contains(this.config.classNames.activeState);
var hasHighlightedItems = activeItems.some(function (item) {
return item.highlighted;
});
var blurActions = {
text: function text() {
if (target === _this18.input) {
// Remove the focus state
_this18.containerOuter.classList.remove(_this18.config.classNames.focusState);
// De-select any highlighted items
if (hasHighlightedItems) {
_this18.unhighlightAll();
}
// Hide dropdown if it is showing
if (hasActiveDropdown) {
_this18.hideDropdown();
}
}
},
'select-one': function selectOne() {
_this18.containerOuter.classList.remove(_this18.config.classNames.focusState);
if (target === _this18.containerOuter) {
// Hide dropdown if it is showing
if (hasActiveDropdown && !_this18.canSearch) {
_this18.hideDropdown();
}
}
if (target === _this18.input && hasActiveDropdown) {
// Hide dropdown if it is showing
_this18.hideDropdown();
}
},
'select-multiple': function selectMultiple() {
if (target === _this18.input) {
// Remove the focus state
_this18.containerOuter.classList.remove(_this18.config.classNames.focusState);
// Hide dropdown if it is showing
if (hasActiveDropdown) {
_this18.hideDropdown();
}
// De-select any highlighted items
if (hasHighlightedItems) {
_this18.unhighlightAll();
}
}
}
};
blurActions[this.passedElement.type]();
}
}
/**
* Tests value against a regular expression
* @param {string} value Value to test
* @return {Boolean} Whether test passed/failed
* @private
*/
}, {
key: '_regexFilter',
value: function _regexFilter(value) {
if (!value) {
return false;
}
var regex = this.config.regexFilter;
var expression = new RegExp(regex.source, 'i');
return expression.test(value);
}
/**
* Scroll to an option element
* @param {HTMLElement} choice Option to scroll to
* @param {Number} direction Whether option is above or below
* @return
* @private
*/
}, {
key: '_scrollToChoice',
value: function _scrollToChoice(choice, direction) {
var _this19 = this;
if (!choice) {
return;
}
var dropdownHeight = this.choiceList.offsetHeight;
var choiceHeight = choice.offsetHeight;
// Distance from bottom of element to top of parent
var choicePos = choice.offsetTop + choiceHeight;
// Scroll position of dropdown
var containerScrollPos = this.choiceList.scrollTop + dropdownHeight;
// Difference between the choice and scroll position
var endPoint = direction > 0 ? this.choiceList.scrollTop + choicePos - containerScrollPos : choice.offsetTop;
var animateScroll = function animateScroll() {
var strength = 4;
var choiceListScrollTop = _this19.choiceList.scrollTop;
var continueAnimation = false;
var easing = void 0;
var distance = void 0;
if (direction > 0) {
easing = (endPoint - choiceListScrollTop) / strength;
distance = easing > 1 ? easing : 1;
_this19.choiceList.scrollTop = choiceListScrollTop + distance;
if (choiceListScrollTop < endPoint) {
continueAnimation = true;
}
} else {
easing = (choiceListScrollTop - endPoint) / strength;
distance = easing > 1 ? easing : 1;
_this19.choiceList.scrollTop = choiceListScrollTop - distance;
if (choiceListScrollTop > endPoint) {
continueAnimation = true;
}
}
if (continueAnimation) {
requestAnimationFrame(function (time) {
animateScroll(time, endPoint, direction);
});
}
};
requestAnimationFrame(function (time) {
animateScroll(time, endPoint, direction);
});
}
/**
* Highlight choice
* @param {HTMLElement} [el] Element to highlight
* @return
* @private
*/
}, {
key: '_highlightChoice',
value: function _highlightChoice() {
var _this20 = this;
var el = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
// Highlight first element in dropdown
var choices = Array.from(this.dropdown.querySelectorAll('[data-choice-selectable]'));
var passedEl = el;
if (choices && choices.length) {
var highlightedChoices = Array.from(this.dropdown.querySelectorAll('.' + this.config.classNames.highlightedState));
// Remove any highlighted choices
highlightedChoices.forEach(function (choice) {
choice.classList.remove(_this20.config.classNames.highlightedState);
choice.setAttribute('aria-selected', 'false');
});
if (passedEl) {
this.highlightPosition = choices.indexOf(passedEl);
} else {
// Highlight choice based on last known highlight location
if (choices.length > this.highlightPosition) {
// If we have an option to highlight
passedEl = choices[this.highlightPosition];
} else {
// Otherwise highlight the option before
passedEl = choices[choices.length - 1];
}
if (!passedEl) {
passedEl = choices[0];
}
}
// Highlight given option, and set accessiblity attributes
passedEl.classList.add(this.config.classNames.highlightedState);
passedEl.setAttribute('aria-selected', 'true');
this.containerOuter.setAttribute('aria-activedescendant', passedEl.id);
this.input.setAttribute('aria-activedescendant', passedEl.id);
}
}
/**
* Add item to store with correct value
* @param {String} value Value to add to store
* @param {String} [label] Label to add to store
* @param {Number} [choiceId=-1] ID of the associated choice that was selected
* @param {Number} [groupId=-1] ID of group choice is within. Negative number indicates no group
* @param {Object} [customProperties] Object containing user defined properties
* @return {Object} Class instance
* @public
*/
}, {
key: '_addItem',
value: function _addItem(value) {
var label = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
var choiceId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : -1;
var groupId = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : -1;
var customProperties = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
var keyCode = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : null;
var passedValue = (0, _utils.isType)('String', value) ? value.trim() : value;
var passedKeyCode = keyCode;
var items = this.store.getItems();
var passedLabel = label || passedValue;
var passedOptionId = parseInt(choiceId, 10) || -1;
// Get group if group ID passed
var group = groupId >= 0 ? this.store.getGroupById(groupId) : null;
// Generate unique id
var id = items ? items.length + 1 : 1;
// If a prepended value has been passed, prepend it
if (this.config.prependValue) {
passedValue = this.config.prependValue + passedValue.toString();
}
// If an appended value has been passed, append it
if (this.config.appendValue) {
passedValue += this.config.appendValue.toString();
}
this.store.dispatch((0, _index3.addItem)(passedValue, passedLabel, id, passedOptionId, groupId, customProperties, passedKeyCode));
if (this.isSelectOneElement) {
this.removeActiveItems(id);
}
// Trigger change event
if (group && group.value) {
(0, _utils.triggerEvent)(this.passedElement, 'addItem', {
id: id,
value: passedValue,
label: passedLabel,
groupValue: group.value,
keyCode: passedKeyCode
});
} else {
(0, _utils.triggerEvent)(this.passedElement, 'addItem', {
id: id,
value: passedValue,
label: passedLabel,
keyCode: passedKeyCode
});
}
return this;
}
/**
* Remove item from store
* @param {Object} item Item to remove
* @return {Object} Class instance
* @public
*/
}, {
key: '_removeItem',
value: function _removeItem(item) {
if (!item || !(0, _utils.isType)('Object', item)) {
return this;
}
var id = item.id;
var value = item.value;
var label = item.label;
var choiceId = item.choiceId;
var groupId = item.groupId;
var group = groupId >= 0 ? this.store.getGroupById(groupId) : null;
this.store.dispatch((0, _index3.removeItem)(id, choiceId));
if (group && group.value) {
(0, _utils.triggerEvent)(this.passedElement, 'removeItem', {
id: id,
value: value,
label: label,
groupValue: group.value
});
} else {
(0, _utils.triggerEvent)(this.passedElement, 'removeItem', {
id: id,
value: value,
label: label
});
}
return this;
}
/**
* Add choice to dropdown
* @param {String} value Value of choice
* @param {String} [label] Label of choice
* @param {Boolean} [isSelected=false] Whether choice is selected
* @param {Boolean} [isDisabled=false] Whether choice is disabled
* @param {Number} [groupId=-1] ID of group choice is within. Negative number indicates no group
* @param {Object} [customProperties] Object containing user defined properties
* @return
* @private
*/
}, {
key: '_addChoice',
value: function _addChoice(value) {
var label = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
var isSelected = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
var isDisabled = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
var groupId = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : -1;
var customProperties = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : null;
var keyCode = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : null;
if (typeof value === 'undefined' || value === null) {
return;
}
// Generate unique id
var choices = this.store.getChoices();
var choiceLabel = label || value;
var choiceId = choices ? choices.length + 1 : 1;
var choiceElementId = this.baseId + '-' + this.idNames.itemChoice + '-' + choiceId;
this.store.dispatch((0, _index3.addChoice)(value, choiceLabel, choiceId, groupId, isDisabled, choiceElementId, customProperties, keyCode));
if (isSelected) {
this._addItem(value, choiceLabel, choiceId, undefined, customProperties, keyCode);
}
}
/**
* Clear all choices added to the store.
* @return
* @private
*/
}, {
key: '_clearChoices',
value: function _clearChoices() {
this.store.dispatch((0, _index3.clearChoices)());
}
/**
* Add group to dropdown
* @param {Object} group Group to add
* @param {Number} id Group ID
* @param {String} [valueKey] name of the value property on the object
* @param {String} [labelKey] name of the label property on the object
* @return
* @private
*/
}, {
key: '_addGroup',
value: function _addGroup(group, id) {
var _this21 = this;
var valueKey = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'value';
var labelKey = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'label';
var groupChoices = (0, _utils.isType)('Object', group) ? group.choices : Array.from(group.getElementsByTagName('OPTION'));
var groupId = id ? id : Math.floor(new Date().valueOf() * Math.random());
var isDisabled = group.disabled ? group.disabled : false;
if (groupChoices) {
this.store.dispatch((0, _index3.addGroup)(group.label, groupId, true, isDisabled));
groupChoices.forEach(function (option) {
var isOptDisabled = option.disabled || option.parentNode && option.parentNode.disabled;
var label = (0, _utils.isType)('Object', option) ? option[labelKey] : option.innerHTML;
_this21._addChoice(option[valueKey], label, option.selected, isOptDisabled, groupId, option.customProperties);
});
} else {
this.store.dispatch((0, _index3.addGroup)(group.label, group.id, false, group.disabled));
}
}
/**
* Get template from name
* @param {String} template Name of template to get
* @param {...} args Data to pass to template
* @return {HTMLElement} Template
* @private
*/
}, {
key: '_getTemplate',
value: function _getTemplate(template) {
if (!template) {
return null;
}
var templates = this.config.templates;
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
return templates[template].apply(templates, args);
}
/**
* Create HTML element based on type and arguments
* @return
* @private
*/
}, {
key: '_createTemplates',
value: function _createTemplates() {
var _this22 = this;
var globalClasses = this.config.classNames;
var templates = {
containerOuter: function containerOuter(direction) {
return (0, _utils.strToEl)('\n <div\n class="' + globalClasses.containerOuter + '"\n ' + (_this22.isSelectElement ? _this22.config.searchEnabled ? 'role="combobox" aria-autocomplete="list"' : 'role="listbox"' : '') + '\n data-type="' + _this22.passedElement.type + '"\n ' + (_this22.isSelectOneElement ? 'tabindex="0"' : '') + '\n aria-haspopup="true"\n aria-expanded="false"\n dir="' + direction + '"\n >\n </div>\n ');
},
containerInner: function containerInner() {
return (0, _utils.strToEl)('\n <div class="' + globalClasses.containerInner + '"></div>\n ');
},
itemList: function itemList() {
var _classNames;
var localClasses = (0, _classnames2.default)(globalClasses.list, (_classNames = {}, _defineProperty(_classNames, globalClasses.listSingle, _this22.isSelectOneElement), _defineProperty(_classNames, globalClasses.listItems, !_this22.isSelectOneElement), _classNames));
return (0, _utils.strToEl)('\n <div class="' + localClasses + '"></div>\n ');
},
placeholder: function placeholder(value) {
return (0, _utils.strToEl)('\n <div class="' + globalClasses.placeholder + '">\n ' + value + '\n </div>\n ');
},
item: function item(data) {
var _classNames2;
var localClasses = (0, _classnames2.default)(globalClasses.item, (_classNames2 = {}, _defineProperty(_classNames2, globalClasses.highlightedState, data.highlighted), _defineProperty(_classNames2, globalClasses.itemSelectable, !data.highlighted), _classNames2));
if (_this22.config.removeItemButton) {
var _classNames3;
localClasses = (0, _classnames2.default)(globalClasses.item, (_classNames3 = {}, _defineProperty(_classNames3, globalClasses.highlightedState, data.highlighted), _defineProperty(_classNames3, globalClasses.itemSelectable, !data.disabled), _classNames3));
return (0, _utils.strToEl)('\n <div\n class="' + localClasses + '"\n data-item\n data-id="' + data.id + '"\n data-value="' + data.value + '"\n data-deletable\n ' + (data.active ? 'aria-selected="true"' : '') + '\n ' + (data.disabled ? 'aria-disabled="true"' : '') + '\n >\n ' + data.label + '<!--\n --><button\n type="button"\n class="' + globalClasses.button + '"\n data-button\n aria-label="Remove item: \'' + data.value + '\'"\n >\n Remove item\n </button>\n </div>\n ');
}
return (0, _utils.strToEl)('\n <div\n class="' + localClasses + '"\n data-item\n data-id="' + data.id + '"\n data-value="' + data.value + '"\n ' + (data.active ? 'aria-selected="true"' : '') + '\n ' + (data.disabled ? 'aria-disabled="true"' : '') + '\n >\n ' + data.label + '\n </div>\n ');
},
choiceList: function choiceList() {
return (0, _utils.strToEl)('\n <div\n class="' + globalClasses.list + '"\n dir="ltr"\n role="listbox"\n ' + (!_this22.isSelectOneElement ? 'aria-multiselectable="true"' : '') + '\n >\n </div>\n ');
},
choiceGroup: function choiceGroup(data) {
var localClasses = (0, _classnames2.default)(globalClasses.group, _defineProperty({}, globalClasses.itemDisabled, data.disabled));
return (0, _utils.strToEl)('\n <div\n class="' + localClasses + '"\n data-group\n data-id="' + data.id + '"\n data-value="' + data.value + '"\n role="group"\n ' + (data.disabled ? 'aria-disabled="true"' : '') + '\n >\n <div class="' + globalClasses.groupHeading + '">' + data.value + '</div>\n </div>\n ');
},
choice: function choice(data) {
var _classNames5;
var localClasses = (0, _classnames2.default)(globalClasses.item, globalClasses.itemChoice, (_classNames5 = {}, _defineProperty(_classNames5, globalClasses.itemDisabled, data.disabled), _defineProperty(_classNames5, globalClasses.itemSelectable, !data.disabled), _classNames5));
return (0, _utils.strToEl)('\n <div\n class="' + localClasses + '"\n data-select-text="' + _this22.config.itemSelectText + '"\n data-choice\n data-id="' + data.id + '"\n data-value="' + data.value + '"\n ' + (data.disabled ? 'data-choice-disabled aria-disabled="true"' : 'data-choice-selectable') + '\n id="' + data.elementId + '"\n ' + (data.groupId > 0 ? 'role="treeitem"' : 'role="option"') + '\n >\n ' + data.label + '\n </div>\n ');
},
input: function input() {
var localClasses = (0, _classnames2.default)(globalClasses.input, globalClasses.inputCloned);
return (0, _utils.strToEl)('\n <input\n type="text"\n class="' + localClasses + '"\n autocomplete="off"\n autocapitalize="off"\n spellcheck="false"\n role="textbox"\n aria-autocomplete="list"\n >\n ');
},
dropdown: function dropdown() {
var localClasses = (0, _classnames2.default)(globalClasses.list, globalClasses.listDropdown);
return (0, _utils.strToEl)('\n <div\n class="' + localClasses + '"\n aria-expanded="false"\n >\n </div>\n ');
},
notice: function notice(label) {
var localClasses = (0, _classnames2.default)(globalClasses.item, globalClasses.itemChoice);
return (0, _utils.strToEl)('\n <div class="' + localClasses + '">\n ' + label + '\n </div>\n ');
},
option: function option(data) {
return (0, _utils.strToEl)('\n <option value="' + data.value + '" selected>' + data.label + '</option>\n ');
}
};
// User's custom templates
var callbackTemplate = this.config.callbackOnCreateTemplates;
var userTemplates = {};
if (callbackTemplate && (0, _utils.isType)('Function', callbackTemplate)) {
userTemplates = callbackTemplate.call(this, _utils.strToEl);
}
this.config.templates = (0, _utils.extend)(templates, userTemplates);
}
/**
* Create DOM structure around passed select element
* @return
* @private
*/
}, {
key: '_createInput',
value: function _createInput() {
var _this23 = this;
var direction = this.passedElement.getAttribute('dir') || 'ltr';
var containerOuter = this._getTemplate('containerOuter', direction);
var containerInner = this._getTemplate('containerInner');
var itemList = this._getTemplate('itemList');
var choiceList = this._getTemplate('choiceList');
var input = this._getTemplate('input');
var dropdown = this._getTemplate('dropdown');
var placeholder = this.config.placeholder ? this.config.placeholderValue || this.passedElement.getAttribute('placeholder') : false;
this.containerOuter = containerOuter;
this.containerInner = containerInner;
this.input = input;
this.choiceList = choiceList;
this.itemList = itemList;
this.dropdown = dropdown;
// Hide passed input
this.passedElement.classList.add(this.config.classNames.input, this.config.classNames.hiddenState);
// Remove element from tab index
this.passedElement.tabIndex = '-1';
// Backup original styles if any
var origStyle = this.passedElement.getAttribute('style');
if (Boolean(origStyle)) {
this.passedElement.setAttribute('data-choice-orig-style', origStyle);
}
this.passedElement.setAttribute('style', 'display:none;');
this.passedElement.setAttribute('aria-hidden', 'true');
this.passedElement.setAttribute('data-choice', 'active');
// Wrap input in container preserving DOM ordering
(0, _utils.wrap)(this.passedElement, containerInner);
// Wrapper inner container with outer container
(0, _utils.wrap)(containerInner, containerOuter);
// If placeholder has been enabled and we have a value
if (placeholder) {
input.placeholder = placeholder;
if (!this.isSelectOneElement) {
input.style.width = (0, _utils.getWidthOfInput)(input);
}
}
if (!this.config.addItems) {
this.disable();
}
containerOuter.appendChild(containerInner);
containerOuter.appendChild(dropdown);
containerInner.appendChild(itemList);
if (!this.isTextElement) {
dropdown.appendChild(choiceList);
}
if (this.isSelectMultipleElement || this.isTextElement) {
containerInner.appendChild(input);
} else if (this.canSearch) {
dropdown.insertBefore(input, dropdown.firstChild);
}
if (this.isSelectElement) {
var passedGroups = Array.from(this.passedElement.getElementsByTagName('OPTGROUP'));
this.highlightPosition = 0;
this.isSearching = false;
if (passedGroups && passedGroups.length) {
passedGroups.forEach(function (group) {
_this23._addGroup(group, group.id || null);
});
} else {
var passedOptions = Array.from(this.passedElement.options);
var filter = this.config.sortFilter;
var allChoices = this.presetChoices;
// Create array of options from option elements
passedOptions.forEach(function (o) {
allChoices.push({
value: o.value,
label: o.innerHTML,
selected: o.selected,
disabled: o.disabled || o.parentNode.disabled
});
});
// If sorting is enabled or the user is searching, filter choices
if (this.config.shouldSort) {
allChoices.sort(filter);
}
// Determine whether there is a selected choice
var hasSelectedChoice = allChoices.some(function (choice) {
return choice.selected;
});
// Add each choice
allChoices.forEach(function (choice, index) {
// Pre-select first choice if it's a single select
if (_this23.isSelectOneElement) {
if (hasSelectedChoice || !hasSelectedChoice && index > 0) {
// If there is a selected choice already or the choice is not
// the first in the array, add each choice normally
_this23._addChoice(choice.value, choice.label, choice.selected, choice.disabled, undefined, choice.customProperties);
} else {
// Otherwise pre-select the first choice in the array
_this23._addChoice(choice.value, choice.label, true, false, undefined, choice.customProperties);
}
} else {
_this23._addChoice(choice.value, choice.label, choice.selected, choice.disabled, undefined, choice.customProperties);
}
});
}
} else if (this.isTextElement) {
// Add any preset values seperated by delimiter
this.presetItems.forEach(function (item) {
var itemType = (0, _utils.getType)(item);
if (itemType === 'Object') {
if (!item.value) {
return;
}
_this23._addItem(item.value, item.label, item.id, undefined, item.customProperties);
} else if (itemType === 'String') {
_this23._addItem(item);
}
});
}
}
/*===== End of Private functions ======*/
}]);
return Choices;
}();
module.exports = Choices;
/***/ }),
/* 2 */
/***/ (function(module, exports, __webpack_require__) {
/**
* @license
* Fuse - Lightweight fuzzy-search
*
* Copyright (c) 2012-2016 Kirollos Risk <kirollos@gmail.com>.
* All Rights Reserved. Apache Software License 2.0
*
* Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
;(function (global) {
'use strict'
/** @type {function(...*)} */
function log () {
console.log.apply(console, arguments)
}
var defaultOptions = {
// The name of the identifier property. If specified, the returned result will be a list
// of the items' dentifiers, otherwise it will be a list of the items.
id: null,
// Indicates whether comparisons should be case sensitive.
caseSensitive: false,
// An array of values that should be included from the searcher's output. When this array
// contains elements, each result in the list will be of the form `{ item: ..., include1: ..., include2: ... }`.
// Values you can include are `score`, `matchedLocations`
include: [],
// Whether to sort the result list, by score
shouldSort: true,
// The search function to use
// Note that the default search function ([[Function]]) must conform to the following API:
//
// @param pattern The pattern string to search
// @param options The search option
// [[Function]].constructor = function(pattern, options)
//
// @param text: the string to search in for the pattern
// @return Object in the form of:
// - isMatch: boolean
// - score: Int
// [[Function]].prototype.search = function(text)
searchFn: BitapSearcher,
// Default sort function
sortFn: function (a, b) {
return a.score - b.score
},
// The get function to use when fetching an object's properties.
// The default will search nested paths *ie foo.bar.baz*
getFn: deepValue,
// List of properties that will be searched. This also supports nested properties.
keys: [],
// Will print to the console. Useful for debugging.
verbose: false,
// When true, the search algorithm will search individual words **and** the full string,
// computing the final score as a function of both. Note that when `tokenize` is `true`,
// the `threshold`, `distance`, and `location` are inconsequential for individual tokens.
tokenize: false,
// When true, the result set will only include records that match all tokens. Will only work
// if `tokenize` is also true.
matchAllTokens: false,
// Regex used to separate words when searching. Only applicable when `tokenize` is `true`.
tokenSeparator: / +/g,
// Minimum number of characters that must be matched before a result is considered a match
minMatchCharLength: 1,
// When true, the algorithm continues searching to the end of the input even if a perfect
// match is found before the end of the same input.
findAllMatches: false
}
/**
* @constructor
* @param {!Array} list
* @param {!Object<string, *>} options
*/
function Fuse (list, options) {
var key
this.list = list
this.options = options = options || {}
for (key in defaultOptions) {
if (!defaultOptions.hasOwnProperty(key)) {
continue;
}
// Add boolean type options
if (typeof defaultOptions[key] === 'boolean') {
this.options[key] = key in options ? options[key] : defaultOptions[key];
// Add all other options
} else {
this.options[key] = options[key] || defaultOptions[key]
}
}
}
Fuse.VERSION = '2.7.3'
/**
* Sets a new list for Fuse to match against.
* @param {!Array} list
* @return {!Array} The newly set list
* @public
*/
Fuse.prototype.set = function (list) {
this.list = list
return list
}
Fuse.prototype.search = function (pattern) {
if (this.options.verbose) log('\nSearch term:', pattern, '\n')
this.pattern = pattern
this.results = []
this.resultMap = {}
this._keyMap = null
this._prepareSearchers()
this._startSearch()
this._computeScore()
this._sort()
var output = this._format()
return output
}
Fuse.prototype._prepareSearchers = function () {
var options = this.options
var pattern = this.pattern
var searchFn = options.searchFn
var tokens = pattern.split(options.tokenSeparator)
var i = 0
var len = tokens.length
if (this.options.tokenize) {
this.tokenSearchers = []
for (; i < len; i++) {
this.tokenSearchers.push(new searchFn(tokens[i], options))
}
}
this.fullSeacher = new searchFn(pattern, options)
}
Fuse.prototype._startSearch = function () {
var options = this.options
var getFn = options.getFn
var list = this.list
var listLen = list.length
var keys = this.options.keys
var keysLen = keys.length
var key
var weight
var item = null
var i
var j
// Check the first item in the list, if it's a string, then we assume
// that every item in the list is also a string, and thus it's a flattened array.
if (typeof list[0] === 'string') {
// Iterate over every item
for (i = 0; i < listLen; i++) {
this._analyze('', list[i], i, i)
}
} else {
this._keyMap = {}
// Otherwise, the first item is an Object (hopefully), and thus the searching
// is done on the values of the keys of each item.
// Iterate over every item
for (i = 0; i < listLen; i++) {
item = list[i]
// Iterate over every key
for (j = 0; j < keysLen; j++) {
key = keys[j]
if (typeof key !== 'string') {
weight = (1 - key.weight) || 1
this._keyMap[key.name] = {
weight: weight
}
if (key.weight <= 0 || key.weight > 1) {
throw new Error('Key weight has to be > 0 and <= 1')
}
key = key.name
} else {
this._keyMap[key] = {
weight: 1
}
}
this._analyze(key, getFn(item, key, []), item, i)
}
}
}
}
Fuse.prototype._analyze = function (key, text, entity, index) {
var options = this.options
var words
var scores
var exists = false
var existingResult
var averageScore
var finalScore
var scoresLen
var mainSearchResult
var tokenSearcher
var termScores
var word
var tokenSearchResult
var hasMatchInText
var checkTextMatches
var i
var j
// Check if the text can be searched
if (text === undefined || text === null) {
return
}
scores = []
var numTextMatches = 0
if (typeof text === 'string') {
words = text.split(options.tokenSeparator)
if (options.verbose) log('---------\nKey:', key)
if (this.options.tokenize) {
for (i = 0; i < this.tokenSearchers.length; i++) {
tokenSearcher = this.tokenSearchers[i]
if (options.verbose) log('Pattern:', tokenSearcher.pattern)
termScores = []
hasMatchInText = false
for (j = 0; j < words.length; j++) {
word = words[j]
tokenSearchResult = tokenSearcher.search(word)
var obj = {}
if (tokenSearchResult.isMatch) {
obj[word] = tokenSearchResult.score
exists = true
hasMatchInText = true
scores.push(tokenSearchResult.score)
} else {
obj[word] = 1
if (!this.options.matchAllTokens) {
scores.push(1)
}
}
termScores.push(obj)
}
if (hasMatchInText) {
numTextMatches++
}
if (options.verbose) log('Token scores:', termScores)
}
averageScore = scores[0]
scoresLen = scores.length
for (i = 1; i < scoresLen; i++) {
averageScore += scores[i]
}
averageScore = averageScore / scoresLen
if (options.verbose) log('Token score average:', averageScore)
}
mainSearchResult = this.fullSeacher.search(text)
if (options.verbose) log('Full text score:', mainSearchResult.score)
finalScore = mainSearchResult.score
if (averageScore !== undefined) {
finalScore = (finalScore + averageScore) / 2
}
if (options.verbose) log('Score average:', finalScore)
checkTextMatches = (this.options.tokenize && this.options.matchAllTokens) ? numTextMatches >= this.tokenSearchers.length : true
if (options.verbose) log('Check Matches', checkTextMatches)
// If a match is found, add the item to <rawResults>, including its score
if ((exists || mainSearchResult.isMatch) && checkTextMatches) {
// Check if the item already exists in our results
existingResult = this.resultMap[index]
if (existingResult) {
// Use the lowest score
// existingResult.score, bitapResult.score
existingResult.output.push({
key: key,
score: finalScore,
matchedIndices: mainSearchResult.matchedIndices
})
} else {
// Add it to the raw result list
this.resultMap[index] = {
item: entity,
output: [{
key: key,
score: finalScore,
matchedIndices: mainSearchResult.matchedIndices
}]
}
this.results.push(this.resultMap[index])
}
}
} else if (isArray(text)) {
for (i = 0; i < text.length; i++) {
this._analyze(key, text[i], entity, index)
}
}
}
Fuse.prototype._computeScore = function () {
var i
var j
var keyMap = this._keyMap
var totalScore
var output
var scoreLen
var score
var weight
var results = this.results
var bestScore
var nScore
if (this.options.verbose) log('\n\nComputing score:\n')
for (i = 0; i < results.length; i++) {
totalScore = 0
output = results[i].output
scoreLen = output.length
bestScore = 1
for (j = 0; j < scoreLen; j++) {
score = output[j].score
weight = keyMap ? keyMap[output[j].key].weight : 1
nScore = score * weight
if (weight !== 1) {
bestScore = Math.min(bestScore, nScore)
} else {
totalScore += nScore
output[j].nScore = nScore
}
}
if (bestScore === 1) {
results[i].score = totalScore / scoreLen
} else {
results[i].score = bestScore
}
if (this.options.verbose) log(results[i])
}
}
Fuse.prototype._sort = function () {
var options = this.options
if (options.shouldSort) {
if (options.verbose) log('\n\nSorting....')
this.results.sort(options.sortFn)
}
}
Fuse.prototype._format = function () {
var options = this.options
var getFn = options.getFn
var finalOutput = []
var i
var len
var results = this.results
var replaceValue
var getItemAtIndex
var include = options.include
if (options.verbose) log('\n\nOutput:\n\n', results)
// Helper function, here for speed-up, which replaces the item with its value,
// if the options specifies it,
replaceValue = options.id ? function (index) {
results[index].item = getFn(results[index].item, options.id, [])[0]
} : function () {}
getItemAtIndex = function (index) {
var record = results[index]
var data
var j
var output
var _item
var _result
// If `include` has values, put the item in the result
if (include.length > 0) {
data = {
item: record.item
}
if (include.indexOf('matches') !== -1) {
output = record.output
data.matches = []
for (j = 0; j < output.length; j++) {
_item = output[j]
_result = {
indices: _item.matchedIndices
}
if (_item.key) {
_result.key = _item.key
}
data.matches.push(_result)
}
}
if (include.indexOf('score') !== -1) {
data.score = results[index].score
}
} else {
data = record.item
}
return data
}
// From the results, push into a new array only the item identifier (if specified)
// of the entire item. This is because we don't want to return the <results>,
// since it contains other metadata
for (i = 0, len = results.length; i < len; i++) {
replaceValue(i)
finalOutput.push(getItemAtIndex(i))
}
return finalOutput
}
// Helpers
function deepValue (obj, path, list) {
var firstSegment
var remaining
var dotIndex
var value
var i
var len
if (!path) {
// If there's no path left, we've gotten to the object we care about.
list.push(obj)
} else {
dotIndex = path.indexOf('.')
if (dotIndex !== -1) {
firstSegment = path.slice(0, dotIndex)
remaining = path.slice(dotIndex + 1)
} else {
firstSegment = path
}
value = obj[firstSegment]
if (value !== null && value !== undefined) {
if (!remaining && (typeof value === 'string' || typeof value === 'number')) {
list.push(value)
} else if (isArray(value)) {
// Search each item in the array.
for (i = 0, len = value.length; i < len; i++) {
deepValue(value[i], remaining, list)
}
} else if (remaining) {
// An object. Recurse further.
deepValue(value, remaining, list)
}
}
}
return list
}
function isArray (obj) {
return Object.prototype.toString.call(obj) === '[object Array]'
}
/**
* Adapted from "Diff, Match and Patch", by Google
*
* http://code.google.com/p/google-diff-match-patch/
*
* Modified by: Kirollos Risk <kirollos@gmail.com>
* -----------------------------------------------
* Details: the algorithm and structure was modified to allow the creation of
* <Searcher> instances with a <search> method which does the actual
* bitap search. The <pattern> (the string that is searched for) is only defined
* once per instance and thus it eliminates redundant re-creation when searching
* over a list of strings.
*
* Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
*
* @constructor
*/
function BitapSearcher (pattern, options) {
options = options || {}
this.options = options
this.options.location = options.location || BitapSearcher.defaultOptions.location
this.options.distance = 'distance' in options ? options.distance : BitapSearcher.defaultOptions.distance
this.options.threshold = 'threshold' in options ? options.threshold : BitapSearcher.defaultOptions.threshold
this.options.maxPatternLength = options.maxPatternLength || BitapSearcher.defaultOptions.maxPatternLength
this.pattern = options.caseSensitive ? pattern : pattern.toLowerCase()
this.patternLen = pattern.length
if (this.patternLen <= this.options.maxPatternLength) {
this.matchmask = 1 << (this.patternLen - 1)
this.patternAlphabet = this._calculatePatternAlphabet()
}
}
BitapSearcher.defaultOptions = {
// Approximately where in the text is the pattern expected to be found?
location: 0,
// Determines how close the match must be to the fuzzy location (specified above).
// An exact letter match which is 'distance' characters away from the fuzzy location
// would score as a complete mismatch. A distance of '0' requires the match be at
// the exact location specified, a threshold of '1000' would require a perfect match
// to be within 800 characters of the fuzzy location to be found using a 0.8 threshold.
distance: 100,
// At what point does the match algorithm give up. A threshold of '0.0' requires a perfect match
// (of both letters and location), a threshold of '1.0' would match anything.
threshold: 0.6,
// Machine word size
maxPatternLength: 32
}
/**
* Initialize the alphabet for the Bitap algorithm.
* @return {Object} Hash of character locations.
* @private
*/
BitapSearcher.prototype._calculatePatternAlphabet = function () {
var mask = {},
i = 0
for (i = 0; i < this.patternLen; i++) {
mask[this.pattern.charAt(i)] = 0
}
for (i = 0; i < this.patternLen; i++) {
mask[this.pattern.charAt(i)] |= 1 << (this.pattern.length - i - 1)
}
return mask
}
/**
* Compute and return the score for a match with `e` errors and `x` location.
* @param {number} errors Number of errors in match.
* @param {number} location Location of match.
* @return {number} Overall score for match (0.0 = good, 1.0 = bad).
* @private
*/
BitapSearcher.prototype._bitapScore = function (errors, location) {
var accuracy = errors / this.patternLen,
proximity = Math.abs(this.options.location - location)
if (!this.options.distance) {
// Dodge divide by zero error.
return proximity ? 1.0 : accuracy
}
return accuracy + (proximity / this.options.distance)
}
/**
* Compute and return the result of the search
* @param {string} text The text to search in
* @return {{isMatch: boolean, score: number}} Literal containing:
* isMatch - Whether the text is a match or not
* score - Overall score for the match
* @public
*/
BitapSearcher.prototype.search = function (text) {
var options = this.options
var i
var j
var textLen
var findAllMatches
var location
var threshold
var bestLoc
var binMin
var binMid
var binMax
var start, finish
var bitArr
var lastBitArr
var charMatch
var score
var locations
var matches
var isMatched
var matchMask
var matchedIndices
var matchesLen
var match
text = options.caseSensitive ? text : text.toLowerCase()
if (this.pattern === text) {
// Exact match
return {
isMatch: true,
score: 0,
matchedIndices: [[0, text.length - 1]]
}
}
// When pattern length is greater than the machine word length, just do a a regex comparison
if (this.patternLen > options.maxPatternLength) {
matches = text.match(new RegExp(this.pattern.replace(options.tokenSeparator, '|')))
isMatched = !!matches
if (isMatched) {
matchedIndices = []
for (i = 0, matchesLen = matches.length; i < matchesLen; i++) {
match = matches[i]
matchedIndices.push([text.indexOf(match), match.length - 1])
}
}
return {
isMatch: isMatched,
// TODO: revisit this score
score: isMatched ? 0.5 : 1,
matchedIndices: matchedIndices
}
}
findAllMatches = options.findAllMatches
location = options.location
// Set starting location at beginning text and initialize the alphabet.
textLen = text.length
// Highest score beyond which we give up.
threshold = options.threshold
// Is there a nearby exact match? (speedup)
bestLoc = text.indexOf(this.pattern, location)
// a mask of the matches
matchMask = []
for (i = 0; i < textLen; i++) {
matchMask[i] = 0
}
if (bestLoc != -1) {
threshold = Math.min(this._bitapScore(0, bestLoc), threshold)
// What about in the other direction? (speed up)
bestLoc = text.lastIndexOf(this.pattern, location + this.patternLen)
if (bestLoc != -1) {
threshold = Math.min(this._bitapScore(0, bestLoc), threshold)
}
}
bestLoc = -1
score = 1
locations = []
binMax = this.patternLen + textLen
for (i = 0; i < this.patternLen; i++) {
// Scan for the best match; each iteration allows for one more error.
// Run a binary search to determine how far from the match location we can stray
// at this error level.
binMin = 0
binMid = binMax
while (binMin < binMid) {
if (this._bitapScore(i, location + binMid) <= threshold) {
binMin = binMid
} else {
binMax = binMid
}
binMid = Math.floor((binMax - binMin) / 2 + binMin)
}
// Use the result from this iteration as the maximum for the next.
binMax = binMid
start = Math.max(1, location - binMid + 1)
if (findAllMatches) {
finish = textLen;
} else {
finish = Math.min(location + binMid, textLen) + this.patternLen
}
// Initialize the bit array
bitArr = Array(finish + 2)
bitArr[finish + 1] = (1 << i) - 1
for (j = finish; j >= start; j--) {
charMatch = this.patternAlphabet[text.charAt(j - 1)]
if (charMatch) {
matchMask[j - 1] = 1
}
bitArr[j] = ((bitArr[j + 1] << 1) | 1) & charMatch
if (i !== 0) {
// Subsequent passes: fuzzy match.
bitArr[j] |= (((lastBitArr[j + 1] | lastBitArr[j]) << 1) | 1) | lastBitArr[j + 1]
}
if (bitArr[j] & this.matchmask) {
score = this._bitapScore(i, j - 1)
// This match will almost certainly be better than any existing match.
// But check anyway.
if (score <= threshold) {
// Indeed it is
threshold = score
bestLoc = j - 1
locations.push(bestLoc)
// Already passed loc, downhill from here on in.
if (bestLoc <= location) {
break
}
// When passing loc, don't exceed our current distance from loc.
start = Math.max(1, 2 * location - bestLoc)
}
}
}
// No hope for a (better) match at greater error levels.
if (this._bitapScore(i + 1, location) > threshold) {
break
}
lastBitArr = bitArr
}
matchedIndices = this._getMatchedIndices(matchMask)
// Count exact matches (those with a score of 0) to be "almost" exact
return {
isMatch: bestLoc >= 0,
score: score === 0 ? 0.001 : score,
matchedIndices: matchedIndices
}
}
BitapSearcher.prototype._getMatchedIndices = function (matchMask) {
var matchedIndices = []
var start = -1
var end = -1
var i = 0
var match
var len = matchMask.length
for (; i < len; i++) {
match = matchMask[i]
if (match && start === -1) {
start = i
} else if (!match && start !== -1) {
end = i - 1
if ((end - start) + 1 >= this.options.minMatchCharLength) {
matchedIndices.push([start, end])
}
start = -1
}
}
if (matchMask[i - 1]) {
if ((i-1 - start) + 1 >= this.options.minMatchCharLength) {
matchedIndices.push([start, i - 1])
}
}
return matchedIndices
}
// Export to Common JS Loader
if (true) {
// Node. Does not work with strict CommonJS, but
// only CommonJS-like environments that support module.exports,
// like Node.
module.exports = Fuse
} else if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(function () {
return Fuse
})
} else {
// Browser globals (root is window)
global.Fuse = Fuse
}
})(this);
/***/ }),
/* 3 */
/***/ (function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
Copyright (c) 2016 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/
/* global define */
(function () {
'use strict';
var hasOwn = {}.hasOwnProperty;
function classNames () {
var classes = [];
for (var i = 0; i < arguments.length; i++) {
var arg = arguments[i];
if (!arg) continue;
var argType = typeof arg;
if (argType === 'string' || argType === 'number') {
classes.push(arg);
} else if (Array.isArray(arg)) {
classes.push(classNames.apply(null, arg));
} else if (argType === 'object') {
for (var key in arg) {
if (hasOwn.call(arg, key) && arg[key]) {
classes.push(key);
}
}
}
}
return classes.join(' ');
}
if (typeof module !== 'undefined' && module.exports) {
module.exports = classNames;
} else if (true) {
// register as 'classnames', consistent with npm package name
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function () {
return classNames;
}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else {
window.classNames = classNames;
}
}());
/***/ }),
/* 4 */
/***/ (function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _redux = __webpack_require__(5);
var _index = __webpack_require__(26);
var _index2 = _interopRequireDefault(_index);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var Store = function () {
function Store() {
_classCallCheck(this, Store);
this.store = (0, _redux.createStore)(_index2.default, window.devToolsExtension ? window.devToolsExtension() : undefined);
}
/**
* Get store object (wrapping Redux method)
* @return {Object} State
*/
_createClass(Store, [{
key: 'getState',
value: function getState() {
return this.store.getState();
}
/**
* Dispatch event to store (wrapped Redux method)
* @param {Function} action Action function to trigger
* @return
*/
}, {
key: 'dispatch',
value: function dispatch(action) {
this.store.dispatch(action);
}
/**
* Subscribe store to function call (wrapped Redux method)
* @param {Function} onChange Function to trigger when state changes
* @return
*/
}, {
key: 'subscribe',
value: function subscribe(onChange) {
this.store.subscribe(onChange);
}
/**
* Get items from store
* @return {Array} Item objects
*/
}, {
key: 'getItems',
value: function getItems() {
var state = this.store.getState();
return state.items;
}
/**
* Get active items from store
* @return {Array} Item objects
*/
}, {
key: 'getItemsFilteredByActive',
value: function getItemsFilteredByActive() {
var items = this.getItems();
var values = items.filter(function (item) {
return item.active === true;
}, []);
return values;
}
/**
* Get items from store reduced to just their values
* @return {Array} Item objects
*/
}, {
key: 'getItemsReducedToValues',
value: function getItemsReducedToValues() {
var items = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.getItems();
var values = items.reduce(function (prev, current) {
prev.push(current.value);
return prev;
}, []);
return values;
}
/**
* Get choices from store
* @return {Array} Option objects
*/
}, {
key: 'getChoices',
value: function getChoices() {
var state = this.store.getState();
return state.choices;
}
/**
* Get active choices from store
* @return {Array} Option objects
*/
}, {
key: 'getChoicesFilteredByActive',
value: function getChoicesFilteredByActive() {
var choices = this.getChoices();
var values = choices.filter(function (choice) {
return choice.active === true;
}, []);
return values;
}
/**
* Get selectable choices from store
* @return {Array} Option objects
*/
}, {
key: 'getChoicesFilteredBySelectable',
value: function getChoicesFilteredBySelectable() {
var choices = this.getChoices();
var values = choices.filter(function (choice) {
return choice.disabled !== true;
}, []);
return values;
}
/**
* Get single choice by it's ID
* @return {Object} Found choice
*/
}, {
key: 'getChoiceById',
value: function getChoiceById(id) {
if (id) {
var choices = this.getChoicesFilteredByActive();
var foundChoice = choices.find(function (choice) {
return choice.id === parseInt(id, 10);
});
return foundChoice;
}
return false;
}
/**
* Get groups from store
* @return {Array} Group objects
*/
}, {
key: 'getGroups',
value: function getGroups() {
var state = this.store.getState();
return state.groups;
}
/**
* Get active groups from store
* @return {Array} Group objects
*/
}, {
key: 'getGroupsFilteredByActive',
value: function getGroupsFilteredByActive() {
var groups = this.getGroups();
var choices = this.getChoices();
var values = groups.filter(function (group) {
var isActive = group.active === true && group.disabled === false;
var hasActiveOptions = choices.some(function (choice) {
return choice.active === true && choice.disabled === false;
});
return isActive && hasActiveOptions;
}, []);
return values;
}
/**
* Get group by group id
* @param {Number} id Group ID
* @return {Object} Group data
*/
}, {
key: 'getGroupById',
value: function getGroupById(id) {
var groups = this.getGroups();
var foundGroup = groups.find(function (group) {
return group.id === id;
});
return foundGroup;
}
}]);
return Store;
}();
exports.default = Store;
module.exports = Store;
/***/ }),
/* 5 */
/***/ (function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
exports.compose = exports.applyMiddleware = exports.bindActionCreators = exports.combineReducers = exports.createStore = undefined;
var _createStore = __webpack_require__(6);
var _createStore2 = _interopRequireDefault(_createStore);
var _combineReducers = __webpack_require__(21);
var _combineReducers2 = _interopRequireDefault(_combineReducers);
var _bindActionCreators = __webpack_require__(23);
var _bindActionCreators2 = _interopRequireDefault(_bindActionCreators);
var _applyMiddleware = __webpack_require__(24);
var _applyMiddleware2 = _interopRequireDefault(_applyMiddleware);
var _compose = __webpack_require__(25);
var _compose2 = _interopRequireDefault(_compose);
var _warning = __webpack_require__(22);
var _warning2 = _interopRequireDefault(_warning);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
/*
* This is a dummy function to check if the function name has been altered by minification.
* If the function has been minified and NODE_ENV !== 'production', warn the user.
*/
function isCrushed() {}
if (false) {
(0, _warning2['default'])('You are currently using minified code outside of NODE_ENV === \'production\'. ' + 'This means that you are running a slower development build of Redux. ' + 'You can use loose-envify (https://github.com/zertosh/loose-envify) for browserify ' + 'or DefinePlugin for webpack (http://stackoverflow.com/questions/30030031) ' + 'to ensure you have the correct code for your production build.');
}
exports.createStore = _createStore2['default'];
exports.combineReducers = _combineReducers2['default'];
exports.bindActionCreators = _bindActionCreators2['default'];
exports.applyMiddleware = _applyMiddleware2['default'];
exports.compose = _compose2['default'];
/***/ }),
/* 6 */
/***/ (function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
exports.ActionTypes = undefined;
exports['default'] = createStore;
var _isPlainObject = __webpack_require__(7);
var _isPlainObject2 = _interopRequireDefault(_isPlainObject);
var _symbolObservable = __webpack_require__(17);
var _symbolObservable2 = _interopRequireDefault(_symbolObservable);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
/**
* These are private action types reserved by Redux.
* For any unknown actions, you must return the current state.
* If the current state is undefined, you must return the initial state.
* Do not reference these action types directly in your code.
*/
var ActionTypes = exports.ActionTypes = {
INIT: '@@redux/INIT'
};
/**
* Creates a Redux store that holds the state tree.
* The only way to change the data in the store is to call `dispatch()` on it.
*
* There should only be a single store in your app. To specify how different
* parts of the state tree respond to actions, you may combine several reducers
* into a single reducer function by using `combineReducers`.
*
* @param {Function} reducer A function that returns the next state tree, given
* the current state tree and the action to handle.
*
* @param {any} [preloadedState] The initial state. You may optionally specify it
* to hydrate the state from the server in universal apps, or to restore a
* previously serialized user session.
* If you use `combineReducers` to produce the root reducer function, this must be
* an object with the same shape as `combineReducers` keys.
*
* @param {Function} enhancer The store enhancer. You may optionally specify it
* to enhance the store with third-party capabilities such as middleware,
* time travel, persistence, etc. The only store enhancer that ships with Redux
* is `applyMiddleware()`.
*
* @returns {Store} A Redux store that lets you read the state, dispatch actions
* and subscribe to changes.
*/
function createStore(reducer, preloadedState, enhancer) {
var _ref2;
if (typeof preloadedState === 'function' && typeof enhancer === 'undefined') {
enhancer = preloadedState;
preloadedState = undefined;
}
if (typeof enhancer !== 'undefined') {
if (typeof enhancer !== 'function') {
throw new Error('Expected the enhancer to be a function.');
}
return enhancer(createStore)(reducer, preloadedState);
}
if (typeof reducer !== 'function') {
throw new Error('Expected the reducer to be a function.');
}
var currentReducer = reducer;
var currentState = preloadedState;
var currentListeners = [];
var nextListeners = currentListeners;
var isDispatching = false;
function ensureCanMutateNextListeners() {
if (nextListeners === currentListeners) {
nextListeners = currentListeners.slice();
}
}
/**
* Reads the state tree managed by the store.
*
* @returns {any} The current state tree of your application.
*/
function getState() {
return currentState;
}
/**
* Adds a change listener. It will be called any time an action is dispatched,
* and some part of the state tree may potentially have changed. You may then
* call `getState()` to read the current state tree inside the callback.
*
* You may call `dispatch()` from a change listener, with the following
* caveats:
*
* 1. The subscriptions are snapshotted just before every `dispatch()` call.
* If you subscribe or unsubscribe while the listeners are being invoked, this
* will not have any effect on the `dispatch()` that is currently in progress.
* However, the next `dispatch()` call, whether nested or not, will use a more
* recent snapshot of the subscription list.
*
* 2. The listener should not expect to see all state changes, as the state
* might have been updated multiple times during a nested `dispatch()` before
* the listener is called. It is, however, guaranteed that all subscribers
* registered before the `dispatch()` started will be called with the latest
* state by the time it exits.
*
* @param {Function} listener A callback to be invoked on every dispatch.
* @returns {Function} A function to remove this change listener.
*/
function subscribe(listener) {
if (typeof listener !== 'function') {
throw new Error('Expected listener to be a function.');
}
var isSubscribed = true;
ensureCanMutateNextListeners();
nextListeners.push(listener);
return function unsubscribe() {
if (!isSubscribed) {
return;
}
isSubscribed = false;
ensureCanMutateNextListeners();
var index = nextListeners.indexOf(listener);
nextListeners.splice(index, 1);
};
}
/**
* Dispatches an action. It is the only way to trigger a state change.
*
* The `reducer` function, used to create the store, will be called with the
* current state tree and the given `action`. Its return value will
* be considered the **next** state of the tree, and the change listeners
* will be notified.
*
* The base implementation only supports plain object actions. If you want to
* dispatch a Promise, an Observable, a thunk, or something else, you need to
* wrap your store creating function into the corresponding middleware. For
* example, see the documentation for the `redux-thunk` package. Even the
* middleware will eventually dispatch plain object actions using this method.
*
* @param {Object} action A plain object representing “what changed”. It is
* a good idea to keep actions serializable so you can record and replay user
* sessions, or use the time travelling `redux-devtools`. An action must have
* a `type` property which may not be `undefined`. It is a good idea to use
* string constants for action types.
*
* @returns {Object} For convenience, the same action object you dispatched.
*
* Note that, if you use a custom middleware, it may wrap `dispatch()` to
* return something else (for example, a Promise you can await).
*/
function dispatch(action) {
if (!(0, _isPlainObject2['default'])(action)) {
throw new Error('Actions must be plain objects. ' + 'Use custom middleware for async actions.');
}
if (typeof action.type === 'undefined') {
throw new Error('Actions may not have an undefined "type" property. ' + 'Have you misspelled a constant?');
}
if (isDispatching) {
throw new Error('Reducers may not dispatch actions.');
}
try {
isDispatching = true;
currentState = currentReducer(currentState, action);
} finally {
isDispatching = false;
}
var listeners = currentListeners = nextListeners;
for (var i = 0; i < listeners.length; i++) {
listeners[i]();
}
return action;
}
/**
* Replaces the reducer currently used by the store to calculate the state.
*
* You might need this if your app implements code splitting and you want to
* load some of the reducers dynamically. You might also need this if you
* implement a hot reloading mechanism for Redux.
*
* @param {Function} nextReducer The reducer for the store to use instead.
* @returns {void}
*/
function replaceReducer(nextReducer) {
if (typeof nextReducer !== 'function') {
throw new Error('Expected the nextReducer to be a function.');
}
currentReducer = nextReducer;
dispatch({ type: ActionTypes.INIT });
}
/**
* Interoperability point for observable/reactive libraries.
* @returns {observable} A minimal observable of state changes.
* For more information, see the observable proposal:
* https://github.com/zenparsing/es-observable
*/
function observable() {
var _ref;
var outerSubscribe = subscribe;
return _ref = {
/**
* The minimal observable subscription method.
* @param {Object} observer Any object that can be used as an observer.
* The observer object should have a `next` method.
* @returns {subscription} An object with an `unsubscribe` method that can
* be used to unsubscribe the observable from the store, and prevent further
* emission of values from the observable.
*/
subscribe: function subscribe(observer) {
if (typeof observer !== 'object') {
throw new TypeError('Expected the observer to be an object.');
}
function observeState() {
if (observer.next) {
observer.next(getState());
}
}
observeState();
var unsubscribe = outerSubscribe(observeState);
return { unsubscribe: unsubscribe };
}
}, _ref[_symbolObservable2['default']] = function () {
return this;
}, _ref;
}
// When a store is created, an "INIT" action is dispatched so that every
// reducer returns their initial state. This effectively populates
// the initial state tree.
dispatch({ type: ActionTypes.INIT });
return _ref2 = {
dispatch: dispatch,
subscribe: subscribe,
getState: getState,
replaceReducer: replaceReducer
}, _ref2[_symbolObservable2['default']] = observable, _ref2;
}
/***/ }),
/* 7 */
/***/ (function(module, exports, __webpack_require__) {
var baseGetTag = __webpack_require__(8),
getPrototype = __webpack_require__(14),
isObjectLike = __webpack_require__(16);
/** `Object#toString` result references. */
var objectTag = '[object Object]';
/** Used for built-in method references. */
var funcProto = Function.prototype,
objectProto = Object.prototype;
/** Used to resolve the decompiled source of functions. */
var funcToString = funcProto.toString;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/** Used to infer the `Object` constructor. */
var objectCtorString = funcToString.call(Object);
/**
* Checks if `value` is a plain object, that is, an object created by the
* `Object` constructor or one with a `[[Prototype]]` of `null`.
*
* @static
* @memberOf _
* @since 0.8.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
* @example
*
* function Foo() {
* this.a = 1;
* }
*
* _.isPlainObject(new Foo);
* // => false
*
* _.isPlainObject([1, 2, 3]);
* // => false
*
* _.isPlainObject({ 'x': 0, 'y': 0 });
* // => true
*
* _.isPlainObject(Object.create(null));
* // => true
*/
function isPlainObject(value) {
if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
return false;
}
var proto = getPrototype(value);
if (proto === null) {
return true;
}
var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
return typeof Ctor == 'function' && Ctor instanceof Ctor &&
funcToString.call(Ctor) == objectCtorString;
}
module.exports = isPlainObject;
/***/ }),
/* 8 */
/***/ (function(module, exports, __webpack_require__) {
var Symbol = __webpack_require__(9),
getRawTag = __webpack_require__(12),
objectToString = __webpack_require__(13);
/** `Object#toString` result references. */
var nullTag = '[object Null]',
undefinedTag = '[object Undefined]';
/** Built-in value references. */
var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
/**
* The base implementation of `getTag` without fallbacks for buggy environments.
*
* @private
* @param {*} value The value to query.
* @returns {string} Returns the `toStringTag`.
*/
function baseGetTag(value) {
if (value == null) {
return value === undefined ? undefinedTag : nullTag;
}
return (symToStringTag && symToStringTag in Object(value))
? getRawTag(value)
: objectToString(value);
}
module.exports = baseGetTag;
/***/ }),
/* 9 */
/***/ (function(module, exports, __webpack_require__) {
var root = __webpack_require__(10);
/** Built-in value references. */
var Symbol = root.Symbol;
module.exports = Symbol;
/***/ }),
/* 10 */
/***/ (function(module, exports, __webpack_require__) {
var freeGlobal = __webpack_require__(11);
/** Detect free variable `self`. */
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
/** Used as a reference to the global object. */
var root = freeGlobal || freeSelf || Function('return this')();
module.exports = root;
/***/ }),
/* 11 */
/***/ (function(module, exports) {
/* WEBPACK VAR INJECTION */(function(global) {/** Detect free variable `global` from Node.js. */
var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
module.exports = freeGlobal;
/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
/***/ }),
/* 12 */
/***/ (function(module, exports, __webpack_require__) {
var Symbol = __webpack_require__(9);
/** Used for built-in method references. */
var objectProto = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
var nativeObjectToString = objectProto.toString;
/** Built-in value references. */
var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
/**
* A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
*
* @private
* @param {*} value The value to query.
* @returns {string} Returns the raw `toStringTag`.
*/
function getRawTag(value) {
var isOwn = hasOwnProperty.call(value, symToStringTag),
tag = value[symToStringTag];
try {
value[symToStringTag] = undefined;
var unmasked = true;
} catch (e) {}
var result = nativeObjectToString.call(value);
if (unmasked) {
if (isOwn) {
value[symToStringTag] = tag;
} else {
delete value[symToStringTag];
}
}
return result;
}
module.exports = getRawTag;
/***/ }),
/* 13 */
/***/ (function(module, exports) {
/** Used for built-in method references. */
var objectProto = Object.prototype;
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
var nativeObjectToString = objectProto.toString;
/**
* Converts `value` to a string using `Object.prototype.toString`.
*
* @private
* @param {*} value The value to convert.
* @returns {string} Returns the converted string.
*/
function objectToString(value) {
return nativeObjectToString.call(value);
}
module.exports = objectToString;
/***/ }),
/* 14 */
/***/ (function(module, exports, __webpack_require__) {
var overArg = __webpack_require__(15);
/** Built-in value references. */
var getPrototype = overArg(Object.getPrototypeOf, Object);
module.exports = getPrototype;
/***/ }),
/* 15 */
/***/ (function(module, exports) {
/**
* Creates a unary function that invokes `func` with its argument transformed.
*
* @private
* @param {Function} func The function to wrap.
* @param {Function} transform The argument transform.
* @returns {Function} Returns the new function.
*/
function overArg(func, transform) {
return function(arg) {
return func(transform(arg));
};
}
module.exports = overArg;
/***/ }),
/* 16 */
/***/ (function(module, exports) {
/**
* Checks if `value` is object-like. A value is object-like if it's not `null`
* and has a `typeof` result of "object".
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
* @example
*
* _.isObjectLike({});
* // => true
*
* _.isObjectLike([1, 2, 3]);
* // => true
*
* _.isObjectLike(_.noop);
* // => false
*
* _.isObjectLike(null);
* // => false
*/
function isObjectLike(value) {
return value != null && typeof value == 'object';
}
module.exports = isObjectLike;
/***/ }),
/* 17 */
/***/ (function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(18);
/***/ }),
/* 18 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(global, module) {'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _ponyfill = __webpack_require__(20);
var _ponyfill2 = _interopRequireDefault(_ponyfill);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var root; /* global window */
if (typeof self !== 'undefined') {
root = self;
} else if (typeof window !== 'undefined') {
root = window;
} else if (typeof global !== 'undefined') {
root = global;
} else if (true) {
root = module;
} else {
root = Function('return this')();
}
var result = (0, _ponyfill2['default'])(root);
exports['default'] = result;
/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()), __webpack_require__(19)(module)))
/***/ }),
/* 19 */
/***/ (function(module, exports) {
module.exports = function(module) {
if(!module.webpackPolyfill) {
module.deprecate = function() {};
module.paths = [];
// module.parent = undefined by default
module.children = [];
module.webpackPolyfill = 1;
}
return module;
}
/***/ }),
/* 20 */
/***/ (function(module, exports) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports['default'] = symbolObservablePonyfill;
function symbolObservablePonyfill(root) {
var result;
var _Symbol = root.Symbol;
if (typeof _Symbol === 'function') {
if (_Symbol.observable) {
result = _Symbol.observable;
} else {
result = _Symbol('observable');
_Symbol.observable = result;
}
} else {
result = '@@observable';
}
return result;
};
/***/ }),
/* 21 */
/***/ (function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
exports['default'] = combineReducers;
var _createStore = __webpack_require__(6);
var _isPlainObject = __webpack_require__(7);
var _isPlainObject2 = _interopRequireDefault(_isPlainObject);
var _warning = __webpack_require__(22);
var _warning2 = _interopRequireDefault(_warning);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function getUndefinedStateErrorMessage(key, action) {
var actionType = action && action.type;
var actionName = actionType && '"' + actionType.toString() + '"' || 'an action';
return 'Given action ' + actionName + ', reducer "' + key + '" returned undefined. ' + 'To ignore an action, you must explicitly return the previous state.';
}
function getUnexpectedStateShapeWarningMessage(inputState, reducers, action, unexpectedKeyCache) {
var reducerKeys = Object.keys(reducers);
var argumentName = action && action.type === _createStore.ActionTypes.INIT ? 'preloadedState argument passed to createStore' : 'previous state received by the reducer';
if (reducerKeys.length === 0) {
return 'Store does not have a valid reducer. Make sure the argument passed ' + 'to combineReducers is an object whose values are reducers.';
}
if (!(0, _isPlainObject2['default'])(inputState)) {
return 'The ' + argumentName + ' has unexpected type of "' + {}.toString.call(inputState).match(/\s([a-z|A-Z]+)/)[1] + '". Expected argument to be an object with the following ' + ('keys: "' + reducerKeys.join('", "') + '"');
}
var unexpectedKeys = Object.keys(inputState).filter(function (key) {
return !reducers.hasOwnProperty(key) && !unexpectedKeyCache[key];
});
unexpectedKeys.forEach(function (key) {
unexpectedKeyCache[key] = true;
});
if (unexpectedKeys.length > 0) {
return 'Unexpected ' + (unexpectedKeys.length > 1 ? 'keys' : 'key') + ' ' + ('"' + unexpectedKeys.join('", "') + '" found in ' + argumentName + '. ') + 'Expected to find one of the known reducer keys instead: ' + ('"' + reducerKeys.join('", "') + '". Unexpected keys will be ignored.');
}
}
function assertReducerSanity(reducers) {
Object.keys(reducers).forEach(function (key) {
var reducer = reducers[key];
var initialState = reducer(undefined, { type: _createStore.ActionTypes.INIT });
if (typeof initialState === 'undefined') {
throw new Error('Reducer "' + key + '" returned undefined during initialization. ' + 'If the state passed to the reducer is undefined, you must ' + 'explicitly return the initial state. The initial state may ' + 'not be undefined.');
}
var type = '@@redux/PROBE_UNKNOWN_ACTION_' + Math.random().toString(36).substring(7).split('').join('.');
if (typeof reducer(undefined, { type: type }) === 'undefined') {
throw new Error('Reducer "' + key + '" returned undefined when probed with a random type. ' + ('Don\'t try to handle ' + _createStore.ActionTypes.INIT + ' or other actions in "redux/*" ') + 'namespace. They are considered private. Instead, you must return the ' + 'current state for any unknown actions, unless it is undefined, ' + 'in which case you must return the initial state, regardless of the ' + 'action type. The initial state may not be undefined.');
}
});
}
/**
* Turns an object whose values are different reducer functions, into a single
* reducer function. It will call every child reducer, and gather their results
* into a single state object, whose keys correspond to the keys of the passed
* reducer functions.
*
* @param {Object} reducers An object whose values correspond to different
* reducer functions that need to be combined into one. One handy way to obtain
* it is to use ES6 `import * as reducers` syntax. The reducers may never return
* undefined for any action. Instead, they should return their initial state
* if the state passed to them was undefined, and the current state for any
* unrecognized action.
*
* @returns {Function} A reducer function that invokes every reducer inside the
* passed object, and builds a state object with the same shape.
*/
function combineReducers(reducers) {
var reducerKeys = Object.keys(reducers);
var finalReducers = {};
for (var i = 0; i < reducerKeys.length; i++) {
var key = reducerKeys[i];
if (false) {
if (typeof reducers[key] === 'undefined') {
(0, _warning2['default'])('No reducer provided for key "' + key + '"');
}
}
if (typeof reducers[key] === 'function') {
finalReducers[key] = reducers[key];
}
}
var finalReducerKeys = Object.keys(finalReducers);
if (false) {
var unexpectedKeyCache = {};
}
var sanityError;
try {
assertReducerSanity(finalReducers);
} catch (e) {
sanityError = e;
}
return function combination() {
var state = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
var action = arguments[1];
if (sanityError) {
throw sanityError;
}
if (false) {
var warningMessage = getUnexpectedStateShapeWarningMessage(state, finalReducers, action, unexpectedKeyCache);
if (warningMessage) {
(0, _warning2['default'])(warningMessage);
}
}
var hasChanged = false;
var nextState = {};
for (var i = 0; i < finalReducerKeys.length; i++) {
var key = finalReducerKeys[i];
var reducer = finalReducers[key];
var previousStateForKey = state[key];
var nextStateForKey = reducer(previousStateForKey, action);
if (typeof nextStateForKey === 'undefined') {
var errorMessage = getUndefinedStateErrorMessage(key, action);
throw new Error(errorMessage);
}
nextState[key] = nextStateForKey;
hasChanged = hasChanged || nextStateForKey !== previousStateForKey;
}
return hasChanged ? nextState : state;
};
}
/***/ }),
/* 22 */
/***/ (function(module, exports) {
'use strict';
exports.__esModule = true;
exports['default'] = warning;
/**
* Prints a warning in the console if it exists.
*
* @param {String} message The warning message.
* @returns {void}
*/
function warning(message) {
/* eslint-disable no-console */
if (typeof console !== 'undefined' && typeof console.error === 'function') {
console.error(message);
}
/* eslint-enable no-console */
try {
// This error was thrown as a convenience so that if you enable
// "break on all exceptions" in your console,
// it would pause the execution at this line.
throw new Error(message);
/* eslint-disable no-empty */
} catch (e) {}
/* eslint-enable no-empty */
}
/***/ }),
/* 23 */
/***/ (function(module, exports) {
'use strict';
exports.__esModule = true;
exports['default'] = bindActionCreators;
function bindActionCreator(actionCreator, dispatch) {
return function () {
return dispatch(actionCreator.apply(undefined, arguments));
};
}
/**
* Turns an object whose values are action creators, into an object with the
* same keys, but with every function wrapped into a `dispatch` call so they
* may be invoked directly. This is just a convenience method, as you can call
* `store.dispatch(MyActionCreators.doSomething())` yourself just fine.
*
* For convenience, you can also pass a single function as the first argument,
* and get a function in return.
*
* @param {Function|Object} actionCreators An object whose values are action
* creator functions. One handy way to obtain it is to use ES6 `import * as`
* syntax. You may also pass a single function.
*
* @param {Function} dispatch The `dispatch` function available on your Redux
* store.
*
* @returns {Function|Object} The object mimicking the original object, but with
* every action creator wrapped into the `dispatch` call. If you passed a
* function as `actionCreators`, the return value will also be a single
* function.
*/
function bindActionCreators(actionCreators, dispatch) {
if (typeof actionCreators === 'function') {
return bindActionCreator(actionCreators, dispatch);
}
if (typeof actionCreators !== 'object' || actionCreators === null) {
throw new Error('bindActionCreators expected an object or a function, instead received ' + (actionCreators === null ? 'null' : typeof actionCreators) + '. ' + 'Did you write "import ActionCreators from" instead of "import * as ActionCreators from"?');
}
var keys = Object.keys(actionCreators);
var boundActionCreators = {};
for (var i = 0; i < keys.length; i++) {
var key = keys[i];
var actionCreator = actionCreators[key];
if (typeof actionCreator === 'function') {
boundActionCreators[key] = bindActionCreator(actionCreator, dispatch);
}
}
return boundActionCreators;
}
/***/ }),
/* 24 */
/***/ (function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
exports['default'] = applyMiddleware;
var _compose = __webpack_require__(25);
var _compose2 = _interopRequireDefault(_compose);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
/**
* Creates a store enhancer that applies middleware to the dispatch method
* of the Redux store. This is handy for a variety of tasks, such as expressing
* asynchronous actions in a concise manner, or logging every action payload.
*
* See `redux-thunk` package as an example of the Redux middleware.
*
* Because middleware is potentially asynchronous, this should be the first
* store enhancer in the composition chain.
*
* Note that each middleware will be given the `dispatch` and `getState` functions
* as named arguments.
*
* @param {...Function} middlewares The middleware chain to be applied.
* @returns {Function} A store enhancer applying the middleware.
*/
function applyMiddleware() {
for (var _len = arguments.length, middlewares = Array(_len), _key = 0; _key < _len; _key++) {
middlewares[_key] = arguments[_key];
}
return function (createStore) {
return function (reducer, preloadedState, enhancer) {
var store = createStore(reducer, preloadedState, enhancer);
var _dispatch = store.dispatch;
var chain = [];
var middlewareAPI = {
getState: store.getState,
dispatch: function dispatch(action) {
return _dispatch(action);
}
};
chain = middlewares.map(function (middleware) {
return middleware(middlewareAPI);
});
_dispatch = _compose2['default'].apply(undefined, chain)(store.dispatch);
return _extends({}, store, {
dispatch: _dispatch
});
};
};
}
/***/ }),
/* 25 */
/***/ (function(module, exports) {
"use strict";
exports.__esModule = true;
exports["default"] = compose;
/**
* Composes single-argument functions from right to left. The rightmost
* function can take multiple arguments as it provides the signature for
* the resulting composite function.
*
* @param {...Function} funcs The functions to compose.
* @returns {Function} A function obtained by composing the argument functions
* from right to left. For example, compose(f, g, h) is identical to doing
* (...args) => f(g(h(...args))).
*/
function compose() {
for (var _len = arguments.length, funcs = Array(_len), _key = 0; _key < _len; _key++) {
funcs[_key] = arguments[_key];
}
if (funcs.length === 0) {
return function (arg) {
return arg;
};
}
if (funcs.length === 1) {
return funcs[0];
}
var last = funcs[funcs.length - 1];
var rest = funcs.slice(0, -1);
return function () {
return rest.reduceRight(function (composed, f) {
return f(composed);
}, last.apply(undefined, arguments));
};
}
/***/ }),
/* 26 */
/***/ (function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _redux = __webpack_require__(5);
var _items = __webpack_require__(27);
var _items2 = _interopRequireDefault(_items);
var _groups = __webpack_require__(28);
var _groups2 = _interopRequireDefault(_groups);
var _choices = __webpack_require__(29);
var _choices2 = _interopRequireDefault(_choices);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var appReducer = (0, _redux.combineReducers)({
items: _items2.default,
groups: _groups2.default,
choices: _choices2.default
});
var rootReducer = function rootReducer(passedState, action) {
var state = passedState;
// If we are clearing all items, groups and options we reassign
// state and then pass that state to our proper reducer. This isn't
// mutating our actual state
// See: http://stackoverflow.com/a/35641992
if (action.type === 'CLEAR_ALL') {
state = undefined;
}
return appReducer(state, action);
};
exports.default = rootReducer;
/***/ }),
/* 27 */
/***/ (function(module, exports) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
var items = function items() {
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
var action = arguments[1];
switch (action.type) {
case 'ADD_ITEM':
{
// Add object to items array
var newState = [].concat(_toConsumableArray(state), [{
id: action.id,
choiceId: action.choiceId,
groupId: action.groupId,
value: action.value,
label: action.label,
active: true,
highlighted: false,
customProperties: action.customProperties,
keyCode: null
}]);
return newState.map(function (item) {
if (item.highlighted) {
item.highlighted = false;
}
return item;
});
}
case 'REMOVE_ITEM':
{
// Set item to inactive
return state.map(function (item) {
if (item.id === action.id) {
item.active = false;
}
return item;
});
}
case 'HIGHLIGHT_ITEM':
{
return state.map(function (item) {
if (item.id === action.id) {
item.highlighted = action.highlighted;
}
return item;
});
}
default:
{
return state;
}
}
};
exports.default = items;
/***/ }),
/* 28 */
/***/ (function(module, exports) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
var groups = function groups() {
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
var action = arguments[1];
switch (action.type) {
case 'ADD_GROUP':
{
return [].concat(_toConsumableArray(state), [{
id: action.id,
value: action.value,
active: action.active,
disabled: action.disabled
}]);
}
case 'CLEAR_CHOICES':
{
return state.groups = [];
}
default:
{
return state;
}
}
};
exports.default = groups;
/***/ }),
/* 29 */
/***/ (function(module, exports) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
var choices = function choices() {
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
var action = arguments[1];
switch (action.type) {
case 'ADD_CHOICE':
{
/*
A disabled choice appears in the choice dropdown but cannot be selected
A selected choice has been added to the passed input's value (added as an item)
An active choice appears within the choice dropdown
*/
return [].concat(_toConsumableArray(state), [{
id: action.id,
elementId: action.elementId,
groupId: action.groupId,
value: action.value,
label: action.label || action.value,
disabled: action.disabled || false,
selected: false,
active: true,
score: 9999,
customProperties: action.customProperties,
keyCode: null
}]);
}
case 'ADD_ITEM':
{
var newState = state;
// If all choices need to be activated
if (action.activateOptions) {
newState = state.map(function (choice) {
choice.active = action.active;
return choice;
});
}
// When an item is added and it has an associated choice,
// we want to disable it so it can't be chosen again
if (action.choiceId > -1) {
newState = state.map(function (choice) {
if (choice.id === parseInt(action.choiceId, 10)) {
choice.selected = true;
}
return choice;
});
}
return newState;
}
case 'REMOVE_ITEM':
{
// When an item is removed and it has an associated choice,
// we want to re-enable it so it can be chosen again
if (action.choiceId > -1) {
return state.map(function (choice) {
if (choice.id === parseInt(action.choiceId, 10)) {
choice.selected = false;
}
return choice;
});
}
return state;
}
case 'FILTER_CHOICES':
{
var filteredResults = action.results;
var filteredState = state.map(function (choice) {
// Set active state based on whether choice is
// within filtered results
choice.active = filteredResults.some(function (result) {
if (result.item.id === choice.id) {
choice.score = result.score;
return true;
}
return false;
});
return choice;
});
return filteredState;
}
case 'ACTIVATE_CHOICES':
{
return state.map(function (choice) {
choice.active = action.active;
return choice;
});
}
case 'CLEAR_CHOICES':
{
return state.choices = [];
}
default:
{
return state;
}
}
};
exports.default = choices;
/***/ }),
/* 30 */
/***/ (function(module, exports) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var addItem = exports.addItem = function addItem(value, label, id, choiceId, groupId, customProperties, keyCode) {
return {
type: 'ADD_ITEM',
value: value,
label: label,
id: id,
choiceId: choiceId,
groupId: groupId,
customProperties: customProperties,
keyCode: keyCode
};
};
var removeItem = exports.removeItem = function removeItem(id, choiceId) {
return {
type: 'REMOVE_ITEM',
id: id,
choiceId: choiceId
};
};
var highlightItem = exports.highlightItem = function highlightItem(id, highlighted) {
return {
type: 'HIGHLIGHT_ITEM',
id: id,
highlighted: highlighted
};
};
var addChoice = exports.addChoice = function addChoice(value, label, id, groupId, disabled, elementId, customProperties, keyCode) {
return {
type: 'ADD_CHOICE',
value: value,
label: label,
id: id,
groupId: groupId,
disabled: disabled,
elementId: elementId,
customProperties: customProperties,
keyCode: keyCode
};
};
var filterChoices = exports.filterChoices = function filterChoices(results) {
return {
type: 'FILTER_CHOICES',
results: results
};
};
var activateChoices = exports.activateChoices = function activateChoices() {
var active = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
return {
type: 'ACTIVATE_CHOICES',
active: active
};
};
var clearChoices = exports.clearChoices = function clearChoices() {
return {
type: 'CLEAR_CHOICES'
};
};
var addGroup = exports.addGroup = function addGroup(value, id, active, disabled) {
return {
type: 'ADD_GROUP',
value: value,
id: id,
active: active,
disabled: disabled
};
};
var clearAll = exports.clearAll = function clearAll() {
return {
type: 'CLEAR_ALL'
};
};
/***/ }),
/* 31 */
/***/ (function(module, exports) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
/* eslint-disable */
/**
* Capitalises the first letter of each word in a string
* @param {String} str String to capitalise
* @return {String} Capitalised string
*/
var capitalise = exports.capitalise = function capitalise(str) {
return str.replace(/\w\S*/g, function (txt) {
return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
});
};
/**
* Generates a string of random chars
* @param {Number} length Length of the string to generate
* @return {String} String of random chars
*/
var generateChars = exports.generateChars = function generateChars(length) {
var chars = '';
for (var i = 0; i < length; i++) {
var randomChar = getRandomNumber(0, 36);
chars += randomChar.toString(36);
}
return chars;
};
/**
* Generates a unique id based on an element
* @param {HTMLElement} element Element to generate the id from
* @param {String} Prefix for the Id
* @return {String} Unique Id
*/
var generateId = exports.generateId = function generateId(element, prefix) {
var id = element.id || element.name && element.name + '-' + generateChars(2) || generateChars(4);
id = id.replace(/(:|\.|\[|\]|,)/g, '');
id = prefix + id;
return id;
};
/**
* Tests the type of an object
* @param {String} type Type to test object against
* @param {Object} obj Object to be tested
* @return {Boolean}
*/
var getType = exports.getType = function getType(obj) {
return Object.prototype.toString.call(obj).slice(8, -1);
};
/**
* Tests the type of an object
* @param {String} type Type to test object against
* @param {Object} obj Object to be tested
* @return {Boolean}
*/
var isType = exports.isType = function isType(type, obj) {
var clas = getType(obj);
return obj !== undefined && obj !== null && clas === type;
};
/**
* Tests to see if a passed object is a node
* @param {Object} obj Object to be tested
* @return {Boolean}
*/
var isNode = exports.isNode = function isNode(o) {
return (typeof Node === 'undefined' ? 'undefined' : _typeof(Node)) === "object" ? o instanceof Node : o && (typeof o === 'undefined' ? 'undefined' : _typeof(o)) === "object" && typeof o.nodeType === "number" && typeof o.nodeName === "string";
};
/**
* Tests to see if a passed object is an element
* @param {Object} obj Object to be tested
* @return {Boolean}
*/
var isElement = exports.isElement = function isElement(o) {
return (typeof HTMLElement === 'undefined' ? 'undefined' : _typeof(HTMLElement)) === "object" ? o instanceof HTMLElement : //DOM2
o && (typeof o === 'undefined' ? 'undefined' : _typeof(o)) === "object" && o !== null && o.nodeType === 1 && typeof o.nodeName === "string";
};
/**
* Merges unspecified amount of objects into new object
* @private
* @return {Object} Merged object of arguments
*/
var extend = exports.extend = function extend() {
var extended = {};
var length = arguments.length;
/**
* Merge one object into another
* @param {Object} obj Object to merge into extended object
*/
var merge = function merge(obj) {
for (var prop in obj) {
if (Object.prototype.hasOwnProperty.call(obj, prop)) {
// If deep merge and property is an object, merge properties
if (isType('Object', obj[prop])) {
extended[prop] = extend(true, extended[prop], obj[prop]);
} else {
extended[prop] = obj[prop];
}
}
}
};
// Loop through each passed argument
for (var i = 0; i < length; i++) {
// store argument at position i
var obj = arguments[i];
// If we are in fact dealing with an object, merge it.
if (isType('Object', obj)) {
merge(obj);
}
}
return extended;
};
/**
* CSS transition end event listener
* @return
*/
var whichTransitionEvent = exports.whichTransitionEvent = function whichTransitionEvent() {
var t,
el = document.createElement("fakeelement");
var transitions = {
"transition": "transitionend",
"OTransition": "oTransitionEnd",
"MozTransition": "transitionend",
"WebkitTransition": "webkitTransitionEnd"
};
for (t in transitions) {
if (el.style[t] !== undefined) {
return transitions[t];
}
}
};
/**
* CSS animation end event listener
* @return
*/
var whichAnimationEvent = exports.whichAnimationEvent = function whichAnimationEvent() {
var t,
el = document.createElement('fakeelement');
var animations = {
'animation': 'animationend',
'OAnimation': 'oAnimationEnd',
'MozAnimation': 'animationend',
'WebkitAnimation': 'webkitAnimationEnd'
};
for (t in animations) {
if (el.style[t] !== undefined) {
return animations[t];
}
}
};
/**
* Get the ancestors of each element in the current set of matched elements,
* up to but not including the element matched by the selector
* @param {NodeElement} elem Element to begin search from
* @param {NodeElement} parent Parent to find
* @param {String} selector Class to find
* @return {Array} Array of parent elements
*/
var getParentsUntil = exports.getParentsUntil = function getParentsUntil(elem, parent, selector) {
var parents = [];
// Get matches
for (; elem && elem !== document; elem = elem.parentNode) {
// Check if parent has been reached
if (parent) {
var parentType = parent.charAt(0);
// If parent is a class
if (parentType === '.') {
if (elem.classList.contains(parent.substr(1))) {
break;
}
}
// If parent is an ID
if (parentType === '#') {
if (elem.id === parent.substr(1)) {
break;
}
}
// If parent is a data attribute
if (parentType === '[') {
if (elem.hasAttribute(parent.substr(1, parent.length - 1))) {
break;
}
}
// If parent is a tag
if (elem.tagName.toLowerCase() === parent) {
break;
}
}
if (selector) {
var selectorType = selector.charAt(0);
// If selector is a class
if (selectorType === '.') {
if (elem.classList.contains(selector.substr(1))) {
parents.push(elem);
}
}
// If selector is an ID
if (selectorType === '#') {
if (elem.id === selector.substr(1)) {
parents.push(elem);
}
}
// If selector is a data attribute
if (selectorType === '[') {
if (elem.hasAttribute(selector.substr(1, selector.length - 1))) {
parents.push(elem);
}
}
// If selector is a tag
if (elem.tagName.toLowerCase() === selector) {
parents.push(elem);
}
} else {
parents.push(elem);
}
}
// Return parents if any exist
if (parents.length === 0) {
return null;
} else {
return parents;
}
};
var wrap = exports.wrap = function wrap(element, wrapper) {
wrapper = wrapper || document.createElement('div');
if (element.nextSibling) {
element.parentNode.insertBefore(wrapper, element.nextSibling);
} else {
element.parentNode.appendChild(wrapper);
}
return wrapper.appendChild(element);
};
var getSiblings = exports.getSiblings = function getSiblings(elem) {
var siblings = [];
var sibling = elem.parentNode.firstChild;
for (; sibling; sibling = sibling.nextSibling) {
if (sibling.nodeType === 1 && sibling !== elem) {
siblings.push(sibling);
}
}
return siblings;
};
/**
* Find ancestor in DOM tree
* @param {NodeElement} el Element to start search from
* @param {[type]} cls Class of parent
* @return {NodeElement} Found parent element
*/
var findAncestor = exports.findAncestor = function findAncestor(el, cls) {
while ((el = el.parentElement) && !el.classList.contains(cls)) {}
return el;
};
/**
* Find ancestor in DOM tree by attribute name
* @param {NodeElement} el Element to start search from
* @param {string} attr Attribute name of parent
* @return {?NodeElement} Found parent element or null
*/
var findAncestorByAttrName = exports.findAncestorByAttrName = function findAncestorByAttrName(el, attr) {
var target = el;
while (target) {
if (target.hasAttribute(attr)) {
return target;
}
target = target.parentElement;
}
return null;
};
/**
* Debounce an event handler.
* @param {Function} func Function to run after wait
* @param {Number} wait The delay before the function is executed
* @param {Boolean} immediate If passed, trigger the function on the leading edge, instead of the trailing.
* @return {Function} A function will be called after it stops being called for a given delay
*/
var debounce = exports.debounce = function debounce(func, wait, immediate) {
var timeout;
return function () {
var context = this,
args = arguments;
var later = function later() {
timeout = null;
if (!immediate) func.apply(context, args);
};
var callNow = immediate && !timeout;
clearTimeout(timeout);
timeout = setTimeout(later, wait);
if (callNow) func.apply(context, args);
};
};
/**
* Get an element's distance from the top of the page
* @private
* @param {NodeElement} el Element to test for
* @return {Number} Elements Distance from top of page
*/
var getElemDistance = exports.getElemDistance = function getElemDistance(el) {
var location = 0;
if (el.offsetParent) {
do {
location += el.offsetTop;
el = el.offsetParent;
} while (el);
}
return location >= 0 ? location : 0;
};
/**
* Determine element height multiplied by any offsets
* @private
* @param {HTMLElement} el Element to test for
* @return {Number} Height of element
*/
var getElementOffset = exports.getElementOffset = function getElementOffset(el, offset) {
var elOffset = offset;
if (elOffset > 1) elOffset = 1;
if (elOffset > 0) elOffset = 0;
return Math.max(el.offsetHeight * elOffset);
};
/**
* Get the next or previous element from a given start point
* @param {HTMLElement} startEl Element to start position from
* @param {String} className The class we will look through
* @param {Number} direction Positive next element, negative previous element
* @return {[HTMLElement} Found element
*/
var getAdjacentEl = exports.getAdjacentEl = function getAdjacentEl(startEl, className) {
var direction = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
if (!startEl || !className) return;
var parent = startEl.parentNode.parentNode;
var children = Array.from(parent.querySelectorAll(className));
var startPos = children.indexOf(startEl);
var operatorDirection = direction > 0 ? 1 : -1;
return children[startPos + operatorDirection];
};
/**
* Get scroll position based on top/bottom position
* @private
* @return {String} Position of scroll
*/
var getScrollPosition = exports.getScrollPosition = function getScrollPosition(position) {
if (position === 'bottom') {
// Scroll position from the bottom of the viewport
return Math.max((window.scrollY || window.pageYOffset) + (window.innerHeight || document.documentElement.clientHeight));
} else {
// Scroll position from the top of the viewport
return window.scrollY || window.pageYOffset;
}
};
/**
* Determine whether an element is within the viewport
* @param {HTMLElement} el Element to test
* @return {String} Position of scroll
* @return {Boolean}
*/
var isInView = exports.isInView = function isInView(el, position, offset) {
// If the user has scrolled further than the distance from the element to the top of its parent
return this.getScrollPosition(position) > this.getElemDistance(el) + this.getElementOffset(el, offset) ? true : false;
};
/**
* Determine whether an element is within
* @param {HTMLElement} el Element to test
* @param {HTMLElement} parent Scrolling parent
* @param {Number} direction Whether element is visible from above or below
* @return {Boolean}
*/
var isScrolledIntoView = exports.isScrolledIntoView = function isScrolledIntoView(el, parent) {
var direction = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
if (!el) return;
var isVisible = void 0;
if (direction > 0) {
// In view from bottom
isVisible = parent.scrollTop + parent.offsetHeight >= el.offsetTop + el.offsetHeight;
} else {
// In view from top
isVisible = el.offsetTop >= parent.scrollTop;
}
return isVisible;
};
/**
* Remove html tags from a string
* @param {String} Initial string/html
* @return {String} Sanitised string
*/
var stripHTML = exports.stripHTML = function stripHTML(html) {
var el = document.createElement("DIV");
el.innerHTML = html;
return el.textContent || el.innerText || "";
};
/**
* Adds animation to an element and removes it upon animation completion
* @param {Element} el Element to add animation to
* @param {String} animation Animation class to add to element
* @return
*/
var addAnimation = exports.addAnimation = function addAnimation(el, animation) {
var animationEvent = whichAnimationEvent();
var removeAnimation = function removeAnimation() {
el.classList.remove(animation);
el.removeEventListener(animationEvent, removeAnimation, false);
};
el.classList.add(animation);
el.addEventListener(animationEvent, removeAnimation, false);
};
/**
* Get a random number between a range
* @param {Number} min Minimum range
* @param {Number} max Maximum range
* @return {Number} Random number
*/
var getRandomNumber = exports.getRandomNumber = function getRandomNumber(min, max) {
return Math.floor(Math.random() * (max - min) + min);
};
/**
* Turn a string into a node
* @param {String} String to convert
* @return {HTMLElement} Converted node element
*/
var strToEl = exports.strToEl = function () {
var tmpEl = document.createElement('div');
return function (str) {
var cleanedInput = str.trim();
var r = void 0;
tmpEl.innerHTML = cleanedInput;
r = tmpEl.children[0];
while (tmpEl.firstChild) {
tmpEl.removeChild(tmpEl.firstChild);
}
return r;
};
}();
/**
* Sets the width of a passed input based on its value
* @return {Number} Width of input
*/
var getWidthOfInput = exports.getWidthOfInput = function getWidthOfInput(input) {
var value = input.value || input.placeholder;
var width = input.offsetWidth;
if (value) {
var testEl = strToEl('<span>' + value + '</span>');
testEl.style.position = 'absolute';
testEl.style.padding = '0';
testEl.style.top = '-9999px';
testEl.style.left = '-9999px';
testEl.style.width = 'auto';
testEl.style.whiteSpace = 'pre';
document.body.appendChild(testEl);
if (value && testEl.offsetWidth !== input.offsetWidth) {
width = testEl.offsetWidth + 4;
}
document.body.removeChild(testEl);
}
return width + 'px';
};
/**
* Sorting function for current and previous string
* @param {String} a Current value
* @param {String} b Next value
* @return {Number} -1 for after previous,
* 1 for before,
* 0 for same location
*/
var sortByAlpha = exports.sortByAlpha = function sortByAlpha(a, b) {
var labelA = (a.label || a.value).toLowerCase();
var labelB = (b.label || b.value).toLowerCase();
if (labelA < labelB) return -1;
if (labelA > labelB) return 1;
return 0;
};
/**
* Sort by numeric score
* @param {Object} a Current value
* @param {Object} b Next value
* @return {Number} -1 for after previous,
* 1 for before,
* 0 for same location
*/
var sortByScore = exports.sortByScore = function sortByScore(a, b) {
return a.score - b.score;
};
/**
* Trigger native event
* @param {NodeElement} element Element to trigger event on
* @param {String} type Type of event to trigger
* @param {Object} customArgs Data to pass with event
* @return {Object} Triggered event
*/
var triggerEvent = exports.triggerEvent = function triggerEvent(element, type) {
var customArgs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
var event = new CustomEvent(type, {
detail: customArgs,
bubbles: true,
cancelable: true
});
return element.dispatchEvent(event);
};
/***/ }),
/* 32 */
/***/ (function(module, exports) {
'use strict';
/* eslint-disable */
(function () {
// Production steps of ECMA-262, Edition 6, 22.1.2.1
// Reference: https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.from
if (!Array.from) {
Array.from = function () {
var toStr = Object.prototype.toString;
var isCallable = function isCallable(fn) {
return typeof fn === 'function' || toStr.call(fn) === '[object Function]';
};
var toInteger = function toInteger(value) {
var number = Number(value);
if (isNaN(number)) {
return 0;
}
if (number === 0 || !isFinite(number)) {
return number;
}
return (number > 0 ? 1 : -1) * Math.floor(Math.abs(number));
};
var maxSafeInteger = Math.pow(2, 53) - 1;
var toLength = function toLength(value) {
var len = toInteger(value);
return Math.min(Math.max(len, 0), maxSafeInteger);
};
// The length property of the from method is 1.
return function from(arrayLike /*, mapFn, thisArg */) {
// 1. Let C be the this value.
var C = this;
// 2. Let items be ToObject(arrayLike).
var items = Object(arrayLike);
// 3. ReturnIfAbrupt(items).
if (arrayLike == null) {
throw new TypeError("Array.from requires an array-like object - not null or undefined");
}
// 4. If mapfn is undefined, then let mapping be false.
var mapFn = arguments.length > 1 ? arguments[1] : void undefined;
var T;
if (typeof mapFn !== 'undefined') {
// 5. else
// 5. a If IsCallable(mapfn) is false, throw a TypeError exception.
if (!isCallable(mapFn)) {
throw new TypeError('Array.from: when provided, the second argument must be a function');
}
// 5. b. If thisArg was supplied, let T be thisArg; else let T be undefined.
if (arguments.length > 2) {
T = arguments[2];
}
}
// 10. Let lenValue be Get(items, "length").
// 11. Let len be ToLength(lenValue).
var len = toLength(items.length);
// 13. If IsConstructor(C) is true, then
// 13. a. Let A be the result of calling the [[Construct]] internal method of C with an argument list containing the single item len.
// 14. a. Else, Let A be ArrayCreate(len).
var A = isCallable(C) ? Object(new C(len)) : new Array(len);
// 16. Let k be 0.
var k = 0;
// 17. Repeat, while k < len… (also steps a - h)
var kValue;
while (k < len) {
kValue = items[k];
if (mapFn) {
A[k] = typeof T === 'undefined' ? mapFn(kValue, k) : mapFn.call(T, kValue, k);
} else {
A[k] = kValue;
}
k += 1;
}
// 18. Let putStatus be Put(A, "length", len, true).
A.length = len;
// 20. Return A.
return A;
};
}();
}
// Reference: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/find
if (!Array.prototype.find) {
Array.prototype.find = function (predicate) {
'use strict';
if (this == null) {
throw new TypeError('Array.prototype.find called on null or undefined');
}
if (typeof predicate !== 'function') {
throw new TypeError('predicate must be a function');
}
var list = Object(this);
var length = list.length >>> 0;
var thisArg = arguments[1];
var value;
for (var i = 0; i < length; i++) {
value = list[i];
if (predicate.call(thisArg, value, i, list)) {
return value;
}
}
return undefined;
};
}
function CustomEvent(event, params) {
params = params || {
bubbles: false,
cancelable: false,
detail: undefined
};
var evt = document.createEvent('CustomEvent');
evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);
return evt;
}
CustomEvent.prototype = window.Event.prototype;
window.CustomEvent = CustomEvent;
})();
/***/ })
/******/ ])
});
;
//# sourceMappingURL=choices.js.map |
ajax/libs/forerunnerdb/1.3.755/fdb-core+persist.min.js | rlugojr/cdnjs | !function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b,c){var d=a("./core");a("../lib/Persist");"undefined"!=typeof window&&(window.ForerunnerDB=d),b.exports=d},{"../lib/Persist":28,"./core":2}],2:[function(a,b,c){var d=a("../lib/Core");a("../lib/Shim.IE8");"undefined"!=typeof window&&(window.ForerunnerDB=d),b.exports=d},{"../lib/Core":7,"../lib/Shim.IE8":34}],3:[function(a,b,c){"use strict";var d=a("./Shared"),e=a("./Path"),f=new e,g=function(a,b,c){this.init.apply(this,arguments)};g.prototype.init=function(a,b,c,d,e){this._store=[],this._keys=[],void 0!==c&&this.primaryKey(c),void 0!==b&&this.index(b),void 0!==d&&this.compareFunc(d),void 0!==e&&this.hashFunc(e),void 0!==a&&this.data(a)},d.addModule("BinaryTree",g),d.mixin(g.prototype,"Mixin.ChainReactor"),d.mixin(g.prototype,"Mixin.Sorting"),d.mixin(g.prototype,"Mixin.Common"),d.synthesize(g.prototype,"compareFunc"),d.synthesize(g.prototype,"hashFunc"),d.synthesize(g.prototype,"indexDir"),d.synthesize(g.prototype,"primaryKey"),d.synthesize(g.prototype,"keys"),d.synthesize(g.prototype,"index",function(a){return void 0!==a&&(this.debug()&&console.log("Setting index",a,f.parse(a,!0)),this.keys(f.parse(a,!0))),this.$super.call(this,a)}),g.prototype.clear=function(){delete this._data,delete this._left,delete this._right,this._store=[]},g.prototype.data=function(a){return void 0!==a?(this._data=a,this._hashFunc&&(this._hash=this._hashFunc(a)),this):this._data},g.prototype.push=function(a){return void 0!==a?(this._store.push(a),this):!1},g.prototype.pull=function(a){if(void 0!==a){var b=this._store.indexOf(a);if(b>-1)return this._store.splice(b,1),this}return!1},g.prototype._compareFunc=function(a,b){var c,d,e=0;for(c=0;c<this._keys.length;c++)if(d=this._keys[c],1===d.value?e=this.sortAsc(f.get(a,d.path),f.get(b,d.path)):-1===d.value&&(e=this.sortDesc(f.get(a,d.path),f.get(b,d.path))),this.debug()&&console.log("Compared %s with %s order %d in path %s and result was %d",f.get(a,d.path),f.get(b,d.path),d.value,d.path,e),0!==e)return this.debug()&&console.log("Retuning result %d",e),e;return this.debug()&&console.log("Retuning result %d",e),e},g.prototype._hashFunc=function(a){return a[this._keys[0].path]},g.prototype.removeChildNode=function(a){this._left===a?delete this._left:this._right===a&&delete this._right},g.prototype.nodeBranch=function(a){return this._left===a?"left":this._right===a?"right":void 0},g.prototype.insert=function(a){var b,c,d,e;if(a instanceof Array){for(c=[],d=[],e=0;e<a.length;e++)this.insert(a[e])?c.push(a[e]):d.push(a[e]);return{inserted:c,failed:d}}return this.debug()&&console.log("Inserting",a),this._data?(b=this._compareFunc(this._data,a),0===b?(this.debug()&&console.log("Data is equal (currrent, new)",this._data,a),this._left?this._left.insert(a):(this._left=new g(a,this._index,this._binaryTree,this._compareFunc,this._hashFunc),this._left._parent=this),!0):-1===b?(this.debug()&&console.log("Data is greater (currrent, new)",this._data,a),this._right?this._right.insert(a):(this._right=new g(a,this._index,this._binaryTree,this._compareFunc,this._hashFunc),this._right._parent=this),!0):1===b?(this.debug()&&console.log("Data is less (currrent, new)",this._data,a),this._left?this._left.insert(a):(this._left=new g(a,this._index,this._binaryTree,this._compareFunc,this._hashFunc),this._left._parent=this),!0):!1):(this.debug()&&console.log("Node has no data, setting data",a),this.data(a),!0)},g.prototype.remove=function(a){var b,c,d,e=this.primaryKey();if(a instanceof Array){for(c=[],d=0;d<a.length;d++)this.remove(a[d])&&c.push(a[d]);return c}return this.debug()&&console.log("Removing",a),this._data[e]===a[e]?this._remove(this):(b=this._compareFunc(this._data,a),-1===b&&this._right?this._right.remove(a):1===b&&this._left?this._left.remove(a):!1)},g.prototype._remove=function(a){var b,c;return this._left?(b=this._left,c=this._right,this._left=b._left,this._right=b._right,this._data=b._data,this._store=b._store,c&&(b.rightMost()._right=c)):this._right?(c=this._right,this._left=c._left,this._right=c._right,this._data=c._data,this._store=c._store):this.clear(),!0},g.prototype.leftMost=function(){return this._left?this._left.leftMost():this},g.prototype.rightMost=function(){return this._right?this._right.rightMost():this},g.prototype.lookup=function(a,b,c){var d=this._compareFunc(this._data,a);return c=c||[],0===d&&(this._left&&this._left.lookup(a,b,c),c.push(this._data),this._right&&this._right.lookup(a,b,c)),-1===d&&this._right&&this._right.lookup(a,b,c),1===d&&this._left&&this._left.lookup(a,b,c),c},g.prototype.inOrder=function(a,b){switch(b=b||[],this._left&&this._left.inOrder(a,b),a){case"hash":b.push(this._hash);break;case"data":b.push(this._data);break;default:b.push({key:this._data,arr:this._store})}return this._right&&this._right.inOrder(a,b),b},g.prototype.startsWith=function(a,b,c,d){var e,g,h=f.get(this._data,a),i=h.substr(0,b.length);return c=c||new RegExp("^"+b),d=d||[],void 0===d._visited&&(d._visited=0),d._visited++,g=this.sortAsc(h,b),e=i===b,0===g&&(this._left&&this._left.startsWith(a,b,c,d),e&&d.push(this._data),this._right&&this._right.startsWith(a,b,c,d)),-1===g&&(e&&d.push(this._data),this._right&&this._right.startsWith(a,b,c,d)),1===g&&(this._left&&this._left.startsWith(a,b,c,d),e&&d.push(this._data)),d},g.prototype.findRange=function(a,b,c,d,f,g){f=f||[],g=g||new e(b),this._left&&this._left.findRange(a,b,c,d,f,g);var h=g.value(this._data),i=this.sortAsc(h,c),j=this.sortAsc(h,d);if(!(0!==i&&1!==i||0!==j&&-1!==j))switch(a){case"hash":f.push(this._hash);break;case"data":f.push(this._data);break;default:f.push({key:this._data,arr:this._store})}return this._right&&this._right.findRange(a,b,c,d,f,g),f},g.prototype.match=function(a,b,c){var d,e,g,h=[],i=0;for(d=f.parseArr(this._index,{verbose:!0}),e=f.parseArr(a,c&&c.pathOptions?c.pathOptions:{ignore:/\$/,verbose:!0}),g=0;g<d.length;g++)e[g]===d[g]&&(i++,h.push(e[g]));return{matchedKeys:h,totalKeyCount:e.length,score:i}},d.finishModule("BinaryTree"),b.exports=g},{"./Path":27,"./Shared":33}],4:[function(a,b,c){"use strict";var d,e;d=function(){var a,b,c,d=[];for(b=0;256>b;b++){for(a=b,c=0;8>c;c++)a=1&a?3988292384^a>>>1:a>>>1;d[b]=a}return d}(),e=function(a){var b,c=-1;for(b=0;b<a.length;b++)c=c>>>8^d[255&(c^a.charCodeAt(b))];return(-1^c)>>>0},b.exports=e},{}],5:[function(a,b,c){"use strict";var d,e,f,g,h,i,j,k,l,m,n;d=a("./Shared");var o=function(a,b){this.init.apply(this,arguments)};o.prototype.init=function(a,b){this.sharedPathSolver=n,this._primaryKey="_id",this._primaryIndex=new g("primary"),this._primaryCrc=new g("primaryCrc"),this._crcLookup=new g("crcLookup"),this._name=a,this._data=[],this._metrics=new f,this._options=b||{changeTimestamp:!1},this._options.db&&this.db(this._options.db),this._metaData={},this._deferQueue={insert:[],update:[],remove:[],upsert:[],async:[]},this._deferThreshold={insert:100,update:100,remove:100,upsert:100},this._deferTime={insert:1,update:1,remove:1,upsert:1},this._deferredCalls=!0,this.subsetOf(this)},d.addModule("Collection",o),d.mixin(o.prototype,"Mixin.Common"),d.mixin(o.prototype,"Mixin.Events"),d.mixin(o.prototype,"Mixin.ChainReactor"),d.mixin(o.prototype,"Mixin.CRUD"),d.mixin(o.prototype,"Mixin.Constants"),d.mixin(o.prototype,"Mixin.Triggers"),d.mixin(o.prototype,"Mixin.Sorting"),d.mixin(o.prototype,"Mixin.Matching"),d.mixin(o.prototype,"Mixin.Updating"),d.mixin(o.prototype,"Mixin.Tags"),f=a("./Metrics"),g=a("./KeyValueStore"),h=a("./Path"),i=a("./IndexHashMap"),j=a("./IndexBinaryTree"),k=a("./Index2d"),e=d.modules.Db,l=a("./Overload"),m=a("./ReactorIO"),n=new h,d.synthesize(o.prototype,"deferredCalls"),d.synthesize(o.prototype,"state"),d.synthesize(o.prototype,"name"),d.synthesize(o.prototype,"metaData"),d.synthesize(o.prototype,"capped"),d.synthesize(o.prototype,"cappedSize"),o.prototype._asyncPending=function(a){this._deferQueue.async.push(a)},o.prototype._asyncComplete=function(a){for(var b=this._deferQueue.async.indexOf(a);b>-1;)this._deferQueue.async.splice(b,1),b=this._deferQueue.async.indexOf(a);0===this._deferQueue.async.length&&this.deferEmit("ready")},o.prototype.data=function(){return this._data},o.prototype.drop=function(a){var b;if(this.isDropped())return a&&a.call(this,!1,!0),!0;if(this._db&&this._db._collection&&this._name){if(this.debug()&&console.log(this.logIdentifier()+" Dropping"),this._state="dropped",this.emit("drop",this),delete this._db._collection[this._name],this._collate)for(b in this._collate)this._collate.hasOwnProperty(b)&&this.collateRemove(b);return delete this._primaryKey,delete this._primaryIndex,delete this._primaryCrc,delete this._crcLookup,delete this._data,delete this._metrics,delete this._listeners,a&&a.call(this,!1,!0),!0}return a&&a.call(this,!1,!0),!1},o.prototype.primaryKey=function(a){if(void 0!==a){if(this._primaryKey!==a){var b=this._primaryKey;this._primaryKey=a,this._primaryIndex.primaryKey(a),this.rebuildPrimaryKeyIndex(),this.chainSend("primaryKey",{keyName:a,oldData:b})}return this}return this._primaryKey},o.prototype._onInsert=function(a,b){this.emit("insert",a,b)},o.prototype._onUpdate=function(a){this.emit("update",a)},o.prototype._onRemove=function(a){this.emit("remove",a)},o.prototype._onChange=function(){this._options.changeTimestamp&&(this._metaData.lastChange=this.serialiser.convert(new Date))},d.synthesize(o.prototype,"db",function(a){return a&&"_id"===this.primaryKey()&&(this.primaryKey(a.primaryKey()),this.debug(a.debug())),this.$super.apply(this,arguments)}),d.synthesize(o.prototype,"mongoEmulation"),o.prototype.setData=new l("Collection.prototype.setData",{"*":function(a){return this.$main.call(this,a,{})},"*, object":function(a,b){return this.$main.call(this,a,b)},"*, function":function(a,b){return this.$main.call(this,a,{},b)},"*, *, function":function(a,b,c){return this.$main.call(this,a,b,c)},"*, *, *":function(a,b,c){return this.$main.call(this,a,b,c)},$main:function(a,b,c){if(this.isDropped())throw this.logIdentifier()+" Cannot operate in a dropped state!";if(a){var d=this.deferredCalls(),e=[].concat(this._data);this.deferredCalls(!1),b=this.options(b),b.$decouple&&(a=this.decouple(a)),a instanceof Array||(a=[a]),this.remove({}),this.insert(a),this.deferredCalls(d),this._onChange(),this.emit("setData",this._data,e)}return c&&c.call(this),this}}),o.prototype.rebuildPrimaryKeyIndex=function(a){a=a||{$ensureKeys:void 0,$violationCheck:void 0};var b,c,d,e,f=a&&void 0!==a.$ensureKeys?a.$ensureKeys:!0,g=a&&void 0!==a.$violationCheck?a.$violationCheck:!0,h=this._primaryIndex,i=this._primaryCrc,j=this._crcLookup,k=this._primaryKey;for(h.truncate(),i.truncate(),j.truncate(),b=this._data,c=b.length;c--;){if(d=b[c],f&&this.ensurePrimaryKey(d),g){if(!h.uniqueSet(d[k],d))throw this.logIdentifier()+" Call to setData on collection failed because your data violates the primary key unique constraint. One or more documents are using the same primary key: "+d[this._primaryKey]}else h.set(d[k],d);e=this.hash(d),i.set(d[k],e),j.set(e,d)}},o.prototype.ensurePrimaryKey=function(a){void 0===a[this._primaryKey]&&(a[this._primaryKey]=this.objectId())},o.prototype.truncate=function(){if(this.isDropped())throw this.logIdentifier()+" Cannot operate in a dropped state!";return this.emit("truncate",this._data),this._data.length=0,this._primaryIndex=new g("primary"),this._primaryCrc=new g("primaryCrc"),this._crcLookup=new g("crcLookup"),this._onChange(),this.emit("immediateChange",{type:"truncate"}),this.deferEmit("change",{type:"truncate"}),this},o.prototype.upsert=function(a,b){if(this.isDropped())throw this.logIdentifier()+" Cannot operate in a dropped state!";if(a){var c,d,e=this._deferQueue.upsert,f=this._deferThreshold.upsert,g={};if(a instanceof Array){if(this._deferredCalls&&a.length>f)return this._deferQueue.upsert=e.concat(a),this._asyncPending("upsert"),this.processQueue("upsert",b),{};for(g=[],d=0;d<a.length;d++)g.push(this.upsert(a[d]));return b&&b.call(this),g}switch(a[this._primaryKey]?(c={},c[this._primaryKey]=a[this._primaryKey],this._primaryIndex.lookup(c)[0]?g.op="update":g.op="insert"):g.op="insert",g.op){case"insert":g.result=this.insert(a,b);break;case"update":g.result=this.update(c,a,{},b)}return g}return b&&b.call(this),{}},o.prototype.filter=function(a,b,c){return this.find(a,c).filter(b)},o.prototype.filterUpdate=function(a,b,c){var d,e,f,g,h=this.find(a,c),i=[],j=this.primaryKey();for(g=0;g<h.length;g++)d=h[g],f=b(d),f&&(e={},e[j]=d[j],i.push(this.update(e,f)));return i},o.prototype.update=function(a,b,c,d){if(this.isDropped())throw this.logIdentifier()+" Cannot operate in a dropped state!";return this.mongoEmulation()?(this.convertToFdb(a),this.convertToFdb(b)):b=this.decouple(b),b=this.transformIn(b),this._handleUpdate(a,b,c,d)},o.prototype._handleUpdate=function(a,b,c,d){var e,f,g=this,h=this._metrics.create("update"),i=function(d){var e,f,i,j=g.decouple(d);return g.willTrigger(g.TYPE_UPDATE,g.PHASE_BEFORE)||g.willTrigger(g.TYPE_UPDATE,g.PHASE_AFTER)?(e=g.decouple(d),f={type:"update",query:g.decouple(a),update:g.decouple(b),options:g.decouple(c),op:h},i=g.updateObject(e,f.update,f.query,f.options,""),g.processTrigger(f,g.TYPE_UPDATE,g.PHASE_BEFORE,d,e)!==!1?(i=g.updateObject(d,e,f.query,f.options,""),g.processTrigger(f,g.TYPE_UPDATE,g.PHASE_AFTER,j,e)):i=!1):i=g.updateObject(d,b,a,c,""),g._updateIndexes(j,d),i};return h.start(),h.time("Retrieve documents to update"),e=this.find(a,{$decouple:!1}),h.time("Retrieve documents to update"),e.length&&(h.time("Update documents"),f=e.filter(i),h.time("Update documents"),f.length&&(this.debug()&&console.log(this.logIdentifier()+" Updated some data"),h.time("Resolve chains"),this.chainWillSend()&&this.chainSend("update",{query:a,update:b,dataSet:this.decouple(f)},c),h.time("Resolve chains"),this._onUpdate(f),this._onChange(),d&&d.call(this),this.emit("immediateChange",{type:"update",data:f}),this.deferEmit("change",{type:"update",data:f}))),h.stop(),f||[]},o.prototype._replaceObj=function(a,b){var c;this._removeFromIndexes(a);for(c in a)a.hasOwnProperty(c)&&delete a[c];for(c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);if(!this._insertIntoIndexes(a))throw this.logIdentifier()+" Primary key violation in update! Key violated: "+a[this._primaryKey];return this},o.prototype.updateById=function(a,b){var c={};return c[this._primaryKey]=a,this.update(c,b)[0]},o.prototype.updateObject=function(a,b,c,d,e,f){b=this.decouple(b),e=e||"","."===e.substr(0,1)&&(e=e.substr(1,e.length-1));var g,i,j,k,l,m,n,o,p,q,r,s,t=!1,u=!1;for(s in b)if(b.hasOwnProperty(s)){if(g=!1,"$"===s.substr(0,1))switch(s){case"$key":case"$index":case"$data":case"$min":case"$max":g=!0;break;case"$each":for(g=!0,k=b.$each.length,j=0;k>j;j++)u=this.updateObject(a,b.$each[j],c,d,e),u&&(t=!0);t=t||u;break;case"$replace":g=!0,n=b.$replace,o=this.primaryKey();for(m in a)a.hasOwnProperty(m)&&m!==o&&void 0===n[m]&&(this._updateUnset(a,m),t=!0);for(m in n)n.hasOwnProperty(m)&&m!==o&&(this._updateOverwrite(a,m,n[m]),t=!0);break;default:g=!0,u=this.updateObject(a,b[s],c,d,e,s),t=t||u}if(this._isPositionalKey(s)&&(g=!0,s=s.substr(0,s.length-2),p=new h(e+"."+s),a[s]&&a[s]instanceof Array&&a[s].length)){for(i=[],j=0;j<a[s].length;j++)this._match(a[s][j],p.value(c)[0],d,"",{})&&i.push(j);for(j=0;j<i.length;j++)u=this.updateObject(a[s][i[j]],b[s+".$"],c,d,e+"."+s,f),t=t||u}if(!g)if(f||"object"!=typeof b[s])switch(f){case"$inc":var v=!0;b[s]>0?b.$max&&a[s]>=b.$max&&(v=!1):b[s]<0&&b.$min&&a[s]<=b.$min&&(v=!1),v&&(this._updateIncrement(a,s,b[s]),t=!0);break;case"$cast":switch(b[s]){case"array":a[s]instanceof Array||(this._updateProperty(a,s,b.$data||[]),t=!0);break;case"object":a[s]instanceof Object&&!(a[s]instanceof Array)||(this._updateProperty(a,s,b.$data||{}),t=!0);break;case"number":"number"!=typeof a[s]&&(this._updateProperty(a,s,Number(a[s])),t=!0);break;case"string":"string"!=typeof a[s]&&(this._updateProperty(a,s,String(a[s])),t=!0);break;default:throw this.logIdentifier()+" Cannot update cast to unknown type: "+b[s]}break;case"$push":if(void 0===a[s]&&this._updateProperty(a,s,[]),!(a[s]instanceof Array))throw this.logIdentifier()+" Cannot push to a key that is not an array! ("+s+")";if(void 0!==b[s].$position&&b[s].$each instanceof Array)for(l=b[s].$position,k=b[s].$each.length,j=0;k>j;j++)this._updateSplicePush(a[s],l+j,b[s].$each[j]);else if(b[s].$each instanceof Array)for(k=b[s].$each.length,j=0;k>j;j++)this._updatePush(a[s],b[s].$each[j]);else this._updatePush(a[s],b[s]);t=!0;break;case"$pull":if(a[s]instanceof Array){for(i=[],j=0;j<a[s].length;j++)this._match(a[s][j],b[s],d,"",{})&&i.push(j);for(k=i.length;k--;)this._updatePull(a[s],i[k]),t=!0}break;case"$pullAll":if(a[s]instanceof Array){if(!(b[s]instanceof Array))throw this.logIdentifier()+" Cannot pullAll without being given an array of values to pull! ("+s+")";if(i=a[s],k=i.length,k>0)for(;k--;){for(l=0;l<b[s].length;l++)i[k]===b[s][l]&&(this._updatePull(a[s],k),k--,t=!0);if(0>k)break}}break;case"$addToSet":if(void 0===a[s]&&this._updateProperty(a,s,[]),!(a[s]instanceof Array))throw this.logIdentifier()+" Cannot addToSet on a key that is not an array! ("+s+")";var w,x,y,z,A=a[s],B=A.length,C=!0,D=d&&d.$addToSet;for(b[s].$key?(y=!1,z=new h(b[s].$key),x=z.value(b[s])[0],delete b[s].$key):D&&D.key?(y=!1,z=new h(D.key),x=z.value(b[s])[0]):(x=this.jStringify(b[s]),y=!0),w=0;B>w;w++)if(y){if(this.jStringify(A[w])===x){C=!1;break}}else if(x===z.value(A[w])[0]){C=!1;break}C&&(this._updatePush(a[s],b[s]),t=!0);break;case"$splicePush":if(void 0===a[s]&&this._updateProperty(a,s,[]),!(a[s]instanceof Array))throw this.logIdentifier()+" Cannot splicePush with a key that is not an array! ("+s+")";if(l=b.$index,void 0===l)throw this.logIdentifier()+" Cannot splicePush without a $index integer value!";delete b.$index,l>a[s].length&&(l=a[s].length),this._updateSplicePush(a[s],l,b[s]),t=!0;break;case"$move":if(!(a[s]instanceof Array))throw this.logIdentifier()+" Cannot move on a key that is not an array! ("+s+")";for(j=0;j<a[s].length;j++)if(this._match(a[s][j],b[s],d,"",{})){var E=b.$index;if(void 0===E)throw this.logIdentifier()+" Cannot move without a $index integer value!";delete b.$index,this._updateSpliceMove(a[s],j,E),t=!0;break}break;case"$mul":this._updateMultiply(a,s,b[s]),t=!0;break;case"$rename":this._updateRename(a,s,b[s]),t=!0;break;case"$overwrite":this._updateOverwrite(a,s,b[s]),t=!0;break;case"$unset":this._updateUnset(a,s),t=!0;break;case"$clear":this._updateClear(a,s),t=!0;break;case"$pop":if(!(a[s]instanceof Array))throw this.logIdentifier()+" Cannot pop from a key that is not an array! ("+s+")";this._updatePop(a[s],b[s])&&(t=!0);break;case"$toggle":this._updateProperty(a,s,!a[s]),t=!0;break;default:a[s]!==b[s]&&(this._updateProperty(a,s,b[s]),t=!0)}else if(null!==a[s]&&"object"==typeof a[s])if(q=a[s]instanceof Array,r=b[s]instanceof Array,q||r)if(!r&&q)for(j=0;j<a[s].length;j++)u=this.updateObject(a[s][j],b[s],c,d,e+"."+s,f),t=t||u;else a[s]!==b[s]&&(this._updateProperty(a,s,b[s]),t=!0);else u=this.updateObject(a[s],b[s],c,d,e+"."+s,f),t=t||u;else a[s]!==b[s]&&(this._updateProperty(a,s,b[s]),t=!0)}return t},o.prototype._isPositionalKey=function(a){return".$"===a.substr(a.length-2,2)},o.prototype.remove=function(a,b,c){if(this.isDropped())throw this.logIdentifier()+" Cannot operate in a dropped state!";var d,e,f,g,h,i,j,k,l=this;if("function"==typeof b&&(c=b,b={}),this.mongoEmulation()&&this.convertToFdb(a),a instanceof Array){for(g=[],f=0;f<a.length;f++)g.push(this.remove(a[f],{noEmit:!0}));return(!b||b&&!b.noEmit)&&this._onRemove(g),c&&c.call(this,!1,g),g}if(g=[],d=this.find(a,{$decouple:!1}),d.length){h=function(a){l._removeFromIndexes(a),e=l._data.indexOf(a),l._dataRemoveAtIndex(e),g.push(a)};for(var m=0;m<d.length;m++)j=d[m],l.willTrigger(l.TYPE_REMOVE,l.PHASE_BEFORE)||l.willTrigger(l.TYPE_REMOVE,l.PHASE_AFTER)?(i={type:"remove"},k=l.decouple(j),l.processTrigger(i,l.TYPE_REMOVE,l.PHASE_BEFORE,k,k)!==!1&&(h(j),l.processTrigger(i,l.TYPE_REMOVE,l.PHASE_AFTER,k,k))):h(j);g.length&&(l.chainSend("remove",{query:a,dataSet:g},b),(!b||b&&!b.noEmit)&&this._onRemove(g),this._onChange(),this.emit("immediateChange",{type:"remove",data:g}),this.deferEmit("change",{type:"remove",data:g}))}return c&&c.call(this,!1,g),g},o.prototype.removeById=function(a){var b={};return b[this._primaryKey]=a,this.remove(b)[0]},o.prototype.processQueue=function(a,b,c){var d,e,f=this,g=this._deferQueue[a],h=this._deferThreshold[a],i=this._deferTime[a];if(c=c||{deferred:!0},g.length){switch(d=g.length>h?g.splice(0,h):g.splice(0,g.length),e=f[a](d),a){case"insert":c.inserted=c.inserted||[],c.failed=c.failed||[],c.inserted=c.inserted.concat(e.inserted),c.failed=c.failed.concat(e.failed)}setTimeout(function(){f.processQueue.call(f,a,b,c)},i)}else b&&b.call(this,c),this._asyncComplete(a);this.isProcessingQueue()||this.deferEmit("queuesComplete")},o.prototype.isProcessingQueue=function(){var a;for(a in this._deferQueue)if(this._deferQueue.hasOwnProperty(a)&&this._deferQueue[a].length)return!0;return!1},o.prototype.insert=function(a,b,c){if(this.isDropped())throw this.logIdentifier()+" Cannot operate in a dropped state!";return"function"==typeof b?(c=b,b=this._data.length):void 0===b&&(b=this._data.length),a=this.transformIn(a),this._insertHandle(a,b,c)},o.prototype._insertHandle=function(a,b,c){var d,e,f,g=this._deferQueue.insert,h=this._deferThreshold.insert,i=[],j=[];if(a instanceof Array){if(this._deferredCalls&&a.length>h)return this._deferQueue.insert=g.concat(a),this._asyncPending("insert"),void this.processQueue("insert",c);for(f=0;f<a.length;f++)d=this._insert(a[f],b+f),d===!0?i.push(a[f]):j.push({doc:a[f],reason:d})}else d=this._insert(a,b),d===!0?i.push(a):j.push({doc:a,reason:d});return e={deferred:!1,inserted:i,failed:j},this._onInsert(i,j),c&&c.call(this,e),this._onChange(),this.emit("immediateChange",{type:"insert",data:i}),this.deferEmit("change",{type:"insert",data:i}),e},o.prototype._insert=function(a,b){if(a){var c,d,e,f,g=this,h=this.capped(),i=this.cappedSize();if(this.ensurePrimaryKey(a),c=this.insertIndexViolation(a),e=function(a){g._insertIntoIndexes(a),b>g._data.length&&(b=g._data.length),g._dataInsertAtIndex(b,a),h&&g._data.length>i&&g.removeById(g._data[0][g._primaryKey]),g.chainWillSend()&&g.chainSend("insert",{dataSet:g.decouple([a])},{index:b})},c)return"Index violation in index: "+c;if(g.willTrigger(g.TYPE_INSERT,g.PHASE_BEFORE)||g.willTrigger(g.TYPE_INSERT,g.PHASE_AFTER)){if(d={type:"insert"},g.processTrigger(d,g.TYPE_INSERT,g.PHASE_BEFORE,{},a)===!1)return"Trigger cancelled operation";e(a),g.willTrigger(g.TYPE_INSERT,g.PHASE_AFTER)&&(f=g.decouple(a),g.processTrigger(d,g.TYPE_INSERT,g.PHASE_AFTER,{},f))}else e(a);return!0}return"No document passed to insert"},o.prototype._dataInsertAtIndex=function(a,b){this._data.splice(a,0,b)},o.prototype._dataRemoveAtIndex=function(a){this._data.splice(a,1)},o.prototype._dataReplace=function(a){for(;this._data.length;)this._data.pop();this._data=this._data.concat(a)},o.prototype._insertIntoIndexes=function(a){var b,c,d=this._indexByName,e=this.hash(a),f=this._primaryKey;c=this._primaryIndex.uniqueSet(a[f],a),this._primaryCrc.uniqueSet(a[f],e),this._crcLookup.uniqueSet(e,a);for(b in d)d.hasOwnProperty(b)&&d[b].insert(a);return c},o.prototype._removeFromIndexes=function(a){var b,c=this._indexByName,d=this.hash(a),e=this._primaryKey;this._primaryIndex.unSet(a[e]),this._primaryCrc.unSet(a[e]),this._crcLookup.unSet(d);for(b in c)c.hasOwnProperty(b)&&c[b].remove(a)},o.prototype._updateIndexes=function(a,b){this._removeFromIndexes(a),this._insertIntoIndexes(b)},o.prototype._rebuildIndexes=function(){var a,b=this._indexByName;for(a in b)b.hasOwnProperty(a)&&b[a].rebuild()},o.prototype.subset=function(a,b){var c,d=this.find(a,b);return c=new o,c.db(this._db),c.subsetOf(this).primaryKey(this._primaryKey).setData(d),c},d.synthesize(o.prototype,"subsetOf"),o.prototype.isSubsetOf=function(a){return this._subsetOf===a},o.prototype.distinct=function(a,b,c){if(this.isDropped())throw this.logIdentifier()+" Cannot operate in a dropped state!";var d,e,f=this.find(b,c),g=new h(a),i={},j=[];for(e=0;e<f.length;e++)d=g.value(f[e])[0],d&&!i[d]&&(i[d]=!0,j.push(d));return j},o.prototype.findById=function(a,b){var c={};return c[this._primaryKey]=a,this.find(c,b)[0]},o.prototype.peek=function(a,b){var c,d,e=this._data,f=e.length,g=new o,h=typeof a;if("string"===h){for(c=0;f>c;c++)d=this.jStringify(e[c]),d.indexOf(a)>-1&&g.insert(e[c]);return g.find({},b)}return this.find(a,b)},o.prototype.explain=function(a,b){var c=this.find(a,b);return c.__fdbOp._data},o.prototype.options=function(a){return a=a||{},a.$decouple=void 0!==a.$decouple?a.$decouple:!0,a.$explain=void 0!==a.$explain?a.$explain:!1,a},o.prototype.find=function(a,b,c){return this.mongoEmulation()&&this.convertToFdb(a),c?(c.call(this,"Callbacks for the find() operation are not yet implemented!",[]),[]):this._find.call(this,a,b,c)},o.prototype._find=function(a,b){if(this.isDropped())throw this.logIdentifier()+" Cannot operate in a dropped state!";a=a||{};var c,d,e,f,g,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x=this._metrics.create("find"),y=this.primaryKey(),z=this,A=!0,B={},C=[],D=[],E=[],F={},G={};if(b instanceof Array||(b=this.options(b)),w=function(c){return z._match(c,a,b,"and",F)},x.start(),a){if(a instanceof Array){for(v=this,n=0;n<a.length;n++)v=v.subset(a[n],b&&b[n]?b[n]:{});return v.find()}if(a.$findSub){if(!a.$findSub.$path)throw"$findSub missing $path property!";return this.findSub(a.$findSub.$query,a.$findSub.$path,a.$findSub.$subQuery,a.$findSub.$subOptions)}if(a.$findSubOne){if(!a.$findSubOne.$path)throw"$findSubOne missing $path property!";return this.findSubOne(a.$findSubOne.$query,a.$findSubOne.$path,a.$findSubOne.$subQuery,a.$findSubOne.$subOptions)}if(x.time("analyseQuery"),c=this._analyseQuery(z.decouple(a),b,x),x.time("analyseQuery"),x.data("analysis",c),c.hasJoin&&c.queriesJoin){for(x.time("joinReferences"),f=0;f<c.joinsOn.length;f++)m=c.joinsOn[f],j=m.key,k=m.type,l=m.id,i=new h(c.joinQueries[j]),g=i.value(a)[0],B[l]=this._db[k](j).subset(g),delete a[c.joinQueries[j]];x.time("joinReferences")}if(c.indexMatch.length&&(!b||b&&!b.$skipIndex)?(x.data("index.potential",c.indexMatch),x.data("index.used",c.indexMatch[0].index),x.time("indexLookup"),e=c.indexMatch[0].lookup||[],x.time("indexLookup"),c.indexMatch[0].keyData.totalKeyCount===c.indexMatch[0].keyData.score&&(A=!1)):x.flag("usedIndex",!1),A&&(e&&e.length?(d=e.length,x.time("tableScan: "+d),e=e.filter(w)):(d=this._data.length,x.time("tableScan: "+d),e=this._data.filter(w)),x.time("tableScan: "+d)),b.$orderBy&&(x.time("sort"),e=this.sort(b.$orderBy,e),x.time("sort")),void 0!==b.$page&&void 0!==b.$limit&&(G.page=b.$page,G.pages=Math.ceil(e.length/b.$limit),G.records=e.length,b.$page&&b.$limit>0&&(x.data("cursor",G),e.splice(0,b.$page*b.$limit))),b.$skip&&(G.skip=b.$skip,e.splice(0,b.$skip),x.data("skip",b.$skip)),b.$limit&&e&&e.length>b.$limit&&(G.limit=b.$limit,e.length=b.$limit,x.data("limit",b.$limit)),b.$decouple&&(x.time("decouple"),e=this.decouple(e),x.time("decouple"),x.data("flag.decouple",!0)),b.$join&&(C=C.concat(this.applyJoin(e,b.$join,B)),x.data("flag.join",!0)),C.length&&(x.time("removalQueue"),this.spliceArrayByIndexList(e,C),x.time("removalQueue")),b.$transform){for(x.time("transform"),n=0;n<e.length;n++)e.splice(n,1,b.$transform(e[n]));x.time("transform"),x.data("flag.transform",!0)}this._transformEnabled&&this._transformOut&&(x.time("transformOut"),e=this.transformOut(e),x.time("transformOut")),x.data("results",e.length)}else e=[];if(!b.$aggregate){x.time("scanFields");for(n in b)b.hasOwnProperty(n)&&0!==n.indexOf("$")&&(1===b[n]?D.push(n):0===b[n]&&E.push(n));if(x.time("scanFields"),D.length||E.length){for(x.data("flag.limitFields",!0),x.data("limitFields.on",D),x.data("limitFields.off",E),x.time("limitFields"),n=0;n<e.length;n++){t=e[n];for(o in t)t.hasOwnProperty(o)&&(D.length&&o!==y&&-1===D.indexOf(o)&&delete t[o],E.length&&E.indexOf(o)>-1&&delete t[o])}x.time("limitFields")}if(b.$elemMatch){x.data("flag.elemMatch",!0),x.time("projection-elemMatch");for(n in b.$elemMatch)if(b.$elemMatch.hasOwnProperty(n))for(q=new h(n),o=0;o<e.length;o++)if(r=q.value(e[o])[0],r&&r.length)for(p=0;p<r.length;p++)if(z._match(r[p],b.$elemMatch[n],b,"",{})){q.set(e[o],n,[r[p]]);break}x.time("projection-elemMatch")}if(b.$elemsMatch){x.data("flag.elemsMatch",!0),x.time("projection-elemsMatch");for(n in b.$elemsMatch)if(b.$elemsMatch.hasOwnProperty(n))for(q=new h(n),o=0;o<e.length;o++)if(r=q.value(e[o])[0],r&&r.length){for(s=[],p=0;p<r.length;p++)z._match(r[p],b.$elemsMatch[n],b,"",{})&&s.push(r[p]);q.set(e[o],n,s)}x.time("projection-elemsMatch")}}return b.$aggregate&&(x.data("flag.aggregate",!0),x.time("aggregate"),u=new h(b.$aggregate),e=u.value(e),x.time("aggregate")),x.stop(),e.__fdbOp=x,e.$cursor=G,e},o.prototype.findOne=function(){return this.find.apply(this,arguments)[0]},o.prototype.indexOf=function(a,b){var c,d=this.find(a,{$decouple:!1})[0];return d?!b||b&&!b.$orderBy?this._data.indexOf(d):(b.$decouple=!1,c=this.find(a,b),c.indexOf(d)):-1},o.prototype.indexOfDocById=function(a,b){var c,d;return c="object"!=typeof a?this._primaryIndex.get(a):this._primaryIndex.get(a[this._primaryKey]),c?!b||b&&!b.$orderBy?this._data.indexOf(c):(b.$decouple=!1,d=this.find({},b),d.indexOf(c)):-1},o.prototype.removeByIndex=function(a){var b,c;return b=this._data[a],void 0!==b?(b=this.decouple(b),c=b[this.primaryKey()],this.removeById(c)):!1},o.prototype.transform=function(a){return void 0!==a?("object"==typeof a?(void 0!==a.enabled&&(this._transformEnabled=a.enabled),void 0!==a.dataIn&&(this._transformIn=a.dataIn),void 0!==a.dataOut&&(this._transformOut=a.dataOut)):this._transformEnabled=a!==!1,this):{enabled:this._transformEnabled,dataIn:this._transformIn,dataOut:this._transformOut}},o.prototype.transformIn=function(a){if(this._transformEnabled&&this._transformIn){if(a instanceof Array){var b,c,d=[];for(c=0;c<a.length;c++)b=this._transformIn(a[c]),b instanceof Array?d=d.concat(b):d.push(b);return d}return this._transformIn(a)}return a},o.prototype.transformOut=function(a){if(this._transformEnabled&&this._transformOut){if(a instanceof Array){var b,c,d=[];for(c=0;c<a.length;c++)b=this._transformOut(a[c]),b instanceof Array?d=d.concat(b):d.push(b);return d}return this._transformOut(a)}return a},o.prototype.sort=function(a,b){var c=this,d=n.parse(a,!0);return d.length&&b.sort(function(a,b){var e,f,g=0;for(e=0;e<d.length;e++)if(f=d[e],1===f.value?g=c.sortAsc(n.get(a,f.path),n.get(b,f.path)):-1===f.value&&(g=c.sortDesc(n.get(a,f.path),n.get(b,f.path))),0!==g)return g;return g}),b},o.prototype._sort=function(a,b){var c,d=this,e=new h,f=e.parse(a,!0)[0];if(e.path(f.path),1===f.value)c=function(a,b){var c=e.value(a)[0],f=e.value(b)[0];return d.sortAsc(c,f)};else{if(-1!==f.value)throw this.logIdentifier()+" $orderBy clause has invalid direction: "+f.value+", accepted values are 1 or -1 for ascending or descending!";c=function(a,b){var c=e.value(a)[0],f=e.value(b)[0];return d.sortDesc(c,f)}}return b.sort(c)},o.prototype._analyseQuery=function(a,b,c){var d,e,f,g,i,j,k,l,m,n,o,p,q,r,s,t,u={queriesOn:[{id:"$collection."+this._name,type:"colletion",key:this._name}],indexMatch:[],hasJoin:!1,queriesJoin:!1,joinQueries:{},query:a,options:b},v=[],w=[];if(c.time("checkIndexes"),p=new h,q=p.parseArr(a,{ignore:/\$/,verbose:!0}).length){void 0!==a[this._primaryKey]&&(r=typeof a[this._primaryKey],("string"===r||"number"===r||a[this._primaryKey]instanceof Array)&&(c.time("checkIndexMatch: Primary Key"),s=this._primaryIndex.lookup(a,b),u.indexMatch.push({lookup:s,keyData:{matchedKeys:[this._primaryKey],totalKeyCount:q,score:1
},index:this._primaryIndex}),c.time("checkIndexMatch: Primary Key")));for(t in this._indexById)if(this._indexById.hasOwnProperty(t)&&(m=this._indexById[t],n=m.name(),c.time("checkIndexMatch: "+n),l=m.match(a,b),l.score>0&&(o=m.lookup(a,b),u.indexMatch.push({lookup:o,keyData:l,index:m})),c.time("checkIndexMatch: "+n),l.score===q))break;c.time("checkIndexes"),u.indexMatch.length>1&&(c.time("findOptimalIndex"),u.indexMatch.sort(function(a,b){return a.keyData.score>b.keyData.score?-1:a.keyData.score<b.keyData.score?1:a.keyData.score===b.keyData.score?a.lookup.length-b.lookup.length:void 0}),c.time("findOptimalIndex"))}if(b.$join){for(u.hasJoin=!0,d=0;d<b.$join.length;d++)for(e in b.$join[d])b.$join[d].hasOwnProperty(e)&&(i=b.$join[d][e],f=i.$sourceType||"collection",g="$"+f+"."+e,v.push({id:g,type:f,key:e}),void 0!==b.$join[d][e].$as?w.push(b.$join[d][e].$as):w.push(e));for(k=0;k<w.length;k++)j=this._queryReferencesSource(a,w[k],""),j&&(u.joinQueries[v[k].key]=j,u.queriesJoin=!0);u.joinsOn=v,u.queriesOn=u.queriesOn.concat(v)}return u},o.prototype._queryReferencesSource=function(a,b,c){var d;for(d in a)if(a.hasOwnProperty(d)){if(d===b)return c&&(c+="."),c+d;if("object"==typeof a[d])return c&&(c+="."),c+=d,this._queryReferencesSource(a[d],b,c)}return!1},o.prototype.count=function(a,b){return a?this.find(a,b).length:this._data.length},o.prototype.findSub=function(a,b,c,d){return this._findSub(this.find(a),b,c,d)},o.prototype._findSub=function(a,b,c,d){var e,f,g,i=new h(b),j=a.length,k=new o("__FDB_temp_"+this.objectId()).db(this._db),l={parents:j,subDocTotal:0,subDocs:[],pathFound:!1,err:""};for(d=d||{},e=0;j>e;e++)if(f=i.value(a[e])[0]){if(k.setData(f),g=k.find(c,d),d.returnFirst&&g.length)return g[0];d.$split?l.subDocs.push(g):l.subDocs=l.subDocs.concat(g),l.subDocTotal+=g.length,l.pathFound=!0}return k.drop(),l.pathFound||(l.err="No objects found in the parent documents with a matching path of: "+b),d.$stats?l:l.subDocs},o.prototype.findSubOne=function(a,b,c,d){return this.findSub(a,b,c,d)[0]},o.prototype.insertIndexViolation=function(a){var b,c,d,e=this._indexByName;if(this._primaryIndex.get(a[this._primaryKey]))b=this._primaryIndex;else for(c in e)if(e.hasOwnProperty(c)&&(d=e[c],d.unique()&&d.violation(a))){b=d;break}return b?b.name():!1},o.prototype.ensureIndex=function(a,b){if(this.isDropped())throw this.logIdentifier()+" Cannot operate in a dropped state!";this._indexByName=this._indexByName||{},this._indexById=this._indexById||{};var c,e={start:(new Date).getTime()};if(b)if(b.type){if(!d.index[b.type])throw this.logIdentifier()+' Cannot create index of type "'+b.type+'", type not found in the index type register (Shared.index)';c=new d.index[b.type](a,b,this)}else c=new i(a,b,this);else c=new i(a,b,this);return this._indexByName[c.name()]?{err:"Index with that name already exists"}:(c.rebuild(),this._indexByName[c.name()]=c,this._indexById[c.id()]=c,e.end=(new Date).getTime(),e.total=e.end-e.start,this._lastOp={type:"ensureIndex",stats:{time:e}},{index:c,id:c.id(),name:c.name(),state:c.state()})},o.prototype.index=function(a){return this._indexByName?this._indexByName[a]:void 0},o.prototype.lastOp=function(){return this._metrics.list()},o.prototype.diff=function(a){var b,c,d,e,f={insert:[],update:[],remove:[]},g=this.primaryKey();if(g!==a.primaryKey())throw this.logIdentifier()+" Diffing requires that both collections have the same primary key!";for(b=a._data;b&&!(b instanceof Array);)a=b,b=a._data;for(e=b.length,c=0;e>c;c++)d=b[c],this._primaryIndex.get(d[g])?this._primaryCrc.get(d[g])!==a._primaryCrc.get(d[g])&&f.update.push(d):f.insert.push(d);for(b=this._data,e=b.length,c=0;e>c;c++)d=b[c],a._primaryIndex.get(d[g])||f.remove.push(d);return f},o.prototype.collateAdd=new l("Collection.prototype.collateAdd",{"object, string":function(a,b){var c=this;c.collateAdd(a,function(d){var e,f;switch(d.type){case"insert":b?(e={$push:{}},e.$push[b]=c.decouple(d.data.dataSet),c.update({},e)):c.insert(d.data.dataSet);break;case"update":b?(e={},f={},e[b]=d.data.query,f[b+".$"]=d.data.update,c.update(e,f)):c.update(d.data.query,d.data.update);break;case"remove":b?(e={$pull:{}},e.$pull[b]={},e.$pull[b][c.primaryKey()]=d.data.dataSet[0][a.primaryKey()],c.update({},e)):c.remove(d.data.dataSet)}})},"object, function":function(a,b){if("string"==typeof a&&(a=this._db.collection(a,{autoCreate:!1,throwError:!1})),a)return this._collate=this._collate||{},this._collate[a.name()]=new m(a,this,b),this;throw"Cannot collate from a non-existent collection!"}}),o.prototype.collateRemove=function(a){if("object"==typeof a&&(a=a.name()),a)return this._collate[a].drop(),delete this._collate[a],this;throw"No collection name passed to collateRemove() or collection not found!"},e.prototype.collection=new l("Db.prototype.collection",{"":function(){return this.$main.call(this,{name:this.objectId()})},object:function(a){return a instanceof o?"droppped"!==a.state()?a:this.$main.call(this,{name:a.name()}):this.$main.call(this,a)},string:function(a){return this.$main.call(this,{name:a})},"string, string":function(a,b){return this.$main.call(this,{name:a,primaryKey:b})},"string, object":function(a,b){return b.name=a,this.$main.call(this,b)},"string, string, object":function(a,b,c){return c.name=a,c.primaryKey=b,this.$main.call(this,c)},$main:function(a){var b=this,c=a.name;if(c){if(this._collection[c])return this._collection[c];if(a&&a.autoCreate===!1){if(a&&a.throwError!==!1)throw this.logIdentifier()+" Cannot get collection "+c+" because it does not exist and auto-create has been disabled!";return}if(this.debug()&&console.log(this.logIdentifier()+" Creating collection "+c),this._collection[c]=this._collection[c]||new o(c,a).db(this),this._collection[c].mongoEmulation(this.mongoEmulation()),void 0!==a.primaryKey&&this._collection[c].primaryKey(a.primaryKey),void 0!==a.capped){if(void 0===a.size)throw this.logIdentifier()+" Cannot create a capped collection without specifying a size!";this._collection[c].capped(a.capped),this._collection[c].cappedSize(a.size)}return b._collection[c].on("change",function(){b.emit("change",b._collection[c],"collection",c)}),b.emit("create",b._collection[c],"collection",c),this._collection[c]}if(!a||a&&a.throwError!==!1)throw this.logIdentifier()+" Cannot get collection with undefined name!"}}),e.prototype.collectionExists=function(a){return Boolean(this._collection[a])},e.prototype.collections=function(a){var b,c,d=[],e=this._collection;a&&(a instanceof RegExp||(a=new RegExp(a)));for(c in e)e.hasOwnProperty(c)&&(b=e[c],a?a.exec(c)&&d.push({name:c,count:b.count(),linked:void 0!==b.isLinked?b.isLinked():!1}):d.push({name:c,count:b.count(),linked:void 0!==b.isLinked?b.isLinked():!1}));return d.sort(function(a,b){return a.name.localeCompare(b.name)}),d},d.finishModule("Collection"),b.exports=o},{"./Index2d":10,"./IndexBinaryTree":11,"./IndexHashMap":12,"./KeyValueStore":13,"./Metrics":14,"./Overload":26,"./Path":27,"./ReactorIO":31,"./Shared":33}],6:[function(a,b,c){"use strict";var d,e,f,g;d=a("./Shared");var h=function(){this.init.apply(this,arguments)};h.prototype.init=function(a){var b=this;b._name=a,b._data=new g("__FDB__cg_data_"+b._name),b._collections=[],b._view=[]},d.addModule("CollectionGroup",h),d.mixin(h.prototype,"Mixin.Common"),d.mixin(h.prototype,"Mixin.ChainReactor"),d.mixin(h.prototype,"Mixin.Constants"),d.mixin(h.prototype,"Mixin.Triggers"),d.mixin(h.prototype,"Mixin.Tags"),d.mixin(h.prototype,"Mixin.Events"),g=a("./Collection"),e=d.modules.Db,f=d.modules.Db.prototype.init,h.prototype.on=function(){this._data.on.apply(this._data,arguments)},h.prototype.off=function(){this._data.off.apply(this._data,arguments)},h.prototype.emit=function(){this._data.emit.apply(this._data,arguments)},h.prototype.primaryKey=function(a){return void 0!==a?(this._primaryKey=a,this):this._primaryKey},d.synthesize(h.prototype,"state"),d.synthesize(h.prototype,"db"),d.synthesize(h.prototype,"name"),h.prototype.addCollection=function(a){if(a&&-1===this._collections.indexOf(a)){if(this._collections.length){if(this._primaryKey!==a.primaryKey())throw this.logIdentifier()+" All collections in a collection group must have the same primary key!"}else this.primaryKey(a.primaryKey());this._collections.push(a),a._groups=a._groups||[],a._groups.push(this),a.chain(this),a.on("drop",function(){if(a._groups&&a._groups.length){var b,c=[];for(b=0;b<a._groups.length;b++)c.push(a._groups[b]);for(b=0;b<c.length;b++)a._groups[b].removeCollection(a)}delete a._groups}),this._data.insert(a.find())}return this},h.prototype.removeCollection=function(a){if(a){var b,c=this._collections.indexOf(a);-1!==c&&(a.unChain(this),this._collections.splice(c,1),a._groups=a._groups||[],b=a._groups.indexOf(this),-1!==b&&a._groups.splice(b,1),a.off("drop")),0===this._collections.length&&delete this._primaryKey}return this},h.prototype._chainHandler=function(a){switch(a.type){case"setData":a.data.dataSet=this.decouple(a.data.dataSet),this._data.remove(a.data.oldData),this._data.insert(a.data.dataSet);break;case"insert":a.data.dataSet=this.decouple(a.data.dataSet),this._data.insert(a.data.dataSet);break;case"update":this._data.update(a.data.query,a.data.update,a.options);break;case"remove":this._data.remove(a.data.query,a.options)}},h.prototype.insert=function(){this._collectionsRun("insert",arguments)},h.prototype.update=function(){this._collectionsRun("update",arguments)},h.prototype.updateById=function(){this._collectionsRun("updateById",arguments)},h.prototype.remove=function(){this._collectionsRun("remove",arguments)},h.prototype._collectionsRun=function(a,b){for(var c=0;c<this._collections.length;c++)this._collections[c][a].apply(this._collections[c],b)},h.prototype.find=function(a,b){return this._data.find(a,b)},h.prototype.removeById=function(a){for(var b=0;b<this._collections.length;b++)this._collections[b].removeById(a)},h.prototype.subset=function(a,b){var c=this.find(a,b);return(new g).subsetOf(this).primaryKey(this._primaryKey).setData(c)},h.prototype.drop=function(a){if(!this.isDropped()){var b,c,d;if(this._debug&&console.log(this.logIdentifier()+" Dropping"),this._state="dropped",this._collections&&this._collections.length)for(c=[].concat(this._collections),b=0;b<c.length;b++)this.removeCollection(c[b]);if(this._view&&this._view.length)for(d=[].concat(this._view),b=0;b<d.length;b++)this._removeView(d[b]);this.emit("drop",this),delete this._listeners,a&&a(!1,!0)}return!0},e.prototype.init=function(){this._collectionGroup={},f.apply(this,arguments)},e.prototype.collectionGroup=function(a){var b=this;return a?a instanceof h?a:this._collectionGroup&&this._collectionGroup[a]?this._collectionGroup[a]:(this._collectionGroup[a]=new h(a).db(this),b.emit("create",b._collectionGroup[a],"collectionGroup",a),this._collectionGroup[a]):this._collectionGroup},e.prototype.collectionGroups=function(){var a,b=[];for(a in this._collectionGroup)this._collectionGroup.hasOwnProperty(a)&&b.push({name:a});return b},b.exports=h},{"./Collection":5,"./Shared":33}],7:[function(a,b,c){"use strict";var d,e,f,g,h=[];d=a("./Shared"),g=a("./Overload");var i=function(a){this.init.apply(this,arguments)};i.prototype.init=function(a){this._db={},this._debug={},this._name=a||"ForerunnerDB",h.push(this)},i.prototype.instantiatedCount=function(){return h.length},i.prototype.instances=function(a){return void 0!==a?h[a]:h},i.prototype.namedInstances=function(a){var b,c;{if(void 0===a){for(c=[],b=0;b<h.length;b++)c.push(h[b].name);return c}for(b=0;b<h.length;b++)if(h[b].name===a)return h[b]}},i.prototype.moduleLoaded=new g({string:function(a){if(void 0!==a){a=a.replace(/ /g,"");var b,c=a.split(",");for(b=0;b<c.length;b++)if(!d.modules[c[b]])return!1;return!0}return!1},"string, function":function(a,b){if(void 0!==a){a=a.replace(/ /g,"");var c,e=a.split(",");for(c=0;c<e.length;c++)if(!d.modules[e[c]])return!1;b&&b()}},"array, function":function(a,b){var c,e;for(e=0;e<a.length;e++)if(c=a[e],void 0!==c){c=c.replace(/ /g,"");var f,g=c.split(",");for(f=0;f<g.length;f++)if(!d.modules[g[f]])return!1}b&&b()},"string, function, function":function(a,b,c){if(void 0!==a){a=a.replace(/ /g,"");var e,f=a.split(",");for(e=0;e<f.length;e++)if(!d.modules[f[e]])return c(),!1;b()}}}),i.prototype.version=function(a,b){return void 0!==a?0===d.version.indexOf(a)?(b&&b(),!0):!1:d.version},i.moduleLoaded=i.prototype.moduleLoaded,i.version=i.prototype.version,i.instances=i.prototype.instances,i.instantiatedCount=i.prototype.instantiatedCount,i.shared=d,i.prototype.shared=d,d.addModule("Core",i),d.mixin(i.prototype,"Mixin.Common"),d.mixin(i.prototype,"Mixin.Constants"),e=a("./Db.js"),f=a("./Metrics.js"),d.synthesize(i.prototype,"name"),d.synthesize(i.prototype,"mongoEmulation"),i.prototype._isServer=!1,i.prototype.isClient=function(){return!this._isServer},i.prototype.isServer=function(){return this._isServer},i.prototype.collection=function(){throw"ForerunnerDB's instantiation has changed since version 1.3.36 to support multiple database instances. Please see the readme.md file for the minor change you have to make to get your project back up and running, or see the issue related to this change at https://github.com/Irrelon/ForerunnerDB/issues/44"},b.exports=i},{"./Db.js":8,"./Metrics.js":14,"./Overload":26,"./Shared":33}],8:[function(a,b,c){"use strict";var d,e,f,g,h,i;d=a("./Shared"),i=a("./Overload");var j=function(a,b){this.init.apply(this,arguments)};j.prototype.init=function(a,b){this.core(b),this._primaryKey="_id",this._name=a,this._collection={},this._debug={}},d.addModule("Db",j),j.prototype.moduleLoaded=new i({string:function(a){if(void 0!==a){a=a.replace(/ /g,"");var b,c=a.split(",");for(b=0;b<c.length;b++)if(!d.modules[c[b]])return!1;return!0}return!1},"string, function":function(a,b){if(void 0!==a){a=a.replace(/ /g,"");var c,e=a.split(",");for(c=0;c<e.length;c++)if(!d.modules[e[c]])return!1;b&&b()}},"string, function, function":function(a,b,c){if(void 0!==a){a=a.replace(/ /g,"");var e,f=a.split(",");for(e=0;e<f.length;e++)if(!d.modules[f[e]])return c(),!1;b()}}}),j.prototype.version=function(a,b){return void 0!==a?0===d.version.indexOf(a)?(b&&b(),!0):!1:d.version},j.moduleLoaded=j.prototype.moduleLoaded,j.version=j.prototype.version,j.shared=d,j.prototype.shared=d,d.addModule("Db",j),d.mixin(j.prototype,"Mixin.Common"),d.mixin(j.prototype,"Mixin.ChainReactor"),d.mixin(j.prototype,"Mixin.Constants"),d.mixin(j.prototype,"Mixin.Tags"),e=d.modules.Core,f=a("./Collection.js"),g=a("./Metrics.js"),h=a("./Checksum.js"),j.prototype._isServer=!1,d.synthesize(j.prototype,"core"),d.synthesize(j.prototype,"primaryKey"),d.synthesize(j.prototype,"state"),d.synthesize(j.prototype,"name"),d.synthesize(j.prototype,"mongoEmulation"),j.prototype.isClient=function(){return!this._isServer},j.prototype.isServer=function(){return this._isServer},j.prototype.Checksum=h,j.prototype.isClient=function(){return!this._isServer},j.prototype.isServer=function(){return this._isServer},j.prototype.arrayToCollection=function(a){return(new f).setData(a)},j.prototype.on=function(a,b){return this._listeners=this._listeners||{},this._listeners[a]=this._listeners[a]||[],this._listeners[a].push(b),this},j.prototype.off=function(a,b){if(a in this._listeners){var c=this._listeners[a],d=c.indexOf(b);d>-1&&c.splice(d,1)}return this},j.prototype.emit=function(a,b){if(this._listeners=this._listeners||{},a in this._listeners){var c,d=this._listeners[a],e=d.length;for(c=0;e>c;c++)d[c].apply(this,Array.prototype.slice.call(arguments,1))}return this},j.prototype.peek=function(a){var b,c,d=[],e=typeof a;for(b in this._collection)this._collection.hasOwnProperty(b)&&(c=this._collection[b],d="string"===e?d.concat(c.peek(a)):d.concat(c.find(a)));return d},j.prototype.peek=function(a){var b,c,d=[],e=typeof a;for(b in this._collection)this._collection.hasOwnProperty(b)&&(c=this._collection[b],d="string"===e?d.concat(c.peek(a)):d.concat(c.find(a)));return d},j.prototype.peekCat=function(a){var b,c,d,e={},f=typeof a;for(b in this._collection)this._collection.hasOwnProperty(b)&&(c=this._collection[b],"string"===f?(d=c.peek(a),d&&d.length&&(e[c.name()]=d)):(d=c.find(a),d&&d.length&&(e[c.name()]=d)));return e},j.prototype.drop=new i({"":function(){if(!this.isDropped()){var a,b=this.collections(),c=b.length;for(this._state="dropped",a=0;c>a;a++)this.collection(b[a].name).drop(),delete this._collection[b[a].name];this.emit("drop",this),delete this._listeners,delete this._core._db[this._name]}return!0},"function":function(a){if(!this.isDropped()){var b,c=this.collections(),d=c.length,e=0,f=function(){e++,e===d&&a&&a()};for(this._state="dropped",b=0;d>b;b++)this.collection(c[b].name).drop(f),delete this._collection[c[b].name];this.emit("drop",this),delete this._listeners,delete this._core._db[this._name]}return!0},"boolean":function(a){if(!this.isDropped()){var b,c=this.collections(),d=c.length;for(this._state="dropped",b=0;d>b;b++)this.collection(c[b].name).drop(a),delete this._collection[c[b].name];this.emit("drop",this),delete this._listeners,delete this._core._db[this._name]}return!0},"boolean, function":function(a,b){if(!this.isDropped()){var c,d=this.collections(),e=d.length,f=0,g=function(){f++,f===e&&b&&b()};for(this._state="dropped",c=0;e>c;c++)this.collection(d[c].name).drop(a,g),delete this._collection[d[c].name];this.emit("drop",this),delete this._listeners,delete this._core._db[this._name]}return!0}}),e.prototype.db=function(a){return a instanceof j?a:(a||(a=this.objectId()),this._db[a]=this._db[a]||new j(a,this),this._db[a].mongoEmulation(this.mongoEmulation()),this._db[a])},e.prototype.databases=function(a){var b,c,d,e=[];a&&(a instanceof RegExp||(a=new RegExp(a)));for(d in this._db)this._db.hasOwnProperty(d)&&(c=!0,a&&(a.exec(d)||(c=!1)),c&&(b={name:d,children:[]},this.shared.moduleExists("Collection")&&b.children.push({module:"collection",moduleName:"Collections",count:this._db[d].collections().length}),this.shared.moduleExists("CollectionGroup")&&b.children.push({module:"collectionGroup",moduleName:"Collection Groups",count:this._db[d].collectionGroups().length}),this.shared.moduleExists("Document")&&b.children.push({module:"document",moduleName:"Documents",count:this._db[d].documents().length}),this.shared.moduleExists("Grid")&&b.children.push({module:"grid",moduleName:"Grids",count:this._db[d].grids().length}),this.shared.moduleExists("Overview")&&b.children.push({module:"overview",moduleName:"Overviews",count:this._db[d].overviews().length}),this.shared.moduleExists("View")&&b.children.push({module:"view",moduleName:"Views",count:this._db[d].views().length}),e.push(b)));return e.sort(function(a,b){return a.name.localeCompare(b.name)}),e},d.finishModule("Db"),b.exports=j},{"./Checksum.js":4,"./Collection.js":5,"./Metrics.js":14,"./Overload":26,"./Shared":33}],9:[function(a,b,c){"use strict";var d,e,f,g;d=[16,8,4,2,1],e="0123456789bcdefghjkmnpqrstuvwxyz",f={right:{even:"bc01fg45238967deuvhjyznpkmstqrwx"},left:{even:"238967debc01fg45kmstqrwxuvhjyznp"},top:{even:"p0r21436x8zb9dcf5h7kjnmqesgutwvy"},bottom:{even:"14365h7k9dcfesgujnmqp0r2twvyx8zb"}},g={right:{even:"bcfguvyz"},left:{even:"0145hjnp"},top:{even:"prxz"},bottom:{even:"028b"}},f.bottom.odd=f.left.even,f.top.odd=f.right.even,f.left.odd=f.bottom.even,f.right.odd=f.top.even,g.bottom.odd=g.left.even,g.top.odd=g.right.even,g.left.odd=g.bottom.even,g.right.odd=g.top.even;var h=function(){};h.prototype.refineInterval=function(a,b,c){b&c?a[0]=(a[0]+a[1])/2:a[1]=(a[0]+a[1])/2},h.prototype.calculateNeighbours=function(a,b){var c;return b&&"object"!==b.type?(c=[],c[4]=a,c[3]=this.calculateAdjacent(a,"left"),c[5]=this.calculateAdjacent(a,"right"),c[1]=this.calculateAdjacent(a,"top"),c[7]=this.calculateAdjacent(a,"bottom"),c[0]=this.calculateAdjacent(c[3],"top"),c[2]=this.calculateAdjacent(c[5],"top"),c[6]=this.calculateAdjacent(c[3],"bottom"),c[8]=this.calculateAdjacent(c[5],"bottom")):(c={center:a,left:this.calculateAdjacent(a,"left"),right:this.calculateAdjacent(a,"right"),top:this.calculateAdjacent(a,"top"),bottom:this.calculateAdjacent(a,"bottom")},c.topLeft=this.calculateAdjacent(c.left,"top"),c.topRight=this.calculateAdjacent(c.right,"top"),c.bottomLeft=this.calculateAdjacent(c.left,"bottom"),c.bottomRight=this.calculateAdjacent(c.right,"bottom")),c},h.prototype.calculateAdjacent=function(a,b){a=a.toLowerCase();var c=a.charAt(a.length-1),d=a.length%2?"odd":"even",h=a.substring(0,a.length-1);return-1!==g[b][d].indexOf(c)&&(h=this.calculateAdjacent(h,b)),h+e[f[b][d].indexOf(c)]},h.prototype.decode=function(a){var b,c,f,g,h,i,j,k=1,l=[],m=[];for(l[0]=-90,l[1]=90,m[0]=-180,m[1]=180,i=90,j=180,b=0;b<a.length;b++)for(c=a[b],f=e.indexOf(c),g=0;5>g;g++)h=d[g],k?(j/=2,this.refineInterval(m,f,h)):(i/=2,this.refineInterval(l,f,h)),k=!k;return l[2]=(l[0]+l[1])/2,m[2]=(m[0]+m[1])/2,{latitude:l,longitude:m}},h.prototype.encode=function(a,b,c){var f,g=1,h=[],i=[],j=0,k=0,l="";for(c||(c=12),h[0]=-90,h[1]=90,i[0]=-180,i[1]=180;l.length<c;)g?(f=(i[0]+i[1])/2,b>f?(k|=d[j],i[0]=f):i[1]=f):(f=(h[0]+h[1])/2,a>f?(k|=d[j],h[0]=f):h[1]=f),g=!g,4>j?j++:(l+=e[k],j=0,k=0);return l},b.exports=h},{}],10:[function(a,b,c){"use strict";var d=a("./Shared"),e=a("./Path"),f=a("./BinaryTree"),g=a("./GeoHash"),h=new e,i=new g,j=[5e3,1250,156,39.1,4.89,1.22,.153,.0382,.00477,.00119,149e-6,372e-7],k=function(){this.init.apply(this,arguments)};k.prototype.init=function(a,b,c){this._btree=new f,this._btree.index(a),this._size=0,this._id=this._itemKeyHash(a,a),this._debug=b&&b.debug?b.debug:!1,this.unique(b&&b.unique?b.unique:!1),void 0!==a&&this.keys(a),void 0!==c&&(this.collection(c),this._btree.primaryKey(c.primaryKey())),this.name(b&&b.name?b.name:this._id),this._btree.debug(this._debug)},d.addModule("Index2d",k),d.mixin(k.prototype,"Mixin.Common"),d.mixin(k.prototype,"Mixin.ChainReactor"),d.mixin(k.prototype,"Mixin.Sorting"),k.prototype.id=function(){return this._id},k.prototype.state=function(){return this._state},k.prototype.size=function(){return this._size},d.synthesize(k.prototype,"data"),d.synthesize(k.prototype,"name"),d.synthesize(k.prototype,"collection"),d.synthesize(k.prototype,"type"),d.synthesize(k.prototype,"unique"),k.prototype.keys=function(a){return void 0!==a?(this._keys=a,this._keyCount=h.parse(this._keys).length,this):this._keys},k.prototype.rebuild=function(){if(this._collection){var a,b=this._collection.subset({},{$decouple:!1,$orderBy:this._keys}),c=b.find(),d=c.length;for(this._btree.clear(),this._size=0,this._unique&&(this._uniqueLookup={}),a=0;d>a;a++)this.insert(c[a])}this._state={name:this._name,keys:this._keys,indexSize:this._size,built:new Date,updated:new Date,ok:!0}},k.prototype.insert=function(a,b){var c,d=this._unique;a=this.decouple(a),d&&(c=this._itemHash(a,this._keys),this._uniqueLookup[c]=a);var e,f,g,j,k,l=this._btree.keys();for(k=0;k<l.length;k++)e=h.get(a,l[k].path),e instanceof Array&&(g=e[0],j=e[1],f=i.encode(g,j),h.set(a,l[k].path,f));return this._btree.insert(a)?(this._size++,!0):!1},k.prototype.remove=function(a,b){var c,d=this._unique;return d&&(c=this._itemHash(a,this._keys),delete this._uniqueLookup[c]),this._btree.remove(a)?(this._size--,!0):!1},k.prototype.violation=function(a){var b=this._itemHash(a,this._keys);return Boolean(this._uniqueLookup[b])},k.prototype.hashViolation=function(a){return Boolean(this._uniqueLookup[a])},k.prototype.lookup=function(a,b){var c,d,e,f,g=this._btree.keys();for(f=0;f<g.length;f++)if(c=g[f].path,d=h.get(a,c),"object"==typeof d)return d.$near&&(e=[],e=e.concat(this.near(c,d.$near,b))),d.$geoWithin&&(e=[],e=e.concat(this.geoWithin(c,d.$geoWithin,b))),e;return this._btree.lookup(a,b)},k.prototype.near=function(a,b,c){var d,e,f,g,k,l,m,n,o,p,q,r=this,s=[],t=this._collection.primaryKey();if("km"===b.$distanceUnits){for(m=b.$maxDistance,q=0;q<j.length;q++)if(m>j[q]){l=q;break}0===l&&(l=1)}else if("miles"===b.$distanceUnits){for(m=1.60934*b.$maxDistance,q=0;q<j.length;q++)if(m>j[q]){l=q;break}0===l&&(l=1)}for(d=i.encode(b.$point[0],b.$point[1],l),e=i.calculateNeighbours(d,{type:"array"}),k=[],f=0,q=0;9>q;q++)g=this._btree.startsWith(a,e[q]),f+=g._visited,k=k.concat(g);if(k=this._collection._primaryIndex.lookup(k),k.length){for(n={},q=0;q<k.length;q++)p=h.get(k[q],a),o=n[k[q][t]]=this.distanceBetweenPoints(b.$point[0],b.$point[1],p[0],p[1]),m>=o&&s.push(k[q]);s.sort(function(a,b){return r.sortAsc(n[a[t]],n[b[t]])})}return s},k.prototype.geoWithin=function(a,b,c){return[]},k.prototype.distanceBetweenPoints=function(a,b,c,d){var e=6371,f=this.toRadians(a),g=this.toRadians(c),h=this.toRadians(c-a),i=this.toRadians(d-b),j=Math.sin(h/2)*Math.sin(h/2)+Math.cos(f)*Math.cos(g)*Math.sin(i/2)*Math.sin(i/2),k=2*Math.atan2(Math.sqrt(j),Math.sqrt(1-j));return e*k},k.prototype.toRadians=function(a){return.01747722222222*a},k.prototype.match=function(a,b){return this._btree.match(a,b)},k.prototype._itemHash=function(a,b){var c,d,f=new e,g="";for(c=f.parse(b),d=0;d<c.length;d++)g&&(g+="_"),g+=f.value(a,c[d].path).join(":");return g},k.prototype._itemKeyHash=function(a,b){var c,d,f=new e,g="";for(c=f.parse(b),d=0;d<c.length;d++)g&&(g+="_"),g+=f.keyValue(a,c[d].path);return g},k.prototype._itemHashArr=function(a,b){var c,d,f,g,h,i=new e,j=[];for(c=i.parse(b),g=0;g<c.length;g++)for(d=i.value(a,c[g].path),f=0;f<d.length;f++)if(0===g)j.push(d[f]);else for(h=0;h<j.length;h++)j[h]=j[h]+"_"+d[f];return j},d.index["2d"]=k,d.finishModule("Index2d"),b.exports=k},{"./BinaryTree":3,"./GeoHash":9,"./Path":27,"./Shared":33}],11:[function(a,b,c){"use strict";var d=a("./Shared"),e=a("./Path"),f=a("./BinaryTree"),g=function(){this.init.apply(this,arguments)};g.prototype.init=function(a,b,c){this._btree=new f,this._btree.index(a),this._size=0,this._id=this._itemKeyHash(a,a),this._debug=b&&b.debug?b.debug:!1,this.unique(b&&b.unique?b.unique:!1),void 0!==a&&this.keys(a),void 0!==c&&(this.collection(c),this._btree.primaryKey(c.primaryKey())),this.name(b&&b.name?b.name:this._id),this._btree.debug(this._debug)},d.addModule("IndexBinaryTree",g),d.mixin(g.prototype,"Mixin.ChainReactor"),d.mixin(g.prototype,"Mixin.Sorting"),g.prototype.id=function(){return this._id},g.prototype.state=function(){return this._state},g.prototype.size=function(){return this._size},d.synthesize(g.prototype,"data"),d.synthesize(g.prototype,"name"),d.synthesize(g.prototype,"collection"),d.synthesize(g.prototype,"type"),d.synthesize(g.prototype,"unique"),g.prototype.keys=function(a){return void 0!==a?(this._keys=a,this._keyCount=(new e).parse(this._keys).length,this):this._keys},g.prototype.rebuild=function(){if(this._collection){var a,b=this._collection.subset({},{$decouple:!1,$orderBy:this._keys}),c=b.find(),d=c.length;for(this._btree.clear(),this._size=0,this._unique&&(this._uniqueLookup={}),a=0;d>a;a++)this.insert(c[a])}this._state={name:this._name,keys:this._keys,indexSize:this._size,built:new Date,updated:new Date,ok:!0}},g.prototype.insert=function(a,b){var c,d=this._unique;return d&&(c=this._itemHash(a,this._keys),this._uniqueLookup[c]=a),this._btree.insert(a)?(this._size++,!0):!1},g.prototype.remove=function(a,b){var c,d=this._unique;return d&&(c=this._itemHash(a,this._keys),delete this._uniqueLookup[c]),this._btree.remove(a)?(this._size--,!0):!1},g.prototype.violation=function(a){var b=this._itemHash(a,this._keys);return Boolean(this._uniqueLookup[b])},g.prototype.hashViolation=function(a){return Boolean(this._uniqueLookup[a])},g.prototype.lookup=function(a,b){return this._btree.lookup(a,b)},g.prototype.match=function(a,b){return this._btree.match(a,b)},g.prototype._itemHash=function(a,b){var c,d,f=new e,g="";for(c=f.parse(b),d=0;d<c.length;d++)g&&(g+="_"),g+=f.value(a,c[d].path).join(":");return g},g.prototype._itemKeyHash=function(a,b){var c,d,f=new e,g="";for(c=f.parse(b),d=0;d<c.length;d++)g&&(g+="_"),g+=f.keyValue(a,c[d].path);return g},g.prototype._itemHashArr=function(a,b){var c,d,f,g,h,i=new e,j=[];for(c=i.parse(b),g=0;g<c.length;g++)for(d=i.value(a,c[g].path),f=0;f<d.length;f++)if(0===g)j.push(d[f]);else for(h=0;h<j.length;h++)j[h]=j[h]+"_"+d[f];return j},d.index.btree=g,d.finishModule("IndexBinaryTree"),b.exports=g},{"./BinaryTree":3,"./Path":27,"./Shared":33}],12:[function(a,b,c){"use strict";var d=a("./Shared"),e=a("./Path"),f=function(){this.init.apply(this,arguments)};f.prototype.init=function(a,b,c){this._crossRef={},this._size=0,this._id=this._itemKeyHash(a,a),this.data({}),this.unique(b&&b.unique?b.unique:!1),void 0!==a&&this.keys(a),void 0!==c&&this.collection(c),this.name(b&&b.name?b.name:this._id)},d.addModule("IndexHashMap",f),d.mixin(f.prototype,"Mixin.ChainReactor"),f.prototype.id=function(){return this._id},f.prototype.state=function(){return this._state},f.prototype.size=function(){return this._size},d.synthesize(f.prototype,"data"),d.synthesize(f.prototype,"name"),d.synthesize(f.prototype,"collection"),d.synthesize(f.prototype,"type"),d.synthesize(f.prototype,"unique"),f.prototype.keys=function(a){return void 0!==a?(this._keys=a,this._keyCount=(new e).parse(this._keys).length,this):this._keys},f.prototype.rebuild=function(){if(this._collection){var a,b=this._collection.subset({},{$decouple:!1,$orderBy:this._keys}),c=b.find(),d=c.length;for(this._data={},this._size=0,this._unique&&(this._uniqueLookup={}),a=0;d>a;a++)this.insert(c[a])}this._state={name:this._name,keys:this._keys,indexSize:this._size,built:new Date,updated:new Date,ok:!0}},f.prototype.insert=function(a,b){var c,d,e,f=this._unique;for(f&&(c=this._itemHash(a,this._keys),this._uniqueLookup[c]=a),d=this._itemHashArr(a,this._keys),e=0;e<d.length;e++)this.pushToPathValue(d[e],a)},f.prototype.update=function(a,b){},f.prototype.remove=function(a,b){var c,d,e,f=this._unique;for(f&&(c=this._itemHash(a,this._keys),delete this._uniqueLookup[c]),d=this._itemHashArr(a,this._keys),e=0;e<d.length;e++)this.pullFromPathValue(d[e],a)},f.prototype.violation=function(a){var b=this._itemHash(a,this._keys);return Boolean(this._uniqueLookup[b])},f.prototype.hashViolation=function(a){return Boolean(this._uniqueLookup[a])},f.prototype.pushToPathValue=function(a,b){var c=this._data[a]=this._data[a]||[];-1===c.indexOf(b)&&(c.push(b),this._size++,this.pushToCrossRef(b,c))},f.prototype.pullFromPathValue=function(a,b){var c,d=this._data[a];c=d.indexOf(b),c>-1&&(d.splice(c,1),this._size--,this.pullFromCrossRef(b,d)),d.length||delete this._data[a]},f.prototype.pull=function(a){var b,c,d=a[this._collection.primaryKey()],e=this._crossRef[d],f=e.length;for(b=0;f>b;b++)c=e[b],this._pullFromArray(c,a);this._size--,delete this._crossRef[d]},f.prototype._pullFromArray=function(a,b){for(var c=a.length;c--;)a[c]===b&&a.splice(c,1)},f.prototype.pushToCrossRef=function(a,b){var c,d=a[this._collection.primaryKey()];this._crossRef[d]=this._crossRef[d]||[],c=this._crossRef[d],-1===c.indexOf(b)&&c.push(b)},f.prototype.pullFromCrossRef=function(a,b){var c=a[this._collection.primaryKey()];delete this._crossRef[c]},f.prototype.lookup=function(a){return this._data[this._itemHash(a,this._keys)]||[]},f.prototype.match=function(a,b){var c,d=new e,f=d.parseArr(this._keys),g=d.parseArr(a),h=[],i=0;for(c=0;c<f.length;c++){if(g[c]!==f[c])return{matchedKeys:[],totalKeyCount:g.length,score:0};i++,h.push(g[c])}return{matchedKeys:h,totalKeyCount:g.length,score:i}},f.prototype._itemHash=function(a,b){var c,d,f=new e,g="";for(c=f.parse(b),d=0;d<c.length;d++)g&&(g+="_"),g+=f.value(a,c[d].path).join(":");return g},f.prototype._itemKeyHash=function(a,b){var c,d,f=new e,g="";for(c=f.parse(b),d=0;d<c.length;d++)g&&(g+="_"),g+=f.keyValue(a,c[d].path);return g},f.prototype._itemHashArr=function(a,b){var c,d,f,g,h,i=new e,j=[];for(c=i.parse(b),g=0;g<c.length;g++)for(d=i.value(a,c[g].path),f=0;f<d.length;f++)if(0===g)j.push(d[f]);else for(h=0;h<j.length;h++)j[h]=j[h]+"_"+d[f];return j},d.index.hashed=f,d.finishModule("IndexHashMap"),b.exports=f},{"./Path":27,"./Shared":33}],13:[function(a,b,c){"use strict";var d=a("./Shared"),e=function(a){this.init.apply(this,arguments)};e.prototype.init=function(a){this._name=a,this._data={},this._primaryKey="_id"},d.addModule("KeyValueStore",e),d.mixin(e.prototype,"Mixin.ChainReactor"),
d.synthesize(e.prototype,"name"),e.prototype.primaryKey=function(a){return void 0!==a?(this._primaryKey=a,this):this._primaryKey},e.prototype.truncate=function(){return this._data={},this},e.prototype.set=function(a,b){return this._data[a]=b?b:!0,this},e.prototype.get=function(a){return this._data[a]},e.prototype.lookup=function(a){var b,c,d,e=this._primaryKey,f=typeof a,g=[];if("string"===f||"number"===f)return d=this.get(a),void 0!==d?[d]:[];if("object"===f){if(a instanceof Array){for(c=a.length,g=[],b=0;c>b;b++)d=this.lookup(a[b]),d&&(d instanceof Array?g=g.concat(d):g.push(d));return g}if(a[e])return this.lookup(a[e])}},e.prototype.unSet=function(a){return delete this._data[a],this},e.prototype.uniqueSet=function(a,b){return void 0===this._data[a]?(this._data[a]=b,!0):!1},d.finishModule("KeyValueStore"),b.exports=e},{"./Shared":33}],14:[function(a,b,c){"use strict";var d=a("./Shared"),e=a("./Operation"),f=function(){this.init.apply(this,arguments)};f.prototype.init=function(){this._data=[]},d.addModule("Metrics",f),d.mixin(f.prototype,"Mixin.ChainReactor"),f.prototype.create=function(a){var b=new e(a);return this._enabled&&this._data.push(b),b},f.prototype.start=function(){return this._enabled=!0,this},f.prototype.stop=function(){return this._enabled=!1,this},f.prototype.clear=function(){return this._data=[],this},f.prototype.list=function(){return this._data},d.finishModule("Metrics"),b.exports=f},{"./Operation":25,"./Shared":33}],15:[function(a,b,c){"use strict";var d={preSetData:function(){},postSetData:function(){}};b.exports=d},{}],16:[function(a,b,c){"use strict";var d={chain:function(a){this.debug&&this.debug()&&(a._reactorIn&&a._reactorOut?console.log(a._reactorIn.logIdentifier()+' Adding target "'+a._reactorOut.instanceIdentifier()+'" to the chain reactor target list'):console.log(this.logIdentifier()+' Adding target "'+a.instanceIdentifier()+'" to the chain reactor target list')),this._chain=this._chain||[];var b=this._chain.indexOf(a);-1===b&&this._chain.push(a)},unChain:function(a){if(this.debug&&this.debug()&&(a._reactorIn&&a._reactorOut?console.log(a._reactorIn.logIdentifier()+' Removing target "'+a._reactorOut.instanceIdentifier()+'" from the chain reactor target list'):console.log(this.logIdentifier()+' Removing target "'+a.instanceIdentifier()+'" from the chain reactor target list')),this._chain){var b=this._chain.indexOf(a);b>-1&&this._chain.splice(b,1)}},chainWillSend:function(){return Boolean(this._chain)},chainSend:function(a,b,c){if(this._chain){var d,e,f=this._chain,g=f.length,h=this.decouple(b,g);for(e=0;g>e;e++){if(d=f[e],d._state&&(!d._state||d.isDropped()))throw console.log("Reactor Data:",a,b,c),console.log("Reactor Node:",d),"Chain reactor attempting to send data to target reactor node that is in a dropped state!";this.debug&&this.debug()&&(d._reactorIn&&d._reactorOut?console.log(d._reactorIn.logIdentifier()+' Sending data down the chain reactor pipe to "'+d._reactorOut.instanceIdentifier()+'"'):console.log(this.logIdentifier()+' Sending data down the chain reactor pipe to "'+d.instanceIdentifier()+'"')),d.chainReceive&&d.chainReceive(this,a,h[e],c)}}},chainReceive:function(a,b,c,d){var e={sender:a,type:b,data:c,options:d},f=!1;this.debug&&this.debug()&&console.log(this.logIdentifier()+" Received data from parent reactor node"),this._chainHandler&&(f=this._chainHandler(e)),f||this.chainSend(e.type,e.data,e.options)}};b.exports=d},{}],17:[function(a,b,c){"use strict";var d,e=0,f=a("./Overload"),g=a("./Serialiser"),h=new g;d={serialiser:h,make:function(a){return h.convert(a)},store:function(a,b){if(void 0!==a){if(void 0!==b)return this._store=this._store||{},this._store[a]=b,this;if(this._store)return this._store[a]}},unStore:function(a){return void 0!==a&&delete this._store[a],this},decouple:function(a,b){if(void 0!==a&&""!==a){if(b){var c,d=this.jStringify(a),e=[];for(c=0;b>c;c++)e.push(this.jParse(d));return e}return this.jParse(this.jStringify(a))}},jParse:function(a){return JSON.parse(a,h.reviver())},jStringify:function(a){return JSON.stringify(a)},objectId:function(a){var b,c=Math.pow(10,17);if(a){var d,f=0,g=a.length;for(d=0;g>d;d++)f+=a.charCodeAt(d)*c;b=f.toString(16)}else e++,b=(e+(Math.random()*c+Math.random()*c+Math.random()*c+Math.random()*c)).toString(16);return b},hash:function(a){return JSON.stringify(a)},debug:new f([function(){return this._debug&&this._debug.all},function(a){return void 0!==a?"boolean"==typeof a?(this._debug=this._debug||{},this._debug.all=a,this.chainSend("debug",this._debug),this):this._debug&&this._debug[a]||this._db&&this._db._debug&&this._db._debug[a]||this._debug&&this._debug.all:this._debug&&this._debug.all},function(a,b){return void 0!==a?void 0!==b?(this._debug=this._debug||{},this._debug[a]=b,this.chainSend("debug",this._debug),this):this._debug&&this._debug[b]||this._db&&this._db._debug&&this._db._debug[a]:this._debug&&this._debug.all}]),classIdentifier:function(){return"ForerunnerDB."+this.className},instanceIdentifier:function(){return"["+this.className+"]"+this.name()},logIdentifier:function(){return"ForerunnerDB "+this.instanceIdentifier()},convertToFdb:function(a){var b,c,d,e;for(e in a)if(a.hasOwnProperty(e)&&(d=a,e.indexOf(".")>-1)){for(e=e.replace(".$","[|$|]"),c=e.split(".");b=c.shift();)b=b.replace("[|$|]",".$"),c.length?d[b]={}:d[b]=a[e],d=d[b];delete a[e]}},isDropped:function(){return"dropped"===this._state},debounce:function(a,b,c){var d,e=this;e._debounce=e._debounce||{},e._debounce[a]&&clearTimeout(e._debounce[a].timeout),d={callback:b,timeout:setTimeout(function(){delete e._debounce[a],b()},c)},e._debounce[a]=d}},b.exports=d},{"./Overload":26,"./Serialiser":32}],18:[function(a,b,c){"use strict";var d={TYPE_INSERT:0,TYPE_UPDATE:1,TYPE_REMOVE:2,PHASE_BEFORE:0,PHASE_AFTER:1};b.exports=d},{}],19:[function(a,b,c){"use strict";var d=a("./Overload"),e={on:new d({"string, function":function(a,b){return this._listeners=this._listeners||{},this._listeners[a]=this._listeners[a]||{},this._listeners[a]["*"]=this._listeners[a]["*"]||[],this._listeners[a]["*"].push(b),this},"string, *, function":function(a,b,c){return this._listeners=this._listeners||{},this._listeners[a]=this._listeners[a]||{},this._listeners[a][b]=this._listeners[a][b]||[],this._listeners[a][b].push(c),this}}),once:new d({"string, function":function(a,b){var c=this,d=function(){c.off(a,d),b.apply(c,arguments)};return this.on(a,d)},"string, *, function":function(a,b,c){var d=this,e=function(){d.off(a,b,e),c.apply(d,arguments)};return this.on(a,b,e)}}),off:new d({string:function(a){return this._listeners&&this._listeners[a]&&a in this._listeners&&delete this._listeners[a],this},"string, function":function(a,b){var c,d;return"string"==typeof b?this._listeners&&this._listeners[a]&&this._listeners[a][b]&&delete this._listeners[a][b]:this._listeners&&a in this._listeners&&(c=this._listeners[a]["*"],d=c.indexOf(b),d>-1&&c.splice(d,1)),this},"string, *, function":function(a,b,c){if(this._listeners&&a in this._listeners&&b in this.listeners[a]){var d=this._listeners[a][b],e=d.indexOf(c);e>-1&&d.splice(e,1)}},"string, *":function(a,b){this._listeners&&a in this._listeners&&b in this._listeners[a]&&delete this._listeners[a][b]}}),emit:function(a,b){if(this._listeners=this._listeners||{},a in this._listeners){var c,d,e,f,g,h,i;if(this._listeners[a]["*"])for(f=this._listeners[a]["*"],d=f.length,c=0;d>c;c++)e=f[c],"function"==typeof e&&e.apply(this,Array.prototype.slice.call(arguments,1));if(b instanceof Array&&b[0]&&b[0][this._primaryKey])for(g=this._listeners[a],d=b.length,c=0;d>c;c++)if(g[b[c][this._primaryKey]])for(h=g[b[c][this._primaryKey]].length,i=0;h>i;i++)e=g[b[c][this._primaryKey]][i],"function"==typeof e&&g[b[c][this._primaryKey]][i].apply(this,Array.prototype.slice.call(arguments,1))}return this},deferEmit:function(a,b){var c,d=this;return this._noEmitDefer||this._db&&(!this._db||this._db._noEmitDefer)?this.emit.apply(this,arguments):(c=arguments,this._deferTimeout=this._deferTimeout||{},this._deferTimeout[a]&&clearTimeout(this._deferTimeout[a]),this._deferTimeout[a]=setTimeout(function(){d.debug()&&console.log(d.logIdentifier()+" Emitting "+c[0]),d.emit.apply(d,c)},1)),this}};b.exports=e},{"./Overload":26}],20:[function(a,b,c){"use strict";var d={_match:function(a,b,c,d,e){var f,g,h,i,j,k,l=d,m=typeof a,n=typeof b,o=!0;if("object"===m&&null===a&&(m="null"),"object"===n&&null===b&&(n="null"),e=e||{},c=c||{},e.$rootQuery||(e.$rootQuery=b),e.$rootSource||(e.$rootSource=a),e.$currentQuery=b,e.$rootData=e.$rootData||{},"string"!==m&&"number"!==m&&"null"!==m||"string"!==n&&"number"!==n&&"null"!==n){if(("string"===m||"number"===m)&&"object"===n&&b instanceof RegExp)b.test(a)||(o=!1);else for(k in b)if(b.hasOwnProperty(k)){if(e.$previousQuery=e.$parent,e.$parent={query:b[k],key:k,parent:e.$previousQuery},f=!1,j=k.substr(0,2),"//"===j)continue;if(0===j.indexOf("$")&&(i=this._matchOp(k,a,b[k],c,e),i>-1)){if(i){if("or"===d)return!0}else o=i;f=!0}if(!f&&b[k]instanceof RegExp)if(f=!0,"object"===m&&void 0!==a[k]&&b[k].test(a[k])){if("or"===d)return!0}else o=!1;if(!f)if("object"==typeof b[k])if(void 0!==a[k])if(a[k]instanceof Array&&!(b[k]instanceof Array)){for(g=!1,h=0;h<a[k].length&&!(g=this._match(a[k][h],b[k],c,l,e));h++);if(g){if("or"===d)return!0}else o=!1}else if(!(a[k]instanceof Array)&&b[k]instanceof Array){for(g=!1,h=0;h<b[k].length&&!(g=this._match(a[k],b[k][h],c,l,e));h++);if(g){if("or"===d)return!0}else o=!1}else if("object"==typeof a)if(g=this._match(a[k],b[k],c,l,e)){if("or"===d)return!0}else o=!1;else if(g=this._match(void 0,b[k],c,l,e)){if("or"===d)return!0}else o=!1;else if(b[k]&&void 0!==b[k].$exists)if(g=this._match(void 0,b[k],c,l,e)){if("or"===d)return!0}else o=!1;else o=!1;else if(a&&a[k]===b[k]){if("or"===d)return!0}else if(a&&a[k]&&a[k]instanceof Array&&b[k]&&"object"!=typeof b[k]){for(g=!1,h=0;h<a[k].length&&!(g=this._match(a[k][h],b[k],c,l,e));h++);if(g){if("or"===d)return!0}else o=!1}else o=!1;if("and"===d&&!o)return!1}}else"number"===m||"null"===m||"null"===n?a!==b&&(o=!1):a.localeCompare(b)&&(o=!1);return o},_matchOp:function(a,b,c,d,e){switch(a){case"$gt":return b>c;case"$gte":return b>=c;case"$lt":return c>b;case"$lte":return c>=b;case"$exists":return void 0===b!==c;case"$eq":return b==c;case"$eeq":return b===c;case"$ne":return b!=c;case"$nee":return b!==c;case"$or":for(var f=0;f<c.length;f++)if(this._match(b,c[f],d,"and",e))return!0;return!1;case"$and":for(var g=0;g<c.length;g++)if(!this._match(b,c[g],d,"and",e))return!1;return!0;case"$in":if(c instanceof Array){var h,i=c,j=i.length;for(h=0;j>h;h++)if(this._match(b,i[h],d,"and",e))return!0;return!1}return"object"==typeof c?this._match(b,c,d,"and",e):(console.log(this.logIdentifier()+" Cannot use an $in operator on a non-array key: "+a,e.$rootQuery),!1);case"$nin":if(c instanceof Array){var k,l=c,m=l.length;for(k=0;m>k;k++)if(this._match(b,l[k],d,"and",e))return!1;return!0}return"object"==typeof c?this._match(b,c,d,"and",e):(console.log(this.logIdentifier()+" Cannot use a $nin operator on a non-array key: "+a,e.$rootQuery),!1);case"$distinct":e.$rootData["//distinctLookup"]=e.$rootData["//distinctLookup"]||{};for(var n in c)if(c.hasOwnProperty(n))return e.$rootData["//distinctLookup"][n]=e.$rootData["//distinctLookup"][n]||{},e.$rootData["//distinctLookup"][n][b[n]]?!1:(e.$rootData["//distinctLookup"][n][b[n]]=!0,!0);break;case"$count":var o,p,q;for(o in c)if(c.hasOwnProperty(o)&&(p=b[o],q="object"==typeof p&&p instanceof Array?p.length:0,!this._match(q,c[o],d,"and",e)))return!1;return!0;case"$find":case"$findOne":case"$findSub":var r,s,t,u,v,w,x="collection",y={};if(!c.$from)throw a+" missing $from property!";if(c.$fromType&&(x=c.$fromType,!this.db()[x]||"function"!=typeof this.db()[x]))throw a+' cannot operate against $fromType "'+x+'" because the database does not recognise this type of object!';if(r=c.$query||{},s=c.$options||{},"$findSub"===a){if(!c.$path)throw a+" missing $path property!";if(v=c.$path,t=c.$subQuery||{},u=c.$subOptions||{},!(e.$parent&&e.$parent.parent&&e.$parent.parent.key))return this._match(b,r,{},"and",e)&&(w=this._findSub([b],v,t,u)),w&&w.length>0;w=this.db()[x](c.$from).findSub(r,v,t,u)}else w=this.db()[x](c.$from)[a.substr(1)](r,s);return y[e.$parent.parent.key]=w,this._match(b,y,d,"and",e)}return-1},applyJoin:function(a,b,c,d){var e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x=this,y=[];for(a instanceof Array||(a=[a]),e=0;e<b.length;e++)for(f in b[e])if(b[e].hasOwnProperty(f))for(g=b[e][f],h=g.$sourceType||"collection",i="$"+h+"."+f,j=f,c[i]?k=c[i]:this._db[h]&&"function"==typeof this._db[h]&&(k=this._db[h](f)),l=0;l<a.length;l++){m={},n=!1,o=!1,p="";for(q in g)if(g.hasOwnProperty(q))if(r=g[q],"$"===q.substr(0,1))switch(q){case"$where":if(!r.$query&&!r.$options)throw'$join $where clause requires "$query" and / or "$options" keys to work!';r.$query&&(m=x.resolveDynamicQuery(r.$query,a[l])),r.$options&&(s=r.$options);break;case"$as":j=r;break;case"$multi":n=r;break;case"$require":o=r;break;case"$prefix":p=r}else m[q]=x.resolveDynamicQuery(r,a[l]);if(t=k.find(m,s),!o||o&&t[0])if("$root"===j){if(n!==!1)throw this.logIdentifier()+' Cannot combine [$as: "$root"] with [$multi: true] in $join clause!';u=t[0],v=a[l];for(w in u)u.hasOwnProperty(w)&&void 0===v[p+w]&&(v[p+w]=u[w])}else a[l][j]=n===!1?t[0]:t;else y.push(l)}return y},resolveDynamicQuery:function(a,b){var c,d,e,f,g,h=this;if("string"==typeof a)return f="$$."===a.substr(0,3)?this.sharedPathSolver.value(b,a.substr(3,a.length-3)):this.sharedPathSolver.value(b,a),f.length>1?{$in:f}:f[0];c={};for(g in a)if(a.hasOwnProperty(g))switch(d=typeof a[g],e=a[g],d){case"string":"$$."===e.substr(0,3)?c[g]=this.sharedPathSolver.value(b,e.substr(3,e.length-3))[0]:c[g]=e;break;case"object":c[g]=h.resolveDynamicQuery(e,b);break;default:c[g]=e}return c},spliceArrayByIndexList:function(a,b){var c;for(c=b.length-1;c>=0;c--)a.splice(b[c],1)}};b.exports=d},{}],21:[function(a,b,c){"use strict";var d={sortAsc:function(a,b){return"string"==typeof a&&"string"==typeof b?a.localeCompare(b):a>b?1:b>a?-1:0},sortDesc:function(a,b){return"string"==typeof a&&"string"==typeof b?b.localeCompare(a):a>b?-1:b>a?1:0}};b.exports=d},{}],22:[function(a,b,c){"use strict";var d,e={};d={tagAdd:function(a){var b,c=this,d=e[a]=e[a]||[];for(b=0;b<d.length;b++)if(d[b]===c)return!0;return d.push(c),c.on&&c.on("drop",function(){c.tagRemove(a)}),!0},tagRemove:function(a){var b,c=e[a];if(c)for(b=0;b<c.length;b++)if(c[b]===this)return c.splice(b,1),!0;return!1},tagLookup:function(a){return e[a]||[]},tagDrop:function(a,b){var c,d,e,f=this.tagLookup(a);if(c=function(){d--,b&&0===d&&b(!1)},f.length)for(d=f.length,e=f.length-1;e>=0;e--)f[e].drop(c);return!0}},b.exports=d},{}],23:[function(a,b,c){"use strict";var d=a("./Overload"),e={addTrigger:function(a,b,c,d){var e,f=this;return e=f._triggerIndexOf(a,b,c),-1===e?(f.triggerStack={},f._trigger=f._trigger||{},f._trigger[b]=f._trigger[b]||{},f._trigger[b][c]=f._trigger[b][c]||[],f._trigger[b][c].push({id:a,method:d,enabled:!0}),!0):!1},removeTrigger:function(a,b,c){var d,e=this;return d=e._triggerIndexOf(a,b,c),d>-1&&e._trigger[b][c].splice(d,1),!1},ignoreTriggers:function(a){return void 0!==a?(this._ignoreTriggers=a,this):this._ignoreTriggers},addLinkIO:function(a,b){var c,d,e,f,g,h,i,j,k,l=this;if(l._linkIO=l._linkIO||{},l._linkIO[a]=b,d=b["export"],e=b["import"],d&&(h=l.db().collection(d.to)),e&&(i=l.db().collection(e.from)),j=[l.TYPE_INSERT,l.TYPE_UPDATE,l.TYPE_REMOVE],c=function(a,b){b(!1,!0)},d&&(d.match||(d.match=c),d.types||(d.types=j),f=function(a,b,c){d.match(c,function(b,e){!b&&e&&d.data(c,a.type,function(b,c,d){!b&&c&&(h.ignoreTriggers(!0),"remove"!==a.type?h.upsert(c,d):h.remove(c,d),h.ignoreTriggers(!1))})})}),e&&(e.match||(e.match=c),e.types||(e.types=j),g=function(a,b,c){e.match(c,function(b,d){!b&&d&&e.data(c,a.type,function(b,c,d){!b&&c&&(h.ignoreTriggers(!0),"remove"!==a.type?l.upsert(c,d):l.remove(c,d),h.ignoreTriggers(!1))})})}),d)for(k=0;k<d.types.length;k++)l.addTrigger(a+"export"+d.types[k],d.types[k],l.PHASE_AFTER,f);if(e)for(k=0;k<e.types.length;k++)i.addTrigger(a+"import"+e.types[k],e.types[k],l.PHASE_AFTER,g)},removeLinkIO:function(a){var b,c,d,e,f=this,g=f._linkIO[a];if(g){if(b=g["export"],c=g["import"],b)for(e=0;e<b.types.length;e++)f.removeTrigger(a+"export"+b.types[e],b.types[e],f.db.PHASE_AFTER);if(c)for(d=f.db().collection(c.from),e=0;e<c.types.length;e++)d.removeTrigger(a+"import"+c.types[e],c.types[e],f.db.PHASE_AFTER);return delete f._linkIO[a],!0}return!1},enableTrigger:new d({string:function(a){var b,c,d,e,f,g=this,h=g._trigger,i=!1;if(h)for(f in h)if(h.hasOwnProperty(f)&&(b=h[f]))for(d in b)if(b.hasOwnProperty(d))for(c=b[d],e=0;e<c.length;e++)c[e].id===a&&(c[e].enabled=!0,i=!0);return i},number:function(a){var b,c,d,e=this,f=e._trigger[a],g=!1;if(f)for(c in f)if(f.hasOwnProperty(c))for(b=f[c],d=0;d<b.length;d++)b[d].enabled=!0,g=!0;return g},"number, number":function(a,b){var c,d,e=this,f=e._trigger[a],g=!1;if(f&&(c=f[b]))for(d=0;d<c.length;d++)c[d].enabled=!0,g=!0;return g},"string, number, number":function(a,b,c){var d=this,e=d._triggerIndexOf(a,b,c);return e>-1?(d._trigger[b][c][e].enabled=!0,!0):!1}}),disableTrigger:new d({string:function(a){var b,c,d,e,f,g=this,h=g._trigger,i=!1;if(h)for(f in h)if(h.hasOwnProperty(f)&&(b=h[f]))for(d in b)if(b.hasOwnProperty(d))for(c=b[d],e=0;e<c.length;e++)c[e].id===a&&(c[e].enabled=!1,i=!0);return i},number:function(a){var b,c,d,e=this,f=e._trigger[a],g=!1;if(f)for(c in f)if(f.hasOwnProperty(c))for(b=f[c],d=0;d<b.length;d++)b[d].enabled=!1,g=!0;return g},"number, number":function(a,b){var c,d,e=this,f=e._trigger[a],g=!1;if(f&&(c=f[b]))for(d=0;d<c.length;d++)c[d].enabled=!1,g=!0;return g},"string, number, number":function(a,b,c){var d=this,e=d._triggerIndexOf(a,b,c);return e>-1?(d._trigger[b][c][e].enabled=!1,!0):!1}}),willTrigger:function(a,b){if(!this._ignoreTriggers&&this._trigger&&this._trigger[a]&&this._trigger[a][b]&&this._trigger[a][b].length){var c,d=this._trigger[a][b];for(c=0;c<d.length;c++)if(d[c].enabled)return!0}return!1},processTrigger:function(a,b,c,d,e){var f,g,h,i,j,k,l,m=this;if(!m._ignoreTriggers&&m._trigger&&m._trigger[b]&&m._trigger[b][c]){for(f=m._trigger[b][c],h=f.length,g=0;h>g;g++)if(i=f[g],i.enabled){if(m.debug()){switch(b){case this.TYPE_INSERT:k="insert";break;case this.TYPE_UPDATE:k="update";break;case this.TYPE_REMOVE:k="remove";break;default:k=""}switch(c){case this.PHASE_BEFORE:l="before";break;case this.PHASE_AFTER:l="after";break;default:l=""}console.log('Triggers: Processing trigger "'+i.id+'" for '+k+' in phase "'+l+'"')}if(m.triggerStack&&m.triggerStack[b]&&m.triggerStack[b][c]&&m.triggerStack[b][c][i.id]){m.debug()&&console.log('Triggers: Will not run trigger "'+i.id+'" for '+k+' in phase "'+l+'" as it is already in the stack!');continue}if(m.triggerStack=m.triggerStack||{},m.triggerStack[b]={},m.triggerStack[b][c]={},m.triggerStack[b][c][i.id]=!0,j=i.method.call(m,a,d,e),m.triggerStack=m.triggerStack||{},m.triggerStack[b]={},m.triggerStack[b][c]={},m.triggerStack[b][c][i.id]=!1,j===!1)return!1;if(void 0!==j&&j!==!0&&j!==!1)throw"ForerunnerDB.Mixin.Triggers: Trigger error: "+j}return!0}},_triggerIndexOf:function(a,b,c){var d,e,f,g=this;if(g._trigger&&g._trigger[b]&&g._trigger[b][c])for(d=g._trigger[b][c],e=d.length,f=0;e>f;f++)if(d[f].id===a)return f;return-1}};b.exports=e},{"./Overload":26}],24:[function(a,b,c){"use strict";var d={_updateProperty:function(a,b,c){a[b]=c,this.debug()&&console.log(this.logIdentifier()+' Setting non-data-bound document property "'+b+'" to val "'+c+'"')},_updateIncrement:function(a,b,c){a[b]+=c},_updateSpliceMove:function(a,b,c){a.splice(c,0,a.splice(b,1)[0]),this.debug()&&console.log(this.logIdentifier()+' Moving non-data-bound document array index from "'+b+'" to "'+c+'"')},_updateSplicePush:function(a,b,c){a.length>b?a.splice(b,0,c):a.push(c)},_updatePush:function(a,b){a.push(b)},_updatePull:function(a,b){a.splice(b,1)},_updateMultiply:function(a,b,c){a[b]*=c},_updateRename:function(a,b,c){a[c]=a[b],delete a[b]},_updateOverwrite:function(a,b,c){a[b]=c},_updateUnset:function(a,b){delete a[b]},_updateClear:function(a,b){var c,d=a[b];if(d&&"object"==typeof d)for(c in d)d.hasOwnProperty(c)&&this._updateUnset(d,c)},_updatePop:function(a,b){var c,d=!1;if(a.length>0)if(b>0){for(c=0;b>c;c++)a.pop();d=!0}else if(0>b){for(c=0;c>b;c--)a.shift();d=!0}return d}};b.exports=d},{}],25:[function(a,b,c){"use strict";var d=a("./Shared"),e=a("./Path"),f=function(a){this.pathSolver=new e,this.counter=0,this.init.apply(this,arguments)};f.prototype.init=function(a){this._data={operation:a,index:{potential:[],used:!1},steps:[],time:{startMs:0,stopMs:0,totalMs:0,process:{}},flag:{},log:[]}},d.addModule("Operation",f),d.mixin(f.prototype,"Mixin.ChainReactor"),f.prototype.start=function(){this._data.time.startMs=(new Date).getTime()},f.prototype.log=function(a){if(a){var b=this._log.length>0?this._data.log[this._data.log.length-1].time:0,c={event:a,time:(new Date).getTime(),delta:0};return this._data.log.push(c),b&&(c.delta=c.time-b),this}return this._data.log},f.prototype.time=function(a){if(void 0!==a){var b=this._data.time.process,c=b[a]=b[a]||{};return c.startMs?(c.stopMs=(new Date).getTime(),c.totalMs=c.stopMs-c.startMs,c.stepObj.totalMs=c.totalMs,delete c.stepObj):(c.startMs=(new Date).getTime(),c.stepObj={name:a},this._data.steps.push(c.stepObj)),this}return this._data.time},f.prototype.flag=function(a,b){return void 0===a||void 0===b?void 0!==a?this._data.flag[a]:this._data.flag:void(this._data.flag[a]=b)},f.prototype.data=function(a,b,c){return void 0!==b?(this.pathSolver.set(this._data,a,b),this):this.pathSolver.get(this._data,a)},f.prototype.pushData=function(a,b,c){this.pathSolver.push(this._data,a,b)},f.prototype.stop=function(){this._data.time.stopMs=(new Date).getTime(),this._data.time.totalMs=this._data.time.stopMs-this._data.time.startMs},d.finishModule("Operation"),b.exports=f},{"./Path":27,"./Shared":33}],26:[function(a,b,c){"use strict";var d=function(a,b){if(b||(b=a,a=void 0),b){var c,d,e,f,g,h,i=this;if(!(b instanceof Array)){e={};for(c in b)if(b.hasOwnProperty(c))if(f=c.replace(/ /g,""),-1===f.indexOf("*"))e[f]=b[c];else for(h=this.generateSignaturePermutations(f),g=0;g<h.length;g++)e[h[g]]||(e[h[g]]=b[c]);b=e}return function(){var e,f,g,h=[];if(b instanceof Array){for(d=b.length,c=0;d>c;c++)if(b[c].length===arguments.length)return i.callExtend(this,"$main",b,b[c],arguments)}else{for(c=0;c<arguments.length&&(f=typeof arguments[c],"object"===f&&arguments[c]instanceof Array&&(f="array"),1!==arguments.length||"undefined"!==f);c++)h.push(f);if(e=h.join(","),b[e])return i.callExtend(this,"$main",b,b[e],arguments);for(c=h.length;c>=0;c--)if(e=h.slice(0,c).join(","),b[e+",..."])return i.callExtend(this,"$main",b,b[e+",..."],arguments)}throw g=void 0!==a?a:"function"==typeof this.name?this.name():"Unknown",console.log("Overload Definition:",b),'ForerunnerDB.Overload "'+g+'": Overloaded method does not have a matching signature "'+e+'" for the passed arguments: '+this.jStringify(h)}}return function(){}};d.prototype.generateSignaturePermutations=function(a){var b,c,d=[],e=["array","string","object","number","function","undefined"];if(a.indexOf("*")>-1)for(c=0;c<e.length;c++)b=a.replace("*",e[c]),d=d.concat(this.generateSignaturePermutations(b));else d.push(a);return d},d.prototype.callExtend=function(a,b,c,d,e){var f,g;return a&&c[b]?(f=a[b],a[b]=c[b],g=d.apply(a,e),a[b]=f,g):d.apply(a,e)},b.exports=d},{}],27:[function(a,b,c){"use strict";var d=a("./Shared"),e=function(a){this.init.apply(this,arguments)};e.prototype.init=function(a){a&&this.path(a)},d.addModule("Path",e),d.mixin(e.prototype,"Mixin.Common"),d.mixin(e.prototype,"Mixin.ChainReactor"),e.prototype.path=function(a){return void 0!==a?(this._path=this.clean(a),this._pathParts=this._path.split("."),this):this._path},e.prototype.hasObjectPaths=function(a,b){var c,d=!0;for(c in a)if(a.hasOwnProperty(c)){if(void 0===b[c])return!1;if("object"==typeof a[c]&&(d=this.hasObjectPaths(a[c],b[c]),!d))return!1}return d},e.prototype.countKeys=function(a){var b,c=0;for(b in a)a.hasOwnProperty(b)&&void 0!==a[b]&&("object"!=typeof a[b]?c++:c+=this.countKeys(a[b]));return c},e.prototype.countObjectPaths=function(a,b){var c,d,e={},f=0,g=0;for(d in b)b.hasOwnProperty(d)&&("object"==typeof b[d]?(c=this.countObjectPaths(a[d],b[d]),e[d]=c.matchedKeys,g+=c.totalKeyCount,f+=c.matchedKeyCount):(g++,a&&a[d]&&"object"!=typeof a[d]?(e[d]=!0,f++):e[d]=!1));return{matchedKeys:e,matchedKeyCount:f,totalKeyCount:g}},e.prototype.parse=function(a,b){var c,d,e,f=[],g="";for(d in a)if(a.hasOwnProperty(d))if(g=d,"object"==typeof a[d])if(b)for(c=this.parse(a[d],b),e=0;e<c.length;e++)f.push({path:g+"."+c[e].path,value:c[e].value});else for(c=this.parse(a[d]),e=0;e<c.length;e++)f.push({path:g+"."+c[e].path});else b?f.push({path:g,value:a[d]}):f.push({path:g});return f},e.prototype.parseArr=function(a,b){return b=b||{},this._parseArr(a,"",[],b)},e.prototype._parseArr=function(a,b,c,d){var e,f="";b=b||"",c=c||[];for(e in a)a.hasOwnProperty(e)&&(!d.ignore||d.ignore&&!d.ignore.test(e))&&(f=b?b+"."+e:e,"object"==typeof a[e]?(d.verbose&&c.push(f),this._parseArr(a[e],f,c,d)):c.push(f));return c},e.prototype.set=function(a,b,c){if(void 0!==a&&void 0!==b){var d,e;b=this.clean(b),d=b.split("."),e=d.shift(),d.length?(a[e]=a[e]||{},this.set(a[e],d.join("."),c)):a[e]=c}return a},e.prototype.get=function(a,b){return this.value(a,b)[0]},e.prototype.value=function(a,b,c){var d,e,f,g,h,i,j,k,l;if(b&&-1===b.indexOf("."))return[a[b]];if(void 0!==a&&"object"==typeof a){if((!c||c&&!c.skipArrCheck)&&a instanceof Array){for(j=[],k=0;k<a.length;k++)j.push(this.get(a[k],b));return j}for(i=[],void 0!==b&&(b=this.clean(b),d=b.split(".")),e=d||this._pathParts,f=e.length,g=a,k=0;f>k;k++){if(g=g[e[k]],h instanceof Array){for(l=0;l<h.length;l++)i=i.concat(this.value(h,l+"."+e[k],{skipArrCheck:!0}));return i}if(!g||"object"!=typeof g)break;h=g}return[g]}return[]},e.prototype.push=function(a,b,c){if(void 0!==a&&void 0!==b){var d,e;if(b=this.clean(b),d=b.split("."),e=d.shift(),d.length)a[e]=a[e]||{},this.set(a[e],d.join("."),c);else{if(a[e]=a[e]||[],!(a[e]instanceof Array))throw"ForerunnerDB.Path: Cannot push to a path whose endpoint is not an array!";a[e].push(c)}}return a},e.prototype.keyValue=function(a,b){var c,d,e,f,g,h,i;for(void 0!==b&&(b=this.clean(b),c=b.split(".")),d=c||this._pathParts,e=d.length,f=a,i=0;e>i;i++){if(f=f[d[i]],!f||"object"!=typeof f){h=d[i]+":"+f;break}g=f}return h},e.prototype.set=function(a,b,c){if(void 0!==a&&void 0!==b){var d,e;b=this.clean(b),d=b.split("."),e=d.shift(),d.length?(a[e]=a[e]||{},this.set(a[e],d.join("."),c)):a[e]=c}return a},e.prototype.clean=function(a){return"."===a.substr(0,1)&&(a=a.substr(1,a.length-1)),a},d.finishModule("Path"),b.exports=e},{"./Shared":33}],28:[function(a,b,c){"use strict";var d,e,f,g,h,i,j,k,l,m=a("./Shared"),n=a("async"),o=a("localforage");a("./PersistCompress"),a("./PersistCrypto");k=function(){this.init.apply(this,arguments)},k.prototype.localforage=o,k.prototype.init=function(a){var b=this;this._encodeSteps=[function(){return b._encode.apply(b,arguments)}],this._decodeSteps=[function(){return b._decode.apply(b,arguments)}],a.isClient()&&void 0!==window.Storage&&(this.mode("localforage"),o.config({driver:[o.INDEXEDDB,o.WEBSQL,o.LOCALSTORAGE],name:String(a.core().name()),storeName:"FDB"}))},m.addModule("Persist",k),m.mixin(k.prototype,"Mixin.ChainReactor"),m.mixin(k.prototype,"Mixin.Common"),d=m.modules.Db,e=a("./Collection"),f=e.prototype.drop,g=a("./CollectionGroup"),h=e.prototype.init,i=d.prototype.init,j=d.prototype.drop,l=m.overload,m.synthesize(k.prototype,"auto",function(a){var b=this;return void 0!==a&&(a?(this._db.on("create",function(){b._autoLoad.apply(b,arguments)}),this._db.on("change",function(){b._autoSave.apply(b,arguments)}),this._db.debug()&&console.log(this._db.logIdentifier()+" Automatic load/save enabled")):(this._db.off("create",this._autoLoad),this._db.off("change",this._autoSave),this._db.debug()&&console.log(this._db.logIdentifier()+" Automatic load/save disbled"))),this.$super.call(this,a)}),k.prototype._autoLoad=function(a,b,c){var d=this;"function"==typeof a.load?(d._db.debug()&&console.log(d._db.logIdentifier()+" Auto-loading data for "+b+":",c),a.load(function(a,b){a&&d._db.debug()&&console.log(d._db.logIdentifier()+" Automatic load failed:",a),d.emit("load",a,b)})):d._db.debug()&&console.log(d._db.logIdentifier()+" Auto-load for "+b+":",c,"no load method, skipping")},k.prototype._autoSave=function(a,b,c){var d=this;"function"==typeof a.save&&(d._db.debug()&&console.log(d._db.logIdentifier()+" Auto-saving data for "+b+":",c),a.save(function(a,b){a&&d._db.debug()&&console.log(d._db.logIdentifier()+" Automatic save failed:",a),d.emit("save",a,b)}))},k.prototype.mode=function(a){return void 0!==a?(this._mode=a,this):this._mode},k.prototype.driver=function(a){if(void 0!==a){switch(a.toUpperCase()){case"LOCALSTORAGE":o.setDriver(o.LOCALSTORAGE);break;case"WEBSQL":o.setDriver(o.WEBSQL);break;case"INDEXEDDB":o.setDriver(o.INDEXEDDB);break;default:throw"ForerunnerDB.Persist: The persistence driver you have specified is not found. Please use either IndexedDB, WebSQL or LocalStorage!"}return this}return o.driver()},k.prototype.decode=function(a,b){n.waterfall([function(b){b&&b(!1,a,{})}].concat(this._decodeSteps),b)},k.prototype.encode=function(a,b){n.waterfall([function(b){b&&b(!1,a,{})}].concat(this._encodeSteps),b)},m.synthesize(k.prototype,"encodeSteps"),m.synthesize(k.prototype,"decodeSteps"),k.prototype.addStep=new l({object:function(a){this.$main.call(this,function(){a.encode.apply(a,arguments)},function(){a.decode.apply(a,arguments)},0)},"function, function":function(a,b){this.$main.call(this,a,b,0)},"function, function, number":function(a,b,c){this.$main.call(this,a,b,c)},$main:function(a,b,c){0===c||void 0===c?(this._encodeSteps.push(a),this._decodeSteps.unshift(b)):(this._encodeSteps.splice(c,0,a),this._decodeSteps.splice(this._decodeSteps.length-c,0,b))}}),k.prototype.unwrap=function(a){var b,c=a.split("::fdb::");switch(c[0]){case"json":b=this.jParse(c[1]);break;case"raw":b=c[1]}},k.prototype._decode=function(a,b,c){var d,e;if(a){switch(d=a.split("::fdb::"),d[0]){case"json":e=this.jParse(d[1]);break;case"raw":e=d[1]}e?(b.foundData=!0,b.rowCount=e.length||0):(b.foundData=!1,b.rowCount=0),c&&c(!1,e,b)}else b.foundData=!1,b.rowCount=0,c&&c(!1,a,b)},k.prototype._encode=function(a,b,c){var d=a;a="object"==typeof a?"json::fdb::"+this.jStringify(a):"raw::fdb::"+a,d?(b.foundData=!0,b.rowCount=d.length||0):(b.foundData=!1,b.rowCount=0),c&&c(!1,a,b)},k.prototype.save=function(a,b,c){switch(this.mode()){case"localforage":this.encode(b,function(b,d,e){b?c(b):o.setItem(a,d).then(function(a){c&&c(!1,a,e)},function(a){c&&c(a)})});break;default:c&&c("No data handler.")}},k.prototype.load=function(a,b){var c=this;switch(this.mode()){case"localforage":o.getItem(a).then(function(a){c.decode(a,b)},function(a){b&&b(a)});break;default:b&&b("No data handler or unrecognised data type.")}},k.prototype.drop=function(a,b){switch(this.mode()){case"localforage":o.removeItem(a).then(function(){b&&b(!1)},function(a){b&&b(a)});break;default:b&&b("No data handler or unrecognised data type.")}},e.prototype.drop=new l({"":function(){this.isDropped()||this.drop(!0)},"function":function(a){this.isDropped()||this.drop(!0,a)},"boolean":function(a){if(!this.isDropped()){if(a){if(!this._name)throw"ForerunnerDB.Persist: Cannot drop a collection's persistent storage when no name assigned to collection!";this._db&&(this._db.persist.drop(this._db._name+"-"+this._name),this._db.persist.drop(this._db._name+"-"+this._name+"-metaData"))}f.call(this)}},"boolean, function":function(a,b){var c=this;if(!this.isDropped()){if(!a)return f.call(this,b);if(this._name){if(this._db)return this._db.persist.drop(this._db._name+"-"+this._name,function(){c._db.persist.drop(c._db._name+"-"+c._name+"-metaData",b)}),f.call(this);b&&b("Cannot drop a collection's persistent storage when the collection is not attached to a database!");
}else b&&b("Cannot drop a collection's persistent storage when no name assigned to collection!")}}}),e.prototype.save=function(a){var b,c=this;c._name?c._db?(b=function(){c._db.persist.save(c._db._name+"-"+c._name,c._data,function(b,d,e){b?a&&a(b):c._db.persist.save(c._db._name+"-"+c._name+"-metaData",c.metaData(),function(b,c,d){a&&a(b,c,e,d)})})},c.isProcessingQueue()?c.on("queuesComplete",function(){b()}):b()):a&&a("Cannot save a collection that is not attached to a database!"):a&&a("Cannot save a collection with no assigned name!")},e.prototype.load=function(a){var b=this;b._name?b._db?b._db.persist.load(b._db._name+"-"+b._name,function(c,d,e){c?a&&a(c):(d&&(b.remove({}),b.insert(d)),b._db.persist.load(b._db._name+"-"+b._name+"-metaData",function(c,d,f){c||d&&b.metaData(d),a&&a(c,e,f)}))}):a&&a("Cannot load a collection that is not attached to a database!"):a&&a("Cannot load a collection with no assigned name!")},e.prototype.saveCustom=function(a){var b,c=this,d={};c._name?c._db?(b=function(){c.encode(c._data,function(b,e,f){b?a(b):(d.data={name:c._db._name+"-"+c._name,store:e,tableStats:f},c.encode(c._data,function(b,e,f){b?a(b):(d.metaData={name:c._db._name+"-"+c._name+"-metaData",store:e,tableStats:f},a(!1,d))}))})},c.isProcessingQueue()?c.on("queuesComplete",function(){b()}):b()):a&&a("Cannot save a collection that is not attached to a database!"):a&&a("Cannot save a collection with no assigned name!")},e.prototype.loadCustom=function(a,b){var c=this;c._name?c._db?a.data&&a.data.store?a.metaData&&a.metaData.store?c.decode(a.data.store,function(d,e,f){d?b(d):e&&(c.remove({}),c.insert(e),c.decode(a.metaData.store,function(a,d,e){a?b(a):d&&(c.metaData(d),b&&b(a,f,e))}))}):b('No "metaData" key found in passed object!'):b('No "data" key found in passed object!'):b&&b("Cannot load a collection that is not attached to a database!"):b&&b("Cannot load a collection with no assigned name!")},d.prototype.init=function(){i.apply(this,arguments),this.persist=new k(this)},d.prototype.load=new l({"function":function(a){this.$main.call(this,{},a)},"object, function":function(a,b){this.$main.call(this,a,b)},$main:function(a,b){var c,d,e=this._collection,f=e.keys(),g=f.length;c=function(a){a?b&&b(a):(g--,0===g&&b&&b(!1))};for(d in e)e.hasOwnProperty(d)&&(a?e[d].loadCustom(a,c):e[d].load(c))}}),d.prototype.save=new l({"function":function(a){this.$main.call(this,{},a)},"object, function":function(a,b){this.$main.call(this,a,b)},$main:function(a,b){var c,d,e=this._collection,f=e.keys(),g=f.length;c=function(a){a?b&&b(a):(g--,0===g&&b&&b(!1))};for(d in e)e.hasOwnProperty(d)&&(a.custom?e[d].saveCustom(c):e[d].save(c))}}),m.finishModule("Persist"),b.exports=k},{"./Collection":5,"./CollectionGroup":6,"./PersistCompress":29,"./PersistCrypto":30,"./Shared":33,async:35,localforage:70}],29:[function(a,b,c){"use strict";var d=a("./Shared"),e=a("pako"),f=function(){this.init.apply(this,arguments)};f.prototype.init=function(a){},d.mixin(f.prototype,"Mixin.Common"),f.prototype.encode=function(a,b,c){var d,f,g,h={data:a,type:"fdbCompress",enabled:!1};d=a.length,g=e.deflate(a,{to:"string"}),f=g.length,d>f&&(h.data=g,h.enabled=!0),b.compression={enabled:h.enabled,compressedBytes:f,uncompressedBytes:d,effect:Math.round(100/d*f)+"%"},c(!1,this.jStringify(h),b)},f.prototype.decode=function(a,b,c){var d,f=!1;a?(a=this.jParse(a),a.enabled?(d=e.inflate(a.data,{to:"string"}),f=!0):(d=a.data,f=!1),b.compression={enabled:f},c&&c(!1,d,b)):c&&c(!1,d,b)},d.plugins.FdbCompress=f,b.exports=f},{"./Shared":33,pako:71}],30:[function(a,b,c){"use strict";var d=a("./Shared"),e=a("crypto-js"),f=function(){this.init.apply(this,arguments)};f.prototype.init=function(a){if(!a||!a.pass)throw'Cannot initialise persistent storage encryption without a passphrase provided in the passed options object as the "pass" field.';this._algo=a.algo||"AES",this._pass=a.pass},d.mixin(f.prototype,"Mixin.Common"),d.synthesize(f.prototype,"pass"),f.prototype.stringify=function(a){var b={ct:a.ciphertext.toString(e.enc.Base64)};return a.iv&&(b.iv=a.iv.toString()),a.salt&&(b.s=a.salt.toString()),this.jStringify(b)},f.prototype.parse=function(a){var b=this.jParse(a),c=e.lib.CipherParams.create({ciphertext:e.enc.Base64.parse(b.ct)});return b.iv&&(c.iv=e.enc.Hex.parse(b.iv)),b.s&&(c.salt=e.enc.Hex.parse(b.s)),c},f.prototype.encode=function(a,b,c){var d,f=this,g={type:"fdbCrypto"};d=e[this._algo].encrypt(a,this._pass,{format:{stringify:function(){return f.stringify.apply(f,arguments)},parse:function(){return f.parse.apply(f,arguments)}}}),g.data=d.toString(),g.enabled=!0,b.encryption={enabled:g.enabled},c&&c(!1,this.jStringify(g),b)},f.prototype.decode=function(a,b,c){var d,f=this;a?(a=this.jParse(a),d=e[this._algo].decrypt(a.data,this._pass,{format:{stringify:function(){return f.stringify.apply(f,arguments)},parse:function(){return f.parse.apply(f,arguments)}}}).toString(e.enc.Utf8),c&&c(!1,d,b)):c&&c(!1,a,b)},d.plugins.FdbCrypto=f,b.exports=f},{"./Shared":33,"crypto-js":44}],31:[function(a,b,c){"use strict";var d=a("./Shared"),e=function(a,b,c){if(!(a&&b&&c))throw"ForerunnerDB.ReactorIO: ReactorIO requires in, out and process arguments to instantiate!";if(this._reactorIn=a,this._reactorOut=b,this._chainHandler=c,!a.chain)throw"ForerunnerDB.ReactorIO: ReactorIO requires passed in and out objects to implement the ChainReactor mixin!";a.chain(this),this.chain(b)};d.addModule("ReactorIO",e),e.prototype.drop=function(){return this.isDropped()||(this._state="dropped",this._reactorIn&&this._reactorIn.unChain(this),this._reactorOut&&this.unChain(this._reactorOut),delete this._reactorIn,delete this._reactorOut,delete this._chainHandler,this.emit("drop",this),delete this._listeners),!0},d.synthesize(e.prototype,"state"),d.mixin(e.prototype,"Mixin.Common"),d.mixin(e.prototype,"Mixin.ChainReactor"),d.mixin(e.prototype,"Mixin.Events"),d.finishModule("ReactorIO"),b.exports=e},{"./Shared":33}],32:[function(a,b,c){"use strict";var d=function(){this.init.apply(this,arguments)};d.prototype.init=function(){var a=this;this._encoder=[],this._decoder=[],this.registerHandler("$date",function(a){return a instanceof Date?(a.toJSON=function(){return"$date:"+this.toISOString()},!0):!1},function(b){return"string"==typeof b&&0===b.indexOf("$date:")?a.convert(new Date(b.substr(6))):void 0}),this.registerHandler("$regexp",function(a){return a instanceof RegExp?(a.toJSON=function(){return"$regexp:"+this.source.length+":"+this.source+":"+(this.global?"g":"")+(this.ignoreCase?"i":"")},!0):!1},function(b){if("string"==typeof b&&0===b.indexOf("$regexp:")){var c=b.substr(8),d=c.indexOf(":"),e=Number(c.substr(0,d)),f=c.substr(d+1,e),g=c.substr(d+e+2);return a.convert(new RegExp(f,g))}})},d.prototype.registerHandler=function(a,b,c){void 0!==a&&(this._encoder.push(b),this._decoder.push(c))},d.prototype.convert=function(a){var b,c=this._encoder;for(b=0;b<c.length;b++)if(c[b](a))return a;return a},d.prototype.reviver=function(){var a=this._decoder;return function(b,c){var d,e;for(e=0;e<a.length;e++)if(d=a[e](c),void 0!==d)return d;return c}},b.exports=d},{}],33:[function(a,b,c){"use strict";var d=a("./Overload"),e={version:"1.3.755",modules:{},plugins:{},index:{},_synth:{},addModule:function(a,b){this.modules[a]=b,this.emit("moduleLoad",[a,b])},finishModule:function(a){if(!this.modules[a])throw"ForerunnerDB.Shared: finishModule called on a module that has not been registered with addModule(): "+a;this.modules[a]._fdbFinished=!0,this.modules[a].prototype?this.modules[a].prototype.className=a:this.modules[a].className=a,this.emit("moduleFinished",[a,this.modules[a]])},moduleFinished:function(a,b){this.modules[a]&&this.modules[a]._fdbFinished?b&&b(a,this.modules[a]):this.on("moduleFinished",b)},moduleExists:function(a){return Boolean(this.modules[a])},mixin:new d({"object, string":function(a,b){var c;if("string"==typeof b&&(c=this.mixins[b],!c))throw"ForerunnerDB.Shared: Cannot find mixin named: "+b;return this.$main.call(this,a,c)},"object, *":function(a,b){return this.$main.call(this,a,b)},$main:function(a,b){if(b&&"object"==typeof b)for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);return a}}),synthesize:function(a,b,c){if(this._synth[b]=this._synth[b]||function(a){return void 0!==a?(this["_"+b]=a,this):this["_"+b]},c){var d=this;a[b]=function(){var a,e=this.$super;return this.$super=d._synth[b],a=c.apply(this,arguments),this.$super=e,a}}else a[b]=this._synth[b]},overload:d,mixins:{"Mixin.Common":a("./Mixin.Common"),"Mixin.Events":a("./Mixin.Events"),"Mixin.ChainReactor":a("./Mixin.ChainReactor"),"Mixin.CRUD":a("./Mixin.CRUD"),"Mixin.Constants":a("./Mixin.Constants"),"Mixin.Triggers":a("./Mixin.Triggers"),"Mixin.Sorting":a("./Mixin.Sorting"),"Mixin.Matching":a("./Mixin.Matching"),"Mixin.Updating":a("./Mixin.Updating"),"Mixin.Tags":a("./Mixin.Tags")}};e.mixin(e,"Mixin.Events"),b.exports=e},{"./Mixin.CRUD":15,"./Mixin.ChainReactor":16,"./Mixin.Common":17,"./Mixin.Constants":18,"./Mixin.Events":19,"./Mixin.Matching":20,"./Mixin.Sorting":21,"./Mixin.Tags":22,"./Mixin.Triggers":23,"./Mixin.Updating":24,"./Overload":26}],34:[function(a,b,c){Array.prototype.filter||(Array.prototype.filter=function(a){if(void 0===this||null===this)throw new TypeError;var b=Object(this),c=b.length>>>0;if("function"!=typeof a)throw new TypeError;for(var d=[],e=arguments.length>=2?arguments[1]:void 0,f=0;c>f;f++)if(f in b){var g=b[f];a.call(e,g,f,b)&&d.push(g)}return d}),"function"!=typeof Object.create&&(Object.create=function(){var a=function(){};return function(b){if(arguments.length>1)throw Error("Second argument not supported");if("object"!=typeof b)throw TypeError("Argument must be an object");a.prototype=b;var c=new a;return a.prototype=null,c}}()),Array.prototype.indexOf||(Array.prototype.indexOf=function(a,b){var c;if(null===this)throw new TypeError('"this" is null or not defined');var d=Object(this),e=d.length>>>0;if(0===e)return-1;var f=+b||0;if(Math.abs(f)===1/0&&(f=0),f>=e)return-1;for(c=Math.max(f>=0?f:e-Math.abs(f),0);e>c;){if(c in d&&d[c]===a)return c;c++}return-1}),b.exports={}},{}],35:[function(a,b,c){(function(a,c){!function(){function d(){}function e(a){return a}function f(a){return!!a}function g(a){return!a}function h(a){return function(){if(null===a)throw new Error("Callback was already called.");a.apply(this,arguments),a=null}}function i(a){return function(){null!==a&&(a.apply(this,arguments),a=null)}}function j(a){return N(a)||"number"==typeof a.length&&a.length>=0&&a.length%1===0}function k(a,b){for(var c=-1,d=a.length;++c<d;)b(a[c],c,a)}function l(a,b){for(var c=-1,d=a.length,e=Array(d);++c<d;)e[c]=b(a[c],c,a);return e}function m(a){return l(Array(a),function(a,b){return b})}function n(a,b,c){return k(a,function(a,d,e){c=b(c,a,d,e)}),c}function o(a,b){k(P(a),function(c){b(a[c],c)})}function p(a,b){for(var c=0;c<a.length;c++)if(a[c]===b)return c;return-1}function q(a){var b,c,d=-1;return j(a)?(b=a.length,function(){return d++,b>d?d:null}):(c=P(a),b=c.length,function(){return d++,b>d?c[d]:null})}function r(a,b){return b=null==b?a.length-1:+b,function(){for(var c=Math.max(arguments.length-b,0),d=Array(c),e=0;c>e;e++)d[e]=arguments[e+b];switch(b){case 0:return a.call(this,d);case 1:return a.call(this,arguments[0],d)}}}function s(a){return function(b,c,d){return a(b,d)}}function t(a){return function(b,c,e){e=i(e||d),b=b||[];var f=q(b);if(0>=a)return e(null);var g=!1,j=0,k=!1;!function l(){if(g&&0>=j)return e(null);for(;a>j&&!k;){var d=f();if(null===d)return g=!0,void(0>=j&&e(null));j+=1,c(b[d],d,h(function(a){j-=1,a?(e(a),k=!0):l()}))}}()}}function u(a){return function(b,c,d){return a(K.eachOf,b,c,d)}}function v(a){return function(b,c,d,e){return a(t(c),b,d,e)}}function w(a){return function(b,c,d){return a(K.eachOfSeries,b,c,d)}}function x(a,b,c,e){e=i(e||d),b=b||[];var f=j(b)?[]:{};a(b,function(a,b,d){c(a,function(a,c){f[b]=c,d(a)})},function(a){e(a,f)})}function y(a,b,c,d){var e=[];a(b,function(a,b,d){c(a,function(c){c&&e.push({index:b,value:a}),d()})},function(){d(l(e.sort(function(a,b){return a.index-b.index}),function(a){return a.value}))})}function z(a,b,c,d){y(a,b,function(a,b){c(a,function(a){b(!a)})},d)}function A(a,b,c){return function(d,e,f,g){function h(){g&&g(c(!1,void 0))}function i(a,d,e){return g?void f(a,function(d){g&&b(d)&&(g(c(!0,a)),g=f=!1),e()}):e()}arguments.length>3?a(d,e,i,h):(g=f,f=e,a(d,i,h))}}function B(a,b){return b}function C(a,b,c){c=c||d;var e=j(b)?[]:{};a(b,function(a,b,c){a(r(function(a,d){d.length<=1&&(d=d[0]),e[b]=d,c(a)}))},function(a){c(a,e)})}function D(a,b,c,d){var e=[];a(b,function(a,b,d){c(a,function(a,b){e=e.concat(b||[]),d(a)})},function(a){d(a,e)})}function E(a,b,c){function e(a,b,c,e){if(null!=e&&"function"!=typeof e)throw new Error("task callback must be a function");return a.started=!0,N(b)||(b=[b]),0===b.length&&a.idle()?K.setImmediate(function(){a.drain()}):(k(b,function(b){var f={data:b,callback:e||d};c?a.tasks.unshift(f):a.tasks.push(f),a.tasks.length===a.concurrency&&a.saturated()}),void K.setImmediate(a.process))}function f(a,b){return function(){g-=1;var c=!1,d=arguments;k(b,function(a){k(i,function(b,d){b!==a||c||(i.splice(d,1),c=!0)}),a.callback.apply(a,d)}),a.tasks.length+g===0&&a.drain(),a.process()}}if(null==b)b=1;else if(0===b)throw new Error("Concurrency must not be zero");var g=0,i=[],j={tasks:[],concurrency:b,payload:c,saturated:d,empty:d,drain:d,started:!1,paused:!1,push:function(a,b){e(j,a,!1,b)},kill:function(){j.drain=d,j.tasks=[]},unshift:function(a,b){e(j,a,!0,b)},process:function(){for(;!j.paused&&g<j.concurrency&&j.tasks.length;){var b=j.payload?j.tasks.splice(0,j.payload):j.tasks.splice(0,j.tasks.length),c=l(b,function(a){return a.data});0===j.tasks.length&&j.empty(),g+=1,i.push(b[0]);var d=h(f(j,b));a(c,d)}},length:function(){return j.tasks.length},running:function(){return g},workersList:function(){return i},idle:function(){return j.tasks.length+g===0},pause:function(){j.paused=!0},resume:function(){if(j.paused!==!1){j.paused=!1;for(var a=Math.min(j.concurrency,j.tasks.length),b=1;a>=b;b++)K.setImmediate(j.process)}}};return j}function F(a){return r(function(b,c){b.apply(null,c.concat([r(function(b,c){"object"==typeof console&&(b?console.error&&console.error(b):console[a]&&k(c,function(b){console[a](b)}))})]))})}function G(a){return function(b,c,d){a(m(b),c,d)}}function H(a){return r(function(b,c){var d=r(function(c){var d=this,e=c.pop();return a(b,function(a,b,e){a.apply(d,c.concat([e]))},e)});return c.length?d.apply(this,c):d})}function I(a){return r(function(b){var c=b.pop();b.push(function(){var a=arguments;d?K.setImmediate(function(){c.apply(null,a)}):c.apply(null,a)});var d=!0;a.apply(this,b),d=!1})}var J,K={},L="object"==typeof self&&self.self===self&&self||"object"==typeof c&&c.global===c&&c||this;null!=L&&(J=L.async),K.noConflict=function(){return L.async=J,K};var M=Object.prototype.toString,N=Array.isArray||function(a){return"[object Array]"===M.call(a)},O=function(a){var b=typeof a;return"function"===b||"object"===b&&!!a},P=Object.keys||function(a){var b=[];for(var c in a)a.hasOwnProperty(c)&&b.push(c);return b},Q="function"==typeof setImmediate&&setImmediate,R=Q?function(a){Q(a)}:function(a){setTimeout(a,0)};"object"==typeof a&&"function"==typeof a.nextTick?K.nextTick=a.nextTick:K.nextTick=R,K.setImmediate=Q?R:K.nextTick,K.forEach=K.each=function(a,b,c){return K.eachOf(a,s(b),c)},K.forEachSeries=K.eachSeries=function(a,b,c){return K.eachOfSeries(a,s(b),c)},K.forEachLimit=K.eachLimit=function(a,b,c,d){return t(b)(a,s(c),d)},K.forEachOf=K.eachOf=function(a,b,c){function e(a){j--,a?c(a):null===f&&0>=j&&c(null)}c=i(c||d),a=a||[];for(var f,g=q(a),j=0;null!=(f=g());)j+=1,b(a[f],f,h(e));0===j&&c(null)},K.forEachOfSeries=K.eachOfSeries=function(a,b,c){function e(){var d=!0;return null===g?c(null):(b(a[g],g,h(function(a){if(a)c(a);else{if(g=f(),null===g)return c(null);d?K.setImmediate(e):e()}})),void(d=!1))}c=i(c||d),a=a||[];var f=q(a),g=f();e()},K.forEachOfLimit=K.eachOfLimit=function(a,b,c,d){t(b)(a,c,d)},K.map=u(x),K.mapSeries=w(x),K.mapLimit=v(x),K.inject=K.foldl=K.reduce=function(a,b,c,d){K.eachOfSeries(a,function(a,d,e){c(b,a,function(a,c){b=c,e(a)})},function(a){d(a,b)})},K.foldr=K.reduceRight=function(a,b,c,d){var f=l(a,e).reverse();K.reduce(f,b,c,d)},K.transform=function(a,b,c,d){3===arguments.length&&(d=c,c=b,b=N(a)?[]:{}),K.eachOf(a,function(a,d,e){c(b,a,d,e)},function(a){d(a,b)})},K.select=K.filter=u(y),K.selectLimit=K.filterLimit=v(y),K.selectSeries=K.filterSeries=w(y),K.reject=u(z),K.rejectLimit=v(z),K.rejectSeries=w(z),K.any=K.some=A(K.eachOf,f,e),K.someLimit=A(K.eachOfLimit,f,e),K.all=K.every=A(K.eachOf,g,g),K.everyLimit=A(K.eachOfLimit,g,g),K.detect=A(K.eachOf,e,B),K.detectSeries=A(K.eachOfSeries,e,B),K.detectLimit=A(K.eachOfLimit,e,B),K.sortBy=function(a,b,c){function d(a,b){var c=a.criteria,d=b.criteria;return d>c?-1:c>d?1:0}K.map(a,function(a,c){b(a,function(b,d){b?c(b):c(null,{value:a,criteria:d})})},function(a,b){return a?c(a):void c(null,l(b.sort(d),function(a){return a.value}))})},K.auto=function(a,b,c){function e(a){s.unshift(a)}function f(a){var b=p(s,a);b>=0&&s.splice(b,1)}function g(){j--,k(s.slice(0),function(a){a()})}"function"==typeof arguments[1]&&(c=b,b=null),c=i(c||d);var h=P(a),j=h.length;if(!j)return c(null);b||(b=j);var l={},m=0,q=!1,s=[];e(function(){j||c(null,l)}),k(h,function(d){function h(){return b>m&&n(t,function(a,b){return a&&l.hasOwnProperty(b)},!0)&&!l.hasOwnProperty(d)}function i(){h()&&(m++,f(i),k[k.length-1](s,l))}if(!q){for(var j,k=N(a[d])?a[d]:[a[d]],s=r(function(a,b){if(m--,b.length<=1&&(b=b[0]),a){var e={};o(l,function(a,b){e[b]=a}),e[d]=b,q=!0,c(a,e)}else l[d]=b,K.setImmediate(g)}),t=k.slice(0,k.length-1),u=t.length;u--;){if(!(j=a[t[u]]))throw new Error("Has nonexistent dependency in "+t.join(", "));if(N(j)&&p(j,d)>=0)throw new Error("Has cyclic dependencies")}h()?(m++,k[k.length-1](s,l)):e(i)}})},K.retry=function(a,b,c){function d(a,b){if("number"==typeof b)a.times=parseInt(b,10)||f;else{if("object"!=typeof b)throw new Error("Unsupported argument type for 'times': "+typeof b);a.times=parseInt(b.times,10)||f,a.interval=parseInt(b.interval,10)||g}}function e(a,b){function c(a,c){return function(d){a(function(a,b){d(!a||c,{err:a,result:b})},b)}}function d(a){return function(b){setTimeout(function(){b(null)},a)}}for(;i.times;){var e=!(i.times-=1);h.push(c(i.task,e)),!e&&i.interval>0&&h.push(d(i.interval))}K.series(h,function(b,c){c=c[c.length-1],(a||i.callback)(c.err,c.result)})}var f=5,g=0,h=[],i={times:f,interval:g},j=arguments.length;if(1>j||j>3)throw new Error("Invalid arguments - must be either (task), (task, callback), (times, task) or (times, task, callback)");return 2>=j&&"function"==typeof a&&(c=b,b=a),"function"!=typeof a&&d(i,a),i.callback=c,i.task=b,i.callback?e():e},K.waterfall=function(a,b){function c(a){return r(function(d,e){if(d)b.apply(null,[d].concat(e));else{var f=a.next();f?e.push(c(f)):e.push(b),I(a).apply(null,e)}})}if(b=i(b||d),!N(a)){var e=new Error("First argument to waterfall must be an array of functions");return b(e)}return a.length?void c(K.iterator(a))():b()},K.parallel=function(a,b){C(K.eachOf,a,b)},K.parallelLimit=function(a,b,c){C(t(b),a,c)},K.series=function(a,b){C(K.eachOfSeries,a,b)},K.iterator=function(a){function b(c){function d(){return a.length&&a[c].apply(null,arguments),d.next()}return d.next=function(){return c<a.length-1?b(c+1):null},d}return b(0)},K.apply=r(function(a,b){return r(function(c){return a.apply(null,b.concat(c))})}),K.concat=u(D),K.concatSeries=w(D),K.whilst=function(a,b,c){if(c=c||d,a()){var e=r(function(d,f){d?c(d):a.apply(this,f)?b(e):c.apply(null,[null].concat(f))});b(e)}else c(null)},K.doWhilst=function(a,b,c){var d=0;return K.whilst(function(){return++d<=1||b.apply(this,arguments)},a,c)},K.until=function(a,b,c){return K.whilst(function(){return!a.apply(this,arguments)},b,c)},K.doUntil=function(a,b,c){return K.doWhilst(a,function(){return!b.apply(this,arguments)},c)},K.during=function(a,b,c){c=c||d;var e=r(function(b,d){b?c(b):(d.push(f),a.apply(this,d))}),f=function(a,d){a?c(a):d?b(e):c(null)};a(f)},K.doDuring=function(a,b,c){var d=0;K.during(function(a){d++<1?a(null,!0):b.apply(this,arguments)},a,c)},K.queue=function(a,b){var c=E(function(b,c){a(b[0],c)},b,1);return c},K.priorityQueue=function(a,b){function c(a,b){return a.priority-b.priority}function e(a,b,c){for(var d=-1,e=a.length-1;e>d;){var f=d+(e-d+1>>>1);c(b,a[f])>=0?d=f:e=f-1}return d}function f(a,b,f,g){if(null!=g&&"function"!=typeof g)throw new Error("task callback must be a function");return a.started=!0,N(b)||(b=[b]),0===b.length?K.setImmediate(function(){a.drain()}):void k(b,function(b){var h={data:b,priority:f,callback:"function"==typeof g?g:d};a.tasks.splice(e(a.tasks,h,c)+1,0,h),a.tasks.length===a.concurrency&&a.saturated(),K.setImmediate(a.process)})}var g=K.queue(a,b);return g.push=function(a,b,c){f(g,a,b,c)},delete g.unshift,g},K.cargo=function(a,b){return E(a,1,b)},K.log=F("log"),K.dir=F("dir"),K.memoize=function(a,b){var c={},d={},f=Object.prototype.hasOwnProperty;b=b||e;var g=r(function(e){var g=e.pop(),h=b.apply(null,e);f.call(c,h)?K.setImmediate(function(){g.apply(null,c[h])}):f.call(d,h)?d[h].push(g):(d[h]=[g],a.apply(null,e.concat([r(function(a){c[h]=a;var b=d[h];delete d[h];for(var e=0,f=b.length;f>e;e++)b[e].apply(null,a)})])))});return g.memo=c,g.unmemoized=a,g},K.unmemoize=function(a){return function(){return(a.unmemoized||a).apply(null,arguments)}},K.times=G(K.map),K.timesSeries=G(K.mapSeries),K.timesLimit=function(a,b,c,d){return K.mapLimit(m(a),b,c,d)},K.seq=function(){var a=arguments;return r(function(b){var c=this,e=b[b.length-1];"function"==typeof e?b.pop():e=d,K.reduce(a,b,function(a,b,d){b.apply(c,a.concat([r(function(a,b){d(a,b)})]))},function(a,b){e.apply(c,[a].concat(b))})})},K.compose=function(){return K.seq.apply(null,Array.prototype.reverse.call(arguments))},K.applyEach=H(K.eachOf),K.applyEachSeries=H(K.eachOfSeries),K.forever=function(a,b){function c(a){return a?e(a):void f(c)}var e=h(b||d),f=I(a);c()},K.ensureAsync=I,K.constant=r(function(a){var b=[null].concat(a);return function(a){return a.apply(this,b)}}),K.wrapSync=K.asyncify=function(a){return r(function(b){var c,d=b.pop();try{c=a.apply(this,b)}catch(e){return d(e)}O(c)&&"function"==typeof c.then?c.then(function(a){d(null,a)})["catch"](function(a){d(a.message?a:new Error(a))}):d(null,c)})},"object"==typeof b&&b.exports?b.exports=K:"function"==typeof define&&define.amd?define([],function(){return K}):L.async=K}()}).call(this,a("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:87}],36:[function(a,b,c){!function(d,e,f){"object"==typeof c?b.exports=c=e(a("./core"),a("./enc-base64"),a("./md5"),a("./evpkdf"),a("./cipher-core")):"function"==typeof define&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(d.CryptoJS)}(this,function(a){return function(){var b=a,c=b.lib,d=c.BlockCipher,e=b.algo,f=[],g=[],h=[],i=[],j=[],k=[],l=[],m=[],n=[],o=[];!function(){for(var a=[],b=0;256>b;b++)128>b?a[b]=b<<1:a[b]=b<<1^283;for(var c=0,d=0,b=0;256>b;b++){var e=d^d<<1^d<<2^d<<3^d<<4;e=e>>>8^255&e^99,f[c]=e,g[e]=c;var p=a[c],q=a[p],r=a[q],s=257*a[e]^16843008*e;h[c]=s<<24|s>>>8,i[c]=s<<16|s>>>16,j[c]=s<<8|s>>>24,k[c]=s;var s=16843009*r^65537*q^257*p^16843008*c;l[e]=s<<24|s>>>8,m[e]=s<<16|s>>>16,n[e]=s<<8|s>>>24,o[e]=s,c?(c=p^a[a[a[r^p]]],d^=a[a[d]]):c=d=1}}();var p=[0,1,2,4,8,16,32,64,128,27,54],q=e.AES=d.extend({_doReset:function(){for(var a=this._key,b=a.words,c=a.sigBytes/4,d=this._nRounds=c+6,e=4*(d+1),g=this._keySchedule=[],h=0;e>h;h++)if(c>h)g[h]=b[h];else{var i=g[h-1];h%c?c>6&&h%c==4&&(i=f[i>>>24]<<24|f[i>>>16&255]<<16|f[i>>>8&255]<<8|f[255&i]):(i=i<<8|i>>>24,i=f[i>>>24]<<24|f[i>>>16&255]<<16|f[i>>>8&255]<<8|f[255&i],i^=p[h/c|0]<<24),g[h]=g[h-c]^i}for(var j=this._invKeySchedule=[],k=0;e>k;k++){var h=e-k;if(k%4)var i=g[h];else var i=g[h-4];4>k||4>=h?j[k]=i:j[k]=l[f[i>>>24]]^m[f[i>>>16&255]]^n[f[i>>>8&255]]^o[f[255&i]]}},encryptBlock:function(a,b){this._doCryptBlock(a,b,this._keySchedule,h,i,j,k,f)},decryptBlock:function(a,b){var c=a[b+1];a[b+1]=a[b+3],a[b+3]=c,this._doCryptBlock(a,b,this._invKeySchedule,l,m,n,o,g);var c=a[b+1];a[b+1]=a[b+3],a[b+3]=c},_doCryptBlock:function(a,b,c,d,e,f,g,h){for(var i=this._nRounds,j=a[b]^c[0],k=a[b+1]^c[1],l=a[b+2]^c[2],m=a[b+3]^c[3],n=4,o=1;i>o;o++){var p=d[j>>>24]^e[k>>>16&255]^f[l>>>8&255]^g[255&m]^c[n++],q=d[k>>>24]^e[l>>>16&255]^f[m>>>8&255]^g[255&j]^c[n++],r=d[l>>>24]^e[m>>>16&255]^f[j>>>8&255]^g[255&k]^c[n++],s=d[m>>>24]^e[j>>>16&255]^f[k>>>8&255]^g[255&l]^c[n++];j=p,k=q,l=r,m=s}var p=(h[j>>>24]<<24|h[k>>>16&255]<<16|h[l>>>8&255]<<8|h[255&m])^c[n++],q=(h[k>>>24]<<24|h[l>>>16&255]<<16|h[m>>>8&255]<<8|h[255&j])^c[n++],r=(h[l>>>24]<<24|h[m>>>16&255]<<16|h[j>>>8&255]<<8|h[255&k])^c[n++],s=(h[m>>>24]<<24|h[j>>>16&255]<<16|h[k>>>8&255]<<8|h[255&l])^c[n++];a[b]=p,a[b+1]=q,a[b+2]=r,a[b+3]=s},keySize:8});b.AES=d._createHelper(q)}(),a.AES})},{"./cipher-core":37,"./core":38,"./enc-base64":39,"./evpkdf":41,"./md5":46}],37:[function(a,b,c){!function(d,e){"object"==typeof c?b.exports=c=e(a("./core")):"function"==typeof define&&define.amd?define(["./core"],e):e(d.CryptoJS)}(this,function(a){a.lib.Cipher||function(b){var c=a,d=c.lib,e=d.Base,f=d.WordArray,g=d.BufferedBlockAlgorithm,h=c.enc,i=(h.Utf8,h.Base64),j=c.algo,k=j.EvpKDF,l=d.Cipher=g.extend({cfg:e.extend(),createEncryptor:function(a,b){return this.create(this._ENC_XFORM_MODE,a,b)},createDecryptor:function(a,b){return this.create(this._DEC_XFORM_MODE,a,b)},init:function(a,b,c){this.cfg=this.cfg.extend(c),this._xformMode=a,this._key=b,this.reset()},reset:function(){g.reset.call(this),this._doReset()},process:function(a){return this._append(a),this._process()},finalize:function(a){a&&this._append(a);var b=this._doFinalize();return b},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function a(a){return"string"==typeof a?x:u}return function(b){return{encrypt:function(c,d,e){return a(d).encrypt(b,c,d,e)},decrypt:function(c,d,e){return a(d).decrypt(b,c,d,e)}}}}()}),m=(d.StreamCipher=l.extend({_doFinalize:function(){var a=this._process(!0);return a},blockSize:1}),c.mode={}),n=d.BlockCipherMode=e.extend({createEncryptor:function(a,b){return this.Encryptor.create(a,b)},createDecryptor:function(a,b){return this.Decryptor.create(a,b)},init:function(a,b){this._cipher=a,this._iv=b}}),o=m.CBC=function(){function a(a,c,d){var e=this._iv;if(e){var f=e;this._iv=b}else var f=this._prevBlock;for(var g=0;d>g;g++)a[c+g]^=f[g]}var c=n.extend();return c.Encryptor=c.extend({processBlock:function(b,c){var d=this._cipher,e=d.blockSize;a.call(this,b,c,e),d.encryptBlock(b,c),this._prevBlock=b.slice(c,c+e)}}),c.Decryptor=c.extend({processBlock:function(b,c){var d=this._cipher,e=d.blockSize,f=b.slice(c,c+e);d.decryptBlock(b,c),a.call(this,b,c,e),this._prevBlock=f}}),c}(),p=c.pad={},q=p.Pkcs7={pad:function(a,b){for(var c=4*b,d=c-a.sigBytes%c,e=d<<24|d<<16|d<<8|d,g=[],h=0;d>h;h+=4)g.push(e);var i=f.create(g,d);a.concat(i)},unpad:function(a){var b=255&a.words[a.sigBytes-1>>>2];a.sigBytes-=b}},r=(d.BlockCipher=l.extend({cfg:l.cfg.extend({mode:o,padding:q}),reset:function(){l.reset.call(this);var a=this.cfg,b=a.iv,c=a.mode;if(this._xformMode==this._ENC_XFORM_MODE)var d=c.createEncryptor;else{var d=c.createDecryptor;this._minBufferSize=1}this._mode=d.call(c,this,b&&b.words)},_doProcessBlock:function(a,b){this._mode.processBlock(a,b)},_doFinalize:function(){var a=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){a.pad(this._data,this.blockSize);var b=this._process(!0)}else{var b=this._process(!0);a.unpad(b)}return b},blockSize:4}),d.CipherParams=e.extend({init:function(a){this.mixIn(a)},toString:function(a){return(a||this.formatter).stringify(this)}})),s=c.format={},t=s.OpenSSL={stringify:function(a){var b=a.ciphertext,c=a.salt;if(c)var d=f.create([1398893684,1701076831]).concat(c).concat(b);else var d=b;return d.toString(i)},parse:function(a){var b=i.parse(a),c=b.words;if(1398893684==c[0]&&1701076831==c[1]){var d=f.create(c.slice(2,4));c.splice(0,4),b.sigBytes-=16}return r.create({ciphertext:b,salt:d})}},u=d.SerializableCipher=e.extend({cfg:e.extend({format:t}),encrypt:function(a,b,c,d){d=this.cfg.extend(d);var e=a.createEncryptor(c,d),f=e.finalize(b),g=e.cfg;return r.create({ciphertext:f,key:c,iv:g.iv,algorithm:a,mode:g.mode,padding:g.padding,blockSize:a.blockSize,formatter:d.format})},decrypt:function(a,b,c,d){d=this.cfg.extend(d),b=this._parse(b,d.format);var e=a.createDecryptor(c,d).finalize(b.ciphertext);return e},_parse:function(a,b){return"string"==typeof a?b.parse(a,this):a}}),v=c.kdf={},w=v.OpenSSL={execute:function(a,b,c,d){d||(d=f.random(8));var e=k.create({keySize:b+c}).compute(a,d),g=f.create(e.words.slice(b),4*c);return e.sigBytes=4*b,r.create({key:e,iv:g,salt:d})}},x=d.PasswordBasedCipher=u.extend({cfg:u.cfg.extend({kdf:w}),encrypt:function(a,b,c,d){d=this.cfg.extend(d);var e=d.kdf.execute(c,a.keySize,a.ivSize);d.iv=e.iv;var f=u.encrypt.call(this,a,b,e.key,d);return f.mixIn(e),f},decrypt:function(a,b,c,d){d=this.cfg.extend(d),b=this._parse(b,d.format);var e=d.kdf.execute(c,a.keySize,a.ivSize,b.salt);d.iv=e.iv;var f=u.decrypt.call(this,a,b,e.key,d);return f}})}()})},{"./core":38}],38:[function(a,b,c){!function(a,d){"object"==typeof c?b.exports=c=d():"function"==typeof define&&define.amd?define([],d):a.CryptoJS=d()}(this,function(){var a=a||function(a,b){var c={},d=c.lib={},e=d.Base=function(){function a(){}return{extend:function(b){a.prototype=this;var c=new a;return b&&c.mixIn(b),c.hasOwnProperty("init")||(c.init=function(){c.$super.init.apply(this,arguments)}),c.init.prototype=c,c.$super=this,c},create:function(){var a=this.extend();return a.init.apply(a,arguments),a},init:function(){},mixIn:function(a){for(var b in a)a.hasOwnProperty(b)&&(this[b]=a[b]);a.hasOwnProperty("toString")&&(this.toString=a.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),f=d.WordArray=e.extend({init:function(a,c){a=this.words=a||[],c!=b?this.sigBytes=c:this.sigBytes=4*a.length},toString:function(a){return(a||h).stringify(this)},concat:function(a){var b=this.words,c=a.words,d=this.sigBytes,e=a.sigBytes;if(this.clamp(),d%4)for(var f=0;e>f;f++){var g=c[f>>>2]>>>24-f%4*8&255;b[d+f>>>2]|=g<<24-(d+f)%4*8}else for(var f=0;e>f;f+=4)b[d+f>>>2]=c[f>>>2];return this.sigBytes+=e,this},clamp:function(){var b=this.words,c=this.sigBytes;b[c>>>2]&=4294967295<<32-c%4*8,b.length=a.ceil(c/4)},clone:function(){var a=e.clone.call(this);return a.words=this.words.slice(0),a},random:function(b){for(var c,d=[],e=function(b){var b=b,c=987654321,d=4294967295;return function(){c=36969*(65535&c)+(c>>16)&d,b=18e3*(65535&b)+(b>>16)&d;var e=(c<<16)+b&d;return e/=4294967296,e+=.5,e*(a.random()>.5?1:-1)}},g=0;b>g;g+=4){var h=e(4294967296*(c||a.random()));c=987654071*h(),d.push(4294967296*h()|0)}return new f.init(d,b)}}),g=c.enc={},h=g.Hex={stringify:function(a){for(var b=a.words,c=a.sigBytes,d=[],e=0;c>e;e++){var f=b[e>>>2]>>>24-e%4*8&255;d.push((f>>>4).toString(16)),d.push((15&f).toString(16))}return d.join("")},parse:function(a){for(var b=a.length,c=[],d=0;b>d;d+=2)c[d>>>3]|=parseInt(a.substr(d,2),16)<<24-d%8*4;return new f.init(c,b/2)}},i=g.Latin1={stringify:function(a){for(var b=a.words,c=a.sigBytes,d=[],e=0;c>e;e++){var f=b[e>>>2]>>>24-e%4*8&255;d.push(String.fromCharCode(f))}return d.join("")},parse:function(a){for(var b=a.length,c=[],d=0;b>d;d++)c[d>>>2]|=(255&a.charCodeAt(d))<<24-d%4*8;return new f.init(c,b)}},j=g.Utf8={stringify:function(a){try{return decodeURIComponent(escape(i.stringify(a)))}catch(b){throw new Error("Malformed UTF-8 data")}},parse:function(a){return i.parse(unescape(encodeURIComponent(a)))}},k=d.BufferedBlockAlgorithm=e.extend({reset:function(){this._data=new f.init,this._nDataBytes=0},_append:function(a){"string"==typeof a&&(a=j.parse(a)),this._data.concat(a),this._nDataBytes+=a.sigBytes},_process:function(b){var c=this._data,d=c.words,e=c.sigBytes,g=this.blockSize,h=4*g,i=e/h;i=b?a.ceil(i):a.max((0|i)-this._minBufferSize,0);
var j=i*g,k=a.min(4*j,e);if(j){for(var l=0;j>l;l+=g)this._doProcessBlock(d,l);var m=d.splice(0,j);c.sigBytes-=k}return new f.init(m,k)},clone:function(){var a=e.clone.call(this);return a._data=this._data.clone(),a},_minBufferSize:0}),l=(d.Hasher=k.extend({cfg:e.extend(),init:function(a){this.cfg=this.cfg.extend(a),this.reset()},reset:function(){k.reset.call(this),this._doReset()},update:function(a){return this._append(a),this._process(),this},finalize:function(a){a&&this._append(a);var b=this._doFinalize();return b},blockSize:16,_createHelper:function(a){return function(b,c){return new a.init(c).finalize(b)}},_createHmacHelper:function(a){return function(b,c){return new l.HMAC.init(a,c).finalize(b)}}}),c.algo={});return c}(Math);return a})},{}],39:[function(a,b,c){!function(d,e){"object"==typeof c?b.exports=c=e(a("./core")):"function"==typeof define&&define.amd?define(["./core"],e):e(d.CryptoJS)}(this,function(a){return function(){var b=a,c=b.lib,d=c.WordArray,e=b.enc;e.Base64={stringify:function(a){var b=a.words,c=a.sigBytes,d=this._map;a.clamp();for(var e=[],f=0;c>f;f+=3)for(var g=b[f>>>2]>>>24-f%4*8&255,h=b[f+1>>>2]>>>24-(f+1)%4*8&255,i=b[f+2>>>2]>>>24-(f+2)%4*8&255,j=g<<16|h<<8|i,k=0;4>k&&c>f+.75*k;k++)e.push(d.charAt(j>>>6*(3-k)&63));var l=d.charAt(64);if(l)for(;e.length%4;)e.push(l);return e.join("")},parse:function(a){var b=a.length,c=this._map,e=c.charAt(64);if(e){var f=a.indexOf(e);-1!=f&&(b=f)}for(var g=[],h=0,i=0;b>i;i++)if(i%4){var j=c.indexOf(a.charAt(i-1))<<i%4*2,k=c.indexOf(a.charAt(i))>>>6-i%4*2,l=j|k;g[h>>>2]|=l<<24-h%4*8,h++}return d.create(g,h)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),a.enc.Base64})},{"./core":38}],40:[function(a,b,c){!function(d,e){"object"==typeof c?b.exports=c=e(a("./core")):"function"==typeof define&&define.amd?define(["./core"],e):e(d.CryptoJS)}(this,function(a){return function(){function b(a){return a<<8&4278255360|a>>>8&16711935}var c=a,d=c.lib,e=d.WordArray,f=c.enc;f.Utf16=f.Utf16BE={stringify:function(a){for(var b=a.words,c=a.sigBytes,d=[],e=0;c>e;e+=2){var f=b[e>>>2]>>>16-e%4*8&65535;d.push(String.fromCharCode(f))}return d.join("")},parse:function(a){for(var b=a.length,c=[],d=0;b>d;d++)c[d>>>1]|=a.charCodeAt(d)<<16-d%2*16;return e.create(c,2*b)}};f.Utf16LE={stringify:function(a){for(var c=a.words,d=a.sigBytes,e=[],f=0;d>f;f+=2){var g=b(c[f>>>2]>>>16-f%4*8&65535);e.push(String.fromCharCode(g))}return e.join("")},parse:function(a){for(var c=a.length,d=[],f=0;c>f;f++)d[f>>>1]|=b(a.charCodeAt(f)<<16-f%2*16);return e.create(d,2*c)}}}(),a.enc.Utf16})},{"./core":38}],41:[function(a,b,c){!function(d,e,f){"object"==typeof c?b.exports=c=e(a("./core"),a("./sha1"),a("./hmac")):"function"==typeof define&&define.amd?define(["./core","./sha1","./hmac"],e):e(d.CryptoJS)}(this,function(a){return function(){var b=a,c=b.lib,d=c.Base,e=c.WordArray,f=b.algo,g=f.MD5,h=f.EvpKDF=d.extend({cfg:d.extend({keySize:4,hasher:g,iterations:1}),init:function(a){this.cfg=this.cfg.extend(a)},compute:function(a,b){for(var c=this.cfg,d=c.hasher.create(),f=e.create(),g=f.words,h=c.keySize,i=c.iterations;g.length<h;){j&&d.update(j);var j=d.update(a).finalize(b);d.reset();for(var k=1;i>k;k++)j=d.finalize(j),d.reset();f.concat(j)}return f.sigBytes=4*h,f}});b.EvpKDF=function(a,b,c){return h.create(c).compute(a,b)}}(),a.EvpKDF})},{"./core":38,"./hmac":43,"./sha1":62}],42:[function(a,b,c){!function(d,e,f){"object"==typeof c?b.exports=c=e(a("./core"),a("./cipher-core")):"function"==typeof define&&define.amd?define(["./core","./cipher-core"],e):e(d.CryptoJS)}(this,function(a){return function(b){var c=a,d=c.lib,e=d.CipherParams,f=c.enc,g=f.Hex,h=c.format;h.Hex={stringify:function(a){return a.ciphertext.toString(g)},parse:function(a){var b=g.parse(a);return e.create({ciphertext:b})}}}(),a.format.Hex})},{"./cipher-core":37,"./core":38}],43:[function(a,b,c){!function(d,e){"object"==typeof c?b.exports=c=e(a("./core")):"function"==typeof define&&define.amd?define(["./core"],e):e(d.CryptoJS)}(this,function(a){!function(){var b=a,c=b.lib,d=c.Base,e=b.enc,f=e.Utf8,g=b.algo;g.HMAC=d.extend({init:function(a,b){a=this._hasher=new a.init,"string"==typeof b&&(b=f.parse(b));var c=a.blockSize,d=4*c;b.sigBytes>d&&(b=a.finalize(b)),b.clamp();for(var e=this._oKey=b.clone(),g=this._iKey=b.clone(),h=e.words,i=g.words,j=0;c>j;j++)h[j]^=1549556828,i[j]^=909522486;e.sigBytes=g.sigBytes=d,this.reset()},reset:function(){var a=this._hasher;a.reset(),a.update(this._iKey)},update:function(a){return this._hasher.update(a),this},finalize:function(a){var b=this._hasher,c=b.finalize(a);b.reset();var d=b.finalize(this._oKey.clone().concat(c));return d}})}()})},{"./core":38}],44:[function(a,b,c){!function(d,e,f){"object"==typeof c?b.exports=c=e(a("./core"),a("./x64-core"),a("./lib-typedarrays"),a("./enc-utf16"),a("./enc-base64"),a("./md5"),a("./sha1"),a("./sha256"),a("./sha224"),a("./sha512"),a("./sha384"),a("./sha3"),a("./ripemd160"),a("./hmac"),a("./pbkdf2"),a("./evpkdf"),a("./cipher-core"),a("./mode-cfb"),a("./mode-ctr"),a("./mode-ctr-gladman"),a("./mode-ofb"),a("./mode-ecb"),a("./pad-ansix923"),a("./pad-iso10126"),a("./pad-iso97971"),a("./pad-zeropadding"),a("./pad-nopadding"),a("./format-hex"),a("./aes"),a("./tripledes"),a("./rc4"),a("./rabbit"),a("./rabbit-legacy")):"function"==typeof define&&define.amd?define(["./core","./x64-core","./lib-typedarrays","./enc-utf16","./enc-base64","./md5","./sha1","./sha256","./sha224","./sha512","./sha384","./sha3","./ripemd160","./hmac","./pbkdf2","./evpkdf","./cipher-core","./mode-cfb","./mode-ctr","./mode-ctr-gladman","./mode-ofb","./mode-ecb","./pad-ansix923","./pad-iso10126","./pad-iso97971","./pad-zeropadding","./pad-nopadding","./format-hex","./aes","./tripledes","./rc4","./rabbit","./rabbit-legacy"],e):d.CryptoJS=e(d.CryptoJS)}(this,function(a){return a})},{"./aes":36,"./cipher-core":37,"./core":38,"./enc-base64":39,"./enc-utf16":40,"./evpkdf":41,"./format-hex":42,"./hmac":43,"./lib-typedarrays":45,"./md5":46,"./mode-cfb":47,"./mode-ctr":49,"./mode-ctr-gladman":48,"./mode-ecb":50,"./mode-ofb":51,"./pad-ansix923":52,"./pad-iso10126":53,"./pad-iso97971":54,"./pad-nopadding":55,"./pad-zeropadding":56,"./pbkdf2":57,"./rabbit":59,"./rabbit-legacy":58,"./rc4":60,"./ripemd160":61,"./sha1":62,"./sha224":63,"./sha256":64,"./sha3":65,"./sha384":66,"./sha512":67,"./tripledes":68,"./x64-core":69}],45:[function(a,b,c){!function(d,e){"object"==typeof c?b.exports=c=e(a("./core")):"function"==typeof define&&define.amd?define(["./core"],e):e(d.CryptoJS)}(this,function(a){return function(){if("function"==typeof ArrayBuffer){var b=a,c=b.lib,d=c.WordArray,e=d.init,f=d.init=function(a){if(a instanceof ArrayBuffer&&(a=new Uint8Array(a)),(a instanceof Int8Array||"undefined"!=typeof Uint8ClampedArray&&a instanceof Uint8ClampedArray||a instanceof Int16Array||a instanceof Uint16Array||a instanceof Int32Array||a instanceof Uint32Array||a instanceof Float32Array||a instanceof Float64Array)&&(a=new Uint8Array(a.buffer,a.byteOffset,a.byteLength)),a instanceof Uint8Array){for(var b=a.byteLength,c=[],d=0;b>d;d++)c[d>>>2]|=a[d]<<24-d%4*8;e.call(this,c,b)}else e.apply(this,arguments)};f.prototype=d}}(),a.lib.WordArray})},{"./core":38}],46:[function(a,b,c){!function(d,e){"object"==typeof c?b.exports=c=e(a("./core")):"function"==typeof define&&define.amd?define(["./core"],e):e(d.CryptoJS)}(this,function(a){return function(b){function c(a,b,c,d,e,f,g){var h=a+(b&c|~b&d)+e+g;return(h<<f|h>>>32-f)+b}function d(a,b,c,d,e,f,g){var h=a+(b&d|c&~d)+e+g;return(h<<f|h>>>32-f)+b}function e(a,b,c,d,e,f,g){var h=a+(b^c^d)+e+g;return(h<<f|h>>>32-f)+b}function f(a,b,c,d,e,f,g){var h=a+(c^(b|~d))+e+g;return(h<<f|h>>>32-f)+b}var g=a,h=g.lib,i=h.WordArray,j=h.Hasher,k=g.algo,l=[];!function(){for(var a=0;64>a;a++)l[a]=4294967296*b.abs(b.sin(a+1))|0}();var m=k.MD5=j.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(a,b){for(var g=0;16>g;g++){var h=b+g,i=a[h];a[h]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8)}var j=this._hash.words,k=a[b+0],m=a[b+1],n=a[b+2],o=a[b+3],p=a[b+4],q=a[b+5],r=a[b+6],s=a[b+7],t=a[b+8],u=a[b+9],v=a[b+10],w=a[b+11],x=a[b+12],y=a[b+13],z=a[b+14],A=a[b+15],B=j[0],C=j[1],D=j[2],E=j[3];B=c(B,C,D,E,k,7,l[0]),E=c(E,B,C,D,m,12,l[1]),D=c(D,E,B,C,n,17,l[2]),C=c(C,D,E,B,o,22,l[3]),B=c(B,C,D,E,p,7,l[4]),E=c(E,B,C,D,q,12,l[5]),D=c(D,E,B,C,r,17,l[6]),C=c(C,D,E,B,s,22,l[7]),B=c(B,C,D,E,t,7,l[8]),E=c(E,B,C,D,u,12,l[9]),D=c(D,E,B,C,v,17,l[10]),C=c(C,D,E,B,w,22,l[11]),B=c(B,C,D,E,x,7,l[12]),E=c(E,B,C,D,y,12,l[13]),D=c(D,E,B,C,z,17,l[14]),C=c(C,D,E,B,A,22,l[15]),B=d(B,C,D,E,m,5,l[16]),E=d(E,B,C,D,r,9,l[17]),D=d(D,E,B,C,w,14,l[18]),C=d(C,D,E,B,k,20,l[19]),B=d(B,C,D,E,q,5,l[20]),E=d(E,B,C,D,v,9,l[21]),D=d(D,E,B,C,A,14,l[22]),C=d(C,D,E,B,p,20,l[23]),B=d(B,C,D,E,u,5,l[24]),E=d(E,B,C,D,z,9,l[25]),D=d(D,E,B,C,o,14,l[26]),C=d(C,D,E,B,t,20,l[27]),B=d(B,C,D,E,y,5,l[28]),E=d(E,B,C,D,n,9,l[29]),D=d(D,E,B,C,s,14,l[30]),C=d(C,D,E,B,x,20,l[31]),B=e(B,C,D,E,q,4,l[32]),E=e(E,B,C,D,t,11,l[33]),D=e(D,E,B,C,w,16,l[34]),C=e(C,D,E,B,z,23,l[35]),B=e(B,C,D,E,m,4,l[36]),E=e(E,B,C,D,p,11,l[37]),D=e(D,E,B,C,s,16,l[38]),C=e(C,D,E,B,v,23,l[39]),B=e(B,C,D,E,y,4,l[40]),E=e(E,B,C,D,k,11,l[41]),D=e(D,E,B,C,o,16,l[42]),C=e(C,D,E,B,r,23,l[43]),B=e(B,C,D,E,u,4,l[44]),E=e(E,B,C,D,x,11,l[45]),D=e(D,E,B,C,A,16,l[46]),C=e(C,D,E,B,n,23,l[47]),B=f(B,C,D,E,k,6,l[48]),E=f(E,B,C,D,s,10,l[49]),D=f(D,E,B,C,z,15,l[50]),C=f(C,D,E,B,q,21,l[51]),B=f(B,C,D,E,x,6,l[52]),E=f(E,B,C,D,o,10,l[53]),D=f(D,E,B,C,v,15,l[54]),C=f(C,D,E,B,m,21,l[55]),B=f(B,C,D,E,t,6,l[56]),E=f(E,B,C,D,A,10,l[57]),D=f(D,E,B,C,r,15,l[58]),C=f(C,D,E,B,y,21,l[59]),B=f(B,C,D,E,p,6,l[60]),E=f(E,B,C,D,w,10,l[61]),D=f(D,E,B,C,n,15,l[62]),C=f(C,D,E,B,u,21,l[63]),j[0]=j[0]+B|0,j[1]=j[1]+C|0,j[2]=j[2]+D|0,j[3]=j[3]+E|0},_doFinalize:function(){var a=this._data,c=a.words,d=8*this._nDataBytes,e=8*a.sigBytes;c[e>>>5]|=128<<24-e%32;var f=b.floor(d/4294967296),g=d;c[(e+64>>>9<<4)+15]=16711935&(f<<8|f>>>24)|4278255360&(f<<24|f>>>8),c[(e+64>>>9<<4)+14]=16711935&(g<<8|g>>>24)|4278255360&(g<<24|g>>>8),a.sigBytes=4*(c.length+1),this._process();for(var h=this._hash,i=h.words,j=0;4>j;j++){var k=i[j];i[j]=16711935&(k<<8|k>>>24)|4278255360&(k<<24|k>>>8)}return h},clone:function(){var a=j.clone.call(this);return a._hash=this._hash.clone(),a}});g.MD5=j._createHelper(m),g.HmacMD5=j._createHmacHelper(m)}(Math),a.MD5})},{"./core":38}],47:[function(a,b,c){!function(d,e,f){"object"==typeof c?b.exports=c=e(a("./core"),a("./cipher-core")):"function"==typeof define&&define.amd?define(["./core","./cipher-core"],e):e(d.CryptoJS)}(this,function(a){return a.mode.CFB=function(){function b(a,b,c,d){var e=this._iv;if(e){var f=e.slice(0);this._iv=void 0}else var f=this._prevBlock;d.encryptBlock(f,0);for(var g=0;c>g;g++)a[b+g]^=f[g]}var c=a.lib.BlockCipherMode.extend();return c.Encryptor=c.extend({processBlock:function(a,c){var d=this._cipher,e=d.blockSize;b.call(this,a,c,e,d),this._prevBlock=a.slice(c,c+e)}}),c.Decryptor=c.extend({processBlock:function(a,c){var d=this._cipher,e=d.blockSize,f=a.slice(c,c+e);b.call(this,a,c,e,d),this._prevBlock=f}}),c}(),a.mode.CFB})},{"./cipher-core":37,"./core":38}],48:[function(a,b,c){!function(d,e,f){"object"==typeof c?b.exports=c=e(a("./core"),a("./cipher-core")):"function"==typeof define&&define.amd?define(["./core","./cipher-core"],e):e(d.CryptoJS)}(this,function(a){return a.mode.CTRGladman=function(){function b(a){if(255===(a>>24&255)){var b=a>>16&255,c=a>>8&255,d=255&a;255===b?(b=0,255===c?(c=0,255===d?d=0:++d):++c):++b,a=0,a+=b<<16,a+=c<<8,a+=d}else a+=1<<24;return a}function c(a){return 0===(a[0]=b(a[0]))&&(a[1]=b(a[1])),a}var d=a.lib.BlockCipherMode.extend(),e=d.Encryptor=d.extend({processBlock:function(a,b){var d=this._cipher,e=d.blockSize,f=this._iv,g=this._counter;f&&(g=this._counter=f.slice(0),this._iv=void 0),c(g);var h=g.slice(0);d.encryptBlock(h,0);for(var i=0;e>i;i++)a[b+i]^=h[i]}});return d.Decryptor=e,d}(),a.mode.CTRGladman})},{"./cipher-core":37,"./core":38}],49:[function(a,b,c){!function(d,e,f){"object"==typeof c?b.exports=c=e(a("./core"),a("./cipher-core")):"function"==typeof define&&define.amd?define(["./core","./cipher-core"],e):e(d.CryptoJS)}(this,function(a){return a.mode.CTR=function(){var b=a.lib.BlockCipherMode.extend(),c=b.Encryptor=b.extend({processBlock:function(a,b){var c=this._cipher,d=c.blockSize,e=this._iv,f=this._counter;e&&(f=this._counter=e.slice(0),this._iv=void 0);var g=f.slice(0);c.encryptBlock(g,0),f[d-1]=f[d-1]+1|0;for(var h=0;d>h;h++)a[b+h]^=g[h]}});return b.Decryptor=c,b}(),a.mode.CTR})},{"./cipher-core":37,"./core":38}],50:[function(a,b,c){!function(d,e,f){"object"==typeof c?b.exports=c=e(a("./core"),a("./cipher-core")):"function"==typeof define&&define.amd?define(["./core","./cipher-core"],e):e(d.CryptoJS)}(this,function(a){return a.mode.ECB=function(){var b=a.lib.BlockCipherMode.extend();return b.Encryptor=b.extend({processBlock:function(a,b){this._cipher.encryptBlock(a,b)}}),b.Decryptor=b.extend({processBlock:function(a,b){this._cipher.decryptBlock(a,b)}}),b}(),a.mode.ECB})},{"./cipher-core":37,"./core":38}],51:[function(a,b,c){!function(d,e,f){"object"==typeof c?b.exports=c=e(a("./core"),a("./cipher-core")):"function"==typeof define&&define.amd?define(["./core","./cipher-core"],e):e(d.CryptoJS)}(this,function(a){return a.mode.OFB=function(){var b=a.lib.BlockCipherMode.extend(),c=b.Encryptor=b.extend({processBlock:function(a,b){var c=this._cipher,d=c.blockSize,e=this._iv,f=this._keystream;e&&(f=this._keystream=e.slice(0),this._iv=void 0),c.encryptBlock(f,0);for(var g=0;d>g;g++)a[b+g]^=f[g]}});return b.Decryptor=c,b}(),a.mode.OFB})},{"./cipher-core":37,"./core":38}],52:[function(a,b,c){!function(d,e,f){"object"==typeof c?b.exports=c=e(a("./core"),a("./cipher-core")):"function"==typeof define&&define.amd?define(["./core","./cipher-core"],e):e(d.CryptoJS)}(this,function(a){return a.pad.AnsiX923={pad:function(a,b){var c=a.sigBytes,d=4*b,e=d-c%d,f=c+e-1;a.clamp(),a.words[f>>>2]|=e<<24-f%4*8,a.sigBytes+=e},unpad:function(a){var b=255&a.words[a.sigBytes-1>>>2];a.sigBytes-=b}},a.pad.Ansix923})},{"./cipher-core":37,"./core":38}],53:[function(a,b,c){!function(d,e,f){"object"==typeof c?b.exports=c=e(a("./core"),a("./cipher-core")):"function"==typeof define&&define.amd?define(["./core","./cipher-core"],e):e(d.CryptoJS)}(this,function(a){return a.pad.Iso10126={pad:function(b,c){var d=4*c,e=d-b.sigBytes%d;b.concat(a.lib.WordArray.random(e-1)).concat(a.lib.WordArray.create([e<<24],1))},unpad:function(a){var b=255&a.words[a.sigBytes-1>>>2];a.sigBytes-=b}},a.pad.Iso10126})},{"./cipher-core":37,"./core":38}],54:[function(a,b,c){!function(d,e,f){"object"==typeof c?b.exports=c=e(a("./core"),a("./cipher-core")):"function"==typeof define&&define.amd?define(["./core","./cipher-core"],e):e(d.CryptoJS)}(this,function(a){return a.pad.Iso97971={pad:function(b,c){b.concat(a.lib.WordArray.create([2147483648],1)),a.pad.ZeroPadding.pad(b,c)},unpad:function(b){a.pad.ZeroPadding.unpad(b),b.sigBytes--}},a.pad.Iso97971})},{"./cipher-core":37,"./core":38}],55:[function(a,b,c){!function(d,e,f){"object"==typeof c?b.exports=c=e(a("./core"),a("./cipher-core")):"function"==typeof define&&define.amd?define(["./core","./cipher-core"],e):e(d.CryptoJS)}(this,function(a){return a.pad.NoPadding={pad:function(){},unpad:function(){}},a.pad.NoPadding})},{"./cipher-core":37,"./core":38}],56:[function(a,b,c){!function(d,e,f){"object"==typeof c?b.exports=c=e(a("./core"),a("./cipher-core")):"function"==typeof define&&define.amd?define(["./core","./cipher-core"],e):e(d.CryptoJS)}(this,function(a){return a.pad.ZeroPadding={pad:function(a,b){var c=4*b;a.clamp(),a.sigBytes+=c-(a.sigBytes%c||c)},unpad:function(a){for(var b=a.words,c=a.sigBytes-1;!(b[c>>>2]>>>24-c%4*8&255);)c--;a.sigBytes=c+1}},a.pad.ZeroPadding})},{"./cipher-core":37,"./core":38}],57:[function(a,b,c){!function(d,e,f){"object"==typeof c?b.exports=c=e(a("./core"),a("./sha1"),a("./hmac")):"function"==typeof define&&define.amd?define(["./core","./sha1","./hmac"],e):e(d.CryptoJS)}(this,function(a){return function(){var b=a,c=b.lib,d=c.Base,e=c.WordArray,f=b.algo,g=f.SHA1,h=f.HMAC,i=f.PBKDF2=d.extend({cfg:d.extend({keySize:4,hasher:g,iterations:1}),init:function(a){this.cfg=this.cfg.extend(a)},compute:function(a,b){for(var c=this.cfg,d=h.create(c.hasher,a),f=e.create(),g=e.create([1]),i=f.words,j=g.words,k=c.keySize,l=c.iterations;i.length<k;){var m=d.update(b).finalize(g);d.reset();for(var n=m.words,o=n.length,p=m,q=1;l>q;q++){p=d.finalize(p),d.reset();for(var r=p.words,s=0;o>s;s++)n[s]^=r[s]}f.concat(m),j[0]++}return f.sigBytes=4*k,f}});b.PBKDF2=function(a,b,c){return i.create(c).compute(a,b)}}(),a.PBKDF2})},{"./core":38,"./hmac":43,"./sha1":62}],58:[function(a,b,c){!function(d,e,f){"object"==typeof c?b.exports=c=e(a("./core"),a("./enc-base64"),a("./md5"),a("./evpkdf"),a("./cipher-core")):"function"==typeof define&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(d.CryptoJS)}(this,function(a){return function(){function b(){for(var a=this._X,b=this._C,c=0;8>c;c++)h[c]=b[c];b[0]=b[0]+1295307597+this._b|0,b[1]=b[1]+3545052371+(b[0]>>>0<h[0]>>>0?1:0)|0,b[2]=b[2]+886263092+(b[1]>>>0<h[1]>>>0?1:0)|0,b[3]=b[3]+1295307597+(b[2]>>>0<h[2]>>>0?1:0)|0,b[4]=b[4]+3545052371+(b[3]>>>0<h[3]>>>0?1:0)|0,b[5]=b[5]+886263092+(b[4]>>>0<h[4]>>>0?1:0)|0,b[6]=b[6]+1295307597+(b[5]>>>0<h[5]>>>0?1:0)|0,b[7]=b[7]+3545052371+(b[6]>>>0<h[6]>>>0?1:0)|0,this._b=b[7]>>>0<h[7]>>>0?1:0;for(var c=0;8>c;c++){var d=a[c]+b[c],e=65535&d,f=d>>>16,g=((e*e>>>17)+e*f>>>15)+f*f,j=((4294901760&d)*d|0)+((65535&d)*d|0);i[c]=g^j}a[0]=i[0]+(i[7]<<16|i[7]>>>16)+(i[6]<<16|i[6]>>>16)|0,a[1]=i[1]+(i[0]<<8|i[0]>>>24)+i[7]|0,a[2]=i[2]+(i[1]<<16|i[1]>>>16)+(i[0]<<16|i[0]>>>16)|0,a[3]=i[3]+(i[2]<<8|i[2]>>>24)+i[1]|0,a[4]=i[4]+(i[3]<<16|i[3]>>>16)+(i[2]<<16|i[2]>>>16)|0,a[5]=i[5]+(i[4]<<8|i[4]>>>24)+i[3]|0,a[6]=i[6]+(i[5]<<16|i[5]>>>16)+(i[4]<<16|i[4]>>>16)|0,a[7]=i[7]+(i[6]<<8|i[6]>>>24)+i[5]|0}var c=a,d=c.lib,e=d.StreamCipher,f=c.algo,g=[],h=[],i=[],j=f.RabbitLegacy=e.extend({_doReset:function(){var a=this._key.words,c=this.cfg.iv,d=this._X=[a[0],a[3]<<16|a[2]>>>16,a[1],a[0]<<16|a[3]>>>16,a[2],a[1]<<16|a[0]>>>16,a[3],a[2]<<16|a[1]>>>16],e=this._C=[a[2]<<16|a[2]>>>16,4294901760&a[0]|65535&a[1],a[3]<<16|a[3]>>>16,4294901760&a[1]|65535&a[2],a[0]<<16|a[0]>>>16,4294901760&a[2]|65535&a[3],a[1]<<16|a[1]>>>16,4294901760&a[3]|65535&a[0]];this._b=0;for(var f=0;4>f;f++)b.call(this);for(var f=0;8>f;f++)e[f]^=d[f+4&7];if(c){var g=c.words,h=g[0],i=g[1],j=16711935&(h<<8|h>>>24)|4278255360&(h<<24|h>>>8),k=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),l=j>>>16|4294901760&k,m=k<<16|65535&j;e[0]^=j,e[1]^=l,e[2]^=k,e[3]^=m,e[4]^=j,e[5]^=l,e[6]^=k,e[7]^=m;for(var f=0;4>f;f++)b.call(this)}},_doProcessBlock:function(a,c){var d=this._X;b.call(this),g[0]=d[0]^d[5]>>>16^d[3]<<16,g[1]=d[2]^d[7]>>>16^d[5]<<16,g[2]=d[4]^d[1]>>>16^d[7]<<16,g[3]=d[6]^d[3]>>>16^d[1]<<16;for(var e=0;4>e;e++)g[e]=16711935&(g[e]<<8|g[e]>>>24)|4278255360&(g[e]<<24|g[e]>>>8),a[c+e]^=g[e]},blockSize:4,ivSize:2});c.RabbitLegacy=e._createHelper(j)}(),a.RabbitLegacy})},{"./cipher-core":37,"./core":38,"./enc-base64":39,"./evpkdf":41,"./md5":46}],59:[function(a,b,c){!function(d,e,f){"object"==typeof c?b.exports=c=e(a("./core"),a("./enc-base64"),a("./md5"),a("./evpkdf"),a("./cipher-core")):"function"==typeof define&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(d.CryptoJS)}(this,function(a){return function(){function b(){for(var a=this._X,b=this._C,c=0;8>c;c++)h[c]=b[c];b[0]=b[0]+1295307597+this._b|0,b[1]=b[1]+3545052371+(b[0]>>>0<h[0]>>>0?1:0)|0,b[2]=b[2]+886263092+(b[1]>>>0<h[1]>>>0?1:0)|0,b[3]=b[3]+1295307597+(b[2]>>>0<h[2]>>>0?1:0)|0,b[4]=b[4]+3545052371+(b[3]>>>0<h[3]>>>0?1:0)|0,b[5]=b[5]+886263092+(b[4]>>>0<h[4]>>>0?1:0)|0,b[6]=b[6]+1295307597+(b[5]>>>0<h[5]>>>0?1:0)|0,b[7]=b[7]+3545052371+(b[6]>>>0<h[6]>>>0?1:0)|0,this._b=b[7]>>>0<h[7]>>>0?1:0;for(var c=0;8>c;c++){var d=a[c]+b[c],e=65535&d,f=d>>>16,g=((e*e>>>17)+e*f>>>15)+f*f,j=((4294901760&d)*d|0)+((65535&d)*d|0);i[c]=g^j}a[0]=i[0]+(i[7]<<16|i[7]>>>16)+(i[6]<<16|i[6]>>>16)|0,a[1]=i[1]+(i[0]<<8|i[0]>>>24)+i[7]|0,a[2]=i[2]+(i[1]<<16|i[1]>>>16)+(i[0]<<16|i[0]>>>16)|0,a[3]=i[3]+(i[2]<<8|i[2]>>>24)+i[1]|0,a[4]=i[4]+(i[3]<<16|i[3]>>>16)+(i[2]<<16|i[2]>>>16)|0,a[5]=i[5]+(i[4]<<8|i[4]>>>24)+i[3]|0,a[6]=i[6]+(i[5]<<16|i[5]>>>16)+(i[4]<<16|i[4]>>>16)|0,a[7]=i[7]+(i[6]<<8|i[6]>>>24)+i[5]|0}var c=a,d=c.lib,e=d.StreamCipher,f=c.algo,g=[],h=[],i=[],j=f.Rabbit=e.extend({_doReset:function(){for(var a=this._key.words,c=this.cfg.iv,d=0;4>d;d++)a[d]=16711935&(a[d]<<8|a[d]>>>24)|4278255360&(a[d]<<24|a[d]>>>8);var e=this._X=[a[0],a[3]<<16|a[2]>>>16,a[1],a[0]<<16|a[3]>>>16,a[2],a[1]<<16|a[0]>>>16,a[3],a[2]<<16|a[1]>>>16],f=this._C=[a[2]<<16|a[2]>>>16,4294901760&a[0]|65535&a[1],a[3]<<16|a[3]>>>16,4294901760&a[1]|65535&a[2],a[0]<<16|a[0]>>>16,4294901760&a[2]|65535&a[3],a[1]<<16|a[1]>>>16,4294901760&a[3]|65535&a[0]];this._b=0;for(var d=0;4>d;d++)b.call(this);for(var d=0;8>d;d++)f[d]^=e[d+4&7];if(c){var g=c.words,h=g[0],i=g[1],j=16711935&(h<<8|h>>>24)|4278255360&(h<<24|h>>>8),k=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),l=j>>>16|4294901760&k,m=k<<16|65535&j;f[0]^=j,f[1]^=l,f[2]^=k,f[3]^=m,f[4]^=j,f[5]^=l,f[6]^=k,f[7]^=m;for(var d=0;4>d;d++)b.call(this)}},_doProcessBlock:function(a,c){var d=this._X;b.call(this),g[0]=d[0]^d[5]>>>16^d[3]<<16,g[1]=d[2]^d[7]>>>16^d[5]<<16,g[2]=d[4]^d[1]>>>16^d[7]<<16,g[3]=d[6]^d[3]>>>16^d[1]<<16;for(var e=0;4>e;e++)g[e]=16711935&(g[e]<<8|g[e]>>>24)|4278255360&(g[e]<<24|g[e]>>>8),a[c+e]^=g[e]},blockSize:4,ivSize:2});c.Rabbit=e._createHelper(j)}(),a.Rabbit})},{"./cipher-core":37,"./core":38,"./enc-base64":39,"./evpkdf":41,"./md5":46}],60:[function(a,b,c){!function(d,e,f){"object"==typeof c?b.exports=c=e(a("./core"),a("./enc-base64"),a("./md5"),a("./evpkdf"),a("./cipher-core")):"function"==typeof define&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(d.CryptoJS)}(this,function(a){return function(){function b(){for(var a=this._S,b=this._i,c=this._j,d=0,e=0;4>e;e++){b=(b+1)%256,c=(c+a[b])%256;var f=a[b];a[b]=a[c],a[c]=f,d|=a[(a[b]+a[c])%256]<<24-8*e}return this._i=b,this._j=c,d}var c=a,d=c.lib,e=d.StreamCipher,f=c.algo,g=f.RC4=e.extend({_doReset:function(){for(var a=this._key,b=a.words,c=a.sigBytes,d=this._S=[],e=0;256>e;e++)d[e]=e;for(var e=0,f=0;256>e;e++){var g=e%c,h=b[g>>>2]>>>24-g%4*8&255;f=(f+d[e]+h)%256;var i=d[e];d[e]=d[f],d[f]=i}this._i=this._j=0},_doProcessBlock:function(a,c){a[c]^=b.call(this)},keySize:8,ivSize:0});c.RC4=e._createHelper(g);var h=f.RC4Drop=g.extend({cfg:g.cfg.extend({drop:192}),_doReset:function(){g._doReset.call(this);for(var a=this.cfg.drop;a>0;a--)b.call(this)}});c.RC4Drop=e._createHelper(h)}(),a.RC4})},{"./cipher-core":37,"./core":38,"./enc-base64":39,"./evpkdf":41,"./md5":46}],61:[function(a,b,c){!function(d,e){"object"==typeof c?b.exports=c=e(a("./core")):"function"==typeof define&&define.amd?define(["./core"],e):e(d.CryptoJS)}(this,function(a){return function(b){function c(a,b,c){return a^b^c}function d(a,b,c){return a&b|~a&c}function e(a,b,c){return(a|~b)^c}function f(a,b,c){return a&c|b&~c}function g(a,b,c){return a^(b|~c)}function h(a,b){return a<<b|a>>>32-b}var i=a,j=i.lib,k=j.WordArray,l=j.Hasher,m=i.algo,n=k.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),o=k.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),p=k.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),q=k.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),r=k.create([0,1518500249,1859775393,2400959708,2840853838]),s=k.create([1352829926,1548603684,1836072691,2053994217,0]),t=m.RIPEMD160=l.extend({_doReset:function(){this._hash=k.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(a,b){for(var i=0;16>i;i++){var j=b+i,k=a[j];a[j]=16711935&(k<<8|k>>>24)|4278255360&(k<<24|k>>>8)}var l,m,t,u,v,w,x,y,z,A,B=this._hash.words,C=r.words,D=s.words,E=n.words,F=o.words,G=p.words,H=q.words;w=l=B[0],x=m=B[1],y=t=B[2],z=u=B[3],A=v=B[4];for(var I,i=0;80>i;i+=1)I=l+a[b+E[i]]|0,I+=16>i?c(m,t,u)+C[0]:32>i?d(m,t,u)+C[1]:48>i?e(m,t,u)+C[2]:64>i?f(m,t,u)+C[3]:g(m,t,u)+C[4],I=0|I,I=h(I,G[i]),I=I+v|0,l=v,v=u,u=h(t,10),t=m,m=I,I=w+a[b+F[i]]|0,I+=16>i?g(x,y,z)+D[0]:32>i?f(x,y,z)+D[1]:48>i?e(x,y,z)+D[2]:64>i?d(x,y,z)+D[3]:c(x,y,z)+D[4],I=0|I,I=h(I,H[i]),I=I+A|0,w=A,A=z,z=h(y,10),y=x,x=I;I=B[1]+t+z|0,B[1]=B[2]+u+A|0,B[2]=B[3]+v+w|0,B[3]=B[4]+l+x|0,B[4]=B[0]+m+y|0,B[0]=I},_doFinalize:function(){var a=this._data,b=a.words,c=8*this._nDataBytes,d=8*a.sigBytes;b[d>>>5]|=128<<24-d%32,b[(d+64>>>9<<4)+14]=16711935&(c<<8|c>>>24)|4278255360&(c<<24|c>>>8),a.sigBytes=4*(b.length+1),this._process();for(var e=this._hash,f=e.words,g=0;5>g;g++){var h=f[g];f[g]=16711935&(h<<8|h>>>24)|4278255360&(h<<24|h>>>8)}return e},clone:function(){var a=l.clone.call(this);return a._hash=this._hash.clone(),a}});i.RIPEMD160=l._createHelper(t),i.HmacRIPEMD160=l._createHmacHelper(t)}(Math),a.RIPEMD160})},{"./core":38}],62:[function(a,b,c){!function(d,e){"object"==typeof c?b.exports=c=e(a("./core")):"function"==typeof define&&define.amd?define(["./core"],e):e(d.CryptoJS)}(this,function(a){return function(){var b=a,c=b.lib,d=c.WordArray,e=c.Hasher,f=b.algo,g=[],h=f.SHA1=e.extend({_doReset:function(){this._hash=new d.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(a,b){for(var c=this._hash.words,d=c[0],e=c[1],f=c[2],h=c[3],i=c[4],j=0;80>j;j++){if(16>j)g[j]=0|a[b+j];else{var k=g[j-3]^g[j-8]^g[j-14]^g[j-16];g[j]=k<<1|k>>>31}var l=(d<<5|d>>>27)+i+g[j];l+=20>j?(e&f|~e&h)+1518500249:40>j?(e^f^h)+1859775393:60>j?(e&f|e&h|f&h)-1894007588:(e^f^h)-899497514,i=h,h=f,f=e<<30|e>>>2,e=d,d=l}c[0]=c[0]+d|0,c[1]=c[1]+e|0,c[2]=c[2]+f|0,c[3]=c[3]+h|0,c[4]=c[4]+i|0},_doFinalize:function(){var a=this._data,b=a.words,c=8*this._nDataBytes,d=8*a.sigBytes;return b[d>>>5]|=128<<24-d%32,b[(d+64>>>9<<4)+14]=Math.floor(c/4294967296),b[(d+64>>>9<<4)+15]=c,a.sigBytes=4*b.length,this._process(),this._hash},clone:function(){var a=e.clone.call(this);return a._hash=this._hash.clone(),a}});b.SHA1=e._createHelper(h),b.HmacSHA1=e._createHmacHelper(h)}(),a.SHA1})},{"./core":38}],63:[function(a,b,c){!function(d,e,f){"object"==typeof c?b.exports=c=e(a("./core"),a("./sha256")):"function"==typeof define&&define.amd?define(["./core","./sha256"],e):e(d.CryptoJS)}(this,function(a){return function(){var b=a,c=b.lib,d=c.WordArray,e=b.algo,f=e.SHA256,g=e.SHA224=f.extend({_doReset:function(){this._hash=new d.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var a=f._doFinalize.call(this);return a.sigBytes-=4,a}});b.SHA224=f._createHelper(g),b.HmacSHA224=f._createHmacHelper(g)}(),a.SHA224})},{"./core":38,"./sha256":64}],64:[function(a,b,c){!function(d,e){"object"==typeof c?b.exports=c=e(a("./core")):"function"==typeof define&&define.amd?define(["./core"],e):e(d.CryptoJS)}(this,function(a){return function(b){var c=a,d=c.lib,e=d.WordArray,f=d.Hasher,g=c.algo,h=[],i=[];!function(){function a(a){for(var c=b.sqrt(a),d=2;c>=d;d++)if(!(a%d))return!1;return!0}function c(a){return 4294967296*(a-(0|a))|0}for(var d=2,e=0;64>e;)a(d)&&(8>e&&(h[e]=c(b.pow(d,.5))),i[e]=c(b.pow(d,1/3)),e++),d++}();var j=[],k=g.SHA256=f.extend({_doReset:function(){this._hash=new e.init(h.slice(0))},_doProcessBlock:function(a,b){for(var c=this._hash.words,d=c[0],e=c[1],f=c[2],g=c[3],h=c[4],k=c[5],l=c[6],m=c[7],n=0;64>n;n++){if(16>n)j[n]=0|a[b+n];else{var o=j[n-15],p=(o<<25|o>>>7)^(o<<14|o>>>18)^o>>>3,q=j[n-2],r=(q<<15|q>>>17)^(q<<13|q>>>19)^q>>>10;j[n]=p+j[n-7]+r+j[n-16]}var s=h&k^~h&l,t=d&e^d&f^e&f,u=(d<<30|d>>>2)^(d<<19|d>>>13)^(d<<10|d>>>22),v=(h<<26|h>>>6)^(h<<21|h>>>11)^(h<<7|h>>>25),w=m+v+s+i[n]+j[n],x=u+t;m=l,l=k,k=h,h=g+w|0,g=f,f=e,e=d,d=w+x|0}c[0]=c[0]+d|0,c[1]=c[1]+e|0,c[2]=c[2]+f|0,c[3]=c[3]+g|0,c[4]=c[4]+h|0,c[5]=c[5]+k|0,c[6]=c[6]+l|0,c[7]=c[7]+m|0},_doFinalize:function(){var a=this._data,c=a.words,d=8*this._nDataBytes,e=8*a.sigBytes;return c[e>>>5]|=128<<24-e%32,c[(e+64>>>9<<4)+14]=b.floor(d/4294967296),c[(e+64>>>9<<4)+15]=d,a.sigBytes=4*c.length,this._process(),this._hash},clone:function(){var a=f.clone.call(this);return a._hash=this._hash.clone(),a}});c.SHA256=f._createHelper(k),c.HmacSHA256=f._createHmacHelper(k)}(Math),a.SHA256})},{"./core":38}],65:[function(a,b,c){!function(d,e,f){"object"==typeof c?b.exports=c=e(a("./core"),a("./x64-core")):"function"==typeof define&&define.amd?define(["./core","./x64-core"],e):e(d.CryptoJS)}(this,function(a){return function(b){var c=a,d=c.lib,e=d.WordArray,f=d.Hasher,g=c.x64,h=g.Word,i=c.algo,j=[],k=[],l=[];!function(){for(var a=1,b=0,c=0;24>c;c++){j[a+5*b]=(c+1)*(c+2)/2%64;var d=b%5,e=(2*a+3*b)%5;a=d,b=e}for(var a=0;5>a;a++)for(var b=0;5>b;b++)k[a+5*b]=b+(2*a+3*b)%5*5;for(var f=1,g=0;24>g;g++){for(var i=0,m=0,n=0;7>n;n++){if(1&f){var o=(1<<n)-1;32>o?m^=1<<o:i^=1<<o-32}128&f?f=f<<1^113:f<<=1}l[g]=h.create(i,m)}}();var m=[];!function(){for(var a=0;25>a;a++)m[a]=h.create()}();var n=i.SHA3=f.extend({cfg:f.cfg.extend({outputLength:512}),_doReset:function(){for(var a=this._state=[],b=0;25>b;b++)a[b]=new h.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(a,b){for(var c=this._state,d=this.blockSize/2,e=0;d>e;e++){var f=a[b+2*e],g=a[b+2*e+1];f=16711935&(f<<8|f>>>24)|4278255360&(f<<24|f>>>8),g=16711935&(g<<8|g>>>24)|4278255360&(g<<24|g>>>8);var h=c[e];h.high^=g,h.low^=f}for(var i=0;24>i;i++){for(var n=0;5>n;n++){for(var o=0,p=0,q=0;5>q;q++){var h=c[n+5*q];o^=h.high,p^=h.low}var r=m[n];r.high=o,r.low=p}for(var n=0;5>n;n++)for(var s=m[(n+4)%5],t=m[(n+1)%5],u=t.high,v=t.low,o=s.high^(u<<1|v>>>31),p=s.low^(v<<1|u>>>31),q=0;5>q;q++){var h=c[n+5*q];h.high^=o,h.low^=p}for(var w=1;25>w;w++){var h=c[w],x=h.high,y=h.low,z=j[w];if(32>z)var o=x<<z|y>>>32-z,p=y<<z|x>>>32-z;else var o=y<<z-32|x>>>64-z,p=x<<z-32|y>>>64-z;var A=m[k[w]];A.high=o,A.low=p}var B=m[0],C=c[0];B.high=C.high,B.low=C.low;for(var n=0;5>n;n++)for(var q=0;5>q;q++){var w=n+5*q,h=c[w],D=m[w],E=m[(n+1)%5+5*q],F=m[(n+2)%5+5*q];h.high=D.high^~E.high&F.high,h.low=D.low^~E.low&F.low}var h=c[0],G=l[i];h.high^=G.high,h.low^=G.low}},_doFinalize:function(){var a=this._data,c=a.words,d=(8*this._nDataBytes,8*a.sigBytes),f=32*this.blockSize;c[d>>>5]|=1<<24-d%32,c[(b.ceil((d+1)/f)*f>>>5)-1]|=128,a.sigBytes=4*c.length,this._process();for(var g=this._state,h=this.cfg.outputLength/8,i=h/8,j=[],k=0;i>k;k++){var l=g[k],m=l.high,n=l.low;m=16711935&(m<<8|m>>>24)|4278255360&(m<<24|m>>>8),n=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),j.push(n),j.push(m)}return new e.init(j,h)},clone:function(){for(var a=f.clone.call(this),b=a._state=this._state.slice(0),c=0;25>c;c++)b[c]=b[c].clone();return a}});c.SHA3=f._createHelper(n),c.HmacSHA3=f._createHmacHelper(n)}(Math),a.SHA3})},{"./core":38,"./x64-core":69}],66:[function(a,b,c){!function(d,e,f){"object"==typeof c?b.exports=c=e(a("./core"),a("./x64-core"),a("./sha512")):"function"==typeof define&&define.amd?define(["./core","./x64-core","./sha512"],e):e(d.CryptoJS)}(this,function(a){return function(){var b=a,c=b.x64,d=c.Word,e=c.WordArray,f=b.algo,g=f.SHA512,h=f.SHA384=g.extend({_doReset:function(){this._hash=new e.init([new d.init(3418070365,3238371032),new d.init(1654270250,914150663),new d.init(2438529370,812702999),new d.init(355462360,4144912697),new d.init(1731405415,4290775857),new d.init(2394180231,1750603025),new d.init(3675008525,1694076839),new d.init(1203062813,3204075428)]);
},_doFinalize:function(){var a=g._doFinalize.call(this);return a.sigBytes-=16,a}});b.SHA384=g._createHelper(h),b.HmacSHA384=g._createHmacHelper(h)}(),a.SHA384})},{"./core":38,"./sha512":67,"./x64-core":69}],67:[function(a,b,c){!function(d,e,f){"object"==typeof c?b.exports=c=e(a("./core"),a("./x64-core")):"function"==typeof define&&define.amd?define(["./core","./x64-core"],e):e(d.CryptoJS)}(this,function(a){return function(){function b(){return g.create.apply(g,arguments)}var c=a,d=c.lib,e=d.Hasher,f=c.x64,g=f.Word,h=f.WordArray,i=c.algo,j=[b(1116352408,3609767458),b(1899447441,602891725),b(3049323471,3964484399),b(3921009573,2173295548),b(961987163,4081628472),b(1508970993,3053834265),b(2453635748,2937671579),b(2870763221,3664609560),b(3624381080,2734883394),b(310598401,1164996542),b(607225278,1323610764),b(1426881987,3590304994),b(1925078388,4068182383),b(2162078206,991336113),b(2614888103,633803317),b(3248222580,3479774868),b(3835390401,2666613458),b(4022224774,944711139),b(264347078,2341262773),b(604807628,2007800933),b(770255983,1495990901),b(1249150122,1856431235),b(1555081692,3175218132),b(1996064986,2198950837),b(2554220882,3999719339),b(2821834349,766784016),b(2952996808,2566594879),b(3210313671,3203337956),b(3336571891,1034457026),b(3584528711,2466948901),b(113926993,3758326383),b(338241895,168717936),b(666307205,1188179964),b(773529912,1546045734),b(1294757372,1522805485),b(1396182291,2643833823),b(1695183700,2343527390),b(1986661051,1014477480),b(2177026350,1206759142),b(2456956037,344077627),b(2730485921,1290863460),b(2820302411,3158454273),b(3259730800,3505952657),b(3345764771,106217008),b(3516065817,3606008344),b(3600352804,1432725776),b(4094571909,1467031594),b(275423344,851169720),b(430227734,3100823752),b(506948616,1363258195),b(659060556,3750685593),b(883997877,3785050280),b(958139571,3318307427),b(1322822218,3812723403),b(1537002063,2003034995),b(1747873779,3602036899),b(1955562222,1575990012),b(2024104815,1125592928),b(2227730452,2716904306),b(2361852424,442776044),b(2428436474,593698344),b(2756734187,3733110249),b(3204031479,2999351573),b(3329325298,3815920427),b(3391569614,3928383900),b(3515267271,566280711),b(3940187606,3454069534),b(4118630271,4000239992),b(116418474,1914138554),b(174292421,2731055270),b(289380356,3203993006),b(460393269,320620315),b(685471733,587496836),b(852142971,1086792851),b(1017036298,365543100),b(1126000580,2618297676),b(1288033470,3409855158),b(1501505948,4234509866),b(1607167915,987167468),b(1816402316,1246189591)],k=[];!function(){for(var a=0;80>a;a++)k[a]=b()}();var l=i.SHA512=e.extend({_doReset:function(){this._hash=new h.init([new g.init(1779033703,4089235720),new g.init(3144134277,2227873595),new g.init(1013904242,4271175723),new g.init(2773480762,1595750129),new g.init(1359893119,2917565137),new g.init(2600822924,725511199),new g.init(528734635,4215389547),new g.init(1541459225,327033209)])},_doProcessBlock:function(a,b){for(var c=this._hash.words,d=c[0],e=c[1],f=c[2],g=c[3],h=c[4],i=c[5],l=c[6],m=c[7],n=d.high,o=d.low,p=e.high,q=e.low,r=f.high,s=f.low,t=g.high,u=g.low,v=h.high,w=h.low,x=i.high,y=i.low,z=l.high,A=l.low,B=m.high,C=m.low,D=n,E=o,F=p,G=q,H=r,I=s,J=t,K=u,L=v,M=w,N=x,O=y,P=z,Q=A,R=B,S=C,T=0;80>T;T++){var U=k[T];if(16>T)var V=U.high=0|a[b+2*T],W=U.low=0|a[b+2*T+1];else{var X=k[T-15],Y=X.high,Z=X.low,$=(Y>>>1|Z<<31)^(Y>>>8|Z<<24)^Y>>>7,_=(Z>>>1|Y<<31)^(Z>>>8|Y<<24)^(Z>>>7|Y<<25),aa=k[T-2],ba=aa.high,ca=aa.low,da=(ba>>>19|ca<<13)^(ba<<3|ca>>>29)^ba>>>6,ea=(ca>>>19|ba<<13)^(ca<<3|ba>>>29)^(ca>>>6|ba<<26),fa=k[T-7],ga=fa.high,ha=fa.low,ia=k[T-16],ja=ia.high,ka=ia.low,W=_+ha,V=$+ga+(_>>>0>W>>>0?1:0),W=W+ea,V=V+da+(ea>>>0>W>>>0?1:0),W=W+ka,V=V+ja+(ka>>>0>W>>>0?1:0);U.high=V,U.low=W}var la=L&N^~L&P,ma=M&O^~M&Q,na=D&F^D&H^F&H,oa=E&G^E&I^G&I,pa=(D>>>28|E<<4)^(D<<30|E>>>2)^(D<<25|E>>>7),qa=(E>>>28|D<<4)^(E<<30|D>>>2)^(E<<25|D>>>7),ra=(L>>>14|M<<18)^(L>>>18|M<<14)^(L<<23|M>>>9),sa=(M>>>14|L<<18)^(M>>>18|L<<14)^(M<<23|L>>>9),ta=j[T],ua=ta.high,va=ta.low,wa=S+sa,xa=R+ra+(S>>>0>wa>>>0?1:0),wa=wa+ma,xa=xa+la+(ma>>>0>wa>>>0?1:0),wa=wa+va,xa=xa+ua+(va>>>0>wa>>>0?1:0),wa=wa+W,xa=xa+V+(W>>>0>wa>>>0?1:0),ya=qa+oa,za=pa+na+(qa>>>0>ya>>>0?1:0);R=P,S=Q,P=N,Q=O,N=L,O=M,M=K+wa|0,L=J+xa+(K>>>0>M>>>0?1:0)|0,J=H,K=I,H=F,I=G,F=D,G=E,E=wa+ya|0,D=xa+za+(wa>>>0>E>>>0?1:0)|0}o=d.low=o+E,d.high=n+D+(E>>>0>o>>>0?1:0),q=e.low=q+G,e.high=p+F+(G>>>0>q>>>0?1:0),s=f.low=s+I,f.high=r+H+(I>>>0>s>>>0?1:0),u=g.low=u+K,g.high=t+J+(K>>>0>u>>>0?1:0),w=h.low=w+M,h.high=v+L+(M>>>0>w>>>0?1:0),y=i.low=y+O,i.high=x+N+(O>>>0>y>>>0?1:0),A=l.low=A+Q,l.high=z+P+(Q>>>0>A>>>0?1:0),C=m.low=C+S,m.high=B+R+(S>>>0>C>>>0?1:0)},_doFinalize:function(){var a=this._data,b=a.words,c=8*this._nDataBytes,d=8*a.sigBytes;b[d>>>5]|=128<<24-d%32,b[(d+128>>>10<<5)+30]=Math.floor(c/4294967296),b[(d+128>>>10<<5)+31]=c,a.sigBytes=4*b.length,this._process();var e=this._hash.toX32();return e},clone:function(){var a=e.clone.call(this);return a._hash=this._hash.clone(),a},blockSize:32});c.SHA512=e._createHelper(l),c.HmacSHA512=e._createHmacHelper(l)}(),a.SHA512})},{"./core":38,"./x64-core":69}],68:[function(a,b,c){!function(d,e,f){"object"==typeof c?b.exports=c=e(a("./core"),a("./enc-base64"),a("./md5"),a("./evpkdf"),a("./cipher-core")):"function"==typeof define&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(d.CryptoJS)}(this,function(a){return function(){function b(a,b){var c=(this._lBlock>>>a^this._rBlock)&b;this._rBlock^=c,this._lBlock^=c<<a}function c(a,b){var c=(this._rBlock>>>a^this._lBlock)&b;this._lBlock^=c,this._rBlock^=c<<a}var d=a,e=d.lib,f=e.WordArray,g=e.BlockCipher,h=d.algo,i=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],j=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],k=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],l=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],m=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],n=h.DES=g.extend({_doReset:function(){for(var a=this._key,b=a.words,c=[],d=0;56>d;d++){var e=i[d]-1;c[d]=b[e>>>5]>>>31-e%32&1}for(var f=this._subKeys=[],g=0;16>g;g++){for(var h=f[g]=[],l=k[g],d=0;24>d;d++)h[d/6|0]|=c[(j[d]-1+l)%28]<<31-d%6,h[4+(d/6|0)]|=c[28+(j[d+24]-1+l)%28]<<31-d%6;h[0]=h[0]<<1|h[0]>>>31;for(var d=1;7>d;d++)h[d]=h[d]>>>4*(d-1)+3;h[7]=h[7]<<5|h[7]>>>27}for(var m=this._invSubKeys=[],d=0;16>d;d++)m[d]=f[15-d]},encryptBlock:function(a,b){this._doCryptBlock(a,b,this._subKeys)},decryptBlock:function(a,b){this._doCryptBlock(a,b,this._invSubKeys)},_doCryptBlock:function(a,d,e){this._lBlock=a[d],this._rBlock=a[d+1],b.call(this,4,252645135),b.call(this,16,65535),c.call(this,2,858993459),c.call(this,8,16711935),b.call(this,1,1431655765);for(var f=0;16>f;f++){for(var g=e[f],h=this._lBlock,i=this._rBlock,j=0,k=0;8>k;k++)j|=l[k][((i^g[k])&m[k])>>>0];this._lBlock=i,this._rBlock=h^j}var n=this._lBlock;this._lBlock=this._rBlock,this._rBlock=n,b.call(this,1,1431655765),c.call(this,8,16711935),c.call(this,2,858993459),b.call(this,16,65535),b.call(this,4,252645135),a[d]=this._lBlock,a[d+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});d.DES=g._createHelper(n);var o=h.TripleDES=g.extend({_doReset:function(){var a=this._key,b=a.words;this._des1=n.createEncryptor(f.create(b.slice(0,2))),this._des2=n.createEncryptor(f.create(b.slice(2,4))),this._des3=n.createEncryptor(f.create(b.slice(4,6)))},encryptBlock:function(a,b){this._des1.encryptBlock(a,b),this._des2.decryptBlock(a,b),this._des3.encryptBlock(a,b)},decryptBlock:function(a,b){this._des3.decryptBlock(a,b),this._des2.encryptBlock(a,b),this._des1.decryptBlock(a,b)},keySize:6,ivSize:2,blockSize:2});d.TripleDES=g._createHelper(o)}(),a.TripleDES})},{"./cipher-core":37,"./core":38,"./enc-base64":39,"./evpkdf":41,"./md5":46}],69:[function(a,b,c){!function(d,e){"object"==typeof c?b.exports=c=e(a("./core")):"function"==typeof define&&define.amd?define(["./core"],e):e(d.CryptoJS)}(this,function(a){return function(b){var c=a,d=c.lib,e=d.Base,f=d.WordArray,g=c.x64={};g.Word=e.extend({init:function(a,b){this.high=a,this.low=b}}),g.WordArray=e.extend({init:function(a,c){a=this.words=a||[],c!=b?this.sigBytes=c:this.sigBytes=8*a.length},toX32:function(){for(var a=this.words,b=a.length,c=[],d=0;b>d;d++){var e=a[d];c.push(e.high),c.push(e.low)}return f.create(c,this.sigBytes)},clone:function(){for(var a=e.clone.call(this),b=a.words=this.words.slice(0),c=b.length,d=0;c>d;d++)b[d]=b[d].clone();return a}})}(),a})},{"./core":38}],70:[function(a,b,c){(function(a,d){!function(){var b,c,e,f;!function(){var a={},d={};b=function(b,c,d){a[b]={deps:c,callback:d}},f=e=c=function(b){function e(a){if("."!==a.charAt(0))return a;for(var c=a.split("/"),d=b.split("/").slice(0,-1),e=0,f=c.length;f>e;e++){var g=c[e];if(".."===g)d.pop();else{if("."===g)continue;d.push(g)}}return d.join("/")}if(f._eak_seen=a,d[b])return d[b];if(d[b]={},!a[b])throw new Error("Could not find module "+b);for(var g,h=a[b],i=h.deps,j=h.callback,k=[],l=0,m=i.length;m>l;l++)"exports"===i[l]?k.push(g={}):k.push(c(e(i[l])));var n=j.apply(this,k);return d[b]=g||n}}(),b("promise/all",["./utils","exports"],function(a,b){"use strict";function c(a){var b=this;if(!d(a))throw new TypeError("You must pass an array to all.");return new b(function(b,c){function d(a){return function(b){f(a,b)}}function f(a,c){h[a]=c,0===--i&&b(h)}var g,h=[],i=a.length;0===i&&b([]);for(var j=0;j<a.length;j++)g=a[j],g&&e(g.then)?g.then(d(j),c):f(j,g)})}var d=a.isArray,e=a.isFunction;b.all=c}),b("promise/asap",["exports"],function(b){"use strict";function c(){return function(){a.nextTick(g)}}function e(){var a=0,b=new k(g),c=document.createTextNode("");return b.observe(c,{characterData:!0}),function(){c.data=a=++a%2}}function f(){return function(){l.setTimeout(g,1)}}function g(){for(var a=0;a<m.length;a++){var b=m[a],c=b[0],d=b[1];c(d)}m=[]}function h(a,b){var c=m.push([a,b]);1===c&&i()}var i,j="undefined"!=typeof window?window:{},k=j.MutationObserver||j.WebKitMutationObserver,l="undefined"!=typeof d?d:void 0===this?window:this,m=[];i="undefined"!=typeof a&&"[object process]"==={}.toString.call(a)?c():k?e():f(),b.asap=h}),b("promise/config",["exports"],function(a){"use strict";function b(a,b){return 2!==arguments.length?c[a]:void(c[a]=b)}var c={instrument:!1};a.config=c,a.configure=b}),b("promise/polyfill",["./promise","./utils","exports"],function(a,b,c){"use strict";function e(){var a;a="undefined"!=typeof d?d:"undefined"!=typeof window&&window.document?window:self;var b="Promise"in a&&"resolve"in a.Promise&&"reject"in a.Promise&&"all"in a.Promise&&"race"in a.Promise&&function(){var b;return new a.Promise(function(a){b=a}),g(b)}();b||(a.Promise=f)}var f=a.Promise,g=b.isFunction;c.polyfill=e}),b("promise/promise",["./config","./utils","./all","./race","./resolve","./reject","./asap","exports"],function(a,b,c,d,e,f,g,h){"use strict";function i(a){if(!v(a))throw new TypeError("You must pass a resolver function as the first argument to the promise constructor");if(!(this instanceof i))throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");this._subscribers=[],j(a,this)}function j(a,b){function c(a){o(b,a)}function d(a){q(b,a)}try{a(c,d)}catch(e){d(e)}}function k(a,b,c,d){var e,f,g,h,i=v(c);if(i)try{e=c(d),g=!0}catch(j){h=!0,f=j}else e=d,g=!0;n(b,e)||(i&&g?o(b,e):h?q(b,f):a===D?o(b,e):a===E&&q(b,e))}function l(a,b,c,d){var e=a._subscribers,f=e.length;e[f]=b,e[f+D]=c,e[f+E]=d}function m(a,b){for(var c,d,e=a._subscribers,f=a._detail,g=0;g<e.length;g+=3)c=e[g],d=e[g+b],k(b,c,d,f);a._subscribers=null}function n(a,b){var c,d=null;try{if(a===b)throw new TypeError("A promises callback cannot return that same promise.");if(u(b)&&(d=b.then,v(d)))return d.call(b,function(d){return c?!0:(c=!0,void(b!==d?o(a,d):p(a,d)))},function(b){return c?!0:(c=!0,void q(a,b))}),!0}catch(e){return c?!0:(q(a,e),!0)}return!1}function o(a,b){a===b?p(a,b):n(a,b)||p(a,b)}function p(a,b){a._state===B&&(a._state=C,a._detail=b,t.async(r,a))}function q(a,b){a._state===B&&(a._state=C,a._detail=b,t.async(s,a))}function r(a){m(a,a._state=D)}function s(a){m(a,a._state=E)}var t=a.config,u=(a.configure,b.objectOrFunction),v=b.isFunction,w=(b.now,c.all),x=d.race,y=e.resolve,z=f.reject,A=g.asap;t.async=A;var B=void 0,C=0,D=1,E=2;i.prototype={constructor:i,_state:void 0,_detail:void 0,_subscribers:void 0,then:function(a,b){var c=this,d=new this.constructor(function(){});if(this._state){var e=arguments;t.async(function(){k(c._state,d,e[c._state-1],c._detail)})}else l(this,d,a,b);return d},"catch":function(a){return this.then(null,a)}},i.all=w,i.race=x,i.resolve=y,i.reject=z,h.Promise=i}),b("promise/race",["./utils","exports"],function(a,b){"use strict";function c(a){var b=this;if(!d(a))throw new TypeError("You must pass an array to race.");return new b(function(b,c){for(var d,e=0;e<a.length;e++)d=a[e],d&&"function"==typeof d.then?d.then(b,c):b(d)})}var d=a.isArray;b.race=c}),b("promise/reject",["exports"],function(a){"use strict";function b(a){var b=this;return new b(function(b,c){c(a)})}a.reject=b}),b("promise/resolve",["exports"],function(a){"use strict";function b(a){if(a&&"object"==typeof a&&a.constructor===this)return a;var b=this;return new b(function(b){b(a)})}a.resolve=b}),b("promise/utils",["exports"],function(a){"use strict";function b(a){return c(a)||"object"==typeof a&&null!==a}function c(a){return"function"==typeof a}function d(a){return"[object Array]"===Object.prototype.toString.call(a)}var e=Date.now||function(){return(new Date).getTime()};a.objectOrFunction=b,a.isFunction=c,a.isArray=d,a.now=e}),c("promise/polyfill").polyfill()}(),function(a,d){"object"==typeof c&&"object"==typeof b?b.exports=d():"function"==typeof define&&define.amd?define([],d):"object"==typeof c?c.localforage=d():a.localforage=d()}(this,function(){return function(a){function b(d){if(c[d])return c[d].exports;var e=c[d]={exports:{},id:d,loaded:!1};return a[d].call(e.exports,e,e.exports,b),e.loaded=!0,e.exports}var c={};return b.m=a,b.c=c,b.p="",b(0)}([function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}b.__esModule=!0;var e=function(a){function b(a,b){a[b]=function(){var c=arguments;return a.ready().then(function(){return a[b].apply(a,c)})}}function e(){for(var a=1;a<arguments.length;a++){var b=arguments[a];if(b)for(var c in b)b.hasOwnProperty(c)&&(m(b[c])?arguments[0][c]=b[c].slice():arguments[0][c]=b[c])}return arguments[0]}function f(a){for(var b in h)if(h.hasOwnProperty(b)&&h[b]===a)return!0;return!1}var g={},h={INDEXEDDB:"asyncStorage",LOCALSTORAGE:"localStorageWrapper",WEBSQL:"webSQLStorage"},i=[h.INDEXEDDB,h.WEBSQL,h.LOCALSTORAGE],j=["clear","getItem","iterate","key","keys","length","removeItem","setItem"],k={description:"",driver:i.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1},l=function(a){var b={};return b[h.INDEXEDDB]=!!function(){try{var b=b||a.indexedDB||a.webkitIndexedDB||a.mozIndexedDB||a.OIndexedDB||a.msIndexedDB;return"undefined"!=typeof a.openDatabase&&a.navigator&&a.navigator.userAgent&&/Safari/.test(a.navigator.userAgent)&&!/Chrome/.test(a.navigator.userAgent)?!1:b&&"function"==typeof b.open&&"undefined"!=typeof a.IDBKeyRange}catch(c){return!1}}(),b[h.WEBSQL]=!!function(){try{return a.openDatabase}catch(b){return!1}}(),b[h.LOCALSTORAGE]=!!function(){try{return a.localStorage&&"setItem"in a.localStorage&&a.localStorage.setItem}catch(b){return!1}}(),b}(a),m=Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)},n=function(){function a(b){d(this,a),this.INDEXEDDB=h.INDEXEDDB,this.LOCALSTORAGE=h.LOCALSTORAGE,this.WEBSQL=h.WEBSQL,this._defaultConfig=e({},k),this._config=e({},this._defaultConfig,b),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver)}return a.prototype.config=function(a){if("object"==typeof a){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var b in a)"storeName"===b&&(a[b]=a[b].replace(/\W/g,"_")),this._config[b]=a[b];return"driver"in a&&a.driver&&this.setDriver(this._config.driver),!0}return"string"==typeof a?this._config[a]:this._config},a.prototype.defineDriver=function(a,b,c){var d=new Promise(function(b,c){try{var d=a._driver,e=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver"),h=new Error("Custom driver name already in use: "+a._driver);if(!a._driver)return void c(e);if(f(a._driver))return void c(h);for(var i=j.concat("_initStorage"),k=0;k<i.length;k++){var m=i[k];if(!m||!a[m]||"function"!=typeof a[m])return void c(e)}var n=Promise.resolve(!0);"_support"in a&&(n=a._support&&"function"==typeof a._support?a._support():Promise.resolve(!!a._support)),n.then(function(c){l[d]=c,g[d]=a,b()},c)}catch(o){c(o)}});return d.then(b,c),d},a.prototype.driver=function(){return this._driver||null},a.prototype.getDriver=function(a,b,d){var e=this,h=function(){if(f(a))switch(a){case e.INDEXEDDB:return new Promise(function(a,b){a(c(1))});case e.LOCALSTORAGE:return new Promise(function(a,b){a(c(2))});case e.WEBSQL:return new Promise(function(a,b){a(c(4))})}else if(g[a])return Promise.resolve(g[a]);return Promise.reject(new Error("Driver not found."))}();return h.then(b,d),h},a.prototype.getSerializer=function(a){var b=new Promise(function(a,b){a(c(3))});return a&&"function"==typeof a&&b.then(function(b){a(b)}),b},a.prototype.ready=function(a){var b=this,c=b._driverSet.then(function(){return null===b._ready&&(b._ready=b._initDriver()),b._ready});return c.then(a,a),c},a.prototype.setDriver=function(a,b,c){function d(){f._config.driver=f.driver()}function e(a){return function(){function b(){for(;c<a.length;){var e=a[c];return c++,f._dbInfo=null,f._ready=null,f.getDriver(e).then(function(a){return f._extend(a),d(),f._ready=f._initStorage(f._config),f._ready})["catch"](b)}d();var g=new Error("No available storage method found.");return f._driverSet=Promise.reject(g),f._driverSet}var c=0;return b()}}var f=this;m(a)||(a=[a]);var g=this._getSupportedDrivers(a),h=null!==this._driverSet?this._driverSet["catch"](function(){return Promise.resolve()}):Promise.resolve();return this._driverSet=h.then(function(){var a=g[0];return f._dbInfo=null,f._ready=null,f.getDriver(a).then(function(a){f._driver=a._driver,d(),f._wrapLibraryMethodsWithReady(),f._initDriver=e(g)})})["catch"](function(){d();var a=new Error("No available storage method found.");return f._driverSet=Promise.reject(a),f._driverSet}),this._driverSet.then(b,c),this._driverSet},a.prototype.supports=function(a){return!!l[a]},a.prototype._extend=function(a){e(this,a)},a.prototype._getSupportedDrivers=function(a){for(var b=[],c=0,d=a.length;d>c;c++){var e=a[c];this.supports(e)&&b.push(e)}return b},a.prototype._wrapLibraryMethodsWithReady=function(){for(var a=0;a<j.length;a++)b(this,j[a])},a.prototype.createInstance=function(b){return new a(b)},a}();return new n}("undefined"!=typeof window?window:self);b["default"]=e,a.exports=b["default"]},function(a,b){"use strict";b.__esModule=!0;var c=function(a){function b(b,c){b=b||[],c=c||{};try{return new Blob(b,c)}catch(d){if("TypeError"!==d.name)throw d;for(var e=a.BlobBuilder||a.MSBlobBuilder||a.MozBlobBuilder||a.WebKitBlobBuilder,f=new e,g=0;g<b.length;g+=1)f.append(b[g]);return f.getBlob(c.type)}}function c(a){for(var b=a.length,c=new ArrayBuffer(b),d=new Uint8Array(c),e=0;b>e;e++)d[e]=a.charCodeAt(e);return c}function d(a){return new Promise(function(b,c){var d=new XMLHttpRequest;d.open("GET",a),d.withCredentials=!0,d.responseType="arraybuffer",d.onreadystatechange=function(){return 4===d.readyState?200===d.status?b({response:d.response,type:d.getResponseHeader("Content-Type")}):void c({status:d.status,response:d.response}):void 0},d.send()})}function e(a){return new Promise(function(c,e){var f=b([""],{type:"image/png"}),g=a.transaction([D],"readwrite");g.objectStore(D).put(f,"key"),g.oncomplete=function(){var b=a.transaction([D],"readwrite"),f=b.objectStore(D).get("key");f.onerror=e,f.onsuccess=function(a){var b=a.target.result,e=URL.createObjectURL(b);d(e).then(function(a){c(!(!a||"image/png"!==a.type))},function(){c(!1)}).then(function(){URL.revokeObjectURL(e)})}},g.onerror=g.onabort=e})["catch"](function(){return!1})}function f(a){return"boolean"==typeof B?Promise.resolve(B):e(a).then(function(a){return B=a})}function g(a){return new Promise(function(b,c){var d=new FileReader;d.onerror=c,d.onloadend=function(c){var d=btoa(c.target.result||"");b({__local_forage_encoded_blob:!0,data:d,type:a.type})},d.readAsBinaryString(a)})}function h(a){var d=c(atob(a.data));return b([d],{type:a.type})}function i(a){return a&&a.__local_forage_encoded_blob}function j(a){var b=this,c=b._initReady().then(function(){var a=C[b._dbInfo.name];return a&&a.dbReady?a.dbReady:void 0});return c.then(a,a),c}function k(a){var b=C[a.name],c={};c.promise=new Promise(function(a){c.resolve=a}),b.deferredOperations.push(c),b.dbReady?b.dbReady=b.dbReady.then(function(){return c.promise}):b.dbReady=c.promise}function l(a){var b=C[a.name],c=b.deferredOperations.pop();c&&c.resolve()}function m(a){function b(){return Promise.resolve()}var c=this,d={db:null};if(a)for(var e in a)d[e]=a[e];C||(C={});var f=C[d.name];f||(f={forages:[],db:null,dbReady:null,deferredOperations:[]},C[d.name]=f),f.forages.push(c),c._initReady||(c._initReady=c.ready,c.ready=j);for(var g=[],h=0;h<f.forages.length;h++){var i=f.forages[h];i!==c&&g.push(i._initReady()["catch"](b))}var k=f.forages.slice(0);return Promise.all(g).then(function(){return d.db=f.db,n(d)}).then(function(a){return d.db=a,q(d,c._defaultConfig.version)?o(d):a}).then(function(a){d.db=f.db=a,c._dbInfo=d;for(var b=0;b<k.length;b++){var e=k[b];e!==c&&(e._dbInfo.db=d.db,e._dbInfo.version=d.version)}})}function n(a){return p(a,!1)}function o(a){return p(a,!0)}function p(b,c){return new Promise(function(d,e){if(b.db){if(!c)return d(b.db);k(b),b.db.close()}var f=[b.name];c&&f.push(b.version);var g=A.open.apply(A,f);c&&(g.onupgradeneeded=function(c){var d=g.result;try{d.createObjectStore(b.storeName),c.oldVersion<=1&&d.createObjectStore(D)}catch(e){if("ConstraintError"!==e.name)throw e;a.console.warn('The database "'+b.name+'" has been upgraded from version '+c.oldVersion+" to version "+c.newVersion+', but the storage "'+b.storeName+'" already exists.')}}),g.onerror=function(){e(g.error)},g.onsuccess=function(){d(g.result),l(b)}})}function q(b,c){if(!b.db)return!0;var d=!b.db.objectStoreNames.contains(b.storeName),e=b.version<b.db.version,f=b.version>b.db.version;if(e&&(b.version!==c&&a.console.warn('The database "'+b.name+"\" can't be downgraded from version "+b.db.version+" to version "+b.version+"."),b.version=b.db.version),f||d){if(d){var g=b.db.version+1;g>b.version&&(b.version=g)}return!0}return!1}function r(b,c){var d=this;"string"!=typeof b&&(a.console.warn(b+" used as a key, but it is not a string."),b=String(b));var e=new Promise(function(a,c){d.ready().then(function(){var e=d._dbInfo,f=e.db.transaction(e.storeName,"readonly").objectStore(e.storeName),g=f.get(b);g.onsuccess=function(){var b=g.result;void 0===b&&(b=null),i(b)&&(b=h(b)),a(b)},g.onerror=function(){c(g.error)}})["catch"](c)});return z(e,c),e}function s(a,b){var c=this,d=new Promise(function(b,d){c.ready().then(function(){var e=c._dbInfo,f=e.db.transaction(e.storeName,"readonly").objectStore(e.storeName),g=f.openCursor(),j=1;g.onsuccess=function(){var c=g.result;if(c){var d=c.value;i(d)&&(d=h(d));var e=a(d,c.key,j++);void 0!==e?b(e):c["continue"]()}else b()},g.onerror=function(){d(g.error)}})["catch"](d)});return z(d,b),d}function t(b,c,d){var e=this;"string"!=typeof b&&(a.console.warn(b+" used as a key, but it is not a string."),b=String(b));var h=new Promise(function(a,d){var h;e.ready().then(function(){return h=e._dbInfo,c instanceof Blob?f(h.db).then(function(a){return a?c:g(c)}):c}).then(function(c){var e=h.db.transaction(h.storeName,"readwrite"),f=e.objectStore(h.storeName);null===c&&(c=void 0),e.oncomplete=function(){void 0===c&&(c=null),a(c)},e.onabort=e.onerror=function(){var a=g.error?g.error:g.transaction.error;d(a)};var g=f.put(c,b)})["catch"](d)});return z(h,d),h}function u(b,c){var d=this;"string"!=typeof b&&(a.console.warn(b+" used as a key, but it is not a string."),
b=String(b));var e=new Promise(function(a,c){d.ready().then(function(){var e=d._dbInfo,f=e.db.transaction(e.storeName,"readwrite"),g=f.objectStore(e.storeName),h=g["delete"](b);f.oncomplete=function(){a()},f.onerror=function(){c(h.error)},f.onabort=function(){var a=h.error?h.error:h.transaction.error;c(a)}})["catch"](c)});return z(e,c),e}function v(a){var b=this,c=new Promise(function(a,c){b.ready().then(function(){var d=b._dbInfo,e=d.db.transaction(d.storeName,"readwrite"),f=e.objectStore(d.storeName),g=f.clear();e.oncomplete=function(){a()},e.onabort=e.onerror=function(){var a=g.error?g.error:g.transaction.error;c(a)}})["catch"](c)});return z(c,a),c}function w(a){var b=this,c=new Promise(function(a,c){b.ready().then(function(){var d=b._dbInfo,e=d.db.transaction(d.storeName,"readonly").objectStore(d.storeName),f=e.count();f.onsuccess=function(){a(f.result)},f.onerror=function(){c(f.error)}})["catch"](c)});return z(c,a),c}function x(a,b){var c=this,d=new Promise(function(b,d){return 0>a?void b(null):void c.ready().then(function(){var e=c._dbInfo,f=e.db.transaction(e.storeName,"readonly").objectStore(e.storeName),g=!1,h=f.openCursor();h.onsuccess=function(){var c=h.result;return c?void(0===a?b(c.key):g?b(c.key):(g=!0,c.advance(a))):void b(null)},h.onerror=function(){d(h.error)}})["catch"](d)});return z(d,b),d}function y(a){var b=this,c=new Promise(function(a,c){b.ready().then(function(){var d=b._dbInfo,e=d.db.transaction(d.storeName,"readonly").objectStore(d.storeName),f=e.openCursor(),g=[];f.onsuccess=function(){var b=f.result;return b?(g.push(b.key),void b["continue"]()):void a(g)},f.onerror=function(){c(f.error)}})["catch"](c)});return z(c,a),c}function z(a,b){b&&a.then(function(a){b(null,a)},function(a){b(a)})}var A=A||a.indexedDB||a.webkitIndexedDB||a.mozIndexedDB||a.OIndexedDB||a.msIndexedDB;if(A){var B,C,D="local-forage-detect-blob-support",E={_driver:"asyncStorage",_initStorage:m,iterate:s,getItem:r,setItem:t,removeItem:u,clear:v,length:w,key:x,keys:y};return E}}("undefined"!=typeof window?window:self);b["default"]=c,a.exports=b["default"]},function(a,b,c){"use strict";b.__esModule=!0;var d=function(a){function b(a){var b=this,d={};if(a)for(var e in a)d[e]=a[e];return d.keyPrefix=d.name+"/",d.storeName!==b._defaultConfig.storeName&&(d.keyPrefix+=d.storeName+"/"),b._dbInfo=d,new Promise(function(a,b){a(c(3))}).then(function(a){return d.serializer=a,Promise.resolve()})}function d(a){var b=this,c=b.ready().then(function(){for(var a=b._dbInfo.keyPrefix,c=m.length-1;c>=0;c--){var d=m.key(c);0===d.indexOf(a)&&m.removeItem(d)}});return l(c,a),c}function e(b,c){var d=this;"string"!=typeof b&&(a.console.warn(b+" used as a key, but it is not a string."),b=String(b));var e=d.ready().then(function(){var a=d._dbInfo,c=m.getItem(a.keyPrefix+b);return c&&(c=a.serializer.deserialize(c)),c});return l(e,c),e}function f(a,b){var c=this,d=c.ready().then(function(){for(var b=c._dbInfo,d=b.keyPrefix,e=d.length,f=m.length,g=1,h=0;f>h;h++){var i=m.key(h);if(0===i.indexOf(d)){var j=m.getItem(i);if(j&&(j=b.serializer.deserialize(j)),j=a(j,i.substring(e),g++),void 0!==j)return j}}});return l(d,b),d}function g(a,b){var c=this,d=c.ready().then(function(){var b,d=c._dbInfo;try{b=m.key(a)}catch(e){b=null}return b&&(b=b.substring(d.keyPrefix.length)),b});return l(d,b),d}function h(a){var b=this,c=b.ready().then(function(){for(var a=b._dbInfo,c=m.length,d=[],e=0;c>e;e++)0===m.key(e).indexOf(a.keyPrefix)&&d.push(m.key(e).substring(a.keyPrefix.length));return d});return l(c,a),c}function i(a){var b=this,c=b.keys().then(function(a){return a.length});return l(c,a),c}function j(b,c){var d=this;"string"!=typeof b&&(a.console.warn(b+" used as a key, but it is not a string."),b=String(b));var e=d.ready().then(function(){var a=d._dbInfo;m.removeItem(a.keyPrefix+b)});return l(e,c),e}function k(b,c,d){var e=this;"string"!=typeof b&&(a.console.warn(b+" used as a key, but it is not a string."),b=String(b));var f=e.ready().then(function(){void 0===c&&(c=null);var a=c;return new Promise(function(d,f){var g=e._dbInfo;g.serializer.serialize(c,function(c,e){if(e)f(e);else try{m.setItem(g.keyPrefix+b,c),d(a)}catch(h){"QuotaExceededError"!==h.name&&"NS_ERROR_DOM_QUOTA_REACHED"!==h.name||f(h),f(h)}})})});return l(f,d),f}function l(a,b){b&&a.then(function(a){b(null,a)},function(a){b(a)})}var m=null;try{if(!(a.localStorage&&"setItem"in a.localStorage))return;m=a.localStorage}catch(n){return}var o={_driver:"localStorageWrapper",_initStorage:b,iterate:f,getItem:e,setItem:k,removeItem:j,clear:d,length:i,key:g,keys:h};return o}("undefined"!=typeof window?window:self);b["default"]=d,a.exports=b["default"]},function(a,b){"use strict";b.__esModule=!0;var c=function(a){function b(b,c){b=b||[],c=c||{};try{return new Blob(b,c)}catch(d){if("TypeError"!==d.name)throw d;for(var e=a.BlobBuilder||a.MSBlobBuilder||a.MozBlobBuilder||a.WebKitBlobBuilder,f=new e,g=0;g<b.length;g+=1)f.append(b[g]);return f.getBlob(c.type)}}function c(a,b){var c="";if(a&&(c=a.toString()),a&&("[object ArrayBuffer]"===a.toString()||a.buffer&&"[object ArrayBuffer]"===a.buffer.toString())){var d,e=j;a instanceof ArrayBuffer?(d=a,e+=l):(d=a.buffer,"[object Int8Array]"===c?e+=n:"[object Uint8Array]"===c?e+=o:"[object Uint8ClampedArray]"===c?e+=p:"[object Int16Array]"===c?e+=q:"[object Uint16Array]"===c?e+=s:"[object Int32Array]"===c?e+=r:"[object Uint32Array]"===c?e+=t:"[object Float32Array]"===c?e+=u:"[object Float64Array]"===c?e+=v:b(new Error("Failed to get type for BinaryArray"))),b(e+f(d))}else if("[object Blob]"===c){var g=new FileReader;g.onload=function(){var c=h+a.type+"~"+f(this.result);b(j+m+c)},g.readAsArrayBuffer(a)}else try{b(JSON.stringify(a))}catch(i){console.error("Couldn't convert value into a JSON string: ",a),b(null,i)}}function d(a){if(a.substring(0,k)!==j)return JSON.parse(a);var c,d=a.substring(w),f=a.substring(k,w);if(f===m&&i.test(d)){var g=d.match(i);c=g[1],d=d.substring(g[0].length)}var h=e(d);switch(f){case l:return h;case m:return b([h],{type:c});case n:return new Int8Array(h);case o:return new Uint8Array(h);case p:return new Uint8ClampedArray(h);case q:return new Int16Array(h);case s:return new Uint16Array(h);case r:return new Int32Array(h);case t:return new Uint32Array(h);case u:return new Float32Array(h);case v:return new Float64Array(h);default:throw new Error("Unkown type: "+f)}}function e(a){var b,c,d,e,f,h=.75*a.length,i=a.length,j=0;"="===a[a.length-1]&&(h--,"="===a[a.length-2]&&h--);var k=new ArrayBuffer(h),l=new Uint8Array(k);for(b=0;i>b;b+=4)c=g.indexOf(a[b]),d=g.indexOf(a[b+1]),e=g.indexOf(a[b+2]),f=g.indexOf(a[b+3]),l[j++]=c<<2|d>>4,l[j++]=(15&d)<<4|e>>2,l[j++]=(3&e)<<6|63&f;return k}function f(a){var b,c=new Uint8Array(a),d="";for(b=0;b<c.length;b+=3)d+=g[c[b]>>2],d+=g[(3&c[b])<<4|c[b+1]>>4],d+=g[(15&c[b+1])<<2|c[b+2]>>6],d+=g[63&c[b+2]];return c.length%3===2?d=d.substring(0,d.length-1)+"=":c.length%3===1&&(d=d.substring(0,d.length-2)+"=="),d}var g="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",h="~~local_forage_type~",i=/^~~local_forage_type~([^~]+)~/,j="__lfsc__:",k=j.length,l="arbf",m="blob",n="si08",o="ui08",p="uic8",q="si16",r="si32",s="ur16",t="ui32",u="fl32",v="fl64",w=k+l.length,x={serialize:c,deserialize:d,stringToBuffer:e,bufferToString:f};return x}("undefined"!=typeof window?window:self);b["default"]=c,a.exports=b["default"]},function(a,b,c){"use strict";b.__esModule=!0;var d=function(a){function b(a){var b=this,d={db:null};if(a)for(var e in a)d[e]="string"!=typeof a[e]?a[e].toString():a[e];var f=new Promise(function(a,c){try{d.db=m(d.name,String(d.version),d.description,d.size)}catch(e){return c(e)}d.db.transaction(function(e){e.executeSql("CREATE TABLE IF NOT EXISTS "+d.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],function(){b._dbInfo=d,a()},function(a,b){c(b)})})});return new Promise(function(a,b){a(c(3))}).then(function(a){return d.serializer=a,f})}function d(b,c){var d=this;"string"!=typeof b&&(a.console.warn(b+" used as a key, but it is not a string."),b=String(b));var e=new Promise(function(a,c){d.ready().then(function(){var e=d._dbInfo;e.db.transaction(function(d){d.executeSql("SELECT * FROM "+e.storeName+" WHERE key = ? LIMIT 1",[b],function(b,c){var d=c.rows.length?c.rows.item(0).value:null;d&&(d=e.serializer.deserialize(d)),a(d)},function(a,b){c(b)})})})["catch"](c)});return l(e,c),e}function e(a,b){var c=this,d=new Promise(function(b,d){c.ready().then(function(){var e=c._dbInfo;e.db.transaction(function(c){c.executeSql("SELECT * FROM "+e.storeName,[],function(c,d){for(var f=d.rows,g=f.length,h=0;g>h;h++){var i=f.item(h),j=i.value;if(j&&(j=e.serializer.deserialize(j)),j=a(j,i.key,h+1),void 0!==j)return void b(j)}b()},function(a,b){d(b)})})})["catch"](d)});return l(d,b),d}function f(b,c,d){var e=this;"string"!=typeof b&&(a.console.warn(b+" used as a key, but it is not a string."),b=String(b));var f=new Promise(function(a,d){e.ready().then(function(){void 0===c&&(c=null);var f=c,g=e._dbInfo;g.serializer.serialize(c,function(c,e){e?d(e):g.db.transaction(function(e){e.executeSql("INSERT OR REPLACE INTO "+g.storeName+" (key, value) VALUES (?, ?)",[b,c],function(){a(f)},function(a,b){d(b)})},function(a){a.code===a.QUOTA_ERR&&d(a)})})})["catch"](d)});return l(f,d),f}function g(b,c){var d=this;"string"!=typeof b&&(a.console.warn(b+" used as a key, but it is not a string."),b=String(b));var e=new Promise(function(a,c){d.ready().then(function(){var e=d._dbInfo;e.db.transaction(function(d){d.executeSql("DELETE FROM "+e.storeName+" WHERE key = ?",[b],function(){a()},function(a,b){c(b)})})})["catch"](c)});return l(e,c),e}function h(a){var b=this,c=new Promise(function(a,c){b.ready().then(function(){var d=b._dbInfo;d.db.transaction(function(b){b.executeSql("DELETE FROM "+d.storeName,[],function(){a()},function(a,b){c(b)})})})["catch"](c)});return l(c,a),c}function i(a){var b=this,c=new Promise(function(a,c){b.ready().then(function(){var d=b._dbInfo;d.db.transaction(function(b){b.executeSql("SELECT COUNT(key) as c FROM "+d.storeName,[],function(b,c){var d=c.rows.item(0).c;a(d)},function(a,b){c(b)})})})["catch"](c)});return l(c,a),c}function j(a,b){var c=this,d=new Promise(function(b,d){c.ready().then(function(){var e=c._dbInfo;e.db.transaction(function(c){c.executeSql("SELECT key FROM "+e.storeName+" WHERE id = ? LIMIT 1",[a+1],function(a,c){var d=c.rows.length?c.rows.item(0).key:null;b(d)},function(a,b){d(b)})})})["catch"](d)});return l(d,b),d}function k(a){var b=this,c=new Promise(function(a,c){b.ready().then(function(){var d=b._dbInfo;d.db.transaction(function(b){b.executeSql("SELECT key FROM "+d.storeName,[],function(b,c){for(var d=[],e=0;e<c.rows.length;e++)d.push(c.rows.item(e).key);a(d)},function(a,b){c(b)})})})["catch"](c)});return l(c,a),c}function l(a,b){b&&a.then(function(a){b(null,a)},function(a){b(a)})}var m=a.openDatabase;if(m){var n={_driver:"webSQLStorage",_initStorage:b,iterate:e,getItem:d,setItem:f,removeItem:g,clear:h,length:i,key:j,keys:k};return n}}("undefined"!=typeof window?window:self);b["default"]=d,a.exports=b["default"]}])})}).call(this,a("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:87}],71:[function(a,b,c){"use strict";var d=a("./lib/utils/common").assign,e=a("./lib/deflate"),f=a("./lib/inflate"),g=a("./lib/zlib/constants"),h={};d(h,e,f,g),b.exports=h},{"./lib/deflate":72,"./lib/inflate":73,"./lib/utils/common":74,"./lib/zlib/constants":77}],72:[function(a,b,c){"use strict";function d(a){if(!(this instanceof d))return new d(a);this.options=i.assign({level:s,method:u,chunkSize:16384,windowBits:15,memLevel:8,strategy:t,to:""},a||{});var b=this.options;b.raw&&b.windowBits>0?b.windowBits=-b.windowBits:b.gzip&&b.windowBits>0&&b.windowBits<16&&(b.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new l,this.strm.avail_out=0;var c=h.deflateInit2(this.strm,b.level,b.method,b.windowBits,b.memLevel,b.strategy);if(c!==p)throw new Error(k[c]);b.header&&h.deflateSetHeader(this.strm,b.header)}function e(a,b){var c=new d(b);if(c.push(a,!0),c.err)throw c.msg;return c.result}function f(a,b){return b=b||{},b.raw=!0,e(a,b)}function g(a,b){return b=b||{},b.gzip=!0,e(a,b)}var h=a("./zlib/deflate"),i=a("./utils/common"),j=a("./utils/strings"),k=a("./zlib/messages"),l=a("./zlib/zstream"),m=Object.prototype.toString,n=0,o=4,p=0,q=1,r=2,s=-1,t=0,u=8;d.prototype.push=function(a,b){var c,d,e=this.strm,f=this.options.chunkSize;if(this.ended)return!1;d=b===~~b?b:b===!0?o:n,"string"==typeof a?e.input=j.string2buf(a):"[object ArrayBuffer]"===m.call(a)?e.input=new Uint8Array(a):e.input=a,e.next_in=0,e.avail_in=e.input.length;do{if(0===e.avail_out&&(e.output=new i.Buf8(f),e.next_out=0,e.avail_out=f),c=h.deflate(e,d),c!==q&&c!==p)return this.onEnd(c),this.ended=!0,!1;0!==e.avail_out&&(0!==e.avail_in||d!==o&&d!==r)||("string"===this.options.to?this.onData(j.buf2binstring(i.shrinkBuf(e.output,e.next_out))):this.onData(i.shrinkBuf(e.output,e.next_out)))}while((e.avail_in>0||0===e.avail_out)&&c!==q);return d===o?(c=h.deflateEnd(this.strm),this.onEnd(c),this.ended=!0,c===p):d===r?(this.onEnd(p),e.avail_out=0,!0):!0},d.prototype.onData=function(a){this.chunks.push(a)},d.prototype.onEnd=function(a){a===p&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=a,this.msg=this.strm.msg},c.Deflate=d,c.deflate=e,c.deflateRaw=f,c.gzip=g},{"./utils/common":74,"./utils/strings":75,"./zlib/deflate":79,"./zlib/messages":84,"./zlib/zstream":86}],73:[function(a,b,c){"use strict";function d(a){if(!(this instanceof d))return new d(a);this.options=h.assign({chunkSize:16384,windowBits:0,to:""},a||{});var b=this.options;b.raw&&b.windowBits>=0&&b.windowBits<16&&(b.windowBits=-b.windowBits,0===b.windowBits&&(b.windowBits=-15)),!(b.windowBits>=0&&b.windowBits<16)||a&&a.windowBits||(b.windowBits+=32),b.windowBits>15&&b.windowBits<48&&0===(15&b.windowBits)&&(b.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new l,this.strm.avail_out=0;var c=g.inflateInit2(this.strm,b.windowBits);if(c!==j.Z_OK)throw new Error(k[c]);this.header=new m,g.inflateGetHeader(this.strm,this.header)}function e(a,b){var c=new d(b);if(c.push(a,!0),c.err)throw c.msg;return c.result}function f(a,b){return b=b||{},b.raw=!0,e(a,b)}var g=a("./zlib/inflate"),h=a("./utils/common"),i=a("./utils/strings"),j=a("./zlib/constants"),k=a("./zlib/messages"),l=a("./zlib/zstream"),m=a("./zlib/gzheader"),n=Object.prototype.toString;d.prototype.push=function(a,b){var c,d,e,f,k,l=this.strm,m=this.options.chunkSize,o=!1;if(this.ended)return!1;d=b===~~b?b:b===!0?j.Z_FINISH:j.Z_NO_FLUSH,"string"==typeof a?l.input=i.binstring2buf(a):"[object ArrayBuffer]"===n.call(a)?l.input=new Uint8Array(a):l.input=a,l.next_in=0,l.avail_in=l.input.length;do{if(0===l.avail_out&&(l.output=new h.Buf8(m),l.next_out=0,l.avail_out=m),c=g.inflate(l,j.Z_NO_FLUSH),c===j.Z_BUF_ERROR&&o===!0&&(c=j.Z_OK,o=!1),c!==j.Z_STREAM_END&&c!==j.Z_OK)return this.onEnd(c),this.ended=!0,!1;l.next_out&&(0!==l.avail_out&&c!==j.Z_STREAM_END&&(0!==l.avail_in||d!==j.Z_FINISH&&d!==j.Z_SYNC_FLUSH)||("string"===this.options.to?(e=i.utf8border(l.output,l.next_out),f=l.next_out-e,k=i.buf2string(l.output,e),l.next_out=f,l.avail_out=m-f,f&&h.arraySet(l.output,l.output,e,f,0),this.onData(k)):this.onData(h.shrinkBuf(l.output,l.next_out)))),0===l.avail_in&&0===l.avail_out&&(o=!0)}while((l.avail_in>0||0===l.avail_out)&&c!==j.Z_STREAM_END);return c===j.Z_STREAM_END&&(d=j.Z_FINISH),d===j.Z_FINISH?(c=g.inflateEnd(this.strm),this.onEnd(c),this.ended=!0,c===j.Z_OK):d===j.Z_SYNC_FLUSH?(this.onEnd(j.Z_OK),l.avail_out=0,!0):!0},d.prototype.onData=function(a){this.chunks.push(a)},d.prototype.onEnd=function(a){a===j.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=h.flattenChunks(this.chunks)),this.chunks=[],this.err=a,this.msg=this.strm.msg},c.Inflate=d,c.inflate=e,c.inflateRaw=f,c.ungzip=e},{"./utils/common":74,"./utils/strings":75,"./zlib/constants":77,"./zlib/gzheader":80,"./zlib/inflate":82,"./zlib/messages":84,"./zlib/zstream":86}],74:[function(a,b,c){"use strict";var d="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;c.assign=function(a){for(var b=Array.prototype.slice.call(arguments,1);b.length;){var c=b.shift();if(c){if("object"!=typeof c)throw new TypeError(c+"must be non-object");for(var d in c)c.hasOwnProperty(d)&&(a[d]=c[d])}}return a},c.shrinkBuf=function(a,b){return a.length===b?a:a.subarray?a.subarray(0,b):(a.length=b,a)};var e={arraySet:function(a,b,c,d,e){if(b.subarray&&a.subarray)return void a.set(b.subarray(c,c+d),e);for(var f=0;d>f;f++)a[e+f]=b[c+f]},flattenChunks:function(a){var b,c,d,e,f,g;for(d=0,b=0,c=a.length;c>b;b++)d+=a[b].length;for(g=new Uint8Array(d),e=0,b=0,c=a.length;c>b;b++)f=a[b],g.set(f,e),e+=f.length;return g}},f={arraySet:function(a,b,c,d,e){for(var f=0;d>f;f++)a[e+f]=b[c+f]},flattenChunks:function(a){return[].concat.apply([],a)}};c.setTyped=function(a){a?(c.Buf8=Uint8Array,c.Buf16=Uint16Array,c.Buf32=Int32Array,c.assign(c,e)):(c.Buf8=Array,c.Buf16=Array,c.Buf32=Array,c.assign(c,f))},c.setTyped(d)},{}],75:[function(a,b,c){"use strict";function d(a,b){if(65537>b&&(a.subarray&&g||!a.subarray&&f))return String.fromCharCode.apply(null,e.shrinkBuf(a,b));for(var c="",d=0;b>d;d++)c+=String.fromCharCode(a[d]);return c}var e=a("./common"),f=!0,g=!0;try{String.fromCharCode.apply(null,[0])}catch(h){f=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(h){g=!1}for(var i=new e.Buf8(256),j=0;256>j;j++)i[j]=j>=252?6:j>=248?5:j>=240?4:j>=224?3:j>=192?2:1;i[254]=i[254]=1,c.string2buf=function(a){var b,c,d,f,g,h=a.length,i=0;for(f=0;h>f;f++)c=a.charCodeAt(f),55296===(64512&c)&&h>f+1&&(d=a.charCodeAt(f+1),56320===(64512&d)&&(c=65536+(c-55296<<10)+(d-56320),f++)),i+=128>c?1:2048>c?2:65536>c?3:4;for(b=new e.Buf8(i),g=0,f=0;i>g;f++)c=a.charCodeAt(f),55296===(64512&c)&&h>f+1&&(d=a.charCodeAt(f+1),56320===(64512&d)&&(c=65536+(c-55296<<10)+(d-56320),f++)),128>c?b[g++]=c:2048>c?(b[g++]=192|c>>>6,b[g++]=128|63&c):65536>c?(b[g++]=224|c>>>12,b[g++]=128|c>>>6&63,b[g++]=128|63&c):(b[g++]=240|c>>>18,b[g++]=128|c>>>12&63,b[g++]=128|c>>>6&63,b[g++]=128|63&c);return b},c.buf2binstring=function(a){return d(a,a.length)},c.binstring2buf=function(a){for(var b=new e.Buf8(a.length),c=0,d=b.length;d>c;c++)b[c]=a.charCodeAt(c);return b},c.buf2string=function(a,b){var c,e,f,g,h=b||a.length,j=new Array(2*h);for(e=0,c=0;h>c;)if(f=a[c++],128>f)j[e++]=f;else if(g=i[f],g>4)j[e++]=65533,c+=g-1;else{for(f&=2===g?31:3===g?15:7;g>1&&h>c;)f=f<<6|63&a[c++],g--;g>1?j[e++]=65533:65536>f?j[e++]=f:(f-=65536,j[e++]=55296|f>>10&1023,j[e++]=56320|1023&f)}return d(j,e)},c.utf8border=function(a,b){var c;for(b=b||a.length,b>a.length&&(b=a.length),c=b-1;c>=0&&128===(192&a[c]);)c--;return 0>c?b:0===c?b:c+i[a[c]]>b?c:b}},{"./common":74}],76:[function(a,b,c){"use strict";function d(a,b,c,d){for(var e=65535&a|0,f=a>>>16&65535|0,g=0;0!==c;){g=c>2e3?2e3:c,c-=g;do e=e+b[d++]|0,f=f+e|0;while(--g);e%=65521,f%=65521}return e|f<<16|0}b.exports=d},{}],77:[function(a,b,c){"use strict";b.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],78:[function(a,b,c){"use strict";function d(){for(var a,b=[],c=0;256>c;c++){a=c;for(var d=0;8>d;d++)a=1&a?3988292384^a>>>1:a>>>1;b[c]=a}return b}function e(a,b,c,d){var e=f,g=d+c;a^=-1;for(var h=d;g>h;h++)a=a>>>8^e[255&(a^b[h])];return-1^a}var f=d();b.exports=e},{}],79:[function(a,b,c){"use strict";function d(a,b){return a.msg=H[b],b}function e(a){return(a<<1)-(a>4?9:0)}function f(a){for(var b=a.length;--b>=0;)a[b]=0}function g(a){var b=a.state,c=b.pending;c>a.avail_out&&(c=a.avail_out),0!==c&&(D.arraySet(a.output,b.pending_buf,b.pending_out,c,a.next_out),a.next_out+=c,b.pending_out+=c,a.total_out+=c,a.avail_out-=c,b.pending-=c,0===b.pending&&(b.pending_out=0))}function h(a,b){E._tr_flush_block(a,a.block_start>=0?a.block_start:-1,a.strstart-a.block_start,b),a.block_start=a.strstart,g(a.strm)}function i(a,b){a.pending_buf[a.pending++]=b}function j(a,b){a.pending_buf[a.pending++]=b>>>8&255,a.pending_buf[a.pending++]=255&b}function k(a,b,c,d){var e=a.avail_in;return e>d&&(e=d),0===e?0:(a.avail_in-=e,D.arraySet(b,a.input,a.next_in,e,c),1===a.state.wrap?a.adler=F(a.adler,b,e,c):2===a.state.wrap&&(a.adler=G(a.adler,b,e,c)),a.next_in+=e,a.total_in+=e,e)}function l(a,b){var c,d,e=a.max_chain_length,f=a.strstart,g=a.prev_length,h=a.nice_match,i=a.strstart>a.w_size-ka?a.strstart-(a.w_size-ka):0,j=a.window,k=a.w_mask,l=a.prev,m=a.strstart+ja,n=j[f+g-1],o=j[f+g];a.prev_length>=a.good_match&&(e>>=2),h>a.lookahead&&(h=a.lookahead);do if(c=b,j[c+g]===o&&j[c+g-1]===n&&j[c]===j[f]&&j[++c]===j[f+1]){f+=2,c++;do;while(j[++f]===j[++c]&&j[++f]===j[++c]&&j[++f]===j[++c]&&j[++f]===j[++c]&&j[++f]===j[++c]&&j[++f]===j[++c]&&j[++f]===j[++c]&&j[++f]===j[++c]&&m>f);if(d=ja-(m-f),f=m-ja,d>g){if(a.match_start=b,g=d,d>=h)break;n=j[f+g-1],o=j[f+g]}}while((b=l[b&k])>i&&0!==--e);return g<=a.lookahead?g:a.lookahead}function m(a){var b,c,d,e,f,g=a.w_size;do{if(e=a.window_size-a.lookahead-a.strstart,a.strstart>=g+(g-ka)){D.arraySet(a.window,a.window,g,g,0),a.match_start-=g,a.strstart-=g,a.block_start-=g,c=a.hash_size,b=c;do d=a.head[--b],a.head[b]=d>=g?d-g:0;while(--c);c=g,b=c;do d=a.prev[--b],a.prev[b]=d>=g?d-g:0;while(--c);e+=g}if(0===a.strm.avail_in)break;if(c=k(a.strm,a.window,a.strstart+a.lookahead,e),a.lookahead+=c,a.lookahead+a.insert>=ia)for(f=a.strstart-a.insert,a.ins_h=a.window[f],a.ins_h=(a.ins_h<<a.hash_shift^a.window[f+1])&a.hash_mask;a.insert&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[f+ia-1])&a.hash_mask,a.prev[f&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=f,f++,a.insert--,!(a.lookahead+a.insert<ia)););}while(a.lookahead<ka&&0!==a.strm.avail_in)}function n(a,b){var c=65535;for(c>a.pending_buf_size-5&&(c=a.pending_buf_size-5);;){if(a.lookahead<=1){if(m(a),0===a.lookahead&&b===I)return ta;if(0===a.lookahead)break}a.strstart+=a.lookahead,a.lookahead=0;var d=a.block_start+c;if((0===a.strstart||a.strstart>=d)&&(a.lookahead=a.strstart-d,a.strstart=d,h(a,!1),0===a.strm.avail_out))return ta;if(a.strstart-a.block_start>=a.w_size-ka&&(h(a,!1),0===a.strm.avail_out))return ta}return a.insert=0,b===L?(h(a,!0),0===a.strm.avail_out?va:wa):a.strstart>a.block_start&&(h(a,!1),0===a.strm.avail_out)?ta:ta}function o(a,b){for(var c,d;;){if(a.lookahead<ka){if(m(a),a.lookahead<ka&&b===I)return ta;if(0===a.lookahead)break}if(c=0,a.lookahead>=ia&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+ia-1])&a.hash_mask,c=a.prev[a.strstart&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart),0!==c&&a.strstart-c<=a.w_size-ka&&(a.match_length=l(a,c)),a.match_length>=ia)if(d=E._tr_tally(a,a.strstart-a.match_start,a.match_length-ia),a.lookahead-=a.match_length,a.match_length<=a.max_lazy_match&&a.lookahead>=ia){a.match_length--;do a.strstart++,a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+ia-1])&a.hash_mask,c=a.prev[a.strstart&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart;while(0!==--a.match_length);a.strstart++}else a.strstart+=a.match_length,a.match_length=0,a.ins_h=a.window[a.strstart],a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+1])&a.hash_mask;else d=E._tr_tally(a,0,a.window[a.strstart]),a.lookahead--,a.strstart++;if(d&&(h(a,!1),0===a.strm.avail_out))return ta}return a.insert=a.strstart<ia-1?a.strstart:ia-1,b===L?(h(a,!0),0===a.strm.avail_out?va:wa):a.last_lit&&(h(a,!1),0===a.strm.avail_out)?ta:ua}function p(a,b){for(var c,d,e;;){if(a.lookahead<ka){if(m(a),a.lookahead<ka&&b===I)return ta;if(0===a.lookahead)break}if(c=0,a.lookahead>=ia&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+ia-1])&a.hash_mask,c=a.prev[a.strstart&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart),a.prev_length=a.match_length,a.prev_match=a.match_start,a.match_length=ia-1,0!==c&&a.prev_length<a.max_lazy_match&&a.strstart-c<=a.w_size-ka&&(a.match_length=l(a,c),a.match_length<=5&&(a.strategy===T||a.match_length===ia&&a.strstart-a.match_start>4096)&&(a.match_length=ia-1)),a.prev_length>=ia&&a.match_length<=a.prev_length){e=a.strstart+a.lookahead-ia,d=E._tr_tally(a,a.strstart-1-a.prev_match,a.prev_length-ia),a.lookahead-=a.prev_length-1,a.prev_length-=2;do++a.strstart<=e&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+ia-1])&a.hash_mask,c=a.prev[a.strstart&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart);while(0!==--a.prev_length);if(a.match_available=0,a.match_length=ia-1,a.strstart++,d&&(h(a,!1),0===a.strm.avail_out))return ta}else if(a.match_available){if(d=E._tr_tally(a,0,a.window[a.strstart-1]),d&&h(a,!1),a.strstart++,a.lookahead--,0===a.strm.avail_out)return ta}else a.match_available=1,a.strstart++,a.lookahead--}return a.match_available&&(d=E._tr_tally(a,0,a.window[a.strstart-1]),a.match_available=0),a.insert=a.strstart<ia-1?a.strstart:ia-1,b===L?(h(a,!0),0===a.strm.avail_out?va:wa):a.last_lit&&(h(a,!1),0===a.strm.avail_out)?ta:ua}function q(a,b){for(var c,d,e,f,g=a.window;;){if(a.lookahead<=ja){if(m(a),a.lookahead<=ja&&b===I)return ta;if(0===a.lookahead)break}if(a.match_length=0,a.lookahead>=ia&&a.strstart>0&&(e=a.strstart-1,d=g[e],d===g[++e]&&d===g[++e]&&d===g[++e])){f=a.strstart+ja;do;while(d===g[++e]&&d===g[++e]&&d===g[++e]&&d===g[++e]&&d===g[++e]&&d===g[++e]&&d===g[++e]&&d===g[++e]&&f>e);a.match_length=ja-(f-e),a.match_length>a.lookahead&&(a.match_length=a.lookahead)}if(a.match_length>=ia?(c=E._tr_tally(a,1,a.match_length-ia),a.lookahead-=a.match_length,a.strstart+=a.match_length,a.match_length=0):(c=E._tr_tally(a,0,a.window[a.strstart]),a.lookahead--,a.strstart++),c&&(h(a,!1),0===a.strm.avail_out))return ta}return a.insert=0,b===L?(h(a,!0),0===a.strm.avail_out?va:wa):a.last_lit&&(h(a,!1),0===a.strm.avail_out)?ta:ua}function r(a,b){for(var c;;){if(0===a.lookahead&&(m(a),0===a.lookahead)){if(b===I)return ta;break}if(a.match_length=0,c=E._tr_tally(a,0,a.window[a.strstart]),a.lookahead--,a.strstart++,c&&(h(a,!1),0===a.strm.avail_out))return ta}return a.insert=0,b===L?(h(a,!0),0===a.strm.avail_out?va:wa):a.last_lit&&(h(a,!1),0===a.strm.avail_out)?ta:ua}function s(a,b,c,d,e){this.good_length=a,this.max_lazy=b,this.nice_length=c,this.max_chain=d,this.func=e}function t(a){a.window_size=2*a.w_size,f(a.head),a.max_lazy_match=C[a.level].max_lazy,a.good_match=C[a.level].good_length,a.nice_match=C[a.level].nice_length,a.max_chain_length=C[a.level].max_chain,a.strstart=0,a.block_start=0,a.lookahead=0,a.insert=0,a.match_length=a.prev_length=ia-1,a.match_available=0,a.ins_h=0}function u(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Z,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new D.Buf16(2*ga),this.dyn_dtree=new D.Buf16(2*(2*ea+1)),this.bl_tree=new D.Buf16(2*(2*fa+1)),f(this.dyn_ltree),f(this.dyn_dtree),f(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new D.Buf16(ha+1),this.heap=new D.Buf16(2*da+1),f(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new D.Buf16(2*da+1),f(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function v(a){var b;return a&&a.state?(a.total_in=a.total_out=0,a.data_type=Y,b=a.state,b.pending=0,b.pending_out=0,b.wrap<0&&(b.wrap=-b.wrap),b.status=b.wrap?ma:ra,a.adler=2===b.wrap?0:1,b.last_flush=I,E._tr_init(b),N):d(a,P)}function w(a){var b=v(a);return b===N&&t(a.state),b}function x(a,b){return a&&a.state?2!==a.state.wrap?P:(a.state.gzhead=b,N):P}function y(a,b,c,e,f,g){if(!a)return P;var h=1;if(b===S&&(b=6),0>e?(h=0,e=-e):e>15&&(h=2,e-=16),1>f||f>$||c!==Z||8>e||e>15||0>b||b>9||0>g||g>W)return d(a,P);8===e&&(e=9);var i=new u;return a.state=i,i.strm=a,i.wrap=h,i.gzhead=null,i.w_bits=e,i.w_size=1<<i.w_bits,i.w_mask=i.w_size-1,i.hash_bits=f+7,i.hash_size=1<<i.hash_bits,i.hash_mask=i.hash_size-1,i.hash_shift=~~((i.hash_bits+ia-1)/ia),i.window=new D.Buf8(2*i.w_size),i.head=new D.Buf16(i.hash_size),i.prev=new D.Buf16(i.w_size),i.lit_bufsize=1<<f+6,i.pending_buf_size=4*i.lit_bufsize,i.pending_buf=new D.Buf8(i.pending_buf_size),i.d_buf=i.lit_bufsize>>1,i.l_buf=3*i.lit_bufsize,i.level=b,i.strategy=g,i.method=c,w(a)}function z(a,b){return y(a,b,Z,_,aa,X)}function A(a,b){var c,h,k,l;if(!a||!a.state||b>M||0>b)return a?d(a,P):P;if(h=a.state,!a.output||!a.input&&0!==a.avail_in||h.status===sa&&b!==L)return d(a,0===a.avail_out?R:P);if(h.strm=a,c=h.last_flush,h.last_flush=b,h.status===ma)if(2===h.wrap)a.adler=0,i(h,31),i(h,139),i(h,8),h.gzhead?(i(h,(h.gzhead.text?1:0)+(h.gzhead.hcrc?2:0)+(h.gzhead.extra?4:0)+(h.gzhead.name?8:0)+(h.gzhead.comment?16:0)),i(h,255&h.gzhead.time),i(h,h.gzhead.time>>8&255),i(h,h.gzhead.time>>16&255),i(h,h.gzhead.time>>24&255),i(h,9===h.level?2:h.strategy>=U||h.level<2?4:0),i(h,255&h.gzhead.os),h.gzhead.extra&&h.gzhead.extra.length&&(i(h,255&h.gzhead.extra.length),i(h,h.gzhead.extra.length>>8&255)),h.gzhead.hcrc&&(a.adler=G(a.adler,h.pending_buf,h.pending,0)),h.gzindex=0,h.status=na):(i(h,0),i(h,0),i(h,0),i(h,0),i(h,0),i(h,9===h.level?2:h.strategy>=U||h.level<2?4:0),i(h,xa),h.status=ra);else{var m=Z+(h.w_bits-8<<4)<<8,n=-1;n=h.strategy>=U||h.level<2?0:h.level<6?1:6===h.level?2:3,m|=n<<6,0!==h.strstart&&(m|=la),m+=31-m%31,h.status=ra,j(h,m),0!==h.strstart&&(j(h,a.adler>>>16),j(h,65535&a.adler)),a.adler=1}if(h.status===na)if(h.gzhead.extra){for(k=h.pending;h.gzindex<(65535&h.gzhead.extra.length)&&(h.pending!==h.pending_buf_size||(h.gzhead.hcrc&&h.pending>k&&(a.adler=G(a.adler,h.pending_buf,h.pending-k,k)),g(a),k=h.pending,h.pending!==h.pending_buf_size));)i(h,255&h.gzhead.extra[h.gzindex]),h.gzindex++;h.gzhead.hcrc&&h.pending>k&&(a.adler=G(a.adler,h.pending_buf,h.pending-k,k)),h.gzindex===h.gzhead.extra.length&&(h.gzindex=0,h.status=oa)}else h.status=oa;if(h.status===oa)if(h.gzhead.name){k=h.pending;do{if(h.pending===h.pending_buf_size&&(h.gzhead.hcrc&&h.pending>k&&(a.adler=G(a.adler,h.pending_buf,h.pending-k,k)),g(a),k=h.pending,h.pending===h.pending_buf_size)){l=1;break}l=h.gzindex<h.gzhead.name.length?255&h.gzhead.name.charCodeAt(h.gzindex++):0,i(h,l)}while(0!==l);h.gzhead.hcrc&&h.pending>k&&(a.adler=G(a.adler,h.pending_buf,h.pending-k,k)),0===l&&(h.gzindex=0,h.status=pa)}else h.status=pa;if(h.status===pa)if(h.gzhead.comment){k=h.pending;do{if(h.pending===h.pending_buf_size&&(h.gzhead.hcrc&&h.pending>k&&(a.adler=G(a.adler,h.pending_buf,h.pending-k,k)),g(a),k=h.pending,h.pending===h.pending_buf_size)){l=1;break}l=h.gzindex<h.gzhead.comment.length?255&h.gzhead.comment.charCodeAt(h.gzindex++):0,i(h,l)}while(0!==l);h.gzhead.hcrc&&h.pending>k&&(a.adler=G(a.adler,h.pending_buf,h.pending-k,k)),0===l&&(h.status=qa)}else h.status=qa;if(h.status===qa&&(h.gzhead.hcrc?(h.pending+2>h.pending_buf_size&&g(a),h.pending+2<=h.pending_buf_size&&(i(h,255&a.adler),i(h,a.adler>>8&255),a.adler=0,h.status=ra)):h.status=ra),0!==h.pending){if(g(a),0===a.avail_out)return h.last_flush=-1,N}else if(0===a.avail_in&&e(b)<=e(c)&&b!==L)return d(a,R);if(h.status===sa&&0!==a.avail_in)return d(a,R);if(0!==a.avail_in||0!==h.lookahead||b!==I&&h.status!==sa){var o=h.strategy===U?r(h,b):h.strategy===V?q(h,b):C[h.level].func(h,b);if(o!==va&&o!==wa||(h.status=sa),o===ta||o===va)return 0===a.avail_out&&(h.last_flush=-1),
N;if(o===ua&&(b===J?E._tr_align(h):b!==M&&(E._tr_stored_block(h,0,0,!1),b===K&&(f(h.head),0===h.lookahead&&(h.strstart=0,h.block_start=0,h.insert=0))),g(a),0===a.avail_out))return h.last_flush=-1,N}return b!==L?N:h.wrap<=0?O:(2===h.wrap?(i(h,255&a.adler),i(h,a.adler>>8&255),i(h,a.adler>>16&255),i(h,a.adler>>24&255),i(h,255&a.total_in),i(h,a.total_in>>8&255),i(h,a.total_in>>16&255),i(h,a.total_in>>24&255)):(j(h,a.adler>>>16),j(h,65535&a.adler)),g(a),h.wrap>0&&(h.wrap=-h.wrap),0!==h.pending?N:O)}function B(a){var b;return a&&a.state?(b=a.state.status,b!==ma&&b!==na&&b!==oa&&b!==pa&&b!==qa&&b!==ra&&b!==sa?d(a,P):(a.state=null,b===ra?d(a,Q):N)):P}var C,D=a("../utils/common"),E=a("./trees"),F=a("./adler32"),G=a("./crc32"),H=a("./messages"),I=0,J=1,K=3,L=4,M=5,N=0,O=1,P=-2,Q=-3,R=-5,S=-1,T=1,U=2,V=3,W=4,X=0,Y=2,Z=8,$=9,_=15,aa=8,ba=29,ca=256,da=ca+1+ba,ea=30,fa=19,ga=2*da+1,ha=15,ia=3,ja=258,ka=ja+ia+1,la=32,ma=42,na=69,oa=73,pa=91,qa=103,ra=113,sa=666,ta=1,ua=2,va=3,wa=4,xa=3;C=[new s(0,0,0,0,n),new s(4,4,8,4,o),new s(4,5,16,8,o),new s(4,6,32,32,o),new s(4,4,16,16,p),new s(8,16,32,32,p),new s(8,16,128,128,p),new s(8,32,128,256,p),new s(32,128,258,1024,p),new s(32,258,258,4096,p)],c.deflateInit=z,c.deflateInit2=y,c.deflateReset=w,c.deflateResetKeep=v,c.deflateSetHeader=x,c.deflate=A,c.deflateEnd=B,c.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":74,"./adler32":76,"./crc32":78,"./messages":84,"./trees":85}],80:[function(a,b,c){"use strict";function d(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}b.exports=d},{}],81:[function(a,b,c){"use strict";var d=30,e=12;b.exports=function(a,b){var c,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C;c=a.state,f=a.next_in,B=a.input,g=f+(a.avail_in-5),h=a.next_out,C=a.output,i=h-(b-a.avail_out),j=h+(a.avail_out-257),k=c.dmax,l=c.wsize,m=c.whave,n=c.wnext,o=c.window,p=c.hold,q=c.bits,r=c.lencode,s=c.distcode,t=(1<<c.lenbits)-1,u=(1<<c.distbits)-1;a:do{15>q&&(p+=B[f++]<<q,q+=8,p+=B[f++]<<q,q+=8),v=r[p&t];b:for(;;){if(w=v>>>24,p>>>=w,q-=w,w=v>>>16&255,0===w)C[h++]=65535&v;else{if(!(16&w)){if(0===(64&w)){v=r[(65535&v)+(p&(1<<w)-1)];continue b}if(32&w){c.mode=e;break a}a.msg="invalid literal/length code",c.mode=d;break a}x=65535&v,w&=15,w&&(w>q&&(p+=B[f++]<<q,q+=8),x+=p&(1<<w)-1,p>>>=w,q-=w),15>q&&(p+=B[f++]<<q,q+=8,p+=B[f++]<<q,q+=8),v=s[p&u];c:for(;;){if(w=v>>>24,p>>>=w,q-=w,w=v>>>16&255,!(16&w)){if(0===(64&w)){v=s[(65535&v)+(p&(1<<w)-1)];continue c}a.msg="invalid distance code",c.mode=d;break a}if(y=65535&v,w&=15,w>q&&(p+=B[f++]<<q,q+=8,w>q&&(p+=B[f++]<<q,q+=8)),y+=p&(1<<w)-1,y>k){a.msg="invalid distance too far back",c.mode=d;break a}if(p>>>=w,q-=w,w=h-i,y>w){if(w=y-w,w>m&&c.sane){a.msg="invalid distance too far back",c.mode=d;break a}if(z=0,A=o,0===n){if(z+=l-w,x>w){x-=w;do C[h++]=o[z++];while(--w);z=h-y,A=C}}else if(w>n){if(z+=l+n-w,w-=n,x>w){x-=w;do C[h++]=o[z++];while(--w);if(z=0,x>n){w=n,x-=w;do C[h++]=o[z++];while(--w);z=h-y,A=C}}}else if(z+=n-w,x>w){x-=w;do C[h++]=o[z++];while(--w);z=h-y,A=C}for(;x>2;)C[h++]=A[z++],C[h++]=A[z++],C[h++]=A[z++],x-=3;x&&(C[h++]=A[z++],x>1&&(C[h++]=A[z++]))}else{z=h-y;do C[h++]=C[z++],C[h++]=C[z++],C[h++]=C[z++],x-=3;while(x>2);x&&(C[h++]=C[z++],x>1&&(C[h++]=C[z++]))}break}}break}}while(g>f&&j>h);x=q>>3,f-=x,q-=x<<3,p&=(1<<q)-1,a.next_in=f,a.next_out=h,a.avail_in=g>f?5+(g-f):5-(f-g),a.avail_out=j>h?257+(j-h):257-(h-j),c.hold=p,c.bits=q}},{}],82:[function(a,b,c){"use strict";function d(a){return(a>>>24&255)+(a>>>8&65280)+((65280&a)<<8)+((255&a)<<24)}function e(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new r.Buf16(320),this.work=new r.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function f(a){var b;return a&&a.state?(b=a.state,a.total_in=a.total_out=b.total=0,a.msg="",b.wrap&&(a.adler=1&b.wrap),b.mode=K,b.last=0,b.havedict=0,b.dmax=32768,b.head=null,b.hold=0,b.bits=0,b.lencode=b.lendyn=new r.Buf32(oa),b.distcode=b.distdyn=new r.Buf32(pa),b.sane=1,b.back=-1,C):F}function g(a){var b;return a&&a.state?(b=a.state,b.wsize=0,b.whave=0,b.wnext=0,f(a)):F}function h(a,b){var c,d;return a&&a.state?(d=a.state,0>b?(c=0,b=-b):(c=(b>>4)+1,48>b&&(b&=15)),b&&(8>b||b>15)?F:(null!==d.window&&d.wbits!==b&&(d.window=null),d.wrap=c,d.wbits=b,g(a))):F}function i(a,b){var c,d;return a?(d=new e,a.state=d,d.window=null,c=h(a,b),c!==C&&(a.state=null),c):F}function j(a){return i(a,ra)}function k(a){if(sa){var b;for(p=new r.Buf32(512),q=new r.Buf32(32),b=0;144>b;)a.lens[b++]=8;for(;256>b;)a.lens[b++]=9;for(;280>b;)a.lens[b++]=7;for(;288>b;)a.lens[b++]=8;for(v(x,a.lens,0,288,p,0,a.work,{bits:9}),b=0;32>b;)a.lens[b++]=5;v(y,a.lens,0,32,q,0,a.work,{bits:5}),sa=!1}a.lencode=p,a.lenbits=9,a.distcode=q,a.distbits=5}function l(a,b,c,d){var e,f=a.state;return null===f.window&&(f.wsize=1<<f.wbits,f.wnext=0,f.whave=0,f.window=new r.Buf8(f.wsize)),d>=f.wsize?(r.arraySet(f.window,b,c-f.wsize,f.wsize,0),f.wnext=0,f.whave=f.wsize):(e=f.wsize-f.wnext,e>d&&(e=d),r.arraySet(f.window,b,c-d,e,f.wnext),d-=e,d?(r.arraySet(f.window,b,c-d,d,0),f.wnext=d,f.whave=f.wsize):(f.wnext+=e,f.wnext===f.wsize&&(f.wnext=0),f.whave<f.wsize&&(f.whave+=e))),0}function m(a,b){var c,e,f,g,h,i,j,m,n,o,p,q,oa,pa,qa,ra,sa,ta,ua,va,wa,xa,ya,za,Aa=0,Ba=new r.Buf8(4),Ca=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!a||!a.state||!a.output||!a.input&&0!==a.avail_in)return F;c=a.state,c.mode===V&&(c.mode=W),h=a.next_out,f=a.output,j=a.avail_out,g=a.next_in,e=a.input,i=a.avail_in,m=c.hold,n=c.bits,o=i,p=j,xa=C;a:for(;;)switch(c.mode){case K:if(0===c.wrap){c.mode=W;break}for(;16>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(2&c.wrap&&35615===m){c.check=0,Ba[0]=255&m,Ba[1]=m>>>8&255,c.check=t(c.check,Ba,2,0),m=0,n=0,c.mode=L;break}if(c.flags=0,c.head&&(c.head.done=!1),!(1&c.wrap)||(((255&m)<<8)+(m>>8))%31){a.msg="incorrect header check",c.mode=la;break}if((15&m)!==J){a.msg="unknown compression method",c.mode=la;break}if(m>>>=4,n-=4,wa=(15&m)+8,0===c.wbits)c.wbits=wa;else if(wa>c.wbits){a.msg="invalid window size",c.mode=la;break}c.dmax=1<<wa,a.adler=c.check=1,c.mode=512&m?T:V,m=0,n=0;break;case L:for(;16>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(c.flags=m,(255&c.flags)!==J){a.msg="unknown compression method",c.mode=la;break}if(57344&c.flags){a.msg="unknown header flags set",c.mode=la;break}c.head&&(c.head.text=m>>8&1),512&c.flags&&(Ba[0]=255&m,Ba[1]=m>>>8&255,c.check=t(c.check,Ba,2,0)),m=0,n=0,c.mode=M;case M:for(;32>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}c.head&&(c.head.time=m),512&c.flags&&(Ba[0]=255&m,Ba[1]=m>>>8&255,Ba[2]=m>>>16&255,Ba[3]=m>>>24&255,c.check=t(c.check,Ba,4,0)),m=0,n=0,c.mode=N;case N:for(;16>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}c.head&&(c.head.xflags=255&m,c.head.os=m>>8),512&c.flags&&(Ba[0]=255&m,Ba[1]=m>>>8&255,c.check=t(c.check,Ba,2,0)),m=0,n=0,c.mode=O;case O:if(1024&c.flags){for(;16>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}c.length=m,c.head&&(c.head.extra_len=m),512&c.flags&&(Ba[0]=255&m,Ba[1]=m>>>8&255,c.check=t(c.check,Ba,2,0)),m=0,n=0}else c.head&&(c.head.extra=null);c.mode=P;case P:if(1024&c.flags&&(q=c.length,q>i&&(q=i),q&&(c.head&&(wa=c.head.extra_len-c.length,c.head.extra||(c.head.extra=new Array(c.head.extra_len)),r.arraySet(c.head.extra,e,g,q,wa)),512&c.flags&&(c.check=t(c.check,e,q,g)),i-=q,g+=q,c.length-=q),c.length))break a;c.length=0,c.mode=Q;case Q:if(2048&c.flags){if(0===i)break a;q=0;do wa=e[g+q++],c.head&&wa&&c.length<65536&&(c.head.name+=String.fromCharCode(wa));while(wa&&i>q);if(512&c.flags&&(c.check=t(c.check,e,q,g)),i-=q,g+=q,wa)break a}else c.head&&(c.head.name=null);c.length=0,c.mode=R;case R:if(4096&c.flags){if(0===i)break a;q=0;do wa=e[g+q++],c.head&&wa&&c.length<65536&&(c.head.comment+=String.fromCharCode(wa));while(wa&&i>q);if(512&c.flags&&(c.check=t(c.check,e,q,g)),i-=q,g+=q,wa)break a}else c.head&&(c.head.comment=null);c.mode=S;case S:if(512&c.flags){for(;16>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(m!==(65535&c.check)){a.msg="header crc mismatch",c.mode=la;break}m=0,n=0}c.head&&(c.head.hcrc=c.flags>>9&1,c.head.done=!0),a.adler=c.check=0,c.mode=V;break;case T:for(;32>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}a.adler=c.check=d(m),m=0,n=0,c.mode=U;case U:if(0===c.havedict)return a.next_out=h,a.avail_out=j,a.next_in=g,a.avail_in=i,c.hold=m,c.bits=n,E;a.adler=c.check=1,c.mode=V;case V:if(b===A||b===B)break a;case W:if(c.last){m>>>=7&n,n-=7&n,c.mode=ia;break}for(;3>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}switch(c.last=1&m,m>>>=1,n-=1,3&m){case 0:c.mode=X;break;case 1:if(k(c),c.mode=ba,b===B){m>>>=2,n-=2;break a}break;case 2:c.mode=$;break;case 3:a.msg="invalid block type",c.mode=la}m>>>=2,n-=2;break;case X:for(m>>>=7&n,n-=7&n;32>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if((65535&m)!==(m>>>16^65535)){a.msg="invalid stored block lengths",c.mode=la;break}if(c.length=65535&m,m=0,n=0,c.mode=Y,b===B)break a;case Y:c.mode=Z;case Z:if(q=c.length){if(q>i&&(q=i),q>j&&(q=j),0===q)break a;r.arraySet(f,e,g,q,h),i-=q,g+=q,j-=q,h+=q,c.length-=q;break}c.mode=V;break;case $:for(;14>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(c.nlen=(31&m)+257,m>>>=5,n-=5,c.ndist=(31&m)+1,m>>>=5,n-=5,c.ncode=(15&m)+4,m>>>=4,n-=4,c.nlen>286||c.ndist>30){a.msg="too many length or distance symbols",c.mode=la;break}c.have=0,c.mode=_;case _:for(;c.have<c.ncode;){for(;3>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}c.lens[Ca[c.have++]]=7&m,m>>>=3,n-=3}for(;c.have<19;)c.lens[Ca[c.have++]]=0;if(c.lencode=c.lendyn,c.lenbits=7,ya={bits:c.lenbits},xa=v(w,c.lens,0,19,c.lencode,0,c.work,ya),c.lenbits=ya.bits,xa){a.msg="invalid code lengths set",c.mode=la;break}c.have=0,c.mode=aa;case aa:for(;c.have<c.nlen+c.ndist;){for(;Aa=c.lencode[m&(1<<c.lenbits)-1],qa=Aa>>>24,ra=Aa>>>16&255,sa=65535&Aa,!(n>=qa);){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(16>sa)m>>>=qa,n-=qa,c.lens[c.have++]=sa;else{if(16===sa){for(za=qa+2;za>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(m>>>=qa,n-=qa,0===c.have){a.msg="invalid bit length repeat",c.mode=la;break}wa=c.lens[c.have-1],q=3+(3&m),m>>>=2,n-=2}else if(17===sa){for(za=qa+3;za>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}m>>>=qa,n-=qa,wa=0,q=3+(7&m),m>>>=3,n-=3}else{for(za=qa+7;za>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}m>>>=qa,n-=qa,wa=0,q=11+(127&m),m>>>=7,n-=7}if(c.have+q>c.nlen+c.ndist){a.msg="invalid bit length repeat",c.mode=la;break}for(;q--;)c.lens[c.have++]=wa}}if(c.mode===la)break;if(0===c.lens[256]){a.msg="invalid code -- missing end-of-block",c.mode=la;break}if(c.lenbits=9,ya={bits:c.lenbits},xa=v(x,c.lens,0,c.nlen,c.lencode,0,c.work,ya),c.lenbits=ya.bits,xa){a.msg="invalid literal/lengths set",c.mode=la;break}if(c.distbits=6,c.distcode=c.distdyn,ya={bits:c.distbits},xa=v(y,c.lens,c.nlen,c.ndist,c.distcode,0,c.work,ya),c.distbits=ya.bits,xa){a.msg="invalid distances set",c.mode=la;break}if(c.mode=ba,b===B)break a;case ba:c.mode=ca;case ca:if(i>=6&&j>=258){a.next_out=h,a.avail_out=j,a.next_in=g,a.avail_in=i,c.hold=m,c.bits=n,u(a,p),h=a.next_out,f=a.output,j=a.avail_out,g=a.next_in,e=a.input,i=a.avail_in,m=c.hold,n=c.bits,c.mode===V&&(c.back=-1);break}for(c.back=0;Aa=c.lencode[m&(1<<c.lenbits)-1],qa=Aa>>>24,ra=Aa>>>16&255,sa=65535&Aa,!(n>=qa);){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(ra&&0===(240&ra)){for(ta=qa,ua=ra,va=sa;Aa=c.lencode[va+((m&(1<<ta+ua)-1)>>ta)],qa=Aa>>>24,ra=Aa>>>16&255,sa=65535&Aa,!(n>=ta+qa);){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}m>>>=ta,n-=ta,c.back+=ta}if(m>>>=qa,n-=qa,c.back+=qa,c.length=sa,0===ra){c.mode=ha;break}if(32&ra){c.back=-1,c.mode=V;break}if(64&ra){a.msg="invalid literal/length code",c.mode=la;break}c.extra=15&ra,c.mode=da;case da:if(c.extra){for(za=c.extra;za>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}c.length+=m&(1<<c.extra)-1,m>>>=c.extra,n-=c.extra,c.back+=c.extra}c.was=c.length,c.mode=ea;case ea:for(;Aa=c.distcode[m&(1<<c.distbits)-1],qa=Aa>>>24,ra=Aa>>>16&255,sa=65535&Aa,!(n>=qa);){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(0===(240&ra)){for(ta=qa,ua=ra,va=sa;Aa=c.distcode[va+((m&(1<<ta+ua)-1)>>ta)],qa=Aa>>>24,ra=Aa>>>16&255,sa=65535&Aa,!(n>=ta+qa);){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}m>>>=ta,n-=ta,c.back+=ta}if(m>>>=qa,n-=qa,c.back+=qa,64&ra){a.msg="invalid distance code",c.mode=la;break}c.offset=sa,c.extra=15&ra,c.mode=fa;case fa:if(c.extra){for(za=c.extra;za>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}c.offset+=m&(1<<c.extra)-1,m>>>=c.extra,n-=c.extra,c.back+=c.extra}if(c.offset>c.dmax){a.msg="invalid distance too far back",c.mode=la;break}c.mode=ga;case ga:if(0===j)break a;if(q=p-j,c.offset>q){if(q=c.offset-q,q>c.whave&&c.sane){a.msg="invalid distance too far back",c.mode=la;break}q>c.wnext?(q-=c.wnext,oa=c.wsize-q):oa=c.wnext-q,q>c.length&&(q=c.length),pa=c.window}else pa=f,oa=h-c.offset,q=c.length;q>j&&(q=j),j-=q,c.length-=q;do f[h++]=pa[oa++];while(--q);0===c.length&&(c.mode=ca);break;case ha:if(0===j)break a;f[h++]=c.length,j--,c.mode=ca;break;case ia:if(c.wrap){for(;32>n;){if(0===i)break a;i--,m|=e[g++]<<n,n+=8}if(p-=j,a.total_out+=p,c.total+=p,p&&(a.adler=c.check=c.flags?t(c.check,f,p,h-p):s(c.check,f,p,h-p)),p=j,(c.flags?m:d(m))!==c.check){a.msg="incorrect data check",c.mode=la;break}m=0,n=0}c.mode=ja;case ja:if(c.wrap&&c.flags){for(;32>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(m!==(4294967295&c.total)){a.msg="incorrect length check",c.mode=la;break}m=0,n=0}c.mode=ka;case ka:xa=D;break a;case la:xa=G;break a;case ma:return H;case na:default:return F}return a.next_out=h,a.avail_out=j,a.next_in=g,a.avail_in=i,c.hold=m,c.bits=n,(c.wsize||p!==a.avail_out&&c.mode<la&&(c.mode<ia||b!==z))&&l(a,a.output,a.next_out,p-a.avail_out)?(c.mode=ma,H):(o-=a.avail_in,p-=a.avail_out,a.total_in+=o,a.total_out+=p,c.total+=p,c.wrap&&p&&(a.adler=c.check=c.flags?t(c.check,f,p,a.next_out-p):s(c.check,f,p,a.next_out-p)),a.data_type=c.bits+(c.last?64:0)+(c.mode===V?128:0)+(c.mode===ba||c.mode===Y?256:0),(0===o&&0===p||b===z)&&xa===C&&(xa=I),xa)}function n(a){if(!a||!a.state)return F;var b=a.state;return b.window&&(b.window=null),a.state=null,C}function o(a,b){var c;return a&&a.state?(c=a.state,0===(2&c.wrap)?F:(c.head=b,b.done=!1,C)):F}var p,q,r=a("../utils/common"),s=a("./adler32"),t=a("./crc32"),u=a("./inffast"),v=a("./inftrees"),w=0,x=1,y=2,z=4,A=5,B=6,C=0,D=1,E=2,F=-2,G=-3,H=-4,I=-5,J=8,K=1,L=2,M=3,N=4,O=5,P=6,Q=7,R=8,S=9,T=10,U=11,V=12,W=13,X=14,Y=15,Z=16,$=17,_=18,aa=19,ba=20,ca=21,da=22,ea=23,fa=24,ga=25,ha=26,ia=27,ja=28,ka=29,la=30,ma=31,na=32,oa=852,pa=592,qa=15,ra=qa,sa=!0;c.inflateReset=g,c.inflateReset2=h,c.inflateResetKeep=f,c.inflateInit=j,c.inflateInit2=i,c.inflate=m,c.inflateEnd=n,c.inflateGetHeader=o,c.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":74,"./adler32":76,"./crc32":78,"./inffast":81,"./inftrees":83}],83:[function(a,b,c){"use strict";var d=a("../utils/common"),e=15,f=852,g=592,h=0,i=1,j=2,k=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],l=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],m=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],n=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];b.exports=function(a,b,c,o,p,q,r,s){var t,u,v,w,x,y,z,A,B,C=s.bits,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=null,O=0,P=new d.Buf16(e+1),Q=new d.Buf16(e+1),R=null,S=0;for(D=0;e>=D;D++)P[D]=0;for(E=0;o>E;E++)P[b[c+E]]++;for(H=C,G=e;G>=1&&0===P[G];G--);if(H>G&&(H=G),0===G)return p[q++]=20971520,p[q++]=20971520,s.bits=1,0;for(F=1;G>F&&0===P[F];F++);for(F>H&&(H=F),K=1,D=1;e>=D;D++)if(K<<=1,K-=P[D],0>K)return-1;if(K>0&&(a===h||1!==G))return-1;for(Q[1]=0,D=1;e>D;D++)Q[D+1]=Q[D]+P[D];for(E=0;o>E;E++)0!==b[c+E]&&(r[Q[b[c+E]]++]=E);if(a===h?(N=R=r,y=19):a===i?(N=k,O-=257,R=l,S-=257,y=256):(N=m,R=n,y=-1),M=0,E=0,D=F,x=q,I=H,J=0,v=-1,L=1<<H,w=L-1,a===i&&L>f||a===j&&L>g)return 1;for(var T=0;;){T++,z=D-J,r[E]<y?(A=0,B=r[E]):r[E]>y?(A=R[S+r[E]],B=N[O+r[E]]):(A=96,B=0),t=1<<D-J,u=1<<I,F=u;do u-=t,p[x+(M>>J)+u]=z<<24|A<<16|B|0;while(0!==u);for(t=1<<D-1;M&t;)t>>=1;if(0!==t?(M&=t-1,M+=t):M=0,E++,0===--P[D]){if(D===G)break;D=b[c+r[E]]}if(D>H&&(M&w)!==v){for(0===J&&(J=H),x+=F,I=D-J,K=1<<I;G>I+J&&(K-=P[I+J],!(0>=K));)I++,K<<=1;if(L+=1<<I,a===i&&L>f||a===j&&L>g)return 1;v=M&w,p[v]=H<<24|I<<16|x-q|0}}return 0!==M&&(p[x+M]=D-J<<24|64<<16|0),s.bits=H,0}},{"../utils/common":74}],84:[function(a,b,c){"use strict";b.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],85:[function(a,b,c){"use strict";function d(a){for(var b=a.length;--b>=0;)a[b]=0}function e(a,b,c,d,e){this.static_tree=a,this.extra_bits=b,this.extra_base=c,this.elems=d,this.max_length=e,this.has_stree=a&&a.length}function f(a,b){this.dyn_tree=a,this.max_code=0,this.stat_desc=b}function g(a){return 256>a?ia[a]:ia[256+(a>>>7)]}function h(a,b){a.pending_buf[a.pending++]=255&b,a.pending_buf[a.pending++]=b>>>8&255}function i(a,b,c){a.bi_valid>X-c?(a.bi_buf|=b<<a.bi_valid&65535,h(a,a.bi_buf),a.bi_buf=b>>X-a.bi_valid,a.bi_valid+=c-X):(a.bi_buf|=b<<a.bi_valid&65535,a.bi_valid+=c)}function j(a,b,c){i(a,c[2*b],c[2*b+1])}function k(a,b){var c=0;do c|=1&a,a>>>=1,c<<=1;while(--b>0);return c>>>1}function l(a){16===a.bi_valid?(h(a,a.bi_buf),a.bi_buf=0,a.bi_valid=0):a.bi_valid>=8&&(a.pending_buf[a.pending++]=255&a.bi_buf,a.bi_buf>>=8,a.bi_valid-=8)}function m(a,b){var c,d,e,f,g,h,i=b.dyn_tree,j=b.max_code,k=b.stat_desc.static_tree,l=b.stat_desc.has_stree,m=b.stat_desc.extra_bits,n=b.stat_desc.extra_base,o=b.stat_desc.max_length,p=0;for(f=0;W>=f;f++)a.bl_count[f]=0;for(i[2*a.heap[a.heap_max]+1]=0,c=a.heap_max+1;V>c;c++)d=a.heap[c],f=i[2*i[2*d+1]+1]+1,f>o&&(f=o,p++),i[2*d+1]=f,d>j||(a.bl_count[f]++,g=0,d>=n&&(g=m[d-n]),h=i[2*d],a.opt_len+=h*(f+g),l&&(a.static_len+=h*(k[2*d+1]+g)));if(0!==p){do{for(f=o-1;0===a.bl_count[f];)f--;a.bl_count[f]--,a.bl_count[f+1]+=2,a.bl_count[o]--,p-=2}while(p>0);for(f=o;0!==f;f--)for(d=a.bl_count[f];0!==d;)e=a.heap[--c],e>j||(i[2*e+1]!==f&&(a.opt_len+=(f-i[2*e+1])*i[2*e],i[2*e+1]=f),d--)}}function n(a,b,c){var d,e,f=new Array(W+1),g=0;for(d=1;W>=d;d++)f[d]=g=g+c[d-1]<<1;for(e=0;b>=e;e++){var h=a[2*e+1];0!==h&&(a[2*e]=k(f[h]++,h))}}function o(){var a,b,c,d,f,g=new Array(W+1);for(c=0,d=0;Q-1>d;d++)for(ka[d]=c,a=0;a<1<<ba[d];a++)ja[c++]=d;for(ja[c-1]=d,f=0,d=0;16>d;d++)for(la[d]=f,a=0;a<1<<ca[d];a++)ia[f++]=d;for(f>>=7;T>d;d++)for(la[d]=f<<7,a=0;a<1<<ca[d]-7;a++)ia[256+f++]=d;for(b=0;W>=b;b++)g[b]=0;for(a=0;143>=a;)ga[2*a+1]=8,a++,g[8]++;for(;255>=a;)ga[2*a+1]=9,a++,g[9]++;for(;279>=a;)ga[2*a+1]=7,a++,g[7]++;for(;287>=a;)ga[2*a+1]=8,a++,g[8]++;for(n(ga,S+1,g),a=0;T>a;a++)ha[2*a+1]=5,ha[2*a]=k(a,5);ma=new e(ga,ba,R+1,S,W),na=new e(ha,ca,0,T,W),oa=new e(new Array(0),da,0,U,Y)}function p(a){var b;for(b=0;S>b;b++)a.dyn_ltree[2*b]=0;for(b=0;T>b;b++)a.dyn_dtree[2*b]=0;for(b=0;U>b;b++)a.bl_tree[2*b]=0;a.dyn_ltree[2*Z]=1,a.opt_len=a.static_len=0,a.last_lit=a.matches=0}function q(a){a.bi_valid>8?h(a,a.bi_buf):a.bi_valid>0&&(a.pending_buf[a.pending++]=a.bi_buf),a.bi_buf=0,a.bi_valid=0}function r(a,b,c,d){q(a),d&&(h(a,c),h(a,~c)),G.arraySet(a.pending_buf,a.window,b,c,a.pending),a.pending+=c}function s(a,b,c,d){var e=2*b,f=2*c;return a[e]<a[f]||a[e]===a[f]&&d[b]<=d[c]}function t(a,b,c){for(var d=a.heap[c],e=c<<1;e<=a.heap_len&&(e<a.heap_len&&s(b,a.heap[e+1],a.heap[e],a.depth)&&e++,!s(b,d,a.heap[e],a.depth));)a.heap[c]=a.heap[e],c=e,e<<=1;a.heap[c]=d}function u(a,b,c){var d,e,f,h,k=0;if(0!==a.last_lit)do d=a.pending_buf[a.d_buf+2*k]<<8|a.pending_buf[a.d_buf+2*k+1],e=a.pending_buf[a.l_buf+k],k++,0===d?j(a,e,b):(f=ja[e],j(a,f+R+1,b),h=ba[f],0!==h&&(e-=ka[f],i(a,e,h)),d--,f=g(d),j(a,f,c),h=ca[f],0!==h&&(d-=la[f],i(a,d,h)));while(k<a.last_lit);j(a,Z,b)}function v(a,b){var c,d,e,f=b.dyn_tree,g=b.stat_desc.static_tree,h=b.stat_desc.has_stree,i=b.stat_desc.elems,j=-1;for(a.heap_len=0,a.heap_max=V,c=0;i>c;c++)0!==f[2*c]?(a.heap[++a.heap_len]=j=c,a.depth[c]=0):f[2*c+1]=0;for(;a.heap_len<2;)e=a.heap[++a.heap_len]=2>j?++j:0,f[2*e]=1,a.depth[e]=0,a.opt_len--,h&&(a.static_len-=g[2*e+1]);for(b.max_code=j,c=a.heap_len>>1;c>=1;c--)t(a,f,c);e=i;do c=a.heap[1],a.heap[1]=a.heap[a.heap_len--],t(a,f,1),d=a.heap[1],a.heap[--a.heap_max]=c,a.heap[--a.heap_max]=d,f[2*e]=f[2*c]+f[2*d],a.depth[e]=(a.depth[c]>=a.depth[d]?a.depth[c]:a.depth[d])+1,f[2*c+1]=f[2*d+1]=e,a.heap[1]=e++,t(a,f,1);while(a.heap_len>=2);a.heap[--a.heap_max]=a.heap[1],m(a,b),n(f,j,a.bl_count)}function w(a,b,c){var d,e,f=-1,g=b[1],h=0,i=7,j=4;for(0===g&&(i=138,j=3),b[2*(c+1)+1]=65535,d=0;c>=d;d++)e=g,g=b[2*(d+1)+1],++h<i&&e===g||(j>h?a.bl_tree[2*e]+=h:0!==e?(e!==f&&a.bl_tree[2*e]++,a.bl_tree[2*$]++):10>=h?a.bl_tree[2*_]++:a.bl_tree[2*aa]++,h=0,f=e,0===g?(i=138,j=3):e===g?(i=6,j=3):(i=7,j=4))}function x(a,b,c){var d,e,f=-1,g=b[1],h=0,k=7,l=4;for(0===g&&(k=138,l=3),d=0;c>=d;d++)if(e=g,g=b[2*(d+1)+1],!(++h<k&&e===g)){if(l>h){do j(a,e,a.bl_tree);while(0!==--h)}else 0!==e?(e!==f&&(j(a,e,a.bl_tree),h--),j(a,$,a.bl_tree),i(a,h-3,2)):10>=h?(j(a,_,a.bl_tree),i(a,h-3,3)):(j(a,aa,a.bl_tree),i(a,h-11,7));h=0,f=e,0===g?(k=138,l=3):e===g?(k=6,l=3):(k=7,l=4)}}function y(a){var b;for(w(a,a.dyn_ltree,a.l_desc.max_code),w(a,a.dyn_dtree,a.d_desc.max_code),v(a,a.bl_desc),b=U-1;b>=3&&0===a.bl_tree[2*ea[b]+1];b--);return a.opt_len+=3*(b+1)+5+5+4,b}function z(a,b,c,d){var e;for(i(a,b-257,5),i(a,c-1,5),i(a,d-4,4),e=0;d>e;e++)i(a,a.bl_tree[2*ea[e]+1],3);x(a,a.dyn_ltree,b-1),x(a,a.dyn_dtree,c-1)}function A(a){var b,c=4093624447;for(b=0;31>=b;b++,c>>>=1)if(1&c&&0!==a.dyn_ltree[2*b])return I;if(0!==a.dyn_ltree[18]||0!==a.dyn_ltree[20]||0!==a.dyn_ltree[26])return J;for(b=32;R>b;b++)if(0!==a.dyn_ltree[2*b])return J;return I}function B(a){pa||(o(),pa=!0),a.l_desc=new f(a.dyn_ltree,ma),a.d_desc=new f(a.dyn_dtree,na),a.bl_desc=new f(a.bl_tree,oa),a.bi_buf=0,a.bi_valid=0,p(a)}function C(a,b,c,d){i(a,(L<<1)+(d?1:0),3),r(a,b,c,!0)}function D(a){i(a,M<<1,3),j(a,Z,ga),l(a)}function E(a,b,c,d){var e,f,g=0;a.level>0?(a.strm.data_type===K&&(a.strm.data_type=A(a)),v(a,a.l_desc),v(a,a.d_desc),g=y(a),e=a.opt_len+3+7>>>3,f=a.static_len+3+7>>>3,e>=f&&(e=f)):e=f=c+5,e>=c+4&&-1!==b?C(a,b,c,d):a.strategy===H||f===e?(i(a,(M<<1)+(d?1:0),3),u(a,ga,ha)):(i(a,(N<<1)+(d?1:0),3),z(a,a.l_desc.max_code+1,a.d_desc.max_code+1,g+1),u(a,a.dyn_ltree,a.dyn_dtree)),p(a),d&&q(a)}function F(a,b,c){return a.pending_buf[a.d_buf+2*a.last_lit]=b>>>8&255,a.pending_buf[a.d_buf+2*a.last_lit+1]=255&b,a.pending_buf[a.l_buf+a.last_lit]=255&c,a.last_lit++,0===b?a.dyn_ltree[2*c]++:(a.matches++,b--,a.dyn_ltree[2*(ja[c]+R+1)]++,a.dyn_dtree[2*g(b)]++),a.last_lit===a.lit_bufsize-1}var G=a("../utils/common"),H=4,I=0,J=1,K=2,L=0,M=1,N=2,O=3,P=258,Q=29,R=256,S=R+1+Q,T=30,U=19,V=2*S+1,W=15,X=16,Y=7,Z=256,$=16,_=17,aa=18,ba=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],ca=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],da=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],ea=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],fa=512,ga=new Array(2*(S+2));d(ga);var ha=new Array(2*T);d(ha);var ia=new Array(fa);d(ia);var ja=new Array(P-O+1);d(ja);var ka=new Array(Q);d(ka);var la=new Array(T);d(la);var ma,na,oa,pa=!1;c._tr_init=B,c._tr_stored_block=C,c._tr_flush_block=E,c._tr_tally=F,c._tr_align=D},{"../utils/common":74}],86:[function(a,b,c){"use strict";function d(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}b.exports=d},{}],87:[function(a,b,c){function d(){k=!1,h.length?j=h.concat(j):l=-1,j.length&&e()}function e(){if(!k){var a=setTimeout(d);k=!0;for(var b=j.length;b;){for(h=j,j=[];++l<b;)h&&h[l].run();l=-1,b=j.length}h=null,k=!1,clearTimeout(a)}}function f(a,b){this.fun=a,this.array=b}function g(){}var h,i=b.exports={},j=[],k=!1,l=-1;i.nextTick=function(a){var b=new Array(arguments.length-1);if(arguments.length>1)for(var c=1;c<arguments.length;c++)b[c-1]=arguments[c];j.push(new f(a,b)),1!==j.length||k||setTimeout(e,0)},f.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=g,i.addListener=g,i.once=g,i.off=g,i.removeListener=g,i.removeAllListeners=g,i.emit=g,i.binding=function(a){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(a){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},{}]},{},[1]); |
ajax/libs/nuclear-js/0.6.0/nuclear.js | shelsonjava/cdnjs | (function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define(factory);
else if(typeof exports === 'object')
exports["Nuclear"] = factory();
else
root["Nuclear"] = factory();
})(this, function() {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ function(module, exports, __webpack_require__) {
var helpers = __webpack_require__(1)
/**
* @return {Reactor}
*/
exports.Reactor = __webpack_require__(2)
/**
* @return {Store}
*/
exports.Store = __webpack_require__(3)
// export the immutable library
exports.Immutable = __webpack_require__(11)
/**
* @return {boolean}
*/
exports.isKeyPath = __webpack_require__(4).isKeyPath
/**
* @return {boolean}
*/
exports.isGetter = __webpack_require__(5).isGetter
// expose helper functions
exports.toJS = helpers.toJS
exports.toImmutable = helpers.toImmutable
exports.isImmutable = helpers.isImmutable
/***/ },
/* 1 */
/***/ function(module, exports, __webpack_require__) {
var Immutable = __webpack_require__(11)
var isObject = __webpack_require__(6).isObject
/**
* A collection of helpers for the ImmutableJS library
*/
/**
* @param {*} obj
* @return {boolean}
*/
function isImmutable(obj) {
return Immutable.Iterable.isIterable(obj)
}
/**
* Returns true if the value is an ImmutableJS data structure
* or a javascript primitive that is immutable (stirng, number, etc)
* @param {*} obj
* @return {boolean}
*/
function isImmutableValue(obj) {
return (
isImmutable(obj) ||
!isObject(obj)
)
}
/**
* Converts an Immutable Sequence to JS object
* Can be called on any type
*/
function toJS(arg) {
// arg instanceof Immutable.Sequence is unreleable
return (isImmutable(arg))
? arg.toJS()
: arg;
}
/**
* Converts a JS object to an Immutable object, if it's
* already Immutable its a no-op
*/
function toImmutable(arg) {
return (isImmutable(arg))
? arg
: Immutable.fromJS(arg)
}
exports.toJS = toJS
exports.toImmutable = toImmutable
exports.isImmutable = isImmutable
exports.isImmutableValue = isImmutableValue
/***/ },
/* 2 */
/***/ function(module, exports, __webpack_require__) {
var Immutable = __webpack_require__(11)
var logging = __webpack_require__(7)
var ChangeObserver = __webpack_require__(8)
var Getter = __webpack_require__(5)
var KeyPath = __webpack_require__(4)
var Evaluator = __webpack_require__(9)
var createReactMixin = __webpack_require__(10)
// helper fns
var toJS = __webpack_require__(1).toJS
var toImmutable = __webpack_require__(1).toImmutable
var isImmutableValue = __webpack_require__(1).isImmutableValue
var each = __webpack_require__(6).each
/**
* In Nuclear Reactors are where state is stored. Reactors
* contain a "state" object which is an Immutable.Map
*
* The only way Reactors can change state is by reacting to
* messages. To update staet, Reactor's dispatch messages to
* all registered cores, and the core returns it's new
* state based on the message
*/
function Reactor(config) {"use strict";
if (!(this instanceof Reactor)) {
return new Reactor(config)
}
config = config || {}
this.debug = !!config.debug
this.ReactMixin = createReactMixin(this)
/**
* The state for the whole cluster
*/
this.__state = Immutable.Map({})
/**
* Holds a map of id => reactor instance
*/
this.__stores = Immutable.Map({})
this.__evaluator = new Evaluator()
/**
* Change observer interface to observe certain keypaths
* Created after __initialize so it starts with initialState
*/
this.__changeObserver = new ChangeObserver(this.__state, this.__evaluator)
}
/**
* Evaluates a KeyPath or Getter in context of the reactor state
* @param {KeyPath|Getter} keyPathOrGetter
* @return {*}
*/
Reactor.prototype.evaluate=function(keyPathOrGetter) {"use strict";
return this.__evaluator.evaluate(this.__state, keyPathOrGetter)
};
/**
* Gets the coerced state (to JS object) of the reactor.evaluate
* @param {KeyPath|Getter} keyPathOrGetter
* @return {*}
*/
Reactor.prototype.evaluateToJS=function(keyPathOrGetter) {"use strict";
return toJS(this.evaluate(keyPathOrGetter))
};
/**
* Adds a change observer whenever a certain part of the reactor state changes
*
* 1. observe(handlerFn) - 1 argument, called anytime reactor.state changes
* 2. observe(keyPath, handlerFn) same as above
* 3. observe(getter, handlerFn) called whenever any getter dependencies change with
* the value of the getter
*
* Adds a change handler whenever certain deps change
* If only one argument is passed invoked the handler whenever
* the reactor state changes
*
* @param {KeyPath|Getter} getter
* @param {function} handler
* @return {function} unwatch function
*/
Reactor.prototype.observe=function(getter, handler) {"use strict";
if (arguments.length === 1) {
handler = getter
getter = Getter.fromKeyPath([])
} else if (KeyPath.isKeyPath(getter)) {
getter = Getter.fromKeyPath(getter)
}
return this.__changeObserver.onChange(getter, handler)
};
/**
* Dispatches a single message
* @param {string} actionType
* @param {object|undefined} payload
*/
Reactor.prototype.dispatch=function(actionType, payload) {"use strict";
var debug = this.debug
var prevState = this.__state
this.__state = this.__state.withMutations(function(state) {
if (this.debug) {
logging.dispatchStart(actionType, payload)
}
// let each core handle the message
this.__stores.forEach(function(store, id) {
var currState = state.get(id)
var newState = store.handle(currState, actionType, payload)
if (debug && newState === undefined) {
throw new Error("Store handler must return a value, did you forget a return statement")
}
state.set(id, newState)
if (this.debug) {
logging.coreReact(id, currState, newState)
}
}.bind(this))
if (this.debug) {
logging.dispatchEnd(state)
}
}.bind(this))
// write the new state to the output stream if changed
if (this.__state !== prevState) {
this.__changeObserver.notifyObservers(this.__state)
}
};
/**
* Attachs a store to a non-running or running nuclear reactor. Will emit change
* @param {string} id
* @param {Store} store
* @param {boolean} silent should not notify observers of state change
*/
Reactor.prototype.registerStore=function(id, store, silent) {"use strict";
if (this.__stores.get(id)) {
console.warn("Store already defined for id=" + id)
}
var initialState = store.getInitialState()
if (this.debug && !isImmutableValue(initialState)) {
throw new Error("Store getInitialState() must return an immutable value, did you forget to call toImmutable")
}
this.__stores = this.__stores.set(id, store)
this.__state = this.__state.set(id, initialState)
if (!silent) {
this.__changeObserver.notifyObservers(this.__state)
}
};
/**
* @param {Array.<string, Store>} stores
* @param {boolean} silent should not notify observers of state change
*/
Reactor.prototype.registerStores=function(stores, silent) {"use strict";
each(stores, function(store, id) {
this.registerStore(id, store, true)
}.bind(this))
if (!silent) {
this.__changeObserver.notifyObservers(this.__state)
}
};
/**
* Resets the state of a reactor and returns back to initial state
*/
Reactor.prototype.reset=function() {"use strict";
var debug = this.debug
var prevState = this.__state
this.__state = Immutable.Map().withMutations(function(state) {
this.__stores.forEach(function(store, id) {
var storeState = prevState.get(id)
var resetStoreState = store.handleReset(storeState)
if (debug && resetStoreState === undefined) {
throw new Error("Store handleReset() must return a value, did you forget a return statement")
}
if (debug && !isImmutableValue(resetStoreState)) {
throw new Error("Store reset state must be an immutable value, did you forget to call toImmutable")
}
state.set(id, resetStoreState)
})
}.bind(this))
this.__evaluator.reset()
this.__changeObserver.reset(this.__state)
};
module.exports = Reactor
/***/ },
/* 3 */
/***/ function(module, exports, __webpack_require__) {
var Map = __webpack_require__(11).Map
var extend = __webpack_require__(6).extend
/**
* Stores define how a certain domain of the application should respond to actions
* taken on the whole system. They manage their own section of the entire app state
* and have no knowledge about the other parts of the application state.
*/
function Store(config) {"use strict";
if (!(this instanceof Store)) {
return new Store(config)
}
this.__handlers = Map({})
extend(this, config)
this.initialize()
}
/**
* This method is overriden by extending classses to setup message handlers
* via `this.on` and to set up the initial state
*
* Anything returned from this function will be coerced into an ImmutableJS value
* and set as the initial state for the part of the ReactorCore
*/
Store.prototype.initialize=function() {"use strict";
// extending classes implement to setup action handlers
};
/**
* Overridable method to get the initial state for this type of store
*/
Store.prototype.getInitialState=function() {"use strict";
return Map()
};
/**
* Takes a current reactor state, action type and payload
* does the reaction and returns the new state
*/
Store.prototype.handle=function(state, type, payload) {"use strict";
var handler = this.__handlers.get(type)
if (typeof handler === 'function') {
return handler.call(this, state, payload, type)
}
return state
};
/**
* Pure function taking the current state of store and returning
* the new state after a Nuclear reactor has been reset
*
* Overridable
*/
Store.prototype.handleReset=function(state) {"use strict";
return this.getInitialState()
};
/**
* Binds an action type => handler
*/
Store.prototype.on=function(actionType, handler) {"use strict";
this.__handlers = this.__handlers.set(actionType, handler)
};
function isStore(toTest) {
return (toTest instanceof Store)
}
module.exports = Store
module.exports.isStore = isStore
/***/ },
/* 4 */
/***/ function(module, exports, __webpack_require__) {
var isArray = __webpack_require__(6).isArray
var isFunction = __webpack_require__(6).isFunction
/**
* Checks if something is simply a keyPath and not a getter
* @param {*} toTest
* @return {boolean}
*/
exports.isKeyPath = function(toTest) {
return (
isArray(toTest) &&
!isFunction(toTest[toTest.length - 1])
)
}
/***/ },
/* 5 */
/***/ function(module, exports, __webpack_require__) {
var Immutable = __webpack_require__(11)
var isFunction = __webpack_require__(6).isFunction
var isArray = __webpack_require__(6).isArray
var isKeyPath = __webpack_require__(4).isKeyPath
/**
* Getter helper functions
* A getter is an array with the form:
* [<KeyPath>, ...<KeyPath>, <function>]
*/
var identity = function(x) {return x;}
/**
* Checks if something is a getter literal, ex: ['dep1', 'dep2', function(dep1, dep2) {...}]
* @param {*} toTest
* @return {boolean}
*/
function isGetter(toTest) {
return (isArray(toTest) && isFunction(toTest[toTest.length - 1]))
}
/**
* Recursive function to flatten deps of a getter
* @param {Getter} getter
* @return {Array.<KeyPath>} unique flatten deps
*/
function unwrapDeps(getter) {
var accum = Immutable.Set()
var deps = getter.slice(0, getter.length - 1)
return accum.withMutations(function(accum) {
deps.forEach(function(dep) {
isGetter(dep)
? accum.union(unwrapDeps(dep))
: accum.add(dep)
})
return accum
})
}
/**
* Returns the compute function from a getter
* @param {Getter} getter
* @return {function}
*/
function getComputeFn(getter) {
return getter[getter.length - 1]
}
/**
* Returns an array of deps from a getter
* @param {Getter} getter
* @return {function}
*/
function getDeps(getter) {
return getter.slice(0, getter.length - 1)
}
/**
* @param {KeyPath}
* @return {Getter}
*/
function fromKeyPath(keyPath) {
if (!isKeyPath(keyPath)) {
throw new Error("Cannot create Getter from KeyPath: " + keyPath)
}
return [keyPath, identity]
}
module.exports = {
unwrapDeps: unwrapDeps,
isGetter: isGetter,
getComputeFn: getComputeFn,
getDeps: getDeps,
fromKeyPath: fromKeyPath,
}
/***/ },
/* 6 */
/***/ function(module, exports, __webpack_require__) {
/**
* Ensures that the inputted value is an array
* @param {*} val
* @return {array}
*/
exports.coerceArray = function(val) {
if (!exports.isArray(val)) {
return [val]
}
return val
}
/**
* Checks if the passed in value is a number
* @param {*} val
* @return {boolean}
*/
exports.isNumber = function(val) {
return typeof val == 'number' || objectToString(val) === '[object Number]'
}
/**
* Checks if the passed in value is a string
* @param {*} val
* @return {boolean}
*/
exports.isString = function(val) {
return typeof val == 'string' || objectToString(val) === '[object String]'
}
/**
* Checks if the passed in value is an array
* @param {*} val
* @return {boolean}
*/
exports.isArray = Array.isArray || function(val) {
return objectToString(val) === '[object Array]'
}
/**
* Checks if the passed in value is a function
* @param {*} val
* @return {boolean}
*/
exports.isFunction = function(val) {
return toString.call(val) === '[object Function]'
}
/**
* Checks if the passed in value is af type Object
* @param {*} val
* @return {boolean}
*/
exports.isObject = function(obj) {
var type = typeof obj
return type === 'function' || type === 'object' && !!obj
}
/**
* Extends an object with the properties of additional objects
* @param {object} obj
* @param {object} objects
* @return {object}
*/
exports.extend = function(obj) {
var length = arguments.length
if (!obj || length < 2) return obj || {}
for (var index = 1; index < length; index++) {
var source = arguments[index]
var keys = Object.keys(source)
var l = keys.length
for (var i = 0; i < l; i++) {
var key = keys[i]
obj[key] = source[key]
}
}
return obj
}
/**
* Creates a shallow clone of an object
* @param {object} obj
* @return {object}
*/
exports.clone = function(obj) {
if (!exports.isObject(obj)) return obj
return exports.isArray(obj) ? obj.slice() : exports.extend({}, obj)
}
/**
* Iterates over a collection of elements yielding each iteration to an
* iteratee. The iteratee may be bound to the context argument and is invoked
* each time with three arguments (value, index|key, collection). Iteration may
* be exited early by explicitly returning false.
* @param {array|object|string} collection
* @param {function} iteratee
* @param {*} context
* @return {array|object|string}
*/
exports.each = function(collection, iteratee, context) {
var length = collection ? collection.length : 0
var i = -1
var keys, origIteratee
if (context) {
origIteratee = iteratee
iteratee = function(value, index, collection) {
return origIteratee.call(context, value, index, collection)
}
}
if (isLength(length)) {
while (++i < length) {
if (iteratee(collection[i], i, collection) === false) break
}
} else {
keys = Object.keys(collection)
length = keys.length
while (++i < length) {
if (iteratee(collection[keys[i]], keys[i], collection) === false) break
}
}
return collection
}
/**
* Returns a new function the invokes `func` with `partialArgs` prepended to
* any passed into the new function. Acts like `Array.prototype.bind`, except
* it does not alter `this` context.
* @param {function} func
* @param {*} partialArgs
* @return {function}
*/
exports.partial = function(func) {
var slice = Array.prototype.slice
var partialArgs = slice.call(arguments, 1)
return function() {
return func.apply(this, partialArgs.concat(slice.call(arguments)))
}
}
/**
* Returns the text value representation of an object
* @private
* @param {*} obj
* @return {string}
*/
function objectToString(obj) {
return obj && typeof obj == 'object' && toString.call(obj)
}
/**
* Checks if the value is a valid array-like length.
* @private
* @param {*} val
* @return {bool}
*/
function isLength(val) {
return typeof val == 'number'
&& val > -1
&& val % 1 == 0
&& val <= Number.MAX_SAFE_INTEGER
}
/***/ },
/* 7 */
/***/ function(module, exports, __webpack_require__) {
/**
* Wraps a Reactor.react invocation in a console.group
*/
exports.dispatchStart = function(type, payload) {
if (console.group) {
console.groupCollapsed('Dispatch: %s', type)
console.group('payload')
console.log(payload)
console.groupEnd()
}
}
exports.coreReact = function(id, before, after) {
if (console.group) {
if (before !== after) {
console.log('Core changed: ' + id)
}
}
}
exports.dispatchEnd = function(state) {
if (console.group) {
console.log('Dispatch done, new state: ', state.toJS())
console.groupEnd()
}
}
/***/ },
/* 8 */
/***/ function(module, exports, __webpack_require__) {
var Immutable = __webpack_require__(11)
var hashCode = __webpack_require__(12)
var isEqual = __webpack_require__(13)
/**
* ChangeObserver is an object that contains a set of subscriptions
* to changes for keyPaths on a reactor
*
* Packaging the handlers together allows for easier cleanup
*/
/**
* @param {Immutable.Map} initialState
* @param {Evaluator} evaluator
*/
function ChangeObserver(initialState, evaluator) {"use strict";
this.__prevState = initialState
this.__evaluator = evaluator
this.__prevValues = Immutable.Map({})
this.__observers = []
}
/**
* @param {Immutable.Map} newState
*/
ChangeObserver.prototype.notifyObservers=function(newState) {"use strict";
var currentValues = Immutable.Map()
this.__observers.forEach(function(entry) {
var getter = entry.getter
var code = hashCode(getter)
var prevState = this.__prevState
var prevValue
if (this.__prevValues.has(code)) {
prevValue = this.__prevValues.get(code)
} else {
prevValue = this.__evaluator.evaluate(prevState, getter)
this.__prevValues = this.__prevValues.set(code, prevValue)
}
var currValue = this.__evaluator.evaluate(newState, getter)
if (!isEqual(prevValue, currValue)) {
entry.handler.call(null, currValue)
currentValues = currentValues.set(code, currValue)
}
}.bind(this))
this.__prevState = newState
this.__prevValues = currentValues
};
/**
* Specify an getter and a change handler fn
* Handler function is called whenever the value of the getter changes
* @param {Getter} getter
* @param {function} handler
* @return {function} unwatch function
*/
ChangeObserver.prototype.onChange=function(getter, handler) {"use strict";
// TODO make observers a map of <Getter> => { handlers }
var entry = {
getter: getter,
handler: handler,
}
this.__observers.push(entry)
// return unwatch function
return function() {
// TODO untrack from change emitter
var ind = this.__observers.indexOf(entry)
if (ind > -1) {
this.__observers.splice(ind, 1)
}
}.bind(this)
};
/**
* Resets and clears all observers and reinitializes back to the supplied
* previous state
* @param {Immutable.Map} prevState
*
*/
ChangeObserver.prototype.reset=function(prevState) {"use strict";
this.__prevState = prevState
this.__prevValues = Immutable.Map({})
this.__observers = []
};
module.exports = ChangeObserver
/***/ },
/* 9 */
/***/ function(module, exports, __webpack_require__) {
var Immutable = __webpack_require__(11)
var helpers = __webpack_require__(1)
var isImmutable = helpers.isImmutable
var toImmutable = helpers.toImmutable
var hashCode = __webpack_require__(12)
var isEqual = __webpack_require__(13)
var getComputeFn = __webpack_require__(5).getComputeFn
var getDeps = __webpack_require__(5).getDeps
var isKeyPath = __webpack_require__(4).isKeyPath
var isGetter = __webpack_require__(5).isGetter
var isObject = __webpack_require__(6).isObject
var isArray = __webpack_require__(6).isArray
// Keep track of whether we are currently executing a Getter's computeFn
var __applyingComputeFn = false;
function Evaluator() {"use strict";
/**
* {
* <hashCode>: {
* stateHashCode: number,
* args: Immutable.List,
* value: any,
* }
* }
*/
this.__cachedGetters = Immutable.Map({})
}
/**
* Takes either a KeyPath or Getter and evaluates
*
* KeyPath form:
* ['foo', 'bar'] => state.getIn(['foo', 'bar'])
*
* Getter form:
* [<KeyPath>, <KeyPath>, ..., <function>]
*
* @param {Immutable.Map} state
* @param {string|array} getter
* @return {any}
*/
Evaluator.prototype.evaluate=function(state, keyPathOrGetter) {"use strict";
if (isKeyPath(keyPathOrGetter)) {
// if its a keyPath simply return
return state.getIn(keyPathOrGetter)
} else if (!isGetter(keyPathOrGetter)) {
throw new Error("evaluate must be passed a keyPath or Getter")
}
// Must be a Getter
var code = hashCode(keyPathOrGetter)
// if the value is cached for this dispatch cycle, return the cached value
if (this.__isCached(state, keyPathOrGetter)) {
// Cache hit
return this.__cachedGetters.getIn([code, 'value'])
} else if (this.__hasStaleValue(state, keyPathOrGetter)) {
var prevValue = this.__cachedGetters.getIn([code, 'value'])
var prevArgs = this.__cachedGetters.getIn([code, 'args'])
// getter deps could still be unchanged since we only looked at the unwrapped (keypath, bottom level) deps
var currArgs = toImmutable(getDeps(keyPathOrGetter).map(function(getter) {
return this.evaluate(state, getter)
}.bind(this)))
// since Getter is a pure functions if the args are the same its a cache hit
if (isEqual(prevArgs, currArgs)) {
this.__cacheValue(state, keyPathOrGetter, prevArgs, prevValue)
return prevValue
}
}
// no cache hit evaluate
var args = getDeps(keyPathOrGetter).map(function(dep) {return this.evaluate(state, dep);}.bind(this))
// This indicates that we have called evaluate within the body of a computeFn.
// Throw an error as this will lead to inconsistent caching
if (__applyingComputeFn === true) {
__applyingComputeFn = false
throw new Error("Evaluate may not be called within a Getters computeFn")
}
__applyingComputeFn = true
var evaluatedValue = getComputeFn(keyPathOrGetter).apply(null, args)
__applyingComputeFn = false
this.__cacheValue(state, keyPathOrGetter, args, evaluatedValue)
return evaluatedValue
};
/**
* @param {Immutable.Map} state
* @param {Getter} getter
*/
Evaluator.prototype.__hasStaleValue=function(state, getter) {"use strict";
var code = hashCode(getter)
var cache = this.__cachedGetters
return (
cache.has(code) &&
cache.getIn([code, 'stateHashCode']) !== state.hashCode()
)
};
/**
* Caches the value of a getter given state, getter, args, value
* @param {Immutable.Map} state
* @param {Getter} getter
* @param {Array} args
* @param {any} value
*/
Evaluator.prototype.__cacheValue=function(state, getter, args, value) {"use strict";
var code = hashCode(getter)
this.__cachedGetters = this.__cachedGetters.set(code, Immutable.Map({
value: value,
args: toImmutable(args),
stateHashCode: state.hashCode(),
}))
};
/**
* Returns boolean whether the supplied getter is cached for a given state
* @param {Immutable.Map} state
* @param {Getter} getter
* @return {boolean}
*/
Evaluator.prototype.__isCached=function(state, getter) {"use strict";
var code = hashCode(getter)
return (
this.__cachedGetters.hasIn([code, 'value']) &&
this.__cachedGetters.getIn([code, 'stateHashCode']) === state.hashCode()
)
};
/**
* Removes all caching about a getter
* @param {Getter}
*/
Evaluator.prototype.untrack=function(getter) {"use strict";
var code = hashCode(getter)
this.__cachedGetters = this.__cachedGetters.remove(code)
// TODO untrack all depedencies
};
Evaluator.prototype.reset=function() {"use strict";
this.__cachedGetters = Immutable.Map({})
};
module.exports = Evaluator
/***/ },
/* 10 */
/***/ function(module, exports, __webpack_require__) {
var each = __webpack_require__(6).each
/**
* @param {Reactor} reactor
*/
module.exports = function(reactor) {
return {
getInitialState: function() {
return getState(reactor, this.getDataBindings())
},
componentDidMount: function() {
var component = this
var dataBindings = this.getDataBindings()
component.__unwatchFns = []
each(this.getDataBindings(), function(getter, key) {
var unwatchFn = reactor.observe(getter, function(val) {
var newState = {};
newState[key] = val;
component.setState(newState)
})
component.__unwatchFns.push(unwatchFn)
})
},
componentWillUnmount: function() {
while (this.__unwatchFns.length) {
this.__unwatchFns.shift()()
}
}
}
}
/**
* Returns a mapping of the getDataBinding keys to
* the reactor values
*/
function getState(reactor, data) {
var state = {}
for (var key in data) {
state[key] = reactor.evaluate(data[key])
}
return state
}
/***/ },
/* 11 */
/***/ function(module, exports, __webpack_require__) {
/**
* Copyright (c) 2014, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
function universalModule() {
var $Object = Object;
function createClass(ctor, methods, staticMethods, superClass) {
var proto;
if (superClass) {
var superProto = superClass.prototype;
proto = $Object.create(superProto);
} else {
proto = ctor.prototype;
}
$Object.keys(methods).forEach(function (key) {
proto[key] = methods[key];
});
$Object.keys(staticMethods).forEach(function (key) {
ctor[key] = staticMethods[key];
});
proto.constructor = ctor;
ctor.prototype = proto;
return ctor;
}
function superCall(self, proto, name, args) {
return $Object.getPrototypeOf(proto)[name].apply(self, args);
}
function defaultSuperCall(self, proto, args) {
superCall(self, proto, 'constructor', args);
}
var $traceurRuntime = {};
$traceurRuntime.createClass = createClass;
$traceurRuntime.superCall = superCall;
$traceurRuntime.defaultSuperCall = defaultSuperCall;
"use strict";
function is(valueA, valueB) {
if (valueA === valueB || (valueA !== valueA && valueB !== valueB)) {
return true;
}
if (!valueA || !valueB) {
return false;
}
if (typeof valueA.valueOf === 'function' && typeof valueB.valueOf === 'function') {
valueA = valueA.valueOf();
valueB = valueB.valueOf();
}
return typeof valueA.equals === 'function' && typeof valueB.equals === 'function' ? valueA.equals(valueB) : valueA === valueB || (valueA !== valueA && valueB !== valueB);
}
function invariant(condition, error) {
if (!condition)
throw new Error(error);
}
var DELETE = 'delete';
var SHIFT = 5;
var SIZE = 1 << SHIFT;
var MASK = SIZE - 1;
var NOT_SET = {};
var CHANGE_LENGTH = {value: false};
var DID_ALTER = {value: false};
function MakeRef(ref) {
ref.value = false;
return ref;
}
function SetRef(ref) {
ref && (ref.value = true);
}
function OwnerID() {}
function arrCopy(arr, offset) {
offset = offset || 0;
var len = Math.max(0, arr.length - offset);
var newArr = new Array(len);
for (var ii = 0; ii < len; ii++) {
newArr[ii] = arr[ii + offset];
}
return newArr;
}
function assertNotInfinite(size) {
invariant(size !== Infinity, 'Cannot perform this action with an infinite size.');
}
function ensureSize(iter) {
if (iter.size === undefined) {
iter.size = iter.__iterate(returnTrue);
}
return iter.size;
}
function wrapIndex(iter, index) {
return index >= 0 ? (+index) : ensureSize(iter) + (+index);
}
function returnTrue() {
return true;
}
function wholeSlice(begin, end, size) {
return (begin === 0 || (size !== undefined && begin <= -size)) && (end === undefined || (size !== undefined && end >= size));
}
function resolveBegin(begin, size) {
return resolveIndex(begin, size, 0);
}
function resolveEnd(end, size) {
return resolveIndex(end, size, size);
}
function resolveIndex(index, size, defaultIndex) {
return index === undefined ? defaultIndex : index < 0 ? Math.max(0, size + index) : size === undefined ? index : Math.min(size, index);
}
var imul = typeof Math.imul === 'function' && Math.imul(0xffffffff, 2) === -2 ? Math.imul : function imul(a, b) {
a = a | 0;
b = b | 0;
var c = a & 0xffff;
var d = b & 0xffff;
return (c * d) + ((((a >>> 16) * d + c * (b >>> 16)) << 16) >>> 0) | 0;
};
function smi(i32) {
return ((i32 >>> 1) & 0x40000000) | (i32 & 0xBFFFFFFF);
}
function hash(o) {
if (o === false || o === null || o === undefined) {
return 0;
}
if (typeof o.valueOf === 'function') {
o = o.valueOf();
if (o === false || o === null || o === undefined) {
return 0;
}
}
if (o === true) {
return 1;
}
var type = typeof o;
if (type === 'number') {
var h = o | 0;
while (o > 0xFFFFFFFF) {
o /= 0xFFFFFFFF;
h ^= o;
}
return smi(h);
}
if (type === 'string') {
return o.length > STRING_HASH_CACHE_MIN_STRLEN ? cachedHashString(o) : hashString(o);
}
if (typeof o.hashCode === 'function') {
return o.hashCode();
}
return hashJSObj(o);
}
function cachedHashString(string) {
var hash = stringHashCache[string];
if (hash === undefined) {
hash = hashString(string);
if (STRING_HASH_CACHE_SIZE === STRING_HASH_CACHE_MAX_SIZE) {
STRING_HASH_CACHE_SIZE = 0;
stringHashCache = {};
}
STRING_HASH_CACHE_SIZE++;
stringHashCache[string] = hash;
}
return hash;
}
function hashString(string) {
var hash = 0;
for (var ii = 0; ii < string.length; ii++) {
hash = 31 * hash + string.charCodeAt(ii) | 0;
}
return smi(hash);
}
function hashJSObj(obj) {
var hash = weakMap && weakMap.get(obj);
if (hash)
return hash;
hash = obj[UID_HASH_KEY];
if (hash)
return hash;
if (!canDefineProperty) {
hash = obj.propertyIsEnumerable && obj.propertyIsEnumerable[UID_HASH_KEY];
if (hash)
return hash;
hash = getIENodeHash(obj);
if (hash)
return hash;
}
if (Object.isExtensible && !Object.isExtensible(obj)) {
throw new Error('Non-extensible objects are not allowed as keys.');
}
hash = ++objHashUID;
if (objHashUID & 0x40000000) {
objHashUID = 0;
}
if (weakMap) {
weakMap.set(obj, hash);
} else if (canDefineProperty) {
Object.defineProperty(obj, UID_HASH_KEY, {
'enumerable': false,
'configurable': false,
'writable': false,
'value': hash
});
} else if (obj.propertyIsEnumerable && obj.propertyIsEnumerable === obj.constructor.prototype.propertyIsEnumerable) {
obj.propertyIsEnumerable = function() {
return this.constructor.prototype.propertyIsEnumerable.apply(this, arguments);
};
obj.propertyIsEnumerable[UID_HASH_KEY] = hash;
} else if (obj.nodeType) {
obj[UID_HASH_KEY] = hash;
} else {
throw new Error('Unable to set a non-enumerable property on object.');
}
return hash;
}
var canDefineProperty = (function() {
try {
Object.defineProperty({}, 'x', {});
return true;
} catch (e) {
return false;
}
}());
function getIENodeHash(node) {
if (node && node.nodeType > 0) {
switch (node.nodeType) {
case 1:
return node.uniqueID;
case 9:
return node.documentElement && node.documentElement.uniqueID;
}
}
}
var weakMap = typeof WeakMap === 'function' && new WeakMap();
var objHashUID = 0;
var UID_HASH_KEY = '__immutablehash__';
if (typeof Symbol === 'function') {
UID_HASH_KEY = Symbol(UID_HASH_KEY);
}
var STRING_HASH_CACHE_MIN_STRLEN = 16;
var STRING_HASH_CACHE_MAX_SIZE = 255;
var STRING_HASH_CACHE_SIZE = 0;
var stringHashCache = {};
var ITERATE_KEYS = 0;
var ITERATE_VALUES = 1;
var ITERATE_ENTRIES = 2;
var FAUX_ITERATOR_SYMBOL = '@@iterator';
var REAL_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
var ITERATOR_SYMBOL = REAL_ITERATOR_SYMBOL || FAUX_ITERATOR_SYMBOL;
var Iterator = function Iterator(next) {
this.next = next;
};
($traceurRuntime.createClass)(Iterator, {toString: function() {
return '[Iterator]';
}}, {});
Iterator.KEYS = ITERATE_KEYS;
Iterator.VALUES = ITERATE_VALUES;
Iterator.ENTRIES = ITERATE_ENTRIES;
var IteratorPrototype = Iterator.prototype;
IteratorPrototype.inspect = IteratorPrototype.toSource = function() {
return this.toString();
};
IteratorPrototype[ITERATOR_SYMBOL] = function() {
return this;
};
function iteratorValue(type, k, v, iteratorResult) {
var value = type === 0 ? k : type === 1 ? v : [k, v];
iteratorResult ? (iteratorResult.value = value) : (iteratorResult = {
value: value,
done: false
});
return iteratorResult;
}
function iteratorDone() {
return {
value: undefined,
done: true
};
}
function hasIterator(maybeIterable) {
return !!_iteratorFn(maybeIterable);
}
function isIterator(maybeIterator) {
return maybeIterator && typeof maybeIterator.next === 'function';
}
function getIterator(iterable) {
var iteratorFn = _iteratorFn(iterable);
return iteratorFn && iteratorFn.call(iterable);
}
function _iteratorFn(iterable) {
var iteratorFn = iterable && ((REAL_ITERATOR_SYMBOL && iterable[REAL_ITERATOR_SYMBOL]) || iterable[FAUX_ITERATOR_SYMBOL]);
if (typeof iteratorFn === 'function') {
return iteratorFn;
}
}
var Iterable = function Iterable(value) {
return isIterable(value) ? value : Seq(value);
};
var $Iterable = Iterable;
($traceurRuntime.createClass)(Iterable, {
toArray: function() {
assertNotInfinite(this.size);
var array = new Array(this.size || 0);
this.valueSeq().__iterate((function(v, i) {
array[i] = v;
}));
return array;
},
toIndexedSeq: function() {
return new ToIndexedSequence(this);
},
toJS: function() {
return this.toSeq().map((function(value) {
return value && typeof value.toJS === 'function' ? value.toJS() : value;
})).__toJS();
},
toKeyedSeq: function() {
return new ToKeyedSequence(this, true);
},
toMap: function() {
return Map(this.toKeyedSeq());
},
toObject: function() {
assertNotInfinite(this.size);
var object = {};
this.__iterate((function(v, k) {
object[k] = v;
}));
return object;
},
toOrderedMap: function() {
return OrderedMap(this.toKeyedSeq());
},
toOrderedSet: function() {
return OrderedSet(isKeyed(this) ? this.valueSeq() : this);
},
toSet: function() {
return Set(isKeyed(this) ? this.valueSeq() : this);
},
toSetSeq: function() {
return new ToSetSequence(this);
},
toSeq: function() {
return isIndexed(this) ? this.toIndexedSeq() : isKeyed(this) ? this.toKeyedSeq() : this.toSetSeq();
},
toStack: function() {
return Stack(isKeyed(this) ? this.valueSeq() : this);
},
toList: function() {
return List(isKeyed(this) ? this.valueSeq() : this);
},
toString: function() {
return '[Iterable]';
},
__toString: function(head, tail) {
if (this.size === 0) {
return head + tail;
}
return head + ' ' + this.toSeq().map(this.__toStringMapper).join(', ') + ' ' + tail;
},
concat: function() {
for (var values = [],
$__2 = 0; $__2 < arguments.length; $__2++)
values[$__2] = arguments[$__2];
return reify(this, concatFactory(this, values));
},
contains: function(searchValue) {
return this.some((function(value) {
return is(value, searchValue);
}));
},
entries: function() {
return this.__iterator(ITERATE_ENTRIES);
},
every: function(predicate, context) {
assertNotInfinite(this.size);
var returnValue = true;
this.__iterate((function(v, k, c) {
if (!predicate.call(context, v, k, c)) {
returnValue = false;
return false;
}
}));
return returnValue;
},
filter: function(predicate, context) {
return reify(this, filterFactory(this, predicate, context, true));
},
find: function(predicate, context, notSetValue) {
var foundValue = notSetValue;
this.__iterate((function(v, k, c) {
if (predicate.call(context, v, k, c)) {
foundValue = v;
return false;
}
}));
return foundValue;
},
forEach: function(sideEffect, context) {
assertNotInfinite(this.size);
return this.__iterate(context ? sideEffect.bind(context) : sideEffect);
},
join: function(separator) {
assertNotInfinite(this.size);
separator = separator !== undefined ? '' + separator : ',';
var joined = '';
var isFirst = true;
this.__iterate((function(v) {
isFirst ? (isFirst = false) : (joined += separator);
joined += v !== null && v !== undefined ? v : '';
}));
return joined;
},
keys: function() {
return this.__iterator(ITERATE_KEYS);
},
map: function(mapper, context) {
return reify(this, mapFactory(this, mapper, context));
},
reduce: function(reducer, initialReduction, context) {
assertNotInfinite(this.size);
var reduction;
var useFirst;
if (arguments.length < 2) {
useFirst = true;
} else {
reduction = initialReduction;
}
this.__iterate((function(v, k, c) {
if (useFirst) {
useFirst = false;
reduction = v;
} else {
reduction = reducer.call(context, reduction, v, k, c);
}
}));
return reduction;
},
reduceRight: function(reducer, initialReduction, context) {
var reversed = this.toKeyedSeq().reverse();
return reversed.reduce.apply(reversed, arguments);
},
reverse: function() {
return reify(this, reverseFactory(this, true));
},
slice: function(begin, end) {
if (wholeSlice(begin, end, this.size)) {
return this;
}
var resolvedBegin = resolveBegin(begin, this.size);
var resolvedEnd = resolveEnd(end, this.size);
if (resolvedBegin !== resolvedBegin || resolvedEnd !== resolvedEnd) {
return this.toSeq().cacheResult().slice(begin, end);
}
var skipped = resolvedBegin === 0 ? this : this.skip(resolvedBegin);
return reify(this, resolvedEnd === undefined || resolvedEnd === this.size ? skipped : skipped.take(resolvedEnd - resolvedBegin));
},
some: function(predicate, context) {
return !this.every(not(predicate), context);
},
sort: function(comparator) {
return reify(this, sortFactory(this, comparator));
},
values: function() {
return this.__iterator(ITERATE_VALUES);
},
butLast: function() {
return this.slice(0, -1);
},
count: function(predicate, context) {
return ensureSize(predicate ? this.toSeq().filter(predicate, context) : this);
},
countBy: function(grouper, context) {
return countByFactory(this, grouper, context);
},
equals: function(other) {
return deepEqual(this, other);
},
entrySeq: function() {
var iterable = this;
if (iterable._cache) {
return new ArraySeq(iterable._cache);
}
var entriesSequence = iterable.toSeq().map(entryMapper).toIndexedSeq();
entriesSequence.fromEntrySeq = (function() {
return iterable.toSeq();
});
return entriesSequence;
},
filterNot: function(predicate, context) {
return this.filter(not(predicate), context);
},
findLast: function(predicate, context, notSetValue) {
return this.toKeyedSeq().reverse().find(predicate, context, notSetValue);
},
first: function() {
return this.find(returnTrue);
},
flatMap: function(mapper, context) {
return reify(this, flatMapFactory(this, mapper, context));
},
flatten: function(depth) {
return reify(this, flattenFactory(this, depth, true));
},
fromEntrySeq: function() {
return new FromEntriesSequence(this);
},
get: function(searchKey, notSetValue) {
return this.find((function(_, key) {
return is(key, searchKey);
}), undefined, notSetValue);
},
getIn: function(searchKeyPath, notSetValue) {
var nested = this;
if (searchKeyPath) {
var iter = getIterator(searchKeyPath) || getIterator($Iterable(searchKeyPath));
var step;
while (!(step = iter.next()).done) {
var key = step.value;
nested = nested && nested.get ? nested.get(key, NOT_SET) : NOT_SET;
if (nested === NOT_SET) {
return notSetValue;
}
}
}
return nested;
},
groupBy: function(grouper, context) {
return groupByFactory(this, grouper, context);
},
has: function(searchKey) {
return this.get(searchKey, NOT_SET) !== NOT_SET;
},
hasIn: function(searchKeyPath) {
return this.getIn(searchKeyPath, NOT_SET) !== NOT_SET;
},
isSubset: function(iter) {
iter = typeof iter.contains === 'function' ? iter : $Iterable(iter);
return this.every((function(value) {
return iter.contains(value);
}));
},
isSuperset: function(iter) {
return iter.isSubset(this);
},
keySeq: function() {
return this.toSeq().map(keyMapper).toIndexedSeq();
},
last: function() {
return this.toSeq().reverse().first();
},
max: function(comparator) {
return maxFactory(this, comparator);
},
maxBy: function(mapper, comparator) {
return maxFactory(this, comparator, mapper);
},
min: function(comparator) {
return maxFactory(this, comparator ? neg(comparator) : defaultNegComparator);
},
minBy: function(mapper, comparator) {
return maxFactory(this, comparator ? neg(comparator) : defaultNegComparator, mapper);
},
rest: function() {
return this.slice(1);
},
skip: function(amount) {
return reify(this, skipFactory(this, amount, true));
},
skipLast: function(amount) {
return reify(this, this.toSeq().reverse().skip(amount).reverse());
},
skipWhile: function(predicate, context) {
return reify(this, skipWhileFactory(this, predicate, context, true));
},
skipUntil: function(predicate, context) {
return this.skipWhile(not(predicate), context);
},
sortBy: function(mapper, comparator) {
return reify(this, sortFactory(this, comparator, mapper));
},
take: function(amount) {
return reify(this, takeFactory(this, amount));
},
takeLast: function(amount) {
return reify(this, this.toSeq().reverse().take(amount).reverse());
},
takeWhile: function(predicate, context) {
return reify(this, takeWhileFactory(this, predicate, context));
},
takeUntil: function(predicate, context) {
return this.takeWhile(not(predicate), context);
},
valueSeq: function() {
return this.toIndexedSeq();
},
hashCode: function() {
return this.__hash || (this.__hash = hashIterable(this));
}
}, {});
var IS_ITERABLE_SENTINEL = '@@__IMMUTABLE_ITERABLE__@@';
var IS_KEYED_SENTINEL = '@@__IMMUTABLE_KEYED__@@';
var IS_INDEXED_SENTINEL = '@@__IMMUTABLE_INDEXED__@@';
var IS_ORDERED_SENTINEL = '@@__IMMUTABLE_ORDERED__@@';
var IterablePrototype = Iterable.prototype;
IterablePrototype[IS_ITERABLE_SENTINEL] = true;
IterablePrototype[ITERATOR_SYMBOL] = IterablePrototype.values;
IterablePrototype.toJSON = IterablePrototype.toJS;
IterablePrototype.__toJS = IterablePrototype.toArray;
IterablePrototype.__toStringMapper = quoteString;
IterablePrototype.inspect = IterablePrototype.toSource = function() {
return this.toString();
};
IterablePrototype.chain = IterablePrototype.flatMap;
(function() {
try {
Object.defineProperty(IterablePrototype, 'length', {get: function() {
if (!Iterable.noLengthWarning) {
var stack;
try {
throw new Error();
} catch (error) {
stack = error.stack;
}
if (stack.indexOf('_wrapObject') === -1) {
console && console.warn && console.warn('iterable.length has been deprecated, ' + 'use iterable.size or iterable.count(). ' + 'This warning will become a silent error in a future version. ' + stack);
return this.size;
}
}
}});
} catch (e) {}
})();
var KeyedIterable = function KeyedIterable(value) {
return isKeyed(value) ? value : KeyedSeq(value);
};
($traceurRuntime.createClass)(KeyedIterable, {
flip: function() {
return reify(this, flipFactory(this));
},
findKey: function(predicate, context) {
var foundKey;
this.__iterate((function(v, k, c) {
if (predicate.call(context, v, k, c)) {
foundKey = k;
return false;
}
}));
return foundKey;
},
findLastKey: function(predicate, context) {
return this.toSeq().reverse().findKey(predicate, context);
},
keyOf: function(searchValue) {
return this.findKey((function(value) {
return is(value, searchValue);
}));
},
lastKeyOf: function(searchValue) {
return this.toSeq().reverse().keyOf(searchValue);
},
mapEntries: function(mapper, context) {
var $__0 = this;
var iterations = 0;
return reify(this, this.toSeq().map((function(v, k) {
return mapper.call(context, [k, v], iterations++, $__0);
})).fromEntrySeq());
},
mapKeys: function(mapper, context) {
var $__0 = this;
return reify(this, this.toSeq().flip().map((function(k, v) {
return mapper.call(context, k, v, $__0);
})).flip());
}
}, {}, Iterable);
var KeyedIterablePrototype = KeyedIterable.prototype;
KeyedIterablePrototype[IS_KEYED_SENTINEL] = true;
KeyedIterablePrototype[ITERATOR_SYMBOL] = IterablePrototype.entries;
KeyedIterablePrototype.__toJS = IterablePrototype.toObject;
KeyedIterablePrototype.__toStringMapper = (function(v, k) {
return k + ': ' + quoteString(v);
});
var IndexedIterable = function IndexedIterable(value) {
return isIndexed(value) ? value : IndexedSeq(value);
};
($traceurRuntime.createClass)(IndexedIterable, {
toKeyedSeq: function() {
return new ToKeyedSequence(this, false);
},
filter: function(predicate, context) {
return reify(this, filterFactory(this, predicate, context, false));
},
findIndex: function(predicate, context) {
var key = this.toKeyedSeq().findKey(predicate, context);
return key === undefined ? -1 : key;
},
indexOf: function(searchValue) {
var key = this.toKeyedSeq().keyOf(searchValue);
return key === undefined ? -1 : key;
},
lastIndexOf: function(searchValue) {
var key = this.toKeyedSeq().lastKeyOf(searchValue);
return key === undefined ? -1 : key;
},
reverse: function() {
return reify(this, reverseFactory(this, false));
},
splice: function(index, removeNum) {
var numArgs = arguments.length;
removeNum = Math.max(removeNum | 0, 0);
if (numArgs === 0 || (numArgs === 2 && !removeNum)) {
return this;
}
index = resolveBegin(index, this.size);
var spliced = this.slice(0, index);
return reify(this, numArgs === 1 ? spliced : spliced.concat(arrCopy(arguments, 2), this.slice(index + removeNum)));
},
findLastIndex: function(predicate, context) {
var key = this.toKeyedSeq().findLastKey(predicate, context);
return key === undefined ? -1 : key;
},
first: function() {
return this.get(0);
},
flatten: function(depth) {
return reify(this, flattenFactory(this, depth, false));
},
get: function(index, notSetValue) {
index = wrapIndex(this, index);
return (index < 0 || (this.size === Infinity || (this.size !== undefined && index > this.size))) ? notSetValue : this.find((function(_, key) {
return key === index;
}), undefined, notSetValue);
},
has: function(index) {
index = wrapIndex(this, index);
return index >= 0 && (this.size !== undefined ? this.size === Infinity || index < this.size : this.indexOf(index) !== -1);
},
interpose: function(separator) {
return reify(this, interposeFactory(this, separator));
},
last: function() {
return this.get(-1);
},
skip: function(amount) {
var iter = this;
var skipSeq = skipFactory(iter, amount, false);
if (isSeq(iter) && skipSeq !== iter) {
skipSeq.get = function(index, notSetValue) {
index = wrapIndex(this, index);
return index >= 0 ? iter.get(index + amount, notSetValue) : notSetValue;
};
}
return reify(this, skipSeq);
},
skipWhile: function(predicate, context) {
return reify(this, skipWhileFactory(this, predicate, context, false));
},
take: function(amount) {
var iter = this;
var takeSeq = takeFactory(iter, amount);
if (isSeq(iter) && takeSeq !== iter) {
takeSeq.get = function(index, notSetValue) {
index = wrapIndex(this, index);
return index >= 0 && index < amount ? iter.get(index, notSetValue) : notSetValue;
};
}
return reify(this, takeSeq);
}
}, {}, Iterable);
IndexedIterable.prototype[IS_INDEXED_SENTINEL] = true;
IndexedIterable.prototype[IS_ORDERED_SENTINEL] = true;
var SetIterable = function SetIterable(value) {
return isIterable(value) && !isAssociative(value) ? value : SetSeq(value);
};
($traceurRuntime.createClass)(SetIterable, {
get: function(value, notSetValue) {
return this.has(value) ? value : notSetValue;
},
contains: function(value) {
return this.has(value);
},
keySeq: function() {
return this.valueSeq();
}
}, {}, Iterable);
SetIterable.prototype.has = IterablePrototype.contains;
function isIterable(maybeIterable) {
return !!(maybeIterable && maybeIterable[IS_ITERABLE_SENTINEL]);
}
function isKeyed(maybeKeyed) {
return !!(maybeKeyed && maybeKeyed[IS_KEYED_SENTINEL]);
}
function isIndexed(maybeIndexed) {
return !!(maybeIndexed && maybeIndexed[IS_INDEXED_SENTINEL]);
}
function isAssociative(maybeAssociative) {
return isKeyed(maybeAssociative) || isIndexed(maybeAssociative);
}
function isOrdered(maybeOrdered) {
return !!(maybeOrdered && maybeOrdered[IS_ORDERED_SENTINEL]);
}
Iterable.isIterable = isIterable;
Iterable.isKeyed = isKeyed;
Iterable.isIndexed = isIndexed;
Iterable.isAssociative = isAssociative;
Iterable.isOrdered = isOrdered;
Iterable.Keyed = KeyedIterable;
Iterable.Indexed = IndexedIterable;
Iterable.Set = SetIterable;
Iterable.Iterator = Iterator;
function keyMapper(v, k) {
return k;
}
function entryMapper(v, k) {
return [k, v];
}
function not(predicate) {
return function() {
return !predicate.apply(this, arguments);
};
}
function neg(predicate) {
return function() {
return -predicate.apply(this, arguments);
};
}
function quoteString(value) {
return typeof value === 'string' ? JSON.stringify(value) : value;
}
function defaultNegComparator(a, b) {
return a < b ? 1 : a > b ? -1 : 0;
}
function deepEqual(a, b) {
if (a === b) {
return true;
}
if (!isIterable(b) || a.size !== undefined && b.size !== undefined && a.size !== b.size || a.__hash !== undefined && b.__hash !== undefined && a.__hash !== b.__hash || isKeyed(a) !== isKeyed(b) || isIndexed(a) !== isIndexed(b) || isOrdered(a) !== isOrdered(b)) {
return false;
}
if (a.size === 0 && b.size === 0) {
return true;
}
var notAssociative = !isAssociative(a);
if (isOrdered(a)) {
var entries = a.entries();
return b.every((function(v, k) {
var entry = entries.next().value;
return entry && is(entry[1], v) && (notAssociative || is(entry[0], k));
})) && entries.next().done;
}
var flipped = false;
if (a.size === undefined) {
if (b.size === undefined) {
a.cacheResult();
} else {
flipped = true;
var _ = a;
a = b;
b = _;
}
}
var allEqual = true;
var bSize = b.__iterate((function(v, k) {
if (notAssociative ? !a.has(v) : flipped ? !is(v, a.get(k, NOT_SET)) : !is(a.get(k, NOT_SET), v)) {
allEqual = false;
return false;
}
}));
return allEqual && a.size === bSize;
}
function hashIterable(iterable) {
if (iterable.size === Infinity) {
return 0;
}
var ordered = isOrdered(iterable);
var keyed = isKeyed(iterable);
var h = ordered ? 1 : 0;
var size = iterable.__iterate(keyed ? ordered ? (function(v, k) {
h = 31 * h + hashMerge(hash(v), hash(k)) | 0;
}) : (function(v, k) {
h = h + hashMerge(hash(v), hash(k)) | 0;
}) : ordered ? (function(v) {
h = 31 * h + hash(v) | 0;
}) : (function(v) {
h = h + hash(v) | 0;
}));
return murmurHashOfSize(size, h);
}
function murmurHashOfSize(size, h) {
h = imul(h, 0xCC9E2D51);
h = imul(h << 15 | h >>> -15, 0x1B873593);
h = imul(h << 13 | h >>> -13, 5);
h = (h + 0xE6546B64 | 0) ^ size;
h = imul(h ^ h >>> 16, 0x85EBCA6B);
h = imul(h ^ h >>> 13, 0xC2B2AE35);
h = smi(h ^ h >>> 16);
return h;
}
function hashMerge(a, b) {
return a ^ b + 0x9E3779B9 + (a << 6) + (a >> 2) | 0;
}
function mixin(ctor, methods) {
var proto = ctor.prototype;
var keyCopier = (function(key) {
proto[key] = methods[key];
});
Object.keys(methods).forEach(keyCopier);
Object.getOwnPropertySymbols && Object.getOwnPropertySymbols(methods).forEach(keyCopier);
return ctor;
}
var Seq = function Seq(value) {
return value === null || value === undefined ? emptySequence() : isIterable(value) ? value.toSeq() : seqFromValue(value);
};
var $Seq = Seq;
($traceurRuntime.createClass)(Seq, {
toSeq: function() {
return this;
},
toString: function() {
return this.__toString('Seq {', '}');
},
cacheResult: function() {
if (!this._cache && this.__iterateUncached) {
this._cache = this.entrySeq().toArray();
this.size = this._cache.length;
}
return this;
},
__iterate: function(fn, reverse) {
return seqIterate(this, fn, reverse, true);
},
__iterator: function(type, reverse) {
return seqIterator(this, type, reverse, true);
}
}, {of: function() {
return $Seq(arguments);
}}, Iterable);
var KeyedSeq = function KeyedSeq(value) {
return value === null || value === undefined ? emptySequence().toKeyedSeq() : isIterable(value) ? (isKeyed(value) ? value.toSeq() : value.fromEntrySeq()) : keyedSeqFromValue(value);
};
var $KeyedSeq = KeyedSeq;
($traceurRuntime.createClass)(KeyedSeq, {
toKeyedSeq: function() {
return this;
},
toSeq: function() {
return this;
}
}, {of: function() {
return $KeyedSeq(arguments);
}}, Seq);
mixin(KeyedSeq, KeyedIterable.prototype);
var IndexedSeq = function IndexedSeq(value) {
return value === null || value === undefined ? emptySequence() : !isIterable(value) ? indexedSeqFromValue(value) : isKeyed(value) ? value.entrySeq() : value.toIndexedSeq();
};
var $IndexedSeq = IndexedSeq;
($traceurRuntime.createClass)(IndexedSeq, {
toIndexedSeq: function() {
return this;
},
toString: function() {
return this.__toString('Seq [', ']');
},
__iterate: function(fn, reverse) {
return seqIterate(this, fn, reverse, false);
},
__iterator: function(type, reverse) {
return seqIterator(this, type, reverse, false);
}
}, {of: function() {
return $IndexedSeq(arguments);
}}, Seq);
mixin(IndexedSeq, IndexedIterable.prototype);
var SetSeq = function SetSeq(value) {
return (value === null || value === undefined ? emptySequence() : !isIterable(value) ? indexedSeqFromValue(value) : isKeyed(value) ? value.entrySeq() : value).toSetSeq();
};
var $SetSeq = SetSeq;
($traceurRuntime.createClass)(SetSeq, {toSetSeq: function() {
return this;
}}, {of: function() {
return $SetSeq(arguments);
}}, Seq);
mixin(SetSeq, SetIterable.prototype);
Seq.isSeq = isSeq;
Seq.Keyed = KeyedSeq;
Seq.Set = SetSeq;
Seq.Indexed = IndexedSeq;
var IS_SEQ_SENTINEL = '@@__IMMUTABLE_SEQ__@@';
Seq.prototype[IS_SEQ_SENTINEL] = true;
var ArraySeq = function ArraySeq(array) {
this._array = array;
this.size = array.length;
};
($traceurRuntime.createClass)(ArraySeq, {
get: function(index, notSetValue) {
return this.has(index) ? this._array[wrapIndex(this, index)] : notSetValue;
},
__iterate: function(fn, reverse) {
var array = this._array;
var maxIndex = array.length - 1;
for (var ii = 0; ii <= maxIndex; ii++) {
if (fn(array[reverse ? maxIndex - ii : ii], ii, this) === false) {
return ii + 1;
}
}
return ii;
},
__iterator: function(type, reverse) {
var array = this._array;
var maxIndex = array.length - 1;
var ii = 0;
return new Iterator((function() {
return ii > maxIndex ? iteratorDone() : iteratorValue(type, ii, array[reverse ? maxIndex - ii++ : ii++]);
}));
}
}, {}, IndexedSeq);
var ObjectSeq = function ObjectSeq(object) {
var keys = Object.keys(object);
this._object = object;
this._keys = keys;
this.size = keys.length;
};
($traceurRuntime.createClass)(ObjectSeq, {
get: function(key, notSetValue) {
if (notSetValue !== undefined && !this.has(key)) {
return notSetValue;
}
return this._object[key];
},
has: function(key) {
return this._object.hasOwnProperty(key);
},
__iterate: function(fn, reverse) {
var object = this._object;
var keys = this._keys;
var maxIndex = keys.length - 1;
for (var ii = 0; ii <= maxIndex; ii++) {
var key = keys[reverse ? maxIndex - ii : ii];
if (fn(object[key], key, this) === false) {
return ii + 1;
}
}
return ii;
},
__iterator: function(type, reverse) {
var object = this._object;
var keys = this._keys;
var maxIndex = keys.length - 1;
var ii = 0;
return new Iterator((function() {
var key = keys[reverse ? maxIndex - ii : ii];
return ii++ > maxIndex ? iteratorDone() : iteratorValue(type, key, object[key]);
}));
}
}, {}, KeyedSeq);
ObjectSeq.prototype[IS_ORDERED_SENTINEL] = true;
var IterableSeq = function IterableSeq(iterable) {
this._iterable = iterable;
this.size = iterable.length || iterable.size;
};
($traceurRuntime.createClass)(IterableSeq, {
__iterateUncached: function(fn, reverse) {
if (reverse) {
return this.cacheResult().__iterate(fn, reverse);
}
var iterable = this._iterable;
var iterator = getIterator(iterable);
var iterations = 0;
if (isIterator(iterator)) {
var step;
while (!(step = iterator.next()).done) {
if (fn(step.value, iterations++, this) === false) {
break;
}
}
}
return iterations;
},
__iteratorUncached: function(type, reverse) {
if (reverse) {
return this.cacheResult().__iterator(type, reverse);
}
var iterable = this._iterable;
var iterator = getIterator(iterable);
if (!isIterator(iterator)) {
return new Iterator(iteratorDone);
}
var iterations = 0;
return new Iterator((function() {
var step = iterator.next();
return step.done ? step : iteratorValue(type, iterations++, step.value);
}));
}
}, {}, IndexedSeq);
var IteratorSeq = function IteratorSeq(iterator) {
this._iterator = iterator;
this._iteratorCache = [];
};
($traceurRuntime.createClass)(IteratorSeq, {
__iterateUncached: function(fn, reverse) {
if (reverse) {
return this.cacheResult().__iterate(fn, reverse);
}
var iterator = this._iterator;
var cache = this._iteratorCache;
var iterations = 0;
while (iterations < cache.length) {
if (fn(cache[iterations], iterations++, this) === false) {
return iterations;
}
}
var step;
while (!(step = iterator.next()).done) {
var val = step.value;
cache[iterations] = val;
if (fn(val, iterations++, this) === false) {
break;
}
}
return iterations;
},
__iteratorUncached: function(type, reverse) {
if (reverse) {
return this.cacheResult().__iterator(type, reverse);
}
var iterator = this._iterator;
var cache = this._iteratorCache;
var iterations = 0;
return new Iterator((function() {
if (iterations >= cache.length) {
var step = iterator.next();
if (step.done) {
return step;
}
cache[iterations] = step.value;
}
return iteratorValue(type, iterations, cache[iterations++]);
}));
}
}, {}, IndexedSeq);
function isSeq(maybeSeq) {
return !!(maybeSeq && maybeSeq[IS_SEQ_SENTINEL]);
}
var EMPTY_SEQ;
function emptySequence() {
return EMPTY_SEQ || (EMPTY_SEQ = new ArraySeq([]));
}
function keyedSeqFromValue(value) {
var seq = Array.isArray(value) ? new ArraySeq(value).fromEntrySeq() : isIterator(value) ? new IteratorSeq(value).fromEntrySeq() : hasIterator(value) ? new IterableSeq(value).fromEntrySeq() : typeof value === 'object' ? new ObjectSeq(value) : undefined;
if (!seq) {
throw new TypeError('Expected Array or iterable object of [k, v] entries, ' + 'or keyed object: ' + value);
}
return seq;
}
function indexedSeqFromValue(value) {
var seq = maybeIndexedSeqFromValue(value);
if (!seq) {
throw new TypeError('Expected Array or iterable object of values: ' + value);
}
return seq;
}
function seqFromValue(value) {
var seq = maybeIndexedSeqFromValue(value) || (typeof value === 'object' && new ObjectSeq(value));
if (!seq) {
throw new TypeError('Expected Array or iterable object of values, or keyed object: ' + value);
}
return seq;
}
function maybeIndexedSeqFromValue(value) {
return (isArrayLike(value) ? new ArraySeq(value) : isIterator(value) ? new IteratorSeq(value) : hasIterator(value) ? new IterableSeq(value) : undefined);
}
function isArrayLike(value) {
return value && typeof value.length === 'number';
}
function seqIterate(seq, fn, reverse, useKeys) {
var cache = seq._cache;
if (cache) {
var maxIndex = cache.length - 1;
for (var ii = 0; ii <= maxIndex; ii++) {
var entry = cache[reverse ? maxIndex - ii : ii];
if (fn(entry[1], useKeys ? entry[0] : ii, seq) === false) {
return ii + 1;
}
}
return ii;
}
return seq.__iterateUncached(fn, reverse);
}
function seqIterator(seq, type, reverse, useKeys) {
var cache = seq._cache;
if (cache) {
var maxIndex = cache.length - 1;
var ii = 0;
return new Iterator((function() {
var entry = cache[reverse ? maxIndex - ii : ii];
return ii++ > maxIndex ? iteratorDone() : iteratorValue(type, useKeys ? entry[0] : ii - 1, entry[1]);
}));
}
return seq.__iteratorUncached(type, reverse);
}
function fromJS(json, converter) {
return converter ? _fromJSWith(converter, json, '', {'': json}) : _fromJSDefault(json);
}
function _fromJSWith(converter, json, key, parentJSON) {
if (Array.isArray(json)) {
return converter.call(parentJSON, key, IndexedSeq(json).map((function(v, k) {
return _fromJSWith(converter, v, k, json);
})));
}
if (isPlainObj(json)) {
return converter.call(parentJSON, key, KeyedSeq(json).map((function(v, k) {
return _fromJSWith(converter, v, k, json);
})));
}
return json;
}
function _fromJSDefault(json) {
if (Array.isArray(json)) {
return IndexedSeq(json).map(_fromJSDefault).toList();
}
if (isPlainObj(json)) {
return KeyedSeq(json).map(_fromJSDefault).toMap();
}
return json;
}
function isPlainObj(value) {
return value && value.constructor === Object;
}
var Collection = function Collection() {
throw TypeError('Abstract');
};
($traceurRuntime.createClass)(Collection, {}, {}, Iterable);
var KeyedCollection = function KeyedCollection() {
$traceurRuntime.defaultSuperCall(this, $KeyedCollection.prototype, arguments);
};
var $KeyedCollection = KeyedCollection;
($traceurRuntime.createClass)(KeyedCollection, {}, {}, Collection);
mixin(KeyedCollection, KeyedIterable.prototype);
var IndexedCollection = function IndexedCollection() {
$traceurRuntime.defaultSuperCall(this, $IndexedCollection.prototype, arguments);
};
var $IndexedCollection = IndexedCollection;
($traceurRuntime.createClass)(IndexedCollection, {}, {}, Collection);
mixin(IndexedCollection, IndexedIterable.prototype);
var SetCollection = function SetCollection() {
$traceurRuntime.defaultSuperCall(this, $SetCollection.prototype, arguments);
};
var $SetCollection = SetCollection;
($traceurRuntime.createClass)(SetCollection, {}, {}, Collection);
mixin(SetCollection, SetIterable.prototype);
Collection.Keyed = KeyedCollection;
Collection.Indexed = IndexedCollection;
Collection.Set = SetCollection;
var Map = function Map(value) {
return value === null || value === undefined ? emptyMap() : isMap(value) ? value : emptyMap().withMutations((function(map) {
var iter = KeyedIterable(value);
assertNotInfinite(iter.size);
iter.forEach((function(v, k) {
return map.set(k, v);
}));
}));
};
($traceurRuntime.createClass)(Map, {
toString: function() {
return this.__toString('Map {', '}');
},
get: function(k, notSetValue) {
return this._root ? this._root.get(0, undefined, k, notSetValue) : notSetValue;
},
set: function(k, v) {
return updateMap(this, k, v);
},
setIn: function(keyPath, v) {
return this.updateIn(keyPath, NOT_SET, (function() {
return v;
}));
},
remove: function(k) {
return updateMap(this, k, NOT_SET);
},
deleteIn: function(keyPath) {
return this.updateIn(keyPath, (function() {
return NOT_SET;
}));
},
update: function(k, notSetValue, updater) {
return arguments.length === 1 ? k(this) : this.updateIn([k], notSetValue, updater);
},
updateIn: function(keyPath, notSetValue, updater) {
if (!updater) {
updater = notSetValue;
notSetValue = undefined;
}
var updatedValue = updateInDeepMap(this, getIterator(keyPath) || getIterator(Iterable(keyPath)), notSetValue, updater);
return updatedValue === NOT_SET ? undefined : updatedValue;
},
clear: function() {
if (this.size === 0) {
return this;
}
if (this.__ownerID) {
this.size = 0;
this._root = null;
this.__hash = undefined;
this.__altered = true;
return this;
}
return emptyMap();
},
merge: function() {
return mergeIntoMapWith(this, undefined, arguments);
},
mergeWith: function(merger) {
for (var iters = [],
$__3 = 1; $__3 < arguments.length; $__3++)
iters[$__3 - 1] = arguments[$__3];
return mergeIntoMapWith(this, merger, iters);
},
mergeIn: function(keyPath) {
for (var iters = [],
$__4 = 1; $__4 < arguments.length; $__4++)
iters[$__4 - 1] = arguments[$__4];
return this.updateIn(keyPath, emptyMap(), (function(m) {
return m.merge.apply(m, iters);
}));
},
mergeDeep: function() {
return mergeIntoMapWith(this, deepMerger(undefined), arguments);
},
mergeDeepWith: function(merger) {
for (var iters = [],
$__5 = 1; $__5 < arguments.length; $__5++)
iters[$__5 - 1] = arguments[$__5];
return mergeIntoMapWith(this, deepMerger(merger), iters);
},
mergeDeepIn: function(keyPath) {
for (var iters = [],
$__6 = 1; $__6 < arguments.length; $__6++)
iters[$__6 - 1] = arguments[$__6];
return this.updateIn(keyPath, emptyMap(), (function(m) {
return m.mergeDeep.apply(m, iters);
}));
},
sort: function(comparator) {
return OrderedMap(sortFactory(this, comparator));
},
sortBy: function(mapper, comparator) {
return OrderedMap(sortFactory(this, comparator, mapper));
},
withMutations: function(fn) {
var mutable = this.asMutable();
fn(mutable);
return mutable.wasAltered() ? mutable.__ensureOwner(this.__ownerID) : this;
},
asMutable: function() {
return this.__ownerID ? this : this.__ensureOwner(new OwnerID());
},
asImmutable: function() {
return this.__ensureOwner();
},
wasAltered: function() {
return this.__altered;
},
__iterator: function(type, reverse) {
return new MapIterator(this, type, reverse);
},
__iterate: function(fn, reverse) {
var $__0 = this;
var iterations = 0;
this._root && this._root.iterate((function(entry) {
iterations++;
return fn(entry[1], entry[0], $__0);
}), reverse);
return iterations;
},
__ensureOwner: function(ownerID) {
if (ownerID === this.__ownerID) {
return this;
}
if (!ownerID) {
this.__ownerID = ownerID;
this.__altered = false;
return this;
}
return makeMap(this.size, this._root, ownerID, this.__hash);
}
}, {}, KeyedCollection);
function isMap(maybeMap) {
return !!(maybeMap && maybeMap[IS_MAP_SENTINEL]);
}
Map.isMap = isMap;
var IS_MAP_SENTINEL = '@@__IMMUTABLE_MAP__@@';
var MapPrototype = Map.prototype;
MapPrototype[IS_MAP_SENTINEL] = true;
MapPrototype[DELETE] = MapPrototype.remove;
MapPrototype.removeIn = MapPrototype.deleteIn;
var ArrayMapNode = function ArrayMapNode(ownerID, entries) {
this.ownerID = ownerID;
this.entries = entries;
};
var $ArrayMapNode = ArrayMapNode;
($traceurRuntime.createClass)(ArrayMapNode, {
get: function(shift, keyHash, key, notSetValue) {
var entries = this.entries;
for (var ii = 0,
len = entries.length; ii < len; ii++) {
if (is(key, entries[ii][0])) {
return entries[ii][1];
}
}
return notSetValue;
},
update: function(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {
var removed = value === NOT_SET;
var entries = this.entries;
var idx = 0;
for (var len = entries.length; idx < len; idx++) {
if (is(key, entries[idx][0])) {
break;
}
}
var exists = idx < len;
if (exists ? entries[idx][1] === value : removed) {
return this;
}
SetRef(didAlter);
(removed || !exists) && SetRef(didChangeSize);
if (removed && entries.length === 1) {
return;
}
if (!exists && !removed && entries.length >= MAX_ARRAY_MAP_SIZE) {
return createNodes(ownerID, entries, key, value);
}
var isEditable = ownerID && ownerID === this.ownerID;
var newEntries = isEditable ? entries : arrCopy(entries);
if (exists) {
if (removed) {
idx === len - 1 ? newEntries.pop() : (newEntries[idx] = newEntries.pop());
} else {
newEntries[idx] = [key, value];
}
} else {
newEntries.push([key, value]);
}
if (isEditable) {
this.entries = newEntries;
return this;
}
return new $ArrayMapNode(ownerID, newEntries);
}
}, {});
var BitmapIndexedNode = function BitmapIndexedNode(ownerID, bitmap, nodes) {
this.ownerID = ownerID;
this.bitmap = bitmap;
this.nodes = nodes;
};
var $BitmapIndexedNode = BitmapIndexedNode;
($traceurRuntime.createClass)(BitmapIndexedNode, {
get: function(shift, keyHash, key, notSetValue) {
if (keyHash === undefined) {
keyHash = hash(key);
}
var bit = (1 << ((shift === 0 ? keyHash : keyHash >>> shift) & MASK));
var bitmap = this.bitmap;
return (bitmap & bit) === 0 ? notSetValue : this.nodes[popCount(bitmap & (bit - 1))].get(shift + SHIFT, keyHash, key, notSetValue);
},
update: function(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {
if (keyHash === undefined) {
keyHash = hash(key);
}
var keyHashFrag = (shift === 0 ? keyHash : keyHash >>> shift) & MASK;
var bit = 1 << keyHashFrag;
var bitmap = this.bitmap;
var exists = (bitmap & bit) !== 0;
if (!exists && value === NOT_SET) {
return this;
}
var idx = popCount(bitmap & (bit - 1));
var nodes = this.nodes;
var node = exists ? nodes[idx] : undefined;
var newNode = updateNode(node, ownerID, shift + SHIFT, keyHash, key, value, didChangeSize, didAlter);
if (newNode === node) {
return this;
}
if (!exists && newNode && nodes.length >= MAX_BITMAP_INDEXED_SIZE) {
return expandNodes(ownerID, nodes, bitmap, keyHashFrag, newNode);
}
if (exists && !newNode && nodes.length === 2 && isLeafNode(nodes[idx ^ 1])) {
return nodes[idx ^ 1];
}
if (exists && newNode && nodes.length === 1 && isLeafNode(newNode)) {
return newNode;
}
var isEditable = ownerID && ownerID === this.ownerID;
var newBitmap = exists ? newNode ? bitmap : bitmap ^ bit : bitmap | bit;
var newNodes = exists ? newNode ? setIn(nodes, idx, newNode, isEditable) : spliceOut(nodes, idx, isEditable) : spliceIn(nodes, idx, newNode, isEditable);
if (isEditable) {
this.bitmap = newBitmap;
this.nodes = newNodes;
return this;
}
return new $BitmapIndexedNode(ownerID, newBitmap, newNodes);
}
}, {});
var HashArrayMapNode = function HashArrayMapNode(ownerID, count, nodes) {
this.ownerID = ownerID;
this.count = count;
this.nodes = nodes;
};
var $HashArrayMapNode = HashArrayMapNode;
($traceurRuntime.createClass)(HashArrayMapNode, {
get: function(shift, keyHash, key, notSetValue) {
if (keyHash === undefined) {
keyHash = hash(key);
}
var idx = (shift === 0 ? keyHash : keyHash >>> shift) & MASK;
var node = this.nodes[idx];
return node ? node.get(shift + SHIFT, keyHash, key, notSetValue) : notSetValue;
},
update: function(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {
if (keyHash === undefined) {
keyHash = hash(key);
}
var idx = (shift === 0 ? keyHash : keyHash >>> shift) & MASK;
var removed = value === NOT_SET;
var nodes = this.nodes;
var node = nodes[idx];
if (removed && !node) {
return this;
}
var newNode = updateNode(node, ownerID, shift + SHIFT, keyHash, key, value, didChangeSize, didAlter);
if (newNode === node) {
return this;
}
var newCount = this.count;
if (!node) {
newCount++;
} else if (!newNode) {
newCount--;
if (newCount < MIN_HASH_ARRAY_MAP_SIZE) {
return packNodes(ownerID, nodes, newCount, idx);
}
}
var isEditable = ownerID && ownerID === this.ownerID;
var newNodes = setIn(nodes, idx, newNode, isEditable);
if (isEditable) {
this.count = newCount;
this.nodes = newNodes;
return this;
}
return new $HashArrayMapNode(ownerID, newCount, newNodes);
}
}, {});
var HashCollisionNode = function HashCollisionNode(ownerID, keyHash, entries) {
this.ownerID = ownerID;
this.keyHash = keyHash;
this.entries = entries;
};
var $HashCollisionNode = HashCollisionNode;
($traceurRuntime.createClass)(HashCollisionNode, {
get: function(shift, keyHash, key, notSetValue) {
var entries = this.entries;
for (var ii = 0,
len = entries.length; ii < len; ii++) {
if (is(key, entries[ii][0])) {
return entries[ii][1];
}
}
return notSetValue;
},
update: function(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {
if (keyHash === undefined) {
keyHash = hash(key);
}
var removed = value === NOT_SET;
if (keyHash !== this.keyHash) {
if (removed) {
return this;
}
SetRef(didAlter);
SetRef(didChangeSize);
return mergeIntoNode(this, ownerID, shift, keyHash, [key, value]);
}
var entries = this.entries;
var idx = 0;
for (var len = entries.length; idx < len; idx++) {
if (is(key, entries[idx][0])) {
break;
}
}
var exists = idx < len;
if (exists ? entries[idx][1] === value : removed) {
return this;
}
SetRef(didAlter);
(removed || !exists) && SetRef(didChangeSize);
if (removed && len === 2) {
return new ValueNode(ownerID, this.keyHash, entries[idx ^ 1]);
}
var isEditable = ownerID && ownerID === this.ownerID;
var newEntries = isEditable ? entries : arrCopy(entries);
if (exists) {
if (removed) {
idx === len - 1 ? newEntries.pop() : (newEntries[idx] = newEntries.pop());
} else {
newEntries[idx] = [key, value];
}
} else {
newEntries.push([key, value]);
}
if (isEditable) {
this.entries = newEntries;
return this;
}
return new $HashCollisionNode(ownerID, this.keyHash, newEntries);
}
}, {});
var ValueNode = function ValueNode(ownerID, keyHash, entry) {
this.ownerID = ownerID;
this.keyHash = keyHash;
this.entry = entry;
};
var $ValueNode = ValueNode;
($traceurRuntime.createClass)(ValueNode, {
get: function(shift, keyHash, key, notSetValue) {
return is(key, this.entry[0]) ? this.entry[1] : notSetValue;
},
update: function(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {
var removed = value === NOT_SET;
var keyMatch = is(key, this.entry[0]);
if (keyMatch ? value === this.entry[1] : removed) {
return this;
}
SetRef(didAlter);
if (removed) {
SetRef(didChangeSize);
return;
}
if (keyMatch) {
if (ownerID && ownerID === this.ownerID) {
this.entry[1] = value;
return this;
}
return new $ValueNode(ownerID, this.keyHash, [key, value]);
}
SetRef(didChangeSize);
return mergeIntoNode(this, ownerID, shift, hash(key), [key, value]);
}
}, {});
ArrayMapNode.prototype.iterate = HashCollisionNode.prototype.iterate = function(fn, reverse) {
var entries = this.entries;
for (var ii = 0,
maxIndex = entries.length - 1; ii <= maxIndex; ii++) {
if (fn(entries[reverse ? maxIndex - ii : ii]) === false) {
return false;
}
}
};
BitmapIndexedNode.prototype.iterate = HashArrayMapNode.prototype.iterate = function(fn, reverse) {
var nodes = this.nodes;
for (var ii = 0,
maxIndex = nodes.length - 1; ii <= maxIndex; ii++) {
var node = nodes[reverse ? maxIndex - ii : ii];
if (node && node.iterate(fn, reverse) === false) {
return false;
}
}
};
ValueNode.prototype.iterate = function(fn, reverse) {
return fn(this.entry);
};
var MapIterator = function MapIterator(map, type, reverse) {
this._type = type;
this._reverse = reverse;
this._stack = map._root && mapIteratorFrame(map._root);
};
($traceurRuntime.createClass)(MapIterator, {next: function() {
var type = this._type;
var stack = this._stack;
while (stack) {
var node = stack.node;
var index = stack.index++;
var maxIndex;
if (node.entry) {
if (index === 0) {
return mapIteratorValue(type, node.entry);
}
} else if (node.entries) {
maxIndex = node.entries.length - 1;
if (index <= maxIndex) {
return mapIteratorValue(type, node.entries[this._reverse ? maxIndex - index : index]);
}
} else {
maxIndex = node.nodes.length - 1;
if (index <= maxIndex) {
var subNode = node.nodes[this._reverse ? maxIndex - index : index];
if (subNode) {
if (subNode.entry) {
return mapIteratorValue(type, subNode.entry);
}
stack = this._stack = mapIteratorFrame(subNode, stack);
}
continue;
}
}
stack = this._stack = this._stack.__prev;
}
return iteratorDone();
}}, {}, Iterator);
function mapIteratorValue(type, entry) {
return iteratorValue(type, entry[0], entry[1]);
}
function mapIteratorFrame(node, prev) {
return {
node: node,
index: 0,
__prev: prev
};
}
function makeMap(size, root, ownerID, hash) {
var map = Object.create(MapPrototype);
map.size = size;
map._root = root;
map.__ownerID = ownerID;
map.__hash = hash;
map.__altered = false;
return map;
}
var EMPTY_MAP;
function emptyMap() {
return EMPTY_MAP || (EMPTY_MAP = makeMap(0));
}
function updateMap(map, k, v) {
var newRoot;
var newSize;
if (!map._root) {
if (v === NOT_SET) {
return map;
}
newSize = 1;
newRoot = new ArrayMapNode(map.__ownerID, [[k, v]]);
} else {
var didChangeSize = MakeRef(CHANGE_LENGTH);
var didAlter = MakeRef(DID_ALTER);
newRoot = updateNode(map._root, map.__ownerID, 0, undefined, k, v, didChangeSize, didAlter);
if (!didAlter.value) {
return map;
}
newSize = map.size + (didChangeSize.value ? v === NOT_SET ? -1 : 1 : 0);
}
if (map.__ownerID) {
map.size = newSize;
map._root = newRoot;
map.__hash = undefined;
map.__altered = true;
return map;
}
return newRoot ? makeMap(newSize, newRoot) : emptyMap();
}
function updateNode(node, ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {
if (!node) {
if (value === NOT_SET) {
return node;
}
SetRef(didAlter);
SetRef(didChangeSize);
return new ValueNode(ownerID, keyHash, [key, value]);
}
return node.update(ownerID, shift, keyHash, key, value, didChangeSize, didAlter);
}
function isLeafNode(node) {
return node.constructor === ValueNode || node.constructor === HashCollisionNode;
}
function mergeIntoNode(node, ownerID, shift, keyHash, entry) {
if (node.keyHash === keyHash) {
return new HashCollisionNode(ownerID, keyHash, [node.entry, entry]);
}
var idx1 = (shift === 0 ? node.keyHash : node.keyHash >>> shift) & MASK;
var idx2 = (shift === 0 ? keyHash : keyHash >>> shift) & MASK;
var newNode;
var nodes = idx1 === idx2 ? [mergeIntoNode(node, ownerID, shift + SHIFT, keyHash, entry)] : ((newNode = new ValueNode(ownerID, keyHash, entry)), idx1 < idx2 ? [node, newNode] : [newNode, node]);
return new BitmapIndexedNode(ownerID, (1 << idx1) | (1 << idx2), nodes);
}
function createNodes(ownerID, entries, key, value) {
if (!ownerID) {
ownerID = new OwnerID();
}
var node = new ValueNode(ownerID, hash(key), [key, value]);
for (var ii = 0; ii < entries.length; ii++) {
var entry = entries[ii];
node = node.update(ownerID, 0, undefined, entry[0], entry[1]);
}
return node;
}
function packNodes(ownerID, nodes, count, excluding) {
var bitmap = 0;
var packedII = 0;
var packedNodes = new Array(count);
for (var ii = 0,
bit = 1,
len = nodes.length; ii < len; ii++, bit <<= 1) {
var node = nodes[ii];
if (node !== undefined && ii !== excluding) {
bitmap |= bit;
packedNodes[packedII++] = node;
}
}
return new BitmapIndexedNode(ownerID, bitmap, packedNodes);
}
function expandNodes(ownerID, nodes, bitmap, including, node) {
var count = 0;
var expandedNodes = new Array(SIZE);
for (var ii = 0; bitmap !== 0; ii++, bitmap >>>= 1) {
expandedNodes[ii] = bitmap & 1 ? nodes[count++] : undefined;
}
expandedNodes[including] = node;
return new HashArrayMapNode(ownerID, count + 1, expandedNodes);
}
function mergeIntoMapWith(map, merger, iterables) {
var iters = [];
for (var ii = 0; ii < iterables.length; ii++) {
var value = iterables[ii];
var iter = KeyedIterable(value);
if (!isIterable(value)) {
iter = iter.map((function(v) {
return fromJS(v);
}));
}
iters.push(iter);
}
return mergeIntoCollectionWith(map, merger, iters);
}
function deepMerger(merger) {
return (function(existing, value) {
return existing && existing.mergeDeepWith && isIterable(value) ? existing.mergeDeepWith(merger, value) : merger ? merger(existing, value) : value;
});
}
function mergeIntoCollectionWith(collection, merger, iters) {
iters = iters.filter((function(x) {
return x.size !== 0;
}));
if (iters.length === 0) {
return collection;
}
if (collection.size === 0 && iters.length === 1) {
return collection.constructor(iters[0]);
}
return collection.withMutations((function(collection) {
var mergeIntoMap = merger ? (function(value, key) {
collection.update(key, NOT_SET, (function(existing) {
return existing === NOT_SET ? value : merger(existing, value);
}));
}) : (function(value, key) {
collection.set(key, value);
});
for (var ii = 0; ii < iters.length; ii++) {
iters[ii].forEach(mergeIntoMap);
}
}));
}
function updateInDeepMap(existing, keyPathIter, notSetValue, updater) {
var isNotSet = existing === NOT_SET;
var step = keyPathIter.next();
if (step.done) {
var existingValue = isNotSet ? notSetValue : existing;
var newValue = updater(existingValue);
return newValue === existingValue ? existing : newValue;
}
invariant(isNotSet || (existing && existing.set), 'invalid keyPath');
var key = step.value;
var nextExisting = isNotSet ? NOT_SET : existing.get(key, NOT_SET);
var nextUpdated = updateInDeepMap(nextExisting, keyPathIter, notSetValue, updater);
return nextUpdated === nextExisting ? existing : nextUpdated === NOT_SET ? existing.remove(key) : (isNotSet ? emptyMap() : existing).set(key, nextUpdated);
}
function popCount(x) {
x = x - ((x >> 1) & 0x55555555);
x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
x = (x + (x >> 4)) & 0x0f0f0f0f;
x = x + (x >> 8);
x = x + (x >> 16);
return x & 0x7f;
}
function setIn(array, idx, val, canEdit) {
var newArray = canEdit ? array : arrCopy(array);
newArray[idx] = val;
return newArray;
}
function spliceIn(array, idx, val, canEdit) {
var newLen = array.length + 1;
if (canEdit && idx + 1 === newLen) {
array[idx] = val;
return array;
}
var newArray = new Array(newLen);
var after = 0;
for (var ii = 0; ii < newLen; ii++) {
if (ii === idx) {
newArray[ii] = val;
after = -1;
} else {
newArray[ii] = array[ii + after];
}
}
return newArray;
}
function spliceOut(array, idx, canEdit) {
var newLen = array.length - 1;
if (canEdit && idx === newLen) {
array.pop();
return array;
}
var newArray = new Array(newLen);
var after = 0;
for (var ii = 0; ii < newLen; ii++) {
if (ii === idx) {
after = 1;
}
newArray[ii] = array[ii + after];
}
return newArray;
}
var MAX_ARRAY_MAP_SIZE = SIZE / 4;
var MAX_BITMAP_INDEXED_SIZE = SIZE / 2;
var MIN_HASH_ARRAY_MAP_SIZE = SIZE / 4;
var ToKeyedSequence = function ToKeyedSequence(indexed, useKeys) {
this._iter = indexed;
this._useKeys = useKeys;
this.size = indexed.size;
};
($traceurRuntime.createClass)(ToKeyedSequence, {
get: function(key, notSetValue) {
return this._iter.get(key, notSetValue);
},
has: function(key) {
return this._iter.has(key);
},
valueSeq: function() {
return this._iter.valueSeq();
},
reverse: function() {
var $__0 = this;
var reversedSequence = reverseFactory(this, true);
if (!this._useKeys) {
reversedSequence.valueSeq = (function() {
return $__0._iter.toSeq().reverse();
});
}
return reversedSequence;
},
map: function(mapper, context) {
var $__0 = this;
var mappedSequence = mapFactory(this, mapper, context);
if (!this._useKeys) {
mappedSequence.valueSeq = (function() {
return $__0._iter.toSeq().map(mapper, context);
});
}
return mappedSequence;
},
__iterate: function(fn, reverse) {
var $__0 = this;
var ii;
return this._iter.__iterate(this._useKeys ? (function(v, k) {
return fn(v, k, $__0);
}) : ((ii = reverse ? resolveSize(this) : 0), (function(v) {
return fn(v, reverse ? --ii : ii++, $__0);
})), reverse);
},
__iterator: function(type, reverse) {
if (this._useKeys) {
return this._iter.__iterator(type, reverse);
}
var iterator = this._iter.__iterator(ITERATE_VALUES, reverse);
var ii = reverse ? resolveSize(this) : 0;
return new Iterator((function() {
var step = iterator.next();
return step.done ? step : iteratorValue(type, reverse ? --ii : ii++, step.value, step);
}));
}
}, {}, KeyedSeq);
ToKeyedSequence.prototype[IS_ORDERED_SENTINEL] = true;
var ToIndexedSequence = function ToIndexedSequence(iter) {
this._iter = iter;
this.size = iter.size;
};
($traceurRuntime.createClass)(ToIndexedSequence, {
contains: function(value) {
return this._iter.contains(value);
},
__iterate: function(fn, reverse) {
var $__0 = this;
var iterations = 0;
return this._iter.__iterate((function(v) {
return fn(v, iterations++, $__0);
}), reverse);
},
__iterator: function(type, reverse) {
var iterator = this._iter.__iterator(ITERATE_VALUES, reverse);
var iterations = 0;
return new Iterator((function() {
var step = iterator.next();
return step.done ? step : iteratorValue(type, iterations++, step.value, step);
}));
}
}, {}, IndexedSeq);
var ToSetSequence = function ToSetSequence(iter) {
this._iter = iter;
this.size = iter.size;
};
($traceurRuntime.createClass)(ToSetSequence, {
has: function(key) {
return this._iter.contains(key);
},
__iterate: function(fn, reverse) {
var $__0 = this;
return this._iter.__iterate((function(v) {
return fn(v, v, $__0);
}), reverse);
},
__iterator: function(type, reverse) {
var iterator = this._iter.__iterator(ITERATE_VALUES, reverse);
return new Iterator((function() {
var step = iterator.next();
return step.done ? step : iteratorValue(type, step.value, step.value, step);
}));
}
}, {}, SetSeq);
var FromEntriesSequence = function FromEntriesSequence(entries) {
this._iter = entries;
this.size = entries.size;
};
($traceurRuntime.createClass)(FromEntriesSequence, {
entrySeq: function() {
return this._iter.toSeq();
},
__iterate: function(fn, reverse) {
var $__0 = this;
return this._iter.__iterate((function(entry) {
if (entry) {
validateEntry(entry);
return fn(entry[1], entry[0], $__0);
}
}), reverse);
},
__iterator: function(type, reverse) {
var iterator = this._iter.__iterator(ITERATE_VALUES, reverse);
return new Iterator((function() {
while (true) {
var step = iterator.next();
if (step.done) {
return step;
}
var entry = step.value;
if (entry) {
validateEntry(entry);
return type === ITERATE_ENTRIES ? step : iteratorValue(type, entry[0], entry[1], step);
}
}
}));
}
}, {}, KeyedSeq);
ToIndexedSequence.prototype.cacheResult = ToKeyedSequence.prototype.cacheResult = ToSetSequence.prototype.cacheResult = FromEntriesSequence.prototype.cacheResult = cacheResultThrough;
function flipFactory(iterable) {
var flipSequence = makeSequence(iterable);
flipSequence._iter = iterable;
flipSequence.size = iterable.size;
flipSequence.flip = (function() {
return iterable;
});
flipSequence.reverse = function() {
var reversedSequence = iterable.reverse.apply(this);
reversedSequence.flip = (function() {
return iterable.reverse();
});
return reversedSequence;
};
flipSequence.has = (function(key) {
return iterable.contains(key);
});
flipSequence.contains = (function(key) {
return iterable.has(key);
});
flipSequence.cacheResult = cacheResultThrough;
flipSequence.__iterateUncached = function(fn, reverse) {
var $__0 = this;
return iterable.__iterate((function(v, k) {
return fn(k, v, $__0) !== false;
}), reverse);
};
flipSequence.__iteratorUncached = function(type, reverse) {
if (type === ITERATE_ENTRIES) {
var iterator = iterable.__iterator(type, reverse);
return new Iterator((function() {
var step = iterator.next();
if (!step.done) {
var k = step.value[0];
step.value[0] = step.value[1];
step.value[1] = k;
}
return step;
}));
}
return iterable.__iterator(type === ITERATE_VALUES ? ITERATE_KEYS : ITERATE_VALUES, reverse);
};
return flipSequence;
}
function mapFactory(iterable, mapper, context) {
var mappedSequence = makeSequence(iterable);
mappedSequence.size = iterable.size;
mappedSequence.has = (function(key) {
return iterable.has(key);
});
mappedSequence.get = (function(key, notSetValue) {
var v = iterable.get(key, NOT_SET);
return v === NOT_SET ? notSetValue : mapper.call(context, v, key, iterable);
});
mappedSequence.__iterateUncached = function(fn, reverse) {
var $__0 = this;
return iterable.__iterate((function(v, k, c) {
return fn(mapper.call(context, v, k, c), k, $__0) !== false;
}), reverse);
};
mappedSequence.__iteratorUncached = function(type, reverse) {
var iterator = iterable.__iterator(ITERATE_ENTRIES, reverse);
return new Iterator((function() {
var step = iterator.next();
if (step.done) {
return step;
}
var entry = step.value;
var key = entry[0];
return iteratorValue(type, key, mapper.call(context, entry[1], key, iterable), step);
}));
};
return mappedSequence;
}
function reverseFactory(iterable, useKeys) {
var reversedSequence = makeSequence(iterable);
reversedSequence._iter = iterable;
reversedSequence.size = iterable.size;
reversedSequence.reverse = (function() {
return iterable;
});
if (iterable.flip) {
reversedSequence.flip = function() {
var flipSequence = flipFactory(iterable);
flipSequence.reverse = (function() {
return iterable.flip();
});
return flipSequence;
};
}
reversedSequence.get = (function(key, notSetValue) {
return iterable.get(useKeys ? key : -1 - key, notSetValue);
});
reversedSequence.has = (function(key) {
return iterable.has(useKeys ? key : -1 - key);
});
reversedSequence.contains = (function(value) {
return iterable.contains(value);
});
reversedSequence.cacheResult = cacheResultThrough;
reversedSequence.__iterate = function(fn, reverse) {
var $__0 = this;
return iterable.__iterate((function(v, k) {
return fn(v, k, $__0);
}), !reverse);
};
reversedSequence.__iterator = (function(type, reverse) {
return iterable.__iterator(type, !reverse);
});
return reversedSequence;
}
function filterFactory(iterable, predicate, context, useKeys) {
var filterSequence = makeSequence(iterable);
if (useKeys) {
filterSequence.has = (function(key) {
var v = iterable.get(key, NOT_SET);
return v !== NOT_SET && !!predicate.call(context, v, key, iterable);
});
filterSequence.get = (function(key, notSetValue) {
var v = iterable.get(key, NOT_SET);
return v !== NOT_SET && predicate.call(context, v, key, iterable) ? v : notSetValue;
});
}
filterSequence.__iterateUncached = function(fn, reverse) {
var $__0 = this;
var iterations = 0;
iterable.__iterate((function(v, k, c) {
if (predicate.call(context, v, k, c)) {
iterations++;
return fn(v, useKeys ? k : iterations - 1, $__0);
}
}), reverse);
return iterations;
};
filterSequence.__iteratorUncached = function(type, reverse) {
var iterator = iterable.__iterator(ITERATE_ENTRIES, reverse);
var iterations = 0;
return new Iterator((function() {
while (true) {
var step = iterator.next();
if (step.done) {
return step;
}
var entry = step.value;
var key = entry[0];
var value = entry[1];
if (predicate.call(context, value, key, iterable)) {
return iteratorValue(type, useKeys ? key : iterations++, value, step);
}
}
}));
};
return filterSequence;
}
function countByFactory(iterable, grouper, context) {
var groups = Map().asMutable();
iterable.__iterate((function(v, k) {
groups.update(grouper.call(context, v, k, iterable), 0, (function(a) {
return a + 1;
}));
}));
return groups.asImmutable();
}
function groupByFactory(iterable, grouper, context) {
var isKeyedIter = isKeyed(iterable);
var groups = Map().asMutable();
iterable.__iterate((function(v, k) {
groups.update(grouper.call(context, v, k, iterable), (function(a) {
return (a = a || [], a.push(isKeyedIter ? [k, v] : v), a);
}));
}));
var coerce = iterableClass(iterable);
return groups.map((function(arr) {
return reify(iterable, coerce(arr));
}));
}
function takeFactory(iterable, amount) {
if (amount > iterable.size) {
return iterable;
}
if (amount < 0) {
amount = 0;
}
var takeSequence = makeSequence(iterable);
takeSequence.size = iterable.size && Math.min(iterable.size, amount);
takeSequence.__iterateUncached = function(fn, reverse) {
var $__0 = this;
if (amount === 0) {
return 0;
}
if (reverse) {
return this.cacheResult().__iterate(fn, reverse);
}
var iterations = 0;
iterable.__iterate((function(v, k) {
return ++iterations && fn(v, k, $__0) !== false && iterations < amount;
}));
return iterations;
};
takeSequence.__iteratorUncached = function(type, reverse) {
if (reverse) {
return this.cacheResult().__iterator(type, reverse);
}
var iterator = amount && iterable.__iterator(type, reverse);
var iterations = 0;
return new Iterator((function() {
if (iterations++ > amount) {
return iteratorDone();
}
return iterator.next();
}));
};
return takeSequence;
}
function takeWhileFactory(iterable, predicate, context) {
var takeSequence = makeSequence(iterable);
takeSequence.__iterateUncached = function(fn, reverse) {
var $__0 = this;
if (reverse) {
return this.cacheResult().__iterate(fn, reverse);
}
var iterations = 0;
iterable.__iterate((function(v, k, c) {
return predicate.call(context, v, k, c) && ++iterations && fn(v, k, $__0);
}));
return iterations;
};
takeSequence.__iteratorUncached = function(type, reverse) {
var $__0 = this;
if (reverse) {
return this.cacheResult().__iterator(type, reverse);
}
var iterator = iterable.__iterator(ITERATE_ENTRIES, reverse);
var iterating = true;
return new Iterator((function() {
if (!iterating) {
return iteratorDone();
}
var step = iterator.next();
if (step.done) {
return step;
}
var entry = step.value;
var k = entry[0];
var v = entry[1];
if (!predicate.call(context, v, k, $__0)) {
iterating = false;
return iteratorDone();
}
return type === ITERATE_ENTRIES ? step : iteratorValue(type, k, v, step);
}));
};
return takeSequence;
}
function skipFactory(iterable, amount, useKeys) {
if (amount <= 0) {
return iterable;
}
var skipSequence = makeSequence(iterable);
skipSequence.size = iterable.size && Math.max(0, iterable.size - amount);
skipSequence.__iterateUncached = function(fn, reverse) {
var $__0 = this;
if (reverse) {
return this.cacheResult().__iterate(fn, reverse);
}
var skipped = 0;
var isSkipping = true;
var iterations = 0;
iterable.__iterate((function(v, k) {
if (!(isSkipping && (isSkipping = skipped++ < amount))) {
iterations++;
return fn(v, useKeys ? k : iterations - 1, $__0);
}
}));
return iterations;
};
skipSequence.__iteratorUncached = function(type, reverse) {
if (reverse) {
return this.cacheResult().__iterator(type, reverse);
}
var iterator = amount && iterable.__iterator(type, reverse);
var skipped = 0;
var iterations = 0;
return new Iterator((function() {
while (skipped < amount) {
skipped++;
iterator.next();
}
var step = iterator.next();
if (useKeys || type === ITERATE_VALUES) {
return step;
} else if (type === ITERATE_KEYS) {
return iteratorValue(type, iterations++, undefined, step);
} else {
return iteratorValue(type, iterations++, step.value[1], step);
}
}));
};
return skipSequence;
}
function skipWhileFactory(iterable, predicate, context, useKeys) {
var skipSequence = makeSequence(iterable);
skipSequence.__iterateUncached = function(fn, reverse) {
var $__0 = this;
if (reverse) {
return this.cacheResult().__iterate(fn, reverse);
}
var isSkipping = true;
var iterations = 0;
iterable.__iterate((function(v, k, c) {
if (!(isSkipping && (isSkipping = predicate.call(context, v, k, c)))) {
iterations++;
return fn(v, useKeys ? k : iterations - 1, $__0);
}
}));
return iterations;
};
skipSequence.__iteratorUncached = function(type, reverse) {
var $__0 = this;
if (reverse) {
return this.cacheResult().__iterator(type, reverse);
}
var iterator = iterable.__iterator(ITERATE_ENTRIES, reverse);
var skipping = true;
var iterations = 0;
return new Iterator((function() {
var step,
k,
v;
do {
step = iterator.next();
if (step.done) {
if (useKeys || type === ITERATE_VALUES) {
return step;
} else if (type === ITERATE_KEYS) {
return iteratorValue(type, iterations++, undefined, step);
} else {
return iteratorValue(type, iterations++, step.value[1], step);
}
}
var entry = step.value;
k = entry[0];
v = entry[1];
skipping && (skipping = predicate.call(context, v, k, $__0));
} while (skipping);
return type === ITERATE_ENTRIES ? step : iteratorValue(type, k, v, step);
}));
};
return skipSequence;
}
function concatFactory(iterable, values) {
var isKeyedIterable = isKeyed(iterable);
var iters = [iterable].concat(values).map((function(v) {
if (!isIterable(v)) {
v = isKeyedIterable ? keyedSeqFromValue(v) : indexedSeqFromValue(Array.isArray(v) ? v : [v]);
} else if (isKeyedIterable) {
v = KeyedIterable(v);
}
return v;
})).filter((function(v) {
return v.size !== 0;
}));
if (iters.length === 0) {
return iterable;
}
if (iters.length === 1) {
var singleton = iters[0];
if (singleton === iterable || isKeyedIterable && isKeyed(singleton) || isIndexed(iterable) && isIndexed(singleton)) {
return singleton;
}
}
var concatSeq = new ArraySeq(iters);
if (isKeyedIterable) {
concatSeq = concatSeq.toKeyedSeq();
} else if (!isIndexed(iterable)) {
concatSeq = concatSeq.toSetSeq();
}
concatSeq = concatSeq.flatten(true);
concatSeq.size = iters.reduce((function(sum, seq) {
if (sum !== undefined) {
var size = seq.size;
if (size !== undefined) {
return sum + size;
}
}
}), 0);
return concatSeq;
}
function flattenFactory(iterable, depth, useKeys) {
var flatSequence = makeSequence(iterable);
flatSequence.__iterateUncached = function(fn, reverse) {
var iterations = 0;
var stopped = false;
function flatDeep(iter, currentDepth) {
var $__0 = this;
iter.__iterate((function(v, k) {
if ((!depth || currentDepth < depth) && isIterable(v)) {
flatDeep(v, currentDepth + 1);
} else if (fn(v, useKeys ? k : iterations++, $__0) === false) {
stopped = true;
}
return !stopped;
}), reverse);
}
flatDeep(iterable, 0);
return iterations;
};
flatSequence.__iteratorUncached = function(type, reverse) {
var iterator = iterable.__iterator(type, reverse);
var stack = [];
var iterations = 0;
return new Iterator((function() {
while (iterator) {
var step = iterator.next();
if (step.done !== false) {
iterator = stack.pop();
continue;
}
var v = step.value;
if (type === ITERATE_ENTRIES) {
v = v[1];
}
if ((!depth || stack.length < depth) && isIterable(v)) {
stack.push(iterator);
iterator = v.__iterator(type, reverse);
} else {
return useKeys ? step : iteratorValue(type, iterations++, v, step);
}
}
return iteratorDone();
}));
};
return flatSequence;
}
function flatMapFactory(iterable, mapper, context) {
var coerce = iterableClass(iterable);
return iterable.toSeq().map((function(v, k) {
return coerce(mapper.call(context, v, k, iterable));
})).flatten(true);
}
function interposeFactory(iterable, separator) {
var interposedSequence = makeSequence(iterable);
interposedSequence.size = iterable.size && iterable.size * 2 - 1;
interposedSequence.__iterateUncached = function(fn, reverse) {
var $__0 = this;
var iterations = 0;
iterable.__iterate((function(v, k) {
return (!iterations || fn(separator, iterations++, $__0) !== false) && fn(v, iterations++, $__0) !== false;
}), reverse);
return iterations;
};
interposedSequence.__iteratorUncached = function(type, reverse) {
var iterator = iterable.__iterator(ITERATE_VALUES, reverse);
var iterations = 0;
var step;
return new Iterator((function() {
if (!step || iterations % 2) {
step = iterator.next();
if (step.done) {
return step;
}
}
return iterations % 2 ? iteratorValue(type, iterations++, separator) : iteratorValue(type, iterations++, step.value, step);
}));
};
return interposedSequence;
}
function sortFactory(iterable, comparator, mapper) {
if (!comparator) {
comparator = defaultComparator;
}
var isKeyedIterable = isKeyed(iterable);
var index = 0;
var entries = iterable.toSeq().map((function(v, k) {
return [k, v, index++, mapper ? mapper(v, k, iterable) : v];
})).toArray();
entries.sort((function(a, b) {
return comparator(a[3], b[3]) || a[2] - b[2];
})).forEach(isKeyedIterable ? (function(v, i) {
entries[i].length = 2;
}) : (function(v, i) {
entries[i] = v[1];
}));
return isKeyedIterable ? KeyedSeq(entries) : isIndexed(iterable) ? IndexedSeq(entries) : SetSeq(entries);
}
function maxFactory(iterable, comparator, mapper) {
if (!comparator) {
comparator = defaultComparator;
}
if (mapper) {
var entry = iterable.toSeq().map((function(v, k) {
return [v, mapper(v, k, iterable)];
})).reduce((function(a, b) {
return _maxCompare(comparator, a[1], b[1]) ? b : a;
}));
return entry && entry[0];
} else {
return iterable.reduce((function(a, b) {
return _maxCompare(comparator, a, b) ? b : a;
}));
}
}
function _maxCompare(comparator, a, b) {
var comp = comparator(b, a);
return (comp === 0 && b !== a && (b === undefined || b === null || b !== b)) || comp > 0;
}
function reify(iter, seq) {
return isSeq(iter) ? seq : iter.constructor(seq);
}
function validateEntry(entry) {
if (entry !== Object(entry)) {
throw new TypeError('Expected [K, V] tuple: ' + entry);
}
}
function resolveSize(iter) {
assertNotInfinite(iter.size);
return ensureSize(iter);
}
function iterableClass(iterable) {
return isKeyed(iterable) ? KeyedIterable : isIndexed(iterable) ? IndexedIterable : SetIterable;
}
function makeSequence(iterable) {
return Object.create((isKeyed(iterable) ? KeyedSeq : isIndexed(iterable) ? IndexedSeq : SetSeq).prototype);
}
function cacheResultThrough() {
if (this._iter.cacheResult) {
this._iter.cacheResult();
this.size = this._iter.size;
return this;
} else {
return Seq.prototype.cacheResult.call(this);
}
}
function defaultComparator(a, b) {
return a > b ? 1 : a < b ? -1 : 0;
}
var List = function List(value) {
var empty = emptyList();
if (value === null || value === undefined) {
return empty;
}
if (isList(value)) {
return value;
}
var iter = IndexedIterable(value);
var size = iter.size;
if (size === 0) {
return empty;
}
assertNotInfinite(size);
if (size > 0 && size < SIZE) {
return makeList(0, size, SHIFT, null, new VNode(iter.toArray()));
}
return empty.withMutations((function(list) {
list.setSize(size);
iter.forEach((function(v, i) {
return list.set(i, v);
}));
}));
};
($traceurRuntime.createClass)(List, {
toString: function() {
return this.__toString('List [', ']');
},
get: function(index, notSetValue) {
index = wrapIndex(this, index);
if (index < 0 || index >= this.size) {
return notSetValue;
}
index += this._origin;
var node = listNodeFor(this, index);
return node && node.array[index & MASK];
},
set: function(index, value) {
return updateList(this, index, value);
},
remove: function(index) {
return !this.has(index) ? this : index === 0 ? this.shift() : index === this.size - 1 ? this.pop() : this.splice(index, 1);
},
clear: function() {
if (this.size === 0) {
return this;
}
if (this.__ownerID) {
this.size = this._origin = this._capacity = 0;
this._level = SHIFT;
this._root = this._tail = null;
this.__hash = undefined;
this.__altered = true;
return this;
}
return emptyList();
},
push: function() {
var values = arguments;
var oldSize = this.size;
return this.withMutations((function(list) {
setListBounds(list, 0, oldSize + values.length);
for (var ii = 0; ii < values.length; ii++) {
list.set(oldSize + ii, values[ii]);
}
}));
},
pop: function() {
return setListBounds(this, 0, -1);
},
unshift: function() {
var values = arguments;
return this.withMutations((function(list) {
setListBounds(list, -values.length);
for (var ii = 0; ii < values.length; ii++) {
list.set(ii, values[ii]);
}
}));
},
shift: function() {
return setListBounds(this, 1);
},
merge: function() {
return mergeIntoListWith(this, undefined, arguments);
},
mergeWith: function(merger) {
for (var iters = [],
$__7 = 1; $__7 < arguments.length; $__7++)
iters[$__7 - 1] = arguments[$__7];
return mergeIntoListWith(this, merger, iters);
},
mergeDeep: function() {
return mergeIntoListWith(this, deepMerger(undefined), arguments);
},
mergeDeepWith: function(merger) {
for (var iters = [],
$__8 = 1; $__8 < arguments.length; $__8++)
iters[$__8 - 1] = arguments[$__8];
return mergeIntoListWith(this, deepMerger(merger), iters);
},
setSize: function(size) {
return setListBounds(this, 0, size);
},
slice: function(begin, end) {
var size = this.size;
if (wholeSlice(begin, end, size)) {
return this;
}
return setListBounds(this, resolveBegin(begin, size), resolveEnd(end, size));
},
__iterator: function(type, reverse) {
var index = 0;
var values = iterateList(this, reverse);
return new Iterator((function() {
var value = values();
return value === DONE ? iteratorDone() : iteratorValue(type, index++, value);
}));
},
__iterate: function(fn, reverse) {
var index = 0;
var values = iterateList(this, reverse);
var value;
while ((value = values()) !== DONE) {
if (fn(value, index++, this) === false) {
break;
}
}
return index;
},
__ensureOwner: function(ownerID) {
if (ownerID === this.__ownerID) {
return this;
}
if (!ownerID) {
this.__ownerID = ownerID;
return this;
}
return makeList(this._origin, this._capacity, this._level, this._root, this._tail, ownerID, this.__hash);
}
}, {of: function() {
return this(arguments);
}}, IndexedCollection);
function isList(maybeList) {
return !!(maybeList && maybeList[IS_LIST_SENTINEL]);
}
List.isList = isList;
var IS_LIST_SENTINEL = '@@__IMMUTABLE_LIST__@@';
var ListPrototype = List.prototype;
ListPrototype[IS_LIST_SENTINEL] = true;
ListPrototype[DELETE] = ListPrototype.remove;
ListPrototype.setIn = MapPrototype.setIn;
ListPrototype.deleteIn = ListPrototype.removeIn = MapPrototype.removeIn;
ListPrototype.update = MapPrototype.update;
ListPrototype.updateIn = MapPrototype.updateIn;
ListPrototype.mergeIn = MapPrototype.mergeIn;
ListPrototype.mergeDeepIn = MapPrototype.mergeDeepIn;
ListPrototype.withMutations = MapPrototype.withMutations;
ListPrototype.asMutable = MapPrototype.asMutable;
ListPrototype.asImmutable = MapPrototype.asImmutable;
ListPrototype.wasAltered = MapPrototype.wasAltered;
var VNode = function VNode(array, ownerID) {
this.array = array;
this.ownerID = ownerID;
};
var $VNode = VNode;
($traceurRuntime.createClass)(VNode, {
removeBefore: function(ownerID, level, index) {
if (index === level ? 1 << level : 0 || this.array.length === 0) {
return this;
}
var originIndex = (index >>> level) & MASK;
if (originIndex >= this.array.length) {
return new $VNode([], ownerID);
}
var removingFirst = originIndex === 0;
var newChild;
if (level > 0) {
var oldChild = this.array[originIndex];
newChild = oldChild && oldChild.removeBefore(ownerID, level - SHIFT, index);
if (newChild === oldChild && removingFirst) {
return this;
}
}
if (removingFirst && !newChild) {
return this;
}
var editable = editableVNode(this, ownerID);
if (!removingFirst) {
for (var ii = 0; ii < originIndex; ii++) {
editable.array[ii] = undefined;
}
}
if (newChild) {
editable.array[originIndex] = newChild;
}
return editable;
},
removeAfter: function(ownerID, level, index) {
if (index === level ? 1 << level : 0 || this.array.length === 0) {
return this;
}
var sizeIndex = ((index - 1) >>> level) & MASK;
if (sizeIndex >= this.array.length) {
return this;
}
var removingLast = sizeIndex === this.array.length - 1;
var newChild;
if (level > 0) {
var oldChild = this.array[sizeIndex];
newChild = oldChild && oldChild.removeAfter(ownerID, level - SHIFT, index);
if (newChild === oldChild && removingLast) {
return this;
}
}
if (removingLast && !newChild) {
return this;
}
var editable = editableVNode(this, ownerID);
if (!removingLast) {
editable.array.pop();
}
if (newChild) {
editable.array[sizeIndex] = newChild;
}
return editable;
}
}, {});
var DONE = {};
function iterateList(list, reverse) {
var left = list._origin;
var right = list._capacity;
var tailPos = getTailOffset(right);
var tail = list._tail;
return iterateNodeOrLeaf(list._root, list._level, 0);
function iterateNodeOrLeaf(node, level, offset) {
return level === 0 ? iterateLeaf(node, offset) : iterateNode(node, level, offset);
}
function iterateLeaf(node, offset) {
var array = offset === tailPos ? tail && tail.array : node && node.array;
var from = offset > left ? 0 : left - offset;
var to = right - offset;
if (to > SIZE) {
to = SIZE;
}
return (function() {
if (from === to) {
return DONE;
}
var idx = reverse ? --to : from++;
return array && array[idx];
});
}
function iterateNode(node, level, offset) {
var values;
var array = node && node.array;
var from = offset > left ? 0 : (left - offset) >> level;
var to = ((right - offset) >> level) + 1;
if (to > SIZE) {
to = SIZE;
}
return (function() {
do {
if (values) {
var value = values();
if (value !== DONE) {
return value;
}
values = null;
}
if (from === to) {
return DONE;
}
var idx = reverse ? --to : from++;
values = iterateNodeOrLeaf(array && array[idx], level - SHIFT, offset + (idx << level));
} while (true);
});
}
}
function makeList(origin, capacity, level, root, tail, ownerID, hash) {
var list = Object.create(ListPrototype);
list.size = capacity - origin;
list._origin = origin;
list._capacity = capacity;
list._level = level;
list._root = root;
list._tail = tail;
list.__ownerID = ownerID;
list.__hash = hash;
list.__altered = false;
return list;
}
var EMPTY_LIST;
function emptyList() {
return EMPTY_LIST || (EMPTY_LIST = makeList(0, 0, SHIFT));
}
function updateList(list, index, value) {
index = wrapIndex(list, index);
if (index >= list.size || index < 0) {
return list.withMutations((function(list) {
index < 0 ? setListBounds(list, index).set(0, value) : setListBounds(list, 0, index + 1).set(index, value);
}));
}
index += list._origin;
var newTail = list._tail;
var newRoot = list._root;
var didAlter = MakeRef(DID_ALTER);
if (index >= getTailOffset(list._capacity)) {
newTail = updateVNode(newTail, list.__ownerID, 0, index, value, didAlter);
} else {
newRoot = updateVNode(newRoot, list.__ownerID, list._level, index, value, didAlter);
}
if (!didAlter.value) {
return list;
}
if (list.__ownerID) {
list._root = newRoot;
list._tail = newTail;
list.__hash = undefined;
list.__altered = true;
return list;
}
return makeList(list._origin, list._capacity, list._level, newRoot, newTail);
}
function updateVNode(node, ownerID, level, index, value, didAlter) {
var idx = (index >>> level) & MASK;
var nodeHas = node && idx < node.array.length;
if (!nodeHas && value === undefined) {
return node;
}
var newNode;
if (level > 0) {
var lowerNode = node && node.array[idx];
var newLowerNode = updateVNode(lowerNode, ownerID, level - SHIFT, index, value, didAlter);
if (newLowerNode === lowerNode) {
return node;
}
newNode = editableVNode(node, ownerID);
newNode.array[idx] = newLowerNode;
return newNode;
}
if (nodeHas && node.array[idx] === value) {
return node;
}
SetRef(didAlter);
newNode = editableVNode(node, ownerID);
if (value === undefined && idx === newNode.array.length - 1) {
newNode.array.pop();
} else {
newNode.array[idx] = value;
}
return newNode;
}
function editableVNode(node, ownerID) {
if (ownerID && node && ownerID === node.ownerID) {
return node;
}
return new VNode(node ? node.array.slice() : [], ownerID);
}
function listNodeFor(list, rawIndex) {
if (rawIndex >= getTailOffset(list._capacity)) {
return list._tail;
}
if (rawIndex < 1 << (list._level + SHIFT)) {
var node = list._root;
var level = list._level;
while (node && level > 0) {
node = node.array[(rawIndex >>> level) & MASK];
level -= SHIFT;
}
return node;
}
}
function setListBounds(list, begin, end) {
var owner = list.__ownerID || new OwnerID();
var oldOrigin = list._origin;
var oldCapacity = list._capacity;
var newOrigin = oldOrigin + begin;
var newCapacity = end === undefined ? oldCapacity : end < 0 ? oldCapacity + end : oldOrigin + end;
if (newOrigin === oldOrigin && newCapacity === oldCapacity) {
return list;
}
if (newOrigin >= newCapacity) {
return list.clear();
}
var newLevel = list._level;
var newRoot = list._root;
var offsetShift = 0;
while (newOrigin + offsetShift < 0) {
newRoot = new VNode(newRoot && newRoot.array.length ? [undefined, newRoot] : [], owner);
newLevel += SHIFT;
offsetShift += 1 << newLevel;
}
if (offsetShift) {
newOrigin += offsetShift;
oldOrigin += offsetShift;
newCapacity += offsetShift;
oldCapacity += offsetShift;
}
var oldTailOffset = getTailOffset(oldCapacity);
var newTailOffset = getTailOffset(newCapacity);
while (newTailOffset >= 1 << (newLevel + SHIFT)) {
newRoot = new VNode(newRoot && newRoot.array.length ? [newRoot] : [], owner);
newLevel += SHIFT;
}
var oldTail = list._tail;
var newTail = newTailOffset < oldTailOffset ? listNodeFor(list, newCapacity - 1) : newTailOffset > oldTailOffset ? new VNode([], owner) : oldTail;
if (oldTail && newTailOffset > oldTailOffset && newOrigin < oldCapacity && oldTail.array.length) {
newRoot = editableVNode(newRoot, owner);
var node = newRoot;
for (var level = newLevel; level > SHIFT; level -= SHIFT) {
var idx = (oldTailOffset >>> level) & MASK;
node = node.array[idx] = editableVNode(node.array[idx], owner);
}
node.array[(oldTailOffset >>> SHIFT) & MASK] = oldTail;
}
if (newCapacity < oldCapacity) {
newTail = newTail && newTail.removeAfter(owner, 0, newCapacity);
}
if (newOrigin >= newTailOffset) {
newOrigin -= newTailOffset;
newCapacity -= newTailOffset;
newLevel = SHIFT;
newRoot = null;
newTail = newTail && newTail.removeBefore(owner, 0, newOrigin);
} else if (newOrigin > oldOrigin || newTailOffset < oldTailOffset) {
offsetShift = 0;
while (newRoot) {
var beginIndex = (newOrigin >>> newLevel) & MASK;
if (beginIndex !== (newTailOffset >>> newLevel) & MASK) {
break;
}
if (beginIndex) {
offsetShift += (1 << newLevel) * beginIndex;
}
newLevel -= SHIFT;
newRoot = newRoot.array[beginIndex];
}
if (newRoot && newOrigin > oldOrigin) {
newRoot = newRoot.removeBefore(owner, newLevel, newOrigin - offsetShift);
}
if (newRoot && newTailOffset < oldTailOffset) {
newRoot = newRoot.removeAfter(owner, newLevel, newTailOffset - offsetShift);
}
if (offsetShift) {
newOrigin -= offsetShift;
newCapacity -= offsetShift;
}
}
if (list.__ownerID) {
list.size = newCapacity - newOrigin;
list._origin = newOrigin;
list._capacity = newCapacity;
list._level = newLevel;
list._root = newRoot;
list._tail = newTail;
list.__hash = undefined;
list.__altered = true;
return list;
}
return makeList(newOrigin, newCapacity, newLevel, newRoot, newTail);
}
function mergeIntoListWith(list, merger, iterables) {
var iters = [];
var maxSize = 0;
for (var ii = 0; ii < iterables.length; ii++) {
var value = iterables[ii];
var iter = IndexedIterable(value);
if (iter.size > maxSize) {
maxSize = iter.size;
}
if (!isIterable(value)) {
iter = iter.map((function(v) {
return fromJS(v);
}));
}
iters.push(iter);
}
if (maxSize > list.size) {
list = list.setSize(maxSize);
}
return mergeIntoCollectionWith(list, merger, iters);
}
function getTailOffset(size) {
return size < SIZE ? 0 : (((size - 1) >>> SHIFT) << SHIFT);
}
var OrderedMap = function OrderedMap(value) {
return value === null || value === undefined ? emptyOrderedMap() : isOrderedMap(value) ? value : emptyOrderedMap().withMutations((function(map) {
var iter = KeyedIterable(value);
assertNotInfinite(iter.size);
iter.forEach((function(v, k) {
return map.set(k, v);
}));
}));
};
($traceurRuntime.createClass)(OrderedMap, {
toString: function() {
return this.__toString('OrderedMap {', '}');
},
get: function(k, notSetValue) {
var index = this._map.get(k);
return index !== undefined ? this._list.get(index)[1] : notSetValue;
},
clear: function() {
if (this.size === 0) {
return this;
}
if (this.__ownerID) {
this.size = 0;
this._map.clear();
this._list.clear();
return this;
}
return emptyOrderedMap();
},
set: function(k, v) {
return updateOrderedMap(this, k, v);
},
remove: function(k) {
return updateOrderedMap(this, k, NOT_SET);
},
wasAltered: function() {
return this._map.wasAltered() || this._list.wasAltered();
},
__iterate: function(fn, reverse) {
var $__0 = this;
return this._list.__iterate((function(entry) {
return entry && fn(entry[1], entry[0], $__0);
}), reverse);
},
__iterator: function(type, reverse) {
return this._list.fromEntrySeq().__iterator(type, reverse);
},
__ensureOwner: function(ownerID) {
if (ownerID === this.__ownerID) {
return this;
}
var newMap = this._map.__ensureOwner(ownerID);
var newList = this._list.__ensureOwner(ownerID);
if (!ownerID) {
this.__ownerID = ownerID;
this._map = newMap;
this._list = newList;
return this;
}
return makeOrderedMap(newMap, newList, ownerID, this.__hash);
}
}, {of: function() {
return this(arguments);
}}, Map);
function isOrderedMap(maybeOrderedMap) {
return isMap(maybeOrderedMap) && isOrdered(maybeOrderedMap);
}
OrderedMap.isOrderedMap = isOrderedMap;
OrderedMap.prototype[IS_ORDERED_SENTINEL] = true;
OrderedMap.prototype[DELETE] = OrderedMap.prototype.remove;
function makeOrderedMap(map, list, ownerID, hash) {
var omap = Object.create(OrderedMap.prototype);
omap.size = map ? map.size : 0;
omap._map = map;
omap._list = list;
omap.__ownerID = ownerID;
omap.__hash = hash;
return omap;
}
var EMPTY_ORDERED_MAP;
function emptyOrderedMap() {
return EMPTY_ORDERED_MAP || (EMPTY_ORDERED_MAP = makeOrderedMap(emptyMap(), emptyList()));
}
function updateOrderedMap(omap, k, v) {
var map = omap._map;
var list = omap._list;
var i = map.get(k);
var has = i !== undefined;
var newMap;
var newList;
if (v === NOT_SET) {
if (!has) {
return omap;
}
if (list.size >= SIZE && list.size >= map.size * 2) {
newList = list.filter((function(entry, idx) {
return entry !== undefined && i !== idx;
}));
newMap = newList.toKeyedSeq().map((function(entry) {
return entry[0];
})).flip().toMap();
if (omap.__ownerID) {
newMap.__ownerID = newList.__ownerID = omap.__ownerID;
}
} else {
newMap = map.remove(k);
newList = i === list.size - 1 ? list.pop() : list.set(i, undefined);
}
} else {
if (has) {
if (v === list.get(i)[1]) {
return omap;
}
newMap = map;
newList = list.set(i, [k, v]);
} else {
newMap = map.set(k, list.size);
newList = list.set(list.size, [k, v]);
}
}
if (omap.__ownerID) {
omap.size = newMap.size;
omap._map = newMap;
omap._list = newList;
omap.__hash = undefined;
return omap;
}
return makeOrderedMap(newMap, newList);
}
var Stack = function Stack(value) {
return value === null || value === undefined ? emptyStack() : isStack(value) ? value : emptyStack().unshiftAll(value);
};
var $Stack = Stack;
($traceurRuntime.createClass)(Stack, {
toString: function() {
return this.__toString('Stack [', ']');
},
get: function(index, notSetValue) {
var head = this._head;
while (head && index--) {
head = head.next;
}
return head ? head.value : notSetValue;
},
peek: function() {
return this._head && this._head.value;
},
push: function() {
if (arguments.length === 0) {
return this;
}
var newSize = this.size + arguments.length;
var head = this._head;
for (var ii = arguments.length - 1; ii >= 0; ii--) {
head = {
value: arguments[ii],
next: head
};
}
if (this.__ownerID) {
this.size = newSize;
this._head = head;
this.__hash = undefined;
this.__altered = true;
return this;
}
return makeStack(newSize, head);
},
pushAll: function(iter) {
iter = IndexedIterable(iter);
if (iter.size === 0) {
return this;
}
assertNotInfinite(iter.size);
var newSize = this.size;
var head = this._head;
iter.reverse().forEach((function(value) {
newSize++;
head = {
value: value,
next: head
};
}));
if (this.__ownerID) {
this.size = newSize;
this._head = head;
this.__hash = undefined;
this.__altered = true;
return this;
}
return makeStack(newSize, head);
},
pop: function() {
return this.slice(1);
},
unshift: function() {
return this.push.apply(this, arguments);
},
unshiftAll: function(iter) {
return this.pushAll(iter);
},
shift: function() {
return this.pop.apply(this, arguments);
},
clear: function() {
if (this.size === 0) {
return this;
}
if (this.__ownerID) {
this.size = 0;
this._head = undefined;
this.__hash = undefined;
this.__altered = true;
return this;
}
return emptyStack();
},
slice: function(begin, end) {
if (wholeSlice(begin, end, this.size)) {
return this;
}
var resolvedBegin = resolveBegin(begin, this.size);
var resolvedEnd = resolveEnd(end, this.size);
if (resolvedEnd !== this.size) {
return $traceurRuntime.superCall(this, $Stack.prototype, "slice", [begin, end]);
}
var newSize = this.size - resolvedBegin;
var head = this._head;
while (resolvedBegin--) {
head = head.next;
}
if (this.__ownerID) {
this.size = newSize;
this._head = head;
this.__hash = undefined;
this.__altered = true;
return this;
}
return makeStack(newSize, head);
},
__ensureOwner: function(ownerID) {
if (ownerID === this.__ownerID) {
return this;
}
if (!ownerID) {
this.__ownerID = ownerID;
this.__altered = false;
return this;
}
return makeStack(this.size, this._head, ownerID, this.__hash);
},
__iterate: function(fn, reverse) {
if (reverse) {
return this.toSeq().cacheResult.__iterate(fn, reverse);
}
var iterations = 0;
var node = this._head;
while (node) {
if (fn(node.value, iterations++, this) === false) {
break;
}
node = node.next;
}
return iterations;
},
__iterator: function(type, reverse) {
if (reverse) {
return this.toSeq().cacheResult().__iterator(type, reverse);
}
var iterations = 0;
var node = this._head;
return new Iterator((function() {
if (node) {
var value = node.value;
node = node.next;
return iteratorValue(type, iterations++, value);
}
return iteratorDone();
}));
}
}, {of: function() {
return this(arguments);
}}, IndexedCollection);
function isStack(maybeStack) {
return !!(maybeStack && maybeStack[IS_STACK_SENTINEL]);
}
Stack.isStack = isStack;
var IS_STACK_SENTINEL = '@@__IMMUTABLE_STACK__@@';
var StackPrototype = Stack.prototype;
StackPrototype[IS_STACK_SENTINEL] = true;
StackPrototype.withMutations = MapPrototype.withMutations;
StackPrototype.asMutable = MapPrototype.asMutable;
StackPrototype.asImmutable = MapPrototype.asImmutable;
StackPrototype.wasAltered = MapPrototype.wasAltered;
function makeStack(size, head, ownerID, hash) {
var map = Object.create(StackPrototype);
map.size = size;
map._head = head;
map.__ownerID = ownerID;
map.__hash = hash;
map.__altered = false;
return map;
}
var EMPTY_STACK;
function emptyStack() {
return EMPTY_STACK || (EMPTY_STACK = makeStack(0));
}
var Set = function Set(value) {
return value === null || value === undefined ? emptySet() : isSet(value) ? value : emptySet().withMutations((function(set) {
var iter = SetIterable(value);
assertNotInfinite(iter.size);
iter.forEach((function(v) {
return set.add(v);
}));
}));
};
($traceurRuntime.createClass)(Set, {
toString: function() {
return this.__toString('Set {', '}');
},
has: function(value) {
return this._map.has(value);
},
add: function(value) {
return updateSet(this, this._map.set(value, true));
},
remove: function(value) {
return updateSet(this, this._map.remove(value));
},
clear: function() {
return updateSet(this, this._map.clear());
},
union: function() {
for (var iters = [],
$__9 = 0; $__9 < arguments.length; $__9++)
iters[$__9] = arguments[$__9];
iters = iters.filter((function(x) {
return x.size !== 0;
}));
if (iters.length === 0) {
return this;
}
if (this.size === 0 && iters.length === 1) {
return this.constructor(iters[0]);
}
return this.withMutations((function(set) {
for (var ii = 0; ii < iters.length; ii++) {
SetIterable(iters[ii]).forEach((function(value) {
return set.add(value);
}));
}
}));
},
intersect: function() {
for (var iters = [],
$__10 = 0; $__10 < arguments.length; $__10++)
iters[$__10] = arguments[$__10];
if (iters.length === 0) {
return this;
}
iters = iters.map((function(iter) {
return SetIterable(iter);
}));
var originalSet = this;
return this.withMutations((function(set) {
originalSet.forEach((function(value) {
if (!iters.every((function(iter) {
return iter.contains(value);
}))) {
set.remove(value);
}
}));
}));
},
subtract: function() {
for (var iters = [],
$__11 = 0; $__11 < arguments.length; $__11++)
iters[$__11] = arguments[$__11];
if (iters.length === 0) {
return this;
}
iters = iters.map((function(iter) {
return SetIterable(iter);
}));
var originalSet = this;
return this.withMutations((function(set) {
originalSet.forEach((function(value) {
if (iters.some((function(iter) {
return iter.contains(value);
}))) {
set.remove(value);
}
}));
}));
},
merge: function() {
return this.union.apply(this, arguments);
},
mergeWith: function(merger) {
for (var iters = [],
$__12 = 1; $__12 < arguments.length; $__12++)
iters[$__12 - 1] = arguments[$__12];
return this.union.apply(this, iters);
},
sort: function(comparator) {
return OrderedSet(sortFactory(this, comparator));
},
sortBy: function(mapper, comparator) {
return OrderedSet(sortFactory(this, comparator, mapper));
},
wasAltered: function() {
return this._map.wasAltered();
},
__iterate: function(fn, reverse) {
var $__0 = this;
return this._map.__iterate((function(_, k) {
return fn(k, k, $__0);
}), reverse);
},
__iterator: function(type, reverse) {
return this._map.map((function(_, k) {
return k;
})).__iterator(type, reverse);
},
__ensureOwner: function(ownerID) {
if (ownerID === this.__ownerID) {
return this;
}
var newMap = this._map.__ensureOwner(ownerID);
if (!ownerID) {
this.__ownerID = ownerID;
this._map = newMap;
return this;
}
return this.__make(newMap, ownerID);
}
}, {
of: function() {
return this(arguments);
},
fromKeys: function(value) {
return this(KeyedIterable(value).keySeq());
}
}, SetCollection);
function isSet(maybeSet) {
return !!(maybeSet && maybeSet[IS_SET_SENTINEL]);
}
Set.isSet = isSet;
var IS_SET_SENTINEL = '@@__IMMUTABLE_SET__@@';
var SetPrototype = Set.prototype;
SetPrototype[IS_SET_SENTINEL] = true;
SetPrototype[DELETE] = SetPrototype.remove;
SetPrototype.mergeDeep = SetPrototype.merge;
SetPrototype.mergeDeepWith = SetPrototype.mergeWith;
SetPrototype.withMutations = MapPrototype.withMutations;
SetPrototype.asMutable = MapPrototype.asMutable;
SetPrototype.asImmutable = MapPrototype.asImmutable;
SetPrototype.__empty = emptySet;
SetPrototype.__make = makeSet;
function updateSet(set, newMap) {
if (set.__ownerID) {
set.size = newMap.size;
set._map = newMap;
return set;
}
return newMap === set._map ? set : newMap.size === 0 ? set.__empty() : set.__make(newMap);
}
function makeSet(map, ownerID) {
var set = Object.create(SetPrototype);
set.size = map ? map.size : 0;
set._map = map;
set.__ownerID = ownerID;
return set;
}
var EMPTY_SET;
function emptySet() {
return EMPTY_SET || (EMPTY_SET = makeSet(emptyMap()));
}
var OrderedSet = function OrderedSet(value) {
return value === null || value === undefined ? emptyOrderedSet() : isOrderedSet(value) ? value : emptyOrderedSet().withMutations((function(set) {
var iter = SetIterable(value);
assertNotInfinite(iter.size);
iter.forEach((function(v) {
return set.add(v);
}));
}));
};
($traceurRuntime.createClass)(OrderedSet, {toString: function() {
return this.__toString('OrderedSet {', '}');
}}, {
of: function() {
return this(arguments);
},
fromKeys: function(value) {
return this(KeyedIterable(value).keySeq());
}
}, Set);
function isOrderedSet(maybeOrderedSet) {
return isSet(maybeOrderedSet) && isOrdered(maybeOrderedSet);
}
OrderedSet.isOrderedSet = isOrderedSet;
var OrderedSetPrototype = OrderedSet.prototype;
OrderedSetPrototype[IS_ORDERED_SENTINEL] = true;
OrderedSetPrototype.__empty = emptyOrderedSet;
OrderedSetPrototype.__make = makeOrderedSet;
function makeOrderedSet(map, ownerID) {
var set = Object.create(OrderedSetPrototype);
set.size = map ? map.size : 0;
set._map = map;
set.__ownerID = ownerID;
return set;
}
var EMPTY_ORDERED_SET;
function emptyOrderedSet() {
return EMPTY_ORDERED_SET || (EMPTY_ORDERED_SET = makeOrderedSet(emptyOrderedMap()));
}
var Record = function Record(defaultValues, name) {
var RecordType = function Record(values) {
if (!(this instanceof RecordType)) {
return new RecordType(values);
}
this._map = Map(values);
};
var keys = Object.keys(defaultValues);
var RecordTypePrototype = RecordType.prototype = Object.create(RecordPrototype);
RecordTypePrototype.constructor = RecordType;
name && (RecordTypePrototype._name = name);
RecordTypePrototype._defaultValues = defaultValues;
RecordTypePrototype._keys = keys;
RecordTypePrototype.size = keys.length;
try {
keys.forEach((function(key) {
Object.defineProperty(RecordType.prototype, key, {
get: function() {
return this.get(key);
},
set: function(value) {
invariant(this.__ownerID, 'Cannot set on an immutable record.');
this.set(key, value);
}
});
}));
} catch (error) {}
return RecordType;
};
($traceurRuntime.createClass)(Record, {
toString: function() {
return this.__toString(recordName(this) + ' {', '}');
},
has: function(k) {
return this._defaultValues.hasOwnProperty(k);
},
get: function(k, notSetValue) {
if (!this.has(k)) {
return notSetValue;
}
var defaultVal = this._defaultValues[k];
return this._map ? this._map.get(k, defaultVal) : defaultVal;
},
clear: function() {
if (this.__ownerID) {
this._map && this._map.clear();
return this;
}
var SuperRecord = Object.getPrototypeOf(this).constructor;
return SuperRecord._empty || (SuperRecord._empty = makeRecord(this, emptyMap()));
},
set: function(k, v) {
if (!this.has(k)) {
throw new Error('Cannot set unknown key "' + k + '" on ' + recordName(this));
}
var newMap = this._map && this._map.set(k, v);
if (this.__ownerID || newMap === this._map) {
return this;
}
return makeRecord(this, newMap);
},
remove: function(k) {
if (!this.has(k)) {
return this;
}
var newMap = this._map && this._map.remove(k);
if (this.__ownerID || newMap === this._map) {
return this;
}
return makeRecord(this, newMap);
},
wasAltered: function() {
return this._map.wasAltered();
},
__iterator: function(type, reverse) {
var $__0 = this;
return KeyedIterable(this._defaultValues).map((function(_, k) {
return $__0.get(k);
})).__iterator(type, reverse);
},
__iterate: function(fn, reverse) {
var $__0 = this;
return KeyedIterable(this._defaultValues).map((function(_, k) {
return $__0.get(k);
})).__iterate(fn, reverse);
},
__ensureOwner: function(ownerID) {
if (ownerID === this.__ownerID) {
return this;
}
var newMap = this._map && this._map.__ensureOwner(ownerID);
if (!ownerID) {
this.__ownerID = ownerID;
this._map = newMap;
return this;
}
return makeRecord(this, newMap, ownerID);
}
}, {}, KeyedCollection);
var RecordPrototype = Record.prototype;
RecordPrototype[DELETE] = RecordPrototype.remove;
RecordPrototype.deleteIn = RecordPrototype.removeIn = MapPrototype.removeIn;
RecordPrototype.merge = MapPrototype.merge;
RecordPrototype.mergeWith = MapPrototype.mergeWith;
RecordPrototype.mergeIn = MapPrototype.mergeIn;
RecordPrototype.mergeDeep = MapPrototype.mergeDeep;
RecordPrototype.mergeDeepWith = MapPrototype.mergeDeepWith;
RecordPrototype.mergeDeepIn = MapPrototype.mergeDeepIn;
RecordPrototype.setIn = MapPrototype.setIn;
RecordPrototype.update = MapPrototype.update;
RecordPrototype.updateIn = MapPrototype.updateIn;
RecordPrototype.withMutations = MapPrototype.withMutations;
RecordPrototype.asMutable = MapPrototype.asMutable;
RecordPrototype.asImmutable = MapPrototype.asImmutable;
function makeRecord(likeRecord, map, ownerID) {
var record = Object.create(Object.getPrototypeOf(likeRecord));
record._map = map;
record.__ownerID = ownerID;
return record;
}
function recordName(record) {
return record._name || record.constructor.name;
}
var Range = function Range(start, end, step) {
if (!(this instanceof $Range)) {
return new $Range(start, end, step);
}
invariant(step !== 0, 'Cannot step a Range by 0');
start = start || 0;
if (end === undefined) {
end = Infinity;
}
if (start === end && __EMPTY_RANGE) {
return __EMPTY_RANGE;
}
step = step === undefined ? 1 : Math.abs(step);
if (end < start) {
step = -step;
}
this._start = start;
this._end = end;
this._step = step;
this.size = Math.max(0, Math.ceil((end - start) / step - 1) + 1);
};
var $Range = Range;
($traceurRuntime.createClass)(Range, {
toString: function() {
if (this.size === 0) {
return 'Range []';
}
return 'Range [ ' + this._start + '...' + this._end + (this._step > 1 ? ' by ' + this._step : '') + ' ]';
},
get: function(index, notSetValue) {
return this.has(index) ? this._start + wrapIndex(this, index) * this._step : notSetValue;
},
contains: function(searchValue) {
var possibleIndex = (searchValue - this._start) / this._step;
return possibleIndex >= 0 && possibleIndex < this.size && possibleIndex === Math.floor(possibleIndex);
},
slice: function(begin, end) {
if (wholeSlice(begin, end, this.size)) {
return this;
}
begin = resolveBegin(begin, this.size);
end = resolveEnd(end, this.size);
if (end <= begin) {
return __EMPTY_RANGE;
}
return new $Range(this.get(begin, this._end), this.get(end, this._end), this._step);
},
indexOf: function(searchValue) {
var offsetValue = searchValue - this._start;
if (offsetValue % this._step === 0) {
var index = offsetValue / this._step;
if (index >= 0 && index < this.size) {
return index;
}
}
return -1;
},
lastIndexOf: function(searchValue) {
return this.indexOf(searchValue);
},
take: function(amount) {
return this.slice(0, Math.max(0, amount));
},
skip: function(amount) {
return this.slice(Math.max(0, amount));
},
__iterate: function(fn, reverse) {
var maxIndex = this.size - 1;
var step = this._step;
var value = reverse ? this._start + maxIndex * step : this._start;
for (var ii = 0; ii <= maxIndex; ii++) {
if (fn(value, ii, this) === false) {
return ii + 1;
}
value += reverse ? -step : step;
}
return ii;
},
__iterator: function(type, reverse) {
var maxIndex = this.size - 1;
var step = this._step;
var value = reverse ? this._start + maxIndex * step : this._start;
var ii = 0;
return new Iterator((function() {
var v = value;
value += reverse ? -step : step;
return ii > maxIndex ? iteratorDone() : iteratorValue(type, ii++, v);
}));
},
equals: function(other) {
return other instanceof $Range ? this._start === other._start && this._end === other._end && this._step === other._step : deepEqual(this, other);
}
}, {}, IndexedSeq);
var RangePrototype = Range.prototype;
RangePrototype.__toJS = RangePrototype.toArray;
RangePrototype.first = ListPrototype.first;
RangePrototype.last = ListPrototype.last;
var __EMPTY_RANGE = Range(0, 0);
var Repeat = function Repeat(value, times) {
if (times <= 0 && EMPTY_REPEAT) {
return EMPTY_REPEAT;
}
if (!(this instanceof $Repeat)) {
return new $Repeat(value, times);
}
this._value = value;
this.size = times === undefined ? Infinity : Math.max(0, times);
if (this.size === 0) {
EMPTY_REPEAT = this;
}
};
var $Repeat = Repeat;
($traceurRuntime.createClass)(Repeat, {
toString: function() {
if (this.size === 0) {
return 'Repeat []';
}
return 'Repeat [ ' + this._value + ' ' + this.size + ' times ]';
},
get: function(index, notSetValue) {
return this.has(index) ? this._value : notSetValue;
},
contains: function(searchValue) {
return is(this._value, searchValue);
},
slice: function(begin, end) {
var size = this.size;
return wholeSlice(begin, end, size) ? this : new $Repeat(this._value, resolveEnd(end, size) - resolveBegin(begin, size));
},
reverse: function() {
return this;
},
indexOf: function(searchValue) {
if (is(this._value, searchValue)) {
return 0;
}
return -1;
},
lastIndexOf: function(searchValue) {
if (is(this._value, searchValue)) {
return this.size;
}
return -1;
},
__iterate: function(fn, reverse) {
for (var ii = 0; ii < this.size; ii++) {
if (fn(this._value, ii, this) === false) {
return ii + 1;
}
}
return ii;
},
__iterator: function(type, reverse) {
var $__0 = this;
var ii = 0;
return new Iterator((function() {
return ii < $__0.size ? iteratorValue(type, ii++, $__0._value) : iteratorDone();
}));
},
equals: function(other) {
return other instanceof $Repeat ? is(this._value, other._value) : deepEqual(other);
}
}, {}, IndexedSeq);
var RepeatPrototype = Repeat.prototype;
RepeatPrototype.last = RepeatPrototype.first;
RepeatPrototype.has = RangePrototype.has;
RepeatPrototype.take = RangePrototype.take;
RepeatPrototype.skip = RangePrototype.skip;
RepeatPrototype.__toJS = RangePrototype.__toJS;
var EMPTY_REPEAT;
var Immutable = {
Iterable: Iterable,
Seq: Seq,
Collection: Collection,
Map: Map,
OrderedMap: OrderedMap,
List: List,
Stack: Stack,
Set: Set,
OrderedSet: OrderedSet,
Record: Record,
Range: Range,
Repeat: Repeat,
is: is,
fromJS: fromJS
};
return Immutable;
}
true ? module.exports = universalModule() :
typeof define === 'function' && define.amd ? define(universalModule) :
Immutable = universalModule();
/***/ },
/* 12 */
/***/ function(module, exports, __webpack_require__) {
var Immutable = __webpack_require__(11)
var isGetter = __webpack_require__(5).isGetter
/**
* Takes a getter and returns the hash code value
*
* If cache argument is true it will freeze the getter
* and cache the hashed value
*
* @param {Getter} getter
* @param {boolean} dontCache
* @return {number}
*/
module.exports = function(getter, dontCache) {
if (getter.hasOwnProperty('__hashCode')) {
return getter.__hashCode
}
if (!isGetter(getter)) {
throw new Error("Invalid getter! Must be of the form: [<KeyPath>, ...<KeyPath>, <function>]")
}
var hashCode = Immutable.fromJS(getter).hashCode()
if (!dontCache) {
Object.defineProperty(getter, '__hashCode', {
enumerable: false,
configurable: false,
writable: false,
value: hashCode,
})
Object.freeze(getter)
}
return hashCode
}
/***/ },
/* 13 */
/***/ function(module, exports, __webpack_require__) {
var Immutable = __webpack_require__(11)
/**
* Is equal by value check
*/
module.exports = function(a, b) {
return Immutable.is(a, b)
}
/***/ }
/******/ ])
});
|
test/integration/List/selectableList.spec.js | pancho111203/material-ui | import React from 'react';
import {assert} from 'chai';
import {shallow} from 'enzyme';
import List from 'src/List/List';
import ListItem from 'src/List/ListItem';
import makeSelectable from 'src/List/makeSelectable';
import injectTheme from '../fixtures/inject-theme';
import getMuiTheme from 'src/styles/getMuiTheme';
import TestUtils from 'react-addons-test-utils';
describe('makeSelectable', () => {
const muiTheme = getMuiTheme();
const shallowWithContext = (node) => shallow(node, {context: {muiTheme}});
const testChildren = [
<ListItem
key={1}
value={1}
primaryText="Brendan Lim"
nestedItems={[
<ListItem
value={2}
primaryText="Grace Ng"
/>,
]}
/>,
<ListItem
key={3}
value={3}
primaryText="Kerem Suer"
/>,
];
it('should display the children', () => {
const SelectableList = makeSelectable(List);
const wrapper = shallowWithContext(
<SelectableList>
{testChildren}
</SelectableList>
);
const brendan = wrapper.childAt(0);
const kerem = wrapper.childAt(1);
assert.ok(brendan.length);
assert.ok(kerem.length);
});
it('should select the right item', () => {
const SelectableList = injectTheme(makeSelectable(List));
const render = TestUtils.renderIntoDocument(
<SelectableList value={2}>
{testChildren}
</SelectableList>
);
const nodeTree = TestUtils.scryRenderedDOMComponentsWithTag(render, 'div');
assert.equal(
nodeTree[0].firstChild.lastChild.querySelector('span').style.backgroundColor,
'rgba(0, 0, 0, 0.2)',
'Change the backgroundColor of the selected item'
);
});
});
|
ajax/libs/material-ui/5.0.0-alpha.24/node/List/ListContext.js | cdnjs/cdnjs | "use strict";
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var React = _interopRequireWildcard(require("react"));
/**
* @ignore - internal component.
*/
const ListContext = /*#__PURE__*/React.createContext({});
if (process.env.NODE_ENV !== 'production') {
ListContext.displayName = 'ListContext';
}
var _default = ListContext;
exports.default = _default; |
ajax/libs/F2/1.2.1/f2.no-bootstrap.min.js | upgle/cdnjs | /*! F2 - v1.2.2 - 08-22-2013 - See below for copyright and license */
(function(exports){if(!exports.F2||exports.F2_TESTING_MODE){/*!
JSON.org requires the following notice to accompany json2:
Copyright (c) 2002 JSON.org
http://json.org
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
The Software shall be used for Good, not Evil.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
*/
"object"!=typeof JSON&&(JSON={}),function(){"use strict";function f(e){return 10>e?"0"+e:e}function quote(e){return escapable.lastIndex=0,escapable.test(e)?'"'+e.replace(escapable,function(e){var t=meta[e];return"string"==typeof t?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+e+'"'}function str(e,t){var n,r,o,i,a,s=gap,c=t[e];switch(c&&"object"==typeof c&&"function"==typeof c.toJSON&&(c=c.toJSON(e)),"function"==typeof rep&&(c=rep.call(t,e,c)),typeof c){case"string":return quote(c);case"number":return isFinite(c)?c+"":"null";case"boolean":case"null":return c+"";case"object":if(!c)return"null";if(gap+=indent,a=[],"[object Array]"===Object.prototype.toString.apply(c)){for(i=c.length,n=0;i>n;n+=1)a[n]=str(n,c)||"null";return o=0===a.length?"[]":gap?"[\n"+gap+a.join(",\n"+gap)+"\n"+s+"]":"["+a.join(",")+"]",gap=s,o}if(rep&&"object"==typeof rep)for(i=rep.length,n=0;i>n;n+=1)"string"==typeof rep[n]&&(r=rep[n],o=str(r,c),o&&a.push(quote(r)+(gap?": ":":")+o));else for(r in c)Object.prototype.hasOwnProperty.call(c,r)&&(o=str(r,c),o&&a.push(quote(r)+(gap?": ":":")+o));return o=0===a.length?"{}":gap?"{\n"+gap+a.join(",\n"+gap)+"\n"+s+"}":"{"+a.join(",")+"}",gap=s,o}}"function"!=typeof Date.prototype.toJSON&&(Date.prototype.toJSON=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null},String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(){return this.valueOf()});var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;"function"!=typeof JSON.stringify&&(JSON.stringify=function(e,t,n){var r;if(gap="",indent="","number"==typeof n)for(r=0;n>r;r+=1)indent+=" ";else"string"==typeof n&&(indent=n);if(rep=t,t&&"function"!=typeof t&&("object"!=typeof t||"number"!=typeof t.length))throw Error("JSON.stringify");return str("",{"":e})}),"function"!=typeof JSON.parse&&(JSON.parse=function(text,reviver){function walk(e,t){var n,r,o=e[t];if(o&&"object"==typeof o)for(n in o)Object.prototype.hasOwnProperty.call(o,n)&&(r=walk(o,n),void 0!==r?o[n]=r:delete o[n]);return reviver.call(e,t,o)}var j;if(text+="",cx.lastIndex=0,cx.test(text)&&(text=text.replace(cx,function(e){return"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})),/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return j=eval("("+text+")"),"function"==typeof reviver?walk({"":j},""):j;throw new SyntaxError("JSON.parse")})}(),/*!
* jQuery JavaScript Library v1.8.3
* The jQuery Foundation and other contributors require the following notice to accompany jQuery:
*
* Copyright (c) 2013 jQuery Foundation and other contributors
*
* http://jquery.com
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
* is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
* IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
function(e,t){function n(e){var t=ht[e]={};return Y.each(e.split(tt),function(e,n){t[n]=!0}),t}function r(e,n,r){if(r===t&&1===e.nodeType){var o="data-"+n.replace(mt,"-$1").toLowerCase();if(r=e.getAttribute(o),"string"==typeof r){try{r="true"===r?!0:"false"===r?!1:"null"===r?null:+r+""===r?+r:gt.test(r)?Y.parseJSON(r):r}catch(i){}Y.data(e,n,r)}else r=t}return r}function o(e){var t;for(t in e)if(("data"!==t||!Y.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}function i(){return!1}function a(){return!0}function s(e){return!e||!e.parentNode||11===e.parentNode.nodeType}function c(e,t){do e=e[t];while(e&&1!==e.nodeType);return e}function l(e,t,n){if(t=t||0,Y.isFunction(t))return Y.grep(e,function(e,r){var o=!!t.call(e,r,e);return o===n});if(t.nodeType)return Y.grep(e,function(e){return e===t===n});if("string"==typeof t){var r=Y.grep(e,function(e){return 1===e.nodeType});if(Pt.test(t))return Y.filter(t,r,!n);t=Y.filter(t,r)}return Y.grep(e,function(e){return Y.inArray(e,t)>=0===n})}function u(e){var t=Lt.split("|"),n=e.createDocumentFragment();if(n.createElement)for(;t.length;)n.createElement(t.pop());return n}function p(e,t){return e.getElementsByTagName(t)[0]||e.appendChild(e.ownerDocument.createElement(t))}function f(e,t){if(1===t.nodeType&&Y.hasData(e)){var n,r,o,i=Y._data(e),a=Y._data(t,i),s=i.events;if(s){delete a.handle,a.events={};for(n in s)for(r=0,o=s[n].length;o>r;r++)Y.event.add(t,n,s[n][r])}a.data&&(a.data=Y.extend({},a.data))}}function d(e,t){var n;1===t.nodeType&&(t.clearAttributes&&t.clearAttributes(),t.mergeAttributes&&t.mergeAttributes(e),n=t.nodeName.toLowerCase(),"object"===n?(t.parentNode&&(t.outerHTML=e.outerHTML),Y.support.html5Clone&&e.innerHTML&&!Y.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):"input"===n&&Xt.test(e.type)?(t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value)):"option"===n?t.selected=e.defaultSelected:"input"===n||"textarea"===n?t.defaultValue=e.defaultValue:"script"===n&&t.text!==e.text&&(t.text=e.text),t.removeAttribute(Y.expando))}function h(e){return e.getElementsByTagName!==t?e.getElementsByTagName("*"):e.querySelectorAll!==t?e.querySelectorAll("*"):[]}function g(e){Xt.test(e.type)&&(e.defaultChecked=e.checked)}function m(e,t){if(t in e)return t;for(var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,o=vn.length;o--;)if(t=vn[o]+n,t in e)return t;return r}function y(e,t){return e=t||e,"none"===Y.css(e,"display")||!Y.contains(e.ownerDocument,e)}function v(e,t){for(var n,r,o=[],i=0,a=e.length;a>i;i++)n=e[i],n.style&&(o[i]=Y._data(n,"olddisplay"),t?(o[i]||"none"!==n.style.display||(n.style.display=""),""===n.style.display&&y(n)&&(o[i]=Y._data(n,"olddisplay",x(n.nodeName)))):(r=nn(n,"display"),o[i]||"none"===r||Y._data(n,"olddisplay",r)));for(i=0;a>i;i++)n=e[i],n.style&&(t&&"none"!==n.style.display&&""!==n.style.display||(n.style.display=t?o[i]||"":"none"));return e}function b(e,t,n){var r=pn.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function _(e,t,n,r){for(var o=n===(r?"border":"content")?4:"width"===t?1:0,i=0;4>o;o+=2)"margin"===n&&(i+=Y.css(e,n+yn[o],!0)),r?("content"===n&&(i-=parseFloat(nn(e,"padding"+yn[o]))||0),"margin"!==n&&(i-=parseFloat(nn(e,"border"+yn[o]+"Width"))||0)):(i+=parseFloat(nn(e,"padding"+yn[o]))||0,"padding"!==n&&(i+=parseFloat(nn(e,"border"+yn[o]+"Width"))||0));return i}function C(e,t,n){var r="width"===t?e.offsetWidth:e.offsetHeight,o=!0,i=Y.support.boxSizing&&"border-box"===Y.css(e,"boxSizing");if(0>=r||null==r){if(r=nn(e,t),(0>r||null==r)&&(r=e.style[t]),fn.test(r))return r;o=i&&(Y.support.boxSizingReliable||r===e.style[t]),r=parseFloat(r)||0}return r+_(e,t,n||(i?"border":"content"),o)+"px"}function x(e){if(hn[e])return hn[e];var t=Y("<"+e+">").appendTo(Q.body),n=t.css("display");return t.remove(),("none"===n||""===n)&&(rn=Q.body.appendChild(rn||Y.extend(Q.createElement("iframe"),{frameBorder:0,width:0,height:0})),on&&rn.createElement||(on=(rn.contentWindow||rn.contentDocument).document,on.write("<!doctype html><html><body>"),on.close()),t=on.body.appendChild(on.createElement(e)),n=nn(t,"display"),Q.body.removeChild(rn)),hn[e]=n,n}function w(e,t,n,r){var o;if(Y.isArray(t))Y.each(t,function(t,o){n||Cn.test(e)?r(e,o):w(e+"["+("object"==typeof o?t:"")+"]",o,n,r)});else if(n||"object"!==Y.type(t))r(e,t);else for(o in t)w(e+"["+o+"]",t[o],n,r)}function A(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,o,i,a=t.toLowerCase().split(tt),s=0,c=a.length;if(Y.isFunction(n))for(;c>s;s++)r=a[s],i=/^\+/.test(r),i&&(r=r.substr(1)||"*"),o=e[r]=e[r]||[],o[i?"unshift":"push"](n)}}function F(e,n,r,o,i,a){i=i||n.dataTypes[0],a=a||{},a[i]=!0;for(var s,c=e[i],l=0,u=c?c.length:0,p=e===Hn;u>l&&(p||!s);l++)s=c[l](n,r,o),"string"==typeof s&&(!p||a[s]?s=t:(n.dataTypes.unshift(s),s=F(e,n,r,o,s,a)));return!p&&s||a["*"]||(s=F(e,n,r,o,"*",a)),s}function k(e,n){var r,o,i=Y.ajaxSettings.flatOptions||{};for(r in n)n[r]!==t&&((i[r]?e:o||(o={}))[r]=n[r]);o&&Y.extend(!0,e,o)}function E(e,n,r){var o,i,a,s,c=e.contents,l=e.dataTypes,u=e.responseFields;for(i in u)i in r&&(n[u[i]]=r[i]);for(;"*"===l[0];)l.shift(),o===t&&(o=e.mimeType||n.getResponseHeader("content-type"));if(o)for(i in c)if(c[i]&&c[i].test(o)){l.unshift(i);break}if(l[0]in r)a=l[0];else{for(i in r){if(!l[0]||e.converters[i+" "+l[0]]){a=i;break}s||(s=i)}a=a||s}return a?(a!==l[0]&&l.unshift(a),r[a]):t}function T(e,t){var n,r,o,i,a=e.dataTypes.slice(),s=a[0],c={},l=0;if(e.dataFilter&&(t=e.dataFilter(t,e.dataType)),a[1])for(n in e.converters)c[n.toLowerCase()]=e.converters[n];for(;o=a[++l];)if("*"!==o){if("*"!==s&&s!==o){if(n=c[s+" "+o]||c["* "+o],!n)for(r in c)if(i=r.split(" "),i[1]===o&&(n=c[s+" "+i[0]]||c["* "+i[0]])){n===!0?n=c[r]:c[r]!==!0&&(o=i[0],a.splice(l--,0,o));break}if(n!==!0)if(n&&e["throws"])t=n(t);else try{t=n(t)}catch(u){return{state:"parsererror",error:n?u:"No conversion from "+s+" to "+o}}}s=o}return{state:"success",data:t}}function N(){try{return new e.XMLHttpRequest}catch(t){}}function R(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}function S(){return setTimeout(function(){Vn=t},0),Vn=Y.now()}function j(e,t){Y.each(t,function(t,n){for(var r=(er[t]||[]).concat(er["*"]),o=0,i=r.length;i>o;o++)if(r[o].call(e,t,n))return})}function O(e,t,n){var r,o=0,i=Zn.length,a=Y.Deferred().always(function(){delete s.elem}),s=function(){for(var t=Vn||S(),n=Math.max(0,c.startTime+c.duration-t),r=n/c.duration||0,o=1-r,i=0,s=c.tweens.length;s>i;i++)c.tweens[i].run(o);return a.notifyWith(e,[c,o,n]),1>o&&s?n:(a.resolveWith(e,[c]),!1)},c=a.promise({elem:e,props:Y.extend({},t),opts:Y.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:Vn||S(),duration:n.duration,tweens:[],createTween:function(t,n){var r=Y.Tween(e,c.opts,t,n,c.opts.specialEasing[t]||c.opts.easing);return c.tweens.push(r),r},stop:function(t){for(var n=0,r=t?c.tweens.length:0;r>n;n++)c.tweens[n].run(1);return t?a.resolveWith(e,[c,t]):a.rejectWith(e,[c,t]),this}}),l=c.props;for(I(l,c.opts.specialEasing);i>o;o++)if(r=Zn[o].call(c,e,l,c.opts))return r;return j(c,l),Y.isFunction(c.opts.start)&&c.opts.start.call(e,c),Y.fx.timer(Y.extend(s,{anim:c,queue:c.opts.queue,elem:e})),c.progress(c.opts.progress).done(c.opts.done,c.opts.complete).fail(c.opts.fail).always(c.opts.always)}function I(e,t){var n,r,o,i,a;for(n in e)if(r=Y.camelCase(n),o=t[r],i=e[n],Y.isArray(i)&&(o=i[1],i=e[n]=i[0]),n!==r&&(e[r]=i,delete e[n]),a=Y.cssHooks[r],a&&"expand"in a){i=a.expand(i),delete e[r];for(n in i)n in e||(e[n]=i[n],t[n]=o)}else t[r]=o}function M(e,t,n){var r,o,i,a,s,c,l,u,p,f=this,d=e.style,h={},g=[],m=e.nodeType&&y(e);n.queue||(u=Y._queueHooks(e,"fx"),null==u.unqueued&&(u.unqueued=0,p=u.empty.fire,u.empty.fire=function(){u.unqueued||p()}),u.unqueued++,f.always(function(){f.always(function(){u.unqueued--,Y.queue(e,"fx").length||u.empty.fire()})})),1===e.nodeType&&("height"in t||"width"in t)&&(n.overflow=[d.overflow,d.overflowX,d.overflowY],"inline"===Y.css(e,"display")&&"none"===Y.css(e,"float")&&(Y.support.inlineBlockNeedsLayout&&"inline"!==x(e.nodeName)?d.zoom=1:d.display="inline-block")),n.overflow&&(d.overflow="hidden",Y.support.shrinkWrapBlocks||f.done(function(){d.overflow=n.overflow[0],d.overflowX=n.overflow[1],d.overflowY=n.overflow[2]}));for(r in t)if(i=t[r],Kn.exec(i)){if(delete t[r],c=c||"toggle"===i,i===(m?"hide":"show"))continue;g.push(r)}if(a=g.length){s=Y._data(e,"fxshow")||Y._data(e,"fxshow",{}),"hidden"in s&&(m=s.hidden),c&&(s.hidden=!m),m?Y(e).show():f.done(function(){Y(e).hide()}),f.done(function(){var t;Y.removeData(e,"fxshow",!0);for(t in h)Y.style(e,t,h[t])});for(r=0;a>r;r++)o=g[r],l=f.createTween(o,m?s[o]:0),h[o]=s[o]||Y.style(e,o),o in s||(s[o]=l.start,m&&(l.end=l.start,l.start="width"===o||"height"===o?1:0))}}function P(e,t,n,r,o){return new P.prototype.init(e,t,n,r,o)}function H(e,t){var n,r={height:e},o=0;for(t=t?1:0;4>o;o+=2-t)n=yn[o],r["margin"+n]=r["padding"+n]=e;return t&&(r.opacity=r.width=e),r}function D(e){return Y.isWindow(e)?e:9===e.nodeType?e.defaultView||e.parentWindow:!1}var L,B,Q=e.document,U=e.location,q=e.navigator,W=e.jQuery,$=e.$,z=Array.prototype.push,J=Array.prototype.slice,V=Array.prototype.indexOf,X=Object.prototype.toString,K=Object.prototype.hasOwnProperty,G=String.prototype.trim,Y=function(e,t){return new Y.fn.init(e,t,L)},Z=/[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source,et=/\S/,tt=/\s+/,nt=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,rt=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,ot=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,it=/^[\],:{}\s]*$/,at=/(?:^|:|,)(?:\s*\[)+/g,st=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,ct=/"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g,lt=/^-ms-/,ut=/-([\da-z])/gi,pt=function(e,t){return(t+"").toUpperCase()},ft=function(){Q.addEventListener?(Q.removeEventListener("DOMContentLoaded",ft,!1),Y.ready()):"complete"===Q.readyState&&(Q.detachEvent("onreadystatechange",ft),Y.ready())},dt={};Y.fn=Y.prototype={constructor:Y,init:function(e,n,r){var o,i,a;if(!e)return this;if(e.nodeType)return this.context=this[0]=e,this.length=1,this;if("string"==typeof e){if(o="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:rt.exec(e),!o||!o[1]&&n)return!n||n.jquery?(n||r).find(e):this.constructor(n).find(e);if(o[1])return n=n instanceof Y?n[0]:n,a=n&&n.nodeType?n.ownerDocument||n:Q,e=Y.parseHTML(o[1],a,!0),ot.test(o[1])&&Y.isPlainObject(n)&&this.attr.call(e,n,!0),Y.merge(this,e);if(i=Q.getElementById(o[2]),i&&i.parentNode){if(i.id!==o[2])return r.find(e);this.length=1,this[0]=i}return this.context=Q,this.selector=e,this}return Y.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),Y.makeArray(e,this))},selector:"",jquery:"1.8.3",length:0,size:function(){return this.length},toArray:function(){return J.call(this)},get:function(e){return null==e?this.toArray():0>e?this[this.length+e]:this[e]},pushStack:function(e,t,n){var r=Y.merge(this.constructor(),e);return r.prevObject=this,r.context=this.context,"find"===t?r.selector=this.selector+(this.selector?" ":"")+n:t&&(r.selector=this.selector+"."+t+"("+n+")"),r},each:function(e,t){return Y.each(this,e,t)},ready:function(e){return Y.ready.promise().done(e),this},eq:function(e){return e=+e,-1===e?this.slice(e):this.slice(e,e+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(J.apply(this,arguments),"slice",J.call(arguments).join(","))},map:function(e){return this.pushStack(Y.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:z,sort:[].sort,splice:[].splice},Y.fn.init.prototype=Y.fn,Y.extend=Y.fn.extend=function(){var e,n,r,o,i,a,s=arguments[0]||{},c=1,l=arguments.length,u=!1;for("boolean"==typeof s&&(u=s,s=arguments[1]||{},c=2),"object"==typeof s||Y.isFunction(s)||(s={}),l===c&&(s=this,--c);l>c;c++)if(null!=(e=arguments[c]))for(n in e)r=s[n],o=e[n],s!==o&&(u&&o&&(Y.isPlainObject(o)||(i=Y.isArray(o)))?(i?(i=!1,a=r&&Y.isArray(r)?r:[]):a=r&&Y.isPlainObject(r)?r:{},s[n]=Y.extend(u,a,o)):o!==t&&(s[n]=o));return s},Y.extend({noConflict:function(t){return e.$===Y&&(e.$=$),t&&e.jQuery===Y&&(e.jQuery=W),Y},isReady:!1,readyWait:1,holdReady:function(e){e?Y.readyWait++:Y.ready(!0)},ready:function(e){if(e===!0?!--Y.readyWait:!Y.isReady){if(!Q.body)return setTimeout(Y.ready,1);Y.isReady=!0,e!==!0&&--Y.readyWait>0||(B.resolveWith(Q,[Y]),Y.fn.trigger&&Y(Q).trigger("ready").off("ready"))}},isFunction:function(e){return"function"===Y.type(e)},isArray:Array.isArray||function(e){return"array"===Y.type(e)},isWindow:function(e){return null!=e&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return null==e?e+"":dt[X.call(e)]||"object"},isPlainObject:function(e){if(!e||"object"!==Y.type(e)||e.nodeType||Y.isWindow(e))return!1;try{if(e.constructor&&!K.call(e,"constructor")&&!K.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(n){return!1}var r;for(r in e);return r===t||K.call(e,r)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw Error(e)},parseHTML:function(e,t,n){var r;return e&&"string"==typeof e?("boolean"==typeof t&&(n=t,t=0),t=t||Q,(r=ot.exec(e))?[t.createElement(r[1])]:(r=Y.buildFragment([e],t,n?null:[]),Y.merge([],(r.cacheable?Y.clone(r.fragment):r.fragment).childNodes))):null},parseJSON:function(n){return n&&"string"==typeof n?(n=Y.trim(n),e.JSON&&e.JSON.parse?e.JSON.parse(n):it.test(n.replace(st,"@").replace(ct,"]").replace(at,""))?Function("return "+n)():(Y.error("Invalid JSON: "+n),t)):null},parseXML:function(n){var r,o;if(!n||"string"!=typeof n)return null;try{e.DOMParser?(o=new DOMParser,r=o.parseFromString(n,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(n))}catch(i){r=t}return r&&r.documentElement&&!r.getElementsByTagName("parsererror").length||Y.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&et.test(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(lt,"ms-").replace(ut,pt)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,n,r){var o,i=0,a=e.length,s=a===t||Y.isFunction(e);if(r)if(s){for(o in e)if(n.apply(e[o],r)===!1)break}else for(;a>i&&n.apply(e[i++],r)!==!1;);else if(s){for(o in e)if(n.call(e[o],o,e[o])===!1)break}else for(;a>i&&n.call(e[i],i,e[i++])!==!1;);return e},trim:G&&!G.call(" ")?function(e){return null==e?"":G.call(e)}:function(e){return null==e?"":(e+"").replace(nt,"")},makeArray:function(e,t){var n,r=t||[];return null!=e&&(n=Y.type(e),null==e.length||"string"===n||"function"===n||"regexp"===n||Y.isWindow(e)?z.call(r,e):Y.merge(r,e)),r},inArray:function(e,t,n){var r;if(t){if(V)return V.call(t,e,n);for(r=t.length,n=n?0>n?Math.max(0,r+n):n:0;r>n;n++)if(n in t&&t[n]===e)return n}return-1},merge:function(e,n){var r=n.length,o=e.length,i=0;if("number"==typeof r)for(;r>i;i++)e[o++]=n[i];else for(;n[i]!==t;)e[o++]=n[i++];return e.length=o,e},grep:function(e,t,n){var r,o=[],i=0,a=e.length;for(n=!!n;a>i;i++)r=!!t(e[i],i),n!==r&&o.push(e[i]);return o},map:function(e,n,r){var o,i,a=[],s=0,c=e.length,l=e instanceof Y||c!==t&&"number"==typeof c&&(c>0&&e[0]&&e[c-1]||0===c||Y.isArray(e));if(l)for(;c>s;s++)o=n(e[s],s,r),null!=o&&(a[a.length]=o);else for(i in e)o=n(e[i],i,r),null!=o&&(a[a.length]=o);return a.concat.apply([],a)},guid:1,proxy:function(e,n){var r,o,i;return"string"==typeof n&&(r=e[n],n=e,e=r),Y.isFunction(e)?(o=J.call(arguments,2),i=function(){return e.apply(n,o.concat(J.call(arguments)))},i.guid=e.guid=e.guid||Y.guid++,i):t},access:function(e,n,r,o,i,a,s){var c,l=null==r,u=0,p=e.length;if(r&&"object"==typeof r){for(u in r)Y.access(e,n,u,r[u],1,a,o);i=1}else if(o!==t){if(c=s===t&&Y.isFunction(o),l&&(c?(c=n,n=function(e,t,n){return c.call(Y(e),n)}):(n.call(e,o),n=null)),n)for(;p>u;u++)n(e[u],r,c?o.call(e[u],u,n(e[u],r)):o,s);i=1}return i?e:l?n.call(e):p?n(e[0],r):a},now:function(){return(new Date).getTime()}}),Y.ready.promise=function(t){if(!B)if(B=Y.Deferred(),"complete"===Q.readyState)setTimeout(Y.ready,1);else if(Q.addEventListener)Q.addEventListener("DOMContentLoaded",ft,!1),e.addEventListener("load",Y.ready,!1);else{Q.attachEvent("onreadystatechange",ft),e.attachEvent("onload",Y.ready);var n=!1;try{n=null==e.frameElement&&Q.documentElement}catch(r){}n&&n.doScroll&&function o(){if(!Y.isReady){try{n.doScroll("left")}catch(e){return setTimeout(o,50)}Y.ready()}}()}return B.promise(t)},Y.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(e,t){dt["[object "+t+"]"]=t.toLowerCase()}),L=Y(Q);var ht={};Y.Callbacks=function(e){e="string"==typeof e?ht[e]||n(e):Y.extend({},e);var r,o,i,a,s,c,l=[],u=!e.once&&[],p=function(t){for(r=e.memory&&t,o=!0,c=a||0,a=0,s=l.length,i=!0;l&&s>c;c++)if(l[c].apply(t[0],t[1])===!1&&e.stopOnFalse){r=!1;break}i=!1,l&&(u?u.length&&p(u.shift()):r?l=[]:f.disable())},f={add:function(){if(l){var t=l.length;(function n(t){Y.each(t,function(t,r){var o=Y.type(r);"function"===o?e.unique&&f.has(r)||l.push(r):r&&r.length&&"string"!==o&&n(r)})})(arguments),i?s=l.length:r&&(a=t,p(r))}return this},remove:function(){return l&&Y.each(arguments,function(e,t){for(var n;(n=Y.inArray(t,l,n))>-1;)l.splice(n,1),i&&(s>=n&&s--,c>=n&&c--)}),this},has:function(e){return Y.inArray(e,l)>-1},empty:function(){return l=[],this},disable:function(){return l=u=r=t,this},disabled:function(){return!l},lock:function(){return u=t,r||f.disable(),this},locked:function(){return!u},fireWith:function(e,t){return t=t||[],t=[e,t.slice?t.slice():t],!l||o&&!u||(i?u.push(t):p(t)),this},fire:function(){return f.fireWith(this,arguments),this},fired:function(){return!!o}};return f},Y.extend({Deferred:function(e){var t=[["resolve","done",Y.Callbacks("once memory"),"resolved"],["reject","fail",Y.Callbacks("once memory"),"rejected"],["notify","progress",Y.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return o.done(arguments).fail(arguments),this},then:function(){var e=arguments;return Y.Deferred(function(n){Y.each(t,function(t,r){var i=r[0],a=e[t];o[r[1]](Y.isFunction(a)?function(){var e=a.apply(this,arguments);e&&Y.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[i+"With"](this===o?n:this,[e])}:n[i])}),e=null}).promise()},promise:function(e){return null!=e?Y.extend(e,r):r}},o={};return r.pipe=r.then,Y.each(t,function(e,i){var a=i[2],s=i[3];r[i[1]]=a.add,s&&a.add(function(){n=s},t[1^e][2].disable,t[2][2].lock),o[i[0]]=a.fire,o[i[0]+"With"]=a.fireWith}),r.promise(o),e&&e.call(o,o),o},when:function(e){var t,n,r,o=0,i=J.call(arguments),a=i.length,s=1!==a||e&&Y.isFunction(e.promise)?a:0,c=1===s?e:Y.Deferred(),l=function(e,n,r){return function(o){n[e]=this,r[e]=arguments.length>1?J.call(arguments):o,r===t?c.notifyWith(n,r):--s||c.resolveWith(n,r)}};if(a>1)for(t=Array(a),n=Array(a),r=Array(a);a>o;o++)i[o]&&Y.isFunction(i[o].promise)?i[o].promise().done(l(o,r,i)).fail(c.reject).progress(l(o,n,t)):--s;return s||c.resolveWith(r,i),c.promise()}}),Y.support=function(){var n,r,o,i,a,s,c,l,u,p,f,d=Q.createElement("div");if(d.setAttribute("className","t"),d.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",r=d.getElementsByTagName("*"),o=d.getElementsByTagName("a")[0],!r||!o||!r.length)return{};i=Q.createElement("select"),a=i.appendChild(Q.createElement("option")),s=d.getElementsByTagName("input")[0],o.style.cssText="top:1px;float:left;opacity:.5",n={leadingWhitespace:3===d.firstChild.nodeType,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/top/.test(o.getAttribute("style")),hrefNormalized:"/a"===o.getAttribute("href"),opacity:/^0.5/.test(o.style.opacity),cssFloat:!!o.style.cssFloat,checkOn:"on"===s.value,optSelected:a.selected,getSetAttribute:"t"!==d.className,enctype:!!Q.createElement("form").enctype,html5Clone:"<:nav></:nav>"!==Q.createElement("nav").cloneNode(!0).outerHTML,boxModel:"CSS1Compat"===Q.compatMode,submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},s.checked=!0,n.noCloneChecked=s.cloneNode(!0).checked,i.disabled=!0,n.optDisabled=!a.disabled;try{delete d.test}catch(h){n.deleteExpando=!1}if(!d.addEventListener&&d.attachEvent&&d.fireEvent&&(d.attachEvent("onclick",f=function(){n.noCloneEvent=!1}),d.cloneNode(!0).fireEvent("onclick"),d.detachEvent("onclick",f)),s=Q.createElement("input"),s.value="t",s.setAttribute("type","radio"),n.radioValue="t"===s.value,s.setAttribute("checked","checked"),s.setAttribute("name","t"),d.appendChild(s),c=Q.createDocumentFragment(),c.appendChild(d.lastChild),n.checkClone=c.cloneNode(!0).cloneNode(!0).lastChild.checked,n.appendChecked=s.checked,c.removeChild(s),c.appendChild(d),d.attachEvent)for(u in{submit:!0,change:!0,focusin:!0})l="on"+u,p=l in d,p||(d.setAttribute(l,"return;"),p="function"==typeof d[l]),n[u+"Bubbles"]=p;return Y(function(){var r,o,i,a,s="padding:0;margin:0;border:0;display:block;overflow:hidden;",c=Q.getElementsByTagName("body")[0];c&&(r=Q.createElement("div"),r.style.cssText="visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px",c.insertBefore(r,c.firstChild),o=Q.createElement("div"),r.appendChild(o),o.innerHTML="<table><tr><td></td><td>t</td></tr></table>",i=o.getElementsByTagName("td"),i[0].style.cssText="padding:0;margin:0;border:0;display:none",p=0===i[0].offsetHeight,i[0].style.display="",i[1].style.display="none",n.reliableHiddenOffsets=p&&0===i[0].offsetHeight,o.innerHTML="",o.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",n.boxSizing=4===o.offsetWidth,n.doesNotIncludeMarginInBodyOffset=1!==c.offsetTop,e.getComputedStyle&&(n.pixelPosition="1%"!==(e.getComputedStyle(o,null)||{}).top,n.boxSizingReliable="4px"===(e.getComputedStyle(o,null)||{width:"4px"}).width,a=Q.createElement("div"),a.style.cssText=o.style.cssText=s,a.style.marginRight=a.style.width="0",o.style.width="1px",o.appendChild(a),n.reliableMarginRight=!parseFloat((e.getComputedStyle(a,null)||{}).marginRight)),o.style.zoom!==t&&(o.innerHTML="",o.style.cssText=s+"width:1px;padding:1px;display:inline;zoom:1",n.inlineBlockNeedsLayout=3===o.offsetWidth,o.style.display="block",o.style.overflow="visible",o.innerHTML="<div></div>",o.firstChild.style.width="5px",n.shrinkWrapBlocks=3!==o.offsetWidth,r.style.zoom=1),c.removeChild(r),r=o=i=a=null)}),c.removeChild(d),r=o=i=a=s=c=d=null,n}();var gt=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,mt=/([A-Z])/g;Y.extend({cache:{},deletedIds:[],uuid:0,expando:"jQuery"+(Y.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(e){return e=e.nodeType?Y.cache[e[Y.expando]]:e[Y.expando],!!e&&!o(e)},data:function(e,n,r,o){if(Y.acceptData(e)){var i,a,s=Y.expando,c="string"==typeof n,l=e.nodeType,u=l?Y.cache:e,p=l?e[s]:e[s]&&s;if(p&&u[p]&&(o||u[p].data)||!c||r!==t)return p||(l?e[s]=p=Y.deletedIds.pop()||Y.guid++:p=s),u[p]||(u[p]={},l||(u[p].toJSON=Y.noop)),("object"==typeof n||"function"==typeof n)&&(o?u[p]=Y.extend(u[p],n):u[p].data=Y.extend(u[p].data,n)),i=u[p],o||(i.data||(i.data={}),i=i.data),r!==t&&(i[Y.camelCase(n)]=r),c?(a=i[n],null==a&&(a=i[Y.camelCase(n)])):a=i,a}},removeData:function(e,t,n){if(Y.acceptData(e)){var r,i,a,s=e.nodeType,c=s?Y.cache:e,l=s?e[Y.expando]:Y.expando;if(c[l]){if(t&&(r=n?c[l]:c[l].data)){Y.isArray(t)||(t in r?t=[t]:(t=Y.camelCase(t),t=t in r?[t]:t.split(" ")));for(i=0,a=t.length;a>i;i++)delete r[t[i]];if(!(n?o:Y.isEmptyObject)(r))return}(n||(delete c[l].data,o(c[l])))&&(s?Y.cleanData([e],!0):Y.support.deleteExpando||c!=c.window?delete c[l]:c[l]=null)}}},_data:function(e,t,n){return Y.data(e,t,n,!0)},acceptData:function(e){var t=e.nodeName&&Y.noData[e.nodeName.toLowerCase()];return!t||t!==!0&&e.getAttribute("classid")===t}}),Y.fn.extend({data:function(e,n){var o,i,a,s,c,l=this[0],u=0,p=null;if(e===t){if(this.length&&(p=Y.data(l),1===l.nodeType&&!Y._data(l,"parsedAttrs"))){for(a=l.attributes,c=a.length;c>u;u++)s=a[u].name,s.indexOf("data-")||(s=Y.camelCase(s.substring(5)),r(l,s,p[s]));Y._data(l,"parsedAttrs",!0)}return p}return"object"==typeof e?this.each(function(){Y.data(this,e)}):(o=e.split(".",2),o[1]=o[1]?"."+o[1]:"",i=o[1]+"!",Y.access(this,function(n){return n===t?(p=this.triggerHandler("getData"+i,[o[0]]),p===t&&l&&(p=Y.data(l,e),p=r(l,e,p)),p===t&&o[1]?this.data(o[0]):p):(o[1]=n,this.each(function(){var t=Y(this);t.triggerHandler("setData"+i,o),Y.data(this,e,n),t.triggerHandler("changeData"+i,o)}),t)},null,n,arguments.length>1,null,!1))},removeData:function(e){return this.each(function(){Y.removeData(this,e)})}}),Y.extend({queue:function(e,n,r){var o;return e?(n=(n||"fx")+"queue",o=Y._data(e,n),r&&(!o||Y.isArray(r)?o=Y._data(e,n,Y.makeArray(r)):o.push(r)),o||[]):t},dequeue:function(e,t){t=t||"fx";var n=Y.queue(e,t),r=n.length,o=n.shift(),i=Y._queueHooks(e,t),a=function(){Y.dequeue(e,t)};"inprogress"===o&&(o=n.shift(),r--),o&&("fx"===t&&n.unshift("inprogress"),delete i.stop,o.call(e,a,i)),!r&&i&&i.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return Y._data(e,n)||Y._data(e,n,{empty:Y.Callbacks("once memory").add(function(){Y.removeData(e,t+"queue",!0),Y.removeData(e,n,!0)})})}}),Y.fn.extend({queue:function(e,n){var r=2;return"string"!=typeof e&&(n=e,e="fx",r--),r>arguments.length?Y.queue(this[0],e):n===t?this:this.each(function(){var t=Y.queue(this,e,n);Y._queueHooks(this,e),"fx"===e&&"inprogress"!==t[0]&&Y.dequeue(this,e)})},dequeue:function(e){return this.each(function(){Y.dequeue(this,e)})},delay:function(e,t){return e=Y.fx?Y.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,n){var r,o=1,i=Y.Deferred(),a=this,s=this.length,c=function(){--o||i.resolveWith(a,[a])};for("string"!=typeof e&&(n=e,e=t),e=e||"fx";s--;)r=Y._data(a[s],e+"queueHooks"),r&&r.empty&&(o++,r.empty.add(c));return c(),i.promise(n)}});var yt,vt,bt,_t=/[\t\r\n]/g,Ct=/\r/g,xt=/^(?:button|input)$/i,wt=/^(?:button|input|object|select|textarea)$/i,At=/^a(?:rea|)$/i,Ft=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,kt=Y.support.getSetAttribute;Y.fn.extend({attr:function(e,t){return Y.access(this,Y.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){Y.removeAttr(this,e)})},prop:function(e,t){return Y.access(this,Y.prop,e,t,arguments.length>1)},removeProp:function(e){return e=Y.propFix[e]||e,this.each(function(){try{this[e]=t,delete this[e]}catch(n){}})},addClass:function(e){var t,n,r,o,i,a,s;if(Y.isFunction(e))return this.each(function(t){Y(this).addClass(e.call(this,t,this.className))});if(e&&"string"==typeof e)for(t=e.split(tt),n=0,r=this.length;r>n;n++)if(o=this[n],1===o.nodeType)if(o.className||1!==t.length){for(i=" "+o.className+" ",a=0,s=t.length;s>a;a++)0>i.indexOf(" "+t[a]+" ")&&(i+=t[a]+" ");o.className=Y.trim(i)}else o.className=e;return this},removeClass:function(e){var n,r,o,i,a,s,c;if(Y.isFunction(e))return this.each(function(t){Y(this).removeClass(e.call(this,t,this.className))});if(e&&"string"==typeof e||e===t)for(n=(e||"").split(tt),s=0,c=this.length;c>s;s++)if(o=this[s],1===o.nodeType&&o.className){for(r=(" "+o.className+" ").replace(_t," "),i=0,a=n.length;a>i;i++)for(;r.indexOf(" "+n[i]+" ")>=0;)r=r.replace(" "+n[i]+" "," ");o.className=e?Y.trim(r):""}return this},toggleClass:function(e,t){var n=typeof e,r="boolean"==typeof t;return Y.isFunction(e)?this.each(function(n){Y(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if("string"===n)for(var o,i=0,a=Y(this),s=t,c=e.split(tt);o=c[i++];)s=r?s:!a.hasClass(o),a[s?"addClass":"removeClass"](o);else("undefined"===n||"boolean"===n)&&(this.className&&Y._data(this,"__className__",this.className),this.className=this.className||e===!1?"":Y._data(this,"__className__")||"")})},hasClass:function(e){for(var t=" "+e+" ",n=0,r=this.length;r>n;n++)if(1===this[n].nodeType&&(" "+this[n].className+" ").replace(_t," ").indexOf(t)>=0)return!0;return!1},val:function(e){var n,r,o,i=this[0];{if(arguments.length)return o=Y.isFunction(e),this.each(function(r){var i,a=Y(this);1===this.nodeType&&(i=o?e.call(this,r,a.val()):e,null==i?i="":"number"==typeof i?i+="":Y.isArray(i)&&(i=Y.map(i,function(e){return null==e?"":e+""})),n=Y.valHooks[this.type]||Y.valHooks[this.nodeName.toLowerCase()],n&&"set"in n&&n.set(this,i,"value")!==t||(this.value=i))});if(i)return n=Y.valHooks[i.type]||Y.valHooks[i.nodeName.toLowerCase()],n&&"get"in n&&(r=n.get(i,"value"))!==t?r:(r=i.value,"string"==typeof r?r.replace(Ct,""):null==r?"":r)}}}),Y.extend({valHooks:{option:{get:function(e){var t=e.attributes.value;return!t||t.specified?e.value:e.text}},select:{get:function(e){for(var t,n,r=e.options,o=e.selectedIndex,i="select-one"===e.type||0>o,a=i?null:[],s=i?o+1:r.length,c=0>o?s:i?o:0;s>c;c++)if(n=r[c],!(!n.selected&&c!==o||(Y.support.optDisabled?n.disabled:null!==n.getAttribute("disabled"))||n.parentNode.disabled&&Y.nodeName(n.parentNode,"optgroup"))){if(t=Y(n).val(),i)return t;a.push(t)}return a},set:function(e,t){var n=Y.makeArray(t);return Y(e).find("option").each(function(){this.selected=Y.inArray(Y(this).val(),n)>=0}),n.length||(e.selectedIndex=-1),n}}},attrFn:{},attr:function(e,n,r,o){var i,a,s,c=e.nodeType;if(e&&3!==c&&8!==c&&2!==c)return o&&Y.isFunction(Y.fn[n])?Y(e)[n](r):e.getAttribute===t?Y.prop(e,n,r):(s=1!==c||!Y.isXMLDoc(e),s&&(n=n.toLowerCase(),a=Y.attrHooks[n]||(Ft.test(n)?vt:yt)),r!==t?null===r?(Y.removeAttr(e,n),t):a&&"set"in a&&s&&(i=a.set(e,r,n))!==t?i:(e.setAttribute(n,r+""),r):a&&"get"in a&&s&&null!==(i=a.get(e,n))?i:(i=e.getAttribute(n),null===i?t:i))},removeAttr:function(e,t){var n,r,o,i,a=0;if(t&&1===e.nodeType)for(r=t.split(tt);r.length>a;a++)o=r[a],o&&(n=Y.propFix[o]||o,i=Ft.test(o),i||Y.attr(e,o,""),e.removeAttribute(kt?o:n),i&&n in e&&(e[n]=!1))},attrHooks:{type:{set:function(e,t){if(xt.test(e.nodeName)&&e.parentNode)Y.error("type property can't be changed");else if(!Y.support.radioValue&&"radio"===t&&Y.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}},value:{get:function(e,t){return yt&&Y.nodeName(e,"button")?yt.get(e,t):t in e?e.value:null},set:function(e,n,r){return yt&&Y.nodeName(e,"button")?yt.set(e,n,r):(e.value=n,t)}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(e,n,r){var o,i,a,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return a=1!==s||!Y.isXMLDoc(e),a&&(n=Y.propFix[n]||n,i=Y.propHooks[n]),r!==t?i&&"set"in i&&(o=i.set(e,r,n))!==t?o:e[n]=r:i&&"get"in i&&null!==(o=i.get(e,n))?o:e[n]},propHooks:{tabIndex:{get:function(e){var n=e.getAttributeNode("tabindex");return n&&n.specified?parseInt(n.value,10):wt.test(e.nodeName)||At.test(e.nodeName)&&e.href?0:t}}}}),vt={get:function(e,n){var r,o=Y.prop(e,n);return o===!0||"boolean"!=typeof o&&(r=e.getAttributeNode(n))&&r.nodeValue!==!1?n.toLowerCase():t},set:function(e,t,n){var r;return t===!1?Y.removeAttr(e,n):(r=Y.propFix[n]||n,r in e&&(e[r]=!0),e.setAttribute(n,n.toLowerCase())),n}},kt||(bt={name:!0,id:!0,coords:!0},yt=Y.valHooks.button={get:function(e,n){var r;return r=e.getAttributeNode(n),r&&(bt[n]?""!==r.value:r.specified)?r.value:t},set:function(e,t,n){var r=e.getAttributeNode(n);return r||(r=Q.createAttribute(n),e.setAttributeNode(r)),r.value=t+""}},Y.each(["width","height"],function(e,n){Y.attrHooks[n]=Y.extend(Y.attrHooks[n],{set:function(e,r){return""===r?(e.setAttribute(n,"auto"),r):t}})}),Y.attrHooks.contenteditable={get:yt.get,set:function(e,t,n){""===t&&(t="false"),yt.set(e,t,n)
}}),Y.support.hrefNormalized||Y.each(["href","src","width","height"],function(e,n){Y.attrHooks[n]=Y.extend(Y.attrHooks[n],{get:function(e){var r=e.getAttribute(n,2);return null===r?t:r}})}),Y.support.style||(Y.attrHooks.style={get:function(e){return e.style.cssText.toLowerCase()||t},set:function(e,t){return e.style.cssText=t+""}}),Y.support.optSelected||(Y.propHooks.selected=Y.extend(Y.propHooks.selected,{get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}})),Y.support.enctype||(Y.propFix.enctype="encoding"),Y.support.checkOn||Y.each(["radio","checkbox"],function(){Y.valHooks[this]={get:function(e){return null===e.getAttribute("value")?"on":e.value}}}),Y.each(["radio","checkbox"],function(){Y.valHooks[this]=Y.extend(Y.valHooks[this],{set:function(e,n){return Y.isArray(n)?e.checked=Y.inArray(Y(e).val(),n)>=0:t}})});var Et=/^(?:textarea|input|select)$/i,Tt=/^([^\.]*|)(?:\.(.+)|)$/,Nt=/(?:^|\s)hover(\.\S+|)\b/,Rt=/^key/,St=/^(?:mouse|contextmenu)|click/,jt=/^(?:focusinfocus|focusoutblur)$/,Ot=function(e){return Y.event.special.hover?e:e.replace(Nt,"mouseenter$1 mouseleave$1")};Y.event={add:function(e,n,r,o,i){var a,s,c,l,u,p,f,d,h,g,m;if(3!==e.nodeType&&8!==e.nodeType&&n&&r&&(a=Y._data(e))){for(r.handler&&(h=r,r=h.handler,i=h.selector),r.guid||(r.guid=Y.guid++),c=a.events,c||(a.events=c={}),s=a.handle,s||(a.handle=s=function(e){return Y===t||e&&Y.event.triggered===e.type?t:Y.event.dispatch.apply(s.elem,arguments)},s.elem=e),n=Y.trim(Ot(n)).split(" "),l=0;n.length>l;l++)u=Tt.exec(n[l])||[],p=u[1],f=(u[2]||"").split(".").sort(),m=Y.event.special[p]||{},p=(i?m.delegateType:m.bindType)||p,m=Y.event.special[p]||{},d=Y.extend({type:p,origType:u[1],data:o,handler:r,guid:r.guid,selector:i,needsContext:i&&Y.expr.match.needsContext.test(i),namespace:f.join(".")},h),g=c[p],g||(g=c[p]=[],g.delegateCount=0,m.setup&&m.setup.call(e,o,f,s)!==!1||(e.addEventListener?e.addEventListener(p,s,!1):e.attachEvent&&e.attachEvent("on"+p,s))),m.add&&(m.add.call(e,d),d.handler.guid||(d.handler.guid=r.guid)),i?g.splice(g.delegateCount++,0,d):g.push(d),Y.event.global[p]=!0;e=null}},global:{},remove:function(e,t,n,r,o){var i,a,s,c,l,u,p,f,d,h,g,m=Y.hasData(e)&&Y._data(e);if(m&&(f=m.events)){for(t=Y.trim(Ot(t||"")).split(" "),i=0;t.length>i;i++)if(a=Tt.exec(t[i])||[],s=c=a[1],l=a[2],s){for(d=Y.event.special[s]||{},s=(r?d.delegateType:d.bindType)||s,h=f[s]||[],u=h.length,l=l?RegExp("(^|\\.)"+l.split(".").sort().join("\\.(?:.*\\.|)")+"(\\.|$)"):null,p=0;h.length>p;p++)g=h[p],!o&&c!==g.origType||n&&n.guid!==g.guid||l&&!l.test(g.namespace)||r&&r!==g.selector&&("**"!==r||!g.selector)||(h.splice(p--,1),g.selector&&h.delegateCount--,d.remove&&d.remove.call(e,g));0===h.length&&u!==h.length&&(d.teardown&&d.teardown.call(e,l,m.handle)!==!1||Y.removeEvent(e,s,m.handle),delete f[s])}else for(s in f)Y.event.remove(e,s+t[i],n,r,!0);Y.isEmptyObject(f)&&(delete m.handle,Y.removeData(e,"events",!0))}},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(n,r,o,i){if(!o||3!==o.nodeType&&8!==o.nodeType){var a,s,c,l,u,p,f,d,h,g,m=n.type||n,y=[];if(!jt.test(m+Y.event.triggered)&&(m.indexOf("!")>=0&&(m=m.slice(0,-1),s=!0),m.indexOf(".")>=0&&(y=m.split("."),m=y.shift(),y.sort()),o&&!Y.event.customEvent[m]||Y.event.global[m]))if(n="object"==typeof n?n[Y.expando]?n:new Y.Event(m,n):new Y.Event(m),n.type=m,n.isTrigger=!0,n.exclusive=s,n.namespace=y.join("."),n.namespace_re=n.namespace?RegExp("(^|\\.)"+y.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,p=0>m.indexOf(":")?"on"+m:"",o){if(n.result=t,n.target||(n.target=o),r=null!=r?Y.makeArray(r):[],r.unshift(n),f=Y.event.special[m]||{},!f.trigger||f.trigger.apply(o,r)!==!1){if(h=[[o,f.bindType||m]],!i&&!f.noBubble&&!Y.isWindow(o)){for(g=f.delegateType||m,l=jt.test(g+m)?o:o.parentNode,u=o;l;l=l.parentNode)h.push([l,g]),u=l;u===(o.ownerDocument||Q)&&h.push([u.defaultView||u.parentWindow||e,g])}for(c=0;h.length>c&&!n.isPropagationStopped();c++)l=h[c][0],n.type=h[c][1],d=(Y._data(l,"events")||{})[n.type]&&Y._data(l,"handle"),d&&d.apply(l,r),d=p&&l[p],d&&Y.acceptData(l)&&d.apply&&d.apply(l,r)===!1&&n.preventDefault();return n.type=m,i||n.isDefaultPrevented()||f._default&&f._default.apply(o.ownerDocument,r)!==!1||"click"===m&&Y.nodeName(o,"a")||!Y.acceptData(o)||p&&o[m]&&("focus"!==m&&"blur"!==m||0!==n.target.offsetWidth)&&!Y.isWindow(o)&&(u=o[p],u&&(o[p]=null),Y.event.triggered=m,o[m](),Y.event.triggered=t,u&&(o[p]=u)),n.result}}else{a=Y.cache;for(c in a)a[c].events&&a[c].events[m]&&Y.event.trigger(n,r,a[c].handle.elem,!0)}}},dispatch:function(n){n=Y.event.fix(n||e.event);var r,o,i,a,s,c,l,u,p,f=(Y._data(this,"events")||{})[n.type]||[],d=f.delegateCount,h=J.call(arguments),g=!n.exclusive&&!n.namespace,m=Y.event.special[n.type]||{},y=[];if(h[0]=n,n.delegateTarget=this,!m.preDispatch||m.preDispatch.call(this,n)!==!1){if(d&&(!n.button||"click"!==n.type))for(i=n.target;i!=this;i=i.parentNode||this)if(i.disabled!==!0||"click"!==n.type){for(s={},l=[],r=0;d>r;r++)u=f[r],p=u.selector,s[p]===t&&(s[p]=u.needsContext?Y(p,this).index(i)>=0:Y.find(p,this,null,[i]).length),s[p]&&l.push(u);l.length&&y.push({elem:i,matches:l})}for(f.length>d&&y.push({elem:this,matches:f.slice(d)}),r=0;y.length>r&&!n.isPropagationStopped();r++)for(c=y[r],n.currentTarget=c.elem,o=0;c.matches.length>o&&!n.isImmediatePropagationStopped();o++)u=c.matches[o],(g||!n.namespace&&!u.namespace||n.namespace_re&&n.namespace_re.test(u.namespace))&&(n.data=u.data,n.handleObj=u,a=((Y.event.special[u.origType]||{}).handle||u.handler).apply(c.elem,h),a!==t&&(n.result=a,a===!1&&(n.preventDefault(),n.stopPropagation())));return m.postDispatch&&m.postDispatch.call(this,n),n.result}},props:"attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return null==e.which&&(e.which=null!=t.charCode?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,n){var r,o,i,a=n.button,s=n.fromElement;return null==e.pageX&&null!=n.clientX&&(r=e.target.ownerDocument||Q,o=r.documentElement,i=r.body,e.pageX=n.clientX+(o&&o.scrollLeft||i&&i.scrollLeft||0)-(o&&o.clientLeft||i&&i.clientLeft||0),e.pageY=n.clientY+(o&&o.scrollTop||i&&i.scrollTop||0)-(o&&o.clientTop||i&&i.clientTop||0)),!e.relatedTarget&&s&&(e.relatedTarget=s===e.target?n.toElement:s),e.which||a===t||(e.which=1&a?1:2&a?3:4&a?2:0),e}},fix:function(e){if(e[Y.expando])return e;var t,n,r=e,o=Y.event.fixHooks[e.type]||{},i=o.props?this.props.concat(o.props):this.props;for(e=Y.Event(r),t=i.length;t;)n=i[--t],e[n]=r[n];return e.target||(e.target=r.srcElement||Q),3===e.target.nodeType&&(e.target=e.target.parentNode),e.metaKey=!!e.metaKey,o.filter?o.filter(e,r):e},special:{load:{noBubble:!0},focus:{delegateType:"focusin"},blur:{delegateType:"focusout"},beforeunload:{setup:function(e,t,n){Y.isWindow(this)&&(this.onbeforeunload=n)},teardown:function(e,t){this.onbeforeunload===t&&(this.onbeforeunload=null)}}},simulate:function(e,t,n,r){var o=Y.extend(new Y.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?Y.event.trigger(o,null,t):Y.event.dispatch.call(t,o),o.isDefaultPrevented()&&n.preventDefault()}},Y.event.handle=Y.event.dispatch,Y.removeEvent=Q.removeEventListener?function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)}:function(e,n,r){var o="on"+n;e.detachEvent&&(e[o]===t&&(e[o]=null),e.detachEvent(o,r))},Y.Event=function(e,n){return this instanceof Y.Event?(e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.returnValue===!1||e.getPreventDefault&&e.getPreventDefault()?a:i):this.type=e,n&&Y.extend(this,n),this.timeStamp=e&&e.timeStamp||Y.now(),this[Y.expando]=!0,t):new Y.Event(e,n)},Y.Event.prototype={preventDefault:function(){this.isDefaultPrevented=a;var e=this.originalEvent;e&&(e.preventDefault?e.preventDefault():e.returnValue=!1)},stopPropagation:function(){this.isPropagationStopped=a;var e=this.originalEvent;e&&(e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=a,this.stopPropagation()},isDefaultPrevented:i,isPropagationStopped:i,isImmediatePropagationStopped:i},Y.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){Y.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,o=e.relatedTarget,i=e.handleObj;return i.selector,(!o||o!==r&&!Y.contains(r,o))&&(e.type=i.origType,n=i.handler.apply(this,arguments),e.type=t),n}}}),Y.support.submitBubbles||(Y.event.special.submit={setup:function(){return Y.nodeName(this,"form")?!1:(Y.event.add(this,"click._submit keypress._submit",function(e){var n=e.target,r=Y.nodeName(n,"input")||Y.nodeName(n,"button")?n.form:t;r&&!Y._data(r,"_submit_attached")&&(Y.event.add(r,"submit._submit",function(e){e._submit_bubble=!0}),Y._data(r,"_submit_attached",!0))}),t)},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&Y.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){return Y.nodeName(this,"form")?!1:(Y.event.remove(this,"._submit"),t)}}),Y.support.changeBubbles||(Y.event.special.change={setup:function(){return Et.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(Y.event.add(this,"propertychange._change",function(e){"checked"===e.originalEvent.propertyName&&(this._just_changed=!0)}),Y.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1),Y.event.simulate("change",this,e,!0)})),!1):(Y.event.add(this,"beforeactivate._change",function(e){var t=e.target;Et.test(t.nodeName)&&!Y._data(t,"_change_attached")&&(Y.event.add(t,"change._change",function(e){!this.parentNode||e.isSimulated||e.isTrigger||Y.event.simulate("change",this.parentNode,e,!0)}),Y._data(t,"_change_attached",!0))}),t)},handle:function(e){var n=e.target;return this!==n||e.isSimulated||e.isTrigger||"radio"!==n.type&&"checkbox"!==n.type?e.handleObj.handler.apply(this,arguments):t},teardown:function(){return Y.event.remove(this,"._change"),!Et.test(this.nodeName)}}),Y.support.focusinBubbles||Y.each({focus:"focusin",blur:"focusout"},function(e,t){var n=0,r=function(e){Y.event.simulate(t,e.target,Y.event.fix(e),!0)};Y.event.special[t]={setup:function(){0===n++&&Q.addEventListener(e,r,!0)},teardown:function(){0===--n&&Q.removeEventListener(e,r,!0)}}}),Y.fn.extend({on:function(e,n,r,o,a){var s,c;if("object"==typeof e){"string"!=typeof n&&(r=r||n,n=t);for(c in e)this.on(c,n,r,e[c],a);return this}if(null==r&&null==o?(o=n,r=n=t):null==o&&("string"==typeof n?(o=r,r=t):(o=r,r=n,n=t)),o===!1)o=i;else if(!o)return this;return 1===a&&(s=o,o=function(e){return Y().off(e),s.apply(this,arguments)},o.guid=s.guid||(s.guid=Y.guid++)),this.each(function(){Y.event.add(this,e,o,r,n)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,n,r){var o,a;if(e&&e.preventDefault&&e.handleObj)return o=e.handleObj,Y(e.delegateTarget).off(o.namespace?o.origType+"."+o.namespace:o.origType,o.selector,o.handler),this;if("object"==typeof e){for(a in e)this.off(a,n,e[a]);return this}return(n===!1||"function"==typeof n)&&(r=n,n=t),r===!1&&(r=i),this.each(function(){Y.event.remove(this,e,r,n)})},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},live:function(e,t,n){return Y(this.context).on(e,this.selector,t,n),this},die:function(e,t){return Y(this.context).off(e,this.selector||"**",t),this},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},trigger:function(e,t){return this.each(function(){Y.event.trigger(e,t,this)})},triggerHandler:function(e,n){return this[0]?Y.event.trigger(e,n,this[0],!0):t},toggle:function(e){var t=arguments,n=e.guid||Y.guid++,r=0,o=function(n){var o=(Y._data(this,"lastToggle"+e.guid)||0)%r;return Y._data(this,"lastToggle"+e.guid,o+1),n.preventDefault(),t[o].apply(this,arguments)||!1};for(o.guid=n;t.length>r;)t[r++].guid=n;return this.click(o)},hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),Y.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){Y.fn[t]=function(e,n){return null==n&&(n=e,e=null),arguments.length>0?this.on(t,null,e,n):this.trigger(t)},Rt.test(t)&&(Y.event.fixHooks[t]=Y.event.keyHooks),St.test(t)&&(Y.event.fixHooks[t]=Y.event.mouseHooks)}),/*!
* Sizzle CSS Selector Engine
* Copyright 2012 jQuery Foundation and other contributors
* Released under the MIT license
* http://sizzlejs.com/
*/
function(e,t){function n(e,t,n,r){n=n||[],t=t||S;var o,i,a,s,c=t.nodeType;if(!e||"string"!=typeof e)return n;if(1!==c&&9!==c)return[];if(a=C(t),!a&&!r&&(o=nt.exec(e)))if(s=o[1]){if(9===c){if(i=t.getElementById(s),!i||!i.parentNode)return n;if(i.id===s)return n.push(i),n}else if(t.ownerDocument&&(i=t.ownerDocument.getElementById(s))&&x(t,i)&&i.id===s)return n.push(i),n}else{if(o[2])return P.apply(n,H.call(t.getElementsByTagName(e),0)),n;if((s=o[3])&&ft&&t.getElementsByClassName)return P.apply(n,H.call(t.getElementsByClassName(s),0)),n}return g(e.replace(G,"$1"),t,n,r,a)}function r(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function o(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function i(e){return L(function(t){return t=+t,L(function(n,r){for(var o,i=e([],n.length,t),a=i.length;a--;)n[o=i[a]]&&(n[o]=!(r[o]=n[o]))})})}function a(e,t,n){if(e===t)return n;for(var r=e.nextSibling;r;){if(r===t)return-1;r=r.nextSibling}return 1}function s(e,t){var r,o,i,a,s,c,l,u=U[N][e+" "];if(u)return t?0:u.slice(0);for(s=e,c=[],l=b.preFilter;s;){(!r||(o=Z.exec(s)))&&(o&&(s=s.slice(o[0].length)||s),c.push(i=[])),r=!1,(o=et.exec(s))&&(i.push(r=new R(o.shift())),s=s.slice(r.length),r.type=o[0].replace(G," "));for(a in b.filter)!(o=st[a].exec(s))||l[a]&&!(o=l[a](o))||(i.push(r=new R(o.shift())),s=s.slice(r.length),r.type=a,r.matches=o);if(!r)break}return t?s.length:s?n.error(e):U(e,c).slice(0)}function c(e,t,n){var r=t.dir,o=n&&"parentNode"===t.dir,i=I++;return t.first?function(t,n,i){for(;t=t[r];)if(o||1===t.nodeType)return e(t,n,i)}:function(t,n,a){if(a){for(;t=t[r];)if((o||1===t.nodeType)&&e(t,n,a))return t}else for(var s,c=O+" "+i+" ",l=c+y;t=t[r];)if(o||1===t.nodeType){if((s=t[N])===l)return t.sizset;if("string"==typeof s&&0===s.indexOf(c)){if(t.sizset)return t}else{if(t[N]=l,e(t,n,a))return t.sizset=!0,t;t.sizset=!1}}}}function l(e){return e.length>1?function(t,n,r){for(var o=e.length;o--;)if(!e[o](t,n,r))return!1;return!0}:e[0]}function u(e,t,n,r,o){for(var i,a=[],s=0,c=e.length,l=null!=t;c>s;s++)(i=e[s])&&(!n||n(i,r,o))&&(a.push(i),l&&t.push(s));return a}function p(e,t,n,r,o,i){return r&&!r[N]&&(r=p(r)),o&&!o[N]&&(o=p(o,i)),L(function(i,a,s,c){var l,p,f,d=[],g=[],m=a.length,y=i||h(t||"*",s.nodeType?[s]:s,[]),v=!e||!i&&t?y:u(y,d,e,s,c),b=n?o||(i?e:m||r)?[]:a:v;if(n&&n(v,b,s,c),r)for(l=u(b,g),r(l,[],s,c),p=l.length;p--;)(f=l[p])&&(b[g[p]]=!(v[g[p]]=f));if(i){if(o||e){if(o){for(l=[],p=b.length;p--;)(f=b[p])&&l.push(v[p]=f);o(null,b=[],l,c)}for(p=b.length;p--;)(f=b[p])&&(l=o?D.call(i,f):d[p])>-1&&(i[l]=!(a[l]=f))}}else b=u(b===a?b.splice(m,b.length):b),o?o(null,a,b,c):P.apply(a,b)})}function f(e){for(var t,n,r,o=e.length,i=b.relative[e[0].type],a=i||b.relative[" "],s=i?1:0,u=c(function(e){return e===t},a,!0),d=c(function(e){return D.call(t,e)>-1},a,!0),h=[function(e,n,r){return!i&&(r||n!==k)||((t=n).nodeType?u(e,n,r):d(e,n,r))}];o>s;s++)if(n=b.relative[e[s].type])h=[c(l(h),n)];else{if(n=b.filter[e[s].type].apply(null,e[s].matches),n[N]){for(r=++s;o>r&&!b.relative[e[r].type];r++);return p(s>1&&l(h),s>1&&e.slice(0,s-1).join("").replace(G,"$1"),n,r>s&&f(e.slice(s,r)),o>r&&f(e=e.slice(r)),o>r&&e.join(""))}h.push(n)}return l(h)}function d(e,t){var r=t.length>0,o=e.length>0,i=function(a,s,c,l,p){var f,d,h,g=[],m=0,v="0",_=a&&[],C=null!=p,x=k,w=a||o&&b.find.TAG("*",p&&s.parentNode||s),A=O+=null==x?1:Math.E;for(C&&(k=s!==S&&s,y=i.el);null!=(f=w[v]);v++){if(o&&f){for(d=0;h=e[d];d++)if(h(f,s,c)){l.push(f);break}C&&(O=A,y=++i.el)}r&&((f=!h&&f)&&m--,a&&_.push(f))}if(m+=v,r&&v!==m){for(d=0;h=t[d];d++)h(_,g,s,c);if(a){if(m>0)for(;v--;)_[v]||g[v]||(g[v]=M.call(l));g=u(g)}P.apply(l,g),C&&!a&&g.length>0&&m+t.length>1&&n.uniqueSort(l)}return C&&(O=A,k=x),_};return i.el=0,r?L(i):i}function h(e,t,r){for(var o=0,i=t.length;i>o;o++)n(e,t[o],r);return r}function g(e,t,n,r,o){var i,a,c,l,u,p=s(e);if(p.length,!r&&1===p.length){if(a=p[0]=p[0].slice(0),a.length>2&&"ID"===(c=a[0]).type&&9===t.nodeType&&!o&&b.relative[a[1].type]){if(t=b.find.ID(c.matches[0].replace(at,""),t,o)[0],!t)return n;e=e.slice(a.shift().length)}for(i=st.POS.test(e)?-1:a.length-1;i>=0&&(c=a[i],!b.relative[l=c.type]);i--)if((u=b.find[l])&&(r=u(c.matches[0].replace(at,""),rt.test(a[0].type)&&t.parentNode||t,o))){if(a.splice(i,1),e=r.length&&a.join(""),!e)return P.apply(n,H.call(r,0)),n;break}}return w(e,p)(r,t,o,n,rt.test(e)),n}function m(){}var y,v,b,_,C,x,w,A,F,k,E=!0,T="undefined",N=("sizcache"+Math.random()).replace(".",""),R=String,S=e.document,j=S.documentElement,O=0,I=0,M=[].pop,P=[].push,H=[].slice,D=[].indexOf||function(e){for(var t=0,n=this.length;n>t;t++)if(this[t]===e)return t;return-1},L=function(e,t){return e[N]=null==t||t,e},B=function(){var e={},t=[];return L(function(n,r){return t.push(n)>b.cacheLength&&delete e[t.shift()],e[n+" "]=r},e)},Q=B(),U=B(),q=B(),W="[\\x20\\t\\r\\n\\f]",$="(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+",z=$.replace("w","w#"),J="([*^$|!~]?=)",V="\\["+W+"*("+$+")"+W+"*(?:"+J+W+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+z+")|)|)"+W+"*\\]",X=":("+$+")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|([^()[\\]]*|(?:(?:"+V+")|[^:]|\\\\.)*|.*))\\)|)",K=":(even|odd|eq|gt|lt|nth|first|last)(?:\\("+W+"*((?:-\\d)?\\d*)"+W+"*\\)|)(?=[^-]|$)",G=RegExp("^"+W+"+|((?:^|[^\\\\])(?:\\\\.)*)"+W+"+$","g"),Z=RegExp("^"+W+"*,"+W+"*"),et=RegExp("^"+W+"*([\\x20\\t\\r\\n\\f>+~])"+W+"*"),tt=RegExp(X),nt=/^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/,rt=/[\x20\t\r\n\f]*[+~]/,ot=/h\d/i,it=/input|select|textarea|button/i,at=/\\(?!\\)/g,st={ID:RegExp("^#("+$+")"),CLASS:RegExp("^\\.("+$+")"),NAME:RegExp("^\\[name=['\"]?("+$+")['\"]?\\]"),TAG:RegExp("^("+$.replace("w","w*")+")"),ATTR:RegExp("^"+V),PSEUDO:RegExp("^"+X),POS:RegExp(K,"i"),CHILD:RegExp("^:(only|nth|first|last)-child(?:\\("+W+"*(even|odd|(([+-]|)(\\d*)n|)"+W+"*(?:([+-]|)"+W+"*(\\d+)|))"+W+"*\\)|)","i"),needsContext:RegExp("^"+W+"*[>+~]|"+K,"i")},ct=function(e){var t=S.createElement("div");try{return e(t)}catch(n){return!1}finally{t=null}},lt=ct(function(e){return e.appendChild(S.createComment("")),!e.getElementsByTagName("*").length}),ut=ct(function(e){return e.innerHTML="<a href='#'></a>",e.firstChild&&typeof e.firstChild.getAttribute!==T&&"#"===e.firstChild.getAttribute("href")}),pt=ct(function(e){e.innerHTML="<select></select>";var t=typeof e.lastChild.getAttribute("multiple");return"boolean"!==t&&"string"!==t}),ft=ct(function(e){return e.innerHTML="<div class='hidden e'></div><div class='hidden'></div>",e.getElementsByClassName&&e.getElementsByClassName("e").length?(e.lastChild.className="e",2===e.getElementsByClassName("e").length):!1}),dt=ct(function(e){e.id=N+0,e.innerHTML="<a name='"+N+"'></a><div name='"+N+"'></div>",j.insertBefore(e,j.firstChild);var t=S.getElementsByName&&S.getElementsByName(N).length===2+S.getElementsByName(N+0).length;return v=!S.getElementById(N),j.removeChild(e),t});try{H.call(j.childNodes,0)[0].nodeType}catch(ht){H=function(e){for(var t,n=[];t=this[e];e++)n.push(t);return n}}n.matches=function(e,t){return n(e,null,null,t)},n.matchesSelector=function(e,t){return n(t,null,null,[e]).length>0},_=n.getText=function(e){var t,n="",r=0,o=e.nodeType;if(o){if(1===o||9===o||11===o){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=_(e)}else if(3===o||4===o)return e.nodeValue}else for(;t=e[r];r++)n+=_(t);return n},C=n.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?"HTML"!==t.nodeName:!1},x=n.contains=j.contains?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!!(r&&1===r.nodeType&&n.contains&&n.contains(r))}:j.compareDocumentPosition?function(e,t){return t&&!!(16&e.compareDocumentPosition(t))}:function(e,t){for(;t=t.parentNode;)if(t===e)return!0;return!1},n.attr=function(e,t){var n,r=C(e);return r||(t=t.toLowerCase()),(n=b.attrHandle[t])?n(e):r||pt?e.getAttribute(t):(n=e.getAttributeNode(t),n?"boolean"==typeof e[t]?e[t]?t:null:n.specified?n.value:null:null)},b=n.selectors={cacheLength:50,createPseudo:L,match:st,attrHandle:ut?{}:{href:function(e){return e.getAttribute("href",2)},type:function(e){return e.getAttribute("type")}},find:{ID:v?function(e,t,n){if(typeof t.getElementById!==T&&!n){var r=t.getElementById(e);return r&&r.parentNode?[r]:[]}}:function(e,n,r){if(typeof n.getElementById!==T&&!r){var o=n.getElementById(e);return o?o.id===e||typeof o.getAttributeNode!==T&&o.getAttributeNode("id").value===e?[o]:t:[]}},TAG:lt?function(e,n){return typeof n.getElementsByTagName!==T?n.getElementsByTagName(e):t}:function(e,t){var n=t.getElementsByTagName(e);if("*"===e){for(var r,o=[],i=0;r=n[i];i++)1===r.nodeType&&o.push(r);return o}return n},NAME:dt&&function(e,n){return typeof n.getElementsByName!==T?n.getElementsByName(name):t},CLASS:ft&&function(e,n,r){return typeof n.getElementsByClassName===T||r?t:n.getElementsByClassName(e)}},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(at,""),e[3]=(e[4]||e[5]||"").replace(at,""),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1]?(e[2]||n.error(e[0]),e[3]=+(e[3]?e[4]+(e[5]||1):2*("even"===e[2]||"odd"===e[2])),e[4]=+(e[6]+e[7]||"odd"===e[2])):e[2]&&n.error(e[0]),e},PSEUDO:function(e){var t,n;return st.CHILD.test(e[0])?null:(e[3]?e[2]=e[3]:(t=e[4])&&(tt.test(t)&&(n=s(t,!0))&&(n=t.indexOf(")",t.length-n)-t.length)&&(t=t.slice(0,n),e[0]=e[0].slice(0,n)),e[2]=t),e.slice(0,3))}},filter:{ID:v?function(e){return e=e.replace(at,""),function(t){return t.getAttribute("id")===e}}:function(e){return e=e.replace(at,""),function(t){var n=typeof t.getAttributeNode!==T&&t.getAttributeNode("id");return n&&n.value===e}},TAG:function(e){return"*"===e?function(){return!0}:(e=e.replace(at,"").toLowerCase(),function(t){return t.nodeName&&t.nodeName.toLowerCase()===e})},CLASS:function(e){var t=Q[N][e+" "];return t||(t=RegExp("(^|"+W+")"+e+"("+W+"|$)"))&&Q(e,function(e){return t.test(e.className||typeof e.getAttribute!==T&&e.getAttribute("class")||"")})},ATTR:function(e,t,r){return function(o){var i=n.attr(o,e);return null==i?"!="===t:t?(i+="","="===t?i===r:"!="===t?i!==r:"^="===t?r&&0===i.indexOf(r):"*="===t?r&&i.indexOf(r)>-1:"$="===t?r&&i.substr(i.length-r.length)===r:"~="===t?(" "+i+" ").indexOf(r)>-1:"|="===t?i===r||i.substr(0,r.length+1)===r+"-":!1):!0}},CHILD:function(e,t,n,r){return"nth"===e?function(e){var t,o,i=e.parentNode;if(1===n&&0===r)return!0;if(i)for(o=0,t=i.firstChild;t&&(1!==t.nodeType||(o++,e!==t));t=t.nextSibling);return o-=r,o===n||0===o%n&&o/n>=0}:function(t){var n=t;switch(e){case"only":case"first":for(;n=n.previousSibling;)if(1===n.nodeType)return!1;if("first"===e)return!0;n=t;case"last":for(;n=n.nextSibling;)if(1===n.nodeType)return!1;return!0}}},PSEUDO:function(e,t){var r,o=b.pseudos[e]||b.setFilters[e.toLowerCase()]||n.error("unsupported pseudo: "+e);return o[N]?o(t):o.length>1?(r=[e,e,"",t],b.setFilters.hasOwnProperty(e.toLowerCase())?L(function(e,n){for(var r,i=o(e,t),a=i.length;a--;)r=D.call(e,i[a]),e[r]=!(n[r]=i[a])}):function(e){return o(e,0,r)}):o}},pseudos:{not:L(function(e){var t=[],n=[],r=w(e.replace(G,"$1"));return r[N]?L(function(e,t,n,o){for(var i,a=r(e,null,o,[]),s=e.length;s--;)(i=a[s])&&(e[s]=!(t[s]=i))}):function(e,o,i){return t[0]=e,r(t,null,i,n),!n.pop()}}),has:L(function(e){return function(t){return n(e,t).length>0}}),contains:L(function(e){return function(t){return(t.textContent||t.innerText||_(t)).indexOf(e)>-1}}),enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},parent:function(e){return!b.pseudos.empty(e)},empty:function(e){var t;for(e=e.firstChild;e;){if(e.nodeName>"@"||3===(t=e.nodeType)||4===t)return!1;e=e.nextSibling}return!0},header:function(e){return ot.test(e.nodeName)},text:function(e){var t,n;return"input"===e.nodeName.toLowerCase()&&"text"===(t=e.type)&&(null==(n=e.getAttribute("type"))||n.toLowerCase()===t)},radio:r("radio"),checkbox:r("checkbox"),file:r("file"),password:r("password"),image:r("image"),submit:o("submit"),reset:o("reset"),button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},input:function(e){return it.test(e.nodeName)},focus:function(e){var t=e.ownerDocument;return e===t.activeElement&&(!t.hasFocus||t.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},active:function(e){return e===e.ownerDocument.activeElement},first:i(function(){return[0]}),last:i(function(e,t){return[t-1]}),eq:i(function(e,t,n){return[0>n?n+t:n]}),even:i(function(e,t){for(var n=0;t>n;n+=2)e.push(n);return e}),odd:i(function(e,t){for(var n=1;t>n;n+=2)e.push(n);return e}),lt:i(function(e,t,n){for(var r=0>n?n+t:n;--r>=0;)e.push(r);return e}),gt:i(function(e,t,n){for(var r=0>n?n+t:n;t>++r;)e.push(r);return e})}},A=j.compareDocumentPosition?function(e,t){return e===t?(F=!0,0):(e.compareDocumentPosition&&t.compareDocumentPosition?4&e.compareDocumentPosition(t):e.compareDocumentPosition)?-1:1}:function(e,t){if(e===t)return F=!0,0;if(e.sourceIndex&&t.sourceIndex)return e.sourceIndex-t.sourceIndex;var n,r,o=[],i=[],s=e.parentNode,c=t.parentNode,l=s;if(s===c)return a(e,t);if(!s)return-1;if(!c)return 1;for(;l;)o.unshift(l),l=l.parentNode;for(l=c;l;)i.unshift(l),l=l.parentNode;n=o.length,r=i.length;for(var u=0;n>u&&r>u;u++)if(o[u]!==i[u])return a(o[u],i[u]);return u===n?a(e,i[u],-1):a(o[u],t,1)},[0,0].sort(A),E=!F,n.uniqueSort=function(e){var t,n=[],r=1,o=0;if(F=E,e.sort(A),F){for(;t=e[r];r++)t===e[r-1]&&(o=n.push(r));for(;o--;)e.splice(n[o],1)}return e},n.error=function(e){throw Error("Syntax error, unrecognized expression: "+e)},w=n.compile=function(e,t){var n,r=[],o=[],i=q[N][e+" "];if(!i){for(t||(t=s(e)),n=t.length;n--;)i=f(t[n]),i[N]?r.push(i):o.push(i);i=q(e,d(o,r))}return i},S.querySelectorAll&&function(){var e,t=g,r=/'|\\/g,o=/\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,i=[":focus"],a=[":active"],c=j.matchesSelector||j.mozMatchesSelector||j.webkitMatchesSelector||j.oMatchesSelector||j.msMatchesSelector;ct(function(e){e.innerHTML="<select><option selected=''></option></select>",e.querySelectorAll("[selected]").length||i.push("\\["+W+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),e.querySelectorAll(":checked").length||i.push(":checked")}),ct(function(e){e.innerHTML="<p test=''></p>",e.querySelectorAll("[test^='']").length&&i.push("[*^$]="+W+"*(?:\"\"|'')"),e.innerHTML="<input type='hidden'/>",e.querySelectorAll(":enabled").length||i.push(":enabled",":disabled")}),i=RegExp(i.join("|")),g=function(e,n,o,a,c){if(!a&&!c&&!i.test(e)){var l,u,p=!0,f=N,d=n,h=9===n.nodeType&&e;if(1===n.nodeType&&"object"!==n.nodeName.toLowerCase()){for(l=s(e),(p=n.getAttribute("id"))?f=p.replace(r,"\\$&"):n.setAttribute("id",f),f="[id='"+f+"'] ",u=l.length;u--;)l[u]=f+l[u].join("");d=rt.test(e)&&n.parentNode||n,h=l.join(",")}if(h)try{return P.apply(o,H.call(d.querySelectorAll(h),0)),o}catch(g){}finally{p||n.removeAttribute("id")}}return t(e,n,o,a,c)},c&&(ct(function(t){e=c.call(t,"div");try{c.call(t,"[test!='']:sizzle"),a.push("!=",X)}catch(n){}}),a=RegExp(a.join("|")),n.matchesSelector=function(t,r){if(r=r.replace(o,"='$1']"),!C(t)&&!a.test(r)&&!i.test(r))try{var s=c.call(t,r);if(s||e||t.document&&11!==t.document.nodeType)return s}catch(l){}return n(r,null,null,[t]).length>0})}(),b.pseudos.nth=b.pseudos.eq,b.filters=m.prototype=b.pseudos,b.setFilters=new m,n.attr=Y.attr,Y.find=n,Y.expr=n.selectors,Y.expr[":"]=Y.expr.pseudos,Y.unique=n.uniqueSort,Y.text=n.getText,Y.isXMLDoc=n.isXML,Y.contains=n.contains}(e);var It=/Until$/,Mt=/^(?:parents|prev(?:Until|All))/,Pt=/^.[^:#\[\.,]*$/,Ht=Y.expr.match.needsContext,Dt={children:!0,contents:!0,next:!0,prev:!0};Y.fn.extend({find:function(e){var t,n,r,o,i,a,s=this;if("string"!=typeof e)return Y(e).filter(function(){for(t=0,n=s.length;n>t;t++)if(Y.contains(s[t],this))return!0});for(a=this.pushStack("","find",e),t=0,n=this.length;n>t;t++)if(r=a.length,Y.find(e,this[t],a),t>0)for(o=r;a.length>o;o++)for(i=0;r>i;i++)if(a[i]===a[o]){a.splice(o--,1);break}return a},has:function(e){var t,n=Y(e,this),r=n.length;return this.filter(function(){for(t=0;r>t;t++)if(Y.contains(this,n[t]))return!0})},not:function(e){return this.pushStack(l(this,e,!1),"not",e)},filter:function(e){return this.pushStack(l(this,e,!0),"filter",e)},is:function(e){return!!e&&("string"==typeof e?Ht.test(e)?Y(e,this.context).index(this[0])>=0:Y.filter(e,this).length>0:this.filter(e).length>0)},closest:function(e,t){for(var n,r=0,o=this.length,i=[],a=Ht.test(e)||"string"!=typeof e?Y(e,t||this.context):0;o>r;r++)for(n=this[r];n&&n.ownerDocument&&n!==t&&11!==n.nodeType;){if(a?a.index(n)>-1:Y.find.matchesSelector(n,e)){i.push(n);break}n=n.parentNode}return i=i.length>1?Y.unique(i):i,this.pushStack(i,"closest",e)},index:function(e){return e?"string"==typeof e?Y.inArray(this[0],Y(e)):Y.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.prevAll().length:-1},add:function(e,t){var n="string"==typeof e?Y(e,t):Y.makeArray(e&&e.nodeType?[e]:e),r=Y.merge(this.get(),n);return this.pushStack(s(n[0])||s(r[0])?r:Y.unique(r))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),Y.fn.andSelf=Y.fn.addBack,Y.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return Y.dir(e,"parentNode")},parentsUntil:function(e,t,n){return Y.dir(e,"parentNode",n)},next:function(e){return c(e,"nextSibling")},prev:function(e){return c(e,"previousSibling")},nextAll:function(e){return Y.dir(e,"nextSibling")},prevAll:function(e){return Y.dir(e,"previousSibling")},nextUntil:function(e,t,n){return Y.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return Y.dir(e,"previousSibling",n)},siblings:function(e){return Y.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return Y.sibling(e.firstChild)},contents:function(e){return Y.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:Y.merge([],e.childNodes)}},function(e,t){Y.fn[e]=function(n,r){var o=Y.map(this,t,n);return It.test(e)||(r=n),r&&"string"==typeof r&&(o=Y.filter(r,o)),o=this.length>1&&!Dt[e]?Y.unique(o):o,this.length>1&&Mt.test(e)&&(o=o.reverse()),this.pushStack(o,e,J.call(arguments).join(","))}}),Y.extend({filter:function(e,t,n){return n&&(e=":not("+e+")"),1===t.length?Y.find.matchesSelector(t[0],e)?[t[0]]:[]:Y.find.matches(e,t)},dir:function(e,n,r){for(var o=[],i=e[n];i&&9!==i.nodeType&&(r===t||1!==i.nodeType||!Y(i).is(r));)1===i.nodeType&&o.push(i),i=i[n];return o},sibling:function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n}});var Lt="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",Bt=/ jQuery\d+="(?:null|\d+)"/g,Qt=/^\s+/,Ut=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,qt=/<([\w:]+)/,Wt=/<tbody/i,$t=/<|&#?\w+;/,zt=/<(?:script|style|link)/i,Jt=/<(?:script|object|embed|option|style)/i,Vt=RegExp("<(?:"+Lt+")[\\s/>]","i"),Xt=/^(?:checkbox|radio)$/,Kt=/checked\s*(?:[^=]|=\s*.checked.)/i,Gt=/\/(java|ecma)script/i,Yt=/^\s*<!(?:\[CDATA\[|\-\-)|[\]\-]{2}>\s*$/g,Zt={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]},en=u(Q),tn=en.appendChild(Q.createElement("div"));Zt.optgroup=Zt.option,Zt.tbody=Zt.tfoot=Zt.colgroup=Zt.caption=Zt.thead,Zt.th=Zt.td,Y.support.htmlSerialize||(Zt._default=[1,"X<div>","</div>"]),Y.fn.extend({text:function(e){return Y.access(this,function(e){return e===t?Y.text(this):this.empty().append((this[0]&&this[0].ownerDocument||Q).createTextNode(e))},null,e,arguments.length)},wrapAll:function(e){if(Y.isFunction(e))return this.each(function(t){Y(this).wrapAll(e.call(this,t))});if(this[0]){var t=Y(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){for(var e=this;e.firstChild&&1===e.firstChild.nodeType;)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return Y.isFunction(e)?this.each(function(t){Y(this).wrapInner(e.call(this,t))}):this.each(function(){var t=Y(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=Y.isFunction(e);return this.each(function(n){Y(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){Y.nodeName(this,"body")||Y(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(e){(1===this.nodeType||11===this.nodeType)&&this.appendChild(e)})},prepend:function(){return this.domManip(arguments,!0,function(e){(1===this.nodeType||11===this.nodeType)&&this.insertBefore(e,this.firstChild)})},before:function(){if(!s(this[0]))return this.domManip(arguments,!1,function(e){this.parentNode.insertBefore(e,this)});if(arguments.length){var e=Y.clean(arguments);return this.pushStack(Y.merge(e,this),"before",this.selector)}},after:function(){if(!s(this[0]))return this.domManip(arguments,!1,function(e){this.parentNode.insertBefore(e,this.nextSibling)});if(arguments.length){var e=Y.clean(arguments);return this.pushStack(Y.merge(this,e),"after",this.selector)}},remove:function(e,t){for(var n,r=0;null!=(n=this[r]);r++)(!e||Y.filter(e,[n]).length)&&(t||1!==n.nodeType||(Y.cleanData(n.getElementsByTagName("*")),Y.cleanData([n])),n.parentNode&&n.parentNode.removeChild(n));return this},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)for(1===e.nodeType&&Y.cleanData(e.getElementsByTagName("*"));e.firstChild;)e.removeChild(e.firstChild);return this},clone:function(e,t){return e=null==e?!1:e,t=null==t?e:t,this.map(function(){return Y.clone(this,e,t)})},html:function(e){return Y.access(this,function(e){var n=this[0]||{},r=0,o=this.length;if(e===t)return 1===n.nodeType?n.innerHTML.replace(Bt,""):t;if(!("string"!=typeof e||zt.test(e)||!Y.support.htmlSerialize&&Vt.test(e)||!Y.support.leadingWhitespace&&Qt.test(e)||Zt[(qt.exec(e)||["",""])[1].toLowerCase()])){e=e.replace(Ut,"<$1></$2>");try{for(;o>r;r++)n=this[r]||{},1===n.nodeType&&(Y.cleanData(n.getElementsByTagName("*")),n.innerHTML=e);n=0}catch(i){}}n&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(e){return s(this[0])?this.length?this.pushStack(Y(Y.isFunction(e)?e():e),"replaceWith",e):this:Y.isFunction(e)?this.each(function(t){var n=Y(this),r=n.html();n.replaceWith(e.call(this,t,r))}):("string"!=typeof e&&(e=Y(e).detach()),this.each(function(){var t=this.nextSibling,n=this.parentNode;Y(this).remove(),t?Y(t).before(e):Y(n).append(e)}))},detach:function(e){return this.remove(e,!0)},domManip:function(e,n,r){e=[].concat.apply([],e);var o,i,a,s,c=0,l=e[0],u=[],f=this.length;if(!Y.support.checkClone&&f>1&&"string"==typeof l&&Kt.test(l))return this.each(function(){Y(this).domManip(e,n,r)});if(Y.isFunction(l))return this.each(function(o){var i=Y(this);e[0]=l.call(this,o,n?i.html():t),i.domManip(e,n,r)});if(this[0]){if(o=Y.buildFragment(e,this,u),a=o.fragment,i=a.firstChild,1===a.childNodes.length&&(a=i),i)for(n=n&&Y.nodeName(i,"tr"),s=o.cacheable||f-1;f>c;c++)r.call(n&&Y.nodeName(this[c],"table")?p(this[c],"tbody"):this[c],c===s?a:Y.clone(a,!0,!0));a=i=null,u.length&&Y.each(u,function(e,t){t.src?Y.ajax?Y.ajax({url:t.src,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0}):Y.error("no ajax"):Y.globalEval((t.text||t.textContent||t.innerHTML||"").replace(Yt,"")),t.parentNode&&t.parentNode.removeChild(t)})}return this}}),Y.buildFragment=function(e,n,r){var o,i,a,s=e[0];return n=n||Q,n=!n.nodeType&&n[0]||n,n=n.ownerDocument||n,!(1===e.length&&"string"==typeof s&&512>s.length&&n===Q&&"<"===s.charAt(0))||Jt.test(s)||!Y.support.checkClone&&Kt.test(s)||!Y.support.html5Clone&&Vt.test(s)||(i=!0,o=Y.fragments[s],a=o!==t),o||(o=n.createDocumentFragment(),Y.clean(e,n,o,r),i&&(Y.fragments[s]=a&&o)),{fragment:o,cacheable:i}},Y.fragments={},Y.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){Y.fn[e]=function(n){var r,o=0,i=[],a=Y(n),s=a.length,c=1===this.length&&this[0].parentNode;if((null==c||c&&11===c.nodeType&&1===c.childNodes.length)&&1===s)return a[t](this[0]),this;for(;s>o;o++)r=(o>0?this.clone(!0):this).get(),Y(a[o])[t](r),i=i.concat(r);return this.pushStack(i,e,a.selector)}}),Y.extend({clone:function(e,t,n){var r,o,i,a;if(Y.support.html5Clone||Y.isXMLDoc(e)||!Vt.test("<"+e.nodeName+">")?a=e.cloneNode(!0):(tn.innerHTML=e.outerHTML,tn.removeChild(a=tn.firstChild)),!(Y.support.noCloneEvent&&Y.support.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||Y.isXMLDoc(e)))for(d(e,a),r=h(e),o=h(a),i=0;r[i];++i)o[i]&&d(r[i],o[i]);if(t&&(f(e,a),n))for(r=h(e),o=h(a),i=0;r[i];++i)f(r[i],o[i]);return r=o=null,a},clean:function(e,n,r,o){var i,a,s,c,l,p,f,d,h,m,y,v=n===Q&&en,b=[];for(n&&n.createDocumentFragment!==t||(n=Q),i=0;null!=(s=e[i]);i++)if("number"==typeof s&&(s+=""),s){if("string"==typeof s)if($t.test(s)){for(v=v||u(n),f=n.createElement("div"),v.appendChild(f),s=s.replace(Ut,"<$1></$2>"),c=(qt.exec(s)||["",""])[1].toLowerCase(),l=Zt[c]||Zt._default,p=l[0],f.innerHTML=l[1]+s+l[2];p--;)f=f.lastChild;if(!Y.support.tbody)for(d=Wt.test(s),h="table"!==c||d?"<table>"!==l[1]||d?[]:f.childNodes:f.firstChild&&f.firstChild.childNodes,a=h.length-1;a>=0;--a)Y.nodeName(h[a],"tbody")&&!h[a].childNodes.length&&h[a].parentNode.removeChild(h[a]);!Y.support.leadingWhitespace&&Qt.test(s)&&f.insertBefore(n.createTextNode(Qt.exec(s)[0]),f.firstChild),s=f.childNodes,f.parentNode.removeChild(f)}else s=n.createTextNode(s);s.nodeType?b.push(s):Y.merge(b,s)}if(f&&(s=f=v=null),!Y.support.appendChecked)for(i=0;null!=(s=b[i]);i++)Y.nodeName(s,"input")?g(s):s.getElementsByTagName!==t&&Y.grep(s.getElementsByTagName("input"),g);if(r)for(m=function(e){return!e.type||Gt.test(e.type)?o?o.push(e.parentNode?e.parentNode.removeChild(e):e):r.appendChild(e):t},i=0;null!=(s=b[i]);i++)Y.nodeName(s,"script")&&m(s)||(r.appendChild(s),s.getElementsByTagName!==t&&(y=Y.grep(Y.merge([],s.getElementsByTagName("script")),m),b.splice.apply(b,[i+1,0].concat(y)),i+=y.length));return b},cleanData:function(e,t){for(var n,r,o,i,a=0,s=Y.expando,c=Y.cache,l=Y.support.deleteExpando,u=Y.event.special;null!=(o=e[a]);a++)if((t||Y.acceptData(o))&&(r=o[s],n=r&&c[r])){if(n.events)for(i in n.events)u[i]?Y.event.remove(o,i):Y.removeEvent(o,i,n.handle);c[r]&&(delete c[r],l?delete o[s]:o.removeAttribute?o.removeAttribute(s):o[s]=null,Y.deletedIds.push(r))}}}),function(){var e,t;Y.uaMatch=function(e){e=e.toLowerCase();var t=/(chrome)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+)/.exec(e)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e)||/(msie) ([\w.]+)/.exec(e)||0>e.indexOf("compatible")&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(e)||[];return{browser:t[1]||"",version:t[2]||"0"}},e=Y.uaMatch(q.userAgent),t={},e.browser&&(t[e.browser]=!0,t.version=e.version),t.chrome?t.webkit=!0:t.webkit&&(t.safari=!0),Y.browser=t,Y.sub=function(){function e(t,n){return new e.fn.init(t,n)}Y.extend(!0,e,this),e.superclass=this,e.fn=e.prototype=this(),e.fn.constructor=e,e.sub=this.sub,e.fn.init=function(n,r){return r&&r instanceof Y&&!(r instanceof e)&&(r=e(r)),Y.fn.init.call(this,n,r,t)},e.fn.init.prototype=e.fn;var t=e(Q);return e}}();var nn,rn,on,an=/alpha\([^)]*\)/i,sn=/opacity=([^)]*)/,cn=/^(top|right|bottom|left)$/,ln=/^(none|table(?!-c[ea]).+)/,un=/^margin/,pn=RegExp("^("+Z+")(.*)$","i"),fn=RegExp("^("+Z+")(?!px)[a-z%]+$","i"),dn=RegExp("^([-+])=("+Z+")","i"),hn={BODY:"block"},gn={position:"absolute",visibility:"hidden",display:"block"},mn={letterSpacing:0,fontWeight:400},yn=["Top","Right","Bottom","Left"],vn=["Webkit","O","Moz","ms"],bn=Y.fn.toggle;Y.fn.extend({css:function(e,n){return Y.access(this,function(e,n,r){return r!==t?Y.style(e,n,r):Y.css(e,n)},e,n,arguments.length>1)},show:function(){return v(this,!0)},hide:function(){return v(this)},toggle:function(e,t){var n="boolean"==typeof e;return Y.isFunction(e)&&Y.isFunction(t)?bn.apply(this,arguments):this.each(function(){(n?e:y(this))?Y(this).show():Y(this).hide()})}}),Y.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=nn(e,"opacity");return""===n?"1":n}}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":Y.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,r,o){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var i,a,s,c=Y.camelCase(n),l=e.style;if(n=Y.cssProps[c]||(Y.cssProps[c]=m(l,c)),s=Y.cssHooks[n]||Y.cssHooks[c],r===t)return s&&"get"in s&&(i=s.get(e,!1,o))!==t?i:l[n];if(a=typeof r,"string"===a&&(i=dn.exec(r))&&(r=(i[1]+1)*i[2]+parseFloat(Y.css(e,n)),a="number"),!(null==r||"number"===a&&isNaN(r)||("number"!==a||Y.cssNumber[c]||(r+="px"),s&&"set"in s&&(r=s.set(e,r,o))===t)))try{l[n]=r}catch(u){}}},css:function(e,n,r,o){var i,a,s,c=Y.camelCase(n);return n=Y.cssProps[c]||(Y.cssProps[c]=m(e.style,c)),s=Y.cssHooks[n]||Y.cssHooks[c],s&&"get"in s&&(i=s.get(e,!0,o)),i===t&&(i=nn(e,n)),"normal"===i&&n in mn&&(i=mn[n]),r||o!==t?(a=parseFloat(i),r||Y.isNumeric(a)?a||0:i):i},swap:function(e,t,n){var r,o,i={};for(o in t)i[o]=e.style[o],e.style[o]=t[o];r=n.call(e);for(o in t)e.style[o]=i[o];return r}}),e.getComputedStyle?nn=function(t,n){var r,o,i,a,s=e.getComputedStyle(t,null),c=t.style;return s&&(r=s.getPropertyValue(n)||s[n],""!==r||Y.contains(t.ownerDocument,t)||(r=Y.style(t,n)),fn.test(r)&&un.test(n)&&(o=c.width,i=c.minWidth,a=c.maxWidth,c.minWidth=c.maxWidth=c.width=r,r=s.width,c.width=o,c.minWidth=i,c.maxWidth=a)),r}:Q.documentElement.currentStyle&&(nn=function(e,t){var n,r,o=e.currentStyle&&e.currentStyle[t],i=e.style;return null==o&&i&&i[t]&&(o=i[t]),fn.test(o)&&!cn.test(t)&&(n=i.left,r=e.runtimeStyle&&e.runtimeStyle.left,r&&(e.runtimeStyle.left=e.currentStyle.left),i.left="fontSize"===t?"1em":o,o=i.pixelLeft+"px",i.left=n,r&&(e.runtimeStyle.left=r)),""===o?"auto":o}),Y.each(["height","width"],function(e,n){Y.cssHooks[n]={get:function(e,r,o){return r?0===e.offsetWidth&&ln.test(nn(e,"display"))?Y.swap(e,gn,function(){return C(e,n,o)}):C(e,n,o):t},set:function(e,t,r){return b(e,t,r?_(e,n,r,Y.support.boxSizing&&"border-box"===Y.css(e,"boxSizing")):0)}}}),Y.support.opacity||(Y.cssHooks.opacity={get:function(e,t){return sn.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var n=e.style,r=e.currentStyle,o=Y.isNumeric(t)?"alpha(opacity="+100*t+")":"",i=r&&r.filter||n.filter||"";n.zoom=1,t>=1&&""===Y.trim(i.replace(an,""))&&n.removeAttribute&&(n.removeAttribute("filter"),r&&!r.filter)||(n.filter=an.test(i)?i.replace(an,o):i+" "+o)}}),Y(function(){Y.support.reliableMarginRight||(Y.cssHooks.marginRight={get:function(e,n){return Y.swap(e,{display:"inline-block"},function(){return n?nn(e,"marginRight"):t})}}),!Y.support.pixelPosition&&Y.fn.position&&Y.each(["top","left"],function(e,t){Y.cssHooks[t]={get:function(e,n){if(n){var r=nn(e,t);return fn.test(r)?Y(e).position()[t]+"px":r}}}})}),Y.expr&&Y.expr.filters&&(Y.expr.filters.hidden=function(e){return 0===e.offsetWidth&&0===e.offsetHeight||!Y.support.reliableHiddenOffsets&&"none"===(e.style&&e.style.display||nn(e,"display"))},Y.expr.filters.visible=function(e){return!Y.expr.filters.hidden(e)}),Y.each({margin:"",padding:"",border:"Width"},function(e,t){Y.cssHooks[e+t]={expand:function(n){var r,o="string"==typeof n?n.split(" "):[n],i={};for(r=0;4>r;r++)i[e+yn[r]+t]=o[r]||o[r-2]||o[0];return i}},un.test(e)||(Y.cssHooks[e+t].set=b)});var _n=/%20/g,Cn=/\[\]$/,xn=/\r?\n/g,wn=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,An=/^(?:select|textarea)/i;
Y.fn.extend({serialize:function(){return Y.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?Y.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||An.test(this.nodeName)||wn.test(this.type))}).map(function(e,t){var n=Y(this).val();return null==n?null:Y.isArray(n)?Y.map(n,function(e){return{name:t.name,value:e.replace(xn,"\r\n")}}):{name:t.name,value:n.replace(xn,"\r\n")}}).get()}}),Y.param=function(e,n){var r,o=[],i=function(e,t){t=Y.isFunction(t)?t():null==t?"":t,o[o.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(n===t&&(n=Y.ajaxSettings&&Y.ajaxSettings.traditional),Y.isArray(e)||e.jquery&&!Y.isPlainObject(e))Y.each(e,function(){i(this.name,this.value)});else for(r in e)w(r,e[r],n,i);return o.join("&").replace(_n,"+")};var Fn,kn,En=/#.*$/,Tn=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Nn=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,Rn=/^(?:GET|HEAD)$/,Sn=/^\/\//,jn=/\?/,On=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,In=/([?&])_=[^&]*/,Mn=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,Pn=Y.fn.load,Hn={},Dn={},Ln=["*/"]+["*"];try{kn=U.href}catch(Bn){kn=Q.createElement("a"),kn.href="",kn=kn.href}Fn=Mn.exec(kn.toLowerCase())||[],Y.fn.load=function(e,n,r){if("string"!=typeof e&&Pn)return Pn.apply(this,arguments);if(!this.length)return this;var o,i,a,s=this,c=e.indexOf(" ");return c>=0&&(o=e.slice(c,e.length),e=e.slice(0,c)),Y.isFunction(n)?(r=n,n=t):n&&"object"==typeof n&&(i="POST"),Y.ajax({url:e,type:i,dataType:"html",data:n,complete:function(e,t){r&&s.each(r,a||[e.responseText,t,e])}}).done(function(e){a=arguments,s.html(o?Y("<div>").append(e.replace(On,"")).find(o):e)}),this},Y.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(e,t){Y.fn[t]=function(e){return this.on(t,e)}}),Y.each(["get","post"],function(e,n){Y[n]=function(e,r,o,i){return Y.isFunction(r)&&(i=i||o,o=r,r=t),Y.ajax({type:n,url:e,data:r,success:o,dataType:i})}}),Y.extend({getScript:function(e,n){return Y.get(e,t,n,"script")},getJSON:function(e,t,n){return Y.get(e,t,n,"json")},ajaxSetup:function(e,t){return t?k(e,Y.ajaxSettings):(t=e,e=Y.ajaxSettings),k(e,t),e},ajaxSettings:{url:kn,isLocal:Nn.test(Fn[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":Ln},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":e.String,"text html":!0,"text json":Y.parseJSON,"text xml":Y.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:A(Hn),ajaxTransport:A(Dn),ajax:function(e,n){function r(e,n,r,a){var l,p,v,b,C,w=n;2!==_&&(_=2,c&&clearTimeout(c),s=t,i=a||"",x.readyState=e>0?4:0,r&&(b=E(f,x,r)),e>=200&&300>e||304===e?(f.ifModified&&(C=x.getResponseHeader("Last-Modified"),C&&(Y.lastModified[o]=C),C=x.getResponseHeader("Etag"),C&&(Y.etag[o]=C)),304===e?(w="notmodified",l=!0):(l=T(f,b),w=l.state,p=l.data,v=l.error,l=!v)):(v=w,(!w||e)&&(w="error",0>e&&(e=0))),x.status=e,x.statusText=(n||w)+"",l?g.resolveWith(d,[p,w,x]):g.rejectWith(d,[x,w,v]),x.statusCode(y),y=t,u&&h.trigger("ajax"+(l?"Success":"Error"),[x,f,l?p:v]),m.fireWith(d,[x,w]),u&&(h.trigger("ajaxComplete",[x,f]),--Y.active||Y.event.trigger("ajaxStop")))}"object"==typeof e&&(n=e,e=t),n=n||{};var o,i,a,s,c,l,u,p,f=Y.ajaxSetup({},n),d=f.context||f,h=d!==f&&(d.nodeType||d instanceof Y)?Y(d):Y.event,g=Y.Deferred(),m=Y.Callbacks("once memory"),y=f.statusCode||{},v={},b={},_=0,C="canceled",x={readyState:0,setRequestHeader:function(e,t){if(!_){var n=e.toLowerCase();e=b[n]=b[n]||e,v[e]=t}return this},getAllResponseHeaders:function(){return 2===_?i:null},getResponseHeader:function(e){var n;if(2===_){if(!a)for(a={};n=Tn.exec(i);)a[n[1].toLowerCase()]=n[2];n=a[e.toLowerCase()]}return n===t?null:n},overrideMimeType:function(e){return _||(f.mimeType=e),this},abort:function(e){return e=e||C,s&&s.abort(e),r(0,e),this}};if(g.promise(x),x.success=x.done,x.error=x.fail,x.complete=m.add,x.statusCode=function(e){if(e){var t;if(2>_)for(t in e)y[t]=[y[t],e[t]];else t=e[x.status],x.always(t)}return this},f.url=((e||f.url)+"").replace(En,"").replace(Sn,Fn[1]+"//"),f.dataTypes=Y.trim(f.dataType||"*").toLowerCase().split(tt),null==f.crossDomain&&(l=Mn.exec(f.url.toLowerCase()),f.crossDomain=!(!l||l[1]===Fn[1]&&l[2]===Fn[2]&&(l[3]||("http:"===l[1]?80:443))==(Fn[3]||("http:"===Fn[1]?80:443)))),f.data&&f.processData&&"string"!=typeof f.data&&(f.data=Y.param(f.data,f.traditional)),F(Hn,f,n,x),2===_)return x;if(u=f.global,f.type=f.type.toUpperCase(),f.hasContent=!Rn.test(f.type),u&&0===Y.active++&&Y.event.trigger("ajaxStart"),!f.hasContent&&(f.data&&(f.url+=(jn.test(f.url)?"&":"?")+f.data,delete f.data),o=f.url,f.cache===!1)){var w=Y.now(),A=f.url.replace(In,"$1_="+w);f.url=A+(A===f.url?(jn.test(f.url)?"&":"?")+"_="+w:"")}(f.data&&f.hasContent&&f.contentType!==!1||n.contentType)&&x.setRequestHeader("Content-Type",f.contentType),f.ifModified&&(o=o||f.url,Y.lastModified[o]&&x.setRequestHeader("If-Modified-Since",Y.lastModified[o]),Y.etag[o]&&x.setRequestHeader("If-None-Match",Y.etag[o])),x.setRequestHeader("Accept",f.dataTypes[0]&&f.accepts[f.dataTypes[0]]?f.accepts[f.dataTypes[0]]+("*"!==f.dataTypes[0]?", "+Ln+"; q=0.01":""):f.accepts["*"]);for(p in f.headers)x.setRequestHeader(p,f.headers[p]);if(f.beforeSend&&(f.beforeSend.call(d,x,f)===!1||2===_))return x.abort();C="abort";for(p in{success:1,error:1,complete:1})x[p](f[p]);if(s=F(Dn,f,n,x)){x.readyState=1,u&&h.trigger("ajaxSend",[x,f]),f.async&&f.timeout>0&&(c=setTimeout(function(){x.abort("timeout")},f.timeout));try{_=1,s.send(v,r)}catch(k){if(!(2>_))throw k;r(-1,k)}}else r(-1,"No Transport");return x},active:0,lastModified:{},etag:{}});var Qn=[],Un=/\?/,qn=/(=)\?(?=&|$)|\?\?/,Wn=Y.now();Y.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Qn.pop()||Y.expando+"_"+Wn++;return this[e]=!0,e}}),Y.ajaxPrefilter("json jsonp",function(n,r,o){var i,a,s,c=n.data,l=n.url,u=n.jsonp!==!1,p=u&&qn.test(l),f=u&&!p&&"string"==typeof c&&!(n.contentType||"").indexOf("application/x-www-form-urlencoded")&&qn.test(c);return"jsonp"===n.dataTypes[0]||p||f?(i=n.jsonpCallback=Y.isFunction(n.jsonpCallback)?n.jsonpCallback():n.jsonpCallback,a=e[i],p?n.url=l.replace(qn,"$1"+i):f?n.data=c.replace(qn,"$1"+i):u&&(n.url+=(Un.test(l)?"&":"?")+n.jsonp+"="+i),n.converters["script json"]=function(){return s||Y.error(i+" was not called"),s[0]},n.dataTypes[0]="json",e[i]=function(){s=arguments},o.always(function(){e[i]=a,n[i]&&(n.jsonpCallback=r.jsonpCallback,Qn.push(i)),s&&Y.isFunction(a)&&a(s[0]),s=a=t}),"script"):t}),Y.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(e){return Y.globalEval(e),e}}}),Y.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),Y.ajaxTransport("script",function(e){if(e.crossDomain){var n,r=Q.head||Q.getElementsByTagName("head")[0]||Q.documentElement;return{send:function(o,i){n=Q.createElement("script"),n.async="async",e.scriptCharset&&(n.charset=e.scriptCharset),n.src=e.url,n.onload=n.onreadystatechange=function(e,o){(o||!n.readyState||/loaded|complete/.test(n.readyState))&&(n.onload=n.onreadystatechange=null,r&&n.parentNode&&r.removeChild(n),n=t,o||i(200,"success"))},r.insertBefore(n,r.firstChild)},abort:function(){n&&n.onload(0,1)}}}});var $n,zn=e.ActiveXObject?function(){for(var e in $n)$n[e](0,1)}:!1,Jn=0;Y.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&N()||R()}:N,function(e){Y.extend(Y.support,{ajax:!!e,cors:!!e&&"withCredentials"in e})}(Y.ajaxSettings.xhr()),Y.support.ajax&&Y.ajaxTransport(function(n){if(!n.crossDomain||Y.support.cors){var r;return{send:function(o,i){var a,s,c=n.xhr();if(n.username?c.open(n.type,n.url,n.async,n.username,n.password):c.open(n.type,n.url,n.async),n.xhrFields)for(s in n.xhrFields)c[s]=n.xhrFields[s];n.mimeType&&c.overrideMimeType&&c.overrideMimeType(n.mimeType),n.crossDomain||o["X-Requested-With"]||(o["X-Requested-With"]="XMLHttpRequest");try{for(s in o)c.setRequestHeader(s,o[s])}catch(l){}c.send(n.hasContent&&n.data||null),r=function(e,o){var s,l,u,p,f;try{if(r&&(o||4===c.readyState))if(r=t,a&&(c.onreadystatechange=Y.noop,zn&&delete $n[a]),o)4!==c.readyState&&c.abort();else{s=c.status,u=c.getAllResponseHeaders(),p={},f=c.responseXML,f&&f.documentElement&&(p.xml=f);try{p.text=c.responseText}catch(d){}try{l=c.statusText}catch(d){l=""}s||!n.isLocal||n.crossDomain?1223===s&&(s=204):s=p.text?200:404}}catch(h){o||i(-1,h)}p&&i(s,l,p,u)},n.async?4===c.readyState?setTimeout(r,0):(a=++Jn,zn&&($n||($n={},Y(e).unload(zn)),$n[a]=r),c.onreadystatechange=r):r()},abort:function(){r&&r(0,1)}}}});var Vn,Xn,Kn=/^(?:toggle|show|hide)$/,Gn=RegExp("^(?:([-+])=|)("+Z+")([a-z%]*)$","i"),Yn=/queueHooks$/,Zn=[M],er={"*":[function(e,t){var n,r,o=this.createTween(e,t),i=Gn.exec(t),a=o.cur(),s=+a||0,c=1,l=20;if(i){if(n=+i[2],r=i[3]||(Y.cssNumber[e]?"":"px"),"px"!==r&&s){s=Y.css(o.elem,e,!0)||n||1;do c=c||".5",s/=c,Y.style(o.elem,e,s+r);while(c!==(c=o.cur()/a)&&1!==c&&--l)}o.unit=r,o.start=s,o.end=i[1]?s+(i[1]+1)*n:n}return o}]};Y.Animation=Y.extend(O,{tweener:function(e,t){Y.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");for(var n,r=0,o=e.length;o>r;r++)n=e[r],er[n]=er[n]||[],er[n].unshift(t)},prefilter:function(e,t){t?Zn.unshift(e):Zn.push(e)}}),Y.Tween=P,P.prototype={constructor:P,init:function(e,t,n,r,o,i){this.elem=e,this.prop=n,this.easing=o||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=i||(Y.cssNumber[n]?"":"px")},cur:function(){var e=P.propHooks[this.prop];return e&&e.get?e.get(this):P.propHooks._default.get(this)},run:function(e){var t,n=P.propHooks[this.prop];return this.pos=t=this.options.duration?Y.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):P.propHooks._default.set(this),this}},P.prototype.init.prototype=P.prototype,P.propHooks={_default:{get:function(e){var t;return null==e.elem[e.prop]||e.elem.style&&null!=e.elem.style[e.prop]?(t=Y.css(e.elem,e.prop,!1,""),t&&"auto"!==t?t:0):e.elem[e.prop]},set:function(e){Y.fx.step[e.prop]?Y.fx.step[e.prop](e):e.elem.style&&(null!=e.elem.style[Y.cssProps[e.prop]]||Y.cssHooks[e.prop])?Y.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},P.propHooks.scrollTop=P.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},Y.each(["toggle","show","hide"],function(e,t){var n=Y.fn[t];Y.fn[t]=function(r,o,i){return null==r||"boolean"==typeof r||!e&&Y.isFunction(r)&&Y.isFunction(o)?n.apply(this,arguments):this.animate(H(t,!0),r,o,i)}}),Y.fn.extend({fadeTo:function(e,t,n,r){return this.filter(y).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var o=Y.isEmptyObject(e),i=Y.speed(t,n,r),a=function(){var t=O(this,Y.extend({},e),i);o&&t.stop(!0)};return o||i.queue===!1?this.each(a):this.queue(i.queue,a)},stop:function(e,n,r){var o=function(e){var t=e.stop;delete e.stop,t(r)};return"string"!=typeof e&&(r=n,n=e,e=t),n&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,n=null!=e&&e+"queueHooks",i=Y.timers,a=Y._data(this);if(n)a[n]&&a[n].stop&&o(a[n]);else for(n in a)a[n]&&a[n].stop&&Yn.test(n)&&o(a[n]);for(n=i.length;n--;)i[n].elem!==this||null!=e&&i[n].queue!==e||(i[n].anim.stop(r),t=!1,i.splice(n,1));(t||!r)&&Y.dequeue(this,e)})}}),Y.each({slideDown:H("show"),slideUp:H("hide"),slideToggle:H("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){Y.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),Y.speed=function(e,t,n){var r=e&&"object"==typeof e?Y.extend({},e):{complete:n||!n&&t||Y.isFunction(e)&&e,duration:e,easing:n&&t||t&&!Y.isFunction(t)&&t};return r.duration=Y.fx.off?0:"number"==typeof r.duration?r.duration:r.duration in Y.fx.speeds?Y.fx.speeds[r.duration]:Y.fx.speeds._default,(null==r.queue||r.queue===!0)&&(r.queue="fx"),r.old=r.complete,r.complete=function(){Y.isFunction(r.old)&&r.old.call(this),r.queue&&Y.dequeue(this,r.queue)},r},Y.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},Y.timers=[],Y.fx=P.prototype.init,Y.fx.tick=function(){var e,n=Y.timers,r=0;for(Vn=Y.now();n.length>r;r++)e=n[r],e()||n[r]!==e||n.splice(r--,1);n.length||Y.fx.stop(),Vn=t},Y.fx.timer=function(e){e()&&Y.timers.push(e)&&!Xn&&(Xn=setInterval(Y.fx.tick,Y.fx.interval))},Y.fx.interval=13,Y.fx.stop=function(){clearInterval(Xn),Xn=null},Y.fx.speeds={slow:600,fast:200,_default:400},Y.fx.step={},Y.expr&&Y.expr.filters&&(Y.expr.filters.animated=function(e){return Y.grep(Y.timers,function(t){return e===t.elem}).length});var tr=/^(?:body|html)$/i;Y.fn.offset=function(e){if(arguments.length)return e===t?this:this.each(function(t){Y.offset.setOffset(this,e,t)});var n,r,o,i,a,s,c,l={top:0,left:0},u=this[0],p=u&&u.ownerDocument;if(p)return(r=p.body)===u?Y.offset.bodyOffset(u):(n=p.documentElement,Y.contains(n,u)?(u.getBoundingClientRect!==t&&(l=u.getBoundingClientRect()),o=D(p),i=n.clientTop||r.clientTop||0,a=n.clientLeft||r.clientLeft||0,s=o.pageYOffset||n.scrollTop,c=o.pageXOffset||n.scrollLeft,{top:l.top+s-i,left:l.left+c-a}):l)},Y.offset={bodyOffset:function(e){var t=e.offsetTop,n=e.offsetLeft;return Y.support.doesNotIncludeMarginInBodyOffset&&(t+=parseFloat(Y.css(e,"marginTop"))||0,n+=parseFloat(Y.css(e,"marginLeft"))||0),{top:t,left:n}},setOffset:function(e,t,n){var r=Y.css(e,"position");"static"===r&&(e.style.position="relative");var o,i,a=Y(e),s=a.offset(),c=Y.css(e,"top"),l=Y.css(e,"left"),u=("absolute"===r||"fixed"===r)&&Y.inArray("auto",[c,l])>-1,p={},f={};u?(f=a.position(),o=f.top,i=f.left):(o=parseFloat(c)||0,i=parseFloat(l)||0),Y.isFunction(t)&&(t=t.call(e,n,s)),null!=t.top&&(p.top=t.top-s.top+o),null!=t.left&&(p.left=t.left-s.left+i),"using"in t?t.using.call(e,p):a.css(p)}},Y.fn.extend({position:function(){if(this[0]){var e=this[0],t=this.offsetParent(),n=this.offset(),r=tr.test(t[0].nodeName)?{top:0,left:0}:t.offset();return n.top-=parseFloat(Y.css(e,"marginTop"))||0,n.left-=parseFloat(Y.css(e,"marginLeft"))||0,r.top+=parseFloat(Y.css(t[0],"borderTopWidth"))||0,r.left+=parseFloat(Y.css(t[0],"borderLeftWidth"))||0,{top:n.top-r.top,left:n.left-r.left}}},offsetParent:function(){return this.map(function(){for(var e=this.offsetParent||Q.body;e&&!tr.test(e.nodeName)&&"static"===Y.css(e,"position");)e=e.offsetParent;return e||Q.body})}}),Y.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var r=/Y/.test(n);Y.fn[e]=function(o){return Y.access(this,function(e,o,i){var a=D(e);return i===t?a?n in a?a[n]:a.document.documentElement[o]:e[o]:(a?a.scrollTo(r?Y(a).scrollLeft():i,r?i:Y(a).scrollTop()):e[o]=i,t)},e,o,arguments.length,null)}}),Y.each({Height:"height",Width:"width"},function(e,n){Y.each({padding:"inner"+e,content:n,"":"outer"+e},function(r,o){Y.fn[o]=function(o,i){var a=arguments.length&&(r||"boolean"!=typeof o),s=r||(o===!0||i===!0?"margin":"border");return Y.access(this,function(n,r,o){var i;return Y.isWindow(n)?n.document.documentElement["client"+e]:9===n.nodeType?(i=n.documentElement,Math.max(n.body["scroll"+e],i["scroll"+e],n.body["offset"+e],i["offset"+e],i["client"+e])):o===t?Y.css(n,r,o,s):Y.style(n,r,o,s)},n,a?o:t,a,null)}})}),e.jQuery=e.$=Y,"function"==typeof define&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return Y})}(window);/*!
* This file creates $ and jQuery variables within the F2 closure scope
*/
var $,jQuery=$=window.jQuery.noConflict(!0);/*!
* Hij1nx requires the following notice to accompany EventEmitter:
*
* Copyright (c) 2011 hij1nx
*
* http://www.twitter.com/hij1nx
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
* documentation files (the 'Software'), to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
* THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
!function(e){function t(){this._events={}}function n(e){e&&(e.delimiter&&(this.delimiter=e.delimiter),e.wildcard&&(this.wildcard=e.wildcard),this.wildcard&&(this.listenerTree={}))}function r(e){this._events={},n.call(this,e)}function o(e,t,n,r){if(!n)return[];var i,a,s,c,l,u,p,f=[],d=t.length,h=t[r],g=t[r+1];if(r===d&&n._listeners){if("function"==typeof n._listeners)return e&&e.push(n._listeners),[n];for(i=0,a=n._listeners.length;a>i;i++)e&&e.push(n._listeners[i]);return[n]}if("*"===h||"**"===h||n[h]){if("*"===h){for(s in n)"_listeners"!==s&&n.hasOwnProperty(s)&&(f=f.concat(o(e,t,n[s],r+1)));return f}if("**"===h){p=r+1===d||r+2===d&&"*"===g,p&&n._listeners&&(f=f.concat(o(e,t,n,d)));for(s in n)"_listeners"!==s&&n.hasOwnProperty(s)&&("*"===s||"**"===s?(n[s]._listeners&&!p&&(f=f.concat(o(e,t,n[s],d))),f=f.concat(o(e,t,n[s],r))):f=s===g?f.concat(o(e,t,n[s],r+2)):f.concat(o(e,t,n[s],r)));return f}f=f.concat(o(e,t,n[h],r+1))}if(c=n["*"],c&&o(e,t,c,r+1),l=n["**"])if(d>r){l._listeners&&o(e,t,l,d);for(s in l)"_listeners"!==s&&l.hasOwnProperty(s)&&(s===g?o(e,t,l[s],r+2):s===h?o(e,t,l[s],r+1):(u={},u[s]=l[s],o(e,t,{"**":u},r+1)))}else l._listeners?o(e,t,l,d):l["*"]&&l["*"]._listeners&&o(e,t,l["*"],d);return f}function i(e,t){e="string"==typeof e?e.split(this.delimiter):e.slice();for(var n=0,r=e.length;r>n+1;n++)if("**"===e[n]&&"**"===e[n+1])return;for(var o=this.listenerTree,i=e.shift();i;){if(o[i]||(o[i]={}),o=o[i],0===e.length){if(o._listeners){if("function"==typeof o._listeners)o._listeners=[o._listeners,t];else if(a(o._listeners)&&(o._listeners.push(t),!o._listeners.warned)){var c=s;this._events.maxListeners!==undefined&&(c=this._events.maxListeners),c>0&&o._listeners.length>c&&(o._listeners.warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",o._listeners.length),console.trace())}}else o._listeners=t;return!0}i=e.shift()}return!0}var a=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},s=10;r.prototype.delimiter=".",r.prototype.setMaxListeners=function(e){this._events||t.call(this),this._events.maxListeners=e},r.prototype.event="",r.prototype.once=function(e,t){return this.many(e,1,t),this},r.prototype.many=function(e,t,n){function r(){0===--t&&o.off(e,r),n.apply(this,arguments)}var o=this;if("function"!=typeof n)throw Error("many only accepts instances of Function");return r._origin=n,this.on(e,r),o},r.prototype.emit=function(){this._events||t.call(this);var e=arguments[0];if("newListener"===e&&!this._events.newListener)return!1;if(this._all){for(var n=arguments.length,r=Array(n-1),i=1;n>i;i++)r[i-1]=arguments[i];for(i=0,n=this._all.length;n>i;i++)this.event=e,this._all[i].apply(this,r)}if("error"===e&&!(this._all||this._events.error||this.wildcard&&this.listenerTree.error))throw arguments[1]instanceof Error?arguments[1]:Error("Uncaught, unspecified 'error' event.");var a;if(this.wildcard){a=[];var s="string"==typeof e?e.split(this.delimiter):e.slice();o.call(this,a,s,this.listenerTree,0)}else a=this._events[e];if("function"==typeof a){if(this.event=e,1===arguments.length)a.call(this);else if(arguments.length>1)switch(arguments.length){case 2:a.call(this,arguments[1]);break;case 3:a.call(this,arguments[1],arguments[2]);break;default:for(var n=arguments.length,r=Array(n-1),i=1;n>i;i++)r[i-1]=arguments[i];a.apply(this,r)}return!0}if(a){for(var n=arguments.length,r=Array(n-1),i=1;n>i;i++)r[i-1]=arguments[i];for(var c=a.slice(),i=0,n=c.length;n>i;i++)this.event=e,c[i].apply(this,r);return c.length>0||this._all}return this._all},r.prototype.on=function(e,n){if("function"==typeof e)return this.onAny(e),this;if("function"!=typeof n)throw Error("on only accepts instances of Function");if(this._events||t.call(this),this.emit("newListener",e,n),this.wildcard)return i.call(this,e,n),this;if(this._events[e]){if("function"==typeof this._events[e])this._events[e]=[this._events[e],n];else if(a(this._events[e])&&(this._events[e].push(n),!this._events[e].warned)){var r=s;this._events.maxListeners!==undefined&&(r=this._events.maxListeners),r>0&&this._events[e].length>r&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),console.trace())}}else this._events[e]=n;return this},r.prototype.onAny=function(e){if(this._all||(this._all=[]),"function"!=typeof e)throw Error("onAny only accepts instances of Function");return this._all.push(e),this},r.prototype.addListener=r.prototype.on,r.prototype.off=function(e,t){if("function"!=typeof t)throw Error("removeListener only takes instances of Function");var n,r=[];if(this.wildcard){var i="string"==typeof e?e.split(this.delimiter):e.slice();r=o.call(this,null,i,this.listenerTree,0)}else{if(!this._events[e])return this;n=this._events[e],r.push({_listeners:n})}for(var s=0;r.length>s;s++){var c=r[s];if(n=c._listeners,a(n)){for(var l=-1,u=0,p=n.length;p>u;u++)if(n[u]===t||n[u].listener&&n[u].listener===t||n[u]._origin&&n[u]._origin===t){l=u;break}if(0>l)return this;this.wildcard?c._listeners.splice(l,1):this._events[e].splice(l,1),0===n.length&&(this.wildcard?delete c._listeners:delete this._events[e])}else(n===t||n.listener&&n.listener===t||n._origin&&n._origin===t)&&(this.wildcard?delete c._listeners:delete this._events[e])}return this},r.prototype.offAny=function(e){var t,n=0,r=0;if(e&&this._all&&this._all.length>0){for(t=this._all,n=0,r=t.length;r>n;n++)if(e===t[n])return t.splice(n,1),this}else this._all=[];return this},r.prototype.removeListener=r.prototype.off,r.prototype.removeAllListeners=function(e){if(0===arguments.length)return!this._events||t.call(this),this;if(this.wildcard)for(var n="string"==typeof e?e.split(this.delimiter):e.slice(),r=o.call(this,null,n,this.listenerTree,0),i=0;r.length>i;i++){var a=r[i];a._listeners=null}else{if(!this._events[e])return this;this._events[e]=null}return this},r.prototype.listeners=function(e){if(this.wildcard){var n=[],r="string"==typeof e?e.split(this.delimiter):e.slice();return o.call(this,n,r,this.listenerTree,0),n}return this._events||t.call(this),this._events[e]||(this._events[e]=[]),a(this._events[e])||(this._events[e]=[this._events[e]]),this._events[e]},r.prototype.listenersAny=function(){return this._all?this._all:[]},e.EventEmitter2=r}("undefined"!=typeof process&&process.title!==void 0&&exports!==void 0?exports:window),/*!
* Øyvind Sean Kinsey and others require the following notice to accompany easyXDM:
*
* http://easyxdm.net/
* Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
function(e,t,n,r,o,i){function a(e,t){var n=typeof e[t];return"function"==n||!("object"!=n||!e[t])||"unknown"==n}function s(e,t){return!("object"!=typeof e[t]||!e[t])}function c(e){return"[object Array]"===Object.prototype.toString.call(e)}function l(){try{var e=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");return T=Array.prototype.slice.call(e.GetVariable("$version").match(/(\d+),(\d+),(\d+),(\d+)/),1),N=parseInt(T[0],10)>9&&parseInt(T[1],10)>0,e=null,!0}catch(t){return!1}}function u(){if(!W){W=!0;for(var e=0;$.length>e;e++)$[e]();$.length=0}}function p(e,t){return W?(e.call(t),void 0):($.push(function(){e.call(t)}),void 0)}function f(){var e=parent;if(""!==D)for(var t=0,n=D.split(".");n.length>t;t++)e=e[n[t]];return e.easyXDM}function d(t){return e.easyXDM=B,D=t,D&&(Q="easyXDM_"+D.replace(".","_")+"_"),L}function h(e){return e.match(M)[3]}function g(e){return e.match(M)[4]||""}function m(e){var t=e.toLowerCase().match(M),n=t[2],r=t[3],o=t[4]||"";return("http:"==n&&":80"==o||"https:"==n&&":443"==o)&&(o=""),n+"//"+r+o}function y(e){if(e=e.replace(H,"$1/"),!e.match(/^(http||https):\/\//)){var t="/"===e.substring(0,1)?"":n.pathname;"/"!==t.substring(t.length-1)&&(t=t.substring(0,t.lastIndexOf("/")+1)),e=n.protocol+"//"+n.host+t+e}for(;P.test(e);)e=e.replace(P,"");return e}function v(e,t){var n="",r=e.indexOf("#");-1!==r&&(n=e.substring(r),e=e.substring(0,r));var o=[];for(var a in t)t.hasOwnProperty(a)&&o.push(a+"="+i(t[a]));return e+(U?"#":-1==e.indexOf("?")?"?":"&")+o.join("&")+n}function b(e){return e===void 0}function _(e,t,n){var r;for(var o in t)t.hasOwnProperty(o)&&(o in e?(r=t[o],"object"==typeof r?_(e[o],r,n):n||(e[o]=t[o])):e[o]=t[o]);return e}function C(){var e=t.body.appendChild(t.createElement("form")),n=e.appendChild(t.createElement("input"));n.name=Q+"TEST"+O,E=n!==e.elements[n.name],t.body.removeChild(e)}function x(e){b(E)&&C();var n;E?n=t.createElement('<iframe name="'+e.props.name+'"/>'):(n=t.createElement("IFRAME"),n.name=e.props.name),n.id=n.name=e.props.name,delete e.props.name,e.onLoad&&R(n,"load",e.onLoad),"string"==typeof e.container&&(e.container=t.getElementById(e.container)),e.container||(_(n.style,{position:"absolute",top:"-2000px"}),e.container=t.body);var r=e.props.src;return delete e.props.src,_(n,e.props),n.border=n.frameBorder=0,n.allowTransparency=!0,e.container.appendChild(n),n.src=r,e.props.src=r,n}function w(e,t){"string"==typeof e&&(e=[e]);for(var n,r=e.length;r--;)if(n=e[r],n=RegExp("^"==n.substr(0,1)?n:"^"+n.replace(/(\*)/g,".$1").replace(/\?/g,".")+"$"),n.test(t))return!0;return!1}function A(r){var o,i=r.protocol;if(r.isHost=r.isHost||b(J.xdm_p),U=r.hash||!1,r.props||(r.props={}),r.isHost)r.remote=y(r.remote),r.channel=r.channel||"default"+O++,r.secret=Math.random().toString(16).substring(2),b(i)&&(m(n.href)==m(r.remote)?i="4":a(e,"postMessage")||a(t,"postMessage")?i="1":r.swf&&a(e,"ActiveXObject")&&l()?i="6":"Gecko"===navigator.product&&"frameElement"in e&&-1==navigator.userAgent.indexOf("WebKit")?i="5":r.remoteHelper?(r.remoteHelper=y(r.remoteHelper),i="2"):i="0");else if(r.channel=J.xdm_c,r.secret=J.xdm_s,r.remote=J.xdm_e,i=J.xdm_p,r.acl&&!w(r.acl,r.remote))throw Error("Access denied for "+r.remote);switch(r.protocol=i,i){case"0":if(_(r,{interval:100,delay:2e3,useResize:!0,useParent:!1,usePolling:!1},!0),r.isHost){if(!r.local){for(var s,c=n.protocol+"//"+n.host,u=t.body.getElementsByTagName("img"),p=u.length;p--;)if(s=u[p],s.src.substring(0,c.length)===c){r.local=s.src;break}r.local||(r.local=e)}var f={xdm_c:r.channel,xdm_p:0};r.local===e?(r.usePolling=!0,r.useParent=!0,r.local=n.protocol+"//"+n.host+n.pathname+n.search,f.xdm_e=r.local,f.xdm_pa=1):f.xdm_e=y(r.local),r.container&&(r.useResize=!1,f.xdm_po=1),r.remote=v(r.remote,f)}else _(r,{channel:J.xdm_c,remote:J.xdm_e,useParent:!b(J.xdm_pa),usePolling:!b(J.xdm_po),useResize:r.useParent?!1:r.useResize});o=[new L.stack.HashTransport(r),new L.stack.ReliableBehavior({}),new L.stack.QueueBehavior({encode:!0,maxLength:4e3-r.remote.length}),new L.stack.VerifyBehavior({initiate:r.isHost})];break;case"1":o=[new L.stack.PostMessageTransport(r)];break;case"2":o=[new L.stack.NameTransport(r),new L.stack.QueueBehavior,new L.stack.VerifyBehavior({initiate:r.isHost})];break;case"3":o=[new L.stack.NixTransport(r)];break;case"4":o=[new L.stack.SameOriginTransport(r)];break;case"5":o=[new L.stack.FrameElementTransport(r)];break;case"6":T||l(),o=[new L.stack.FlashTransport(r)]}return o.push(new L.stack.QueueBehavior({lazy:r.lazy,remove:!0})),o}function F(e){for(var t,n={incoming:function(e,t){this.up.incoming(e,t)},outgoing:function(e,t){this.down.outgoing(e,t)},callback:function(e){this.up.callback(e)},init:function(){this.down.init()},destroy:function(){this.down.destroy()}},r=0,o=e.length;o>r;r++)t=e[r],_(t,n,!0),0!==r&&(t.down=e[r-1]),r!==o-1&&(t.up=e[r+1]);return t}function k(e){e.up.down=e.down,e.down.up=e.up,e.up=e.down=null}var E,T,N,R,S,j=this,O=Math.floor(1e4*Math.random()),I=Function.prototype,M=/^((http.?:)\/\/([^:\/\s]+)(:\d+)*)/,P=/[\-\w]+\/\.\.\//,H=/([^:])\/\//g,D="",L={},B=e.easyXDM,Q="easyXDM_",U=!1;if(a(e,"addEventListener"))R=function(e,t,n){e.addEventListener(t,n,!1)},S=function(e,t,n){e.removeEventListener(t,n,!1)};else{if(!a(e,"attachEvent"))throw Error("Browser not supported");R=function(e,t,n){e.attachEvent("on"+t,n)},S=function(e,t,n){e.detachEvent("on"+t,n)}}var q,W=!1,$=[];if("readyState"in t?(q=t.readyState,W="complete"==q||~navigator.userAgent.indexOf("AppleWebKit/")&&("loaded"==q||"interactive"==q)):W=!!t.body,!W){if(a(e,"addEventListener"))R(t,"DOMContentLoaded",u);else if(R(t,"readystatechange",function(){"complete"==t.readyState&&u()}),t.documentElement.doScroll&&e===top){var z=function(){if(!W){try{t.documentElement.doScroll("left")}catch(e){return r(z,1),void 0}u()}};z()}R(e,"load",u)}var J=function(e){e=e.substring(1).split("&");for(var t,n={},r=e.length;r--;)t=e[r].split("="),n[t[0]]=o(t[1]);return n}(/xdm_e=/.test(n.search)?n.search:n.hash),V=function(){var e={},t={a:[1,2,3]},n='{"a":[1,2,3]}';return"undefined"!=typeof JSON&&"function"==typeof JSON.stringify&&JSON.stringify(t).replace(/\s/g,"")===n?JSON:(Object.toJSON&&Object.toJSON(t).replace(/\s/g,"")===n&&(e.stringify=Object.toJSON),"function"==typeof String.prototype.evalJSON&&(t=n.evalJSON(),t.a&&3===t.a.length&&3===t.a[2]&&(e.parse=function(e){return e.evalJSON()})),e.stringify&&e.parse?(V=function(){return e},e):null)};_(L,{version:"2.4.15.118",query:J,stack:{},apply:_,getJSONObject:V,whenReady:p,noConflict:d}),L.DomHelper={on:R,un:S,requiresJSON:function(n){s(e,"JSON")||t.write('<script type="text/javascript" src="'+n+'"><'+"/script>")}},function(){var e={};L.Fn={set:function(t,n){e[t]=n},get:function(t,n){var r=e[t];return n&&delete e[t],r}}}(),L.Socket=function(e){var t=F(A(e).concat([{incoming:function(t,n){e.onMessage(t,n)},callback:function(t){e.onReady&&e.onReady(t)}}])),n=m(e.remote);this.origin=m(e.remote),this.destroy=function(){t.destroy()},this.postMessage=function(e){t.outgoing(e,n)},t.init()},L.Rpc=function(e,t){if(t.local)for(var n in t.local)if(t.local.hasOwnProperty(n)){var r=t.local[n];"function"==typeof r&&(t.local[n]={method:r})}var o=F(A(e).concat([new L.stack.RpcBehavior(this,t),{callback:function(t){e.onReady&&e.onReady(t)}}]));this.origin=m(e.remote),this.destroy=function(){o.destroy()},o.init()},L.stack.SameOriginTransport=function(e){var t,o,i,a;return t={outgoing:function(e,t,n){i(e),n&&n()},destroy:function(){o&&(o.parentNode.removeChild(o),o=null)},onDOMReady:function(){a=m(e.remote),e.isHost?(_(e.props,{src:v(e.remote,{xdm_e:n.protocol+"//"+n.host+n.pathname,xdm_c:e.channel,xdm_p:4}),name:Q+e.channel+"_provider"}),o=x(e),L.Fn.set(e.channel,function(e){return i=e,r(function(){t.up.callback(!0)},0),function(e){t.up.incoming(e,a)}})):(i=f().Fn.get(e.channel,!0)(function(e){t.up.incoming(e,a)}),r(function(){t.up.callback(!0)},0))},init:function(){p(t.onDOMReady,t)}}},L.stack.FlashTransport=function(e){function o(e){r(function(){a.up.incoming(e,c)},0)}function i(n){var r=e.swf+"?host="+e.isHost,o="easyXDM_swf_"+Math.floor(1e4*Math.random());L.Fn.set("flash_loaded"+n.replace(/[\-.]/g,"_"),function(){L.stack.FlashTransport[n].swf=l=u.firstChild;for(var e=L.stack.FlashTransport[n].queue,t=0;e.length>t;t++)e[t]();e.length=0}),e.swfContainer?u="string"==typeof e.swfContainer?t.getElementById(e.swfContainer):e.swfContainer:(u=t.createElement("div"),_(u.style,N&&e.swfNoThrottle?{height:"20px",width:"20px",position:"fixed",right:0,top:0}:{height:"1px",width:"1px",position:"absolute",overflow:"hidden",right:0,top:0}),t.body.appendChild(u));var i="callback=flash_loaded"+n.replace(/[\-.]/g,"_")+"&proto="+j.location.protocol+"&domain="+h(j.location.href)+"&port="+g(j.location.href)+"&ns="+D;u.innerHTML="<object height='20' width='20' type='application/x-shockwave-flash' id='"+o+"' data='"+r+"'>"+"<param name='allowScriptAccess' value='always'></param>"+"<param name='wmode' value='transparent'>"+"<param name='movie' value='"+r+"'></param>"+"<param name='flashvars' value='"+i+"'></param>"+"<embed type='application/x-shockwave-flash' FlashVars='"+i+"' allowScriptAccess='always' wmode='transparent' src='"+r+"' height='1' width='1'></embed>"+"</object>"}var a,s,c,l,u;return a={outgoing:function(t,n,r){l.postMessage(e.channel,""+t),r&&r()},destroy:function(){try{l.destroyChannel(e.channel)}catch(t){}l=null,s&&(s.parentNode.removeChild(s),s=null)},onDOMReady:function(){c=e.remote,L.Fn.set("flash_"+e.channel+"_init",function(){r(function(){a.up.callback(!0)})}),L.Fn.set("flash_"+e.channel+"_onMessage",o),e.swf=y(e.swf);var t=h(e.swf),u=function(){L.stack.FlashTransport[t].init=!0,l=L.stack.FlashTransport[t].swf,l.createChannel(e.channel,e.secret,m(e.remote),e.isHost),e.isHost&&(N&&e.swfNoThrottle&&_(e.props,{position:"fixed",right:0,top:0,height:"20px",width:"20px"}),_(e.props,{src:v(e.remote,{xdm_e:m(n.href),xdm_c:e.channel,xdm_p:6,xdm_s:e.secret}),name:Q+e.channel+"_provider"}),s=x(e))};L.stack.FlashTransport[t]&&L.stack.FlashTransport[t].init?u():L.stack.FlashTransport[t]?L.stack.FlashTransport[t].queue.push(u):(L.stack.FlashTransport[t]={queue:[u]},i(t))},init:function(){p(a.onDOMReady,a)}}},L.stack.PostMessageTransport=function(t){function o(e){if(e.origin)return m(e.origin);if(e.uri)return m(e.uri);if(e.domain)return n.protocol+"//"+e.domain;throw"Unable to retrieve the origin of the event"}function i(e){var n=o(e);n==l&&e.data.substring(0,t.channel.length+1)==t.channel+" "&&a.up.incoming(e.data.substring(t.channel.length+1),n)}var a,s,c,l;return a={outgoing:function(e,n,r){c.postMessage(t.channel+" "+e,n||l),r&&r()},destroy:function(){S(e,"message",i),s&&(c=null,s.parentNode.removeChild(s),s=null)},onDOMReady:function(){if(l=m(t.remote),t.isHost){var o=function(n){n.data==t.channel+"-ready"&&(c="postMessage"in s.contentWindow?s.contentWindow:s.contentWindow.document,S(e,"message",o),R(e,"message",i),r(function(){a.up.callback(!0)},0))};R(e,"message",o),_(t.props,{src:v(t.remote,{xdm_e:m(n.href),xdm_c:t.channel,xdm_p:1}),name:Q+t.channel+"_provider"}),s=x(t)}else R(e,"message",i),c="postMessage"in e.parent?e.parent:e.parent.document,c.postMessage(t.channel+"-ready",l),r(function(){a.up.callback(!0)},0)},init:function(){p(a.onDOMReady,a)}}},L.stack.FrameElementTransport=function(o){var i,a,s,c;return i={outgoing:function(e,t,n){s.call(this,e),n&&n()},destroy:function(){a&&(a.parentNode.removeChild(a),a=null)},onDOMReady:function(){c=m(o.remote),o.isHost?(_(o.props,{src:v(o.remote,{xdm_e:m(n.href),xdm_c:o.channel,xdm_p:5}),name:Q+o.channel+"_provider"}),a=x(o),a.fn=function(e){return delete a.fn,s=e,r(function(){i.up.callback(!0)},0),function(e){i.up.incoming(e,c)}}):(t.referrer&&m(t.referrer)!=J.xdm_e&&(e.top.location=J.xdm_e),s=e.frameElement.fn(function(e){i.up.incoming(e,c)}),i.up.callback(!0))},init:function(){p(i.onDOMReady,i)}}},L.stack.NameTransport=function(e){function t(t){var n=e.remoteHelper+(s?"#_3":"#_2")+e.channel;c.contentWindow.sendMessage(t,n)}function n(){s?2!==++u&&s||a.up.callback(!0):(t("ready"),a.up.callback(!0))}function o(e){a.up.incoming(e,d)}function i(){f&&r(function(){f(!0)},0)}var a,s,c,l,u,f,d,h;return a={outgoing:function(e,n,r){f=r,t(e)},destroy:function(){c.parentNode.removeChild(c),c=null,s&&(l.parentNode.removeChild(l),l=null)},onDOMReady:function(){s=e.isHost,u=0,d=m(e.remote),e.local=y(e.local),s?(L.Fn.set(e.channel,function(t){s&&"ready"===t&&(L.Fn.set(e.channel,o),n())}),h=v(e.remote,{xdm_e:e.local,xdm_c:e.channel,xdm_p:2}),_(e.props,{src:h+"#"+e.channel,name:Q+e.channel+"_provider"}),l=x(e)):(e.remoteHelper=e.remote,L.Fn.set(e.channel,o)),c=x({props:{src:e.local+"#_4"+e.channel},onLoad:function t(){var o=c||this;S(o,"load",t),L.Fn.set(e.channel+"_load",i),function a(){"function"==typeof o.contentWindow.sendMessage?n():r(a,50)}()}})},init:function(){p(a.onDOMReady,a)}}},L.stack.HashTransport=function(t){function n(e){if(g){var n=t.remote+"#"+d++ +"_"+e;(c||!y?g.contentWindow:g).location=n}}function o(e){f=e,s.up.incoming(f.substring(f.indexOf("_")+1),v)}function i(){if(h){var e=h.location.href,t="",n=e.indexOf("#");-1!=n&&(t=e.substring(n)),t&&t!=f&&o(t)}}function a(){l=setInterval(i,u)}var s,c,l,u,f,d,h,g,y,v;return s={outgoing:function(e){n(e)},destroy:function(){e.clearInterval(l),(c||!y)&&g.parentNode.removeChild(g),g=null},onDOMReady:function(){if(c=t.isHost,u=t.interval,f="#"+t.channel,d=0,y=t.useParent,v=m(t.remote),c){if(t.props={src:t.remote,name:Q+t.channel+"_provider"},y)t.onLoad=function(){h=e,a(),s.up.callback(!0)};else{var n=0,o=t.delay/50;(function i(){if(++n>o)throw Error("Unable to reference listenerwindow");try{h=g.contentWindow.frames[Q+t.channel+"_consumer"]}catch(e){}h?(a(),s.up.callback(!0)):r(i,50)})()}g=x(t)}else h=e,a(),y?(g=parent,s.up.callback(!0)):(_(t,{props:{src:t.remote+"#"+t.channel+new Date,name:Q+t.channel+"_consumer"},onLoad:function(){s.up.callback(!0)}}),g=x(t))},init:function(){p(s.onDOMReady,s)}}},L.stack.ReliableBehavior=function(){var e,t,n=0,r=0,o="";return e={incoming:function(i,a){var s=i.indexOf("_"),c=i.substring(0,s).split(",");i=i.substring(s+1),c[0]==n&&(o="",t&&t(!0)),i.length>0&&(e.down.outgoing(c[1]+","+n+"_"+o,a),r!=c[1]&&(r=c[1],e.up.incoming(i,a)))},outgoing:function(i,a,s){o=i,t=s,e.down.outgoing(r+","+ ++n+"_"+i,a)}}},L.stack.QueueBehavior=function(e){function t(){if(e.remove&&0===s.length)return k(n),void 0;if(!c&&0!==s.length&&!a){c=!0;var o=s.shift();n.down.outgoing(o.data,o.origin,function(e){c=!1,o.callback&&r(function(){o.callback(e)},0),t()})}}var n,a,s=[],c=!0,l="",u=0,p=!1,f=!1;return n={init:function(){b(e)&&(e={}),e.maxLength&&(u=e.maxLength,f=!0),e.lazy?p=!0:n.down.init()},callback:function(e){c=!1;var r=n.up;t(),r.callback(e)},incoming:function(t,r){if(f){var i=t.indexOf("_"),a=parseInt(t.substring(0,i),10);l+=t.substring(i+1),0===a&&(e.encode&&(l=o(l)),n.up.incoming(l,r),l="")}else n.up.incoming(t,r)},outgoing:function(r,o,a){e.encode&&(r=i(r));var c,l=[];if(f){for(;0!==r.length;)c=r.substring(0,u),r=r.substring(c.length),l.push(c);for(;c=l.shift();)s.push({data:l.length+"_"+c,origin:o,callback:0===l.length?a:null})}else s.push({data:r,origin:o,callback:a});p?n.down.init():t()},destroy:function(){a=!0,n.down.destroy()}}},L.stack.VerifyBehavior=function(e){function t(){r=Math.random().toString(16).substring(2),n.down.outgoing(r)}var n,r,o;return n={incoming:function(i,a){var s=i.indexOf("_");-1===s?i===r?n.up.callback(!0):o||(o=i,e.initiate||t(),n.down.outgoing(i)):i.substring(0,s)===o&&n.up.incoming(i.substring(s+1),a)},outgoing:function(e,t,o){n.down.outgoing(r+"_"+e,t,o)},callback:function(){e.initiate&&t()}}},L.stack.RpcBehavior=function(e,t){function n(e){e.jsonrpc="2.0",i.down.outgoing(a.stringify(e))}function r(e,t){var r=Array.prototype.slice;return function(){var o,i=arguments.length,a={method:t};i>0&&"function"==typeof arguments[i-1]?(i>1&&"function"==typeof arguments[i-2]?(o={success:arguments[i-2],error:arguments[i-1]},a.params=r.call(arguments,0,i-2)):(o={success:arguments[i-1]},a.params=r.call(arguments,0,i-1)),l[""+ ++s]=o,a.id=s):a.params=r.call(arguments,0),e.namedParams&&1===a.params.length&&(a.params=a.params[0]),n(a)}}function o(e,t,r,o){if(!r)return t&&n({id:t,error:{code:-32601,message:"Procedure not found."}}),void 0;var i,a;t?(i=function(e){i=I,n({id:t,result:e})},a=function(e,r){a=I;var o={id:t,error:{code:-32099,message:e}};r&&(o.error.data=r),n(o)}):i=a=I,c(o)||(o=[o]);try{var s=r.method.apply(r.scope,o.concat([i,a]));b(s)||i(s)}catch(l){a(l.message)}}var i,a=t.serializer||V(),s=0,l={};return i={incoming:function(e){var r=a.parse(e);if(r.method)t.handle?t.handle(r,n):o(r.method,r.id,t.local[r.method],r.params);else{var i=l[r.id];r.error?i.error&&i.error(r.error):i.success&&i.success(r.result),delete l[r.id]}},init:function(){if(t.remote)for(var n in t.remote)t.remote.hasOwnProperty(n)&&(e[n]=r(t.remote[n],n));i.down.init()},destroy:function(){for(var n in t.remote)t.remote.hasOwnProperty(n)&&e.hasOwnProperty(n)&&delete e[n];i.down.destroy()}}},j.easyXDM=L}(window,document,location,window.setTimeout,decodeURIComponent,encodeURIComponent);/*!
* F2 v1.2.2 08-22-2013
* Copyright (c) 2013 Markit On Demand, Inc. http://www.openf2.org
*
* "F2" is licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed
* under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*
* Please note that F2 ("Software") may contain third party material that Markit
* On Demand Inc. has a license to use and include within the Software (the
* "Third Party Material"). A list of the software comprising the Third Party Material
* and the terms and conditions under which such Third Party Material is distributed
* are reproduced in the ThirdPartyMaterial.md file available at:
*
* https://github.com/OpenF2/F2/blob/master/ThirdPartyMaterial.md
*
* The inclusion of the Third Party Material in the Software does not grant, provide
* nor result in you having acquiring any rights whatsoever, other than as stipulated
* in the terms and conditions related to the specific Third Party Material, if any.
*
*/
var F2;F2=function(){var e=function(e,n){function r(e){var t=[];return e.replace(/^(\.\.?(\/|$))+/,"").replace(/\/(\.(\/|$))+/g,"/").replace(/\/\.\.$/,"/../").replace(/\/?[^\/]*/g,function(e){"/.."===e?t.pop():t.push(e)}),t.join("").replace(/^\//,"/"===e.charAt(0)?"/":"")}return n=t(n||""),e=t(e||""),n&&e?(n.protocol||e.protocol)+(n.protocol||n.authority?n.authority:e.authority)+r(n.protocol||n.authority||"/"===n.pathname.charAt(0)?n.pathname:n.pathname?(e.authority&&!e.pathname?"/":"")+e.pathname.slice(0,e.pathname.lastIndexOf("/")+1)+n.pathname:e.pathname)+(n.protocol||n.authority||n.pathname?n.search:n.search||e.search)+n.hash:null},t=function(e){var t=(e+"").replace(/^\s+|\s+$/g,"").match(/^([^:\/?#]+:)?(\/\/(?:[^:@]*(?::[^:@]*)?@)?(([^:\/?#]*)(?::(\d*))?))?([^?#]*)(\?[^#]*)?(#[\s\S]*)?/);return t?{href:t[0]||"",protocol:t[1]||"",authority:t[2]||"",host:t[3]||"",hostname:t[4]||"",port:t[5]||"",pathname:t[6]||"",search:t[7]||"",hash:t[8]||""}:null};return{appConfigReplacer:function(e,t){return"root"==e||"ui"==e||"height"==e?void 0:t},Apps:{},extend:function(e,t,n){var r="function"==typeof t,o=e?e.split("."):[],i=this;t=t||{},"F2"===o[0]&&(o=o.slice(1));for(var a=0,s=o.length;s>a;a++)i[o[a]]||(i[o[a]]=r&&a+1==s?t:{}),i=i[o[a]];if(!r)for(var c in t)(i[c]===void 0||n)&&(i[c]=t[c]);return i},guid:function(){var e=function(){return(0|65536*(1+Math.random())).toString(16).substring(1)};return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()},inArray:function(e,t){return jQuery.inArray(e,t)>-1},isLocalRequest:function(t){var n,r,o=/^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,i=t.toLowerCase(),a=o.exec(i);try{n=location.href}catch(s){n=document.createElement("a"),n.href="",n=n.href}n=n.toLowerCase(),a||(i=e(n,i).toLowerCase(),a=o.exec(i)),r=o.exec(n)||[];var c=!(a&&(a[1]!==r[1]||a[2]!==r[2]||(a[3]||("http:"===a[1]?"80":"443"))!==(r[3]||("http:"===r[1]?"80":"443"))));return c},isNativeDOMNode:function(e){var t="object"==typeof Node?e instanceof Node:e&&"object"==typeof e&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName,n="object"==typeof HTMLElement?e instanceof HTMLElement:e&&"object"==typeof e&&1===e.nodeType&&"string"==typeof e.nodeName;return t||n},log:function(){for(var e,t,n,r="log",o=function(){},i=["assert","clear","count","debug","dir","dirxml","error","exception","group","groupCollapsed","groupEnd","info","log","markTimeline","profile","profileEnd","table","time","timeEnd","timeStamp","trace","warn"],a=i.length,s=window.console=window.console||{};a--;)t=i[a],s[t]||(s[t]=o),arguments&&arguments.length>1&&arguments[0]==t&&(r=t,n=Array.prototype.slice.call(arguments,1));e=Function.prototype.bind?Function.prototype.bind.call(s[r],s):function(){Function.prototype.apply.call(s[r],s,n||arguments)},e.apply(this,n||arguments)},parse:function(e){return JSON.parse(e)},stringify:function(e,t,n){return JSON.stringify(e,t,n)},version:function(){return"{{sdk.version}}"}}}(),F2.extend("AppHandlers",function(){var e=F2.guid(),t=F2.guid(),n={appCreateRoot:[],appRenderBefore:[],appDestroyBefore:[],appRenderAfter:[],appDestroyAfter:[],appRender:[],appDestroy:[]},r={appRender:function(e,t){var n=null;F2.isNativeDOMNode(e.root)?(n=jQuery(e.root),n.append(t)):(e.root=jQuery(t).get(0),n=jQuery(e.root)),jQuery("body").append(n)},appDestroy:function(e){e&&e.app&&e.app.destroy&&"function"==typeof e.app.destroy?e.app.destroy():e&&e.app&&e.app.destroy&&F2.log(e.config.appId+" has a destroy property, but destroy is not of type function and as such will not be executed."),jQuery(e.config.root).fadeOut(500,function(){jQuery(this).remove()})}},o=function(e,t,n,r){i(e);var o={func:n,namespace:t,domNode:F2.isNativeDOMNode(n)?n:null};if(!o.func&&!o.domNode)throw"Invalid or null argument passed. Handler will not be added to collection. A valid dom element or callback function is required.";if(o.domNode&&!r)throw"Invalid argument passed. Handler will not be added to collection. A callback function is required for this event type.";return o},i=function(n){if(e!=n&&t!=n)throw"Invalid token passed. Please verify that you have correctly received and stored token from F2.AppHandlers.getToken()."},a=function(e,t,r){if(i(e),r||t)if(!r&&t)n[t]=[];else if(r&&!t){r=r.toLowerCase();for(var o in n){for(var a=n[o],s=[],c=0,l=a.length;l>c;c++){var u=a[c];u&&(u.namespace&&u.namespace.toLowerCase()==r||s.push(u))}a=s}}else if(r&&n[t]){r=r.toLowerCase();for(var p=[],f=0,d=n[t].length;d>f;f++){var h=n[t][f];h&&(h.namespace&&h.namespace.toLowerCase()==r||p.push(h))}n[t]=p}};return{getToken:function(){return delete this.getToken,e},__f2GetToken:function(){return delete this.__f2GetToken,t},__trigger:function(e,o){if(e!=t)throw"Token passed is invalid. Only F2 is allowed to call F2.AppHandlers.__trigger().";if(!n||!n[o])throw"Invalid EventKey passed. Check your inputs and try again.";for(var i=[],a=2,s=arguments.length;s>a;a++)i.push(arguments[a]);if(0===n[o].length&&r[o])return r[o].apply(F2,i),this;if(0===n[o].length&&!n[o])return this;for(var c=0,l=n[o].length;l>c;c++){var u=n[o][c];if(u.domNode&&arguments[2]&&arguments[2].root&&arguments[3]){var p=jQuery(arguments[2].root).append(arguments[3]);jQuery(u.domNode).append(p)}else u.domNode&&arguments[2]&&!arguments[2].root&&arguments[3]?(arguments[2].root=jQuery(arguments[3]).get(0),jQuery(u.domNode).append(arguments[2].root)):u.func.apply(F2,i)}return this},on:function(e,t,r){var i=null;if(!t)throw"eventKey must be of type string and not null. For available appHandlers check F2.Constants.AppHandlers.";if(t.indexOf(".")>-1){var a=t.split(".");t=a[0],i=a[1]}if(!n||!n[t])throw"Invalid EventKey passed. Check your inputs and try again.";return n[t].push(o(e,i,r,"appRender"==t)),this},off:function(e,t){var r=null;if(!t)throw"eventKey must be of type string and not null. For available appHandlers check F2.Constants.AppHandlers.";if(t.indexOf(".")>-1){var o=t.split(".");t=o[0],r=o[1]}if(!n||!n[t])throw"Invalid EventKey passed. Check your inputs and try again.";return a(e,t,r),this}}}()),F2.extend("Constants",{AppHandlers:function(){return{APP_CREATE_ROOT:"appCreateRoot",APP_RENDER_BEFORE:"appRenderBefore",APP_RENDER:"appRender",APP_RENDER_AFTER:"appRenderAfter",APP_DESTROY_BEFORE:"appDestroyBefore",APP_DESTROY:"appDestroy",APP_DESTROY_AFTER:"appDestroyAfter"}}()}),F2.extend("",{App:function(){return{init:function(){}}},AppConfig:{appId:"",context:{},enableBatchRequests:!1,height:0,instanceId:"",isSecure:!1,manifestUrl:"",maxWidth:0,minGridSize:4,minWidth:300,name:"",root:void 0,ui:void 0,views:[]},AppManifest:{apps:[],inlineScripts:[],scripts:[],styles:[]},AppContent:{data:{},html:"",status:""},ContainerConfig:{afterAppRender:function(){},appRender:function(){},beforeAppRender:function(){},debugMode:!1,scriptErrorTimeout:7e3,isSecureAppPage:!1,secureAppPagePath:"",supportedViews:[],UI:{Mask:{backgroundColor:"#FFF",loadingIcon:"",opacity:.6,useClasses:!1,zIndex:2}},xhr:{dataType:function(){},type:function(){},url:function(){}}}}),F2.extend("Constants",{Css:function(){var e="f2-";return{APP:e+"app",APP_CONTAINER:e+"app-container",APP_TITLE:e+"app-title",APP_VIEW:e+"app-view",APP_VIEW_TRIGGER:e+"app-view-trigger",MASK:e+"mask",MASK_CONTAINER:e+"mask-container"}}(),Events:function(){var e="App.",t="Container.";return{APP_SYMBOL_CHANGE:e+"symbolChange",APP_WIDTH_CHANGE:e+"widthChange.",CONTAINER_SYMBOL_CHANGE:t+"symbolChange",CONTAINER_WIDTH_CHANGE:t+"widthChange"}}(),JSONP_CALLBACK:"F2_jsonpCallback_",Sockets:{EVENT:"__event__",LOAD:"__socketLoad__",RPC:"__rpc__",RPC_CALLBACK:"__rpcCallback__",UI_RPC:"__uiRpc__"},Views:{DATA_ATTRIBUTE:"data-f2-view",ABOUT:"about",HELP:"help",HOME:"home",REMOVE:"remove",SETTINGS:"settings"}}),F2.extend("Events",function(){var e=new EventEmitter2({wildcard:!0});return e.setMaxListeners(0),{_socketEmit:function(){return EventEmitter2.prototype.emit.apply(e,[].slice.call(arguments))},emit:function(){return F2.Rpc.broadcast(F2.Constants.Sockets.EVENT,[].slice.call(arguments)),EventEmitter2.prototype.emit.apply(e,[].slice.call(arguments))},many:function(t,n,r){return e.many(t,n,r)},off:function(t,n){return e.off(t,n)},on:function(t,n){return e.on(t,n)},once:function(t,n){return e.once(t,n)}}}()),F2.extend("Rpc",function(){var e={},t="",n={},r=RegExp("^"+F2.Constants.Sockets.EVENT),o=RegExp("^"+F2.Constants.Sockets.RPC),i=RegExp("^"+F2.Constants.Sockets.RPC_CALLBACK),a=RegExp("^"+F2.Constants.Sockets.LOAD),s=RegExp("^"+F2.Constants.Sockets.UI_RPC),c=function(){var e,t=!1,r=[],o=new easyXDM.Socket({onMessage:function(i,s){if(!t&&a.test(i)){i=i.replace(a,"");var c=F2.parse(i);2==c.length&&(e=c[0],n[e.instanceId]={config:e,socket:o},F2.registerApps([e],[c[1]]),jQuery.each(r,function(){p(e,i,s)}),t=!0)}else t?p(e,i,s):r.push(i)}})},l=function(e,n){var r=jQuery(e.root);if(r.is("."+F2.Constants.Css.APP_CONTAINER)||r.find("."+F2.Constants.Css.APP_CONTAINER),!r.length)return F2.log("Unable to locate app in order to establish secure connection."),void 0;var o={scrolling:"no",style:{width:"100%"}};e.height&&(o.style.height=e.height+"px");var i=new easyXDM.Socket({remote:t,container:r.get(0),props:o,onMessage:function(t,n){p(e,t,n)},onReady:function(){i.postMessage(F2.Constants.Sockets.LOAD+F2.stringify([e,n],F2.appConfigReplacer))}});return i},u=function(e,t){return function(){F2.Rpc.call(e,F2.Constants.Sockets.RPC_CALLBACK,t,[].slice.call(arguments).slice(2))}},p=function(t,n){function a(e,t){for(var n=(t+"").split("."),r=0;n.length>r;r++){if(void 0===e[n[r]]){e=void 0;break}e=e[n[r]]}return e}function c(e,t,n){var r=F2.parse(t.replace(e,""));return r.params&&r.params.length&&r.callbacks&&r.callbacks.length&&jQuery.each(r.callbacks,function(e,t){jQuery.each(r.params,function(e,o){t==o&&(r.params[e]=u(n,t))})}),r}var l,p;s.test(n)?(l=c(s,n,t.instanceId),p=a(t.ui,l.functionName),void 0!==p?p.apply(t.ui,l.params):F2.log("Unable to locate UI RPC function: "+l.functionName)):o.test(n)?(l=c(o,n,t.instanceId),p=a(window,l.functionName),void 0!==p?p.apply(p,l.params):F2.log("Unable to locate RPC function: "+l.functionName)):i.test(n)?(l=c(i,n,t.instanceId),void 0!==e[l.functionName]&&(e[l.functionName].apply(e[l.functionName],l.params),delete e[l.functionName])):r.test(n)&&(l=c(r,n,t.instanceId),F2.Events._socketEmit.apply(F2.Events,l))},f=function(t){var n=F2.guid();return e[n]=t,n};return{broadcast:function(e,t){var r=e+F2.stringify(t);jQuery.each(n,function(e,t){t.socket.postMessage(r)})},call:function(e,t,r,o){var i=[];jQuery.each(o,function(e,t){if("function"==typeof t){var n=f(t);o[e]=n,i.push(n)}}),n[e].socket.postMessage(t+F2.stringify({functionName:r,params:o,callbacks:i}))},init:function(e){t=e,t||c()},isRemote:function(e){return void 0!==n[e]&&n[e].config.isSecure&&0===jQuery(n[e].config.root).find("iframe").length},register:function(e,t){e&&t?n[e.instanceId]={config:e,socket:l(e,t)}:F2.log("Unable to register socket connection. Please check container configuration.")}}}()),F2.extend("UI",function(){var e,t=function(e){var t=e,n=jQuery(e.root),r=function(e){e=e||jQuery(t.root).outerHeight(),F2.Rpc.isRemote(t.instanceId)?F2.Rpc.call(t.instanceId,F2.Constants.Sockets.UI_RPC,"updateHeight",[e]):(t.height=e,n.find("iframe").height(t.height))};return{hideMask:function(e){F2.UI.hideMask(t.instanceId,e)},Modals:function(){var e=function(e){return['<div class="modal">','<header class="modal-header">',"<h3>Alert!</h3>","</header>",'<div class="modal-body">',"<p>",e,"</p>","</div>",'<div class="modal-footer">','<button class="btn btn-primary btn-ok">OK</button>',"</div>","</div>"].join("")},n=function(e){return['<div class="modal">','<header class="modal-header">',"<h3>Confirm</h3>","</header>",'<div class="modal-body">',"<p>",e,"</p>","</div>",'<div class="modal-footer">','<button type="button" class="btn btn-primary btn-ok">OK</button>','<button type="button" class="btn btn-cancel">Cancel</button">',"</div>","</div>"].join("")};return{alert:function(n,r){return F2.isInit()?(F2.Rpc.isRemote(t.instanceId)?F2.Rpc.call(t.instanceId,F2.Constants.Sockets.UI_RPC,"Modals.alert",[].slice.call(arguments)):jQuery(e(n)).on("show",function(){var e=this;jQuery(e).find(".btn-primary").on("click",function(){jQuery(e).modal("hide").remove(),(r||jQuery.noop)()})}).modal({backdrop:!0}),void 0):(F2.log("F2.init() must be called before F2.UI.Modals.alert()"),void 0)},confirm:function(e,r,o){return F2.isInit()?(F2.Rpc.isRemote(t.instanceId)?F2.Rpc.call(t.instanceId,F2.Constants.Sockets.UI_RPC,"Modals.confirm",[].slice.call(arguments)):jQuery(n(e)).on("show",function(){var e=this;jQuery(e).find(".btn-ok").on("click",function(){jQuery(e).modal("hide").remove(),(r||jQuery.noop)()}),jQuery(e).find(".btn-cancel").on("click",function(){jQuery(e).modal("hide").remove(),(o||jQuery.noop)()})}).modal({backdrop:!0}),void 0):(F2.log("F2.init() must be called before F2.UI.Modals.confirm()"),void 0)}}}(),setTitle:function(e){F2.Rpc.isRemote(t.instanceId)?F2.Rpc.call(t.instanceId,F2.Constants.Sockets.UI_RPC,"setTitle",[e]):jQuery(t.root).find("."+F2.Constants.Css.APP_TITLE).text(e)},showMask:function(e,n){F2.UI.showMask(t.instanceId,e,n)},updateHeight:r,Views:function(){var e=new EventEmitter2,o=/change/i;e.setMaxListeners(0);var i=function(e){return o.test(e)?!0:(F2.log('"'+e+'" is not a valid F2.UI.Views event name'),!1)};return{change:function(o){"function"==typeof o?this.on("change",o):"string"==typeof o&&(t.isSecure&&!F2.Rpc.isRemote(t.instanceId)?F2.Rpc.call(t.instanceId,F2.Constants.Sockets.UI_RPC,"Views.change",[].slice.call(arguments)):F2.inArray(o,t.views)&&(jQuery("."+F2.Constants.Css.APP_VIEW,n).addClass("hide").filter('[data-f2-view="'+o+'"]',n).removeClass("hide"),r(),e.emit("change",o)))},off:function(t,n){i(t)&&e.off(t,n)},on:function(t,n){i(t)&&e.on(t,n)}}}()}};return t.hideMask=function(e,t){if(!F2.isInit())return F2.log("F2.init() must be called before F2.UI.hideMask()"),void 0;if(F2.Rpc.isRemote(e)&&!jQuery(t).is("."+F2.Constants.Css.APP))F2.Rpc.call(e,F2.Constants.Sockets.RPC,"F2.UI.hideMask",[e,jQuery(t).selector]);else{var n=jQuery(t);n.find("> ."+F2.Constants.Css.MASK).remove(),n.removeClass(F2.Constants.Css.MASK_CONTAINER),n.data(F2.Constants.Css.MASK_CONTAINER)&&n.css({position:"static"})}},t.init=function(t){e=t,e.UI=jQuery.extend(!0,{},F2.ContainerConfig.UI,e.UI||{})},t.showMask=function(t,n,r){if(!F2.isInit())return F2.log("F2.init() must be called before F2.UI.showMask()"),void 0;if(F2.Rpc.isRemote(t)&&jQuery(n).is("."+F2.Constants.Css.APP))F2.Rpc.call(t,F2.Constants.Sockets.RPC,"F2.UI.showMask",[t,jQuery(n).selector,r]);else{r&&!e.UI.Mask.loadingIcon&&F2.log("Unable to display loading icon. Please set F2.ContainerConfig.UI.Mask.loadingIcon when calling F2.init();");var o=jQuery(n).addClass(F2.Constants.Css.MASK_CONTAINER),i=jQuery("<div>").height("100%").width("100%").addClass(F2.Constants.Css.MASK);e.UI.Mask.useClasses||i.css({"background-color":e.UI.Mask.backgroundColor,"background-image":e.UI.Mask.loadingIcon?"url("+e.UI.Mask.loadingIcon+")":"","background-position":"50% 50%","background-repeat":"no-repeat",display:"block",left:0,"min-height":30,padding:0,position:"absolute",top:0,"z-index":e.UI.Mask.zIndex,filter:"alpha(opacity="+100*e.UI.Mask.opacity+")",opacity:e.UI.Mask.opacity}),"static"===o.css("position")&&(o.css({position:"relative"}),o.data(F2.Constants.Css.MASK_CONTAINER,!0)),o.append(i)}},t}()),F2.extend("",function(){var _apps={},_config=!1,_bUsesAppHandlers=!1,_sAppHandlerToken=F2.AppHandlers.__f2GetToken(),_afterAppRender=function(e,t){var n=_config.afterAppRender||function(e,t){return jQuery(t).appendTo("body")},r=n(e,t);return _config.afterAppRender&&!r?(F2.log("F2.ContainerConfig.afterAppRender() must return the DOM Element that contains the app"),void 0):(jQuery(r).addClass(F2.Constants.Css.APP),r.get(0))},_appRender=function(e,t){return t=_outerHtml(jQuery(t).addClass(F2.Constants.Css.APP_CONTAINER+" "+e.appId)),_config.appRender&&(t=_config.appRender(e,t)),_outerHtml(t)},_beforeAppRender=function(e){var t=_config.beforeAppRender||jQuery.noop;return t(e)},_createAppConfig=function(e){return e=jQuery.extend(!0,{},e),e.instanceId=e.instanceId||F2.guid(),e.views=e.views||[],F2.inArray(F2.Constants.Views.HOME,e.views)||e.views.push(F2.Constants.Views.HOME),e},_hydrateContainerConfig=function(e){e.scriptErrorTimeout||(e.scriptErrorTimeout=F2.ContainerConfig.scriptErrorTimeout),e.debugMode!==!0&&(e.debugMode=F2.ContainerConfig.debugMode)},_initAppEvents=function(e){jQuery(e.root).on("click","."+F2.Constants.Css.APP_VIEW_TRIGGER+"["+F2.Constants.Views.DATA_ATTRIBUTE+"]",function(t){t.preventDefault();var n=jQuery(this).attr(F2.Constants.Views.DATA_ATTRIBUTE).toLowerCase();n==F2.Constants.Views.REMOVE?F2.removeApp(e.instanceId):e.ui.Views.change(n)})},_initContainerEvents=function(){var e,t=function(){F2.Events.emit(F2.Constants.Events.CONTAINER_WIDTH_CHANGE)};jQuery(window).on("resize",function(){clearTimeout(e),e=setTimeout(t,100)})},_isInit=function(){return!!_config},_createAppInstance=function(e,t){e.ui=new F2.UI(e),void 0!==F2.Apps[e.appId]&&("function"==typeof F2.Apps[e.appId]?setTimeout(function(){_apps[e.instanceId].app=new F2.Apps[e.appId](e,t,e.root),void 0!==_apps[e.instanceId].app.init&&_apps[e.instanceId].app.init()},0):F2.log("app initialization class is defined but not a function. ("+e.appId+")"))},_loadApps=function(appConfigs,appManifest){if(appConfigs=[].concat(appConfigs),1==appConfigs.length&&appConfigs[0].isSecure&&!_config.isSecureAppPage)return _loadSecureApp(appConfigs[0],appManifest),void 0;if(appConfigs.length!=appManifest.apps.length)return F2.log("The number of apps defined in the AppManifest do not match the number requested.",appManifest),void 0;var scripts=appManifest.scripts||[],styles=appManifest.styles||[],inlines=appManifest.inlineScripts||[],scriptCount=scripts.length,scriptsLoaded=0,appInit=function(){jQuery.each(appConfigs,function(e,t){_createAppInstance(t,appManifest.apps[e])})},isFileReady=function(e){return!e||"loaded"==e||"complete"==e||"uninitialized"==e},_onload=function(e){if("load"==e.type||isFileReady((e.currentTarget||e.srcElement).readyState)){var t=e.currentTarget||e.srcElement;t.detachEvent?t.detachEvent("onreadystatechange",_onload):(removeEventListener(t,_onload,"load"),removeEventListener(t,_error,"error"))}++scriptsLoaded==scriptCount&&(evalInlines(),appInit())},_error=function(e){setTimeout(function(){var t={src:e.target.src,appId:appConfigs[0].appId};F2.log("Script defined in '"+t.appId+"' failed to load '"+t.src+"'"),F2.Events.emit("RESOURCE_FAILED_TO_LOAD",t)},_config.scriptErrorTimeout)},evalInlines=function(){jQuery.each(inlines,function(i,e){try{eval(e)}catch(exception){F2.log("Error loading inline script: "+exception+"\n\n"+e)}})},stylesFragment=null,useCreateStyleSheet=!!document.createStyleSheet;jQuery.each(styles,function(e,t){useCreateStyleSheet?document.createStyleSheet(t):(stylesFragment=stylesFragment||[],stylesFragment.push('<link rel="stylesheet" type="text/css" href="'+t+'"/>'))}),stylesFragment&&jQuery("head").append(stylesFragment.join("")),jQuery.each(appManifest.apps,function(e,t){if(_bUsesAppHandlers){F2.AppHandlers.__trigger(_sAppHandlerToken,F2.Constants.AppHandlers.APP_RENDER,appConfigs[e],_outerHtml(t.html));var n=appConfigs[e].appId;if(!appConfigs[e].root)throw"Root for "+n+" must be a native DOM element and cannot be null or undefined. Check your AppHandler callbacks to ensure you have set App root to a native DOM element.";var r=jQuery(appConfigs[e].root);if(0===r.parents("body:first").length)throw"App root for "+n+" was not appended to the DOM. Check your AppHandler callbacks to ensure you have rendered the app root to the DOM.";if(F2.AppHandlers.__trigger(_sAppHandlerToken,F2.Constants.AppHandlers.APP_RENDER_AFTER,appConfigs[e]),!F2.isNativeDOMNode(appConfigs[e].root))throw"App root for "+n+" must be a native DOM element. Check your AppHandler callbacks to ensure you have set app root to a native DOM element.";r.addClass(F2.Constants.Css.APP_CONTAINER+" "+n)}else appConfigs[e].root=_afterAppRender(appConfigs[e],_appRender(appConfigs[e],t.html));_initAppEvents(appConfigs[e])}),jQuery.each(scripts,function(e,t){var n=document,r=n.createElement("script"),o=t;_config.debugMode&&(o+="?cachebuster="+(new Date).getTime()),r.async=!1,r.src=o,r.type="text/javascript",r.charset="utf-8",!r.attachEvent||r.attachEvent.toString&&0>(""+r.attachEvent).indexOf("[native code")?(r.addEventListener("load",_onload,!1),r.addEventListener("error",_error,!1)):r.attachEvent("onreadystatechange",_onload),n.body.appendChild(r)}),scriptCount||(evalInlines(),appInit())},_loadSecureApp=function(e,t){if(_config.secureAppPagePath){if(_bUsesAppHandlers){var n=jQuery(e.root);if(F2.AppHandlers.__trigger(_sAppHandlerToken,F2.Constants.AppHandlers.APP_RENDER,e,t.html),0===n.parents("body:first").length)throw"App was never rendered on the page. Please check your AppHandler callbacks to ensure you have rendered the app root to the DOM.";if(F2.AppHandlers.__trigger(_sAppHandlerToken,F2.Constants.AppHandlers.APP_RENDER_AFTER,e),!e.root)throw"App Root must be a native dom node and can not be null or undefined. Please check your AppHandler callbacks to ensure you have set App Root to a native dom node.";if(!F2.isNativeDOMNode(e.root))throw"App Root must be a native dom node. Please check your AppHandler callbacks to ensure you have set App Root to a native dom node.";jQuery(e.root).addClass(F2.Constants.Css.APP_CONTAINER+" "+e.appId)}else e.root=_afterAppRender(e,_appRender(e,"<div></div>"));e.ui=new F2.UI(e),_initAppEvents(e),F2.Rpc.register(e,t)}else F2.log('Unable to load secure app: "secureAppPagePath" is not defined in F2.ContainerConfig.')},_outerHtml=function(e){return jQuery("<div></div>").append(e).html()},_validateApp=function(e){return e.appId?e.root||e.manifestUrl?!0:(F2.log('"manifestUrl" missing from app object'),!1):(F2.log('"appId" missing from app object'),!1)},_validateContainerConfig=function(){if(_config&&_config.xhr){if("function"!=typeof _config.xhr&&"object"!=typeof _config.xhr)throw"ContainerConfig.xhr should be a function or an object";if(_config.xhr.dataType&&"function"!=typeof _config.xhr.dataType)throw"ContainerConfig.xhr.dataType should be a function";if(_config.xhr.type&&"function"!=typeof _config.xhr.type)throw"ContainerConfig.xhr.type should be a function";if(_config.xhr.url&&"function"!=typeof _config.xhr.url)throw"ContainerConfig.xhr.url should be a function"}return!0};return{getContainerState:function(){return _isInit()?jQuery.map(_apps,function(e){return{appId:e.config.appId}}):(F2.log("F2.init() must be called before F2.getContainerState()"),void 0)},init:function(e){_config=e||{},_validateContainerConfig(),_hydrateContainerConfig(_config),_bUsesAppHandlers=!_config.beforeAppRender&&!_config.appRender&&!_config.afterAppRender,(_config.secureAppPagePath||_config.isSecureAppPage)&&F2.Rpc.init(_config.secureAppPagePath?_config.secureAppPagePath:!1),F2.UI.init(_config),_config.isSecureAppPage||_initContainerEvents()},isInit:_isInit,registerApps:function(e,t){if(!_isInit())return F2.log("F2.init() must be called before F2.registerApps()"),void 0;if(!e)return F2.log("At least one AppConfig must be passed when calling F2.registerApps()"),void 0;var n=[],r={},o={},i=!1;return e=[].concat(e),t=[].concat(t||[]),i=!!t.length,e.length?e.length&&i&&e.length!=t.length?(F2.log('The length of "apps" does not equal the length of "appManifests"'),void 0):(jQuery.each(e,function(e,o){if(o=_createAppConfig(o),o.root=o.root||null,_validateApp(o)){if(_apps[o.instanceId]={config:o},o.root){if(!o.root&&"string"!=typeof o.root&&!F2.isNativeDOMNode(o.root))throw F2.log("AppConfig invalid for pre-load, not a valid string and not dom node"),F2.log("AppConfig instance:",o),"Preloaded appConfig.root property must be a native dom node or a string representing a sizzle selector. Please check your inputs and try again.";if(1!=jQuery(o.root).length)throw F2.log("AppConfig invalid for pre-load, root not unique"),F2.log("AppConfig instance:",o),F2.log("Number of dom node instances:",jQuery(o.root).length),"Preloaded appConfig.root property must map to a unique dom node. Please check your inputs and try again.";return _createAppInstance(o),_initAppEvents(o),void 0}_bUsesAppHandlers?(F2.AppHandlers.__trigger(_sAppHandlerToken,F2.Constants.AppHandlers.APP_CREATE_ROOT,o),F2.AppHandlers.__trigger(_sAppHandlerToken,F2.Constants.AppHandlers.APP_RENDER_BEFORE,o)):o.root=_beforeAppRender(o),i?_loadApps(o,t[e]):o.enableBatchRequests&&!o.isSecure?(r[o.manifestUrl.toLowerCase()]=r[o.manifestUrl.toLowerCase()]||[],r[o.manifestUrl.toLowerCase()].push(o)):n.push({apps:[o],url:o.manifestUrl})}}),i||(jQuery.each(r,function(e,t){n.push({url:e,apps:t})}),jQuery.each(n,function(e,t){var n=F2.Constants.JSONP_CALLBACK+t.apps[0].appId;o[n]=o[n]||[],o[n].push(t)}),jQuery.each(o,function(e,t){var n=function(r,o){if(o){var i=o.url,a="GET",s="jsonp",c=function(){n(e,t.pop())},l=function(){jQuery.each(o.apps,function(e,t){F2.log("Removed failed "+t.name+" app",t),F2.removeApp(t.instanceId)})},u=function(e){_loadApps(o.apps,e)};if(_config.xhr&&_config.xhr.dataType&&(s=_config.xhr.dataType(o.url,o.apps),"string"!=typeof s))throw"ContainerConfig.xhr.dataType should return a string";if(_config.xhr&&_config.xhr.type&&(a=_config.xhr.type(o.url,o.apps),"string"!=typeof a))throw"ContainerConfig.xhr.type should return a string";if(_config.xhr&&_config.xhr.url&&(i=_config.xhr.url(o.url,o.apps),"string"!=typeof i))throw"ContainerConfig.xhr.url should return a string";var p=_config.xhr;"function"!=typeof p&&(p=function(e,t,n,i,c){jQuery.ajax({url:e,type:a,data:{params:F2.stringify(o.apps,F2.appConfigReplacer)},jsonp:!1,jsonpCallback:r,dataType:s,success:n,error:function(e,t,n){F2.log("Failed to load app(s)",""+n,o.apps),i()},complete:c})}),p(i,o.apps,u,l,c)}};n(e,t.pop())})),void 0):(F2.log("At least one AppConfig must be passed when calling F2.registerApps()"),void 0)},removeAllApps:function(){return _isInit()?(jQuery.each(_apps,function(e,t){F2.removeApp(t.config.instanceId)}),void 0):(F2.log("F2.init() must be called before F2.removeAllApps()"),void 0)},removeApp:function(e){return _isInit()?(_apps[e]&&(F2.AppHandlers.__trigger(_sAppHandlerToken,F2.Constants.AppHandlers.APP_DESTROY_BEFORE,_apps[e]),F2.AppHandlers.__trigger(_sAppHandlerToken,F2.Constants.AppHandlers.APP_DESTROY,_apps[e]),F2.AppHandlers.__trigger(_sAppHandlerToken,F2.Constants.AppHandlers.APP_DESTROY_AFTER,_apps[e]),delete _apps[e]),void 0):(F2.log("F2.init() must be called before F2.removeApp()"),void 0)}}}()),exports.F2=F2,"undefined"!=typeof define&&define.amd&&define(function(){return F2})}})("undefined"!=typeof exports?exports:window); |
docs/src/app/components/pages/components/IconMenu/ExampleSimple.js | w01fgang/material-ui | import React from 'react';
import IconMenu from 'material-ui/IconMenu';
import MenuItem from 'material-ui/MenuItem';
import IconButton from 'material-ui/IconButton';
import MoreVertIcon from 'material-ui/svg-icons/navigation/more-vert';
/**
* Simple Icon Menus demonstrating some of the layouts possible using the `anchorOrigin` and
* `targetOrigin` properties.
*/
const IconMenuExampleSimple = () => (
<div>
<IconMenu
iconButtonElement={<IconButton><MoreVertIcon /></IconButton>}
anchorOrigin={{horizontal: 'left', vertical: 'top'}}
targetOrigin={{horizontal: 'left', vertical: 'top'}}
>
<MenuItem primaryText="Refresh" />
<MenuItem primaryText="Send feedback" />
<MenuItem primaryText="Settings" />
<MenuItem primaryText="Help" />
<MenuItem primaryText="Sign out" />
</IconMenu>
<IconMenu
iconButtonElement={<IconButton><MoreVertIcon /></IconButton>}
anchorOrigin={{horizontal: 'left', vertical: 'bottom'}}
targetOrigin={{horizontal: 'left', vertical: 'bottom'}}
>
<MenuItem primaryText="Refresh" />
<MenuItem primaryText="Send feedback" />
<MenuItem primaryText="Settings" />
<MenuItem primaryText="Help" />
<MenuItem primaryText="Sign out" />
</IconMenu>
<IconMenu
iconButtonElement={<IconButton><MoreVertIcon /></IconButton>}
anchorOrigin={{horizontal: 'right', vertical: 'bottom'}}
targetOrigin={{horizontal: 'right', vertical: 'bottom'}}
>
<MenuItem primaryText="Refresh" />
<MenuItem primaryText="Send feedback" />
<MenuItem primaryText="Settings" />
<MenuItem primaryText="Help" />
<MenuItem primaryText="Sign out" />
</IconMenu>
<IconMenu
iconButtonElement={<IconButton><MoreVertIcon /></IconButton>}
anchorOrigin={{horizontal: 'right', vertical: 'top'}}
targetOrigin={{horizontal: 'right', vertical: 'top'}}
>
<MenuItem primaryText="Refresh" />
<MenuItem primaryText="Send feedback" />
<MenuItem primaryText="Settings" />
<MenuItem primaryText="Help" />
<MenuItem primaryText="Sign out" />
</IconMenu>
</div>
);
export default IconMenuExampleSimple;
|
src/js/components/app-component.js | dashukin/StyleMe | 'use strict';
import React from 'react';
import AppStore from '../stores/store';
import AppActions from '../actions/actions';
import StylesheetsComponent from './app-stylesheets-component';
import OptionsComponent from './app-options-component';
import FooterActionsComponent from './app-footer-actions-component';
import getMuiTheme from 'material-ui/styles/getMuiTheme';
import AppTheme from '../theme/app-theme.js';
import {Tabs, Tab} from 'material-ui/Tabs';
class AppComponent extends React.Component {
constructor (props) {
super(props);
// expecting configuration value to be an immutable object
this.state = {
configuration: null,
originalStyleSheets: [],
viewType: 'stylesheets'
};
}
getChildContext () {
return {
muiTheme: getMuiTheme(AppTheme)
}
}
componentWillMount () {
AppStore.addChangeListener(this.updateState);
}
componentDidMount () {
this.updateState();
}
render () {
let {state} = this;
let {configuration, viewType, originalStyleSheets} = state;
return (
<div>
<Tabs value={viewType}>
<Tab
label="CSS"
value="stylesheets"
onClick={this.handleTabClick.bind(this, 'stylesheets')}
>
<StylesheetsComponent configuration={configuration} originalStyleSheets={originalStyleSheets} />
</Tab>
<Tab label="Options" value="options" onClick={this.handleTabClick.bind(this, 'options')}>
<OptionsComponent configuration={configuration} />
</Tab>
</Tabs>
<FooterActionsComponent configuration={configuration} />
</div>
);
}
handleTabClick = (value, e) => {
this.setState({
viewType: value
});
}
updateState = () => {
let storeData = AppStore.getStoreData();
this.setState({
configuration: storeData.get('configuration'),
originalStyleSheets: storeData.get('originalStyleSheets')
});
}
addStylesheet = () => {
AppActions.addStylesheet();
}
}
AppComponent.childContextTypes = {
muiTheme: React.PropTypes.object
};
export default AppComponent; |
src/GreenNav.js | jrios6/GreenNav | import React, { Component } from 'react';
import ol from 'openlayers';
import { Toolbar, ToolbarGroup, ToolbarSeparator, ToolbarTitle } from 'material-ui/Toolbar';
import FlatButton from 'material-ui/FlatButton';
import { green50 } from 'material-ui/styles/colors';
import FontIcon from 'material-ui/FontIcon';
import Dialog from 'material-ui/Dialog';
import Snackbar from 'material-ui/Snackbar';
import Toggle from 'material-ui/Toggle';
import SelectField from 'material-ui/SelectField';
import MenuItem from 'material-ui/MenuItem';
import fetch from 'unfetch';
import Menu from './components/Menu';
import GreenNavMap from './components/GreenNavMap';
import { testCoordinatesValidity, getRangeAnxietyPolygonWithCoordinate } from './reachability';
const GreenNavServerAddress = 'http://localhost:8080/';
const styles = {
label: {
color: green50
},
unitSelectField: {
marginLeft: '24px'
}
};
export default class GreenNav extends Component {
constructor(props) {
super(props);
this.state = {
openInfoDialog: false,
openContactDialog: false,
openMapDialog: false,
openInvalidRouteSnackbar: false,
openAllowAccessSnackbar: false,
openIndicateStartSnackbar: false,
openRemainingRangeSnackbar: false,
mapType: 0,
unitsType: 0,
temperatureEnabled: false,
trafficEnabled: false,
windEnabled: false,
findingRoute: false,
userLocationCoordinates: undefined, // in EPSG:3857
rangePolygonOriginCoordinates: undefined, // in EPSG:3857
rangePolygonDestinationCoordinates: undefined, // in EPSG:3857
rangePolygonVisible: false,
locationPickerCoordinates: undefined, // in EPSG:3857
locationPickerCoordinatesTransformed: undefined, // in EPSG:4326
rangeFromField: '',
rangeFromFieldSelected: false,
rangeToField: '',
rangeToFieldSelected: false,
};
this.setLocationPickerCoordinates = this.setLocationPickerCoordinates.bind(this);
this.setUserLocationCoordinates = this.setUserLocationCoordinates.bind(this);
this.setRangePolygonAutocompleteOrigin = this.setRangePolygonAutocompleteOrigin.bind(this);
this.setRangePolygonAutocompleteDestination =
this.setRangePolygonAutocompleteDestination.bind(this);
}
setUserLocationCoordinates(coord) {
this.setState({ userLocationCoordinates: coord });
if (this.state.rangePolygonOriginCoordinates === undefined) {
this.setState({ rangePolygonOriginCoordinates: coord });
}
}
setRangePolygonAutocompleteOrigin(coord) {
const nCoord = ol.proj.transform(coord, 'EPSG:4326', 'EPSG:3857');
this.setState({
rangePolygonOriginCoordinates: nCoord,
locationPickerCoordinatesTransformed: coord
});
this.map.setAutocompleteLocationMarker(nCoord);
}
setRangePolygonAutocompleteDestination(coord) {
const nCoord = ol.proj.transform(coord, 'EPSG:4326', 'EPSG:3857');
this.setState({
rangePolygonDestinationCoordinates: nCoord,
locationPickerCoordinatesTransformed: coord
});
this.map.setAutocompleteLocationMarker(nCoord);
}
setLocationPickerCoordinates(coord) {
this.setState({ locationPickerCoordinates: coord });
const nCoord = ol.proj.transform(coord, 'EPSG:3857', 'EPSG:4326');
this.setState({ locationPickerCoordinatesTransformed: nCoord });
// update textfield with coordinate if selected
if (this.state.rangeFromFieldSelected) {
this.setState({
rangePolygonOriginCoordinates: coord,
rangeFromField: nCoord.map(i => i.toFixed(6)).join(', ') });
}
else if (this.state.rangeToFieldSelected) {
this.setState({
rangePolygonDestinationCoordinates: coord,
rangeToField: nCoord.map(i => i.toFixed(6)).join(', ')
});
}
}
getRoutes = (waypoints) => {
const routes = [];
let counterRoutes = 0;
if (waypoints.length > 0) {
this.showLoader();
}
for (let i = 0; i < waypoints.length - 1; i += 1) {
const startOsmId = waypoints[i];
const destinationOsmId = waypoints[i + 1];
const url = `${GreenNavServerAddress}astar/from/${startOsmId}/to/${destinationOsmId}`;
fetch(url)
.then((response) => {
if (response.status > 400) {
throw new Error('Failed to load route data!');
}
else {
return response.json();
}
})
.then((routeReceived) => {
// The array received from rt-library is actually from dest to orig,
// so we gotta reverse for now.
routes[i] = routeReceived.reverse();
counterRoutes += 1;
// We use counterRoutes instead of "i" because we don't know the order that
// routes will be received.
if (counterRoutes === waypoints.length - 1) {
let finalRoute = [];
for (let j = 0; j < routes.length; j += 1) {
finalRoute = finalRoute.concat(routes[j]);
}
this.hideLoader();
this.map.setRoute(routes[0]);
}
})
.catch(() => this.hideLoader());
}
}
getRangeVisualisation = (range) => {
const coord = this.state.rangePolygonOriginCoordinates;
if (!coord) {
this.handleAllowAccessSnackbarOpen();
}
else {
this.showLoader();
// test if origin coordinate has valid roads
testCoordinatesValidity(coord)
.then((res) => {
if (res) {
// gets vertices of range anxiety polygon
getRangeAnxietyPolygonWithCoordinate(coord, range)
.then((vertices) => {
this.hideLoader();
if (vertices !== false) {
this.map.setRangePolygon(vertices, coord);
this.setState({ rangePolygonVisible: true });
}
else {
this.handleInvalidRouteSnackbarOpen();
}
});
}
else {
this.hideLoader();
this.handleInvalidRouteSnackbarOpen();
}
});
}
}
hideRangeVisualisation = () => {
this.map.hideRangePolygon();
this.setState({ rangePolygonVisible: false });
}
toggleDrawer = () => {
this.drawer.toggle(this.updateMapSize);
}
updateMapSize = () => {
this.map.updateSize();
}
handleIndicateStartSnackbarOpen = () => {
this.setState({ openIndicateStartSnackbar: true });
}
handleIndicateStartSnackbarClose= () => {
this.setState({ openIndicateStartSnackbar: false });
}
handleRemainingRangeSnackbarOpen = () => {
this.setState({ openRemainingRangeSnackbar: true });
}
handleRemainingRangeSnackbarClose= () => {
this.setState({ openRemainingRangeSnackbar: false });
}
handleInvalidRouteSnackbarOpen = () => {
this.setState({ openInvalidRouteSnackbar: true });
}
handleInvalidRouteSnackbarClose = () => {
this.setState({ openInvalidRouteSnackbar: false });
}
handleAllowAccessSnackbarOpen = () => {
this.setState({ openAllowAccessSnackbar: true });
}
handleAllowAccessSnackbarClose = () => {
this.setState({ openAllowAccessSnackbar: false });
}
handleInfoOpen = () => {
this.setState({ openInfoDialog: true });
}
handleInfoClose = () => {
this.setState({ openInfoDialog: false });
}
handleContactOpen = () => {
this.setState({ openContactDialog: true });
}
handleContactClose = () => {
this.setState({ openContactDialog: false });
}
handleMapOpen = () => {
this.setState({ openMapDialog: true });
}
handleMapClose = () => {
this.setState({ openMapDialog: false });
}
mapTypeChange = (event, index, value) => {
this.setState({ mapType: value });
this.map.setMapType(value);
}
unitsTypeChange = (event, index, value) => {
this.drawer.convertUnits(value);
this.setState({ unitsType: value });
}
toggleTraffic = () => {
this.setState({ trafficEnabled: !this.state.trafficEnabled });
this.map.toggleTraffic();
}
toggleWind = () => {
this.setState({ windEnabled: !this.state.windEnabled });
this.map.toggleWind();
}
toggleTemperature = () => {
this.setState({ temperatureEnabled: !this.state.temperatureEnabled });
this.map.toggleTemperature();
}
showLoader = () => {
// show loader for requests that take more than 400ms to complete
this.searchTimeout = setTimeout(() => {
this.setState({ findingRoute: true });
}, 400);
}
hideLoader = () => {
clearTimeout(this.searchTimeout);
this.setState({ findingRoute: false });
}
updateRangeFromSelected = (e) => {
// selects rangeFromField and unselect rangeToField
this.setState({
rangeFromFieldSelected: e,
rangeToFieldSelected: !e
});
}
updateRangeToSelected = (e) => {
// selects rangeToField and unselects rangeFromField
this.setState({
rangeFromFieldSelected: !e,
rangeToFieldSelected: e
});
}
updateRangeFromField = (val) => {
this.setState({ rangeFromField: val });
const coord = this.isEPSG4326Coordinate(val);
if (coord) {
this.setState({
rangePolygonOriginCoordinates: ol.proj.transform(coord, 'EPSG:4326', 'EPSG:3857')
});
}
}
updateRangeToField = (val) => {
this.setState({ rangeToField: val });
const coord = this.isEPSG4326Coordinate(val);
if (coord) {
this.setState({
rangePolygonDestinationCoordinates: ol.proj.transform(coord, 'EPSG:4326', 'EPSG:3857')
});
}
}
isEPSG4326Coordinate = (val) => {
const valArray = val.replace(/\s+/g, '').split(',');
if (valArray.length === 2) {
const lng = parseFloat(valArray[0]);
const lat = parseFloat(valArray[1]);
// returns formatted coordinate if true
if (lng <= 180 && lng >= -180 && lat <= 45 && lat >= -45) {
return [lng, lat];
}
}
return false;
}
render() {
const infoActions = [
<FlatButton
label="Ok"
onTouchTap={this.handleInfoClose}
/>,
];
const contactActions = [
<FlatButton
label="Ok"
onTouchTap={this.handleContactClose}
/>,
];
const mapActions = [
<FlatButton
label="Finish"
onTouchTap={this.handleMapClose}
/>,
];
return (
<div style={{ display: 'flex', flexDirection: 'column', height: '100vh' }}>
<Toolbar>
<ToolbarGroup firstChild>
<FontIcon className="material-icons" onClick={this.toggleDrawer}>
menu</FontIcon>
<img alt="GreenNav" src="/images/logo-64.png" />
</ToolbarGroup>
<ToolbarGroup>
<ToolbarTitle text="Map Options" />
<FontIcon className="material-icons" onTouchTap={this.handleMapOpen}>
map</FontIcon>
<ToolbarSeparator />
<FlatButton
label="Info"
labelStyle={styles.label}
onTouchTap={this.handleInfoOpen}
icon={<FontIcon className="material-icons" color={green50}>info</FontIcon>}
/>
<FlatButton
label="Contact"
labelStyle={styles.label}
onTouchTap={this.handleContactOpen}
icon={<FontIcon className="material-icons" color={green50}>email</FontIcon>}
/>
</ToolbarGroup>
</Toolbar>
<div style={{ display: 'flex', flex: '1 0' }}>
<Menu
autoCompleteAddress={GreenNavServerAddress}
locationPickerCoordinates={this.state.locationPickerCoordinatesTransformed}
ref={c => (this.drawer = c)}
open
getRoutes={this.getRoutes}
unitsType={this.state.unitsType}
rangePolygonVisible={this.state.rangePolygonVisible}
getRangeVisualisation={this.getRangeVisualisation}
hideRangeVisualisation={this.hideRangeVisualisation}
updateRangeFromField={this.updateRangeFromField}
updateRangeFromSelected={this.updateRangeFromSelected}
rangeFromField={this.state.rangeFromField}
updateRangeToField={this.updateRangeToField}
updateRangeToSelected={this.updateRangeToSelected}
rangeToField={this.state.rangeToField}
setRangePolygonAutocompleteOrigin={this.setRangePolygonAutocompleteOrigin}
setRangePolygonAutocompleteDestination={this.setRangePolygonAutocompleteDestination}
handleIndicateStartSnackbarOpen={this.handleIndicateStartSnackbarOpen}
handleRemainingRangeSnackbarOpen={this.handleRemainingRangeSnackbarOpen}
/>
<GreenNavMap
ref={c => (this.map = c)}
mapType={this.state.mapType}
locationPickerCoordinates={this.state.locationPickerCoordinates}
locationPickerCoordinatesTransformed={this.state.locationPickerCoordinatesTransformed}
findingRoute={this.state.findingRoute}
userLocationCoordinates={this.state.userLocationCoordinates}
setLocationPickerCoordinates={this.setLocationPickerCoordinates}
setUserLocationCoordinates={this.setUserLocationCoordinates}
/>
</div>
<Snackbar
open={this.state.openIndicateStartSnackbar}
message="Please select a start and destination from the suggestions"
autoHideDuration={4000}
onRequestClose={this.handleIndicateStartSnackbarClose}
/>
<Snackbar
open={this.state.openRemainingRangeSnackbar}
message="Please indicate the remaining range of your vehicle"
autoHideDuration={4000}
onRequestClose={this.handleRemainingRangeSnackbarClose}
/>
<Snackbar
open={this.state.openInvalidRouteSnackbar}
message="No valid routes were found from your starting location"
autoHideDuration={4000}
onRequestClose={this.handleInvalidRouteSnackbarClose}
/>
<Snackbar
open={this.state.openAllowAccessSnackbar}
message="Please allow access to your current location or pick a starting location"
autoHideDuration={4000}
onRequestClose={this.handleAllowAccessSnackbarClose}
/>
<Dialog
title=""
actions={infoActions}
modal={false}
open={this.state.openInfoDialog}
onRequestClose={this.handleInfoClose}
>
<h2>Green Navigation</h2>
<p>The GreenNav organization is a community of young researchers and students at the
University of Lübeck.We decided not long ago to go open source in order to collaborate
with others and to show what we are working on.
</p>
<p>The projects of the GreenNav organization are closely related to the student projects
at the university’s computer science program. However, with this organisation we
invite everyone to participate in the development of experimental routing systems.
<br />
<a href="http://greennav.github.io/what-is-greennav.html">
Get more information about GreenNav
</a>
</p>
</Dialog>
<Dialog
title=""
actions={contactActions}
modal={false}
open={this.state.openContactDialog}
onRequestClose={this.handleContactClose}
>
<h2>Contact</h2>
<p>There are several ways to contact us. For questions about coding, issues, etc. please
use <a href="https://github.com/Greennav">Github</a>
</p>
<p>For more general questions use our <a href="https://plus.google.com/communities/110704433153909631379">G+ page</a> or <a href="https://groups.google.com/forum/#!forum/greennav">Google Groups</a></p>
</Dialog>
<Dialog
title="Map Settings"
actions={mapActions}
modal={false}
open={this.state.openMapDialog}
onRequestClose={this.handleMapClose}
>
<SelectField
floatingLabelText="Map Type"
value={this.state.mapType}
onChange={this.mapTypeChange}
>
<MenuItem value={0} primaryText="OpenStreetMap" />
<MenuItem value={1} primaryText="Google Map" />
</SelectField>
<SelectField
floatingLabelText="Units"
value={this.state.unitsType}
style={styles.unitSelectField}
onChange={this.unitsTypeChange}
>
<MenuItem value={0} primaryText="Kilometers" />
<MenuItem value={1} primaryText="Miles" />
</SelectField>
<h2>Overlays</h2>
<Toggle
label="Traffic"
toggled={this.state.trafficEnabled}
onToggle={this.toggleTraffic}
labelPosition="right"
thumbSwitchedStyle={styles.thumbSwitched}
trackSwitchedStyle={styles.trackSwitched}
/>
<Toggle
label="Temperature"
toggled={this.state.temperatureEnabled}
onToggle={this.toggleTemperature}
labelPosition="right"
thumbSwitchedStyle={styles.thumbSwitched}
trackSwitchedStyle={styles.trackSwitched}
/>
<Toggle
label="Wind"
toggled={this.state.windEnabled}
onToggle={this.toggleWind}
labelPosition="right"
thumbSwitchedStyle={styles.thumbSwitched}
trackSwitchedStyle={styles.trackSwitched}
/>
</Dialog>
</div>
);
}
}
|
src/svg-icons/action/speaker-notes.js | spiermar/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let ActionSpeakerNotes = (props) => (
<SvgIcon {...props}>
<path d="M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zM8 14H6v-2h2v2zm0-3H6V9h2v2zm0-3H6V6h2v2zm7 6h-5v-2h5v2zm3-3h-8V9h8v2zm0-3h-8V6h8v2z"/>
</SvgIcon>
);
ActionSpeakerNotes = pure(ActionSpeakerNotes);
ActionSpeakerNotes.displayName = 'ActionSpeakerNotes';
ActionSpeakerNotes.muiName = 'SvgIcon';
export default ActionSpeakerNotes;
|
components/DiscussionSection.js | concensus/react-native-ios-concensus | import React, { Component } from 'react';
import {
StyleSheet,
Text,
TextInput,
View,
ListView,
KeyboardAvoidingView,
Keyboard,
} from 'react-native';
import DiscussionPost from './DiscussionPost';
import { firebase, newComment } from '../api/firebase';
export default class DiscussionSection extends Component {
constructor(props) {
super(props);
this.state = {
discussions: [],
keyboardOpen: false,
};
}
componentWillMount() {
this.keyboardDidShowListener = Keyboard.addListener(
'keyboardDidShow',
this._keyboardDidShow.bind(this)
);
this.keyboardDidHideListener = Keyboard.addListener(
'keyboardDidHide',
this._keyboardDidHide.bind(this)
);
}
componentWillUnmount() {
this.keyboardDidShowListener.remove();
this.keyboardDidHideListener.remove();
}
componentDidMount() {
this.getDiscussion();
}
_keyboardDidShow() {
this.setState({ keyboardOpen: true });
}
_keyboardDidHide() {
this.setState({ keyboardOpen: false });
}
getDiscussion() {
var id = this.props.pollID;
let discussionRef = firebase.database().ref(`polls/${id}/discussions`);
discussionRef.on('value', snapshot => {
var discussionsSlice = [];
snapshot.forEach(child => {
discussionsSlice.push({
...child.val(),
});
});
this.setState({ discussions: discussionsSlice });
});
}
renderComments() {
let inputContent = null;
if (this.props.showEntry) {
inputContent = <DiscussionInput style={{ flexBasis: '10%' }} {...this.props} />;
}
if (this.state.discussions.length === 0) {
return (
<KeyboardAvoidingView behavior="padding">
<Text>No Comments</Text>
<View style={{ height: this.state.keyboardOpen ? 100 : 0 }} />
{inputContent}
</KeyboardAvoidingView>
);
} else {
const ds = new ListView.DataSource({ rowHasChanged: (r1, r2) => r1 !== r2 });
return (
<KeyboardAvoidingView
behavior="padding"
style={{ flex: 1, flexDirection: 'column', justifyContent: 'flex-start' }}>
<ListView
style={{ flexBasis: this.state.keyboardOpen ? '20%' : '80%' }}
dataSource={ds.cloneWithRows(this.state.discussions)}
renderRow={post => <DiscussionPost post={post} />}
/>
{inputContent}
</KeyboardAvoidingView>
);
}
}
render() {
return (
<View style={styles.container}>
<Text style={styles.heading}>Discourse</Text>
{this.renderComments()}
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
},
heading: {
fontSize: 25,
fontFamily: 'Baskerville',
marginBottom: 10,
},
});
class DiscussionInput extends React.Component {
constructor(props) {
super(props);
this.state = {
text: '',
};
}
onPostPress() {
if (this.state.text === '') {
return;
}
newComment(this.props.pollID, {
author: this.props.userID || 'Anonymous',
body: this.state.text,
});
this.setState({
text: '',
});
}
render() {
const inputHeight = 40;
return (
<View
style={{
...this.props.style,
flex: 1,
height: inputHeight,
marginTop: 10,
flexDirection: 'row',
borderColor: '#AAA',
borderTopWidth: 1,
paddingTop: 15,
}}>
<TextInput
style={{
flex: 1,
height: inputHeight,
padding: 3,
borderColor: 'gray',
backgroundColor: '#FFF',
borderWidth: 1,
}}
onChangeText={text => this.setState({ text })}
onSubmitEditing={this.onPostPress.bind(this)}
returnKeyLabel="send"
value={this.state.text}
/>
</View>
);
}
}
|